@stacksjs/stx 0.2.169 → 0.2.171

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/craft.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // @bun
2
- var cq=Object.defineProperty;var pq=(X)=>X;function iq(X,$){this[X]=pq.bind(null,$)}var t=(X,$)=>{for(var Z in $)cq(X,Z,{get:$[Z],enumerable:!0,configurable:!0,set:iq.bind($,Z)})};var D=(X,$)=>()=>(X&&($=X(X=0)),$);var X0=import.meta.require;function F2(X,$,Z,Y){let J=X;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,w,q)=>{let 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"}[w]||"Make this element accessible";return`<!-- a11y-hint: ${q||K} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(G,(Q,w)=>{return`<span class="sr-only">${w.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,w,q)=>{return`<span id="${`desc-${w}`}" class="sr-only">${q}</span>`}),J}var V2,A2;var L$=D(()=>{V2={name:"a11y",handler:(X,$,Z,Y)=>{if(!$.length)return X;let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"",w={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${G||w} -->${X}`},hasEndTag:!1},A2={name:"screenReader",handler:(X)=>{return`<span class="sr-only">${X}</span>`},hasEndTag:!0}});function iW(X,$={}){let{duration:Z,delay:Y,ease:J,direction:G,custom:Q}={...B1,...$};if(X==="custom"&&Q)return Q;switch(X){case"fade":return`${G==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="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 $W=Object.defineProperty;var ZW=(X)=>X;function YW(X,$){this[X]=ZW.bind(null,$)}var t=(X,$)=>{for(var Z in $)$W(X,Z,{get:$[Z],enumerable:!0,configurable:!0,set:YW.bind($,Z)})};var D=(X,$)=>()=>(X&&($=X(X=0)),$);var X0=import.meta.require;function k2(X,$,Z,Y){let J=X;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,w,q)=>{let U={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[w]||"Make this element accessible";return`<!-- a11y-hint: ${q||U} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(G,(Q,w)=>{return`<span class="sr-only">${w.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,w,q)=>{return`<span id="${`desc-${w}`}" class="sr-only">${q}</span>`}),J}var I2,E2;var L$=D(()=>{I2={name:"a11y",handler:(X,$,Z,Y)=>{if(!$.length)return X;let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"",w={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${G||w} -->${X}`},hasEndTag:!1},E2={name:"screenReader",handler:(X)=>{return`<span class="sr-only">${X}</span>`},hasEndTag:!0}});function YU(X,$={}){let{duration:Z,delay:Y,ease:J,direction:G,custom:Q}={..._1,...$};if(X==="custom"&&Q)return Q;switch(X){case"fade":return`${G==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="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`${G==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="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 cq=Object.defineProperty;var pq=(X)=>X;function iq(X,$){this[X]=pq.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`${G==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="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 nW(){return`
12
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function JU(){return`
13
13
  <script data-stx-scoped data-stx-run="once">
14
14
  // Motion preferences handling
15
15
  (function() {
@@ -37,7 +37,7 @@ else {
37
37
  });
38
38
  })();
39
39
  </script>
40
- `}function rW(X){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((Z)=>Z.test(X))}function sW(X=0.1,$="0px"){return`
40
+ `}function GU(X){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((Z)=>Z.test(X))}function QU(X=0.1,$="0px"){return`
41
41
  <script data-stx-scoped data-stx-run="always">
42
42
  // Intersection Observer for scroll animations
43
43
  (function() {
@@ -80,7 +80,7 @@ else {
80
80
  }
81
81
  })();
82
82
  </script>
83
- `}function oW(){return`
83
+ `}function wU(){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 aW(X,$,Z={}){let{staggerDelay:Y=50,sequence:J=!1}=Z;return`
198
+ `}function qU(X,$,Z={}){let{staggerDelay:Y=50,sequence:J=!1}=Z;return`
199
199
  <script data-stx-scoped data-stx-run="always">
200
200
  // Animation Group: ${X}
201
201
  (function() {
@@ -232,13 +232,13 @@ else {
232
232
  }
233
233
  })();
234
234
  </script>
235
- `}function k2(X,$,Z,Y){let J=X;if(Y.animation?.enabled===!1)return J;let G=Z.includes("test")&&Z.includes("animation");if(!rW(J)&&!G)return J;if(!J.includes('<style id="stx-animation-base">')){let w=oW();J=J.replace("</head>",`${w}
236
- </head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let q=sW(),W=J.lastIndexOf("</body>");if(W!==-1)J=J.slice(0,W)+q+`
237
- `+J.slice(W)}}return J}var B1,R2,T2,M2,N2;var O$=D(()=>{B1={duration:300,delay:0,ease:"ease",direction:"both"};R2={name:"transition",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||B1.duration:B1.duration,Q=$.length>2?$[2]||B1.ease:B1.ease,w=$.length>3?Number.parseInt($[3],10)||B1.delay:B1.delay,q=$.length>4?$[4]||B1.direction:B1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,K=iW(J,{duration:G,delay:w,ease:Q,direction:q}),U="stx-transition",z="";if(J==="fade")z="stx-fade";else if(J==="slide")z="stx-slide";else if(J==="scale")z="stx-scale";else if(J==="flip")z="stx-flip";else if(J==="rotate")z="stx-rotate";return`<div id="${W}" class="${U} ${z} ${q==="out"?"stx-out":""}"
238
- style="--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${w}ms;">${X}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},T2={name:"scrollAnimate",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||300:300,Q=$.length>2?$[2]||"ease":"ease",w=$.length>3?Number.parseFloat($[3])||0.2:0.2,q=$.length>4?Number.parseInt($[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,K=`--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(J==="fade")U+=" stx-fade";else if(J==="slide-up"||J==="slide")U+=" stx-from-bottom";else if(J==="slide-down")U+=" stx-from-top";else if(J==="slide-left")U+=" stx-from-right";else if(J==="slide-right")U+=" stx-from-left";else if(J==="scale")U+=" stx-scale";else if(J.includes("-"))U+=` stx-${J}`;else U+=` stx-${J}`;return`<div id="${W}" class="${U}" style="${K}" data-threshold="${w}">${X}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},M2={name:"animationGroup",handler:(X,$,Z,Y)=>{if($.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${X}`;let J=$[0],G=$.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),Q=Z.staggerDelay||50,w=Z.sequence||!0,q=aW(J,G,{staggerDelay:Q,sequence:w});return`${X}
239
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},N2={name:"motion",handler:(X,$,Z,Y)=>{let J=$.length>0?$[0].toLowerCase()==="true":!0,G=nW();return`<div data-animate="${J?"auto":"true"}">${X}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function F$(X){return X.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>W7.includes(Z))}function K7(X){return F$(X.replace(/^\//,""))}var W7;var qX=D(()=>{W7=["components","layouts","partials"]});import A5 from"fs";import U7 from"path";function z7(X,$){let Z=X.filter((Q)=>!K7(Q.pattern)),Y=["// Auto-generated by STX - do not edit"];if(Z.length===0)Y.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{Y.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let Q of Z){let w=[];for(let W of Q.params){let K=Q.pattern.includes(`:${W}?`)?"?":"";w.push(`${W}${K}: string`)}let q=w.join("; ");Y.push(` '${Q.pattern}': { ${q} }`)}Y.push(" }","}","","export {}","")}let J=Y.join(`
240
- `),G=U7.join($,"route-types.d.ts");try{if(A5.existsSync(G)&&A5.readFileSync(G,"utf8")===J)return;A5.mkdirSync($,{recursive:!0}),A5.writeFileSync(G,J)}catch{}}function _7(X,$,Z){let Y=process.cwd(),J=U7.relative(Y,Z),G=X.filter((w)=>!K7(w.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${J||"pages"}/`,"","export const routes = ["];for(let w of G){let q=U7.relative(Y,w.filePath).replace(/\\/g,"/"),W=JSON.stringify(w.params),K=w.layout?`, layout: '${U7.relative(Y,w.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${w.pattern}', filePath: '${q}', isDynamic: ${w.isDynamic}, params: ${W}${K} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),A5.mkdirSync($,{recursive:!0}),A5.writeFileSync(U7.join($,"routes.ts"),Q.join(`
241
- `))}var V$=D(()=>{qX()});import I2 from"path";function WX(X,$){let Y=I2.relative($,X).replace(/\.(stx|md)$/,"");if(Y=Y.split(I2.sep).join("/"),Y==="index")return"/";if(Y.endsWith("/index"))Y=Y.slice(0,-6);return Y=Y.replace(/\[\[([^\]]+)\]\]/g,":$1?"),Y=Y.replace(/\[([^\]]+)\]/g,":$1"),Y=Y.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${Y}`}function B7(X){let $=[],Z="",Y=0;while(Y<X.length){let J=X.slice(Y),G=/^\/:([^/?*]+)\?/.exec(J);if(G){$.push(G[1]),Z+="(?:/([^/]+))?",Y+=G[0].length;continue}let Q=/^:([^/?*]+)\*/.exec(J);if(Q){$.push(Q[1]),Z+="(.+)",Y+=Q[0].length;continue}let w=/^:([^/?*]+)/.exec(J);if(w){$.push(w[1]),Z+="([^/]+)",Y+=w[0].length;continue}Z+=X[Y].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),Y+=1}return{regex:new RegExp(`^${Z}$`),params:$}}function KX(X,$){let Z=X===""?"/":X;for(let Y of $){let J=Z.match(Y.regex);if(J){let G={};return Y.params.forEach((Q,w)=>{G[Q]=J[w+1]}),{route:Y,params:G}}}return null}function E2(X){let $=X.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return B7($)}var A$=()=>{};import tW from"fs";import R$ from"path";function UX(X,$){let Z=[],Y=R$.dirname(X);while(Y.startsWith($)||Y===$){let J=R$.join(Y,"_layout.stx");if(tW.existsSync(J))Z.unshift(J);if(Y===$)break;Y=R$.dirname(Y)}return Z}var T$=()=>{};import M$ from"fs";import R5 from"path";function D2(X,$){let Z=[];if(!M$.existsSync(X))return Z;let Y=M$.readdirSync(X,{withFileTypes:!0});for(let J of Y){let G=R5.join(X,J.name);if(J.isDirectory()){if(J.name.startsWith("."))continue;if(W7.includes(J.name))continue;Z.push(...D2(G,$))}else if(J.isFile()){let Q=R5.extname(J.name);if($.includes(Q)){if(J.name.startsWith("_")&&J.name!=="_layout.stx")continue;if(J.name==="_layout.stx")continue;Z.push(G)}}}return Z}class T5{routes;pagesDir;pagesDirs;config;constructor(X,$={}){this.config=$;let Z=$.pagesDirs&&$.pagesDirs.length>0?$.pagesDirs:[$.pagesDir||"pages"];this.pagesDirs=Z.map((Q)=>R5.resolve(X,Q)),this.pagesDir=this.pagesDirs[0];let Y=$.extensions||[".stx"],J=new Set;this.routes=[];for(let Q of this.pagesDirs){let w=D2(Q,Y);for(let q of w){let W=WX(q,Q);if(J.has(W))continue;J.add(W);let{regex:K,params:U}=B7(W),z=$.layouts!==!1?UX(q,Q):[];this.routes.push({pattern:W,regex:K,params:U,filePath:q,isDynamic:U.length>0,layout:z.length>0?z[z.length-1]:void 0})}}this.routes.sort((Q,w)=>{if(!Q.isDynamic&&w.isDynamic)return-1;if(Q.isDynamic&&!w.isDynamic)return 1;let q=Q.pattern.split("/").length,W=w.pattern.split("/").length;if(q!==W)return W-q;return Q.pattern.localeCompare(w.pattern)});let G=R5.resolve(X,$.stateDir||process.env.STX_DIR?.trim()||".stx");z7(this.routes,G),_7(this.routes,G,this.pagesDir)}match(X){let $=X===""?"/":X;for(let Z of this.routes){let Y=$.match(Z.regex);if(Y){let J={};return Z.params.forEach((G,Q)=>{J[G]=Y[Q+1]}),{route:Z,params:J}}}return null}resolve(X,$){let Z=this.routes.find((J)=>J.pattern===X||J.filePath.includes(X));if(!Z)return"#not-found";let Y=Z.pattern;if($)for(let[J,G]of Object.entries($))Y=Y.replace(`:${J}`,encodeURIComponent(G));return Y}addRoute(X){this.routes.push(X),this.routes.sort(($,Z)=>{if(!$.isDynamic&&Z.isDynamic)return-1;if($.isDynamic&&!Z.isDynamic)return 1;return $.pattern.localeCompare(Z.pattern)})}getLayout(X){return X.layout??null}}function y2(X,$){return new T5(X,$)}function N$(X,$){let Z=[`${$}.stx`,"error.stx"];for(let Y of Z){let J=R5.join(X,Y);if(M$.existsSync(J))return J}return null}function k$(X,$){return X.map((Z)=>{let Y=R5.relative($,Z.filePath),J=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${Y}${J}`})}var b2=D(()=>{V$();A$();T$();qX()});function I$(X){zX=X.replace(/\/$/,"")}function E$(X,$,Z={}){M5[X]={path:$,name:X,params:Z}}function D$(X){for(let[$,Z]of Object.entries(X))if(typeof Z==="string")M5[$]={path:Z,name:$};else M5[$]={...Z,name:$}}function j7(X,$={},Z=!1){let Y=M5[X];if(!Y)return console.warn(`Route [${X}] not defined.`),"#undefined-route";let J={...Y.params,...$},G=Y.path;G=G.replace(/:(\w+)/g,(w,q)=>{let W=J[q];if(W===void 0)return console.warn(`Missing parameter [${q}] for route [${X}].`),`:${q}`;return delete J[q],encodeURIComponent(String(W))});let Q=Object.entries(J);if(Q.length>0){let w=Q.map(([q,W])=>`${encodeURIComponent(q)}=${encodeURIComponent(String(W))}`).join("&");G+=(G.includes("?")?"&":"?")+w}return Z&&zX?`${zX}${G}`:G}function y$(){for(let X of Object.keys(M5))delete M5[X];zX=""}var M5,zX="";var S2=D(()=>{M5={}});import C2 from"fs";import P2 from"path";function v2(X,$={}){return{type:"redirect",path:X,options:{replace:$.replace??!1,external:$.external??!1,redirectCode:$.redirectCode??302}}}function x2(X){return{type:"abort",error:typeof X==="string"?{statusCode:500,message:X}:X}}function f2(X,$={}){return{handler:X,mode:$.mode??"universal"}}function b$(X){let $={};if(!X)return $;let Z=X.split(";");for(let Y of Z){let[J,...G]=Y.split("=");if(J){let Q=J.trim(),w=G.join("=").trim();if(Q)$[Q]=decodeURIComponent(w)}}return $}function _X(X,$,Z={}){let Y=`${encodeURIComponent(X)}=${encodeURIComponent($)}`;if(Z.expires){let J=typeof Z.expires==="number"?new Date(Date.now()+Z.expires*1000):Z.expires;Y+=`; Expires=${J.toUTCString()}`}if(Z.path)Y+=`; Path=${Z.path}`;if(Z.domain)Y+=`; Domain=${Z.domain}`;if(Z.secure)Y+="; Secure";if(Z.httpOnly)Y+="; HttpOnly";if(Z.sameSite)Y+=`; SameSite=${Z.sameSite}`;return Y}function S$(X,$){let Z=X.headers.get("cookie")||"",Y=b$(Z);return{get(J){return Y[J]},set(J,G,Q={}){Y[J]=G,$.append("Set-Cookie",_X(J,G,Q))},delete(J){delete Y[J],$.append("Set-Cookie",_X(J,"",{expires:new Date(0),path:"/"}))},getAll(){return{...Y}}}}function C$(){return{get(X){if(typeof document>"u")return;return b$(document.cookie)[X]},set(X,$,Z={}){if(typeof document>"u")return;document.cookie=_X(X,$,Z)},delete(X){if(typeof document>"u")return;document.cookie=_X(X,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return b$(document.cookie)}}}function P$(){let X=typeof window<"u"&&typeof window.localStorage<"u";return{get($){if(!X)return null;try{return window.localStorage.getItem($)}catch{return null}},set($,Z){if(!X)return;try{window.localStorage.setItem($,Z)}catch{}},remove($){if(!X)return;try{window.localStorage.removeItem($)}catch{}},isAvailable(){return X}}}function BX(X,$){H7.set(X,$)}function v$(X){return H7.get(X)}function g2(X){return H7.has(X)}function h2(){H7.clear()}function u2(){return Array.from(H7.keys())}async function d2(X,$="middleware"){let Z=P2.resolve(X,$);if(!C2.existsSync(Z))return;let Y=C2.readdirSync(Z);for(let J of Y){if(!J.endsWith(".ts")&&!J.endsWith(".js"))continue;if(J.includes(".test.")||J.includes(".spec."))continue;let G=J.replace(/\.(ts|js)$/,""),Q=P2.join(Z,J);try{let q=(await import(Q)).default;if(q&&typeof q.handler==="function")BX(G,q);else if(typeof q==="function")BX(G,{handler:q,mode:"universal"})}catch(w){console.warn(`Failed to load middleware '${G}' from ${Q}:`,w)}}}function eW(X){let $={};if(!X)return $;let Z=new URLSearchParams(X);for(let[Y,J]of Z)$[Y]=J;return $}function m2(X,$,Z,Y=""){return{path:X,params:$,query:eW(Y),fullPath:Y?`${X}?${Y}`:X,meta:Z}}function l2(X,$,Z,Y){let J=Y?.isServer??typeof window>"u",G=!J,Q=new Headers;return{to:X,from:$,isClient:G,isServer:J,cookies:J&&Z?S$(Z,Q):C$(),storage:P$(),state:{},request:Z,responseHeaders:Q}}async function c2(X,$){let Z=Array.isArray(X)?X:[X],Y=$.isServer;for(let J of Z){let G=v$(J);if(!G)return console.error(`Route middleware '${J}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${J}' is not registered`}},state:$.state,responseHeaders:$.responseHeaders};if(G.mode==="server"&&!Y)continue;try{let Q=await G.handler($);if(Q){if(Q.type==="redirect")return{passed:!1,redirect:Q,state:$.state,responseHeaders:$.responseHeaders};if(Q.type==="abort")return{passed:!1,abort:Q,state:$.state,responseHeaders:$.responseHeaders}}}catch(Q){return console.error(`Error in middleware '${J}':`,Q),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:Q instanceof Error?Q.message:"Middleware error"}},state:$.state,responseHeaders:$.responseHeaders}}}return{passed:!0,state:$.state,responseHeaders:$.responseHeaders}}var H7;var p2=D(()=>{H7=new Map});function L7(X){let Z=X.replace(/\\/g,"/").split("/").filter(Boolean),Y=Z.lastIndexOf("layouts"),J=Y>=0?Z[Y+1]:Z.at(-1);if(!J)return"app";return J.replace(/\.stx$/i,"")||"app"}function i2(X){let $=X.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),Z=X.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),Y=X.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),J=$?.[1]||Y?.[1]||"";return{layout:J,group:Z?.[1]||L7(J)}}function XK(X){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return X}}function O7(){if(jX)return jX;return jX=XK(`
235
+ `}function C2(X,$,Z,Y){let J=X;if(Y.animation?.enabled===!1)return J;let G=Z.includes("test")&&Z.includes("animation");if(!GU(J)&&!G)return J;if(!J.includes('<style id="stx-animation-base">')){let w=wU();J=J.replace("</head>",`${w}
236
+ </head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let q=QU(),W=J.lastIndexOf("</body>");if(W!==-1)J=J.slice(0,W)+q+`
237
+ `+J.slice(W)}}return J}var _1,D2,y2,b2,S2;var O$=D(()=>{_1={duration:300,delay:0,ease:"ease",direction:"both"};D2={name:"transition",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||_1.duration:_1.duration,Q=$.length>2?$[2]||_1.ease:_1.ease,w=$.length>3?Number.parseInt($[3],10)||_1.delay:_1.delay,q=$.length>4?$[4]||_1.direction:_1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=YU(J,{duration:G,delay:w,ease:Q,direction:q}),K="stx-transition",z="";if(J==="fade")z="stx-fade";else if(J==="slide")z="stx-slide";else if(J==="scale")z="stx-scale";else if(J==="flip")z="stx-flip";else if(J==="rotate")z="stx-rotate";return`<div id="${W}" class="${K} ${z} ${q==="out"?"stx-out":""}"
238
+ style="--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${w}ms;">${X}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},y2={name:"scrollAnimate",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||300:300,Q=$.length>2?$[2]||"ease":"ease",w=$.length>3?Number.parseFloat($[3])||0.2:0.2,q=$.length>4?Number.parseInt($[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,K="stx-transition stx-observe stx-out";if(J==="fade")K+=" stx-fade";else if(J==="slide-up"||J==="slide")K+=" stx-from-bottom";else if(J==="slide-down")K+=" stx-from-top";else if(J==="slide-left")K+=" stx-from-right";else if(J==="slide-right")K+=" stx-from-left";else if(J==="scale")K+=" stx-scale";else if(J.includes("-"))K+=` stx-${J}`;else K+=` stx-${J}`;return`<div id="${W}" class="${K}" style="${U}" data-threshold="${w}">${X}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},b2={name:"animationGroup",handler:(X,$,Z,Y)=>{if($.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${X}`;let J=$[0],G=$.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),Q=Z.staggerDelay||50,w=Z.sequence||!0,q=qU(J,G,{staggerDelay:Q,sequence:w});return`${X}
239
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},S2={name:"motion",handler:(X,$,Z,Y)=>{let J=$.length>0?$[0].toLowerCase()==="true":!0,G=JU();return`<div data-animate="${J?"auto":"true"}">${X}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function F$(X){return X.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>U7.includes(Z))}function K7(X){return F$(X.replace(/^\//,""))}var U7;var WX=D(()=>{U7=["components","layouts","partials","emails"]});import R5 from"fs";import z7 from"path";function _7(X,$){let Z=X.filter((Q)=>!K7(Q.pattern)),Y=["// Auto-generated by STX - do not edit"];if(Z.length===0)Y.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{Y.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let Q of Z){let w=[];for(let W of Q.params){let U=Q.pattern.includes(`:${W}?`)?"?":"";w.push(`${W}${U}: string`)}let q=w.join("; ");Y.push(` '${Q.pattern}': { ${q} }`)}Y.push(" }","}","","export {}","")}let J=Y.join(`
240
+ `),G=z7.join($,"route-types.d.ts");try{if(R5.existsSync(G)&&R5.readFileSync(G,"utf8")===J)return;R5.mkdirSync($,{recursive:!0}),R5.writeFileSync(G,J)}catch{}}function B7(X,$,Z){let Y=process.cwd(),J=z7.relative(Y,Z),G=X.filter((w)=>!K7(w.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${J||"pages"}/`,"","export const routes = ["];for(let w of G){let q=z7.relative(Y,w.filePath).replace(/\\/g,"/"),W=JSON.stringify(w.params),U=w.layout?`, layout: '${z7.relative(Y,w.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${w.pattern}', filePath: '${q}', isDynamic: ${w.isDynamic}, params: ${W}${U} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),R5.mkdirSync($,{recursive:!0}),R5.writeFileSync(z7.join($,"routes.ts"),Q.join(`
241
+ `))}var V$=D(()=>{WX()});import P2 from"path";function UX(X,$){let Y=P2.relative($,X).replace(/\.(stx|md)$/,"");if(Y=Y.split(P2.sep).join("/"),Y==="index")return"/";if(Y.endsWith("/index"))Y=Y.slice(0,-6);return Y=Y.replace(/\[\[([^\]]+)\]\]/g,":$1?"),Y=Y.replace(/\[([^\]]+)\]/g,":$1"),Y=Y.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${Y}`}function j7(X){let $=[],Z="",Y=0;while(Y<X.length){let J=X.slice(Y),G=/^\/:([^/?*]+)\?/.exec(J);if(G){$.push(G[1]),Z+="(?:/([^/]+))?",Y+=G[0].length;continue}let Q=/^:([^/?*]+)\*/.exec(J);if(Q){$.push(Q[1]),Z+="(.+)",Y+=Q[0].length;continue}let w=/^:([^/?*]+)/.exec(J);if(w){$.push(w[1]),Z+="([^/]+)",Y+=w[0].length;continue}Z+=X[Y].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),Y+=1}return{regex:new RegExp(`^${Z}$`),params:$}}function KX(X,$){let Z=X===""?"/":X;for(let Y of $){let J=Z.match(Y.regex);if(J){let G={};return Y.params.forEach((Q,w)=>{G[Q]=J[w+1]}),{route:Y,params:G}}}return null}function v2(X){let $=X.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return j7($)}var A$=()=>{};import WU from"fs";import R$ from"path";function zX(X,$){let Z=[],Y=R$.dirname(X);while(Y.startsWith($)||Y===$){let J=R$.join(Y,"_layout.stx");if(WU.existsSync(J))Z.unshift(J);if(Y===$)break;Y=R$.dirname(Y)}return Z}var T$=()=>{};import M$ from"fs";import T5 from"path";function x2(X,$){let Z=[];if(!M$.existsSync(X))return Z;let Y=M$.readdirSync(X,{withFileTypes:!0});for(let J of Y){let G=T5.join(X,J.name);if(J.isDirectory()){if(J.name.startsWith("."))continue;if(U7.includes(J.name))continue;Z.push(...x2(G,$))}else if(J.isFile()){let Q=T5.extname(J.name);if($.includes(Q)){if(J.name.startsWith("_")&&J.name!=="_layout.stx")continue;if(J.name==="_layout.stx")continue;Z.push(G)}}}return Z}class M5{routes;pagesDir;pagesDirs;config;constructor(X,$={}){this.config=$;let Z=$.pagesDirs&&$.pagesDirs.length>0?$.pagesDirs:[$.pagesDir||"pages"];this.pagesDirs=Z.map((Q)=>T5.resolve(X,Q)),this.pagesDir=this.pagesDirs[0];let Y=$.extensions||[".stx"],J=new Set;this.routes=[];for(let Q of this.pagesDirs){let w=x2(Q,Y);for(let q of w){let W=UX(q,Q);if(J.has(W))continue;J.add(W);let{regex:U,params:K}=j7(W),z=$.layouts!==!1?zX(q,Q):[];this.routes.push({pattern:W,regex:U,params:K,filePath:q,isDynamic:K.length>0,layout:z.length>0?z[z.length-1]:void 0})}}this.routes.sort((Q,w)=>{if(!Q.isDynamic&&w.isDynamic)return-1;if(Q.isDynamic&&!w.isDynamic)return 1;let q=Q.pattern.split("/").length,W=w.pattern.split("/").length;if(q!==W)return W-q;return Q.pattern.localeCompare(w.pattern)});let G=T5.resolve(X,$.stateDir||process.env.STX_DIR?.trim()||".stx");_7(this.routes,G),B7(this.routes,G,this.pagesDir)}match(X){let $=X===""?"/":X;for(let Z of this.routes){let Y=$.match(Z.regex);if(Y){let J={};return Z.params.forEach((G,Q)=>{J[G]=Y[Q+1]}),{route:Z,params:J}}}return null}resolve(X,$){let Z=this.routes.find((J)=>J.pattern===X||J.filePath.includes(X));if(!Z)return"#not-found";let Y=Z.pattern;if($)for(let[J,G]of Object.entries($))Y=Y.replace(`:${J}`,encodeURIComponent(G));return Y}addRoute(X){this.routes.push(X),this.routes.sort(($,Z)=>{if(!$.isDynamic&&Z.isDynamic)return-1;if($.isDynamic&&!Z.isDynamic)return 1;return $.pattern.localeCompare(Z.pattern)})}getLayout(X){return X.layout??null}}function f2(X,$){return new M5(X,$)}function N$(X,$){let Z=[`${$}.stx`,"error.stx"];for(let Y of Z){let J=T5.join(X,Y);if(M$.existsSync(J))return J}return null}function k$(X,$){return X.map((Z)=>{let Y=T5.relative($,Z.filePath),J=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${Y}${J}`})}var g2=D(()=>{V$();A$();T$();WX()});function I$(X){_X=X.replace(/\/$/,"")}function E$(X,$,Z={}){N5[X]={path:$,name:X,params:Z}}function D$(X){for(let[$,Z]of Object.entries(X))if(typeof Z==="string")N5[$]={path:Z,name:$};else N5[$]={...Z,name:$}}function H7(X,$={},Z=!1){let Y=N5[X];if(!Y)return console.warn(`Route [${X}] not defined.`),"#undefined-route";let J={...Y.params,...$},G=Y.path;G=G.replace(/:(\w+)/g,(w,q)=>{let W=J[q];if(W===void 0)return console.warn(`Missing parameter [${q}] for route [${X}].`),`:${q}`;return delete J[q],encodeURIComponent(String(W))});let Q=Object.entries(J);if(Q.length>0){let w=Q.map(([q,W])=>`${encodeURIComponent(q)}=${encodeURIComponent(String(W))}`).join("&");G+=(G.includes("?")?"&":"?")+w}return Z&&_X?`${_X}${G}`:G}function y$(){for(let X of Object.keys(N5))delete N5[X];_X=""}var N5,_X="";var h2=D(()=>{N5={}});import u2 from"fs";import d2 from"path";function m2(X,$={}){return{type:"redirect",path:X,options:{replace:$.replace??!1,external:$.external??!1,redirectCode:$.redirectCode??302}}}function l2(X){return{type:"abort",error:typeof X==="string"?{statusCode:500,message:X}:X}}function c2(X,$={}){return{handler:X,mode:$.mode??"universal"}}function b$(X){let $={};if(!X)return $;let Z=X.split(";");for(let Y of Z){let[J,...G]=Y.split("=");if(J){let Q=J.trim(),w=G.join("=").trim();if(Q)$[Q]=decodeURIComponent(w)}}return $}function BX(X,$,Z={}){let Y=`${encodeURIComponent(X)}=${encodeURIComponent($)}`;if(Z.expires){let J=typeof Z.expires==="number"?new Date(Date.now()+Z.expires*1000):Z.expires;Y+=`; Expires=${J.toUTCString()}`}if(Z.path)Y+=`; Path=${Z.path}`;if(Z.domain)Y+=`; Domain=${Z.domain}`;if(Z.secure)Y+="; Secure";if(Z.httpOnly)Y+="; HttpOnly";if(Z.sameSite)Y+=`; SameSite=${Z.sameSite}`;return Y}function S$(X,$){let Z=X.headers.get("cookie")||"",Y=b$(Z);return{get(J){return Y[J]},set(J,G,Q={}){Y[J]=G,$.append("Set-Cookie",BX(J,G,Q))},delete(J){delete Y[J],$.append("Set-Cookie",BX(J,"",{expires:new Date(0),path:"/"}))},getAll(){return{...Y}}}}function C$(){return{get(X){if(typeof document>"u")return;return b$(document.cookie)[X]},set(X,$,Z={}){if(typeof document>"u")return;document.cookie=BX(X,$,Z)},delete(X){if(typeof document>"u")return;document.cookie=BX(X,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return b$(document.cookie)}}}function P$(){let X=typeof window<"u"&&typeof window.localStorage<"u";return{get($){if(!X)return null;try{return window.localStorage.getItem($)}catch{return null}},set($,Z){if(!X)return;try{window.localStorage.setItem($,Z)}catch{}},remove($){if(!X)return;try{window.localStorage.removeItem($)}catch{}},isAvailable(){return X}}}function jX(X,$){L7.set(X,$)}function v$(X){return L7.get(X)}function p2(X){return L7.has(X)}function i2(){L7.clear()}function n2(){return Array.from(L7.keys())}async function r2(X,$="middleware"){let Z=d2.resolve(X,$);if(!u2.existsSync(Z))return;let Y=u2.readdirSync(Z);for(let J of Y){if(!J.endsWith(".ts")&&!J.endsWith(".js"))continue;if(J.includes(".test.")||J.includes(".spec."))continue;let G=J.replace(/\.(ts|js)$/,""),Q=d2.join(Z,J);try{let q=(await import(Q)).default;if(q&&typeof q.handler==="function")jX(G,q);else if(typeof q==="function")jX(G,{handler:q,mode:"universal"})}catch(w){console.warn(`Failed to load middleware '${G}' from ${Q}:`,w)}}}function UU(X){let $={};if(!X)return $;let Z=new URLSearchParams(X);for(let[Y,J]of Z)$[Y]=J;return $}function s2(X,$,Z,Y=""){return{path:X,params:$,query:UU(Y),fullPath:Y?`${X}?${Y}`:X,meta:Z}}function o2(X,$,Z,Y){let J=Y?.isServer??typeof window>"u",G=!J,Q=new Headers;return{to:X,from:$,isClient:G,isServer:J,cookies:J&&Z?S$(Z,Q):C$(),storage:P$(),state:{},request:Z,responseHeaders:Q}}async function a2(X,$){let Z=Array.isArray(X)?X:[X],Y=$.isServer;for(let J of Z){let G=v$(J);if(!G)return console.error(`Route middleware '${J}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${J}' is not registered`}},state:$.state,responseHeaders:$.responseHeaders};if(G.mode==="server"&&!Y)continue;try{let Q=await G.handler($);if(Q){if(Q.type==="redirect")return{passed:!1,redirect:Q,state:$.state,responseHeaders:$.responseHeaders};if(Q.type==="abort")return{passed:!1,abort:Q,state:$.state,responseHeaders:$.responseHeaders}}}catch(Q){return console.error(`Error in middleware '${J}':`,Q),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:Q instanceof Error?Q.message:"Middleware error"}},state:$.state,responseHeaders:$.responseHeaders}}}return{passed:!0,state:$.state,responseHeaders:$.responseHeaders}}var L7;var t2=D(()=>{L7=new Map});function O7(X){let Z=X.replace(/\\/g,"/").split("/").filter(Boolean),Y=Z.lastIndexOf("layouts"),J=Y>=0?Z[Y+1]:Z.at(-1);if(!J)return"app";return J.replace(/\.stx$/i,"")||"app"}function e2(X){let $=X.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),Z=X.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),Y=X.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),J=$?.[1]||Y?.[1]||"";return{layout:J,group:Z?.[1]||O7(J)}}function KU(X){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return X}}function F7(){if(HX)return HX;return HX=KU(`
242
242
  ;(function(){
243
243
  'use strict';
244
244
  var ROUTER_REV=7;
@@ -1888,7 +1888,7 @@ else {
1888
1888
 
1889
1889
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
1890
1890
  })();
1891
- `),jX}var jX;var n2={};t(n2,{setAppUrl:()=>I$,runMiddleware:()=>c2,route:()=>j7,resolveLayoutChain:()=>UX,resetRoutes:()=>y$,registerMiddleware:()=>BX,patternToRegex:()=>B7,navigateTo:()=>v2,matchRoute:()=>KX,loadMiddlewareFromDirectory:()=>d2,isNonPageRoutePattern:()=>K7,isNonPageRoutePath:()=>F$,hasMiddleware:()=>g2,getRouterScript:()=>O7,getMiddlewareNames:()=>u2,getMiddleware:()=>v$,generateRouteTypes:()=>z7,generateRouteManifest:()=>_7,formatRoutes:()=>k$,findErrorPage:()=>N$,filePathToPattern:()=>WX,extractLayoutMetadata:()=>i2,deriveLayoutGroup:()=>L7,defineRoutes:()=>D$,defineRoute:()=>E$,defineMiddleware:()=>f2,createStorageManager:()=>P$,createServerCookieManager:()=>S$,createRouter:()=>y2,createRouteLocation:()=>m2,createMiddlewareContext:()=>l2,createClientCookieManager:()=>C$,clearMiddleware:()=>h2,bracketPathToRegex:()=>E2,abortNavigation:()=>x2,Router:()=>T5,NON_PAGE_DIRS:()=>W7});var n1=D(()=>{b2();A$();S2();p2();T$();V$();qX()});var r2=D(()=>{n1();x$()});async function $K(X,$,Z,Y){let J=$[0]?.replace(/['"]/g,"")||"main",G=O7();if(J!=="main")G=G.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${G}</script>`}var s2;var x$=D(()=>{r2();s2={name:"stxRouter",handler:$K,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function o2(X){let $=X.heatmap;if(!$?.enabled)return"";let Z={...ZK,...$};return`
1891
+ `),HX}var HX;var X6={};t(X6,{setAppUrl:()=>I$,runMiddleware:()=>a2,route:()=>H7,resolveLayoutChain:()=>zX,resetRoutes:()=>y$,registerMiddleware:()=>jX,patternToRegex:()=>j7,navigateTo:()=>m2,matchRoute:()=>KX,loadMiddlewareFromDirectory:()=>r2,isNonPageRoutePattern:()=>K7,isNonPageRoutePath:()=>F$,hasMiddleware:()=>p2,getRouterScript:()=>F7,getMiddlewareNames:()=>n2,getMiddleware:()=>v$,generateRouteTypes:()=>_7,generateRouteManifest:()=>B7,formatRoutes:()=>k$,findErrorPage:()=>N$,filePathToPattern:()=>UX,extractLayoutMetadata:()=>e2,deriveLayoutGroup:()=>O7,defineRoutes:()=>D$,defineRoute:()=>E$,defineMiddleware:()=>c2,createStorageManager:()=>P$,createServerCookieManager:()=>S$,createRouter:()=>f2,createRouteLocation:()=>s2,createMiddlewareContext:()=>o2,createClientCookieManager:()=>C$,clearMiddleware:()=>i2,bracketPathToRegex:()=>v2,abortNavigation:()=>l2,Router:()=>M5,NON_PAGE_DIRS:()=>U7});var n1=D(()=>{g2();A$();h2();t2();T$();V$();WX()});var $6=D(()=>{n1();x$()});async function zU(X,$,Z,Y){let J=$[0]?.replace(/['"]/g,"")||"main",G=F7();if(J!=="main")G=G.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${G}</script>`}var Z6;var x$=D(()=>{$6();Z6={name:"stxRouter",handler:zU,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function Y6(X){let $=X.heatmap;if(!$?.enabled)return"";let Z={..._U,...$};return`
1892
1892
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1893
1893
  <script>
1894
1894
  (function() {
@@ -2271,10 +2271,10 @@ else {
2271
2271
  };
2272
2272
  })();
2273
2273
  </script>
2274
- `}function a2(X,$){let Z=o2($);if(!Z)return X;let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}function YK(X){let $={},Z=X.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of Z){let[J,G]=Y.split("="),Q=G?.replace(/["']/g,"");switch(J){case"endpoint":$.endpoint=Q;break;case"samplingRate":$.samplingRate=Number.parseInt(Q,10);break;case"batchSize":$.batchSize=Number.parseInt(Q,10);break;case"trackMouse":$.trackMouse=Q==="true";break;case"trackClicks":$.trackClicks=Q==="true";break;case"trackScroll":$.trackScroll=Q==="true";break;case"honorDnt":$.honorDnt=Q==="true";break;case"debugOverlay":$.debugOverlay=Q==="true";break}}return $}var ZK,t2;var f$=D(()=>{ZK={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};t2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(X,$,Z,Y)=>{let J=Z.__stx_config||{};if($.length>0){let G=YK($.join(" "));J.heatmap={...J.heatmap,...G,enabled:!0}}return o2(J)}}});function I1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function e2(X){let $=X.trim().toLowerCase();return!$.startsWith("javascript:")&&!$.startsWith("vbscript:")&&!$.startsWith("data:text/html")}function HX(X){let $=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=X.match($);if(!Z)return{data:{},content:X.trim()};let Y=Z[1],J=X.slice(Z[0].length),G={};for(let Q of Y.split(`
2275
- `)){let w=Q.trim();if(!w||w.startsWith("#"))continue;let q=w.indexOf(":");if(q===-1)continue;let W=w.slice(0,q).trim(),K=w.slice(q+1).trim();if(typeof K==="string"){if(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'"))K=K.slice(1,-1);else if(K.startsWith("[")&&K.endsWith("]"))try{K=JSON.parse(K)}catch{}else if(K==="true")K=!0;else if(K==="false")K=!1;else if(/^-?\d+(?:\.\d+)?$/.test(K))K=Number(K)}G[W]=K}return{data:G,content:J.trim()}}function r1(X,$={}){let{gfm:Z=!0,breaks:Y=!1}=$,J=X,G=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(K,U,z)=>{let B=G.length,_=U?` class="language-${I1(U)}"`:"";return G.push(`<pre><code${_}>${I1(z.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),J=J.replace(/`([^`]*)`/g,(K,U)=>`<code>${I1(U)}</code>`),J=J.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),J=J.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),J=J.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),J=J.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),J=J.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),J=J.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),J=J.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),J=J.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),J=J.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),J=J.replace(/__(.+?)__/g,"<strong>$1</strong>"),J=J.replace(/\*(.+?)\*/g,"<em>$1</em>"),J=J.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(K,U,z)=>{return`<img src="${e2(z)?I1(z):""}" alt="${I1(U)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,U,z)=>{return`<a href="${e2(z)?I1(z):""}">${U}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
2276
- `),J=J.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),J=J.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),J=J.replace(/<\/ul>\n<ul>/g,""),J=J.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),J=J.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),J=J.replace(/<\/ol>\n<ol>/g,""),J=J.replace(/<li data-ul>/g,"<li>"),J=J.replace(/<li data-ol>/g,"<li>"),Z)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(K,U,z)=>{let _=`<tr>${U.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${I1(H)}</th>`).join("")}</tr>`,j=z.trim().split(`
2277
- `).map((H)=>{return`<tr>${H.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<td>${I1(L)}</td>`).join("")}</tr>`}).join(`
2274
+ `}function J6(X,$){let Z=Y6($);if(!Z)return X;let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}function BU(X){let $={},Z=X.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of Z){let[J,G]=Y.split("="),Q=G?.replace(/["']/g,"");switch(J){case"endpoint":$.endpoint=Q;break;case"samplingRate":$.samplingRate=Number.parseInt(Q,10);break;case"batchSize":$.batchSize=Number.parseInt(Q,10);break;case"trackMouse":$.trackMouse=Q==="true";break;case"trackClicks":$.trackClicks=Q==="true";break;case"trackScroll":$.trackScroll=Q==="true";break;case"honorDnt":$.honorDnt=Q==="true";break;case"debugOverlay":$.debugOverlay=Q==="true";break}}return $}var _U,G6;var f$=D(()=>{_U={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};G6={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(X,$,Z,Y)=>{let J=Z.__stx_config||{};if($.length>0){let G=BU($.join(" "));J.heatmap={...J.heatmap,...G,enabled:!0}}return Y6(J)}}});function k1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Q6(X){let $=X.trim().toLowerCase();return!$.startsWith("javascript:")&&!$.startsWith("vbscript:")&&!$.startsWith("data:text/html")}function LX(X){let $=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=X.match($);if(!Z)return{data:{},content:X.trim()};let Y=Z[1],J=X.slice(Z[0].length),G={};for(let Q of Y.split(`
2275
+ `)){let w=Q.trim();if(!w||w.startsWith("#"))continue;let q=w.indexOf(":");if(q===-1)continue;let W=w.slice(0,q).trim(),U=w.slice(q+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}G[W]=U}return{data:G,content:J.trim()}}function r1(X,$={}){let{gfm:Z=!0,breaks:Y=!1}=$,J=X,G=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(U,K,z)=>{let B=G.length,_=K?` class="language-${k1(K)}"`:"";return G.push(`<pre><code${_}>${k1(z.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),J=J.replace(/`([^`]*)`/g,(U,K)=>`<code>${k1(K)}</code>`),J=J.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),J=J.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),J=J.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),J=J.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),J=J.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),J=J.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),J=J.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),J=J.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),J=J.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),J=J.replace(/__(.+?)__/g,"<strong>$1</strong>"),J=J.replace(/\*(.+?)\*/g,"<em>$1</em>"),J=J.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,K,z)=>{return`<img src="${Q6(z)?k1(z):""}" alt="${k1(K)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,K,z)=>{return`<a href="${Q6(z)?k1(z):""}">${K}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
2276
+ `),J=J.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),J=J.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),J=J.replace(/<\/ul>\n<ul>/g,""),J=J.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),J=J.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),J=J.replace(/<\/ol>\n<ol>/g,""),J=J.replace(/<li data-ul>/g,"<li>"),J=J.replace(/<li data-ol>/g,"<li>"),Z)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,K,z)=>{let _=`<tr>${K.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${k1(H)}</th>`).join("")}</tr>`,j=z.trim().split(`
2277
+ `).map((H)=>{return`<tr>${H.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<td>${k1(L)}</td>`).join("")}</tr>`}).join(`
2278
2278
  `);return`<table>
2279
2279
  <thead>
2280
2280
  ${_}
@@ -2283,13 +2283,13 @@ ${_}
2283
2283
  ${j}
2284
2284
  </tbody>
2285
2285
  </table>`});if(Z)J=J.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),J=J.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let Q=J.split(`
2286
- `),w=[],q=!1,W=[];for(let K of Q){let U=K.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(U)||/^\0CODEBLOCK\d+\0$/.test(U)||U===""){if(q&&W.length>0)w.push(`<p>${W.join(Y?`<br />
2286
+ `),w=[],q=!1,W=[];for(let U of Q){let K=U.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(K)||/^\0CODEBLOCK\d+\0$/.test(K)||K===""){if(q&&W.length>0)w.push(`<p>${W.join(Y?`<br />
2287
2287
  `:`
2288
- `)}</p>`),W=[],q=!1;w.push(K)}else q=!0,W.push(U)}if(q&&W.length>0)w.push(`<p>${W.join(Y?`<br />
2288
+ `)}</p>`),W=[],q=!1;w.push(U)}else q=!0,W.push(K)}if(q&&W.length>0)w.push(`<p>${W.join(Y?`<br />
2289
2289
  `:`
2290
2290
  `)}</p>`);if(J=w.join(`
2291
2291
  `),Y)J=J.replace(/\n/g,`<br />
2292
- `);for(let K=0;K<G.length;K++)J=J.replace(`\x00CODEBLOCK${K}\x00`,G[K]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function N5(X="const",$=[],Z){let Y=$.length?j1.filter((J)=>!$.includes(J)):j1;if(Z!==void 0)Y=Y.filter((J)=>{let G=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${X} { ${Y.join(", ")} } = window.stx;`}function g$(X){if(!X)return!1;return GK.some(($)=>new RegExp(`\\b${$}\\s*(?:<[^>]*>)?\\s*\\(`).test(X))}function h$(X){if(!X)return!1;let $=G6(X);if(QK.some((Z)=>Z.test($)))return!0;return g$($)}function $6(X){if(!X)return!1;return wK.test(G6(X))||h$(X)}function J6(){return`{${Z6.map((X)=>`'${X}':1`).join(",")}}`}function G6(X){if(!X)return X;let $=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(Y,J,G)=>J??" ".repeat(G.length));return X.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var j1,X6,JK,GK,QK,wK,Z6,qK,Y6;var G1=D(()=>{j1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],X6=["onMount","onDestroy"];JK=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],GK=j1.filter((X)=>!JK.includes(X));QK=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],wK=/\s@[a-z][\w.:-]*\s*=/i;Z6=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],qK=["x-init","x-transition","x-effect","x-on"],Y6=[...Z6,...qK]});function q6(X){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of X){let Y=Z.toLowerCase();if(Y==="prevent")$.prevent=!0;else if(Y==="stop")$.stop=!0;else if(Y==="once")$.once=!0;else if(Y==="capture")$.capture=!0;else if(Y==="self")$.self=!0;else if(Y==="passive")$.passive=!0;else if(WK.has(Y))$.systemKeys.push(Y);else if(Y in W6)$.mouse=Y;else if(Y in w6||/^[a-z]$/.test(Y))$.keys.push(w6[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);$.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);$.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return $}function K6(X){let $=[],Z=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec(X))!==null){let[G,Q,w]=J,q=J.index,W=q+G.length,K=`__stx_evt_${Z++}`,U=[],z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=z.exec(w))!==null){let[,j,H]=B,O=j.split("."),L=O[0];if(!Q6.has(L))continue;U.push({attribute:`@${j}`,event:L,handler:H,modifiers:q6(O.slice(1)),elementId:K})}let _=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=_.exec(w))!==null){let[,j,H]=B,O=j.split("."),L=O[0];if(!Q6.has(L))continue;U.push({attribute:`@${j}`,event:L,handler:H,modifiers:q6(O.slice(1)),elementId:K})}if(U.length>0)$.push({originalTag:G,elementId:K,events:U,startIndex:q,endIndex:W})}return $}function KK(X){let $=[],{modifiers:Z}=X;if(Z.self)$.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=W6[Z.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function UK(X,$){let Z=X;if($.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${$.debounce})`;else if($.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${$.throttle})`;return Z}function u$(X){let $=X.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test($))return X;return`if (typeof ${$} === 'function' && !${$}._isSignal) ${$}($event);`}function zK(X){let{modifiers:$}=X,Z=X.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=KK(X),J=UK(u$(X.handler),$),G=[];if($.once)G.push("once: true");if($.capture)G.push("capture: true");if($.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",w=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(X.event==="mounted")return`
2292
+ `);for(let U=0;U<G.length;U++)J=J.replace(`\x00CODEBLOCK${U}\x00`,G[U]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function k5(X="const",$=[],Z){let Y=$.length?B1.filter((J)=>!$.includes(J)):B1;if(Z!==void 0)Y=Y.filter((J)=>{let G=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${X} { ${Y.join(", ")} } = window.stx;`}function g$(X){if(!X)return!1;return HU.some(($)=>new RegExp(`\\b${$}\\s*(?:<[^>]*>)?\\s*\\(`).test(X))}function h$(X){if(!X)return!1;let $=z6(X);if(LU.some((Z)=>Z.test($)))return!0;return g$($)}function q6(X){if(!X)return!1;return OU.test(z6(X))||h$(X)}function K6(){return`{${W6.map((X)=>`'${X}':1`).join(",")}}`}function z6(X){if(!X)return X;let $=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(Y,J,G)=>J??" ".repeat(G.length));return X.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var B1,w6,jU,HU,LU,OU,W6,FU,U6;var J1=D(()=>{B1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],w6=["onMount","onDestroy"];jU=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],HU=B1.filter((X)=>!jU.includes(X));LU=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],OU=/\s@[a-z][\w.:-]*\s*=/i;W6=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],FU=["x-init","x-transition","x-effect","x-on"],U6=[...W6,...FU]});function j6(X){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of X){let Y=Z.toLowerCase();if(Y==="prevent")$.prevent=!0;else if(Y==="stop")$.stop=!0;else if(Y==="once")$.once=!0;else if(Y==="capture")$.capture=!0;else if(Y==="self")$.self=!0;else if(Y==="passive")$.passive=!0;else if(VU.has(Y))$.systemKeys.push(Y);else if(Y in H6)$.mouse=Y;else if(Y in B6||/^[a-z]$/.test(Y))$.keys.push(B6[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);$.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);$.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return $}function L6(X){let $=[],Z=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec(X))!==null){let[G,Q,w]=J,q=J.index,W=q+G.length,U=`__stx_evt_${Z++}`,K=[],z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=z.exec(w))!==null){let[,j,H]=B,O=j.split("."),L=O[0];if(!_6.has(L))continue;K.push({attribute:`@${j}`,event:L,handler:H,modifiers:j6(O.slice(1)),elementId:U})}let _=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=_.exec(w))!==null){let[,j,H]=B,O=j.split("."),L=O[0];if(!_6.has(L))continue;K.push({attribute:`@${j}`,event:L,handler:H,modifiers:j6(O.slice(1)),elementId:U})}if(K.length>0)$.push({originalTag:G,elementId:U,events:K,startIndex:q,endIndex:W})}return $}function AU(X){let $=[],{modifiers:Z}=X;if(Z.self)$.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=H6[Z.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function RU(X,$){let Z=X;if($.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${$.debounce})`;else if($.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${$.throttle})`;return Z}function u$(X){let $=X.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test($))return X;return`if (typeof ${$} === 'function' && !${$}._isSignal) ${$}($event);`}function TU(X){let{modifiers:$}=X,Z=X.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=AU(X),J=RU(u$(X.handler),$),G=[];if($.once)G.push("once: true");if($.capture)G.push("capture: true");if($.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",w=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(X.event==="mounted")return`
2293
2293
  (function() {
2294
2294
  var $el = document.getElementById('${Z}');
2295
2295
  if (!$el) return;
@@ -2398,16 +2398,24 @@ else {
2398
2398
  }
2399
2399
 
2400
2400
  // Event listeners
2401
- ${X.map(zK).join(`
2401
+ ${X.map(TU).join(`
2402
2402
  `)}
2403
2403
  })();
2404
- </script>`}function _K(X){let $=K6(X);if($.length===0)return{template:X,bindings:[]};let Z=X,Y=[];for(let J=$.length-1;J>=0;J--){let G=$[J],Q=G.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${G.elementId}"`);else{let w=Q.match(/id=["']([^"']+)["']/);if(w)for(let q of G.events)q.elementId=w[1]}for(let w of G.events){let q=w.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),K=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(W,""),Q=Q.replace(K,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),Y.push(...G.events)}return{template:Z,bindings:Y}}function U6(X,$,Z){if(h$(X))return X;if($.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(X))return X;let{template:w,bindings:q}=_K(X),W=$.__stx_event_bindings||[];return $.__stx_event_bindings=[...W,...q],w}let Y=K6(X);if(Y.length===0)return X;let J=X;for(let w=Y.length-1;w>=0;w--){let q=Y[w],W=q.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let K=W.match(/id=["']([^"']+)["']/);if(K)for(let U of q.events)U.elementId=K[1]}for(let K of q.events){let U=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");W=W.replace(z,""),W=W.replace(B,"")}J=J.slice(0,q.startIndex)+W+J.slice(q.endIndex)}let G=d$(Y.flatMap((w)=>w.events)),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
2405
- `+J.slice(Q);else J+=G;return J}var Q6,w6,WK,W6;var m$=D(()=>{G1();Q6=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"]),w6={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"},WK=new Set(["ctrl","alt","shift","meta"]),W6={left:0,middle:1,right:2}});function h0(X){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;X=X.replace($,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
2404
+ </script>`}function MU(X){let $=L6(X);if($.length===0)return{template:X,bindings:[]};let Z=X,Y=[];for(let J=$.length-1;J>=0;J--){let G=$[J],Q=G.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${G.elementId}"`);else{let w=Q.match(/id=["']([^"']+)["']/);if(w)for(let q of G.events)q.elementId=w[1]}for(let w of G.events){let q=w.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(W,""),Q=Q.replace(U,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),Y.push(...G.events)}return{template:Z,bindings:Y}}function O6(X,$,Z){if(h$(X))return X;if($.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(X))return X;let{template:w,bindings:q}=MU(X),W=$.__stx_event_bindings||[];return $.__stx_event_bindings=[...W,...q],w}let Y=L6(X);if(Y.length===0)return X;let J=X;for(let w=Y.length-1;w>=0;w--){let q=Y[w],W=q.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let U=W.match(/id=["']([^"']+)["']/);if(U)for(let K of q.events)K.elementId=U[1]}for(let U of q.events){let K=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");W=W.replace(z,""),W=W.replace(B,"")}J=J.slice(0,q.startIndex)+W+J.slice(q.endIndex)}let G=d$(Y.flatMap((w)=>w.events)),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
2405
+ `+J.slice(Q);else J+=G;return J}var _6,B6,VU,H6;var m$=D(()=>{J1();_6=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),B6={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},VU=new Set(["ctrl","alt","shift","meta"]),H6={left:0,middle:1,right:2}});function h0(X){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;X=X.replace($,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
2406
2406
  `});let Z=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return X=X.replace(Z,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__composables
2407
- `}),X}function LX(X){return X.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function BK(){let X=globalThis;return X[z6]??=new Map,X[z6]}function e(X,$){let Z=BK(),Y=`${import.meta.url}\x00${X}`,J=Z.get(Y);if(J)return J;let G=$();return Z.set(Y,G),G.catch(()=>{if(Z.get(Y)===G)Z.delete(Y)}),G}var z6;var F7=D(()=>{z6=Symbol.for("stx.lazy-module-promises")});function k5(X){if(!X||X.indexOf("</")===-1)return X;return X.replace(jK,"<\\/$1")}var jK;var l$=D(()=>{jK=/<\/(script)/gi});import HK from"process";function C0(X="STX_PUBLIC_"){let $={},Z={};for(let[Y,J]of Object.entries(HK.env)){if(!Y.startsWith(X)||J===void 0)continue;$[`import.meta.env.${Y}`]=JSON.stringify(J),Z[Y]=J}return $["import.meta.env"]=JSON.stringify(Z),$}var E1=()=>{};import V7 from"path";function B6(X){_6=X?.trim()||null}function A7(){return process.env[LK]?.trim()||_6||I5}function R7(X=process.cwd(),...$){let Z=A7();return V7.isAbsolute(Z)?V7.join(Z,...$):V7.join(X,Z,...$)}function T7(X){if(!X||V7.isAbsolute(X))return X;let $=X.replace(/\\/g,"/");if($!==I5&&!$.startsWith(`${I5}/`))return X;let Z=$.slice(I5.length+1);return Z?V7.join(A7(),Z):A7()}var I5=".stx",LK="STX_DIR",_6=null;var OX=()=>{};function OK(X){if(!X||typeof X!=="object")return!1;let $=X;return typeof $.message==="string"&&($.name==="BuildMessage"||$.name==="ResolveMessage"||("position"in $))}function FK(X){if(X&&typeof X==="object"&&Array.isArray(X.errors))return X.errors;return[X]}function c$(X,$){let Z=[];for(let Y of FK(X)){if(OK(Y)){let J=Y.position||void 0;Z.push({file:$||J?.file,line:J?.line,column:J?.column,message:Y.message??"",lineText:J?.lineText});continue}Z.push({file:$,message:Y instanceof Error?Y.message:String(Y)})}return Z}function j6(X,$){return c$(X,$).map((Z)=>{let Y=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",J=Z.lineText?`
2407
+ `}),X}function OX(X){return X.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function NU(X,$){let Z=X[$],Y=$+1;while(Y<X.length){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===Z)return Y+1;Y++}return X.length}function kU(X,$){let Z=$+1;while(Z<X.length){if(X[Z]==="\\"){Z+=2;continue}if(X[Z]==="`")return Z+1;if(X[Z]==="$"&&X[Z+1]==="{"){if(Z=FX(X,Z+2),Z<X.length)Z++;continue}Z++}return X.length}function FX(X,$){let Z=1,Y=$;while(Y<X.length){let J=X[Y];if(J==="\\"){Y+=2;continue}if(J==='"'||J==="'"){Y=NU(X,Y);continue}if(J==="`"){Y=kU(X,Y);continue}if(J==="/"&&X[Y+1]==="/"){while(Y<X.length&&X[Y]!==`
2408
+ `)Y++;continue}if(J==="/"&&X[Y+1]==="*"){Y+=2;while(Y<X.length&&X.slice(Y,Y+2)!=="*/")Y++;Y+=2;continue}if(J==="{"){Z++,Y++;continue}if(J==="}"){if(Z--,Z===0)return Y;Y++;continue}Y++}return X.length}function I1(X){let $="",Z=0;while(Z<X.length){let Y=X.slice(Z,Z+2);if(Y==="//"){while(Z<X.length&&X[Z]!==`
2409
+ `)$+=" ",Z++;continue}if(Y==="/*"){while(Z<X.length&&X.slice(Z,Z+2)!=="*/")$+=X[Z]===`
2410
+ `?`
2411
+ `:" ",Z++;$+=" ",Z+=2;continue}let J=X[Z];if(J==='"'||J==="'"){let G=J;$+=" ",Z++;while(Z<X.length&&X[Z]!==G){if(X[Z]==="\\"){$+=" ",Z+=2;continue}$+=X[Z]===`
2412
+ `?`
2413
+ `:" ",Z++}$+=" ",Z++;continue}if(J==="`"){$+=" ",Z++;while(Z<X.length&&X[Z]!=="`"){if(X[Z]==="\\"){$+=" ",Z+=2;continue}if(X[Z]==="$"&&X[Z+1]==="{"){let G=Z+2,Q=FX(X,G);if($+=" ",$+=I1(X.slice(G,Q)),Q<X.length)$+=" ";Z=Q+1;continue}$+=X[Z]===`
2414
+ `?`
2415
+ `:" ",Z++}$+=" ",Z++;continue}$+=J,Z++}return $}function IU(){let X=globalThis;return X[F6]??=new Map,X[F6]}function e(X,$){let Z=IU(),Y=`${import.meta.url}\x00${X}`,J=Z.get(Y);if(J)return J;let G=$();return Z.set(Y,G),G.catch(()=>{if(Z.get(Y)===G)Z.delete(Y)}),G}var F6;var V7=D(()=>{F6=Symbol.for("stx.lazy-module-promises")});function I5(X){if(!X||X.indexOf("</")===-1)return X;return X.replace(EU,"<\\/$1")}var EU;var l$=D(()=>{EU=/<\/(script)/gi});import DU from"process";function C0(X="STX_PUBLIC_"){let $={},Z={};for(let[Y,J]of Object.entries(DU.env)){if(!Y.startsWith(X)||J===void 0)continue;$[`import.meta.env.${Y}`]=JSON.stringify(J),Z[Y]=J}return $["import.meta.env"]=JSON.stringify(Z),$}var E1=()=>{};import A7 from"path";function A6(X){V6=X?.trim()||null}function R7(){return process.env[yU]?.trim()||V6||E5}function T7(X=process.cwd(),...$){let Z=R7();return A7.isAbsolute(Z)?A7.join(Z,...$):A7.join(X,Z,...$)}function M7(X){if(!X||A7.isAbsolute(X))return X;let $=X.replace(/\\/g,"/");if($!==E5&&!$.startsWith(`${E5}/`))return X;let Z=$.slice(E5.length+1);return Z?A7.join(R7(),Z):R7()}var E5=".stx",yU="STX_DIR",V6=null;var VX=()=>{};function bU(X){if(!X||typeof X!=="object")return!1;let $=X;return typeof $.message==="string"&&($.name==="BuildMessage"||$.name==="ResolveMessage"||("position"in $))}function SU(X){if(X&&typeof X==="object"&&Array.isArray(X.errors))return X.errors;return[X]}function c$(X,$){let Z=[];for(let Y of SU(X)){if(bU(Y)){let J=Y.position||void 0;Z.push({file:$||J?.file,line:J?.line,column:J?.column,message:Y.message??"",lineText:J?.lineText});continue}Z.push({file:$,message:Y instanceof Error?Y.message:String(Y)})}return Z}function R6(X,$){return c$(X,$).map((Z)=>{let Y=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",J=Z.lineText?`
2408
2416
  ${Z.lineText.trim()}`:"";return Y?`${Y}: ${Z.message}${J}`:`${Z.message}${J}`}).join(`
2409
- `)}var M7={};t(M7,{shouldLogBundlerDiagnostics:()=>F6,setBundlerFallbackMode:()=>TK,resolveBundlerFallback:()=>A6,recordBundleFailure:()=>V6,queueClientBundleBuild:()=>R6,hasUserImports:()=>MK,getBundleFailures:()=>AK,clearBundleFailures:()=>RK,bundleClientScript:()=>kK});import L0 from"path";import P0 from"fs";function F6(X=process.env){return X.STX_DEBUG==="true"||X.STX_DEBUG==="1"}function s1(...X){if(F6())console.log("[stx:bundler]",...X)}function V6(X,$,Z){n$.push({filePath:X||"<inline>",message:$,details:Z})}function AK(){return n$.slice()}function RK(){n$.length=0}function TK(X){i$=X}function A6(){if(i$)return i$;try{return k7.strict?.bundlerFallback??"warn"}catch{return"warn"}}function MK(X){let $=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=$.exec(X))!==null){let J=Z[1];if(!H6.some((Q)=>Q.test(J)))return s1("detected user import:",J),!0}let Y=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=Y.exec(X))!==null){let J=Z[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!H6.some((Q)=>Q.test(J)))return s1("detected side-effect import:",J),!0}return!1}function NK(X,$,Z,Y){let J=(G,Q)=>{let w=G===Z?$:L0.dirname(G),q=L0.resolve(w,Q),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,L0.join(q,"index.ts"),L0.join(q,"index.tsx"),L0.join(q,"index.js"),L0.join(q,"index.mjs")];for(let K of W)try{if(P0.existsSync(K)&&P0.statSync(K,{throwIfNoEntry:!1})?.isFile())return K}catch{}return q};return{name:"stx-client-bundle",setup(G){G.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^\//},(Q)=>{if(P0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let w=J(Q.importer,Q.path);return Y.add(w),{path:w}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let w=L0.resolve(X,Q.path.slice(2)),q=[w,`${w}.ts`,`${w}.tsx`,`${w}.js`,`${w}.mjs`,`${w}.jsx`,L0.join(w,"index.ts"),L0.join(w,"index.tsx"),L0.join(w,"index.js"),L0.join(w,"index.mjs")];for(let W of q)if(P0.existsSync(W)&&P0.statSync(W,{throwIfNoEntry:!1})?.isFile())return s1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",W),Y.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${Q.path[0]}/ import:`,Q.path),{path:w}}),G.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Q)=>{let w=L0.extname(Q.path).toLowerCase(),q=w===".json"?"json":w===".tsx"?"tsx":w===".jsx"?"jsx":w===".ts"||w===".mts"||w===".cts"?"ts":"js";if(Q.path!==Z)Y.add(Q.path);return{contents:P0.readFileSync(Q.path,"utf8"),loader:q}})}}}function R6(X){let $=globalThis,Y=($[L6]??Promise.resolve()).then(X,X);return $[L6]=Y.then(()=>{return},()=>{return}),Y}async function kK(X,$,Z={}){let Y=Z.projectRoot||process.cwd(),J=Z.minify??!1,G=Z.cacheDir||R7(Y,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${VK}\x00${X}\x00${$}`);let w=Q.digest("hex").slice(0,12),q=L0.join(G,`${w}.js`),W=L0.join(G,`${w}.deps.json`),K=Bun.file(q);if(await K.exists()){let B=Bun.file(W),_=!0;if(await B.exists())try{let j=JSON.parse(await B.text());if(j.metadataVersion!==O6||!Array.isArray(j.files))_=!1;for(let H of Array.isArray(j.files)?j.files:[])try{if(P0.statSync(H.path).mtimeMs!==H.mtimeMs){_=!1;break}}catch{_=!1;break}}catch{_=!1}if(_)return s1("cache hit:",w),await K.text();s1("cache invalidated by dep change:",w)}let U=p$.get(w);if(U)return await U;let z=R6(()=>IK(X,$,{projectRoot:Y,minify:J,cacheDir:G,hash:w,cachePath:q,depsPath:W}));p$.set(w,z);try{return await z}finally{p$.delete(w)}}async function IK(X,$,Z){let{projectRoot:Y,minify:J,cacheDir:G,hash:Q,cachePath:w,depsPath:q}=Z,W=R7(Y,"bundle-tmp"),K=L0.join(W,`${Q}.ts`),U=L0.join(W,"out",Q);P0.mkdirSync(W,{recursive:!0}),P0.mkdirSync(U,{recursive:!0});let z=L0.dirname($),B=[],_=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,j=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,H;while((H=_.exec(X))!==null){if(H[1])continue;if(H[2])H[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)B.push(V)});else if(H[3])B.push(H[3])}while((H=j.exec(X))!==null){if(H[1])continue;B.push(H[2])}let O=B.length>0?`
2410
- export { ${B.join(", ")} }`:"";await Bun.write(K,X+O),s1("bundling:",Q,"from:",L0.basename($));let L=new Set;try{let F=await Bun.build({entrypoints:[K],outdir:U,target:"browser",format:"esm",minify:J,plugins:[NK(Y,z,K,L)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...C0()},root:Y});if(!F.success){let I=F.logs.filter((C)=>C.level==="error").map((C)=>C.message).join(", ");return console.warn("[stx:bundler] build failed:",I),X}let V="";for(let I of F.outputs){V=await I.text();break}let A=[];for(let I of V.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let C of I[1].split(",")){let S=C.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let b=C.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))A.push([b,b])}let R=V.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];V=V.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let T=`__stxBundle_${Q}`,M=A.map(([I,C])=>`${JSON.stringify(I)}: ${C}`).join(", "),k=A.map(([I])=>`var ${I} = undefined;`).join(`
2417
+ `)}var N7={};t(N7,{shouldLogBundlerDiagnostics:()=>k6,setBundlerFallbackMode:()=>xU,resolveBundlerFallback:()=>E6,recordBundleFailure:()=>I6,queueClientBundleBuild:()=>D6,hasUserImports:()=>fU,getBundleFailures:()=>PU,clearBundleFailures:()=>vU,bundleClientScript:()=>hU});import L0 from"path";import P0 from"fs";function k6(X=process.env){return X.STX_DEBUG==="true"||X.STX_DEBUG==="1"}function s1(...X){if(k6())console.log("[stx:bundler]",...X)}function I6(X,$,Z){n$.push({filePath:X||"<inline>",message:$,details:Z})}function PU(){return n$.slice()}function vU(){n$.length=0}function xU(X){i$=X}function E6(){if(i$)return i$;try{let X=I7.strict;return typeof X==="object"&&X!==null?X.bundlerFallback??"warn":"warn"}catch{return"warn"}}function fU(X){let $=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=$.exec(X))!==null){let J=Z[1];if(!T6.some((Q)=>Q.test(J)))return s1("detected user import:",J),!0}let Y=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=Y.exec(X))!==null){let J=Z[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!T6.some((Q)=>Q.test(J)))return s1("detected side-effect import:",J),!0}return!1}function gU(X,$,Z,Y){let J=(G,Q)=>{let w=G===Z?$:L0.dirname(G),q=L0.resolve(w,Q),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,L0.join(q,"index.ts"),L0.join(q,"index.tsx"),L0.join(q,"index.js"),L0.join(q,"index.mjs")];for(let U of W)try{if(P0.existsSync(U)&&P0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(G){G.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^\//},(Q)=>{if(P0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let w=J(Q.importer,Q.path);return Y.add(w),{path:w}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let w=L0.resolve(X,Q.path.slice(2)),q=[w,`${w}.ts`,`${w}.tsx`,`${w}.js`,`${w}.mjs`,`${w}.jsx`,L0.join(w,"index.ts"),L0.join(w,"index.tsx"),L0.join(w,"index.js"),L0.join(w,"index.mjs")];for(let W of q)if(P0.existsSync(W)&&P0.statSync(W,{throwIfNoEntry:!1})?.isFile())return s1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",W),Y.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${Q.path[0]}/ import:`,Q.path),{path:w}}),G.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Q)=>{let w=L0.extname(Q.path).toLowerCase(),q=w===".json"?"json":w===".tsx"?"tsx":w===".jsx"?"jsx":w===".ts"||w===".mts"||w===".cts"?"ts":"js";if(Q.path!==Z)Y.add(Q.path);return{contents:P0.readFileSync(Q.path,"utf8"),loader:q}})}}}function D6(X){let $=globalThis,Y=($[M6]??Promise.resolve()).then(X,X);return $[M6]=Y.then(()=>{return},()=>{return}),Y}async function hU(X,$,Z={}){let Y=Z.projectRoot||process.cwd(),J=Z.minify??!1,G=Z.cacheDir||T7(Y,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${CU}\x00${X}\x00${$}`);let w=Q.digest("hex").slice(0,12),q=L0.join(G,`${w}.js`),W=L0.join(G,`${w}.deps.json`),U=Bun.file(q);if(await U.exists()){let B=Bun.file(W),_=!0;if(await B.exists())try{let j=JSON.parse(await B.text());if(j.metadataVersion!==N6||!Array.isArray(j.files))_=!1;for(let H of Array.isArray(j.files)?j.files:[])try{if(P0.statSync(H.path).mtimeMs!==H.mtimeMs){_=!1;break}}catch{_=!1;break}}catch{_=!1}if(_)return s1("cache hit:",w),await U.text();s1("cache invalidated by dep change:",w)}let K=p$.get(w);if(K)return await K;let z=D6(()=>uU(X,$,{projectRoot:Y,minify:J,cacheDir:G,hash:w,cachePath:q,depsPath:W}));p$.set(w,z);try{return await z}finally{p$.delete(w)}}async function uU(X,$,Z){let{projectRoot:Y,minify:J,cacheDir:G,hash:Q,cachePath:w,depsPath:q}=Z,W=T7(Y,"bundle-tmp"),U=L0.join(W,`${Q}.ts`),K=L0.join(W,"out",Q);P0.mkdirSync(W,{recursive:!0}),P0.mkdirSync(K,{recursive:!0});let z=L0.dirname($),B=[],_=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,j=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,H;while((H=_.exec(X))!==null){if(H[1])continue;if(H[2])H[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)B.push(V)});else if(H[3])B.push(H[3])}while((H=j.exec(X))!==null){if(H[1])continue;B.push(H[2])}let O=B.length>0?`
2418
+ export { ${B.join(", ")} }`:"";await Bun.write(U,X+O),s1("bundling:",Q,"from:",L0.basename($));let L=new Set;try{let F=await Bun.build({entrypoints:[U],outdir:K,target:"browser",format:"esm",minify:J,plugins:[gU(Y,z,U,L)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...C0()},root:Y});if(!F.success){let I=F.logs.filter((C)=>C.level==="error").map((C)=>C.message).join(", ");return console.warn("[stx:bundler] build failed:",I),X}let V="";for(let I of F.outputs){V=await I.text();break}let A=[];for(let I of V.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let C of I[1].split(",")){let S=C.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let b=C.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))A.push([b,b])}let R=V.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];V=V.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let T=`__stxBundle_${Q}`,M=A.map(([I,C])=>`${JSON.stringify(I)}: ${C}`).join(", "),k=A.map(([I])=>`var ${I} = undefined;`).join(`
2411
2419
  `),N=A.map(([I])=>`${I} = ${T}[${JSON.stringify(I)}];`).join(`
2412
2420
  `);if(V=`${R.join(`
2413
2421
  `)}
@@ -2416,26 +2424,18 @@ var ${T} = (function() {
2416
2424
  ${V}
2417
2425
  return { ${M} };
2418
2426
  })();
2419
- ${N}`.trim(),s1("bundled:",Q,"output:",V.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${L0.basename($)} (${Q}); serving the unbundled source and not caching this result`),X;P0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let y=Array.from(L).map((I)=>{try{return{path:I,mtimeMs:P0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(q,JSON.stringify({metadataVersion:O6,files:y})),V}catch(F){let V=c$(F,$||void 0),A=j6(F,$||void 0);if(console.warn(`[stx:bundler] error: ${A}`),V6($||"",A,V),A6()==="error")throw F;return X}finally{try{P0.rmSync(K,{force:!0}),P0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var VK=5,O6=1,n$,i$,H6,p$,L6;var N7=D(()=>{E1();OX();H1();n$=[];H6=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];p$=new Map,L6=Symbol.for("stx.client-bundle-build-queue")});var b6={};t(b6,{stripCommentsAndLiterals:()=>AX,renderVendorStyleTags:()=>VX,processClientScript:()=>t1,injectBrowserCoreAutoImports:()=>E5,generateServerDataBridge:()=>RX,generateBrowserAutoImportDestructuring:()=>gK,generateAutoImportDestructuring:()=>r$,extractBridgeData:()=>a1,extractAndStripCssImports:()=>FX,STX_AUTO_IMPORTS:()=>k6});import o1 from"path";import I7 from"fs";function DK(X){if(X.startsWith(".")||X.startsWith("/"))return null;if(X.startsWith("@")){let Z=X.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let $=X.match(/^([^/]+)(\/.*)?$/);if(!$)return null;return{pkg:$[1],subpath:$[2]||""}}function yK(X,$){let Z=$;while(!0){let Y=o1.join(Z,"node_modules",X,"package.json");if(I7.existsSync(Y))return o1.dirname(Y);let J=o1.dirname(Z);if(J===Z)return null;Z=J}}function bK(X,$){if(!X||typeof X!=="object")return null;let Z=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Z(J.import);if(typeof J.default==="object")return Z(J.default)}return null};if(Object.prototype.hasOwnProperty.call(X,$))return Z(X[$]);let Y=null;for(let J of Object.keys(X)){let G=J.indexOf("*");if(G===-1)continue;let Q=J.slice(0,G),w=J.slice(G+1);if(!$.startsWith(Q)||!$.endsWith(w))continue;if($.length<Q.length+w.length)continue;if(!Y||Q.length>Y.prefix.length)Y={pattern:J,prefix:Q,suffix:w}}if(Y){let J=$.slice(Y.prefix.length,$.length-Y.suffix.length),G=Z(X[Y.pattern]);if(G)return G.replace("*",J)}return null}function SK(X,$){let Z=DK(X);if(!Z||!Z.subpath)return null;let Y=yK(Z.pkg,$);if(!Y)return null;let J;try{J=JSON.parse(I7.readFileSync(o1.join(Y,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=bK(J.exports,G);if(!Q)return null;let w=o1.resolve(Y,Q);return I7.existsSync(w)?w:null}function FX(X,$){let Z=$.filePath?o1.dirname($.filePath):$.projectRoot||process.cwd(),Y=$.projectRoot||process.cwd(),J=new Set,G=[];return{code:X.replace(EK,(w,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:o1.resolve(Z,q),!I7.existsSync(W))throw Error(`file not found: ${W}`)}else{let K=null;try{K=Bun.resolveSync(q,Y)}catch{K=SK(q,Y)}if(!K)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=K}}catch(K){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${$.filePath||"<unknown>"}): ${K?.message||K}`),""}if(J.has(W))return"";J.add(W);try{let K=I7.readFileSync(W,"utf8");G.push({source:q,resolvedPath:W,contents:K})}catch(K){console.warn(`[stx:vendor-css] could not read ${W}: ${K?.message||K}`)}return""}),styles:G}}function CK(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function VX(X){if(X.length===0)return"";return`${X.map(($)=>{return`<style data-stx-vendor="${CK($.source)}" data-stx-layer="vendor">
2427
+ ${N}`.trim(),s1("bundled:",Q,"output:",V.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${L0.basename($)} (${Q}); serving the unbundled source and not caching this result`),X;P0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let y=Array.from(L).map((I)=>{try{return{path:I,mtimeMs:P0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(q,JSON.stringify({metadataVersion:N6,files:y})),V}catch(F){let V=c$(F,$||void 0),A=R6(F,$||void 0);if(console.warn(`[stx:bundler] error: ${A}`),I6($||"",A,V),E6()==="error")throw F;return X}finally{try{P0.rmSync(U,{force:!0}),P0.rmSync(K,{recursive:!0,force:!0})}catch{}}}var CU=5,N6=1,n$,i$,T6,p$,M6;var k7=D(()=>{E1();VX();j1();n$=[];T6=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];p$=new Map,M6=Symbol.for("stx.client-bundle-build-queue")});var f6={};t(f6,{stripCommentsAndLiterals:()=>I1,renderVendorStyleTags:()=>RX,processClientScript:()=>t1,injectBrowserCoreAutoImports:()=>D5,generateServerDataBridge:()=>TX,generateBrowserAutoImportDestructuring:()=>sU,generateAutoImportDestructuring:()=>r$,findInterpolationEnd:()=>FX,extractBridgeData:()=>a1,extractAndStripCssImports:()=>AX,STX_AUTO_IMPORTS:()=>C6});import o1 from"path";import E7 from"fs";function mU(X){if(X.startsWith(".")||X.startsWith("/"))return null;if(X.startsWith("@")){let Z=X.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let $=X.match(/^([^/]+)(\/.*)?$/);if(!$)return null;return{pkg:$[1],subpath:$[2]||""}}function lU(X,$){let Z=$;while(!0){let Y=o1.join(Z,"node_modules",X,"package.json");if(E7.existsSync(Y))return o1.dirname(Y);let J=o1.dirname(Z);if(J===Z)return null;Z=J}}function cU(X,$){if(!X||typeof X!=="object")return null;let Z=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Z(J.import);if(typeof J.default==="object")return Z(J.default)}return null};if(Object.prototype.hasOwnProperty.call(X,$))return Z(X[$]);let Y=null;for(let J of Object.keys(X)){let G=J.indexOf("*");if(G===-1)continue;let Q=J.slice(0,G),w=J.slice(G+1);if(!$.startsWith(Q)||!$.endsWith(w))continue;if($.length<Q.length+w.length)continue;if(!Y||Q.length>Y.prefix.length)Y={pattern:J,prefix:Q,suffix:w}}if(Y){let J=$.slice(Y.prefix.length,$.length-Y.suffix.length),G=Z(X[Y.pattern]);if(G)return G.replace("*",J)}return null}function pU(X,$){let Z=mU(X);if(!Z||!Z.subpath)return null;let Y=lU(Z.pkg,$);if(!Y)return null;let J;try{J=JSON.parse(E7.readFileSync(o1.join(Y,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=cU(J.exports,G);if(!Q)return null;let w=o1.resolve(Y,Q);return E7.existsSync(w)?w:null}function AX(X,$){let Z=$.filePath?o1.dirname($.filePath):$.projectRoot||process.cwd(),Y=$.projectRoot||process.cwd(),J=new Set,G=[];return{code:X.replace(dU,(w,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:o1.resolve(Z,q),!E7.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,Y)}catch{U=pU(q,Y)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${$.filePath||"<unknown>"}): ${U?.message||U}`),""}if(J.has(W))return"";J.add(W);try{let U=E7.readFileSync(W,"utf8");G.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:G}}function iU(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function RX(X){if(X.length===0)return"";return`${X.map(($)=>{return`<style data-stx-vendor="${iU($.source)}" data-stx-layer="vendor">
2420
2428
  @layer vendor {
2421
2429
  ${$.contents}
2422
2430
  }
2423
2431
  </style>`}).join(`
2424
2432
  `)}
2425
- `}function E5(X){let $=AX(X),Z=new Set;for(let w of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of w[1].split(",")){let W=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)Z.add(W)}let Y=new Set;for(let w of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(w[1]);for(let w of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of w[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)Y.add(W)}let J=I6.filter((w)=>{if(Z.has(w)||Y.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test($)}),G=D6($).filter((w)=>!Z.has(w)&&!Y.has(w));if(J.length===0&&G.length===0)return{code:X,imports:J,models:G};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2433
+ `}function D5(X){let $=I1(X),Z=new Set;for(let w of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of w[1].split(",")){let W=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)Z.add(W)}let Y=new Set;for(let w of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(w[1]);for(let w of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of w[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)Y.add(W)}let J=P6.filter((w)=>{if(Z.has(w)||Y.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test($)}),G=v6($).filter((w)=>!Z.has(w)&&!Y.has(w));if(J.length===0&&G.length===0)return{code:X,imports:J,models:G};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2426
2434
  `)}
2427
- ${X}`,imports:J,models:G}}function vK(X,$){let Z=X[$],Y=$+1;while(Y<X.length){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===Z)return Y+1;Y++}return X.length}function xK(X,$){let Z=$+1;while(Z<X.length){if(X[Z]==="\\"){Z+=2;continue}if(X[Z]==="`")return Z+1;if(X[Z]==="$"&&X[Z+1]==="{"){if(Z=E6(X,Z+2),Z<X.length)Z++;continue}Z++}return X.length}function E6(X,$){let Z=1,Y=$;while(Y<X.length){let J=X[Y];if(J==="\\"){Y+=2;continue}if(J==='"'||J==="'"){Y=vK(X,Y);continue}if(J==="`"){Y=xK(X,Y);continue}if(J==="/"&&X[Y+1]==="/"){while(Y<X.length&&X[Y]!==`
2428
- `)Y++;continue}if(J==="/"&&X[Y+1]==="*"){Y+=2;while(Y<X.length&&X.slice(Y,Y+2)!=="*/")Y++;Y+=2;continue}if(J==="{"){Z++,Y++;continue}if(J==="}"){if(Z--,Z===0)return Y;Y++;continue}Y++}return X.length}function AX(X){let $="",Z=0;while(Z<X.length){let Y=X.slice(Z,Z+2);if(Y==="//"){while(Z<X.length&&X[Z]!==`
2429
- `)$+=" ",Z++;continue}if(Y==="/*"){while(Z<X.length&&X.slice(Z,Z+2)!=="*/")$+=X[Z]===`
2430
- `?`
2431
- `:" ",Z++;$+=" ",Z+=2;continue}let J=X[Z];if(J==='"'||J==="'"){let G=J;$+=" ",Z++;while(Z<X.length&&X[Z]!==G){if(X[Z]==="\\"){$+=" ",Z+=2;continue}$+=X[Z]===`
2432
- `?`
2433
- `:" ",Z++}$+=" ",Z++;continue}if(J==="`"){$+=" ",Z++;while(Z<X.length&&X[Z]!=="`"){if(X[Z]==="\\"){$+=" ",Z+=2;continue}if(X[Z]==="$"&&X[Z+1]==="{"){let G=Z+2,Q=E6(X,G);if($+=" ",$+=AX(X.slice(G,Q)),Q<X.length)$+=" ";Z=Q+1;continue}$+=X[Z]===`
2434
- `?`
2435
- `:" ",Z++}$+=" ",Z++;continue}$+=J,Z++}return $}function D6(X){let $=new Set,Z=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=Z.exec(X))!==null)if(!PK.has(Y[1]))$.add(Y[1]);return Array.from($)}function fK(X){let $=new Set;for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Y of Z[1].split(",")){let J=Y.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))$.add(J)}return $}function y6(X){let $=new Set,Z=new Set,Y=X;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,G=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,Q;while((Q=G.exec(X))!==null){let W=Q[1],K=Q[2];if(Q[0].includes("import type"))continue;let U=[];for(let B of W.split(",")){let _=B.trim();if(!_||_.startsWith("type "))continue;let j=_.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!j)continue;let H=j[1],O=j[2]||H;if(J.add(H),J.add(O),K==="stx"||K==="@stacksjs/stx")$.add(H);else Z.add(H);if(O!==H)U.push(`${O} = ${H}`)}let z=U.length>0?`var ${U.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";Y=Y.replace(Q[0],z)}let w=fK(Y);for(let W of k6){if(J.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(Y))$.add(W)}for(let W of I6){if(J.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(Y))Z.add(W)}let q=D6(Y);for(let W of q)if(!J.has(W)&&!w.has(W))Z.add(W);return{code:Y,stxImports:Array.from($),browserImports:Array.from(Z)}}function r$(X,$){let Z=[];if(X.length>0)Z.push(` var { ${X.join(", ")} } = window.stx || window;`);if($.length>0)Z.push(` var { ${$.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
2435
+ ${X}`,imports:J,models:G}}function v6(X){let $=new Set,Z=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=Z.exec(X))!==null)if(!nU.has(Y[1]))$.add(Y[1]);return Array.from($)}function rU(X){let $=new Set;for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Y of Z[1].split(",")){let J=Y.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))$.add(J)}return $}function x6(X){let $=new Set,Z=new Set,Y=X;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,G=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,Q;while((Q=G.exec(X))!==null){let W=Q[1],U=Q[2];if(Q[0].includes("import type"))continue;let K=[];for(let B of W.split(",")){let _=B.trim();if(!_||_.startsWith("type "))continue;let j=_.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!j)continue;let H=j[1],O=j[2]||H;if(J.add(H),J.add(O),U==="stx"||U==="@stacksjs/stx")$.add(H);else Z.add(H);if(O!==H)K.push(`${O} = ${H}`)}let z=K.length>0?`var ${K.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";Y=Y.replace(Q[0],z)}let w=rU(Y);for(let W of C6){if(J.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(Y))$.add(W)}for(let W of P6){if(J.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(Y))Z.add(W)}let q=v6(Y);for(let W of q)if(!J.has(W)&&!w.has(W))Z.add(W);return{code:Y,stxImports:Array.from($),browserImports:Array.from(Z)}}function r$(X,$){let Z=[];if(X.length>0)Z.push(` var { ${X.join(", ")} } = window.stx || window;`);if($.length>0)Z.push(` var { ${$.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
2436
2436
  ${Z.join(`
2437
2437
  `)}
2438
- ${hK(X,$)}`;return""}function gK(X,$=[]){let{browserImports:Z}=y6(X),Y=new Set($);return r$([],Z.filter((J)=>!Y.has(J)))}function hK(X,$){let Z=[...X.map((Y)=>`['${Y}', typeof ${Y}, 'stx']`),...$.map((Y)=>`['${Y}', typeof ${Y}, '@stacksjs/browser']`)];if(Z.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
2438
+ ${oU(X,$)}`;return""}function sU(X,$=[]){let{browserImports:Z}=x6(X),Y=new Set($);return r$([],Z.filter((J)=>!Y.has(J)))}function oU(X,$){let Z=[...X.map((Y)=>`['${Y}', typeof ${Y}, 'stx']`),...$.map((Y)=>`['${Y}', typeof ${Y}, '@stacksjs/browser']`)];if(Z.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
2439
2439
  [${Z.join(", ")}].forEach(function (e) {
2440
2440
  if (e[1] !== 'undefined') return;
2441
2441
  console.error(
@@ -2444,15 +2444,15 @@ ${hK(X,$)}`;return""}function gK(X,$=[]){let{browserImports:Z}=y6(X),Y=new Set($
2444
2444
  + 'or it should be imported from a relative path so the bundler includes it.'
2445
2445
  );
2446
2446
  });
2447
- `}function a1(X){let $=X.__stxClientPayload;if($&&typeof $==="object"){let Y={};for(let J in $){let G=$[J];if(typeof G==="function")continue;Y[J]=G}return Y.__stxDeclaredPayload=!0,Y}let Z={};for(let Y in X){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=X[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function T6(X,$){let Z=new Set;for(let Y of X.split(",")){let J=Y.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if($){let G=J.lastIndexOf(":");if(G!==-1)J=J.slice(G+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function uK(X,$){if(new RegExp(`(?:const|let|var|function|class)\\s+${$}\\b`).test(X))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(T6(Z[1],!0).has($))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(T6(Z[1],!1).has($))return!0;return!1}function dK(X,$){return new RegExp(`(?<![.#\\w$])${$}(?![\\w$])`).test(X)}function lK(X,$){let Z=mK.test(X),Y=$.length>32768;if(!Z&&!Y)return;if(M6.has(X))return;if(M6.add(X),Z)console.warn(`[stx] server\u2192client bridge is publishing "${X}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(Y)console.warn(`[stx] server\u2192client bridge is publishing ${($.length/1024).toFixed(1)}KB under "${X}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function RX(X,$){if(!$)return"";let Z=AX(X),Y=$.__stxDeclaredPayload===!0,J=[];for(let[G,Q]of Object.entries($)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!Y&&!dK(Z,G))continue;if(uK(X,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;lK(G,w),J.push(` var ${G} = ${w.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2447
+ `}function a1(X){let $=X.__stxClientPayload;if($&&typeof $==="object"){let Y={};for(let J in $){let G=$[J];if(typeof G==="function")continue;Y[J]=G}return Y.__stxDeclaredPayload=!0,Y}let Z={};for(let Y in X){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=X[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function y6(X,$){let Z=new Set;for(let Y of X.split(",")){let J=Y.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if($){let G=J.lastIndexOf(":");if(G!==-1)J=J.slice(G+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function aU(X,$){if(new RegExp(`(?:const|let|var|function|class)\\s+${$}\\b`).test(X))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(y6(Z[1],!0).has($))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(y6(Z[1],!1).has($))return!0;return!1}function tU(X,$){return new RegExp(`(?<![.#\\w$])${$}(?![\\w$])`).test(X)}function XK(X,$){let Z=eU.test(X),Y=$.length>32768;if(!Z&&!Y)return;if(b6.has(X))return;if(b6.add(X),Z)console.warn(`[stx] server\u2192client bridge is publishing "${X}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(Y)console.warn(`[stx] server\u2192client bridge is publishing ${($.length/1024).toFixed(1)}KB under "${X}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function TX(X,$){if(!$)return"";let Z=I1(X),Y=$.__stxDeclaredPayload===!0,J=[];for(let[G,Q]of Object.entries($)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!Y&&!tU(Z,G))continue;if(aU(X,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;XK(G,w),J.push(` var ${G} = ${w.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2448
2448
  ${J.join(`
2449
2449
  `)}
2450
- `}function pK(X){let $=[];if(X.self)$.push("if ($event.target !== $el) return");for(let Z of X.systemKeys)$.push(`if (!$event.${Z}Key) return`);if(X.keys.length>0){let Z=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");$.push(`if (!(${Z})) return`)}if(X.mouse!==null){let Z=cK[X.mouse];$.push(`if ($event.button !== ${Z}) return`)}if(X.prevent)$.push("$event.preventDefault()");if(X.stop)$.push("$event.stopPropagation()");return $.join("; ")}function iK(X,$){let{elementId:Z,event:Y,modifiers:J}=X,G=u$(X.handler),Q=pK(J),w=[];if(J.once)w.push("once: true");if(J.capture)w.push("capture: true");if(J.passive)w.push("passive: true");let q=w.length>0?`, { ${w.join(", ")} }`:"",W="";if(Q)W+=`${Q}; `;let K=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
2450
+ `}function ZK(X){let $=[];if(X.self)$.push("if ($event.target !== $el) return");for(let Z of X.systemKeys)$.push(`if (!$event.${Z}Key) return`);if(X.keys.length>0){let Z=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");$.push(`if (!(${Z})) return`)}if(X.mouse!==null){let Z=$K[X.mouse];$.push(`if ($event.button !== ${Z}) return`)}if(X.prevent)$.push("$event.preventDefault()");if(X.stop)$.push("$event.stopPropagation()");return $.join("; ")}function YK(X,$){let{elementId:Z,event:Y,modifiers:J}=X,G=u$(X.handler),Q=ZK(J),w=[];if(J.once)w.push("once: true");if(J.capture)w.push("capture: true");if(J.passive)w.push("passive: true");let q=w.length>0?`, { ${w.join(", ")} }`:"",W="";if(Q)W+=`${Q}; `;let U=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),K=`var $emit = function(name, detail) {
2451
2451
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
2452
- };`;function z(B){if(/\$emit\s*\(/.test(B))return`${U}
2452
+ };`;function z(B){if(/\$emit\s*\(/.test(B))return`${K}
2453
2453
  ${B}`;return`var scope = $el.closest('[data-stx-scope]');
2454
2454
  if (scope && scope.__stx_execute) {
2455
- scope.__stx_execute('${K}', $event, $el);
2455
+ scope.__stx_execute('${U}', $event, $el);
2456
2456
  }
2457
2457
  else {
2458
2458
  ${B}
@@ -2479,36 +2479,36 @@ else {
2479
2479
  }${q})
2480
2480
  })()`;if(/\$emit\s*\(/.test(G))return` var $el = document.getElementById('${Z}')
2481
2481
  if ($el) $el.addEventListener('${Y}', function($event) {
2482
- ${W}${U}
2482
+ ${W}${K}
2483
2483
  ${G}
2484
2484
  }${q})`;return` var $el = document.getElementById('${Z}')
2485
2485
  if ($el) $el.addEventListener('${Y}', function($event) {
2486
2486
  ${W}var scope = $el.closest('[data-stx-scope]');
2487
2487
  if (scope && scope.__stx_execute) {
2488
- scope.__stx_execute('${K}', $event, $el);
2488
+ scope.__stx_execute('${U}', $event, $el);
2489
2489
  }
2490
2490
  else {
2491
2491
  ${G}
2492
2492
  }
2493
- }${q})`}function nK(X){if(X.length===0)return"";return`
2493
+ }${q})`}function JK(X){if(X.length===0)return"";return`
2494
2494
  // STX: auto-generated event bindings
2495
- ${X.map((Z,Y)=>iK(Z,Y)).join(`
2496
- `)}`}function N6(X){let $=[],Z=new Set,Y=X.replace(/^\s*import\s+.*$/gm,""),J=0,G=Y.length,Q=0;while(Q<G){let w=Y[Q];if(w==="'"||w==='"'||w==="`"){let q=w;if(Q++,q==="`"){let W=0;while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]==="`"&&W===0){Q++;break}if(Y[Q]==="$"&&Y[Q+1]==="{"){W++,Q+=2;continue}if(Y[Q]==="}"&&W>0){W--,Q++;continue}Q++}}else while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]===q){Q++;break}Q++}continue}if(w==="/"&&Y[Q+1]==="/"){while(Q<G&&Y[Q]!==`
2497
- `)Q++;continue}if(w==="/"&&Y[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Y[Q]==="*"&&Y[Q+1]==="/"))Q++;Q+=2;continue}if(w==="{"){J++,Q++;continue}if(w==="}"){J--,Q++;continue}if(J===0){let q=Y.slice(Q),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let z=W[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=W[0].length;continue}let K=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[1].split(",").forEach((z)=>{let B=z.trim(),_=B.indexOf(":"),j=_>=0?B.slice(_+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(j&&!j.startsWith("_")&&!Z.has(j))$.push(j),Z.add(j)}),Q+=K[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let z=U[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=U[0].length;continue}}Q++}return $}function sK(X){let $=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(z){let B;while((B=Z.exec(z))!==null){let _=B[0];if(!rK.has(_))$.add(_)}}let J=/\{\{([\s\S]*?)\}\}/g,G;while((G=J.exec(X))!==null)Y(G[1]);let Q=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((G=Q.exec(X))!==null)Y(G[1]);let w=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((G=w.exec(X))!==null)Y(G[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=q.exec(X))!==null)Y(G[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=W.exec(X))!==null)Y(G[1]);let K=/@model\s*=\s*["']([^"']*)["']/gi;while((G=K.exec(X))!==null)Y(G[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((G=U.exec(X))!==null)Y(G[1]);return $}async function t1(X,$={}){let Z=X,Y="",J=!1,G=[],Q=FX(Z,{filePath:$.filePath,projectRoot:$.projectRoot});Z=Q.code;let w=VX(Q.styles),q=E5(Z);Z=q.code,G=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:K}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (N7(),M7)));if(W(Z))Z=await K(Z,$.filePath||"",{projectRoot:$.projectRoot,minify:$.production}),J=!0;if($.autoImports!==!1){let L=y6(Z);Z=L.code,Y=r$(L.stxImports,L.browserImports.filter((F)=>!G.includes(F)))}if(Y=`${RX(Z,$.serverData)}${Y}`,Z=h0(Z),!J&&e1($.attrs||""))Z=X5(Z);let U=nK($.eventBindings||[]),z=($.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(z)){let L=z.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${w}<script ${F}>
2498
- ${k5(`${Y}${Z}
2499
- ${U}`)}
2495
+ ${X.map((Z,Y)=>YK(Z,Y)).join(`
2496
+ `)}`}function S6(X){let $=[],Z=new Set,Y=X.replace(/^\s*import\s+.*$/gm,""),J=0,G=Y.length,Q=0;while(Q<G){let w=Y[Q];if(w==="'"||w==='"'||w==="`"){let q=w;if(Q++,q==="`"){let W=0;while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]==="`"&&W===0){Q++;break}if(Y[Q]==="$"&&Y[Q+1]==="{"){W++,Q+=2;continue}if(Y[Q]==="}"&&W>0){W--,Q++;continue}Q++}}else while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]===q){Q++;break}Q++}continue}if(w==="/"&&Y[Q+1]==="/"){while(Q<G&&Y[Q]!==`
2497
+ `)Q++;continue}if(w==="/"&&Y[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Y[Q]==="*"&&Y[Q+1]==="/"))Q++;Q+=2;continue}if(w==="{"){J++,Q++;continue}if(w==="}"){J--,Q++;continue}if(J===0){let q=Y.slice(Q),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let z=W[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((z)=>{let B=z.trim(),_=B.indexOf(":"),j=_>=0?B.slice(_+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(j&&!j.startsWith("_")&&!Z.has(j))$.push(j),Z.add(j)}),Q+=U[0].length;continue}let K=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(K){let z=K[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=K[0].length;continue}}Q++}return $}function QK(X){let $=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(z){let B;while((B=Z.exec(z))!==null){let _=B[0];if(!GK.has(_))$.add(_)}}let J=/\{\{([\s\S]*?)\}\}/g,G;while((G=J.exec(X))!==null)Y(G[1]);let Q=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((G=Q.exec(X))!==null)Y(G[1]);let w=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((G=w.exec(X))!==null)Y(G[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=q.exec(X))!==null)Y(G[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=W.exec(X))!==null)Y(G[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((G=U.exec(X))!==null)Y(G[1]);let K=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((G=K.exec(X))!==null)Y(G[1]);return $}async function t1(X,$={}){let Z=X,Y="",J=!1,G=[],Q=AX(Z,{filePath:$.filePath,projectRoot:$.projectRoot});Z=Q.code;let w=RX(Q.styles),q=D5(Z);Z=q.code,G=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:U}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (k7(),N7)));if(W(Z))Z=await U(Z,$.filePath||"",{projectRoot:$.projectRoot,minify:$.production}),J=!0;if($.autoImports!==!1){let L=x6(Z);Z=L.code,Y=r$(L.stxImports,L.browserImports.filter((F)=>!G.includes(F)))}if(Y=`${TX(Z,$.serverData)}${Y}`,Z=h0(Z),!J&&e1($.attrs||""))Z=X5(Z);let K=JK($.eventBindings||[]),z=($.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(z)){let L=z.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${w}<script ${F}>
2498
+ ${I5(`${Y}${Z}
2499
+ ${K}`)}
2500
2500
  </script>`}let _=g$(X),j=/function __stx_setup_/.test(Z),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(X);function O(L){let F=L.length>0?`
2501
2501
  return { ${L.join(", ")} };`:"";return`${w}<script data-stx-scoped data-stx-run="always">
2502
2502
  window.stx.mount(function() {
2503
2503
  'use strict';
2504
- ${k5(`${Y}${Z}
2505
- ${U}${F}`)}
2506
- })</script>`}if(!H&&!j){if(_)return O(N6(X));if($.templateContent){let L=N6(X);if(L.length>0){let F=sK($.templateContent);if(L.some((A)=>F.has(A)))return O(L)}}}return`${w}<script data-stx-scoped data-stx-run="always">
2504
+ ${I5(`${Y}${Z}
2505
+ ${K}${F}`)}
2506
+ })</script>`}if(!H&&!j){if(_)return O(S6(X));if($.templateContent){let L=S6(X);if(L.length>0){let F=QK($.templateContent);if(L.some((A)=>F.has(A)))return O(L)}}}return`${w}<script data-stx-scoped data-stx-run="always">
2507
2507
  ;(function() {
2508
2508
  'use strict';
2509
- ${k5(`${Y}${Z}
2510
- ${U}`)}
2511
- })()</script>`}var EK,k6,I6,PK,mK,M6,cK,rK;var D5=D(()=>{m$();T0();F7();G1();l$();EK=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;k6=j1,I6=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];PK=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"]);mK=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,M6=new Set;cK={left:0,middle:1,right:2};rK=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 oK}from"crypto";function S6(X){let $=X[TX];return $ instanceof Map?$:null}function C6(X){X[TX]=new Map}function P6(X,$){let Z=S6(X);if(!Z)return null;let Y=oK("sha256").update($).digest("hex").slice(0,16),J=Z.get(Y);if(J)J.instances++;else Z.set(Y,{body:$,instances:1});return Y}function v6(X,$){let Z=S6($);if(!Z?.size)return X;let Y=X;for(let[q,W]of Z){if(W.instances!==1)continue;let K=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(K,(U,z)=>`(${W.body})(${z});`)}let J=[...Z].filter(([,q])=>q.instances>1);if(J.length===0)return Y;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2509
+ ${I5(`${Y}${Z}
2510
+ ${K}`)}
2511
+ })()</script>`}var dU,C6,P6,nU,eU,b6,$K,GK;var y5=D(()=>{m$();T0();V7();J1();l$();dU=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;C6=B1,P6=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];nU=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);eU=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,b6=new Set;$K={left:0,middle:1,right:2};GK=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});import{createHash as wK}from"crypto";function g6(X){let $=X[MX];return $ instanceof Map?$:null}function h6(X){X[MX]=new Map}function u6(X,$){let Z=g6(X);if(!Z)return null;let Y=wK("sha256").update($).digest("hex").slice(0,16),J=Z.get(Y);if(J)J.instances++;else Z.set(Y,{body:$,instances:1});return Y}function d6(X,$){let Z=g6($);if(!Z?.size)return X;let Y=X;for(let[q,W]of Z){if(W.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(U,(K,z)=>`(${W.body})(${z});`)}let J=[...Z].filter(([,q])=>q.instances>1);if(J.length===0)return Y;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2512
2512
  (function() {
2513
2513
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
2514
2514
  ${J.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${W.body}; }
@@ -2517,7 +2517,7 @@ ${J.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.str
2517
2517
  })();
2518
2518
  </script>`,w=Y.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(w<0)return`${Q}
2519
2519
  ${Y}`;return`${Y.slice(0,w)}${Q}
2520
- ${Y.slice(w)}`}var TX="__stx_component_client_factories";var s$=()=>{};function XU(X){let $="",Z=null,Y=!1;for(let J=0;J<X.length;J++){let G=X[J];if(Y){Y=!1;continue}if(G==="\\"&&Z){Y=!0;continue}if(Z){if(Z==="`"&&G==="$"&&J+1<X.length&&X[J+1]==="{"){let Q=1;J+=2;while(J<X.length&&Q>0){if(X[J]==="{")Q++;else if(X[J]==="}")Q--;if(Q>0)$+=X[J],J++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}$+=G}return $}function $U(X,$){let Z=/[$A-Z_a-z][$\w]*/g,Y;while((Y=Z.exec(X))!==null){let J=Y[0],G=X[Y.index-1];if(tK.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${$}`);if(G==="."&&h6.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${$}`)}}function ZU(X){let $=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=$.exec(X))!==null){let Y=Z[2];if(!h6.has(Y))continue;let J=X.slice(0,Z.index).match(/\S(?=\s*$)/)?.[0],G=X.slice(Z.index+Z[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&G===":"))throw Error(`Potentially unsafe expression (bracket key ${Z[2]}): ${X}`)}}function MX(X){let $=X.trim(),Z=XU($);$U(Z,$),ZU($);for(let Y of g6)if(Y.test(Z))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${$}`);if(!f6.allowBracketNotation&&eK.test($))throw Error(`Bracket notation with strings not allowed: ${$}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return $}function YU(X){let $={};$.Math=Math,$.JSON=JSON,$.Date=Date,$.String=String,$.Number=Number,$.Boolean=Boolean,$.Array=Array,$.parseInt=Number.parseInt,$.parseFloat=Number.parseFloat,$.isNaN=Number.isNaN,$.isFinite=Number.isFinite,$.encodeURIComponent=encodeURIComponent,$.decodeURIComponent=decodeURIComponent;for(let[Z,Y]of Object.entries(X)){if(Z.startsWith("__")||g6.some((J)=>J.test(Z)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))$[Z]=o$(Y);else $[Z]=Y}return $}function o$(X,$=0){if($>=f6.maxSanitizeDepth)return"[Object too deep]";if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Y)=>o$(Y,$+1));if(X instanceof Date||X instanceof RegExp||X instanceof Map||X instanceof Set||X instanceof Error)return X;let Z={};for(let[Y,J]of Object.entries(X)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(J&&typeof J==="object")Z[Y]=o$(J,$+1);else Z[Y]=J}return Z}function Y0(X,$){try{let Z=YU($),Y=Object.keys(Z),J=Object.values(Z);return W0(X,Y)(...J)}catch{return}}function q0(X){try{return MX(X),!0}catch{return!1}}function O0(X,$){try{let Z=Y0(X,$);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function W0(X,$){let Z=MX(X),Y=/^[A-Za-z_$][\w$]*$/,J=[],G=[];for(let W=0;W<$.length;W++){let K=$[W];if(!Y.test(K))continue;if(u6.has(K))continue;J.push(W),G.push(K)}let Q=(W)=>Function(...G,...W,`
2520
+ ${Y.slice(w)}`}var MX="__stx_component_client_factories";var s$=()=>{};function KK(X){let $="",Z=null,Y=!1;for(let J=0;J<X.length;J++){let G=X[J];if(Y){Y=!1;continue}if(G==="\\"&&Z){Y=!0;continue}if(Z){if(Z==="`"&&G==="$"&&J+1<X.length&&X[J+1]==="{"){let Q=1;J+=2;while(J<X.length&&Q>0){if(X[J]==="{")Q++;else if(X[J]==="}")Q--;if(Q>0)$+=X[J],J++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}$+=G}return $}function zK(X,$){let Z=/[$A-Z_a-z][$\w]*/g,Y;while((Y=Z.exec(X))!==null){let J=Y[0],G=X[Y.index-1];if(WK.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${$}`);if(G==="."&&p6.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${$}`)}}function _K(X){let $=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=$.exec(X))!==null){let Y=Z[2];if(!p6.has(Y))continue;let J=X.slice(0,Z.index).match(/\S(?=\s*$)/)?.[0],G=X.slice(Z.index+Z[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&G===":"))throw Error(`Potentially unsafe expression (bracket key ${Z[2]}): ${X}`)}}function NX(X){let $=X.trim(),Z=KK($);zK(Z,$),_K($);for(let Y of c6)if(Y.test(Z))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${$}`);if(!l6.allowBracketNotation&&UK.test($))throw Error(`Bracket notation with strings not allowed: ${$}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return $}function BK(X){let $={};$.Math=Math,$.JSON=JSON,$.Date=Date,$.String=String,$.Number=Number,$.Boolean=Boolean,$.Array=Array,$.parseInt=Number.parseInt,$.parseFloat=Number.parseFloat,$.isNaN=Number.isNaN,$.isFinite=Number.isFinite,$.encodeURIComponent=encodeURIComponent,$.decodeURIComponent=decodeURIComponent;for(let[Z,Y]of Object.entries(X)){if(Z.startsWith("__")||c6.some((J)=>J.test(Z)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))$[Z]=o$(Y);else $[Z]=Y}return $}function o$(X,$=0){if($>=l6.maxSanitizeDepth)return"[Object too deep]";if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Y)=>o$(Y,$+1));if(X instanceof Date||X instanceof RegExp||X instanceof Map||X instanceof Set||X instanceof Error)return X;let Z={};for(let[Y,J]of Object.entries(X)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(J&&typeof J==="object")Z[Y]=o$(J,$+1);else Z[Y]=J}return Z}function Y0(X,$){try{let Z=BK($),Y=Object.keys(Z),J=Object.values(Z);return W0(X,Y)(...J)}catch{return}}function q0(X){try{return NX(X),!0}catch{return!1}}function O0(X,$){try{let Z=Y0(X,$);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function W0(X,$){let Z=NX(X),Y=/^[A-Za-z_$][\w$]*$/,J=[],G=[];for(let W=0;W<$.length;W++){let U=$[W];if(!Y.test(U))continue;if(i6.has(U))continue;J.push(W),G.push(U)}let Q=(W)=>Function(...G,...W,`
2521
2521
  'use strict';
2522
2522
  try {
2523
2523
  return ${Z};
@@ -2528,7 +2528,7 @@ catch (e) {
2528
2528
  }
2529
2529
  throw e;
2530
2530
  }
2531
- `),w=Q([]);if(G.length===$.length)return x6(w,G,Q);return x6((...W)=>{let K=Array(J.length);for(let U=0;U<J.length;U++)K[U]=W[J[U]];return w(...K)},G,Q,(W)=>{w=Q(W)})}function x6(X,$,Z,Y){let G=/^(\w+) is not defined$/,Q=X,w=[],q=new Set($);return(...W)=>{for(let K=0;K<=8;K++)try{return Q(...W)}catch(U){let z=U instanceof Error?U.message:"",B=G.exec(z);if(!(U instanceof ReferenceError)||!B)return;let _=B[1];if(q.has(_)||u6.has(_))return;q.add(_),w.push(_),Q=Z(w),Y?.(w)}return}}function NX(X){let $=X.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of Z)if(Y.test($))return!1;return!0}var aK,f6,g6,tK,h6,eK,u6;var F0=D(()=>{aK={maxSanitizeDepth:10,allowBracketNotation:!1},f6={...aK},g6=[/\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/],tK=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"]),h6=new Set(["__proto__","constructor","prototype"]),eK=/[\w)\]]\s*\[\s*['"]/;u6=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function kX(X,$){let Z=JU++,Y=`<!--__STX_${X.toUpperCase()}_${Z}__-->`;return GU.set(Y,{type:X,expression:$}),Y}var JU=0,GU;var d6=D(()=>{GU=new Map});function i6(X,$,Z,Y){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);if(!G)return-1;return G.index+G[0].length}function D1(X,$){return i6(X,$,m6,l6)}function y5(X,$){return i6(X,$,c6,p6)}function E7(X,$){if(!X.startsWith("<!--",$))return-1;let Z=X.indexOf("-->",$+4);if(Z===-1)return-1;return Z+3}function QU(X,$){if(X.startsWith("<!--",$)){let Z=E7(X,$);return Z===-1?X.length:Z}for(let[Z,Y]of[[m6,l6],[c6,p6]]){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);return G?G.index+G[0].length:X.length}return-1}function a$(X,$){let Z=[],Y=0,J=X.length,G=!1,Q=null;while(Y<J){let w=X[Y];if(G){if(Q){if(w===Q)Q=null}else if(w==='"'||w==="'")Q=w;else if(w===">")G=!1;Y++;continue}if(w!=="<"){Y++;continue}let q=$(X,Y);if(q>Y){Z.push({start:Y,end:q,token:X.slice(Y,q)}),Y=q;continue}let W=QU(X,Y);if(W>Y){Y=W;continue}if(/^<\/?[a-zA-Z]/.test(X.slice(Y,Y+2)))G=!0;Y++}return Z}function Q1(X,$,Z){let Y=a$(X,$);if(Y.length===0)return{output:X,tokens:[]};let J=Y.map((w)=>w.token),G="",Q=0;for(let w=0;w<Y.length;w++){let q=Y[w];G+=X.slice(Q,q.start),G+=Z(q.token,w),Q=q.end}return G+=X.slice(Q),{output:G,tokens:J}}function y1(X){let{output:$,tokens:Z}=Q1(X,D1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:$,scripts:Z}}function D7(X,$){if($.length===0)return X;return X.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>$[+Y]??"")}var m6,l6,c6,p6;var $5=D(()=>{m6=/<script\b[^>]*>/iy,l6=/<\/script\s*>/ig,c6=/<style\b[^>]*>/iy,p6=/<\/style\s*>/ig});var e6={};t(e6,{usesSignalsInScript:()=>L1,unescapeHtml:()=>BU,registerFilters:()=>qU,registerFilter:()=>s6,processExpressions:()=>b1,interpolateScriptsInTemplate:()=>KU,interpolateScriptExpressions:()=>IX,interpolateScriptAttributes:()=>a6,getAllFilters:()=>o6,evaluateExpression:()=>v0,escapeHtml:()=>t0,defaultFilters:()=>b7,clearCustomFilters:()=>WU,applyFilters:()=>t6});function wU(X){let $=n6.get(X);if(!$){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");$=new RegExp(`:${Z}(?!\\w)`,"g"),n6.set(X,$)}return $.lastIndex=0,$}function s6(X,$){if(X in b7)console.warn(`Filter "${X}" already exists as a built-in filter. Custom filter will take precedence.`);y7[X]=$}function qU(X){for(let[$,Z]of Object.entries(X))s6($,Z)}function o6(){return{...b7,...y7}}function WU(){for(let X of Object.keys(y7))delete y7[X]}function t0(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function L1(X){let{scripts:$}=y1(X);for(let Z of $){let Y=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let J=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(X))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(X))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(X))return!0;return!1}function r6(X,$){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=X.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let W=0;W<Y.length;W++){let K=Y[W];if(!G&&K==="`"){G=!0,Q=0;continue}if(G){if(K==="`"&&Q===0){G=!1;continue}if(K==="$"&&Y[W+1]==="{"){Q++,W++,J+=" ";continue}if(K==="}"&&Q>0){Q--;continue}if(Q>0){J+=K;continue}continue}J+=K}Y=J;let w=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=w.exec(Y))!==null){let W=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(W)&&!(W in $))return!1}}return!0}function IX(X,$){let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=v0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=v0(J,$);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function a6(X,$){if(!X.includes("{"))return X;let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=v0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=v0(J,$);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return Y}}),Z}function KU(X,$,Z={}){let{output:Y,scripts:J}=y1(X),G=J.map((Q)=>{let w=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=Q.match(/^<script\b[^>]*>/i),W=Q.search(/<\/script\s*>$/i);if(!w||!q||W===-1)return Q;let K=w[1],U=w[2];if(/\bdata-raw\b/.test(K))return Q;if(Z.skipServer&&/\bserver\b/.test(K))return Q;let B=`<script${a6(K,$)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return B+U+Q.slice(W);return B+IX(U,$)+Q.slice(W)});return D7(Y,G)}function b1(X,$,Z){let Y=X,J=(U,z)=>{let B=y5(U,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(z,B))?-1:B},G=(U,z,B,_)=>{let j=B.length,{output:H,tokens:O}=Q1(U,z,(L,F)=>_(j+F));return B.push(...O),H},Q=[];Y=G(Y,J,Q,(U)=>`<!--__STX_STYLE_${U}__-->`);let w=[];Y=G(Y,D1,w,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let q=$?.__stx_signals_gate===!0||L1(X),W=new Set(Array.isArray($?.__stx_client_signal_names)?$.__stx_client_signal_names:[]),K=new Set(Array.isArray($?.__stx_preserved_client_expressions)?$.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,z,B)=>{try{let _=v0(z,$);return _!==void 0&&_!==null?String(_):""}catch(_){let j=_ instanceof Error?_.message:String(_);return U0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Z,X,B,U)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(U,z,B)=>{try{let _=v0(z,$);if(_===void 0&&$.__stx_buildMode==="compile")return kX("raw",z.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if($.__stx_buildMode==="compile")return kX("raw",z.trim());let j=_ instanceof Error?_.message:String(_);return U0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Z,X,B,U)}}),Y=G(Y,D1,w,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),Y=G(Y,J,Q,(U)=>`<!--__STX_STYLE_${U}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(U,z,B)=>{let _=z.trim();if(K.has(_))return U;let j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=_.match(H)?.[1],F=L&&((L in $)||j.includes(L)),V=Boolean(L&&W.has(L)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=_.match(A),T=R&&!j.includes(R[1])&&!(R[1]in $);if(/^__[A-Z_]+__$/.test(_))return"";try{let M=v0(z,$);if(V)return U;if(q&&!r6(_,$))return U;if(M===void 0&&$.__stx_buildMode==="compile"&&!q)return kX("expr",_);return M!==void 0&&M!==null?t0(String(M)):""}catch(M){if(V)return U;if(q&&!r6(_,$))return U;if(T)return U;let k=M instanceof Error?M.message:String(M);return U0("Expression",`Error evaluating: {{ ${_} }}: ${k}`,Z,X,B,U)}});for(let U=0;U<w.length;U++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>w[U]);for(let U=0;U<Q.length;U++)Y=Y.replace(`<!--__STX_STYLE_${U}__-->`,()=>Q[U]);return Y}function t6(X,$,Z){if(!$.trim())return X;let Y=X,J=$.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let w=y7[Q]||b7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(o6()).join(", ")}`);let q=[];if(J.startsWith(":")){let W=J.match(/^:([^|\s]+)/);if(W){let K=W[1].trim();try{let U=Number(K);q=[Number.isNaN(U)?K:U]}catch{q=[K]}J=J.substring(W[0].length).trim()}}else if(J.startsWith("(")){let W=1,K=1;while(W>0&&K<J.length){if(J[K]==="(")W++;if(J[K]===")")W--;K++}if(W===0){let U=J.substring(1,K-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[v0(`(${U})`,Z,!0)];else{let z=[],B="",_=null,j=0,H=0,O=0,L=!1;for(let F=0;F<U.length;F++){let V=U[F];if(L){B+=V,L=!1;continue}if(V==="\\"){B+=V,L=!0;continue}if(_){if(B+=V,V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=V,B+=V;continue}if(V==="(")j++;else if(V===")")j--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")O++;else if(V==="}")O--;if(V===","&&j===0&&H===0&&O===0){z.push(B),B="";continue}B+=V}if(B)z.push(B);q=z.map((F)=>{let V=F.trim();return v0(V,Z,!0)})}}catch{q=[U]}J=J.substring(K).trim()}}try{Y=w(Y,Z,...q)}catch(W){let K=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${Q}': ${K}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function UU(X){let $=!1,Z="",Y=0,J=0,G=0,Q=!1;for(let w=0;w<X.length;w++){let q=X[w],W=X[w+1];if($&&Q){Q=!1;continue}if($&&q==="\\"){Q=!0;continue}if(Q=!1,(q==='"'||q==="'"||q==="`")&&!Q){if(!$)$=!0,Z=q;else if(q===Z)$=!1,Z="";continue}if($&&Z==="`"&&q==="$"&&W==="{"){let K=1;w+=2;while(w<X.length&&K>0){if(X[w]==="{")K++;else if(X[w]==="}")K--;if(K>0)w++}continue}if($)continue;if(q==="(")Y++;else if(q===")")Y--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")G++;else if(q==="}")G--;if(q==="|"&&Y===0&&J===0&&G===0){if(W==="|"){w++;continue}if(W==="="){w++;continue}return w}}return-1}function v0(X,$,Z=!1){try{let Y=X.trim(),J=UU(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),w=v0(G,$,!0);return t6(w,Q,$)}if(!q0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return Y0(Y,$)}try{let G=Object.keys($),Q=Object.values($);return W0(Y,G)(...Q)}catch{return Y0(Y,$)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=zU(G,Object.keys($));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${X}`,Y);throw Y}}function zU(X,$){let Z=null;for(let J of $){if(J===X)continue;let G=_U(X,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max(X.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function _U(X,$){if(X===$)return 0;if(X.length===0)return $.length;if($.length===0)return X.length;let[Z,Y]=X.length<$.length?[X,$]:[$,X],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let w=1;w<=Z.length;w++){let q=Z[w-1]===Y[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,J[w]+1,J[w-1]+q)}for(let w=0;w<=Z.length;w++)J[w]=G[w]}return J[Z.length]}function BU(X){if(!X)return"";return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var y7,n6,b7;var w1=D(()=>{F0();T0();d6();$5();y7={},n6=new Map;b7={uppercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toUpperCase():""},lowercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toLowerCase():""},capitalize:(X,$)=>{if(X===void 0||X===null)return"";let Z=String(X);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:(X,$,Z=0)=>{if(X===void 0||X===null)return"";try{let Y=Number(X);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:(X,$,Z="en-US")=>{if(X===void 0||X===null)return"";try{let Y=Number(X);if(Number.isNaN(Y))return String(X);return Y.toLocaleString(Z)}catch{return String(X)}},join:(X,$,Z=",")=>{if(!Array.isArray(X))return"";return X.join(String(Z))},escape:(X,$)=>{if(X===void 0||X===null)return"";return t0(String(X))},translate:(X,$,Z={})=>{if(!$||!$.__translations)return X;let Y=$.__translations,J=$.__i18nConfig?.fallbackToKey??!0,G=String(X).split("."),Q=Y;for(let q of G){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return J?X:"";let w=String(Q);return Object.entries(Z).forEach(([q,W])=>{w=w.replace(wU(q),String(W))}),w},t:(X,$,Z={})=>{return b7.translate(X,$,Z)},truncate:(X,$,Z=50,Y="...")=>{if(X===void 0||X===null)return"";let J=String(X);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:(X,$,Z="short",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=X instanceof Date?X:new Date(X);if(Number.isNaN(J.getTime()))return String(X);let G={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Z==="iso")return J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String(X)}},currency:(X,$,Z="USD",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=Number(X);if(Number.isNaN(J))return String(X);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String(X)}},pluralize:(X,$,Z,Y)=>{let J=Number(X);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===1?Z:G},first:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[0];return String(X).charAt(0)},last:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[X.length-1];let Z=String(X);return Z.charAt(Z.length-1)},length:(X,$)=>{if(X===void 0||X===null)return 0;if(Array.isArray(X)||typeof X==="string")return X.length;if(X instanceof Map||X instanceof Set)return X.size;if(typeof X==="object")return Object.keys(X).length;return 0},json:(X,$,Z=!1)=>{if(X===void 0)return"undefined";if(X===null)return"null";try{return Z?JSON.stringify(X,null,2):JSON.stringify(X)}catch{return String(X)}},default:(X,$,Z="")=>{return X===void 0||X===null||X===""?Z:X},reverse:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return[...X].reverse();return String(X).split("").reverse().join("")},slice:(X,$,Z=0,Y)=>{if(X===void 0||X===null)return"";if(Array.isArray(X)||typeof X==="string")return X.slice(Z,Y);return X},replace:(X,$,Z,Y="")=>{if(X===void 0||X===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(X).replace(new RegExp(J,"g"),()=>Y)},stripTags:(X,$)=>{if(X===void 0||X===null)return"";return String(X).replace(/<[^>]*>/g,"")},urlencode:(X,$)=>{if(X===void 0||X===null)return"";return encodeURIComponent(String(X))},abs:(X,$)=>{let Z=Number(X);return Number.isNaN(Z)?0:Math.abs(Z)},round:(X,$,Z=0)=>{let Y=Number(X);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class Z5{cache=new Map;maxSize;constructor(X=100){this.maxSize=X}get(X){if(!this.cache.has(X))return;let $=this.cache.get(X);return this.cache.delete(X),this.cache.set(X,$),$}set(X,$){if(this.cache.has(X))this.cache.delete(X);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set(X,$)}has(X){return this.cache.has(X)}delete(X){return this.cache.delete(X)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function S5(X,$){if($?.includes("g"))return new RegExp(X,$);let Z=`${X}:${$||""}`;if(!b5.has(Z)){if(b5.size>=jU){let Y=b5.keys().next().value;if(Y)b5.delete(Y)}b5.set(Z,new RegExp(X,$))}return b5.get(Z)}class XZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(X){let $=Array.from(new Set(X)),Z=$.sort().join(","),Y=this.pool.find((w)=>w.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...w)=>{return(q)=>{try{let W=`${Z}:${q}`,K=J.get(W);if(!K){if(J.size>=G){let U=J.keys().next().value;if(U)J.delete(U)}K=Function(...$,`
2531
+ `),w=Q([]);if(G.length===$.length)return m6(w,G,Q);return m6((...W)=>{let U=Array(J.length);for(let K=0;K<J.length;K++)U[K]=W[J[K]];return w(...U)},G,Q,(W)=>{w=Q(W)})}function m6(X,$,Z,Y){let G=/^(\w+) is not defined$/,Q=X,w=[],q=new Set($);return(...W)=>{for(let U=0;U<=8;U++)try{return Q(...W)}catch(K){let z=K instanceof Error?K.message:"",B=G.exec(z);if(!(K instanceof ReferenceError)||!B)return;let _=B[1];if(q.has(_)||i6.has(_))return;q.add(_),w.push(_),Q=Z(w),Y?.(w)}return}}function kX(X){let $=X.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of Z)if(Y.test($))return!1;return!0}var qK,l6,c6,WK,p6,UK,i6;var F0=D(()=>{qK={maxSanitizeDepth:10,allowBracketNotation:!1},l6={...qK},c6=[/\b(eval|Function|setTimeout|setInterval|setImmediate)\b/,/\b(process|require|import|exports|module)\b/,/\b(window|document|global|globalThis)\b/,/\b(constructor|prototype|__proto__)\b/,/\b(Reflect|Proxy)\b/,/\bSymbol\b/,/\b(WeakMap|WeakSet|WeakRef|FinalizationRegistry)\b/,/\b(Generator|AsyncGenerator)\b/,/__\w+__/,/\.(bind|call|apply)\s*\(/,/\bnew\s+/,/\bdelete\s+/,/\bthis\b/],WK=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),p6=new Set(["__proto__","constructor","prototype"]),UK=/[\w)\]]\s*\[\s*['"]/;i6=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","enum","export","extends","false","finally","for","function","if","import","in","instanceof","new","null","return","super","switch","this","throw","true","try","typeof","var","void","while","with","yield","let","static","implements","interface","package","private","protected","public","arguments","eval","await"])});function IX(X,$){let Z=jK++,Y=`<!--__STX_${X.toUpperCase()}_${Z}__-->`;return HK.set(Y,{type:X,expression:$}),Y}var jK=0,HK;var n6=D(()=>{HK=new Map});function t6(X,$,Z,Y){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);if(!G)return-1;return G.index+G[0].length}function D1(X,$){return t6(X,$,r6,s6)}function b5(X,$){return t6(X,$,o6,a6)}function D7(X,$){if(!X.startsWith("<!--",$))return-1;let Z=X.indexOf("-->",$+4);if(Z===-1)return-1;return Z+3}function LK(X,$){if(X.startsWith("<!--",$)){let Z=D7(X,$);return Z===-1?X.length:Z}for(let[Z,Y]of[[r6,s6],[o6,a6]]){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);return G?G.index+G[0].length:X.length}return-1}function a$(X,$){let Z=[],Y=0,J=X.length,G=!1,Q=null;while(Y<J){let w=X[Y];if(G){if(Q){if(w===Q)Q=null}else if(w==='"'||w==="'")Q=w;else if(w===">")G=!1;Y++;continue}if(w!=="<"){Y++;continue}let q=$(X,Y);if(q>Y){Z.push({start:Y,end:q,token:X.slice(Y,q)}),Y=q;continue}let W=LK(X,Y);if(W>Y){Y=W;continue}if(/^<\/?[a-zA-Z]/.test(X.slice(Y,Y+2)))G=!0;Y++}return Z}function G1(X,$,Z){let Y=a$(X,$);if(Y.length===0)return{output:X,tokens:[]};let J=Y.map((w)=>w.token),G="",Q=0;for(let w=0;w<Y.length;w++){let q=Y[w];G+=X.slice(Q,q.start),G+=Z(q.token,w),Q=q.end}return G+=X.slice(Q),{output:G,tokens:J}}function y1(X){let{output:$,tokens:Z}=G1(X,D1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:$,scripts:Z}}function y7(X,$){if($.length===0)return X;return X.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>$[+Y]??"")}var r6,s6,o6,a6;var $5=D(()=>{r6=/<script\b[^>]*>/iy,s6=/<\/script\s*>/ig,o6=/<style\b[^>]*>/iy,a6=/<\/style\s*>/ig});var GZ={};t(GZ,{usesSignalsInScript:()=>H1,unescapeHtml:()=>kK,registerFilters:()=>FK,registerFilter:()=>$Z,processExpressions:()=>b1,interpolateScriptsInTemplate:()=>RK,interpolateScriptExpressions:()=>EX,interpolateScriptAttributes:()=>YZ,getAllFilters:()=>ZZ,evaluateExpression:()=>v0,escapeHtml:()=>a0,defaultFilters:()=>S7,clearCustomFilters:()=>VK,applyFilters:()=>JZ});function OK(X){let $=e6.get(X);if(!$){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");$=new RegExp(`:${Z}(?!\\w)`,"g"),e6.set(X,$)}return $.lastIndex=0,$}function $Z(X,$){if(X in S7)console.warn(`Filter "${X}" already exists as a built-in filter. Custom filter will take precedence.`);b7[X]=$}function FK(X){for(let[$,Z]of Object.entries(X))$Z($,Z)}function ZZ(){return{...S7,...b7}}function VK(){for(let X of Object.keys(b7))delete b7[X]}function a0(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function H1(X){let{scripts:$}=y1(X);for(let Z of $){let Y=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let J=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(X))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(X))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(X))return!0;return!1}function XZ(X,$){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=X.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let W=0;W<Y.length;W++){let U=Y[W];if(!G&&U==="`"){G=!0,Q=0;continue}if(G){if(U==="`"&&Q===0){G=!1;continue}if(U==="$"&&Y[W+1]==="{"){Q++,W++,J+=" ";continue}if(U==="}"&&Q>0){Q--;continue}if(Q>0){J+=U;continue}continue}J+=U}Y=J;let w=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=w.exec(Y))!==null){let W=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(W)&&!(W in $))return!1}}return!0}function AK(X,$){let Z=$.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let Y=I1(X);for(let J of Z)if(new RegExp(`(?<![.#\\w$])${J}(?![\\w$])`).test(Y))return!0;return!1}function EX(X,$){let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=v0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=v0(J,$);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function YZ(X,$){if(!X.includes("{"))return X;let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=v0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=v0(J,$);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return Y}}),Z}function RK(X,$,Z={}){let{output:Y,scripts:J}=y1(X),G=J.map((Q)=>{let w=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=Q.match(/^<script\b[^>]*>/i),W=Q.search(/<\/script\s*>$/i);if(!w||!q||W===-1)return Q;let U=w[1],K=w[2];if(/\bdata-raw\b/.test(U))return Q;if(Z.skipServer&&/\bserver\b/.test(U))return Q;let B=`<script${YZ(U,$)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return B+K+Q.slice(W);return B+EX(K,$)+Q.slice(W)});return y7(Y,G)}function b1(X,$,Z){let Y=X,J=(K,z)=>{let B=b5(K,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(K.slice(z,B))?-1:B},G=(K,z,B,_)=>{let j=B.length,{output:H,tokens:O}=G1(K,z,(L,F)=>_(j+F));return B.push(...O),H},Q=[];Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`);let w=[];Y=G(Y,D1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`);let q=$?.__stx_signals_gate===!0||H1(X),W=new Set(Array.isArray($?.__stx_client_signal_names)?$.__stx_client_signal_names:[]),U=new Set(Array.isArray($?.__stx_preserved_client_expressions)?$.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(K,z,B)=>{try{let _=v0(z,$);return _!==void 0&&_!==null?String(_):""}catch(_){let j=_ instanceof Error?_.message:String(_);return K0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Z,X,B,K)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(K,z,B)=>{try{let _=v0(z,$);if(_===void 0&&$.__stx_buildMode==="compile")return IX("raw",z.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if($.__stx_buildMode==="compile")return IX("raw",z.trim());let j=_ instanceof Error?_.message:String(_);return K0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Z,X,B,K)}}),Y=G(Y,D1,w,(K)=>`<!--__STX_SCRIPT_EXPR_${K}__-->`),Y=G(Y,J,Q,(K)=>`<!--__STX_STYLE_${K}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(K,z,B)=>{let _=z.trim();if(U.has(_))return K;let j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=_.match(H)?.[1],F=L&&((L in $)||j.includes(L)),V=Boolean(L&&W.has(L)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=_.match(A),T=R&&!j.includes(R[1])&&!(R[1]in $);if(/^__[A-Z_]+__$/.test(_))return"";try{let M=v0(z,$);if(V)return K;if(q&&!XZ(_,$))return K;if($.__stx_buildMode==="compile"&&!q&&(M===void 0||AK(_,$)))return IX("expr",_);return M!==void 0&&M!==null?a0(String(M)):""}catch(M){if(V)return K;if(q&&!XZ(_,$))return K;if(T)return K;let k=M instanceof Error?M.message:String(M);return K0("Expression",`Error evaluating: {{ ${_} }}: ${k}`,Z,X,B,K)}});for(let K=0;K<w.length;K++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${K}__-->`,()=>w[K]);for(let K=0;K<Q.length;K++)Y=Y.replace(`<!--__STX_STYLE_${K}__-->`,()=>Q[K]);return Y}function JZ(X,$,Z){if(!$.trim())return X;let Y=X,J=$.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let w=b7[Q]||S7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(ZZ()).join(", ")}`);let q=[];if(J.startsWith(":")){let W=J.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let K=Number(U);q=[Number.isNaN(K)?U:K]}catch{q=[U]}J=J.substring(W[0].length).trim()}}else if(J.startsWith("(")){let W=1,U=1;while(W>0&&U<J.length){if(J[U]==="(")W++;if(J[U]===")")W--;U++}if(W===0){let K=J.substring(1,U-1).trim();if(K)try{if(K.startsWith("{")&&K.endsWith("}"))q=[v0(`(${K})`,Z,!0)];else{let z=[],B="",_=null,j=0,H=0,O=0,L=!1;for(let F=0;F<K.length;F++){let V=K[F];if(L){B+=V,L=!1;continue}if(V==="\\"){B+=V,L=!0;continue}if(_){if(B+=V,V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=V,B+=V;continue}if(V==="(")j++;else if(V===")")j--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")O++;else if(V==="}")O--;if(V===","&&j===0&&H===0&&O===0){z.push(B),B="";continue}B+=V}if(B)z.push(B);q=z.map((F)=>{let V=F.trim();return v0(V,Z,!0)})}}catch{q=[K]}J=J.substring(U).trim()}}try{Y=w(Y,Z,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${Q}': ${U}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function TK(X){let $=!1,Z="",Y=0,J=0,G=0,Q=!1;for(let w=0;w<X.length;w++){let q=X[w],W=X[w+1];if($&&Q){Q=!1;continue}if($&&q==="\\"){Q=!0;continue}if(Q=!1,(q==='"'||q==="'"||q==="`")&&!Q){if(!$)$=!0,Z=q;else if(q===Z)$=!1,Z="";continue}if($&&Z==="`"&&q==="$"&&W==="{"){let U=1;w+=2;while(w<X.length&&U>0){if(X[w]==="{")U++;else if(X[w]==="}")U--;if(U>0)w++}continue}if($)continue;if(q==="(")Y++;else if(q===")")Y--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")G++;else if(q==="}")G--;if(q==="|"&&Y===0&&J===0&&G===0){if(W==="|"){w++;continue}if(W==="="){w++;continue}return w}}return-1}function v0(X,$,Z=!1){try{let Y=X.trim(),J=TK(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),w=v0(G,$,!0);return JZ(w,Q,$)}if(!q0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return Y0(Y,$)}try{let G=Object.keys($),Q=Object.values($);return W0(Y,G)(...Q)}catch{return Y0(Y,$)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=MK(G,Object.keys($));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${X}`,Y);throw Y}}function MK(X,$){let Z=null;for(let J of $){if(J===X)continue;let G=NK(X,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max(X.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function NK(X,$){if(X===$)return 0;if(X.length===0)return $.length;if($.length===0)return X.length;let[Z,Y]=X.length<$.length?[X,$]:[$,X],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let w=1;w<=Z.length;w++){let q=Z[w-1]===Y[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,J[w]+1,J[w-1]+q)}for(let w=0;w<=Z.length;w++)J[w]=G[w]}return J[Z.length]}function kK(X){if(!X)return"";return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var b7,e6,S7;var Q1=D(()=>{F0();T0();n6();$5();b7={},e6=new Map;S7={uppercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toUpperCase():""},lowercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toLowerCase():""},capitalize:(X,$)=>{if(X===void 0||X===null)return"";let Z=String(X);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:(X,$,Z=0)=>{if(X===void 0||X===null)return"";try{let Y=Number(X);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:(X,$,Z="en-US")=>{if(X===void 0||X===null)return"";try{let Y=Number(X);if(Number.isNaN(Y))return String(X);return Y.toLocaleString(Z)}catch{return String(X)}},join:(X,$,Z=",")=>{if(!Array.isArray(X))return"";return X.join(String(Z))},escape:(X,$)=>{if(X===void 0||X===null)return"";return a0(String(X))},translate:(X,$,Z={})=>{if(!$||!$.__translations)return X;let Y=$.__translations,J=$.__i18nConfig?.fallbackToKey??!0,G=String(X).split("."),Q=Y;for(let q of G){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return J?X:"";let w=String(Q);return Object.entries(Z).forEach(([q,W])=>{w=w.replace(OK(q),String(W))}),w},t:(X,$,Z={})=>{return S7.translate(X,$,Z)},truncate:(X,$,Z=50,Y="...")=>{if(X===void 0||X===null)return"";let J=String(X);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:(X,$,Z="short",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=X instanceof Date?X:new Date(X);if(Number.isNaN(J.getTime()))return String(X);let G={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Z==="iso")return J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String(X)}},currency:(X,$,Z="USD",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=Number(X);if(Number.isNaN(J))return String(X);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String(X)}},pluralize:(X,$,Z,Y)=>{let J=Number(X);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===1?Z:G},first:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[0];return String(X).charAt(0)},last:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[X.length-1];let Z=String(X);return Z.charAt(Z.length-1)},length:(X,$)=>{if(X===void 0||X===null)return 0;if(Array.isArray(X)||typeof X==="string")return X.length;if(X instanceof Map||X instanceof Set)return X.size;if(typeof X==="object")return Object.keys(X).length;return 0},json:(X,$,Z=!1)=>{if(X===void 0)return"undefined";if(X===null)return"null";try{return Z?JSON.stringify(X,null,2):JSON.stringify(X)}catch{return String(X)}},default:(X,$,Z="")=>{return X===void 0||X===null||X===""?Z:X},reverse:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return[...X].reverse();return String(X).split("").reverse().join("")},slice:(X,$,Z=0,Y)=>{if(X===void 0||X===null)return"";if(Array.isArray(X)||typeof X==="string")return X.slice(Z,Y);return X},replace:(X,$,Z,Y="")=>{if(X===void 0||X===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(X).replace(new RegExp(J,"g"),()=>Y)},stripTags:(X,$)=>{if(X===void 0||X===null)return"";return String(X).replace(/<[^>]*>/g,"")},urlencode:(X,$)=>{if(X===void 0||X===null)return"";return encodeURIComponent(String(X))},abs:(X,$)=>{let Z=Number(X);return Number.isNaN(Z)?0:Math.abs(Z)},round:(X,$,Z=0)=>{let Y=Number(X);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class Z5{cache=new Map;maxSize;constructor(X=100){this.maxSize=X}get(X){if(!this.cache.has(X))return;let $=this.cache.get(X);return this.cache.delete(X),this.cache.set(X,$),$}set(X,$){if(this.cache.has(X))this.cache.delete(X);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set(X,$)}has(X){return this.cache.has(X)}delete(X){return this.cache.delete(X)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function C5(X,$){if($?.includes("g"))return new RegExp(X,$);let Z=`${X}:${$||""}`;if(!S5.has(Z)){if(S5.size>=IK){let Y=S5.keys().next().value;if(Y)S5.delete(Y)}S5.set(Z,new RegExp(X,$))}return S5.get(Z)}class QZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(X){let $=Array.from(new Set(X)),Z=$.sort().join(","),Y=this.pool.find((w)=>w.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...w)=>{return(q)=>{try{let W=`${Z}:${q}`,U=J.get(W);if(!U){if(J.size>=G){let K=J.keys().next().value;if(K)J.delete(K)}U=Function(...$,`
2532
2532
  'use strict';
2533
2533
  try {
2534
2534
  return ${q};
@@ -2539,14 +2539,14 @@ catch (e) {
2539
2539
  }
2540
2540
  throw e;
2541
2541
  }
2542
- `),J.set(W,K)}return K(...w)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:$.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class $Z{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(X){this.enabled=X}isEnabled(){return this.enabled}setBudget(X,$){this.budgets.set(X,{warnThreshold:0.8,action:"warn",...$})}setBudgets(X){for(let[$,Z]of Object.entries(X))this.setBudget($,Z)}removeBudget(X){this.budgets.delete(X)}getBudgets(){let X={};for(let[$,Z]of this.budgets.entries())X[$]=Z;return X}onViolation(X){this.violationHandlers.push(X)}offViolation(X){let $=this.violationHandlers.indexOf(X);if($!==-1)this.violationHandlers.splice($,1)}time(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=$(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}async timeAsync(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=await $(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}checkBudget(X,$){let Z=this.budgets.get(X);if(!Z)return;let Y=$/Z.maxTime*100,J=Z.warnThreshold!==void 0?$>=Z.maxTime*Z.warnThreshold&&$<Z.maxTime:!1,G=$>=Z.maxTime;if(!J&&!G)return;let Q={label:X,actualTime:$,budgetTime:Z.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(Q)}catch{}let w=J?`[Performance Warning] "${X}" took ${$.toFixed(2)}ms (${Y.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${X}" took ${$.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(w);break;case"warn":console.warn(w);break;case"error":console.error(w);break;case"throw":if(G)throw Error(w);else console.warn(w);break}}recordTime(X,$){let Z=this.metrics.get(X);if(Z)Z.count++,Z.totalTime+=$,Z.maxTime=Math.max(Z.maxTime,$),Z.minTime=Math.min(Z.minTime,$);else this.metrics.set(X,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(X){if(X){let Z=this.metrics.get(X);if(!Z)return{};let Y=this.budgets.get(X);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:Y?.maxTime,budgetUtilization:Y?Z.totalTime/Z.count/Y.maxTime*100:void 0}}let $={};for(let[Z,Y]of this.metrics.entries()){let J=this.budgets.get(Z);$[Z]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}return $}getViolations(X){if(X)return this.violations.filter(($)=>$.label===X);return[...this.violations]}getViolationStats(){let X={},$=0,Z=0;for(let Y of this.violations)if(X[Y.label]=(X[Y.label]||0)+1,Y.isWarning)$++;else Z++;return{total:this.violations.length,byLabel:X,warnings:$,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function HU(){if(!t$)t$=new $Z;return t$}var b5,jU=500,SA,t$=null,ZZ;var C5=D(()=>{b5=new Map;SA=new XZ;ZZ=new Proxy({},{get(X,$){return HU()[$]}})});function YZ(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function e$(X,$){let Z={...X};for(let[Y,J]of Object.entries($))Z[Y]=YZ(J)&&YZ(Z[Y])?e$(Z[Y],J):J;return Z}function JZ(X={},$={}){let Z=X.theme||{},Y=$.theme||{},{extend:J,...G}=Y,{extend:Q,...w}=Z,q=e$(w,G),W=e$(Q||{},J||{});if(Object.keys(W).length>0)q.extend=W;let K=[...X.safelist||[],...$.safelist||[]],U={...X.shortcuts||{},...$.shortcuts||{}},z=[...X.preflights||[],...$.preflights||[]];return{config:{...X,...$,theme:q,safelist:K,shortcuts:U,...z.length>0?{preflights:z}:{},content:[],output:""},safelist:K,shortcuts:U,includePreflight:$.preflight!==!1,minify:$.minify===!0}}var B0;var GZ=D(()=>{B0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});var UZ={};t(UZ,{resetCssCache:()=>MU,resetCrosswindCache:()=>NU,rebuildCrosswindCSS:()=>kU,loadCrosswindConfig:()=>Y9,loadCrosswind:()=>Z9,injectCrosswindCSS:()=>J9,getCrosswindServeAsset:()=>FU,getCachedCSS:()=>IU,generateCrosswindCSS:()=>KZ,extractClassNames:()=>WZ,buildCrosswindCSS:()=>qZ});import J0 from"path";import{hasLocalConfig as LU}from"bunfig";function DX(X){return Bun.hash(X).toString(16).padStart(16,"0").slice(0,16)}function X9(X,$){if(O1.has(X))O1.delete(X);else if(O1.size>=wZ)O1.delete(O1.keys().next().value);O1.set(X,$)}function OU(X){let $=DX(X);if(e0.has($))e0.delete($);else if(e0.size>=wZ)e0.delete(e0.keys().next().value);return e0.set($,X),$}function FU(X){let $=e0.get(X);if($===void 0)return;return e0.delete(X),e0.set(X,$),$}async function VU(X){if(!S1)return null;try{let $=Bun.file(J0.join(S1,`cw-${DX(X)}.css`));if(!await $.exists())return null;return await $.text()}catch{return null}}async function AU(X,$){if(!S1)return;try{if(!fs.existsSync(S1))fs.mkdirSync(S1,{recursive:!0});await Bun.write(J0.join(S1,`cw-${DX(X)}.css`),$)}catch{}}async function QZ(X){try{let $=await import(X);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig,extractClasses:$.extractClasses}}catch{}return null}function RU(){let X=[],$=process.cwd();while($!==J0.dirname($))X.push(J0.join($,"node_modules","@cwcss","crosswind","dist","index.js")),X.push(J0.join($,"node_modules","@cwcss","crosswind","src","index.ts")),X.push(J0.join($,"pantry","@cwcss","crosswind","dist","index.js")),X.push(J0.join($,"pantry","@cwcss","crosswind","src","index.ts")),X.push(J0.join($,"node_modules","@stacksjs","crosswind","dist","index.js")),X.push(J0.join($,"pantry","@stacksjs","crosswind","dist","index.js")),$=J0.dirname($);return X}function TU(){let X=[],$=process.env.HOME||process.env.USERPROFILE||"";if($){let Z=[J0.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),J0.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),J0.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),J0.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),J0.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),J0.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];X.push(...Z)}return X.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),X.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),X}async function Z9(){if($9)return q1;$9=!0;try{let X=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await QZ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded from ${J0.dirname(J0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=J0.resolve(process.env.CROSSWIND_SRC),G=await X([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return q1=G,q1}let $=await X(RU());if($)return q1=$,q1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await QZ(J);if(G){if(q1=G,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded`);return q1}}let Y=await X(TU());if(Y)return q1=Y,q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${B0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${B0.reset}`),console.warn(`${B0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${B0.reset}`),null}}function MU(){O1.clear(),e0.clear()}function NU(){q1=null,$9=!1,X1=null,S7="",O1.clear(),e0.clear(),EX=null}async function Y9(X){try{if(!LU({name:"crosswind",cwd:X}))return null;let{loadConfigWithResult:$}=await import("bunfig"),Z=await $({name:"crosswind",cwd:X,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let Y=J0.relative(X,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch($){if($ instanceof Error&&$.name==="ConfigNotFoundError")return null;return console.warn(`${B0.yellow}[Crosswind]${B0.reset} Failed to load crosswind config:`,$ instanceof Error?$.message:$),null}}async function qZ(X){if(P5)return S7;P5=!0;try{let $=await Z9();if(!$||!$.build)return P5=!1,"";if(!X1)X1=await Y9(X);if(!X1)return P5=!1,"";let Z=$.defaultConfig?.theme||{},Y=X1.theme||{},J={...$.defaultConfig,...X1,theme:{...Z,...Y,extend:{...Z.extend||{},...Y.extend||{}}}},G=performance.now(),Q=await $.build(J),w=performance.now()-G;if(S7=Q.css,console.log(`${B0.cyan}[Crosswind]${B0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),J.output){let q=J0.isAbsolute(J.output)?J.output:J0.join(X,J.output),W=J0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,Q.css)}return P5=!1,Q.css}catch($){return console.error(`${B0.red}[Crosswind]${B0.reset} Build error:`,$),P5=!1,S7}}async function kU(X){X1=null,await qZ(X)}function IU(){return S7}function WZ(X){let $=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec(X);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())$.add(Q.trim());Y=Z.exec(X)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.exec(X);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let w of Q)for(let q of w.slice(1,-1).split(/\s+/))if(q.trim())$.add(q.trim())}G=J.exec(X)}return $}async function KZ(X,$){try{let Z=await Z9();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses(X):WZ(X);if(Y.size===0)return"";let J=$?J0.resolve($):process.cwd();if(!S1)S1=R7(J,"cache");let G=[...Y].sort().join(" "),Q=`${EX||"default"}::${G}`,w=O1.get(Q);if(w!==void 0)return X9(Q,w),w;let q=await VU(Q);if(q!==null)return X9(Q,q),q;if(!X1){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (H1(),zZ)),R=await A(J);if(R.css)if(typeof R.css==="string"){let T=J0.isAbsolute(R.css)?R.css:J0.resolve(J,R.css);if(await Bun.file(T).exists()){let M=await import(T);V=M.default||M,console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=J0.isAbsolute(R.css.config)?R.css.config:J0.resolve(J,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);V={...M.default||M,...V}}}console.log(`${B0.green}[Crosswind]${B0.reset} Using inline CSS config from stx.config.ts`)}}catch{}X1=V||await Y9(J);try{EX=DX(JSON.stringify(X1??{}))}catch{EX="unhashable"}}let W=Z.defaultConfig||Z.config,K=X1||{},U=JZ(W,K),{safelist:z,includePreflight:B,minify:_}=U,j=U.config,H=new Z.CSSGenerator(j);for(let V of z)H.generate(V);for(let V of Y)H.generate(V);let O=H.toCSS(B,_),L=j.shortcuts||K.shortcuts||{};for(let[V,A]of Object.entries(L)){if(!Y.has(V)&&!z.includes(V))continue;let R=A.split(/\s+/).filter(Boolean);for(let T of R)H.generate(T)}O=H.toCSS(B,_);let F=O.split(`
2542
+ `),J.set(W,U)}return U(...w)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:$.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class wZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(X){this.enabled=X}isEnabled(){return this.enabled}setBudget(X,$){this.budgets.set(X,{warnThreshold:0.8,action:"warn",...$})}setBudgets(X){for(let[$,Z]of Object.entries(X))this.setBudget($,Z)}removeBudget(X){this.budgets.delete(X)}getBudgets(){let X={};for(let[$,Z]of this.budgets.entries())X[$]=Z;return X}onViolation(X){this.violationHandlers.push(X)}offViolation(X){let $=this.violationHandlers.indexOf(X);if($!==-1)this.violationHandlers.splice($,1)}time(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=$(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}async timeAsync(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=await $(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}checkBudget(X,$){let Z=this.budgets.get(X);if(!Z)return;let Y=$/Z.maxTime*100,J=Z.warnThreshold!==void 0?$>=Z.maxTime*Z.warnThreshold&&$<Z.maxTime:!1,G=$>=Z.maxTime;if(!J&&!G)return;let Q={label:X,actualTime:$,budgetTime:Z.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(Q)}catch{}let w=J?`[Performance Warning] "${X}" took ${$.toFixed(2)}ms (${Y.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${X}" took ${$.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(w);break;case"warn":console.warn(w);break;case"error":console.error(w);break;case"throw":if(G)throw Error(w);else console.warn(w);break}}recordTime(X,$){let Z=this.metrics.get(X);if(Z)Z.count++,Z.totalTime+=$,Z.maxTime=Math.max(Z.maxTime,$),Z.minTime=Math.min(Z.minTime,$);else this.metrics.set(X,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(X){if(X){let Z=this.metrics.get(X);if(!Z)return{};let Y=this.budgets.get(X);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:Y?.maxTime,budgetUtilization:Y?Z.totalTime/Z.count/Y.maxTime*100:void 0}}let $={};for(let[Z,Y]of this.metrics.entries()){let J=this.budgets.get(Z);$[Z]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}return $}getViolations(X){if(X)return this.violations.filter(($)=>$.label===X);return[...this.violations]}getViolationStats(){let X={},$=0,Z=0;for(let Y of this.violations)if(X[Y.label]=(X[Y.label]||0)+1,Y.isWarning)$++;else Z++;return{total:this.violations.length,byLabel:X,warnings:$,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function EK(){if(!t$)t$=new wZ;return t$}var S5,IK=500,rA,t$=null,qZ;var P5=D(()=>{S5=new Map;rA=new QZ;qZ=new Proxy({},{get(X,$){return EK()[$]}})});function WZ(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function e$(X,$){let Z={...X};for(let[Y,J]of Object.entries($))Z[Y]=WZ(J)&&WZ(Z[Y])?e$(Z[Y],J):J;return Z}function UZ(X={},$={}){let Z=X.theme||{},Y=$.theme||{},{extend:J,...G}=Y,{extend:Q,...w}=Z,q=e$(w,G),W=e$(Q||{},J||{});if(Object.keys(W).length>0)q.extend=W;let U=[...X.safelist||[],...$.safelist||[]],K={...X.shortcuts||{},...$.shortcuts||{}},z=[...X.preflights||[],...$.preflights||[]];return{config:{...X,...$,theme:q,safelist:U,shortcuts:K,...z.length>0?{preflights:z}:{},content:[],output:""},safelist:U,shortcuts:K,includePreflight:$.preflight!==!1,minify:$.minify===!0}}var B0;var KZ=D(()=>{B0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});var LZ={};t(LZ,{resetCssCache:()=>xK,resetCrosswindCache:()=>fK,rebuildCrosswindCSS:()=>gK,loadCrosswindConfig:()=>Y9,loadCrosswind:()=>Z9,injectCrosswindCSS:()=>J9,getCrosswindServeAsset:()=>bK,getCachedCSS:()=>hK,generateCrosswindCSS:()=>HZ,extractClassNames:()=>jZ,buildCrosswindCSS:()=>BZ});import J0 from"path";import{hasLocalConfig as DK}from"bunfig";function yX(X){return Bun.hash(X).toString(16).padStart(16,"0").slice(0,16)}function X9(X,$){if(L1.has(X))L1.delete(X);else if(L1.size>=_Z)L1.delete(L1.keys().next().value);L1.set(X,$)}function yK(X){let $=yX(X);if(t0.has($))t0.delete($);else if(t0.size>=_Z)t0.delete(t0.keys().next().value);return t0.set($,X),$}function bK(X){let $=t0.get(X);if($===void 0)return;return t0.delete(X),t0.set(X,$),$}async function SK(X){if(!S1)return null;try{let $=Bun.file(J0.join(S1,`cw-${yX(X)}.css`));if(!await $.exists())return null;return await $.text()}catch{return null}}async function CK(X,$){if(!S1)return;try{if(!fs.existsSync(S1))fs.mkdirSync(S1,{recursive:!0});await Bun.write(J0.join(S1,`cw-${yX(X)}.css`),$)}catch{}}async function zZ(X){try{let $=await import(X);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig,extractClasses:$.extractClasses}}catch{}return null}function PK(){let X=[],$=process.cwd();while($!==J0.dirname($))X.push(J0.join($,"node_modules","@cwcss","crosswind","dist","index.js")),X.push(J0.join($,"node_modules","@cwcss","crosswind","src","index.ts")),X.push(J0.join($,"pantry","@cwcss","crosswind","dist","index.js")),X.push(J0.join($,"pantry","@cwcss","crosswind","src","index.ts")),X.push(J0.join($,"node_modules","@stacksjs","crosswind","dist","index.js")),X.push(J0.join($,"pantry","@stacksjs","crosswind","dist","index.js")),$=J0.dirname($);return X}function vK(){let X=[],$=process.env.HOME||process.env.USERPROFILE||"";if($){let Z=[J0.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),J0.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),J0.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),J0.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),J0.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),J0.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];X.push(...Z)}return X.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),X.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),X}async function Z9(){if($9)return w1;$9=!0;try{let X=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await zZ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded from ${J0.dirname(J0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=J0.resolve(process.env.CROSSWIND_SRC),G=await X([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return w1=G,w1}let $=await X(PK());if($)return w1=$,w1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await zZ(J);if(G){if(w1=G,!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} CSS engine loaded`);return w1}}let Y=await X(vK());if(Y)return w1=Y,w1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${B0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${B0.reset}`),console.warn(`${B0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${B0.reset}`),null}}function xK(){L1.clear(),t0.clear()}function fK(){w1=null,$9=!1,e0=null,C7="",L1.clear(),t0.clear(),DX=null}async function Y9(X){try{if(!DK({name:"crosswind",cwd:X}))return null;let{loadConfigWithResult:$}=await import("bunfig"),Z=await $({name:"crosswind",cwd:X,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let Y=J0.relative(X,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch($){if($ instanceof Error&&$.name==="ConfigNotFoundError")return null;return console.warn(`${B0.yellow}[Crosswind]${B0.reset} Failed to load crosswind config:`,$ instanceof Error?$.message:$),null}}async function BZ(X){if(v5)return C7;v5=!0;try{let $=await Z9();if(!$||!$.build)return v5=!1,"";if(!e0)e0=await Y9(X);if(!e0)return v5=!1,"";let Z=$.defaultConfig?.theme||{},Y=e0.theme||{},J={...$.defaultConfig,...e0,theme:{...Z,...Y,extend:{...Z.extend||{},...Y.extend||{}}}},G=performance.now(),Q=await $.build(J),w=performance.now()-G;if(C7=Q.css,console.log(`${B0.cyan}[Crosswind]${B0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),J.output){let q=J0.isAbsolute(J.output)?J.output:J0.join(X,J.output),W=J0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,Q.css)}return v5=!1,Q.css}catch($){return console.error(`${B0.red}[Crosswind]${B0.reset} Build error:`,$),v5=!1,C7}}async function gK(X){e0=null,await BZ(X)}function hK(){return C7}function jZ(X){let $=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec(X);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())$.add(Q.trim());Y=Z.exec(X)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.exec(X);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let w of Q)for(let q of w.slice(1,-1).split(/\s+/))if(q.trim())$.add(q.trim())}G=J.exec(X)}return $}async function HZ(X,$){try{let Z=await Z9();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses(X):jZ(X);if(Y.size===0)return"";let J=$?J0.resolve($):process.cwd();if(!S1)S1=T7(J,"cache");let G=[...Y].sort().join(" "),Q=`${DX||"default"}::${G}`,w=L1.get(Q);if(w!==void 0)return X9(Q,w),w;let q=await SK(Q);if(q!==null)return X9(Q,q),q;if(!e0){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (j1(),OZ)),R=await A(J);if(R.css)if(typeof R.css==="string"){let T=J0.isAbsolute(R.css)?R.css:J0.resolve(J,R.css);if(await Bun.file(T).exists()){let M=await import(T);V=M.default||M,console.log(`${B0.green}[Crosswind]${B0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=J0.isAbsolute(R.css.config)?R.css.config:J0.resolve(J,R.css.config);if(await Bun.file(T).exists()){let M=await import(T);V={...M.default||M,...V}}}console.log(`${B0.green}[Crosswind]${B0.reset} Using inline CSS config from stx.config.ts`)}}catch{}e0=V||await Y9(J);try{DX=yX(JSON.stringify(e0??{}))}catch{DX="unhashable"}}let W=Z.defaultConfig||Z.config,U=e0||{},K=UZ(W,U),{safelist:z,includePreflight:B,minify:_}=K,j=K.config,H=new Z.CSSGenerator(j);for(let V of z)H.generate(V);for(let V of Y)H.generate(V);let O=H.toCSS(B,_),L=j.shortcuts||U.shortcuts||{};for(let[V,A]of Object.entries(L)){if(!Y.has(V)&&!z.includes(V))continue;let R=A.split(/\s+/).filter(Boolean);for(let T of R)H.generate(T)}O=H.toCSS(B,_);let F=O.split(`
2543
2543
  `);for(let[V,A]of Object.entries(L)){if(!Y.has(V)&&!z.includes(V))continue;let R=A.split(/\s+/).filter(Boolean),T=[],M=[];for(let k of R){let N=k.startsWith("dark:"),C=`.${(N?k.slice(5):k).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let S=0;S<F.length;S++){let b=F[S].trim();if(b===`${C} {`||b.startsWith(`${C} {`)){let P=S,x="";while(P<F.length){if(x+=F[P],F[P].includes("}"))break;P++}let m=x.match(/\{([^}]+)\}/);if(m)if(N)M.push(m[1].trim());else T.push(m[1].trim());break}}}if(T.length)O+=`
2544
2544
  .${V} { ${T.join(" ")} }`;if(M.length)O+=`
2545
- @media (prefers-color-scheme: dark) { .dark .${V} { ${M.join(" ")} } }`}return X9(Q,O),AU(Q,O),O}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function J9(X,$,Z=!1){let Y=await KZ(X,$);if(!Y)return X;let J=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${OU(Y)}.css">`:`<style data-crosswind="generated">
2545
+ @media (prefers-color-scheme: dark) { .dark .${V} { ${M.join(" ")} } }`}return X9(Q,O),CK(Q,O),O}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function J9(X,$,Z=!1){let Y=await HZ(X,$);if(!Y)return X;let J=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${yK(Y)}.css">`:`<style data-crosswind="generated">
2546
2546
  ${Y}
2547
2547
  </style>`,G=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(G.test(X)){let Q=!1;return X.replace(G,()=>{if(Q)return"";return Q=!0,J})}if(X.includes("</head>"))return X.replace("</head>",`${J}
2548
2548
  </head>`);if(X.includes("<body"))return X.replace(/<body([^>]*)>/,`<body$1>
2549
- ${J}`);return J+X}var q1=null,$9=!1,X1=null,S7="",P5=!1,wZ=256,O1,e0,S1=null,EX=null;var G9=D(()=>{OX();GZ();O1=new Map,e0=new Map});function yX(X){let $=0;while($<X.length){let Z=X.slice($),Y=/<body\b([^>]*)>/i.exec(Z);if(!Y)return null;let J=$+Y.index,G=-1,Q="";for(let q of EU){let W=q.open.exec(Z);if(!W)continue;let K=$+W.index;if(K<J&&(G===-1||K<G))G=K,Q=q.close}if(G===-1)return{index:J,tag:Y[0],attrs:Y[1]??""};let w=X.toLowerCase().indexOf(Q,G);if(w===-1)return null;$=w+Q.length}return null}function Q9(X,$){let Z=yX(X);if(!Z)return X;return X.slice(0,Z.index)+$(Z.tag,Z.attrs)+X.slice(Z.index+Z.tag.length)}var EU;var w9=D(()=>{EU=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function _Z(){return`
2549
+ ${J}`);return J+X}var w1=null,$9=!1,e0=null,C7="",v5=!1,_Z=256,L1,t0,S1=null,DX=null;var G9=D(()=>{VX();KZ();L1=new Map,t0=new Map});function P7(X){let $=0,Z,Y=Q9.map(()=>{return});while($<X.length){if(Z===void 0||Z!==null&&Z.index<$)FZ.lastIndex=$,Z=FZ.exec(X);if(!Z)return null;let J=Z.index,G=-1,Q=null;for(let q=0;q<Q9.length;q++){let W=Q9[q],U=Y[q];if(U===void 0||U!==null&&U.index<$)W.open.lastIndex=$,U=W.open.exec(X),Y[q]=U;if(!U)continue;if(U.index<J&&(G===-1||U.index<G))G=U.index,Q=W.close}if(G===-1||!Q)return{index:J,tag:Z[0],attrs:Z[1]??""};Q.lastIndex=G;let w=Q.exec(X);if(!w)return null;$=w.index+w[0].length}return null}function bX(X,$){let Z=P7(X);if(!Z)return X;return X.slice(0,Z.index)+$(Z.tag,Z.attrs)+X.slice(Z.index+Z.tag.length)}var Q9,FZ;var w9=D(()=>{Q9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],FZ=/<body\b([^>]*)>/gi});function VZ(){return`
2550
2550
  // STX Lifecycle Runtime
2551
2551
  (function() {
2552
2552
  if (typeof window === 'undefined') return;
@@ -2891,7 +2891,7 @@ else {
2891
2891
 
2892
2892
  console.log('[stx] Lifecycle runtime initialized');
2893
2893
  })();
2894
- `}function q9(X){return Symbol(X)}var mA,lA,cA;var BZ=D(()=>{mA=q9("theme"),lA=q9("router"),cA=q9("i18n")});import*as HZ from"crypto";function jZ(X){let $=/\$(\w+)\./g,Z=[],Y;while((Y=$.exec(X))!==null)if(!Z.includes(Y[1]))Z.push(Y[1]);return Z}function DU(){return`stx-${HZ.randomBytes(4).toString("hex")}`}function yU(X){return/\$\w+\./.test(X)}function bU(X){let $=[],Z=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,J=X;return J=J.replace(Y,(G,Q,w,q)=>{if(["script","style","template"].includes(Q.toLowerCase()))return G;let W=[],K=!1,U=w,z=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...w.matchAll(z)];for(let H of B){let O=H[0],L=H[1],F=H[2];if(yU(F)){K=!0;let V=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let A=V[1];if(W.push({attr:L,expr:A,fullMatch:O,originalAttr:L}),jZ(A).forEach((T)=>Z.add(T)),L==="text")U=U.replace(O,"");else if(L==="class")U=U.replace(O,'class=""');else if(L==="disabled"||L==="hidden")U=U.replace(O,"");else U=U.replace(O,`${L}=""`)}}}if(!K)return G;let _=U.match(/\bid\s*=\s*"([^"]+)"/),j;if(_)j=_[1];else j=DU(),U=` id="${j}"${U}`;for(let H of W)$.push({elementId:j,attribute:H.attr,expression:H.expr,stores:jZ(H.expr)});return`<${Q}${U}${q}`}),{html:J,bindings:$,stores:Z}}function SU(X,$){if(X.length===0)return"";let Z=Array.from($),Y=`
2894
+ `}function q9(X){return Symbol(X)}var JR,GR,QR;var AZ=D(()=>{JR=q9("theme"),GR=q9("router"),QR=q9("i18n")});import*as TZ from"crypto";function RZ(X){let $=/\$(\w+)\./g,Z=[],Y;while((Y=$.exec(X))!==null)if(!Z.includes(Y[1]))Z.push(Y[1]);return Z}function uK(){return`stx-${TZ.randomBytes(4).toString("hex")}`}function dK(X){return/\$\w+\./.test(X)}function mK(X){let $=[],Z=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,J=X;return J=J.replace(Y,(G,Q,w,q)=>{if(["script","style","template"].includes(Q.toLowerCase()))return G;let W=[],U=!1,K=w,z=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...w.matchAll(z)];for(let H of B){let O=H[0],L=H[1],F=H[2];if(dK(F)){U=!0;let V=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let A=V[1];if(W.push({attr:L,expr:A,fullMatch:O,originalAttr:L}),RZ(A).forEach((T)=>Z.add(T)),L==="text")K=K.replace(O,"");else if(L==="class")K=K.replace(O,'class=""');else if(L==="disabled"||L==="hidden")K=K.replace(O,"");else K=K.replace(O,`${L}=""`)}}}if(!U)return G;let _=K.match(/\bid\s*=\s*"([^"]+)"/),j;if(_)j=_[1];else j=uK(),K=` id="${j}"${K}`;for(let H of W)$.push({elementId:j,attribute:H.attr,expression:H.expr,stores:RZ(H.expr)});return`<${Q}${K}${q}`}),{html:J,bindings:$,stores:Z}}function lK(X,$){if(X.length===0)return"";let Z=Array.from($),Y=`
2895
2895
  <script>
2896
2896
  (function() {
2897
2897
  'use strict';
@@ -3049,10 +3049,10 @@ else {
3049
3049
  }
3050
3050
  })();
3051
3051
  </script>
3052
- `,Y}function LZ(X){let{html:$,bindings:Z,stores:Y}=bU(X);if(Z.length===0)return X;let J=SU(Z,Y),G=$.lastIndexOf("</body>");if(G!==-1)return $.slice(0,G)+J+$.slice(G);return $+J}var OZ=()=>{};function CU(X){let $=X.analytics;if(!$?.enabled)return"";switch($.driver){case"fathom":return PU($);case"google-analytics":return vU($);case"plausible":return xU($);case"self-hosted":return fU($);case"custom":return gU($);default:return""}}function PU(X){let $=X.fathom;if(!$?.siteId)return"";let Z=$.scriptUrl||"https://cdn.usefathom.com/script.js",Y=$.defer!==!1?" defer":"",J=[`data-site="${u0($.siteId)}"`];if($.honorDnt)J.push('data-honor-dnt="true"');if($.spa)J.push('data-spa="auto"');if($.canonical)J.push(`data-canonical="${u0($.canonical)}"`);if($.auto===!1)J.push('data-auto="false"');return`
3052
+ `,Y}function MZ(X){let{html:$,bindings:Z,stores:Y}=mK(X);if(Z.length===0)return X;let J=lK(Z,Y),G=$.lastIndexOf("</body>");if(G!==-1)return $.slice(0,G)+J+$.slice(G);return $+J}var NZ=()=>{};function cK(X){let $=X.analytics;if(!$?.enabled)return"";switch($.driver){case"fathom":return pK($);case"google-analytics":return iK($);case"plausible":return nK($);case"self-hosted":return rK($);case"custom":return sK($);default:return""}}function pK(X){let $=X.fathom;if(!$?.siteId)return"";let Z=$.scriptUrl||"https://cdn.usefathom.com/script.js",Y=$.defer!==!1?" defer":"",J=[`data-site="${u0($.siteId)}"`];if($.honorDnt)J.push('data-honor-dnt="true"');if($.spa)J.push('data-spa="auto"');if($.canonical)J.push(`data-canonical="${u0($.canonical)}"`);if($.auto===!1)J.push('data-auto="false"');return`
3053
3053
  <!-- Fathom Analytics -->
3054
3054
  <script src="${u0(Z)}" ${J.join(" ")}${Y}></script>
3055
- `}function vU(X){let $=X.googleAnalytics;if(!$?.measurementId)return"";let Z=u0($.measurementId),Y=$.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
3055
+ `}function iK(X){let $=X.googleAnalytics;if(!$?.measurementId)return"";let Z=u0($.measurementId),Y=$.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
3056
3056
  <!-- Google Analytics -->
3057
3057
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Z}"></script>
3058
3058
  <script>
@@ -3062,10 +3062,10 @@ else {
3062
3062
  gtag('config', '${Z}');
3063
3063
  ${Y}
3064
3064
  </script>
3065
- `}function xU(X){let $=X.plausible;if(!$?.domain)return"";let Z=$.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${u0($.domain)}"`],J=Z,G=[];if($.trackLocalhost)G.push("local");if($.hashMode)G.push("hash");if(G.length>0&&Z==="https://plausible.io/js/script.js")J=`https://plausible.io/js/script.${G.join(".")}.js`;return`
3065
+ `}function nK(X){let $=X.plausible;if(!$?.domain)return"";let Z=$.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${u0($.domain)}"`],J=Z,G=[];if($.trackLocalhost)G.push("local");if($.hashMode)G.push("hash");if(G.length>0&&Z==="https://plausible.io/js/script.js")J=`https://plausible.io/js/script.${G.join(".")}.js`;return`
3066
3066
  <!-- Plausible Analytics -->
3067
3067
  <script defer data-domain="${u0($.domain)}" src="${u0(J)}"></script>
3068
- `}function fU(X){let $=X.selfHosted;if(!$?.siteId||!$?.apiEndpoint)return"";let Z=u0($.siteId),Y=u0($.apiEndpoint),J=$.honorDnt?'if(n.doNotTrack==="1")return;':"",G=$.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=$.trackOutboundLinks?`
3068
+ `}function rK(X){let $=X.selfHosted;if(!$?.siteId||!$?.apiEndpoint)return"";let Z=u0($.siteId),Y=u0($.apiEndpoint),J=$.honorDnt?'if(n.doNotTrack==="1")return;':"",G=$.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=$.trackOutboundLinks?`
3069
3069
  d.addEventListener('click',function(e){
3070
3070
  var a=e.target.closest('a');
3071
3071
  if(a&&a.hostname!==location.hostname){
@@ -3098,7 +3098,7 @@ else {
3098
3098
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
3099
3099
  })();
3100
3100
  </script>
3101
- `}function gU(X){let $=X.custom;if(!$)return"";if($.inlineScript)return`
3101
+ `}function sK(X){let $=X.custom;if(!$)return"";if($.inlineScript)return`
3102
3102
  <!-- Custom Analytics -->
3103
3103
  <script>
3104
3104
  ${$.inlineScript}
@@ -3106,7 +3106,7 @@ ${$.inlineScript}
3106
3106
  `;if(!$.scriptUrl)return"";let Z=[];if($.scriptId)Z.push(`id="${u0($.scriptId)}"`);if($.attributes)for(let[J,G]of Object.entries($.attributes))Z.push(`${u0(J)}="${u0(G)}"`);return`
3107
3107
  <!-- Custom Analytics -->
3108
3108
  <script${Z.length>0?` ${Z.join(" ")}`:""} src="${u0($.scriptUrl)}" defer></script>
3109
- `}function FZ(X,$){let Z=CU($);if(!Z)return X;if(!X.includes("</head>")){let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}return X.replace("</head>",`${Z}</head>`)}function u0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var VZ=()=>{};function AZ(X){let $=X.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!$)return null;try{return Function(`return ${$[1]}`)()}catch{return null}}function RZ(X){let $=X?.layout;if($===!1)return!1;return typeof $==="string"&&$.trim()?$.trim():void 0}function TZ(X,$){let Z=X.match(new RegExp(`${$}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let Y=X.match(new RegExp(`${$}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function uU(X){let $=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=Z.exec(X))!==null){let[J,G,Q]=Y,w=Y.index,q=TZ(Q,"x-data");if(!q)continue;let W=`__stx_scope_${NZ++}`,K=TZ(Q,"x-init"),U=dU(X,G,w+J.length),z=X.slice(w,U.endIndex),B=mU(z);$.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:K,bindings:[],refs:B})}return $}function dU(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s|>)`,"gi"),Q=new RegExp(`</${$}>`,"gi"),w=new RegExp(`<${$}[^>]*/\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J,w.lastIndex=J;let q=G.exec(X),W=Q.exec(X),K=w.exec(X);if(K&&K.index<(q?.index??1/0)){J=K.index+K[0].length;continue}if(!W)return{endIndex:X.length};if(q&&q.index<W.index)Y++,J=q.index+q[0].length;else{if(Y--,Y===0)return{endIndex:W.index+W[0].length};J=W.index+W[0].length}}return{endIndex:X.length}}function mU(X){let $=new Map,Z=X.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[,G,Q]=J,w=lU(G);$.set(Q,w)}return $}function lU(X){let $=X.match(/\bid\s*=\s*["']([^"']*)["']/);if($)return $[1];return`__stx_el_${hU++}`}function cU(){return`
3109
+ `}function kZ(X,$){let Z=cK($);if(!Z)return X;if(!X.includes("</head>")){let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}return X.replace("</head>",`${Z}</head>`)}function u0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var IZ=()=>{};function EZ(X){let $=X.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!$)return null;try{return Function(`return ${$[1]}`)()}catch{return null}}function DZ(X){let $=X?.layout;if($===!1)return!1;return typeof $==="string"&&$.trim()?$.trim():void 0}function yZ(X,$){let Z=X.match(new RegExp(`${$}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let Y=X.match(new RegExp(`${$}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function aK(X){let $=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=Z.exec(X))!==null){let[J,G,Q]=Y,w=Y.index,q=yZ(Q,"x-data");if(!q)continue;let W=`__stx_scope_${SZ++}`,U=yZ(Q,"x-init"),K=tK(X,G,w+J.length),z=X.slice(w,K.endIndex),B=eK(z);$.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:B})}return $}function tK(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s|>)`,"gi"),Q=new RegExp(`</${$}>`,"gi"),w=new RegExp(`<${$}[^>]*/\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J,w.lastIndex=J;let q=G.exec(X),W=Q.exec(X),U=w.exec(X);if(U&&U.index<(q?.index??1/0)){J=U.index+U[0].length;continue}if(!W)return{endIndex:X.length};if(q&&q.index<W.index)Y++,J=q.index+q[0].length;else{if(Y--,Y===0)return{endIndex:W.index+W[0].length};J=W.index+W[0].length}}return{endIndex:X.length}}function eK(X){let $=new Map,Z=X.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[,G,Q]=J,w=Xz(G);$.set(Q,w)}return $}function Xz(X){let $=X.match(/\bid\s*=\s*["']([^"']*)["']/);if($)return $[1];return`__stx_el_${oK++}`}function $z(){return`
3110
3110
  // STX Reactive Runtime - x-cloak and transition CSS
3111
3111
  (function() {
3112
3112
  var style = document.createElement('style');
@@ -3313,7 +3313,7 @@ window.__stx_reactive = (function() {
3313
3313
 
3314
3314
  return { initScope: initScope, reactive: reactive };
3315
3315
  })();
3316
- `}function MZ(X,$){let Z=X.replace(/\{!!([\s\S]*?)!!\}/g,(w,q)=>{try{let W=v0(q,$,!0);if(W===void 0)return w;return String(W)}catch{return w}}),Y="",J=0,G=null;while(J<Z.length){let w=Z[J];if(G&&w==="\\"){Y+=w+(Z[J+1]??""),J+=2;continue}if(w==="{"&&Z[J+1]==="{"){let q=Z.indexOf("}}",J+2);if(q!==-1){let W=Z.slice(J,q+2);Y+=Q(Z.slice(J+2,q),W,G),J=q+2;continue}}if(G){if(w===G)G=null}else if(w==="'"||w==='"'||w==="`")G=w;Y+=w,J++}return Y;function Q(w,q,W){let K;try{K=v0(w,$,!0)}catch{return q}if(K===void 0)return q;if(W){let U=String(K).replace(/\\/g,"\\\\").replace(new RegExp(W==="`"?"`":W,"g"),`\\${W}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return W==="`"?U.replace(/\$\{/g,"\\${"):U}if(typeof K==="string"){let U=K.trim();if(U.startsWith("{")&&U.endsWith("}")||U.startsWith("[")&&U.endsWith("]"))try{return JSON.parse(U),U}catch{}}return JSON.stringify(K)}}function pU(X,$){if(X.length===0)return"";let Z=X.map((Y)=>{let J=JSON.stringify(Object.fromEntries(Y.refs)),G=MZ(Y.stateExpr,$),Q=Y.initExpr?MZ(Y.initExpr,$):null,w=JSON.stringify(G),q=Q?JSON.stringify(Q):"null";return`
3316
+ `}function bZ(X,$){let Z=X.replace(/\{!!([\s\S]*?)!!\}/g,(w,q)=>{try{let W=v0(q,$,!0);if(W===void 0)return w;return String(W)}catch{return w}}),Y="",J=0,G=null;while(J<Z.length){let w=Z[J];if(G&&w==="\\"){Y+=w+(Z[J+1]??""),J+=2;continue}if(w==="{"&&Z[J+1]==="{"){let q=Z.indexOf("}}",J+2);if(q!==-1){let W=Z.slice(J,q+2);Y+=Q(Z.slice(J+2,q),W,G),J=q+2;continue}}if(G){if(w===G)G=null}else if(w==="'"||w==='"'||w==="`")G=w;Y+=w,J++}return Y;function Q(w,q,W){let U;try{U=v0(w,$,!0)}catch{return q}if(U===void 0)return q;if(W){let K=String(U).replace(/\\/g,"\\\\").replace(new RegExp(W==="`"?"`":W,"g"),`\\${W}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return W==="`"?K.replace(/\$\{/g,"\\${"):K}if(typeof U==="string"){let K=U.trim();if(K.startsWith("{")&&K.endsWith("}")||K.startsWith("[")&&K.endsWith("]"))try{return JSON.parse(K),K}catch{}}return JSON.stringify(U)}}function Zz(X,$){if(X.length===0)return"";let Z=X.map((Y)=>{let J=JSON.stringify(Object.fromEntries(Y.refs)),G=bZ(Y.stateExpr,$),Q=Y.initExpr?bZ(Y.initExpr,$):null,w=JSON.stringify(G),q=Q?JSON.stringify(Q):"null";return`
3317
3317
  (function() {
3318
3318
  var scopeEl = document.querySelector('${Y.selector}');
3319
3319
  if (!scopeEl) return;
@@ -3322,44 +3322,44 @@ window.__stx_reactive = (function() {
3322
3322
  })();`}).join(`
3323
3323
  `);return`
3324
3324
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
3325
- ${cU()}
3325
+ ${$z()}
3326
3326
  ${Z}
3327
- </script>`}function kZ(X,$,Z){if(NZ=0,!nU(X))return X;let Y=uU(X);if(Y.length===0)return X;let J=iU(X,Y),G=pU(Y,$),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
3328
- `+J.slice(Q);else J+=G;return J}function iU(X,$){let Z=0,Y=X.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,G,Q)=>{let w=$[Z++];if(!w)return J;let q=/data-stx-scope="([^"]*)"/.exec(Q);if(q)return w.id=q[1],w.selector=`[data-stx-scope="${w.id}"]`,J;return`<${G} data-stx-scope="${w.id}"${Q}>`});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 nU(X){return/x-data\s*=\s*["']/.test(X)}var NZ=0,hU=0;var IZ=D(()=>{w1()});import rU from"fs";import W9 from"path";import{createHighlighter as sU}from"ts-syntax-highlighter";async function oU(X,$={}){try{if(!await i(X))throw Error(`Markdown file not found: ${X}`);let Y=(await rU.promises.stat(X)).mtime.getTime();if($.cache&&K9.has(X)){let U=K9.get(X);if(U.updatedAt>=Y)return{content:U.content,data:U.data}}let J=await Bun.file(X).text(),{data:G,content:Q}=HX(J),w=$.markdown||k7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=r1(Q,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)W=await aU(W,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:W,data:G||{}};if($.cache)K9.set(X,{...K,updatedAt:Y});return K}catch(Z){if($.debug)console.error(`Error reading/parsing markdown file ${X}:`,Z);let Y=Z instanceof Error?Z.message:String(Z);return{content:U0("Markdown File",`Error reading/parsing markdown file: ${Y}`,X,"",0,""),data:{}}}}async function aU(X,$,Z){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!bX)try{bX=await sU({theme:$||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),X}let J=async(w,q,W,K)=>{let U=K.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),z=W||(Z?"text":"");if(!z)return w;try{if(!bX.getSupportedLanguages().includes(z))return w;return(await bX.highlight(U,z,{theme:$})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return w},G=X,Q=X.matchAll(Y);for(let w of Q){let[q,W,K,U]=w,z=await J(q,W,K,U);G=G.replace(q,z)}return G}async function EZ(X,$,Z="",Y={}){return await tU(X,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,w,q,W)=>{try{let K=w;if(!W9.isAbsolute(w))K=W9.resolve(W9.dirname(Z),w);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of L){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),T=R.startsWith('"')&&R.endsWith('"'),M=R.startsWith("'")&&R.endsWith("'");if(T||M)R=R.substring(1,R.length-1);U[A]=R}}}}catch(O){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:z,data:B}=await oU(K,Y),_={...$,...B,...U},j=z,H=/\{\{([^}]+)\}\}/g;return j=j.replace(H,(O,L)=>{let F=L.trim();return _[F]!==void 0?String(_[F]):O}),j}catch(K){let U=K instanceof Error?K.message:String(K);return U0("Markdown File",`Error including markdown file: ${U}`,Z,X,W,Q)}})}async function tU(X,$,Z){let Y=[],J;while((J=$.exec(X))!==null){let w=J[0],q=J.index,W=J;Y.push(Z(...W).then((K)=>({match:w,replacement:K,index:q})))}let G=await Promise.all(Y);G.sort((w,q)=>q.index-w.index);let Q=X;for(let{match:w,replacement:q}of G)Q=Q.replace(w,()=>q);return Q}var K9,bX=null;var DZ=D(()=>{H1();T0();K9=new Map});function C1(X,$){try{let Z=X.trim();if(q0(Z))return W0(Z,Object.keys($))(...Object.values($));else return Y0(Z,$)}catch{return!1}}var yZ=D(()=>{F0()});function U9(X){for(let[$,Z]of Object.entries(o))if(Z===X)return $;return}var o;var SX=D(()=>{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 C7(){return!1}function P7(){return!C7()||process.env.STX_DEBUG==="true"}function CX(){return!1}import eU from"path";function PX(){return{...z9}}function vX(X){if(!z9.showRelativePaths||!X)return X;let $=z9.baseDir||process.cwd();try{let Z=eU.relative($,X);return Z.startsWith("..")?X:Z}catch{return X}}var Xz,z9,xX,Y5,fX;var gX=D(()=>{SX();Xz={showRelativePaths:!1,enableAutoRecovery:P7(),logRecoveryWarnings:!0},z9={...Xz};xX=class xX extends Error{code;filePath;line;column;context;numericCode;constructor(X,$,Z,Y,J,G,Q){super(X);this.code=$;this.filePath=Z;this.line=Y;this.column=J;this.context=G;if(this.name="StxError",this.numericCode=Q||o.EVALUATION_ERROR,this.filePath)this.filePath=vX(this.filePath)}};Y5=class Y5 extends xX{constructor(X,$,Z,Y,J,G){super(X,"stx_RUNTIME_ERROR",$,Z,Y,J,G||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};fX=class fX extends xX{isFatal=!0;constructor(X,$,Z,Y,J,G){super(X,"stx_VALIDATION_ERROR",$,Z,Y,J,G||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function SZ(X){let{type:$,message:Z,code:Y,filePath:J,line:G,column:Q,template:w,offset:q,snippet:W,suggestion:K,format:U="text"}=X,z=G,B=Q;if(!z&&w&&q!==void 0){let L=Qz(w,q);z=L.line,B=L.column}let _=J?vX(J):void 0,j=Y?U9(Y):void 0,H={type:$,code:Y,codeName:j,message:Z,filePath:_,line:z,column:B,snippet:W,suggestion:K,timestamp:new Date().toISOString()},O;switch(U){case"html":O=Zz(H);break;case"json":O=JSON.stringify(H,null,2);break;case"console":O=Yz(H,w,q);break;case"text":default:O=$z(H,w,q);break}return{formatted:O,data:H}}function $z(X,$,Z){let Y=[],J=X.code?` [${X.codeName||X.code}]`:"";if(Y.push(`[${X.type} Error${J}]`),X.filePath){let G=X.filePath;if(X.line){if(G+=`:${X.line}`,X.column)G+=`:${X.column}`}Y.push(`at ${G}`)}if(Y.push(`
3329
- ${X.message}`),$&&X.line){let G=Jz($,X.line,2);if(G)Y.push(`
3327
+ </script>`}function CZ(X,$,Z){if(SZ=0,!Jz(X))return X;let Y=aK(X);if(Y.length===0)return X;let J=Yz(X,Y),G=Zz(Y,$),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
3328
+ `+J.slice(Q);else J+=G;return J}function Yz(X,$){let Z=0,Y=X.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,G,Q)=>{let w=$[Z++];if(!w)return J;let q=/data-stx-scope="([^"]*)"/.exec(Q);if(q)return w.id=q[1],w.selector=`[data-stx-scope="${w.id}"]`,J;return`<${G} data-stx-scope="${w.id}"${Q}>`});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 Jz(X){return/x-data\s*=\s*["']/.test(X)}var SZ=0,oK=0;var PZ=D(()=>{Q1()});import Gz from"fs";import W9 from"path";import{createHighlighter as Qz}from"ts-syntax-highlighter";async function wz(X,$={}){try{if(!await i(X))throw Error(`Markdown file not found: ${X}`);let Y=(await Gz.promises.stat(X)).mtime.getTime();if($.cache&&U9.has(X)){let K=U9.get(X);if(K.updatedAt>=Y)return{content:K.content,data:K.data}}let J=await Bun.file(X).text(),{data:G,content:Q}=LX(J),w=$.markdown||I7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=r1(Q,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)W=await qz(W,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:G||{}};if($.cache)U9.set(X,{...U,updatedAt:Y});return U}catch(Z){if($.debug)console.error(`Error reading/parsing markdown file ${X}:`,Z);let Y=Z instanceof Error?Z.message:String(Z);return{content:K0("Markdown File",`Error reading/parsing markdown file: ${Y}`,X,"",0,""),data:{}}}}async function qz(X,$,Z){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!SX)try{SX=await Qz({theme:$||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),X}let J=async(w,q,W,U)=>{let K=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),z=W||(Z?"text":"");if(!z)return w;try{if(!SX.getSupportedLanguages().includes(z))return w;return(await SX.highlight(K,z,{theme:$})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return w},G=X,Q=X.matchAll(Y);for(let w of Q){let[q,W,U,K]=w,z=await J(q,W,U,K);G=G.replace(q,z)}return G}async function vZ(X,$,Z="",Y={}){return await Wz(X,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,w,q,W)=>{try{let U=w;if(!W9.isAbsolute(w))U=W9.resolve(W9.dirname(Z),w);let K={};if(q)try{try{K=JSON.parse(q)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of L){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),T=R.startsWith('"')&&R.endsWith('"'),M=R.startsWith("'")&&R.endsWith("'");if(T||M)R=R.substring(1,R.length-1);K[A]=R}}}}catch(O){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:z,data:B}=await wz(U,Y),_={...$,...B,...K},j=z,H=/\{\{([^}]+)\}\}/g;return j=j.replace(H,(O,L)=>{let F=L.trim();return _[F]!==void 0?String(_[F]):O}),j}catch(U){let K=U instanceof Error?U.message:String(U);return K0("Markdown File",`Error including markdown file: ${K}`,Z,X,W,Q)}})}async function Wz(X,$,Z){let Y=[],J;while((J=$.exec(X))!==null){let w=J[0],q=J.index,W=J;Y.push(Z(...W).then((U)=>({match:w,replacement:U,index:q})))}let G=await Promise.all(Y);G.sort((w,q)=>q.index-w.index);let Q=X;for(let{match:w,replacement:q}of G)Q=Q.replace(w,()=>q);return Q}var U9,SX=null;var xZ=D(()=>{j1();T0();U9=new Map});function C1(X,$){try{let Z=X.trim();if(q0(Z))return W0(Z,Object.keys($))(...Object.values($));else return Y0(Z,$)}catch{return!1}}var fZ=D(()=>{F0()});function K9(X){for(let[$,Z]of Object.entries(o))if(Z===X)return $;return}var o;var CX=D(()=>{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 v7(){return!1}function x7(){return!v7()||process.env.STX_DEBUG==="true"}function PX(){return!1}import Uz from"path";function vX(){return{...z9}}function xX(X){if(!z9.showRelativePaths||!X)return X;let $=z9.baseDir||process.cwd();try{let Z=Uz.relative($,X);return Z.startsWith("..")?X:Z}catch{return X}}var Kz,z9,fX,Y5,gX;var hX=D(()=>{CX();Kz={showRelativePaths:!1,enableAutoRecovery:x7(),logRecoveryWarnings:!0},z9={...Kz};fX=class fX extends Error{code;filePath;line;column;context;numericCode;constructor(X,$,Z,Y,J,G,Q){super(X);this.code=$;this.filePath=Z;this.line=Y;this.column=J;this.context=G;if(this.name="StxError",this.numericCode=Q||o.EVALUATION_ERROR,this.filePath)this.filePath=xX(this.filePath)}};Y5=class Y5 extends fX{constructor(X,$,Z,Y,J,G){super(X,"stx_RUNTIME_ERROR",$,Z,Y,J,G||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};gX=class gX extends fX{isFatal=!0;constructor(X,$,Z,Y,J,G){super(X,"stx_VALIDATION_ERROR",$,Z,Y,J,G||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function hZ(X){let{type:$,message:Z,code:Y,filePath:J,line:G,column:Q,template:w,offset:q,snippet:W,suggestion:U,format:K="text"}=X,z=G,B=Q;if(!z&&w&&q!==void 0){let L=Lz(w,q);z=L.line,B=L.column}let _=J?xX(J):void 0,j=Y?K9(Y):void 0,H={type:$,code:Y,codeName:j,message:Z,filePath:_,line:z,column:B,snippet:W,suggestion:U,timestamp:new Date().toISOString()},O;switch(K){case"html":O=_z(H);break;case"json":O=JSON.stringify(H,null,2);break;case"console":O=Bz(H,w,q);break;case"text":default:O=zz(H,w,q);break}return{formatted:O,data:H}}function zz(X,$,Z){let Y=[],J=X.code?` [${X.codeName||X.code}]`:"";if(Y.push(`[${X.type} Error${J}]`),X.filePath){let G=X.filePath;if(X.line){if(G+=`:${X.line}`,X.column)G+=`:${X.column}`}Y.push(`at ${G}`)}if(Y.push(`
3329
+ ${X.message}`),$&&X.line){let G=jz($,X.line,2);if(G)Y.push(`
3330
3330
  ${G}`)}if(X.snippet)Y.push(`
3331
3331
  Snippet: ${X.snippet}`);if(X.suggestion)Y.push(`
3332
- Suggestion: ${X.suggestion}`);return Y.join(" ")}function Zz(X){let $=X.code?` [${X.code}]`:"",Z=X.filePath?` in ${X.filePath}${X.line?`:${X.line}`:""}`:"",Y=`<!-- [${X.type} Error${$}]${Z}: ${bZ(X.message)}`;if(X.suggestion)Y+=` | Suggestion: ${bZ(X.suggestion)}`;return Y+=" -->",Y}function Yz(X,$,Z){let W=[],K=X.code?` [${X.codeName||X.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${X.type} Error${K} \u2501\u2501\u2501${"\x1B[0m"}`),X.filePath){let U=`\x1B[36m${X.filePath}\x1B[0m`;if(X.line){if(U+=`\x1B[90m:${X.line}\x1B[0m`,X.column)U+=`\x1B[90m:${X.column}\x1B[0m`}W.push(`
3333
- \x1B[90mat\x1B[0m ${U}`)}if(W.push(`
3332
+ Suggestion: ${X.suggestion}`);return Y.join(" ")}function _z(X){let $=X.code?` [${X.code}]`:"",Z=X.filePath?` in ${X.filePath}${X.line?`:${X.line}`:""}`:"",Y=`<!-- [${X.type} Error${$}]${Z}: ${gZ(X.message)}`;if(X.suggestion)Y+=` | Suggestion: ${gZ(X.suggestion)}`;return Y+=" -->",Y}function Bz(X,$,Z){let W=[],U=X.code?` [${X.codeName||X.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${X.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),X.filePath){let K=`\x1B[36m${X.filePath}\x1B[0m`;if(X.line){if(K+=`\x1B[90m:${X.line}\x1B[0m`,X.column)K+=`\x1B[90m:${X.column}\x1B[0m`}W.push(`
3333
+ \x1B[90mat\x1B[0m ${K}`)}if(W.push(`
3334
3334
 
3335
- ${X.message}`),$&&X.line){let U=Gz($,X.line,2);if(U)W.push(`
3335
+ ${X.message}`),$&&X.line){let K=Hz($,X.line,2);if(K)W.push(`
3336
3336
 
3337
3337
  \x1B[90mContext:\x1B[0m
3338
- ${U}`)}if(X.suggestion)W.push(`
3338
+ ${K}`)}if(X.suggestion)W.push(`
3339
3339
 
3340
3340
  \x1B[33mSuggestion:\x1B[0m ${X.suggestion}`);return W.push(`
3341
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function Jz(X,$,Z){let Y=X.split(`
3341
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function jz(X,$,Z){let Y=X.split(`
3342
3342
  `),J=Math.max(0,$-Z-1),G=Math.min(Y.length-1,$+Z-1),Q=[];for(let w=J;w<=G;w++){let q=(w+1).toString().padStart(4),W=w===$-1?">":" ";Q.push(`${W}${q} | ${Y[w]}`)}return Q.join(`
3343
- `)}function Gz(X,$,Z){let Y=X.split(`
3344
- `),J=Math.max(0,$-Z-1),G=Math.min(Y.length-1,$+Z-1),Q="\x1B[90m",w="\x1B[31m",q="\x1B[0m",W=[];for(let K=J;K<=G;K++){let U=(K+1).toString().padStart(4),z=K===$-1,B=z?"\x1B[31m>\x1B[0m":" ",_=z?`\x1B[31m${Y[K]}\x1B[0m`:`\x1B[90m${Y[K]}\x1B[0m`;W.push(`${B}\x1B[90m${U}\x1B[0m | ${_}`)}return W.join(`
3345
- `)}function bZ(X){return X.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Qz(X,$){let Y=X.substring(0,$).split(`
3346
- `);return{line:Y.length,column:Y[Y.length-1].length}}function $0(X,$,Z){return SZ({type:X,message:$,code:Z,format:"html"}).formatted}async function v5(X,$,Z){try{return await X()}catch(Y){if(Z&&Y instanceof Error)Z(Y);return $}}var CZ=D(()=>{SX();gX()});class B9{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(X={}){this.maxErrors=X.maxErrors??1000,this.enableFileLogging=X.enableFileLogging??!1,this.logFilePath=X.logFilePath??".stx/errors.log",this.logFormat=X.logFormat??"json",this.maxFileSize=X.maxFileSize??10485760,this.maxLogFiles=X.maxLogFiles??5,this.minLevel=X.minLevel??"all"}configure(X){if(X.maxErrors!==void 0)this.maxErrors=X.maxErrors;if(X.enableFileLogging!==void 0)this.enableFileLogging=X.enableFileLogging;if(X.logFilePath!==void 0)this.logFilePath=X.logFilePath;if(X.logFormat!==void 0)this.logFormat=X.logFormat;if(X.maxFileSize!==void 0)this.maxFileSize=X.maxFileSize;if(X.maxLogFiles!==void 0)this.maxLogFiles=X.maxLogFiles;if(X.minLevel!==void 0)this.minLevel=X.minLevel}log(X,$,Z="error"){let Y={timestamp:new Date,error:X,context:$,level:Z};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))this.writeToFile(Y)}shouldLog(X){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return X==="error"||X==="warning";if(this.minLevel==="error")return X==="error";return!0}formatEntry(X){if(this.logFormat==="json")return JSON.stringify({timestamp:X.timestamp.toISOString(),level:X.level||"error",type:X.error.constructor.name,message:X.error.message,stack:X.error.stack,context:X.context});let $=[`[${X.timestamp.toISOString()}] [${(X.level||"error").toUpperCase()}] ${X.error.constructor.name}: ${X.error.message}`];if(X.error.stack)$.push(` Stack: ${X.error.stack.split(`
3343
+ `)}function Hz(X,$,Z){let Y=X.split(`
3344
+ `),J=Math.max(0,$-Z-1),G=Math.min(Y.length-1,$+Z-1),Q="\x1B[90m",w="\x1B[31m",q="\x1B[0m",W=[];for(let U=J;U<=G;U++){let K=(U+1).toString().padStart(4),z=U===$-1,B=z?"\x1B[31m>\x1B[0m":" ",_=z?`\x1B[31m${Y[U]}\x1B[0m`:`\x1B[90m${Y[U]}\x1B[0m`;W.push(`${B}\x1B[90m${K}\x1B[0m | ${_}`)}return W.join(`
3345
+ `)}function gZ(X){return X.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Lz(X,$){let Y=X.substring(0,$).split(`
3346
+ `);return{line:Y.length,column:Y[Y.length-1].length}}function $0(X,$,Z){return hZ({type:X,message:$,code:Z,format:"html"}).formatted}async function x5(X,$,Z){try{return await X()}catch(Y){if(Z&&Y instanceof Error)Z(Y);return $}}var uZ=D(()=>{CX();hX()});class B9{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(X={}){this.maxErrors=X.maxErrors??1000,this.enableFileLogging=X.enableFileLogging??!1,this.logFilePath=X.logFilePath??".stx/errors.log",this.logFormat=X.logFormat??"json",this.maxFileSize=X.maxFileSize??10485760,this.maxLogFiles=X.maxLogFiles??5,this.minLevel=X.minLevel??"all"}configure(X){if(X.maxErrors!==void 0)this.maxErrors=X.maxErrors;if(X.enableFileLogging!==void 0)this.enableFileLogging=X.enableFileLogging;if(X.logFilePath!==void 0)this.logFilePath=X.logFilePath;if(X.logFormat!==void 0)this.logFormat=X.logFormat;if(X.maxFileSize!==void 0)this.maxFileSize=X.maxFileSize;if(X.maxLogFiles!==void 0)this.maxLogFiles=X.maxLogFiles;if(X.minLevel!==void 0)this.minLevel=X.minLevel}log(X,$,Z="error"){let Y={timestamp:new Date,error:X,context:$,level:Z};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))this.writeToFile(Y)}shouldLog(X){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return X==="error"||X==="warning";if(this.minLevel==="error")return X==="error";return!0}formatEntry(X){if(this.logFormat==="json")return JSON.stringify({timestamp:X.timestamp.toISOString(),level:X.level||"error",type:X.error.constructor.name,message:X.error.message,stack:X.error.stack,context:X.context});let $=[`[${X.timestamp.toISOString()}] [${(X.level||"error").toUpperCase()}] ${X.error.constructor.name}: ${X.error.message}`];if(X.error.stack)$.push(` Stack: ${X.error.stack.split(`
3347
3347
  `).slice(1).join(`
3348
3348
  `)}`);if(X.context)$.push(` Context: ${JSON.stringify(X.context)}`);return $.join(`
3349
3349
  `)}writeToFile(X){this.writeQueue=this.writeQueue.then(async()=>{try{let $=await import("fs"),Y=(await import("path")).dirname(this.logFilePath);if(!$.existsSync(Y))$.mkdirSync(Y,{recursive:!0});await this.rotateIfNeeded($);let J=`${this.formatEntry(X)}
3350
3350
  `;$.appendFileSync(this.logFilePath,J,"utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",$)}})}async rotateIfNeeded(X){try{if(!X.existsSync(this.logFilePath))return;if(X.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Z=this.maxLogFiles-1;Z>=1;Z--){let Y=`${this.logFilePath}.${Z}`,J=`${this.logFilePath}.${Z+1}`;if(X.existsSync(Y))if(Z>=this.maxLogFiles-1)X.unlinkSync(Y);else X.renameSync(Y,J)}if(this.maxLogFiles<=1)X.writeFileSync(this.logFilePath,"");else X.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",$)}}getRecentErrors(X=10){return this.errors.slice(-X)}getErrorsByType(X){return this.errors.filter(($)=>$.error.constructor.name===X)}getErrorsByLevel(X){return this.errors.filter(($)=>$.level===X)}clear(){this.errors.length=0}async clearLogFile(){try{let X=await import("fs");if(X.existsSync(this.logFilePath))X.writeFileSync(this.logFilePath,"","utf-8")}catch(X){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",X)}}getStats(){let X={},$={error:0,warning:0,info:0};for(let Z of this.errors){let Y=Z.error.constructor.name;X[Y]=(X[Y]||0)+1;let J=Z.level||"error";$[J]=($[J]||0)+1}return{total:this.errors.length,byType:X,byLevel:$}}async exportToFile(X,$="json"){let Z=await import("fs"),J=(await import("path")).dirname(X);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});if($==="json"){let G=this.errors.map((Q)=>({timestamp:Q.timestamp.toISOString(),level:Q.level||"error",type:Q.error.constructor.name,message:Q.error.message,stack:Q.error.stack,context:Q.context}));Z.writeFileSync(X,JSON.stringify(G,null,2),"utf-8")}else{let G=this.errors.map((Q)=>this.formatEntry(Q));Z.writeFileSync(X,G.join(`
3351
3351
 
3352
- `),"utf-8")}}async flush(){await this.writeQueue}}var _9,$1,j9;var PZ=D(()=>{gX();_9={isEnabled(){return PX().enableAutoRecovery},fixCommonSyntaxErrors(X){let $=PX();if(!$.enableAutoRecovery)return{fixed:X,fixes:[]};let Z=X,Y=[],J=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(J>G){let w=J-G;Z+="}}".repeat(w),Y.push(`Added ${w} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let w of Q){let q=(Z.match(new RegExp(`@${w}\\b`,"g"))||[]).length,W=(Z.match(new RegExp(`@end${w}\\b`,"g"))||[]).length;if(q>W){let K=q-W;for(let U=0;U<K;U++)Z+=`
3353
- @end${w}`;Y.push(`Added ${K} missing @end${w}`)}}if(Y.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((w)=>console.warn(` - ${w}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:Y}},createFallbackContent(X,$){if(P7())return`<!-- ${X} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};$1=new B9,j9={isDevelopment(){return P7()},logDetailedError(X,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",X.message),console.error("Stack:",X.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(X,$){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${X.message}`,`Type: ${X.constructor.name}`,`Stack: ${X.stack}`];if($)Z.push(`Context: ${JSON.stringify($,null,2)}`);return Z.push("========================"),Z.join(`
3354
- `)}}});var vZ=()=>{};var xZ=D(()=>{SX();CZ();PZ();vZ();gX()});var F1=D(()=>{xZ()});function N0(X,$,Z,Y=0){let J=0,G=Y,Q=null,w=0,q=!1;while(G<X.length){let W=X[G];if(Q&&q){q=!1,G++;continue}if(Q&&W==="\\"){q=!0,G++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!Q){Q=W,G++;continue}if(W===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&W==="$"&&X[G+1]==="{"){w++,G+=2;continue}if(w>0&&W==="}"){w--,G++;continue}if(W==="`"&&Q==="`"&&w===0){Q=null,G++;continue}if(Q){G++;continue}if(W===$)J++;else if(W===Z){if(J--,J===0)return G}G++}return-1}function P1(X,$){let Z=wz(X,$);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function wz(X,$){let Z=$;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let Y=N0(X,"(",")",Z);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:X.slice(Z+1,Y),endPos:Y+1}}function qz(X,$){let Z=X.lastIndexOf("<",$);if(Z===-1)return!1;return Z>X.lastIndexOf(">",$)}function J5(X,$,Z,Y){let J=1,G=Y,Q=new RegExp(`@${$}\\s*\\(`,"g"),w=new RegExp(`@${Z}(?![a-z])`,"g");while(G<X.length&&J>0){Q.lastIndex=G,w.lastIndex=G;let q=Q.exec(X),W=w.exec(X),K=q?q.index:1/0,U=W?W.index:1/0;if(K<U)J++,G=K+q[0].length;else if(U<1/0){if(J--,J===0)return U;G=U+W[0].length}else break}return-1}function fZ(X,$){let Z=X.slice($).match(/^@if\s*/);if(!Z)return null;let Y=$+Z[0].length,J=P1(X,Y);if(!J)return null;let G=J.endPos,Q=J5(X,"if","endif",G);if(Q===-1)return null;let w=X.slice(G,Q),q=[],W=0,K="if",U=J.expression,z=0,B=0;while(W<w.length){let _=w.indexOf("@",W);if(_===-1)break;W=_;let j=w.substring(_);if(qz(w,_)){W++;continue}if(/^@if\s*\(/.test(j)){B++,W++;continue}if(/^@endif(?![a-z])/.test(j)){B--,W+=6;continue}if(B===0){let H=j.match(/^@elseif\s*/);if(H){q.push({type:K,condition:U,content:w.substring(z,W),start:G+z,end:G+W});let O=W+H[0].length,L=P1(w,O);if(!L){W++;continue}K="elseif",U=L.expression,W=L.endPos,z=W;continue}else if(/^@else(?![a-z])/.test(j)){q.push({type:K,condition:U,content:w.substring(z,W),start:G+z,end:G+W}),K="else",U=void 0,W+=5,z=W;continue}}W++}return q.push({type:K,condition:U,content:w.slice(z),start:G+z,end:G+w.length}),{fullMatch:X.slice($,Q+6),branches:q,start:$,end:Q+6}}function v7(X){let $=[],Z=/@if\s*\(/g,Y=Z.exec(X);while(Y!==null){if($.some((Q)=>Y.index>Q.start&&Y.index<Q.end)){Y=Z.exec(X);continue}let G=fZ(X,Y.index);if(G)$.push(G),Z.lastIndex=G.end;Y=Z.exec(X)}return $}function hX(X,$,Z){let Y=[],J=new RegExp(`@${$}\\s*\\(`,"g"),G=J.exec(X);while(G!==null){if(Y.some((j)=>G.index>j.start&&G.index<j.end)){G=J.exec(X);continue}let w=G.index,q=w+G[0].length-1,W=N0(X,"(",")",q);if(W===-1){G=J.exec(X);continue}let K=X.slice(q+1,W),U=W+1,z=J5(X,$,Z,U);if(z===-1){G=J.exec(X);continue}let B=X.slice(U,z),_=z+`@${Z}`.length;Y.push({fullMatch:X.slice(w,_),name:$,params:K,content:B,start:w,end:_}),J.lastIndex=_,G=J.exec(X)}return Y}function H9(X,$){let Z=X.slice($).match(/^@switch\s*/);if(!Z)return null;let Y=$+Z[0].length,J=P1(X,Y);if(!J)return null;let G=J.endPos,Q=J5(X,"switch","endswitch",G);if(Q===-1)return null;let w=X.slice(G,Q),q=[],W=0,K=null,U=0;while(W<w.length){let z=w.slice(W),B=z.match(/^@switch\s*\(/),_=z.match(/^@endswitch(?![a-z])/);if(B){if(U++,K)K.content+=B[0];W+=B[0].length;continue}if(_){if(U--,K)K.content+=_[0];W+=_[0].length;continue}if(U>0){if(K)K.content+=w[W];W++;continue}let j=z.match(/^@case\s*/),H=z.match(/^@default(?![a-z])/),O=z.match(/^@break(?![a-z])/);if(j&&z.startsWith("@case")){if(K)q.push(K);let L=W+j[0].length,F=P1(w,L);if(!F){W++;continue}K={type:"case",value:F.expression,content:""},W=F.endPos}else if(H&&z.startsWith("@default")){if(K)q.push(K);K={type:"default",content:""},W+=H[0].length}else if(O&&z.startsWith("@break"))W+=O[0].length;else{if(K)K.content+=w[W];W++}}if(K)q.push(K);return{fullMatch:X.slice($,Q+10),expression:J.expression,cases:q,start:$,end:Q+10}}var gZ=()=>{};var hZ=()=>{};var uX=D(()=>{gZ();hZ()});function zz(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=H9(Y,Q);if(!w)break;try{let q;if(q0(w.expression))q=W0(w.expression,Object.keys($))(...Object.values($));else q=Y0(w.expression,$);let W="",K=!1;for(let U of w.cases)if(U.type==="default"){if(!K)W=U.content.trim()}else try{let z;if(U.value&&q0(U.value))z=W0(U.value,Object.keys($))(...Object.values($));else if(U.value)z=Y0(U.value,$);if(q===z){W=U.content.trim(),K=!0;break}}catch{continue}Y=Y.substring(0,Q)+W+Y.substring(w.end),J=!0}catch(q){let W=q instanceof Error?q.message:String(q),K=$0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+K+Y.substring(w.end);break}}return Y}function _z(X){let $=[];return{masked:X.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return $.push(Y),`\x00stx-script-${$.length-1}\x00`}),scripts:$}}function Bz(X,$){if($.length===0)return X;return X.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,Y)=>$[Number(Y)]??Z)}function G5(X,$,Z){let{masked:Y,scripts:J}=_z(X);return Bz(jz(Y,$,Z),J)}function jz(X,$,Z){let Y=X;Y=zz(Y,$,Z);{let G=!0;while(G){G=!1;let Q=Y.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=P1(Y,w+7);if(!q)break;let W=q.endPos,K=J5(Y,"unless","endunless",W);if(K===-1){console.warn(`[stx] @unless directive at position ${w} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=Y.slice(W,K),z=q.expression,B=-1;{let j=0,H=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,F=[],V;while((V=H.exec(U))!==null)F.push({pos:V.index,type:"open"});while((V=O.exec(U))!==null)F.push({pos:V.index,type:"close"});while((V=L.exec(U))!==null)F.push({pos:V.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")j++;else if(A.type==="close")j--;else if(A.type==="else"&&j===0){B=A.pos;break}}let _;if(B!==-1){let j=U.slice(0,B),H=U.slice(B+5);_=`@if (${z})${H}@else ${j}@endif`}else _=`@if (!(${z}))${U}@endif`;Y=Y.substring(0,w)+_+Y.substring(K+10),G=!0}}Y=O9(Y,$,Z),Y=F9(Y,$,Z),Y=L9(Y,$);let J=()=>{let G=v7(Y);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let w=G[Q];try{let q="",W=!1;for(let K of w.branches){if(W)break;if(K.type==="else")q=K.content,W=!0;else try{let U;if(K.condition&&q0(K.condition))U=W0(K.condition,Object.keys($))(...Object.values($));else if(K.condition)U=Y0(K.condition,$);if(U)q=K.content,W=!0}catch(U){q=$0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${U instanceof Error?U.message:String(U)}`,o.EVALUATION_ERROR),W=!0}}Y=Y.substring(0,w.start)+q+Y.substring(w.end)}catch(q){let W=q instanceof Error?q.message:String(q),K=$0("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,w.start)+K+Y.substring(w.end)}}return!0};while(!0){let G=Y;if(!J())break;if(Y===G)break}return Y}function uZ(X){let $=0;while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!=="(")return null;$++;while($<X.length&&/\s/.test(X[$]))$++;let Z=X[$];if(Z!=="'"&&Z!=='"')return null;$++;let Y=[];while($<X.length){let J=X[$];if(J==="\\"&&$+1<X.length){Y.push(X[$+1]),$+=2;continue}if(J===Z){$++;break}Y.push(J),$++}while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!==")")return null;return $++,{value:Y.join(""),consumed:$}}function L9(X,$){let Z=X;function Y(w,q,W,K){let U=1,z=K,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g");while(z<w.length&&U>0){B.lastIndex=z,_.lastIndex=z;let j=B.exec(w),H=_.exec(w),O=j?j.index:1/0,L=H?H.index:1/0;if(O<L)U++,z=O+j[0].length;else if(L<1/0){if(U--,U===0)return L;z=L+H[0].length}else break}return-1}function J(w,q,W){let K=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,_=[],j;while((j=U.exec(w))!==null)_.push({pos:j.index,type:"open"});while((j=z.exec(w))!==null)_.push({pos:j.index,type:"close"});while((j=B.exec(w))!==null)_.push({pos:j.index,type:"else"});_.sort((H,O)=>H.pos-O.pos);for(let H of _)if(H.type==="open")K++;else if(H.type==="close")K--;else if(H.type==="else"&&K===0)return H.pos;return-1}{let w=!0;while(w){w=!1;let q=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,K,U,z=Z.slice(W+5),B=uZ(z);if(B)K=B.value,U=W+5+B.consumed;else U=W+5;let _=Y(Z,"auth","endauth",U);if(_===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let j=Z.slice(U,_),H=J(j,"auth","endauth"),O;if(!$.auth)O=!1;else O=K?C1(`auth?.check && auth?.user?.[${K}]`,$):C1("auth?.check",$);let L;if(H!==-1){let F=j.slice(0,H),V=j.slice(H+5);L=O?F:V}else L=O?j:"";Z=Z.substring(0,W)+L+Z.substring(_+8),w=!0}}{let w=!0;while(w){w=!1;let q=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,K,U,z=Z.slice(W+6),B=uZ(z);if(B)K=B.value,U=W+6+B.consumed;else U=W+6;let _=Y(Z,"guest","endguest",U);if(_===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let j=Z.slice(U,_),H=J(j,"guest","endguest"),O;if(!$.auth)O=!0;else O=K?C1(`!auth?.check || !auth?.user?.[${K}]`,$):C1("!auth?.check",$);let L;if(H!==-1){let F=j.slice(0,H),V=j.slice(H+5);L=O?F:V}else L=O?j:"";Z=Z.substring(0,W)+L+Z.substring(_+9),w=!0}}function G(w,q,W){if($.userCan&&typeof $.userCan[w]==="boolean")return $.userCan[w];if($.permissions?.check&&typeof $.permissions.check==="function")try{let K=[w];if(q)K.push(q);if(W){let U=C1(W,$);K.push(U)}return $.permissions.check(...K)}catch{return!1}return!1}function Q(w){let q=w.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let w of["can","cannot"]){let q=`end${w}`,W=w==="can"?"elsecan":"elsecannot",K=!0;while(K){K=!1;let U=Z.match(new RegExp(`@${w}\\s*\\(`));if(!U||U.index===void 0)break;let z=U.index,B=Z.slice(z+`@${w}`.length),_=Q(B);if(!_)break;let j=z+`@${w}`.length+_.paramsEnd,H=Y(Z,w,q,j);if(H===-1){console.warn(`[stx] @${w} directive at position ${z} has no matching @${q} \u2014 the block was skipped.`);break}let O=Z.slice(j,H),L=[],F=0,V=new RegExp(`@${w}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),R=new RegExp(`@${W}\\s*\\(`,"g"),T=/@else(?![a-z])/g,M=[],k;while((k=V.exec(O))!==null)M.push({pos:k.index,type:"open"});while((k=A.exec(O))!==null)M.push({pos:k.index,type:"close"});while((k=R.exec(O))!==null)M.push({pos:k.index,type:"elseDirective"});while((k=T.exec(O))!==null)M.push({pos:k.index,type:"else"});M.sort((b,P)=>b.pos-P.pos);for(let b of M){if(b.type==="open"){F++;continue}if(b.type==="close"){F--;continue}if(F===0)L.push(b)}let N=[],y=0;for(let b=0;b<L.length;b++){let P=L[b];if(N.push({content:O.slice(y,P.pos),ability:void 0}),P.type==="elseDirective"){let x=O.slice(P.pos+`@${W}`.length),m=Q(x);if(m){N[N.length-1]={content:O.slice(y,P.pos)},y=P.pos+`@${W}`.length+m.paramsEnd,N.push({content:"",ability:m.ability,type:m.type,id:m.id}),N.pop();let l=L[b+1],Q0=l?l.pos:O.length;N.push({content:O.slice(y,Q0),ability:m.ability,type:m.type,id:m.id}),y=Q0}}else y=P.pos+5}if(y<O.length){let b=N[N.length-1];if(L.length>0&&L[L.length-1].type==="else")N.push({content:O.slice(y),isFinalElse:!0});else if(N.length===0)N.push({content:O.slice(y)})}let I=G(_.ability,_.type,_.id),C=w==="can"?I:!I,S="";if(C)S=N[0]?.content||"";else{let b=!1;for(let P=1;P<N.length;P++){let x=N[P];if(x.isFinalElse){S=x.content,b=!0;break}if(x.ability){let m=G(x.ability,x.type,x.id);if(w==="can"?m:!m){S=x.content,b=!0;break}}}if(!b&&N.length>0){let P=N[N.length-1];if(P.isFinalElse)S=P.content}}Z=Z.substring(0,z)+S+Z.substring(H+`@${q}`.length),K=!0}}return Z}function O9(X,$,Z){let Y=X;function J(G,Q,w,q,W){let K=!0;while(K){K=!1;let U=new RegExp(`@${Q}\\s*\\(`),z=G.match(U);if(!z||z.index===void 0)break;let B=z.index,_=P1(G,B+`@${Q}`.length);if(!_)break;let j=_.endPos,H=J5(G,Q,w,j);if(H===-1){console.warn(`[stx] @${Q} directive at position ${B} has no matching @${w} \u2014 the block was skipped.`);break}let O=G.slice(j,H),L=_.expression,F=-1,V=0,A=0;while(A<O.length){let R=O.indexOf("@",A);if(R===-1)break;let T=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(T)){F=R;break}A=R+1}try{let R=q(L.trim()),T;if(F!==-1){let M=O.slice(0,F),k=O.slice(F+5);T=R?M:k}else T=R?O:"";G=G.substring(0,B)+T+G.substring(H+`@${w}`.length),K=!0}catch(R){let T=R instanceof Error?R.message:String(R),M=$0(W,`Error processing @${Q} directive: ${T}`,o.EVALUATION_ERROR);G=G.substring(0,B)+M+G.substring(H+`@${w}`.length);break}}return G}return Y=J(Y,"isset","endisset",(G)=>{let Q=C1(G,$);return Q!==void 0&&Q!==null},"Isset"),Y=J(Y,"empty","endempty",(G)=>{let Q=C1(G,$);return Q===void 0||Q===null||Q===""||Q===0||Q===!1||Array.isArray(Q)&&Q.length===0||typeof Q==="object"&&Q!==null&&Object.keys(Q).length===0},"Empty"),Y}function F9(X,$,Z){let Y=X,J="development";function G(Q,w,q,W){let K=new RegExp(`@${w}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`^@${w}(?![a-z])`),B=new RegExp(`^@${q}(?![a-z])`),_=Q,j=!0;while(j){j=!1,K.lastIndex=0;let H=K.exec(_);if(!H)break;let O=H.index,L=O+H[0].length;if(w==="env"){let I=_.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;L+=I[0].length,W=J===I[2]}let F=1,V=L,A=-1;while(F>0&&V<_.length){K.lastIndex=V,U.lastIndex=V;let I=K.exec(_),C=U.exec(_),S=I?I.index:1/0,b=C?C.index:1/0;if(S<b)F++,V=S+I[0].length;else if(b<1/0){if(F--,F===0){A=b;break}V=b+C[0].length}else break}if(A===-1){console.warn(`[stx] @${w} directive at position ${O} has no matching @${q} \u2014 the block was skipped.`);break}let R=_.substring(L,A),T=-1,M=0,k=0;while(k<R.length){let I=R.indexOf("@",k);if(I===-1)break;let C=R.substring(I);if(z.test(C)){M++,k=I+1;continue}if(B.test(C)){M--,k=I+1;continue}if(M===0&&/^@else(?![a-z])/.test(C)){T=I;break}k=I+1}let N;if(T!==-1){let I=R.slice(0,T),C=R.slice(T+5);N=W?I:C}else N=W?R:"";let y=`@${q}`.length;_=_.substring(0,O)+N+_.substring(A+y),j=!0}return _}return Y=G(Y,"env","endenv",!1),Y=G(Y,"production","endproduction",J==="production"),Y=G(Y,"development","enddevelopment",J==="development"),Y=G(Y,"staging","endstaging",J==="staging"),Y=G(Y,"testing","endtesting",J==="testing"),Y}var dX=D(()=>{yZ();F1();uX();F0()});function mZ(X=16){let $=new Uint8Array(X);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function mX(X,$){if(!X)return $?.nonceGenerator?.()??mZ();let Z=dZ.get(X);if(!Z)Z=$?.nonceGenerator?.()??mZ(),dZ.set(X,Z);return Z}function Hz(X,$){let Z=[];for(let[Y,J]of Object.entries(X)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Z.push(Y);continue}if(Array.isArray(J)){let G=[...J];if($&&(Y==="script-src"||Y==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${$}'`);if(G.length>0)Z.push(`${Y} ${G.join(" ")}`)}}return Z.join("; ")}function lZ(X,$){return`<meta http-equiv="Content-Security-Policy" content="${Hz(X,$).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function cZ(X,$,Z){if(!$.enabled||!$.addMetaTag)return X;if(X.includes('http-equiv="Content-Security-Policy"'))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let Y=$.useNonce?mX(Z,$):void 0,J=lZ($.directives,Y);return X.replace(/<head([^>]*)>/,`<head$1>
3355
- ${J}`)}function pZ(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<script nonce="${$}"${J}>`}),Z=Z.replace(/<style([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<style nonce="${$}"${J}>`}),Z}function iZ(X,$,Z,Y){let J=X,G=Y.csp;if(J=J.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?mX($,G):void 0;return lZ(G.directives,Q)}),J=J.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return mX($,G)}),G?.enabled&&G.useNonce)$.cspNonce=mX($,G);return J}var dZ;var nZ=D(()=>{dZ=new WeakMap});import Lz from"crypto";function Fz(X=Oz){let $=Lz.randomBytes(Math.ceil(X/2)).toString("hex").slice(0,X);return V9=$,$}function Vz(){if(!V9)Fz();return V9}function Az(X=rZ){let $=Vz();return`<input type="hidden" name="${X}" value="${$}">`}function sZ(X){return X.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,Z,Y)=>{return Az(Y||rZ)})}var Oz=40,rZ="_token",V9=null;var oZ=()=>{};async function aZ(X,$,Z,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return X;let J=X;for(let G of Y.customDirectives){if(!G.name||typeof G.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)J=await Rz(J,G,$,Z,Y);else J=await Tz(J,G,$,Z,Y)}return J}async function Rz(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=`@${G}`,q=`@end${G}`,W=X,K=S5(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],z=K.exec(W);while(z!==null){let[B,_="",j=""]=z,H=z.index||0;try{let O=_?tZ(_):[],L=j.trim(),F=await Q(L,O,Z,Y);U.push({original:B,processed:F,startIndex:H})}catch(O){let L=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${G}:`,O);U.push({original:B,processed:$0("CustomDirective",`Error in @${G}${_?`(${_})`:""}: ${L}`,o.EVALUATION_ERROR),startIndex:H})}z=K.exec(W)}for(let B=U.length-1;B>=0;B--){let{original:_,processed:j}=U[B];W=W.replace(_,j)}return W}async function Tz(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=X,q=S5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],K=q.exec(w);while(K!==null){let[B,_=""]=K,j=K.index||0;try{let H=tZ(_),O=await Q("",H,Z,Y);W.push({original:B,processed:O,startIndex:j})}catch(H){let O=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${G}:`,H);W.push({original:B,processed:$0("CustomDirective",`Error in @${G}(${_}): ${O}`,o.EVALUATION_ERROR),startIndex:j})}K=q.exec(w)}let U=S5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),z=U.exec(w);while(z!==null){let[B]=z,_=z.index||0;try{let j=await Q("",[],Z,Y);W.push({original:B,processed:j,startIndex:_})}catch(j){let H=j instanceof Error?j.message:String(j);if(J.debug)console.error(`Error processing custom directive @${G}:`,j);W.push({original:B,processed:$0("CustomDirective",`Error in @${G}: ${H}`,o.EVALUATION_ERROR),startIndex:_})}z=U.exec(w)}for(let B=W.length-1;B>=0;B--){let{original:_,processed:j}=W[B];w=w.replace(_,j)}return w}function tZ(X){if(!X.trim())return[];let $=[],Z="",Y=!1,J="";for(let G=0;G<X.length;G++){let Q=X[G];if((Q==='"'||Q==="'")&&(G===0||X[G-1]!=="\\"))if(!Y)Y=!0,J=Q;else if(Q===J)Y=!1;else Z+=Q;else if(Q===","&&!Y)$.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())$.push(Z.trim());return $.map((G)=>{let Q=G.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var eZ=D(()=>{F1();C5()});function Q5(X,$){if(typeof X!=="string"||X.length===0)throw Error(`@appearanceBootstrap ${$} must be a non-empty string`)}function Nz(X){if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap expects an options object");let $=X,Z=$.appearance,Y=$.colorMode;if(Q5($.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(Q5(Z.key,"appearance.key"),Q5(Z.attribute,"appearance.attribute"),Q5(Z.default,"appearance.default"),Q5(Y.key,"colorMode.key"),Q5(Y.attribute,"colorMode.attribute"),Q5(Y.default,"colorMode.default"),!$Y.test(Z.key)||!$Y.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!XY.test(Z.attribute)||!XY.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Z.allowed.includes(Z.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!Mz.has(Y.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:$.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:Y.key,attribute:Y.attribute,default:Y.default}}}function kz(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function Iz(X){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${kz(X)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function Ez(X,$){let Z=1,Y=null,J=!1;for(let G=$+1;G<X.length;G++){let Q=X[G];if(J){J=!1;continue}if(Y){if(Q==="\\")J=!0;else if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function ZY(X,$){let Z=X,Y=/@appearanceBootstrap\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,Q=Ez(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=Z.slice(G+1,Q).trim(),q=Y0(`(${w})`,$),W=Iz(Nz(q));Z=Z.slice(0,J.index)+W+Z.slice(Q+1),Y.lastIndex=J.index+W.length}return Z}var XY,$Y,Mz;var YY=D(()=>{F0();XY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,$Y=/^[A-Za-z_$][\w$]*$/,Mz=new Set(["light","dark","system"])});var T9={};t(T9,{useTitle:()=>Cz,useSeoMeta:()=>JY,usePageTitle:()=>Cz,useHead:()=>R9,seoMetaToHeadConfig:()=>cX,resetHead:()=>bz,renderHtmlAttrs:()=>vz,renderHead:()=>Pz,renderBodyAttrs:()=>xz,processTitleDirective:()=>hz,processMetaDirective:()=>uz,processHeadDirective:()=>gz,mergeHeadConfigs:()=>x5,getPageMeta:()=>yz,getHead:()=>A9,definePageMeta:()=>Sz,applyHead:()=>fz});function A9(){return v1}function yz(){return lX}function bz(){v1={},Dz.length=0,lX={}}function R9(X){v1=x5(v1,X)}function x5(X,$){return{title:$.title??X.title,titleTemplate:$.titleTemplate??X.titleTemplate,base:$.base??X.base,meta:[...X.meta||[],...$.meta||[]],link:[...X.link||[],...$.link||[]],script:[...X.script||[],...$.script||[]],style:[...X.style||[],...$.style||[]],htmlAttrs:{...X.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...X.bodyAttrs,...$.bodyAttrs}}}function JY(X){R9(cX(X))}function cX(X){let $=[];if(X.description)$.push({name:"description",content:X.description});if(X.keywords){let q=Array.isArray(X.keywords)?X.keywords.join(", "):X.keywords;$.push({name:"keywords",content:q})}if(X.author)$.push({name:"author",content:X.author});if(X.robots)$.push({name:"robots",content:X.robots});let Z=X.ogTitle??X.title,Y=X.ogDescription??X.description;if(Z)$.push({property:"og:title",content:Z});if(Y)$.push({property:"og:description",content:Y});if(X.ogImage)$.push({property:"og:image",content:X.ogImage});if(X.ogUrl)$.push({property:"og:url",content:X.ogUrl});if(X.ogType)$.push({property:"og:type",content:X.ogType});if(X.ogSiteName)$.push({property:"og:site_name",content:X.ogSiteName});if(X.ogLocale)$.push({property:"og:locale",content:X.ogLocale});let J=X.twitterTitle??X.title,G=X.twitterDescription??X.description,Q=X.twitterImage??X.ogImage;if(X.twitterCard)$.push({name:"twitter:card",content:X.twitterCard});if(J)$.push({name:"twitter:title",content:J});if(G)$.push({name:"twitter:description",content:G});if(Q)$.push({name:"twitter:image",content:Q});if(X.twitterSite)$.push({name:"twitter:site",content:X.twitterSite});if(X.twitterCreator)$.push({name:"twitter:creator",content:X.twitterCreator});if(X.articleAuthor)$.push({property:"article:author",content:X.articleAuthor});if(X.articlePublishedTime)$.push({property:"article:published_time",content:X.articlePublishedTime});if(X.articleModifiedTime)$.push({property:"article:modified_time",content:X.articleModifiedTime});if(X.articleSection)$.push({property:"article:section",content:X.articleSection});if(X.articleTags)for(let q of X.articleTags)$.push({property:"article:tag",content:q});let w=[];if(X.canonical)w.push({rel:"canonical",href:X.canonical});return{title:X.title,titleTemplate:X.titleTemplate,meta:$,link:w}}function Sz(X){if(lX={...lX,...X},X.title||X.description)JY({title:X.title,description:X.description})}function Cz(X){let $=typeof X==="function"?X():X;R9({title:$})}function Pz(X=v1){let $=[];if(X.title){let Z=X.title;if(X.titleTemplate)Z=typeof X.titleTemplate==="function"?X.titleTemplate(Z):X.titleTemplate.replace("%s",Z);$.push(`<title>${w5(Z)}</title>`)}if(X.base){let Z=Object.entries(X.base).map(([Y,J])=>`${Y}="${w5(J)}"`).join(" ");$.push(`<base ${Z}>`)}for(let Z of X.meta||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>{return`${J==="httpEquiv"?"http-equiv":J}="${w5(String(G))}"`}).join(" ");$.push(`<meta ${Y}>`)}for(let Z of X.link||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>`${J}="${w5(String(G))}"`).join(" ");$.push(`<link ${Y}>`)}for(let Z of X.script||[]){let{content:Y,...J}=Z,G=Object.entries(J).filter(([Q,w])=>w!==void 0).map(([Q,w])=>{if(typeof w==="boolean")return w?Q:"";return`${Q}="${w5(String(w))}"`}).filter(Boolean).join(" ");if(Y)$.push(`<script ${G}>${Y}</script>`);else $.push(`<script ${G}></script>`)}for(let Z of X.style||[]){let Y=Z.type?` type="${Z.type}"`:"";$.push(`<style${Y}>${Z.content}</style>`)}return $.join(`
3356
- `)}function vz(X=v1){if(!X.htmlAttrs)return"";return Object.entries(X.htmlAttrs).map(([$,Z])=>`${$}="${w5(Z)}"`).join(" ")}function xz(X=v1){if(!X.bodyAttrs)return"";return Object.entries(X.bodyAttrs).map(([$,Z])=>`${$}="${w5(Z)}"`).join(" ")}function w5(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function fz(X=v1){if(typeof document>"u")return;if(X.title){let $=X.title;if(X.titleTemplate)$=typeof X.titleTemplate==="function"?X.titleTemplate($):X.titleTemplate.replace("%s",$);document.title=$}for(let $ of X.meta||[]){let Z=$.name?`meta[name="${$.name}"]`:$.property?`meta[property="${$.property}"]`:null;if(Z){let Y=document.querySelector(Z);if(!Y){if(Y=document.createElement("meta"),$.name)Y.setAttribute("name",$.name);if($.property)Y.setAttribute("property",$.property);document.head.appendChild(Y)}Y.setAttribute("content",$.content)}}for(let $ of X.link||[]){let Z=`link[rel="${$.rel}"]${$.href?`[href="${$.href}"]`:""}`,Y=document.querySelector(Z);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[J,G]of Object.entries($))if(G!==void 0)Y.setAttribute(J,String(G))}if(X.htmlAttrs)for(let[$,Z]of Object.entries(X.htmlAttrs))if($==="class")for(let Y of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add(Y);else document.documentElement.setAttribute($,Z);if(X.bodyAttrs)for(let[$,Z]of Object.entries(X.bodyAttrs))document.body.setAttribute($,Z)}function gz(X){let $="";return{content:X.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,J)=>{return $+=J.trim()+`
3357
- `,""}),headContent:$.trim()}}function hz(X,$){return X.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,Y,J,G)=>{let Q=Y?J:$[(G||"").trim()]??G,w=$.__stx_runtime_head??{};return $.__stx_runtime_head=x5(w,{title:Q}),""})}function uz(X,$){return X.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,Y,J,G,Q,w)=>{let q=G?Q:w,W=G?q:$[(q||"").trim()]??q,U=J.includes(":")?{property:J,content:W}:{name:J,content:W},z=$.__stx_runtime_head??{};return $.__stx_runtime_head=x5(z,{meta:[U]}),""})}var v1,Dz,lX;var x7=D(()=>{v1={},Dz=[],lX={}});import dz from"crypto";function H0(X){return String(X??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function pX(X,$,Z,Y){let J=X||$;return Z?`${J} ${Y}`:J}function i0(X){return String(X).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function f5(X,$){if(/\bid\s*=/i.test(X))return"";return` id="${H0($)}"`}function M9(X,$,Z){if(!$)return"";let Y="";if(!/\baria-invalid\s*=/i.test(Z))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))Y+=` aria-describedby="${H0(`${i0(X)}-error`)}"`;return Y}function mz(){return dz.randomUUID()}function iX(X,$){let Z=X;return Z=Z.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let Y=mz();$.csrf={token:Y}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${H0($.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,J)=>{let G=J.toUpperCase();if(J&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${H0(G)}">`;return Y}),Z}function wY(X,$,Z=QY){let Y=X;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,G,Q,w,q,W="")=>{let K=G||Q||"POST",U=w||q||"",z=x1(W),B=K.toUpperCase(),_=["GET","POST"].includes(B)?B:"POST",j=`<form method="${H0(_)}" action="${H0(U)}"${z?` ${z}`:""}>`;if(j+=`
3358
- ${iX("@csrf",$)}`,!["GET","POST"].includes(B))j+=`
3359
- ${iX(`@method('${B}')`,$)}`;return j}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,w,q,W="")=>{let K=G||Q||"",U=w||q||"",z=x1(W),B=f7(K,$),_=B!==void 0&&B!==null?B:U||"",j=z.match(/type=['"]([^'"]+)['"]/i),H=j?j[1]:"text",O=g7(K,$),L=z.match(/class=['"]([^'"]+)['"]/i),F=pX(L?L[1]:"",Z.input,O,Z.inputError),V=z.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${H0(H)}" name="${H0(K)}"${f5(z,i0(K))} value="${H0(_)}" class="${F}"${M9(K,O,z)}${V?` ${V}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,G,Q="",w="")=>{let q=x1(Q),W=f7(G,$)||w.trim(),K=g7(G,$),U=q.match(/class=['"]([^'"]+)['"]/i),z=pX(U?U[1]:"",Z.input,K,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${H0(G)}"${f5(q,i0(G))} class="${z}"${M9(G,K,q)}${B?` ${B}`:""}>${H0(W)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,G,Q="",w)=>{let q=x1(Q),W=f7(G,$),K=g7(G,$),U=q.match(/class=['"]([^'"]+)['"]/i),z=pX(U?U[1]:"",Z.input,K,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,""),_=w;if(W!==void 0)_=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(j,H,O)=>{if((Array.isArray(W)?W.some((F)=>String(F)===O):String(W)===O)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return j});return`<select name="${H0(G)}"${f5(q,i0(G))} class="${z}"${M9(G,K,q)}${B?` ${B}`:""}>${_}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=Q===void 0?"1":Q,W=Q===void 0?i0(G):`${i0(G)}-${i0(q)}`,K=x1(w),U=f7(G,$),z=U!==void 0&&(Array.isArray(U)?U.some((H)=>String(H)===q):U===!0||String(U)===q),B=K.match(/class=['"]([^'"]+)['"]/i),_=B?B[1]:Z.checkInput,j=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${H0(G)}"${f5(K,W)} value="${H0(q)}" class="${_}"${z?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=x1(w),W=f7(G,$),K=W!==void 0&&W===Q,U=q.match(/class=['"]([^'"]+)['"]/i),z=U?U[1]:Z.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${H0(G)}"${f5(q,`${i0(G)}-${i0(Q)}`)} value="${H0(Q)}" class="${z}"${K?" checked":""}${B?` ${B}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q="")=>{let w=x1(Q),q=w.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",K=w.includes("multiple"),U=g7(G,$),z=w.match(/class=['"]([^'"]+)['"]/i),B=pX(z?z[1]:"",Z.input,U,Z.inputError),_=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),j=[`<input type="file" name="${H0(G)}"${f5(w,i0(G))}`,`class="${B}"`];if(W)j.push(`accept="${H0(W)}"`);if(K)j.push("multiple");if(_)j.push(_);return`${j.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,G,Q="",w)=>{let q=x1(Q),W=q.match(/class=['"]([^'"]+)['"]/i),K=W?W[1]:Z.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${H0(i0(G))}" class="${K}"${U?` ${U}`:""}>${w}</label>`}),Y}function qY(X,$,Z=QY){return X.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,J,G)=>{try{if(g7(J,$)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(w,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return GY(J,$);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(J);return GY(J,$)}let W=q.trim();if(q0(W)){let K=Y0(W,$);return K!==void 0?String(K):W}return W}catch{return q}});return`<div id="${H0(`${i0(J)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),Y}})}function g7(X,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(X);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,X);return!1}function GY(X,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(X);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,X)){let Z=$.errors[X];return Array.isArray(Z)?Z[0]:String(Z)}return""}function f7(X,$){let Z;if($.old&&typeof $.old==="function")return $.old(X);if($.old&&typeof $.old==="object")return $.old[X];if(X.endsWith("[]")){let Y=X.slice(0,-2);if(Z=$[Y],Z!==void 0)return Z}return $[X]}function x1(X){if(!X.trim())return"";let $=[],Z=X.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=Y.exec(Z))!==null){let[,G,,Q]=J;$.push(`${G}="${Q.trim()}"`)}return $.join(" ")}var QY;var WY=D(()=>{F0();QY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import I9 from"path";async function lz(){if(h7!==void 0)return h7;try{h7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{h7=null}return h7}function cz(X,$=0){if($<=0)return!1;return Date.now()-X.loadedAt>$}async function pz(X,$){if({...y9,...$.i18n}.cache&&E9[X]){let J=E9[X],G=$.i18n?.cacheMaxAge??0;if(!cz(J,G))return J.translations}if(u7[X]?.state==="loading")return u7[X].promise;N9[X]="loading";let Y=D9(X,$).then((J)=>{return N9[X]="loaded",delete u7[X],J}).catch((J)=>{throw N9[X]="error",u7[X]={promise:Y,state:"error",error:J instanceof Error?J:Error(String(J))},J});return u7[X]={promise:Y,state:"loading"},Y}async function D9(X,$){let Z={...y9,...$.i18n},Y=I9.isAbsolute(Z.translationsDir)?Z.translationsDir:I9.resolve($.root||process.cwd(),Z.translationsDir);try{let J=await lz(),G=J?await J(X,{translationsDir:Y,defaultLocale:Z.defaultLocale,sources:oz(Z.format)}):await iz(X,Z,Y);if(G===void 0){if(X!==Z.defaultLocale)return D9(Z.defaultLocale,$);return{}}let Q=G;if(Z.cache)E9[X]={translations:Q,loadedAt:Date.now(),locale:X};return Q}catch(J){if($.debug)console.error(`Error loading translation file for locale "${X}":`,J);if(X!==Z.defaultLocale)return D9(Z.defaultLocale,$);return{}}}async function iz(X,$,Z){let Y=I9.join(Z,`${X}${nz($.format)}`);try{let J=await import(Y);return J.default||J}catch(J){try{let G=await Bun.file(Y).text();if($.format==="yaml"||$.format==="yml")return rz(G);if($.format==="json")return JSON.parse(G);throw J}catch{return}}}function nz(X){switch(X){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function rz(X){let $={},Z=X.split(`
3360
- `),Y=[{obj:$,indent:-1}];for(let J of Z){let G=J.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let w=Y[Y.length-1].obj,q=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,K]=q,U=W.trim(),z=K.trim();if(z==="")w[U]={},Y.push({obj:w[U],indent:Q});else w[U]=sz(z)}}return $}function sz(X){if(X.startsWith("'")&&X.endsWith("'")||X.startsWith('"')&&X.endsWith('"'))return X.slice(1,-1);let $=X.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let Z=Number(X);if(!Number.isNaN(Z)&&X!=="")return Z;return X}function oz(X){switch(X){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function az(X,$){return pz(X,$)}function tz(X,$){for(let Z of X){let Y=Z.trim(),J=Y.match(/^\{(\d+)\}\s*(.*)$/);if(J){let Q=Number.parseInt(J[1],10);if($===Q)return J[2];continue}let G=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10),w=G[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(G[2],10);if($>=Q&&$<=w)return G[3];continue}}if(X.length===2)return $===1?X[0].trim():X[1].trim();if($<X.length)return X[$].trim();return X[X.length-1].trim()}function ez(X,$={}){return zY(X,$)}function zY(X,$){let Z="",Y=0;while(Y<X.length)if(X[Y]==="{"){let J=X_(X,Y);if(J===-1){Z+=X[Y],Y++;continue}let G=X.slice(Y+1,J);Z+=$_(G,$),Y=J+1}else if(X[Y]==="'"&&Y+1<X.length)if(X[Y+1]==="'")Z+="'",Y+=2;else if(X[Y+1]==="{"||X[Y+1]==="}")Z+=X[Y+1],Y+=2;else Z+=X[Y],Y++;else Z+=X[Y],Y++;return Z}function X_(X,$){let Z=0;for(let Y=$;Y<X.length;Y++)if(X[Y]==="{")Z++;else if(X[Y]==="}"){if(Z--,Z===0)return Y}return-1}function $_(X,$){let Z=Z_(X);if(Z.length===0)return`{${X}}`;let Y=Z[0].trim(),J=$[Y];if(Z.length===1)return J!==void 0?String(J):`{${Y}}`;switch(Z[1].trim().toLowerCase()){case"plural":return Y_(J,Z.slice(2).join(","),$);case"select":return G_(J,Z.slice(2).join(","));case"selectordinal":return Q_(J,Z.slice(2).join(","));case"number":return q_(J,Z[2]?.trim());case"date":return W_(J,Z[2]?.trim());case"time":return K_(J,Z[2]?.trim());default:return J!==void 0?String(J):`{${X}}`}}function Z_(X){let $=[],Z="",Y=0;for(let J=0;J<X.length;J++){let G=X[J];if(G==="{")Y++,Z+=G;else if(G==="}")Y--,Z+=G;else if(G===","&&Y===0)$.push(Z),Z="";else Z+=G}if(Z)$.push(Z);return $}function Y_(X,$,Z){let Y=Number(X)||0,J=b9($),G=`=${Y}`;if(J[G])return k9(J[G],Y,Z);let Q=J_(Y);if(J[Q])return k9(J[Q],Y,Z);if(J.other)return k9(J.other,Y,Z);return String(Y)}function k9(X,$,Z){let Y=X.replace(/#/g,String($));return zY(Y,Z)}function J_(X){let $=Math.abs(X),Z=Math.floor($),Y=String(X).includes(".")?String(X).split(".")[1].length:0;if(Z===1&&Y===0)return"one";return"other"}function G_(X,$){let Z=String(X||""),Y=b9($);if(Y[Z])return Y[Z];return Y.other||String(X)}function Q_(X,$){let Z=Number(X)||0,Y=b9($),J=w_(Z);if(Y[J])return Y[J].replace(/#/g,String(Z));if(Y.other)return Y.other.replace(/#/g,String(Z));return String(Z)}function w_(X){let $=Math.abs(X),Z=$%10,Y=$%100;if(Z===1&&Y!==11)return"one";if(Z===2&&Y!==12)return"two";if(Z===3&&Y!==13)return"few";return"other"}function b9(X){let $={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=Z.exec(X);while(Y!==null)$[Y[1]]=Y[2],Y=Z.exec(X);return $}function q_(X,$){let Z=Number(X);if(Number.isNaN(Z))return String(X);switch($){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function W_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return Z.toLocaleDateString(void 0,Y)}function K_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return Z.toLocaleTimeString(void 0,Y)}function U_(X){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(X)}function KY(X,$,Z=!0,Y={}){let J=X.split("."),G=$;for(let w of J){if(G===void 0||G===null)break;G=G[w]}if(G===void 0||G===null)return Z?X:"";let Q=String(G);if(U_(Q))return ez(Q,Y);if(Q.includes("|")&&"count"in Y){let w=Number(Y.count),q=Q.split("|");Q=tz(q,w)}for(let[w,q]of Object.entries(Y)){let W=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${W}`,"g"),String(q))}return Q}async function _Y(X,$,Z,Y){let J=X,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...y9,...Y.i18n},w=await az(Q.locale,Y);$.__translations=w,$.__locale=Q.locale,$.__i18nConfig=Q,J=await UY(J,G,async(K,U,z,B,_)=>{try{let j={};if(z)try{let O=[()=>JSON.parse(z),()=>{let L=`{"data":${z}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return O0(z,$)}];for(let L of O)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(O){if(Y.debug)console.error("Error parsing parameters for @translate directive:",O)}return KY(U,w,Q.fallbackToKey,j)||B.trim()}catch(j){if(Y.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${U}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let K=[...J.matchAll(q)];console.warn(`Found ${K.length} @translate matches`),K.forEach((U,z)=>console.warn(`Match ${z}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return J=await UY(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(K,U,z,B)=>{try{let _={};if(z)try{let j=[()=>JSON.parse(z),()=>{let H=`{"data":${z}}`,O=JSON.parse(H);return typeof O.data==="object"?O.data:{}},()=>{return O0(z,$)}];for(let H of j)try{if(_=H(),Object.keys(_).length>0)break}catch{}}catch(j){if(Y.debug)console.error("Error parsing parameters for @translate directive:",j)}return KY(U,w,Q.fallbackToKey,_)}catch(_){if(Y.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${U}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}}),J}async function UY(X,$,Z){let Y=[];return X.replace($,(G,...Q)=>{let w=Z(G,...Q).then((q)=>({match:G,replacement:q}));return Y.push(w),G}),(await Promise.all(Y)).reduce((G,{match:Q,replacement:w})=>G.replace(Q,w),X)}var h7,y9,E9,u7,N9;var BY=D(()=>{F1();F0();y9={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},E9={},u7={},N9={}});function __(X){let $=X.replace(/^<template\b/i,"").replace(/>$/,"");return z_.test($)}function g5(X){d7.lastIndex=0;let $;while(($=d7.exec(X))!==null){if($[0].startsWith("</")||__($[0]))continue;let Z=$.index,Y=d7.lastIndex,J=1,G;while((G=d7.exec(X))!==null)if(G[0].startsWith("</")){if(J--,J===0){let Q=G.index;return{start:Z,openEnd:Y,closeStart:Q,end:d7.lastIndex,content:X.slice(Y,Q)}}}else J++;return null}return null}var d7,z_;var nX=D(()=>{d7=/<\/?template\b[^>]*>/gi,z_=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var P9={};t(P9,{streamingSuspenseDirective:()=>LY,streamToResponse:()=>N_,streamTemplateSimple:()=>A_,streamTemplate:()=>j_,renderStreamingPage:()=>L_,registerStreamingDirectives:()=>T_,processStreamDirectives:()=>F_,processSectionDirectives:()=>M_,islandDirective:()=>OY,generateHydrationRuntime:()=>k_,extractStreamBoundaries:()=>V_,createStreamRenderer:()=>R_,buildSuspenseResolveScript:()=>C9,SUSPENSE_RESOLVER_RUNTIME:()=>HY});import rX from"path";function B_(X){let $=[],Z=0,Y;jY.lastIndex=0;while((Y=jY.exec(X))!==null){if(Y.index>Z){let Q=X.slice(Z,Y.index);if(Q.trim())$.push({type:$.length===0?"shell":"content",content:Q})}let J=Y[1],G=Y[2];$.push({type:"suspense",name:J,content:G}),Z=Y.index+Y[0].length}if(Z<X.length){let J=X.slice(Z);if(J.trim())$.push({type:$.length===0?"shell":"content",content:J})}if($.length===0)$.push({type:"shell",content:X});return $}async function j_(X,$={},Z={}){let Y={...A1,...Z,streaming:{...S9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K={...$,__filename:X,__dirname:rX.dirname(X)};if(q.trim())await V1(q,K,X);let U=B_(W),z=new Set;if(!U.some((_)=>_.type==="suspense")){let _=Y.streaming?.strategy||"auto",j=new RegExp(q5.source,"g");if(!(_!=="manual"&&j.test(W))){let O=await V0(W,K,X,Y,z);for(let L=0;L<O.length;L+=J)G.enqueue(O.slice(L,L+J)),await new Promise((F)=>setTimeout(F,0))}else{let O=[],L=new RegExp(q5.source,"g"),F;while((F=L.exec(W))!==null)O.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of O){if(A.start>V){let T=W.slice(V,A.start);if(T.trim()){let M=await V0(T,K,X,Y,z);G.enqueue(M),await new Promise((k)=>setTimeout(k,0))}}let R=await V0(A.content,K,X,Y,z);G.enqueue(R),await new Promise((T)=>setTimeout(T,0)),V=A.end}if(V<W.length){let A=W.slice(V);if(A.trim()){let R=await V0(A,K,X,Y,z);G.enqueue(R)}}}}else{let _=new Map;for(let H of U)if(H.type==="shell"||H.type==="content"){let O=await V0(H.content,K,X,Y,z);G.enqueue(O)}else if(H.type==="suspense"&&H.name){let O=`stx-suspense-${H.name}`;G.enqueue(`<div id="${O}" data-suspense="${H.name}" style="display:contents;">
3352
+ `),"utf-8")}}async flush(){await this.writeQueue}}var _9,X1,j9;var dZ=D(()=>{hX();_9={isEnabled(){return vX().enableAutoRecovery},fixCommonSyntaxErrors(X){let $=vX();if(!$.enableAutoRecovery)return{fixed:X,fixes:[]};let Z=X,Y=[],J=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(J>G){let w=J-G;Z+="}}".repeat(w),Y.push(`Added ${w} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let w of Q){let q=(Z.match(new RegExp(`@${w}\\b`,"g"))||[]).length,W=(Z.match(new RegExp(`@end${w}\\b`,"g"))||[]).length;if(q>W){let U=q-W;for(let K=0;K<U;K++)Z+=`
3353
+ @end${w}`;Y.push(`Added ${U} missing @end${w}`)}}if(Y.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((w)=>console.warn(` - ${w}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:Y}},createFallbackContent(X,$){if(x7())return`<!-- ${X} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};X1=new B9,j9={isDevelopment(){return x7()},logDetailedError(X,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",X.message),console.error("Stack:",X.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(X,$){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${X.message}`,`Type: ${X.constructor.name}`,`Stack: ${X.stack}`];if($)Z.push(`Context: ${JSON.stringify($,null,2)}`);return Z.push("========================"),Z.join(`
3354
+ `)}}});var mZ=()=>{};var lZ=D(()=>{CX();uZ();dZ();mZ();hX()});var O1=D(()=>{lZ()});function N0(X,$,Z,Y=0){let J=0,G=Y,Q=null,w=0,q=!1;while(G<X.length){let W=X[G];if(Q&&q){q=!1,G++;continue}if(Q&&W==="\\"){q=!0,G++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!Q){Q=W,G++;continue}if(W===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&W==="$"&&X[G+1]==="{"){w++,G+=2;continue}if(w>0&&W==="}"){w--,G++;continue}if(W==="`"&&Q==="`"&&w===0){Q=null,G++;continue}if(Q){G++;continue}if(W===$)J++;else if(W===Z){if(J--,J===0)return G}G++}return-1}function P1(X,$){let Z=Oz(X,$);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function Oz(X,$){let Z=$;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let Y=N0(X,"(",")",Z);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:X.slice(Z+1,Y),endPos:Y+1}}function Fz(X,$){let Z=X.lastIndexOf("<",$);if(Z===-1)return!1;return Z>X.lastIndexOf(">",$)}function J5(X,$,Z,Y){let J=1,G=Y,Q=new RegExp(`@${$}\\s*\\(`,"g"),w=new RegExp(`@${Z}(?![a-z])`,"g");while(G<X.length&&J>0){Q.lastIndex=G,w.lastIndex=G;let q=Q.exec(X),W=w.exec(X),U=q?q.index:1/0,K=W?W.index:1/0;if(U<K)J++,G=U+q[0].length;else if(K<1/0){if(J--,J===0)return K;G=K+W[0].length}else break}return-1}function cZ(X,$){let Z=X.slice($).match(/^@if\s*/);if(!Z)return null;let Y=$+Z[0].length,J=P1(X,Y);if(!J)return null;let G=J.endPos,Q=J5(X,"if","endif",G);if(Q===-1)return null;let w=X.slice(G,Q),q=[],W=0,U="if",K=J.expression,z=0,B=0;while(W<w.length){let _=w.indexOf("@",W);if(_===-1)break;W=_;let j=w.substring(_);if(Fz(w,_)){W++;continue}if(/^@if\s*\(/.test(j)){B++,W++;continue}if(/^@endif(?![a-z])/.test(j)){B--,W+=6;continue}if(B===0){let H=j.match(/^@elseif\s*/);if(H){q.push({type:U,condition:K,content:w.substring(z,W),start:G+z,end:G+W});let O=W+H[0].length,L=P1(w,O);if(!L){W++;continue}U="elseif",K=L.expression,W=L.endPos,z=W;continue}else if(/^@else(?![a-z])/.test(j)){q.push({type:U,condition:K,content:w.substring(z,W),start:G+z,end:G+W}),U="else",K=void 0,W+=5,z=W;continue}}W++}return q.push({type:U,condition:K,content:w.slice(z),start:G+z,end:G+w.length}),{fullMatch:X.slice($,Q+6),branches:q,start:$,end:Q+6}}function f7(X){let $=[],Z=/@if\s*\(/g,Y=Z.exec(X);while(Y!==null){if($.some((Q)=>Y.index>Q.start&&Y.index<Q.end)){Y=Z.exec(X);continue}let G=cZ(X,Y.index);if(G)$.push(G),Z.lastIndex=G.end;Y=Z.exec(X)}return $}function uX(X,$,Z){let Y=[],J=new RegExp(`@${$}\\s*\\(`,"g"),G=J.exec(X);while(G!==null){if(Y.some((j)=>G.index>j.start&&G.index<j.end)){G=J.exec(X);continue}let w=G.index,q=w+G[0].length-1,W=N0(X,"(",")",q);if(W===-1){G=J.exec(X);continue}let U=X.slice(q+1,W),K=W+1,z=J5(X,$,Z,K);if(z===-1){G=J.exec(X);continue}let B=X.slice(K,z),_=z+`@${Z}`.length;Y.push({fullMatch:X.slice(w,_),name:$,params:U,content:B,start:w,end:_}),J.lastIndex=_,G=J.exec(X)}return Y}function H9(X,$){let Z=X.slice($).match(/^@switch\s*/);if(!Z)return null;let Y=$+Z[0].length,J=P1(X,Y);if(!J)return null;let G=J.endPos,Q=J5(X,"switch","endswitch",G);if(Q===-1)return null;let w=X.slice(G,Q),q=[],W=0,U=null,K=0;while(W<w.length){let z=w.slice(W),B=z.match(/^@switch\s*\(/),_=z.match(/^@endswitch(?![a-z])/);if(B){if(K++,U)U.content+=B[0];W+=B[0].length;continue}if(_){if(K--,U)U.content+=_[0];W+=_[0].length;continue}if(K>0){if(U)U.content+=w[W];W++;continue}let j=z.match(/^@case\s*/),H=z.match(/^@default(?![a-z])/),O=z.match(/^@break(?![a-z])/);if(j&&z.startsWith("@case")){if(U)q.push(U);let L=W+j[0].length,F=P1(w,L);if(!F){W++;continue}U={type:"case",value:F.expression,content:""},W=F.endPos}else if(H&&z.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=H[0].length}else if(O&&z.startsWith("@break"))W+=O[0].length;else{if(U)U.content+=w[W];W++}}if(U)q.push(U);return{fullMatch:X.slice($,Q+10),expression:J.expression,cases:q,start:$,end:Q+10}}var pZ=()=>{};var iZ=()=>{};var dX=D(()=>{pZ();iZ()});function Tz(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=H9(Y,Q);if(!w)break;try{let q;if(q0(w.expression))q=W0(w.expression,Object.keys($))(...Object.values($));else q=Y0(w.expression,$);let W="",U=!1;for(let K of w.cases)if(K.type==="default"){if(!U)W=K.content.trim()}else try{let z;if(K.value&&q0(K.value))z=W0(K.value,Object.keys($))(...Object.values($));else if(K.value)z=Y0(K.value,$);if(q===z){W=K.content.trim(),U=!0;break}}catch{continue}Y=Y.substring(0,Q)+W+Y.substring(w.end),J=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+U+Y.substring(w.end);break}}return Y}function Mz(X){let $=[];return{masked:X.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return $.push(Y),`\x00stx-script-${$.length-1}\x00`}),scripts:$}}function Nz(X,$){if($.length===0)return X;return X.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,Y)=>$[Number(Y)]??Z)}function G5(X,$,Z){let{masked:Y,scripts:J}=Mz(X);return Nz(kz(Y,$,Z),J)}function kz(X,$,Z){let Y=X;Y=Tz(Y,$,Z);{let G=!0;while(G){G=!1;let Q=Y.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=P1(Y,w+7);if(!q)break;let W=q.endPos,U=J5(Y,"unless","endunless",W);if(U===-1){console.warn(`[stx] @unless directive at position ${w} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let K=Y.slice(W,U),z=q.expression,B=-1;{let j=0,H=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,F=[],V;while((V=H.exec(K))!==null)F.push({pos:V.index,type:"open"});while((V=O.exec(K))!==null)F.push({pos:V.index,type:"close"});while((V=L.exec(K))!==null)F.push({pos:V.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")j++;else if(A.type==="close")j--;else if(A.type==="else"&&j===0){B=A.pos;break}}let _;if(B!==-1){let j=K.slice(0,B),H=K.slice(B+5);_=`@if (${z})${H}@else ${j}@endif`}else _=`@if (!(${z}))${K}@endif`;Y=Y.substring(0,w)+_+Y.substring(U+10),G=!0}}Y=O9(Y,$,Z),Y=F9(Y,$,Z),Y=L9(Y,$);let J=()=>{let G=f7(Y);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let w=G[Q];try{let q="",W=!1;for(let U of w.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let K;if(U.condition&&q0(U.condition))K=W0(U.condition,Object.keys($))(...Object.values($));else if(U.condition)K=Y0(U.condition,$);if(K)q=U.content,W=!0}catch(K){q=$0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${K instanceof Error?K.message:String(K)}`,o.EVALUATION_ERROR),W=!0}}Y=Y.substring(0,w.start)+q+Y.substring(w.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,w.start)+U+Y.substring(w.end)}}return!0};while(!0){let G=Y;if(!J())break;if(Y===G)break}return Y}function nZ(X){let $=0;while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!=="(")return null;$++;while($<X.length&&/\s/.test(X[$]))$++;let Z=X[$];if(Z!=="'"&&Z!=='"')return null;$++;let Y=[];while($<X.length){let J=X[$];if(J==="\\"&&$+1<X.length){Y.push(X[$+1]),$+=2;continue}if(J===Z){$++;break}Y.push(J),$++}while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!==")")return null;return $++,{value:Y.join(""),consumed:$}}function L9(X,$){let Z=X;function Y(w,q,W,U){let K=1,z=U,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g");while(z<w.length&&K>0){B.lastIndex=z,_.lastIndex=z;let j=B.exec(w),H=_.exec(w),O=j?j.index:1/0,L=H?H.index:1/0;if(O<L)K++,z=O+j[0].length;else if(L<1/0){if(K--,K===0)return L;z=L+H[0].length}else break}return-1}function J(w,q,W){let U=0,K=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,_=[],j;while((j=K.exec(w))!==null)_.push({pos:j.index,type:"open"});while((j=z.exec(w))!==null)_.push({pos:j.index,type:"close"});while((j=B.exec(w))!==null)_.push({pos:j.index,type:"else"});_.sort((H,O)=>H.pos-O.pos);for(let H of _)if(H.type==="open")U++;else if(H.type==="close")U--;else if(H.type==="else"&&U===0)return H.pos;return-1}{let w=!0;while(w){w=!1;let q=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,K,z=Z.slice(W+5),B=nZ(z);if(B)U=B.value,K=W+5+B.consumed;else K=W+5;let _=Y(Z,"auth","endauth",K);if(_===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let j=Z.slice(K,_),H=J(j,"auth","endauth"),O;if(!$.auth)O=!1;else O=U?C1(`auth?.check && auth?.user?.[${U}]`,$):C1("auth?.check",$);let L;if(H!==-1){let F=j.slice(0,H),V=j.slice(H+5);L=O?F:V}else L=O?j:"";Z=Z.substring(0,W)+L+Z.substring(_+8),w=!0}}{let w=!0;while(w){w=!1;let q=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,K,z=Z.slice(W+6),B=nZ(z);if(B)U=B.value,K=W+6+B.consumed;else K=W+6;let _=Y(Z,"guest","endguest",K);if(_===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let j=Z.slice(K,_),H=J(j,"guest","endguest"),O;if(!$.auth)O=!0;else O=U?C1(`!auth?.check || !auth?.user?.[${U}]`,$):C1("!auth?.check",$);let L;if(H!==-1){let F=j.slice(0,H),V=j.slice(H+5);L=O?F:V}else L=O?j:"";Z=Z.substring(0,W)+L+Z.substring(_+9),w=!0}}function G(w,q,W){if($.userCan&&typeof $.userCan[w]==="boolean")return $.userCan[w];if($.permissions?.check&&typeof $.permissions.check==="function")try{let U=[w];if(q)U.push(q);if(W){let K=C1(W,$);U.push(K)}return $.permissions.check(...U)}catch{return!1}return!1}function Q(w){let q=w.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let w of["can","cannot"]){let q=`end${w}`,W=w==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let K=Z.match(new RegExp(`@${w}\\s*\\(`));if(!K||K.index===void 0)break;let z=K.index,B=Z.slice(z+`@${w}`.length),_=Q(B);if(!_)break;let j=z+`@${w}`.length+_.paramsEnd,H=Y(Z,w,q,j);if(H===-1){console.warn(`[stx] @${w} directive at position ${z} has no matching @${q} \u2014 the block was skipped.`);break}let O=Z.slice(j,H),L=[],F=0,V=new RegExp(`@${w}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),R=new RegExp(`@${W}\\s*\\(`,"g"),T=/@else(?![a-z])/g,M=[],k;while((k=V.exec(O))!==null)M.push({pos:k.index,type:"open"});while((k=A.exec(O))!==null)M.push({pos:k.index,type:"close"});while((k=R.exec(O))!==null)M.push({pos:k.index,type:"elseDirective"});while((k=T.exec(O))!==null)M.push({pos:k.index,type:"else"});M.sort((b,P)=>b.pos-P.pos);for(let b of M){if(b.type==="open"){F++;continue}if(b.type==="close"){F--;continue}if(F===0)L.push(b)}let N=[],y=0;for(let b=0;b<L.length;b++){let P=L[b];if(N.push({content:O.slice(y,P.pos),ability:void 0}),P.type==="elseDirective"){let x=O.slice(P.pos+`@${W}`.length),m=Q(x);if(m){N[N.length-1]={content:O.slice(y,P.pos)},y=P.pos+`@${W}`.length+m.paramsEnd,N.push({content:"",ability:m.ability,type:m.type,id:m.id}),N.pop();let l=L[b+1],Q0=l?l.pos:O.length;N.push({content:O.slice(y,Q0),ability:m.ability,type:m.type,id:m.id}),y=Q0}}else y=P.pos+5}if(y<O.length){let b=N[N.length-1];if(L.length>0&&L[L.length-1].type==="else")N.push({content:O.slice(y),isFinalElse:!0});else if(N.length===0)N.push({content:O.slice(y)})}let I=G(_.ability,_.type,_.id),C=w==="can"?I:!I,S="";if(C)S=N[0]?.content||"";else{let b=!1;for(let P=1;P<N.length;P++){let x=N[P];if(x.isFinalElse){S=x.content,b=!0;break}if(x.ability){let m=G(x.ability,x.type,x.id);if(w==="can"?m:!m){S=x.content,b=!0;break}}}if(!b&&N.length>0){let P=N[N.length-1];if(P.isFinalElse)S=P.content}}Z=Z.substring(0,z)+S+Z.substring(H+`@${q}`.length),U=!0}}return Z}function O9(X,$,Z){let Y=X;function J(G,Q,w,q,W){let U=!0;while(U){U=!1;let K=new RegExp(`@${Q}\\s*\\(`),z=G.match(K);if(!z||z.index===void 0)break;let B=z.index,_=P1(G,B+`@${Q}`.length);if(!_)break;let j=_.endPos,H=J5(G,Q,w,j);if(H===-1){console.warn(`[stx] @${Q} directive at position ${B} has no matching @${w} \u2014 the block was skipped.`);break}let O=G.slice(j,H),L=_.expression,F=-1,V=0,A=0;while(A<O.length){let R=O.indexOf("@",A);if(R===-1)break;let T=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(T)){F=R;break}A=R+1}try{let R=q(L.trim()),T;if(F!==-1){let M=O.slice(0,F),k=O.slice(F+5);T=R?M:k}else T=R?O:"";G=G.substring(0,B)+T+G.substring(H+`@${w}`.length),U=!0}catch(R){let T=R instanceof Error?R.message:String(R),M=$0(W,`Error processing @${Q} directive: ${T}`,o.EVALUATION_ERROR);G=G.substring(0,B)+M+G.substring(H+`@${w}`.length);break}}return G}return Y=J(Y,"isset","endisset",(G)=>{let Q=C1(G,$);return Q!==void 0&&Q!==null},"Isset"),Y=J(Y,"empty","endempty",(G)=>{let Q=C1(G,$);return Q===void 0||Q===null||Q===""||Q===0||Q===!1||Array.isArray(Q)&&Q.length===0||typeof Q==="object"&&Q!==null&&Object.keys(Q).length===0},"Empty"),Y}function F9(X,$,Z){let Y=X,J="development";function G(Q,w,q,W){let U=new RegExp(`@${w}(?![a-z])`,"g"),K=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`^@${w}(?![a-z])`),B=new RegExp(`^@${q}(?![a-z])`),_=Q,j=!0;while(j){j=!1,U.lastIndex=0;let H=U.exec(_);if(!H)break;let O=H.index,L=O+H[0].length;if(w==="env"){let I=_.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;L+=I[0].length,W=J===I[2]}let F=1,V=L,A=-1;while(F>0&&V<_.length){U.lastIndex=V,K.lastIndex=V;let I=U.exec(_),C=K.exec(_),S=I?I.index:1/0,b=C?C.index:1/0;if(S<b)F++,V=S+I[0].length;else if(b<1/0){if(F--,F===0){A=b;break}V=b+C[0].length}else break}if(A===-1){console.warn(`[stx] @${w} directive at position ${O} has no matching @${q} \u2014 the block was skipped.`);break}let R=_.substring(L,A),T=-1,M=0,k=0;while(k<R.length){let I=R.indexOf("@",k);if(I===-1)break;let C=R.substring(I);if(z.test(C)){M++,k=I+1;continue}if(B.test(C)){M--,k=I+1;continue}if(M===0&&/^@else(?![a-z])/.test(C)){T=I;break}k=I+1}let N;if(T!==-1){let I=R.slice(0,T),C=R.slice(T+5);N=W?I:C}else N=W?R:"";let y=`@${q}`.length;_=_.substring(0,O)+N+_.substring(A+y),j=!0}return _}return Y=G(Y,"env","endenv",!1),Y=G(Y,"production","endproduction",J==="production"),Y=G(Y,"development","enddevelopment",J==="development"),Y=G(Y,"staging","endstaging",J==="staging"),Y=G(Y,"testing","endtesting",J==="testing"),Y}var mX=D(()=>{fZ();O1();dX();F0()});function sZ(X=16){let $=new Uint8Array(X);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function lX(X,$){if(!X)return $?.nonceGenerator?.()??sZ();let Z=rZ.get(X);if(!Z)Z=$?.nonceGenerator?.()??sZ(),rZ.set(X,Z);return Z}function Iz(X,$){let Z=[];for(let[Y,J]of Object.entries(X)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Z.push(Y);continue}if(Array.isArray(J)){let G=[...J];if($&&(Y==="script-src"||Y==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${$}'`);if(G.length>0)Z.push(`${Y} ${G.join(" ")}`)}}return Z.join("; ")}function oZ(X,$){return`<meta http-equiv="Content-Security-Policy" content="${Iz(X,$).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function aZ(X,$,Z){if(!$.enabled||!$.addMetaTag)return X;if(X.includes('http-equiv="Content-Security-Policy"'))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let Y=$.useNonce?lX(Z,$):void 0,J=oZ($.directives,Y);return X.replace(/<head([^>]*)>/,`<head$1>
3355
+ ${J}`)}function tZ(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<script nonce="${$}"${J}>`}),Z=Z.replace(/<style([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<style nonce="${$}"${J}>`}),Z}function eZ(X,$,Z,Y){let J=X,G=Y.csp;if(J=J.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?lX($,G):void 0;return oZ(G.directives,Q)}),J=J.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return lX($,G)}),G?.enabled&&G.useNonce)$.cspNonce=lX($,G);return J}var rZ;var XY=D(()=>{rZ=new WeakMap});import Ez from"crypto";function yz(X=Dz){let $=Ez.randomBytes(Math.ceil(X/2)).toString("hex").slice(0,X);return V9=$,$}function bz(){if(!V9)yz();return V9}function Sz(X=$Y){let $=bz();return`<input type="hidden" name="${X}" value="${$}">`}function ZY(X){return X.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,Z,Y)=>{return Sz(Y||$Y)})}var Dz=40,$Y="_token",V9=null;var YY=()=>{};async function JY(X,$,Z,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return X;let J=X;for(let G of Y.customDirectives){if(!G.name||typeof G.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)J=await Cz(J,G,$,Z,Y);else J=await Pz(J,G,$,Z,Y)}return J}async function Cz(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=`@${G}`,q=`@end${G}`,W=X,U=C5(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),K=[],z=U.exec(W);while(z!==null){let[B,_="",j=""]=z,H=z.index||0;try{let O=_?GY(_):[],L=j.trim(),F=await Q(L,O,Z,Y);K.push({original:B,processed:F,startIndex:H})}catch(O){let L=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${G}:`,O);K.push({original:B,processed:$0("CustomDirective",`Error in @${G}${_?`(${_})`:""}: ${L}`,o.EVALUATION_ERROR),startIndex:H})}z=U.exec(W)}for(let B=K.length-1;B>=0;B--){let{original:_,processed:j}=K[B];W=W.replace(_,j)}return W}async function Pz(X,$,Z,Y,J){let{name:G,handler:Q}=$,w=X,q=C5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(w);while(U!==null){let[B,_=""]=U,j=U.index||0;try{let H=GY(_),O=await Q("",H,Z,Y);W.push({original:B,processed:O,startIndex:j})}catch(H){let O=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${G}:`,H);W.push({original:B,processed:$0("CustomDirective",`Error in @${G}(${_}): ${O}`,o.EVALUATION_ERROR),startIndex:j})}U=q.exec(w)}let K=C5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),z=K.exec(w);while(z!==null){let[B]=z,_=z.index||0;try{let j=await Q("",[],Z,Y);W.push({original:B,processed:j,startIndex:_})}catch(j){let H=j instanceof Error?j.message:String(j);if(J.debug)console.error(`Error processing custom directive @${G}:`,j);W.push({original:B,processed:$0("CustomDirective",`Error in @${G}: ${H}`,o.EVALUATION_ERROR),startIndex:_})}z=K.exec(w)}for(let B=W.length-1;B>=0;B--){let{original:_,processed:j}=W[B];w=w.replace(_,j)}return w}function GY(X){if(!X.trim())return[];let $=[],Z="",Y=!1,J="";for(let G=0;G<X.length;G++){let Q=X[G];if((Q==='"'||Q==="'")&&(G===0||X[G-1]!=="\\"))if(!Y)Y=!0,J=Q;else if(Q===J)Y=!1;else Z+=Q;else if(Q===","&&!Y)$.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())$.push(Z.trim());return $.map((G)=>{let Q=G.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var QY=D(()=>{O1();P5()});function Q5(X,$){if(typeof X!=="string"||X.length===0)throw Error(`@appearanceBootstrap ${$} must be a non-empty string`)}function xz(X){if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap expects an options object");let $=X,Z=$.appearance,Y=$.colorMode;if(Q5($.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(Q5(Z.key,"appearance.key"),Q5(Z.attribute,"appearance.attribute"),Q5(Z.default,"appearance.default"),Q5(Y.key,"colorMode.key"),Q5(Y.attribute,"colorMode.attribute"),Q5(Y.default,"colorMode.default"),!qY.test(Z.key)||!qY.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!wY.test(Z.attribute)||!wY.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Z.allowed.includes(Z.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!vz.has(Y.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:$.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:Y.key,attribute:Y.attribute,default:Y.default}}}function fz(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function gz(X){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${fz(X)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function hz(X,$){let Z=1,Y=null,J=!1;for(let G=$+1;G<X.length;G++){let Q=X[G];if(J){J=!1;continue}if(Y){if(Q==="\\")J=!0;else if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function WY(X,$){let Z=X,Y=/@appearanceBootstrap\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,Q=hz(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=Z.slice(G+1,Q).trim(),q=Y0(`(${w})`,$),W=gz(xz(q));Z=Z.slice(0,J.index)+W+Z.slice(Q+1),Y.lastIndex=J.index+W.length}return Z}var wY,qY,vz;var UY=D(()=>{F0();wY=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,qY=/^[A-Za-z_$][\w$]*$/,vz=new Set(["light","dark","system"])});var T9={};t(T9,{useTitle:()=>cz,useSeoMeta:()=>KY,usePageTitle:()=>cz,useHead:()=>R9,seoMetaToHeadConfig:()=>pX,resetHead:()=>mz,renderHtmlAttrs:()=>iz,renderHead:()=>pz,renderBodyAttrs:()=>nz,processTitleDirective:()=>oz,processMetaDirective:()=>az,processHeadDirective:()=>sz,mergeHeadConfigs:()=>f5,getPageMeta:()=>dz,getHead:()=>A9,definePageMeta:()=>lz,applyHead:()=>rz});function A9(){return v1}function dz(){return cX}function mz(){v1={},uz.length=0,cX={}}function R9(X){v1=f5(v1,X)}function f5(X,$){return{title:$.title??X.title,titleTemplate:$.titleTemplate??X.titleTemplate,base:$.base??X.base,meta:[...X.meta||[],...$.meta||[]],link:[...X.link||[],...$.link||[]],script:[...X.script||[],...$.script||[]],style:[...X.style||[],...$.style||[]],htmlAttrs:{...X.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...X.bodyAttrs,...$.bodyAttrs}}}function KY(X){R9(pX(X))}function pX(X){let $=[];if(X.description)$.push({name:"description",content:X.description});if(X.keywords){let q=Array.isArray(X.keywords)?X.keywords.join(", "):X.keywords;$.push({name:"keywords",content:q})}if(X.author)$.push({name:"author",content:X.author});if(X.robots)$.push({name:"robots",content:X.robots});let Z=X.ogTitle??X.title,Y=X.ogDescription??X.description;if(Z)$.push({property:"og:title",content:Z});if(Y)$.push({property:"og:description",content:Y});if(X.ogImage)$.push({property:"og:image",content:X.ogImage});if(X.ogUrl)$.push({property:"og:url",content:X.ogUrl});if(X.ogType)$.push({property:"og:type",content:X.ogType});if(X.ogSiteName)$.push({property:"og:site_name",content:X.ogSiteName});if(X.ogLocale)$.push({property:"og:locale",content:X.ogLocale});let J=X.twitterTitle??X.title,G=X.twitterDescription??X.description,Q=X.twitterImage??X.ogImage;if(X.twitterCard)$.push({name:"twitter:card",content:X.twitterCard});if(J)$.push({name:"twitter:title",content:J});if(G)$.push({name:"twitter:description",content:G});if(Q)$.push({name:"twitter:image",content:Q});if(X.twitterSite)$.push({name:"twitter:site",content:X.twitterSite});if(X.twitterCreator)$.push({name:"twitter:creator",content:X.twitterCreator});if(X.articleAuthor)$.push({property:"article:author",content:X.articleAuthor});if(X.articlePublishedTime)$.push({property:"article:published_time",content:X.articlePublishedTime});if(X.articleModifiedTime)$.push({property:"article:modified_time",content:X.articleModifiedTime});if(X.articleSection)$.push({property:"article:section",content:X.articleSection});if(X.articleTags)for(let q of X.articleTags)$.push({property:"article:tag",content:q});let w=[];if(X.canonical)w.push({rel:"canonical",href:X.canonical});return{title:X.title,titleTemplate:X.titleTemplate,meta:$,link:w}}function lz(X){if(cX={...cX,...X},X.title||X.description)KY({title:X.title,description:X.description})}function cz(X){let $=typeof X==="function"?X():X;R9({title:$})}function pz(X=v1){let $=[];if(X.title){let Z=X.title;if(X.titleTemplate)Z=typeof X.titleTemplate==="function"?X.titleTemplate(Z):X.titleTemplate.replace("%s",Z);$.push(`<title>${w5(Z)}</title>`)}if(X.base){let Z=Object.entries(X.base).map(([Y,J])=>`${Y}="${w5(J)}"`).join(" ");$.push(`<base ${Z}>`)}for(let Z of X.meta||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>{return`${J==="httpEquiv"?"http-equiv":J}="${w5(String(G))}"`}).join(" ");$.push(`<meta ${Y}>`)}for(let Z of X.link||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>`${J}="${w5(String(G))}"`).join(" ");$.push(`<link ${Y}>`)}for(let Z of X.script||[]){let{content:Y,...J}=Z,G=Object.entries(J).filter(([Q,w])=>w!==void 0).map(([Q,w])=>{if(typeof w==="boolean")return w?Q:"";return`${Q}="${w5(String(w))}"`}).filter(Boolean).join(" ");if(Y)$.push(`<script ${G}>${Y}</script>`);else $.push(`<script ${G}></script>`)}for(let Z of X.style||[]){let Y=Z.type?` type="${Z.type}"`:"";$.push(`<style${Y}>${Z.content}</style>`)}return $.join(`
3356
+ `)}function iz(X=v1){if(!X.htmlAttrs)return"";return Object.entries(X.htmlAttrs).map(([$,Z])=>`${$}="${w5(Z)}"`).join(" ")}function nz(X=v1){if(!X.bodyAttrs)return"";return Object.entries(X.bodyAttrs).map(([$,Z])=>`${$}="${w5(Z)}"`).join(" ")}function w5(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function rz(X=v1){if(typeof document>"u")return;if(X.title){let $=X.title;if(X.titleTemplate)$=typeof X.titleTemplate==="function"?X.titleTemplate($):X.titleTemplate.replace("%s",$);document.title=$}for(let $ of X.meta||[]){let Z=$.name?`meta[name="${$.name}"]`:$.property?`meta[property="${$.property}"]`:null;if(Z){let Y=document.querySelector(Z);if(!Y){if(Y=document.createElement("meta"),$.name)Y.setAttribute("name",$.name);if($.property)Y.setAttribute("property",$.property);document.head.appendChild(Y)}Y.setAttribute("content",$.content)}}for(let $ of X.link||[]){let Z=`link[rel="${$.rel}"]${$.href?`[href="${$.href}"]`:""}`,Y=document.querySelector(Z);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[J,G]of Object.entries($))if(G!==void 0)Y.setAttribute(J,String(G))}if(X.htmlAttrs)for(let[$,Z]of Object.entries(X.htmlAttrs))if($==="class")for(let Y of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add(Y);else document.documentElement.setAttribute($,Z);if(X.bodyAttrs)for(let[$,Z]of Object.entries(X.bodyAttrs))document.body.setAttribute($,Z)}function sz(X){let $="";return{content:X.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,J)=>{return $+=J.trim()+`
3357
+ `,""}),headContent:$.trim()}}function oz(X,$){return X.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,Y,J,G)=>{let Q=Y?J:$[(G||"").trim()]??G,w=$.__stx_runtime_head??{};return $.__stx_runtime_head=f5(w,{title:Q}),""})}function az(X,$){return X.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,Y,J,G,Q,w)=>{let q=G?Q:w,W=G?q:$[(q||"").trim()]??q,K=J.includes(":")?{property:J,content:W}:{name:J,content:W},z=$.__stx_runtime_head??{};return $.__stx_runtime_head=f5(z,{meta:[K]}),""})}var v1,uz,cX;var g7=D(()=>{v1={},uz=[],cX={}});import tz from"crypto";function H0(X){return String(X??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function iX(X,$,Z,Y){let J=X||$;return Z?`${J} ${Y}`:J}function p0(X){return String(X).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function g5(X,$){if(/\bid\s*=/i.test(X))return"";return` id="${H0($)}"`}function M9(X,$,Z){if(!$)return"";let Y="";if(!/\baria-invalid\s*=/i.test(Z))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))Y+=` aria-describedby="${H0(`${p0(X)}-error`)}"`;return Y}function ez(){return tz.randomUUID()}function nX(X,$){let Z=X;return Z=Z.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let Y=ez();$.csrf={token:Y}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${H0($.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,J)=>{let G=J.toUpperCase();if(J&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${H0(G)}">`;return Y}),Z}function BY(X,$,Z=_Y){let Y=X;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,G,Q,w,q,W="")=>{let U=G||Q||"POST",K=w||q||"",z=x1(W),B=U.toUpperCase(),_=["GET","POST"].includes(B)?B:"POST",j=`<form method="${H0(_)}" action="${H0(K)}"${z?` ${z}`:""}>`;if(j+=`
3358
+ ${nX("@csrf",$)}`,!["GET","POST"].includes(B))j+=`
3359
+ ${nX(`@method('${B}')`,$)}`;return j}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,w,q,W="")=>{let U=G||Q||"",K=w||q||"",z=x1(W),B=h7(U,$),_=B!==void 0&&B!==null?B:K||"",j=z.match(/type=['"]([^'"]+)['"]/i),H=j?j[1]:"text",O=u7(U,$),L=z.match(/class=['"]([^'"]+)['"]/i),F=iX(L?L[1]:"",Z.input,O,Z.inputError),V=z.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${H0(H)}" name="${H0(U)}"${g5(z,p0(U))} value="${H0(_)}" class="${F}"${M9(U,O,z)}${V?` ${V}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,G,Q="",w="")=>{let q=x1(Q),W=h7(G,$)||w.trim(),U=u7(G,$),K=q.match(/class=['"]([^'"]+)['"]/i),z=iX(K?K[1]:"",Z.input,U,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${H0(G)}"${g5(q,p0(G))} class="${z}"${M9(G,U,q)}${B?` ${B}`:""}>${H0(W)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,G,Q="",w)=>{let q=x1(Q),W=h7(G,$),U=u7(G,$),K=q.match(/class=['"]([^'"]+)['"]/i),z=iX(K?K[1]:"",Z.input,U,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,""),_=w;if(W!==void 0)_=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(j,H,O)=>{if((Array.isArray(W)?W.some((F)=>String(F)===O):String(W)===O)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return j});return`<select name="${H0(G)}"${g5(q,p0(G))} class="${z}"${M9(G,U,q)}${B?` ${B}`:""}>${_}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=Q===void 0?"1":Q,W=Q===void 0?p0(G):`${p0(G)}-${p0(q)}`,U=x1(w),K=h7(G,$),z=K!==void 0&&(Array.isArray(K)?K.some((H)=>String(H)===q):K===!0||String(K)===q),B=U.match(/class=['"]([^'"]+)['"]/i),_=B?B[1]:Z.checkInput,j=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${H0(G)}"${g5(U,W)} value="${H0(q)}" class="${_}"${z?" checked":""}${j?` ${j}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=x1(w),W=h7(G,$),U=W!==void 0&&W===Q,K=q.match(/class=['"]([^'"]+)['"]/i),z=K?K[1]:Z.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${H0(G)}"${g5(q,`${p0(G)}-${p0(Q)}`)} value="${H0(Q)}" class="${z}"${U?" checked":""}${B?` ${B}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q="")=>{let w=x1(Q),q=w.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=w.includes("multiple"),K=u7(G,$),z=w.match(/class=['"]([^'"]+)['"]/i),B=iX(z?z[1]:"",Z.input,K,Z.inputError),_=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),j=[`<input type="file" name="${H0(G)}"${g5(w,p0(G))}`,`class="${B}"`];if(W)j.push(`accept="${H0(W)}"`);if(U)j.push("multiple");if(_)j.push(_);return`${j.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,G,Q="",w)=>{let q=x1(Q),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Z.label,K=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${H0(p0(G))}" class="${U}"${K?` ${K}`:""}>${w}</label>`}),Y}function jY(X,$,Z=_Y){return X.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,J,G)=>{try{if(u7(J,$)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(w,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return zY(J,$);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(J);return zY(J,$)}let W=q.trim();if(q0(W)){let U=Y0(W,$);return U!==void 0?String(U):W}return W}catch{return q}});return`<div id="${H0(`${p0(J)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),Y}})}function u7(X,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(X);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,X);return!1}function zY(X,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(X);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,X)){let Z=$.errors[X];return Array.isArray(Z)?Z[0]:String(Z)}return""}function h7(X,$){let Z;if($.old&&typeof $.old==="function")return $.old(X);if($.old&&typeof $.old==="object")return $.old[X];if(X.endsWith("[]")){let Y=X.slice(0,-2);if(Z=$[Y],Z!==void 0)return Z}return $[X]}function x1(X){if(!X.trim())return"";let $=[],Z=X.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=Y.exec(Z))!==null){let[,G,,Q]=J;$.push(`${G}="${Q.trim()}"`)}return $.join(" ")}var _Y;var HY=D(()=>{F0();_Y={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import I9 from"path";async function X_(){if(d7!==void 0)return d7;try{d7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{d7=null}return d7}function $_(X,$=0){if($<=0)return!1;return Date.now()-X.loadedAt>$}async function Z_(X,$){if({...y9,...$.i18n}.cache&&E9[X]){let J=E9[X],G=$.i18n?.cacheMaxAge??0;if(!$_(J,G))return J.translations}if(m7[X]?.state==="loading")return m7[X].promise;N9[X]="loading";let Y=D9(X,$).then((J)=>{return N9[X]="loaded",delete m7[X],J}).catch((J)=>{throw N9[X]="error",m7[X]={promise:Y,state:"error",error:J instanceof Error?J:Error(String(J))},J});return m7[X]={promise:Y,state:"loading"},Y}async function D9(X,$){let Z={...y9,...$.i18n},Y=I9.isAbsolute(Z.translationsDir)?Z.translationsDir:I9.resolve($.root||process.cwd(),Z.translationsDir);try{let J=await X_(),G=J?await J(X,{translationsDir:Y,defaultLocale:Z.defaultLocale,sources:w_(Z.format)}):await Y_(X,Z,Y);if(G===void 0){if(X!==Z.defaultLocale)return D9(Z.defaultLocale,$);return{}}let Q=G;if(Z.cache)E9[X]={translations:Q,loadedAt:Date.now(),locale:X};return Q}catch(J){if($.debug)console.error(`Error loading translation file for locale "${X}":`,J);if(X!==Z.defaultLocale)return D9(Z.defaultLocale,$);return{}}}async function Y_(X,$,Z){let Y=I9.join(Z,`${X}${J_($.format)}`);try{let J=await import(Y);return J.default||J}catch(J){try{let G=await Bun.file(Y).text();if($.format==="yaml"||$.format==="yml")return G_(G);if($.format==="json")return JSON.parse(G);throw J}catch{return}}}function J_(X){switch(X){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function G_(X){let $={},Z=X.split(`
3360
+ `),Y=[{obj:$,indent:-1}];for(let J of Z){let G=J.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let w=Y[Y.length-1].obj,q=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,K=W.trim(),z=U.trim();if(z==="")w[K]={},Y.push({obj:w[K],indent:Q});else w[K]=Q_(z)}}return $}function Q_(X){if(X.startsWith("'")&&X.endsWith("'")||X.startsWith('"')&&X.endsWith('"'))return X.slice(1,-1);let $=X.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let Z=Number(X);if(!Number.isNaN(Z)&&X!=="")return Z;return X}function w_(X){switch(X){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function q_(X,$){return Z_(X,$)}function W_(X,$){for(let Z of X){let Y=Z.trim(),J=Y.match(/^\{(\d+)\}\s*(.*)$/);if(J){let Q=Number.parseInt(J[1],10);if($===Q)return J[2];continue}let G=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10),w=G[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(G[2],10);if($>=Q&&$<=w)return G[3];continue}}if(X.length===2)return $===1?X[0].trim():X[1].trim();if($<X.length)return X[$].trim();return X[X.length-1].trim()}function U_(X,$={}){return FY(X,$)}function FY(X,$){let Z="",Y=0;while(Y<X.length)if(X[Y]==="{"){let J=K_(X,Y);if(J===-1){Z+=X[Y],Y++;continue}let G=X.slice(Y+1,J);Z+=z_(G,$),Y=J+1}else if(X[Y]==="'"&&Y+1<X.length)if(X[Y+1]==="'")Z+="'",Y+=2;else if(X[Y+1]==="{"||X[Y+1]==="}")Z+=X[Y+1],Y+=2;else Z+=X[Y],Y++;else Z+=X[Y],Y++;return Z}function K_(X,$){let Z=0;for(let Y=$;Y<X.length;Y++)if(X[Y]==="{")Z++;else if(X[Y]==="}"){if(Z--,Z===0)return Y}return-1}function z_(X,$){let Z=__(X);if(Z.length===0)return`{${X}}`;let Y=Z[0].trim(),J=$[Y];if(Z.length===1)return J!==void 0?String(J):`{${Y}}`;switch(Z[1].trim().toLowerCase()){case"plural":return B_(J,Z.slice(2).join(","),$);case"select":return H_(J,Z.slice(2).join(","));case"selectordinal":return L_(J,Z.slice(2).join(","));case"number":return F_(J,Z[2]?.trim());case"date":return V_(J,Z[2]?.trim());case"time":return A_(J,Z[2]?.trim());default:return J!==void 0?String(J):`{${X}}`}}function __(X){let $=[],Z="",Y=0;for(let J=0;J<X.length;J++){let G=X[J];if(G==="{")Y++,Z+=G;else if(G==="}")Y--,Z+=G;else if(G===","&&Y===0)$.push(Z),Z="";else Z+=G}if(Z)$.push(Z);return $}function B_(X,$,Z){let Y=Number(X)||0,J=b9($),G=`=${Y}`;if(J[G])return k9(J[G],Y,Z);let Q=j_(Y);if(J[Q])return k9(J[Q],Y,Z);if(J.other)return k9(J.other,Y,Z);return String(Y)}function k9(X,$,Z){let Y=X.replace(/#/g,String($));return FY(Y,Z)}function j_(X){let $=Math.abs(X),Z=Math.floor($),Y=String(X).includes(".")?String(X).split(".")[1].length:0;if(Z===1&&Y===0)return"one";return"other"}function H_(X,$){let Z=String(X||""),Y=b9($);if(Y[Z])return Y[Z];return Y.other||String(X)}function L_(X,$){let Z=Number(X)||0,Y=b9($),J=O_(Z);if(Y[J])return Y[J].replace(/#/g,String(Z));if(Y.other)return Y.other.replace(/#/g,String(Z));return String(Z)}function O_(X){let $=Math.abs(X),Z=$%10,Y=$%100;if(Z===1&&Y!==11)return"one";if(Z===2&&Y!==12)return"two";if(Z===3&&Y!==13)return"few";return"other"}function b9(X){let $={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=Z.exec(X);while(Y!==null)$[Y[1]]=Y[2],Y=Z.exec(X);return $}function F_(X,$){let Z=Number(X);if(Number.isNaN(Z))return String(X);switch($){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function V_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return Z.toLocaleDateString(void 0,Y)}function A_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return Z.toLocaleTimeString(void 0,Y)}function R_(X){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(X)}function LY(X,$,Z=!0,Y={}){let J=X.split("."),G=$;for(let w of J){if(G===void 0||G===null)break;G=G[w]}if(G===void 0||G===null)return Z?X:"";let Q=String(G);if(R_(Q))return U_(Q,Y);if(Q.includes("|")&&"count"in Y){let w=Number(Y.count),q=Q.split("|");Q=W_(q,w)}for(let[w,q]of Object.entries(Y)){let W=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${W}`,"g"),String(q))}return Q}async function VY(X,$,Z,Y){let J=X,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...y9,...Y.i18n},w=await q_(Q.locale,Y);$.__translations=w,$.__locale=Q.locale,$.__i18nConfig=Q,J=await OY(J,G,async(U,K,z,B,_)=>{try{let j={};if(z)try{let O=[()=>JSON.parse(z),()=>{let L=`{"data":${z}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return O0(z,$)}];for(let L of O)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(O){if(Y.debug)console.error("Error parsing parameters for @translate directive:",O)}return LY(K,w,Q.fallbackToKey,j)||B.trim()}catch(j){if(Y.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${K}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...J.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((K,z)=>console.warn(`Match ${z}: ${K[0]}, Key: ${K[1]}, Params: ${K[2]||"none"}`))}return J=await OY(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,K,z,B)=>{try{let _={};if(z)try{let j=[()=>JSON.parse(z),()=>{let H=`{"data":${z}}`,O=JSON.parse(H);return typeof O.data==="object"?O.data:{}},()=>{return O0(z,$)}];for(let H of j)try{if(_=H(),Object.keys(_).length>0)break}catch{}}catch(j){if(Y.debug)console.error("Error parsing parameters for @translate directive:",j)}return LY(K,w,Q.fallbackToKey,_)}catch(_){if(Y.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${K}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}}),J}async function OY(X,$,Z){let Y=[];return X.replace($,(G,...Q)=>{let w=Z(G,...Q).then((q)=>({match:G,replacement:q}));return Y.push(w),G}),(await Promise.all(Y)).reduce((G,{match:Q,replacement:w})=>G.replace(Q,w),X)}var d7,y9,E9,m7,N9;var AY=D(()=>{O1();F0();y9={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},E9={},m7={},N9={}});function M_(X){let $=X.replace(/^<template\b/i,"").replace(/>$/,"");return T_.test($)}function h5(X){l7.lastIndex=0;let $;while(($=l7.exec(X))!==null){if($[0].startsWith("</")||M_($[0]))continue;let Z=$.index,Y=l7.lastIndex,J=1,G;while((G=l7.exec(X))!==null)if(G[0].startsWith("</")){if(J--,J===0){let Q=G.index;return{start:Z,openEnd:Y,closeStart:Q,end:l7.lastIndex,content:X.slice(Y,Q)}}}else J++;return null}return null}var l7,T_;var rX=D(()=>{l7=/<\/?template\b[^>]*>/gi,T_=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var P9={};t(P9,{streamingSuspenseDirective:()=>MY,streamToResponse:()=>x_,streamTemplateSimple:()=>S_,streamTemplate:()=>k_,renderStreamingPage:()=>E_,registerStreamingDirectives:()=>P_,processStreamDirectives:()=>y_,processSectionDirectives:()=>v_,islandDirective:()=>NY,generateHydrationRuntime:()=>f_,extractStreamBoundaries:()=>b_,createStreamRenderer:()=>C_,buildSuspenseResolveScript:()=>C9,SUSPENSE_RESOLVER_RUNTIME:()=>TY});import sX from"path";function N_(X){let $=[],Z=0,Y;RY.lastIndex=0;while((Y=RY.exec(X))!==null){if(Y.index>Z){let Q=X.slice(Z,Y.index);if(Q.trim())$.push({type:$.length===0?"shell":"content",content:Q})}let J=Y[1],G=Y[2];$.push({type:"suspense",name:J,content:G}),Z=Y.index+Y[0].length}if(Z<X.length){let J=X.slice(Z);if(J.trim())$.push({type:$.length===0?"shell":"content",content:J})}if($.length===0)$.push({type:"shell",content:X});return $}async function k_(X,$={},Z={}){let Y={...V1,...Z,streaming:{...S9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:sX.dirname(X)};if(q.trim())await F1(q,U,X);let K=N_(W),z=new Set;if(!K.some((_)=>_.type==="suspense")){let _=Y.streaming?.strategy||"auto",j=new RegExp(q5.source,"g");if(!(_!=="manual"&&j.test(W))){let O=await V0(W,U,X,Y,z);for(let L=0;L<O.length;L+=J)G.enqueue(O.slice(L,L+J)),await new Promise((F)=>setTimeout(F,0))}else{let O=[],L=new RegExp(q5.source,"g"),F;while((F=L.exec(W))!==null)O.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of O){if(A.start>V){let T=W.slice(V,A.start);if(T.trim()){let M=await V0(T,U,X,Y,z);G.enqueue(M),await new Promise((k)=>setTimeout(k,0))}}let R=await V0(A.content,U,X,Y,z);G.enqueue(R),await new Promise((T)=>setTimeout(T,0)),V=A.end}if(V<W.length){let A=W.slice(V);if(A.trim()){let R=await V0(A,U,X,Y,z);G.enqueue(R)}}}}else{let _=new Map;for(let H of K)if(H.type==="shell"||H.type==="content"){let O=await V0(H.content,U,X,Y,z);G.enqueue(O)}else if(H.type==="suspense"&&H.name){let O=`stx-suspense-${H.name}`;G.enqueue(`<div id="${O}" data-suspense="${H.name}" style="display:contents;">
3361
3361
  <template data-suspense-fallback>Loading...</template>
3362
- </div>`),_.set(H.name,V0(H.content,K,X,Y,z))}G.enqueue(`
3362
+ </div>`),_.set(H.name,V0(H.content,U,X,Y,z))}G.enqueue(`
3363
3363
  <script>
3364
3364
  (function() {
3365
3365
  window.__stxSuspense = window.__stxSuspense || {
@@ -3380,8 +3380,8 @@ ${J}`)}function pZ(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*
3380
3380
  window.__stxSuspense.resolve('${X}', \`${Y}\`);
3381
3381
  </script>`}catch(Z){let Y=Z instanceof Error?Z.message:String(Z);return`
3382
3382
  <script>
3383
- window.__stxSuspense.resolve('${X}', '<div class="stx-error">Error loading content: ${t0(Y)}</div>');
3384
- </script>`}}function H_(X,$,Z){if(!$||$<=0)return X;let Y,J=new Promise((G,Q)=>{Y=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${$}ms`)),$)});return Promise.race([X,J]).finally(()=>clearTimeout(Y))}function L_(X,$=[],Z={}){let Y=Z.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue(X),$.length>0)J.enqueue(HY),await Promise.all($.map(async(G)=>{let Q=H_(G.render(),Y,G.id);J.enqueue(await C9(G.id,Q))}));J.close()}catch(G){J.error(G)}}})}function F_(X,$){return X.replace(O_,(Z,Y,J)=>{let G=Y.trim(),Q=J.split(/@fallback/i),w=Q[0].trim(),q=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!$.__streamTemplates)$.__streamTemplates={};return $.__streamTemplates[G]=w,`<div data-suspense="${G}">${q}</div>`})}function V_(X){let $=X?.streamBoundaries;if(!$||typeof $!=="object")return;let Z=Object.entries($).filter(([,Y])=>typeof Y==="function");return Z.length>0?Z.map(([Y,J])=>({id:Y,render:J})):void 0}async function A_(X,$={},Z={}){let Y={...A1,...Z,streaming:{...S9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K={...$,__filename:X,__dirname:rX.dirname(X)};if(q.trim())await V1(q,K,X);let U=new Set,z=Y.streaming?.strategy||"auto",B=new RegExp(q5.source,"g");if(!(z!=="manual"&&B.test(W))){let j=await V0(W,K,X,Y,U);for(let H=0;H<j.length;H+=J)G.enqueue(j.slice(H,H+J))}else{let j=[],H=new RegExp(q5.source,"g"),O;while((O=H.exec(W))!==null)j.push({name:O[1],content:O[2],start:O.index,end:O.index+O[0].length});let L=0;for(let F of j){if(F.start>L){let A=W.slice(L,F.start);if(A.trim()){let R=await V0(A,K,X,Y,U);G.enqueue(R)}}let V=await V0(F.content,K,X,Y,U);G.enqueue(V),L=F.end}if(L<W.length){let F=W.slice(L);if(F.trim()){let V=await V0(F,K,X,Y,U);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function R_(X,$={}){let Z={...A1,...$,streaming:{...S9,...$.streaming}},Y=await Bun.file(X).text(),J=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=J?J[1]:"",Q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=Q,q={},W;q5.lastIndex=0;while((W=q5.exec(Q))!==null){let z=W[1],B=W[2];q[z]=B}let K=Q.replace(q5,"");return{renderShell:async(z={})=>{let B={...z,__filename:X,__dirname:rX.dirname(X)};return await V1(G,B,X),V0(K,B,X,Z,new Set)},renderSection:async(z,B={})=>{try{if(!q[z])return`<div class="error-message">Section "${t0(z)}" not found in template "${t0(X)}"</div>`;let _={...B,__filename:X,__dirname:rX.dirname(X)};await V1(G,_,X);let j=new Set;return await V0(q[z],_,X,Z,j)}catch(_){let j=_ instanceof Error?_.message:String(_);return U0("Expression",j,X,q[z]||"",0,q[z]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return w}}}function T_(X={}){let $=[];if(X.streaming?.enabled)$.push(LY);if(X.hydration?.enabled)$.push(OY);return $}async function M_(X,$,Z,Y={}){return X}function N_(X,$={}){let Z=new TextEncoder,Y=X.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),J=new Headers($.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(Y,{...$,headers:J})}function k_(X={mode:"full"}){let{mode:$,components:Z={},dynamicImports:Y=!0}=X,J=Object.entries(Z).map(([G,Q])=>`'${G}': ${Y?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
3383
+ window.__stxSuspense.resolve('${X}', '<div class="stx-error">Error loading content: ${a0(Y)}</div>');
3384
+ </script>`}}function I_(X,$,Z){if(!$||$<=0)return X;let Y,J=new Promise((G,Q)=>{Y=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${$}ms`)),$)});return Promise.race([X,J]).finally(()=>clearTimeout(Y))}function E_(X,$=[],Z={}){let Y=Z.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue(X),$.length>0)J.enqueue(TY),await Promise.all($.map(async(G)=>{let Q=I_(G.render(),Y,G.id);J.enqueue(await C9(G.id,Q))}));J.close()}catch(G){J.error(G)}}})}function y_(X,$){return X.replace(D_,(Z,Y,J)=>{let G=Y.trim(),Q=J.split(/@fallback/i),w=Q[0].trim(),q=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!$.__streamTemplates)$.__streamTemplates={};return $.__streamTemplates[G]=w,`<div data-suspense="${G}">${q}</div>`})}function b_(X){let $=X?.streamBoundaries;if(!$||typeof $!=="object")return;let Z=Object.entries($).filter(([,Y])=>typeof Y==="function");return Z.length>0?Z.map(([Y,J])=>({id:Y,render:J})):void 0}async function S_(X,$={},Z={}){let Y={...V1,...Z,streaming:{...S9,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:sX.dirname(X)};if(q.trim())await F1(q,U,X);let K=new Set,z=Y.streaming?.strategy||"auto",B=new RegExp(q5.source,"g");if(!(z!=="manual"&&B.test(W))){let j=await V0(W,U,X,Y,K);for(let H=0;H<j.length;H+=J)G.enqueue(j.slice(H,H+J))}else{let j=[],H=new RegExp(q5.source,"g"),O;while((O=H.exec(W))!==null)j.push({name:O[1],content:O[2],start:O.index,end:O.index+O[0].length});let L=0;for(let F of j){if(F.start>L){let A=W.slice(L,F.start);if(A.trim()){let R=await V0(A,U,X,Y,K);G.enqueue(R)}}let V=await V0(F.content,U,X,Y,K);G.enqueue(V),L=F.end}if(L<W.length){let F=W.slice(L);if(F.trim()){let V=await V0(F,U,X,Y,K);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function C_(X,$={}){let Z={...V1,...$,streaming:{...S9,...$.streaming}},Y=await Bun.file(X).text(),J=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=J?J[1]:"",Q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=Q,q={},W;q5.lastIndex=0;while((W=q5.exec(Q))!==null){let z=W[1],B=W[2];q[z]=B}let U=Q.replace(q5,"");return{renderShell:async(z={})=>{let B={...z,__filename:X,__dirname:sX.dirname(X)};return await F1(G,B,X),V0(U,B,X,Z,new Set)},renderSection:async(z,B={})=>{try{if(!q[z])return`<div class="error-message">Section "${a0(z)}" not found in template "${a0(X)}"</div>`;let _={...B,__filename:X,__dirname:sX.dirname(X)};await F1(G,_,X);let j=new Set;return await V0(q[z],_,X,Z,j)}catch(_){let j=_ instanceof Error?_.message:String(_);return K0("Expression",j,X,q[z]||"",0,q[z]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return w}}}function P_(X={}){let $=[];if(X.streaming?.enabled)$.push(MY);if(X.hydration?.enabled)$.push(NY);return $}async function v_(X,$,Z,Y={}){return X}function x_(X,$={}){let Z=new TextEncoder,Y=X.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),J=new Headers($.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(Y,{...$,headers:J})}function f_(X={mode:"full"}){let{mode:$,components:Z={},dynamicImports:Y=!0}=X,J=Object.entries(Z).map(([G,Q])=>`'${G}': ${Y?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
3385
3385
  `);if($==="loader")return`
3386
3386
  (function() {
3387
3387
  window.__stx = window.__stx || {};
@@ -3523,7 +3523,7 @@ else {
3523
3523
  else {
3524
3524
  stx.hydrate();
3525
3525
  }
3526
- })();`}var S9,q5,jY,HY=`
3526
+ })();`}var S9,q5,RY,TY=`
3527
3527
  <script>
3528
3528
  (function(){
3529
3529
  window.__stxSuspense = window.__stxSuspense || {
@@ -3543,25 +3543,25 @@ else {
3543
3543
  }
3544
3544
  };
3545
3545
  })();
3546
- </script>`,O_,LY,OY;var v9=D(()=>{H1();w1();sX();T0();S9={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},q5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,jY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;O_=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;LY={name:"suspense",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Suspense directive requires a name parameter");let J=$[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${X}<!-- @endsuspense:${J} -->`}},OY={name:"island",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Island directive requires a name parameter");let J=$[0].replace(/['"`]/g,""),G=$[1]?$[1].replace(/['"`]/g,""):"lazy",Q=`island-${J}-${Math.random().toString(36).substring(2,9)}`,w=X.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=w?w[1].trim():"",W=w?X.replace(w[0],""):X;return`<div data-island="${J}" data-island-id="${Q}" data-priority="${G}">
3546
+ </script>`,D_,MY,NY;var v9=D(()=>{j1();Q1();oX();T0();S9={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},q5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,RY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;D_=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;MY={name:"suspense",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Suspense directive requires a name parameter");let J=$[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${X}<!-- @endsuspense:${J} -->`}},NY={name:"island",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Island directive requires a name parameter");let J=$[0].replace(/['"`]/g,""),G=$[1]?$[1].replace(/['"`]/g,""):"lazy",Q=`island-${J}-${Math.random().toString(36).substring(2,9)}`,w=X.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=w?w[1].trim():"",W=w?X.replace(w[0],""):X;return`<div data-island="${J}" data-island-id="${Q}" data-priority="${G}">
3547
3547
  ${W}
3548
3548
  <script type="application/json" data-island-props="${Q}">
3549
3549
  ${q?`{${q}}`:"{}"}
3550
3550
  </script>
3551
- </div>`}}});var AY={};t(AY,{warnUnbalancedTags:()=>x9,findUnbalancedTags:()=>VY});function h5(X){return X.replace(/[^\n]/g," ")}function VY(X){let $=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,h5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,h5).replace(/<!--[\s\S]*?-->/g,h5).replace(/\{\{\{[\s\S]*?\}\}\}/g,h5).replace(/\{\{[\s\S]*?\}\}/g,h5).replace(/\{!![\s\S]*?!!\}/g,h5),Z=new Map,Y=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=J.exec($))!==null){let w=G[1]==="/",q=G[2],W=G[3]==="/";if(I_.has(q.toLowerCase()))continue;if(W)continue;if(w)Y.set(q,(Y.get(q)??0)+1);else{let K=Z.get(q);if(K)K.count++;else{let U=$.slice(0,G.index).split(`
3552
- `).length;Z.set(q,{count:1,firstLine:U})}}}let Q=[];for(let w of new Set([...Z.keys(),...Y.keys()])){if(E_.has(w.toLowerCase()))continue;let q=Z.get(w)?.count??0,W=Y.get(w)??0;if(q!==W)Q.push({tag:w,opened:q,closed:W,firstOpenLine:Z.get(w)?.firstLine??0})}return Q}function x9(X,$){let Z;try{Z=VY(X)}catch{return}if(Z.length===0)return;let Y=`${$}:${X.length}`;if(FY.has(Y))return;FY.add(Y);let J=$?$.split(/[/\\]/).pop()||$:"template";for(let{tag:G,opened:Q,closed:w,firstOpenLine:q}of Z)if(Q>w){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 an unclosed <${G}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 ${w-Q} stray </${G}>.`)}var I_,E_,FY;var f9=D(()=>{I_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),E_=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);FY=new Set});import n0 from"path";import g9 from"fs";function RY(X){return X.split("-").map(($)=>$.charAt(0).toUpperCase()+$.slice(1)).join("")}function TY(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class MY{builtins=new Map;registerBuiltin(X){this.builtins.set(X.name.toLowerCase(),X);for(let $ of X.aliases)this.builtins.set($.toLowerCase(),X)}isBuiltin(X){return this.builtins.has(X.toLowerCase())}getBuiltin(X){return this.builtins.get(X.toLowerCase())??null}async resolveFile(X,$,Z,Y){let J=X.endsWith(".stx")?X.slice(0,-4):X,G=Y?.__importedComponents;if(G){let B=[J,J.toLowerCase(),RY(J),TY(J)];for(let _ of B)if(G.has(_))return G.get(_)}let Q=[...new Set([`${J}.stx`,`${RY(J)}.stx`,`${TY(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let B=n0.resolve(n0.dirname($),`${J}.stx`);if(await i(B))return B;return null}let w=[],q=Z.componentsDir||"",W=Y?.__originalFilePath;if(W)w.push(n0.join(n0.dirname(W),"components"));if(q)w.push(q);let K=n0.join(n0.dirname($),"components");if(!w.includes(K))w.push(K);let U=process.cwd(),z=[n0.resolve(U,"src/components"),n0.resolve(U,"components"),n0.resolve(import.meta.dir,"components")];for(let B of z)if(!w.includes(B))w.push(B);for(let B of w){if(!B)continue;for(let _ of Q){let j=n0.join(B,_);if(await i(j))return j}try{if(!g9.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let j=g9.readdirSync(B,{withFileTypes:!0});for(let H of j)if(H.isDirectory()){let O=n0.join(B,H.name);for(let L of Q){let F=n0.join(O,L);if(await i(F))return F}}}catch{}}return null}}var x0;var h9=D(()=>{T0();x0=new MY});function k0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function NY(X){return X.indexOf("\x00")===-1?X:X.replace(/\0/g,"")}var W5="\x00stx-boolean-attribute";function u5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.static)){if($.has(Y))continue;let G=X.staticNames?.[Y]??Y;if(typeof J==="boolean"){if(J)Z.push(k0(G));continue}if(J===W5){Z.push(k0(G));continue}Z.push(`${k0(G)}="${k0(NY(String(J)))}"`)}return Z}var oX=()=>{};function m7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function D_(X){if(X.clientReactive.to)return{value:X.clientReactive.to,reactive:!0};if(X.serverDynamic.to!==void 0)return{value:String(X.serverDynamic.to),reactive:!1};if(typeof X.static.to==="string")return{value:X.static.to,reactive:!1};return{value:"#",reactive:!1}}var u9;var d9=D(()=>{oX();u9={name:"StxLink",aliases:["stx-link"],render(X,$,Z){let Y=D_(X),J=(typeof X.static.class==="string"?X.static.class:"")||(typeof X.static.className==="string"?X.static.className:""),G=typeof X.static.activeClass==="string"?X.static.activeClass:"active",Q=typeof X.static.exactActiveClass==="string"?X.static.exactActiveClass:"exact-active",w=X.static.prefetch===!0||X.static.prefetch==="true"||X.serverDynamic.prefetch===!0,q=[];if(Y.reactive)q.push(`:href="${m7(Y.value)}"`);else q.push(`href="${m7(Y.value)}"`);if(J)q.push(`class="${m7(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${m7(G)}"`),q.push(`data-stx-exact-active-class="${m7(Q)}"`),w)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...u5(X,W)),`<a ${q.join(" ")}>${$}</a>`}}});function I0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function y0(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function l9(X,$,Z=!1){let Y=X.serverDynamic[$];if(Y!==void 0)return Y!==!1&&Y!=="false";let J=X.static[$];if(J!==void 0)return J!=="false"&&J!==!1;return Z}function kY(X){if(X.includes("(")||X.includes(","))return X;let $=X.trim().split(/\s+/),Z=[];for(let Y of $)if(Y.includes(":")){let[J,G]=Y.split(":"),Q=y_[J];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let w=Number.parseInt(J);if(!Number.isNaN(w))Z.push(`(max-width: ${w}px) ${G}`)}}else Z.push(Y);return Z.join(", ")}function c9(X,$,Z,Y){return $.map((J)=>`${l7(X,J,void 0,Z,Y)} ${J}w`).join(", ")}function b_(X,$,Z,Y,J){return $.map((G)=>{let Q=Z?Z*G:void 0;return`${l7(X,Q,void 0,Y,J)} ${G}x`}).join(", ")}function l7(X,$,Z,Y,J){if(!Y||Y==="local"||Y==="static")return X;if(Y==="cloudinary"){let G=[];if($)G.push(`w_${$}`);if(Z)G.push(`h_${Z}`);if(J)G.push(`f_${J}`);G.push("q_auto");let Q=G.join(",");return X.replace("/upload/",`/upload/${Q}/`)}if(Y==="imgix"){let G=new URLSearchParams;if($)G.set("w",String($));if(Z)G.set("h",String(Z));if(J)G.set("fm",J);G.set("auto","format");let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}if(Y==="bunny"){let G=new URLSearchParams;if($)G.set("width",String($));if(Z)G.set("height",String(Z));if(J)G.set("format",J);let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}return X}function S_(X,$,Z="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${$}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var y_,m9,p9;var i9=D(()=>{oX();y_={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},m9=[320,640,768,1024,1280,1536,1920];p9={name:"StxImage",aliases:["stx-image","stx-img"],render(X,$,Z){let Y=y0(X,"src")||"",J=y0(X,"alt")||"",G=y0(X,"width"),Q=y0(X,"height"),w=y0(X,"sizes"),q=y0(X,"srcset"),W=y0(X,"densities"),K=y0(X,"format"),U=y0(X,"placeholder"),z=y0(X,"placeholderColor")||"#e5e7eb",B=y0(X,"provider"),_=y0(X,"class")||y0(X,"className")||"",j=y0(X,"style")||"",H=y0(X,"quality"),O=l9(X,"lazy",!0),L=l9(X,"preload",!1),F=l9(X,"picture",!1)||!!K,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=q||"",T="";if(!R&&w)R=c9(Y,m9,B,K),T=kY(w);else if(!R&&W){let S=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));R=b_(Y,S,V,B,K)}else if(w)T=kY(w);let M=[];if(j)M.push(j);if(V&&A)M.push(`aspect-ratio:${V}/${A}`);if(U==="blur"||U==="color"||U==="thumbhash"){let S=S_(V||16,A||9,z);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(${I0(U)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let k=l7(Y,V,A,B,K),N=[];if(N.push(`src="${I0(k)}"`),N.push(`alt="${I0(J)}"`),G)N.push(`width="${I0(G)}"`);if(Q)N.push(`height="${I0(Q)}"`);if(O)N.push('loading="lazy"');if(N.push('decoding="async"'),_)N.push(`class="${I0(_)}"`);if(M.length>0)N.push(`style="${I0(M.join(";"))}"`);if(R)N.push(`srcset="${I0(R)}"`);if(T)N.push(`sizes="${I0(T)}"`);let y=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);N.push(...u5(X,y));let I=`<img ${N.join(" ")} />`,C="";if(L){let b=K==="webp"?"image/webp":K==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${I0(k)}"${b?` type="${b}"`:""}${R?` imagesrcset="${I0(R)}"`:""}${T?` imagesizes="${I0(T)}"`:""} />
3553
- `}if(F){let S=[];if(K==="avif"||K==="auto"){let b=l7(Y,V,A,B,"avif"),P=R?c9(Y,m9,B,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${I0(P)}"${T?` sizes="${I0(T)}"`:""} />`)}if(K==="webp"||K==="auto"){let b=l7(Y,V,A,B,"webp"),P=R?c9(Y,m9,B,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${I0(P)}"${T?` sizes="${I0(T)}"`:""} />`)}return`${C}<picture>
3551
+ </div>`}}});var EY={};t(EY,{warnUnbalancedTags:()=>x9,findUnbalancedTags:()=>IY});function u5(X){return X.replace(/[^\n]/g," ")}function IY(X){let $=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,u5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,u5).replace(/<!--[\s\S]*?-->/g,u5).replace(/\{\{\{[\s\S]*?\}\}\}/g,u5).replace(/\{\{[\s\S]*?\}\}/g,u5).replace(/\{!![\s\S]*?!!\}/g,u5),Z=new Map,Y=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=J.exec($))!==null){let w=G[1]==="/",q=G[2],W=G[3]==="/";if(g_.has(q.toLowerCase()))continue;if(W)continue;if(w)Y.set(q,(Y.get(q)??0)+1);else{let U=Z.get(q);if(U)U.count++;else{let K=$.slice(0,G.index).split(`
3552
+ `).length;Z.set(q,{count:1,firstLine:K})}}}let Q=[];for(let w of new Set([...Z.keys(),...Y.keys()])){if(h_.has(w.toLowerCase()))continue;let q=Z.get(w)?.count??0,W=Y.get(w)??0;if(q!==W)Q.push({tag:w,opened:q,closed:W,firstOpenLine:Z.get(w)?.firstLine??0})}return Q}function x9(X,$){let Z;try{Z=IY(X)}catch{return}if(Z.length===0)return;let Y=`${$}:${X.length}`;if(kY.has(Y))return;kY.add(Y);let J=$?$.split(/[/\\]/).pop()||$:"template";for(let{tag:G,opened:Q,closed:w,firstOpenLine:q}of Z)if(Q>w){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 an unclosed <${G}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 ${w-Q} stray </${G}>.`)}var g_,h_,kY;var f9=D(()=>{g_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),h_=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);kY=new Set});import i0 from"path";import g9 from"fs";function DY(X){return X.split("-").map(($)=>$.charAt(0).toUpperCase()+$.slice(1)).join("")}function yY(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class bY{builtins=new Map;registerBuiltin(X){this.builtins.set(X.name.toLowerCase(),X);for(let $ of X.aliases)this.builtins.set($.toLowerCase(),X)}isBuiltin(X){return this.builtins.has(X.toLowerCase())}getBuiltin(X){return this.builtins.get(X.toLowerCase())??null}async resolveFile(X,$,Z,Y){let J=X.endsWith(".stx")?X.slice(0,-4):X,G=Y?.__importedComponents;if(G){let B=[J,J.toLowerCase(),DY(J),yY(J)];for(let _ of B)if(G.has(_))return G.get(_)}let Q=[...new Set([`${J}.stx`,`${DY(J)}.stx`,`${yY(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let B=i0.resolve(i0.dirname($),`${J}.stx`);if(await i(B))return B;return null}let w=[],q=Z.componentsDir||"",W=Y?.__originalFilePath;if(W)w.push(i0.join(i0.dirname(W),"components"));if(q)w.push(q);let U=i0.join(i0.dirname($),"components");if(!w.includes(U))w.push(U);let K=process.cwd(),z=[i0.resolve(K,"src/components"),i0.resolve(K,"components"),i0.resolve(import.meta.dir,"components")];for(let B of z)if(!w.includes(B))w.push(B);for(let B of w){if(!B)continue;for(let _ of Q){let j=i0.join(B,_);if(await i(j))return j}try{if(!g9.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let j=g9.readdirSync(B,{withFileTypes:!0});for(let H of j)if(H.isDirectory()){let O=i0.join(B,H.name);for(let L of Q){let F=i0.join(O,L);if(await i(F))return F}}}catch{}}return null}}var x0;var h9=D(()=>{T0();x0=new bY});function k0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function SY(X){return X.indexOf("\x00")===-1?X:X.replace(/\0/g,"")}var W5="\x00stx-boolean-attribute";function d5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.static)){if($.has(Y))continue;let G=X.staticNames?.[Y]??Y;if(typeof J==="boolean"){if(J)Z.push(k0(G));continue}if(J===W5){Z.push(k0(G));continue}Z.push(`${k0(G)}="${k0(SY(String(J)))}"`)}return Z}var aX=()=>{};function c7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function u_(X){if(X.clientReactive.to)return{value:X.clientReactive.to,reactive:!0};if(X.serverDynamic.to!==void 0)return{value:String(X.serverDynamic.to),reactive:!1};if(typeof X.static.to==="string")return{value:X.static.to,reactive:!1};return{value:"#",reactive:!1}}var u9;var d9=D(()=>{aX();u9={name:"StxLink",aliases:["stx-link"],render(X,$,Z){let Y=u_(X),J=(typeof X.static.class==="string"?X.static.class:"")||(typeof X.static.className==="string"?X.static.className:""),G=typeof X.static.activeClass==="string"?X.static.activeClass:"active",Q=typeof X.static.exactActiveClass==="string"?X.static.exactActiveClass:"exact-active",w=X.static.prefetch===!0||X.static.prefetch==="true"||X.serverDynamic.prefetch===!0,q=[];if(Y.reactive)q.push(`:href="${c7(Y.value)}"`);else q.push(`href="${c7(Y.value)}"`);if(J)q.push(`class="${c7(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${c7(G)}"`),q.push(`data-stx-exact-active-class="${c7(Q)}"`),w)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...d5(X,W)),`<a ${q.join(" ")}>${$}</a>`}}});function I0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function y0(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function l9(X,$,Z=!1){let Y=X.serverDynamic[$];if(Y!==void 0)return Y!==!1&&Y!=="false";let J=X.static[$];if(J!==void 0)return J!=="false"&&J!==!1;return Z}function CY(X){if(X.includes("(")||X.includes(","))return X;let $=X.trim().split(/\s+/),Z=[];for(let Y of $)if(Y.includes(":")){let[J,G]=Y.split(":"),Q=d_[J];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let w=Number.parseInt(J);if(!Number.isNaN(w))Z.push(`(max-width: ${w}px) ${G}`)}}else Z.push(Y);return Z.join(", ")}function c9(X,$,Z,Y){return $.map((J)=>`${p7(X,J,void 0,Z,Y)} ${J}w`).join(", ")}function m_(X,$,Z,Y,J){return $.map((G)=>{let Q=Z?Z*G:void 0;return`${p7(X,Q,void 0,Y,J)} ${G}x`}).join(", ")}function p7(X,$,Z,Y,J){if(!Y||Y==="local"||Y==="static")return X;if(Y==="cloudinary"){let G=[];if($)G.push(`w_${$}`);if(Z)G.push(`h_${Z}`);if(J)G.push(`f_${J}`);G.push("q_auto");let Q=G.join(",");return X.replace("/upload/",`/upload/${Q}/`)}if(Y==="imgix"){let G=new URLSearchParams;if($)G.set("w",String($));if(Z)G.set("h",String(Z));if(J)G.set("fm",J);G.set("auto","format");let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}if(Y==="bunny"){let G=new URLSearchParams;if($)G.set("width",String($));if(Z)G.set("height",String(Z));if(J)G.set("format",J);let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}return X}function l_(X,$,Z="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${$}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var d_,m9,p9;var i9=D(()=>{aX();d_={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},m9=[320,640,768,1024,1280,1536,1920];p9={name:"StxImage",aliases:["stx-image","stx-img"],render(X,$,Z){let Y=y0(X,"src")||"",J=y0(X,"alt")||"",G=y0(X,"width"),Q=y0(X,"height"),w=y0(X,"sizes"),q=y0(X,"srcset"),W=y0(X,"densities"),U=y0(X,"format"),K=y0(X,"placeholder"),z=y0(X,"placeholderColor")||"#e5e7eb",B=y0(X,"provider"),_=y0(X,"class")||y0(X,"className")||"",j=y0(X,"style")||"",H=y0(X,"quality"),O=l9(X,"lazy",!0),L=l9(X,"preload",!1),F=l9(X,"picture",!1)||!!U,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=q||"",T="";if(!R&&w)R=c9(Y,m9,B,U),T=CY(w);else if(!R&&W){let S=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));R=m_(Y,S,V,B,U)}else if(w)T=CY(w);let M=[];if(j)M.push(j);if(V&&A)M.push(`aspect-ratio:${V}/${A}`);if(K==="blur"||K==="color"||K==="thumbhash"){let S=l_(V||16,A||9,z);M.push(`background-image:url(${S})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(K&&K!=="empty"&&K!=="none")M.push(`background-image:url(${I0(K)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let k=p7(Y,V,A,B,U),N=[];if(N.push(`src="${I0(k)}"`),N.push(`alt="${I0(J)}"`),G)N.push(`width="${I0(G)}"`);if(Q)N.push(`height="${I0(Q)}"`);if(O)N.push('loading="lazy"');if(N.push('decoding="async"'),_)N.push(`class="${I0(_)}"`);if(M.length>0)N.push(`style="${I0(M.join(";"))}"`);if(R)N.push(`srcset="${I0(R)}"`);if(T)N.push(`sizes="${I0(T)}"`);let y=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);N.push(...d5(X,y));let I=`<img ${N.join(" ")} />`,C="";if(L){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${I0(k)}"${b?` type="${b}"`:""}${R?` imagesrcset="${I0(R)}"`:""}${T?` imagesizes="${I0(T)}"`:""} />
3553
+ `}if(F){let S=[];if(U==="avif"||U==="auto"){let b=p7(Y,V,A,B,"avif"),P=R?c9(Y,m9,B,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${I0(P)}"${T?` sizes="${I0(T)}"`:""} />`)}if(U==="webp"||U==="auto"){let b=p7(Y,V,A,B,"webp"),P=R?c9(Y,m9,B,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${I0(P)}"${T?` sizes="${I0(T)}"`:""} />`)}return`${C}<picture>
3554
3554
  ${S.join(`
3555
3555
  `)}
3556
3556
  ${I}
3557
- </picture>`}return`${C}${I}`}}});function c7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function d5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var IY="/images/safe-image-default.svg",C_,n9;var r9=D(()=>{oX();C_=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${IY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,n9={name:"SafeImage",aliases:["safe-image","safe-img"],render(X,$,Z){let Y=d5(X,"src")||"",J=d5(X,"alt")||"",G=d5(X,"fallback")||IY,Q=d5(X,"class")||d5(X,"className")||"",w=d5(X,"fallbackClassName")||"",q=[];if(q.push(`src="${c7(Y)}"`),q.push(`alt="${c7(J)}"`),Q)q.push(`class="${c7(Q)}"`);if(q.push(`data-fallback="${c7(G)}"`),w)q.push(`data-fallback-class="${c7(w)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...u5(X,W));let K=`<img ${q.join(" ")} />`,U=Z.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${C_}${K}`;return K}}});function s9(X){return X.replace(/[;{}()]/g,"").replace(/url/gi,"")}function p7(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function aX(X,$,Z){let Y=p7(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var o9;var a9=D(()=>{o9={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(X,$,Z){let Y=s9(p7(X,"color")||"#6366f1"),J=s9(p7(X,"initialColor")||p7(X,"initial-color")||""),G=s9(p7(X,"height")||"3px"),Q=aX(X,"duration",2000),w=aX(X,"throttle",200),q=aX(X,"zIndex",999999)||aX(X,"z-index",999999),W=J?`linear-gradient(to right, ${J}, ${Y})`:Y;return`
3557
+ </picture>`}return`${C}${I}`}}});function i7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function m5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var PY="/images/safe-image-default.svg",c_,n9;var r9=D(()=>{aX();c_=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${PY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,n9={name:"SafeImage",aliases:["safe-image","safe-img"],render(X,$,Z){let Y=m5(X,"src")||"",J=m5(X,"alt")||"",G=m5(X,"fallback")||PY,Q=m5(X,"class")||m5(X,"className")||"",w=m5(X,"fallbackClassName")||"",q=[];if(q.push(`src="${i7(Y)}"`),q.push(`alt="${i7(J)}"`),Q)q.push(`class="${i7(Q)}"`);if(q.push(`data-fallback="${i7(G)}"`),w)q.push(`data-fallback-class="${i7(w)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...d5(X,W));let U=`<img ${q.join(" ")} />`,K=Z.context;if(!K.__safeImageHandlerEmitted)return K.__safeImageHandlerEmitted=!0,`${c_}${U}`;return U}}});function s9(X){return X.replace(/[;{}()]/g,"").replace(/url/gi,"")}function n7(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function tX(X,$,Z){let Y=n7(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var o9;var a9=D(()=>{o9={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(X,$,Z){let Y=s9(n7(X,"color")||"#6366f1"),J=s9(n7(X,"initialColor")||n7(X,"initial-color")||""),G=s9(n7(X,"height")||"3px"),Q=tX(X,"duration",2000),w=tX(X,"throttle",200),q=tX(X,"zIndex",999999)||tX(X,"z-index",999999),W=J?`linear-gradient(to right, ${J}, ${Y})`:Y;return`
3558
3558
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${G};background:${W};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
3559
3559
  <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>
3560
3560
  </div>
3561
3561
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
3562
3562
  <script>
3563
3563
  (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)},${w})},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()})})();
3564
- </script>`}}});function DY(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function P_(X,$,Z){let Y=DY(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var EY,t9;var e9=D(()=>{EY={"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%)"},t9={name:"StxToast",aliases:["stx-toast"],render(X,$,Z){let Y=k0(DY(X,"position")||"top-right"),J=P_(X,"max",5),G=EY[Y]||EY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${J}" style="position:fixed;${G};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
3564
+ </script>`}}});function xY(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function p_(X,$,Z){let Y=xY(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var vY,t9;var e9=D(()=>{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%)"},t9={name:"StxToast",aliases:["stx-toast"],render(X,$,Z){let Y=k0(xY(X,"position")||"top-right"),J=p_(X,"max",5),G=vY[Y]||vY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${J}" style="position:fixed;${G};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
3565
3565
  <style>
3566
3566
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
3567
3567
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -3569,7 +3569,7 @@ ${I}
3569
3569
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
3570
3570
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
3571
3571
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
3572
- </style>`}}});function tX(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var yY,X3;var $3=D(()=>{yY={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},X3={name:"StxModal",aliases:["stx-modal"],render(X,$,Z){let Y=tX(X,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=k0(Y),G=tX(X,"size")||"md",Q=tX(X,"closeOnBackdrop")!=="false",w=tX(X,"closeOnEscape")!=="false",q=yY[G]||yY.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${Q}" data-close-escape="${w}" 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">
3572
+ </style>`}}});function eX(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var fY,X3;var $3=D(()=>{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)"},X3={name:"StxModal",aliases:["stx-modal"],render(X,$,Z){let Y=eX(X,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=k0(Y),G=eX(X,"size")||"md",Q=eX(X,"closeOnBackdrop")!=="false",w=eX(X,"closeOnEscape")!=="false",q=fY[G]||fY.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${Q}" data-close-escape="${w}" 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">
3573
3573
  <div class="stx-modal-panel" style="${q};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
3574
3574
  <div style="padding:1.5rem">${$}</div>
3575
3575
  </div>
@@ -3578,8 +3578,8 @@ ${I}
3578
3578
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
3579
3579
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
3580
3580
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
3581
- </style>`}}});function m5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var bY,Z3;var Y3=D(()=>{bY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},Z3={name:"StxDrawer",aliases:["stx-drawer"],render(X,$,Z){let Y=m5(X,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=k0(Y),G=m5(X,"side")||"right",Q=m5(X,"size")||"md",w=m5(X,"closeOnBackdrop")!=="false",q=m5(X,"closeOnEscape")!=="false",W=m5(X,"overlay")!=="false",K=bY[Q]||bY.md,U=G==="left",z=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-${J}" class="stx-drawer-backdrop" data-stx-drawer="${J}" data-close-backdrop="${w}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
3582
- <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${z};width:${K};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">
3581
+ </style>`}}});function l5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var gY,Z3;var Y3=D(()=>{gY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},Z3={name:"StxDrawer",aliases:["stx-drawer"],render(X,$,Z){let Y=l5(X,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=k0(Y),G=l5(X,"side")||"right",Q=l5(X,"size")||"md",w=l5(X,"closeOnBackdrop")!=="false",q=l5(X,"closeOnEscape")!=="false",W=l5(X,"overlay")!=="false",U=gY[Q]||gY.md,K=G==="left",z=K?"left:0":"right:0",B=K?"translateX(-100%)":"translateX(100%)",_=K?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${J}" class="stx-drawer-backdrop" data-stx-drawer="${J}" data-close-backdrop="${w}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
3582
+ <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${z};width:${U};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">
3583
3583
  <div style="padding:1.5rem">${$}</div>
3584
3584
  </div>
3585
3585
  </div>
@@ -3587,37 +3587,37 @@ ${I}
3587
3587
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
3588
3588
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
3589
3589
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
3590
- </style>`}}});import{existsSync as v_,readFileSync as x_}from"fs";function f_(X){if(SY.has(X))return;SY.add(X),console.warn(`[stx] icon collection "${X}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${X}\`.`)}function g_(X){let $=process.cwd();for(let Z of[`${$}/node_modules/@iconify-json/${X}/icons.json`,`${$}/pantry/@iconify-json/${X}/icons.json`,`${$}/node_modules/@iconify/json/json/${X}.json`,`${$}/pantry/@iconify/json/json/${X}.json`])if(v_(Z))return Z;for(let Z of[`@iconify-json/${X}/icons.json`,`@iconify/json/json/${X}.json`])try{return X0.resolve(Z)}catch{}return null}function h_(X){if(eX.has(X))return eX.get(X);let $=g_(X);if(!$)return f_(X),null;try{let Z=JSON.parse(x_($,"utf8"));return eX.set(X,Z.icons),Z.icons}catch{return null}}function l5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);if(X.static[$]!==void 0)return String(X.static[$]);if(X.clientReactive[$]!==void 0)return X.clientReactive[$];return}var eX,SY,J3;var G3=D(()=>{eX=new Map,SY=new Set;J3={name:"Icon",aliases:["icon","stx-icon"],render(X,$,Z){let Y=l5(X,"name")??l5(X,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let J="lucide",G=Y;if(Y.includes(":")){let L=Y.split(":");J=L[0],G=L[1]}let Q=k0(l5(X,"size")||"24"),w=k0(l5(X,"color")||"currentColor"),q=k0(l5(X,"class")||""),W=k0(l5(X,"style")||""),K=eX.get(J)??h_(J);if(!K)return`<!-- Icon: collection "${J}" not loaded -->`;let U=K[G];if(!U)return`<!-- Icon: "${G}" not found in ${J} -->`;let z=U.width||24,B=U.height||24,_=`0 0 ${z} ${B}`,j=U.body;if(w!=="currentColor")j=j.replace(/currentColor/g,w);let H=q?` class="${q}"`:"",O=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${_}" fill="none"${H}${O}>${j}</svg>`}}});function CY(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}function PY(X,$){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${$}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=X.match(Z);if(!Y)return{region:null,rest:X};return{region:Y[2],rest:X.replace(Y[0],"")}}var Q3;var w3=D(()=>{Q3={name:"Suspense",aliases:["suspense"],render(X,$,Z){let Y=PY($,"fallback"),J=Y.rest,G=PY(J,"error"),Q=G.rest,w=Y.region??CY(X,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=G.region??CY(X,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${w}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function X8(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}var q3;var W3=D(()=>{q3={name:"TransitionGroup",aliases:["transition-group"],render(X,$,Z){let Y=(X8(X,"name")||"v").replace(/["'<>]/g,""),J=(X8(X,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=X8(X,"class"),Q=X8(X,"id"),w=[`data-stx-transition-group="${Y}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${J} ${w}>${$}</${J}>`}}});function vY(){x0.registerBuiltin(u9),x0.registerBuiltin(p9),x0.registerBuiltin(n9),x0.registerBuiltin(o9),x0.registerBuiltin(t9),x0.registerBuiltin(X3),x0.registerBuiltin(Z3),x0.registerBuiltin(J3),x0.registerBuiltin(Q3),x0.registerBuiltin(q3)}var xY=D(()=>{d9();i9();r9();a9();e9();$3();Y3();G3();w3();W3();h9();d9();i9();r9();a9();e9();$3();Y3();G3();w3();W3()});function $8(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function fY(X,$,Z){let Y=[],J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;let w=X.slice(G+1).match(new RegExp(`^(${$.source})(?![\\w.:-])`));if(!w){J=G+1;continue}let q=w[1];if(Z&&Z.has(q.toLowerCase())){let j=G+1+q.length;while(j<X.length&&X[j]!==">")j++;J=j+1;continue}let W=G+1+q.length,K=null,U=W,z=-1,B=!1;while(W<X.length){let j=X[W];if(K){if(j==="\\"&&W+1<X.length){W+=2;continue}if(j===K)K=null;W++;continue}if(j==='"'||j==="'"){K=j,W++;continue}if(j==="/"&&W+1<X.length&&X[W+1]===">"){z=W+2,B=!0;break}if(j===">"){z=W+1;break}W++}if(z===-1){J=G+1;continue}let _=X.slice(U,B?z-2:z-1).trim();if(B)Y.push({fullMatch:X.slice(G,z),tagName:q,attributes:_,content:"",startIndex:G,endIndex:z,isSelfClosing:!0}),J=z;else{let j=`<${q}`,H=`</${q}>`,O=1,L=z,F=-1;while(O>0&&L<X.length){let R=X.indexOf(j,L),T=X.indexOf(H,L);if(T===-1)break;if(R!==-1&&R<T){let M=X[R+j.length];if(M===" "||M===">"||M==="/"||M===`
3591
- `||M==="\t")O++;L=R+j.length}else{if(O--,O===0){F=T;break}L=T+H.length}}if(F===-1){J=z;continue}let V=X.slice(z,F),A=F+H.length;Y.push({fullMatch:X.slice(G,A),tagName:q,attributes:_,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function gY(X){return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function hY(X,$){try{let Z=Buffer.from(X,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=X.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if($?.debug)console.error("Error decoding __stx_ prop:",Z);return X}}var uY=D(()=>{F0();T0();$5()});var nY={};t(nY,{processESImports:()=>pY,processComponents:()=>J8});import Y8 from"fs";import d0 from"path";function d_(X,$,Z){let Y={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(Y6),G=(w)=>{if(!w.includes("-")||w.startsWith("@")||w.startsWith(":")||w.startsWith("x-")||w.startsWith("__"))return w;if(w.startsWith("aria-")||w.startsWith("data-"))return w;return w.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},Q=(w,q)=>{let W=G(w);if(Y.static[W]=q,W!==w)Y.staticNames[W]=w};for(let[w,q]of Object.entries(X)){let W=w.startsWith("x-")&&!J.has(w)&&!w.startsWith("x-bind:")&&!w.startsWith("x-on:")?`:${w.slice(2)}`:w;if(W.startsWith("@")){Y.events[W]=q;continue}if(W.startsWith("__stx_")){let K=G(W.slice(6));Y.serverDynamic[K]=hY(q,Z);continue}if(W.startsWith(":")){let K=G(W.slice(1)),U=q===W5?K:q;if(K==="if"||K==="for"||K==="show"){Y.clientReactive[K]=U;continue}try{if(!q0(U)){if(Z.debug)console.error(`Unsafe expression in :${K} binding: ${U}`);Y.clientReactive[K]=U;continue}let z=Object.keys($),_=W0(U,z)(...Object.values($));if(_===void 0){let j=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((L)=>!H.has(L)&&!z.includes(L))){Y.clientReactive[K]=U;continue}}Y.serverDynamic[K]=_}catch{Y.clientReactive[K]=U}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let K=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(K)try{let U=K[1];if(q0(U)){let B=W0(U,Object.keys($))(...Object.values($));Q(W,B!=null?String(B):"")}else{if(Z.debug)console.error(`Unsafe expression in ${W}: ${U}`);Q(W,q)}}catch(U){if(Z.debug)console.error(`Error evaluating expression for ${W}:`,U);Q(W,q)}else{let U=q,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(q))!==null)try{let _=B[1];if(!q0(_)){if(Z.debug)console.error(`Unsafe expression in ${W}: ${_}`);continue}let H=W0(_,Object.keys($))(...Object.values($));U=U.replace(B[0],String(H??""))}catch(_){if(Z.debug)console.error(`Error evaluating expression in ${W}:`,_)}Q(W,U)}continue}Q(W,q===W5?"true":gY(q))}return Y}function m_(X){let $={},Z=0,Y=X.length;while(Z<Y){while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test(X[Z]))J+=X[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z<Y&&X[Z]==="="){Z++;while(Z<Y&&/\s/.test(X[Z]))Z++;let G="";if(Z<Y&&(X[Z]==='"'||X[Z]==="'")){let Q=X[Z];Z++;while(Z<Y){let w=X[Z];if(w==="\\"&&Z+1<Y){Z++,G+=X[Z],Z++;continue}if(w===Q){Z++;break}G+=w,Z++}}else while(Z<Y&&!/\s/.test(X[Z]))G+=X[Z],Z++;$[J]=G}else $[J]=W5}return $}function mY(X){return Object.entries(X).map(([$,Z])=>Z===W5?$:`${$}="${l_(Z)}"`).join(" ")}function l_(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function c_(X){let $=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1];if(x0.isBuiltin(J))$.add(J)}return[...$].sort()}function p_(X){let $=lY.get(X);if($)return $;let Z=new Map,Y=[d0.join(X,"src"),d0.join(X,"dist"),X];function J(G,Q){if(Q>6)return;let w;try{w=Y8.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of w){let W=d0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(W,Q+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let K=q.name.slice(0,-4);if(!Z.has(K))Z.set(K,W);let U=K.toLowerCase();if(!Z.has(U))Z.set(U,W);let z=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(z))Z.set(z,W)}}}for(let G of Y)if(J(G,0),Z.size>0)break;return lY.set(X,Z),Z}function i_(X,$){if(X.startsWith(".")||X.startsWith("/"))return null;let Z=$;while(!0){let Y=d0.join(Z,"node_modules",X);try{if(Y8.statSync(Y).isDirectory())return Y}catch{}let J=d0.dirname(Z);if(J===Z)return null;Z=J}}async function pY(X,$,Z,Y,J){if(!X.includes("import"))return X;if(!$.__importedComponents)$.__importedComponents=new Map;let G=$.__importedComponents,Q=d0.dirname(Z),w=X,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return w=w.replace(q,(W,K,U)=>{let z=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=U,_,j=[];while((_=z.exec(U))!==null){let[H,O,L,F]=_,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let M=d0.resolve(Q,F);if(M.endsWith(".stx"))A=M;else{let k=`${M}.stx`;try{if(Y8.statSync(k).isFile())A=k}catch{try{if(Y8.statSync(M).isDirectory())V=M}catch{}}}}else V=i_(F,Q);if(!V&&!A)continue;let R=!1,T=(M,k)=>{G.set(M,k),G.set(M.toLowerCase(),k);let N=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(N,k),J.add(k)};if(L&&A)T(L,A),R=!0;else if(O){let M=O.slice(1,-1).split(",").map((N)=>N.trim()).filter(Boolean).map((N)=>{let y=N.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y)return{source:y[1],local:y[2]};return{source:N,local:N}}),k=V?p_(V):null;for(let{source:N,local:y}of M){let I=null;if(A)I=A;else if(k)I=k.get(N)??k.get(N.toLowerCase())??k.get(N.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)T(y,I),R=!0}}if(R)j.push({start:_.index,end:_.index+H.length})}if(j.length===0)return W;for(let H=j.length-1;H>=0;H--)B=B.slice(0,j[H].start)+B.slice(j[H].end);return`<script${K}>${B}</script>`}),w}async function n_(X,$,Z,Y,J){let G=X;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,w=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=w.exec(G))!==null){let[W,K]=q,U=K.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of U){let B=z.split("/"),j=B[B.length-1].replace(/\.stx$/,""),H=j.includes("-")?j.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):j.charAt(0).toUpperCase()+j.slice(1),O=null,L=[d0.resolve(d0.dirname(Z),`${z}.stx`),d0.resolve(d0.dirname(Z),z),d0.resolve(Y.componentsDir||"components",`${z}.stx`),d0.resolve(Y.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){O=F;break}}catch{}if(O){Q.set(H,O),Q.set(j,O),Q.set(j.toLowerCase(),O);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,O),J.add(O),Y.debug)console.log(`Imported component: ${H} -> ${O}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${z}`)}G=G.replace(W,""),w.lastIndex=0}return G}async function r_(X,$,Z,Y,J){let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(G))!==null){let K=W.index,U=K+W[0].length-1,z=1,B=U+1;while(B<G.length&&z>0){if(G[B]==="(")z++;else if(G[B]===")"){if(z--,z===0)break}B++}if(z!==0)break;let _=G.substring(U+1,B),j=B+1,H=_.match(/^\s*['"]([^'"]+)['"]/);if(!H){q.lastIndex=0;continue}let O=H[1],L,F=_.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)L=F.slice(V[0].length).trim();let A={};if(L)try{A=O0(L,$)}catch(y){let I=y instanceof Error?y.message:String(y);G=G.replace(G.substring(K,j),`[Error parsing component props: ${I}]`);continue}let R="",T=j,k=G.substring(j).match(/^([\s\S]*?)@endcomponent/);if(k)R=k[1].trim(),T=j+k[0].length;let N=await K5(O,A,R,Q,$,Z,Y,w,J);G=G.substring(0,K)+N+G.substring(T),q.lastIndex=0}return G}async function s_(X,$,Z,Y,J){if(!X)return X;let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,q=y1(G);return G=q.output,G=await z(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await z(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await z(G,/[a-z][a-z0-9]*/,!1,u_),G=D7(G,q.scripts),G;async function z(B,_,j,H){if(!B)return B;let O=B,L=fY(O,_,H);for(let F=L.length-1;F>=0;F--){let V=L[F],A=j?$8(V.tagName):V.tagName,R=m_(V.attributes),T=d_(R,$,Y),M=x0.getBuiltin(V.tagName),k=M?await Z8(A,Q,$,Z,Y):!1;if(M&&!k){let C={context:$,filePath:Z,options:Y,dependencies:J},S=M.render(T,V.content,C);if(Object.keys(T.clientReactive).length>0)S=cY(S,T.clientReactive);if(Object.keys(T.events).length>0){let b=mY(T.events);S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}O=O.substring(0,V.startIndex)+S+O.substring(V.endIndex);continue}if(!j&&V.tagName.includes("-")&&!await Z8(A,Q,$,Z,Y))continue;let N={};for(let[C,S]of Object.entries(T.static))N[C]=S;for(let[C,S]of Object.entries(T.serverDynamic))N[C]=S;let I=await K5(A,N,V.content,Q,$,Z,Y,w,J);if(Object.keys(T.clientReactive).length>0)I=cY(I,T.clientReactive);if(Object.keys(T.events).length>0){let C=iY(I);if(C){let S=mY(T.events),b=Object.keys(T.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,C.insertPos)+` data-stx-parent-events="${b}" ${S}`+I.substring(C.insertPos)}}O=O.substring(0,V.startIndex)+I+O.substring(V.endIndex)}return O}}function cY(X,$){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries($).filter(([K])=>!Z.has(K)),G=J.filter(([K])=>!Y.has(K)).map(([K])=>$8(K)).join(" "),Q=X,w=J.length>0?iY(Q):null;if(w){let K=J.map(([z,B])=>`:${$8(z)}="${B.replace(/"/g,"&quot;")}"`).join(" "),U=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,w.insertPos)+`${U} ${K}`+Q.substring(w.insertPos)}let q=$.if;if(q)Q=`<template :if="${q.replace(/"/g,"&quot;")}">${Q}</template>`;let W=$.for;if(W)Q=`<template :for="${W.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function iY(X){let $=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(X);if($)return{insertPos:$.index+1+$[1].length};let Z=0;while(Z<X.length){let Y=X.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let w=X.indexOf("-->",Z+4);if(w===-1)return null;Z=w+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let w=`</${G[1].toLowerCase()}>`,q=X.toLowerCase().indexOf(w,Z+G[0].length);if(q===-1)return null;Z=q+w.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function J8(X,$,Z,Y,J){if(!dY)vY(),dY=!0;let G=await pY(X,$,Z,Y,J);G=await n_(G,$,Z,Y,J),G=await r_(G,$,Z,Y,J);let Q=[];for(let w=0;w<3;w++){let q=Q1(G,E7,(K,U)=>`\x00STX_COMPONENT_COMMENT_${Q.length+U}\x00`);Q.push(...q.tokens);let W=G;if(G=await s_(q.output,$,Z,Y,J),G===W)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,q)=>Q[Number(q)]??"");if(Y.debug){let w=c_(G);if(w.length>0)console.warn(`[stx] ${Z}: unresolved component tag(s) after render passes: ${w.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return G}var dY=!1,u_,lY;var K3=D(()=>{h9();xY();uY();$5();T0();F0();G1();u_=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);lY=new Map});var G8={};t(G8,{stripTypeScript:()=>XJ,splitDeclaration:()=>QJ,isModuleResolutionFailure:()=>$J,isMissingBindingFailure:()=>ZJ,isCompleteImport:()=>YJ,hasVariables:()=>KJ,extractVariables:()=>V1,extractScriptFromTemplate:()=>WJ,convertToCommonJS:()=>_3,STX_ENGINE_BINDING_NAMES:()=>z3});import f1 from"path";import c5 from"process";function a_(X){let $=[],Z=0,Y=X.split(`
3592
- `);for(let J of Y){let G=Z,Q=null,w=!1;for(let q=0;q<J.length;q++){let W=J[q];if(w){w=!1;continue}if(W==="\\"){w=!0;continue}if(Q){if(W===Q)Q=null;continue}if(W==="'"||W==='"'||W==="`"){Q=W;continue}if(W==="/"&&q+1<J.length&&J[q+1]==="/")break;if(W==="{")Z++;else if(W==="}")Z--}if(G===0){let q=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)$.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let W=J.match(/(?:const|let|var)\s+(\w+)/);if(W)$.push(W[1])}else{let W=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let U=W[1].slice(1,-1).split(",").map((z)=>{let B=z.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((z)=>/^\w+$/.test(z));$.push(...U)}}}}return[...new Set($)]}function XJ(X){let $=X;$=$.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),$=$.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),$=$.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(Y){if(!Y.includes(":"))return Y;let J=[],G="",Q=0,w=0,q=null;for(let W=0;W<Y.length;W++){let K=Y[W];if(q){if(G+=K,K===q)q=null;continue}if(K==='"'||K==="'"||K==="`"){q=K,G+=K;continue}if(K==="<")Q++;else if(K===">"&&Q>0)Q--;else if(K==="(")w++;else if(K===")")w--;if(K===","&&Q===0&&w===0){J.push(G),G="";continue}G+=K}if(G)J.push(G);return J.map((W)=>{let K=W.trim(),U=K.startsWith("..."),z=U?K.slice(3):K,B=-1,_=0;for(let A=0;A<z.length;A++)if(z[A]==="<")_++;else if(z[A]===">")_--;else if(z[A]===":"&&_===0){B=A;break}if(B===-1)return W;let H=z.substring(0,B).trim().replace(/\?$/,""),O=z.substring(B+1),L=-1,F=0;for(let A=0;A<O.length;A++)if(O[A]==="<")F++;else if(O[A]===">")F--;else if(O[A]==="="&&F===0){L=A;break}let V=U?"...":"";if(L!==-1)return`${V}${H} = ${O.substring(L+1).trim()}`;return`${V}${H}`}).join(", ")}$=$.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;return`${J}(${Z(G)})`});{let Y=/\b(function\s+\w*\s*)\(/g,J,G=[];while((J=Y.exec($))!==null){let Q=J.index+J[0].length-1,w=1,q=Q+1,W=0,K=null;while(q<$.length&&w>0){let B=$[q];if(K){if(B===K)K=null;q++;continue}if(B==='"'||B==="'"||B==="`"){K=B,q++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")w++;else if(B===")")w--}if(w>0)q++}if(w!==0)continue;let U=$.substring(Q+1,q);if(!U.includes(":"))continue;let z=Z(U);G.push({start:Q+1,end:q,replacement:z})}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];$=$.substring(0,w)+W+$.substring(q)}}return $=$.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((Q)=>{let[w,...q]=Q.split("="),W=w.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),$=$.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),$=$.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),$=$.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),$=$.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),$=$.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),$=$.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),$=$.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),$=$.replace(/\n\s*\n\s*\n/g,`
3590
+ </style>`}}});import{existsSync as i_,readFileSync as n_}from"fs";function r_(X){if(hY.has(X))return;hY.add(X),console.warn(`[stx] icon collection "${X}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${X}\`.`)}function s_(X){let $=process.cwd();for(let Z of[`${$}/node_modules/@iconify-json/${X}/icons.json`,`${$}/pantry/@iconify-json/${X}/icons.json`,`${$}/node_modules/@iconify/json/json/${X}.json`,`${$}/pantry/@iconify/json/json/${X}.json`])if(i_(Z))return Z;for(let Z of[`@iconify-json/${X}/icons.json`,`@iconify/json/json/${X}.json`])try{return X0.resolve(Z)}catch{}return null}function o_(X){if(X8.has(X))return X8.get(X);let $=s_(X);if(!$)return r_(X),null;try{let Z=JSON.parse(n_($,"utf8"));return X8.set(X,Z.icons),Z.icons}catch{return null}}function c5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);if(X.static[$]!==void 0)return String(X.static[$]);if(X.clientReactive[$]!==void 0)return X.clientReactive[$];return}var X8,hY,J3;var G3=D(()=>{X8=new Map,hY=new Set;J3={name:"Icon",aliases:["icon","stx-icon"],render(X,$,Z){let Y=c5(X,"name")??c5(X,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let J="lucide",G=Y;if(Y.includes(":")){let L=Y.split(":");J=L[0],G=L[1]}let Q=k0(c5(X,"size")||"24"),w=k0(c5(X,"color")||"currentColor"),q=k0(c5(X,"class")||""),W=k0(c5(X,"style")||""),U=X8.get(J)??o_(J);if(!U)return`<!-- Icon: collection "${J}" not loaded -->`;let K=U[G];if(!K)return`<!-- Icon: "${G}" not found in ${J} -->`;let z=K.width||24,B=K.height||24,_=`0 0 ${z} ${B}`,j=K.body;if(w!=="currentColor")j=j.replace(/currentColor/g,w);let H=q?` class="${q}"`:"",O=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${_}" fill="none"${H}${O}>${j}</svg>`}}});function uY(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}function dY(X,$){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${$}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=X.match(Z);if(!Y)return{region:null,rest:X};return{region:Y[2],rest:X.replace(Y[0],"")}}var Q3;var w3=D(()=>{Q3={name:"Suspense",aliases:["suspense"],render(X,$,Z){let Y=dY($,"fallback"),J=Y.rest,G=dY(J,"error"),Q=G.rest,w=Y.region??uY(X,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=G.region??uY(X,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${w}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function $8(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}var q3;var W3=D(()=>{q3={name:"TransitionGroup",aliases:["transition-group"],render(X,$,Z){let Y=($8(X,"name")||"v").replace(/["'<>]/g,""),J=($8(X,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=$8(X,"class"),Q=$8(X,"id"),w=[`data-stx-transition-group="${Y}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${J} ${w}>${$}</${J}>`}}});function mY(){x0.registerBuiltin(u9),x0.registerBuiltin(p9),x0.registerBuiltin(n9),x0.registerBuiltin(o9),x0.registerBuiltin(t9),x0.registerBuiltin(X3),x0.registerBuiltin(Z3),x0.registerBuiltin(J3),x0.registerBuiltin(Q3),x0.registerBuiltin(q3)}var lY=D(()=>{d9();i9();r9();a9();e9();$3();Y3();G3();w3();W3();h9();d9();i9();r9();a9();e9();$3();Y3();G3();w3();W3()});function Z8(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function cY(X,$,Z){let Y=[],J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;let w=X.slice(G+1).match(new RegExp(`^(${$.source})(?![\\w.:-])`));if(!w){J=G+1;continue}let q=w[1];if(Z&&Z.has(q.toLowerCase())){let j=G+1+q.length;while(j<X.length&&X[j]!==">")j++;J=j+1;continue}let W=G+1+q.length,U=null,K=W,z=-1,B=!1;while(W<X.length){let j=X[W];if(U){if(j==="\\"&&W+1<X.length){W+=2;continue}if(j===U)U=null;W++;continue}if(j==='"'||j==="'"){U=j,W++;continue}if(j==="/"&&W+1<X.length&&X[W+1]===">"){z=W+2,B=!0;break}if(j===">"){z=W+1;break}W++}if(z===-1){J=G+1;continue}let _=X.slice(K,B?z-2:z-1).trim();if(B)Y.push({fullMatch:X.slice(G,z),tagName:q,attributes:_,content:"",startIndex:G,endIndex:z,isSelfClosing:!0}),J=z;else{let j=`<${q}`,H=`</${q}>`,O=1,L=z,F=-1;while(O>0&&L<X.length){let R=X.indexOf(j,L),T=X.indexOf(H,L);if(T===-1)break;if(R!==-1&&R<T){let M=X[R+j.length];if(M===" "||M===">"||M==="/"||M===`
3591
+ `||M==="\t")O++;L=R+j.length}else{if(O--,O===0){F=T;break}L=T+H.length}}if(F===-1){J=z;continue}let V=X.slice(z,F),A=F+H.length;Y.push({fullMatch:X.slice(G,A),tagName:q,attributes:_,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function pY(X){return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function iY(X,$){try{let Z=Buffer.from(X,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=X.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if($?.debug)console.error("Error decoding __stx_ prop:",Z);return X}}var nY=D(()=>{F0();T0();$5()});var XJ={};t(XJ,{processESImports:()=>tY,processComponents:()=>G8});import J8 from"fs";import d0 from"path";function t_(X,$,Z){let Y={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(U6),G=(w)=>{if(!w.includes("-")||w.startsWith("@")||w.startsWith(":")||w.startsWith("x-")||w.startsWith("__"))return w;if(w.startsWith("aria-")||w.startsWith("data-"))return w;return w.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},Q=(w,q)=>{let W=G(w);if(Y.static[W]=q,W!==w)Y.staticNames[W]=w};for(let[w,q]of Object.entries(X)){let W=w.startsWith("x-")&&!J.has(w)&&!w.startsWith("x-bind:")&&!w.startsWith("x-on:")?`:${w.slice(2)}`:w;if(W.startsWith("@")){Y.events[W]=q;continue}if(W.startsWith("__stx_")){let U=G(W.slice(6));Y.serverDynamic[U]=iY(q,Z);continue}if(W.startsWith(":")){let U=G(W.slice(1)),K=q===W5?U:q;if(U==="if"||U==="for"||U==="show"){Y.clientReactive[U]=K;continue}try{if(!q0(K)){if(Z.debug)console.error(`Unsafe expression in :${U} binding: ${K}`);Y.clientReactive[U]=K;continue}let z=Object.keys($),_=W0(K,z)(...Object.values($));if(_===void 0){let j=K.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((L)=>!H.has(L)&&!z.includes(L))){Y.clientReactive[U]=K;continue}}Y.serverDynamic[U]=_}catch{Y.clientReactive[U]=K}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let U=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let K=U[1];if(q0(K)){let B=W0(K,Object.keys($))(...Object.values($));Q(W,B!=null?String(B):"")}else{if(Z.debug)console.error(`Unsafe expression in ${W}: ${K}`);Q(W,q)}}catch(K){if(Z.debug)console.error(`Error evaluating expression for ${W}:`,K);Q(W,q)}else{let K=q,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(q))!==null)try{let _=B[1];if(!q0(_)){if(Z.debug)console.error(`Unsafe expression in ${W}: ${_}`);continue}let H=W0(_,Object.keys($))(...Object.values($));K=K.replace(B[0],String(H??""))}catch(_){if(Z.debug)console.error(`Error evaluating expression in ${W}:`,_)}Q(W,K)}continue}Q(W,q===W5?"true":pY(q))}return Y}function e_(X){let $={},Z=0,Y=X.length;while(Z<Y){while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test(X[Z]))J+=X[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z<Y&&X[Z]==="="){Z++;while(Z<Y&&/\s/.test(X[Z]))Z++;let G="";if(Z<Y&&(X[Z]==='"'||X[Z]==="'")){let Q=X[Z];Z++;while(Z<Y){let w=X[Z];if(w==="\\"&&Z+1<Y){Z++,G+=X[Z],Z++;continue}if(w===Q){Z++;break}G+=w,Z++}}else while(Z<Y&&!/\s/.test(X[Z]))G+=X[Z],Z++;$[J]=G}else $[J]=W5}return $}function sY(X){return Object.entries(X).map(([$,Z])=>Z===W5?$:`${$}="${XB(Z)}"`).join(" ")}function XB(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $B(X){let $=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1];if(x0.isBuiltin(J))$.add(J)}return[...$].sort()}function ZB(X){let $=oY.get(X);if($)return $;let Z=new Map,Y=[d0.join(X,"src"),d0.join(X,"dist"),X];function J(G,Q){if(Q>6)return;let w;try{w=J8.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of w){let W=d0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(W,Q+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Z.has(U))Z.set(U,W);let K=U.toLowerCase();if(!Z.has(K))Z.set(K,W);let z=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(z))Z.set(z,W)}}}for(let G of Y)if(J(G,0),Z.size>0)break;return oY.set(X,Z),Z}function YB(X,$){if(X.startsWith(".")||X.startsWith("/"))return null;let Z=$;while(!0){let Y=d0.join(Z,"node_modules",X);try{if(J8.statSync(Y).isDirectory())return Y}catch{}let J=d0.dirname(Z);if(J===Z)return null;Z=J}}async function tY(X,$,Z,Y,J){if(!X.includes("import"))return X;if(!$.__importedComponents)$.__importedComponents=new Map;let G=$.__importedComponents,Q=d0.dirname(Z),w=X,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return w=w.replace(q,(W,U,K)=>{let z=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=K,_,j=[];while((_=z.exec(K))!==null){let[H,O,L,F]=_,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let M=d0.resolve(Q,F);if(M.endsWith(".stx"))A=M;else{let k=`${M}.stx`;try{if(J8.statSync(k).isFile())A=k}catch{try{if(J8.statSync(M).isDirectory())V=M}catch{}}}}else V=YB(F,Q);if(!V&&!A)continue;let R=!1,T=(M,k)=>{G.set(M,k),G.set(M.toLowerCase(),k);let N=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(N,k),J.add(k)};if(L&&A)T(L,A),R=!0;else if(O){let M=O.slice(1,-1).split(",").map((N)=>N.trim()).filter(Boolean).map((N)=>{let y=N.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y)return{source:y[1],local:y[2]};return{source:N,local:N}}),k=V?ZB(V):null;for(let{source:N,local:y}of M){let I=null;if(A)I=A;else if(k)I=k.get(N)??k.get(N.toLowerCase())??k.get(N.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)T(y,I),R=!0}}if(R)j.push({start:_.index,end:_.index+H.length})}if(j.length===0)return W;for(let H=j.length-1;H>=0;H--)B=B.slice(0,j[H].start)+B.slice(j[H].end);return`<script${U}>${B}</script>`}),w}async function JB(X,$,Z,Y,J){let G=X;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,w=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=w.exec(G))!==null){let[W,U]=q,K=U.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of K){let B=z.split("/"),j=B[B.length-1].replace(/\.stx$/,""),H=j.includes("-")?j.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):j.charAt(0).toUpperCase()+j.slice(1),O=null,L=[d0.resolve(d0.dirname(Z),`${z}.stx`),d0.resolve(d0.dirname(Z),z),d0.resolve(Y.componentsDir||"components",`${z}.stx`),d0.resolve(Y.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){O=F;break}}catch{}if(O){Q.set(H,O),Q.set(j,O),Q.set(j.toLowerCase(),O);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,O),J.add(O),Y.debug)console.log(`Imported component: ${H} -> ${O}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${z}`)}G=G.replace(W,""),w.lastIndex=0}return G}async function GB(X,$,Z,Y,J){let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(G))!==null){let U=W.index,K=U+W[0].length-1,z=1,B=K+1;while(B<G.length&&z>0){if(G[B]==="(")z++;else if(G[B]===")"){if(z--,z===0)break}B++}if(z!==0)break;let _=G.substring(K+1,B),j=B+1,H=_.match(/^\s*['"]([^'"]+)['"]/);if(!H){q.lastIndex=0;continue}let O=H[1],L,F=_.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)L=F.slice(V[0].length).trim();let A={};if(L)try{A=O0(L,$)}catch(y){let I=y instanceof Error?y.message:String(y);G=G.replace(G.substring(U,j),`[Error parsing component props: ${I}]`);continue}let R="",T=j,k=G.substring(j).match(/^([\s\S]*?)@endcomponent/);if(k)R=k[1].trim(),T=j+k[0].length;let N=await U5(O,A,R,Q,$,Z,Y,w,J);G=G.substring(0,U)+N+G.substring(T),q.lastIndex=0}return G}async function QB(X,$,Z,Y,J){if(!X)return X;let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let w=$.__processedComponents,q=y1(G);return G=q.output,G=await z(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await z(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await z(G,/[a-z][a-z0-9]*/,!1,a_),G=y7(G,q.scripts),G;async function z(B,_,j,H){if(!B)return B;let O=B,L=cY(O,_,H);for(let F=L.length-1;F>=0;F--){let V=L[F],A=j?Z8(V.tagName):V.tagName,R=e_(V.attributes),T=t_(R,$,Y),M=x0.getBuiltin(V.tagName),k=M?await Y8(A,Q,$,Z,Y):!1;if(M&&!k){let C={context:$,filePath:Z,options:Y,dependencies:J},S=M.render(T,V.content,C);if(Object.keys(T.clientReactive).length>0)S=aY(S,T.clientReactive);if(Object.keys(T.events).length>0){let b=sY(T.events);S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}O=O.substring(0,V.startIndex)+S+O.substring(V.endIndex);continue}if(!j&&V.tagName.includes("-")&&!await Y8(A,Q,$,Z,Y))continue;let N={};for(let[C,S]of Object.entries(T.static))N[C]=S;for(let[C,S]of Object.entries(T.serverDynamic))N[C]=S;let I=await U5(A,N,V.content,Q,$,Z,Y,w,J);if(Object.keys(T.clientReactive).length>0)I=aY(I,T.clientReactive);if(Object.keys(T.events).length>0){let C=eY(I);if(C){let S=sY(T.events),b=Object.keys(T.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,C.insertPos)+` data-stx-parent-events="${b}" ${S}`+I.substring(C.insertPos)}}O=O.substring(0,V.startIndex)+I+O.substring(V.endIndex)}return O}}function aY(X,$){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries($).filter(([U])=>!Z.has(U)),G=J.filter(([U])=>!Y.has(U)).map(([U])=>Z8(U)).join(" "),Q=X,w=J.length>0?eY(Q):null;if(w){let U=J.map(([z,B])=>`:${Z8(z)}="${B.replace(/"/g,"&quot;")}"`).join(" "),K=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,w.insertPos)+`${K} ${U}`+Q.substring(w.insertPos)}let q=$.if;if(q)Q=`<template :if="${q.replace(/"/g,"&quot;")}">${Q}</template>`;let W=$.for;if(W)Q=`<template :for="${W.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function eY(X){let $=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(X);if($)return{insertPos:$.index+1+$[1].length};let Z=0;while(Z<X.length){let Y=X.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let w=X.indexOf("-->",Z+4);if(w===-1)return null;Z=w+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let w=`</${G[1].toLowerCase()}>`,q=X.toLowerCase().indexOf(w,Z+G[0].length);if(q===-1)return null;Z=q+w.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function G8(X,$,Z,Y,J){if(!rY)mY(),rY=!0;let G=await tY(X,$,Z,Y,J);G=await JB(G,$,Z,Y,J),G=await GB(G,$,Z,Y,J);let Q=[];for(let w=0;w<3;w++){let q=G1(G,D7,(U,K)=>`\x00STX_COMPONENT_COMMENT_${Q.length+K}\x00`);Q.push(...q.tokens);let W=G;if(G=await QB(q.output,$,Z,Y,J),G===W)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,q)=>Q[Number(q)]??"");if(Y.debug){let w=$B(G);if(w.length>0)console.warn(`[stx] ${Z}: unresolved component tag(s) after render passes: ${w.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return G}var rY=!1,a_,oY;var U3=D(()=>{h9();lY();nY();$5();T0();F0();J1();a_=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);oY=new Map});var Q8={};t(Q8,{stripTypeScript:()=>wJ,splitDeclaration:()=>_J,isModuleResolutionFailure:()=>qJ,isMissingBindingFailure:()=>WJ,isCompleteImport:()=>UJ,hasVariables:()=>LJ,extractVariables:()=>F1,extractScriptFromTemplate:()=>HJ,convertToCommonJS:()=>_3,STX_ENGINE_BINDING_NAMES:()=>z3});import f1 from"path";import p5 from"process";function qB(X){let $=[],Z=0,Y=X.split(`
3592
+ `);for(let J of Y){let G=Z,Q=null,w=!1;for(let q=0;q<J.length;q++){let W=J[q];if(w){w=!1;continue}if(W==="\\"){w=!0;continue}if(Q){if(W===Q)Q=null;continue}if(W==="'"||W==='"'||W==="`"){Q=W;continue}if(W==="/"&&q+1<J.length&&J[q+1]==="/")break;if(W==="{")Z++;else if(W==="}")Z--}if(G===0){let q=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)$.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let W=J.match(/(?:const|let|var)\s+(\w+)/);if(W)$.push(W[1])}else{let W=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let K=W[1].slice(1,-1).split(",").map((z)=>{let B=z.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((z)=>/^\w+$/.test(z));$.push(...K)}}}}return[...new Set($)]}function wJ(X){let $=X;$=$.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),$=$.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),$=$.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(Y){if(!Y.includes(":"))return Y;let J=[],G="",Q=0,w=0,q=null;for(let W=0;W<Y.length;W++){let U=Y[W];if(q){if(G+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,G+=U;continue}if(U==="<")Q++;else if(U===">"&&Q>0)Q--;else if(U==="(")w++;else if(U===")")w--;if(U===","&&Q===0&&w===0){J.push(G),G="";continue}G+=U}if(G)J.push(G);return J.map((W)=>{let U=W.trim(),K=U.startsWith("..."),z=K?U.slice(3):U,B=-1,_=0;for(let A=0;A<z.length;A++)if(z[A]==="<")_++;else if(z[A]===">")_--;else if(z[A]===":"&&_===0){B=A;break}if(B===-1)return W;let H=z.substring(0,B).trim().replace(/\?$/,""),O=z.substring(B+1),L=-1,F=0;for(let A=0;A<O.length;A++)if(O[A]==="<")F++;else if(O[A]===">")F--;else if(O[A]==="="&&F===0){L=A;break}let V=K?"...":"";if(L!==-1)return`${V}${H} = ${O.substring(L+1).trim()}`;return`${V}${H}`}).join(", ")}$=$.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;return`${J}(${Z(G)})`});{let Y=/\b(function\s+\w*\s*)\(/g,J,G=[];while((J=Y.exec($))!==null){let Q=J.index+J[0].length-1,w=1,q=Q+1,W=0,U=null;while(q<$.length&&w>0){let B=$[q];if(U){if(B===U)U=null;q++;continue}if(B==='"'||B==="'"||B==="`"){U=B,q++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")w++;else if(B===")")w--}if(w>0)q++}if(w!==0)continue;let K=$.substring(Q+1,q);if(!K.includes(":"))continue;let z=Z(K);G.push({start:Q+1,end:q,replacement:z})}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];$=$.substring(0,w)+W+$.substring(q)}}return $=$.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((Q)=>{let[w,...q]=Q.split("="),W=w.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),$=$.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),$=$.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),$=$.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),$=$.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),$=$.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),$=$.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),$=$.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),$=$.replace(/\n\s*\n\s*\n/g,`
3593
3593
 
3594
- `),$}function $J(X){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(X)}function ZJ(X){if(!/is not defined|can't find variable/i.test(X))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(X)}async function V1(X,$,Z,Y={}){if(!X.trim())return;let J;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}),v=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=E.transformSync(v)}catch{J=XJ(X)}let G={exports:{}},Q=G.exports,w=c5.cwd(),q={},W=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((E)=>E[1]).filter((E)=>!E.startsWith("node:")&&!E.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(E));for(let E of W)try{let v=f1.resolve(w,"node_modules",E),d=f1.join(v,"package.json"),f=JSON.parse(X0("fs").readFileSync(d,"utf8")),s=f.main||"index.js";if(f.exports){let G0=typeof f.exports==="string"?f.exports:f.exports["."];if(typeof G0==="string")s=G0;else if(G0?.bun)s=G0.bun;else if(G0?.import)s=G0.import;else if(G0?.default)s=G0.default}q[E]=await import(f1.resolve(v,s))}catch{}let K=(E)=>{if(q[E])return q[E];return X0(E)},U=$.props||{},z=(E)=>{if(!E)return U;let v={};for(let[d,f]of Object.entries(E)){let s=U[d];if(s!==void 0)v[d]=s;else if(typeof f==="function")v[d]=f();else v[d]=f}return v};for(let[E,v]of Object.entries(U))Object.defineProperty(z,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,E))continue;try{Object.defineProperty(z,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(E)=>{if(!E)return U;let v={...U};for(let[d,f]of Object.entries(E)){let s=f&&typeof f==="object"&&!Array.isArray(f)?f:{type:f};if(v[d]===void 0&&s.default!==void 0)v[d]=typeof s.default==="function"?s.default():s.default}return v},_=()=>$.slots||{},j=(E,v)=>{let d={...E};for(let[f,s]of Object.entries(v))if(d[f]===void 0)if(typeof s==="function")d[f]=s();else d[f]=s;return d},H=(E)=>{let v=()=>E;return v.set=(d)=>{},v.update=(d)=>{},v},O=(E)=>{let v,d=!1;return()=>{if(!d)try{v=E(),d=!0}catch{v=void 0}return v}},L=(E)=>{},F=(E)=>E(),V=(E)=>{},A=(E)=>{};function R(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)y({title:v.title,description:v.description})}function T(E){if(!E||typeof E!=="object")return;let v=$.__stxClientPayload??{};Object.assign(v,E),$.__stxClientPayload=v}let M=()=>{let E=$.__stxServeContext,v=$.__stxServeSearch??E?.search??"",d=E?.path??"",f=Object.fromEntries(new URLSearchParams(v)),s=$.query,G0=Object.keys(f).length>0?f:s??{},o0=v||(Object.keys(G0).length>0?`?${new URLSearchParams(G0).toString()}`:"");return{params:$.params??{},query:G0,path:d,name:"",fullPath:d+o0,hash:"",matched:[]}},k=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),N=(E)=>{let v=$.__stx_runtime_head||{};$.__stx_runtime_head=x5(v,E||{})},y=(E)=>{N(cX(E||{}))},I=(E)=>({value:E}),C=(E)=>E,S=(E)=>({value:typeof E==="function"?E():E}),b=(E,v)=>{},P=(E)=>{},x=(E)=>{},m=(E)=>E?E():Promise.resolve(),l=(E)=>(v,...d)=>{},Q0=(E)=>{},c0=(E,v)=>{},R0=(E,v)=>v,s0=()=>({value:"light"}),c=()=>H(!1),j0=(E)=>H(!1),p0=()=>H(!1),M1=()=>j0("(prefers-color-scheme: dark)"),L5=()=>j0("(prefers-color-scheme: light)"),O5=()=>j0("(prefers-reduced-motion: reduce)"),r=()=>j0("(prefers-contrast: more)"),a={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},K0=new Proxy(a,{get(E,v){if(v in E)return E[v];return},set(E,v,d){return E[v]=d,!0}}),M0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},w0=console;try{let E=_3(J,Z),v=new Set(Object.keys(U)),d=(n)=>/^[a-z_$][\w$]*$/i.test(n),f=Object.keys($).filter((n)=>!v.has(n)&&n!=="props"&&d(n)),s=f.map((n)=>$[n]);if(!f.includes("__stxServeContext"))f.push("__stxServeContext"),s.push(void 0);let G0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),o0=[],S0=[];for(let[n,J1]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n))continue;if(G0.has(n))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${n}\\b`).test(E))continue;o0.push(n),S0.push(J1)}let a0=a_(E).map((n)=>`module.exports.${n} = typeof ${n} !== 'undefined' ? ${n} : module.exports.${n};`).join(`
3595
- `),F5=$.params??{},N1=[],k1=[];for(let n=0;n<f.length;n++){if(f[n]==="params")continue;N1.push(f[n]),k1.push(s[n])}let Y1=await Function(...z3,...o0,...N1,`return (async () => {
3594
+ `),$}function qJ(X){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(X)}function WJ(X){if(!/is not defined|can't find variable/i.test(X))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(X)}async function F1(X,$,Z,Y={}){if(!X.trim())return;let J;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}),v=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=E.transformSync(v)}catch{J=wJ(X)}let G={exports:{}},Q=G.exports,w=p5.cwd(),q={},W=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((E)=>E[1]).filter((E)=>!E.startsWith("node:")&&!E.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(E));for(let E of W)try{let v=f1.resolve(w,"node_modules",E),d=f1.join(v,"package.json"),f=JSON.parse(X0("fs").readFileSync(d,"utf8")),s=f.main||"index.js";if(f.exports){let G0=typeof f.exports==="string"?f.exports:f.exports["."];if(typeof G0==="string")s=G0;else if(G0?.bun)s=G0.bun;else if(G0?.import)s=G0.import;else if(G0?.default)s=G0.default}q[E]=await import(f1.resolve(v,s))}catch{}let U=(E)=>{if(q[E])return q[E];return X0(E)},K=$.props||{},z=(E)=>{if(!E)return K;let v={};for(let[d,f]of Object.entries(E)){let s=K[d];if(s!==void 0)v[d]=s;else if(typeof f==="function")v[d]=f();else v[d]=f}return v};for(let[E,v]of Object.entries(K))Object.defineProperty(z,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(K,E))continue;try{Object.defineProperty(z,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(E)=>{if(!E)return K;let v={...K};for(let[d,f]of Object.entries(E)){let s=f&&typeof f==="object"&&!Array.isArray(f)?f:{type:f};if(v[d]===void 0&&s.default!==void 0)v[d]=typeof s.default==="function"?s.default():s.default}return v},_=()=>$.slots||{},j=(E,v)=>{let d={...E};for(let[f,s]of Object.entries(v))if(d[f]===void 0)if(typeof s==="function")d[f]=s();else d[f]=s;return d},H=(E)=>{let v=()=>E;return v.set=(d)=>{},v.update=(d)=>{},v},O=(E)=>{let v,d=!1;return()=>{if(!d)try{v=E(),d=!0}catch{v=void 0}return v}},L=(E)=>{},F=(E)=>E(),V=(E)=>{},A=(E)=>{};function R(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)y({title:v.title,description:v.description})}function T(E){if(!E||typeof E!=="object")return;let v=$.__stxClientPayload??{};Object.assign(v,E),$.__stxClientPayload=v}let M=()=>{let E=$.__stxServeContext,v=$.__stxServeSearch??E?.search??"",d=E?.path??"",f=Object.fromEntries(new URLSearchParams(v)),s=$.query,G0=Object.keys(f).length>0?f:s??{},s0=v||(Object.keys(G0).length>0?`?${new URLSearchParams(G0).toString()}`:"");return{params:$.params??{},query:G0,path:d,name:"",fullPath:d+s0,hash:"",matched:[]}},k=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),N=(E)=>{let v=$.__stx_runtime_head||{};$.__stx_runtime_head=f5(v,E||{})},y=(E)=>{N(pX(E||{}))},I=(E)=>({value:E}),C=(E)=>E,S=(E)=>({value:typeof E==="function"?E():E}),b=(E,v)=>{},P=(E)=>{},x=(E)=>{},m=(E)=>E?E():Promise.resolve(),l=(E)=>(v,...d)=>{},Q0=(E)=>{},l0=(E,v)=>{},R0=(E,v)=>v,r0=()=>({value:"light"}),c=()=>H(!1),j0=(E)=>H(!1),c0=()=>H(!1),T1=()=>j0("(prefers-color-scheme: dark)"),O5=()=>j0("(prefers-color-scheme: light)"),F5=()=>j0("(prefers-reduced-motion: reduce)"),r=()=>j0("(prefers-contrast: more)"),a={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},U0=new Proxy(a,{get(E,v){if(v in E)return E[v];return},set(E,v,d){return E[v]=d,!0}}),M0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},w0=console;try{let E=_3(J,Z),v=new Set(Object.keys(K)),d=(n)=>/^[a-z_$][\w$]*$/i.test(n),f=Object.keys($).filter((n)=>!v.has(n)&&n!=="props"&&d(n)),s=f.map((n)=>$[n]);if(!f.includes("__stxServeContext"))f.push("__stxServeContext"),s.push(void 0);let G0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),s0=[],S0=[];for(let[n,Y1]of Object.entries(K)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(n))continue;if(G0.has(n))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${n}\\b`).test(E))continue;s0.push(n),S0.push(Y1)}let o0=qB(E).map((n)=>`module.exports.${n} = typeof ${n} !== 'undefined' ? ${n} : module.exports.${n};`).join(`
3595
+ `),V5=$.params??{},M1=[],N1=[];for(let n=0;n<f.length;n++){if(f[n]==="params")continue;M1.push(f[n]),N1.push(s[n])}let Z1=await Function(...z3,...s0,...M1,`return (async () => {
3596
3596
  ${E}
3597
- ${a0}
3597
+ ${o0}
3598
3598
  return module.exports
3599
- })()`)(G,Q,K,U,z,B,j,T,H,O,L,F,V,A,R,M,k,N,y,I,C,S,b,P,x,m,l,Q0,_,c0,R0,s0,c,j0,p0,M1,L5,O5,r,K0,M0,w0,a.confirm,a.alert,a.fetch,F5,...S0,...k1);if(Y.preserveExisting){for(let[n,J1]of Object.entries(Y1))if(!(n in $)||$[n]===void 0)$[n]=J1}else Object.assign($,Y1);for(let[n,J1]of Object.entries(U))if(!(n in $))$[n]=J1}catch(E){let v=E instanceof Error?E.message:String(E);if($J(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(ZJ(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(c5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await YB(J,$,Z)}catch(d){if(c5.env.STX_DEBUG){let f=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${f}`)}}}}function YJ(X){let $=0,Z=null,Y=!1,J=!1;for(let G=0;G<X.length;G++){let Q=X[G];if(Z){if(Q===Z){if(Z=null,Y||$===0)J=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")$++;else if(Q==="}")$--;else if(X.startsWith("from",G)&&$===0)Y=!0}return Z===null&&$===0&&J}function _3(X,$){let Z=$?f1.dirname($):c5.cwd(),Y=c5.cwd(),J=X.split(`
3600
- `),G=[],Q=0;while(Q<J.length){let w=J[Q].trim();if(w.startsWith("interface ")||w.startsWith("export interface ")||w.startsWith("type ")||w.startsWith("export type ")){if(w.includes("{")&&!w.includes("}")){let q=0;for(;Q<J.length;Q++){for(let W of J[Q])if(W==="{")q++;else if(W==="}")q--;if(q<=0)break}}Q++;continue}if(w.startsWith("definePageMeta(")){let q=0,W=!1,K=Q;for(let B=Q;B<J.length&&!W;B++){let _=null,j=!1,H=J[B];for(let O=0;O<H.length;O++){let L=H[O];if(j){j=!1;continue}if(L==="\\"){j=!0;continue}if(_){if(L===_)_=null;continue}if(L==='"'||L==="'"||L==="`"){_=L;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0){Q=B+1,W=!0;break}}}}if(!W)Q=J.length;let U=J.slice(K,Q).join(`
3601
- `),z=[];for(let B of["title","description"]){let _=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(U);if(_)z.push(`${B}: ${JSON.stringify(_[2])}`)}if(z.length>0)G.push(`useSeoMeta({ ${z.join(", ")} });`);continue}if(w.startsWith("import ")||w==="import"||w.startsWith("import{")){let q=w,W=0;while(!YJ(q)&&Q+W+1<J.length)W++,q=`${q} ${J[Q+W].trim()}`;Q+=W;let K=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+['"](.+?)['"]/),B=q,_=(j)=>{if(j.startsWith("."))return f1.resolve(Z,j);if(j.startsWith("~/")||j.startsWith("@/"))return f1.resolve(Y,j.slice(2));return j};if(K){let[,j,H]=K,O=_(H);G.push(`const ${j} = await import('${O}')`),G.push(`module.exports.${j} = ${j};`)}else if(U){let[,j,H]=U,O=_(H),L=[],F=[],V=o_.has(H);for(let A of j.split(",")){let R=A.trim();if(!R)continue;let T=R.split(/\s+as\s+/);if(T.length===2){let[M,k]=[T[0].trim(),T[1].trim()];if(V&&rY.has(M)){G.push(`const ${k} = ${M};`),F.push(k);continue}L.push(`${M}: ${k}`),F.push(k)}else{if(V&&rY.has(R)){F.push(R);continue}L.push(R),F.push(R)}}if(L.length>0)G.push(`const { ${L.join(", ")} } = await import('${O}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(z){let j=_(z[1]);G.push(`await import('${j}')`)}else G.push(B);Q++;continue}if(t_.test(w))G.push(J[Q]),Q++;else if(w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var ")){let q=oY(J,Q),{type:W,name:K,value:U}=q;G.push(`${W} ${K} = ${U};`),G.push(`module.exports.${K} = ${K};`),Q=q.nextIndex}else if(w.startsWith("export function ")||w.startsWith("export async function ")){let q=U3(J,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("const ")||w.startsWith("let ")||w.startsWith("var ")){let q=oY(J,Q),{type:W,name:K,value:U}=q;G.push(`${W} ${K} = ${U};`),G.push(`module.exports.${K} = ${K};`),Q=q.nextIndex}else if(w.startsWith("function ")||w.startsWith("async function ")){let q=U3(J,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("export default function ")||w.startsWith("export default async function ")){let q=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...J];W[Q]=q;let K=U3(W,Q);if(G.push(K.functionCode),K.name)G.push(`module.exports.default = ${K.name};`);Q=K.nextIndex}else if(w.startsWith("export default ")){let q=w.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${q};`),Q++}else if(w.startsWith("class ")||w.startsWith("export class ")){let q=w.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],K=J[Q].replace(/^export\s+/,""),U=0,z=Q;for(;z<J.length;z++){let B=J[z];for(let _ of B)if(_==="{")U++;else if(_==="}")U--;if(z>Q)K+=`
3602
- `+B;if(U<=0&&z>=Q)break}G.push(K),G.push(`module.exports.${W} = ${W};`),Q=z+1}else G.push(w),Q++}else if(w.includes("module.exports"))G.push(w),Q++;else if(w.trim()&&!w.startsWith("//"))G.push(w),Q++;else Q++}return e_(G.join(`
3603
- `),Z,Y)}function e_(X,$,Z){let Y=X.length,J="",G=0,Q=null,w=!1,q=!1,W=0;while(G<Y){let K=X[G],U=X[G+1];if(w){if(J+=K,K===`
3604
- `)w=!1;G++;continue}if(q){if(J+=K,K==="*"&&U==="/"){J+=U,G+=2,q=!1;continue}G++;continue}if(!Q&&K==="/"&&U==="/"){w=!0,J+=K,G++;continue}if(!Q&&K==="/"&&U==="*"){q=!0,J+=K,G++;continue}if(Q){if(J+=K,K==="\\"){J+=U,G+=2;continue}if(K===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(K==="$"&&U==="{"){W++,J+=U,G+=2;continue}if(K==="`"){Q=null,G++;continue}}G++;continue}if(W>0){if(K==="{")W++;else if(K==="}")W--}if(K==='"'||K==="'"||K==="`"){Q=K,J+=K,G++;continue}if(K==="a"&&X.startsWith("await",G)){let z=XB(X,G);if(z){let{quote:B,path:_,end:j}=z;if(_.startsWith(".")||_.startsWith("~/")||_.startsWith("@/")){let H=_.startsWith(".")?f1.resolve($,_):f1.resolve(Z,_.slice(2));J+=`await import(${B}${H}${B})`,G=j;continue}}}J+=K,G++}return J}function XB(X,$){let Z=$+5;if(Z>=X.length)return null;if(!/\s/.test(X[Z]))return null;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(!X.startsWith("import",Z))return null;Z+=6;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return null;Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;let Y=X[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=Z;while(Z<X.length&&X[Z]!==Y)if(X[Z]==="\\")Z+=2;else Z++;if(Z>=X.length)return null;let G=X.slice(J,Z);Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!==")")return null;return{quote:Y,path:G,end:Z+1}}function JJ(X,$){let Z=X[$];if(Z!=="{"&&Z!=="[")return null;let J=N0(X,Z,Z==="{"?"}":"]",$);if(J===-1)return null;return{pattern:X.slice($,J+1),endPos:J+1}}function GJ(X){let $=[],Z=X.slice(1,-1).trim();if(!Z)return $;let Y=0,J=0,G="";while(Y<Z.length){let Q=Z[Y];if(Q==="{"||Q==="["){let w=J===0?JJ(Z,Y):null;if(w){$.push(...GJ(w.pattern)),Y=w.endPos,G="";continue}J++}else if(Q==="}"||Q==="]")J--;if(J>0){Y++;continue}if(Q===","){if(G.trim())$.push(G.trim());G="",Y++;continue}if(Q===":"){G="",Y++;continue}if(Q==="="){if(G.trim())$.push(G.trim());G="",Y++;while(Y<Z.length&&Z[Y]!==","&&J===0){if(Z[Y]==="{"||Z[Y]==="[")J++;else if(Z[Y]==="}"||Z[Y]==="]")J--;Y++}continue}if(/[\w$]/.test(Q))G+=Q;Y++}if(G.trim())$.push(G.trim());return $}function QJ(X){let $=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(X);if(!$)return null;let Z=$[0].length,Y=(J)=>J===" "||J==="\t";while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]===":"){let J=0,G=null;Z++;for(;Z<X.length;Z++){let Q=X[Z];if(G){if(Q==="\\"){Z++;continue}if(Q===G)G=null;continue}if(Q==="'"||Q==='"'||Q==="`"){G=Q;continue}if(Q==="("||Q==="["||Q==="{"||Q==="<"){J++;continue}if(Q===")"||Q==="]"||Q==="}"||Q===">"){J--;continue}if(Q==="="&&J<=0){let w=X[Z+1],q=X[Z-1];if(w!=="="&&w!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if(X[Z]!=="=")return null}while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]!=="=")return null;return{type:$[1],name:$[2],value:X.slice(Z+1).trim()}}function sY(X,$,Z,Y){let J=null,G=!1;for(let Q of X){if(G){G=!1;continue}if(Q==="\\"){G=!0;continue}if(J){if(Q===J)J=null;continue}if(Q==="'"||Q==='"'||Q==="`"){J=Q;continue}if(Q===$)Y++;else if(Q===Z)Y--}return Y}function oY(X,$){let Z=X[$].trim(),Y=QJ(Z),J=Y?[Z,Y.type,Y.name,Y.value]:null;if(!J){let K=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(K){let U=Z.slice(K[0].length),z=$;if(U.startsWith("{")||U.startsWith("[")){let _=U[0],j=_==="{"?"}":"]",H=sY(U,_,j,0),O=U;for(let L=$+1;L<X.length&&H>0;L++)O+=` ${X[L].trim()}`,z=L,H=sY(X[L],_,j,H);if(H>0)O=U,z=$;U=O}let B=JJ(U,0);if(B){let _=K[1],j=B.pattern,H=U.slice(B.endPos).trim();if(H.startsWith("=")){let O=H.slice(1).trim(),L=O,F=Math.max(z,$);if(aY(O)){let T=tY(X,F,O);L=T.value,F=T.nextIndex}else F=F+1;L=L.trim().replace(/;$/,"");let V=GJ(j),A=`__stx_src_${$}`,R=V.map((T)=>`module.exports.${T} = ${T};`).join(`
3599
+ })()`)(G,Q,U,K,z,B,j,T,H,O,L,F,V,A,R,M,k,N,y,I,C,S,b,P,x,m,l,Q0,_,l0,R0,r0,c,j0,c0,T1,O5,F5,r,U0,M0,w0,a.confirm,a.alert,a.fetch,V5,...S0,...N1);if(Y.preserveExisting){for(let[n,Y1]of Object.entries(Z1))if(!(n in $)||$[n]===void 0)$[n]=Y1}else Object.assign($,Z1);for(let[n,Y1]of Object.entries(K))if(!(n in $))$[n]=Y1}catch(E){let v=E instanceof Error?E.message:String(E);if(qJ(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(WJ(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(p5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await BB(J,$,Z)}catch(d){if(p5.env.STX_DEBUG){let f=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${f}`)}}}}function UJ(X){let $=0,Z=null,Y=!1,J=!1;for(let G=0;G<X.length;G++){let Q=X[G];if(Z){if(Q===Z){if(Z=null,Y||$===0)J=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")$++;else if(Q==="}")$--;else if(X.startsWith("from",G)&&$===0)Y=!0}return Z===null&&$===0&&J}function _3(X,$){let Z=$?f1.dirname($):p5.cwd(),Y=p5.cwd(),J=X.split(`
3600
+ `),G=[],Q=0;while(Q<J.length){let w=J[Q].trim();if(w.startsWith("interface ")||w.startsWith("export interface ")||w.startsWith("type ")||w.startsWith("export type ")){if(w.includes("{")&&!w.includes("}")){let q=0;for(;Q<J.length;Q++){for(let W of J[Q])if(W==="{")q++;else if(W==="}")q--;if(q<=0)break}}Q++;continue}if(w.startsWith("definePageMeta(")){let q=0,W=!1,U=Q;for(let B=Q;B<J.length&&!W;B++){let _=null,j=!1,H=J[B];for(let O=0;O<H.length;O++){let L=H[O];if(j){j=!1;continue}if(L==="\\"){j=!0;continue}if(_){if(L===_)_=null;continue}if(L==='"'||L==="'"||L==="`"){_=L;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0){Q=B+1,W=!0;break}}}}if(!W)Q=J.length;let K=J.slice(U,Q).join(`
3601
+ `),z=[];for(let B of["title","description"]){let _=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(K);if(_)z.push(`${B}: ${JSON.stringify(_[2])}`)}if(z.length>0)G.push(`useSeoMeta({ ${z.join(", ")} });`);continue}if(w.startsWith("import ")||w==="import"||w.startsWith("import{")){let q=w,W=0;while(!UJ(q)&&Q+W+1<J.length)W++,q=`${q} ${J[Q+W].trim()}`;Q+=W;let U=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),K=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+['"](.+?)['"]/),B=q,_=(j)=>{if(j.startsWith("."))return f1.resolve(Z,j);if(j.startsWith("~/")||j.startsWith("@/"))return f1.resolve(Y,j.slice(2));return j};if(U){let[,j,H]=U,O=_(H);G.push(`const ${j} = await import('${O}')`),G.push(`module.exports.${j} = ${j};`)}else if(K){let[,j,H]=K,O=_(H),L=[],F=[],V=wB.has(H);for(let A of j.split(",")){let R=A.trim();if(!R)continue;let T=R.split(/\s+as\s+/);if(T.length===2){let[M,k]=[T[0].trim(),T[1].trim()];if(V&&$J.has(M)){G.push(`const ${k} = ${M};`),F.push(k);continue}L.push(`${M}: ${k}`),F.push(k)}else{if(V&&$J.has(R)){F.push(R);continue}L.push(R),F.push(R)}}if(L.length>0)G.push(`const { ${L.join(", ")} } = await import('${O}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(z){let j=_(z[1]);G.push(`await import('${j}')`)}else G.push(B);Q++;continue}if(WB.test(w))G.push(J[Q]),Q++;else if(w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var ")){let q=YJ(J,Q),{type:W,name:U,value:K}=q;G.push(`${W} ${U} = ${K};`),G.push(`module.exports.${U} = ${U};`),Q=q.nextIndex}else if(w.startsWith("export function ")||w.startsWith("export async function ")){let q=K3(J,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("const ")||w.startsWith("let ")||w.startsWith("var ")){let q=YJ(J,Q),{type:W,name:U,value:K}=q;G.push(`${W} ${U} = ${K};`),G.push(`module.exports.${U} = ${U};`),Q=q.nextIndex}else if(w.startsWith("function ")||w.startsWith("async function ")){let q=K3(J,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("export default function ")||w.startsWith("export default async function ")){let q=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...J];W[Q]=q;let U=K3(W,Q);if(G.push(U.functionCode),U.name)G.push(`module.exports.default = ${U.name};`);Q=U.nextIndex}else if(w.startsWith("export default ")){let q=w.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${q};`),Q++}else if(w.startsWith("class ")||w.startsWith("export class ")){let q=w.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],U=J[Q].replace(/^export\s+/,""),K=0,z=Q;for(;z<J.length;z++){let B=J[z];for(let _ of B)if(_==="{")K++;else if(_==="}")K--;if(z>Q)U+=`
3602
+ `+B;if(K<=0&&z>=Q)break}G.push(U),G.push(`module.exports.${W} = ${W};`),Q=z+1}else G.push(w),Q++}else if(w.includes("module.exports"))G.push(w),Q++;else if(w.trim()&&!w.startsWith("//"))G.push(w),Q++;else Q++}return UB(G.join(`
3603
+ `),Z,Y)}function UB(X,$,Z){let Y=X.length,J="",G=0,Q=null,w=!1,q=!1,W=0;while(G<Y){let U=X[G],K=X[G+1];if(w){if(J+=U,U===`
3604
+ `)w=!1;G++;continue}if(q){if(J+=U,U==="*"&&K==="/"){J+=K,G+=2,q=!1;continue}G++;continue}if(!Q&&U==="/"&&K==="/"){w=!0,J+=U,G++;continue}if(!Q&&U==="/"&&K==="*"){q=!0,J+=U,G++;continue}if(Q){if(J+=U,U==="\\"){J+=K,G+=2;continue}if(U===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(U==="$"&&K==="{"){W++,J+=K,G+=2;continue}if(U==="`"){Q=null,G++;continue}}G++;continue}if(W>0){if(U==="{")W++;else if(U==="}")W--}if(U==='"'||U==="'"||U==="`"){Q=U,J+=U,G++;continue}if(U==="a"&&X.startsWith("await",G)){let z=KB(X,G);if(z){let{quote:B,path:_,end:j}=z;if(_.startsWith(".")||_.startsWith("~/")||_.startsWith("@/")){let H=_.startsWith(".")?f1.resolve($,_):f1.resolve(Z,_.slice(2));J+=`await import(${B}${H}${B})`,G=j;continue}}}J+=U,G++}return J}function KB(X,$){let Z=$+5;if(Z>=X.length)return null;if(!/\s/.test(X[Z]))return null;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(!X.startsWith("import",Z))return null;Z+=6;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return null;Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;let Y=X[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=Z;while(Z<X.length&&X[Z]!==Y)if(X[Z]==="\\")Z+=2;else Z++;if(Z>=X.length)return null;let G=X.slice(J,Z);Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!==")")return null;return{quote:Y,path:G,end:Z+1}}function KJ(X,$){let Z=X[$];if(Z!=="{"&&Z!=="[")return null;let J=N0(X,Z,Z==="{"?"}":"]",$);if(J===-1)return null;return{pattern:X.slice($,J+1),endPos:J+1}}function zJ(X){let $=[],Z=X.slice(1,-1).trim();if(!Z)return $;let Y=0,J=0,G="";while(Y<Z.length){let Q=Z[Y];if(Q==="{"||Q==="["){let w=J===0?KJ(Z,Y):null;if(w){$.push(...zJ(w.pattern)),Y=w.endPos,G="";continue}J++}else if(Q==="}"||Q==="]")J--;if(J>0){Y++;continue}if(Q===","){if(G.trim())$.push(G.trim());G="",Y++;continue}if(Q===":"){G="",Y++;continue}if(Q==="="){if(G.trim())$.push(G.trim());G="",Y++;while(Y<Z.length&&Z[Y]!==","&&J===0){if(Z[Y]==="{"||Z[Y]==="[")J++;else if(Z[Y]==="}"||Z[Y]==="]")J--;Y++}continue}if(/[\w$]/.test(Q))G+=Q;Y++}if(G.trim())$.push(G.trim());return $}function _J(X){let $=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(X);if(!$)return null;let Z=$[0].length,Y=(J)=>J===" "||J==="\t";while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]===":"){let J=0,G=null;Z++;for(;Z<X.length;Z++){let Q=X[Z];if(G){if(Q==="\\"){Z++;continue}if(Q===G)G=null;continue}if(Q==="'"||Q==='"'||Q==="`"){G=Q;continue}if(Q==="("||Q==="["||Q==="{"||Q==="<"){J++;continue}if(Q===")"||Q==="]"||Q==="}"||Q===">"){J--;continue}if(Q==="="&&J<=0){let w=X[Z+1],q=X[Z-1];if(w!=="="&&w!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if(X[Z]!=="=")return null}while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]!=="=")return null;return{type:$[1],name:$[2],value:X.slice(Z+1).trim()}}function ZJ(X,$,Z,Y){let J=null,G=!1;for(let Q of X){if(G){G=!1;continue}if(Q==="\\"){G=!0;continue}if(J){if(Q===J)J=null;continue}if(Q==="'"||Q==='"'||Q==="`"){J=Q;continue}if(Q===$)Y++;else if(Q===Z)Y--}return Y}function YJ(X,$){let Z=X[$].trim(),Y=_J(Z),J=Y?[Z,Y.type,Y.name,Y.value]:null;if(!J){let U=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let K=Z.slice(U[0].length),z=$;if(K.startsWith("{")||K.startsWith("[")){let _=K[0],j=_==="{"?"}":"]",H=ZJ(K,_,j,0),O=K;for(let L=$+1;L<X.length&&H>0;L++)O+=` ${X[L].trim()}`,z=L,H=ZJ(X[L],_,j,H);if(H>0)O=K,z=$;K=O}let B=KJ(K,0);if(B){let _=U[1],j=B.pattern,H=K.slice(B.endPos).trim();if(H.startsWith("=")){let O=H.slice(1).trim(),L=O,F=Math.max(z,$);if(JJ(O)){let T=GJ(X,F,O);L=T.value,F=T.nextIndex}else F=F+1;L=L.trim().replace(/;$/,"");let V=zJ(j),A=`__stx_src_${$}`,R=V.map((T)=>`module.exports.${T} = ${T};`).join(`
3605
3605
  `);return{type:_,name:A,value:`${L}; ${_} ${j} = ${A};
3606
- ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,w]=J,q=w,W=$;if(aY(w)){let K=tY(X,$,w);q=K.value,W=K.nextIndex}else W=$+1;while(W<X.length){let K=X[W].trim();if(K.startsWith(".")||K.startsWith("?."))q+=`
3607
- ${X[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:G,name:Q,value:q,nextIndex:W}}function U3(X,$){let Z=X[$].trim(),Y=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${Z}`);let[,J]=Y,G=Z.replace(/^export\s+/,""),Q=$;if($B(Z)){let w=ZB(X,$,G);G=w.functionCode,Q=w.nextIndex}else Q=$+1;return{name:J,functionCode:G,nextIndex:Q}}function aY(X){let $=X.trim();if($.startsWith("{"))return N0($,"{","}",0)===-1;if($.startsWith("["))return N0($,"[","]",0)===-1;return!wJ($)}function wJ(X){let $={paren:0,bracket:0,brace:0},Z=null,Y=0;for(let J=0;J<X.length;J++){let G=X[J];if((J>0?X[J-1]:"")==="\\"&&Z)continue;if((G==='"'||G==="'")&&!Z){Z=G;continue}if(G===Z&&Z!=="`"){Z=null;continue}if(G==="`"&&!Z){Z="`";continue}if(G==="`"&&Z==="`"&&Y===0){Z=null;continue}if(Z==="`"&&G==="$"&&X[J+1]==="{"){Y++,J++;continue}if(Y>0&&G==="{"){Y++;continue}if(Y>0&&G==="}"){Y--;continue}if(Z)continue;if(G==="(")$.paren++;else if(G===")")$.paren--;else if(G==="[")$.bracket++;else if(G==="]")$.bracket--;else if(G==="{")$.brace++;else if(G==="}")$.brace--}return $.paren===0&&$.bracket===0&&$.brace===0&&Z===null}function qJ(X){let $=X.indexOf("(");if($===-1)return X.indexOf("{");let Z=N0(X,"(",")",$);if(Z===-1)return-1;return X.indexOf("{",Z)}function $B(X){let $=qJ(X);if($===-1)return!0;return N0(X,"{","}",$)===-1}function tY(X,$,Z){let Y=Z,J=$+1;while(J<X.length&&!wJ(Y)){let G=X[J];Y+=`
3606
+ ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,w]=J,q=w,W=$;if(JJ(w)){let U=GJ(X,$,w);q=U.value,W=U.nextIndex}else W=$+1;while(W<X.length){let U=X[W].trim();if(U.startsWith(".")||U.startsWith("?."))q+=`
3607
+ ${X[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:G,name:Q,value:q,nextIndex:W}}function K3(X,$){let Z=X[$].trim(),Y=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${Z}`);let[,J]=Y,G=Z.replace(/^export\s+/,""),Q=$;if(zB(Z)){let w=_B(X,$,G);G=w.functionCode,Q=w.nextIndex}else Q=$+1;return{name:J,functionCode:G,nextIndex:Q}}function JJ(X){let $=X.trim();if($.startsWith("{"))return N0($,"{","}",0)===-1;if($.startsWith("["))return N0($,"[","]",0)===-1;return!BJ($)}function BJ(X){let $={paren:0,bracket:0,brace:0},Z=null,Y=0;for(let J=0;J<X.length;J++){let G=X[J];if((J>0?X[J-1]:"")==="\\"&&Z)continue;if((G==='"'||G==="'")&&!Z){Z=G;continue}if(G===Z&&Z!=="`"){Z=null;continue}if(G==="`"&&!Z){Z="`";continue}if(G==="`"&&Z==="`"&&Y===0){Z=null;continue}if(Z==="`"&&G==="$"&&X[J+1]==="{"){Y++,J++;continue}if(Y>0&&G==="{"){Y++;continue}if(Y>0&&G==="}"){Y--;continue}if(Z)continue;if(G==="(")$.paren++;else if(G===")")$.paren--;else if(G==="[")$.bracket++;else if(G==="]")$.bracket--;else if(G==="{")$.brace++;else if(G==="}")$.brace--}return $.paren===0&&$.bracket===0&&$.brace===0&&Z===null}function jJ(X){let $=X.indexOf("(");if($===-1)return X.indexOf("{");let Z=N0(X,"(",")",$);if(Z===-1)return-1;return X.indexOf("{",Z)}function zB(X){let $=jJ(X);if($===-1)return!0;return N0(X,"{","}",$)===-1}function GJ(X,$,Z){let Y=Z,J=$+1;while(J<X.length&&!BJ(Y)){let G=X[J];Y+=`
3608
3608
  ${G}`,J++}while(J<X.length){let G=X[J].trim();if(G.startsWith(".")||G.startsWith("?."))Y+=`
3609
- ${X[J]}`,J++;else break}return{value:Y,nextIndex:J}}function ZB(X,$,Z){let Y=Z,J=$+1;while(J<X.length){let G=qJ(Y);if(G!==-1){if(N0(Y,"{","}",G)!==-1)break}let Q=X[J];Y+=`
3610
- ${Q}`,J++}return{functionCode:Y,nextIndex:J}}function eY(X,$){let Z=Y0(X,$)??Y0(`(${X})`,$);if(Z!==void 0)return Z;if(!/\bprocess\b/.test(X))return;let Y={...$,process:Object.freeze({env:{...c5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${X});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${X};`)(...Object.values(Y))}catch{return}}}async function YB(X,$,Z){let Y=X.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of Y){let[,,Q,w]=G;try{let q=w.trim().replace(/;$/,""),W=eY(q,$);if(W!==void 0)$[Q]=W}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}let J=X.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of J){let[,,Q,w]=G;if(!(Q in $))try{let q=w.trim().replace(/;$/,""),W=eY(q,$);if(W!==void 0)$[Q]=W}catch{}}}function WJ(X){let $=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=$?$[1]:"",Y=$?X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):X;return{scriptContent:Z,templateWithoutScript:Y}}function KJ(X){let $=X.trim();if(!$)return!1;return/(?:const|let|var|function)\s+\w+/.test($)}var z3,rY,o_,t_;var p5=D(()=>{x7();E1();F0();z3=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],rY=new Set(z3),o_=new Set(["stx","@stacksjs/stx"]);t_=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var LJ={};t(LJ,{processLoops:()=>j3,parseLoopBinding:()=>B3});function QB(X,$){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index+G[0].length,w=G.index+G[0].indexOf("("),q=N0(X,"(",")",w);if(q===-1)continue;let W=X.slice(Q,q).trim();if(!W)continue;if(!Object.keys($).some((z)=>new RegExp(`(?:^|[^\\w$.])${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let U;try{let z=O0(W,$);if(!z||typeof z!=="object")continue;U=JSON.stringify(z)}catch{continue}Y+=X.slice(J,Q)+U,J=q,Z.lastIndex=q}return J===0?X:Y+X.slice(J)}function wB(X,$){let Z=/@component\s*\(/g,Y=X,J,G=[];while((J=Z.exec(Y))!==null){let Q=J.index,w=Q+J[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let K=Y.substring(w+1,W),U=W+1,z=K.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let B=z[1],_=K.slice(z[0].length),j=_.match(/^\s*,\s*/);if(!j)continue;let H=_.slice(j[0].length).trim();if(!H)continue;try{let O=O0(H,$),L=JSON.stringify(O),F=`@component('${B}', ${L})`;G.push({start:Q,end:U,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];Y=Y.substring(0,w)+W+Y.substring(q)}return Y}function Q8(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1,K=null,U=!1;while(W<Y.length&&q>0){let _=Y[W];if(U){U=!1,W++;continue}if(_==="\\"&&K){U=!0,W++;continue}if(K){if(_===K)K=null;W++;continue}if(_==='"'||_==="'"||_==="`"){K=_,W++;continue}if(_==="(")q++;else if(_===")"){if(q--,q===0)break}W++}if(q!==0)break;let z=Y.substring(w+1,W),B=Z(z);Y=Y.substring(0,Q)+B+Y.substring(W+1)}return Y}function qB(X,$){let Z=X;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,J)=>{if(J in $)return`:${J}="${J}"`;return Y}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,J,G)=>{try{let Q=Object.keys($),w=Object.values($);MX(G);let W=W0(G,Q)(...w),K=JSON.stringify(W),U=Buffer.from(K,"utf8").toString("base64");return`__stx_${J}="${U}"`}catch(Q){return Y}}),Z}function WB(X,$){let Z=X;return Z=Q8(Z,"@break",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys($));Q=Boolean(w(...Object.values($)))}else Q=Boolean(Y0(G,$));return Q?w8:""}catch{return""}}),Z=Q8(Z,"@continue",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys($));Q=Boolean(w(...Object.values($)))}else Q=Boolean(Y0(G,$));return Q?q8:""}catch{return""}}),Z}function KB(X){let $=X;return $=$.replace(/@break(?!\()/g,w8),$=$.replace(/@continue(?!\()/g,q8),$}function UJ(X){let $=X.includes(w8),Z=$?X.substring(0,X.indexOf(w8)):X;return{hasBreak:$,content:Z}}function zJ(X){let $=X.includes(q8),Z=$?X.substring(0,X.indexOf(q8)):X;return{hasContinue:$,content:Z}}function BJ(X){let $=X;return $=Q8($,"@break",(Z)=>{let Y=Z.trim();if(!NX(Y))return"";return`\`; if (${Y}) { break; } result += \``}),$=Q8($,"@continue",(Z)=>{let Y=Z.trim();if(!NX(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),$=$.replace(/@break(?!\()/g,"`; break; result += `"),$=$.replace(/@continue(?!\()/g,"`; continue; result += `"),$}function UB(X){let $=/@forelse\s*\(/g,Z,Y=[],J=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=J.exec(X))!==null)Y.push({pos:Q.index,delta:1});while((Q=G.exec(X))!==null)Y.push({pos:Q.index,delta:-1});Y.sort((K,U)=>K.pos-U.pos);let w=[],q=0;for(let K of Y)q+=K.delta,w.push({pos:K.pos,depth:q});function W(K){let U=0,z=w.length-1,B=0;while(U<=z){let _=U+z>>1;if(w[_].pos<=K)B=w[_].depth,U=_+1;else z=_-1}return B}while((Z=$.exec(X))!==null){if(W(Z.index)>0)continue;let K=Z.index,U=Z.index+Z[0].length-1,z=1,B=U+1,_=-1;while(B<X.length&&z>0){if(X[B]==="(")z++;else if(X[B]===")"){if(z--,z===0){_=B;break}}B++}if(_===-1)continue;let j=X.substring(U+1,_),H=B3(j);if(!H)continue;let{arrayExpr:O,itemVar:L}=H,F=_+1,V=1,A=F,R=/@forelse\s*\(/g,T=/@endforelse/g,M=-1;while(V>0&&A<X.length){R.lastIndex=A,T.lastIndex=A;let S=R.exec(X),b=T.exec(X);if(!b)break;if(S&&S.index<b.index)V++,A=S.index+S[0].length;else{if(V--,V===0){M=b.index;break}A=b.index+11}}if(M===-1)continue;let k=X.substring(F,M),N=M+11,y=-1,I=0,C=0;while(C<k.length){let S=k.indexOf("@",C);if(S===-1)break;let b=k.substring(S);if(/^@forelse\s*\(/.test(b))I++,C=S+1;else if(b.startsWith("@endforelse"))I--,C=S+11;else if(I===0&&b.startsWith("@empty")){if(k.length<=S+6||!/[a-z]/i.test(k[S+6])){y=S;break}C=S+1}else C=S+1}if(y===-1)continue;return{start:K,end:N,arrayExpr:O,itemVar:L,foreachContent:k.substring(0,y),emptyContent:k.substring(y+6)}}return null}function _J(X,$){let Z=X;while(!0){let Y=UB(Z);if(!Y)break;let{start:J,end:G,arrayExpr:Q,itemVar:w,foreachContent:q,emptyContent:W}=Y;try{let K;if(q0(Q))K=W0(Q,Object.keys($))(...Object.values($));else K=Y0(Q,$);let U;if(!Array.isArray(K)||K.length===0)U=W;else U=`@foreach (${Q} as ${w})${q}@endforeach`;Z=Z.substring(0,J)+U+Z.substring(G)}catch(K){let U=K instanceof Error?K.message:String(K),z=$0("Forelse",`Error in @forelse(${Q} as ${w}): ${U}`,o.EVALUATION_ERROR);Z=Z.substring(0,J)+z+Z.substring(G)}}return Z}function B3(X){let $=X.indexOf(" as ");if($!==-1){let G=X.slice(0,$).trim(),Q=X.slice($+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(X);if(!Z)return null;let Y=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Z[2].trim();return Y&&J?{arrayExpr:J,itemVar:Y}:null}function j3(X,$,Z,Y){let J=X;J=_J(J,$);function G(q){let W=/@foreach\s*\(/g,K;while((K=W.exec(q))!==null){let U=K.index,z=K.index+K[0].length-1,B=1,_=z+1,j=-1;while(_<q.length&&B>0){if(q[_]==="(")B++;else if(q[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=q.substring(z+1,j),O=B3(H);if(!O)continue;let L=U,{arrayExpr:F,itemVar:V}=O,A=j+1,R=1,T=A,M=/@foreach\s*\(/g,k=/@endforeach/g;while(R>0&&T<q.length){M.lastIndex=T,k.lastIndex=T;let N=M.exec(q),y=k.exec(q);if(!y)break;if(N&&N.index<y.index)R++,T=N.index+N[0].length;else{if(R--,R===0){let I=q.substring(A,y.index),C=y.index+11;return{start:L,end:C,arrayExpr:F,itemVar:V,content:I}}T=y.index+11}}}return null}function Q(q,W){let K=q;while(!0){let U=G(K);if(!U)break;let{start:z,end:B,arrayExpr:_,itemVar:j,content:H}=U;try{let O=_.trim(),L;if(q0(O))L=W0(O,Object.keys(W))(...Object.values(W));else L=Y0(O,W);let F=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),F=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),F=!0;else{console.warn(`[stx] @foreach(${O}) in ${Z}: ${O} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let y=$0("Foreach",`Error in @foreach: ${O} is not iterable`,o.TYPE_ERROR);K=K.substring(0,z)+y+K.substring(B);continue}let V=Y?.loops?.useAltLoopVariable??GB,A=j.trim(),R=null,T,M=!1;if(A.includes("=>")){let y=A.split("=>").map((I)=>I.trim());if(y.length===2&&y[0]&&y[1])R=y[0],T=y[1];else T=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let y=A.split(",").map((I)=>I.trim());if(y.length===2&&y[0]&&y[1])T=y[0],R=y[1],M=!0;else T=A}else T=A;let k="",N=L;for(let y=0;y<N.length;y++){let I=N[y],C={index:y,iteration:y+1,first:y===0,last:y===N.length-1,count:N.length},S={...W,loop:C,$loop:C};if(T.startsWith("[")&&T.endsWith("]")){let m=T.slice(1,-1).split(",").map((l)=>l.trim());if(Array.isArray(I))m.forEach((l,Q0)=>{if(l)S[l]=I[Q0]});else S[T]=I}else S[T]=I;if(R)if(!M&&F&&Array.isArray(I)&&I.length===2)S[R]=I[0],S[T]=I[1];else S[R]=y;let b=WB(H,S),P=zJ(b);if(P.hasContinue){k+=P.content;continue}let x=UJ(b);if(x.hasBreak){k+=x.content;break}if(b=_J(b,S),b=Q(b,S),b=G5(b,S,Z),b=KB(b),x=UJ(b),x.hasBreak){k+=x.content;break}if(P=zJ(b),P.hasContinue){k+=P.content;continue}b=b1(b,S,Z),b=qB(b,S),b=wB(b,S),b=QB(b,S),k+=b}K=K.substring(0,z)+k+K.substring(B)}catch(O){let L=$0("Foreach",`Error in @foreach(${_.trim()} as ${j.trim()}): ${O instanceof Error?O.message:String(O)}`,o.EVALUATION_ERROR);K=K.substring(0,z)+L+K.substring(B)}}return K}J=Q(J,$),J=HJ(J,$,Z,Y);let w=Y?.loops?.maxWhileIterations??JB;return J=BB(J,$,w),J}function jJ(X){return NX(X)}function HJ(X,$,Z,Y){let J=X,G=!0;while(G){G=!1;let Q=J.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=w+Q[0].length-1,W=N0(J,"(",")",q);if(W===-1)break;let K=J.slice(q+1,W),U=W+1,z=hX(J.slice(w),"for","endfor");if(z.length===0)break;let B=z[0].content,_=w+z[0].end;if(!jJ(K)){let j=$0("For",`Unsafe expression in @for: ${K}`,o.UNSAFE_EXPRESSION);J=J.substring(0,w)+j+J.substring(_),G=!0;continue}try{let j=zB(K),H=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(j.length>0&&H){let R=_B({forExpr:K,content:B,iterVarNames:j,context:$,filePath:Z,options:Y});J=J.substring(0,w)+R+J.substring(_),G=!0;continue}let O=Object.keys($),L=Object.values($),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,T)=>{return`\${${T}}`});F=BJ(F);let A=Function(...O,`
3609
+ ${X[J]}`,J++;else break}return{value:Y,nextIndex:J}}function _B(X,$,Z){let Y=Z,J=$+1;while(J<X.length){let G=jJ(Y);if(G!==-1){if(N0(Y,"{","}",G)!==-1)break}let Q=X[J];Y+=`
3610
+ ${Q}`,J++}return{functionCode:Y,nextIndex:J}}function QJ(X,$){let Z=Y0(X,$)??Y0(`(${X})`,$);if(Z!==void 0)return Z;if(!/\bprocess\b/.test(X))return;let Y={...$,process:Object.freeze({env:{...p5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${X});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${X};`)(...Object.values(Y))}catch{return}}}async function BB(X,$,Z){let Y=X.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of Y){let[,,Q,w]=G;try{let q=w.trim().replace(/;$/,""),W=QJ(q,$);if(W!==void 0)$[Q]=W}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}let J=X.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of J){let[,,Q,w]=G;if(!(Q in $))try{let q=w.trim().replace(/;$/,""),W=QJ(q,$);if(W!==void 0)$[Q]=W}catch{}}}function HJ(X){let $=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=$?$[1]:"",Y=$?X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):X;return{scriptContent:Z,templateWithoutScript:Y}}function LJ(X){let $=X.trim();if(!$)return!1;return/(?:const|let|var|function)\s+\w+/.test($)}var z3,$J,wB,WB;var i5=D(()=>{g7();E1();F0();z3=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],$J=new Set(z3),wB=new Set(["stx","@stacksjs/stx"]);WB=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var MJ={};t(MJ,{processLoops:()=>j3,parseLoopBinding:()=>B3});function LB(X,$){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index+G[0].length,w=G.index+G[0].indexOf("("),q=N0(X,"(",")",w);if(q===-1)continue;let W=X.slice(Q,q).trim();if(!W)continue;if(!Object.keys($).some((z)=>new RegExp(`(?:^|[^\\w$.])${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let K;try{let z=O0(W,$);if(!z||typeof z!=="object")continue;K=JSON.stringify(z)}catch{continue}Y+=X.slice(J,Q)+K,J=q,Z.lastIndex=q}return J===0?X:Y+X.slice(J)}function OB(X,$){let Z=/@component\s*\(/g,Y=X,J,G=[];while((J=Z.exec(Y))!==null){let Q=J.index,w=Q+J[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=Y.substring(w+1,W),K=W+1,z=U.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let B=z[1],_=U.slice(z[0].length),j=_.match(/^\s*,\s*/);if(!j)continue;let H=_.slice(j[0].length).trim();if(!H)continue;try{let O=O0(H,$),L=JSON.stringify(O),F=`@component('${B}', ${L})`;G.push({start:Q,end:K,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];Y=Y.substring(0,w)+W+Y.substring(q)}return Y}function w8(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1,U=null,K=!1;while(W<Y.length&&q>0){let _=Y[W];if(K){K=!1,W++;continue}if(_==="\\"&&U){K=!0,W++;continue}if(U){if(_===U)U=null;W++;continue}if(_==='"'||_==="'"||_==="`"){U=_,W++;continue}if(_==="(")q++;else if(_===")"){if(q--,q===0)break}W++}if(q!==0)break;let z=Y.substring(w+1,W),B=Z(z);Y=Y.substring(0,Q)+B+Y.substring(W+1)}return Y}function FB(X,$){let Z=X;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,J)=>{if(J in $)return`:${J}="${J}"`;return Y}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,J,G)=>{try{let Q=Object.keys($),w=Object.values($);NX(G);let W=W0(G,Q)(...w),U=JSON.stringify(W),K=Buffer.from(U,"utf8").toString("base64");return`__stx_${J}="${K}"`}catch(Q){return Y}}),Z}function VB(X,$){let Z=X;return Z=w8(Z,"@break",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys($));Q=Boolean(w(...Object.values($)))}else Q=Boolean(Y0(G,$));return Q?q8:""}catch{return""}}),Z=w8(Z,"@continue",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys($));Q=Boolean(w(...Object.values($)))}else Q=Boolean(Y0(G,$));return Q?W8:""}catch{return""}}),Z}function AB(X){let $=X;return $=$.replace(/@break(?!\()/g,q8),$=$.replace(/@continue(?!\()/g,W8),$}function OJ(X){let $=X.includes(q8),Z=$?X.substring(0,X.indexOf(q8)):X;return{hasBreak:$,content:Z}}function FJ(X){let $=X.includes(W8),Z=$?X.substring(0,X.indexOf(W8)):X;return{hasContinue:$,content:Z}}function AJ(X){let $=X;return $=w8($,"@break",(Z)=>{let Y=Z.trim();if(!kX(Y))return"";return`\`; if (${Y}) { break; } result += \``}),$=w8($,"@continue",(Z)=>{let Y=Z.trim();if(!kX(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),$=$.replace(/@break(?!\()/g,"`; break; result += `"),$=$.replace(/@continue(?!\()/g,"`; continue; result += `"),$}function RB(X){let $=/@forelse\s*\(/g,Z,Y=[],J=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=J.exec(X))!==null)Y.push({pos:Q.index,delta:1});while((Q=G.exec(X))!==null)Y.push({pos:Q.index,delta:-1});Y.sort((U,K)=>U.pos-K.pos);let w=[],q=0;for(let U of Y)q+=U.delta,w.push({pos:U.pos,depth:q});function W(U){let K=0,z=w.length-1,B=0;while(K<=z){let _=K+z>>1;if(w[_].pos<=U)B=w[_].depth,K=_+1;else z=_-1}return B}while((Z=$.exec(X))!==null){if(W(Z.index)>0)continue;let U=Z.index,K=Z.index+Z[0].length-1,z=1,B=K+1,_=-1;while(B<X.length&&z>0){if(X[B]==="(")z++;else if(X[B]===")"){if(z--,z===0){_=B;break}}B++}if(_===-1)continue;let j=X.substring(K+1,_),H=B3(j);if(!H)continue;let{arrayExpr:O,itemVar:L}=H,F=_+1,V=1,A=F,R=/@forelse\s*\(/g,T=/@endforelse/g,M=-1;while(V>0&&A<X.length){R.lastIndex=A,T.lastIndex=A;let S=R.exec(X),b=T.exec(X);if(!b)break;if(S&&S.index<b.index)V++,A=S.index+S[0].length;else{if(V--,V===0){M=b.index;break}A=b.index+11}}if(M===-1)continue;let k=X.substring(F,M),N=M+11,y=-1,I=0,C=0;while(C<k.length){let S=k.indexOf("@",C);if(S===-1)break;let b=k.substring(S);if(/^@forelse\s*\(/.test(b))I++,C=S+1;else if(b.startsWith("@endforelse"))I--,C=S+11;else if(I===0&&b.startsWith("@empty")){if(k.length<=S+6||!/[a-z]/i.test(k[S+6])){y=S;break}C=S+1}else C=S+1}if(y===-1)continue;return{start:U,end:N,arrayExpr:O,itemVar:L,foreachContent:k.substring(0,y),emptyContent:k.substring(y+6)}}return null}function VJ(X,$){let Z=X;while(!0){let Y=RB(Z);if(!Y)break;let{start:J,end:G,arrayExpr:Q,itemVar:w,foreachContent:q,emptyContent:W}=Y;try{let U;if(q0(Q))U=W0(Q,Object.keys($))(...Object.values($));else U=Y0(Q,$);let K;if(!Array.isArray(U)||U.length===0)K=W;else K=`@foreach (${Q} as ${w})${q}@endforeach`;Z=Z.substring(0,J)+K+Z.substring(G)}catch(U){let K=U instanceof Error?U.message:String(U),z=$0("Forelse",`Error in @forelse(${Q} as ${w}): ${K}`,o.EVALUATION_ERROR);Z=Z.substring(0,J)+z+Z.substring(G)}}return Z}function B3(X){let $=X.indexOf(" as ");if($!==-1){let G=X.slice(0,$).trim(),Q=X.slice($+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(X);if(!Z)return null;let Y=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Z[2].trim();return Y&&J?{arrayExpr:J,itemVar:Y}:null}function j3(X,$,Z,Y){let J=X;J=VJ(J,$);function G(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let K=U.index,z=U.index+U[0].length-1,B=1,_=z+1,j=-1;while(_<q.length&&B>0){if(q[_]==="(")B++;else if(q[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=q.substring(z+1,j),O=B3(H);if(!O)continue;let L=K,{arrayExpr:F,itemVar:V}=O,A=j+1,R=1,T=A,M=/@foreach\s*\(/g,k=/@endforeach/g;while(R>0&&T<q.length){M.lastIndex=T,k.lastIndex=T;let N=M.exec(q),y=k.exec(q);if(!y)break;if(N&&N.index<y.index)R++,T=N.index+N[0].length;else{if(R--,R===0){let I=q.substring(A,y.index),C=y.index+11;return{start:L,end:C,arrayExpr:F,itemVar:V,content:I}}T=y.index+11}}}return null}function Q(q,W){let U=q;while(!0){let K=G(U);if(!K)break;let{start:z,end:B,arrayExpr:_,itemVar:j,content:H}=K;try{let O=_.trim(),L;if(q0(O))L=W0(O,Object.keys(W))(...Object.values(W));else L=Y0(O,W);let F=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),F=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),F=!0;else{console.warn(`[stx] @foreach(${O}) in ${Z}: ${O} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let y=$0("Foreach",`Error in @foreach: ${O} is not iterable`,o.TYPE_ERROR);U=U.substring(0,z)+y+U.substring(B);continue}let V=Y?.loops?.useAltLoopVariable??HB,A=j.trim(),R=null,T,M=!1;if(A.includes("=>")){let y=A.split("=>").map((I)=>I.trim());if(y.length===2&&y[0]&&y[1])R=y[0],T=y[1];else T=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let y=A.split(",").map((I)=>I.trim());if(y.length===2&&y[0]&&y[1])T=y[0],R=y[1],M=!0;else T=A}else T=A;let k="",N=L;for(let y=0;y<N.length;y++){let I=N[y],C={index:y,iteration:y+1,first:y===0,last:y===N.length-1,count:N.length},S={...W,loop:C,$loop:C};if(T.startsWith("[")&&T.endsWith("]")){let m=T.slice(1,-1).split(",").map((l)=>l.trim());if(Array.isArray(I))m.forEach((l,Q0)=>{if(l)S[l]=I[Q0]});else S[T]=I}else S[T]=I;if(R)if(!M&&F&&Array.isArray(I)&&I.length===2)S[R]=I[0],S[T]=I[1];else S[R]=y;let b=VB(H,S),P=FJ(b);if(P.hasContinue){k+=P.content;continue}let x=OJ(b);if(x.hasBreak){k+=x.content;break}if(b=VJ(b,S),b=Q(b,S),b=G5(b,S,Z),b=AB(b),x=OJ(b),x.hasBreak){k+=x.content;break}if(P=FJ(b),P.hasContinue){k+=P.content;continue}b=b1(b,S,Z),b=FB(b,S),b=OB(b,S),b=LB(b,S),k+=b}U=U.substring(0,z)+k+U.substring(B)}catch(O){let L=$0("Foreach",`Error in @foreach(${_.trim()} as ${j.trim()}): ${O instanceof Error?O.message:String(O)}`,o.EVALUATION_ERROR);U=U.substring(0,z)+L+U.substring(B)}}return U}J=Q(J,$),J=TJ(J,$,Z,Y);let w=Y?.loops?.maxWhileIterations??jB;return J=NB(J,$,w),J}function RJ(X){return kX(X)}function TJ(X,$,Z,Y){let J=X,G=!0;while(G){G=!1;let Q=J.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=w+Q[0].length-1,W=N0(J,"(",")",q);if(W===-1)break;let U=J.slice(q+1,W),K=W+1,z=uX(J.slice(w),"for","endfor");if(z.length===0)break;let B=z[0].content,_=w+z[0].end;if(!RJ(U)){let j=$0("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);J=J.substring(0,w)+j+J.substring(_),G=!0;continue}try{let j=TB(U),H=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(j.length>0&&H){let R=MB({forExpr:U,content:B,iterVarNames:j,context:$,filePath:Z,options:Y});J=J.substring(0,w)+R+J.substring(_),G=!0;continue}let O=Object.keys($),L=Object.values($),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,T)=>{return`\${${T}}`});F=AJ(F);let A=Function(...O,`
3611
3611
  let result = '';
3612
- for (${K}) {
3612
+ for (${U}) {
3613
3613
  result += \`${F}\`;
3614
3614
  }
3615
3615
  return result;
3616
- `)(...L);J=J.substring(0,w)+A+J.substring(_),G=!0}catch(j){let H=$0("For",`Error in @for(${K}): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR);J=J.substring(0,w)+H+J.substring(_),G=!0}}return J}function zB(X){let $=X.trim(),Z=$.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Z){let G=Z[1];return G.slice(1,-1).split(",").map((w)=>{let q=w.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&G.startsWith("{")){let z=q.slice(W+1).trim(),B=z.indexOf("=");return(B>=0?z.slice(0,B):z).trim()}let K=q.indexOf("="),U=(K>=0?q.slice(0,K):q).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let Y=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let J=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(J)return[J[1]];return[]}function _B(X){let{forExpr:$,content:Z,iterVarNames:Y,context:J,filePath:G,options:Q}=X,w=Object.keys(J),q=Object.values(J),W=Function(...w,"__pushIter",`
3616
+ `)(...L);J=J.substring(0,w)+A+J.substring(_),G=!0}catch(j){let H=$0("For",`Error in @for(${U}): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR);J=J.substring(0,w)+H+J.substring(_),G=!0}}return J}function TB(X){let $=X.trim(),Z=$.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Z){let G=Z[1];return G.slice(1,-1).split(",").map((w)=>{let q=w.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&G.startsWith("{")){let z=q.slice(W+1).trim(),B=z.indexOf("=");return(B>=0?z.slice(0,B):z).trim()}let U=q.indexOf("="),K=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(K)?K:""}).filter(Boolean)}let Y=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let J=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(J)return[J[1]];return[]}function MB(X){let{forExpr:$,content:Z,iterVarNames:Y,context:J,filePath:G,options:Q}=X,w=Object.keys(J),q=Object.values(J),W=Function(...w,"__pushIter",`
3617
3617
  for (${$}) {
3618
3618
  __pushIter([${Y.join(", ")}])
3619
3619
  }
3620
- `),K=[];W(...q,(B)=>{K.push(B)});let U=G??"inline.stx",z="";for(let B of K){let _={...J};Y.forEach((H,O)=>{_[H]=B[O]});let j=HJ(Z,_,G,Q);j=G5(j,_,U),j=b1(j,_,U),z+=j}return z}function BB(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@while\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=Q+G[0].length-1,q=N0(Y,"(",")",w);if(q===-1)break;let W=Y.slice(w+1,q),K=hX(Y.slice(Q),"while","endwhile");if(K.length===0)break;let U=K[0].content,z=Q+K[0].end;if(!jJ(W)){let B=$0("While",`Unsafe expression in @while: ${W}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,Q)+B+Y.substring(z),J=!0;continue}try{let B=Object.keys($),_=Object.values($),j=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,F)=>{return`\${${F}}`});j=BJ(j);let O=Function(...B,`
3620
+ `),U=[];W(...q,(B)=>{U.push(B)});let K=G??"inline.stx",z="";for(let B of U){let _={...J};Y.forEach((H,O)=>{_[H]=B[O]});let j=TJ(Z,_,G,Q);j=G5(j,_,K),j=b1(j,_,K),z+=j}return z}function NB(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@while\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=Q+G[0].length-1,q=N0(Y,"(",")",w);if(q===-1)break;let W=Y.slice(w+1,q),U=uX(Y.slice(Q),"while","endwhile");if(U.length===0)break;let K=U[0].content,z=Q+U[0].end;if(!RJ(W)){let B=$0("While",`Unsafe expression in @while: ${W}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,Q)+B+Y.substring(z),J=!0;continue}try{let B=Object.keys($),_=Object.values($),j=K.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,F)=>{return`\${${F}}`});j=AJ(j);let O=Function(...B,`
3621
3621
  let result = '';
3622
3622
  let maxIterations = ${Z}; // Configurable safety limit
3623
3623
  let counter = 0;
@@ -3629,21 +3629,21 @@ ${Q}`,J++}return{functionCode:Y,nextIndex:J}}function eY(X,$){let Z=Y0(X,$)??Y0(
3629
3629
  result += '<!-- [While Error [1104]]: Maximum iterations (${Z}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3630
3630
  }
3631
3631
  return result;
3632
- `)(..._);Y=Y.substring(0,Q)+O+Y.substring(z),J=!0}catch(B){let _=$0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+_+Y.substring(z),J=!0}}return Y}var JB=1000,GB=!1,w8="<!--__STX_BREAK__-->",q8="<!--__STX_CONTINUE__-->";var H3=D(()=>{dX();F1();w1();uX();F0()});import _0 from"path";function L3(X,$){let Z=0;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J===","&&Z===0)return Y}return-1}function jB(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=J.exec(Y);while(G){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")")q--;W++}if(q!==0)break;let K=Y.substring(w+1,W-1),U=`${Z}(${K})`;Y=Y.substring(0,Q)+U+Y.substring(W),J.lastIndex=Q+U.length,G=J.exec(Y)}return Y}function HB(X){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(X)}function FJ(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,w=(U)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===U){G++;return}G++}},q=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let U=1;while(G<Q&&U>0)if($[G]==="{")U++,G++;else if($[G]==="}")U--,G++;else if($[G]==="'"||$[G]==='"')w($[G]);else if($[G]==="`")q();else G++;continue}G++}},W=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
3633
- `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},K=()=>{if(J!==0)return;let U=$.slice(G).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 z=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let _=z[1];if(!Y.has(_))Z.push(_),Y.add(_);return}let B=$.slice(G).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(G<Q){if(W())continue;if($[G]==="'"||$[G]==='"'){w($[G]);continue}if($[G]==="`"){q();continue}if($[G]==="{"){J++,G++;continue}if($[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))K();G++}return Z.join(", ")}function VJ(X,$=""){let Z=FJ(X).split(",").map((Y)=>Y.trim()).filter(Boolean);return`
3632
+ `)(..._);Y=Y.substring(0,Q)+O+Y.substring(z),J=!0}catch(B){let _=$0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+_+Y.substring(z),J=!0}}return Y}var jB=1000,HB=!1,q8="<!--__STX_BREAK__-->",W8="<!--__STX_CONTINUE__-->";var H3=D(()=>{mX();O1();Q1();dX();F0()});import _0 from"path";function L3(X,$){let Z=0;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J===","&&Z===0)return Y}return-1}function kB(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=J.exec(Y);while(G){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")")q--;W++}if(q!==0)break;let U=Y.substring(w+1,W-1),K=`${Z}(${U})`;Y=Y.substring(0,Q)+K+Y.substring(W),J.lastIndex=Q+K.length,G=J.exec(Y)}return Y}function IB(X){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(X)}function kJ(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,w=(K)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===K){G++;return}G++}},q=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let K=1;while(G<Q&&K>0)if($[G]==="{")K++,G++;else if($[G]==="}")K--,G++;else if($[G]==="'"||$[G]==='"')w($[G]);else if($[G]==="`")q();else G++;continue}G++}},W=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
3633
+ `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},U=()=>{if(J!==0)return;let K=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let _=K[2];if(!Y.has(_))Z.push(_),Y.add(_);return}let z=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let _=z[1];if(!Y.has(_))Z.push(_),Y.add(_);return}let B=$.slice(G).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(G<Q){if(W())continue;if($[G]==="'"||$[G]==='"'){w($[G]);continue}if($[G]==="`"){q();continue}if($[G]==="{"){J++,G++;continue}if($[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))U();G++}return Z.join(", ")}function IJ(X,$=""){let Z=kJ(X).split(",").map((Y)=>Y.trim()).filter(Boolean);return`
3634
3634
  (function() {
3635
- ${N5("var",Z)}
3635
+ ${k5("var",Z)}
3636
3636
  var __destroyHooks = [];
3637
3637
  var __origOnDestroy = onDestroy;
3638
3638
  onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
3639
3639
 
3640
3640
  ${X}
3641
3641
  ${$}})();
3642
- `}function AJ(X,$){return`
3642
+ `}function EJ(X,$){return`
3643
3643
  // Register scope variables for STX runtime
3644
3644
  if (!window.stx._scopes) window.stx._scopes = {};
3645
3645
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
3646
- ${FJ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeRegistration[${JSON.stringify(G)}] = ${G}; } catch (e) { /* not actually top-level */ }`).join(`
3646
+ ${kJ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeRegistration[${JSON.stringify(G)}] = ${G}; } catch (e) { /* not actually top-level */ }`).join(`
3647
3647
  `)}
3648
3648
  // #1767: when the bundler renamed a component const that collided with an
3649
3649
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -3651,7 +3651,7 @@ ${FJ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
3651
3651
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
3652
3652
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
3653
3653
  window.stx._scopes['${$}'] = __scopeRegistration;
3654
- `}function LB(X,$){let Z=AJ(X,$),Y=`
3654
+ `}function EB(X,$){let Z=EJ(X,$),Y=`
3655
3655
  (function() {
3656
3656
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${$}"]') : null;
3657
3657
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -3660,21 +3660,21 @@ ${FJ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
3660
3660
  } finally {
3661
3661
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3662
3662
  }
3663
- })();`;return Y+VJ(X,Z)+`
3663
+ })();`;return Y+IJ(X,Z)+`
3664
3664
  } finally {
3665
3665
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
3666
3666
  }
3667
- })();`}function OB(X,$){let Z=X.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let J=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:X,mergedIntoExisting:J[1]};let G=Z[1],Q=Z[2],w=Z[3];return{html:`${G}${Q} data-stx-scope="${$}"${w}${X.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:X,mergedIntoExisting:null}}function VB(X){if(X.__onceStore instanceof Set)return X.__onceStore;return FB}async function O3(X,$,Z,Y,J,G=new Set){let Q=Y.partialsDir||_0.join(_0.dirname(Z),"partials");if(Q&&!_0.isAbsolute(Q))Q=_0.resolve(process.cwd(),Q);let w=jB(X,"@partial","@include"),q=VB($);w=w.replace(/@once([\s\S]*?)@endonce/g,(_,j,H)=>{let O=j.trim(),L=`${Z}:${O}`;if(q.has(L))return"";return q.add(L),j});{let _=/@includeIf\s*\(/g,j;while((j=_.exec(w))!==null){let H=j.index,O=H+j[0].length-1,L=1,F=O+1;while(F<w.length&&L>0){if(w[F]==="(")L++;else if(w[F]===")")L--;F++}if(L!==0)break;let V=w.substring(O+1,F-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){_.lastIndex=F;continue}let R=A[1],T=W(R,Q,Z),M="";if(T&&await Bun.file(T).exists())J.add(T),M=`@include(${V})`;w=w.substring(0,H)+M+w.substring(F),_.lastIndex=0}}for(let[_,j]of[["@includeWhen",!1],["@includeUnless",!0]]){let H=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=H.exec(w))!==null){let L=O.index,F=L+O[0].length-1,V=1,A=F+1;while(A<w.length&&V>0){if(w[A]==="(")V++;else if(w[A]===")")V--;A++}if(V!==0)break;let R=w.substring(F+1,A-1),T=L3(R,0);if(T===-1){H.lastIndex=A;continue}let M=R.substring(0,T).trim(),k=R.substring(T+1).trim(),N=k.match(/^\s*['"]([^'"]+)['"]/);if(!N){H.lastIndex=A;continue}let y=N[1],I=k.substring(N[0].length),C,S=L3(I,0);if(S!==-1)C=I.substring(S+1).trim();try{let b=`Boolean(${M})`,P;if(q0(b)){let l=W0(b,Object.keys($));P=Boolean(l(...Object.values($)))}else P=Boolean(Y0(b,$));let x=j?!P:P,m="";if(x){let l=W(y,Q,Z);if(l&&await Bun.file(l).exists())J.add(l);m=`@include('${y}'${C?`, ${C}`:""})`}w=w.substring(0,L)+m+w.substring(A),H.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),x=U0("Include",`Error evaluating ${_} condition: ${P}`,Z,X,L);w=w.substring(0,L)+x+w.substring(A),H.lastIndex=0}}}{let _=/@each\s*\(/g,j;while((j=_.exec(w))!==null){let H=j.index,O=H+j[0].length-1,L=1,F=O+1;while(F<w.length&&L>0){if(w[F]==="(")L++;else if(w[F]===")"){if(L--,L===0)break}F++}if(L!==0)break;let V=w.substring(O+1,F),A=w.substring(H,F+1),R=V.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){_.lastIndex=0,w=w.replace(A,"");continue}let[,T,M,k,N]=R;try{let y,I=M.trim();if(q0(I))y=W0(I,Object.keys($))(...Object.values($));else y=Y0(I,$);let C="";if(Array.isArray(y)&&y.length>0)for(let S of y){let b={...$,[k]:S},P=await U(T,b,X,H);C+=P}else if(N)C=await U(N,{},X,H);w=w.substring(0,H)+C+w.substring(F+1),_.lastIndex=0}catch(y){let I=y instanceof Error?y.message:String(y);w=w.substring(0,H)+U0("Each",`Error in @each: ${I}`,Z,X,H)+w.substring(F+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,j;while((j=_.exec(w))!==null){let H=j.index,O=H+j[0].length-1,L=1,F=O+1;while(F<w.length&&L>0){if(w[F]==="(")L++;else if(w[F]===")"){if(L--,L===0)break}F++}if(L!==0)break;let V=w.substring(O+1,F),A=w.substring(H,F+1),R=V.match(/^\s*(\[[^\]]+\])/);if(!R){_.lastIndex=0,w=w.replace(A,"");continue}let T=R[1],M=V.slice(R[0].length),k,N=M.match(/^\s*,\s*\{/);if(N){M=M.slice(N[0].length-1);let C=1,S=1;while(S<M.length&&C>0){if(M[S]==="{")C++;else if(M[S]==="}"){if(C--,C===0)break}S++}k=M.substring(0,S+1),M=M.slice(S+1)}let y,I=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(I)y=I[1];try{let C=JSON.parse(T.replace(/'/g,'"')),S={};if(k)try{S=O0(k,$)}catch(P){let x=P instanceof Error?P.message:String(P);if(Y.debug){let m=U0("Include",`Error parsing includeFirst variables: ${x}`,Z,X,H,A);w=w.replace(A,()=>m)}else w=w.replace(A,()=>y||"");continue}let b=!1;for(let P of C){let x=W(P,Q,Z);if(!x)continue;if(await i(x)){let m=await U(P,S,X,H);w=w.replace(A,()=>m),b=!0;break}}if(!b)if(y!==void 0)w=w.replace(A,()=>y);else if(Y.debug){let P=U0("Include",`None of the includeFirst paths exist: ${T}`,Z,X,H,A);w=w.replace(A,()=>P)}else w=w.replace(A,"")}catch(C){let S=C instanceof Error?C.message:String(C),b=U0("Include",`Error processing @includeFirst: ${S}`,Z,X,H,A);w=w.replace(A,()=>b)}_.lastIndex=0}}function W(_,j,H){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let L=_0.resolve(j),F=_0.resolve(_0.dirname(H)),V;if(!O.startsWith("./")&&!O.startsWith("../"))V=_0.resolve(j,O);else V=_0.resolve(F,O);let A=_0.normalize(V),R=A.startsWith(L+_0.sep)||A===L,T=A.startsWith(F+_0.sep)||A===F,M=!1,k=_0.dirname(F);if(A.startsWith(k+_0.sep)){if(!_0.relative(k,A).split(_0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))M=!0}if(!R&&!T&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${L}, ${F}`),null;return A}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let K=_0.resolve(Z);G.add(K);async function U(_,j={},H,O){let L=W(_,Q,Z);if(!L)return U0("Include",`Could not resolve path for include: ${_}`,Z,H,O);let F=_0.resolve(L);if(G.has(F)){let V=[...G,F].map((A)=>_0.basename(A)).join(" -> ");return U0("Include",`Circular include detected: ${V}`,Z,H,O)}try{J.add(L);let V;if(!V)try{V=await Bun.file(L).text()}catch(x){let m=x instanceof Error?x.message:String(x);return U0("Include",`Error loading include file ${_}: ${m}`,Z,H,O)}if(V)V=V.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(V&&V.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (v9(),P9));V=x(V,$)}if(V&&(Y.debug||!C7()&&!CX()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (f9(),AY));x(V,L)}catch{}let A=V;try{let{processESImports:x}=await Promise.resolve().then(() => (K3(),nY));await x(V,$,L,Y,J)}catch(x){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let R=g5(A);if(R)A=R.content.trim();let M=V.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k="";if(M)k=`<style${M[1]}>${M[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let N={...$};N.__stx_signals_gate=L1(V);for(let[x,m]of Object.entries(j))N[x]=m;let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...V.matchAll(y)],C="",S=null;for(let x of I){let m=x[1]||"",l=x[2]||"",Q0=m.includes("server"),c0=e1(m),R0="";try{let{extractAndStripCssImports:c,renderVendorStyleTags:j0}=await Promise.resolve().then(() => (D5(),b6)),p0=c(l,{filePath:L,projectRoot:process.cwd()});l=p0.code,R0=j0(p0.styles)}catch(c){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,c instanceof Error?c.message:c)}if(c0&&l.trim())l=X5(l);if(!Q0)try{let{hasUserImports:c,bundleClientScript:j0}=await Promise.resolve().then(() => (N7(),M7));if(c(l))l=await j0(l,L,{projectRoot:process.cwd()})}catch(c){if(Y.debug)console.warn(`[stx] bundler skipped for ${L}:`,c instanceof Error?c.message:c)}let s0=HB(l);if(s0&&!Q0){S=`stx_scope_${_0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++OJ}`;let c=h0(l),j0=LB(c,S);C+=`${R0}<script data-stx-scoped data-stx-run="always">${j0}</script>
3668
- `;continue}if(Q0)try{let{extractVariables:c}=await Promise.resolve().then(() => (p5(),G8));await c(l,N,L)}catch(c){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,c)}if(!Q0&&!s0){let c=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${_0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++OJ}`;let j0=h0(l),p0=AJ(j0,S),M1=VJ(j0,p0);C+=`${R0}<script data-stx-scoped data-stx-run="always"${c?` ${c}`:""}>${M1}</script>
3669
- `}}if(S){let x=OB(A,S);if(A=x.html,x.mergedIntoExisting)C=C.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),S=x.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await O3(A,N,L,Y,J,G);let{processLoops:b}=await Promise.resolve().then(() => (H3(),LJ)),P=b(A,N,L);if(P=G5(P,N,L),P=b1(P,N,L),k)P+=`
3667
+ })();`}function DB(X,$){let Z=X.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let J=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:X,mergedIntoExisting:J[1]};let G=Z[1],Q=Z[2],w=Z[3];return{html:`${G}${Q} data-stx-scope="${$}"${w}${X.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:X,mergedIntoExisting:null}}function bB(X){if(X.__onceStore instanceof Set)return X.__onceStore;return yB}async function O3(X,$,Z,Y,J,G=new Set){let Q=Y.partialsDir||_0.join(_0.dirname(Z),"partials");if(Q&&!_0.isAbsolute(Q))Q=_0.resolve(process.cwd(),Q);let w=kB(X,"@partial","@include"),q=bB($);w=w.replace(/@once([\s\S]*?)@endonce/g,(_,j,H)=>{let O=j.trim(),L=`${Z}:${O}`;if(q.has(L))return"";return q.add(L),j});{let _=/@includeIf\s*\(/g,j;while((j=_.exec(w))!==null){let H=j.index,O=H+j[0].length-1,L=1,F=O+1;while(F<w.length&&L>0){if(w[F]==="(")L++;else if(w[F]===")")L--;F++}if(L!==0)break;let V=w.substring(O+1,F-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){_.lastIndex=F;continue}let R=A[1],T=W(R,Q,Z),M="";if(T&&await Bun.file(T).exists())J.add(T),M=`@include(${V})`;w=w.substring(0,H)+M+w.substring(F),_.lastIndex=0}}for(let[_,j]of[["@includeWhen",!1],["@includeUnless",!0]]){let H=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=H.exec(w))!==null){let L=O.index,F=L+O[0].length-1,V=1,A=F+1;while(A<w.length&&V>0){if(w[A]==="(")V++;else if(w[A]===")")V--;A++}if(V!==0)break;let R=w.substring(F+1,A-1),T=L3(R,0);if(T===-1){H.lastIndex=A;continue}let M=R.substring(0,T).trim(),k=R.substring(T+1).trim(),N=k.match(/^\s*['"]([^'"]+)['"]/);if(!N){H.lastIndex=A;continue}let y=N[1],I=k.substring(N[0].length),C,S=L3(I,0);if(S!==-1)C=I.substring(S+1).trim();try{let b=`Boolean(${M})`,P;if(q0(b)){let l=W0(b,Object.keys($));P=Boolean(l(...Object.values($)))}else P=Boolean(Y0(b,$));let x=j?!P:P,m="";if(x){let l=W(y,Q,Z);if(l&&await Bun.file(l).exists())J.add(l);m=`@include('${y}'${C?`, ${C}`:""})`}w=w.substring(0,L)+m+w.substring(A),H.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),x=K0("Include",`Error evaluating ${_} condition: ${P}`,Z,X,L);w=w.substring(0,L)+x+w.substring(A),H.lastIndex=0}}}{let _=/@each\s*\(/g,j;while((j=_.exec(w))!==null){let H=j.index,O=H+j[0].length-1,L=1,F=O+1;while(F<w.length&&L>0){if(w[F]==="(")L++;else if(w[F]===")"){if(L--,L===0)break}F++}if(L!==0)break;let V=w.substring(O+1,F),A=w.substring(H,F+1),R=V.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){_.lastIndex=0,w=w.replace(A,"");continue}let[,T,M,k,N]=R;try{let y,I=M.trim();if(q0(I))y=W0(I,Object.keys($))(...Object.values($));else y=Y0(I,$);let C="";if(Array.isArray(y)&&y.length>0)for(let S of y){let b={...$,[k]:S},P=await K(T,b,X,H);C+=P}else if(N)C=await K(N,{},X,H);w=w.substring(0,H)+C+w.substring(F+1),_.lastIndex=0}catch(y){let I=y instanceof Error?y.message:String(y);w=w.substring(0,H)+K0("Each",`Error in @each: ${I}`,Z,X,H)+w.substring(F+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,j;while((j=_.exec(w))!==null){let H=j.index,O=H+j[0].length-1,L=1,F=O+1;while(F<w.length&&L>0){if(w[F]==="(")L++;else if(w[F]===")"){if(L--,L===0)break}F++}if(L!==0)break;let V=w.substring(O+1,F),A=w.substring(H,F+1),R=V.match(/^\s*(\[[^\]]+\])/);if(!R){_.lastIndex=0,w=w.replace(A,"");continue}let T=R[1],M=V.slice(R[0].length),k,N=M.match(/^\s*,\s*\{/);if(N){M=M.slice(N[0].length-1);let C=1,S=1;while(S<M.length&&C>0){if(M[S]==="{")C++;else if(M[S]==="}"){if(C--,C===0)break}S++}k=M.substring(0,S+1),M=M.slice(S+1)}let y,I=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(I)y=I[1];try{let C=JSON.parse(T.replace(/'/g,'"')),S={};if(k)try{S=O0(k,$)}catch(P){let x=P instanceof Error?P.message:String(P);if(Y.debug){let m=K0("Include",`Error parsing includeFirst variables: ${x}`,Z,X,H,A);w=w.replace(A,()=>m)}else w=w.replace(A,()=>y||"");continue}let b=!1;for(let P of C){let x=W(P,Q,Z);if(!x)continue;if(await i(x)){let m=await K(P,S,X,H);w=w.replace(A,()=>m),b=!0;break}}if(!b)if(y!==void 0)w=w.replace(A,()=>y);else if(Y.debug){let P=K0("Include",`None of the includeFirst paths exist: ${T}`,Z,X,H,A);w=w.replace(A,()=>P)}else w=w.replace(A,"")}catch(C){let S=C instanceof Error?C.message:String(C),b=K0("Include",`Error processing @includeFirst: ${S}`,Z,X,H,A);w=w.replace(A,()=>b)}_.lastIndex=0}}function W(_,j,H){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let L=_0.resolve(j),F=_0.resolve(_0.dirname(H)),V;if(!O.startsWith("./")&&!O.startsWith("../"))V=_0.resolve(j,O);else V=_0.resolve(F,O);let A=_0.normalize(V),R=A.startsWith(L+_0.sep)||A===L,T=A.startsWith(F+_0.sep)||A===F,M=!1,k=_0.dirname(F);if(A.startsWith(k+_0.sep)){if(!_0.relative(k,A).split(_0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))M=!0}if(!R&&!T&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${L}, ${F}`),null;return A}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let U=_0.resolve(Z);G.add(U);async function K(_,j={},H,O){let L=W(_,Q,Z);if(!L)return K0("Include",`Could not resolve path for include: ${_}`,Z,H,O);let F=_0.resolve(L);if(G.has(F)){let V=[...G,F].map((A)=>_0.basename(A)).join(" -> ");return K0("Include",`Circular include detected: ${V}`,Z,H,O)}try{J.add(L);let V;if(!V)try{V=await Bun.file(L).text()}catch(x){let m=x instanceof Error?x.message:String(x);return K0("Include",`Error loading include file ${_}: ${m}`,Z,H,O)}if(V)V=V.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(V&&V.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (v9(),P9));V=x(V,$)}if(V&&(Y.debug||!v7()&&!PX()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (f9(),EY));x(V,L)}catch{}let A=V;try{let{processESImports:x}=await Promise.resolve().then(() => (U3(),XJ));await x(V,$,L,Y,J)}catch(x){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let R=h5(A);if(R)A=R.content.trim();let M=V.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k="";if(M)k=`<style${M[1]}>${M[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let N={...$};N.__stx_signals_gate=H1(V);for(let[x,m]of Object.entries(j))N[x]=m;let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...V.matchAll(y)],C="",S=null;for(let x of I){let m=x[1]||"",l=x[2]||"",Q0=m.includes("server"),l0=e1(m),R0="";try{let{extractAndStripCssImports:c,renderVendorStyleTags:j0}=await Promise.resolve().then(() => (y5(),f6)),c0=c(l,{filePath:L,projectRoot:process.cwd()});l=c0.code,R0=j0(c0.styles)}catch(c){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,c instanceof Error?c.message:c)}if(l0&&l.trim())l=X5(l);if(!Q0)try{let{hasUserImports:c,bundleClientScript:j0}=await Promise.resolve().then(() => (k7(),N7));if(c(l))l=await j0(l,L,{projectRoot:process.cwd()})}catch(c){if(Y.debug)console.warn(`[stx] bundler skipped for ${L}:`,c instanceof Error?c.message:c)}let r0=IB(l);if(r0&&!Q0){S=`stx_scope_${_0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++NJ}`;let c=h0(l),j0=EB(c,S);C+=`${R0}<script data-stx-scoped data-stx-run="always">${j0}</script>
3668
+ `;continue}if(Q0)try{let{extractVariables:c}=await Promise.resolve().then(() => (i5(),Q8));await c(l,N,L)}catch(c){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,c)}if(!Q0&&!r0){let c=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${_0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++NJ}`;let j0=h0(l),c0=EJ(j0,S),T1=IJ(j0,c0);C+=`${R0}<script data-stx-scoped data-stx-run="always"${c?` ${c}`:""}>${T1}</script>
3669
+ `}}if(S){let x=DB(A,S);if(A=x.html,x.mergedIntoExisting)C=C.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),S=x.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await O3(A,N,L,Y,J,G);let{processLoops:b}=await Promise.resolve().then(() => (H3(),MJ)),P=b(A,N,L);if(P=G5(P,N,L),P=b1(P,N,L),k)P+=`
3670
3670
  `+k;if(C)P+=`
3671
- `+C;return P}catch(V){let A=V instanceof Error?V.message:String(V);return U0("Include",`Error processing include ${_}: ${A}`,Z,H,O)}}let z=/@include\s*\(/g,B;while((B=z.exec(w))!==null){let _=B.index,j=_+B[0].length-1,H=1,O=j+1;while(O<w.length&&H>0){if(w[O]==="(")H++;else if(w[O]===")")H--;O++}if(H!==0)break;let L=w.substring(_,O),F=w.substring(j+1,O-1),V=F.match(/^\s*['"]([^'"]+)['"]/);if(!V){z.lastIndex=O;continue}let A=V[1],R,T=F.substring(V[0].length),M=L3(T,0);if(M!==-1)R=T.substring(M+1).trim();let k={};if(R)try{k=O0(R,$)}catch(y){let I=y instanceof Error?y.message:String(y);w=w.replace(L,U0("Include",`Error parsing include variables for ${A}: ${I}`,Z,X,_)),z.lastIndex=0;continue}let N=await U(A,k,X,_);w=w.substring(0,_)+N+w.substring(O),z.lastIndex=0}return w}function F3(X,$){let Z=X;function Y(J,G,Q,w){let q=J,W=!0;while(W){W=!1;let K=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),U=q.match(K);if(!U||U.index===void 0)break;let z=U.index,B=U[1],_=z+U[0].length,j=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),O=1,L=_,F=-1;while(O>0&&L<q.length){let A=q.slice(L),R=A.match(j),T=A.match(H),M=R?L+R.index:1/0,k=T?L+T.index:1/0;if(M<k)O++,L=M+(R[0].length||1);else if(k<1/0){if(O--,O===0){F=k;break}L=k+Q.length+1}else break}if(F===-1)break;let V=q.slice(_,F);if(!$[B])$[B]=[];if(w)$[B].unshift(V);else $[B].push(V);q=q.substring(0,z)+q.substring(F+`@${Q}`.length),W=!0}return q}return Z=Y(Z,"push","endpush",!1),Z=Y(Z,"prepend","endprepend",!0),Z}function V3(X,$){return X.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,Y)=>{if(!$[Y]||$[Y].length===0)return"";return $[Y].join(`
3672
- `)})}var OJ=0,LN,FB;var RJ=D(()=>{nX();dX();w1();G1();C5();F0();T0();LN=new Z5(500),FB=new Set});import*as A3 from"path";async function TJ(X,$,Z=""){if(A3.basename(Z)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,X.replace(/@js[\s\S]*?@endjs/g,"");return NJ(X,$,Z,"@js","@endjs")}async function MJ(X,$,Z=""){if(A3.basename(Z)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return X.replace(/@ts[\s\S]*?@endts/g,"")}return NJ(X,$,Z,"@ts","@endts")}async function NJ(X,$,Z,Y,J){let G=X,Q=S5(`${Y}([\\s\\S]*?)${J}`,"g"),w=[],q;while((q=Q.exec(X))!==null)w.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:K,index:U}of w)try{let z={...$,global:$},B=Object.keys(z),_=Object.values(z),j=K.trim();if(Y==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let O=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=O.length>0?`return { ${O.join(", ")} };`:"return {};",F=`
3671
+ `+C;return P}catch(V){let A=V instanceof Error?V.message:String(V);return K0("Include",`Error processing include ${_}: ${A}`,Z,H,O)}}let z=/@include\s*\(/g,B;while((B=z.exec(w))!==null){let _=B.index,j=_+B[0].length-1,H=1,O=j+1;while(O<w.length&&H>0){if(w[O]==="(")H++;else if(w[O]===")")H--;O++}if(H!==0)break;let L=w.substring(_,O),F=w.substring(j+1,O-1),V=F.match(/^\s*['"]([^'"]+)['"]/);if(!V){z.lastIndex=O;continue}let A=V[1],R,T=F.substring(V[0].length),M=L3(T,0);if(M!==-1)R=T.substring(M+1).trim();let k={};if(R)try{k=O0(R,$)}catch(y){let I=y instanceof Error?y.message:String(y);w=w.replace(L,K0("Include",`Error parsing include variables for ${A}: ${I}`,Z,X,_)),z.lastIndex=0;continue}let N=await K(A,k,X,_);w=w.substring(0,_)+N+w.substring(O),z.lastIndex=0}return w}function F3(X,$){let Z=X;function Y(J,G,Q,w){let q=J,W=!0;while(W){W=!1;let U=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),K=q.match(U);if(!K||K.index===void 0)break;let z=K.index,B=K[1],_=z+K[0].length,j=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),O=1,L=_,F=-1;while(O>0&&L<q.length){let A=q.slice(L),R=A.match(j),T=A.match(H),M=R?L+R.index:1/0,k=T?L+T.index:1/0;if(M<k)O++,L=M+(R[0].length||1);else if(k<1/0){if(O--,O===0){F=k;break}L=k+Q.length+1}else break}if(F===-1)break;let V=q.slice(_,F);if(!$[B])$[B]=[];if(w)$[B].unshift(V);else $[B].push(V);q=q.substring(0,z)+q.substring(F+`@${Q}`.length),W=!0}return q}return Z=Y(Z,"push","endpush",!1),Z=Y(Z,"prepend","endprepend",!0),Z}function V3(X,$){return X.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,Y)=>{if(!$[Y]||$[Y].length===0)return"";return $[Y].join(`
3672
+ `)})}var NJ=0,CN,yB;var DJ=D(()=>{rX();mX();Q1();J1();P5();F0();T0();CN=new Z5(500),yB=new Set});import*as A3 from"path";async function yJ(X,$,Z=""){if(A3.basename(Z)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,X.replace(/@js[\s\S]*?@endjs/g,"");return SJ(X,$,Z,"@js","@endjs")}async function bJ(X,$,Z=""){if(A3.basename(Z)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return X.replace(/@ts[\s\S]*?@endts/g,"")}return SJ(X,$,Z,"@ts","@endts")}async function SJ(X,$,Z,Y,J){let G=X,Q=C5(`${Y}([\\s\\S]*?)${J}`,"g"),w=[],q;while((q=Q.exec(X))!==null)w.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:K}of w)try{let z={...$,global:$},B=Object.keys(z),_=Object.values(z),j=U.trim();if(Y==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let O=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=O.length>0?`return { ${O.join(", ")} };`:"return {};",F=`
3673
3673
  ${j}
3674
3674
  ${L}
3675
- `,A=Function(...B,F)(..._);if(A&&typeof A==="object")Object.assign($,A);G=G.replace(W,"")}catch(z){console.error(`Error executing ${Y} code block in ${Z}:`,z);let B=z instanceof Error?z.message:String(z),_=U0(`${Y} Directive`,`Error executing code: ${B}`,Z,X,U,W);console.error(_),G=G.replace(W,"")}return G}var kJ=D(()=>{C5();T0()});function AB(X,$="_method"){let Z=X.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${$}" value="${Z}">`}function IJ(X){return X.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,($,Z,Y,J,G)=>{return AB(Y,G||"_method")})}async function EJ(X,$,Z,Y,J){if(!Y.middleware||Y.middleware.length===0)return X;let G=X,Q=Y.middleware.filter((w)=>w.timing===J);if(Q.length===0)return G;for(let w of Q){if(!w.name||typeof w.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",w);continue}try{let q=await w.handler(G,$,Z,Y);if(typeof q==="string")G=q;else if(Y.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(q){if(Y.debug)console.error(`Error in middleware ${w.name}:`,q);if(Y.debug){let W=U0("Middleware",`Error in middleware '${w.name}': ${q instanceof Error?q.message:String(q)}`,Z,X);G=G.replace(/<body[^>]*>/,`$&
3676
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${t0(W)}</div>
3677
- `)}}}return G}async function DJ(X,$,Z,Y){return EJ(X,$,Z,Y,"before")}async function yJ(X,$,Z,Y){return EJ(X,$,Z,Y,"after")}var bJ=D(()=>{w1();T0()});function SJ(X){return X.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,($,Z,Y,J,G)=>{try{let Q=J?O0(J,{}):{};return j7(Y,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var CJ=D(()=>{n1();n1();F0()});function PJ(X,$,Z,Y){let J=X;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,q,W)=>{if(!W&&q.includes(":")){let K=q.split(":"),U=q,z=K.length>1?K[1]:"";if(z&&$[z])W=$[z];else if(U.startsWith("og:")&&$.openGraph&&$.openGraph[K[1]])W=$.openGraph[K[1]];else W="";return W?`<meta property="${p(U)}" content="${p(W)}">`:""}return W?`<meta name="${p(q)}" content="${p(W)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(J))!==null){let w=Q.index,q=w+Q[0].length-1,W=1,K=q+1;while(K<J.length&&W>0){if(J[K]==="(")W++;else if(J[K]===")"){if(W--,W===0)break}K++}if(W!==0)break;let U=J.substring(q+1,K).trim(),z=K+1,B=(()=>{try{let _=O0(U,$);if(!_)return"";let j="<meta";if(_.name)j+=` name="${p(String(_.name))}"`;if(_.property)j+=` property="${p(String(_.property))}"`;if(_.httpEquiv)j+=` http-equiv="${p(String(_.httpEquiv))}"`;if(_.content)j+=` content="${p(String(_.content))}"`;return j+=">",j}catch(_){let j=_ instanceof Error?_.message:String(_);return $0("MetaTag",j,o.EVALUATION_ERROR)}})();J=J.substring(0,w)+B+J.substring(z),G.lastIndex=0}return J}function vJ(X,$,Z){let Y=X,J=/@structuredData\s*\(/g,G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let K=Y.substring(w+1,W).trim(),U=W+1,z=(()=>{try{let B=O0(K,$);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let _=B instanceof Error?B.message:String(B);return $0("StructuredData",_,o.EVALUATION_ERROR)}})();Y=Y.substring(0,Q)+z+Y.substring(U),J.lastIndex=0}return Y}function xJ(X,$,Z,Y){let J=X,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(J))!==null){let w=J.indexOf("{",Q.index+4),q=1,W=w+1,K=null,U=!1;while(W<J.length&&q>0){let O=J[W];if(U){U=!1,W++;continue}if(O==="\\"&&K){U=!0,W++;continue}if(K){if(O===K)K=null;W++;continue}if(O==='"'||O==="'"||O==="`"){K=O,W++;continue}if(O==="{")q++;else if(O==="}")q--;W++}if(q!==0)break;let z=J.substring(W).match(/^\s*\)/);if(!z)break;let B=W+z[0].length,_=J.substring(w,W),j=J.substring(Q.index,B),H=((O)=>{try{let L=O0(O,$);if(!L)return"";let F="";if(L.title)F+=`<title>${p(L.title)}</title>
3675
+ `,A=Function(...B,F)(..._);if(A&&typeof A==="object")Object.assign($,A);G=G.replace(W,"")}catch(z){console.error(`Error executing ${Y} code block in ${Z}:`,z);let B=z instanceof Error?z.message:String(z),_=K0(`${Y} Directive`,`Error executing code: ${B}`,Z,X,K,W);console.error(_),G=G.replace(W,"")}return G}var CJ=D(()=>{P5();T0()});function SB(X,$="_method"){let Z=X.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${$}" value="${Z}">`}function PJ(X){return X.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,($,Z,Y,J,G)=>{return SB(Y,G||"_method")})}async function vJ(X,$,Z,Y,J){if(!Y.middleware||Y.middleware.length===0)return X;let G=X,Q=Y.middleware.filter((w)=>w.timing===J);if(Q.length===0)return G;for(let w of Q){if(!w.name||typeof w.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",w);continue}try{let q=await w.handler(G,$,Z,Y);if(typeof q==="string")G=q;else if(Y.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(q){if(Y.debug)console.error(`Error in middleware ${w.name}:`,q);if(Y.debug){let W=K0("Middleware",`Error in middleware '${w.name}': ${q instanceof Error?q.message:String(q)}`,Z,X);G=G.replace(/<body[^>]*>/,`$&
3676
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${a0(W)}</div>
3677
+ `)}}}return G}async function xJ(X,$,Z,Y){return vJ(X,$,Z,Y,"before")}async function fJ(X,$,Z,Y){return vJ(X,$,Z,Y,"after")}var gJ=D(()=>{Q1();T0()});function hJ(X){return X.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,($,Z,Y,J,G)=>{try{let Q=J?O0(J,{}):{};return H7(Y,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var uJ=D(()=>{n1();n1();F0()});function dJ(X,$,Z,Y){let J=X;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),K=q,z=U.length>1?U[1]:"";if(z&&$[z])W=$[z];else if(K.startsWith("og:")&&$.openGraph&&$.openGraph[U[1]])W=$.openGraph[U[1]];else W="";return W?`<meta property="${p(K)}" content="${p(W)}">`:""}return W?`<meta name="${p(q)}" content="${p(W)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(J))!==null){let w=Q.index,q=w+Q[0].length-1,W=1,U=q+1;while(U<J.length&&W>0){if(J[U]==="(")W++;else if(J[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let K=J.substring(q+1,U).trim(),z=U+1,B=(()=>{try{let _=O0(K,$);if(!_)return"";let j="<meta";if(_.name)j+=` name="${p(String(_.name))}"`;if(_.property)j+=` property="${p(String(_.property))}"`;if(_.httpEquiv)j+=` http-equiv="${p(String(_.httpEquiv))}"`;if(_.content)j+=` content="${p(String(_.content))}"`;return j+=">",j}catch(_){let j=_ instanceof Error?_.message:String(_);return $0("MetaTag",j,o.EVALUATION_ERROR)}})();J=J.substring(0,w)+B+J.substring(z),G.lastIndex=0}return J}function mJ(X,$,Z){let Y=X,J=/@structuredData\s*\(/g,G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=Y.substring(w+1,W).trim(),K=W+1,z=(()=>{try{let B=O0(U,$);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let _=B instanceof Error?B.message:String(B);return $0("StructuredData",_,o.EVALUATION_ERROR)}})();Y=Y.substring(0,Q)+z+Y.substring(K),J.lastIndex=0}return Y}function lJ(X,$,Z,Y){let J=X,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(J))!==null){let w=J.indexOf("{",Q.index+4),q=1,W=w+1,U=null,K=!1;while(W<J.length&&q>0){let O=J[W];if(K){K=!1,W++;continue}if(O==="\\"&&U){K=!0,W++;continue}if(U){if(O===U)U=null;W++;continue}if(O==='"'||O==="'"||O==="`"){U=O,W++;continue}if(O==="{")q++;else if(O==="}")q--;W++}if(q!==0)break;let z=J.substring(W).match(/^\s*\)/);if(!z)break;let B=W+z[0].length,_=J.substring(w,W),j=J.substring(Q.index,B),H=((O)=>{try{let L=O0(O,$);if(!L)return"";let F="";if(L.title)F+=`<title>${p(L.title)}</title>
3678
3678
  `,F+=`<meta name="title" content="${p(L.title)}">
3679
3679
  `;if(L.description)F+=`<meta name="description" content="${p(L.description)}">
3680
3680
  `;if(L.keywords){let V=Array.isArray(L.keywords)?L.keywords.join(", "):L.keywords;F+=`<meta name="keywords" content="${p(V)}">
@@ -3696,7 +3696,7 @@ ${FJ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
3696
3696
  `}if(V.site)F+=`<meta name="twitter:site" content="${p(V.site)}">
3697
3697
  `;if(V.creator)F+=`<meta name="twitter:creator" content="${p(V.creator)}">
3698
3698
  `}if(L.structuredData){let V=JSON.stringify(L.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${V}</script>
3699
- `}return F.trim()}catch(L){let F=L instanceof Error?L.message:String(L);return $0("SEO",`Error processing @seo directive: ${F}`,o.EVALUATION_ERROR)}})(_);J=J.substring(0,Q.index)+H+J.substring(B),G.lastIndex=Q.index+H.length}return J}function fJ(X,$,Z){if(Z.seo?.enabled===!1)return X;if(X.includes("<!-- stx SEO Tags -->")||Z.skipDefaultSeoTags===!0)return X;let Y=$.__stx_runtime_head;if(!!(Y?.title||Y?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return X;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(X))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let G=X.includes("<title>")||X.includes("</title>"),Q="";if($.title)Q=$.title;else if($.meta&&$.meta.title)Q=$.meta.title;else if(Z.seo?.defaultConfig?.title)Q=Z.seo.defaultConfig.title;else Q=Z.defaultTitle||"stx Project";let w="";if($.description)w=$.description;else if($.meta&&$.meta.description)w=$.meta.description;else if(Z.seo?.defaultConfig?.description)w=Z.seo.defaultConfig.description;else w=Z.defaultDescription||"A website built with stx templating engine";let q="";if($.image)q=$.image;else if($.meta&&$.meta.image)q=$.meta.image;else if($.openGraph&&$.openGraph.image)q=$.openGraph.image;else if(Z.seo?.defaultImage)q=Z.seo.defaultImage;else if(Z.defaultImage)q=Z.defaultImage;let W=`
3699
+ `}return F.trim()}catch(L){let F=L instanceof Error?L.message:String(L);return $0("SEO",`Error processing @seo directive: ${F}`,o.EVALUATION_ERROR)}})(_);J=J.substring(0,Q.index)+H+J.substring(B),G.lastIndex=Q.index+H.length}return J}function cJ(X,$,Z){if(Z.seo?.enabled===!1)return X;if(X.includes("<!-- stx SEO Tags -->")||Z.skipDefaultSeoTags===!0)return X;let Y=$.__stx_runtime_head;if(!!(Y?.title||Y?.meta?.some((K)=>K.property==="og:title"||K.name==="og:title"||K.name==="twitter:title"||K.name==="description")))return X;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(X))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let G=X.includes("<title>")||X.includes("</title>"),Q="";if($.title)Q=$.title;else if($.meta&&$.meta.title)Q=$.meta.title;else if(Z.seo?.defaultConfig?.title)Q=Z.seo.defaultConfig.title;else Q=Z.defaultTitle||"stx Project";let w="";if($.description)w=$.description;else if($.meta&&$.meta.description)w=$.meta.description;else if(Z.seo?.defaultConfig?.description)w=Z.seo.defaultConfig.description;else w=Z.defaultDescription||"A website built with stx templating engine";let q="";if($.image)q=$.image;else if($.meta&&$.meta.image)q=$.meta.image;else if($.openGraph&&$.openGraph.image)q=$.openGraph.image;else if(Z.seo?.defaultImage)q=Z.seo.defaultImage;else if(Z.defaultImage)q=Z.defaultImage;let W=`
3700
3700
  <!-- stx SEO Tags -->
3701
3701
  <meta name="title" content="${p(Q)}">
3702
3702
  <meta name="description" content="${p(w)}">
@@ -3709,32 +3709,32 @@ ${FJ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
3709
3709
  `;if(q)W+=`
3710
3710
  <meta property="og:image" content="${p(q)}">
3711
3711
  <meta name="twitter:image" content="${p(q)}">
3712
- `;let K=X;if(!G)K=K.replace(/<head[^>]*>/,`$&
3713
- <title>${p(Q)}</title>`);return K.replace(/<head[^>]*>/,`$&
3712
+ `;let U=X;if(!G)U=U.replace(/<head[^>]*>/,`$&
3713
+ <title>${p(Q)}</title>`);return U.replace(/<head[^>]*>/,`$&
3714
3714
  ${W}
3715
- `)}function p(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var gJ,hJ;var R3=D(()=>{F1();F0();gJ={name:"meta",handler:(X,$,Z,Y)=>{if($.length<1)return $0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"";return`<meta name="${p(J)}" content="${p(G)}">`},hasEndTag:!1},hJ={name:"structuredData",handler:(X,$,Z,Y)=>{if(X.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse(X);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return $0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let G=J instanceof Error?J.message:String(J);return $0("StructuredData",G,o.EVALUATION_ERROR)}},hasEndTag:!0}});async function uJ(X,$){let Z=X.split("/").pop()?.split(".")[0]||"";if(i7.exact[X])for(let Y of i7.exact[X])await Promise.resolve(Y($,X));if(i7.exact[Z])for(let Y of i7.exact[Z])await Promise.resolve(Y($,X));for(let{pattern:Y,callback:J}of i7.patterns)if(Y.test(X)||Y.test(Z))await Promise.resolve(J($,X))}var i7;var dJ=D(()=>{i7={patterns:[],exact:{}}});function mJ(X){if(typeof X==="string")return X;if(Array.isArray(X))return X.filter(Boolean).map(($)=>mJ($)).join(" ");if(X&&typeof X==="object")return Object.entries(X).filter(([,$])=>$).map(([$])=>$).join(" ");return X?String(X):""}function lJ(X,$){if(!/:[\w-]+=/.test(X))return X;let Z=X,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],G;while((G=Y.exec(X))!==null)J.push([G.index,G.index+G[0].length]);function Q(W){return J.some(([K,U])=>W>=K&&W<U)}let w=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((G=w.exec(Z))!==null){if(Q(G.index))continue;let W=G[0],K=G[2];if(!K||!K.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,z,B=K,_=!1;while((z=U.exec(K))!==null){let j=z[1],H=z[2];if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let O=Object.keys($),L=Object.values($),F=H.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!O.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...O,`return (${H})`)(...L);if(j==="class"){let R=mJ(A);if(R){let T=B.match(/\sclass="([^"]*)"/);if(T)B=B.replace(T[0],` class="${T[1]} ${R}"`);else B=B.replace(z[0],` class="${R}"`)}else B=B.replace(z[0],"");_=!0;continue}if(RB.has(j)){if(A)B=B.replace(z[0],` ${j}`);else B=B.replace(z[0],"");_=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(z[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(z[0],` ${j}="${R}"`)}_=!0}catch{continue}}if(_){let j=W.endsWith("/>")?" /":"",O=`<${G[1]}${B}${j}>`;q.push({start:G.index,end:G.index+W.length,replacement:O})}}for(let W=q.length-1;W>=0;W--){let{start:K,end:U,replacement:z}=q[W];Z=Z.slice(0,K)+z+Z.slice(U)}return Z}var RB;var cJ=D(()=>{RB=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function U5(X,$){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=$;let Y=Z.exec(X);if(!Y)return null;let J=/\/\s*>$/.test(Y[0])||Y[1]===Y[1].toLowerCase()&&TB.has(Y[1]),G=J?Y[2].replace(/\/\s*$/,""):Y[2];return{full:Y[0],tag:Y[1],attrs:G,selfClosing:J,start:Y.index,end:Y.index+Y[0].length}}function NB(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${$}\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J;let w=G.exec(X),q=Q.exec(X);if(!q)return-1;if(w&&w.index<q.index)Y++,J=w.index+w[0].length;else{if(Y--,Y===0)return q.index+q[0].length;J=q.index+q[0].length}}return-1}function W1(X,$){if($.selfClosing)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};let Z=NB(X,$.tag,$.end);if(Z===-1)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};return{outerStart:$.start,outerEnd:Z,innerHTML:X.slice($.end,Z-`</${$.tag}>`.length)}}function pJ(X,$){return new RegExp(`(?:^|\\s)${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(X)||X.includes(` ${$}=`)||X.includes(` ${$} `)||X.trimEnd().endsWith(` ${$}`)}function i5(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=X.match(new RegExp(`${Z}="([^"]*)"`,"s"))||X.match(new RegExp(`${Z}='([^']*)'`,"s"));return Y?Y[1]:null}function g1(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return X.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function h1(X,$,Z){let Y=$.selfClosing?" /":"",J=`<${$.tag}${Z}${Y}>`;return X.slice(0,$.start)+J+X.slice($.end)}function kB(X){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(X)}function IB(X){let $=X,Z=0;while(Z<$.length){let Y=U5($,Z);if(!Y)break;let J=i5(Y.attrs,"v-for");if(J===null){Z=Y.end;continue}let G=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=Y.end;continue}let Q=G[1].trim(),w=G[2].trim(),q;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),O=H[0],L=H[1];q=`${w} as ${L} => ${O}`}else q=`${w} as ${Q}`;let W=g1(Y.attrs,"v-for"),K=g1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=W1($,Y),z=$.slice(U.outerStart,U.outerEnd),B=h1(z,{...Y,start:0,end:Y.end-Y.start},K),_=`@foreach(${q})
3715
+ `)}function p(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var pJ,iJ;var R3=D(()=>{O1();F0();pJ={name:"meta",handler:(X,$,Z,Y)=>{if($.length<1)return $0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"";return`<meta name="${p(J)}" content="${p(G)}">`},hasEndTag:!1},iJ={name:"structuredData",handler:(X,$,Z,Y)=>{if(X.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse(X);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return $0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let G=J instanceof Error?J.message:String(J);return $0("StructuredData",G,o.EVALUATION_ERROR)}},hasEndTag:!0}});async function nJ(X,$){let Z=X.split("/").pop()?.split(".")[0]||"";if(r7.exact[X])for(let Y of r7.exact[X])await Promise.resolve(Y($,X));if(r7.exact[Z])for(let Y of r7.exact[Z])await Promise.resolve(Y($,X));for(let{pattern:Y,callback:J}of r7.patterns)if(Y.test(X)||Y.test(Z))await Promise.resolve(J($,X))}var r7;var rJ=D(()=>{r7={patterns:[],exact:{}}});function sJ(X){if(typeof X==="string")return X;if(Array.isArray(X))return X.filter(Boolean).map(($)=>sJ($)).join(" ");if(X&&typeof X==="object")return Object.entries(X).filter(([,$])=>$).map(([$])=>$).join(" ");return X?String(X):""}function oJ(X,$){if(!/:[\w-]+=/.test(X))return X;let Z=X,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],G;while((G=Y.exec(X))!==null)J.push([G.index,G.index+G[0].length]);function Q(W){return J.some(([U,K])=>W>=U&&W<K)}let w=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((G=w.exec(Z))!==null){if(Q(G.index))continue;let W=G[0],U=G[2];if(!U||!U.includes(":"))continue;let K=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,z,B=U,_=!1;while((z=K.exec(U))!==null){let j=z[1],H=z[2];if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let O=Object.keys($),L=Object.values($),F=H.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!O.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...O,`return (${H})`)(...L);if(j==="class"){let R=sJ(A);if(R){let T=B.match(/\sclass="([^"]*)"/);if(T)B=B.replace(T[0],` class="${T[1]} ${R}"`);else B=B.replace(z[0],` class="${R}"`)}else B=B.replace(z[0],"");_=!0;continue}if(CB.has(j)){if(A)B=B.replace(z[0],` ${j}`);else B=B.replace(z[0],"");_=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(z[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(z[0],` ${j}="${R}"`)}_=!0}catch{continue}}if(_){let j=W.endsWith("/>")?" /":"",O=`<${G[1]}${B}${j}>`;q.push({start:G.index,end:G.index+W.length,replacement:O})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:K,replacement:z}=q[W];Z=Z.slice(0,U)+z+Z.slice(K)}return Z}var CB;var aJ=D(()=>{CB=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function K5(X,$){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=$;let Y=Z.exec(X);if(!Y)return null;let J=/\/\s*>$/.test(Y[0])||Y[1]===Y[1].toLowerCase()&&PB.has(Y[1]),G=J?Y[2].replace(/\/\s*$/,""):Y[2];return{full:Y[0],tag:Y[1],attrs:G,selfClosing:J,start:Y.index,end:Y.index+Y[0].length}}function xB(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${$}\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J;let w=G.exec(X),q=Q.exec(X);if(!q)return-1;if(w&&w.index<q.index)Y++,J=w.index+w[0].length;else{if(Y--,Y===0)return q.index+q[0].length;J=q.index+q[0].length}}return-1}function q1(X,$){if($.selfClosing)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};let Z=xB(X,$.tag,$.end);if(Z===-1)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};return{outerStart:$.start,outerEnd:Z,innerHTML:X.slice($.end,Z-`</${$.tag}>`.length)}}function tJ(X,$){return new RegExp(`(?:^|\\s)${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(X)||X.includes(` ${$}=`)||X.includes(` ${$} `)||X.trimEnd().endsWith(` ${$}`)}function n5(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=X.match(new RegExp(`${Z}="([^"]*)"`,"s"))||X.match(new RegExp(`${Z}='([^']*)'`,"s"));return Y?Y[1]:null}function g1(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return X.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function h1(X,$,Z){let Y=$.selfClosing?" /":"",J=`<${$.tag}${Z}${Y}>`;return X.slice(0,$.start)+J+X.slice($.end)}function fB(X){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(X)}function gB(X){let $=X,Z=0;while(Z<$.length){let Y=K5($,Z);if(!Y)break;let J=n5(Y.attrs,"v-for");if(J===null){Z=Y.end;continue}let G=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=Y.end;continue}let Q=G[1].trim(),w=G[2].trim(),q;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),O=H[0],L=H[1];q=`${w} as ${L} => ${O}`}else q=`${w} as ${Q}`;let W=g1(Y.attrs,"v-for"),U=g1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),K=q1($,Y),z=$.slice(K.outerStart,K.outerEnd),B=h1(z,{...Y,start:0,end:Y.end-Y.start},U),_=`@foreach(${q})
3716
3716
  `,j=`${_}${B}
3717
- @endforeach`;$=$.slice(0,U.outerStart)+j+$.slice(U.outerEnd),Z=U.outerStart+_.length}return $}function EB(X){let $=X,Z=0;while(Z<$.length){let Y=U5($,Z);if(!Y)break;let J=i5(Y.attrs,"v-if");if(J===null){Z=Y.end;continue}let G=[],Q=W1($,Y),w=g1(Y.attrs,"v-if"),q=h1($.slice(Q.outerStart,Q.outerEnd),{...Y,start:0,end:Y.end-Y.start},w);G.push({type:"if",expr:J,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:q,parsedTag:Y});let W=Q.outerEnd,K=!0;while(K){let j=$.slice(W).match(/^\s*/),H=j?j[0].length:0,O=U5($,W+H);if(!O){K=!1;break}let L=i5(O.attrs,"v-else-if"),F=pJ(O.attrs,"v-else");if(L!==null){let V=W1($,O),A=g1(O.attrs,"v-else-if"),R=h1($.slice(V.outerStart,V.outerEnd),{...O,start:0,end:O.end-O.start},A);G.push({type:"else-if",expr:L,outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:O}),W=V.outerEnd}else if(F){let V=W1($,O),A=g1(O.attrs,"v-else"),R=h1($.slice(V.outerStart,V.outerEnd),{...O,start:0,end:O.end-O.start},A);G.push({type:"else",outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:O}),K=!1}else K=!1}let U=[];for(let j of G)if(j.type==="if")U.push(`@if(${j.expr})
3718
- ${j.element}`);else if(j.type==="else-if")U.push(`@elseif(${j.expr})
3719
- ${j.element}`);else U.push(`@else
3720
- ${j.element}`);U.push("@endif");let z=U.join(`
3721
- `),B=G[0].outerStart,_=G[G.length-1].outerEnd;$=$.slice(0,B)+z+$.slice(_),Z=B+z.length}return $}function DB(X){return X.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function yB(X){let $=X,Z=0;while(Z<$.length){let Y=U5($,Z);if(!Y)break;let J=Y.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,w=J.match(Q);while(w){G=!0;let K=w[1],U=w[2],z=w[3];J=J.replace(w[0],""),J+=` :${K}="${z}" @update:${K}="${z} = $event"`,w=J.match(Q)}if(G){let K=W1($,Y),U=$.slice(K.outerStart,K.outerEnd),z=h1(U,{...Y,start:0,end:Y.end-Y.start},J);$=$.slice(0,K.outerStart)+z+$.slice(K.outerEnd),Z=K.outerStart+z.length;continue}let q=i5(Y.attrs,"v-model");if(q===null){Z=Y.end;continue}if(MB.has(Y.tag)){let K=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=W1($,Y),z=$.slice(U.outerStart,U.outerEnd),B=h1(z,{...Y,start:0,end:Y.end-Y.start},K);$=$.slice(0,U.outerStart)+B+$.slice(U.outerEnd),Z=U.outerStart+B.length}else{let K=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");K+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=W1($,Y),z=$.slice(U.outerStart,U.outerEnd),B=h1(z,{...Y,start:0,end:Y.end-Y.start},K);$=$.slice(0,U.outerStart)+B+$.slice(U.outerEnd),Z=U.outerStart+B.length}}return $}function bB(X){return X.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function SB(X){return X.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function CB(X){let $=X,Z=0;while(Z<$.length){let Y=U5($,Z);if(!Y)break;let J=i5(Y.attrs,"v-html");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=W1($,Y),Q=g1(Y.attrs,"v-html"),w=Y.selfClosing?" /":"",q=`<${Y.tag}${Q}${w}>{!! ${J} !!}</${Y.tag}>`;$=$.slice(0,G.outerStart)+q+$.slice(G.outerEnd),Z=G.outerStart+q.length}return $}function PB(X){let $=X,Z=0;while(Z<$.length){let Y=U5($,Z);if(!Y)break;let J=i5(Y.attrs,"v-text");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=W1($,Y),Q=g1(Y.attrs,"v-text"),w=Y.selfClosing?" /":"",q=`<${Y.tag}${Q}${w}>{{ ${J} }}</${Y.tag}>`;$=$.slice(0,G.outerStart)+q+$.slice(G.outerEnd),Z=G.outerStart+q.length}return $}function vB(X){return X.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 xB(X){let $=X,Z=0;while(Z<$.length){let Y=U5($,Z);if(!Y)break;if(!pJ(Y.attrs,"v-once")){Z=Y.end;continue}let J=g1(Y.attrs,"v-once"),G=W1($,Y),Q=$.slice(G.outerStart,G.outerEnd),q=`@once
3717
+ @endforeach`;$=$.slice(0,K.outerStart)+j+$.slice(K.outerEnd),Z=K.outerStart+_.length}return $}function hB(X){let $=X,Z=0;while(Z<$.length){let Y=K5($,Z);if(!Y)break;let J=n5(Y.attrs,"v-if");if(J===null){Z=Y.end;continue}let G=[],Q=q1($,Y),w=g1(Y.attrs,"v-if"),q=h1($.slice(Q.outerStart,Q.outerEnd),{...Y,start:0,end:Y.end-Y.start},w);G.push({type:"if",expr:J,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:q,parsedTag:Y});let W=Q.outerEnd,U=!0;while(U){let j=$.slice(W).match(/^\s*/),H=j?j[0].length:0,O=K5($,W+H);if(!O){U=!1;break}let L=n5(O.attrs,"v-else-if"),F=tJ(O.attrs,"v-else");if(L!==null){let V=q1($,O),A=g1(O.attrs,"v-else-if"),R=h1($.slice(V.outerStart,V.outerEnd),{...O,start:0,end:O.end-O.start},A);G.push({type:"else-if",expr:L,outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:O}),W=V.outerEnd}else if(F){let V=q1($,O),A=g1(O.attrs,"v-else"),R=h1($.slice(V.outerStart,V.outerEnd),{...O,start:0,end:O.end-O.start},A);G.push({type:"else",outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:O}),U=!1}else U=!1}let K=[];for(let j of G)if(j.type==="if")K.push(`@if(${j.expr})
3718
+ ${j.element}`);else if(j.type==="else-if")K.push(`@elseif(${j.expr})
3719
+ ${j.element}`);else K.push(`@else
3720
+ ${j.element}`);K.push("@endif");let z=K.join(`
3721
+ `),B=G[0].outerStart,_=G[G.length-1].outerEnd;$=$.slice(0,B)+z+$.slice(_),Z=B+z.length}return $}function uB(X){return X.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function dB(X){let $=X,Z=0;while(Z<$.length){let Y=K5($,Z);if(!Y)break;let J=Y.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,w=J.match(Q);while(w){G=!0;let U=w[1],K=w[2],z=w[3];J=J.replace(w[0],""),J+=` :${U}="${z}" @update:${U}="${z} = $event"`,w=J.match(Q)}if(G){let U=q1($,Y),K=$.slice(U.outerStart,U.outerEnd),z=h1(K,{...Y,start:0,end:Y.end-Y.start},J);$=$.slice(0,U.outerStart)+z+$.slice(U.outerEnd),Z=U.outerStart+z.length;continue}let q=n5(Y.attrs,"v-model");if(q===null){Z=Y.end;continue}if(vB.has(Y.tag)){let U=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,K=q1($,Y),z=$.slice(K.outerStart,K.outerEnd),B=h1(z,{...Y,start:0,end:Y.end-Y.start},U);$=$.slice(0,K.outerStart)+B+$.slice(K.outerEnd),Z=K.outerStart+B.length}else{let U=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let K=q1($,Y),z=$.slice(K.outerStart,K.outerEnd),B=h1(z,{...Y,start:0,end:Y.end-Y.start},U);$=$.slice(0,K.outerStart)+B+$.slice(K.outerEnd),Z=K.outerStart+B.length}}return $}function mB(X){return X.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function lB(X){return X.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function cB(X){let $=X,Z=0;while(Z<$.length){let Y=K5($,Z);if(!Y)break;let J=n5(Y.attrs,"v-html");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=q1($,Y),Q=g1(Y.attrs,"v-html"),w=Y.selfClosing?" /":"",q=`<${Y.tag}${Q}${w}>{!! ${J} !!}</${Y.tag}>`;$=$.slice(0,G.outerStart)+q+$.slice(G.outerEnd),Z=G.outerStart+q.length}return $}function pB(X){let $=X,Z=0;while(Z<$.length){let Y=K5($,Z);if(!Y)break;let J=n5(Y.attrs,"v-text");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=q1($,Y),Q=g1(Y.attrs,"v-text"),w=Y.selfClosing?" /":"",q=`<${Y.tag}${Q}${w}>{{ ${J} }}</${Y.tag}>`;$=$.slice(0,G.outerStart)+q+$.slice(G.outerEnd),Z=G.outerStart+q.length}return $}function iB(X){return X.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 nB(X){let $=X,Z=0;while(Z<$.length){let Y=K5($,Z);if(!Y)break;if(!tJ(Y.attrs,"v-once")){Z=Y.end;continue}let J=g1(Y.attrs,"v-once"),G=q1($,Y),Q=$.slice(G.outerStart,G.outerEnd),q=`@once
3722
3722
  ${h1(Q,{...Y,start:0,end:Y.end-Y.start},J)}
3723
- @endonce`;$=$.slice(0,G.outerStart)+q+$.slice(G.outerEnd),Z=G.outerStart+q.length}return $}function fB(X){return X.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function gB(X){return X.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 iJ(X){if(!kB(X))return X;let $=X;return $=IB($),$=EB($),$=xB($),$=bB($),$=SB($),$=yB($),$=DB($),$=gB($),$=CB($),$=PB($),$=vB($),$=fB($),$}var TB,MB;var nJ=D(()=>{TB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),MB=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 W8(X){return X.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function rJ(X,$){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X),Y=Z?Z[1]:X,J=Y0(Y,$);if(J&&typeof J==="string")return J;let G=Y.trim();return T3.has(G)?G:null}function sJ(X){let $=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X);return $?$[1]:X}function oJ(X,$,Z){let Y=$.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=Y?`<${X} ${Y}>`:`<${X}>`;if(hB.has(X))return Y?`<${X} ${Y}>`:`<${X}>`;return`${J}${Z}</${X}>`}async function aJ(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=w.length-1;W>=0;W--){let K=w[W];try{let U=rJ(K.expr,$);if(!U||typeof U!=="string"){let L=`<!-- dynamic component: could not resolve "${W8(sJ(K.expr))}" -->`;G=G.slice(0,K.index)+L+G.slice(K.index+K.full.length);continue}if(T3.has(U)){let L=oJ(U,K.attrs,K.slotContent);G=G.slice(0,K.index)+L+G.slice(K.index+K.full.length);continue}let z=K.attrs.trim(),B={},_=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,j;while((j=_.exec(z))!==null){let L=j[1]||j[2],F=j[3];if(j[1])try{B[L]=Y0(F,$)}catch{B[L]=F}else B[L]=F}let H=Y.componentsDir||"components",O=await K5(U,B,K.slotContent,H,$,Z,Y,new Set,J??new Set);G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length)}catch(U){let z=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${W8(z)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G=await uB(G,$,Z,Y,J),G}async function uB(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=w.length-1;W>=0;W--){let K=w[W];try{let U=rJ(K.expr,$);if(!U||typeof U!=="string"){let _=`<!-- dynamic component: could not resolve "${W8(sJ(K.expr))}" -->`;G=G.slice(0,K.index)+_+G.slice(K.index+K.full.length);continue}if(T3.has(U)){let _=oJ(U,K.attrs,"");G=G.slice(0,K.index)+_+G.slice(K.index+K.full.length);continue}let z=Y.componentsDir||"components",B=await K5(U,{},"",z,$,Z,Y,new Set,J??new Set);G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}catch(U){let z=U instanceof Error?U.message:String(U),B=`<!-- dynamic component error: ${W8(z)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G}var T3,hB;var tJ=D(()=>{T0();F0();T3=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),hB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function eJ(X,$=""){let Z=`${X}${$}`,Y=0;for(let J=0;J<Z.length;J++){let G=Z.charCodeAt(J);Y=(Y<<5)-Y+G,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function XG(X,$,Z={}){let{prefix:Y="",preserveHost:J=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!X.trim())return"";let w=M3(X),q=[],W=new Map;if(G)for(let K of w){let U=K.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let z=U[1],B=`${$}_${z}`;W.set(z,B)}}for(let K of w){let U=$G(K,$,Y,J,W,Q);q.push(U)}return q.join(`
3723
+ @endonce`;$=$.slice(0,G.outerStart)+q+$.slice(G.outerEnd),Z=G.outerStart+q.length}return $}function rB(X){return X.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function sB(X){return X.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 eJ(X){if(!fB(X))return X;let $=X;return $=gB($),$=hB($),$=nB($),$=mB($),$=lB($),$=dB($),$=uB($),$=sB($),$=cB($),$=pB($),$=iB($),$=rB($),$}var PB,vB;var XG=D(()=>{PB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),vB=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 U8(X){return X.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $G(X,$){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X),Y=Z?Z[1]:X,J=Y0(Y,$);if(J&&typeof J==="string")return J;let G=Y.trim();return T3.has(G)?G:null}function ZG(X){let $=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X);return $?$[1]:X}function YG(X,$,Z){let Y=$.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=Y?`<${X} ${Y}>`:`<${X}>`;if(oB.has(X))return Y?`<${X} ${Y}>`:`<${X}>`;return`${J}${Z}</${X}>`}async function JG(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=w.length-1;W>=0;W--){let U=w[W];try{let K=$G(U.expr,$);if(!K||typeof K!=="string"){let L=`<!-- dynamic component: could not resolve "${U8(ZG(U.expr))}" -->`;G=G.slice(0,U.index)+L+G.slice(U.index+U.full.length);continue}if(T3.has(K)){let L=YG(K,U.attrs,U.slotContent);G=G.slice(0,U.index)+L+G.slice(U.index+U.full.length);continue}let z=U.attrs.trim(),B={},_=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,j;while((j=_.exec(z))!==null){let L=j[1]||j[2],F=j[3];if(j[1])try{B[L]=Y0(F,$)}catch{B[L]=F}else B[L]=F}let H=Y.componentsDir||"components",O=await U5(K,B,U.slotContent,H,$,Z,Y,new Set,J??new Set);G=G.slice(0,U.index)+O+G.slice(U.index+U.full.length)}catch(K){let z=K instanceof Error?K.message:String(K),B=`<!-- dynamic component error: ${U8(z)} -->`;G=G.slice(0,U.index)+B+G.slice(U.index+U.full.length)}}return G=await aB(G,$,Z,Y,J),G}async function aB(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=w.length-1;W>=0;W--){let U=w[W];try{let K=$G(U.expr,$);if(!K||typeof K!=="string"){let _=`<!-- dynamic component: could not resolve "${U8(ZG(U.expr))}" -->`;G=G.slice(0,U.index)+_+G.slice(U.index+U.full.length);continue}if(T3.has(K)){let _=YG(K,U.attrs,"");G=G.slice(0,U.index)+_+G.slice(U.index+U.full.length);continue}let z=Y.componentsDir||"components",B=await U5(K,{},"",z,$,Z,Y,new Set,J??new Set);G=G.slice(0,U.index)+B+G.slice(U.index+U.full.length)}catch(K){let z=K instanceof Error?K.message:String(K),B=`<!-- dynamic component error: ${U8(z)} -->`;G=G.slice(0,U.index)+B+G.slice(U.index+U.full.length)}}return G}var T3,oB;var GG=D(()=>{T0();F0();T3=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),oB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function QG(X,$=""){let Z=`${X}${$}`,Y=0;for(let J=0;J<Z.length;J++){let G=Z.charCodeAt(J);Y=(Y<<5)-Y+G,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function wG(X,$,Z={}){let{prefix:Y="",preserveHost:J=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!X.trim())return"";let w=M3(X),q=[],W=new Map;if(G)for(let U of w){let K=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(K){let z=K[1],B=`${$}_${z}`;W.set(z,B)}}for(let U of w){let K=qG(U,$,Y,J,W,Q);q.push(K)}return q.join(`
3724
3724
 
3725
- `)}function M3(X){let $=[],Z=X.replace(/\/\*[\s\S]*?\*\//g,""),Y=0,J="",G=!1,Q="";for(let w=0;w<Z.length;w++){let q=Z[w];if(q==="@"&&Y===0)G=!0;if(q==="{")Y++;else if(q==="}"){if(Y--,Y===0){if(G){Q+=q;let W=Q.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,K,U,z]=W;if(K==="keyframes")$.push({selector:`@keyframes ${U.trim()}`,declarations:z.trim()});else if(K==="media"||K==="supports"||K==="container"){let B=M3(z);$.push({selector:`@${K} ${U.trim()}`,declarations:B.map((_)=>`${_.selector} { ${_.declarations} }`).join(`
3726
- `)})}else $.push({selector:`@${K} ${U.trim()}`,declarations:z.trim()})}Q="",G=!1}else if(J.trim()){J+=q;let W=J.match(/([^{]+)\{([^}]*)\}/);if(W)$.push({selector:W[1].trim(),declarations:W[2].trim()});J=""}continue}}if(G)Q+=q;else J+=q}return $}function $G(X,$,Z,Y,J,G){let{selector:Q,declarations:w}=X;if(Q.startsWith("@")){if(Q.startsWith("@keyframes")){let K=Q.replace("@keyframes ","").trim();return`@keyframes ${J.get(K)||K} { ${w} }`}if(Q.startsWith("@media")||Q.startsWith("@supports")||Q.startsWith("@container")){let U=M3(`x { ${w} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((z)=>$G(z,$,Z,Y,J,G)).join(`
3725
+ `)}function M3(X){let $=[],Z=X.replace(/\/\*[\s\S]*?\*\//g,""),Y=0,J="",G=!1,Q="";for(let w=0;w<Z.length;w++){let q=Z[w];if(q==="@"&&Y===0)G=!0;if(q==="{")Y++;else if(q==="}"){if(Y--,Y===0){if(G){Q+=q;let W=Q.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,U,K,z]=W;if(U==="keyframes")$.push({selector:`@keyframes ${K.trim()}`,declarations:z.trim()});else if(U==="media"||U==="supports"||U==="container"){let B=M3(z);$.push({selector:`@${U} ${K.trim()}`,declarations:B.map((_)=>`${_.selector} { ${_.declarations} }`).join(`
3726
+ `)})}else $.push({selector:`@${U} ${K.trim()}`,declarations:z.trim()})}Q="",G=!1}else if(J.trim()){J+=q;let W=J.match(/([^{]+)\{([^}]*)\}/);if(W)$.push({selector:W[1].trim(),declarations:W[2].trim()});J=""}continue}}if(G)Q+=q;else J+=q}return $}function qG(X,$,Z,Y,J,G){let{selector:Q,declarations:w}=X;if(Q.startsWith("@")){if(Q.startsWith("@keyframes")){let U=Q.replace("@keyframes ","").trim();return`@keyframes ${J.get(U)||U} { ${w} }`}if(Q.startsWith("@media")||Q.startsWith("@supports")||Q.startsWith("@container")){let K=M3(`x { ${w} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((z)=>qG(z,$,Z,Y,J,G)).join(`
3727
3727
  `);return`${Q} {
3728
- ${U}
3729
- }`}return`${Q} { ${w} }`}let q=dB(Q,$,Z,Y),W=w;for(let[K,U]of J)W=W.replace(new RegExp(`\\b${K}\\b`,"g"),U);if(G)W=W.replace(/--([a-z-]+)/gi,`--${$}-$1`);return`${q} { ${W} }`}function dB(X,$,Z,Y){let J=X.split(",").map((Q)=>Q.trim()),G=[];for(let Q of J){if(Q.startsWith(":host")){if(Y)G.push(Q);else{let W=Q.replace(/:host(\([^)]*\))?/,`.${$}$1`);G.push(W)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${$}`);continue}let w=Z?`${Z} .${$}`:`.${$}`;G.push(`${w} ${Q}`);let q=mB(Q,$);if(q)G.push(Z?`${Z} ${q}`:q)}return G.join(", ")}function mB(X,$){let Z=0,Y=X.length;for(let q=0;q<X.length;q++){let W=X[q];if(W==="["||W==="(")Z++;else if(W==="]"||W===")")Z--;else if(Z===0&&(W===" "||W===">"||W==="+"||W==="~")){Y=q;break}}let J=X.slice(0,Y),G=X.slice(Y);if(!J)return"";let Q=J.length,w=0;for(let q=0;q<J.length;q++){let W=J[q];if(W==="["||W==="(")w++;else if(W==="]"||W===")")w--;else if(Z===0&&w===0&&W===":"){Q=q;break}}return`${J.slice(0,Q)}.${$}${J.slice(Q)}${G}`}function YG(X){let $=new Set;return X.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let Y=Z.trim();if($.has(Y))return"";return $.add(Y),Z})}function K8(X,$){if(!lB.test(X))return{html:X,hasScoped:!1};let Z=eJ($),Y=`data-v-${Z}`,J=X,G=new RegExp(`<style\\s+([^>]*${N3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(J=J.replace(G,(w,q,W)=>{Q=!0;let K=cB(W,Y),U=q.replace(new RegExp(N3,"gi"),"").trim(),z=U?` ${U}`:"";return`<style data-stx-scoped="${Z}"${z}>${K}</style>`}),!Q)return{html:X,hasScoped:!1};return J=iB(J,Y),{html:J,hasScoped:!0}}function cB(X,$){return XG(X,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${$}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${$}]`)}function iB(X,$){let Z=Q1(X,(J,G)=>{let Q=D1(J,G);return Q>G?Q:y5(J,G)},(J,G)=>pB(G)),Y=nB(Z.output,$);return ZG.lastIndex=0,Y.replace(ZG,(J,G)=>Z.tokens[Number(G)])}function nB(X,$){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return X.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,J,G)=>{if(Z.has(J.toLowerCase()))return Y;if(Y.includes($))return Y;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return Y;if(G)return Y.replace(`<${J}${G}`,`<${J} ${$}${G}`);if(Y.endsWith("/>"))return`<${J} ${$} />`;return`<${J} ${$}>`})}var N3,lB,pB=(X)=>`\x00stx-scope-mask-${X}\x00`,ZG;var k3=D(()=>{$5();N3=String.raw`(?<![\w-])scoped(?![\w-])`,lB=new RegExp(`<style\\s+[^>]*${N3}`,"i");ZG=/\u0000stx-scope-mask-(\d+)\u0000/g});function tB(X){let $=X.storageKey??"stx-color-mode",Z=X.initialMode??"auto",Y=X.darkClass===void 0?"dark":X.darkClass,J=X.attribute??null,G=X.autoValue??null;if(typeof $!=="string"||$.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!rB.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(Y!==null&&(typeof Y!=="string"||!aB.test(Y)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!oB.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(G!==null&&!sB.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(Y===null&&J===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:$,initialMode:Z==="system"?"auto":Z,darkClass:Y,attribute:J,autoValue:G}}function eB(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function E3(X={}){let $=tB(X);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${eB($)};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 JG(X,$={}){if(X.includes("data-stx-color-mode-boot"))return X;let Z=I3(X);if(Z===null)return X;let Y=E3($);return`${X.slice(0,Z)}
3730
- ${Y}${X.slice(Z)}`}function I3(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return null;let Z=$.index+$[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(X.slice(Z));if(Y)Z+=Y[0].length;return Z}function Zj(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return X;let Z=$.index+$[0].length,Y=X.toLowerCase().indexOf("</head>",Z),J=X.slice(Z,Y===-1?X.length:Y),G=$j.exec(J);if(!G||J.slice(0,G.index).trim()==="")return X;let Q=J.slice(0,G.index)+J.slice(G.index+G[0].length);return X.slice(0,Z)+`
3731
- ${G[0]}`+Q+X.slice(Z+J.length)}function GG(X){return Yj(Zj(X))}function Yj(X){let $=Xj.exec(X);if(!$)return X;let Z=I3(X);if(Z===null)return X;if($.index<=Z||X.slice(Z,$.index).trim()==="")return X;let Y=X.slice(0,$.index)+X.slice($.index+$[0].length),J=I3(Y);if(J===null)return X;return`${Y.slice(0,J)}
3732
- ${$[0]}${Y.slice(J)}`}var rB,sB,oB,aB,Xj,$j;var D3=D(()=>{rB=new Set(["light","dark","auto","system"]),sB=new Set(["auto","system"]),oB=/^[a-z][\w:-]*$/i,aB=/^[\w-]+$/;Xj=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),$j=/<meta\b[^>]*\bcharset\b[^>]*>/i});function Jj(){if(y3===null)y3=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return y3}function QG(X,$=Jj()){if(X.includes('name="stx-build"'))return X;let Z=/<head\b[^>]*>/i.exec(X);if(!Z)return X;let Y=Z.index+Z[0].length;return`${X.slice(0,Y)}
3733
- <meta name="stx-build" content="${$}">${X.slice(Y)}`}var y3=null;function R1(X){return String(X).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Gj(X){return String(X).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function b3(X){if(X.name)return`name="${X.name}"`;if(X.property)return`property="${X.property}"`;if(X.charset!=null)return"charset=";if(X["http-equiv"])return`http-equiv="${X["http-equiv"]}"`;return""}function n5(X,$){return Object.entries(X).filter(([Z])=>!$?.(Z)).map(([Z,Y])=>`${Z}="${R1(String(Y))}"`).join(" ")}function Qj(X={},$="en"){let Z=[],Y=[],J="",G=$;for(let[w,q]of Object.entries(X||{})){if(q==null)continue;let W=w.trim();if(!qG.test(W))continue;let K=W.toLowerCase();if(K==="lang"){G=String(q);continue}if(K==="class"){J=String(q).trim();continue}Z.push(` ${W}="${R1(String(q))}"`),Y.push(W)}let Q=` lang="${R1(G)}"`;if(J)Q+=` class="${R1(J)}"`;if(Q+=Z.join(""),J)Q+=` ${z8}="${R1(J)}"`;if(Y.length)Q+=` ${U8}="${R1(Y.join(" "))}"`;return Q}function WG(X={},$={}){let Z={...X,...$};if(X.class&&$.class){let Y=X.class.split(/\s+/).filter(Boolean);for(let J of $.class.split(/\s+/).filter(Boolean))if(!Y.includes(J))Y.push(J);Z.class=Y.join(" ")}return Z}function KG(X,$={}){if(!$||Object.keys($).length===0)return X;let Z=X.match(/<html\b([^>]*)>/i);if(!Z)return X;let Y={},J=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let K=Q[1];if(!(K in Y))J.push(K);Y[K]=Q[2]??Q[3]??Q[4]??""}let w=[],q=[];for(let[K,U]of Object.entries($)){if(U==null)continue;let z=K.trim();if(!qG.test(z))continue;let B=z.toLowerCase();if(B==="class"){let _=(Y.class||"").split(/\s+/).filter(Boolean);for(let j of String(U).split(/\s+/).filter(Boolean))if(!_.includes(j))_.push(j),w.push(j);if(!("class"in Y))J.push("class");Y.class=_.join(" ");continue}if(!(z in Y))J.push(z);if(Y[z]=String(U),B!=="lang")q.push(z)}if(w.length){if(!(z8 in Y))J.push(z8);Y[z8]=w.join(" ")}if(q.length){if(!(U8 in Y))J.push(U8);Y[U8]=q.join(" ")}let W=J.map((K)=>` ${K}="${R1(Y[K])}"`).join("");return X.replace(Z[0],()=>`<html${W}>`)}function UG(X){if(X.includes("data-stx-cloak"))return X;let $=X.lastIndexOf("</head>");if($===-1)return X;return`${X.slice(0,$)}${wG}
3734
- ${X.slice($)}`}function wj(X){let $=[],Z=0;while(Z<X.length){let G=X.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let U=X.indexOf("-->",Z);if(U===-1)break;Z=U+3;continue}let w=G.match(/^<script\b[^>]*>/i);if(w){let U=X.toLowerCase().indexOf("</script>",Z+w[0].length);if(U===-1)break;Z=U+9;continue}let q=G.match(/^<link\b[^>]*>/i);if(q){$.push(q[0]),Z+=q[0].length;continue}let W=G.match(/^<meta\b[^>]*>/i);if(W){$.push(W[0]),Z+=W[0].length;continue}let K=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K){$.push(K[0]),Z+=K[0].length;continue}break}if($.length===0)return{body:X,hoisted:$};let Y="",J=0;while(J<X.length&&J<Z){let G=X.slice(J),Q=G.match(/^<link\b[^>]*>/i);if(Q&&$.includes(Q[0])){J+=Q[0].length;continue}let w=G.match(/^<meta\b[^>]*>/i);if(w&&$.includes(w[0])){J+=w[0].length;continue}let q=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&$.includes(q[0])){J+=q[0].length;continue}Y+=X[J],J++}return Y+=X.slice(Z),{body:Y,hoisted:$}}function qj(X,$={},Z={}){let{title:Y="stx App",lang:J="en",meta:G=[],link:Q=[],script:w=[],headRaw:q="",htmlAttrs:W={},bodyClass:K="",bodyAttrs:U={}}=$,z=Z.title||Y,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],_=new Set(G.map(b3).filter(Boolean)),H=[...B.filter((N)=>!_.has(b3(N))),...G].map((N)=>{return` <meta ${n5(N)}>`}).join(`
3735
- `),O=Q.map((N)=>{return` <link ${n5(N)}>`}).join(`
3736
- `),L=w.map((N)=>{if(N.src)return` <script ${n5(N,(y)=>y==="content")}></script>`;if(N.content)return` <script>${N.content}</script>`;return""}).filter(Boolean).join(`
3737
- `),F=Qj(W,J),V=Object.entries(U).map(([N,y])=>` ${N}="${R1(String(y))}"`).join(""),A=K?` class="${R1(K)}"`:"",{body:R,hoisted:T}=wj(X),M=[H,Z.colorMode?` ${E3(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?z:Gj(z)}</title>`,` ${wG}`,O,L,q?` ${q}`:"",...(Z.styles||[]).map((N)=>` ${N}`),...T.map((N)=>` ${N}`),...(Z.headScripts||[]).map((N)=>` ${N}`),Z.headStack||""].filter(Boolean),k=[R,...(Z.bodyScripts||[]).map((N)=>N),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3728
+ ${K}
3729
+ }`}return`${Q} { ${w} }`}let q=tB(Q,$,Z,Y),W=w;for(let[U,K]of J)W=W.replace(new RegExp(`\\b${U}\\b`,"g"),K);if(G)W=W.replace(/--([a-z-]+)/gi,`--${$}-$1`);return`${q} { ${W} }`}function tB(X,$,Z,Y){let J=X.split(",").map((Q)=>Q.trim()),G=[];for(let Q of J){if(Q.startsWith(":host")){if(Y)G.push(Q);else{let W=Q.replace(/:host(\([^)]*\))?/,`.${$}$1`);G.push(W)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${$}`);continue}let w=Z?`${Z} .${$}`:`.${$}`;G.push(`${w} ${Q}`);let q=eB(Q,$);if(q)G.push(Z?`${Z} ${q}`:q)}return G.join(", ")}function eB(X,$){let Z=0,Y=X.length;for(let q=0;q<X.length;q++){let W=X[q];if(W==="["||W==="(")Z++;else if(W==="]"||W===")")Z--;else if(Z===0&&(W===" "||W===">"||W==="+"||W==="~")){Y=q;break}}let J=X.slice(0,Y),G=X.slice(Y);if(!J)return"";let Q=J.length,w=0;for(let q=0;q<J.length;q++){let W=J[q];if(W==="["||W==="(")w++;else if(W==="]"||W===")")w--;else if(Z===0&&w===0&&W===":"){Q=q;break}}return`${J.slice(0,Q)}.${$}${J.slice(Q)}${G}`}function UG(X){let $=new Set;return X.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let Y=Z.trim();if($.has(Y))return"";return $.add(Y),Z})}function K8(X,$){if(!Xj.test(X))return{html:X,hasScoped:!1};let Z=QG($),Y=`data-v-${Z}`,J=X,G=new RegExp(`<style\\s+([^>]*${N3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(J=J.replace(G,(w,q,W)=>{Q=!0;let U=$j(W,Y),K=q.replace(new RegExp(N3,"gi"),"").trim(),z=K?` ${K}`:"";return`<style data-stx-scoped="${Z}"${z}>${U}</style>`}),!Q)return{html:X,hasScoped:!1};return J=Yj(J,Y),{html:J,hasScoped:!0}}function $j(X,$){return wG(X,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${$}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${$}]`)}function Yj(X,$){let Z=G1(X,(J,G)=>{let Q=D1(J,G);return Q>G?Q:b5(J,G)},(J,G)=>Zj(G)),Y=Jj(Z.output,$);return WG.lastIndex=0,Y.replace(WG,(J,G)=>Z.tokens[Number(G)])}function Jj(X,$){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return X.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,J,G)=>{if(Z.has(J.toLowerCase()))return Y;if(Y.includes($))return Y;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return Y;if(G)return Y.replace(`<${J}${G}`,`<${J} ${$}${G}`);if(Y.endsWith("/>"))return`<${J} ${$} />`;return`<${J} ${$}>`})}var N3,Xj,Zj=(X)=>`\x00stx-scope-mask-${X}\x00`,WG;var k3=D(()=>{$5();N3=String.raw`(?<![\w-])scoped(?![\w-])`,Xj=new RegExp(`<style\\s+[^>]*${N3}`,"i");WG=/\u0000stx-scope-mask-(\d+)\u0000/g});function Wj(X){let $=X.storageKey??"stx-color-mode",Z=X.initialMode??"auto",Y=X.darkClass===void 0?"dark":X.darkClass,J=X.attribute??null,G=X.autoValue??null;if(typeof $!=="string"||$.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!Gj.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(Y!==null&&(typeof Y!=="string"||!qj.test(Y)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!wj.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(G!==null&&!Qj.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(Y===null&&J===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:$,initialMode:Z==="system"?"auto":Z,darkClass:Y,attribute:J,autoValue:G}}function Uj(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function E3(X={}){let $=Wj(X);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${Uj($)};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 KG(X,$={}){if(X.includes("data-stx-color-mode-boot"))return X;let Z=I3(X);if(Z===null)return X;let Y=E3($);return`${X.slice(0,Z)}
3730
+ ${Y}${X.slice(Z)}`}function I3(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return null;let Z=$.index+$[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(X.slice(Z));if(Y)Z+=Y[0].length;return Z}function _j(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return X;let Z=$.index+$[0].length,Y=X.toLowerCase().indexOf("</head>",Z),J=X.slice(Z,Y===-1?X.length:Y),G=zj.exec(J);if(!G||J.slice(0,G.index).trim()==="")return X;let Q=J.slice(0,G.index)+J.slice(G.index+G[0].length);return X.slice(0,Z)+`
3731
+ ${G[0]}`+Q+X.slice(Z+J.length)}function zG(X){return Bj(_j(X))}function Bj(X){let $=Kj.exec(X);if(!$)return X;let Z=I3(X);if(Z===null)return X;if($.index<=Z||X.slice(Z,$.index).trim()==="")return X;let Y=X.slice(0,$.index)+X.slice($.index+$[0].length),J=I3(Y);if(J===null)return X;return`${Y.slice(0,J)}
3732
+ ${$[0]}${Y.slice(J)}`}var Gj,Qj,wj,qj,Kj,zj;var D3=D(()=>{Gj=new Set(["light","dark","auto","system"]),Qj=new Set(["auto","system"]),wj=/^[a-z][\w:-]*$/i,qj=/^[\w-]+$/;Kj=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),zj=/<meta\b[^>]*\bcharset\b[^>]*>/i});function jj(){if(y3===null)y3=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return y3}function _G(X,$=jj()){if(X.includes('name="stx-build"'))return X;let Z=/<head\b[^>]*>/i.exec(X);if(!Z)return X;let Y=Z.index+Z[0].length;return`${X.slice(0,Y)}
3733
+ <meta name="stx-build" content="${$}">${X.slice(Y)}`}var y3=null;function A1(X){return String(X).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hj(X){return String(X).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function b3(X){if(X.name)return`name="${X.name}"`;if(X.property)return`property="${X.property}"`;if(X.charset!=null)return"charset=";if(X["http-equiv"])return`http-equiv="${X["http-equiv"]}"`;return""}function r5(X,$){return Object.entries(X).filter(([Z])=>!$?.(Z)).map(([Z,Y])=>`${Z}="${A1(String(Y))}"`).join(" ")}function Lj(X={},$="en"){let Z=[],Y=[],J="",G=$;for(let[w,q]of Object.entries(X||{})){if(q==null)continue;let W=w.trim();if(!jG.test(W))continue;let U=W.toLowerCase();if(U==="lang"){G=String(q);continue}if(U==="class"){J=String(q).trim();continue}Z.push(` ${W}="${A1(String(q))}"`),Y.push(W)}let Q=` lang="${A1(G)}"`;if(J)Q+=` class="${A1(J)}"`;if(Q+=Z.join(""),J)Q+=` ${_8}="${A1(J)}"`;if(Y.length)Q+=` ${z8}="${A1(Y.join(" "))}"`;return Q}function HG(X={},$={}){let Z={...X,...$};if(X.class&&$.class){let Y=X.class.split(/\s+/).filter(Boolean);for(let J of $.class.split(/\s+/).filter(Boolean))if(!Y.includes(J))Y.push(J);Z.class=Y.join(" ")}return Z}function LG(X,$={}){if(!$||Object.keys($).length===0)return X;let Z=X.match(/<html\b([^>]*)>/i);if(!Z)return X;let Y={},J=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let U=Q[1];if(!(U in Y))J.push(U);Y[U]=Q[2]??Q[3]??Q[4]??""}let w=[],q=[];for(let[U,K]of Object.entries($)){if(K==null)continue;let z=U.trim();if(!jG.test(z))continue;let B=z.toLowerCase();if(B==="class"){let _=(Y.class||"").split(/\s+/).filter(Boolean);for(let j of String(K).split(/\s+/).filter(Boolean))if(!_.includes(j))_.push(j),w.push(j);if(!("class"in Y))J.push("class");Y.class=_.join(" ");continue}if(!(z in Y))J.push(z);if(Y[z]=String(K),B!=="lang")q.push(z)}if(w.length){if(!(_8 in Y))J.push(_8);Y[_8]=w.join(" ")}if(q.length){if(!(z8 in Y))J.push(z8);Y[z8]=q.join(" ")}let W=J.map((U)=>` ${U}="${A1(Y[U])}"`).join("");return X.replace(Z[0],()=>`<html${W}>`)}function OG(X){if(X.includes("data-stx-cloak"))return X;let $=X.lastIndexOf("</head>");if($===-1)return X;return`${X.slice(0,$)}${BG}
3734
+ ${X.slice($)}`}function Oj(X){let $=[],Z=0;while(Z<X.length){let G=X.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let K=X.indexOf("-->",Z);if(K===-1)break;Z=K+3;continue}let w=G.match(/^<script\b[^>]*>/i);if(w){let K=X.toLowerCase().indexOf("</script>",Z+w[0].length);if(K===-1)break;Z=K+9;continue}let q=G.match(/^<link\b[^>]*>/i);if(q){$.push(q[0]),Z+=q[0].length;continue}let W=G.match(/^<meta\b[^>]*>/i);if(W){$.push(W[0]),Z+=W[0].length;continue}let U=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){$.push(U[0]),Z+=U[0].length;continue}break}if($.length===0)return{body:X,hoisted:$};let Y="",J=0;while(J<X.length&&J<Z){let G=X.slice(J),Q=G.match(/^<link\b[^>]*>/i);if(Q&&$.includes(Q[0])){J+=Q[0].length;continue}let w=G.match(/^<meta\b[^>]*>/i);if(w&&$.includes(w[0])){J+=w[0].length;continue}let q=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&$.includes(q[0])){J+=q[0].length;continue}Y+=X[J],J++}return Y+=X.slice(Z),{body:Y,hoisted:$}}function Fj(X,$={},Z={}){let{title:Y="stx App",lang:J="en",meta:G=[],link:Q=[],script:w=[],headRaw:q="",htmlAttrs:W={},bodyClass:U="",bodyAttrs:K={}}=$,z=Z.title||Y,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],_=new Set(G.map(b3).filter(Boolean)),H=[...B.filter((N)=>!_.has(b3(N))),...G].map((N)=>{return` <meta ${r5(N)}>`}).join(`
3735
+ `),O=Q.map((N)=>{return` <link ${r5(N)}>`}).join(`
3736
+ `),L=w.map((N)=>{if(N.src)return` <script ${r5(N,(y)=>y==="content")}></script>`;if(N.content)return` <script>${N.content}</script>`;return""}).filter(Boolean).join(`
3737
+ `),F=Lj(W,J),V=Object.entries(K).map(([N,y])=>` ${N}="${A1(String(y))}"`).join(""),A=U?` class="${A1(U)}"`:"",{body:R,hoisted:T}=Oj(X),M=[H,Z.colorMode?` ${E3(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?z:Hj(z)}</title>`,` ${BG}`,O,L,q?` ${q}`:"",...(Z.styles||[]).map((N)=>` ${N}`),...T.map((N)=>` ${N}`),...(Z.headScripts||[]).map((N)=>` ${N}`),Z.headStack||""].filter(Boolean),k=[R,...(Z.bodyScripts||[]).map((N)=>N),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
3738
3738
  <html${F}>
3739
3739
  <head>
3740
3740
  ${M.join(`
@@ -3744,9 +3744,9 @@ ${M.join(`
3744
3744
  ${k.join(`
3745
3745
  `)}
3746
3746
  </body>
3747
- </html>`}function S3(X){let $=0;while($<X.length){let Z=X.slice($),Y=Z.match(/^\s+/);if(Y){$+=Y[0].length;continue}if(Z.startsWith("<!--")){let G=X.indexOf("-->",$);if(G===-1)return!1;$=G+3;continue}let J=Z.match(/^<(script|style)\b[^>]*>/i);if(J){let G=`</${J[1].toLowerCase()}>`,Q=X.toLowerCase().indexOf(G,$+J[0].length);if(Q===-1)return!1;$=Q+G.length;continue}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}return!1}function C3(X){return S3(X)}function zG(X,$={}){let Z=X.lastIndexOf("</head>");if(Z===-1)return X;let{meta:Y=[],link:J=[],script:G=[],headRaw:Q=""}=$,w=X.slice(0,Z),q=[];for(let W of Y){let K=b3(W);if(K&&w.includes(K))continue;q.push(` <meta ${n5(W)}>`)}for(let W of J){if(W.href&&w.includes(`href="${W.href}"`))continue;q.push(` <link ${n5(W)}>`)}for(let W of G)if(W.src){if(w.includes(`src="${W.src}"`))continue;q.push(` <script ${n5(W,(K)=>K==="content")}></script>`)}else if(W.content){if(w.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(Q&&!w.includes(Q))q.push(` ${Q}`);if(q.length===0)return X;return`${X.slice(0,Z)}${q.join(`
3747
+ </html>`}function S3(X){let $=0;while($<X.length){let Z=X.slice($),Y=Z.match(/^\s+/);if(Y){$+=Y[0].length;continue}if(Z.startsWith("<!--")){let G=X.indexOf("-->",$);if(G===-1)return!1;$=G+3;continue}let J=Z.match(/^<(script|style)\b[^>]*>/i);if(J){let G=`</${J[1].toLowerCase()}>`,Q=X.toLowerCase().indexOf(G,$+J[0].length);if(Q===-1)return!1;$=Q+G.length;continue}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}return!1}function C3(X){return S3(X)}function FG(X,$={}){let Z=X.lastIndexOf("</head>");if(Z===-1)return X;let{meta:Y=[],link:J=[],script:G=[],headRaw:Q=""}=$,w=X.slice(0,Z),q=[];for(let W of Y){let U=b3(W);if(U&&w.includes(U))continue;q.push(` <meta ${r5(W)}>`)}for(let W of J){if(W.href&&w.includes(`href="${W.href}"`))continue;q.push(` <link ${r5(W)}>`)}for(let W of G)if(W.src){if(w.includes(`src="${W.src}"`))continue;q.push(` <script ${r5(W,(U)=>U==="content")}></script>`)}else if(W.content){if(w.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(Q&&!w.includes(Q))q.push(` ${Q}`);if(q.length===0)return X;return`${X.slice(0,Z)}${q.join(`
3748
3748
  `)}
3749
- ${X.slice(Z)}`}function _G(X,$={},Z={}){if(C3(X))return X;return qj(X,$,Z)}var wG="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",U8="data-stx-html-attrs",z8="data-stx-html-class",qG;var BG=D(()=>{D3();qG=/^[A-Za-z_:][\w:.-]*$/});function jG(X,$={}){return new T5(X,$).routes}var HG=D(()=>{n1();n1()});async function OG(X){let $=X;if(!$)try{$=(await u1())?.pagesDir||"pages"}catch{$="pages"}let Z=$,Y=LG.get(Z);if(Y)return Y;let J=[];try{J=jG(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{J=[]}return LG.set(Z,J),J}var LG;var FG=D(()=>{HG();H1();LG=new Map});function Wj(X){return X.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function VG(X){return Wj(JSON.stringify(X))}function d1(X){let $=X,Z=new Set,Y=new Set,J=()=>{if(m0)Y.add(m0);return $};return J.set=(G)=>{if(!Object.is(G,$)){let Q=$;if($=G,Z.forEach((w)=>w($,Q)),n7)Y.forEach((w)=>B8.add(w));else Y.forEach((w)=>w())}},J.update=(G)=>{J.set(G($))},J.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(G)=>J.set(G),configurable:!0}),J}function H8(X){let $,Z=!0,Y=new Set,J=()=>{if(!Z)if(Z=!0,n7)Y.forEach((Q)=>B8.add(Q));else Y.forEach((Q)=>Q())},G=()=>{if(m0)Y.add(m0);if(Z){let Q=m0;m0=J,_8.push(J);try{$=X()}finally{_8.pop(),m0=Q}Z=!1}return $};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function L8(X,$={}){let Z,Y=!1,J=()=>{if(Y)return;if(Z)Z(),Z=void 0;let G=m0;m0=J,_8.push(J);try{let Q=X();Z=typeof Q==="function"?Q:void 0}finally{_8.pop(),m0=G}};if($.immediate!==!1)J();return()=>{if(Y=!0,Z)Z()}}function v3(X){if(n7){X();return}n7=!0;try{X()}finally{n7=!1,B8.forEach(($)=>$()),B8.clear()}}function x3(X){P3.push(X)}function f3(X){j8.push(X)}function Kj(){AG(P3,"onMount",j8)}function Uj(){AG(j8,"onDestroy")}function AG(X,$,Z){let Y=X.splice(0,X.length);for(let J of Y)try{let G=J();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${$} callback threw:`,G)}}function zj(){return{mount:P3.length,destroy:j8.length}}function O8(X){return typeof X==="function"&&X._isSignal===!0}function F8(X){return typeof X==="function"&&X._isDerived===!0}function g3(X){if(O8(X)||F8(X))return X();return X}function V8(X){let $=m0;m0=null;try{return X()}finally{m0=$}}function _j(X,$){let Z=typeof X==="function"?X:()=>X,Y=d1([]),J=H8(()=>Y().reduce((w,q)=>$(w,q.action),Z())),G=!1;return L8(()=>{if(Z(),!G){G=!0;return}if(V8(()=>Y().length))Y.set([])}),[J,(w,q)=>{let W={action:w};Y.set([...Y(),W]);let K=()=>{let U=Y().filter((z)=>z!==W);if(U.length!==Y().length)Y.set(U)};if(q&&typeof q.then==="function")Promise.resolve(q).then(K,K);return K}]}var m0=null,_8,n7=!1,B8,P3,j8;var A8=D(()=>{_8=[],B8=new Set,P3=[],j8=[]});var TG={};t(TG,{useOptimistic:()=>_j,untrack:()=>g3,state:()=>d1,runMountCallbacks:()=>Kj,runDestroyCallbacks:()=>Uj,pendingLifecycleCounts:()=>zj,peek:()=>V8,onMount:()=>x3,onDestroy:()=>f3,isSignal:()=>O8,isDerived:()=>F8,generateSignalsRuntimeDev:()=>h3,generateSignalsRuntime:()=>RG,effect:()=>L8,derived:()=>H8,default:()=>jj,batch:()=>v3});function RG(){let X=Bj(h3());try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X);return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return X}}function Bj(X){let $=[],Z=0,Y="console.log(";while(Z<X.length){let J=X.indexOf(Y,Z);if(J===-1){$.push(X.slice(Z));break}$.push(X.slice(Z,J));let G=1,Q=J+Y.length;while(Q<X.length&&G>0){let w=X[Q];if(w==='"'||w==="'"||w==="`"){let q=w;Q++;while(Q<X.length&&X[Q]!==q){if(X[Q]==="\\")Q++;Q++}Q++;continue}if(w==="(")G++;else if(w===")")G--;Q++}$.push("0"),Z=Q}return $.join("")}function h3(){return`
3749
+ ${X.slice(Z)}`}function VG(X,$={},Z={}){if(C3(X))return X;return Fj(X,$,Z)}var BG="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",z8="data-stx-html-attrs",_8="data-stx-html-class",jG;var AG=D(()=>{D3();jG=/^[A-Za-z_:][\w:.-]*$/});function RG(X,$={}){return new M5(X,$).routes}var TG=D(()=>{n1();n1()});async function NG(X){let $=X;if(!$)try{$=(await u1())?.pagesDir||"pages"}catch{$="pages"}let Z=$,Y=MG.get(Z);if(Y)return Y;let J=[];try{J=RG(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{J=[]}return MG.set(Z,J),J}var MG;var kG=D(()=>{TG();j1();MG=new Map});function Vj(X){return X.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function IG(X){return Vj(JSON.stringify(X))}function v3(){return z5}function x3(X){let $=z5;return EG.push(X),z5=X,$}function f3(X){EG.pop(),z5=X}function g3(){return B8>0}function h3(X){P3.add(X)}function DG(X){B8++;try{X()}finally{if(B8--,B8===0){let $=[...P3];P3.clear();for(let Z of $)Z()}}}function yG(X){let $=z5;z5=null;try{return X()}finally{z5=$}}var z5=null,EG,B8=0,P3;var bG=D(()=>{EG=[],P3=new Set});function d1(X){let $=X,Z=new Set,Y=new Set,J=()=>{let G=v3();if(G)Y.add(G);return $};return J.set=(G)=>{if(!Object.is(G,$)){let Q=$;if($=G,Z.forEach((w)=>w($,Q)),g3())Y.forEach((w)=>h3(w));else Y.forEach((w)=>w())}},J.update=(G)=>{J.set(G($))},J.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(G)=>J.set(G),configurable:!0}),J}function H8(X){let $,Z=!0,Y=new Set,J=()=>{if(!Z)if(Z=!0,g3())Y.forEach((Q)=>h3(Q));else Y.forEach((Q)=>Q())},G=()=>{let Q=v3();if(Q)Y.add(Q);if(Z){let w=x3(J);try{$=X()}finally{f3(w)}Z=!1}return $};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function L8(X,$={}){let Z,Y=!1,J=()=>{if(Y)return;if(Z)Z(),Z=void 0;let G=x3(J);try{let Q=X();Z=typeof Q==="function"?Q:void 0}finally{f3(G)}};if($.immediate!==!1)J();return()=>{if(Y=!0,Z)Z()}}function d3(X){DG(X)}function m3(X){u3.push(X)}function l3(X){j8.push(X)}function Aj(){SG(u3,"onMount",j8)}function Rj(){SG(j8,"onDestroy")}function SG(X,$,Z){let Y=X.splice(0,X.length);for(let J of Y)try{let G=J();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${$} callback threw:`,G)}}function Tj(){return{mount:u3.length,destroy:j8.length}}function O8(X){return typeof X==="function"&&X._isSignal===!0}function F8(X){return typeof X==="function"&&X._isDerived===!0}function c3(X){if(O8(X)||F8(X))return X();return X}function V8(X){return yG(X)}function Mj(X,$){let Z=typeof X==="function"?X:()=>X,Y=d1([]),J=H8(()=>Y().reduce((w,q)=>$(w,q.action),Z())),G=!1;return L8(()=>{if(Z(),!G){G=!0;return}if(V8(()=>Y().length))Y.set([])}),[J,(w,q)=>{let W={action:w};Y.set([...Y(),W]);let U=()=>{let K=Y().filter((z)=>z!==W);if(K.length!==Y().length)Y.set(K)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var u3,j8;var A8=D(()=>{bG();u3=[],j8=[]});var PG={};t(PG,{useOptimistic:()=>Mj,untrack:()=>c3,state:()=>d1,runMountCallbacks:()=>Aj,runDestroyCallbacks:()=>Rj,pendingLifecycleCounts:()=>Tj,peek:()=>V8,onMount:()=>m3,onDestroy:()=>l3,isSignal:()=>O8,isDerived:()=>F8,generateSignalsRuntimeDev:()=>p3,generateSignalsRuntime:()=>CG,effect:()=>L8,derived:()=>H8,default:()=>kj,batch:()=>d3});function CG(){let X=Nj(p3());try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X);return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return X}}function Nj(X){let $=[],Z=0,Y="console.log(";while(Z<X.length){let J=X.indexOf(Y,Z);if(J===-1){$.push(X.slice(Z));break}$.push(X.slice(Z,J));let G=1,Q=J+Y.length;while(Q<X.length&&G>0){let w=X[Q];if(w==='"'||w==="'"||w==="`"){let q=w;Q++;while(Q<X.length&&X[Q]!==q){if(X[Q]==="\\")Q++;Q++}Q++;continue}if(w==="(")G++;else if(w===")")G--;Q++}$.push("0"),Z=Q}return $.join("")}function p3(){return`
3750
3750
  // STX Signals Runtime (Development Build)
3751
3751
  console.log('[stx] signals runtime loading');
3752
3752
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -6296,7 +6296,7 @@ catch (e2) {
6296
6296
  // :attr still works for backward compat but is reserved for structural directives.
6297
6297
  // x-text, x-html, x-model, x-show, x-if, x-for, x-cloak, x-ref, x-data are
6298
6298
  // handled by their own code paths below \u2014 exclude them here.
6299
- var X_HANDLED = ${J6()};
6299
+ var X_HANDLED = ${K6()};
6300
6300
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
6301
6301
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
6302
6302
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
@@ -11507,62 +11507,57 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
11507
11507
  }
11508
11508
  }
11509
11509
  })();
11510
- `}var jj;var MG=D(()=>{A8();G1();A8();jj={state:d1,derived:H8,effect:L8,batch:v3,onMount:x3,onDestroy:f3,isSignal:O8,isDerived:F8,untrack:g3,peek:V8,generateSignalsRuntime:RG,generateSignalsRuntimeDev:h3}});var u3={};t(u3,{templateCache:()=>NG,readFileCached:()=>Hj,invalidateFileCacheByDir:()=>Oj,invalidateFileCache:()=>Lj,hashFilePath:()=>r7,getCachedSignalsRuntime:()=>Aj,getCachedRouterScript:()=>Rj,clearDevCaches:()=>Tj,checkCache:()=>Mj,cacheTemplate:()=>Nj,__setSignalsGeneratorsForTest:()=>Vj});import m1 from"fs";import r5 from"path";async function Hj(X){let Z;for(let Y=0;Y<3;Y++)try{let G=(await m1.promises.stat(X)).mtime.getTime(),Q=z5.get(X);if(Q&&Q.mtime===G)return Q.content;let w=await Bun.file(X).text(),W=(await m1.promises.stat(X)).mtime.getTime();if(W!==G)continue;return z5.set(X,{content:w,mtime:W}),w}catch(J){Z=J;break}throw z5.delete(X),Error(`File not found: ${X}${Z?` (${Z.message})`:""}`)}function Lj(X){z5.delete(X)}function Oj(X){for(let $ of z5.keys())if($.startsWith(X))z5.delete($)}function Vj(X){kG=X}async function Aj(X=!1){let $=kG??await Promise.resolve().then(() => (MG(),TG));if(X)return $.generateSignalsRuntimeDev();if(R8===null)R8=$.generateSignalsRuntime();return R8}async function Rj(){if(T8===null){let{getRouterScript:X}=await Promise.resolve().then(() => (n1(),n2));T8=X()}return T8}function Tj(){z5.clear(),EG(),R8=null,Fj=null,T8=null}function IG(X){let $={debug:X.debug===!0,middleware:(X.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:(X.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify($)).digest("hex")}async function Mj(X,$){try{if(!$.cachePath)return null;let Z=r5.resolve($.cachePath),Y=r5.join(Z,`${r7(X)}.html`),J=r5.join(Z,`${r7(X)}.meta.json`);if(!await i(Y)||!await i(J))return null;let G=await Bun.file(J).text(),Q=JSON.parse(G);if(Q.cacheVersion!==$.cacheVersion)return null;if(Q.optionsSignature!==IG($))return null;if((await m1.promises.stat(X)).mtime.getTime()>Q.mtime)return null;for(let q of Q.dependencies)if(await i(q)){if((await m1.promises.stat(q)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(Y).text()}catch(Z){return console.warn(`Cache error for ${X}:`,Z),null}}async function Nj(X,$,Z,Y){try{if(!Y.cachePath)return;let J=r5.resolve(Y.cachePath);await m1.promises.mkdir(J,{recursive:!0});let G=r5.join(J,`${r7(X)}.html`),Q=r5.join(J,`${r7(X)}.meta.json`),w=await m1.promises.stat(X);await Bun.write(G,$);let q={sourcePath:X,mtime:w.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:Y.cacheVersion,optionsSignature:IG(Y),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(q,null,2)),NG.set(X,{output:$,mtime:w.mtime.getTime(),dependencies:Z})}catch(J){console.warn(`Failed to cache template ${X}:`,J)}}function r7(X){return new Bun.CryptoHasher("sha1").update(X).digest("hex").substring(0,kj)}var NG,z5,R8=null,Fj=null,kG=null,T8=null,kj=16;var d3=D(()=>{T0();NG=new Map,z5=new Map});function DG(X){return X.includes("data-stx-runtime")}function yG(X){let $=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=$.exec(X);Z!==null;Z=$.exec(X)){let Y=X.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}async function M8(X,$){if(X.includes("data-stx-runtime")||X.includes("window.stx.state")||X.includes("STX Signals Runtime"))return X;if($.buildMode==="serve"){let w=X.indexOf("<script");if(w!==-1)return X.slice(0,w)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
11511
- `+X.slice(w);if(X.includes("</head>")){let q=X.indexOf("</head>");return X.slice(0,q)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
11512
- `+X.slice(q)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
11513
- `+X}if($.buildMode==="compile"){let w=X.indexOf("<script");if(w!==-1)return X.slice(0,w)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
11514
- `+X.slice(w);if(X.includes("</head>")){let q=X.indexOf("</head>");return X.slice(0,q)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
11515
- `+X.slice(q)}return`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
11516
- `+X}let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (d3(),u3)),J=`<script data-stx-scoped data-stx-runtime>${await Z($.debug)}</script>`,G=X.indexOf("<script");if(G!==-1)return X.slice(0,G)+J+`
11517
- `+X.slice(G);if(X.includes("</head>")){let Q=X.indexOf("</head>");return X.slice(0,Q)+J+`
11518
- `+X.slice(Q)}if(X.includes("<body")){let Q=X.indexOf("<body"),w=X.indexOf(">",Q);return X.slice(0,w+1)+`
11519
- `+J+X.slice(w+1)}return J+`
11520
- `+X}async function m3(X,$){if(!X.includes("</body>"))return X;if(X.includes("data-stx-router")||X.includes("__stxRouter)return")||X.includes("__stxRouter=true"))return X;let Z=$?.router,Y="";{let w={};if(Z){if(Z.container)w.container=Z.container;if(Z.interceptAllLinks!==void 0)w.interceptAllLinks=Z.interceptAllLinks;if(Z.progress!==void 0)w.progress=Z.progress;if(Z.viewTransitions!==void 0)w.viewTransitions=Z.viewTransitions;if(Z.viewTransitionDuration!==void 0)w.viewTransitionDuration=Z.viewTransitionDuration;if(Z.viewTransitionEasing!==void 0)w.viewTransitionEasing=Z.viewTransitionEasing;if(Z.scrollToTop!==void 0)w.scrollToTop=Z.scrollToTop;if(Z.prefetch!==void 0)w.prefetch=Z.prefetch;if(Z.cache!==void 0)w.cache=Z.cache;if(Z.progressColor!==void 0)w.progressColor=Z.progressColor;if(Z.progressHeight!==void 0)w.progressHeight=Z.progressHeight}try{let q=await OG($?.pagesDir);if(q.length>0)w.ownedRoutes=q}catch{}if(Object.keys(w).length>0)Y=`<script>window.__stxRouterConfig=${VG(w)};</script>
11521
- `}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (d3(),u3)),G=$?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':$?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await J()}</script>`,Q=X.lastIndexOf("</body>");return X.slice(0,Q)+Y+G+`
11522
- </body>`+X.slice(Q+7)}var N8=D(()=>{FG();w9()});var D8={};t(D8,{scanScriptTags:()=>fG,rewriteStxImportSpecifiers:()=>dG,processSignals:()=>n3,processScriptSetup:()=>hG,preEvalLiteralReactiveIfs:()=>p3,parseLoopExpression:()=>gG,hasSignalsSyntax:()=>E8,findMarkupIndexOutsideScripts:()=>I8,extractExports:()=>uG,convertSignalLoopsToAttributes:()=>i3,convertSignalDirectivesToAttributes:()=>c3});function fG(X,$={}){let Z=[];for(let Y of a$(X,D1)){let J=Y.token.match(/^<script\b([^>]*)>/i),G=Y.token.match(/<\/script\s*>$/i);if(!J||!G)continue;let Q=J[1];if($.skipAttrs){if($.skipAttrs.lastIndex=0,$.skipAttrs.test(Q))continue}let w=J[0].length,q=Y.token.length-G[0].length;Z.push({fullMatch:Y.token,attrs:Q,body:Y.token.slice(w,q),start:Y.start,end:Y.end})}return Z}function gG(X){let $=X.trim(),Z=$.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let J=Z[1].trim(),G=Z[2].trim(),{itemVar:Q,indexVar:w}=SG(G);if(Q)return{style:"as",iterable:J,itemVar:Q,indexVar:w}}let Y=$.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let J=Y[1].trim(),G=Y[2].trim(),{itemVar:Q,indexVar:w}=SG(J);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:w}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function SG(X){let $=X.trim(),Z=$.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let Y=$.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let J=$.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let G=$.match(/^(\w+)$/);if(G)return{itemVar:G[1],indexVar:null};return{itemVar:null,indexVar:null}}function E8(X){return $6(X)}function Ej(X){let $=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,Y;while((Y=$.exec(X))!==null){let J=Y[1];if(J.startsWith("if"))Z++;else if(J==="endif")Z--;else if(Z===0)return!0}return!1}function Dj(X){let $=new Set,Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=Z.exec(X))!==null){let G=J[1],Q;while((Q=Y.exec(G))!==null)$.add(Q[1])}return $}function yj(X){return X.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function PG(X,$,Z){if(!X)return!1;let Y=yj(X),J=!1,G=!1,Q=!1,w=/([a-zA-Z_$][\w$]*)/g,q;while((q=w.exec(Y))!==null){let z=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(CG.has(z))continue;if($.has(z))J=!0;else if(Z&&z in Z)G=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,K;while((K=W.exec(Y))!==null){let z=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(CG.has(z)||Z&&z in Z)continue;Q=!0}return(J||Q)&&!G}function k8(X,$,Z){let Y=Z===void 0?` ${$}`:` ${$}="${Z.replace(/"/g,"&quot;")}"`,J=X.trim(),G=J.match(xG);if(G&&bj(G[3],G[1])){let[,Q,w,q]=G;return`<${Q}${w}${Y}>${q}</${Q}>`}return`<template${Y}>${J}</template>`}function bj(X,$){let Z=new RegExp(`<(/)?${$}(?=[\\s/>])`,"gi"),Y=0,J;while((J=Z.exec(X))!==null)if(J[1]){if(Y--,Y<0)return!1}else Y++;return!0}function c3(X,$){let Z=Dj(X);function Y(J){let G=J,Q=/@if\s*\(/g,w,q=[];while((w=Q.exec(G))!==null){let W=w.index,K=W+w[0].length,U=1,z=K;while(z<G.length&&U>0){if(G[z]==="(")U++;else if(G[z]===")")U--;z++}if(U!==0)continue;let B=G.substring(K,z-1).trim(),_=z,j=1,H=_,O=/@(if\s*\(|endif)/g;O.lastIndex=_;let L;while((L=O.exec(G))!==null)if(L[1].startsWith("if"))j++;else if(L[1]==="endif"){if(j--,j===0){H=L.index+L[0].length;break}}if(j!==0)continue;let F=G.substring(_,H-6).trim(),V;if(Ej(F)){let A=v7(G.substring(W,H));if(A.length===0)continue;let R=A[0].branches.filter((k)=>k.type!=="else");if(!(R.length>0&&R.every((k)=>PG(k.condition,Z,$))))continue;V=A[0].branches.map((k)=>{let N=Y(k.content);if(k.type==="elseif")return k8(N,"@else-if",k.condition??"");if(k.type==="else")return k8(N,"@else");return k8(N,"@if",k.condition??"")}).join(`
11523
- `)}else{if(!PG(B,Z,$))continue;V=k8(Y(F),"@if",B)}q.push({start:W,end:H,replacement:V}),Q.lastIndex=H}for(let W=q.length-1;W>=0;W--){let{start:K,end:U,replacement:z}=q[W];G=G.substring(0,K)+z+G.substring(U)}return G}return Y(X)}function Sj(X){let $=X.trim();if($==="")return;if($==="true")return!0;if($==="false")return!1;if($==="null")return!1;if($==="undefined")return!1;if($==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test($)){let J=Number($);return J!==0&&!Number.isNaN(J)}let Z=$.match(/^'((?:\\.|[^'\\])*)'$/);if(Z)return Z[1].length>0;let Y=$.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}function Cj(X,$,Z,Y){if(l3.has(Z.toLowerCase()))return Y;let J=Z.toLowerCase(),G=X.toLowerCase(),Q=X.length,w=1,q=Y;while(q<Q){let W=X.indexOf("<",q);if(W===-1)return-1;if(q=W,X.startsWith("<!--",q)){let B=X.indexOf("-->",q+4);if(B===-1)return-1;q=B+3;continue}let K=/^<(script|style)\b/i.exec(X.slice(q,q+8));if(K){let B=X.indexOf(">",q);if(B===-1)return-1;if(X[B-1]==="/"){q=B+1;continue}let _=G.indexOf(`</${K[1].toLowerCase()}`,q);if(_===-1)return-1;let j=X.indexOf(">",_);if(j===-1)return-1;q=j+1;continue}if(X[q+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec(X.slice(q,q+64));if(!B){q++;continue}if(B[1].toLowerCase()===J){if(w--,q+=B[0].length,w===0)return q;continue}q+=B[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec(X.slice(q,q+64));if(!U){q++;continue}let z=X.indexOf(">",q);if(z===-1)return-1;if(U[1].toLowerCase()===J){let B=X.slice(q,z+1);if(!(/\/\s*>$/.test(B)||l3.has(J)))w++}q=z+1}return-1}function vj(X,$){let Z=$,Y=X.length;for(;;){while(Z<Y&&X[Z]!=="<")Z++;if(Z>=Y)return!1;if(X.startsWith("<!--",Z)){let Q=X.indexOf("-->",Z+4);if(Q===-1)return!1;Z=Q+3;continue}break}if(X[Z+1]==="/")return!1;let J=X.indexOf(">",Z);if(J===-1)return!1;let G=X.slice(Z,J+1);return Pj.test(G)}function p3(X){if(!X.includes(":if")&&!X.includes(":show")&&!X.includes("x-if")&&!X.includes("x-show")&&!X.includes("@if=")&&!X.includes("@show="))return X;let $=[],Z=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);let J=(U)=>$.some(([z,B])=>U>=z&&U<B),G=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,Q=[],w;while((w=G.exec(X))!==null){if(J(w.index))continue;let[U,z,B,_,j,H,O]=w,L=Sj(j);if(L===void 0)continue;let F=w.index,V=F+U.length,T=!!O||/\/\s*>$/.test(U)||l3.has(z.toLowerCase())?V:Cj(X,F,z,V);if(T===-1)continue;if((_===":if"||_==="x-if"||_==="@if")&&vj(X,T)){G.lastIndex=V;continue}if(L===!0){let k=`<${z}${B}${H}${O}>`;Q.push({start:F,end:V,replacement:k});continue}Q.push({start:F,end:T,replacement:""}),G.lastIndex=T}if(Q.length===0)return X;Q.sort((U,z)=>U.start-z.start);let q=[],W=-1;for(let U of Q){if(U.start<W)continue;q.push(U),W=U.end}let K=X;for(let U=q.length-1;U>=0;U--){let{start:z,end:B,replacement:_}=q[U];K=K.substring(0,z)+_+K.substring(B)}return K}function i3(X,$){let Z=X,Y=/@(for|foreach)\s*\(/g,J,G=[],Q=[];while((J=Y.exec(Z))!==null){let w=J[1],q=J.index,W=q+J[0].length,K=1,U=W;while(U<Z.length&&K>0){if(Z[U]==="(")K++;else if(Z[U]===")")K--;U++}if(K!==0)continue;let z=Z.substring(W,U-1).trim(),B=U,_=gG(z),j=w==="for"?"@endfor":"@endforeach",H=1,O=B,L=w==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${w}\\s*\\(|end${w})`,"g");L.lastIndex=B;let F;while((F=L.exec(Z))!==null)if(F[1].startsWith(w))H++;else if(H--,H===0){O=F.index+F[0].length;break}if(H!==0)continue;let V=()=>{let M=[_.itemVar,_.indexVar].filter(Boolean);if(M.length)Q.push({start:q,end:O,vars:M})};if(_.iterable){let M=_.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M)){V();continue}let k=M.split(/[.[(]/)[0].trim(),N=$?k in $:!1,y=Q.some((I)=>q>I.start&&q<I.end&&I.vars.includes(k));if(k&&(N||y)){V();continue}}if(_.style==="as")z=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let A=Z.substring(B,O-j.length).trim(),R=A.match(xG),T;if(R){let[,M,k,N]=R;T=`<${M}${k} @for="${z}">${N}</${M}>`}else T=`<template @for="${z}">${A}</template>`;G.push({start:q,end:O,replacement:T})}for(let w=G.length-1;w>=0;w--){let{start:q,end:W,replacement:K}=G[w];Z=Z.substring(0,q)+K+Z.substring(W)}return Z}function xj(X){let $=new Set,Z=[],Y=0,J=0,G=X.length,Q=(K)=>{let U=Y+1;while(U<G){let z=X[U];if(z==="\\"){U+=2;continue}if(z===K)return U+1;U++}return G},w=()=>{let K=Y+2;while(K<G&&X[K]!==`
11524
- `)K++;return K},q=()=>{let K=Y+2;while(K<G-1){if(X[K]==="*"&&X[K+1]==="/")return K+2;K++}return G},W=(K)=>{let U=K,z=0;while(U<G){let B=X[U];if(B==="/"&&X[U+1]==="/"){let _=U+2;while(_<G&&X[_]!==`
11525
- `)_++;U=_;continue}if(B==="/"&&X[U+1]==="*"){let _=U+2;while(_<G-1&&!(X[_]==="*"&&X[_+1]==="/"))_++;U=_+2;continue}if(B==='"'||B==="'"||B==="`"){let _=U+1;while(_<G){if(X[_]==="\\"){_+=2;continue}if(X[_]===B){_++;break}_++}U=_;continue}if(B==="("||B==="["||B==="{"){z++,U++;continue}if(B===")"||B==="]"||B==="}"){z--,U++;continue}if(B===";"&&z===0)return U+1;U++}return G};while(Y<G){let K=X[Y];if(K==="/"&&X[Y+1]==="/"){let U=w();Z.push(X.slice(Y,U)),Y=U;continue}if(K==="/"&&X[Y+1]==="*"){let U=q();Z.push(X.slice(Y,U)),Y=U;continue}if(K==='"'||K==="'"||K==="`"){let U=Q(K);Z.push(X.slice(Y,U)),Y=U;continue}if(K==="{"){J++,Z.push(K),Y++;continue}if(K==="}"){J--,Z.push(K),Y++;continue}if(J===0){let U=Y>0?X[Y-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let B=X.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let _=B[2],j=W(Y+B[0].length);if($.has(_)){Z.push(`/* stx: deduped const ${_} */`),Y=j;continue}$.add(_),Z.push(X.slice(Y,j)),Y=j;continue}}}Z.push(K),Y++}return Z.join("")}async function hG(X,$,Z){let Y=fG(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\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*\(/,G=[];for(let H of Y){let O=H.body;if(e1(H.attrs))O=X5(O);if(J.test(O))G.push({fullMatch:H.fullMatch,attrs:H.attrs,content:O})}if(G.length===0)return{output:X,setupCode:null};let Q=`__stx_setup_${Date.now()}_${Ij++}`,{hasUserImports:w,bundleClientScript:q}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (N7(),M7))),W=[];for(let H=0;H<G.length;H++){let O=G[H].content;if(O=E5(O).code,w(O))O=await q(O,$||"",{projectRoot:process.cwd()});O=O.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,V)=>dG(V));let L=h0(O);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
11526
- ${L}`)}let K=W.join(`
11527
-
11528
- `);K=xj(K);let U=uG(K),z=U.split(",").map((H)=>H.trim()).filter(Boolean),B=RX(K,Z),_=`
11510
+ `}var kj;var vG=D(()=>{A8();J1();A8();kj={state:d1,derived:H8,effect:L8,batch:d3,onMount:m3,onDestroy:l3,isSignal:O8,isDerived:F8,untrack:c3,peek:V8,generateSignalsRuntime:CG,generateSignalsRuntimeDev:p3}});var i3={};t(i3,{templateCache:()=>xG,readFileCached:()=>Ij,invalidateFileCacheByDir:()=>Dj,invalidateFileCache:()=>Ej,hashFilePath:()=>s7,getCachedSignalsRuntime:()=>Sj,getCachedRouterScript:()=>Cj,clearDevCaches:()=>Pj,checkCache:()=>vj,cacheTemplate:()=>xj,__setSignalsGeneratorsForTest:()=>bj});import m1 from"fs";import s5 from"path";async function Ij(X){let Z;for(let Y=0;Y<3;Y++)try{let G=(await m1.promises.stat(X)).mtime.getTime(),Q=_5.get(X);if(Q&&Q.mtime===G)return Q.content;let w=await Bun.file(X).text(),W=(await m1.promises.stat(X)).mtime.getTime();if(W!==G)continue;return _5.set(X,{content:w,mtime:W}),w}catch(J){Z=J;break}throw _5.delete(X),Error(`File not found: ${X}${Z?` (${Z.message})`:""}`)}function Ej(X){_5.delete(X)}function Dj(X){for(let $ of _5.keys())if($.startsWith(X))_5.delete($)}function bj(X){fG=X}async function Sj(X=!1){let $=fG??await Promise.resolve().then(() => (vG(),PG));if(X)return $.generateSignalsRuntimeDev();if(R8===null)R8=$.generateSignalsRuntime();return R8}async function Cj(){if(T8===null){let{getRouterScript:X}=await Promise.resolve().then(() => (n1(),X6));T8=X()}return T8}function Pj(){_5.clear(),hG(),R8=null,yj=null,T8=null}function gG(X){let $={debug:X.debug===!0,middleware:(X.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:(X.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify($)).digest("hex")}async function vj(X,$){try{if(!$.cachePath)return null;let Z=s5.resolve($.cachePath),Y=s5.join(Z,`${s7(X)}.html`),J=s5.join(Z,`${s7(X)}.meta.json`);if(!await i(Y)||!await i(J))return null;let G=await Bun.file(J).text(),Q=JSON.parse(G);if(Q.cacheVersion!==$.cacheVersion)return null;if(Q.optionsSignature!==gG($))return null;if((await m1.promises.stat(X)).mtime.getTime()>Q.mtime)return null;for(let q of Q.dependencies)if(await i(q)){if((await m1.promises.stat(q)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(Y).text()}catch(Z){return console.warn(`Cache error for ${X}:`,Z),null}}async function xj(X,$,Z,Y){try{if(!Y.cachePath)return;let J=s5.resolve(Y.cachePath);await m1.promises.mkdir(J,{recursive:!0});let G=s5.join(J,`${s7(X)}.html`),Q=s5.join(J,`${s7(X)}.meta.json`),w=await m1.promises.stat(X);await Bun.write(G,$);let q={sourcePath:X,mtime:w.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:Y.cacheVersion,optionsSignature:gG(Y),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(q,null,2)),xG.set(X,{output:$,mtime:w.mtime.getTime(),dependencies:Z})}catch(J){console.warn(`Failed to cache template ${X}:`,J)}}function s7(X){return new Bun.CryptoHasher("sha1").update(X).digest("hex").substring(0,fj)}var xG,_5,R8=null,yj=null,fG=null,T8=null,fj=16;var n3=D(()=>{T0();xG=new Map,_5=new Map});function uG(X){return X.includes("data-stx-runtime")}function dG(X){let $=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=$.exec(X);Z!==null;Z=$.exec(X)){let Y=X.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}function r3(X,$){let Z=X.indexOf("<script"),Y=X.search(/<!doctype\b/i);if(Z!==-1&&(Y===-1||Z>Y))return X.slice(0,Z)+$+`
11511
+ `+X.slice(Z);let J=/<head\b[^>]*>/i.exec(X);if(J){let Q=J.index+J[0].length;return`${X.slice(0,Q)}
11512
+ ${$}${X.slice(Q)}`}if(X.includes("</head>")){let Q=X.indexOf("</head>");return X.slice(0,Q)+$+`
11513
+ `+X.slice(Q)}if(P7(X))return bX(X,(Q)=>`${Q}
11514
+ ${$}`);return`${$}
11515
+ ${X}`}async function M8(X,$){if(X.includes("data-stx-runtime")||X.includes("window.stx.state")||X.includes("STX Signals Runtime"))return X;if($.buildMode==="serve")return r3(X,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if($.buildMode==="compile")return r3(X,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (n3(),i3)),Y=await Z($.debug);return r3(X,`<script data-stx-scoped data-stx-runtime>${Y}</script>`)}async function s3(X,$){if(!X.includes("</body>"))return X;if(X.includes("data-stx-router")||X.includes("__stxRouter)return")||X.includes("__stxRouter=true"))return X;let Z=$?.router,Y="";{let w={};if(Z){if(Z.container)w.container=Z.container;if(Z.interceptAllLinks!==void 0)w.interceptAllLinks=Z.interceptAllLinks;if(Z.progress!==void 0)w.progress=Z.progress;if(Z.viewTransitions!==void 0)w.viewTransitions=Z.viewTransitions;if(Z.viewTransitionDuration!==void 0)w.viewTransitionDuration=Z.viewTransitionDuration;if(Z.viewTransitionEasing!==void 0)w.viewTransitionEasing=Z.viewTransitionEasing;if(Z.scrollToTop!==void 0)w.scrollToTop=Z.scrollToTop;if(Z.prefetch!==void 0)w.prefetch=Z.prefetch;if(Z.cache!==void 0)w.cache=Z.cache;if(Z.progressColor!==void 0)w.progressColor=Z.progressColor;if(Z.progressHeight!==void 0)w.progressHeight=Z.progressHeight}try{let q=await NG($?.pagesDir);if(q.length>0)w.ownedRoutes=q}catch{}if(Object.keys(w).length>0)Y=`<script>window.__stxRouterConfig=${IG(w)};</script>
11516
+ `}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (n3(),i3)),G=$?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':$?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await J()}</script>`,Q=X.lastIndexOf("</body>");return X.slice(0,Q)+Y+G+`
11517
+ </body>`+X.slice(Q+7)}var N8=D(()=>{kG();w9()});var D8={};t(D8,{scanScriptTags:()=>rG,rewriteStxImportSpecifiers:()=>tG,processSignals:()=>X4,processScriptSetup:()=>oG,preEvalLiteralReactiveIfs:()=>t3,parseLoopExpression:()=>sG,hasSignalsSyntax:()=>E8,findMarkupIndexOutsideScripts:()=>I8,extractExports:()=>aG,convertSignalLoopsToAttributes:()=>e3,convertSignalDirectivesToAttributes:()=>a3});function rG(X,$={}){let Z=[];for(let Y of a$(X,D1)){let J=Y.token.match(/^<script\b([^>]*)>/i),G=Y.token.match(/<\/script\s*>$/i);if(!J||!G)continue;let Q=J[1];if($.skipAttrs){if($.skipAttrs.lastIndex=0,$.skipAttrs.test(Q))continue}let w=J[0].length,q=Y.token.length-G[0].length;Z.push({fullMatch:Y.token,attrs:Q,body:Y.token.slice(w,q),start:Y.start,end:Y.end})}return Z}function sG(X){let $=X.trim(),Z=$.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let J=Z[1].trim(),G=Z[2].trim(),{itemVar:Q,indexVar:w}=lG(G);if(Q)return{style:"as",iterable:J,itemVar:Q,indexVar:w}}let Y=$.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let J=Y[1].trim(),G=Y[2].trim(),{itemVar:Q,indexVar:w}=lG(J);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:w}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function lG(X){let $=X.trim(),Z=$.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let Y=$.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let J=$.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let G=$.match(/^(\w+)$/);if(G)return{itemVar:G[1],indexVar:null};return{itemVar:null,indexVar:null}}function E8(X){return q6(X)}function hj(X){let $=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,Y;while((Y=$.exec(X))!==null){let J=Y[1];if(J.startsWith("if"))Z++;else if(J==="endif")Z--;else if(Z===0)return!0}return!1}function uj(X){let $=new Set,Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=Z.exec(X))!==null){let G=J[1],Q;while((Q=Y.exec(G))!==null)$.add(Q[1])}return $}function dj(X){return X.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function pG(X,$,Z){if(!X)return!1;let Y=dj(X),J=!1,G=!1,Q=!1,w=/([a-zA-Z_$][\w$]*)/g,q;while((q=w.exec(Y))!==null){let z=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(cG.has(z))continue;if($.has(z))J=!0;else if(Z&&z in Z)G=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(Y))!==null){let z=U[1];if(Y.slice(0,U.index).trimEnd().endsWith("."))continue;if(cG.has(z)||Z&&z in Z)continue;Q=!0}return(J||Q)&&!G}function k8(X,$,Z){let Y=Z===void 0?` ${$}`:` ${$}="${Z.replace(/"/g,"&quot;")}"`,J=X.trim(),G=J.match(nG);if(G&&mj(G[3],G[1])){let[,Q,w,q]=G;return`<${Q}${w}${Y}>${q}</${Q}>`}return`<template${Y}>${J}</template>`}function mj(X,$){let Z=new RegExp(`<(/)?${$}(?=[\\s/>])`,"gi"),Y=0,J;while((J=Z.exec(X))!==null)if(J[1]){if(Y--,Y<0)return!1}else Y++;return!0}function a3(X,$){let Z=uj(X);function Y(J){let G=J,Q=/@if\s*\(/g,w,q=[];while((w=Q.exec(G))!==null){let W=w.index,U=W+w[0].length,K=1,z=U;while(z<G.length&&K>0){if(G[z]==="(")K++;else if(G[z]===")")K--;z++}if(K!==0)continue;let B=G.substring(U,z-1).trim(),_=z,j=1,H=_,O=/@(if\s*\(|endif)/g;O.lastIndex=_;let L;while((L=O.exec(G))!==null)if(L[1].startsWith("if"))j++;else if(L[1]==="endif"){if(j--,j===0){H=L.index+L[0].length;break}}if(j!==0)continue;let F=G.substring(_,H-6).trim(),V;if(hj(F)){let A=f7(G.substring(W,H));if(A.length===0)continue;let R=A[0].branches.filter((k)=>k.type!=="else");if(!(R.length>0&&R.every((k)=>pG(k.condition,Z,$))))continue;V=A[0].branches.map((k)=>{let N=Y(k.content);if(k.type==="elseif")return k8(N,"@else-if",k.condition??"");if(k.type==="else")return k8(N,"@else");return k8(N,"@if",k.condition??"")}).join(`
11518
+ `)}else{if(!pG(B,Z,$))continue;V=k8(Y(F),"@if",B)}q.push({start:W,end:H,replacement:V}),Q.lastIndex=H}for(let W=q.length-1;W>=0;W--){let{start:U,end:K,replacement:z}=q[W];G=G.substring(0,U)+z+G.substring(K)}return G}return Y(X)}function lj(X){let $=X.trim();if($==="")return;if($==="true")return!0;if($==="false")return!1;if($==="null")return!1;if($==="undefined")return!1;if($==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test($)){let J=Number($);return J!==0&&!Number.isNaN(J)}let Z=$.match(/^'((?:\\.|[^'\\])*)'$/);if(Z)return Z[1].length>0;let Y=$.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}function cj(X,$,Z,Y){if(o3.has(Z.toLowerCase()))return Y;let J=Z.toLowerCase(),G=X.toLowerCase(),Q=X.length,w=1,q=Y;while(q<Q){let W=X.indexOf("<",q);if(W===-1)return-1;if(q=W,X.startsWith("<!--",q)){let B=X.indexOf("-->",q+4);if(B===-1)return-1;q=B+3;continue}let U=/^<(script|style)\b/i.exec(X.slice(q,q+8));if(U){let B=X.indexOf(">",q);if(B===-1)return-1;if(X[B-1]==="/"){q=B+1;continue}let _=G.indexOf(`</${U[1].toLowerCase()}`,q);if(_===-1)return-1;let j=X.indexOf(">",_);if(j===-1)return-1;q=j+1;continue}if(X[q+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec(X.slice(q,q+64));if(!B){q++;continue}if(B[1].toLowerCase()===J){if(w--,q+=B[0].length,w===0)return q;continue}q+=B[0].length;continue}let K=/^<([a-z][\w-]*)\b/i.exec(X.slice(q,q+64));if(!K){q++;continue}let z=X.indexOf(">",q);if(z===-1)return-1;if(K[1].toLowerCase()===J){let B=X.slice(q,z+1);if(!(/\/\s*>$/.test(B)||o3.has(J)))w++}q=z+1}return-1}function ij(X,$){let Z=$,Y=X.length;for(;;){while(Z<Y&&X[Z]!=="<")Z++;if(Z>=Y)return!1;if(X.startsWith("<!--",Z)){let Q=X.indexOf("-->",Z+4);if(Q===-1)return!1;Z=Q+3;continue}break}if(X[Z+1]==="/")return!1;let J=X.indexOf(">",Z);if(J===-1)return!1;let G=X.slice(Z,J+1);return pj.test(G)}function t3(X){if(!X.includes(":if")&&!X.includes(":show")&&!X.includes("x-if")&&!X.includes("x-show")&&!X.includes("@if=")&&!X.includes("@show="))return X;let $=[],Z=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);let J=(K)=>$.some(([z,B])=>K>=z&&K<B),G=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,Q=[],w;while((w=G.exec(X))!==null){if(J(w.index))continue;let[K,z,B,_,j,H,O]=w,L=lj(j);if(L===void 0)continue;let F=w.index,V=F+K.length,T=!!O||/\/\s*>$/.test(K)||o3.has(z.toLowerCase())?V:cj(X,F,z,V);if(T===-1)continue;if((_===":if"||_==="x-if"||_==="@if")&&ij(X,T)){G.lastIndex=V;continue}if(L===!0){let k=`<${z}${B}${H}${O}>`;Q.push({start:F,end:V,replacement:k});continue}Q.push({start:F,end:T,replacement:""}),G.lastIndex=T}if(Q.length===0)return X;Q.sort((K,z)=>K.start-z.start);let q=[],W=-1;for(let K of Q){if(K.start<W)continue;q.push(K),W=K.end}let U=X;for(let K=q.length-1;K>=0;K--){let{start:z,end:B,replacement:_}=q[K];U=U.substring(0,z)+_+U.substring(B)}return U}function e3(X,$){let Z=X,Y=/@(for|foreach)\s*\(/g,J,G=[],Q=[];while((J=Y.exec(Z))!==null){let w=J[1],q=J.index,W=q+J[0].length,U=1,K=W;while(K<Z.length&&U>0){if(Z[K]==="(")U++;else if(Z[K]===")")U--;K++}if(U!==0)continue;let z=Z.substring(W,K-1).trim(),B=K,_=sG(z),j=w==="for"?"@endfor":"@endforeach",H=1,O=B,L=w==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${w}\\s*\\(|end${w})`,"g");L.lastIndex=B;let F;while((F=L.exec(Z))!==null)if(F[1].startsWith(w))H++;else if(H--,H===0){O=F.index+F[0].length;break}if(H!==0)continue;let V=()=>{let M=[_.itemVar,_.indexVar].filter(Boolean);if(M.length)Q.push({start:q,end:O,vars:M})};if(_.iterable){let M=_.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M)){V();continue}let k=M.split(/[.[(]/)[0].trim(),N=$?k in $:!1,y=Q.some((I)=>q>I.start&&q<I.end&&I.vars.includes(k));if(k&&(N||y)){V();continue}}if(_.style==="as")z=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let A=Z.substring(B,O-j.length).trim(),R=A.match(nG),T;if(R){let[,M,k,N]=R;T=`<${M}${k} @for="${z}">${N}</${M}>`}else T=`<template @for="${z}">${A}</template>`;G.push({start:q,end:O,replacement:T})}for(let w=G.length-1;w>=0;w--){let{start:q,end:W,replacement:U}=G[w];Z=Z.substring(0,q)+U+Z.substring(W)}return Z}function nj(X){let $=new Set,Z=[],Y=0,J=0,G=X.length,Q=(U)=>{let K=Y+1;while(K<G){let z=X[K];if(z==="\\"){K+=2;continue}if(z===U)return K+1;K++}return G},w=()=>{let U=Y+2;while(U<G&&X[U]!==`
11519
+ `)U++;return U},q=()=>{let U=Y+2;while(U<G-1){if(X[U]==="*"&&X[U+1]==="/")return U+2;U++}return G},W=(U)=>{let K=U,z=0;while(K<G){let B=X[K];if(B==="/"&&X[K+1]==="/"){let _=K+2;while(_<G&&X[_]!==`
11520
+ `)_++;K=_;continue}if(B==="/"&&X[K+1]==="*"){let _=K+2;while(_<G-1&&!(X[_]==="*"&&X[_+1]==="/"))_++;K=_+2;continue}if(B==='"'||B==="'"||B==="`"){let _=K+1;while(_<G){if(X[_]==="\\"){_+=2;continue}if(X[_]===B){_++;break}_++}K=_;continue}if(B==="("||B==="["||B==="{"){z++,K++;continue}if(B===")"||B==="]"||B==="}"){z--,K++;continue}if(B===";"&&z===0)return K+1;K++}return G};while(Y<G){let U=X[Y];if(U==="/"&&X[Y+1]==="/"){let K=w();Z.push(X.slice(Y,K)),Y=K;continue}if(U==="/"&&X[Y+1]==="*"){let K=q();Z.push(X.slice(Y,K)),Y=K;continue}if(U==='"'||U==="'"||U==="`"){let K=Q(U);Z.push(X.slice(Y,K)),Y=K;continue}if(U==="{"){J++,Z.push(U),Y++;continue}if(U==="}"){J--,Z.push(U),Y++;continue}if(J===0){let K=Y>0?X[Y-1]:"";if(K===""||/\s/.test(K)||K===";"||K==="}"||K==="{"){let B=X.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let _=B[2],j=W(Y+B[0].length);if($.has(_)){Z.push(`/* stx: deduped const ${_} */`),Y=j;continue}$.add(_),Z.push(X.slice(Y,j)),Y=j;continue}}}Z.push(U),Y++}return Z.join("")}async function oG(X,$,Z){let Y=rG(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\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*\(/,G=[];for(let H of Y){let O=H.body;if(e1(H.attrs))O=X5(O);if(J.test(O))G.push({fullMatch:H.fullMatch,attrs:H.attrs,content:O})}if(G.length===0)return{output:X,setupCode:null};let Q=`__stx_setup_${Date.now()}_${gj++}`,{hasUserImports:w,bundleClientScript:q}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (k7(),N7))),W=[];for(let H=0;H<G.length;H++){let O=G[H].content;if(O=D5(O).code,w(O))O=await q(O,$||"",{projectRoot:process.cwd()});O=O.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,V)=>tG(V));let L=h0(O);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
11521
+ ${L}`)}let U=W.join(`
11522
+
11523
+ `);U=nj(U);let K=aG(U),z=K.split(",").map((H)=>H.trim()).filter(Boolean),B=TX(U,Z),_=`
11529
11524
  <script data-stx-scoped>
11530
11525
  function ${Q}() {
11531
- ${N5("const",z)}
11532
- ${k5(`${B}${K}`)}
11533
- return { ${U} };
11526
+ ${k5("const",z)}
11527
+ ${I5(`${B}${U}`)}
11528
+ return { ${K} };
11534
11529
  }
11535
11530
  window.__stx_latestSetup=${Q};
11536
11531
  if(window.stx)window.stx._latestSetup=${Q};
11537
- </script>`,j=X;for(let H of G)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(new RegExp(`<body(${bG})>`),`<body$1 data-stx="${Q}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],O=!1;j=j.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${bG})>`,"gi"),(L,F,V)=>{if(O||H.includes(F.toLowerCase()))return L;return O=!0,`<${F}${V} data-stx="${Q}">`})}return{output:j,setupCode:_}}function uG(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,w="",q=()=>{G++;let _=!1;while(G<Q){let j=$[G];if(j==="\\"){G+=2;continue}if(j==="["&&!_){_=!0,G++;continue}if(j==="]"&&_){_=!1,G++;continue}if(j==="/"&&!_){G++;while(G<Q&&/[gimsuyd]/.test($[G]))G++;return}if(j===`
11538
- `)return;G++}},W=()=>{if(!w)return!0;if(/[\w)\]]/.test(w))return!1;return!0},K=(_)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===_){G++;return}G++}},U=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let _=1;while(G<Q&&_>0)if($[G]==="{")_++,G++;else if($[G]==="}")_--,G++;else if($[G]==="'"||$[G]==='"')K($[G]);else if($[G]==="`")U();else G++;continue}G++}},z=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
11539
- `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},B=()=>{if(J!==0)return;let _=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(_){let F=_[2];if(!Y.has(F))Z.push(F),Y.add(F);return}let j=$.slice(G).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(j){j[1].split(",").forEach((F)=>{let V=F.trim();if(!V)return;let A=V.indexOf(":"),T=(A>=0?V.slice(A+1).trim():V).split(/[\s=]/)[0];if(T&&!Y.has(T))Z.push(T),Y.add(T)});return}let H=$.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((F)=>{let V=F.trim().replace(/^\.\.\./,"");if(!V)return;let A=V.split(/[\s=]/)[0];if(A&&!Y.has(A))Z.push(A),Y.add(A)});return}let O=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!Y.has(F))Z.push(F),Y.add(F);return}let L=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!Y.has(F))Z.push(F),Y.add(F)}};while(G<Q){if(z())continue;if($[G]==="'"||$[G]==='"'){K($[G]),w=$[G-1];continue}if($[G]==="`"){U(),w="`";continue}if($[G]==="/"&&$[G+1]!=="/"&&$[G+1]!=="*"&&W()){q(),w="/";continue}if($[G]==="{"){J++,w="{",G++;continue}if($[G]==="}"){J--,w="}",G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))B();if(!/\s/.test($[G]))w=$[G];G++}return Z.join(", ")}async function n3(X,$,Z,Y){if(!E8(X))return X;let J=X;if($.skipSignalsRuntime)return J;let{output:G,setupCode:Q}=await hG(J,Z,Y);if(J=G,J=await M8(J,$),Q){let K=I8(J,/<\/head>/i),U=K===-1?I8(J,/<body[^>]*>/i):-1;if(K!==-1)J=`${J.slice(0,K)}${Q}
11540
- ${J.slice(K)}`;else if(U!==-1){let z=/<body[^>]*>/i.exec(J.slice(U))[0],B=U+z.length;J=`${J.slice(0,B)}
11532
+ </script>`,j=X;for(let H of G)j=j.split(H.fullMatch).join("");if(j.includes("<body"))j=j.replace(new RegExp(`<body(${mG})>`),`<body$1 data-stx="${Q}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],O=!1;j=j.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${mG})>`,"gi"),(L,F,V)=>{if(O||H.includes(F.toLowerCase()))return L;return O=!0,`<${F}${V} data-stx="${Q}">`})}return{output:j,setupCode:_}}function aG(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,w="",q=()=>{G++;let _=!1;while(G<Q){let j=$[G];if(j==="\\"){G+=2;continue}if(j==="["&&!_){_=!0,G++;continue}if(j==="]"&&_){_=!1,G++;continue}if(j==="/"&&!_){G++;while(G<Q&&/[gimsuyd]/.test($[G]))G++;return}if(j===`
11533
+ `)return;G++}},W=()=>{if(!w)return!0;if(/[\w)\]]/.test(w))return!1;return!0},U=(_)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===_){G++;return}G++}},K=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let _=1;while(G<Q&&_>0)if($[G]==="{")_++,G++;else if($[G]==="}")_--,G++;else if($[G]==="'"||$[G]==='"')U($[G]);else if($[G]==="`")K();else G++;continue}G++}},z=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
11534
+ `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},B=()=>{if(J!==0)return;let _=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(_){let F=_[2];if(!Y.has(F))Z.push(F),Y.add(F);return}let j=$.slice(G).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(j){j[1].split(",").forEach((F)=>{let V=F.trim();if(!V)return;let A=V.indexOf(":"),T=(A>=0?V.slice(A+1).trim():V).split(/[\s=]/)[0];if(T&&!Y.has(T))Z.push(T),Y.add(T)});return}let H=$.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((F)=>{let V=F.trim().replace(/^\.\.\./,"");if(!V)return;let A=V.split(/[\s=]/)[0];if(A&&!Y.has(A))Z.push(A),Y.add(A)});return}let O=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!Y.has(F))Z.push(F),Y.add(F);return}let L=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!Y.has(F))Z.push(F),Y.add(F)}};while(G<Q){if(z())continue;if($[G]==="'"||$[G]==='"'){U($[G]),w=$[G-1];continue}if($[G]==="`"){K(),w="`";continue}if($[G]==="/"&&$[G+1]!=="/"&&$[G+1]!=="*"&&W()){q(),w="/";continue}if($[G]==="{"){J++,w="{",G++;continue}if($[G]==="}"){J--,w="}",G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))B();if(!/\s/.test($[G]))w=$[G];G++}return Z.join(", ")}async function X4(X,$,Z,Y){if(!E8(X))return X;let J=X;if($.skipSignalsRuntime)return J;let{output:G,setupCode:Q}=await oG(J,Z,Y);if(J=G,J=await M8(J,$),Q){let U=I8(J,/<\/head>/i),K=U===-1?I8(J,/<body[^>]*>/i):-1;if(U!==-1)J=`${J.slice(0,U)}${Q}
11535
+ ${J.slice(U)}`;else if(K!==-1){let z=/<body[^>]*>/i.exec(J.slice(K))[0],B=K+z.length;J=`${J.slice(0,B)}
11541
11536
  ${Q}${J.slice(B)}`}else J=`${J}
11542
- ${Q}`}let q=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!Q&&!W&&q&&!/data-stx-auto/.test(q[1])){let K=/<body[^>]*>/i,U=I8(J,K);if(U!==-1){let z=J.slice(0,U),B=J.slice(U).replace(K,(_)=>_.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=z+B}}return J}function I8(X,$){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec(X))!==null)Y.push([J.index,J.index+J[0].length]);let G=new RegExp($.source,$.flags.replace(/[gy]/g,"")),Q=0;while(Q<X.length){let w=G.exec(X.slice(Q));if(!w)return-1;let q=Q+w.index;if(!Y.some(([K,U])=>q>=K&&q<U))return q;Q=q+Math.max(w[0].length,1)}return-1}function dG(X){let $=[];for(let Z of X.split(",")){let Y=Z.trim();if(!Y||Y.startsWith("type "))continue;let J=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])$.push(`${J[2]} = ${J[1]}`)}if($.length===0)return vG;return`var ${$.join(", ")}; ${vG}`}var Ij=0,bG=`(?:"[^"]*"|'[^']*'|[^>"'])*`,xG,CG,l3,Pj,vG="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var s7=D(()=>{D5();uX();G1();l$();T0();N8();$5();F7();xG=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;CG=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);l3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Pj=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import s5 from"path";function mG(X){return X.startsWith("http://")||X.startsWith("https://")||X.startsWith("//")}async function lG(X,$,Z){try{let Y;if(X.startsWith("/")){let J=$;for(let G=0;G<5;G++){let Q=s5.join(J,X);if(await Bun.file(Q).exists())return Q;J=s5.dirname(J)}Y=s5.join($,X)}else if(X.startsWith("./")||X.startsWith("../"))Y=s5.resolve($,X);else Y=s5.resolve($,X);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function cG(X,$,Z){let Y=X,J=s5.dirname($),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(Y))!==null){let[W,K,U,z]=Q;if(mG(U))continue;let B=await lG(U,J,$);if(B)try{let _=await Bun.file(B).text();if(Z.add(B),U.endsWith(".ts")||U.endsWith(".tsx")){let H=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:C0()});if(H.outputs.length>0)_=await H.outputs[0].text()}let j=`<script>
11543
- // Source: ${U}
11537
+ ${Q}`}let q=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!Q&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,K=I8(J,U);if(K!==-1){let z=J.slice(0,K),B=J.slice(K).replace(U,(_)=>_.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=z+B}}return J}function I8(X,$){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec(X))!==null)Y.push([J.index,J.index+J[0].length]);let G=new RegExp($.source,$.flags.replace(/[gy]/g,"")),Q=0;while(Q<X.length){let w=G.exec(X.slice(Q));if(!w)return-1;let q=Q+w.index;if(!Y.some(([U,K])=>q>=U&&q<K))return q;Q=q+Math.max(w[0].length,1)}return-1}function tG(X){let $=[];for(let Z of X.split(",")){let Y=Z.trim();if(!Y||Y.startsWith("type "))continue;let J=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])$.push(`${J[2]} = ${J[1]}`)}if($.length===0)return iG;return`var ${$.join(", ")}; ${iG}`}var gj=0,mG=`(?:"[^"]*"|'[^']*'|[^>"'])*`,nG,cG,o3,pj,iG="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var o7=D(()=>{y5();dX();J1();l$();T0();N8();$5();V7();nG=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;cG=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);o3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);pj=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import o5 from"path";function eG(X){return X.startsWith("http://")||X.startsWith("https://")||X.startsWith("//")}async function XQ(X,$,Z){try{let Y;if(X.startsWith("/")){let J=$;for(let G=0;G<5;G++){let Q=o5.join(J,X);if(await Bun.file(Q).exists())return Q;J=o5.dirname(J)}Y=o5.join($,X)}else if(X.startsWith("./")||X.startsWith("../"))Y=o5.resolve($,X);else Y=o5.resolve($,X);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function $Q(X,$,Z){let Y=X,J=o5.dirname($),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(Y))!==null){let[W,U,K,z]=Q;if(eG(K))continue;let B=await XQ(K,J,$);if(B)try{let _=await Bun.file(B).text();if(Z.add(B),K.endsWith(".ts")||K.endsWith(".tsx")){let H=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:C0()});if(H.outputs.length>0)_=await H.outputs[0].text()}let j=`<script>
11538
+ // Source: ${K}
11544
11539
  ${_}
11545
- </script>`;Y=Y.replace(W,j),G.lastIndex=0}catch(_){}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=w.exec(Y))!==null){let[W,K,U,z]=q,B=K+z;if(mG(U))continue;if(/rel=["']stylesheet["']/.test(B)||U.endsWith(".css")){let j=await lG(U,J,$);if(j)try{let H=await Bun.file(j).text();Z.add(j);let O=`<style>
11546
- /* Source: ${U} */
11540
+ </script>`;Y=Y.replace(W,j),G.lastIndex=0}catch(_){}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=w.exec(Y))!==null){let[W,U,K,z]=q,B=U+z;if(eG(K))continue;if(/rel=["']stylesheet["']/.test(B)||K.endsWith(".css")){let j=await XQ(K,J,$);if(j)try{let H=await Bun.file(j).text();Z.add(j);let O=`<style>
11541
+ /* Source: ${K} */
11547
11542
  ${H}
11548
- </style>`;Y=Y.replace(W,O),w.lastIndex=0}catch(H){}}}return Y}var pG=D(()=>{E1()});function r3(X,$){let Z=X,Y=/@json\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index,Q=G+J[0].length-1,w=1,q=Q+1,W=null,K=!1;while(q<Z.length&&w>0){let F=Z[q];if(K){K=!1,q++;continue}if(F==="\\"&&W){K=!0,q++;continue}if(W){if(F===W)W=null;q++;continue}if(F==='"'||F==="'"||F==="`"){W=F,q++;continue}if(F==="(")w++;else if(F===")"){if(w--,w===0)break}q++}if(w!==0)break;let U=Z.substring(Q+1,q).trim(),z=Z.substring(G,q+1),B=-1,_=0,j=null,H=!1;for(let F=0;F<U.length;F++){let V=U[F];if(H){H=!1;continue}if(V==="\\"&&j){H=!0;continue}if(j){if(V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V;continue}if(V==="("||V==="["||V==="{")_++;else if(V===")"||V==="]"||V==="}")_--;if(V===","&&_===0){B=F;break}}let O=B>=0?U.substring(0,B).trim():U,L=B>=0?U.substring(B+1).trim():void 0;try{let F=O.trim(),V;if(q0(F))V=W0(F,Object.keys($))(...Object.values($));else V=void 0;let A;if(L==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(q+1),Y.lastIndex=G+R.length}catch(F){$1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),Y.lastIndex=G+z.length}}return Z}function s3(X){return X.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function iG(X){let $=X,Z=/@memo\s*\(/g,Y,J=[];while((Y=Z.exec($))!==null){let G=Y.index,Q=G+Y[0].length,w=1,q=Q;while(q<$.length&&w>0){if($[q]==="(")w++;else if($[q]===")")w--;q++}if(w!==0)continue;let W=$.slice(Q,q-1).trim(),K=q,U=$.slice(K),z=U.indexOf("@endmemo");if(z===-1)continue;let B=U.slice(0,z),_=K+z+8,j=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=j?j[0].length:0,O=B.slice(H),L=B.match(/(\s*)$/),F=L?L[0].length:0,V=O.slice(0,O.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[T,M,k="",N]=A,y=`<${M}${k} data-stx-memo="${W}"${N}>`;R=B.slice(0,H)+y+V.slice(T.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${W}">${V}</div>${B.slice(H+V.length)}`;J.push({start:G,end:_,replacement:R}),Z.lastIndex=_}for(let G=J.length-1;G>=0;G--){let Q=J[G];$=$.slice(0,Q.start)+Q.replacement+$.slice(Q.end)}return $.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function o3(X){let $=X.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),$}function nG(X){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index,w=Q+G[0].length,q=!1,W=!1,K=-1;while(w<X.length){let j=X[w];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){K=w;break}w++}if(K===-1)continue;if(X.slice(Q,K+1).includes("x-cloak"))continue;let z=X.slice(K+1),B=z.indexOf("</"),_=B>=0?z.slice(0,B):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(_))Y+=X.slice(J,K)+" x-cloak>",J=K+1}return Y+=X.slice(J),Y}function rG(X){let $=/<[a-z][\w-]*/gi,Z="",Y=0,J;while((J=$.exec(X))!==null){let G=J.index,Q=J[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let _=`</${Q}>`,j=X.toLowerCase().indexOf(_,G);if(j!==-1)$.lastIndex=j+_.length;continue}let w=G+J[0].length,q=!1,W=!1,K=-1;while(w<X.length){let _=X[w];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){K=w;break}w++}if(K===-1)continue;let U=X.slice(G+J[0].length,K);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!fj.test(U))continue;let z=X[K-1]==="/",B=z?K-1:K;Z+=`${X.slice(Y,B)} x-cloak${z?" ":""}`,Y=B}return Z+=X.slice(Y),Z}var fj;var a3=D(()=>{F1();F0();fj=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function t3(X,$,Z,Y){let J=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=J.allowPatterns??[],Q=[];for(let{pattern:w,message:q,suggestion:W}of gj){if(G.some((U)=>/\w/.test(U)&&q.includes(U)))continue;w.lastIndex=0;let K=X.match(w);if(K&&K.length>0){let U=X.split(`
11549
- `),z=[];U.forEach((H,O)=>{if(w.lastIndex=0,w.test(H))z.push(O+1)});let B=z.length>0?` (script line${z.length>1?"s":""} ${z.join(", ")})`:"",_=z.slice(0,3).map((H)=>` ${H} | ${(U[H-1]??"").trim().slice(0,100)}`).join(`
11543
+ </style>`;Y=Y.replace(W,O),w.lastIndex=0}catch(H){}}}return Y}var ZQ=D(()=>{E1()});function $4(X,$){let Z=X,Y=/@json\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index,Q=G+J[0].length-1,w=1,q=Q+1,W=null,U=!1;while(q<Z.length&&w>0){let F=Z[q];if(U){U=!1,q++;continue}if(F==="\\"&&W){U=!0,q++;continue}if(W){if(F===W)W=null;q++;continue}if(F==='"'||F==="'"||F==="`"){W=F,q++;continue}if(F==="(")w++;else if(F===")"){if(w--,w===0)break}q++}if(w!==0)break;let K=Z.substring(Q+1,q).trim(),z=Z.substring(G,q+1),B=-1,_=0,j=null,H=!1;for(let F=0;F<K.length;F++){let V=K[F];if(H){H=!1;continue}if(V==="\\"&&j){H=!0;continue}if(j){if(V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V;continue}if(V==="("||V==="["||V==="{")_++;else if(V===")"||V==="]"||V==="}")_--;if(V===","&&_===0){B=F;break}}let O=B>=0?K.substring(0,B).trim():K,L=B>=0?K.substring(B+1).trim():void 0;try{let F=O.trim(),V;if(q0(F))V=W0(F,Object.keys($))(...Object.values($));else V=void 0;let A;if(L==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(q+1),Y.lastIndex=G+R.length}catch(F){X1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),Y.lastIndex=G+z.length}}return Z}function Z4(X){return X.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function YQ(X){let $=X,Z=/@memo\s*\(/g,Y,J=[];while((Y=Z.exec($))!==null){let G=Y.index,Q=G+Y[0].length,w=1,q=Q;while(q<$.length&&w>0){if($[q]==="(")w++;else if($[q]===")")w--;q++}if(w!==0)continue;let W=$.slice(Q,q-1).trim(),U=q,K=$.slice(U),z=K.indexOf("@endmemo");if(z===-1)continue;let B=K.slice(0,z),_=U+z+8,j=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=j?j[0].length:0,O=B.slice(H),L=B.match(/(\s*)$/),F=L?L[0].length:0,V=O.slice(0,O.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[T,M,k="",N]=A,y=`<${M}${k} data-stx-memo="${W}"${N}>`;R=B.slice(0,H)+y+V.slice(T.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${W}">${V}</div>${B.slice(H+V.length)}`;J.push({start:G,end:_,replacement:R}),Z.lastIndex=_}for(let G=J.length-1;G>=0;G--){let Q=J[G];$=$.slice(0,Q.start)+Q.replacement+$.slice(Q.end)}return $.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function Y4(X){let $=X.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),$}function JQ(X){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index,w=Q+G[0].length,q=!1,W=!1,U=-1;while(w<X.length){let j=X[w];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){U=w;break}w++}if(U===-1)continue;if(X.slice(Q,U+1).includes("x-cloak"))continue;let z=X.slice(U+1),B=z.indexOf("</"),_=B>=0?z.slice(0,B):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(_))Y+=X.slice(J,U)+" x-cloak>",J=U+1}return Y+=X.slice(J),Y}function GQ(X){let $=/<[a-z][\w-]*/gi,Z="",Y=0,J;while((J=$.exec(X))!==null){let G=J.index,Q=J[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let _=`</${Q}>`,j=X.toLowerCase().indexOf(_,G);if(j!==-1)$.lastIndex=j+_.length;continue}let w=G+J[0].length,q=!1,W=!1,U=-1;while(w<X.length){let _=X[w];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){U=w;break}w++}if(U===-1)continue;let K=X.slice(G+J[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(K))continue;if(!rj.test(K))continue;let z=X[U-1]==="/",B=z?U-1:U;Z+=`${X.slice(Y,B)} x-cloak${z?" ":""}`,Y=B}return Z+=X.slice(Y),Z}var rj;var J4=D(()=>{O1();F0();rj=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function G4(X,$,Z,Y){let J=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=J.allowPatterns??[],Q=[];for(let{pattern:w,message:q,suggestion:W}of sj){if(G.some((K)=>/\w/.test(K)&&q.includes(K)))continue;w.lastIndex=0;let U=X.match(w);if(U&&U.length>0){let K=X.split(`
11544
+ `),z=[];K.forEach((H,O)=>{if(w.lastIndex=0,w.test(H))z.push(O+1)});let B=z.length>0?` (script line${z.length>1?"s":""} ${z.join(", ")})`:"",_=z.slice(0,3).map((H)=>` ${H} | ${(K[H-1]??"").trim().slice(0,100)}`).join(`
11550
11545
  `),j=_?`
11551
11546
  ${_}`:"";Q.push(` \u2717 ${q}${B}
11552
- \u2192 ${W}${j}`)}}if(Q.length>0&&J.enabled){let w=(K)=>{let U=`${process.cwd()}/`;return K.startsWith(U)?K.slice(U.length):K},W=`[STX] DOM API violation in ${Y&&Y!==$?`${w(Y)} (composed into ${w($)})`:w($)}:
11547
+ \u2192 ${W}${j}`)}}if(Q.length>0&&J.enabled){let w=(U)=>{let K=`${process.cwd()}/`;return U.startsWith(K)?U.slice(K.length):U},W=`[STX] DOM API violation in ${Y&&Y!==$?`${w(Y)} (composed into ${w($)})`:w($)}:
11553
11548
  ${Q.join(`
11554
11549
  `)}
11555
- Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(W);else console.warn(W)}}var gj;var e3=D(()=>{gj=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import hj from"fs";function y8(X){return[...X].sort().map(($)=>{try{let Z=hj.statSync($);return`${$}:${Z.size}:${Z.mtimeMs}`}catch{return`${$}:missing`}}).join(`
11556
- `)}function b8(X,$,Z){let Y=X.get($);return Y!==void 0&&Y.signature===Z?Y.value:void 0}function K1(X,$,Z,Y){return X.set($,{signature:Z,value:Y}),Y}var X4=()=>{};var sG={};t(sG,{getStoreScript:()=>dj,clearStoreCache:()=>mj});import S8 from"path";function uj(X,$){for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let Y of(Z[1]??"").split(",")){let G=((Y.includes(":")?Y.split(":").pop():Y)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))$.add(G)}for(let Z of X.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let Y of(Z[1]??"").split(",")){let J=Y.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))$.add(J)}}async function dj(X){let $;if(X)$=S8.resolve(X);else{let _=await u1();$=S8.resolve(_.root||process.cwd(),_.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),Y=[];try{for await(let _ of Z.scan({cwd:$,absolute:!0})){let j=S8.basename(_,".ts");if(["index","types"].includes(j))continue;if(_.includes(".d.ts"))continue;Y.push(_)}}catch{return K1(o5,$,"",""),null}let J=y8(Y),G=b8(o5,$,J);if(G!==void 0)return G||null;if(Y.length===0)return K1(o5,$,J,""),null;let Q=[];for(let _ of Y){let j=await Bun.file(_).text();Q.push({file:_,hasUseStore:/useStore\s*\(/.test(j)})}Q.sort((_,j)=>{if(_.hasUseStore===j.hasUseStore)return 0;return _.hasUseStore?1:-1});let w=Q.map((_)=>_.file),q=[],W=new Set,K=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()});for(let _ of w)try{let j=await Bun.file(_).text(),H=S8.basename(_,".ts");uj(j,W),j=h0(j),j=LX(j),j=j.replace(/^export\s+(default\s+)?/gm,""),j=K.transformSync(j),q.push(`// Store: ${H}
11557
- ${j.trim()}`)}catch(j){console.warn(`[stx] Failed to load store ${_}:`,j)}if(q.length===0)return K1(o5,$,J,""),null;let U=q.join(`
11550
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(W);else console.warn(W)}}var sj;var Q4=D(()=>{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:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import oj from"fs";function y8(X){return[...X].sort().map(($)=>{try{let Z=oj.statSync($);return`${$}:${Z.size}:${Z.mtimeMs}`}catch{return`${$}:missing`}}).join(`
11551
+ `)}function b8(X,$,Z){let Y=X.get($);return Y!==void 0&&Y.signature===Z?Y.value:void 0}function W1(X,$,Z,Y){return X.set($,{signature:Z,value:Y}),Y}var w4=()=>{};var QQ={};t(QQ,{getStoreScript:()=>tj,clearStoreCache:()=>ej});import S8 from"path";function aj(X,$){for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let Y of(Z[1]??"").split(",")){let G=((Y.includes(":")?Y.split(":").pop():Y)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))$.add(G)}for(let Z of X.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let Y of(Z[1]??"").split(",")){let J=Y.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))$.add(J)}}async function tj(X){let $;if(X)$=S8.resolve(X);else{let _=await u1();$=S8.resolve(_.root||process.cwd(),_.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),Y=[];try{for await(let _ of Z.scan({cwd:$,absolute:!0})){let j=S8.basename(_,".ts");if(["index","types"].includes(j))continue;if(_.includes(".d.ts"))continue;Y.push(_)}}catch{return W1(a5,$,"",""),null}let J=y8(Y),G=b8(a5,$,J);if(G!==void 0)return G||null;if(Y.length===0)return W1(a5,$,J,""),null;let Q=[];for(let _ of Y){let j=await Bun.file(_).text();Q.push({file:_,hasUseStore:/useStore\s*\(/.test(j)})}Q.sort((_,j)=>{if(_.hasUseStore===j.hasUseStore)return 0;return _.hasUseStore?1:-1});let w=Q.map((_)=>_.file),q=[],W=new Set,U=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()});for(let _ of w)try{let j=await Bun.file(_).text(),H=S8.basename(_,".ts");aj(j,W),j=h0(j),j=OX(j),j=j.replace(/^export\s+(default\s+)?/gm,""),j=U.transformSync(j),q.push(`// Store: ${H}
11552
+ ${j.trim()}`)}catch(j){console.warn(`[stx] Failed to load store ${_}:`,j)}if(q.length===0)return W1(a5,$,J,""),null;let K=q.join(`
11558
11553
 
11559
11554
  `),B=`;(function(){
11560
11555
  var __stx = window.stx || {};
11561
- ${j1.filter((_)=>!W.has(_)&&new RegExp(`\\b${_}\\b`).test(U)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
11556
+ ${B1.filter((_)=>!W.has(_)&&new RegExp(`\\b${_}\\b`).test(K)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
11562
11557
  `)}
11563
- ${U}
11564
- })();`;return K1(o5,$,J,B),B}function mj(){o5.clear()}var o5;var oG=D(()=>{H1();E1();G1();X4();o5=new Map});var $4,fk;var aG=D(()=>{$4=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],fk=new Set($4)});var XQ={};t(XQ,{selectComposableFiles:()=>tG,referencedFrameworkComposables:()=>eG,getFrameworkComposableScript:()=>ij,clearFrameworkComposableCache:()=>cj,__setRuntimeOwnedForTest:()=>nj});import C8 from"path";function cj(){o7.clear()}function tG(X){let $=new Map;for(let Z of X){let Y=C8.basename(Z);if(Y.endsWith(".d.ts"))continue;let J=Y.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===Y)continue;let G=$.get(J);if(G&&!G.endsWith(".js"))continue;$.set(J,Z)}return[...$.values()].sort()}function pj(X,$){let Z=$.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test(X)}function eG(X){if(!X)return[];let $=X.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Z=[];for(let Y of lj){if(Z4.has(Y))continue;let J=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test($))Z.push(Y)}return Z.sort()}async function ij(X,$){let Z=eG(X);if(Z.length===0)return null;let Y=$??C8.join(import.meta.dir,"composables"),J=`${Y}\x00${Z.join(",")}`,G=o7.get(J);if(G!==void 0)return G||null;let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}),w=new Set(Z),q=[],W=new Set,K=[];try{let _=new Bun.Glob("*.{ts,js}");for await(let j of _.scan({cwd:Y,absolute:!0}))K.push(j)}catch{return o7.set(J,""),null}K=tG(K);for(let _ of K){let j;try{j=await Bun.file(_).text()}catch{continue}let H=[];try{H=Q.scan(j).exports.filter((O)=>O!=="default")}catch{continue}if(!H.some((O)=>w.has(O)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${C8.basename(_).replace(/\.[jt]s$/,"")}
11565
- ${Q.transformSync(j).trim()}`);for(let O of H)W.add(O)}catch(O){console.warn(`[stx] framework composable ${C8.basename(_)} could not be bundled:`,O)}}let U=Z.filter((_)=>!W.has(_)&&!pj(X,_));if(U.length>0)console.warn(`[stx] could not bundle ${U.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(q.length===0)return o7.set(J,""),null;let z=[...W].map((_)=>` try { if (!(${JSON.stringify(_)} in __s)) { __s[${JSON.stringify(_)}] = ${_}; if (!(${JSON.stringify(_)} in window)) window[${JSON.stringify(_)}] = ${_}; } } catch (e) {}`).join(`
11558
+ ${K}
11559
+ })();`;return W1(a5,$,J,B),B}function ej(){a5.clear()}var a5;var wQ=D(()=>{j1();E1();J1();w4();a5=new Map});var q4,$I;var qQ=D(()=>{q4=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],$I=new Set(q4)});var KQ={};t(KQ,{selectComposableFiles:()=>WQ,referencedFrameworkComposables:()=>UQ,getFrameworkComposableScript:()=>YH,clearFrameworkComposableCache:()=>$H,__setRuntimeOwnedForTest:()=>JH});import C8 from"path";function $H(){a7.clear()}function WQ(X){let $=new Map;for(let Z of X){let Y=C8.basename(Z);if(Y.endsWith(".d.ts"))continue;let J=Y.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===Y)continue;let G=$.get(J);if(G&&!G.endsWith(".js"))continue;$.set(J,Z)}return[...$.values()].sort()}function ZH(X,$){let Z=$.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test(X)}function UQ(X){if(!X)return[];let $=X.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Z=[];for(let Y of XH){if(W4.has(Y))continue;let J=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test($))Z.push(Y)}return Z.sort()}async function YH(X,$){let Z=UQ(X);if(Z.length===0)return null;let Y=$??C8.join(import.meta.dir,"composables"),J=`${Y}\x00${Z.join(",")}`,G=a7.get(J);if(G!==void 0)return G||null;let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}),w=new Set(Z),q=[],W=new Set,U=[];try{let _=new Bun.Glob("*.{ts,js}");for await(let j of _.scan({cwd:Y,absolute:!0}))U.push(j)}catch{return a7.set(J,""),null}U=WQ(U);for(let _ of U){let j;try{j=await Bun.file(_).text()}catch{continue}let H=[];try{H=Q.scan(j).exports.filter((O)=>O!=="default")}catch{continue}if(!H.some((O)=>w.has(O)))continue;try{j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^import\s+type\s+.*$/gm,""),j=j.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),j=j.replace(/^export\s+default\s+/gm,""),j=j.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${C8.basename(_).replace(/\.[jt]s$/,"")}
11560
+ ${Q.transformSync(j).trim()}`);for(let O of H)W.add(O)}catch(O){console.warn(`[stx] framework composable ${C8.basename(_)} could not be bundled:`,O)}}let K=Z.filter((_)=>!W.has(_)&&!ZH(X,_));if(K.length>0)console.warn(`[stx] could not bundle ${K.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(q.length===0)return a7.set(J,""),null;let z=[...W].map((_)=>` try { if (!(${JSON.stringify(_)} in __s)) { __s[${JSON.stringify(_)}] = ${_}; if (!(${JSON.stringify(_)} in window)) window[${JSON.stringify(_)}] = ${_}; } } catch (e) {}`).join(`
11566
11561
  `),B=`<script data-stx-framework-composables>
11567
11562
  ;(function(){
11568
11563
  var __s = window.stx = window.stx || {};
@@ -11571,19 +11566,19 @@ ${q.join(`
11571
11566
  `)}
11572
11567
  ${z}
11573
11568
  })();
11574
- </script>`;return o7.set(J,B),B}function nj(X){Z4.clear();for(let $ of X)Z4.add($)}var o7,Z4,lj;var $Q=D(()=>{E1();aG();o7=new Map,Z4=new Set,lj=new Set($4)});var YQ={};t(YQ,{getComposableScript:()=>aj,clearComposableCache:()=>tj});import a7 from"path";function ZQ(X){let $=a7.basename(X,".ts");return $==="index"||$==="types"||X.endsWith(".d.ts")}async function sj(X){if(X)return a7.resolve(X);let $=`<default>:${process.cwd()}`,Z=Y4.get($);if(Z!==void 0)return Z;let Y=await oj();if(Y!==null)Y4.set($,Y);return Y}async function oj(){let X=await u1(),$=X.root||process.cwd(),Z=X.composablesDir;if(Z)return a7.resolve($,Z);for(let Y of rj){let J=a7.resolve($,Y);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:J,absolute:!0}))if(!ZQ(Q))return J}catch{}}return null}async function aj(X){let $=await sj(X);if(!$)return null;let Z=[];try{let _=new Bun.Glob("**/*.ts");for await(let j of _.scan({cwd:$,absolute:!0})){if(ZQ(j))continue;Z.push(j)}}catch{return K1(a5,$,"",""),null}let Y=y8(Z),J=b8(a5,$,Y);if(J!==void 0)return J||null;if(Z.length===0)return K1(a5,$,Y,""),null;Z.sort();let G=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}),Q=[],w=new Set,q=new Set;for(let _ of Z)try{let j=await Bun.file(_).text(),H=a7.basename(_,".ts");for(let O of j.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(O[1])q.add(O[1]);try{for(let O of G.scan(j).exports)if(O!=="default")w.add(O)}catch{}j=h0(j),j=LX(j),j=j.replace(/^export\s+(default\s+)?/gm,""),j=G.transformSync(j),Q.push(`// Composable: ${H}
11575
- ${j.trim()}`)}catch(j){console.warn(`[stx] Failed to load composable ${_}:`,j)}if(Q.length===0||w.size===0)return K1(a5,$,Y,""),null;let W=[...w].map((_)=>` try { __c[${JSON.stringify(_)}] = ${_}; } catch (e) {}`).join(`
11576
- `),K=JSON.stringify([...w]),U=Q.join(`
11569
+ </script>`;return a7.set(J,B),B}function JH(X){W4.clear();for(let $ of X)W4.add($)}var a7,W4,XH;var zQ=D(()=>{E1();qQ();a7=new Map,W4=new Set,XH=new Set(q4)});var BQ={};t(BQ,{getComposableScript:()=>qH,clearComposableCache:()=>WH});import t7 from"path";function _Q(X){let $=t7.basename(X,".ts");return $==="index"||$==="types"||X.endsWith(".d.ts")}async function QH(X){if(X)return t7.resolve(X);let $=`<default>:${process.cwd()}`,Z=U4.get($);if(Z!==void 0)return Z;let Y=await wH();if(Y!==null)U4.set($,Y);return Y}async function wH(){let X=await u1(),$=X.root||process.cwd(),Z=X.composablesDir;if(Z)return t7.resolve($,Z);for(let Y of GH){let J=t7.resolve($,Y);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:J,absolute:!0}))if(!_Q(Q))return J}catch{}}return null}async function qH(X){let $=await QH(X);if(!$)return null;let Z=[];try{let _=new Bun.Glob("**/*.ts");for await(let j of _.scan({cwd:$,absolute:!0})){if(_Q(j))continue;Z.push(j)}}catch{return W1(t5,$,"",""),null}let Y=y8(Z),J=b8(t5,$,Y);if(J!==void 0)return J||null;if(Z.length===0)return W1(t5,$,Y,""),null;Z.sort();let G=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}),Q=[],w=new Set,q=new Set;for(let _ of Z)try{let j=await Bun.file(_).text(),H=t7.basename(_,".ts");for(let O of j.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(O[1])q.add(O[1]);try{for(let O of G.scan(j).exports)if(O!=="default")w.add(O)}catch{}j=h0(j),j=OX(j),j=j.replace(/^export\s+(default\s+)?/gm,""),j=G.transformSync(j),Q.push(`// Composable: ${H}
11570
+ ${j.trim()}`)}catch(j){console.warn(`[stx] Failed to load composable ${_}:`,j)}if(Q.length===0||w.size===0)return W1(t5,$,Y,""),null;let W=[...w].map((_)=>` try { __c[${JSON.stringify(_)}] = ${_}; } catch (e) {}`).join(`
11571
+ `),U=JSON.stringify([...w]),K=Q.join(`
11577
11572
 
11578
11573
  `),B=`;(function(){
11579
11574
  window.__composables = window.__composables || {};
11580
11575
  var __c = window.__composables;
11581
11576
  var __stx = window.stx || {};
11582
- ${j1.filter((_)=>!q.has(_)&&new RegExp(`\\b${_}\\b`).test(U)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
11577
+ ${B1.filter((_)=>!q.has(_)&&new RegExp(`\\b${_}\\b`).test(K)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
11583
11578
  `)}
11584
- ${U}
11579
+ ${K}
11585
11580
  ${W}
11586
- var __names = ${K};
11581
+ var __names = ${U};
11587
11582
  for (var __i = 0; __i < __names.length; __i++) {
11588
11583
  var __n = __names[__i];
11589
11584
  if (!(__n in __c)) continue;
@@ -11596,7 +11591,7 @@ ${W}
11596
11591
  }
11597
11592
  window[__n] = __c[__n];
11598
11593
  }
11599
- })();`;return K1(a5,$,Y,B),B}function tj(){a5.clear(),Y4.clear()}var a5,Y4,rj;var JQ=D(()=>{H1();E1();X4();G1();a5=new Map,Y4=new Map,rj=["composables","functions"]});var QQ={};t(QQ,{processDeferDirectives:()=>YH});function ej(){return`stx-defer-${++GQ}`}function XH(X){let $=X.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function $H(X,$,Z){let{trigger:Y,value:J}=XH($),G=Z,Q,w,q,W=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)Q=W[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let K=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(K)w=K[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)q=U[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:Y,triggerValue:J,content:G,placeholder:Q,loading:w,error:q}}function ZH(X,$){let{trigger:Z,triggerValue:Y}=$,J;switch(Z){case"visible":J=`
11594
+ })();`;return W1(t5,$,Y,B),B}function WH(){t5.clear(),U4.clear()}var t5,U4,GH;var jQ=D(()=>{j1();E1();w4();J1();t5=new Map,U4=new Map,GH=["composables","functions"]});var LQ={};t(LQ,{processDeferDirectives:()=>BH});function UH(){return`stx-defer-${++HQ}`}function KH(X){let $=X.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function zH(X,$,Z){let{trigger:Y,value:J}=KH($),G=Z,Q,w,q,W=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)Q=W[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)w=U[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let K=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(K)q=K[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:Y,triggerValue:J,content:G,placeholder:Q,loading:w,error:q}}function _H(X,$){let{trigger:Z,triggerValue:Y}=$,J;switch(Z){case"visible":J=`
11600
11595
  const observer = new IntersectionObserver((entries) => {
11601
11596
  if (entries[0].isIntersecting) {
11602
11597
  observer.disconnect();
@@ -11669,15 +11664,15 @@ else {
11669
11664
  ${J}
11670
11665
  })();
11671
11666
  </script>
11672
- `}function YH(X,$,Z){GQ=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return X.replace(Y,(J,G,Q)=>{let w=ej(),q=$H(J,G,Q),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",K=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',U=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",z=`<div data-defer-content style="display: none;">${q.content}</div>`,B=ZH(w,q);return`
11667
+ `}function BH(X,$,Z){HQ=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return X.replace(Y,(J,G,Q)=>{let w=UH(),q=zH(J,G,Q),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",U=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',K=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",z=`<div data-defer-content style="display: none;">${q.content}</div>`,B=_H(w,q);return`
11673
11668
  <div id="${w}" class="stx-defer" data-defer-trigger="${q.trigger}">
11674
11669
  ${W}
11675
- ${K}
11676
- ${z}
11677
11670
  ${U}
11671
+ ${z}
11672
+ ${K}
11678
11673
  </div>
11679
11674
  ${B}
11680
- `})}var GQ=0;var qQ={};t(qQ,{processTeleportDirectives:()=>wH,ensureTeleportTargets:()=>qH});function JH(){return`stx-teleport-${++wQ}`}function GH(X){let $=X.split(",").map((J)=>J.trim()),Z=$[0].replace(/['"]/g,""),Y;for(let J=1;J<$.length;J++){let G=$[J].match(/disabled:\s*(.+)/);if(G)Y=G[1].trim()}return{target:Z,disabled:Y}}function QH(X,$){return`
11675
+ `})}var HQ=0;var FQ={};t(FQ,{processTeleportDirectives:()=>OH,ensureTeleportTargets:()=>FH});function jH(){return`stx-teleport-${++OQ}`}function HH(X){let $=X.split(",").map((J)=>J.trim()),Z=$[0].replace(/['"]/g,""),Y;for(let J=1;J<$.length;J++){let G=$[J].match(/disabled:\s*(.+)/);if(G)Y=G[1].trim()}return{target:Z,disabled:Y}}function LH(X,$){return`
11681
11676
  <script>
11682
11677
  (function() {
11683
11678
  const source = document.getElementById('${X}');
@@ -11723,12 +11718,12 @@ else {
11723
11718
  });
11724
11719
  })();
11725
11720
  </script>
11726
- `}function wH(X,$,Z){wQ=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return X.replace(Y,(J,G,Q)=>{let w=JH(),{target:q,disabled:W}=GH(G),K=Q.trim();if(W)try{let z=!1;if(W==="true")z=!0;else if(W==="false")z=!1;else if(W in $)z=Boolean($[W]);if(z)return`<div class="stx-teleport-inline" data-teleport-disabled>${K}</div>`}catch{}let U=QH(w,q);return`
11721
+ `}function OH(X,$,Z){OQ=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return X.replace(Y,(J,G,Q)=>{let w=jH(),{target:q,disabled:W}=HH(G),U=Q.trim();if(W)try{let z=!1;if(W==="true")z=!0;else if(W==="false")z=!1;else if(W in $)z=Boolean($[W]);if(z)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let K=LH(w,q);return`
11727
11722
  <div id="${w}" class="stx-teleport-source" style="display: none;">
11728
- <template>${K}</template>
11723
+ <template>${U}</template>
11729
11724
  </div>
11730
- ${U}
11731
- `})}function qH(){return`
11725
+ ${K}
11726
+ `})}function FH(){return`
11732
11727
  <script>
11733
11728
  (function() {
11734
11729
  // Common teleport targets
@@ -11745,11 +11740,11 @@ else {
11745
11740
  });
11746
11741
  })();
11747
11742
  </script>
11748
- `}var wQ=0;var zQ={};t(zQ,{processTransitionDirectives:()=>zH,processTransitionAttributes:()=>HH,performLeave:()=>UH,performEnter:()=>KH,generateTransitionRuntime:()=>jH,generateTransitionCSS:()=>BH});function WQ(X,$={}){return{enterFrom:$.enterClass||`${X}-enter-from`,enterActive:$.enterActiveClass||`${X}-enter-active`,enterTo:$.enterToClass||`${X}-enter-to`,leaveFrom:$.leaveClass||`${X}-leave-from`,leaveActive:$.leaveActiveClass||`${X}-leave-active`,leaveTo:$.leaveToClass||`${X}-leave-to`}}function WH(X){let $=getComputedStyle(X),Z=$.transitionDuration||"0s",Y=$.animationDuration||"0s",J=(G)=>{let Q=G.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let w=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?w:w*1000};return Math.max(J(Z),J(Y))}function KQ(X,$){return new Promise((Z)=>{let Y=$??WH(X);if(Y===0){Z();return}let J=!1,G=()=>{if(J)return;J=!0,X.removeEventListener("transitionend",Q),X.removeEventListener("animationend",Q),Z()},Q=(w)=>{if(w.target===X)G()};X.addEventListener("transitionend",Q),X.addEventListener("animationend",Q),setTimeout(G,Y+50)})}function UQ(X){X.offsetHeight}async function KH(X,$={}){let Z=$.name||"stx",Y=WQ(Z,$),J=typeof $.duration==="object"?$.duration.enter:$.duration;if($.onBeforeEnter?.(X),X.classList.add(Y.enterFrom),X.classList.add(Y.enterActive),UQ(X),X.classList.remove(Y.enterFrom),X.classList.add(Y.enterTo),$.onEnter)await new Promise((G)=>{$.onEnter(X,G)});else await KQ(X,J);X.classList.remove(Y.enterActive),X.classList.remove(Y.enterTo),$.onAfterEnter?.(X)}async function UH(X,$={}){let Z=$.name||"stx",Y=WQ(Z,$),J=typeof $.duration==="object"?$.duration.leave:$.duration;if($.onBeforeLeave?.(X),X.classList.add(Y.leaveFrom),X.classList.add(Y.leaveActive),UQ(X),X.classList.remove(Y.leaveFrom),X.classList.add(Y.leaveTo),$.onLeave)await new Promise((G)=>{$.onLeave(X,G)});else await KQ(X,J);X.classList.remove(Y.leaveActive),X.classList.remove(Y.leaveTo),$.onAfterLeave?.(X)}function zH(X,$={},Z){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return X.replace(Y,(J,G,Q)=>{let w=_H(G),q=w.name||"stx",W=w.duration||300,K=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
11743
+ `}var OQ=0;var TQ={};t(TQ,{processTransitionDirectives:()=>TH,processTransitionAttributes:()=>IH,performLeave:()=>RH,performEnter:()=>AH,generateTransitionRuntime:()=>kH,generateTransitionCSS:()=>NH});function VQ(X,$={}){return{enterFrom:$.enterClass||`${X}-enter-from`,enterActive:$.enterActiveClass||`${X}-enter-active`,enterTo:$.enterToClass||`${X}-enter-to`,leaveFrom:$.leaveClass||`${X}-leave-from`,leaveActive:$.leaveActiveClass||`${X}-leave-active`,leaveTo:$.leaveToClass||`${X}-leave-to`}}function VH(X){let $=getComputedStyle(X),Z=$.transitionDuration||"0s",Y=$.animationDuration||"0s",J=(G)=>{let Q=G.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let w=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?w:w*1000};return Math.max(J(Z),J(Y))}function AQ(X,$){return new Promise((Z)=>{let Y=$??VH(X);if(Y===0){Z();return}let J=!1,G=()=>{if(J)return;J=!0,X.removeEventListener("transitionend",Q),X.removeEventListener("animationend",Q),Z()},Q=(w)=>{if(w.target===X)G()};X.addEventListener("transitionend",Q),X.addEventListener("animationend",Q),setTimeout(G,Y+50)})}function RQ(X){X.offsetHeight}async function AH(X,$={}){let Z=$.name||"stx",Y=VQ(Z,$),J=typeof $.duration==="object"?$.duration.enter:$.duration;if($.onBeforeEnter?.(X),X.classList.add(Y.enterFrom),X.classList.add(Y.enterActive),RQ(X),X.classList.remove(Y.enterFrom),X.classList.add(Y.enterTo),$.onEnter)await new Promise((G)=>{$.onEnter(X,G)});else await AQ(X,J);X.classList.remove(Y.enterActive),X.classList.remove(Y.enterTo),$.onAfterEnter?.(X)}async function RH(X,$={}){let Z=$.name||"stx",Y=VQ(Z,$),J=typeof $.duration==="object"?$.duration.leave:$.duration;if($.onBeforeLeave?.(X),X.classList.add(Y.leaveFrom),X.classList.add(Y.leaveActive),RQ(X),X.classList.remove(Y.leaveFrom),X.classList.add(Y.leaveTo),$.onLeave)await new Promise((G)=>{$.onLeave(X,G)});else await AQ(X,J);X.classList.remove(Y.leaveActive),X.classList.remove(Y.leaveTo),$.onAfterLeave?.(X)}function TH(X,$={},Z){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return X.replace(Y,(J,G,Q)=>{let w=MH(G),q=w.name||"stx",W=w.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
11749
11744
  <div
11750
11745
  class="stx-transition-wrapper"
11751
11746
  data-transition="${q}"
11752
- data-transition-id="${K}"
11747
+ data-transition-id="${U}"
11753
11748
  data-transition-duration="${W}"
11754
11749
  ${w.mode?`data-transition-mode="${w.mode}"`:""}
11755
11750
  >
@@ -11757,7 +11752,7 @@ else {
11757
11752
  </div>
11758
11753
  <script>
11759
11754
  (function() {
11760
- const wrapper = document.querySelector('[data-transition-id="${K}"]');
11755
+ const wrapper = document.querySelector('[data-transition-id="${U}"]');
11761
11756
  if (!wrapper) return;
11762
11757
 
11763
11758
  const name = '${q}';
@@ -11787,7 +11782,7 @@ else {
11787
11782
  });
11788
11783
  })();
11789
11784
  </script>
11790
- `})}function _H(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4]||Y[5];switch(J){case"name":$.name=G;break;case"duration":$.duration=parseInt(G,10);break;case"mode":$.mode=G;break;case"easing":$.easing=G;break}}return $}function BH(){return`
11785
+ `})}function MH(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4]||Y[5];switch(J){case"name":$.name=G;break;case"duration":$.duration=parseInt(G,10);break;case"mode":$.mode=G;break;case"easing":$.easing=G;break}}return $}function NH(){return`
11791
11786
  /* STX Transition Presets */
11792
11787
 
11793
11788
  /* Fade */
@@ -11974,7 +11969,7 @@ else {
11974
11969
  opacity: 1;
11975
11970
  max-height: 1000px;
11976
11971
  }
11977
- `}function jH(){return`
11972
+ `}function kH(){return`
11978
11973
  // STX Transition Runtime
11979
11974
  (function() {
11980
11975
  if (typeof window === 'undefined') return;
@@ -12063,7 +12058,7 @@ else {
12063
12058
 
12064
12059
  console.log('[stx] Transition runtime initialized');
12065
12060
  })();
12066
- `}function HH(X){let $=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return X.replace($,(Z,Y,J,G)=>{let Q=J||"300",w=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${w}"`})}var BQ={};t(BQ,{withErrorBoundary:()=>_Q,processErrorBoundaryDirectives:()=>FH,generateErrorBoundaryRuntime:()=>MH,generateErrorBoundaryCSS:()=>TH,createErrorBoundary:()=>RH});function OH(){return`eb-${++LH}-${Date.now().toString(36)}`}function FH(X,$={},Z){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return X.replace(Y,(J,G,Q,w)=>{let q=OH(),W=VH(G||"");return AH(q,Q.trim(),w.trim(),W)})}function VH(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4];switch(J){case"id":$.id=G;break;case"logErrors":$.logErrors=G==="true";break}}return $}function AH(X,$,Z,Y){let J=Y.logErrors!==!1;return`
12061
+ `}function IH(X){let $=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return X.replace($,(Z,Y,J,G)=>{let Q=J||"300",w=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${w}"`})}var NQ={};t(NQ,{withErrorBoundary:()=>MQ,processErrorBoundaryDirectives:()=>yH,generateErrorBoundaryRuntime:()=>vH,generateErrorBoundaryCSS:()=>PH,createErrorBoundary:()=>CH});function DH(){return`eb-${++EH}-${Date.now().toString(36)}`}function yH(X,$={},Z){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return X.replace(Y,(J,G,Q,w)=>{let q=DH(),W=bH(G||"");return SH(q,Q.trim(),w.trim(),W)})}function bH(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4];switch(J){case"id":$.id=G;break;case"logErrors":$.logErrors=G==="true";break}}return $}function SH(X,$,Z,Y){let J=Y.logErrors!==!1;return`
12067
12062
  <div class="stx-error-boundary" data-boundary-id="${X}" data-has-error="false">
12068
12063
  <div class="stx-error-boundary-content" data-boundary-content="${X}">
12069
12064
  ${$}
@@ -12183,7 +12178,7 @@ else {
12183
12178
  };
12184
12179
  })();
12185
12180
  </script>
12186
- `}async function _Q(X,$,Z){try{return await X()}catch(Y){if(Z)Z(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return $}}function RH(X,$={}){let Z=$.onError?(Y)=>$.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>_Q(Y,X,Z)}function TH(){return`
12181
+ `}async function MQ(X,$,Z){try{return await X()}catch(Y){if(Z)Z(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return $}}function CH(X,$={}){let Z=$.onError?(Y)=>$.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>MQ(Y,X,Z)}function PH(){return`
12187
12182
  /* STX Error Boundary Styles */
12188
12183
  .stx-error-boundary {
12189
12184
  position: relative;
@@ -12227,7 +12222,7 @@ else {
12227
12222
  color: #fecaca;
12228
12223
  }
12229
12224
  }
12230
- `}function MH(){return`
12225
+ `}function vH(){return`
12231
12226
  // STX Error Boundary Runtime
12232
12227
  (function() {
12233
12228
  if (typeof window === 'undefined') return;
@@ -12292,7 +12287,7 @@ else {
12292
12287
 
12293
12288
  console.log('[stx] Error boundary runtime initialized');
12294
12289
  })();
12295
- `}var LH=0;var jQ={};t(jQ,{renderSSRSuspense:()=>bH,processSuspenseDirectives:()=>IH,generateSuspenseRuntime:()=>CH,generateSuspenseCSS:()=>SH,createSSRSuspense:()=>yH});function kH(){return`suspense-${++NH}-${Date.now().toString(36)}`}function IH(X,$={},Z){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return X.replace(Y,(J,G,Q,w)=>{let q=kH(),W=EH(G||"");return DH(q,Q.trim(),w.trim(),W)})}function EH(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"id":$.id=G;break;case"timeout":$.timeout=Q?parseInt(Q,10):void 0;break}}return $}function DH(X,$,Z,Y){let J=Y.timeout||30000,G=Y.id||X;return`
12290
+ `}var EH=0;var kQ={};t(kQ,{renderSSRSuspense:()=>mH,processSuspenseDirectives:()=>gH,generateSuspenseRuntime:()=>cH,generateSuspenseCSS:()=>lH,createSSRSuspense:()=>dH});function fH(){return`suspense-${++xH}-${Date.now().toString(36)}`}function gH(X,$={},Z){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return X.replace(Y,(J,G,Q,w)=>{let q=fH(),W=hH(G||"");return uH(q,Q.trim(),w.trim(),W)})}function hH(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"id":$.id=G;break;case"timeout":$.timeout=Q?parseInt(Q,10):void 0;break}}return $}function uH(X,$,Z,Y){let J=Y.timeout||30000,G=Y.id||X;return`
12296
12291
  <div class="stx-suspense" data-suspense-id="${X}" data-custom-id="${G}" data-status="pending">
12297
12292
  <div class="stx-suspense-fallback" data-suspense-fallback="${X}">
12298
12293
  ${Z}
@@ -12482,7 +12477,7 @@ else {
12482
12477
  }, 0);
12483
12478
  })();
12484
12479
  </script>
12485
- `}function yH(X,$,Z){return{id:X,fallback:Z,content:$}}async function bH(X){let $=X.map((Y)=>`
12480
+ `}function dH(X,$,Z){return{id:X,fallback:Z,content:$}}async function mH(X){let $=X.map((Y)=>`
12486
12481
  <div id="stx-ssr-suspense-${Y.id}" class="stx-ssr-suspense">
12487
12482
  ${Y.fallback}
12488
12483
  </div>
@@ -12507,7 +12502,7 @@ else {
12507
12502
  }
12508
12503
  })();
12509
12504
  </script>
12510
- `}}return{initial:$,streaming:Z()}}function SH(){return`
12505
+ `}}return{initial:$,streaming:Z()}}function lH(){return`
12511
12506
  /* STX Suspense Styles */
12512
12507
  .stx-suspense {
12513
12508
  position: relative;
@@ -12563,7 +12558,7 @@ else {
12563
12558
  background-size: 200% 100%;
12564
12559
  }
12565
12560
  }
12566
- `}function CH(){return`
12561
+ `}function cH(){return`
12567
12562
  // STX Suspense Runtime
12568
12563
  (function() {
12569
12564
  if (typeof window === 'undefined') return;
@@ -12630,7 +12625,7 @@ else {
12630
12625
 
12631
12626
  console.log('[stx] Suspense runtime initialized');
12632
12627
  })();
12633
- `}var NH=0;var FQ={};t(FQ,{processAsyncDirectives:()=>vH,isAsyncComponent:()=>fH,generateAsyncComponentRuntime:()=>hH,generateAsyncComponentCSS:()=>gH,defineAsyncComponent:()=>xH});function HQ(){return`async-${++PH}-${Date.now().toString(36)}`}function vH(X,$={},Z){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,G=X;return G=G.replace(Y,(Q,w,q,W)=>{let K=HQ(),U=LQ(w);return OQ(K,U,q.trim(),W.trim())}),G=G.replace(J,(Q,w,q)=>{let W=HQ(),K=LQ(w);return OQ(W,K,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function LQ(X){let $={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4],w=Y[5];switch(J){case"component":$.component=G||w||"";break;case"timeout":$.timeout=Q?parseInt(Q,10):30000;break;case"delay":$.delay=Q?parseInt(Q,10):200;break;case"suspensible":$.suspensible=w==="true";break;case"retries":$.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":$.loadingComponent=G||w;break;case"errorComponent":$.errorComponent=G||w;break}}return $}function OQ(X,$,Z,Y){let{component:J,timeout:G,delay:Q,suspensible:w,retries:q}=$;return`
12628
+ `}var xH=0;var yQ={};t(yQ,{processAsyncDirectives:()=>iH,isAsyncComponent:()=>rH,generateAsyncComponentRuntime:()=>oH,generateAsyncComponentCSS:()=>sH,defineAsyncComponent:()=>nH});function IQ(){return`async-${++pH}-${Date.now().toString(36)}`}function iH(X,$={},Z){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,G=X;return G=G.replace(Y,(Q,w,q,W)=>{let U=IQ(),K=EQ(w);return DQ(U,K,q.trim(),W.trim())}),G=G.replace(J,(Q,w,q)=>{let W=IQ(),U=EQ(w);return DQ(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function EQ(X){let $={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4],w=Y[5];switch(J){case"component":$.component=G||w||"";break;case"timeout":$.timeout=Q?parseInt(Q,10):30000;break;case"delay":$.delay=Q?parseInt(Q,10):200;break;case"suspensible":$.suspensible=w==="true";break;case"retries":$.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":$.loadingComponent=G||w;break;case"errorComponent":$.errorComponent=G||w;break}}return $}function DQ(X,$,Z,Y){let{component:J,timeout:G,delay:Q,suspensible:w,retries:q}=$;return`
12634
12629
  <div class="stx-async-component" data-async-id="${X}" data-component="${J}" data-status="pending">
12635
12630
  <div class="stx-async-loading" data-async-loading="${X}">
12636
12631
  ${Z}
@@ -12857,7 +12852,7 @@ catch (error) {
12857
12852
  loadComponent();
12858
12853
  })();
12859
12854
  </script>
12860
- `}function xH(X){return{__asyncComponent:!0,...typeof X==="function"?{loader:X}:X}}function fH(X){return typeof X==="object"&&X!==null&&"__asyncComponent"in X&&X.__asyncComponent===!0}function gH(){return`
12855
+ `}function nH(X){return{__asyncComponent:!0,...typeof X==="function"?{loader:X}:X}}function rH(X){return typeof X==="object"&&X!==null&&"__asyncComponent"in X&&X.__asyncComponent===!0}function sH(){return`
12861
12856
  /* STX Async Component Styles */
12862
12857
  .stx-async-component {
12863
12858
  position: relative;
@@ -12931,7 +12926,7 @@ catch (error) {
12931
12926
  background-size: 200% 100%;
12932
12927
  }
12933
12928
  }
12934
- `}function hH(){return`
12929
+ `}function oH(){return`
12935
12930
  // STX Async Component Runtime
12936
12931
  (function() {
12937
12932
  if (typeof window === 'undefined') return;
@@ -12985,7 +12980,7 @@ catch (error) {
12985
12980
 
12986
12981
  console.log('[stx] Async component runtime initialized');
12987
12982
  })();
12988
- `}var PH=0;var AQ={};t(AQ,{shouldCacheComponent:()=>pH,processKeepAliveDirectives:()=>dH,onDeactivated:()=>sH,onActivated:()=>rH,generateKeepAliveRuntime:()=>nH,generateKeepAliveCSS:()=>iH,createKeepAliveCache:()=>cH});function VQ(){return`keep-alive-${++uH}-${Date.now().toString(36)}`}function dH(X,$={},Z){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return X.replace(Y,(J,G,Q)=>{let w=VQ(),q=mH(G||"");return lH(w,Q.trim(),q)})}function mH(X){let $={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"max":$.max=Q?parseInt(Q,10):10;break;case"include":$.include=G;break;case"exclude":$.exclude=G;break;case"id":$.id=G;break}}return $}function lH(X,$,Z){let{max:Y,include:J,exclude:G}=Z,Q=Z.id||X;return`
12983
+ `}var pH=0;var SQ={};t(SQ,{shouldCacheComponent:()=>ZL,processKeepAliveDirectives:()=>tH,onDeactivated:()=>QL,onActivated:()=>GL,generateKeepAliveRuntime:()=>JL,generateKeepAliveCSS:()=>YL,createKeepAliveCache:()=>$L});function bQ(){return`keep-alive-${++aH}-${Date.now().toString(36)}`}function tH(X,$={},Z){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return X.replace(Y,(J,G,Q)=>{let w=bQ(),q=eH(G||"");return XL(w,Q.trim(),q)})}function eH(X){let $={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"max":$.max=Q?parseInt(Q,10):10;break;case"include":$.include=G;break;case"exclude":$.exclude=G;break;case"id":$.id=G;break}}return $}function XL(X,$,Z){let{max:Y,include:J,exclude:G}=Z,Q=Z.id||X;return`
12989
12984
  <div class="stx-keep-alive" data-keep-alive-id="${X}" data-custom-id="${Q}">
12990
12985
  <div class="stx-keep-alive-content" data-keep-alive-content="${X}">
12991
12986
  ${$}
@@ -13272,7 +13267,7 @@ else {
13272
13267
  });
13273
13268
  })();
13274
13269
  </script>
13275
- `}function cH(X={}){return{id:X.id||VQ(),cache:new Map,max:X.max||10,include:X.include?X.include.split(",").map((Z)=>Z.trim()):null,exclude:X.exclude?X.exclude.split(",").map((Z)=>Z.trim()):null}}function pH(X,$){if($.exclude&&$.exclude.includes(X))return!1;if($.include&&!$.include.includes(X))return!1;return!0}function iH(){return`
13270
+ `}function $L(X={}){return{id:X.id||bQ(),cache:new Map,max:X.max||10,include:X.include?X.include.split(",").map((Z)=>Z.trim()):null,exclude:X.exclude?X.exclude.split(",").map((Z)=>Z.trim()):null}}function ZL(X,$){if($.exclude&&$.exclude.includes(X))return!1;if($.include&&!$.include.includes(X))return!1;return!0}function YL(){return`
13276
13271
  /* STX Keep-Alive Styles */
13277
13272
  .stx-keep-alive {
13278
13273
  position: relative;
@@ -13297,7 +13292,7 @@ else {
13297
13292
  .stx-keep-alive-content > [data-activated] {
13298
13293
  opacity: 1;
13299
13294
  }
13300
- `}function nH(){return`
13295
+ `}function JL(){return`
13301
13296
  // STX Keep-Alive Runtime
13302
13297
  (function() {
13303
13298
  if (typeof window === 'undefined') return;
@@ -13333,33 +13328,33 @@ else {
13333
13328
 
13334
13329
  console.log('[stx] Keep-alive runtime initialized');
13335
13330
  })();
13336
- `}function rH(X){if(typeof document<"u")document.addEventListener("stx:activated",($)=>{X($.detail)})}function sH(X){if(typeof document<"u")document.addEventListener("stx:deactivated",($)=>{X($.detail)})}var uH=0;var kQ={};t(kQ,{useVirtualList:()=>TQ,processVirtualListDirectives:()=>G4,processVirtualGridDirectives:()=>NQ,processInfiniteListDirectives:()=>MQ,generateVirtualListCSS:()=>RQ,default:()=>oH,createVirtualList:()=>J4});function J4(X,$){let{itemHeight:Z,containerHeight:Y,overscan:J=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:w=Z,direction:q="vertical"}=$,W=[...X],K=0,U=new Map;function z(){if(Q)return B();let R=Math.max(0,Math.floor(K/Z)-J),T=Math.ceil(Y/Z),M=Math.min(W.length-1,R+T+J*2);return{startIndex:R,endIndex:M}}function B(){let R=0,T=0,M=W.length-1;for(let k=0;k<W.length;k++){let N=U.get(k)||w;if(R+N>K){T=Math.max(0,k-J);break}R+=N}R=0;for(let k=0;k<W.length;k++){let N=U.get(k)||w;if(R+=N,R>K+Y){M=Math.min(W.length-1,k+J);break}}return{startIndex:T,endIndex:M}}function _(){if(Q){let R=0;for(let T=0;T<W.length;T++)R+=U.get(T)||w;return R}return W.length*Z}function j(R){if(Q){let T=0;for(let M=0;M<R;M++)T+=U.get(M)||w;return T}return R*Z}function H(){let{startIndex:R,endIndex:T}=z();return{startIndex:R,endIndex:T,scrollTop:K,totalHeight:_(),visibleItems:W.slice(R,T+1),itemHeights:new Map(U)}}function O(R,T="auto"){let M=j(R);L(M,T)}function L(R,T="auto"){K=Math.max(0,Math.min(R,_()-Y))}function F(){z()}function V(R){W=[...R],U.clear(),F()}function A(){W=[],U.clear()}return{scrollToIndex:O,scrollToOffset:L,getState:H,refresh:F,setItems:V,destroy:A}}function G4(X,$={},Z){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return X.replace(Y,(J,G,Q,w)=>{let q=G.trim(),W=$[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let K={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let L=Q.trim(),F=Function(`return ${L}`)();K={...K,...F}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(K.containerHeight/K.itemHeight),B=K.overscan||3,_=0,j=Math.min(W.length-1,z+B),H="";for(let L=_;L<=j&&L<W.length;L++){let F=W[L],V=w.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(L));H+=`
13337
- <div class="virtual-item ${K.itemClass||""}"
13338
- style="position: absolute; top: ${L*K.itemHeight}px; height: ${K.itemHeight}px; width: 100%;"
13331
+ `}function GL(X){if(typeof document<"u")document.addEventListener("stx:activated",($)=>{X($.detail)})}function QL(X){if(typeof document<"u")document.addEventListener("stx:deactivated",($)=>{X($.detail)})}var aH=0;var fQ={};t(fQ,{useVirtualList:()=>PQ,processVirtualListDirectives:()=>z4,processVirtualGridDirectives:()=>xQ,processInfiniteListDirectives:()=>vQ,generateVirtualListCSS:()=>CQ,default:()=>wL,createVirtualList:()=>K4});function K4(X,$){let{itemHeight:Z,containerHeight:Y,overscan:J=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:w=Z,direction:q="vertical"}=$,W=[...X],U=0,K=new Map;function z(){if(Q)return B();let R=Math.max(0,Math.floor(U/Z)-J),T=Math.ceil(Y/Z),M=Math.min(W.length-1,R+T+J*2);return{startIndex:R,endIndex:M}}function B(){let R=0,T=0,M=W.length-1;for(let k=0;k<W.length;k++){let N=K.get(k)||w;if(R+N>U){T=Math.max(0,k-J);break}R+=N}R=0;for(let k=0;k<W.length;k++){let N=K.get(k)||w;if(R+=N,R>U+Y){M=Math.min(W.length-1,k+J);break}}return{startIndex:T,endIndex:M}}function _(){if(Q){let R=0;for(let T=0;T<W.length;T++)R+=K.get(T)||w;return R}return W.length*Z}function j(R){if(Q){let T=0;for(let M=0;M<R;M++)T+=K.get(M)||w;return T}return R*Z}function H(){let{startIndex:R,endIndex:T}=z();return{startIndex:R,endIndex:T,scrollTop:U,totalHeight:_(),visibleItems:W.slice(R,T+1),itemHeights:new Map(K)}}function O(R,T="auto"){let M=j(R);L(M,T)}function L(R,T="auto"){U=Math.max(0,Math.min(R,_()-Y))}function F(){z()}function V(R){W=[...R],K.clear(),F()}function A(){W=[],K.clear()}return{scrollToIndex:O,scrollToOffset:L,getState:H,refresh:F,setItems:V,destroy:A}}function z4(X,$={},Z){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return X.replace(Y,(J,G,Q,w)=>{let q=G.trim(),W=$[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let L=Q.trim(),F=Function(`return ${L}`)();U={...U,...F}}catch{}let K=`vlist-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(U.containerHeight/U.itemHeight),B=U.overscan||3,_=0,j=Math.min(W.length-1,z+B),H="";for(let L=_;L<=j&&L<W.length;L++){let F=W[L],V=w.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(L));H+=`
13332
+ <div class="virtual-item ${U.itemClass||""}"
13333
+ style="position: absolute; top: ${L*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
13339
13334
  data-index="${L}">
13340
13335
  ${V}
13341
- </div>`}let O=W.length*K.itemHeight;return`
13342
- <div id="${U}"
13343
- class="virtual-list-container ${K.containerClass||""}"
13344
- style="position: relative; height: ${K.containerHeight}px; overflow-y: auto;"
13345
- data-item-height="${K.itemHeight}"
13336
+ </div>`}let O=W.length*U.itemHeight;return`
13337
+ <div id="${K}"
13338
+ class="virtual-list-container ${U.containerClass||""}"
13339
+ style="position: relative; height: ${U.containerHeight}px; overflow-y: auto;"
13340
+ data-item-height="${U.itemHeight}"
13346
13341
  data-total-items="${W.length}"
13347
13342
  data-overscan="${B}">
13348
- <div class="virtual-list-viewport ${K.viewportClass||""}"
13343
+ <div class="virtual-list-viewport ${U.viewportClass||""}"
13349
13344
  style="position: relative; height: ${O}px; width: 100%;">
13350
13345
  ${H}
13351
13346
  </div>
13352
13347
  </div>
13353
- <script data-virtual-list="${U}">
13348
+ <script data-virtual-list="${K}">
13354
13349
  (function() {
13355
- const container = document.getElementById('${U}');
13350
+ const container = document.getElementById('${K}');
13356
13351
  if (!container) return;
13357
13352
 
13358
13353
  const viewport = container.querySelector('.virtual-list-viewport');
13359
- const itemHeight = ${K.itemHeight};
13354
+ const itemHeight = ${U.itemHeight};
13360
13355
  const totalItems = ${W.length};
13361
13356
  const overscan = ${B};
13362
- const containerHeight = ${K.containerHeight};
13357
+ const containerHeight = ${U.containerHeight};
13363
13358
  const items = ${JSON.stringify(W)};
13364
13359
  const template = ${JSON.stringify(w.trim())};
13365
13360
 
@@ -13379,7 +13374,7 @@ else {
13379
13374
  for (let i = startIndex; i <= endIndex; i++) {
13380
13375
  const item = items[i];
13381
13376
  const div = document.createElement('div');
13382
- div.className = 'virtual-item ${K.itemClass||""}';
13377
+ div.className = 'virtual-item ${U.itemClass||""}';
13383
13378
  div.style.cssText = 'position: absolute; top: ' + (i * itemHeight) + 'px; height: ' + itemHeight + 'px; width: 100%;';
13384
13379
  div.dataset.index = i;
13385
13380
 
@@ -13410,7 +13405,7 @@ else {
13410
13405
  };
13411
13406
  })();
13412
13407
  </script>
13413
- `})}function RQ(){return`
13408
+ `})}function CQ(){return`
13414
13409
  .virtual-list-container {
13415
13410
  position: relative;
13416
13411
  overflow-y: auto;
@@ -13458,11 +13453,11 @@ else {
13458
13453
  0% { background-position: 200% 0; }
13459
13454
  100% { background-position: -200% 0; }
13460
13455
  }
13461
- `}function TQ(X,$){let Z=null,Y=()=>{if(!Z)Z=J4(X(),$);return Z};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${$.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(J)=>{let G=J.target;if(Z)Z.scrollToOffset(G.scrollTop)}}),itemProps:(J)=>({style:{position:"absolute",top:`${J*$.itemHeight}px`,height:`${$.itemHeight}px`,width:"100%"},"data-index":J}),scrollToIndex:(J)=>{Y().scrollToIndex(J)}}}function MQ(X,$={},Z){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return X.replace(Y,(J,G,Q,w,q)=>{let W=G.trim(),K=$[W];if(!K||!Array.isArray(K))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let _=Function(`return ${Q.trim()}`)();U={...U,..._}}catch{}let z=`ilist-${Math.random().toString(36).substring(2,9)}`,B=G4(`@virtualList(${W}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${w}@endvirtualList`,$);return B=B.replace("</script>",`
13456
+ `}function PQ(X,$){let Z=null,Y=()=>{if(!Z)Z=K4(X(),$);return Z};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${$.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(J)=>{let G=J.target;if(Z)Z.scrollToOffset(G.scrollTop)}}),itemProps:(J)=>({style:{position:"absolute",top:`${J*$.itemHeight}px`,height:`${$.itemHeight}px`,width:"100%"},"data-index":J}),scrollToIndex:(J)=>{Y().scrollToIndex(J)}}}function vQ(X,$={},Z){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return X.replace(Y,(J,G,Q,w,q)=>{let W=G.trim(),U=$[W];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let K={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let _=Function(`return ${Q.trim()}`)();K={...K,..._}}catch{}let z=`ilist-${Math.random().toString(36).substring(2,9)}`,B=z4(`@virtualList(${W}, ${JSON.stringify({itemHeight:K.itemHeight,containerHeight:K.containerHeight,overscan:K.overscan,containerClass:K.containerClass})})${w}@endvirtualList`,$);return B=B.replace("</script>",`
13462
13457
  // Infinite scroll detection
13463
13458
  container.addEventListener('scroll', function() {
13464
13459
  const scrollBottom = container.scrollTop + container.clientHeight;
13465
- const threshold = ${U.threshold};
13460
+ const threshold = ${K.threshold};
13466
13461
  const totalHeight = viewport.offsetHeight;
13467
13462
 
13468
13463
  if (scrollBottom >= totalHeight - threshold) {
@@ -13476,32 +13471,32 @@ else {
13476
13471
  ${q}
13477
13472
  </div>
13478
13473
  </div>
13479
- `})}function NQ(X,$={},Z){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return X.replace(Y,(J,G,Q,w)=>{let q=G.trim(),W=$[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let K={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let F=Function(`return ${Q.trim()}`)();K={...K,...F}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(W.length/K.columns),B=z*(K.rowHeight+(K.gap||0)),_=Math.ceil(K.containerHeight/(K.rowHeight+(K.gap||0))),j=K.overscan||2,H=0,O=Math.min(z-1,_+j),L="";for(let F=H;F<=O;F++)for(let V=0;V<K.columns;V++){let A=F*K.columns+V;if(A>=W.length)break;let R=W[A],T=V*(100/K.columns),M=F*(K.rowHeight+(K.gap||0)),k=w.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(N,y)=>{if(typeof R==="object"&&R!==null)return String(R[y]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));L+=`
13474
+ `})}function xQ(X,$={},Z){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return X.replace(Y,(J,G,Q,w)=>{let q=G.trim(),W=$[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let U={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let F=Function(`return ${Q.trim()}`)();U={...U,...F}}catch{}let K=`vgrid-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(W.length/U.columns),B=z*(U.rowHeight+(U.gap||0)),_=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),j=U.overscan||2,H=0,O=Math.min(z-1,_+j),L="";for(let F=H;F<=O;F++)for(let V=0;V<U.columns;V++){let A=F*U.columns+V;if(A>=W.length)break;let R=W[A],T=V*(100/U.columns),M=F*(U.rowHeight+(U.gap||0)),k=w.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(N,y)=>{if(typeof R==="object"&&R!==null)return String(R[y]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));L+=`
13480
13475
  <div class="virtual-grid-item"
13481
- style="position: absolute; top: ${M}px; left: ${T}%; width: calc(${100/K.columns}% - ${K.gap||0}px); height: ${K.rowHeight}px;"
13476
+ style="position: absolute; top: ${M}px; left: ${T}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
13482
13477
  data-index="${A}">
13483
13478
  ${k}
13484
13479
  </div>`}return`
13485
- <div id="${U}"
13480
+ <div id="${K}"
13486
13481
  class="virtual-grid-container"
13487
- style="position: relative; height: ${K.containerHeight}px; overflow-y: auto;">
13482
+ style="position: relative; height: ${U.containerHeight}px; overflow-y: auto;">
13488
13483
  <div class="virtual-grid-viewport"
13489
13484
  style="position: relative; height: ${B}px; width: 100%;">
13490
13485
  ${L}
13491
13486
  </div>
13492
13487
  </div>
13493
- <script data-virtual-grid="${U}">
13488
+ <script data-virtual-grid="${K}">
13494
13489
  (function() {
13495
- const container = document.getElementById('${U}');
13490
+ const container = document.getElementById('${K}');
13496
13491
  if (!container) return;
13497
13492
 
13498
13493
  const viewport = container.querySelector('.virtual-grid-viewport');
13499
- const columns = ${K.columns};
13500
- const rowHeight = ${K.rowHeight};
13501
- const gap = ${K.gap||0};
13494
+ const columns = ${U.columns};
13495
+ const rowHeight = ${U.rowHeight};
13496
+ const gap = ${U.gap||0};
13502
13497
  const totalItems = ${W.length};
13503
13498
  const overscan = ${j};
13504
- const containerHeight = ${K.containerHeight};
13499
+ const containerHeight = ${U.containerHeight};
13505
13500
  const items = ${JSON.stringify(W)};
13506
13501
  const template = ${JSON.stringify(w.trim())};
13507
13502
 
@@ -13546,7 +13541,7 @@ else {
13546
13541
  });
13547
13542
  })();
13548
13543
  </script>
13549
- `})}var oH;var IQ=D(()=>{oH={createVirtualList:J4,processVirtualListDirectives:G4,processInfiniteListDirectives:MQ,processVirtualGridDirectives:NQ,generateVirtualListCSS:RQ,useVirtualList:TQ}});function EQ(){return`<script data-stx-hydration-runtime>
13544
+ `})}var wL;var gQ=D(()=>{wL={createVirtualList:K4,processVirtualListDirectives:z4,processInfiniteListDirectives:vQ,processVirtualGridDirectives:xQ,generateVirtualListCSS:CQ,useVirtualList:PQ}});function hQ(){return`<script data-stx-hydration-runtime>
13550
13545
  (function() {
13551
13546
  'use strict';
13552
13547
 
@@ -13706,7 +13701,7 @@ else {
13706
13701
  stxIslands.initIslands();
13707
13702
  }
13708
13703
  })();
13709
- </script>`}function DQ(X){let $=X.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if($)return $[1];let Z=X.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function yQ(X,$){let Z={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(Q in $)Z[G]=$[Q];else Z[G]=Q}return Z}var dQ={};t(dQ,{processStaticDirectives:()=>hQ,processPartialHydrationDirectives:()=>SQ,onHydrated:()=>gQ,isHydrated:()=>fQ,hydrateIsland:()=>PQ,hydrateByStrategy:()=>vQ,hydrateAll:()=>xQ,generatePartialHydrationCSS:()=>CQ,generateIslandManifest:()=>uQ,default:()=>JL,createIslandRegistry:()=>bQ});function bQ(){let X=new Map;return{islands:X,register($){X.set($.id,$)},get($){return X.get($)},async hydrate($){let Z=X.get($);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:$,component:Z.component}}))},async hydrateAll(){let $=Array.from(X.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all($)}}}function aH(X){return`
13704
+ </script>`}function uQ(X){let $=X.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if($)return $[1];let Z=X.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function dQ(X,$){let Z={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(Q in $)Z[G]=$[Q];else Z[G]=Q}return Z}var tQ={};t(tQ,{processStaticDirectives:()=>oQ,processPartialHydrationDirectives:()=>lQ,onHydrated:()=>sQ,isHydrated:()=>rQ,hydrateIsland:()=>pQ,hydrateByStrategy:()=>iQ,hydrateAll:()=>nQ,generatePartialHydrationCSS:()=>cQ,generateIslandManifest:()=>aQ,default:()=>jL,createIslandRegistry:()=>mQ});function mQ(){let X=new Map;return{islands:X,register($){X.set($.id,$)},get($){return X.get($)},async hydrate($){let Z=X.get($);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:$,component:Z.component}}))},async hydrateAll(){let $=Array.from(X.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all($)}}}function qL(X){return`
13710
13705
  <script data-hydrate="${X}">
13711
13706
  (function() {
13712
13707
  const island = document.querySelector('[data-island="${X}"]');
@@ -13717,7 +13712,7 @@ else {
13717
13712
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
13718
13713
  })();
13719
13714
  </script>
13720
- `}function tH(X,$){let Z=$.timeout||2000,Y=$.priority||"low";return`
13715
+ `}function WL(X,$){let Z=$.timeout||2000,Y=$.priority||"low";return`
13721
13716
  <script data-hydrate="${X}">
13722
13717
  (function() {
13723
13718
  const island = document.querySelector('[data-island="${X}"]');
@@ -13753,7 +13748,7 @@ else {
13753
13748
  }
13754
13749
  })();
13755
13750
  </script>
13756
- `}function eH(X,$){let Z=$.rootMargin||"0px",Y=$.threshold||0;return`
13751
+ `}function UL(X,$){let Z=$.rootMargin||"0px",Y=$.threshold||0;return`
13757
13752
  <script data-hydrate="${X}">
13758
13753
  (function() {
13759
13754
  const island = document.querySelector('[data-island="${X}"]');
@@ -13786,7 +13781,7 @@ else {
13786
13781
  }
13787
13782
  })();
13788
13783
  </script>
13789
- `}function XL(X,$){let Z=$.media||"(min-width: 768px)";return`
13784
+ `}function KL(X,$){let Z=$.media||"(min-width: 768px)";return`
13790
13785
  <script data-hydrate="${X}">
13791
13786
  (function() {
13792
13787
  const island = document.querySelector('[data-island="${X}"]');
@@ -13815,7 +13810,7 @@ else {
13815
13810
  }
13816
13811
  })();
13817
13812
  </script>
13818
- `}function $L(X){return`
13813
+ `}function zL(X){return`
13819
13814
  <script data-hydrate="${X}">
13820
13815
  (function() {
13821
13816
  const island = document.querySelector('[data-island="${X}"]');
@@ -13837,7 +13832,7 @@ else {
13837
13832
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
13838
13833
  })();
13839
13834
  </script>
13840
- `}function ZL(X,$){let Z=$.event||"stx:activate";return`
13835
+ `}function _L(X,$){let Z=$.event||"stx:activate";return`
13841
13836
  <script data-hydrate="${X}">
13842
13837
  (function() {
13843
13838
  const island = document.querySelector('[data-island="${X}"]');
@@ -13858,19 +13853,19 @@ else {
13858
13853
  });
13859
13854
  })();
13860
13855
  </script>
13861
- `}function SQ(X,$={},Z){let Y=X,J=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test(X);if(Y=t5(Y,"load",$),Y=t5(Y,"idle",$),Y=t5(Y,"visible",$),Y=t5(Y,"media",$),Y=YL(Y),Y=t5(Y,"hover",$),Y=t5(Y,"event",$),J=G&&Y!==X,J)Y+=`
13862
- `+EQ();return Y}function t5(X,$,Z){let Y=new RegExp(`@client:${$}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return X.replace(Y,(J,G,Q)=>{let w={strategy:$};if(G)try{let j=G.split(",").map((H)=>H.trim());for(let H of j){let[O,L]=H.split(":").map((F)=>F.trim());if(O&&L){let F=L.replace(/^['"]|['"]$/g,"");w[O]=F}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=DQ(Q.trim()),K=yQ(Q.trim(),Z),U=[];if(w.rootMargin)U.push(`data-root-margin="${w.rootMargin}"`);if(w.threshold!==void 0)U.push(`data-threshold="${w.threshold}"`);if(w.media)U.push(`data-media="${w.media}"`);if(w.event)U.push(`data-event="${w.event}"`);if(W)U.push(`data-component="${W}"`);let B=Object.keys(K).length>0?`
13863
- <script type="application/json" data-island-props="${q}">${JSON.stringify(K)}</script>`:"",_="";switch($){case"load":_=aH(q);break;case"idle":_=tH(q,w);break;case"visible":_=eH(q,w);break;case"media":_=XL(q,w);break;case"hover":_=$L(q);break;case"event":_=ZL(q,w);break}return`
13856
+ `}function lQ(X,$={},Z){let Y=X,J=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test(X);if(Y=e5(Y,"load",$),Y=e5(Y,"idle",$),Y=e5(Y,"visible",$),Y=e5(Y,"media",$),Y=BL(Y),Y=e5(Y,"hover",$),Y=e5(Y,"event",$),J=G&&Y!==X,J)Y+=`
13857
+ `+hQ();return Y}function e5(X,$,Z){let Y=new RegExp(`@client:${$}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return X.replace(Y,(J,G,Q)=>{let w={strategy:$};if(G)try{let j=G.split(",").map((H)=>H.trim());for(let H of j){let[O,L]=H.split(":").map((F)=>F.trim());if(O&&L){let F=L.replace(/^['"]|['"]$/g,"");w[O]=F}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=uQ(Q.trim()),U=dQ(Q.trim(),Z),K=[];if(w.rootMargin)K.push(`data-root-margin="${w.rootMargin}"`);if(w.threshold!==void 0)K.push(`data-threshold="${w.threshold}"`);if(w.media)K.push(`data-media="${w.media}"`);if(w.event)K.push(`data-event="${w.event}"`);if(W)K.push(`data-component="${W}"`);let B=Object.keys(U).length>0?`
13858
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",_="";switch($){case"load":_=qL(q);break;case"idle":_=WL(q,w);break;case"visible":_=UL(q,w);break;case"media":_=KL(q,w);break;case"hover":_=zL(q);break;case"event":_=_L(q,w);break}return`
13864
13859
  <div data-island="${q}"
13865
13860
  data-strategy="${$}"
13866
- ${U.join(`
13861
+ ${K.join(`
13867
13862
  `)}
13868
13863
  class="stx-island"
13869
13864
  style="contents;">
13870
13865
  ${Q.trim()}${B}
13871
13866
  </div>
13872
13867
  ${_}
13873
- `})}function YL(X){let $=/@client:only\s*([\s\S]*?)@endclient/gi;return X.replace($,(Z,Y)=>{let J=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
13868
+ `})}function BL(X){let $=/@client:only\s*([\s\S]*?)@endclient/gi;return X.replace($,(Z,Y)=>{let J=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
13874
13869
  <div data-island="${J}"
13875
13870
  data-strategy="only"
13876
13871
  class="stx-island stx-client-only">
@@ -13889,7 +13884,7 @@ else {
13889
13884
  }
13890
13885
  })();
13891
13886
  </script>
13892
- `})}function CQ(){return`
13887
+ `})}function cQ(){return`
13893
13888
  /* Island base styles */
13894
13889
  .stx-island {
13895
13890
  display: contents;
@@ -13930,11 +13925,11 @@ else {
13930
13925
  .stx-island.hydrated {
13931
13926
  opacity: 1;
13932
13927
  }
13933
- `}function PQ(X){if(typeof window>"u")return;let $=document.querySelector(`[data-island="${X}"]`);if(!$||$.classList.contains("hydrated"))return;$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function vQ(X){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${X}"]:not(.hydrated)`).forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function xQ(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach(($)=>{$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function fQ(X){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${X}"]`)?.classList.contains("hydrated")??!1}function gQ(X){return new Promise(($)=>{if(typeof window>"u"){$();return}let Z=document.querySelector(`[data-island="${X}"]`);if(!Z){$();return}if(Z.classList.contains("hydrated")){$();return}Z.addEventListener("stx:hydrated",()=>$(),{once:!0})})}function hQ(X){return X.replace(/@static\s*([\s\S]*?)@endstatic/gi,($,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function uQ(X){let $=X.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
13928
+ `}function pQ(X){if(typeof window>"u")return;let $=document.querySelector(`[data-island="${X}"]`);if(!$||$.classList.contains("hydrated"))return;$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function iQ(X){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${X}"]:not(.hydrated)`).forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function nQ(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach(($)=>{$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function rQ(X){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${X}"]`)?.classList.contains("hydrated")??!1}function sQ(X){return new Promise(($)=>{if(typeof window>"u"){$();return}let Z=document.querySelector(`[data-island="${X}"]`);if(!Z){$();return}if(Z.classList.contains("hydrated")){$();return}Z.addEventListener("stx:hydrated",()=>$(),{once:!0})})}function oQ(X){return X.replace(/@static\s*([\s\S]*?)@endstatic/gi,($,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function aQ(X){let $=X.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
13934
13929
  <script type="application/json" id="stx-island-manifest">
13935
13930
  ${JSON.stringify($)}
13936
13931
  </script>
13937
- `}var JL;var mQ=D(()=>{JL={processPartialHydrationDirectives:SQ,processStaticDirectives:hQ,generatePartialHydrationCSS:CQ,generateIslandManifest:uQ,createIslandRegistry:bQ,hydrateIsland:PQ,hydrateByStrategy:vQ,hydrateAll:xQ,isHydrated:fQ,onHydrated:gQ}});var eQ={};t(eQ,{watchMultiple:()=>nQ,watchEffect:()=>rQ,watch:()=>iQ,unref:()=>lQ,toRefs:()=>cQ,throttledComputed:()=>tQ,stxWatchMultiple:()=>nQ,stxWatchEffect:()=>rQ,stxWatch:()=>iQ,stxUnref:()=>lQ,stxToRefs:()=>cQ,stxThrottledComputed:()=>tQ,stxShallowRef:()=>pQ,stxRef:()=>e5,stxIsRef:()=>l1,stxDebouncedComputed:()=>aQ,stxComputed:()=>e7,shallowRef:()=>pQ,ref:()=>e5,processWatchDirectives:()=>oQ,processComputedDirectives:()=>sQ,isRef:()=>l1,default:()=>GL,debouncedComputed:()=>aQ,computed:()=>e7});function e5(X){let $=X,Z=new Set,Y={get value(){if(U1){let J=t7.get(Y);if(!J)J=new Set,t7.set(Y,J);J.add(U1)}return $},set value(J){if(!Object.is($,J)){$=J,Z.forEach((Q)=>Q(J));let G=t7.get(Y);if(G)G.forEach((Q)=>Q())}},subscribe(J){return Z.add(J),()=>Z.delete(J)},peek(){return $}};return Y}function l1(X){return X!==null&&typeof X==="object"&&"value"in X&&"subscribe"in X&&"peek"in X}function lQ(X){return l1(X)?X.value:X}function cQ(X){let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=e5(X[Z]);return $}function pQ(X){return e5(X)}function e7(X){let $=typeof X==="function",Z=$?X:X.get,Y=$?void 0:X.set,J=$?Object.is:X.equals||Object.is,G,Q=!0,w=new Set,q=new Set,W=()=>{if(Q=!0,q.size>0){let z=U.value;q.forEach((B)=>B(z))}};function K(){w.clear();let z=U1;U1=W,P8.push(W);try{return Z()}finally{P8.pop(),U1=z}}let U={get value(){if(U1){let z=t7.get(U);if(!z)z=new Set,t7.set(U,z);z.add(U1)}if(Q){let z=K();if(!J(G,z))G=z;Q=!1}return G},set value(z){if(Y)Y(z);else console.warn("Computed property is readonly")},subscribe(z){return q.add(z),()=>q.delete(z)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return w}};return U}function iQ(X,$,Z={}){let{immediate:Y=!1,deep:J=!1,flush:G="pre",once:Q=!1}=Z,w,q=!0,W=!1,K=()=>{if(l1(X))return J?_5(X.value):X.value;return X()},U=()=>{if(!q||W)return;let _=K();if(w!==void 0&&Object.is(w,_)&&!J)return;let j=()=>{if($(_,w),w=J?_5(_):_,Q)B()};if(G==="sync")j();else if(G==="post")queueMicrotask(j);else Promise.resolve().then(j)},z=null;if(l1(X))z=X.subscribe(()=>U());else z=e7(X).subscribe(()=>U());if(Y)w=void 0,U();else w=K();let B=()=>{if(q=!1,z)z(),z=null};return B.pause=()=>{W=!0},B.resume=()=>{W=!1},B}function nQ(X,$,Z={}){let{immediate:Y=!1,once:J=!1}=Z,G=X.map((U)=>l1(U)?U.value:void 0),Q=!0,w=!1,q=()=>{if(!Q||w)return;let U=X.map((z)=>l1(z)?z.value:void 0);if($(U,G),G=[...U],J)K()},W=X.map((U)=>{if(l1(U))return U.subscribe(()=>q());return()=>{}});if(Y)q();let K=()=>{Q=!1,W.forEach((U)=>U())};return K.pause=()=>{w=!0},K.resume=()=>{w=!1},K}function rQ(X,$={}){let{flush:Z="pre"}=$,Y,J=!0,G=!1,Q=()=>{if(!J||G)return;if(Y)Y();let q=U1;U1=Q,P8.push(Q);try{Y=X()}finally{P8.pop(),U1=q}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let w=()=>{if(J=!1,Y)Y()};return w.pause=()=>{G=!0},w.resume=()=>{G=!1},w}function sQ(X,$={},Z){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return X.replace(Y,(J,G,Q)=>{try{let q=Function(...Object.keys($),`return ${Q}`)(...Object.values($));return $[G]=q,`<!-- computed: ${G} = ${q} -->`}catch(w){return`<!-- computed error: ${G} - ${w} -->`}})}function oQ(X,$={},Z){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return X.replace(Y,(J,G,Q)=>{return`
13932
+ `}var jL;var eQ=D(()=>{jL={processPartialHydrationDirectives:lQ,processStaticDirectives:oQ,generatePartialHydrationCSS:cQ,generateIslandManifest:aQ,createIslandRegistry:mQ,hydrateIsland:pQ,hydrateByStrategy:iQ,hydrateAll:nQ,isHydrated:rQ,onHydrated:sQ}});var Uw={};t(Uw,{watchMultiple:()=>Jw,watchEffect:()=>Gw,watch:()=>Yw,unref:()=>Xw,toRefs:()=>$w,throttledComputed:()=>Ww,stxWatchMultiple:()=>Jw,stxWatchEffect:()=>Gw,stxWatch:()=>Yw,stxUnref:()=>Xw,stxToRefs:()=>$w,stxThrottledComputed:()=>Ww,stxShallowRef:()=>Zw,stxRef:()=>X7,stxIsRef:()=>l1,stxDebouncedComputed:()=>qw,stxComputed:()=>XX,shallowRef:()=>Zw,ref:()=>X7,processWatchDirectives:()=>ww,processComputedDirectives:()=>Qw,isRef:()=>l1,default:()=>HL,debouncedComputed:()=>qw,computed:()=>XX});function X7(X){let $=X,Z=new Set,Y={get value(){if(U1){let J=e7.get(Y);if(!J)J=new Set,e7.set(Y,J);J.add(U1)}return $},set value(J){if(!Object.is($,J)){$=J,Z.forEach((Q)=>Q(J));let G=e7.get(Y);if(G)G.forEach((Q)=>Q())}},subscribe(J){return Z.add(J),()=>Z.delete(J)},peek(){return $}};return Y}function l1(X){return X!==null&&typeof X==="object"&&"value"in X&&"subscribe"in X&&"peek"in X}function Xw(X){return l1(X)?X.value:X}function $w(X){let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=X7(X[Z]);return $}function Zw(X){return X7(X)}function XX(X){let $=typeof X==="function",Z=$?X:X.get,Y=$?void 0:X.set,J=$?Object.is:X.equals||Object.is,G,Q=!0,w=new Set,q=new Set,W=()=>{if(Q=!0,q.size>0){let z=K.value;q.forEach((B)=>B(z))}};function U(){w.clear();let z=U1;U1=W,P8.push(W);try{return Z()}finally{P8.pop(),U1=z}}let K={get value(){if(U1){let z=e7.get(K);if(!z)z=new Set,e7.set(K,z);z.add(U1)}if(Q){let z=U();if(!J(G,z))G=z;Q=!1}return G},set value(z){if(Y)Y(z);else console.warn("Computed property is readonly")},subscribe(z){return q.add(z),()=>q.delete(z)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return w}};return K}function Yw(X,$,Z={}){let{immediate:Y=!1,deep:J=!1,flush:G="pre",once:Q=!1}=Z,w,q=!0,W=!1,U=()=>{if(l1(X))return J?B5(X.value):X.value;return X()},K=()=>{if(!q||W)return;let _=U();if(w!==void 0&&Object.is(w,_)&&!J)return;let j=()=>{if($(_,w),w=J?B5(_):_,Q)B()};if(G==="sync")j();else if(G==="post")queueMicrotask(j);else Promise.resolve().then(j)},z=null;if(l1(X))z=X.subscribe(()=>K());else z=XX(X).subscribe(()=>K());if(Y)w=void 0,K();else w=U();let B=()=>{if(q=!1,z)z(),z=null};return B.pause=()=>{W=!0},B.resume=()=>{W=!1},B}function Jw(X,$,Z={}){let{immediate:Y=!1,once:J=!1}=Z,G=X.map((K)=>l1(K)?K.value:void 0),Q=!0,w=!1,q=()=>{if(!Q||w)return;let K=X.map((z)=>l1(z)?z.value:void 0);if($(K,G),G=[...K],J)U()},W=X.map((K)=>{if(l1(K))return K.subscribe(()=>q());return()=>{}});if(Y)q();let U=()=>{Q=!1,W.forEach((K)=>K())};return U.pause=()=>{w=!0},U.resume=()=>{w=!1},U}function Gw(X,$={}){let{flush:Z="pre"}=$,Y,J=!0,G=!1,Q=()=>{if(!J||G)return;if(Y)Y();let q=U1;U1=Q,P8.push(Q);try{Y=X()}finally{P8.pop(),U1=q}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let w=()=>{if(J=!1,Y)Y()};return w.pause=()=>{G=!0},w.resume=()=>{G=!1},w}function Qw(X,$={},Z){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return X.replace(Y,(J,G,Q)=>{try{let q=Function(...Object.keys($),`return ${Q}`)(...Object.values($));return $[G]=q,`<!-- computed: ${G} = ${q} -->`}catch(w){return`<!-- computed error: ${G} - ${w} -->`}})}function ww(X,$={},Z){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return X.replace(Y,(J,G,Q)=>{return`
13938
13933
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
13939
13934
  (function() {
13940
13935
  // Watch implementation for ${G}
@@ -13946,9 +13941,9 @@ else {
13946
13941
  }
13947
13942
  })();
13948
13943
  </script>
13949
- `})}function _5(X){if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Z)=>_5(Z));if(X instanceof Date)return new Date(X.getTime());if(X instanceof Map){let Z=new Map;return X.forEach((Y,J)=>Z.set(_5(J),_5(Y))),Z}if(X instanceof Set){let Z=new Set;return X.forEach((Y)=>Z.add(_5(Y))),Z}let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=_5(X[Z]);return $}function aQ(X,$=100){let Z=e5(X()),Y=null,J=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{Z.value=X()},$)};return e7(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function tQ(X,$=100){let Z=e5(X()),Y=0,J=()=>{let Q=Date.now();if(Q-Y>=$)Y=Q,Z.value=X()};return e7(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var U1=null,P8,t7,GL;var Xw=D(()=>{P8=[],t7=new WeakMap;GL={ref:e5,computed:e7,watch:iQ,watchMultiple:nQ,watchEffect:rQ,isRef:l1,unref:lQ,toRefs:cQ,shallowRef:pQ,debouncedComputed:aQ,throttledComputed:tQ,processComputedDirectives:sQ,processWatchDirectives:oQ}});function XX(X,$){let Z={};for(let Y of X)Z[Y]=d1($(Y));return new Proxy({},{get:(Y,J)=>Z[J]?.(),set:(Y,J,G)=>{if(Z[J])Z[J].set(G);else Z[J]=d1(G);return!0},has:(Y,J)=>(J in Z),deleteProperty:(Y,J)=>{return delete Z[J],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(Y,J)=>(J in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[J]()}:void 0})}function QL(X,$){let Z={};for(let Y of $)Z[Y]=X[Y];return Z}function Q4(X,$){let Z=Object.keys(X),Y=XX(Z,(L)=>$?.[L]??X[L].getDefaultValue()),J=XX(Z,()=>[]),G=XX(Z,()=>!1),Q=XX(Z,()=>!1),w=XX(Z,()=>!1),q=d1(!1);async function W(L){w[L]=!0;let F=await X[L].validate(Y[L],Y);return J[L]=F,w[L]=!1,F.length===0}async function K(){q.set(!0);let L=await Promise.all(Z.map(W));return q.set(!1),L.every(Boolean)}function U(){for(let L of Z)Y[L]=$?.[L]??X[L].getDefaultValue(),J[L]=[],G[L]=!1,Q[L]=!1}function z(L){for(let F of Z)if(F in L)Y[F]=L[F],Q[F]=!0}function B(L,F){Y[L]=F,Q[L]=!0}function _(L,F=!0){if(G[L]=F,F)W(L)}function j(L){return{value:Y[L],errors:J[L],touched:G[L],dirty:Q[L],valid:J[L].length===0,validating:w[L]}}function H(L){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await K())await L(QL(Y,Z))}}return{values:Y,errors:J,touched:G,dirty:Q,get isValid(){return Z.every((L)=>J[L].length===0)},get isValidating(){return q()||Z.some((L)=>w[L])},get isDirty(){return Z.some((L)=>Q[L])},validate:K,validateField:W,reset:U,setValues:z,setFieldValue:B,setFieldTouched:_,getFieldState:j,handleSubmit:H}}var $w;var Zw=D(()=>{A8();$w=Q4});var Qw={};t(Qw,{v:()=>wL,useForm:()=>Q4,processHasErrorsDirective:()=>Gw,processFormValidationDirectives:()=>qL,processErrorsDirective:()=>Jw,processErrorDirective:()=>Yw,defineForm:()=>$w,Validator:()=>X7});class X7{rules=[];defaultValue="";addRule(X){let $=new X7;return $.rules=[...this.rules,X],$.defaultValue=this.defaultValue,$}required(X="This field is required"){return this.addRule({name:"required",message:X,validate:($)=>{if($===null||$===void 0)return X;if(typeof $==="string"&&$.trim()==="")return X;if(Array.isArray($)&&$.length===0)return X;return!0}})}email(X="Please enter a valid email"){return this.addRule({name:"email",message:X,validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||X}})}url(X="Please enter a valid URL"){return this.addRule({name:"url",message:X,validate:($)=>{if(!$)return!0;try{return new URL(String($)),!0}catch{return X}}})}min(X,$){let Z=$||`Must be at least ${X} characters`;return this.addRule({name:"min",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=X||Z}})}max(X,$){let Z=$||`Must be no more than ${X} characters`;return this.addRule({name:"max",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=X||Z}})}length(X,$,Z){let Y=Z||`Must be between ${X} and ${$} characters`;return this.addRule({name:"length",message:Y,validate:(J)=>{if(!J)return!0;let G=String(J).length;return G>=X&&G<=$||Y}})}pattern(X,$="Invalid format"){return this.addRule({name:"pattern",message:$,validate:(Z)=>{if(!Z)return!0;return X.test(String(Z))||$}})}hasUppercase(X="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,X)}hasLowercase(X="Must contain a lowercase letter"){return this.pattern(/[a-z]/,X)}hasNumber(X="Must contain a number"){return this.pattern(/\d/,X)}hasSpecial(X="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,X)}alphanumeric(X="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,X)}startsWithLetter(X="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,X)}noSpaces(X="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:X,validate:($)=>{if(!$)return!0;return!String($).includes(" ")||X}})}number(X="Must be a number"){let $=this.addRule({name:"number",message:X,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||X}});return $.defaultValue=0,$}integer(X="Must be a whole number"){return this.addRule({name:"integer",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number.isInteger(Number($))||X}})}positive(X="Must be a positive number"){return this.addRule({name:"positive",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)>0||X}})}negative(X="Must be a negative number"){return this.addRule({name:"negative",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)<0||X}})}minValue(X,$){let Z=$||`Must be at least ${X}`;return this.addRule({name:"minValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=X||Z}})}maxValue(X,$){let Z=$||`Must be no more than ${X}`;return this.addRule({name:"maxValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=X||Z}})}between(X,$,Z){let Y=Z||`Must be between ${X} and ${$}`;return this.addRule({name:"between",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;let G=Number(J);return G>=X&&G<=$||Y}})}matches(X,$){let Z=$||`Must match ${X}`;return this.addRule({name:"matches",message:Z,validate:(Y,J)=>{if(!J)return!0;return Y===J[X]||Z}})}oneOf(X,$){let Z=$||`Must be one of: ${X.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return X.includes(Y)||Z}})}notOneOf(X,$){let Z=$||`Cannot be one of: ${X.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return!X.includes(Y)||Z}})}date(X="Must be a valid date"){return this.addRule({name:"date",message:X,validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||X}})}before(X,$){let Z=new Date(X),Y=$||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Z||Y}})}after(X,$){let Z=new Date(X),Y=$||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Z||Y}})}custom(X,$="Invalid value"){return this.addRule({name:"custom",message:$,validate:X})}async(X,$="Invalid value"){return this.addRule({name:"async",message:$,async:!0,validate:X})}when(X,$){let Z=new X7;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let Y of $.getRules())Z.rules.push({...Y,validate:(J,G)=>{if(!X(J,G||{}))return!0;return Y.validate(J,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(X){let $=new X7;return $.rules=[...this.rules],$.defaultValue=X,$}async validate(X,$){let Z=[];for(let Y of this.rules){let J=await Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}validateSync(X,$){let Z=[];for(let Y of this.rules){if(Y.async)continue;let J=Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}}function Yw(X,$,Z){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),q=$;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((K)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,K)}).join(`
13950
- `)}catch{return""}})}function Jw(X,$,Z){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),q=$;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((K)=>Q.replace(/\{\{\s*message\s*\}\}/g,K)).join(`
13951
- `)}catch{return""}})}function Gw(X,$,Z){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),q=$;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return Q}catch{return""}})}function qL(X,$,Z){let Y=X;return Y=Yw(Y,$,Z),Y=Jw(Y,$,Z),Y=Gw(Y,$,Z),Y}var wL;var ww=D(()=>{Zw();wL=new X7});var Kw={};t(Kw,{processXElementDirectives:()=>WL,hasXElementDirectives:()=>Ww,generateXElementRuntime:()=>qw});function qw(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
13944
+ `})}function B5(X){if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Z)=>B5(Z));if(X instanceof Date)return new Date(X.getTime());if(X instanceof Map){let Z=new Map;return X.forEach((Y,J)=>Z.set(B5(J),B5(Y))),Z}if(X instanceof Set){let Z=new Set;return X.forEach((Y)=>Z.add(B5(Y))),Z}let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=B5(X[Z]);return $}function qw(X,$=100){let Z=X7(X()),Y=null,J=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{Z.value=X()},$)};return XX(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function Ww(X,$=100){let Z=X7(X()),Y=0,J=()=>{let Q=Date.now();if(Q-Y>=$)Y=Q,Z.value=X()};return XX(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var U1=null,P8,e7,HL;var Kw=D(()=>{P8=[],e7=new WeakMap;HL={ref:X7,computed:XX,watch:Yw,watchMultiple:Jw,watchEffect:Gw,isRef:l1,unref:Xw,toRefs:$w,shallowRef:Zw,debouncedComputed:qw,throttledComputed:Ww,processComputedDirectives:Qw,processWatchDirectives:ww}});function $X(X,$){let Z={};for(let Y of X)Z[Y]=d1($(Y));return new Proxy({},{get:(Y,J)=>Z[J]?.(),set:(Y,J,G)=>{if(Z[J])Z[J].set(G);else Z[J]=d1(G);return!0},has:(Y,J)=>(J in Z),deleteProperty:(Y,J)=>{return delete Z[J],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(Y,J)=>(J in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[J]()}:void 0})}function LL(X,$){let Z={};for(let Y of $)Z[Y]=X[Y];return Z}function _4(X,$){let Z=Object.keys(X),Y=$X(Z,(L)=>$?.[L]??X[L].getDefaultValue()),J=$X(Z,()=>[]),G=$X(Z,()=>!1),Q=$X(Z,()=>!1),w=$X(Z,()=>!1),q=d1(!1);async function W(L){w[L]=!0;let F=await X[L].validate(Y[L],Y);return J[L]=F,w[L]=!1,F.length===0}async function U(){q.set(!0);let L=await Promise.all(Z.map(W));return q.set(!1),L.every(Boolean)}function K(){for(let L of Z)Y[L]=$?.[L]??X[L].getDefaultValue(),J[L]=[],G[L]=!1,Q[L]=!1}function z(L){for(let F of Z)if(F in L)Y[F]=L[F],Q[F]=!0}function B(L,F){Y[L]=F,Q[L]=!0}function _(L,F=!0){if(G[L]=F,F)W(L)}function j(L){return{value:Y[L],errors:J[L],touched:G[L],dirty:Q[L],valid:J[L].length===0,validating:w[L]}}function H(L){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await U())await L(LL(Y,Z))}}return{values:Y,errors:J,touched:G,dirty:Q,get isValid(){return Z.every((L)=>J[L].length===0)},get isValidating(){return q()||Z.some((L)=>w[L])},get isDirty(){return Z.some((L)=>Q[L])},validate:U,validateField:W,reset:K,setValues:z,setFieldValue:B,setFieldTouched:_,getFieldState:j,handleSubmit:H}}var zw;var _w=D(()=>{A8();zw=_4});var Lw={};t(Lw,{v:()=>OL,useForm:()=>_4,processHasErrorsDirective:()=>Hw,processFormValidationDirectives:()=>FL,processErrorsDirective:()=>jw,processErrorDirective:()=>Bw,defineForm:()=>zw,Validator:()=>$7});class $7{rules=[];defaultValue="";addRule(X){let $=new $7;return $.rules=[...this.rules,X],$.defaultValue=this.defaultValue,$}required(X="This field is required"){return this.addRule({name:"required",message:X,validate:($)=>{if($===null||$===void 0)return X;if(typeof $==="string"&&$.trim()==="")return X;if(Array.isArray($)&&$.length===0)return X;return!0}})}email(X="Please enter a valid email"){return this.addRule({name:"email",message:X,validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||X}})}url(X="Please enter a valid URL"){return this.addRule({name:"url",message:X,validate:($)=>{if(!$)return!0;try{return new URL(String($)),!0}catch{return X}}})}min(X,$){let Z=$||`Must be at least ${X} characters`;return this.addRule({name:"min",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=X||Z}})}max(X,$){let Z=$||`Must be no more than ${X} characters`;return this.addRule({name:"max",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=X||Z}})}length(X,$,Z){let Y=Z||`Must be between ${X} and ${$} characters`;return this.addRule({name:"length",message:Y,validate:(J)=>{if(!J)return!0;let G=String(J).length;return G>=X&&G<=$||Y}})}pattern(X,$="Invalid format"){return this.addRule({name:"pattern",message:$,validate:(Z)=>{if(!Z)return!0;return X.test(String(Z))||$}})}hasUppercase(X="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,X)}hasLowercase(X="Must contain a lowercase letter"){return this.pattern(/[a-z]/,X)}hasNumber(X="Must contain a number"){return this.pattern(/\d/,X)}hasSpecial(X="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,X)}alphanumeric(X="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,X)}startsWithLetter(X="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,X)}noSpaces(X="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:X,validate:($)=>{if(!$)return!0;return!String($).includes(" ")||X}})}number(X="Must be a number"){let $=this.addRule({name:"number",message:X,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||X}});return $.defaultValue=0,$}integer(X="Must be a whole number"){return this.addRule({name:"integer",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number.isInteger(Number($))||X}})}positive(X="Must be a positive number"){return this.addRule({name:"positive",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)>0||X}})}negative(X="Must be a negative number"){return this.addRule({name:"negative",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)<0||X}})}minValue(X,$){let Z=$||`Must be at least ${X}`;return this.addRule({name:"minValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=X||Z}})}maxValue(X,$){let Z=$||`Must be no more than ${X}`;return this.addRule({name:"maxValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=X||Z}})}between(X,$,Z){let Y=Z||`Must be between ${X} and ${$}`;return this.addRule({name:"between",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;let G=Number(J);return G>=X&&G<=$||Y}})}matches(X,$){let Z=$||`Must match ${X}`;return this.addRule({name:"matches",message:Z,validate:(Y,J)=>{if(!J)return!0;return Y===J[X]||Z}})}oneOf(X,$){let Z=$||`Must be one of: ${X.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return X.includes(Y)||Z}})}notOneOf(X,$){let Z=$||`Cannot be one of: ${X.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return!X.includes(Y)||Z}})}date(X="Must be a valid date"){return this.addRule({name:"date",message:X,validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||X}})}before(X,$){let Z=new Date(X),Y=$||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Z||Y}})}after(X,$){let Z=new Date(X),Y=$||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Z||Y}})}custom(X,$="Invalid value"){return this.addRule({name:"custom",message:$,validate:X})}async(X,$="Invalid value"){return this.addRule({name:"async",message:$,async:!0,validate:X})}when(X,$){let Z=new $7;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let Y of $.getRules())Z.rules.push({...Y,validate:(J,G)=>{if(!X(J,G||{}))return!0;return Y.validate(J,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(X){let $=new $7;return $.rules=[...this.rules],$.defaultValue=X,$}async validate(X,$){let Z=[];for(let Y of this.rules){let J=await Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}validateSync(X,$){let Z=[];for(let Y of this.rules){if(Y.async)continue;let J=Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}}function Bw(X,$,Z){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),q=$;for(let U of w)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
13945
+ `)}catch{return""}})}function jw(X,$,Z){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),q=$;for(let U of w)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>Q.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
13946
+ `)}catch{return""}})}function Hw(X,$,Z){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return X.replace(Y,(J,G,Q)=>{try{let w=G.trim().split("."),q=$;for(let U of w)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return Q}catch{return""}})}function FL(X,$,Z){let Y=X;return Y=Bw(Y,$,Z),Y=jw(Y,$,Z),Y=Hw(Y,$,Z),Y}var OL;var Ow=D(()=>{_w();OL=new $7});var Aw={};t(Aw,{processXElementDirectives:()=>VL,hasXElementDirectives:()=>Vw,generateXElementRuntime:()=>Fw});function Fw(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
13952
13947
  (function() {
13953
13948
  'use strict';
13954
13949
 
@@ -14232,16 +14227,16 @@ else {
14232
14227
  // Expose for manual initialization
14233
14228
  window.XElement = XElement;
14234
14229
  })();
14235
- </script>`}function Ww(X){return/\bx-data(?:\s|=)/.test(X)}function WL(X){let $=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=X.match($)||[],Y=Z.length>0?X.replace($,""):X;if(!Ww(Y))return Y;let J=Z[0]?.trim()||qw(),G=Y.lastIndexOf("</body>");if(G!==-1)return Y.slice(0,G)+J+`
14230
+ </script>`}function Vw(X){return/\bx-data(?:\s|=)/.test(X)}function VL(X){let $=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=X.match($)||[],Y=Z.length>0?X.replace($,""):X;if(!Vw(Y))return Y;let J=Z[0]?.trim()||Fw(),G=Y.lastIndexOf("</body>");if(G!==-1)return Y.slice(0,G)+J+`
14236
14231
  `+Y.slice(G);return Y+`
14237
- `+J}var Uw={};t(Uw,{rewriteImagesWithSiblings:()=>zL});import T1 from"path";async function zL(X,$){let Z=$.formats??UL;if(!$.publicDir)return X;let Y=jL(X),J=[],G=/<img\b[^>]*?>/gi,Q=[],w;while((w=G.exec(X))!==null){let U=w[0],z=U.match(/\bsrc=["']([^"']+)["']/i);if(!z)continue;if(HL(w.index,Y))continue;Q.push({idx:w.index,length:U.length,src:z[1],raw:U})}if(Q.length===0)return X;let q=await Promise.all(Q.map(async(U)=>{let z=await _L(U.src,$.publicDir,Z);return{match:U,sources:z}}));for(let{match:U,sources:z}of q){if(z.length===0)continue;let _=`<picture>${z.map((j)=>`<source type="${j.mime}" srcset="${LL(j.url)}">`).join("")}${U.raw}</picture>`;J.push({start:U.idx,end:U.idx+U.length,replacement:_})}if(J.length===0)return X;let W="",K=0;for(let U of J)W+=X.slice(K,U.start),W+=U.replacement,K=U.end;return W+=X.slice(K),W}async function _L(X,$,Z){if(!BL(X))return[];let Y=T1.extname(X).toLowerCase();if(!KL.has(Y))return[];if(!X.startsWith("/"))return[];let J=T1.join($,X.slice(1)),G=T1.dirname(J),Q=T1.basename(J,Y),w=T1.resolve(G),q=T1.resolve($);if(!w.startsWith(q))return[];let W=T1.posix.dirname(X),K=Z.map(async(z)=>{let B=T1.join(G,`${Q}${z.ext}`);if(!await Bun.file(B).exists())return null;return{url:T1.posix.join(W,`${Q}${z.ext}`),mime:z.mime}});return(await Promise.all(K)).filter((z)=>z!==null)}function BL(X){if(!X)return!1;if(X.startsWith("http://")||X.startsWith("https://"))return!1;if(X.startsWith("//"))return!1;if(X.startsWith("data:"))return!1;return!0}function jL(X){let $=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);return $}function HL(X,$){for(let[Z,Y]of $)if(X>=Z&&X<Y)return!0;return!1}function LL(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var KL,UL;var zw=D(()=>{KL=new Set([".jpg",".jpeg",".png",".gif"]),UL=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var _w=()=>{};function w4(X){return X.pwa?.serviceWorker?.fileName||"sw.js"}var Bw=D(()=>{_w()});var jw={};t(jw,{injectPwaTags:()=>OL,generateThemeColorMeta:()=>AL,generateSwRegistrationScript:()=>FL,generatePwaTags:()=>v8,generateManifestLink:()=>VL});function v8(X){let $=X.pwa;if(!$?.enabled)return"";let Z=$.manifest,Y=$.icons?.outputDir?`/${$.icons.outputDir}`:"/pwa-icons",J=w4(X),G=`
14232
+ `+J}var Rw={};t(Rw,{rewriteImagesWithSiblings:()=>TL});import R1 from"path";async function TL(X,$){let Z=$.formats??RL;if(!$.publicDir)return X;let Y=kL(X),J=[],G=/<img\b[^>]*?>/gi,Q=[],w;while((w=G.exec(X))!==null){let K=w[0],z=K.match(/\bsrc=["']([^"']+)["']/i);if(!z)continue;if(IL(w.index,Y))continue;Q.push({idx:w.index,length:K.length,src:z[1],raw:K})}if(Q.length===0)return X;let q=await Promise.all(Q.map(async(K)=>{let z=await ML(K.src,$.publicDir,Z);return{match:K,sources:z}}));for(let{match:K,sources:z}of q){if(z.length===0)continue;let _=`<picture>${z.map((j)=>`<source type="${j.mime}" srcset="${EL(j.url)}">`).join("")}${K.raw}</picture>`;J.push({start:K.idx,end:K.idx+K.length,replacement:_})}if(J.length===0)return X;let W="",U=0;for(let K of J)W+=X.slice(U,K.start),W+=K.replacement,U=K.end;return W+=X.slice(U),W}async function ML(X,$,Z){if(!NL(X))return[];let Y=R1.extname(X).toLowerCase();if(!AL.has(Y))return[];if(!X.startsWith("/"))return[];let J=R1.join($,X.slice(1)),G=R1.dirname(J),Q=R1.basename(J,Y),w=R1.resolve(G),q=R1.resolve($);if(!w.startsWith(q))return[];let W=R1.posix.dirname(X),U=Z.map(async(z)=>{let B=R1.join(G,`${Q}${z.ext}`);if(!await Bun.file(B).exists())return null;return{url:R1.posix.join(W,`${Q}${z.ext}`),mime:z.mime}});return(await Promise.all(U)).filter((z)=>z!==null)}function NL(X){if(!X)return!1;if(X.startsWith("http://")||X.startsWith("https://"))return!1;if(X.startsWith("//"))return!1;if(X.startsWith("data:"))return!1;return!0}function kL(X){let $=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);return $}function IL(X,$){for(let[Z,Y]of $)if(X>=Z&&X<Y)return!0;return!1}function EL(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var AL,RL;var Tw=D(()=>{AL=new Set([".jpg",".jpeg",".png",".gif"]),RL=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var Mw=()=>{};function B4(X){return X.pwa?.serviceWorker?.fileName||"sw.js"}var Nw=D(()=>{Mw()});var kw={};t(kw,{injectPwaTags:()=>DL,generateThemeColorMeta:()=>SL,generateSwRegistrationScript:()=>yL,generatePwaTags:()=>v8,generateManifestLink:()=>bL});function v8(X){let $=X.pwa;if(!$?.enabled)return"";let Z=$.manifest,Y=$.icons?.outputDir?`/${$.icons.outputDir}`:"/pwa-icons",J=B4(X),G=`
14238
14233
  <!-- stx PWA Meta Tags -->
14239
14234
  <link rel="manifest" href="/manifest.json">
14240
- <meta name="theme-color" content="${q4(Z?.themeColor||"#000000")}">
14235
+ <meta name="theme-color" content="${j4(Z?.themeColor||"#000000")}">
14241
14236
  <meta name="mobile-web-app-capable" content="yes">
14242
14237
  <meta name="apple-mobile-web-app-capable" content="yes">
14243
14238
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
14244
- <meta name="apple-mobile-web-app-title" content="${q4(Z?.shortName||Z?.name||"App")}">`;if($.icons?.generateAppleIcons!==!1)G+=`
14239
+ <meta name="apple-mobile-web-app-title" content="${j4(Z?.shortName||Z?.name||"App")}">`;if($.icons?.generateAppleIcons!==!1)G+=`
14245
14240
  <link rel="apple-touch-icon" href="${Y}/apple-touch-icon.png">
14246
14241
  <link rel="apple-touch-icon" sizes="120x120" href="${Y}/apple-touch-icon-120x120.png">
14247
14242
  <link rel="apple-touch-icon" sizes="152x152" href="${Y}/apple-touch-icon-152x152.png">
@@ -14278,12 +14273,12 @@ if ('serviceWorker' in navigator) {
14278
14273
  });
14279
14274
  }
14280
14275
  </script>
14281
- <!-- End stx PWA -->`,G}function OL(X,$){let Z=$.pwa;if(!Z?.enabled||Z.autoInject===!1)return X;if(X.includes("<!-- stx PWA Meta Tags -->"))return X;if(!X.includes("</head>")){let J=X.lastIndexOf("</body>");if(J!==-1){let G=v8($);return X.slice(0,J)+G+`
14276
+ <!-- End stx PWA -->`,G}function DL(X,$){let Z=$.pwa;if(!Z?.enabled||Z.autoInject===!1)return X;if(X.includes("<!-- stx PWA Meta Tags -->"))return X;if(!X.includes("</head>")){let J=X.lastIndexOf("</body>");if(J!==-1){let G=v8($);return X.slice(0,J)+G+`
14282
14277
  `+X.slice(J)}return X+v8($)}let Y=v8($);return X.replace("</head>",`${Y}
14283
- </head>`)}function FL(X){if(!X.pwa?.enabled)return"";return`<script>
14278
+ </head>`)}function yL(X){if(!X.pwa?.enabled)return"";return`<script>
14284
14279
  if ('serviceWorker' in navigator) {
14285
14280
  window.addEventListener('load', function() {
14286
- navigator.serviceWorker.register('/${w4(X)}')
14281
+ navigator.serviceWorker.register('/${B4(X)}')
14287
14282
  .then(function(registration) {
14288
14283
  console.log('[PWA] Service Worker registered:', registration.scope);
14289
14284
  })
@@ -14292,46 +14287,46 @@ if ('serviceWorker' in navigator) {
14292
14287
  });
14293
14288
  });
14294
14289
  }
14295
- </script>`}function VL(){return'<link rel="manifest" href="/manifest.json">'}function AL(X){return`<meta name="theme-color" content="${q4(X)}">`}function q4(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Hw=D(()=>{Bw()});import RL from"fs";import E0 from"path";function Lw(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function TL(X,$){let Z=X.length,Y=$,J=!0,G=[],Q=(w)=>w+9<=Z&&X[w]==="<"&&X[w+1]==="/"&&(X[w+2]==="s"||X[w+2]==="S")&&(X[w+3]==="c"||X[w+3]==="C")&&(X[w+4]==="r"||X[w+4]==="R")&&(X[w+5]==="i"||X[w+5]==="I")&&(X[w+6]==="p"||X[w+6]==="P")&&(X[w+7]==="t"||X[w+7]==="T")&&(X[w+8]===">"||/\s/.test(X[w+8]));while(Y<Z){let w=X[Y];if(Q(Y))return Y;if(w==="/"&&X[Y+1]==="/"){if(Y=X.indexOf(`
14296
- `,Y+2),Y===-1)return-1;Y+=1,J=!0;continue}if(w==="/"&&X[Y+1]==="*"){let q=X.indexOf("*/",Y+2);if(q===-1)return-1;Y=q+2,J=!0;continue}if(w==="/"&&J){let q=Y+1,W=!1;while(q<Z){let K=X[q];if(K==="\\"){q+=2;continue}if(K==="[")W=!0;else if(K==="]")W=!1;else if(K==="/"&&!W){q++;break}else if(K===`
14290
+ </script>`}function bL(){return'<link rel="manifest" href="/manifest.json">'}function SL(X){return`<meta name="theme-color" content="${j4(X)}">`}function j4(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var Iw=D(()=>{Nw()});import CL from"fs";import E0 from"path";function Ew(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function PL(X,$){let Z=X.length,Y=$,J=!0,G=[],Q=(w)=>w+9<=Z&&X[w]==="<"&&X[w+1]==="/"&&(X[w+2]==="s"||X[w+2]==="S")&&(X[w+3]==="c"||X[w+3]==="C")&&(X[w+4]==="r"||X[w+4]==="R")&&(X[w+5]==="i"||X[w+5]==="I")&&(X[w+6]==="p"||X[w+6]==="P")&&(X[w+7]==="t"||X[w+7]==="T")&&(X[w+8]===">"||/\s/.test(X[w+8]));while(Y<Z){let w=X[Y];if(Q(Y))return Y;if(w==="/"&&X[Y+1]==="/"){if(Y=X.indexOf(`
14291
+ `,Y+2),Y===-1)return-1;Y+=1,J=!0;continue}if(w==="/"&&X[Y+1]==="*"){let q=X.indexOf("*/",Y+2);if(q===-1)return-1;Y=q+2,J=!0;continue}if(w==="/"&&J){let q=Y+1,W=!1;while(q<Z){let U=X[q];if(U==="\\"){q+=2;continue}if(U==="[")W=!0;else if(U==="]")W=!1;else if(U==="/"&&!W){q++;break}else if(U===`
14297
14292
  `){q=-1;break}q++}if(q===-1){Y++,J=!1;continue}while(q<Z&&/[a-z]/.test(X[q]))q++;Y=q,J=!1;continue}if(w==="'"||w==='"'){let q=w;Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===q){Y++;break}if(X[Y]===`
14298
- `)break;Y++}J=!1;continue}if(w==="`"){Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}if(G.length===0)J=!1;continue}if(w==="}"&&G.length>0){G.pop(),Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++,J=!1;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))J=!1;else J=!0;Y++}return-1}function $7(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec(X);if(!Y)return null;let J=Y.index+Y[0].length,G=X.indexOf("</script>",J);if(G===-1)return null;let Q=X.indexOf(">",G);if(Q===-1)return null;return{start:Y.index,end:Q+1}}function Ow(X){let $=0;while($<X.length){let Z=X.indexOf("<",$);if(Z===-1)return-1;if(X.startsWith("<!--",Z)){let G=X.indexOf("-->",Z+4);$=G===-1?X.length:G+3;continue}let Y=X.slice(Z),J=/^<style\b[^>]*>/i.exec(Y);if(J){let G=X.toLowerCase().indexOf("</style>",Z+J[0].length);$=G===-1?X.length:G+8;continue}if(/^<script\b[^>]*>/i.test(Y))return Z;$=Z+1}return-1}function ML(X){let $=$7(X,"data-stx-runtime");if(!$)return X;let Z=Ow(X);if(Z===-1||Z===$.start)return X;let Y=X.slice($.start,$.end),J=X.slice(0,$.start)+X.slice($.end),G=Ow(J);if(G===-1)return Y+`
14293
+ `)break;Y++}J=!1;continue}if(w==="`"){Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}if(G.length===0)J=!1;continue}if(w==="}"&&G.length>0){G.pop(),Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++,J=!1;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))J=!1;else J=!0;Y++}return-1}function Z7(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec(X);if(!Y)return null;let J=Y.index+Y[0].length,G=X.indexOf("</script>",J);if(G===-1)return null;let Q=X.indexOf(">",G);if(Q===-1)return null;return{start:Y.index,end:Q+1}}function Dw(X){let $=0;while($<X.length){let Z=X.indexOf("<",$);if(Z===-1)return-1;if(X.startsWith("<!--",Z)){let G=X.indexOf("-->",Z+4);$=G===-1?X.length:G+3;continue}let Y=X.slice(Z),J=/^<style\b[^>]*>/i.exec(Y);if(J){let G=X.toLowerCase().indexOf("</style>",Z+J[0].length);$=G===-1?X.length:G+8;continue}if(/^<script\b[^>]*>/i.test(Y))return Z;$=Z+1}return-1}function vL(X){let $=Z7(X,"data-stx-runtime");if(!$)return X;let Z=Dw(X);if(Z===-1||Z===$.start)return X;let Y=X.slice($.start,$.end),J=X.slice(0,$.start)+X.slice($.end),G=Dw(J);if(G===-1)return Y+`
14299
14294
  `+J;return J.slice(0,G)+Y+`
14300
- `+J.slice(G)}async function V0(X,$,Z,Y,J){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return X;if($.__stx_signals_gate===void 0)$.__stx_signals_gate=L1(X);let G=!$.__stxProcessingDepth;if(G)C6($);if(!$.__stxProcessingDepth)$.__stxProcessingDepth=0;if($.__stxProcessingDepth++,!$.__onceStore)$.__onceStore=new Set;if((Y.debug||!C7()&&!CX())&&Z&&Z.endsWith(".stx"))x9(X,Z);try{return await ZZ.timeAsync("template-processing",async()=>{let Q=await NL(X,$,Z,Y,J);if(G)Q=o3(Q);if(G&&Y.autoShell&&Y.buildMode!=="compile"){let w=Y.app?.head||{},W=($.__stx_runtime_head||null)??A9(),K=($.__stx_head_raw||"").trim(),U,z=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(z)U=z[1].trim(),K=K.replace(z[0],"").trim();let B=$.__sections?.title,_=W.title||U||B,j=!W.title&&(!!U||!!B),H={...w,..._&&{title:_},meta:[...w.meta||[],...W.meta||[]],link:[...w.link||[],...W.link||[]],script:[...w.script||[],...W.script||[]],headRaw:[w.headRaw,K].filter(Boolean).join(`
14301
- `),...W.htmlAttrs&&{htmlAttrs:WG(w.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...W.bodyAttrs}}},O=C3(Q);if(Q=_G(Q,H,{...j&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),O)Q=zG(Q,w),Q=KG(Q,H.htmlAttrs);let L=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&Q.includes("<head")){let A=L[1],R=L7(A);Q=Q.replace(/<head\b[^>]*>/i,(T)=>`${T}
14302
- <meta name="stx-layout" content="${Lw(A)}">
14303
- <meta name="stx-layout-group" content="${Lw(R)}">`)}let F=Q.match(/function (__stx_setup_\d+_\d+)\(/),V=F?yX(Q):null;if(F&&V&&!/\bdata-stx=/.test(V.tag)){Q=Q9(Q,(R,T)=>`<body${T} data-stx="${F[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${F[1]}"`,"i");Q=Q.replace(A,"$1")}}if(G){Q=UG(Q);let w=Y.app?.colorMode;if(w)Q=JG(Q,w);Q=QG(Q),Q=ML(Q)}if(G)try{let{getStoreScript:w}=await e("stx/store-loader",()=>Promise.resolve().then(() => (oG(),sG))),q=Y.storesDir,W=await w(q);if(W){let K=`<script data-stx-stores>${W}</script>`,U=$7(Q,"data-stx-runtime");if(U)Q=Q.slice(0,U.end)+`
14304
- `+K+Q.slice(U.end)}}catch{}if(G)try{let{getFrameworkComposableScript:w}=await e("stx/framework-composables",()=>Promise.resolve().then(() => ($Q(),XQ))),q=await w(Q);if(q){let W=$7(Q,"data-stx-stores")||$7(Q,"data-stx-runtime");if(W)Q=Q.slice(0,W.end)+`
14305
- `+q+Q.slice(W.end)}}catch{}if(G)try{let{getComposableScript:w}=await e("stx/composable-loader",()=>Promise.resolve().then(() => (JQ(),YQ))),q=Y.composablesDir,W=await w(q);if(W){let K=`<script data-stx-composables>${W}</script>`,U=$7(Q,"data-stx-stores")||$7(Q,"data-stx-runtime");if(U)Q=Q.slice(0,U.end)+`
14306
- `+K+Q.slice(U.end)}}catch{}if(G)Q=GG(Q);if(G&&$.__stx_inject_css!==!1)Q=await J9(Q,void 0,Y.buildMode==="serve");if(G)Q=YG(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof fX)throw Q;let w=Q instanceof Error?Q.message:String(Q),q=new Y5(`Template processing failed: ${w}`,Z,void 0,void 0,X.substring(0,200)+(X.length>200?"...":""));if($1.log(q,{filePath:Z,context:$}),j9.logDetailedError(q,{filePath:Z,template:X.substring(0,500)}),Y.debug)throw q;return _9.createFallbackContent("Template Processing",q)}}async function NL(X,$,Z,Y,J){let G=process.cwd(),Q={...Y,partialsDir:Y.partialsDir&&!E0.isAbsolute(Y.partialsDir)?E0.resolve(G,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!E0.isAbsolute(Y.componentsDir)?E0.resolve(G,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!E0.isAbsolute(Y.layoutsDir)?E0.resolve(G,Y.layoutsDir):Y.layoutsDir},w=Q,q=X;await EL(Z,$),IL($,w),q=await v5(()=>DJ(q,$,Z,w),q,(F)=>{$1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=Q1(q,E7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let K=W.tokens,U=(F)=>K.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>K[Number(A)]??""),z="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,z),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),q=iJ(q),q=await cG(q,Z,J);let B={};q=F3(q,B);let _={...$.__sections||{}},j="",H=RZ(AZ(X)),O=/@nolayout\b/.test(q)||H===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let L=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)j=L[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(j=H,!/@section\s*\(/.test(q))q=`@section('content')
14295
+ `+J.slice(G)}async function V0(X,$,Z,Y,J){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return X;if($.__stx_signals_gate===void 0)$.__stx_signals_gate=H1(X);let G=!$.__stxProcessingDepth;if(G)h6($);if(!$.__stxProcessingDepth)$.__stxProcessingDepth=0;if($.__stxProcessingDepth++,!$.__onceStore)$.__onceStore=new Set;if((Y.debug||!v7()&&!PX())&&Z&&Z.endsWith(".stx"))x9(X,Z);try{return await qZ.timeAsync("template-processing",async()=>{let Q=await xL(X,$,Z,Y,J);if(G)Q=Y4(Q);if(G&&Y.autoShell&&Y.buildMode!=="compile"){let w=Y.app?.head||{},W=($.__stx_runtime_head||null)??A9(),U=($.__stx_head_raw||"").trim(),K,z=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(z)K=z[1].trim(),U=U.replace(z[0],"").trim();let B=$.__sections?.title,_=W.title||K||B,j=!W.title&&(!!K||!!B),H={...w,..._&&{title:_},meta:[...w.meta||[],...W.meta||[]],link:[...w.link||[],...W.link||[]],script:[...w.script||[],...W.script||[]],headRaw:[w.headRaw,U].filter(Boolean).join(`
14296
+ `),...W.htmlAttrs&&{htmlAttrs:HG(w.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...W.bodyAttrs}}},O=C3(Q);if(Q=VG(Q,H,{...j&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),O)Q=FG(Q,w),Q=LG(Q,H.htmlAttrs);let L=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&Q.includes("<head")){let A=L[1],R=O7(A);Q=Q.replace(/<head\b[^>]*>/i,(T)=>`${T}
14297
+ <meta name="stx-layout" content="${Ew(A)}">
14298
+ <meta name="stx-layout-group" content="${Ew(R)}">`)}let F=Q.match(/function (__stx_setup_\d+_\d+)\(/),V=F?P7(Q):null;if(F&&V&&!/\bdata-stx=/.test(V.tag)){Q=bX(Q,(R,T)=>`<body${T} data-stx="${F[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${F[1]}"`,"i");Q=Q.replace(A,"$1")}}if(G){Q=OG(Q);let w=Y.app?.colorMode;if(w)Q=KG(Q,w);Q=_G(Q),Q=vL(Q)}if(G)try{let{getStoreScript:w}=await e("stx/store-loader",()=>Promise.resolve().then(() => (wQ(),QQ))),q=Y.storesDir,W=await w(q);if(W){let U=`<script data-stx-stores>${W}</script>`,K=Z7(Q,"data-stx-runtime");if(K)Q=Q.slice(0,K.end)+`
14299
+ `+U+Q.slice(K.end)}}catch{}if(G)try{let{getFrameworkComposableScript:w}=await e("stx/framework-composables",()=>Promise.resolve().then(() => (zQ(),KQ))),q=await w(Q);if(q){let W=Z7(Q,"data-stx-stores")||Z7(Q,"data-stx-runtime");if(W)Q=Q.slice(0,W.end)+`
14300
+ `+q+Q.slice(W.end)}}catch{}if(G)try{let{getComposableScript:w}=await e("stx/composable-loader",()=>Promise.resolve().then(() => (jQ(),BQ))),q=Y.composablesDir,W=await w(q);if(W){let U=`<script data-stx-composables>${W}</script>`,K=Z7(Q,"data-stx-stores")||Z7(Q,"data-stx-runtime");if(K)Q=Q.slice(0,K.end)+`
14301
+ `+U+Q.slice(K.end)}}catch{}if(G)Q=zG(Q);if(G&&$.__stx_inject_css!==!1)Q=await J9(Q,void 0,Y.buildMode==="serve");if(G)Q=UG(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof gX)throw Q;let w=Q instanceof Error?Q.message:String(Q),q=new Y5(`Template processing failed: ${w}`,Z,void 0,void 0,X.substring(0,200)+(X.length>200?"...":""));if(X1.log(q,{filePath:Z,context:$}),j9.logDetailedError(q,{filePath:Z,template:X.substring(0,500)}),Y.debug)throw q;return _9.createFallbackContent("Template Processing",q)}}async function xL(X,$,Z,Y,J){let G=process.cwd(),Q={...Y,partialsDir:Y.partialsDir&&!E0.isAbsolute(Y.partialsDir)?E0.resolve(G,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!E0.isAbsolute(Y.componentsDir)?E0.resolve(G,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!E0.isAbsolute(Y.layoutsDir)?E0.resolve(G,Y.layoutsDir):Y.layoutsDir},w=Q,q=X;await hL(Z,$),gL($,w),q=await x5(()=>xJ(q,$,Z,w),q,(F)=>{X1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=G1(q,D7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,K=(F)=>U.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>U[Number(A)]??""),z="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,z),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),q=eJ(q),q=await $Q(q,Z,J);let B={};q=F3(q,B);let _={...$.__sections||{}},j="",H=DZ(EZ(X)),O=/@nolayout\b/.test(q)||H===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let L=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)j=L[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(j=H,!/@section\s*\(/.test(q))q=`@section('content')
14307
14302
  ${q.trim()}
14308
14303
  @endsection`}if(!j&&!O&&w.defaultLayout){let F=S3(q),V=/@section\s*\(/.test(q);if(!F||V){let A="",R=E0.dirname(Z),T=w.layoutsDir?E0.dirname(w.layoutsDir):process.cwd();for(let M=0;M<20;M++){let k=E0.join(R,"_layout.stx");if(await i(k)){A=k;break}let N=E0.dirname(R);if(N===R||N.length<T.length)break;R=N}if(A)j=A;else if(w.layoutsDir){let M=E0.isAbsolute(w.layoutsDir)?w.layoutsDir:E0.resolve(process.cwd(),w.layoutsDir),k=E0.join(M,`${w.defaultLayout}.stx`);if(await i(k))j=k}if(j&&!V)q=`@section('content')
14309
14304
  ${q.trim()}
14310
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return _[V]=A,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=Y0(A.trim(),$);if(R===void 0)return F;return _[V]=String(R??""),""}catch{return F}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))_[V]=A.replace("@parent",B5);else _[V]=A.trim();return""}),$.__sections=_,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return _[V]||A||""}),!("slot"in $)||$.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""});if(q=V3(q,B),j){let F=[],V=y1(q),A=Q1(V.output,y5,(R,T)=>`\x00STX_ORPHAN_STYLE_${T}\x00`);if(q=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,T,M)=>{let k=T==="SCRIPT"?V.scripts[Number(M)]:A.tokens[Number(M)];if(k)F.push(k);return""}),F.length>0){let R=F.join(`
14305
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return _[V]=A,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=Y0(A.trim(),$);if(R===void 0)return F;return _[V]=String(R??""),""}catch{return F}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))_[V]=A.replace("@parent",j5);else _[V]=A.trim();return""}),$.__sections=_,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return _[V]||A||""}),!("slot"in $)||$.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""});if(q=V3(q,B),j){let F=[],V=y1(q),A=G1(V.output,b5,(R,T)=>`\x00STX_ORPHAN_STYLE_${T}\x00`);if(q=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,T,M)=>{let k=T==="SCRIPT"?V.scripts[Number(M)]:A.tokens[Number(M)];if(k)F.push(k);return""}),F.length>0){let R=F.join(`
14311
14306
  `);_.content=_.content?`${_.content}
14312
- ${R}`:R,$.__sections=_}}if(j)try{let F;if(E0.isAbsolute(j))F=j,J.add(j);else F=await v5(()=>W4(j,Z,Q,J),null,()=>{throw new Y5(`Failed to resolve layout path: ${j}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let k=[];try{let y=Q.layoutsDir;if(y){let I=E0.isAbsolute(y)?y:E0.resolve(process.cwd(),y);k=RL.readdirSync(I).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,"")).sort()}}catch{}let N=`Layout not found: ${j} (referenced from ${Z})`+(k.length>0?`. Available layouts: ${k.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if($1.log(Error(N),{layoutPath:j,filePath:Z,available:k},"error"),console.error(`[stx] ${N}`),Q.debug)throw new Y5(N,Z);return q}let V=await v5(()=>Bun.file(F).text(),"",()=>{throw new Y5(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let k={},N=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(C,S,b)=>{return k[S]=b.trim(),""});for(let[C,S]of Object.entries(k))if(_[C]&&_[C].includes(B5)){let b=_[C].indexOf(B5);_[C]=_[C].slice(0,b)+S+_[C].slice(b+B5.length)}else if(!_[C])_[C]=S;let y={...$,__sections:_},I=`@layout('${A[1]}')${N}`;return await V0(I,y,F,Q,J)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),T=F3(R,B),M={};return T=T.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,N,y)=>{return M[N]=y.trim(),`@slot('${N}')`}),T=T.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,N,y)=>{if(_[N]){let I=_[N];if(I.includes(B5)){let C=M[N]||"",S=I.indexOf(B5);I=I.slice(0,S)+C+I.slice(S+B5.length)}return I}return y||""}),T=kL(T,_),T=T.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""}),T=V3(T,B),$.__originalFilePath=Z,q=await Fw(T,$,F,Q,J),q=`<!-- stx-layout: ${j} -->
14313
- ${q}`,U(q)}catch(F){return $1.log(F instanceof Error?F:Error(String(F)),{layoutPath:j,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return U(await Fw(q,$,Z,Q,J))}function kL(X,$){return X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,Y,J)=>{let G=$[Y];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return J||""})}function IL(X,$){if(X.__stx_sfc_mode=!0,X.__stx_options=$,$.buildMode)X.__stx_buildMode=$.buildMode;let Z=$.envPrefix||"STX_PUBLIC_",Y={};for(let[J,G]of Object.entries(process.env))if(J.startsWith(Z)&&G!==void 0)Y[J]=G;X.$env=Y}async function EL(X,$){await v5(()=>uJ(X,$),void 0,(Z)=>{$1.log(Z,{filePath:X,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${X}: ${Z.message}`)})}async function DL(X,$,Z){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:q}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (p5(),G8)));await q(Q,$,Z,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));$1.log(W,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${W.message}`)}}}async function yL(X,$,Z){try{let{interpolateScriptsInTemplate:Y}=await e("stx/expressions",()=>Promise.resolve().then(() => (w1(),e6)));return Y(X,$,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return $1.log(J,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${J.message}`),X}}async function Fw(X,$,Z,Y,J){let G=X,Q=Y;if(await DL(G,$,Z),G=await yL(G,$,Z),G=await TJ(G,$,Z),G=await MJ(G,$,Z),G=await aZ(G,$,Z,Q),L1(G))G=c3(G,$),G=i3(G,$);G=p3(G);let{processStreamDirectives:w}=await e("stx/streaming",()=>Promise.resolve().then(() => (v9(),P9)));G=w(G,$),G=j3(G,$,Z,Q),G=await aJ(G,$,Z,Q,J),G=await J8(G,$,Z,Q,J),G=k2(G,$,Z,Q);let{processDeferDirectives:q}=await e("stx/defer",()=>Promise.resolve().then(() => QQ));G=q(G,$,Z);let{processTeleportDirectives:W}=await e("stx/teleport",()=>Promise.resolve().then(() => qQ));G=W(G,$,Z);let{processTransitionDirectives:K,processTransitionAttributes:U}=await e("stx/transitions",()=>Promise.resolve().then(() => zQ));G=K(G,$,Z),G=U(G);let{processErrorBoundaryDirectives:z}=await e("stx/error-boundaries",()=>Promise.resolve().then(() => BQ));G=z(G,$,Z);let{processSuspenseDirectives:B}=await e("stx/suspense",()=>Promise.resolve().then(() => jQ));G=B(G,$,Z);let{processAsyncDirectives:_}=await e("stx/async-components",()=>Promise.resolve().then(() => FQ));G=_(G,$,Z);let{processKeepAliveDirectives:j}=await e("stx/keep-alive",()=>Promise.resolve().then(() => AQ));G=j(G,$,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:O,processInfiniteListDirectives:L}=await e("stx/virtual-scrolling",()=>Promise.resolve().then(() => (IQ(),kQ)));G=H(G,$,Z),G=O(G,$,Z),G=L(G,$,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await e("stx/partial-hydration",()=>Promise.resolve().then(() => (mQ(),dQ)));G=F(G,$,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await e("stx/computed",()=>Promise.resolve().then(() => (Xw(),eQ)));G=A(G,$,Z),G=R(G,$,Z);let{processFormValidationDirectives:T}=await e("stx/forms-validation",()=>Promise.resolve().then(() => (ww(),Qw)));G=T(G,$,Z);let{processHeadDirective:M,processTitleDirective:k,processMetaDirective:N,resetHead:y}=await e("stx/head",()=>Promise.resolve().then(() => (x7(),T9)));if(!$.__stx_head_preset&&!$.__stx_runtime_head)y();let I=M(G);if(G=I.content,I.headContent)$.__stx_head_raw=`${$.__stx_head_raw||""}${I.headContent}
14314
- `;if(G=k(G,$),G=N(G,$),G=SJ(G),G=L9(G,$),G=sZ(G),G=IJ(G),G=await O3(G,$,Z,Q,J),G=await J8(G,$,Z,Q,J),$.__stxProcessingDepth===1)G=v6(G,$);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=o3(G),G=G5(G,$,Z),G=O9(G,$),G=F9(G,$),G=iX(G,$),G=wY(G,$),G=qY(G,$),G=await EZ(G,$,Z,Q),G=await Vw(G,$,Z),G=await _Y(G,$,Z,Q),G=F2(G,$,Z,Q),G=PJ(G,$,Z,Q),G=vJ(G,$,Z),G=xJ(G,$,Z,Q),G=iZ(G,$,Z,Q),G=r3(G,$),G=s3(G),G=iG(G),!Q.skipEventDirectives)G=U6(G,$,Z);if(G=kZ(G,$,Z),Q.debug){let r=/\bx-data\s*=/.test(G),a=E8(X);if(r&&a)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
14307
+ ${R}`:R,$.__sections=_}}if(j)try{let F;if(E0.isAbsolute(j))F=j,J.add(j);else F=await x5(()=>H4(j,Z,Q,J),null,()=>{throw new Y5(`Failed to resolve layout path: ${j}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let k=[];try{let y=Q.layoutsDir;if(y){let I=E0.isAbsolute(y)?y:E0.resolve(process.cwd(),y);k=CL.readdirSync(I).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,"")).sort()}}catch{}let N=`Layout not found: ${j} (referenced from ${Z})`+(k.length>0?`. Available layouts: ${k.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if(X1.log(Error(N),{layoutPath:j,filePath:Z,available:k},"error"),console.error(`[stx] ${N}`),Q.debug)throw new Y5(N,Z);return q}let V=await x5(()=>Bun.file(F).text(),"",()=>{throw new Y5(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let k={},N=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(C,S,b)=>{return k[S]=b.trim(),""});for(let[C,S]of Object.entries(k))if(_[C]&&_[C].includes(j5)){let b=_[C].indexOf(j5);_[C]=_[C].slice(0,b)+S+_[C].slice(b+j5.length)}else if(!_[C])_[C]=S;let y={...$,__sections:_},I=`@layout('${A[1]}')${N}`;return await V0(I,y,F,Q,J)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),T=F3(R,B),M={};return T=T.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,N,y)=>{return M[N]=y.trim(),`@slot('${N}')`}),T=T.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,N,y)=>{if(_[N]){let I=_[N];if(I.includes(j5)){let C=M[N]||"",S=I.indexOf(j5);I=I.slice(0,S)+C+I.slice(S+j5.length)}return I}return y||""}),T=fL(T,_),T=T.replace(/\{\{\s*slot\s*\}\}/g,()=>{return _.content||""}),T=V3(T,B),$.__originalFilePath=Z,q=await yw(T,$,F,Q,J),q=`<!-- stx-layout: ${j} -->
14308
+ ${q}`,K(q)}catch(F){return X1.log(F instanceof Error?F:Error(String(F)),{layoutPath:j,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return K(await yw(q,$,Z,Q,J))}function fL(X,$){return X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,Y,J)=>{let G=$[Y];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return J||""})}function gL(X,$){if(X.__stx_sfc_mode=!0,X.__stx_options=$,$.buildMode)X.__stx_buildMode=$.buildMode;let Z=$.envPrefix||"STX_PUBLIC_",Y={};for(let[J,G]of Object.entries(process.env))if(J.startsWith(Z)&&G!==void 0)Y[J]=G;X.$env=Y}async function hL(X,$){await x5(()=>nJ(X,$),void 0,(Z)=>{X1.log(Z,{filePath:X,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${X}: ${Z.message}`)})}async function uL(X,$,Z){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:q}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (i5(),Q8)));await q(Q,$,Z,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));X1.log(W,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${W.message}`)}}}async function dL(X,$,Z){try{let{interpolateScriptsInTemplate:Y}=await e("stx/expressions",()=>Promise.resolve().then(() => (Q1(),GZ)));return Y(X,$,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return X1.log(J,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${J.message}`),X}}async function yw(X,$,Z,Y,J){let G=X,Q=Y;if(await uL(G,$,Z),G=await dL(G,$,Z),G=await yJ(G,$,Z),G=await bJ(G,$,Z),G=await JY(G,$,Z,Q),H1(G))G=a3(G,$),G=e3(G,$);G=t3(G);let{processStreamDirectives:w}=await e("stx/streaming",()=>Promise.resolve().then(() => (v9(),P9)));G=w(G,$),G=j3(G,$,Z,Q),G=await JG(G,$,Z,Q,J),G=await G8(G,$,Z,Q,J),G=C2(G,$,Z,Q);let{processDeferDirectives:q}=await e("stx/defer",()=>Promise.resolve().then(() => LQ));G=q(G,$,Z);let{processTeleportDirectives:W}=await e("stx/teleport",()=>Promise.resolve().then(() => FQ));G=W(G,$,Z);let{processTransitionDirectives:U,processTransitionAttributes:K}=await e("stx/transitions",()=>Promise.resolve().then(() => TQ));G=U(G,$,Z),G=K(G);let{processErrorBoundaryDirectives:z}=await e("stx/error-boundaries",()=>Promise.resolve().then(() => NQ));G=z(G,$,Z);let{processSuspenseDirectives:B}=await e("stx/suspense",()=>Promise.resolve().then(() => kQ));G=B(G,$,Z);let{processAsyncDirectives:_}=await e("stx/async-components",()=>Promise.resolve().then(() => yQ));G=_(G,$,Z);let{processKeepAliveDirectives:j}=await e("stx/keep-alive",()=>Promise.resolve().then(() => SQ));G=j(G,$,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:O,processInfiniteListDirectives:L}=await e("stx/virtual-scrolling",()=>Promise.resolve().then(() => (gQ(),fQ)));G=H(G,$,Z),G=O(G,$,Z),G=L(G,$,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await e("stx/partial-hydration",()=>Promise.resolve().then(() => (eQ(),tQ)));G=F(G,$,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await e("stx/computed",()=>Promise.resolve().then(() => (Kw(),Uw)));G=A(G,$,Z),G=R(G,$,Z);let{processFormValidationDirectives:T}=await e("stx/forms-validation",()=>Promise.resolve().then(() => (Ow(),Lw)));G=T(G,$,Z);let{processHeadDirective:M,processTitleDirective:k,processMetaDirective:N,resetHead:y}=await e("stx/head",()=>Promise.resolve().then(() => (g7(),T9)));if(!$.__stx_head_preset&&!$.__stx_runtime_head)y();let I=M(G);if(G=I.content,I.headContent)$.__stx_head_raw=`${$.__stx_head_raw||""}${I.headContent}
14309
+ `;if(G=k(G,$),G=N(G,$),G=hJ(G),G=L9(G,$),G=ZY(G),G=PJ(G),G=await O3(G,$,Z,Q,J),G=await G8(G,$,Z,Q,J),$.__stxProcessingDepth===1)G=d6(G,$);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=Y4(G),G=G5(G,$,Z),G=O9(G,$),G=F9(G,$),G=nX(G,$),G=BY(G,$),G=jY(G,$),G=await vZ(G,$,Z,Q),G=await bw(G,$,Z),G=await VY(G,$,Z,Q),G=k2(G,$,Z,Q),G=dJ(G,$,Z,Q),G=mJ(G,$,Z),G=lJ(G,$,Z,Q),G=eZ(G,$,Z,Q),G=$4(G,$),G=Z4(G),G=YQ(G),!Q.skipEventDirectives)G=O6(G,$,Z);if(G=CZ(G,$,Z),Q.debug){let r=/\bx-data\s*=/.test(G),a=E8(X);if(r&&a)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
14315
14310
  Both work on the same page, but they manage separate scopes.
14316
- Prefer signals (state/derived/effect) for new components.`)}G=lJ(G,$),G=await b1(G,$,Z),G=nG(G),G=rG(G),G=LZ(G);let{processXElementDirectives:C}=await e("stx/x-element",()=>Promise.resolve().then(() => Kw));G=C(G);let S=$.__originalFilePath||Z,b=a1($);if(G=await n3(G,Q,S,b),G=ZY(G,$),G=await yJ(G,$,Z,Q),Q.media?.image?.autoSiblings){let r=Q.publicDir||"public",{rewriteImagesWithSiblings:a}=await e("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (zw(),Uw)));G=await a(G,{publicDir:r})}if(Q.seo?.enabled)G=fJ(G,$,Q);let P=(r,a,K0=!0)=>{if(!a)return r;let M0=a.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),w0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(M0&&w0){if(K0)r=r.replace(w0[0],M0[0]);if(a=a.replace(M0[0],"").trim(),!a)return r}if(/<\/head>/i.test(r))return r.replace(/<\/head>/i,`${a}
14311
+ Prefer signals (state/derived/effect) for new components.`)}G=oJ(G,$),G=await b1(G,$,Z),G=JQ(G),G=GQ(G),G=MZ(G);let{processXElementDirectives:C}=await e("stx/x-element",()=>Promise.resolve().then(() => Aw));G=C(G);let S=$.__originalFilePath||Z,b=a1($);if(G=await X4(G,Q,S,b),G=WY(G,$),G=await fJ(G,$,Z,Q),Q.media?.image?.autoSiblings){let r=Q.publicDir||"public",{rewriteImagesWithSiblings:a}=await e("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (Tw(),Rw)));G=await a(G,{publicDir:r})}if(Q.seo?.enabled)G=cJ(G,$,Q);let P=(r,a,U0=!0)=>{if(!a)return r;let M0=a.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),w0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(M0&&w0){if(U0)r=r.replace(w0[0],M0[0]);if(a=a.replace(M0[0],"").trim(),!a)return r}if(/<\/head>/i.test(r))return r.replace(/<\/head>/i,`${a}
14317
14312
  </head>`);if(/<head\b[^>]*>/i.test(r))return r.replace(/(<head\b[^>]*>)/i,`$1
14318
14313
  ${a}`);if(/<html\b[^>]*>/i.test(r))return r.replace(/(<html\b[^>]*>)/i,`$1
14319
14314
  <head>
14320
14315
  ${a}
14321
- </head>`);return r},{renderHead:x,getHead:m}=await e("stx/head",()=>Promise.resolve().then(() => (x7(),T9))),Q0=$.__stx_runtime_head??m();if(Q0.title||Q0.meta?.length||Q0.link?.length){let r=x(Q0);if(r)G=P(G,r)}if(I.headContent)G=P(G,I.headContent,!Q0.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=cZ(G,Q.csp,$);if(Q.analytics?.enabled)G=FZ(G,Q);if(Q.heatmap?.enabled)G=a2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:r}=await e("stx/pwa/inject",()=>Promise.resolve().then(() => (Hw(),jw)));G=r(G,Q)}let c0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),R0=/\bSTX\.\w+/.test(G),s0=/window\.STX\s*=/.test(G);if(c0&&R0&&!s0){let a=`<script data-stx-scoped data-stx-run="once">
14322
- ${_Z()}
14323
- </script>`;if(G.includes("</head>")){let K0=G.indexOf("</head>"),w0=G.slice(0,K0).indexOf("<script");if(w0!==-1){let E=G.slice(0,w0),v=G.slice(w0);G=E+a+`
14316
+ </head>`);return r},{renderHead:x,getHead:m}=await e("stx/head",()=>Promise.resolve().then(() => (g7(),T9))),Q0=$.__stx_runtime_head??m();if(Q0.title||Q0.meta?.length||Q0.link?.length){let r=x(Q0);if(r)G=P(G,r)}if(I.headContent)G=P(G,I.headContent,!Q0.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=aZ(G,Q.csp,$);if(Q.analytics?.enabled)G=kZ(G,Q);if(Q.heatmap?.enabled)G=J6(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:r}=await e("stx/pwa/inject",()=>Promise.resolve().then(() => (Iw(),kw)));G=r(G,Q)}let l0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),R0=/\bSTX\.\w+/.test(G),r0=/window\.STX\s*=/.test(G);if(l0&&R0&&!r0){let a=`<script data-stx-scoped data-stx-run="once">
14317
+ ${VZ()}
14318
+ </script>`;if(G.includes("</head>")){let U0=G.indexOf("</head>"),w0=G.slice(0,U0).indexOf("<script");if(w0!==-1){let E=G.slice(0,w0),v=G.slice(w0);G=E+a+`
14324
14319
  `+v}else G=G.replace("</head>",`${a}
14325
14320
  </head>`)}else if(G.includes("<body"))G=G.replace(/<body([^>]*)>/,`<body$1>
14326
14321
  ${a}`);else G=a+`
14327
- `+G}{let{scanScriptTags:r}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (s7(),D8))),a=[];for(let K0 of r(G)){if(!/\bserver\b/i.test(K0.attrs))continue;let M0=K0.start+K0.fullMatch.indexOf(">")+1,w0=TL(G,M0);if(w0===-1)continue;let E=w0+9;while(E<G.length&&/\s/.test(G[E]))E++;a.push({start:K0.start,end:E})}for(let K0=a.length-1;K0>=0;K0--){let{start:M0,end:w0}=a[K0];G=G.substring(0,M0)+G.substring(w0)}}let c=K8(G,Z);if(c.hasScoped)G=c.html;let j0=$.__stx_event_bindings||[],p0=!1,M1=[],L5=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:O5}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (s7(),D8)));for(let r of O5(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))M1.push({match:r.fullMatch,attrs:r.attrs,content:r.body});for(let{match:r,attrs:a,content:K0}of M1){p0=!0;let M0=K0;t3(K0,Z,Y.strict,$.__originalFilePath);let w0=await t1(K0,{eventBindings:j0,attrs:a,hasColonDirectives:L5,templateContent:X,filePath:Z,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:b});G=G.replace(r,()=>w0)}if(p0)$.__stx_event_bindings=[];if(!p0&&$.__stxProcessingDepth===1){let r=$.__stx_event_bindings||[];if(r.length>0){let a=d$(r);if(a){let K0=G.lastIndexOf("</body>");G=K0===-1?G+a:G.slice(0,K0)+a+`
14328
- `+G.slice(K0)}$.__stx_event_bindings=[]}}if(!DG(G)&&yG(G))G=await M8(G,Q);if(Q.csp?.enabled&&Q.csp.useNonce&&typeof $.cspNonce==="string")G=pZ(G,$.cspNonce);return G}var B5="<!--PARENT_CONTENT_PLACEHOLDER-->";var sX=D(()=>{G9();w9();$5();L$();BZ();OZ();VZ();f$();O$();m$();D5();IZ();DZ();dX();nZ();oZ();eZ();YY();F1();x7();w1();WY();BY();RJ();kJ();H3();K4();bJ();C5();CJ();R3();T0();dJ();cJ();nJ();tJ();k3();D3();BG();s7();K3();pG();a3();e3();F0();f9();s$();F7();N8();N8();a3();e3()});var Aw=()=>{};var U4={};t(U4,{renderSlot:()=>Tw,processSlots:()=>Nw,parseSlots:()=>Rw,parseSlotElement:()=>vL,extractSlotContent:()=>gL,applySlots:()=>hL});function bL(X,$){let Z=1,Y=$,J="<template",G="</template";while(Y<X.length&&Z>0){let Q=X.indexOf("<",Y);if(Q===-1)break;if(Y=Q,X.startsWith(J,Y)&&(Y+J.length>=X.length||/[\s>\/]/.test(X[Y+J.length]))){Z++,Y+=J.length;continue}if(X.startsWith(G,Y)){let w=X.indexOf(">",Y+G.length);if(w!==-1){if(Z--,Z===0)return w+1;Y=w+1;continue}}Y++}return Z===0?Y:-1}function CL(X,$){let Z=null;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"){Z=J;continue}if(J===">")return Y+1}return-1}function PL(X){let $=[],Z=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;if(X.startsWith("<!--",G)){let z=X.indexOf("-->",G+4);J=z===-1?X.length:z+3;continue}let Q=CL(X,G+1);if(Q===-1)break;let w=X.slice(G,Q),q=w.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){J=Q;continue}let W=q[1]==="/",K=q[2].toLowerCase();if(W){let z=Z.lastIndexOf(K);if(z!==-1)Z.splice(z);J=Q;continue}if(K==="template"&&Z.length===0){let z=w.match(Y);if(z){let B=bL(X,Q);if(B!==-1){let _=z[1]||z[2]||z[3];$.push({start:G,end:B,slotName:_,content:X.slice(Q,B-11).trim(),propsBinding:z[4]||void 0}),J=B;continue}}}if(!/\/\s*>$/.test(w)&&!SL.has(K)){if(Z.push(K),K==="script"||K==="style"){let z=X.toLowerCase().indexOf(`</${K}>`,Q);if(z!==-1){J=z;continue}}}J=Q}return $}function Rw(X){let $={default:"",named:new Map},Z=X,Y=PL(X);for(let q of Y)$.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});Y.sort((q,W)=>W.start-q.start);for(let q of Y)Z=Z.slice(0,q.start)+Z.slice(q.end);let J=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[q,W,K,U,z,B]=Q,_=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+j).trim(),O=`<${W}${H?" "+H:""}>${B}</${W}>`;J.push({start:Q.index,end:Q.index+q.length,slotName:U,element:O})}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=w.exec(Z))!==null){let[q,W,K,U,z]=Q,B=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=(B+_).trim(),H=`<${W}${j?" "+j:""} />`;J.push({start:Q.index,end:Q.index+q.length,slotName:U,element:H})}J.sort((q,W)=>W.start-q.start);for(let q of J){let W=$.named.get(q.slotName);if(W)W.content+=q.element;else $.named.set(q.slotName,{name:q.slotName,content:q.element});Z=Z.slice(0,q.start)+Z.slice(q.end)}return $.default=Z.trim(),$}function vL(X){let $=X.match(/name\s*=\s*["']([^"']+)["']/),Z=$?$[1]:"",Y={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=J.exec(X))!==null)Y[G[1]]=G[2];let Q=X.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),w=Q?Q[1].trim():"";return{name:Z,props:Y,defaultContent:w}}async function Tw(X,$,Z,Y){if(!X)return Z;let J=X.content;if(X.propsBinding&&Object.keys($).length>0){let G=X.propsBinding.trim(),Q={...Y};if(G.startsWith("{")&&G.endsWith("}")){let w=G.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of w){let[W,K]=q.split(":").map((z)=>z.trim()),U=K||W;if($[W]!==void 0)Q[U]=$[W]}}else Q[G]=$;J=xL(J,Q)}return J}function xL(X,$){return X.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,Y)=>{try{let J=Y.trim(),G=Mw(J,$);return t0(String(G??""))}catch{return`{{ ${Y} }}`}})}function Mw(X,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(X)){let Y=X.split("."),J=$;for(let G of Y)if(J&&typeof J==="object"&&G in J)J=J[G];else return;return J}let Z=X.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,Y,J,G]=Z,Q=$[Y],w=parseInt(G,10);if(typeof Q==="number")switch(J){case"+":return Q+w;case"-":return Q-w;case"*":return Q*w;case"/":return Q/w}}try{if(!q0(X))return;return W0(X,Object.keys($))(...Object.values($))}catch{return}}async function Nw(X,$,Z){let Y=X;Y=await fL(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,w,q,W)=>{let K=$.named.get(w),U=W?.trim()||"",z=q||"",B={},_=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,j;while((j=_.exec(z))!==null){let H=j[1],O=j[2];B[H]=Mw(O,Z)}return await Tw(K,B,U,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(G,(Q,w)=>{if(Q.includes("name="))return Q;let q=w?.trim()||"";return $.default||q}),Y}async function fL(X,$,Z){let Y=[],J=[];X.replace($,(w,...q)=>{let W=q[q.length-2];return J.push({match:w,index:W}),Y.push(Z(w,...q.slice(0,-2))),w});let G=await Promise.all(Y),Q=X;for(let w=J.length-1;w>=0;w--){let{match:q,index:W}=J[w];Q=Q.slice(0,W)+G[w]+Q.slice(W+q.length)}return Q}function gL(X){let $=Rw(X);return{defaultSlot:$.default,namedSlots:$.named}}async function hL(X,$,Z,Y){return await Nw(X,{default:$,named:Z},Y)}var SL;var z4=D(()=>{w1();F0();SL=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import uL from"fs";import g from"path";function mL(X){let $=new WeakSet;try{let Z=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if($.has(Y))throw TypeError("Circular component input");if($.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(Z);let J={};for(let G of Object.keys(Y).sort())J[G]=Z(Y[G]);return J};return JSON.stringify(Z(X))}catch{return null}}function kw(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function lL(X){return/\bjs\b/.test(X)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(X)}function e1(X){return!lL(X)}function X5(X){try{let $=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");$=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];$=$.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}).transformSync($);for(let G=0;G<Z.length;G++)J=J.replace(`"__STX_EXPR_${G}__"`,Z[G]),J=J.replace(`'__STX_EXPR_${G}__'`,Z[G]);return J}catch($){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",$);return X}}function cL(X){let $=[],Z=new Set,Y=0,J=0,G=X.length,Q=(K)=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]===K){J++;return}J++}},w=()=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]==="`"){J++;return}if(X[J]==="$"&&X[J+1]==="{"){J+=2;let K=1;while(J<G&&K>0)if(X[J]==="{")K++,J++;else if(X[J]==="}")K--,J++;else if(X[J]==="'"||X[J]==='"')Q(X[J]);else if(X[J]==="`")w();else J++;continue}J++}},q=()=>{if(X[J]==="/"&&X[J+1]==="/"){while(J<G&&X[J]!==`
14329
- `)J++;return!0}if(X[J]==="/"&&X[J+1]==="*"){J+=2;while(J<G-1&&!(X[J]==="*"&&X[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(Y!==0)return;let K=X.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let _=K[2].split(",").map((j)=>{let H=j.trim().split(":");return H[H.length-1].trim()});for(let j of _)if(j&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(j)&&!Z.has(j))$.push(j),Z.add(j);return}let U=X.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let _=U[2];if(!Z.has(_))$.push(_),Z.add(_);return}let z=X.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let _=z[1];if(!Z.has(_))$.push(_),Z.add(_);return}let B=X.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let _=B[1];if(!Z.has(_))$.push(_),Z.add(_)}};while(J<G){if(q())continue;if(X[J]==="'"||X[J]==='"'){Q(X[J]);continue}if(X[J]==="`"){w();continue}if(X[J]==="{"){Y++,J++;continue}if(X[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test(X[J])&&(J===0||/\s|[;{}()]/.test(X[J-1])))W();J++}return $}function pL(X){let $=[],Z=0,Y=0,J=null;for(let G=0;G<X.length;G++){let Q=X[G];if(J){if(Q==="\\"){G++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)$.push(X.slice(Y,G)),Y=G+1}if(Y<X.length)$.push(X.slice(Y));return $}function iL(X){let $=0,Z=null;for(let Y=0;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}if(J==="("||J==="["||J==="{")$++;else if(J===")"||J==="]"||J==="}")$--;else if(J==="="&&$===0){let G=X[Y-1],Q=X[Y+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return Y}}return-1}function nL(X,$){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(X);if(!Z)return;let Y=Z.index-1;while(Y>=0&&/\s/.test(X[Y]))Y--;if(X[Y]!=="}")return;let J=Y,G=0,Q=-1;for(;Y>=0;Y--){let q=X[Y];if(q==="}")G++;else if(q==="{"){if(G--,G===0){Q=Y;break}}}if(Q===-1)return;let w=X.slice(Q+1,J);for(let q of pL(w)){let W=q.trim();if(!W||W.startsWith("..."))continue;let K=iL(W);if(K===-1)continue;let U=W.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if($[U]!==void 0)continue;let z=W.slice(K+1).trim();if(!z)continue;try{let B=Object.keys($),_=Function(...B,`"use strict"; return (${z});`);$[U]=_(...B.map((j)=>$[j]))}catch{}}}catch{}}async function Z8(X,$,Z,Y,J){let G=X.endsWith(".stx")?X.slice(0,-4):X,Q=(H)=>H.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),w=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Z.__importedComponents;if(q){for(let H of[G,G.toLowerCase(),Q(G),w(G)])if(q.has(H))return!0}let W=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${w(G)}.stx`])],K=typeof J.root==="string"?g.resolve(J.root):void 0,U=K??g.dirname(Y),z=[],B=(H)=>{if(H&&!z.includes(H))z.push(H)},_=Z.__originalFilePath;if(_)B(g.join(g.dirname(_),"components"));B($),B(J._rootComponentsDir),B(g.join(g.dirname(Y),"components")),B(J.componentsDir);let j=J._pluginComponentDirs;if(Array.isArray(j))for(let H of j)B(typeof H==="string"?H:null);if(K)B(g.resolve(K,"resources/views/components")),B(g.resolve(K,"resources/components")),B(g.resolve(K,"src/components")),B(g.resolve(K,"components"));if(G.startsWith("./")||G.startsWith("../"))return i(g.resolve(g.dirname(Y),`${G}.stx`));for(let H of z){let O=g.isAbsolute(H)?H:g.resolve(U,H);for(let L of W)if(await i(g.join(O,L)))return!0}return!1}function rL(X){return X==="visible"||X==="idle"||X==="interaction"||X.startsWith("media:")}function sL(X){if(!X)return!1;let $=X.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test($)}function oL(X){let $=new Set,Z=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let Y of X){let J;while((J=Z.exec(Y))!==null)$.add(J[1]);Z.lastIndex=0}return[...$]}async function K5(X,$,Z,Y,J,G,Q,w=new Set,q){let{extractVariables:W}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (p5(),G8))),K=w??new Set;if(K.has(X))return`[Circular component reference: ${X}]`;let U=new Set(K);U.add(X);let z=typeof $.client==="string"?$.client.trim():"";if("client"in $)delete $.client;let B=z&&z!=="load"&&rL(z)?z:"";try{let _=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=X.endsWith(".stx")?X.slice(0,-4):X,O=null,L=J.__importedComponents;if(L){let E=[H,H.toLowerCase(),_(H),j(H)];for(let v of E)if(L.has(v)){O=L.get(v);break}}let F=[];if(!O){let E=[`${H}.stx`,`${_(H)}.stx`,`${j(H)}.stx`],v=[...new Set(E)],d=J.__originalFilePath,f=[];if(d){let z0=g.join(g.dirname(d),"components");f.push(z0)}if(Y)f.push(Y);let s=Q._rootComponentsDir;if(typeof s==="string"&&!f.includes(s))f.push(s);let G0=g.join(g.dirname(G),"components");if(!f.includes(G0))f.push(G0);if(Q.componentsDir&&Q.componentsDir!==Y&&!f.includes(Q.componentsDir))f.push(Q.componentsDir);let o0=Q._pluginComponentDirs;if(Array.isArray(o0)){for(let z0 of o0)if(typeof z0==="string"&&!f.includes(z0))f.push(z0)}let S0=typeof Q.root==="string"?g.resolve(Q.root):void 0,f0=S0??g.dirname(G),a0=[];if(S0)a0.push(g.resolve(S0,"resources/views/components")),a0.push(g.resolve(S0,"resources/components")),a0.push(g.resolve(S0,"src/components")),a0.push(g.resolve(S0,"components"));a0.push(g.resolve(import.meta.dir,"components"));for(let z0 of a0)if(!f.includes(z0))f.push(z0);let F5=[...new Set(f.map((z0)=>{if(!z0)return z0;return g.isAbsolute(z0)?z0:g.resolve(f0,z0)}))];f.length=0,f.push(...F5);let N1=`${H}\x00${G}\x00${F5.join("\x00")}`,k1=f8.get(N1);if(k1)if(await i(k1))O=k1;else f8.delete(N1);if(!O&&(H.startsWith("./")||H.startsWith("../")))O=g.resolve(g.dirname(G),`${H}.stx`),F.push(O);else if(!O)for(let z0 of f){if(!z0)continue;for(let Y1 of v){let n=g.join(z0,Y1);if(F.push(n),await i(n)){O=n;break}}if(O)break;if(!O)try{let Y1=await import("fs");if(!Y1.statSync(z0,{throwIfNoEntry:!1})?.isDirectory())continue;let J1=8,i1=[{path:z0,depth:0}];while(i1.length>0&&!O){let z1=i1.pop();if(z1.depth>=J1)continue;let JX;try{JX=Y1.readdirSync(z1.path,{withFileTypes:!0})}catch{continue}for(let GX of JX){if(!GX.isDirectory())continue;if(GX.name==="node_modules"||GX.name.startsWith("."))continue;let o4=g.join(z1.path,GX.name);for(let lq of v){let z$=g.join(o4,lq);if(F.push(z$),await i(z$)){O=z$;break}}if(O)break;i1.push({path:o4,depth:z1.depth+1})}}}catch{}if(O)break}if(O)f8.set(N1,O)}if(!O||!await i(O)){let E=F.length>0?`
14322
+ `+G}{let{scanScriptTags:r}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (o7(),D8))),a=[];for(let U0 of r(G)){if(!/\bserver\b/i.test(U0.attrs))continue;let M0=U0.start+U0.fullMatch.indexOf(">")+1,w0=PL(G,M0);if(w0===-1)continue;let E=w0+9;while(E<G.length&&/\s/.test(G[E]))E++;a.push({start:U0.start,end:E})}for(let U0=a.length-1;U0>=0;U0--){let{start:M0,end:w0}=a[U0];G=G.substring(0,M0)+G.substring(w0)}}let c=K8(G,Z);if(c.hasScoped)G=c.html;let j0=$.__stx_event_bindings||[],c0=!1,T1=[],O5=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:F5}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (o7(),D8)));for(let r of F5(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))T1.push({match:r.fullMatch,attrs:r.attrs,content:r.body});for(let{match:r,attrs:a,content:U0}of T1){c0=!0;let M0=U0;G4(U0,Z,Y.strict,$.__originalFilePath);let w0=await t1(U0,{eventBindings:j0,attrs:a,hasColonDirectives:O5,templateContent:X,filePath:Z,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:b});G=G.replace(r,()=>w0)}if(c0)$.__stx_event_bindings=[];if(!c0&&$.__stxProcessingDepth===1){let r=$.__stx_event_bindings||[];if(r.length>0){let a=d$(r);if(a){let U0=G.lastIndexOf("</body>");G=U0===-1?G+a:G.slice(0,U0)+a+`
14323
+ `+G.slice(U0)}$.__stx_event_bindings=[]}}if(!uG(G)&&dG(G))G=await M8(G,Q);if(Q.csp?.enabled&&Q.csp.useNonce&&typeof $.cspNonce==="string")G=tZ(G,$.cspNonce);return G}var j5="<!--PARENT_CONTENT_PLACEHOLDER-->";var oX=D(()=>{G9();w9();$5();L$();AZ();NZ();IZ();f$();O$();m$();y5();PZ();xZ();mX();XY();YY();QY();UY();O1();g7();Q1();HY();AY();DJ();CJ();H3();L4();gJ();P5();uJ();R3();T0();rJ();aJ();XG();GG();k3();D3();AG();o7();U3();ZQ();J4();Q4();F0();f9();s$();V7();N8();N8();J4();Q4()});var Sw=()=>{};var O4={};t(O4,{renderSlot:()=>Pw,processSlots:()=>xw,parseSlots:()=>Cw,parseSlotElement:()=>iL,extractSlotContent:()=>sL,applySlots:()=>oL});function mL(X,$){let Z=1,Y=$,J="<template",G="</template";while(Y<X.length&&Z>0){let Q=X.indexOf("<",Y);if(Q===-1)break;if(Y=Q,X.startsWith(J,Y)&&(Y+J.length>=X.length||/[\s>\/]/.test(X[Y+J.length]))){Z++,Y+=J.length;continue}if(X.startsWith(G,Y)){let w=X.indexOf(">",Y+G.length);if(w!==-1){if(Z--,Z===0)return w+1;Y=w+1;continue}}Y++}return Z===0?Y:-1}function cL(X,$){let Z=null;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"){Z=J;continue}if(J===">")return Y+1}return-1}function pL(X){let $=[],Z=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;if(X.startsWith("<!--",G)){let z=X.indexOf("-->",G+4);J=z===-1?X.length:z+3;continue}let Q=cL(X,G+1);if(Q===-1)break;let w=X.slice(G,Q),q=w.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){J=Q;continue}let W=q[1]==="/",U=q[2].toLowerCase();if(W){let z=Z.lastIndexOf(U);if(z!==-1)Z.splice(z);J=Q;continue}if(U==="template"&&Z.length===0){let z=w.match(Y);if(z){let B=mL(X,Q);if(B!==-1){let _=z[1]||z[2]||z[3];$.push({start:G,end:B,slotName:_,content:X.slice(Q,B-11).trim(),propsBinding:z[4]||void 0}),J=B;continue}}}if(!/\/\s*>$/.test(w)&&!lL.has(U)){if(Z.push(U),U==="script"||U==="style"){let z=X.toLowerCase().indexOf(`</${U}>`,Q);if(z!==-1){J=z;continue}}}J=Q}return $}function Cw(X){let $={default:"",named:new Map},Z=X,Y=pL(X);for(let q of Y)$.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});Y.sort((q,W)=>W.start-q.start);for(let q of Y)Z=Z.slice(0,q.start)+Z.slice(q.end);let J=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[q,W,U,K,z,B]=Q,_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+j).trim(),O=`<${W}${H?" "+H:""}>${B}</${W}>`;J.push({start:Q.index,end:Q.index+q.length,slotName:K,element:O})}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=w.exec(Z))!==null){let[q,W,U,K,z]=Q,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=(B+_).trim(),H=`<${W}${j?" "+j:""} />`;J.push({start:Q.index,end:Q.index+q.length,slotName:K,element:H})}J.sort((q,W)=>W.start-q.start);for(let q of J){let W=$.named.get(q.slotName);if(W)W.content+=q.element;else $.named.set(q.slotName,{name:q.slotName,content:q.element});Z=Z.slice(0,q.start)+Z.slice(q.end)}return $.default=Z.trim(),$}function iL(X){let $=X.match(/name\s*=\s*["']([^"']+)["']/),Z=$?$[1]:"",Y={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=J.exec(X))!==null)Y[G[1]]=G[2];let Q=X.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),w=Q?Q[1].trim():"";return{name:Z,props:Y,defaultContent:w}}async function Pw(X,$,Z,Y){if(!X)return Z;let J=X.content;if(X.propsBinding&&Object.keys($).length>0){let G=X.propsBinding.trim(),Q={...Y};if(G.startsWith("{")&&G.endsWith("}")){let w=G.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of w){let[W,U]=q.split(":").map((z)=>z.trim()),K=U||W;if($[W]!==void 0)Q[K]=$[W]}}else Q[G]=$;J=nL(J,Q)}return J}function nL(X,$){return X.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,Y)=>{try{let J=Y.trim(),G=vw(J,$);return a0(String(G??""))}catch{return`{{ ${Y} }}`}})}function vw(X,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(X)){let Y=X.split("."),J=$;for(let G of Y)if(J&&typeof J==="object"&&G in J)J=J[G];else return;return J}let Z=X.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,Y,J,G]=Z,Q=$[Y],w=parseInt(G,10);if(typeof Q==="number")switch(J){case"+":return Q+w;case"-":return Q-w;case"*":return Q*w;case"/":return Q/w}}try{if(!q0(X))return;return W0(X,Object.keys($))(...Object.values($))}catch{return}}async function xw(X,$,Z){let Y=X;Y=await rL(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,w,q,W)=>{let U=$.named.get(w),K=W?.trim()||"",z=q||"",B={},_=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,j;while((j=_.exec(z))!==null){let H=j[1],O=j[2];B[H]=vw(O,Z)}return await Pw(U,B,K,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(G,(Q,w)=>{if(Q.includes("name="))return Q;let q=w?.trim()||"";return $.default||q}),Y}async function rL(X,$,Z){let Y=[],J=[];X.replace($,(w,...q)=>{let W=q[q.length-2];return J.push({match:w,index:W}),Y.push(Z(w,...q.slice(0,-2))),w});let G=await Promise.all(Y),Q=X;for(let w=J.length-1;w>=0;w--){let{match:q,index:W}=J[w];Q=Q.slice(0,W)+G[w]+Q.slice(W+q.length)}return Q}function sL(X){let $=Cw(X);return{defaultSlot:$.default,namedSlots:$.named}}async function oL(X,$,Z,Y){return await xw(X,{default:$,named:Z},Y)}var lL;var F4=D(()=>{Q1();F0();lL=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});import aL from"fs";import g from"path";function eL(X){let $=new WeakSet;try{let Z=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if($.has(Y))throw TypeError("Circular component input");if($.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(Z);let J={};for(let G of Object.keys(Y).sort())J[G]=Z(Y[G]);return J};return JSON.stringify(Z(X))}catch{return null}}function fw(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function XO(X){return/\bjs\b/.test(X)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(X)}function e1(X){return!XO(X)}function X5(X){try{let $=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");$=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];$=$.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:C0()}).transformSync($);for(let G=0;G<Z.length;G++)J=J.replace(`"__STX_EXPR_${G}__"`,Z[G]),J=J.replace(`'__STX_EXPR_${G}__'`,Z[G]);return J}catch($){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",$);return X}}function $O(X){let $=[],Z=new Set,Y=0,J=0,G=X.length,Q=(U)=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]===U){J++;return}J++}},w=()=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]==="`"){J++;return}if(X[J]==="$"&&X[J+1]==="{"){J+=2;let U=1;while(J<G&&U>0)if(X[J]==="{")U++,J++;else if(X[J]==="}")U--,J++;else if(X[J]==="'"||X[J]==='"')Q(X[J]);else if(X[J]==="`")w();else J++;continue}J++}},q=()=>{if(X[J]==="/"&&X[J+1]==="/"){while(J<G&&X[J]!==`
14324
+ `)J++;return!0}if(X[J]==="/"&&X[J+1]==="*"){J+=2;while(J<G-1&&!(X[J]==="*"&&X[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(Y!==0)return;let U=X.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let _=U[2].split(",").map((j)=>{let H=j.trim().split(":");return H[H.length-1].trim()});for(let j of _)if(j&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(j)&&!Z.has(j))$.push(j),Z.add(j);return}let K=X.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(K){let _=K[2];if(!Z.has(_))$.push(_),Z.add(_);return}let z=X.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let _=z[1];if(!Z.has(_))$.push(_),Z.add(_);return}let B=X.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let _=B[1];if(!Z.has(_))$.push(_),Z.add(_)}};while(J<G){if(q())continue;if(X[J]==="'"||X[J]==='"'){Q(X[J]);continue}if(X[J]==="`"){w();continue}if(X[J]==="{"){Y++,J++;continue}if(X[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test(X[J])&&(J===0||/\s|[;{}()]/.test(X[J-1])))W();J++}return $}function ZO(X){let $=[],Z=0,Y=0,J=null;for(let G=0;G<X.length;G++){let Q=X[G];if(J){if(Q==="\\"){G++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)$.push(X.slice(Y,G)),Y=G+1}if(Y<X.length)$.push(X.slice(Y));return $}function YO(X){let $=0,Z=null;for(let Y=0;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}if(J==="("||J==="["||J==="{")$++;else if(J===")"||J==="]"||J==="}")$--;else if(J==="="&&$===0){let G=X[Y-1],Q=X[Y+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return Y}}return-1}function JO(X,$){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(X);if(!Z)return;let Y=Z.index-1;while(Y>=0&&/\s/.test(X[Y]))Y--;if(X[Y]!=="}")return;let J=Y,G=0,Q=-1;for(;Y>=0;Y--){let q=X[Y];if(q==="}")G++;else if(q==="{"){if(G--,G===0){Q=Y;break}}}if(Q===-1)return;let w=X.slice(Q+1,J);for(let q of ZO(w)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=YO(W);if(U===-1)continue;let K=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(K))continue;if($[K]!==void 0)continue;let z=W.slice(U+1).trim();if(!z)continue;try{let B=Object.keys($),_=Function(...B,`"use strict"; return (${z});`);$[K]=_(...B.map((j)=>$[j]))}catch{}}}catch{}}async function Y8(X,$,Z,Y,J){let G=X.endsWith(".stx")?X.slice(0,-4):X,Q=(H)=>H.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),w=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Z.__importedComponents;if(q){for(let H of[G,G.toLowerCase(),Q(G),w(G)])if(q.has(H))return!0}let W=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${w(G)}.stx`])],U=typeof J.root==="string"?g.resolve(J.root):void 0,K=U??g.dirname(Y),z=[],B=(H)=>{if(H&&!z.includes(H))z.push(H)},_=Z.__originalFilePath;if(_)B(g.join(g.dirname(_),"components"));B($),B(J._rootComponentsDir),B(g.join(g.dirname(Y),"components")),B(J.componentsDir);let j=J._pluginComponentDirs;if(Array.isArray(j))for(let H of j)B(typeof H==="string"?H:null);if(U)B(g.resolve(U,"resources/views/components")),B(g.resolve(U,"resources/components")),B(g.resolve(U,"src/components")),B(g.resolve(U,"components"));if(G.startsWith("./")||G.startsWith("../"))return i(g.resolve(g.dirname(Y),`${G}.stx`));for(let H of z){let O=g.isAbsolute(H)?H:g.resolve(K,H);for(let L of W)if(await i(g.join(O,L)))return!0}return!1}function GO(X){return X==="visible"||X==="idle"||X==="interaction"||X.startsWith("media:")}function QO(X){if(!X)return!1;let $=X.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test($)}function wO(X){let $=new Set,Z=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let Y of X){let J;while((J=Z.exec(Y))!==null)$.add(J[1]);Z.lastIndex=0}return[...$]}async function U5(X,$,Z,Y,J,G,Q,w=new Set,q){let{extractVariables:W}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (i5(),Q8))),U=w??new Set;if(U.has(X))return`[Circular component reference: ${X}]`;let K=new Set(U);K.add(X);let z=typeof $.client==="string"?$.client.trim():"";if("client"in $)delete $.client;let B=z&&z!=="load"&&GO(z)?z:"";try{let _=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),j=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=X.endsWith(".stx")?X.slice(0,-4):X,O=null,L=J.__importedComponents;if(L){let E=[H,H.toLowerCase(),_(H),j(H)];for(let v of E)if(L.has(v)){O=L.get(v);break}}let F=[];if(!O){let E=[`${H}.stx`,`${_(H)}.stx`,`${j(H)}.stx`],v=[...new Set(E)],d=J.__originalFilePath,f=[];if(d){let z0=g.join(g.dirname(d),"components");f.push(z0)}if(Y)f.push(Y);let s=Q._rootComponentsDir;if(typeof s==="string"&&!f.includes(s))f.push(s);let G0=g.join(g.dirname(G),"components");if(!f.includes(G0))f.push(G0);if(Q.componentsDir&&Q.componentsDir!==Y&&!f.includes(Q.componentsDir))f.push(Q.componentsDir);let s0=Q._pluginComponentDirs;if(Array.isArray(s0)){for(let z0 of s0)if(typeof z0==="string"&&!f.includes(z0))f.push(z0)}let S0=typeof Q.root==="string"?g.resolve(Q.root):void 0,f0=S0??g.dirname(G),o0=[];if(S0)o0.push(g.resolve(S0,"resources/views/components")),o0.push(g.resolve(S0,"resources/components")),o0.push(g.resolve(S0,"src/components")),o0.push(g.resolve(S0,"components"));o0.push(g.resolve(import.meta.dir,"components"));for(let z0 of o0)if(!f.includes(z0))f.push(z0);let V5=[...new Set(f.map((z0)=>{if(!z0)return z0;return g.isAbsolute(z0)?z0:g.resolve(f0,z0)}))];f.length=0,f.push(...V5);let M1=`${H}\x00${G}\x00${V5.join("\x00")}`,N1=f8.get(M1);if(N1)if(await i(N1))O=N1;else f8.delete(M1);if(!O&&(H.startsWith("./")||H.startsWith("../")))O=g.resolve(g.dirname(G),`${H}.stx`),F.push(O);else if(!O)for(let z0 of f){if(!z0)continue;for(let Z1 of v){let n=g.join(z0,Z1);if(F.push(n),await i(n)){O=n;break}}if(O)break;if(!O)try{let Z1=await import("fs");if(!Z1.statSync(z0,{throwIfNoEntry:!1})?.isDirectory())continue;let Y1=8,i1=[{path:z0,depth:0}];while(i1.length>0&&!O){let K1=i1.pop();if(K1.depth>=Y1)continue;let GX;try{GX=Z1.readdirSync(K1.path,{withFileTypes:!0})}catch{continue}for(let QX of GX){if(!QX.isDirectory())continue;if(QX.name==="node_modules"||QX.name.startsWith("."))continue;let Y2=g.join(K1.path,QX.name);for(let XW of v){let z$=g.join(Y2,XW);if(F.push(z$),await i(z$)){O=z$;break}}if(O)break;i1.push({path:Y2,depth:K1.depth+1})}}}catch{}if(O)break}if(O)f8.set(M1,O)}if(!O||!await i(O)){let E=F.length>0?`
14330
14325
  Searched paths:
14331
14326
  ${F.map((v)=>` - ${v}`).join(`
14332
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${X}']${E}`}q.add(O);let V;if(x8.has(O))V=x8.get(O);else try{V=await Bun.file(O).text(),x8.set(O,V)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let A=new Set(["__originalFilePath","__importedComponents",TX]),R={};for(let[E,v]of Object.entries(J))if(!E.startsWith("__")||A.has(E))R[E]=v;let{extractSlotContent:T}=await e("stx/slots",()=>Promise.resolve().then(() => (z4(),U4))),M=T(Z),k={};if(M.defaultSlot?.trim())k.default=M.defaultSlot;for(let[E,v]of M.namedSlots)k[E]=v.content;let N={...R,...$,props:$,slot:Z,$slots:k,__processedComponents:U,__sections:{},__stx_signals_gate:L1(V)||sL(Z)};nL(V,N);let y=V,I=g5(y);if(I)y=I.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...V.matchAll(C)],b=[],P=S.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&S.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,m=null;if(P){let E=mL({props:$,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(E!==null){x=`${O}\x00${E}`;let v=_4.get(x);if(v){for(let d of v.dependencies)q.add(d);return v.output}m=new Set(q)}}for(let E of S){let v=E[1]||"",d=E[2]||"",f=v.includes("server");if(e1(v)&&d.trim())d=X5(d);if(f&&d)try{await W(d,N,O)}catch(G0){}if(!f){let G0=d.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),o0=G0.includes("{{")&&G0.includes("}}"),S0=G0.includes("{!!")&&G0.includes("!!}");if(o0||S0)G0=IX(G0,N);let f0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${f0}>${G0}</script>`)}}let l=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Q0=l?l[1]:"",c0=l?l[2]:"",R0="",s0=Q0&&/\bscoped\b/i.test(Q0);if(l)R0=`<style${Q0}>${c0}</style>`;let c=y;if(c=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)c=c.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(c=c.replace(E,(d,f)=>{let s=f.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(s)v.push(`<style${s[1]}>${s[2]}</style>`);return""}),c=c.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)R0=`${R0}${v.join(`
14333
- `)}`}if(Z&&c.includes("{{ text || slot }}"))c=c.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:j0}=await e("stx/slots",()=>Promise.resolve().then(() => (z4(),U4))),{defaultSlot:p0,namedSlots:M1}=M;c=await j0(c,p0,M1,N);let L5=b.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),O5=oL(b);if(O5.length>0)N.__stx_client_signal_names=O5;let r={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:L5||b.length===0,defaultLayout:void 0};N.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let a=await V0(c,N,O,r,q),K0=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let E of a.matchAll(/\{\{([\s\S]*?)\}\}/g))K0.add(E[1].trim());if(K0.size>0)J.__stx_preserved_client_expressions=[...K0];let M0=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++dL}_${Math.random().toString(36).slice(2,8)}`,w0=a;if(L5){let E="";if(Object.keys($).length>0)try{E=` data-stx-props="${kw(JSON.stringify($))}"`}catch{}let v=B?` stx-hydrate="${kw(B)}"`:"";w0=`<div data-stx-scope="${M0}"${E}${v}>${a}</div>`;let d=await Promise.all(b.map(async(f)=>{let s=f.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!s)return f;let[,G0,o0]=s,S0=FX(o0,{filePath:O,projectRoot:process.cwd()}),f0=S0.code,a0=VX(S0.styles);f0=E5(f0).code;let{hasUserImports:F5,bundleClientScript:N1}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (N7(),M7)));if(F5(f0))f0=await N1(f0,O,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:k1}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (s7(),D8)));f0=f0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(z1,JX)=>k1(JX));let z0=h0(f0),Y1=cL(z0),n=`function(__scopeId) {
14334
- ${N5("const",[...X6,...Y1],z0)}
14327
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${X}']${E}`}q.add(O);let V;if(x8.has(O))V=x8.get(O);else try{V=await Bun.file(O).text(),x8.set(O,V)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let A=new Set(["__originalFilePath","__importedComponents",MX]),R={};for(let[E,v]of Object.entries(J))if(!E.startsWith("__")||A.has(E))R[E]=v;let{extractSlotContent:T}=await e("stx/slots",()=>Promise.resolve().then(() => (F4(),O4))),M=T(Z),k={};if(M.defaultSlot?.trim())k.default=M.defaultSlot;for(let[E,v]of M.namedSlots)k[E]=v.content;let N={...R,...$,props:$,slot:Z,$slots:k,__processedComponents:K,__sections:{},__stx_signals_gate:H1(V)||QO(Z)};JO(V,N);let y=V,I=h5(y);if(I)y=I.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...V.matchAll(C)],b=[],P=S.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&S.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,m=null;if(P){let E=eL({props:$,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(E!==null){x=`${O}\x00${E}`;let v=V4.get(x);if(v){for(let d of v.dependencies)q.add(d);return v.output}m=new Set(q)}}for(let E of S){let v=E[1]||"",d=E[2]||"",f=v.includes("server");if(e1(v)&&d.trim())d=X5(d);if(f&&d)try{await W(d,N,O)}catch(G0){}if(!f){let G0=d.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),s0=G0.includes("{{")&&G0.includes("}}"),S0=G0.includes("{!!")&&G0.includes("!!}");if(s0||S0)G0=EX(G0,N);let f0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${f0}>${G0}</script>`)}}let l=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Q0=l?l[1]:"",l0=l?l[2]:"",R0="",r0=Q0&&/\bscoped\b/i.test(Q0);if(l)R0=`<style${Q0}>${l0}</style>`;let c=y;if(c=c.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)c=c.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(c=c.replace(E,(d,f)=>{let s=f.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(s)v.push(`<style${s[1]}>${s[2]}</style>`);return""}),c=c.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)R0=`${R0}${v.join(`
14328
+ `)}`}if(Z&&c.includes("{{ text || slot }}"))c=c.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:j0}=await e("stx/slots",()=>Promise.resolve().then(() => (F4(),O4))),{defaultSlot:c0,namedSlots:T1}=M;c=await j0(c,c0,T1,N);let O5=b.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),F5=wO(b);if(F5.length>0)N.__stx_client_signal_names=F5;let r={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:g.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:O5||b.length===0,defaultLayout:void 0};N.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let a=await V0(c,N,O,r,q),U0=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let E of a.matchAll(/\{\{([\s\S]*?)\}\}/g))U0.add(E[1].trim());if(U0.size>0)J.__stx_preserved_client_expressions=[...U0];let M0=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++tL}_${Math.random().toString(36).slice(2,8)}`,w0=a;if(O5){let E="";if(Object.keys($).length>0)try{E=` data-stx-props="${fw(JSON.stringify($))}"`}catch{}let v=B?` stx-hydrate="${fw(B)}"`:"";w0=`<div data-stx-scope="${M0}"${E}${v}>${a}</div>`;let d=await Promise.all(b.map(async(f)=>{let s=f.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!s)return f;let[,G0,s0]=s,S0=AX(s0,{filePath:O,projectRoot:process.cwd()}),f0=S0.code,o0=RX(S0.styles);f0=D5(f0).code;let{hasUserImports:V5,bundleClientScript:M1}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (k7(),N7)));if(V5(f0))f0=await M1(f0,O,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:N1}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (o7(),D8)));f0=f0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(K1,GX)=>N1(GX));let z0=h0(f0),Z1=$O(z0),n=`function(__scopeId) {
14329
+ ${k5("const",[...w6,...Z1],z0)}
14335
14330
  const __scope = window.stx._scopes = window.stx._scopes || {};
14336
14331
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
14337
14332
  const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
@@ -14349,7 +14344,7 @@ ${z0}
14349
14344
  // Register all defined signals and functions in this scope
14350
14345
  const __localVars = {};
14351
14346
  try {
14352
- ${Y1.map((z1)=>`if (typeof ${z1} !== 'undefined') __localVars['${z1}'] = ${z1};`).join(`
14347
+ ${Z1.map((K1)=>`if (typeof ${K1} !== 'undefined') __localVars['${K1}'] = ${K1};`).join(`
14353
14348
  `)}
14354
14349
  }
14355
14350
  catch (e) {}
@@ -14358,29 +14353,29 @@ catch (e) {}
14358
14353
  finally {
14359
14354
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
14360
14355
  }
14361
- }`,J1=B?null:P6(J,n),i1=J1?`window.__stxComponentFactories[${JSON.stringify(J1)}](${JSON.stringify(M0)});`:`(${n})(${JSON.stringify(M0)});`;if(B)return`${a0}<script type="stx/island" data-stx-island="${M0}" data-stx-scoped${G0}>${i1}</script>`;return`${a0}<script data-stx-scoped data-stx-run="always"${G0}>${i1}</script>`}));if(w0=w0+`
14356
+ }`,Y1=B?null:u6(J,n),i1=Y1?`window.__stxComponentFactories[${JSON.stringify(Y1)}](${JSON.stringify(M0)});`:`(${n})(${JSON.stringify(M0)});`;if(B)return`${o0}<script type="stx/island" data-stx-island="${M0}" data-stx-scoped${G0}>${i1}</script>`;return`${o0}<script data-stx-scoped data-stx-run="always"${G0}>${i1}</script>`}));if(w0=w0+`
14362
14357
  `+d.join(`
14363
14358
  `),R0)w0+=`
14364
14359
  `+R0}else{if(R0)w0+=`
14365
14360
  `+R0;if(b.length>0){let E=N.__stx_event_bindings||[],v=a1(N),d=await Promise.all(b.map(async(f)=>{let s=f.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!s)return f;return await t1(s[1],{eventBindings:E,templateContent:w0,filePath:O,projectRoot:process.cwd(),serverData:v})}));w0+=`
14366
14361
  `+d.join(`
14367
- `),N.__stx_event_bindings=[]}}if(s0){let E=K8(w0,O);if(E.hasScoped)w0=E.html}if(x&&m)_4.set(x,{output:w0,dependencies:[...q].filter((E)=>!m.has(E))});return w0}catch(_){return`[Error processing component: ${_ instanceof Error?_.message:String(_)}]`}finally{K.delete(X)}}async function i(X){return Bun.file(X).exists()}function B4(X,$){let Z=g.resolve($),Y=g.resolve(X),J=Z.endsWith(g.sep)?Z:Z+g.sep;if(Y===Z||Y.startsWith(J))return Y;return null}async function W4(X,$,Z,Y){let J=await aL(X,$,Z,Y);if(J===null)return null;let G=B4(J,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((w)=>typeof w==="string"&&w.length>0);for(let w of Q){let q=g.isAbsolute(w)?w:g.resolve(process.cwd(),w);if(B4(J,q))return g.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${X}, from: ${$})`),null}async function aL(X,$,Z,Y){if(Z.debug)console.log(`Resolving template path: ${X} from ${$}`);let J=g.dirname($),G=process.cwd();if(X.startsWith("/")){let z=g.join(G,X),B=B4(z,G);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${X} (from ${$})`),null;if(Z.debug)console.log(`Checking absolute path: ${B}`);if(await i(B)&&Y)Y.add(B);return B}let Q=g.join(J,X);if(await i(Q)){if(Z.debug)console.log(`Found direct path: ${Q}`);if(Y)Y.add(Q);return Q}if(!X.endsWith(".stx")&&!X.endsWith(".jsx")&&!X.endsWith(".tsx"))for(let z of[".stx",".tsx",".jsx"]){let B=`${Q}${z}`;if(await i(B)){if(Z.debug)console.log(`Found direct path with extension: ${B}`);if(Y)Y.add(B);return B}}let w="",q=g.resolve(J),W=process.cwd();for(let z=0;z<10;z++){let B=g.join(q,"layouts"),_=!1;try{_=uL.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(_){w=B;break}let j=g.dirname(q);if(j===q||j.length<W.length)break;q=j}if(w){let z=X.startsWith("layouts/")?X.slice(8):X,B=g.join(w,z);if(await i(B)){if(Z.debug)console.log(`Found in current layouts dir: ${B}`);if(Y)Y.add(B);return B}if(!z.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${_}`);if(Y)Y.add(_);return _}}}if(Z.layoutsDir){let z=g.isAbsolute(Z.layoutsDir)?Z.layoutsDir:g.resolve(process.cwd(),Z.layoutsDir),B=X.startsWith("layouts/")?X.slice(8):X,_=g.join(z,B);if(await i(_)){if(Z.debug)console.log(`Found in options.layoutsDir: ${_}`);if(Y)Y.add(_);return _}if(!X.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(X.startsWith("layouts/")||X.includes("/layouts/")){let z=X.split("layouts/"),B=g.join(Z.partialsDir||J,"layouts",z[1]);if(await i(B)){if(Z.debug)console.log(`Found in layouts path: ${B}`);if(Y)Y.add(B);return B}if(!B.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Z.debug)console.log(`Found in layouts path with extension: ${_}`);if(Y)Y.add(_);return _}}}if(Z.partialsDir){if(w=g.join(Z.partialsDir,"layouts"),await i(w)){let z=g.join(w,X);if(await i(z)){if(Z.debug)console.log(`Found in partials layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}}let K=Z.partialsDir||g.join(process.cwd(),"views"),U=g.join(K,X);if(await i(U)){if(Z.debug)console.log(`Found in views path: ${U}`);if(Y)Y.add(U);return U}if(!X.endsWith(".stx")){let z=`${U}.stx`;if(await i(z)){if(Z.debug)console.log(`Found in views path with extension: ${z}`);if(Y)Y.add(z);return z}}if(J.includes("temp")){let z=g.join(g.dirname(J),"layouts",X);if(await i(z)){if(Z.debug)console.log(`Found in temp layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${X} (referenced from ${$})`);else console.warn(`Template not found: ${X} (referenced from ${$})`);return null}function Iw(X,$,Z){let Y=0,J="",G="";try{if(typeof $==="number"&&$>=0){let Q=X.split(`
14368
- `),w=0;for(let q=0;q<Q.length;q++)if(w+=Q[q].length+1,w>=$){Y=q+1,J=Q[q].trim();let W=Math.max(0,q-2),K=Math.min(Q.length,q+3);G=Q.slice(W,K).map((U,z)=>{let B=W+z+1;return`${B===Y?"> ":" "}${B}: ${U}`}).join(`
14369
- `);break}}else if(Z){let Q=X.indexOf(Z);if(Q>=0)return Iw(X,Q)}}catch{}return{lineNumber:Y,lineContent:J,context:G}}function U0(X,$,Z,Y,J,G){let{lineNumber:Q,context:w}=Iw(Y,J,G),q=Z.split("/").pop(),W=0;if(typeof J==="number"&&J>=0&&Y){let U=Y.lastIndexOf(`
14370
- `,Math.max(0,J-1));W=J-(U+1)+1}let K="";if(Q>0)K+=`
14362
+ `),N.__stx_event_bindings=[]}}if(r0){let E=K8(w0,O);if(E.hasScoped)w0=E.html}if(x&&m)V4.set(x,{output:w0,dependencies:[...q].filter((E)=>!m.has(E))});return w0}catch(_){return`[Error processing component: ${_ instanceof Error?_.message:String(_)}]`}finally{U.delete(X)}}async function i(X){return Bun.file(X).exists()}function A4(X,$){let Z=g.resolve($),Y=g.resolve(X),J=Z.endsWith(g.sep)?Z:Z+g.sep;if(Y===Z||Y.startsWith(J))return Y;return null}async function H4(X,$,Z,Y){let J=await qO(X,$,Z,Y);if(J===null)return null;let G=A4(J,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((w)=>typeof w==="string"&&w.length>0);for(let w of Q){let q=g.isAbsolute(w)?w:g.resolve(process.cwd(),w);if(A4(J,q))return g.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${X}, from: ${$})`),null}async function qO(X,$,Z,Y){if(Z.debug)console.log(`Resolving template path: ${X} from ${$}`);let J=g.dirname($),G=process.cwd();if(X.startsWith("/")){let z=g.join(G,X),B=A4(z,G);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${X} (from ${$})`),null;if(Z.debug)console.log(`Checking absolute path: ${B}`);if(await i(B)&&Y)Y.add(B);return B}let Q=g.join(J,X);if(await i(Q)){if(Z.debug)console.log(`Found direct path: ${Q}`);if(Y)Y.add(Q);return Q}if(!X.endsWith(".stx")&&!X.endsWith(".jsx")&&!X.endsWith(".tsx"))for(let z of[".stx",".tsx",".jsx"]){let B=`${Q}${z}`;if(await i(B)){if(Z.debug)console.log(`Found direct path with extension: ${B}`);if(Y)Y.add(B);return B}}let w="",q=g.resolve(J),W=process.cwd();for(let z=0;z<10;z++){let B=g.join(q,"layouts"),_=!1;try{_=aL.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(_){w=B;break}let j=g.dirname(q);if(j===q||j.length<W.length)break;q=j}if(w){let z=X.startsWith("layouts/")?X.slice(8):X,B=g.join(w,z);if(await i(B)){if(Z.debug)console.log(`Found in current layouts dir: ${B}`);if(Y)Y.add(B);return B}if(!z.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${_}`);if(Y)Y.add(_);return _}}}if(Z.layoutsDir){let z=g.isAbsolute(Z.layoutsDir)?Z.layoutsDir:g.resolve(process.cwd(),Z.layoutsDir),B=X.startsWith("layouts/")?X.slice(8):X,_=g.join(z,B);if(await i(_)){if(Z.debug)console.log(`Found in options.layoutsDir: ${_}`);if(Y)Y.add(_);return _}if(!X.endsWith(".stx")){let j=`${_}.stx`;if(await i(j)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(X.startsWith("layouts/")||X.includes("/layouts/")){let z=X.split("layouts/"),B=g.join(Z.partialsDir||J,"layouts",z[1]);if(await i(B)){if(Z.debug)console.log(`Found in layouts path: ${B}`);if(Y)Y.add(B);return B}if(!B.endsWith(".stx")){let _=`${B}.stx`;if(await i(_)){if(Z.debug)console.log(`Found in layouts path with extension: ${_}`);if(Y)Y.add(_);return _}}}if(Z.partialsDir){if(w=g.join(Z.partialsDir,"layouts"),await i(w)){let z=g.join(w,X);if(await i(z)){if(Z.debug)console.log(`Found in partials layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}}let U=Z.partialsDir||g.join(process.cwd(),"views"),K=g.join(U,X);if(await i(K)){if(Z.debug)console.log(`Found in views path: ${K}`);if(Y)Y.add(K);return K}if(!X.endsWith(".stx")){let z=`${K}.stx`;if(await i(z)){if(Z.debug)console.log(`Found in views path with extension: ${z}`);if(Y)Y.add(z);return z}}if(J.includes("temp")){let z=g.join(g.dirname(J),"layouts",X);if(await i(z)){if(Z.debug)console.log(`Found in temp layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let B=`${z}.stx`;if(await i(B)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${X} (referenced from ${$})`);else console.warn(`Template not found: ${X} (referenced from ${$})`);return null}function gw(X,$,Z){let Y=0,J="",G="";try{if(typeof $==="number"&&$>=0){let Q=X.split(`
14363
+ `),w=0;for(let q=0;q<Q.length;q++)if(w+=Q[q].length+1,w>=$){Y=q+1,J=Q[q].trim();let W=Math.max(0,q-2),U=Math.min(Q.length,q+3);G=Q.slice(W,U).map((K,z)=>{let B=W+z+1;return`${B===Y?"> ":" "}${B}: ${K}`}).join(`
14364
+ `);break}}else if(Z){let Q=X.indexOf(Z);if(Q>=0)return gw(X,Q)}}catch{}return{lineNumber:Y,lineContent:J,context:G}}function K0(X,$,Z,Y,J,G){let{lineNumber:Q,context:w}=gw(Y,J,G),q=Z.split("/").pop(),W=0;if(typeof J==="number"&&J>=0&&Y){let K=Y.lastIndexOf(`
14365
+ `,Math.max(0,J-1));W=J-(K+1)+1}let U="";if(Q>0)U+=`
14371
14366
  ${Z}:${Q}${W>0?`:${W}`:""}: ${X.toLowerCase()} error: ${$}
14372
- `;if(K+=`
14367
+ `;if(U+=`
14373
14368
  ${Z0.bold}${Z0.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${Z0.reset}
14374
- `,K+=`${Z0.bold}${Z0.red}\u2502${Z0.reset} ${Z0.bold}${Z0.bgRed} ERROR ${Z0.reset} ${Z0.red}${X} Error${Z0.reset}${" ".repeat(Math.max(0,43-X.length))}${Z0.bold}${Z0.red}\u2502${Z0.reset}
14375
- `,K+=`${Z0.bold}${Z0.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Z0.reset}
14376
- `,K+=`
14377
- ${Z0.cyan}${Z0.bold}File:${Z0.reset} ${Z0.dim}${q}${Z0.reset}`,Q>0)K+=` ${Z0.gray}(line ${Q}${W>0?`, col ${W}`:""})${Z0.reset}`;if(K+=`
14369
+ `,U+=`${Z0.bold}${Z0.red}\u2502${Z0.reset} ${Z0.bold}${Z0.bgRed} ERROR ${Z0.reset} ${Z0.red}${X} Error${Z0.reset}${" ".repeat(Math.max(0,43-X.length))}${Z0.bold}${Z0.red}\u2502${Z0.reset}
14370
+ `,U+=`${Z0.bold}${Z0.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Z0.reset}
14371
+ `,U+=`
14372
+ ${Z0.cyan}${Z0.bold}File:${Z0.reset} ${Z0.dim}${q}${Z0.reset}`,Q>0)U+=` ${Z0.gray}(line ${Q}${W>0?`, col ${W}`:""})${Z0.reset}`;if(U+=`
14378
14373
  ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${$}
14379
- `,w)K+=`
14374
+ `,w)U+=`
14380
14375
  ${Z0.blue}${Z0.bold}Context:${Z0.reset}
14381
14376
  ${Z0.dim}${w}${Z0.reset}
14382
- `;return K}function EG(){x8.clear(),f8.clear(),_4.clear()}var x8,f8,_4,dL=0,Z0;var T0=D(()=>{D5();s$();w1();G1();C5();sX();E1();k3();nX();F7();Aw();p5();x8=new Z5(500),f8=new Z5(1000),_4=new Z5(2000);Z0={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function Vw(X,$,Z=""){let Y=X,J=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec(X))!==null){let w=Q.index,q=Q[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",K=w+Q[0].length,U=1,z=K,B=-1;while(U>0&&z<X.length){let H=X.indexOf("@markdown",z),O=X.indexOf("@endmarkdown",z);if(O===-1)break;if(H!==-1&&H<O&&H!==w){let L=X[H+9];if(L==="("||L===`
14383
- `||L==="\r"||L===" "||L===void 0)U++;z=H+9}else{if(U--,U===0){B=O;break}z=O+12}}if(B===-1)continue;let _=X.slice(K,B),j=X.slice(w,B+12);J.push({fullMatch:j,options:W,content:_,index:w}),G.lastIndex=B+12}for(let{fullMatch:w,options:q,content:W,index:K}of J)try{let U={};if(q)q.split(",").forEach((_)=>{let j=_.trim();if(j)U[j]=!0});let z={gfm:U.gfm??!0,breaks:U.breaks??!1},B=r1(W.trim(),z);Y=Y.split(w).join(B)}catch(U){let z=U instanceof Error?U.message:String(U),B=U0("Markdown Directive",`Error processing markdown: ${z}`,Z,X,K,w);Y=Y.split(w).join(B)}return Y}async function Ew(X,$,Z,Y){let J={gfm:!0,breaks:!1};return $.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")J.breaks=!0;if(Q==="no-gfm")J.gfm=!1}),r1(X.trim(),J)}var K4=D(()=>{T0()});function XO(X){if(tL.set(X.name,X),X.client)eL.set(X.name,X.client)}function g8(X){return XO(X),{name:X.name,hasEndTag:X.hasEndTag??!0,description:X.description,handler:async(Z,Y,J,G)=>{let Q=$O(Y,X.defaults);if(X.validate){let q=X.validate(Q);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${X.name}`;throw Error(W)}}let w=Z;if(X.transform)w=await X.transform(Z,Q,J,G);if(X.clientScript){let q=X.clientScript(Q);w+=`<script>${q}</script>`}if(X.css){let q=X.css(Q);w+=`<style>${q}</style>`}return w}}}function $O(X,$){let Z={...$};for(let Y of X){let J=Y.indexOf(":"),G=Y.indexOf("="),Q=J>=0&&(G<0||J<G)?J:G;if(Q>=0){let w=Y.slice(0,Q).trim(),q=Y.slice(Q+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Z[w]=q}else{let w=Object.keys(Z).filter((q)=>!$||!(q in $)).length;Z[w===0?"value":`arg${w}`]=Y}}return Z}var tL,eL;var j4=D(()=>{tL=new Map,eL=new Map});function H4(X,$=Z7,Z={},Y){return $.sort((J,G)=>J-G).map((J)=>{return`${ZX(X,{...Z,w:J,fm:Y})} ${J}w`}).join(", ")}function Dw(X,$,Z=ZO,Y={},J){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round($*G);return`${ZX(X,{...Y,w:Q,dpr:G,fm:J})} ${G}x`}).join(", ")}function L4(X,$="100vw"){if(!X||Object.keys(X).length===0)return $;let Y=Object.entries(X).map(([J,G])=>{let Q=/^\d+$/.test(J)?`${J}px`:J;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((J,G)=>J.numericBp-G.numericBp).map(({bp:J,size:G})=>`(max-width: ${J}) ${G}`);return Y.push($),Y.join(", ")}function ZX(X,$={}){let Z=Object.entries($).filter(([,G])=>G!==void 0&&G!==null).map(([G,Q])=>{if(Array.isArray(Q))return[G,Q.join(",")];return[G,String(Q)]});if(Z.length===0)return X;let Y=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),J=X.includes("?")?"&":"?";return`${X}${J}${Y}`}function O4(X){return YO[X]||"application/octet-stream"}var Z7,ZO,$X,YO;var F4=D(()=>{Z7=[320,480,640,768,1024,1280,1536,1920,2560],ZO=[1,1.5,2,3],$X=["avif","webp","jpeg"],YO={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function GO(){try{return await import("ts-images")}catch{return null}}async function QO(X,$={}){let Z={...JO,...$},Y=await GO();if(Y)try{return await wO(X,Z,Y)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return qO(X,Z)}async function wO(X,$,Z){let{generatePlaceholder:Y,generateThumbHash:J}=Z,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[$.strategy]||"blur";if($.strategy==="thumbhash")return{dataURL:(await J(X)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let w=await Y(X,{width:$.width,height:$.height,quality:$.quality,blurLevel:$.blurLevel,strategy:Q,base64Encode:!0});return{dataURL:w.dataURL,width:w.width,height:w.height,aspectRatio:w.aspectRatio,originalWidth:w.originalWidth,originalHeight:w.originalHeight,strategy:$.strategy,dominantColor:w.dominantColor,css:w.css}}function qO(X,$){let Z=$.width||20,Y=$.height||Z,J="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}" viewBox="0 0 ${Z} ${Y}"><rect fill="#e5e7eb" width="${Z}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:Y,aspectRatio:Z/Y,originalWidth:0,originalHeight:0,strategy:$.strategy,dominantColor:"#e5e7eb"}}function yw(X,$,Z={}){let Y=Z.transitionDuration||300,J=Z.easing||"ease-out";return`
14377
+ `;return U}function hG(){x8.clear(),f8.clear(),V4.clear()}var x8,f8,V4,tL=0,Z0;var T0=D(()=>{y5();s$();Q1();J1();P5();oX();E1();k3();rX();V7();Sw();i5();x8=new Z5(500),f8=new Z5(1000),V4=new Z5(2000);Z0={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function bw(X,$,Z=""){let Y=X,J=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec(X))!==null){let w=Q.index,q=Q[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=w+Q[0].length,K=1,z=U,B=-1;while(K>0&&z<X.length){let H=X.indexOf("@markdown",z),O=X.indexOf("@endmarkdown",z);if(O===-1)break;if(H!==-1&&H<O&&H!==w){let L=X[H+9];if(L==="("||L===`
14378
+ `||L==="\r"||L===" "||L===void 0)K++;z=H+9}else{if(K--,K===0){B=O;break}z=O+12}}if(B===-1)continue;let _=X.slice(U,B),j=X.slice(w,B+12);J.push({fullMatch:j,options:W,content:_,index:w}),G.lastIndex=B+12}for(let{fullMatch:w,options:q,content:W,index:U}of J)try{let K={};if(q)q.split(",").forEach((_)=>{let j=_.trim();if(j)K[j]=!0});let z={gfm:K.gfm??!0,breaks:K.breaks??!1},B=r1(W.trim(),z);Y=Y.split(w).join(B)}catch(K){let z=K instanceof Error?K.message:String(K),B=K0("Markdown Directive",`Error processing markdown: ${z}`,Z,X,U,w);Y=Y.split(w).join(B)}return Y}async function hw(X,$,Z,Y){let J={gfm:!0,breaks:!1};return $.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")J.breaks=!0;if(Q==="no-gfm")J.gfm=!1}),r1(X.trim(),J)}var L4=D(()=>{T0()});function KO(X){if(WO.set(X.name,X),X.client)UO.set(X.name,X.client)}function g8(X){return KO(X),{name:X.name,hasEndTag:X.hasEndTag??!0,description:X.description,handler:async(Z,Y,J,G)=>{let Q=zO(Y,X.defaults);if(X.validate){let q=X.validate(Q);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${X.name}`;throw Error(W)}}let w=Z;if(X.transform)w=await X.transform(Z,Q,J,G);if(X.clientScript){let q=X.clientScript(Q);w+=`<script>${q}</script>`}if(X.css){let q=X.css(Q);w+=`<style>${q}</style>`}return w}}}function zO(X,$){let Z={...$};for(let Y of X){let J=Y.indexOf(":"),G=Y.indexOf("="),Q=J>=0&&(G<0||J<G)?J:G;if(Q>=0){let w=Y.slice(0,Q).trim(),q=Y.slice(Q+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Z[w]=q}else{let w=Object.keys(Z).filter((q)=>!$||!(q in $)).length;Z[w===0?"value":`arg${w}`]=Y}}return Z}var WO,UO;var R4=D(()=>{WO=new Map,UO=new Map});function T4(X,$=Y7,Z={},Y){return $.sort((J,G)=>J-G).map((J)=>{return`${YX(X,{...Z,w:J,fm:Y})} ${J}w`}).join(", ")}function uw(X,$,Z=_O,Y={},J){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round($*G);return`${YX(X,{...Y,w:Q,dpr:G,fm:J})} ${G}x`}).join(", ")}function M4(X,$="100vw"){if(!X||Object.keys(X).length===0)return $;let Y=Object.entries(X).map(([J,G])=>{let Q=/^\d+$/.test(J)?`${J}px`:J;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((J,G)=>J.numericBp-G.numericBp).map(({bp:J,size:G})=>`(max-width: ${J}) ${G}`);return Y.push($),Y.join(", ")}function YX(X,$={}){let Z=Object.entries($).filter(([,G])=>G!==void 0&&G!==null).map(([G,Q])=>{if(Array.isArray(Q))return[G,Q.join(",")];return[G,String(Q)]});if(Z.length===0)return X;let Y=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),J=X.includes("?")?"&":"?";return`${X}${J}${Y}`}function N4(X){return BO[X]||"application/octet-stream"}var Y7,_O,ZX,BO;var k4=D(()=>{Y7=[320,480,640,768,1024,1280,1536,1920,2560],_O=[1,1.5,2,3],ZX=["avif","webp","jpeg"],BO={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function HO(){try{return await import("ts-images")}catch{return null}}async function LO(X,$={}){let Z={...jO,...$},Y=await HO();if(Y)try{return await OO(X,Z,Y)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return FO(X,Z)}async function OO(X,$,Z){let{generatePlaceholder:Y,generateThumbHash:J}=Z,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[$.strategy]||"blur";if($.strategy==="thumbhash")return{dataURL:(await J(X)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let w=await Y(X,{width:$.width,height:$.height,quality:$.quality,blurLevel:$.blurLevel,strategy:Q,base64Encode:!0});return{dataURL:w.dataURL,width:w.width,height:w.height,aspectRatio:w.aspectRatio,originalWidth:w.originalWidth,originalHeight:w.originalHeight,strategy:$.strategy,dominantColor:w.dominantColor,css:w.css}}function FO(X,$){let Z=$.width||20,Y=$.height||Z,J="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}" viewBox="0 0 ${Z} ${Y}"><rect fill="#e5e7eb" width="${Z}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:Y,aspectRatio:Z/Y,originalWidth:0,originalHeight:0,strategy:$.strategy,dominantColor:"#e5e7eb"}}function dw(X,$,Z={}){let Y=Z.transitionDuration||300,J=Z.easing||"ease-out";return`
14384
14379
  #${X} {
14385
14380
  --stx-img-transition-duration: ${Y}ms;
14386
14381
  --stx-img-transition-easing: ${J};
@@ -14397,7 +14392,7 @@ ${Z0.dim}${w}${Z0.reset}
14397
14392
  #${X}.stx-img-loaded img {
14398
14393
  opacity: 1;
14399
14394
  }
14400
- `.trim()}async function bw(X,$={}){let Z=`${X}:${JSON.stringify($)}`;if(V4.has(Z))return V4.get(Z);let Y=await QO(X,$);return V4.set(Z,Y),Y}var JO,A4,V4;var Sw=D(()=>{JO={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},A4=`
14395
+ `.trim()}async function mw(X,$={}){let Z=`${X}:${JSON.stringify($)}`;if(I4.has(Z))return I4.get(Z);let Y=await LO(X,$);return I4.set(Z,Y),Y}var jO,E4,I4;var lw=D(()=>{jO={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},E4=`
14401
14396
  .stx-img-placeholder {
14402
14397
  position: relative;
14403
14398
  overflow: hidden;
@@ -14426,8 +14421,8 @@ ${Z0.dim}${w}${Z0.reset}
14426
14421
  filter: blur(0);
14427
14422
  transform: scale(1);
14428
14423
  }
14429
- `.trim();V4=new Map});import{createHash as Pw}from"crypto";import{readFile as WO,stat as vw}from"fs/promises";async function b0(X){try{let $=await WO(X);return Pw("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function Cw(X){return Pw("sha256").update(X).digest("hex").slice(0,16)}function h8(X,$){let Z=JSON.stringify($,Object.keys($).sort());return`${Cw(X)}-${Cw(Z)}`}async function R4(X){try{return(await vw(X)).mtimeMs}catch{return 0}}async function D0(X){try{return await vw(X),!0}catch{return!1}}var j5=()=>{};import{mkdir as KO,readFile as UO,writeFile as zO,readdir as sE,rm as _O,stat as oE}from"fs/promises";import{join as fw,dirname as BO}from"path";async function jO(X){try{await KO(X,{recursive:!0})}catch{}}function gw(X,$,Z){return fw(X,Z,`${$}.json`)}async function xw(X,$,Z){if((Date.now()-X.createdAt)/86400000>Z)return!1;if(await R4($)!==X.srcMtime)return!1;return!0}async function u8(X,$,Z,Y=T4){if(!Y.enabled)return null;let J=h8(X,$),G=Y7.get(J);if(G){if(await xw(G,X,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;Y7.delete(J)}let Q=gw(Y.directory,J,Z);if(await D0(Q))try{let w=await UO(Q,"utf-8"),q=JSON.parse(w);if(await xw(q,X,Y.maxAge))return q.lastAccessedAt=Date.now(),Y7.set(J,q),q.data}catch{}return null}async function d8(X,$,Z,Y,J=T4){if(!J.enabled)return;let G=h8(X,$),Q=await b0(X),w=await R4(X),q={key:G,src:X,srcHash:Q,srcMtime:w,optionsHash:h8("",$),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};Y7.set(G,q);let W=gw(J.directory,G,Y);try{await jO(BO(W)),await zO(W,JSON.stringify(q,null,2))}catch(K){console.warn(`[stx-media] Failed to write cache: ${K}`)}}async function m8(X,$=T4){if(X==="all")Y7.clear();else Y7.clear();let Z=X==="all"?["image","video"]:[X];for(let Y of Z){let J=fw($.directory,Y);try{await _O(J,{recursive:!0,force:!0})}catch{}}}var Y7,T4;var M4=D(()=>{j5();Y7=new Map,T4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class c8{config;constructor(X={}){this.config={...HO,...X}}async get(X,$){return u8(X,$,"image",this.config)}async set(X,$,Z){return d8(X,$,Z,"image",this.config)}async clear(){return m8("image",this.config)}updateConfig(X){this.config={...this.config,...X}}}function N4(X){if(!l8)l8=new c8(X);else if(X)l8.updateConfig(X);return l8}async function p8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return N4(Y).get(X,$)}async function i8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return N4(J).set(X,$,Z)}async function hw(){return N4().clear()}var HO,l8=null;var k4=D(()=>{M4();HO={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as LO,basename as OO,extname as FO,join as VO}from"path";import{mkdir as AO}from"fs/promises";async function I4(){try{return await import("ts-images")}catch{return null}}function uw(X){switch(X){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function RO(X,$){let Z=$?uw($):uw("web"),Y=X.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function dw(X,$,Z){let Y=await I4();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:X,processed:!1};let J=await p8(X,$,Z);if(J)return J;try{let G=LO(X);if(!await D0(G))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let Q=RO(Z,$.preset),w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await AO(w,{recursive:!0});let W=await b0(G),K=OO(X,FO(X)),U=$.outputFormat?[$.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],z={src:X,processed:!0,variants:[],hash:W},B=null;if($.transformations&&$.transformations.length>0)B=await E4(G,$.transformations,Y);for(let _ of U){let j=Q[_]||{},H=`${K}-${W}.${_}`,O=VO(w,H);try{let L=await Y.optimizeImage({input:B||G,output:O,format:_,quality:j.quality,progressive:j.progressive});if(L){if(z.variants.push({path:O,url:`${q}/${H}`,width:L.width||0,height:L.height||0,format:_,size:L.outputSize||0}),!z.originalWidth&&L.width)z.originalWidth=L.width,z.originalHeight=L.height}}catch(L){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${_}: ${L}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let _=await Y.generateThumbHash(G);z.placeholder=_.dataUrl}catch(_){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${_}`)}if($.useDominantColor)try{let _=await Y.generatePlaceholder(G,{strategy:"dominant-color"});z.dominantColor=_.dominantColor}catch(_){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${_}`)}return await i8(X,$,z,Z),z}catch(G){return{src:X,processed:!1,errors:[`Processing failed: ${G}`]}}}async function mw(X,$,Z,Y){let J=await I4();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:X,output:Y,format:$,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function E4(X,$,Z){let Y=Z||await I4();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode(X);for(let G of $){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var lw=D(()=>{j5();k4()});import{resolve as TO,basename as MO,extname as NO,join as kO}from"path";import{mkdir as IO}from"fs/promises";async function EO(){try{return await import("ts-images")}catch{return null}}async function cw(X,$,Z){let Y=await EO();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=TO(X);if(!await D0(J))return console.warn(`[stx-media] Source file not found: ${X}`),null;try{let G=$.responsiveWidths||Z.breakpoints||DO,Q=$.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await IO(w,{recursive:!0});let W=await b0(J),K=MO(X,NO(X)),U=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:X,byFormat:{},srcsets:{}};for(let _ of Q){z.byFormat[_]=[];let j=[];for(let H of G){let O=`${K}-${H}w-${W}.${_}`,L=kO(w,O),F=`${q}/${O}`;try{let V=U[_]?.quality||80;if(await D0(L)){z.byFormat[_].push({path:L,url:F,width:H,height:0,format:_,size:0}),j.push(`${F} ${H}w`);continue}let A=await Y.processImage({input:J,output:L,format:_,quality:V,resize:{width:H}});if(A)z.byFormat[_].push({path:L,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:_,size:A.outputSize||0}),j.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${_} at ${H}w: ${V}`)}}z.srcsets[_]=j.join(", ")}let B=$.placeholder||Z.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let _=await Y.generateThumbHash(J);z.placeholder={dataURL:_.dataUrl,width:_.width||32,height:_.height||32,strategy:"thumbhash"}}else{let _=await Y.generatePlaceholder(J,{strategy:B,width:20});z.placeholder={dataURL:_.dataURL,width:_.width,height:_.height,strategy:B}}}catch(_){console.warn(`[stx-media] Failed to generate placeholder: ${_}`)}return z.sizes=$.sizes||yO(G),z}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function yO(X){let $=[...X].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<$.length-1;Y++){let J=$[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${$[$.length-1]}px`),Z.join(", ")}function pw(X,$="width"){if(!X||X.length===0)return"";if($==="dpr")return X.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return X.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var DO;var iw=D(()=>{j5();DO=[320,480,640,768,1024,1280,1536,1920]});var nw={};t(nw,{setCachedImageResult:()=>i8,processImage:()=>dw,optimizeImage:()=>mw,getCachedImageResult:()=>p8,generateSrcset:()=>pw,generateResponsiveVariants:()=>cw,clearImageCache:()=>hw,applyTransformations:()=>E4,ImageProcessorCache:()=>c8});var rw=D(()=>{lw();iw();k4()});async function bO(){try{return await Promise.resolve().then(() => (rw(),nw))}catch(X){if(!sw)console.warn("[stx-media] Image processor not available, some features disabled:",X),sw=!0;return null}}async function n8(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return vO(Y,Z)}if(Z.processedResult?.processed)return S4(X,Z.processedResult,$);if(Z.responsiveVariants)return ew(X,Z.responsiveVariants,$);let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=Z7,dpr:K,formats:U=$X,quality:z=D4,params:B={},placeholder:_="none",placeholderOptions:j={},lazy:H=!0,priority:O=!1,loading:L=O?"eager":s8,decoding:F=r8,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:T,referrerpolicy:M}=X,k=X.class,N=X.style,y=X.id,I=X.data||{},{isDev:C=!1,baseUrl:S=""}=$;if(C&&!$.optimize)return PO(X);let b,P,x=y||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(_!=="none"&&!O)try{b=await bw(J,{strategy:_,...j}),P=yw(x,b,j)}catch{}let m=K!==void 0&&Q!==void 0,l;if(m)l=CO(X,x,b,$);else l=await SO(X,x,b,$);let Q0;if(O){let s0=U.includes("webp")?"webp":U[0],c=H4(J,W,{...B,q:z},s0),j0=typeof q==="object"?L4(q):q||"100vw";Q0=`<link rel="preload" as="image" imagesrcset="${c}" imagesizes="${j0}" />`}let c0=[];if(!ow&&_!=="none")c0.push(A4),ow=!0;if(P)c0.push(P);let R0=H?tw(x):void 0;return{html:l,preloadLink:Q0,css:c0.length>0?c0.join(`
14430
- `):void 0,script:R0}}async function SO(X,$,Z,Y){let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=Z7,formats:K=$X,quality:U=D4,params:z={},lazy:B=!0,priority:_=!1,loading:j=_?"eager":s8,decoding:H=r8,fetchpriority:O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A}=X,R=X.class,T=X.style,M=X.data||{},k=typeof q==="object"?L4(q):q||"100vw",N=[];for(let C of K){let S=H4(J,W,{...z,q:U},C),b=O4(C);if(B&&!_)N.push(` <source type="${b}" data-srcset="${S}" data-sizes="${k}" />`);else N.push(` <source type="${b}" srcset="${S}" sizes="${k}" />`)}let y=y4({src:ZX(J,{...z,q:U}),alt:G,width:Q,height:w,loading:_?void 0:j,decoding:H,fetchpriority:_?"high":O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A,className:aw(R,Z),style:b4(T,L,F,Z),lazy:B&&!_,data:M}),I;if(Z){let C=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${$}" class="stx-img-placeholder" style="${C}">
14424
+ `.trim();I4=new Map});import{createHash as pw}from"crypto";import{readFile as VO,stat as iw}from"fs/promises";async function b0(X){try{let $=await VO(X);return pw("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function cw(X){return pw("sha256").update(X).digest("hex").slice(0,16)}function h8(X,$){let Z=JSON.stringify($,Object.keys($).sort());return`${cw(X)}-${cw(Z)}`}async function D4(X){try{return(await iw(X)).mtimeMs}catch{return 0}}async function D0(X){try{return await iw(X),!0}catch{return!1}}var H5=()=>{};import{mkdir as AO,readFile as RO,writeFile as TO,readdir as _D,rm as MO,stat as BD}from"fs/promises";import{join as rw,dirname as NO}from"path";async function kO(X){try{await AO(X,{recursive:!0})}catch{}}function sw(X,$,Z){return rw(X,Z,`${$}.json`)}async function nw(X,$,Z){if((Date.now()-X.createdAt)/86400000>Z)return!1;if(await D4($)!==X.srcMtime)return!1;return!0}async function u8(X,$,Z,Y=y4){if(!Y.enabled)return null;let J=h8(X,$),G=J7.get(J);if(G){if(await nw(G,X,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;J7.delete(J)}let Q=sw(Y.directory,J,Z);if(await D0(Q))try{let w=await RO(Q,"utf-8"),q=JSON.parse(w);if(await nw(q,X,Y.maxAge))return q.lastAccessedAt=Date.now(),J7.set(J,q),q.data}catch{}return null}async function d8(X,$,Z,Y,J=y4){if(!J.enabled)return;let G=h8(X,$),Q=await b0(X),w=await D4(X),q={key:G,src:X,srcHash:Q,srcMtime:w,optionsHash:h8("",$),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};J7.set(G,q);let W=sw(J.directory,G,Y);try{await kO(NO(W)),await TO(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function m8(X,$=y4){if(X==="all")J7.clear();else J7.clear();let Z=X==="all"?["image","video"]:[X];for(let Y of Z){let J=rw($.directory,Y);try{await MO(J,{recursive:!0,force:!0})}catch{}}}var J7,y4;var b4=D(()=>{H5();J7=new Map,y4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class c8{config;constructor(X={}){this.config={...IO,...X}}async get(X,$){return u8(X,$,"image",this.config)}async set(X,$,Z){return d8(X,$,Z,"image",this.config)}async clear(){return m8("image",this.config)}updateConfig(X){this.config={...this.config,...X}}}function S4(X){if(!l8)l8=new c8(X);else if(X)l8.updateConfig(X);return l8}async function p8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return S4(Y).get(X,$)}async function i8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return S4(J).set(X,$,Z)}async function ow(){return S4().clear()}var IO,l8=null;var C4=D(()=>{b4();IO={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as EO,basename as DO,extname as yO,join as bO}from"path";import{mkdir as SO}from"fs/promises";async function P4(){try{return await import("ts-images")}catch{return null}}function aw(X){switch(X){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function CO(X,$){let Z=$?aw($):aw("web"),Y=X.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function tw(X,$,Z){let Y=await P4();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:X,processed:!1};let J=await p8(X,$,Z);if(J)return J;try{let G=EO(X);if(!await D0(G))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let Q=CO(Z,$.preset),w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await SO(w,{recursive:!0});let W=await b0(G),U=DO(X,yO(X)),K=$.outputFormat?[$.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],z={src:X,processed:!0,variants:[],hash:W},B=null;if($.transformations&&$.transformations.length>0)B=await v4(G,$.transformations,Y);for(let _ of K){let j=Q[_]||{},H=`${U}-${W}.${_}`,O=bO(w,H);try{let L=await Y.optimizeImage({input:B||G,output:O,format:_,quality:j.quality,progressive:j.progressive});if(L){if(z.variants.push({path:O,url:`${q}/${H}`,width:L.width||0,height:L.height||0,format:_,size:L.outputSize||0}),!z.originalWidth&&L.width)z.originalWidth=L.width,z.originalHeight=L.height}}catch(L){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${_}: ${L}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let _=await Y.generateThumbHash(G);z.placeholder=_.dataUrl}catch(_){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${_}`)}if($.useDominantColor)try{let _=await Y.generatePlaceholder(G,{strategy:"dominant-color"});z.dominantColor=_.dominantColor}catch(_){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${_}`)}return await i8(X,$,z,Z),z}catch(G){return{src:X,processed:!1,errors:[`Processing failed: ${G}`]}}}async function ew(X,$,Z,Y){let J=await P4();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:X,output:Y,format:$,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function v4(X,$,Z){let Y=Z||await P4();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode(X);for(let G of $){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var Xq=D(()=>{H5();C4()});import{resolve as PO,basename as vO,extname as xO,join as fO}from"path";import{mkdir as gO}from"fs/promises";async function hO(){try{return await import("ts-images")}catch{return null}}async function $q(X,$,Z){let Y=await hO();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=PO(X);if(!await D0(J))return console.warn(`[stx-media] Source file not found: ${X}`),null;try{let G=$.responsiveWidths||Z.breakpoints||uO,Q=$.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await gO(w,{recursive:!0});let W=await b0(J),U=vO(X,xO(X)),K=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:X,byFormat:{},srcsets:{}};for(let _ of Q){z.byFormat[_]=[];let j=[];for(let H of G){let O=`${U}-${H}w-${W}.${_}`,L=fO(w,O),F=`${q}/${O}`;try{let V=K[_]?.quality||80;if(await D0(L)){z.byFormat[_].push({path:L,url:F,width:H,height:0,format:_,size:0}),j.push(`${F} ${H}w`);continue}let A=await Y.processImage({input:J,output:L,format:_,quality:V,resize:{width:H}});if(A)z.byFormat[_].push({path:L,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:_,size:A.outputSize||0}),j.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${_} at ${H}w: ${V}`)}}z.srcsets[_]=j.join(", ")}let B=$.placeholder||Z.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let _=await Y.generateThumbHash(J);z.placeholder={dataURL:_.dataUrl,width:_.width||32,height:_.height||32,strategy:"thumbhash"}}else{let _=await Y.generatePlaceholder(J,{strategy:B,width:20});z.placeholder={dataURL:_.dataURL,width:_.width,height:_.height,strategy:B}}}catch(_){console.warn(`[stx-media] Failed to generate placeholder: ${_}`)}return z.sizes=$.sizes||dO(G),z}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function dO(X){let $=[...X].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<$.length-1;Y++){let J=$[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${$[$.length-1]}px`),Z.join(", ")}function Zq(X,$="width"){if(!X||X.length===0)return"";if($==="dpr")return X.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return X.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var uO;var Yq=D(()=>{H5();uO=[320,480,640,768,1024,1280,1536,1920]});var Jq={};t(Jq,{setCachedImageResult:()=>i8,processImage:()=>tw,optimizeImage:()=>ew,getCachedImageResult:()=>p8,generateSrcset:()=>Zq,generateResponsiveVariants:()=>$q,clearImageCache:()=>ow,applyTransformations:()=>v4,ImageProcessorCache:()=>c8});var Gq=D(()=>{Xq();Yq();C4()});async function mO(){try{return await Promise.resolve().then(() => (Gq(),Jq))}catch(X){if(!Qq)console.warn("[stx-media] Image processor not available, some features disabled:",X),Qq=!0;return null}}async function n8(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return iO(Y,Z)}if(Z.processedResult?.processed)return h4(X,Z.processedResult,$);if(Z.responsiveVariants)return Uq(X,Z.responsiveVariants,$);let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=Y7,dpr:U,formats:K=ZX,quality:z=x4,params:B={},placeholder:_="none",placeholderOptions:j={},lazy:H=!0,priority:O=!1,loading:L=O?"eager":s8,decoding:F=r8,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:T,referrerpolicy:M}=X,k=X.class,N=X.style,y=X.id,I=X.data||{},{isDev:C=!1,baseUrl:S=""}=$;if(C&&!$.optimize)return pO(X);let b,P,x=y||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(_!=="none"&&!O)try{b=await mw(J,{strategy:_,...j}),P=dw(x,b,j)}catch{}let m=U!==void 0&&Q!==void 0,l;if(m)l=cO(X,x,b,$);else l=await lO(X,x,b,$);let Q0;if(O){let r0=K.includes("webp")?"webp":K[0],c=T4(J,W,{...B,q:z},r0),j0=typeof q==="object"?M4(q):q||"100vw";Q0=`<link rel="preload" as="image" imagesrcset="${c}" imagesizes="${j0}" />`}let l0=[];if(!wq&&_!=="none")l0.push(E4),wq=!0;if(P)l0.push(P);let R0=H?Wq(x):void 0;return{html:l,preloadLink:Q0,css:l0.length>0?l0.join(`
14425
+ `):void 0,script:R0}}async function lO(X,$,Z,Y){let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=Y7,formats:U=ZX,quality:K=x4,params:z={},lazy:B=!0,priority:_=!1,loading:j=_?"eager":s8,decoding:H=r8,fetchpriority:O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A}=X,R=X.class,T=X.style,M=X.data||{},k=typeof q==="object"?M4(q):q||"100vw",N=[];for(let C of U){let S=T4(J,W,{...z,q:K},C),b=N4(C);if(B&&!_)N.push(` <source type="${b}" data-srcset="${S}" data-sizes="${k}" />`);else N.push(` <source type="${b}" srcset="${S}" sizes="${k}" />`)}let y=f4({src:YX(J,{...z,q:K}),alt:G,width:Q,height:w,loading:_?void 0:j,decoding:H,fetchpriority:_?"high":O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A,className:qq(R,Z),style:g4(T,L,F,Z),lazy:B&&!_,data:M}),I;if(Z){let C=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${$}" class="stx-img-placeholder" style="${C}">
14431
14426
  <picture>
14432
14427
  ${N.join(`
14433
14428
  `)}
@@ -14437,9 +14432,9 @@ ${N.join(`
14437
14432
  ${N.join(`
14438
14433
  `)}
14439
14434
  <img ${y} />
14440
- </picture>`;return I}function CO(X,$,Z,Y){let{src:J,alt:G,width:Q,height:w,dpr:q=[1,2,3],quality:W=D4,params:K={},lazy:U=!0,priority:z=!1,loading:B=z?"eager":s8,decoding:_=r8,fetchpriority:j,objectFit:H,objectPosition:O,crossorigin:L,referrerpolicy:F}=X,V=X.class,A=X.style,R=X.data||{},T=typeof Q==="number"?Q:Number.parseInt(String(Q),10),M=Dw(J,T,q,{...K,q:W}),k=y4({src:ZX(J,{...K,w:T,q:W}),alt:G,width:Q,height:w,loading:z?void 0:B,decoding:_,fetchpriority:z?"high":j,objectFit:H,objectPosition:O,crossorigin:L,referrerpolicy:F,className:aw(V,Z),style:b4(A,H,O,Z),lazy:U&&!z,data:R}),N=U&&!z?`data-srcset="${M}"`:`srcset="${M}"`;if(Z){let y=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${$}" class="stx-img-placeholder" style="${y}">
14435
+ </picture>`;return I}function cO(X,$,Z,Y){let{src:J,alt:G,width:Q,height:w,dpr:q=[1,2,3],quality:W=x4,params:U={},lazy:K=!0,priority:z=!1,loading:B=z?"eager":s8,decoding:_=r8,fetchpriority:j,objectFit:H,objectPosition:O,crossorigin:L,referrerpolicy:F}=X,V=X.class,A=X.style,R=X.data||{},T=typeof Q==="number"?Q:Number.parseInt(String(Q),10),M=uw(J,T,q,{...U,q:W}),k=f4({src:YX(J,{...U,w:T,q:W}),alt:G,width:Q,height:w,loading:z?void 0:B,decoding:_,fetchpriority:z?"high":j,objectFit:H,objectPosition:O,crossorigin:L,referrerpolicy:F,className:qq(V,Z),style:g4(A,H,O,Z),lazy:K&&!z,data:R}),N=K&&!z?`data-srcset="${M}"`:`srcset="${M}"`;if(Z){let y=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${$}" class="stx-img-placeholder" style="${y}">
14441
14436
  <img ${k} ${N} />
14442
- </div>`}return`<img ${$?`id="${$}" `:""}${k} ${N} />`}function PO(X){let{src:$,alt:Z,width:Y,height:J,loading:G=s8,decoding:Q=r8,fetchpriority:w,objectFit:q,objectPosition:W,crossorigin:K,referrerpolicy:U,priority:z=!1}=X,B=X.class,_=X.style,j=X.id,H=X.data||{};return{html:`<img ${y4({src:$,alt:Z,width:Y,height:J,loading:z?"eager":G,decoding:Q,fetchpriority:z?"high":w,objectFit:q,objectPosition:W,crossorigin:K,referrerpolicy:U,className:B,style:b4(_,q,W),id:j,data:H})} />`}}function y4(X){let $=[];if(X.lazy)$.push(`data-src="${Z1(X.src)}"`),$.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else $.push(`src="${Z1(X.src)}"`);if($.push(`alt="${Z1(X.alt)}"`),X.width)$.push(`width="${X.width}"`);if(X.height)$.push(`height="${X.height}"`);if(X.loading)$.push(`loading="${X.loading}"`);if(X.decoding)$.push(`decoding="${X.decoding}"`);if(X.fetchpriority)$.push(`fetchpriority="${X.fetchpriority}"`);if(X.crossorigin)$.push(`crossorigin="${X.crossorigin}"`);if(X.referrerpolicy)$.push(`referrerpolicy="${X.referrerpolicy}"`);if(X.className)$.push(`class="${Z1(X.className)}"`);if(X.style)$.push(`style="${Z1(X.style)}"`);if(X.id)$.push(`id="${Z1(X.id)}"`);if(X.data)for(let[Z,Y]of Object.entries(X.data))$.push(`data-${Z}="${Z1(Y)}"`);if(X.lazy)$.push("data-stx-lazy");return $.join(" ")}function aw(X,$){let Z=[];if(X)Z.push(X);if($)Z.push("stx-img-blur");return Z.join(" ")||""}function b4(X,$,Z,Y){let J=[];if($)J.push(`object-fit: ${$}`);if(Z)J.push(`object-position: ${Z}`);if(Y)J.push("opacity: 0; transition: opacity 300ms ease-out");if(X)J.push(X);return J.join("; ")}function Z1(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function tw(X){return`
14437
+ </div>`}return`<img ${$?`id="${$}" `:""}${k} ${N} />`}function pO(X){let{src:$,alt:Z,width:Y,height:J,loading:G=s8,decoding:Q=r8,fetchpriority:w,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K,priority:z=!1}=X,B=X.class,_=X.style,j=X.id,H=X.data||{};return{html:`<img ${f4({src:$,alt:Z,width:Y,height:J,loading:z?"eager":G,decoding:Q,fetchpriority:z?"high":w,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K,className:B,style:g4(_,q,W),id:j,data:H})} />`}}function f4(X){let $=[];if(X.lazy)$.push(`data-src="${$1(X.src)}"`),$.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else $.push(`src="${$1(X.src)}"`);if($.push(`alt="${$1(X.alt)}"`),X.width)$.push(`width="${X.width}"`);if(X.height)$.push(`height="${X.height}"`);if(X.loading)$.push(`loading="${X.loading}"`);if(X.decoding)$.push(`decoding="${X.decoding}"`);if(X.fetchpriority)$.push(`fetchpriority="${X.fetchpriority}"`);if(X.crossorigin)$.push(`crossorigin="${X.crossorigin}"`);if(X.referrerpolicy)$.push(`referrerpolicy="${X.referrerpolicy}"`);if(X.className)$.push(`class="${$1(X.className)}"`);if(X.style)$.push(`style="${$1(X.style)}"`);if(X.id)$.push(`id="${$1(X.id)}"`);if(X.data)for(let[Z,Y]of Object.entries(X.data))$.push(`data-${Z}="${$1(Y)}"`);if(X.lazy)$.push("data-stx-lazy");return $.join(" ")}function qq(X,$){let Z=[];if(X)Z.push(X);if($)Z.push("stx-img-blur");return Z.join(" ")||""}function g4(X,$,Z,Y){let J=[];if($)J.push(`object-fit: ${$}`);if(Z)J.push(`object-position: ${Z}`);if(Y)J.push("opacity: 0; transition: opacity 300ms ease-out");if(X)J.push(X);return J.join("; ")}function $1(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Wq(X){return`
14443
14438
  (function() {
14444
14439
  const container = document.getElementById('${X}');
14445
14440
  if (!container) return;
@@ -14476,7 +14471,7 @@ ${N.join(`
14476
14471
 
14477
14472
  observer.observe(container);
14478
14473
  })();
14479
- `.trim()}async function vO(X,$){let Z=await bO();if(!Z)return n8({...X,process:!1},$);let Y=$.tsImagesConfig;if(X.responsiveWidths&&X.responsiveWidths.length>0||X.widths&&X.widths.length>0||!X.width&&!X.dpr){let G=await Z.generateResponsiveVariants(X.src,X,Y);if(G)return ew(X,G,$)}else{let G=await Z.processImage(X.src,X,Y);if(G.processed)return S4(X,G,$)}return n8({...X,process:!1},$)}async function S4(X,$,Z){let{alt:Y,width:J,height:G,lazy:Q=!0,priority:w=!1,objectFit:q,objectPosition:W,crossorigin:K,referrerpolicy:U}=X,z=X.class,B=X.style,_=X.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,j=X.data||{},H=$.variants||[],O=H.find((P)=>P.format==="jpeg")||H.find((P)=>P.format==="webp")||H[0],L=O?.url||X.src,F=H.filter((P)=>P.format===(O?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of H){if(!V.has(P.format))V.set(P.format,[]);V.get(P.format).push(P)}let A=[],R=["avif","webp","jpeg","png"];for(let P of R){let x=V.get(P);if(x&&x.length>0){let m=x.map((Q0)=>`${Q0.url} ${Q0.width}w`).join(", "),l=O4(P);if(Q&&!w)A.push(` <source type="${l}" data-srcset="${m}" />`);else A.push(` <source type="${l}" srcset="${m}" />`)}}let T=[];if(Q&&!w){if(T.push(`data-src="${Z1(L)}"`),T.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)T.push(`data-srcset="${F}"`)}else if(T.push(`src="${Z1(L)}"`),F)T.push(`srcset="${F}"`);T.push(`alt="${Z1(Y)}"`);let M=J||$.originalWidth,k=G||$.originalHeight;if(M)T.push(`width="${M}"`);if(k)T.push(`height="${k}"`);if(!w)T.push(`loading="${Q?"lazy":"eager"}"`);if(T.push('decoding="async"'),w)T.push('fetchpriority="high"');if(K)T.push(`crossorigin="${K}"`);if(U)T.push(`referrerpolicy="${U}"`);let N=[];if(q)N.push(`object-fit: ${q}`);if(W)N.push(`object-position: ${W}`);if($.placeholder&&Q)N.push("opacity: 0; transition: opacity 300ms ease-out");if(B)N.push(B);if(N.length>0)T.push(`style="${N.join("; ")}"`);let y=[];if(z)y.push(z);if($.placeholder)y.push("stx-img-blur");if(y.length>0)T.push(`class="${y.join(" ")}"`);if(Q&&!w)T.push("data-stx-lazy");for(let[P,x]of Object.entries(j))T.push(`data-${P}="${Z1(x)}"`);let I;if($.placeholder||$.dominantColor&&X.useDominantColor){let P=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;I=`<div id="${_}" class="stx-img-placeholder" style="${P}">
14474
+ `.trim()}async function iO(X,$){let Z=await mO();if(!Z)return n8({...X,process:!1},$);let Y=$.tsImagesConfig;if(X.responsiveWidths&&X.responsiveWidths.length>0||X.widths&&X.widths.length>0||!X.width&&!X.dpr){let G=await Z.generateResponsiveVariants(X.src,X,Y);if(G)return Uq(X,G,$)}else{let G=await Z.processImage(X.src,X,Y);if(G.processed)return h4(X,G,$)}return n8({...X,process:!1},$)}async function h4(X,$,Z){let{alt:Y,width:J,height:G,lazy:Q=!0,priority:w=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:K}=X,z=X.class,B=X.style,_=X.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,j=X.data||{},H=$.variants||[],O=H.find((P)=>P.format==="jpeg")||H.find((P)=>P.format==="webp")||H[0],L=O?.url||X.src,F=H.filter((P)=>P.format===(O?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of H){if(!V.has(P.format))V.set(P.format,[]);V.get(P.format).push(P)}let A=[],R=["avif","webp","jpeg","png"];for(let P of R){let x=V.get(P);if(x&&x.length>0){let m=x.map((Q0)=>`${Q0.url} ${Q0.width}w`).join(", "),l=N4(P);if(Q&&!w)A.push(` <source type="${l}" data-srcset="${m}" />`);else A.push(` <source type="${l}" srcset="${m}" />`)}}let T=[];if(Q&&!w){if(T.push(`data-src="${$1(L)}"`),T.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)T.push(`data-srcset="${F}"`)}else if(T.push(`src="${$1(L)}"`),F)T.push(`srcset="${F}"`);T.push(`alt="${$1(Y)}"`);let M=J||$.originalWidth,k=G||$.originalHeight;if(M)T.push(`width="${M}"`);if(k)T.push(`height="${k}"`);if(!w)T.push(`loading="${Q?"lazy":"eager"}"`);if(T.push('decoding="async"'),w)T.push('fetchpriority="high"');if(U)T.push(`crossorigin="${U}"`);if(K)T.push(`referrerpolicy="${K}"`);let N=[];if(q)N.push(`object-fit: ${q}`);if(W)N.push(`object-position: ${W}`);if($.placeholder&&Q)N.push("opacity: 0; transition: opacity 300ms ease-out");if(B)N.push(B);if(N.length>0)T.push(`style="${N.join("; ")}"`);let y=[];if(z)y.push(z);if($.placeholder)y.push("stx-img-blur");if(y.length>0)T.push(`class="${y.join(" ")}"`);if(Q&&!w)T.push("data-stx-lazy");for(let[P,x]of Object.entries(j))T.push(`data-${P}="${$1(x)}"`);let I;if($.placeholder||$.dominantColor&&X.useDominantColor){let P=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;I=`<div id="${_}" class="stx-img-placeholder" style="${P}">
14480
14475
  <picture>
14481
14476
  ${A.join(`
14482
14477
  `)}
@@ -14486,12 +14481,12 @@ ${A.join(`
14486
14481
  ${A.join(`
14487
14482
  `)}
14488
14483
  <img ${T.join(" ")} />
14489
- </picture>`;let C=[];if($.placeholder)C.push(A4);let S=Q?tw(_):void 0,b;if(w&&F)b=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:I,preloadLink:b,css:C.length>0?C.join(`
14490
- `):void 0,script:S}}async function ew(X,$,Z){let Y={src:$.src,processed:!0,variants:[],placeholder:$.placeholder?.dataURL,originalWidth:$.placeholder?.width,originalHeight:$.placeholder?.height};for(let[J,G]of Object.entries($.byFormat))if(G)Y.variants.push(...G);return S4(X,Y,Z)}var sw=!1,D4=80,r8="async",s8="lazy",ow=!1;var Xq=D(()=>{F4();Sw()});function xO(){return g8({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(X,$,Z,Y)=>{let{src:J,alt:G,options:Q}=fO(X,$,Z);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let w={src:J,alt:G||"",widths:Q.widths||Z7,formats:Q.formats||$X,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},q=Z.__isDev||!1,W=await n8(w,{isDev:q}),K=W.html;if(W.preloadLink)K=W.preloadLink+`
14491
- `+K;if(W.css)K+=`
14492
- <style>${W.css}</style>`;if(W.script)K+=`
14493
- <script>${W.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function fO(X,$,Z){if($.src)return{src:String($.src),alt:String($.alt||""),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=gO(Y),G=C4(J[0],Z)||"",Q=C4(J[1],Z)||"",w={};if(J[2]){let q=C4(J[2],Z);if(typeof q==="object"&&q!==null)w=q;else if(typeof J[2]==="string")try{w=JSON.parse(J[2])}catch{}}return{src:G,alt:Q,options:w}}function gO(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let w=0;w<X.length;w++){let q=X[w],W=w>0?X[w-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!Y)Y=!0,J=q;else if(q===J)Y=!1,J="";else Z+=q;continue}if(!Y){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())$.push(Z.trim());return $}function C4(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var $q;var Zq=D(()=>{j4();Xq();F4();$q=xO()});class a8{config;constructor(X={}){this.config={...hO,...X}}async get(X,$){return u8(X,$,"video",this.config)}async set(X,$,Z){return d8(X,$,Z,"video",this.config)}async clear(){return m8("video",this.config)}updateConfig(X){this.config={...this.config,...X}}}function P4(X){if(!o8)o8=new a8(X);else if(X)o8.updateConfig(X);return o8}async function t8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return P4(Y).get(X,$)}async function e8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return P4(J).set(X,$,Z)}async function Yq(){return P4().clear()}var hO,o8=null;var v4=D(()=>{M4();hO={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as x4,basename as f4,extname as g4,join as X$}from"path";import{mkdir as h4}from"fs/promises";async function u4(){try{return await import("ts-videos")}catch{return null}}async function $$(X,$,Z,Y){let J=await u4();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=x4(X);if(!await D0(G))return null;await h4(Z,{recursive:!0});let Q=await b0(G),w=f4(X,g4(X)),q=$.format||"webp",W=$.timestamp||0,K=`${w}-poster-${Q}.${q}`,U=X$(Z,K),z=await J.extractThumbnails(G,{timestamps:[W],width:$.width||1280,height:$.height,format:q,quality:$.quality||85,outputDir:Z,outputPattern:K.replace(`.${q}`,"")});if(z&&z.length>0){let B=z[0];return{path:U,url:`${Y}/${K}`,width:B.width||$.width||1280,height:B.height||720,timestamp:W,size:B.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function Z$(X,$,Z,Y){let J=await u4();if(!J)return[];try{let G=x4(X);if(!await D0(G))return[];await h4(Z,{recursive:!0});let Q=await b0(G),w=f4(X,g4(X)),q=$.format||"webp",U=(await new J.Input(G).getInfo()).duration||60,z=$.count||10,B=$.interval||U/z,_=[];for(let H=0;H<z&&H*B<U;H++)_.push(H*B);let j=await J.extractThumbnails(G,{timestamps:_,width:$.width||320,format:q,quality:$.quality||80,outputDir:Z,outputPattern:`${w}-thumb-${Q}`});if(j&&j.length>0)return j.map((H,O)=>({path:H.path||X$(Z,`${w}-thumb-${Q}-${O}.${q}`),url:`${Y}/${w}-thumb-${Q}-${O}.${q}`,width:H.width||$.width||320,height:H.height||180,timestamp:_[O],size:H.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function Jq(X,$,Z,Y){let J=await u4();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=x4(X);if(!await D0(G))return null;await h4(Z,{recursive:!0});let Q=await b0(G),w=f4(X,g4(X)),K=(await new J.Input(G).getInfo()).duration||60,U=$.columns||10,z=$.interval||5,B=$.thumbnailWidth||160,_=$.thumbnailHeight||90,j=$.format||"jpeg",H=Math.ceil(K/z),O=Math.ceil(H/U),L=`${w}-sprite-${Q}.${j}`,F=X$(Z,L),V=[];for(let R=0;R<H;R++)V.push(R*z);let A=await J.extractThumbnails(G,{timestamps:V,width:B,height:_,format:j,quality:$.quality||70,outputDir:X$(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),T=U*B,M=O*_,k=await R.createSprite({images:A.map((N)=>N.path),columns:U,padding:0,outputPath:F,format:j,quality:$.quality||70});return{url:`${Y}/${L}`,path:F,columns:U,rows:O,thumbnailWidth:B,thumbnailHeight:_,interval:z,totalFrames:H}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(G){return console.warn(`[stx-media] Failed to generate sprite sheet: ${G}`),null}}var d4=D(()=>{j5()});import{resolve as Qq,basename as wq,extname as qq,join as H5}from"path";import{mkdir as Y$,writeFile as Wq}from"fs/promises";async function Kq(){try{return await import("ts-videos")}catch{return null}}async function J$(X,$,Z,Y,J){let G=await Kq();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=Qq(X);if(!await D0(Q))return null;let w=await b0(Q),q=wq(X,qq(X)),W=H5(Z,`${q}-${w}-hls`);await Y$(W,{recursive:!0});let K=$.length>0?$:Uq,U=J?.segmentDuration||6,_=(await new G.Input(Q).getInfo()).duration||0,j=[],H=0;for(let F of K){let V=H5(W,F.label);await Y$(V,{recursive:!0});let A=`${F.label}.m3u8`,R=H5(V,A);try{let T=await G.generateHLS(Q,{outputDir:V,segmentDuration:U,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(T)j.push({quality:F,url:`${Y}/${q}-${w}-hls/${F.label}/${A}`,path:R}),H+=T.segmentCount||Math.ceil(_/U)}catch(T){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${T}`)}}if(j.length===0)return null;let O=H5(W,"master.m3u8"),L=uO(j,Y,q,w);return await Wq(O,L),{manifestUrl:`${Y}/${q}-${w}-hls/master.m3u8`,manifestPath:O,playlists:j,segmentCount:H,duration:_}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function uO(X,$,Z,Y){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let G of X){let{quality:Q}=G,w=Q.bitrate+(Q.audioBitrate||128000),q=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${w},RESOLUTION=${q},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return J.join(`
14494
- `)}async function G$(X,$,Z,Y,J){let G=await Kq();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=Qq(X);if(!await D0(Q))return null;let w=await b0(Q),q=wq(X,qq(X)),W=H5(Z,`${q}-${w}-dash`);await Y$(W,{recursive:!0});let K=$.length>0?$:Uq,U=J?.segmentDuration||4,z=J?.minBufferTime||2,j=(await new G.Input(Q).getInfo()).duration||0,H=[],O=[];for(let A of K){let R=H5(W,A.label);await Y$(R,{recursive:!0});try{if(await G.generateDASH(Q,{outputDir:R,segmentDuration:U,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(H.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${Y}/${q}-${w}-dash/${A.label}/video`}),A.audioBitrate)O.push({bandwidth:A.audioBitrate,url:`${Y}/${q}-${w}-dash/${A.label}/audio`})}}catch(T){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${T}`)}}if(H.length===0)return null;let L=H5(W,"manifest.mpd"),F=dO(H,O,j,U,z);await Wq(L,F);let V=[{type:"video",representations:H}];if(O.length>0)V.push({type:"audio",representations:O});return{manifestUrl:`${Y}/${q}-${w}-dash/manifest.mpd`,manifestPath:L,adaptationSets:V,duration:j}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function dO(X,$,Z,Y,J){let G=Gq(Z),Q=Gq(J),w=`<?xml version="1.0" encoding="UTF-8"?>
14484
+ </picture>`;let C=[];if($.placeholder)C.push(E4);let S=Q?Wq(_):void 0,b;if(w&&F)b=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:I,preloadLink:b,css:C.length>0?C.join(`
14485
+ `):void 0,script:S}}async function Uq(X,$,Z){let Y={src:$.src,processed:!0,variants:[],placeholder:$.placeholder?.dataURL,originalWidth:$.placeholder?.width,originalHeight:$.placeholder?.height};for(let[J,G]of Object.entries($.byFormat))if(G)Y.variants.push(...G);return h4(X,Y,Z)}var Qq=!1,x4=80,r8="async",s8="lazy",wq=!1;var Kq=D(()=>{k4();lw()});function nO(){return g8({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(X,$,Z,Y)=>{let{src:J,alt:G,options:Q}=rO(X,$,Z);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let w={src:J,alt:G||"",widths:Q.widths||Y7,formats:Q.formats||ZX,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},q=Z.__isDev||!1,W=await n8(w,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
14486
+ `+U;if(W.css)U+=`
14487
+ <style>${W.css}</style>`;if(W.script)U+=`
14488
+ <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function rO(X,$,Z){if($.src)return{src:String($.src),alt:String($.alt||""),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=sO(Y),G=u4(J[0],Z)||"",Q=u4(J[1],Z)||"",w={};if(J[2]){let q=u4(J[2],Z);if(typeof q==="object"&&q!==null)w=q;else if(typeof J[2]==="string")try{w=JSON.parse(J[2])}catch{}}return{src:G,alt:Q,options:w}}function sO(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let w=0;w<X.length;w++){let q=X[w],W=w>0?X[w-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!Y)Y=!0,J=q;else if(q===J)Y=!1,J="";else Z+=q;continue}if(!Y){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())$.push(Z.trim());return $}function u4(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var zq;var _q=D(()=>{R4();Kq();k4();zq=nO()});class a8{config;constructor(X={}){this.config={...oO,...X}}async get(X,$){return u8(X,$,"video",this.config)}async set(X,$,Z){return d8(X,$,Z,"video",this.config)}async clear(){return m8("video",this.config)}updateConfig(X){this.config={...this.config,...X}}}function d4(X){if(!o8)o8=new a8(X);else if(X)o8.updateConfig(X);return o8}async function t8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return d4(Y).get(X,$)}async function e8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return d4(J).set(X,$,Z)}async function Bq(){return d4().clear()}var oO,o8=null;var m4=D(()=>{b4();oO={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as l4,basename as c4,extname as p4,join as X$}from"path";import{mkdir as i4}from"fs/promises";async function n4(){try{return await import("ts-videos")}catch{return null}}async function $$(X,$,Z,Y){let J=await n4();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=l4(X);if(!await D0(G))return null;await i4(Z,{recursive:!0});let Q=await b0(G),w=c4(X,p4(X)),q=$.format||"webp",W=$.timestamp||0,U=`${w}-poster-${Q}.${q}`,K=X$(Z,U),z=await J.extractThumbnails(G,{timestamps:[W],width:$.width||1280,height:$.height,format:q,quality:$.quality||85,outputDir:Z,outputPattern:U.replace(`.${q}`,"")});if(z&&z.length>0){let B=z[0];return{path:K,url:`${Y}/${U}`,width:B.width||$.width||1280,height:B.height||720,timestamp:W,size:B.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function Z$(X,$,Z,Y){let J=await n4();if(!J)return[];try{let G=l4(X);if(!await D0(G))return[];await i4(Z,{recursive:!0});let Q=await b0(G),w=c4(X,p4(X)),q=$.format||"webp",K=(await new J.Input(G).getInfo()).duration||60,z=$.count||10,B=$.interval||K/z,_=[];for(let H=0;H<z&&H*B<K;H++)_.push(H*B);let j=await J.extractThumbnails(G,{timestamps:_,width:$.width||320,format:q,quality:$.quality||80,outputDir:Z,outputPattern:`${w}-thumb-${Q}`});if(j&&j.length>0)return j.map((H,O)=>({path:H.path||X$(Z,`${w}-thumb-${Q}-${O}.${q}`),url:`${Y}/${w}-thumb-${Q}-${O}.${q}`,width:H.width||$.width||320,height:H.height||180,timestamp:_[O],size:H.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function jq(X,$,Z,Y){let J=await n4();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=l4(X);if(!await D0(G))return null;await i4(Z,{recursive:!0});let Q=await b0(G),w=c4(X,p4(X)),U=(await new J.Input(G).getInfo()).duration||60,K=$.columns||10,z=$.interval||5,B=$.thumbnailWidth||160,_=$.thumbnailHeight||90,j=$.format||"jpeg",H=Math.ceil(U/z),O=Math.ceil(H/K),L=`${w}-sprite-${Q}.${j}`,F=X$(Z,L),V=[];for(let R=0;R<H;R++)V.push(R*z);let A=await J.extractThumbnails(G,{timestamps:V,width:B,height:_,format:j,quality:$.quality||70,outputDir:X$(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),T=K*B,M=O*_,k=await R.createSprite({images:A.map((N)=>N.path),columns:K,padding:0,outputPath:F,format:j,quality:$.quality||70});return{url:`${Y}/${L}`,path:F,columns:K,rows:O,thumbnailWidth:B,thumbnailHeight:_,interval:z,totalFrames:H}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(G){return console.warn(`[stx-media] Failed to generate sprite sheet: ${G}`),null}}var r4=D(()=>{H5()});import{resolve as Lq,basename as Oq,extname as Fq,join as L5}from"path";import{mkdir as Y$,writeFile as Vq}from"fs/promises";async function Aq(){try{return await import("ts-videos")}catch{return null}}async function J$(X,$,Z,Y,J){let G=await Aq();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=Lq(X);if(!await D0(Q))return null;let w=await b0(Q),q=Oq(X,Fq(X)),W=L5(Z,`${q}-${w}-hls`);await Y$(W,{recursive:!0});let U=$.length>0?$:Rq,K=J?.segmentDuration||6,_=(await new G.Input(Q).getInfo()).duration||0,j=[],H=0;for(let F of U){let V=L5(W,F.label);await Y$(V,{recursive:!0});let A=`${F.label}.m3u8`,R=L5(V,A);try{let T=await G.generateHLS(Q,{outputDir:V,segmentDuration:K,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(T)j.push({quality:F,url:`${Y}/${q}-${w}-hls/${F.label}/${A}`,path:R}),H+=T.segmentCount||Math.ceil(_/K)}catch(T){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${T}`)}}if(j.length===0)return null;let O=L5(W,"master.m3u8"),L=aO(j,Y,q,w);return await Vq(O,L),{manifestUrl:`${Y}/${q}-${w}-hls/master.m3u8`,manifestPath:O,playlists:j,segmentCount:H,duration:_}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function aO(X,$,Z,Y){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let G of X){let{quality:Q}=G,w=Q.bitrate+(Q.audioBitrate||128000),q=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${w},RESOLUTION=${q},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return J.join(`
14489
+ `)}async function G$(X,$,Z,Y,J){let G=await Aq();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=Lq(X);if(!await D0(Q))return null;let w=await b0(Q),q=Oq(X,Fq(X)),W=L5(Z,`${q}-${w}-dash`);await Y$(W,{recursive:!0});let U=$.length>0?$:Rq,K=J?.segmentDuration||4,z=J?.minBufferTime||2,j=(await new G.Input(Q).getInfo()).duration||0,H=[],O=[];for(let A of U){let R=L5(W,A.label);await Y$(R,{recursive:!0});try{if(await G.generateDASH(Q,{outputDir:R,segmentDuration:K,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(H.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${Y}/${q}-${w}-dash/${A.label}/video`}),A.audioBitrate)O.push({bandwidth:A.audioBitrate,url:`${Y}/${q}-${w}-dash/${A.label}/audio`})}}catch(T){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${T}`)}}if(H.length===0)return null;let L=L5(W,"manifest.mpd"),F=tO(H,O,j,K,z);await Vq(L,F);let V=[{type:"video",representations:H}];if(O.length>0)V.push({type:"audio",representations:O});return{manifestUrl:`${Y}/${q}-${w}-dash/manifest.mpd`,manifestPath:L,adaptationSets:V,duration:j}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function tO(X,$,Z,Y,J){let G=Hq(Z),Q=Hq(J),w=`<?xml version="1.0" encoding="UTF-8"?>
14495
14490
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
14496
14491
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
14497
14492
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -14517,7 +14512,7 @@ ${A.join(`
14517
14512
  </Representation>
14518
14513
  `}w+=` </AdaptationSet>
14519
14514
  `}return w+=` </Period>
14520
- </MPD>`,w}function Gq(X){let $=Math.floor(X/3600),Z=Math.floor(X%3600/60),Y=Math.floor(X%60),J="PT";if($>0)J+=`${$}H`;if(Z>0)J+=`${Z}M`;return J+=`${Y}S`,J}var Uq;var m4=D(()=>{j5();Uq=[{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 zq,basename as mO,extname as lO,join as cO}from"path";import{mkdir as pO}from"fs/promises";async function _q(){try{return await import("ts-videos")}catch{return null}}function iO(X){switch(X){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 nO(X){switch(X){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 l4(X){let $=await _q();if(!$)return null;try{let Z=zq(X),J=await new $.Input(Z).getInfo();return{duration:J.duration||0,width:J.width||0,height:J.height||0,frameRate:J.frameRate||0,bitrate:J.bitrate||0,codec:J.videoCodec||"",audioCodec:J.audioCodec}}catch(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function Bq(X,$,Z,Y){let J=await _q();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:X,processed:!1};let G=await t8(X,$,Z);if(G)return G;try{let Q=zq(X);if(!await D0(Q))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let w=Z.outputDir||"dist/videos",q=Z.baseUrl||"/videos";await pO(w,{recursive:!0});let W=await b0(Q),K=mO(X,lO(X)),U={src:X,processed:!0,hash:W};Y?.({percentage:5,stage:"analyzing"}),U.metadata=await l4(Q)||void 0;let z={};if($.quality)z.bitrate=iO($.quality);if($.platform)Object.assign(z,nO($.platform));if($.transcode)Object.assign(z,$.transcode);if(Object.keys(z).length>0||$.process){Y?.({percentage:10,stage:"transcoding"});let B=`${K}-${W}.mp4`,_=cO(w,B);try{let j=await rO(Q,_,z,J,(H)=>Y?.({percentage:10+H*0.5,stage:"transcoding"}));if(j)U.transcoded={path:_,url:`${q}/${B}`,duration:j.duration,size:j.size,video:{codec:z.codec||"h264",width:j.width,height:j.height,bitrate:j.bitrate,frameRate:j.frameRate},audio:j.audioCodec?{codec:z.audioCodec||"aac",bitrate:z.audioBitrate||128000,sampleRate:z.sampleRate||48000,channels:z.channels||2}:void 0}}catch(j){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${j}`)}}if($.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let B=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},_=await $$(Q,B,w,q);if(_)U.poster=_}if(Z.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let B=await Z$(Q,Z.thumbnails,w,q);if(B.length>0)U.thumbnails=B}if($.streaming){Y?.({percentage:80,stage:"generating-manifests"});let B=typeof $.streaming==="object"?$.streaming:Z.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let _=await J$(Q,B.qualities||Z.streaming?.defaultQualities||[],w,q);if(_)U.streaming={...U.streaming,hls:_}}if(B.format==="dash"){let _=await G$(Q,B.qualities||Z.streaming?.defaultQualities||[],w,q);if(_)U.streaming={...U.streaming,dash:_}}}if($.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await e8(X,$,U,Z),U}catch(Q){return{src:X,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function rO(X,$,Z,Y,J){try{let Q=await new Y.Conversion(X,$,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((w)=>{J?.(w.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Z.maxWidth||0,height:Q.height||Z.maxHeight||0,bitrate:Q.bitrate||Z.bitrate||0,frameRate:Q.frameRate||Z.frameRate||30,audioCodec:Q.audioCodec}}catch(G){return console.error(`[stx-media] Transcoding failed: ${G}`),null}}var jq=D(()=>{j5();v4();d4();m4()});var Hq={};t(Hq,{setCachedVideoResult:()=>e8,processVideo:()=>Bq,getCachedVideoResult:()=>t8,generateThumbnails:()=>Z$,generateSpriteSheet:()=>Jq,generatePoster:()=>$$,generateHLSManifest:()=>J$,generateDASHManifest:()=>G$,clearVideoCache:()=>Yq,analyzeVideo:()=>l4,VideoProcessorCache:()=>a8});var Lq=D(()=>{jq();d4();m4();v4()});async function Fq(){try{return await Promise.resolve().then(() => (Lq(),Hq))}catch(X){if(!Oq)console.warn("[stx-media] Video processor not available, some features disabled:",X),Oq=!0;return null}}async function Q$(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return XF(Y,Z)}if(Z.processedResult?.processed)return Tq(X,Z.processedResult,$);let J;if(Y.generatePoster&&Y.src&&!X.poster)J=await $F(Y,Z);let{src:G,sources:Q=[],poster:w,posterPlaceholder:q,controls:W=Vq,autoplay:K=!1,muted:U=!1,loop:z=!1,preload:B=Aq,playsinline:_=!0,lazy:j=!0,player:H="native",type:O,width:L,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=X,T=J||w,M=X.class,k=X.style,N=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(H==="ts-video")return aO(X,$);if(O&&O!=="video")return oO(G||"",O,X);let y=Q.length>0?Q:G?[{src:G,type:Rq(G)}]:[],I=[`id="${N}"`];if(W)I.push("controls");if(K)I.push("autoplay");if(U)I.push("muted");if(z)I.push("loop");if(_)I.push("playsinline");if(A)I.push("disablepictureinpicture");if(R)I.push("disableremoteplayback");if(V)I.push(`crossorigin="${V}"`);if(j){if(I.push(`data-preload="${B}"`),I.push('preload="none"'),T)I.push(`data-poster="${A0(T)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),T)I.push(`poster="${A0(T)}"`);if(L)I.push(`width="${L}"`);if(F)I.push(`height="${F}"`);if(M)I.push(`class="${A0(M)}"`);if(k)I.push(`style="${A0(k)}"`);let C=y.map((P)=>{return` <source ${j?`data-src="${A0(P.src)}"`:`src="${A0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
14515
+ </MPD>`,w}function Hq(X){let $=Math.floor(X/3600),Z=Math.floor(X%3600/60),Y=Math.floor(X%60),J="PT";if($>0)J+=`${$}H`;if(Z>0)J+=`${Z}M`;return J+=`${Y}S`,J}var Rq;var s4=D(()=>{H5();Rq=[{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 Tq,basename as eO,extname as XF,join as $F}from"path";import{mkdir as ZF}from"fs/promises";async function Mq(){try{return await import("ts-videos")}catch{return null}}function YF(X){switch(X){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 JF(X){switch(X){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 o4(X){let $=await Mq();if(!$)return null;try{let Z=Tq(X),J=await new $.Input(Z).getInfo();return{duration:J.duration||0,width:J.width||0,height:J.height||0,frameRate:J.frameRate||0,bitrate:J.bitrate||0,codec:J.videoCodec||"",audioCodec:J.audioCodec}}catch(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function Nq(X,$,Z,Y){let J=await Mq();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:X,processed:!1};let G=await t8(X,$,Z);if(G)return G;try{let Q=Tq(X);if(!await D0(Q))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let w=Z.outputDir||"dist/videos",q=Z.baseUrl||"/videos";await ZF(w,{recursive:!0});let W=await b0(Q),U=eO(X,XF(X)),K={src:X,processed:!0,hash:W};Y?.({percentage:5,stage:"analyzing"}),K.metadata=await o4(Q)||void 0;let z={};if($.quality)z.bitrate=YF($.quality);if($.platform)Object.assign(z,JF($.platform));if($.transcode)Object.assign(z,$.transcode);if(Object.keys(z).length>0||$.process){Y?.({percentage:10,stage:"transcoding"});let B=`${U}-${W}.mp4`,_=$F(w,B);try{let j=await GF(Q,_,z,J,(H)=>Y?.({percentage:10+H*0.5,stage:"transcoding"}));if(j)K.transcoded={path:_,url:`${q}/${B}`,duration:j.duration,size:j.size,video:{codec:z.codec||"h264",width:j.width,height:j.height,bitrate:j.bitrate,frameRate:j.frameRate},audio:j.audioCodec?{codec:z.audioCodec||"aac",bitrate:z.audioBitrate||128000,sampleRate:z.sampleRate||48000,channels:z.channels||2}:void 0}}catch(j){K.errors=K.errors||[],K.errors.push(`Transcoding failed: ${j}`)}}if($.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let B=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},_=await $$(Q,B,w,q);if(_)K.poster=_}if(Z.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let B=await Z$(Q,Z.thumbnails,w,q);if(B.length>0)K.thumbnails=B}if($.streaming){Y?.({percentage:80,stage:"generating-manifests"});let B=typeof $.streaming==="object"?$.streaming:Z.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let _=await J$(Q,B.qualities||Z.streaming?.defaultQualities||[],w,q);if(_)K.streaming={...K.streaming,hls:_}}if(B.format==="dash"){let _=await G$(Q,B.qualities||Z.streaming?.defaultQualities||[],w,q);if(_)K.streaming={...K.streaming,dash:_}}}if($.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await e8(X,$,K,Z),K}catch(Q){return{src:X,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function GF(X,$,Z,Y,J){try{let Q=await new Y.Conversion(X,$,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((w)=>{J?.(w.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Z.maxWidth||0,height:Q.height||Z.maxHeight||0,bitrate:Q.bitrate||Z.bitrate||0,frameRate:Q.frameRate||Z.frameRate||30,audioCodec:Q.audioCodec}}catch(G){return console.error(`[stx-media] Transcoding failed: ${G}`),null}}var kq=D(()=>{H5();m4();r4();s4()});var Iq={};t(Iq,{setCachedVideoResult:()=>e8,processVideo:()=>Nq,getCachedVideoResult:()=>t8,generateThumbnails:()=>Z$,generateSpriteSheet:()=>jq,generatePoster:()=>$$,generateHLSManifest:()=>J$,generateDASHManifest:()=>G$,clearVideoCache:()=>Bq,analyzeVideo:()=>o4,VideoProcessorCache:()=>a8});var Eq=D(()=>{kq();r4();s4();m4()});async function yq(){try{return await Promise.resolve().then(() => (Eq(),Iq))}catch(X){if(!Dq)console.warn("[stx-media] Video processor not available, some features disabled:",X),Dq=!0;return null}}async function Q$(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return KF(Y,Z)}if(Z.processedResult?.processed)return Pq(X,Z.processedResult,$);let J;if(Y.generatePoster&&Y.src&&!X.poster)J=await zF(Y,Z);let{src:G,sources:Q=[],poster:w,posterPlaceholder:q,controls:W=bq,autoplay:U=!1,muted:K=!1,loop:z=!1,preload:B=Sq,playsinline:_=!0,lazy:j=!0,player:H="native",type:O,width:L,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=X,T=J||w,M=X.class,k=X.style,N=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(H==="ts-video")return qF(X,$);if(O&&O!=="video")return wF(G||"",O,X);let y=Q.length>0?Q:G?[{src:G,type:Cq(G)}]:[],I=[`id="${N}"`];if(W)I.push("controls");if(U)I.push("autoplay");if(K)I.push("muted");if(z)I.push("loop");if(_)I.push("playsinline");if(A)I.push("disablepictureinpicture");if(R)I.push("disableremoteplayback");if(V)I.push(`crossorigin="${V}"`);if(j){if(I.push(`data-preload="${B}"`),I.push('preload="none"'),T)I.push(`data-poster="${A0(T)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),T)I.push(`poster="${A0(T)}"`);if(L)I.push(`width="${L}"`);if(F)I.push(`height="${F}"`);if(M)I.push(`class="${A0(M)}"`);if(k)I.push(`style="${A0(k)}"`);let C=y.map((P)=>{return` <source ${j?`data-src="${A0(P.src)}"`:`src="${A0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
14521
14516
  `),S=`<video ${I.join(" ")}>
14522
14517
  ${C}
14523
14518
  Your browser does not support the video tag.
@@ -14556,16 +14551,16 @@ ${C}
14556
14551
 
14557
14552
  observer.observe(video);
14558
14553
  })();
14559
- `.trim();return{html:S,script:b}}function oO(X,$,Z){let{width:Y=640,height:J=360}=Z,G=Z.class,Q=Z.style,w=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch($){case"youtube":W=tO(X),q=W?`https://www.youtube-nocookie.com/embed/${W}`:X;break;case"vimeo":W=eO(X),q=W?`https://player.vimeo.com/video/${W}`:X;break;case"dailymotion":W=X.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=X.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=X}let K=[`id="${w}"`,`src="${A0(q)}"`,`width="${Y}"`,`height="${J}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)K.push(`class="${A0(G)}"`);if(Q)K.push(`style="${A0(Q)}"`);if(Z.lazy)K.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
14560
- <iframe ${K.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
14561
- </div>`}}function aO(X,$={}){let{src:Z,sources:Y=[],poster:J,controls:G=!0,autoplay:Q=!1,muted:w=!1,loop:q=!1,preload:W="metadata",playsinline:K=!0,lazy:U=!0,width:z,height:B}=X,_=X.class,j=X.style,H=X.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,O={src:Y.length>0?Y:Z,autoplay:Q,loop:q,muted:w,playsinline:K,preload:W,poster:J,controls:G,title:X.title},L=["position: relative",z?`width: ${typeof z==="number"?z+"px":z}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",j||""].filter(Boolean).join("; "),F=`
14554
+ `.trim();return{html:S,script:b}}function wF(X,$,Z){let{width:Y=640,height:J=360}=Z,G=Z.class,Q=Z.style,w=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch($){case"youtube":W=WF(X),q=W?`https://www.youtube-nocookie.com/embed/${W}`:X;break;case"vimeo":W=UF(X),q=W?`https://player.vimeo.com/video/${W}`:X;break;case"dailymotion":W=X.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=X.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=X}let U=[`id="${w}"`,`src="${A0(q)}"`,`width="${Y}"`,`height="${J}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)U.push(`class="${A0(G)}"`);if(Q)U.push(`style="${A0(Q)}"`);if(Z.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
14555
+ <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
14556
+ </div>`}}function qF(X,$={}){let{src:Z,sources:Y=[],poster:J,controls:G=!0,autoplay:Q=!1,muted:w=!1,loop:q=!1,preload:W="metadata",playsinline:U=!0,lazy:K=!0,width:z,height:B}=X,_=X.class,j=X.style,H=X.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,O={src:Y.length>0?Y:Z,autoplay:Q,loop:q,muted:w,playsinline:U,preload:W,poster:J,controls:G,title:X.title},L=["position: relative",z?`width: ${typeof z==="number"?z+"px":z}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",j||""].filter(Boolean).join("; "),F=`
14562
14557
  <div
14563
14558
  id="${H}"
14564
14559
  class="ts-video-player${_?" "+A0(_):""}"
14565
14560
  style="${L}"
14566
14561
  data-ts-video-player
14567
14562
  data-config='${JSON.stringify(O)}'
14568
- ${U?"data-lazy":""}
14563
+ ${K?"data-lazy":""}
14569
14564
  >
14570
14565
  <div class="ts-video-player__container">
14571
14566
  ${J?`
@@ -14595,7 +14590,7 @@ ${C}
14595
14590
 
14596
14591
  // Load ts-video-player from CDN
14597
14592
  var script = document.createElement('script');
14598
- script.src = '${sO}';
14593
+ script.src = '${QF}';
14599
14594
  script.onload = initPlayer;
14600
14595
  script.onerror = function() {
14601
14596
  console.error('[stx] Failed to load ts-video-player');
@@ -14725,7 +14720,7 @@ else {
14725
14720
  .ts-video-player__play-button svg {
14726
14721
  margin-left: 4px;
14727
14722
  }
14728
- `.trim();return{html:F,script:V,css:A}}function Rq(X){switch(X.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 tO(X){let $=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of $){let Y=X.match(Z);if(Y)return Y[1]}return null}function eO(X){let $=X.match(/vimeo\.com\/(\d+)/);return $?$[1]:null}function A0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function XF(X,$){let Z=await Fq();if(!Z)return Q$({...X,process:!1},$);let Y=$.tsVideosConfig,J=await Z.processVideo(X.src,X,Y,X.onProcessProgress);if(J.processed)return Tq(X,J,$);return Q$({...X,process:!1},$)}async function $F(X,$){let Z=await Fq();if(!Z||!X.src)return;let Y=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},J=$.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster(X.src,Y,J.outputDir,J.baseUrl||"/videos"))?.url}function Tq(X,$,Z){let{controls:Y=Vq,autoplay:J=!1,muted:G=!1,loop:Q=!1,preload:w=Aq,playsinline:q=!0,lazy:W=!0,width:K,height:U,crossorigin:z,disablePictureInPicture:B=!1,disableRemotePlayback:_=!1}=X,j=X.class,H=X.style,O=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=X.src,F=Rq(L);if($.transcoded)L=$.transcoded.url,F="video/mp4";let V=$.streaming?.hls||$.streaming?.dash;if(V){if($.streaming?.hls)L=$.streaming.hls.manifestUrl,F="application/x-mpegURL";else if($.streaming?.dash)L=$.streaming.dash.manifestUrl,F="application/dash+xml"}let A=$.poster?.url||X.poster,R=[`id="${O}"`];if(Y)R.push("controls");if(J)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(q)R.push("playsinline");if(B)R.push("disablepictureinpicture");if(_)R.push("disableremoteplayback");if(z)R.push(`crossorigin="${z}"`);if(W){if(R.push(`data-preload="${w}"`),R.push('preload="none"'),A)R.push(`data-poster="${A0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${w}"`),A)R.push(`poster="${A0(A)}"`);let T=K||$.metadata?.width,M=U||$.metadata?.height;if(T)R.push(`width="${T}"`);if(M)R.push(`height="${M}"`);if(j)R.push(`class="${A0(j)}"`);if(H)R.push(`style="${A0(H)}"`);let N=` <source ${W?`data-src="${A0(L)}"`:`src="${A0(L)}"`} type="${F}" />`,y=`<video ${R.join(" ")}>
14723
+ `.trim();return{html:F,script:V,css:A}}function Cq(X){switch(X.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 WF(X){let $=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of $){let Y=X.match(Z);if(Y)return Y[1]}return null}function UF(X){let $=X.match(/vimeo\.com\/(\d+)/);return $?$[1]:null}function A0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function KF(X,$){let Z=await yq();if(!Z)return Q$({...X,process:!1},$);let Y=$.tsVideosConfig,J=await Z.processVideo(X.src,X,Y,X.onProcessProgress);if(J.processed)return Pq(X,J,$);return Q$({...X,process:!1},$)}async function zF(X,$){let Z=await yq();if(!Z||!X.src)return;let Y=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},J=$.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster(X.src,Y,J.outputDir,J.baseUrl||"/videos"))?.url}function Pq(X,$,Z){let{controls:Y=bq,autoplay:J=!1,muted:G=!1,loop:Q=!1,preload:w=Sq,playsinline:q=!0,lazy:W=!0,width:U,height:K,crossorigin:z,disablePictureInPicture:B=!1,disableRemotePlayback:_=!1}=X,j=X.class,H=X.style,O=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=X.src,F=Cq(L);if($.transcoded)L=$.transcoded.url,F="video/mp4";let V=$.streaming?.hls||$.streaming?.dash;if(V){if($.streaming?.hls)L=$.streaming.hls.manifestUrl,F="application/x-mpegURL";else if($.streaming?.dash)L=$.streaming.dash.manifestUrl,F="application/dash+xml"}let A=$.poster?.url||X.poster,R=[`id="${O}"`];if(Y)R.push("controls");if(J)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(q)R.push("playsinline");if(B)R.push("disablepictureinpicture");if(_)R.push("disableremoteplayback");if(z)R.push(`crossorigin="${z}"`);if(W){if(R.push(`data-preload="${w}"`),R.push('preload="none"'),A)R.push(`data-poster="${A0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${w}"`),A)R.push(`poster="${A0(A)}"`);let T=U||$.metadata?.width,M=K||$.metadata?.height;if(T)R.push(`width="${T}"`);if(M)R.push(`height="${M}"`);if(j)R.push(`class="${A0(j)}"`);if(H)R.push(`style="${A0(H)}"`);let N=` <source ${W?`data-src="${A0(L)}"`:`src="${A0(L)}"`} type="${F}" />`,y=`<video ${R.join(" ")}>
14729
14724
  ${N}
14730
14725
  Your browser does not support the video tag.
14731
14726
  </video>`;if($.spriteSheet)y=`<div class="stx-video-wrapper" data-sprite-sheet="${A0($.spriteSheet.url)}" data-sprite-cols="${$.spriteSheet.columns}" data-sprite-interval="${$.spriteSheet.interval}">
@@ -14774,9 +14769,9 @@ ${y}
14774
14769
  width: 100%;
14775
14770
  height: auto;
14776
14771
  }
14777
- `.trim();return{html:y,script:I,css:C}}var Oq=!1,Vq=!0,Aq="metadata",sO="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var Mq=D(()=>{p4()});function Nq(){return g8({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(X,$,Z,Y)=>{let{src:J,options:G}=ZF(X,$,Z);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:J,poster:G.poster,controls:G.controls!==!1,autoplay:G.autoplay||!1,muted:G.muted||!1,loop:G.loop||!1,preload:G.preload||"metadata",playsinline:G.playsinline!==!1,lazy:G.lazy!==!1,player:G.player||"native",type:G.type,width:G.width,height:G.height,class:G.class,style:G.style,id:G.id,crossorigin:G.crossorigin,disablePictureInPicture:G.disablePictureInPicture,disableRemotePlayback:G.disableRemotePlayback,title:G.title,quality:G.quality,platform:G.platform,process:G.process,generatePoster:G.generatePoster,streaming:G.streaming,transcode:G.transcode,spriteSheet:G.spriteSheet,waveform:G.waveform},q={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},W=await Q$(Q,q),K=W.html;if(W.css)K+=`
14778
- <style>${W.css}</style>`;if(W.script)K+=`
14779
- <script>${W.script}</script>`;return K},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function ZF(X,$,Z){if($.src)return{src:String($.src),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=YF(Y),G=kq(J[0],Z)||"",Q={};if(J[1]){let w=kq(J[1],Z);if(typeof w==="object"&&w!==null)Q=w;else if(typeof J[1]==="string")try{Q=JSON.parse(J[1])}catch{}}return{src:G,options:Q}}function YF(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let w=0;w<X.length;w++){let q=X[w],W=w>0?X[w-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!Y)Y=!0,J=q;else if(q===J)Y=!1,J="";else Z+=q;continue}if(!Y){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())$.push(Z.trim());return $}function kq(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var c4;var p4=D(()=>{j4();Mq();c4=Nq()});function JF(X,$){let Z=$.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
14772
+ `.trim();return{html:y,script:I,css:C}}var Dq=!1,bq=!0,Sq="metadata",QF="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var vq=D(()=>{t4()});function xq(){return g8({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(X,$,Z,Y)=>{let{src:J,options:G}=_F(X,$,Z);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:J,poster:G.poster,controls:G.controls!==!1,autoplay:G.autoplay||!1,muted:G.muted||!1,loop:G.loop||!1,preload:G.preload||"metadata",playsinline:G.playsinline!==!1,lazy:G.lazy!==!1,player:G.player||"native",type:G.type,width:G.width,height:G.height,class:G.class,style:G.style,id:G.id,crossorigin:G.crossorigin,disablePictureInPicture:G.disablePictureInPicture,disableRemotePlayback:G.disableRemotePlayback,title:G.title,quality:G.quality,platform:G.platform,process:G.process,generatePoster:G.generatePoster,streaming:G.streaming,transcode:G.transcode,spriteSheet:G.spriteSheet,waveform:G.waveform},q={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},W=await Q$(Q,q),U=W.html;if(W.css)U+=`
14773
+ <style>${W.css}</style>`;if(W.script)U+=`
14774
+ <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function _F(X,$,Z){if($.src)return{src:String($.src),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=BF(Y),G=fq(J[0],Z)||"",Q={};if(J[1]){let w=fq(J[1],Z);if(typeof w==="object"&&w!==null)Q=w;else if(typeof J[1]==="string")try{Q=JSON.parse(J[1])}catch{}}return{src:G,options:Q}}function BF(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let w=0;w<X.length;w++){let q=X[w],W=w>0?X[w-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!Y)Y=!0,J=q;else if(q===J)Y=!1,J="";else Z+=q;continue}if(!Y){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())$.push(Z.trim());return $}function fq(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var a4;var t4=D(()=>{R4();vq();a4=xq()});function jF(X,$){let Z=$.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
14780
14775
  ${X}
14781
14776
  </div>
14782
14777
  <script>
@@ -14821,7 +14816,7 @@ ${y}
14821
14816
  }
14822
14817
  }
14823
14818
  })();
14824
- </script>`}function GF(X,$){let Z=$.pwa?.updates,Y=Z?.message||"A new version is available. Reload to update?",J=Z?.autoReload||!1,G=X.trim().length>0,Q=`
14819
+ </script>`}function HF(X,$){let Z=$.pwa?.updates,Y=Z?.message||"A new version is available. Reload to update?",J=Z?.autoReload||!1,G=X.trim().length>0,Q=`
14825
14820
  <div class="stx-pwa-update-banner" style="
14826
14821
  position: fixed;
14827
14822
  bottom: 0;
@@ -14932,7 +14927,7 @@ else {
14932
14927
  // Also listen for custom event
14933
14928
  window.addEventListener('pwa-update-available', showUpdate);
14934
14929
  })();
14935
- </script>`}function QF(X,$){let Z=X.trim().length>0,Y=`
14930
+ </script>`}function LF(X,$){let Z=X.trim().length>0,Y=`
14936
14931
  <div class="stx-offline-indicator" style="
14937
14932
  position: fixed;
14938
14933
  top: 16px;
@@ -14993,7 +14988,7 @@ else {
14993
14988
  window.addEventListener('offline', updateStatus);
14994
14989
  updateStatus();
14995
14990
  })();
14996
- </script>`}function wF(X,$){let Z=$.pwa?.push,Y=Z?.vapidPublicKey||"",J=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
14991
+ </script>`}function OF(X,$){let Z=$.pwa?.push,Y=Z?.vapidPublicKey||"",J=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
14997
14992
  ${X}
14998
14993
  </div>
14999
14994
  <script>
@@ -15075,16 +15070,16 @@ catch (error) {
15075
15070
  init();
15076
15071
  }
15077
15072
  })();
15078
- </script>`}var qF,WF,KF,UF,Iq;var Eq=D(()=>{qF={name:"pwa.installButton",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return JF(X,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},WF={name:"pwa.updatePrompt",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return GF(X,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},KF={name:"pwa.offlineIndicator",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return QF(X,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},UF={name:"pwa.pushSubscribe",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return wF(X,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},Iq=[qF,WF,KF,UF]});import YX from"path";function zF(X,$){let Z=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1].trim():"",J=$,G=[],Q=!0;if(Y){let U=Y.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let z=U[1],B=z.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)J=B[1];let _=z.match(/props\s*:\s*\[([\s\S]*?)\]/);if(_)G=_[1].split(",").map((H)=>H.trim().replace(/['"`]/g,"")).filter((H)=>H.length>0);let j=z.match(/shadowDOM\s*:\s*(true|false)/);if(j)Q=j[1]==="true"}catch{}}let w=X.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=w?w[1].trim():"",W=X.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),K=W?W[1].trim():"";return{tag:J,props:G,template:q,styles:K,script:Y,shadowDOM:Q}}function _F(X){let{tag:$,props:Z,template:Y,styles:J,shadowDOM:G}=X,Q=$.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),w=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Z.map((U)=>`'${U}'`).join(", "),K=Z.map((U)=>`
15079
- get ${U}() {
15080
- return this.getAttribute('${U}') || '';
15073
+ </script>`}var FF,VF,AF,RF,gq;var hq=D(()=>{FF={name:"pwa.installButton",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return jF(X,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},VF={name:"pwa.updatePrompt",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return HF(X,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},AF={name:"pwa.offlineIndicator",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return LF(X,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},RF={name:"pwa.pushSubscribe",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return OF(X,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},gq=[FF,VF,AF,RF]});import JX from"path";function TF(X,$){let Z=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1].trim():"",J=$,G=[],Q=!0;if(Y){let K=Y.match(/export\s+default\s+({[\s\S]*})/);if(K)try{let z=K[1],B=z.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)J=B[1];let _=z.match(/props\s*:\s*\[([\s\S]*?)\]/);if(_)G=_[1].split(",").map((H)=>H.trim().replace(/['"`]/g,"")).filter((H)=>H.length>0);let j=z.match(/shadowDOM\s*:\s*(true|false)/);if(j)Q=j[1]==="true"}catch{}}let w=X.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=w?w[1].trim():"",W=X.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=W?W[1].trim():"";return{tag:J,props:G,template:q,styles:U,script:Y,shadowDOM:Q}}function MF(X){let{tag:$,props:Z,template:Y,styles:J,shadowDOM:G}=X,Q=$.split("-").map((K)=>K.charAt(0).toUpperCase()+K.slice(1)).join(""),w=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Z.map((K)=>`'${K}'`).join(", "),U=Z.map((K)=>`
15074
+ get ${K}() {
15075
+ return this.getAttribute('${K}') || '';
15081
15076
  }
15082
- set ${U}(value) {
15077
+ set ${K}(value) {
15083
15078
  if (value) {
15084
- this.setAttribute('${U}', value);
15079
+ this.setAttribute('${K}', value);
15085
15080
  }
15086
15081
  else {
15087
- this.removeAttribute('${U}');
15082
+ this.removeAttribute('${K}');
15088
15083
  }
15089
15084
  }`).join(`
15090
15085
  `);return`/**
@@ -15107,7 +15102,7 @@ class ${Q} extends HTMLElement {
15107
15102
  this._render();
15108
15103
  }
15109
15104
  }
15110
- ${K}
15105
+ ${U}
15111
15106
 
15112
15107
  _render() {
15113
15108
  const template = \`${q?`<style>${q}</style>`:""}${w}\`;
@@ -15126,9 +15121,9 @@ ${K}
15126
15121
  }
15127
15122
 
15128
15123
  customElements.define('${$}', ${Q});
15129
- `}async function Dq(X,$,Z,Y){if($.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",w=[YX.join(YX.dirname(Y),Q,`${J}.stx`),YX.join(process.cwd(),Q,`${J}.stx`),YX.join(YX.dirname(Y),`${J}.stx`)],q=null;for(let U of w)if(await i(U)){q=await Bun.file(U).text();break}if(!q)return $0("WebComponent",`Component file not found: ${J}.stx`,o.FILE_NOT_FOUND);let W=zF(q,J);return`<script type="module">
15130
- ${_F(W)}
15131
- </script>`}var yq=D(()=>{F1();T0()});var bq={};t(bq,{timingPlugin:()=>OF,pluginManager:()=>BF,definePlugin:()=>w$,debugPlugin:()=>LF,createVariablesPlugin:()=>FF,createFilterPlugin:()=>HF,createDirectivePlugin:()=>jF,PluginManager:()=>i4});function w$(X){return X}class i4{plugins=new Map;sortedPlugins=[];initialized=!1;async register(X,$){if(this.plugins.has(X.name))throw Error(`Plugin "${X.name}" is already registered`);if(X.dependencies){for(let Z of X.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${X.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set(X.name,X),X.onRegister)await X.onRegister($);this.sortPlugins()}async unregister(X){let $=this.plugins.get(X);if(!$)return!1;for(let[Z,Y]of this.plugins)if(Y.dependencies?.includes(X))throw Error(`Cannot unregister "${X}" because "${Z}" depends on it`);if($.onUnregister)await $.onUnregister();return this.plugins.delete(X),this.sortPlugins(),!0}get(X){return this.plugins.get(X)}has(X){return this.plugins.has(X)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let X=[];for(let $ of this.sortedPlugins)if($.registerDirectives)X.push(...$.registerDirectives());return X}getAllFilters(){let X={};for(let $ of this.sortedPlugins)if($.registerFilters)Object.assign(X,$.registerFilters());return X}async runBeforeProcess(X){return this.runHooks("beforeProcess",X)}async runAfterParse(X){return this.runHooks("afterParse",X)}async runBeforeDirective(X,$){return this.runDirectiveHooks("beforeDirective",X,$)}async runAfterDirective(X,$){return this.runDirectiveHooks("afterDirective",X,$)}async runBeforeRender(X){return this.runHooks("beforeRender",X)}async runAfterRender(X){return this.runHooks("afterRender",X)}async runOnError(X){for(let $ of this.sortedPlugins)if($.onError)try{let Z=await $.onError(X);if(Z){if(Z.template!==void 0)X.template=Z.template;if(Z.context)X.context={...X.context,...Z.context};if(Z.metadata)X.metadata={...X.metadata,...Z.metadata};if(Z.skip)return X}}catch(Z){console.error(`Error in plugin "${$.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((X,$)=>(X.priority??100)-($.priority??100))}async runHooks(X,$){let Z={...$};for(let Y of this.sortedPlugins){let J=Y[X];if(J)try{let G=await J(Z);if(G){if(G.template!==void 0)Z.template=G.template;if(G.context)Z.context={...Z.context,...G.context};if(G.metadata)Z.metadata={...Z.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Y.name}" ${X} hook:`,G)}}return Z}async runDirectiveHooks(X,$,Z){let Y={...Z};for(let J of this.sortedPlugins){let G=J[X];if(G)try{let Q=await G($,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}" ${X} hook:`,Q)}}return Y}}function jF(X,$,Z={}){return{name:X,...Z,registerDirectives:()=>$}}function HF(X,$,Z={}){return{name:X,...Z,registerFilters:()=>$}}function FF(X){return w$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess($){return{context:{...$.context,...X}}}})}var BF,LF,OF;var Sq=D(()=>{BF=new i4;LF=w$({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(X){console.log("[stx-debug] beforeProcess:",X.filePath)},afterParse(X){console.log("[stx-debug] afterParse:",X.template.length,"chars")},beforeDirective(X,$){console.log("[stx-debug] beforeDirective:",X)},afterDirective(X,$){console.log("[stx-debug] afterDirective:",X)},beforeRender(X){console.log("[stx-debug] beforeRender")},afterRender(X){console.log("[stx-debug] afterRender:",X.template.length,"chars")},onError(X){console.error("[stx-debug] onError:",X.error.message,"in phase:",X.phase)}}),OF=w$({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(X){X.metadata.startTime=performance.now()},afterRender(X){let $=X.metadata.startTime;if($){let Z=performance.now()-$;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var zZ={};t(zZ,{validateConfig:()=>kF,resolveStxDirectories:()=>vq,loadStxConfig:()=>u1,defineStxConfig:()=>NF,defaultConfig:()=>A1,config:()=>k7});import q$ from"fs";import l0 from"path";import{loadConfigWithResult as VF}from"bunfig";function AF(X,$,Z){let Y=$||"pages";if(X)return{root:X,pagesDir:Y};let J=Z||process.cwd(),G=l0.join(J,"resources","views"),Q=l0.join(J,"resources","layouts");if(q$.existsSync(G)&&q$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=l0.join(J,"resources","views","pages");if(q$.existsSync(w))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function RF(X,$){let Z=$.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let Y=X.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/");return Y===J||Y.startsWith(`${J}/`)}function vq(X,$){let Z=!X.root,Y=AF(X.root,X.pagesDir,$);if(X.root=Y.root,X.pagesDir=Y.pagesDir,Z&&Y.root!=="."){let J=`${$}::${Y.root}`;if(!Cq.has(J))Cq.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(X.root&&X.root!=="."){let J=X.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=X[G];if(typeof Q!=="string"||!Q)continue;if(l0.isAbsolute(Q)||RF(Q,J))continue;X[G]=l0.join(J,Q)}}return X}function TF(X,$){let Z=["componentsDir","layoutsDir","partialsDir"];for(let Y of Z){let J=X[Y];if(typeof J!=="string"||!J)continue;let G=l0.isAbsolute(J)?J:l0.join($,J);if(q$.existsSync(G))continue;let Q=X.root,w=!!Q&&Q!==".";console.warn(`[stx] ${String(Y)} resolves to "${G}", which does not exist. Configured as "${J}"`+(w?`, resolved under root "${Q}".`:"."))}}function MF(X){if(B6(X.stateDir),X.stateDir=A7(),X.cachePath=T7(X.cachePath),X.build)X.build.cacheDir=T7(X.build.cacheDir);if(X.media?.cache)X.media.cache.directory=T7(X.media.cache.directory);if(X.story)X.story.outDir=T7(X.story.outDir)}async function u1(X){if(!X){if(J7)return J7;if(W$)return W$}let $=X?l0.resolve(X):process.cwd(),Z=Pq.get($);if(Z)return Z;let Y=(async()=>{let G=(await VF({name:"stx",alias:"ui",cwd:$,defaultConfig:A1,verbose:!1})).config;if(MF(G),vq(G,$),TF(G,$),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (Sq(),bq)),w=[],q=[];for(let W of G.plugins){let K=typeof W==="string"?W:W[0],U=typeof W==="string"?{}:W[1]||{};try{let z,B;try{z=await import(K),B=l0.dirname(X0.resolve(K))}catch{let j=l0.resolve(process.cwd(),K);z=await import(j),B=l0.dirname(j)}let _=z.default||z;if(Q.register(_,G),_.components){let j=Array.isArray(_.components)?_.components:[_.components];for(let H of j)w.push(l0.resolve(B,H))}if(_.pages){let j=l0.resolve(B,_.pages),H=U.path||"/";q.push({dir:j,prefix:H})}if(_.setup){let j={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,O)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=O},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:B,config:G};await _.setup(U,j)}console.log(`[stx] Plugin loaded: ${_.name||K}`)}catch(z){console.warn(`[stx] Failed to load plugin ${K}:`,z.message)}}G._pluginComponentDirs=w,G._pluginPageDirs=q}return G})();if(Pq.set($,Y),!X)W$=Y,Y.then((J)=>{J7=J}).catch(()=>{});return Y}function NF(X){return X}function kF(X){let $=[],Z=[];if(X.partialsDir!==void 0&&typeof X.partialsDir!=="string")$.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(X.componentsDir!==void 0&&typeof X.componentsDir!=="string")$.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(X.cache!==void 0&&typeof X.cache!=="boolean")$.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(X.debug!==void 0&&typeof X.debug!=="boolean")$.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(X.streaming){if(X.streaming.bufferSize!==void 0){if(typeof X.streaming.bufferSize!=="number"||X.streaming.bufferSize<=0)$.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(X.streaming.timeout!==void 0){if(typeof X.streaming.timeout!=="number"||X.streaming.timeout<=0)$.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(X.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes(X.streaming.strategy))$.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.i18n){if(X.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes(X.i18n.format))$.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.animation){if(X.animation.defaultDuration!==void 0){if(typeof X.animation.defaultDuration!=="number"||X.animation.defaultDuration<0)$.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(X.animation.staggerDelay!==void 0){if(typeof X.animation.staggerDelay!=="number"||X.animation.staggerDelay<0)$.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(X.a11y){if(X.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes(X.a11y.level))$.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.hydration){if(X.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes(X.hydration.mode))$.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes(X.hydration.preload))$.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.customDirectives)if(!Array.isArray(X.customDirectives))$.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else X.customDirectives.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(X.middleware)if(!Array.isArray(X.middleware))$.push({path:"middleware",message:"middleware must be an array",severity:"error"});else X.middleware.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))$.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(X.debug===!0&&X.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(X.seo?.enabled===!0&&!X.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(X.pwa){if(X.pwa.enabled===!0&&!X.pwa.manifest?.name)$.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(X.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes(X.pwa.manifest.display))$.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes(X.pwa.manifest.orientation))$.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];X.pwa.routes.forEach((J,G)=>{if(!J.pattern||typeof J.pattern!=="string")$.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(J.strategy))$.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))$.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))$.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(X.pwa.icons?.sizes){if(!Array.isArray(X.pwa.icons.sizes))$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(X.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(X.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if(X.pwa.icons.purpose.filter((G)=>!Y.includes(G)).length>0)$.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.enabled===!0&&!X.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(X.pwa.enabled===!0&&!X.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:$.length===0,errors:$,warnings:Z}}var A1,Cq,J7=null,Pq,W$=null,k7;var H1=D(()=>{L$();O$();x$();f$();K4();Zq();p4();Eq();R3();OX();yq();A1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:I5,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:Ew,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:Dq,hasEndTag:!1,description:"Include a web component in the template"},V2,A2,gJ,hJ,R2,M2,N2,T2,s2,t2,$q,c4,...Iq],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};Cq=new Set;Pq=new Map;k7=new Proxy(A1,{get(X,$){if(J7&&$ in J7)return J7[$];if(!W$)u1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return X[$]}})});var rF=`
15124
+ `}async function uq(X,$,Z,Y){if($.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",w=[JX.join(JX.dirname(Y),Q,`${J}.stx`),JX.join(process.cwd(),Q,`${J}.stx`),JX.join(JX.dirname(Y),`${J}.stx`)],q=null;for(let K of w)if(await i(K)){q=await Bun.file(K).text();break}if(!q)return $0("WebComponent",`Component file not found: ${J}.stx`,o.FILE_NOT_FOUND);let W=TF(q,J);return`<script type="module">
15125
+ ${MF(W)}
15126
+ </script>`}var dq=D(()=>{O1();T0()});var mq={};t(mq,{timingPlugin:()=>DF,pluginManager:()=>NF,definePlugin:()=>w$,debugPlugin:()=>EF,createVariablesPlugin:()=>yF,createFilterPlugin:()=>IF,createDirectivePlugin:()=>kF,PluginManager:()=>e4});function w$(X){return X}class e4{plugins=new Map;sortedPlugins=[];initialized=!1;async register(X,$){if(this.plugins.has(X.name))throw Error(`Plugin "${X.name}" is already registered`);if(X.dependencies){for(let Z of X.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${X.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set(X.name,X),X.onRegister)await X.onRegister($);this.sortPlugins()}async unregister(X){let $=this.plugins.get(X);if(!$)return!1;for(let[Z,Y]of this.plugins)if(Y.dependencies?.includes(X))throw Error(`Cannot unregister "${X}" because "${Z}" depends on it`);if($.onUnregister)await $.onUnregister();return this.plugins.delete(X),this.sortPlugins(),!0}get(X){return this.plugins.get(X)}has(X){return this.plugins.has(X)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let X=[];for(let $ of this.sortedPlugins)if($.registerDirectives)X.push(...$.registerDirectives());return X}getAllFilters(){let X={};for(let $ of this.sortedPlugins)if($.registerFilters)Object.assign(X,$.registerFilters());return X}async runBeforeProcess(X){return this.runHooks("beforeProcess",X)}async runAfterParse(X){return this.runHooks("afterParse",X)}async runBeforeDirective(X,$){return this.runDirectiveHooks("beforeDirective",X,$)}async runAfterDirective(X,$){return this.runDirectiveHooks("afterDirective",X,$)}async runBeforeRender(X){return this.runHooks("beforeRender",X)}async runAfterRender(X){return this.runHooks("afterRender",X)}async runOnError(X){for(let $ of this.sortedPlugins)if($.onError)try{let Z=await $.onError(X);if(Z){if(Z.template!==void 0)X.template=Z.template;if(Z.context)X.context={...X.context,...Z.context};if(Z.metadata)X.metadata={...X.metadata,...Z.metadata};if(Z.skip)return X}}catch(Z){console.error(`Error in plugin "${$.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((X,$)=>(X.priority??100)-($.priority??100))}async runHooks(X,$){let Z={...$};for(let Y of this.sortedPlugins){let J=Y[X];if(J)try{let G=await J(Z);if(G){if(G.template!==void 0)Z.template=G.template;if(G.context)Z.context={...Z.context,...G.context};if(G.metadata)Z.metadata={...Z.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Y.name}" ${X} hook:`,G)}}return Z}async runDirectiveHooks(X,$,Z){let Y={...Z};for(let J of this.sortedPlugins){let G=J[X];if(G)try{let Q=await G($,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}" ${X} hook:`,Q)}}return Y}}function kF(X,$,Z={}){return{name:X,...Z,registerDirectives:()=>$}}function IF(X,$,Z={}){return{name:X,...Z,registerFilters:()=>$}}function yF(X){return w$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess($){return{context:{...$.context,...X}}}})}var NF,EF,DF;var lq=D(()=>{NF=new e4;EF=w$({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(X){console.log("[stx-debug] beforeProcess:",X.filePath)},afterParse(X){console.log("[stx-debug] afterParse:",X.template.length,"chars")},beforeDirective(X,$){console.log("[stx-debug] beforeDirective:",X)},afterDirective(X,$){console.log("[stx-debug] afterDirective:",X)},beforeRender(X){console.log("[stx-debug] beforeRender")},afterRender(X){console.log("[stx-debug] afterRender:",X.template.length,"chars")},onError(X){console.error("[stx-debug] onError:",X.error.message,"in phase:",X.phase)}}),DF=w$({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(X){X.metadata.startTime=performance.now()},afterRender(X){let $=X.metadata.startTime;if($){let Z=performance.now()-$;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var OZ={};t(OZ,{validateConfig:()=>fF,resolveStxDirectories:()=>iq,loadStxConfig:()=>u1,defineStxConfig:()=>xF,defaultConfig:()=>V1,config:()=>I7});import q$ from"fs";import m0 from"path";import{loadConfigWithResult as bF}from"bunfig";function SF(X,$,Z){let Y=$||"pages";if(X)return{root:X,pagesDir:Y};let J=Z||process.cwd(),G=m0.join(J,"resources","views"),Q=m0.join(J,"resources","layouts");if(q$.existsSync(G)&&q$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=m0.join(J,"resources","views","pages");if(q$.existsSync(w))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function CF(X,$){let Z=$.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let Y=X.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/");return Y===J||Y.startsWith(`${J}/`)}function iq(X,$){let Z=!X.root,Y=SF(X.root,X.pagesDir,$);if(X.root=Y.root,X.pagesDir=Y.pagesDir,Z&&Y.root!=="."){let J=`${$}::${Y.root}`;if(!cq.has(J))cq.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(X.root&&X.root!=="."){let J=X.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=X[G];if(typeof Q!=="string"||!Q)continue;if(m0.isAbsolute(Q)||CF(Q,J))continue;X[G]=m0.join(J,Q)}}return X}function PF(X,$){let Z=["componentsDir","layoutsDir","partialsDir"];for(let Y of Z){let J=X[Y];if(typeof J!=="string"||!J)continue;let G=m0.isAbsolute(J)?J:m0.join($,J);if(q$.existsSync(G))continue;let Q=X.root,w=!!Q&&Q!==".";console.warn(`[stx] ${String(Y)} resolves to "${G}", which does not exist. Configured as "${J}"`+(w?`, resolved under root "${Q}".`:"."))}}function vF(X){if(A6(X.stateDir),X.stateDir=R7(),X.cachePath=M7(X.cachePath),X.build)X.build.cacheDir=M7(X.build.cacheDir);if(X.media?.cache)X.media.cache.directory=M7(X.media.cache.directory);if(X.story)X.story.outDir=M7(X.story.outDir)}async function u1(X){if(!X){if(G7)return G7;if(W$)return W$}let $=X?m0.resolve(X):process.cwd(),Z=pq.get($);if(Z)return Z;let Y=(async()=>{let G=(await bF({name:"stx",alias:"ui",cwd:$,defaultConfig:V1,verbose:!1})).config;if(vF(G),iq(G,$),PF(G,$),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (lq(),mq)),w=[],q=[];for(let W of G.plugins){let U=typeof W==="string"?W:W[0],K=typeof W==="string"?{}:W[1]||{};try{let z,B;try{z=await import(U),B=m0.dirname(X0.resolve(U))}catch{let j=m0.resolve(process.cwd(),U);z=await import(j),B=m0.dirname(j)}let _=z.default||z;if(Q.register(_,G),_.components){let j=Array.isArray(_.components)?_.components:[_.components];for(let H of j)w.push(m0.resolve(B,H))}if(_.pages){let j=m0.resolve(B,_.pages),H=K.path||"/";q.push({dir:j,prefix:H})}if(_.setup){let j={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,O)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=O},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:B,config:G};await _.setup(K,j)}console.log(`[stx] Plugin loaded: ${_.name||U}`)}catch(z){console.warn(`[stx] Failed to load plugin ${U}:`,z.message)}}G._pluginComponentDirs=w,G._pluginPageDirs=q}return G})();if(pq.set($,Y),!X)W$=Y,Y.then((J)=>{G7=J}).catch(()=>{});return Y}function xF(X){return X}function fF(X){let $=[],Z=[];if(X.partialsDir!==void 0&&typeof X.partialsDir!=="string")$.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(X.componentsDir!==void 0&&typeof X.componentsDir!=="string")$.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(X.cache!==void 0&&typeof X.cache!=="boolean")$.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(X.debug!==void 0&&typeof X.debug!=="boolean")$.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(X.streaming){if(X.streaming.bufferSize!==void 0){if(typeof X.streaming.bufferSize!=="number"||X.streaming.bufferSize<=0)$.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(X.streaming.timeout!==void 0){if(typeof X.streaming.timeout!=="number"||X.streaming.timeout<=0)$.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(X.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes(X.streaming.strategy))$.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.i18n){if(X.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes(X.i18n.format))$.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.animation){if(X.animation.defaultDuration!==void 0){if(typeof X.animation.defaultDuration!=="number"||X.animation.defaultDuration<0)$.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(X.animation.staggerDelay!==void 0){if(typeof X.animation.staggerDelay!=="number"||X.animation.staggerDelay<0)$.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(X.a11y){if(X.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes(X.a11y.level))$.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.hydration){if(X.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes(X.hydration.mode))$.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes(X.hydration.preload))$.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.customDirectives)if(!Array.isArray(X.customDirectives))$.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else X.customDirectives.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(X.middleware)if(!Array.isArray(X.middleware))$.push({path:"middleware",message:"middleware must be an array",severity:"error"});else X.middleware.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))$.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(X.debug===!0&&X.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(X.seo?.enabled===!0&&!X.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(X.pwa){if(X.pwa.enabled===!0&&!X.pwa.manifest?.name)$.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(X.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes(X.pwa.manifest.display))$.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes(X.pwa.manifest.orientation))$.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];X.pwa.routes.forEach((J,G)=>{if(!J.pattern||typeof J.pattern!=="string")$.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(J.strategy))$.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))$.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))$.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(X.pwa.icons?.sizes){if(!Array.isArray(X.pwa.icons.sizes))$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(X.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(X.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if(X.pwa.icons.purpose.filter((G)=>!Y.includes(G)).length>0)$.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.enabled===!0&&!X.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(X.pwa.enabled===!0&&!X.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:$.length===0,errors:$,warnings:Z}}var V1,cq,G7=null,pq,W$=null,I7;var j1=D(()=>{L$();O$();x$();f$();L4();_q();t4();hq();R3();VX();dq();V1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:E5,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:hw,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:uq,hasEndTag:!1,description:"Include a web component in the template"},I2,E2,pJ,iJ,D2,b2,S2,y2,Z6,G6,zq,a4,...gq],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};cq=new Set;pq=new Map;I7=new Proxy(V1,{get(X,$){if(G7&&$ in G7)return G7[$];if(!W$)u1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return X[$]}})});var GV=`
15132
15127
  <script>
15133
15128
  (function() {
15134
15129
  'use strict';
@@ -15594,7 +15589,7 @@ else if (data.type === 'event' && data.method) {
15594
15589
  }
15595
15590
  })();
15596
15591
  </script>
15597
- `;function a4(X={}){let{debug:$=!1,timeout:Z=30000}=X;return`
15592
+ `;function J2(X={}){let{debug:$=!1,timeout:Z=30000}=X;return`
15598
15593
  <script>
15599
15594
  (function() {
15600
15595
  'use strict';
@@ -16060,14 +16055,14 @@ else if (data.type === 'event' && data.method) {
16060
16055
  }
16061
16056
  })();
16062
16057
  </script>
16063
- `.replace("debug: false,",`debug: ${$},`).replace("timeout: 30000",`timeout: ${Z}`)}function sF(){return!1}function oF(X,$={}){let Z=/@craft(?:\(([\s\S]*?)\))?/g;return X.replace(Z,(Y,J)=>{let G={};if(J)try{G=JSON.parse(J.replace(/'/g,'"'))}catch{try{G=Function(`return ${J}`)()}catch{console.warn(`[stx] Invalid @craft config: ${J}`)}}return a4(G)})}function t4(X,$={}){if(X.includes("__craftBridgeInitialized"))return X;let Z=a4($);if(X.includes("</head>"))return X.replace("</head>",`${Z}
16058
+ `.replace("debug: false,",`debug: ${$},`).replace("timeout: 30000",`timeout: ${Z}`)}function QV(){return!1}function wV(X,$={}){let Z=/@craft(?:\(([\s\S]*?)\))?/g;return X.replace(Z,(Y,J)=>{let G={};if(J)try{G=JSON.parse(J.replace(/'/g,'"'))}catch{try{G=Function(`return ${J}`)()}catch{console.warn(`[stx] Invalid @craft config: ${J}`)}}return J2(G)})}function G2(X,$={}){if(X.includes("__craftBridgeInitialized"))return X;let Z=J2($);if(X.includes("</head>"))return X.replace("</head>",`${Z}
16064
16059
  </head>`);if(X.includes("<body"))return X.replace(/(<body[^>]*>)/,`$1
16065
- ${Z}`);return Z+X}var nq=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function tF(X,$={}){let Z=performance.now(),Y={target:$.target||"universal",format:$.format||"zig",optimize:$.optimize??!0,treeShake:$.treeShake??!0,hotReload:$.hotReload??!1,debug:$.debug??!1,sourceMaps:$.sourceMaps??!1,bundle:$.bundle??!0,minify:$.minify??!1,components:$.components||nq},J=typeof X==="string"?rq(X):X,G=oq(J.tree,Y),Q=YW(G),w=Y.treeShake?GW(G,Q):G,q=new Map;if(Y.target==="universal"){let B=["macos","windows","linux","ios","android"];for(let _ of B){let j=_$(w,{...Y,target:_});q.set(_,j)}}else{let B=_$(w,Y);q.set(Y.target,B)}let W=qW(w,Y,q),K=WW(J,w,Y),U={compilationTime:performance.now()-Z,totalComponents:B$(J.tree),nativeComponents:j$(w),webComponents:B$(J.tree)-j$(w),bundleSize:W.length,treeShakenSize:Y.treeShake?QW(G,w):W.length,warnings:[],errors:[]},z;if(Y.sourceMaps)z=KW(J,w);return{code:W,platformCode:q,dependencies:Q,manifest:K,sourceMaps:z,stats:U}}function rq(X){let $={type:"fragment",children:[]},Z=X.match(/<body[^>]*>([\s\S]*?)<\/body>/i),Y=Z?Z[1]:X;return X2(Y,$),{id:G2(),hash:Q2(X),tree:$,scripts:_W(X),styles:BW(X),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:X.includes("{{"),hasEventHandlers:X.includes("onclick")||X.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:X.length}}}function X2(X,$){let Z=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,Y;while((Y=Z.exec(X))!==null){let[,J,G,Q]=Y,w=J.startsWith("@craft-"),q={type:w?"component":"element",tag:w?J.slice(1):J,props:sq(G),children:[],componentName:w?J.slice(1):void 0};if(Q){let W=Q.replace(/<[^>]+>/g,"").trim();if(W)q.children=q.children??[],q.children.push({type:"text",text:W});X2(Q,q)}$.children=$.children??[],$.children.push(q)}}function sq(X){let $={},Z=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,Y;while((Y=Z.exec(X))!==null){let[,J,G]=Y;$[J]=G??!0}return $}function oq(X,$){return $2(X,$)}function $2(X,$){let Z=X.componentName?$.components?.get(X.componentName):void 0,Y="craft.View";if(Z)Y=Z.zigType;else if(X.type==="text")Y="craft.Text";else if(X.tag)Y=aq(X.tag);let J={};if(X.props)for(let[q,W]of Object.entries(X.props))J[q]=tq(W);let G=[];if(X.children)for(let q of X.children)G.push($2(q,$));let Q=new Map;if(X.props){for(let[q,W]of Object.entries(X.props))if(q.startsWith("on")&&typeof W==="string")Q.set(q.slice(2).toLowerCase(),W)}let w=XW(X);return{type:eq(X,Z),zigType:Y,props:J,children:G,events:Q,styles:w,id:X.hydrationKey,key:X.props?.key}}function aq(X){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[X.toLowerCase()]||"craft.View"}function tq(X){if(typeof X==="string"){if(X.startsWith("{{")&&X.endsWith("}}"))return{type:"binding",path:X.slice(2,-2).trim()};if(X.includes("(")&&X.includes(")"))return{type:"callback",handler:X};return{type:"literal",value:X}}if(typeof X==="number"||typeof X==="boolean")return{type:"literal",value:X};return{type:"literal",value:String(X)}}function eq(X,$){if($){let Y=$.name.toLowerCase();if(Y.includes("button"))return"button";if(Y.includes("input")||Y.includes("text"))return"input";if(Y.includes("image")||Y.includes("avatar"))return"image";if(Y.includes("list")||Y.includes("table"))return"list";if(Y.includes("scroll"))return"scroll";return"custom"}if(X.type==="text")return"text";let Z=X.tag?.toLowerCase();if(Z==="button")return"button";if(Z==="input"||Z==="textarea")return"input";if(Z==="img")return"image";if(Z==="ul"||Z==="ol")return"list";return"view"}function XW(X){let $=X.props?.style,Z={},Y={};if($){let J=$.split(";").filter(Boolean);for(let G of J){let[Q,w]=G.split(":").map((q)=>q.trim());if(!Q||!w)continue;switch(Q){case"display":Z.display=w;break;case"flex-direction":Z.flexDirection=w;break;case"justify-content":Z.justifyContent=$W(w);break;case"align-items":Z.alignItems=ZW(w);break;case"gap":Z.gap=Number.parseInt(w,10);break;case"padding":Z.padding=Number.parseInt(w,10);break;case"margin":Z.margin=Number.parseInt(w,10);break;case"width":Z.width=w==="auto"?"auto":Number.parseInt(w,10);break;case"height":Z.height=w==="auto"?"auto":Number.parseInt(w,10);break;case"background-color":case"background":Y.backgroundColor=w;break;case"border-color":Y.borderColor=w;break;case"border-width":Y.borderWidth=Number.parseInt(w,10);break;case"border-radius":Y.borderRadius=Number.parseInt(w,10);break;case"opacity":Y.opacity=Number.parseFloat(w);break}}}return{layout:Z,appearance:Y}}function $W(X){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[X]||"start"}function ZW(X){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[X]||"start"}function YW(X){let $=[],Z=new Set;function Y(J,G){let Q=J.id||G2();if(Z.has(Q))return;Z.add(Q);let w={id:Q,type:"component",path:J.zigType,dependencies:G?[G]:[],size:Z2(J),isStatic:JW(J)};$.push(w);for(let q of J.children)Y(q,Q)}return Y(X),$}function Z2(X){let $=100;return $+=Object.keys(X.props).length*20,$+=X.events.size*50,$}function JW(X){for(let $ of Object.values(X.props))if($.type!=="literal")return!1;return X.events.size===0}function GW(X,$){return X}function QW(X,$){let Z=0;function Y(J){Z+=Z2(J);for(let G of J.children)Y(G)}return Y($),Z}function _$(X,$){switch($.format){case"zig":return e4(X,$);case"typescript":return wW(X,$);case"json":return JSON.stringify(X,null,$.minify?0:2);default:return e4(X,$)}}function e4(X,$){let Z=[];return Z.push("// Auto-generated by stx compiler"),Z.push("// Target: "+$.target),Z.push(""),Z.push('const std = @import("std");'),Z.push('const craft = @import("craft");'),Z.push(""),Z.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),Z.push(" return try build(allocator);"),Z.push("}"),Z.push(""),Y2(X,Z,0),Z.join(`
16066
- `)}function Y2(X,$,Z){let Y=" ".repeat(Z);if(Z===0)$.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let J=`node_${Z}`;$.push(`${Y} var ${J} = try ${X.zigType}.init(allocator);`);for(let[G,Q]of Object.entries(X.props))if(Q.type==="literal"){let w=typeof Q.value==="string"?`"${Q.value}"`:String(Q.value);$.push(`${Y} ${J}.set${zW(G)}(${w});`)}for(let G=0;G<X.children.length;G++){let Q=X.children[G];if(Q.type==="text"){let w=Q.props.text?.type==="literal"?String(Q.props.text.value):"";$.push(`${Y} try ${J}.addChild(try craft.Text.init(allocator, "${w}"));`)}else Y2(Q,$,Z+1),$.push(`${Y} try ${J}.addChild(node_${Z+1});`)}if(Z===0)$.push(` return ${J}.element();`),$.push("}")}function wW(X,$){let Z=[];return Z.push("// Auto-generated by stx compiler"),Z.push("// Target: "+$.target),Z.push(""),Z.push('import { Craft } from "@stacksjs/craft";'),Z.push(""),Z.push("export function render(): Craft.Element {"),Z.push(" return "+J2(X,1)+";"),Z.push("}"),Z.join(`
16067
- `)}function J2(X,$){let Z=" ".repeat($),Y=[];for(let[w,q]of Object.entries(X.props))if(q.type==="literal"){let W=typeof q.value==="string"?`"${q.value}"`:String(q.value);Y.push(`${w}: ${W}`)}let J=Y.length>0?`{ ${Y.join(", ")} }`:"{}",G=X.children.map((w)=>w.type==="text"?`"${w.props.text?.type==="literal"?w.props.text.value:""}"`:J2(w,$+1)),Q=G.length>0?`,
16060
+ ${Z}`);return Z+X}var JW=new Map([["craft-button",{name:"Button",zigType:"craft.Button",props:[{name:"variant",type:"string",required:!1,default:"primary"},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onclick",type:"callback",required:!1}],children:"single"}],["craft-text-input",{name:"TextInput",zigType:"craft.TextInput",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-textarea",{name:"TextArea",zigType:"craft.TextArea",props:[{name:"value",type:"string",required:!1,default:""},{name:"placeholder",type:"string",required:!1},{name:"rows",type:"number",required:!1,default:3},{name:"disabled",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-checkbox",{name:"Checkbox",zigType:"craft.Checkbox",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"label",type:"string",required:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-select",{name:"Select",zigType:"craft.Select",props:[{name:"value",type:"string",required:!1},{name:"options",type:"array",required:!0},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-slider",{name:"Slider",zigType:"craft.Slider",props:[{name:"value",type:"number",required:!1,default:0},{name:"min",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"step",type:"number",required:!1,default:1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-toggle",{name:"Toggle",zigType:"craft.Toggle",props:[{name:"checked",type:"boolean",required:!1,default:!1},{name:"disabled",type:"boolean",required:!1,default:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-modal",{name:"Modal",zigType:"craft.Modal",props:[{name:"open",type:"boolean",required:!1,default:!1},{name:"title",type:"string",required:!1},{name:"closable",type:"boolean",required:!1,default:!0},{name:"onclose",type:"callback",required:!1}],children:"multiple"}],["craft-alert",{name:"Alert",zigType:"craft.Alert",props:[{name:"variant",type:"string",required:!1,default:"info"},{name:"title",type:"string",required:!1},{name:"dismissible",type:"boolean",required:!1,default:!1}],children:"single"}],["craft-progress",{name:"ProgressBar",zigType:"craft.ProgressBar",props:[{name:"value",type:"number",required:!1,default:0},{name:"max",type:"number",required:!1,default:100},{name:"indeterminate",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-spinner",{name:"Spinner",zigType:"craft.Spinner",props:[{name:"size",type:"number",required:!1,default:24}],children:"none"}],["craft-avatar",{name:"Avatar",zigType:"craft.Avatar",props:[{name:"src",type:"string",required:!1},{name:"alt",type:"string",required:!1},{name:"size",type:"number",required:!1,default:40}],children:"none"}],["craft-badge",{name:"Badge",zigType:"craft.Badge",props:[{name:"variant",type:"string",required:!1,default:"default"}],children:"single"}],["craft-card",{name:"Card",zigType:"craft.Card",props:[{name:"padding",type:"number",required:!1,default:16}],children:"multiple"}],["craft-sidebar",{name:"Sidebar",zigType:"craft.NativeSidebar",props:[{name:"id",type:"string",required:!1},{name:"variant",type:"string",required:!1,default:"desktop"},{name:"material",type:"string",required:!1,default:"sidebar"},{name:"backgroundEffect",type:"string",required:!1,default:"shimmer"},{name:"allowsVibrancy",type:"boolean",required:!1,default:!0},{name:"materialOpacity",type:"number",required:!1,default:0.68},{name:"minWidth",type:"number",required:!1,default:240},{name:"maxWidth",type:"number",required:!1,default:340},{name:"canCollapse",type:"boolean",required:!1,default:!0},{name:"selectedItem",type:"string",required:!1},{name:"sections",type:"array",required:!1}],children:"multiple",platform:["macos"],fallback:"aside"}],["craft-sidebar-section",{name:"SidebarSection",zigType:"craft.NativeSidebarSection",props:[{name:"id",type:"string",required:!0},{name:"title",type:"string",required:!1},{name:"header",type:"string",required:!1}],children:"multiple",platform:["macos"],fallback:"section"}],["craft-sidebar-item",{name:"SidebarItem",zigType:"craft.NativeSidebarItem",props:[{name:"id",type:"string",required:!0},{name:"label",type:"string",required:!0},{name:"icon",type:"string",required:!1},{name:"badge",type:"string",required:!1},{name:"tintColor",type:"color",required:!1}],children:"none",platform:["macos"],fallback:"button"}],["craft-accordion",{name:"Accordion",zigType:"craft.Accordion",props:[{name:"title",type:"string",required:!0},{name:"open",type:"boolean",required:!1,default:!1}],children:"multiple"}],["craft-tabs",{name:"TabView",zigType:"craft.TabView",props:[{name:"activeTab",type:"number",required:!1,default:0},{name:"ontabchange",type:"callback",required:!1}],children:"multiple"}],["craft-tooltip",{name:"Tooltip",zigType:"craft.Tooltip",props:[{name:"content",type:"string",required:!0},{name:"position",type:"string",required:!1,default:"top"}],children:"single"}],["craft-date-picker",{name:"DatePicker",zigType:"craft.DatePicker",props:[{name:"value",type:"string",required:!1},{name:"min",type:"string",required:!1},{name:"max",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-time-picker",{name:"TimePicker",zigType:"craft.TimePicker",props:[{name:"value",type:"string",required:!1},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-color-picker",{name:"ColorPicker",zigType:"craft.ColorPicker",props:[{name:"value",type:"color",required:!1,default:"#000000"},{name:"onchange",type:"callback",required:!1}],children:"none"}],["craft-data-table",{name:"DataTable",zigType:"craft.DataTable",props:[{name:"data",type:"array",required:!0},{name:"columns",type:"array",required:!0},{name:"sortable",type:"boolean",required:!1,default:!1},{name:"paginated",type:"boolean",required:!1,default:!1}],children:"none"}],["craft-virtual-list",{name:"VirtualList",zigType:"craft.VirtualList",props:[{name:"items",type:"array",required:!0},{name:"itemHeight",type:"number",required:!1,default:48},{name:"renderItem",type:"callback",required:!0}],children:"none"}],["craft-tree-view",{name:"TreeView",zigType:"craft.TreeView",props:[{name:"data",type:"object",required:!0},{name:"expandable",type:"boolean",required:!1,default:!0}],children:"none"}]]);async function WV(X,$={}){let Z=performance.now(),Y={target:$.target||"universal",format:$.format||"zig",optimize:$.optimize??!0,treeShake:$.treeShake??!0,hotReload:$.hotReload??!1,debug:$.debug??!1,sourceMaps:$.sourceMaps??!1,bundle:$.bundle??!0,minify:$.minify??!1,components:$.components||JW},J=typeof X==="string"?GW(X):X,G=wW(J.tree,Y),Q=BW(G),w=Y.treeShake?HW(G,Q):G,q=new Map;if(Y.target==="universal"){let B=["macos","windows","linux","ios","android"];for(let _ of B){let j=_$(w,{...Y,target:_});q.set(_,j)}}else{let B=_$(w,Y);q.set(Y.target,B)}let W=FW(w,Y,q),U=VW(J,w,Y),K={compilationTime:performance.now()-Z,totalComponents:B$(J.tree),nativeComponents:j$(w),webComponents:B$(J.tree)-j$(w),bundleSize:W.length,treeShakenSize:Y.treeShake?LW(G,w):W.length,warnings:[],errors:[]},z;if(Y.sourceMaps)z=AW(J,w);return{code:W,platformCode:q,dependencies:Q,manifest:U,sourceMaps:z,stats:K}}function GW(X){let $={type:"fragment",children:[]},Z=X.match(/<body[^>]*>([\s\S]*?)<\/body>/i),Y=Z?Z[1]:X;return w2(Y,$),{id:z2(),hash:_2(X),tree:$,scripts:MW(X),styles:NW(X),staticParts:new Map,dynamicParts:new Map,dependencies:[],metadata:{hasSlots:!1,hasDynamicContent:X.includes("{{"),hasEventHandlers:X.includes("onclick")||X.includes("onchange"),hasAsyncContent:!1,componentCount:0,maxDepth:0,estimatedSize:X.length}}}function w2(X,$){let Z=/<(@?[\w-]+)([^>]*)(?:\/>|>([\s\S]*?)<\/\1>)/g,Y;while((Y=Z.exec(X))!==null){let[,J,G,Q]=Y,w=J.startsWith("@craft-"),q={type:w?"component":"element",tag:w?J.slice(1):J,props:QW(G),children:[],componentName:w?J.slice(1):void 0};if(Q){let W=Q.replace(/<[^>]+>/g,"").trim();if(W)q.children=q.children??[],q.children.push({type:"text",text:W});w2(Q,q)}$.children=$.children??[],$.children.push(q)}}function QW(X){let $={},Z=/([\w-:@]+)(?:=["']([^"']*)["'])?/g,Y;while((Y=Z.exec(X))!==null){let[,J,G]=Y;$[J]=G??!0}return $}function wW(X,$){return q2(X,$)}function q2(X,$){let Z=X.componentName?$.components?.get(X.componentName):void 0,Y="craft.View";if(Z)Y=Z.zigType;else if(X.type==="text")Y="craft.Text";else if(X.tag)Y=qW(X.tag);let J={};if(X.props)for(let[q,W]of Object.entries(X.props))J[q]=WW(W);let G=[];if(X.children)for(let q of X.children)G.push(q2(q,$));let Q=new Map;if(X.props){for(let[q,W]of Object.entries(X.props))if(q.startsWith("on")&&typeof W==="string")Q.set(q.slice(2).toLowerCase(),W)}let w=KW(X);return{type:UW(X,Z),zigType:Y,props:J,children:G,events:Q,styles:w,id:X.hydrationKey,key:X.props?.key}}function qW(X){return{div:"craft.View",span:"craft.Text",p:"craft.Text",h1:"craft.Text",h2:"craft.Text",h3:"craft.Text",h4:"craft.Text",h5:"craft.Text",h6:"craft.Text",button:"craft.Button",input:"craft.TextInput",textarea:"craft.TextArea",select:"craft.Select",img:"craft.Image",a:"craft.Link",ul:"craft.List",ol:"craft.List",li:"craft.ListItem",form:"craft.Form",label:"craft.Label",nav:"craft.View",header:"craft.View",footer:"craft.View",main:"craft.View",section:"craft.View",article:"craft.View",aside:"craft.View"}[X.toLowerCase()]||"craft.View"}function WW(X){if(typeof X==="string"){if(X.startsWith("{{")&&X.endsWith("}}"))return{type:"binding",path:X.slice(2,-2).trim()};if(X.includes("(")&&X.includes(")"))return{type:"callback",handler:X};return{type:"literal",value:X}}if(typeof X==="number"||typeof X==="boolean")return{type:"literal",value:X};return{type:"literal",value:String(X)}}function UW(X,$){if($){let Y=$.name.toLowerCase();if(Y.includes("button"))return"button";if(Y.includes("input")||Y.includes("text"))return"input";if(Y.includes("image")||Y.includes("avatar"))return"image";if(Y.includes("list")||Y.includes("table"))return"list";if(Y.includes("scroll"))return"scroll";return"custom"}if(X.type==="text")return"text";let Z=X.tag?.toLowerCase();if(Z==="button")return"button";if(Z==="input"||Z==="textarea")return"input";if(Z==="img")return"image";if(Z==="ul"||Z==="ol")return"list";return"view"}function KW(X){let $=X.props?.style,Z={},Y={};if($){let J=$.split(";").filter(Boolean);for(let G of J){let[Q,w]=G.split(":").map((q)=>q.trim());if(!Q||!w)continue;switch(Q){case"display":Z.display=w;break;case"flex-direction":Z.flexDirection=w;break;case"justify-content":Z.justifyContent=zW(w);break;case"align-items":Z.alignItems=_W(w);break;case"gap":Z.gap=Number.parseInt(w,10);break;case"padding":Z.padding=Number.parseInt(w,10);break;case"margin":Z.margin=Number.parseInt(w,10);break;case"width":Z.width=w==="auto"?"auto":Number.parseInt(w,10);break;case"height":Z.height=w==="auto"?"auto":Number.parseInt(w,10);break;case"background-color":case"background":Y.backgroundColor=w;break;case"border-color":Y.borderColor=w;break;case"border-width":Y.borderWidth=Number.parseInt(w,10);break;case"border-radius":Y.borderRadius=Number.parseInt(w,10);break;case"opacity":Y.opacity=Number.parseFloat(w);break}}}return{layout:Z,appearance:Y}}function zW(X){return{"flex-start":"start","flex-end":"end",center:"center","space-between":"between","space-around":"around"}[X]||"start"}function _W(X){return{"flex-start":"start","flex-end":"end",center:"center",stretch:"stretch"}[X]||"start"}function BW(X){let $=[],Z=new Set;function Y(J,G){let Q=J.id||z2();if(Z.has(Q))return;Z.add(Q);let w={id:Q,type:"component",path:J.zigType,dependencies:G?[G]:[],size:W2(J),isStatic:jW(J)};$.push(w);for(let q of J.children)Y(q,Q)}return Y(X),$}function W2(X){let $=100;return $+=Object.keys(X.props).length*20,$+=X.events.size*50,$}function jW(X){for(let $ of Object.values(X.props))if($.type!=="literal")return!1;return X.events.size===0}function HW(X,$){return X}function LW(X,$){let Z=0;function Y(J){Z+=W2(J);for(let G of J.children)Y(G)}return Y($),Z}function _$(X,$){switch($.format){case"zig":return Q2(X,$);case"typescript":return OW(X,$);case"json":return JSON.stringify(X,null,$.minify?0:2);default:return Q2(X,$)}}function Q2(X,$){let Z=[];return Z.push("// Auto-generated by stx compiler"),Z.push("// Target: "+$.target),Z.push(""),Z.push('const std = @import("std");'),Z.push('const craft = @import("craft");'),Z.push(""),Z.push("pub fn render(allocator: std.mem.Allocator) !craft.Element {"),Z.push(" return try build(allocator);"),Z.push("}"),Z.push(""),U2(X,Z,0),Z.join(`
16061
+ `)}function U2(X,$,Z){let Y=" ".repeat(Z);if(Z===0)$.push("fn build(allocator: std.mem.Allocator) !craft.Element {");let J=`node_${Z}`;$.push(`${Y} var ${J} = try ${X.zigType}.init(allocator);`);for(let[G,Q]of Object.entries(X.props))if(Q.type==="literal"){let w=typeof Q.value==="string"?`"${Q.value}"`:String(Q.value);$.push(`${Y} ${J}.set${TW(G)}(${w});`)}for(let G=0;G<X.children.length;G++){let Q=X.children[G];if(Q.type==="text"){let w=Q.props.text?.type==="literal"?String(Q.props.text.value):"";$.push(`${Y} try ${J}.addChild(try craft.Text.init(allocator, "${w}"));`)}else U2(Q,$,Z+1),$.push(`${Y} try ${J}.addChild(node_${Z+1});`)}if(Z===0)$.push(` return ${J}.element();`),$.push("}")}function OW(X,$){let Z=[];return Z.push("// Auto-generated by stx compiler"),Z.push("// Target: "+$.target),Z.push(""),Z.push('import { Craft } from "@stacksjs/craft";'),Z.push(""),Z.push("export function render(): Craft.Element {"),Z.push(" return "+K2(X,1)+";"),Z.push("}"),Z.join(`
16062
+ `)}function K2(X,$){let Z=" ".repeat($),Y=[];for(let[w,q]of Object.entries(X.props))if(q.type==="literal"){let W=typeof q.value==="string"?`"${q.value}"`:String(q.value);Y.push(`${w}: ${W}`)}let J=Y.length>0?`{ ${Y.join(", ")} }`:"{}",G=X.children.map((w)=>w.type==="text"?`"${w.props.text?.type==="literal"?w.props.text.value:""}"`:K2(w,$+1)),Q=G.length>0?`,
16068
16063
  ${Z} [${G.join(`,
16069
- ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function qW(X,$,Z){if($.target==="universal"){let Y=[];Y.push("// Universal entry point"),Y.push("");for(let[J,G]of Z)Y.push(`// --- ${J.toUpperCase()} ---`),Y.push(`#if ${J.toUpperCase()}`),Y.push(G),Y.push("#endif"),Y.push("");return Y.join(`
16070
- `)}return Z.get($.target)||_$(X,$)}function WW(X,$,Z){let Y=[];function J(G){Y.push({name:G.zigType,hash:Q2(JSON.stringify(G.props)),props:Object.keys(G.props),events:Array.from(G.events.keys()),slots:[],isNative:G.zigType.startsWith("craft.")});for(let Q of G.children)J(Q)}return J($),{version:"1.0.0",components:Y,entry:X.id,assets:[],styles:X.styles}}function KW(X,$){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var UW=0;function G2(){return`id_${++UW}`}function Q2(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(36)}function zW(X){return X.charAt(0).toUpperCase()+X.slice(1)}function _W(X){let $=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function BW(X){let $=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function B$(X){let $=X.type==="component"?1:0;if(X.children)for(let Z of X.children)$+=B$(Z);return $}function j$(X){let $=X.zigType.startsWith("craft.")?1:0;for(let Z of X.children)$+=j$(Z);return $}function eF(X){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:($)=>{console.log(`[craft-compiler] File changed: ${$}`)}}}var H$={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(X,$)=>{let Z=X.checked?"checked":"",Y=X.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
16064
+ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function FW(X,$,Z){if($.target==="universal"){let Y=[];Y.push("// Universal entry point"),Y.push("");for(let[J,G]of Z)Y.push(`// --- ${J.toUpperCase()} ---`),Y.push(`#if ${J.toUpperCase()}`),Y.push(G),Y.push("#endif"),Y.push("");return Y.join(`
16065
+ `)}return Z.get($.target)||_$(X,$)}function VW(X,$,Z){let Y=[];function J(G){Y.push({name:G.zigType,hash:_2(JSON.stringify(G.props)),props:Object.keys(G.props),events:Array.from(G.events.keys()),slots:[],isNative:G.zigType.startsWith("craft.")});for(let Q of G.children)J(Q)}return J($),{version:"1.0.0",components:Y,entry:X.id,assets:[],styles:X.styles}}function AW(X,$){return JSON.stringify({version:3,file:"output.zig",sources:["input.stx"],mappings:""})}var RW=0;function z2(){return`id_${++RW}`}function _2(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(36)}function TW(X){return X.charAt(0).toUpperCase()+X.slice(1)}function MW(X){let $=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function NW(X){let $=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function B$(X){let $=X.type==="component"?1:0;if(X.children)for(let Z of X.children)$+=B$(Z);return $}function j$(X){let $=X.zigType.startsWith("craft.")?1:0;for(let Z of X.children)$+=j$(Z);return $}function UV(X){return{start:async()=>{console.log("[craft-compiler] Hot reload server started")},stop:async()=>{console.log("[craft-compiler] Hot reload server stopped")},notifyChange:($)=>{console.log(`[craft-compiler] File changed: ${$}`)}}}var H$={button:{nativeType:"craft-button",fallbackTag:"button",fallbackClasses:"craft-button",nativeProps:["variant","size","disabled","loading"]},"text-input":{nativeType:"craft-text-input",fallbackTag:"input",fallbackClasses:"craft-text-input",nativeProps:["placeholder","value","type","disabled","readonly"]},textarea:{nativeType:"craft-textarea",fallbackTag:"textarea",fallbackClasses:"craft-textarea",nativeProps:["placeholder","value","rows","disabled","readonly"]},checkbox:{nativeType:"craft-checkbox",fallbackTag:"input",fallbackClasses:"craft-checkbox",nativeProps:["checked","disabled","label"],render:(X,$)=>{let Z=X.checked?"checked":"",Y=X.disabled?"disabled":"";return`<label class="craft-checkbox-wrapper">
16071
16066
  <input type="checkbox" class="craft-checkbox" ${Z} ${Y}>
16072
16067
  <span class="craft-checkbox-label">${$||X.label||""}</span>
16073
16068
  </label>`}},radio:{nativeType:"craft-radio",fallbackTag:"input",fallbackClasses:"craft-radio",nativeProps:["checked","disabled","name","value","label"]},select:{nativeType:"craft-select",fallbackTag:"select",fallbackClasses:"craft-select",nativeProps:["value","disabled","options","placeholder"]},slider:{nativeType:"craft-slider",fallbackTag:"input",fallbackClasses:"craft-slider",nativeProps:["value","min","max","step","disabled"],render:(X,$)=>{let Z=X.min??0,Y=X.max??100,J=X.step??1,G=X.value??50,Q=X.disabled?"disabled":"";return`<input type="range" class="craft-slider" min="${Z}" max="${Y}" step="${J}" value="${G}" ${Q}>`}},label:{nativeType:"craft-label",fallbackTag:"span",fallbackClasses:"craft-label",nativeProps:["text","for"]},badge:{nativeType:"craft-badge",fallbackTag:"span",fallbackClasses:"craft-badge",nativeProps:["variant","size"]},avatar:{nativeType:"craft-avatar",fallbackTag:"div",fallbackClasses:"craft-avatar",nativeProps:["src","alt","size","fallback"],render:(X,$)=>{let Z=X.size||40,Y=X.src,J=String(X.alt||""),G=X.fallback||(J?J.charAt(0).toUpperCase():"?");if(Y)return`<img class="craft-avatar" src="${Y}" alt="${J}" style="width:${Z}px;height:${Z}px;border-radius:50%">`;return`<div class="craft-avatar craft-avatar-fallback" style="width:${Z}px;height:${Z}px;border-radius:50%;display:flex;align-items:center;justify-content:center">${G}</div>`}},progress:{nativeType:"craft-progress",fallbackTag:"div",fallbackClasses:"craft-progress",nativeProps:["value","max","variant"],render:(X,$)=>{let Z=Number(X.value)||0,Y=Number(X.max)||100;return`<div class="craft-progress"><div class="craft-progress-bar" style="width:${Math.min(100,Math.max(0,Z/Y*100))}%"></div></div>`}},spinner:{nativeType:"craft-spinner",fallbackTag:"div",fallbackClasses:"craft-spinner",nativeProps:["size"],render:(X,$)=>{let Z=X.size||24;return`<div class="craft-spinner" style="width:${Z}px;height:${Z}px"></div>`}},card:{nativeType:"craft-card",fallbackTag:"div",fallbackClasses:"craft-card",nativeProps:["title","subtitle","variant"]},modal:{nativeType:"craft-modal",fallbackTag:"dialog",fallbackClasses:"craft-modal",nativeProps:["open","title","closable","size"],render:(X,$)=>{let Z=X.open?"open":"",Y=X.title||"";return`<dialog class="craft-modal" ${Z}>
@@ -16081,7 +16076,7 @@ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function qW(X,$,
16081
16076
  </details>`}},divider:{nativeType:"craft-divider",fallbackTag:"hr",fallbackClasses:"craft-divider",nativeProps:["orientation","variant"]},table:{nativeType:"craft-table",fallbackTag:"table",fallbackClasses:"craft-table",nativeProps:["columns","rows","sortable","selectable"]},list:{nativeType:"craft-list",fallbackTag:"ul",fallbackClasses:"craft-list",nativeProps:["items","selectable"]},tree:{nativeType:"craft-tree",fallbackTag:"div",fallbackClasses:"craft-tree",nativeProps:["nodes","expandable","selectable"]},alert:{nativeType:"craft-alert",fallbackTag:"div",fallbackClasses:"craft-alert",nativeProps:["variant","title","dismissible"],render:(X,$)=>{let Z=X.variant||"info",Y=X.title||"";return`<div class="craft-alert craft-alert-${Z}" role="alert">
16082
16077
  ${Y?`<div class="craft-alert-title">${Y}</div>`:""}
16083
16078
  <div class="craft-alert-content">${$}</div>
16084
- </div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(X,$)=>{let Z=X.content||"",Y=X.position||"top";return`<span class="craft-tooltip" data-tooltip="${Z}" data-position="${Y}">${$}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:jW},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:HW},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:LW},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:OW},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(X,$)=>{return`<input type="color" class="craft-color-picker" value="${X.value||"#000000"}">`}},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(X,$)=>{let Z=X.value||"",Y=X.min||"",J=X.max||"";return`<input type="date" class="craft-date-picker" value="${Z}" min="${Y}" max="${J}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(X,$)=>{return`<input type="time" class="craft-time-picker" value="${X.value||""}">`}}},w2=`
16079
+ </div>`}},toast:{nativeType:"craft-toast",fallbackTag:"div",fallbackClasses:"craft-toast",nativeProps:["variant","duration","position"]},tooltip:{nativeType:"craft-tooltip",fallbackTag:"span",fallbackClasses:"craft-tooltip",nativeProps:["content","position"],render:(X,$)=>{let Z=X.content||"",Y=X.position||"top";return`<span class="craft-tooltip" data-tooltip="${Z}" data-position="${Y}">${$}</span>`}},menu:{nativeType:"craft-menu",fallbackTag:"nav",fallbackClasses:"craft-menu",nativeProps:["items","orientation"]},breadcrumb:{nativeType:"craft-breadcrumb",fallbackTag:"nav",fallbackClasses:"craft-breadcrumb",nativeProps:["items","separator"]},sidebar:{nativeType:"craft-sidebar",fallbackTag:"aside",fallbackClasses:"craft-sidebar craft-sidebar-tahoe",nativeProps:["id","variant","material","backgroundEffect","allowsVibrancy","materialOpacity","materialDarkOpacity","minWidth","maxWidth","canCollapse","searchPlaceholder","selectedItem","sections","spaces","selectedSpace"],render:kW},"sidebar-space":{nativeType:"craft-sidebar-space",fallbackTag:"section",fallbackClasses:"craft-sidebar-space",nativeProps:["id","label","icon","tint"],render:IW},"sidebar-section":{nativeType:"craft-sidebar-section",fallbackTag:"section",fallbackClasses:"craft-sidebar-section",nativeProps:["id","title","header"],render:EW},"sidebar-item":{nativeType:"craft-sidebar-item",fallbackTag:"button",fallbackClasses:"craft-sidebar-item",nativeProps:["id","label","icon","badge","tintColor"],render:DW},pagination:{nativeType:"craft-pagination",fallbackTag:"nav",fallbackClasses:"craft-pagination",nativeProps:["total","page","pageSize"]},"code-editor":{nativeType:"craft-code-editor",fallbackTag:"textarea",fallbackClasses:"craft-code-editor",nativeProps:["value","language","theme","readonly","lineNumbers"]},"file-browser":{nativeType:"craft-file-browser",fallbackTag:"div",fallbackClasses:"craft-file-browser",nativeProps:["path","showHidden","selectable"]},"color-picker":{nativeType:"craft-color-picker",fallbackTag:"input",fallbackClasses:"craft-color-picker",nativeProps:["value","format"],render:(X,$)=>{return`<input type="color" class="craft-color-picker" value="${X.value||"#000000"}">`}},"date-picker":{nativeType:"craft-date-picker",fallbackTag:"input",fallbackClasses:"craft-date-picker",nativeProps:["value","min","max","format"],render:(X,$)=>{let Z=X.value||"",Y=X.min||"",J=X.max||"";return`<input type="date" class="craft-date-picker" value="${Z}" min="${Y}" max="${J}">`}},"time-picker":{nativeType:"craft-time-picker",fallbackTag:"input",fallbackClasses:"craft-time-picker",nativeProps:["value","min","max","step"],render:(X,$)=>{return`<input type="time" class="craft-time-picker" value="${X.value||""}">`}}},B2=`
16085
16080
  <style id="craft-component-styles">
16086
16081
  /* Craft Component Base Styles */
16087
16082
  .craft-button {
@@ -16499,7 +16494,7 @@ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function qW(X,$,
16499
16494
  }
16500
16495
  }
16501
16496
  </style>
16502
- `,$V=`
16497
+ `,zV=`
16503
16498
  <script id="craft-component-runtime">
16504
16499
  (function() {
16505
16500
  if (window.__stxCraftComponentRuntime) return;
@@ -16603,7 +16598,7 @@ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function qW(X,$,
16603
16598
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
16604
16599
  })();
16605
16600
  </script>
16606
- `;function q2(X,$={}){let{classPrefix:Z="craft"}=$;if(!X.includes("craft-component-styles"))if(X.includes("</head>"))X=X.replace("</head>",`${`
16601
+ `;function j2(X,$={}){let{classPrefix:Z="craft"}=$;if(!X.includes("craft-component-styles"))if(X.includes("</head>"))X=X.replace("</head>",`${`
16607
16602
  <style id="craft-component-styles">
16608
16603
  /* Craft Component Base Styles */
16609
16604
  .craft-button {
@@ -18068,35 +18063,35 @@ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function qW(X,$,
18068
18063
  document.addEventListener('craft:nativeui:ready', initializeCraftComponents);
18069
18064
  })();
18070
18065
  </script>
18071
- `;return X=X.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(Y,J,G)=>{return QX("sidebar",J,G.trim(),$,Z)}),X=X.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(Y,J)=>{return QX("sidebar",J,"",$,Z)}),X=X.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(Y,J,G)=>{return QX(J,G,"",$,Z)}),X=X.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(Y,J,G,Q)=>{return QX(J,G,Q.trim(),$,Z)}),X}function QX(X,$,Z,Y,J){let G=Y.components?.[X]||H$[X];if(!G)return console.warn(`[stx] Unknown Craft component: @craft-${X}`),`<div class="${J}-unknown" data-component="${X}">${Z}</div>`;let Q=wX($),w=[G.fallbackClasses||`${J}-${X}`];if(Q.class)w.push(Q.class),delete Q.class;if(G.render)return Q.__fallbackClasses=w.join(" "),G.render(Q,Z);let q=kW(Q,G,w);if(["input","hr","br","img"].includes(G.fallbackTag))return`<${G.fallbackTag} ${q}>`;return`<${G.fallbackTag} ${q}>${Z}</${G.fallbackTag}>`}function wX(X){let $={},Z=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,Y;while((Y=Z.exec(X))!==null){let[J,G,Q,w]=Y,q=Q??w;if(J.startsWith(":"))$[G]=q;else if(J.startsWith("@"))$[`on${G.charAt(0).toUpperCase()}${G.slice(1)}`]=q;else if(q===void 0)$[G]=!0;else $[G]=q}return $}function jW(X,$){let Z=V5(String(X.id||`craft-sidebar-${MW($||JSON.stringify(X))}`)),Y=AW(X.spaces)||VW($),J=Y.length?[]:TW(X.sections)||W2($),G=String(X.selectedSpace||Y[0]?.id||""),Q=Y.find((_)=>_.id===G)||Y[0],w=String(X.selectedItem||X.selected||(Y.length?Q?.sections[0]?.items[0]?.id:J[0]?.items[0]?.id)||""),q={id:Z,variant:String(X.variant||"desktop"),material:String(X.material||"sidebar"),backgroundEffect:String(X.backgroundEffect||"shimmer"),allowsVibrancy:X.allowsVibrancy!==!1&&X.allowsVibrancy!=="false",materialOpacity:Number(X.materialOpacity??0.68),materialDarkOpacity:X.materialDarkOpacity===void 0?void 0:Number(X.materialDarkOpacity),minWidth:X.minWidth===void 0?240:Number(X.minWidth),maxWidth:X.maxWidth===void 0?340:Number(X.maxWidth),canCollapse:X.canCollapse!==!1&&X.canCollapse!=="false",searchPlaceholder:X.searchPlaceholder?String(X.searchPlaceholder):void 0,selectedItem:w,sections:J,spaces:Y,selectedSpace:G||void 0},W=String(X.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),K=Number(X.width||X.sidebarWidth||286),U=X.native===!1||X.native==="false"?"false":"true",z=q.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${_1(q.searchPlaceholder)}"></div>`:"",B;if(Y.length)B=RW(Y,G,w);else if(J.length)B=J.map((_)=>K2(_,w)).join("");else B=$;return`<aside class="${g0(W)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${g0(Z)}" data-native="${U}" style="--craft-sidebar-width:${K}px">
18066
+ `;return X=X.replace(/<@craft-sidebar(?![-\w])\s*([^>]*)>([\s\S]*?)<\/@craft-sidebar>/g,(Y,J,G)=>{return wX("sidebar",J,G.trim(),$,Z)}),X=X.replace(/<@craft-sidebar(?![-\w])\s*([^>]*?)\/>/g,(Y,J)=>{return wX("sidebar",J,"",$,Z)}),X=X.replace(/<@craft-(\w+[-\w]*)\s*([^>]*?)\/>/g,(Y,J,G)=>{return wX(J,G,"",$,Z)}),X=X.replace(/<@craft-(\w+[-\w]*)\s*([^>]*)>([\s\S]*?)<\/@craft-\1>/g,(Y,J,G,Q)=>{return wX(J,G,Q.trim(),$,Z)}),X}function wX(X,$,Z,Y,J){let G=Y.components?.[X]||H$[X];if(!G)return console.warn(`[stx] Unknown Craft component: @craft-${X}`),`<div class="${J}-unknown" data-component="${X}">${Z}</div>`;let Q=qX($),w=[G.fallbackClasses||`${J}-${X}`];if(Q.class)w.push(Q.class),delete Q.class;if(G.render)return Q.__fallbackClasses=w.join(" "),G.render(Q,Z);let q=fW(Q,G,w);if(["input","hr","br","img"].includes(G.fallbackTag))return`<${G.fallbackTag} ${q}>`;return`<${G.fallbackTag} ${q}>${Z}</${G.fallbackTag}>`}function qX(X){let $={},Z=/(?::|@)?(\w+[-\w]*)(?:=(?:"([^"]*)"|'([^']*)'))?/g,Y;while((Y=Z.exec(X))!==null){let[J,G,Q,w]=Y,q=Q??w;if(J.startsWith(":"))$[G]=q;else if(J.startsWith("@"))$[`on${G.charAt(0).toUpperCase()}${G.slice(1)}`]=q;else if(q===void 0)$[G]=!0;else $[G]=q}return $}function kW(X,$){let Z=A5(String(X.id||`craft-sidebar-${vW($||JSON.stringify(X))}`)),Y=SW(X.spaces)||bW($),J=Y.length?[]:PW(X.sections)||H2($),G=String(X.selectedSpace||Y[0]?.id||""),Q=Y.find((_)=>_.id===G)||Y[0],w=String(X.selectedItem||X.selected||(Y.length?Q?.sections[0]?.items[0]?.id:J[0]?.items[0]?.id)||""),q={id:Z,variant:String(X.variant||"desktop"),material:String(X.material||"sidebar"),backgroundEffect:String(X.backgroundEffect||"shimmer"),allowsVibrancy:X.allowsVibrancy!==!1&&X.allowsVibrancy!=="false",materialOpacity:Number(X.materialOpacity??0.68),materialDarkOpacity:X.materialDarkOpacity===void 0?void 0:Number(X.materialDarkOpacity),minWidth:X.minWidth===void 0?240:Number(X.minWidth),maxWidth:X.maxWidth===void 0?340:Number(X.maxWidth),canCollapse:X.canCollapse!==!1&&X.canCollapse!=="false",searchPlaceholder:X.searchPlaceholder?String(X.searchPlaceholder):void 0,selectedItem:w,sections:J,spaces:Y,selectedSpace:G||void 0},W=String(X.__fallbackClasses||"craft-sidebar craft-sidebar-tahoe"),U=Number(X.width||X.sidebarWidth||286),K=X.native===!1||X.native==="false"?"false":"true",z=q.searchPlaceholder?`<div class="craft-sidebar-search"><input type="search" placeholder="${z1(q.searchPlaceholder)}"></div>`:"",B;if(Y.length)B=CW(Y,G,w);else if(J.length)B=J.map((_)=>L2(_,w)).join("");else B=$;return`<aside class="${g0(W)}" data-craft="craft-sidebar" data-craft-native-sidebar data-craft-sidebar-id="${g0(Z)}" data-native="${K}" style="--craft-sidebar-width:${U}px">
18072
18067
  ${z}
18073
18068
  ${B}
18074
18069
  </aside>
18075
- <script type="application/json" data-craft-sidebar-config="${g0(Z)}">${NW(q)}</script>`}function HW(X,$){let Z=V5(String(X.id||X.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${g0(Z)}">
18076
- ${X.label?`<div class="craft-sidebar-space-title">${_1(String(X.label))}</div>`:""}
18070
+ <script type="application/json" data-craft-sidebar-config="${g0(Z)}">${xW(q)}</script>`}function IW(X,$){let Z=A5(String(X.id||X.label||"space"));return`<section class="craft-sidebar-space" data-craft="craft-sidebar-space" data-space-id="${g0(Z)}">
18071
+ ${X.label?`<div class="craft-sidebar-space-title">${z1(String(X.label))}</div>`:""}
18077
18072
  ${$}
18078
- </section>`}function LW(X,$){let Z=String(X.header||X.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${g0(String(X.id||"section"))}">
18079
- ${Z?`<div class="craft-sidebar-section-title">${_1(Z)}</div>`:""}
18073
+ </section>`}function EW(X,$){let Z=String(X.header||X.title||"");return`<section class="craft-sidebar-section" data-craft="craft-sidebar-section" data-section-id="${g0(String(X.id||"section"))}">
18074
+ ${Z?`<div class="craft-sidebar-section-title">${z1(Z)}</div>`:""}
18080
18075
  ${$}
18081
- </section>`}function OW(X,$){let Z={id:String(X.id||V5(String(X.label||$||"item"))),label:String(X.label||$||""),icon:X.icon?String(X.icon):void 0,badge:X.badge?String(X.badge):void 0,tintColor:X.tintColor?String(X.tintColor):void 0};return U2(Z,String(X.selected||"")==="true")}function W2(X){let $=[],Z=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,Y;while((Y=Z.exec(X))!==null){let J=wX(Y[1]||""),G=Y[2]||"",Q=String(J.id||V5(String(J.header||J.title||`section-${$.length+1}`))),w=String(J.header||J.title||Q),q=FW(G);$.push({id:Q,header:w,title:w,items:q})}return $}function FW(X){let $=[],Z=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,Y;while((Y=Z.exec(X))!==null){let J=wX(Y[1]||""),G=String(J.label||(Y[2]||"").replace(/<[^>]*>/g,"").trim()),Q=String(J.id||V5(G||`item-${$.length+1}`));$.push({id:Q,label:G,icon:J.icon?String(J.icon):void 0,badge:J.badge?String(J.badge):void 0,tintColor:J.tintColor?String(J.tintColor):void 0})}return $}function VW(X){let $=[],Z=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,Y;while((Y=Z.exec(X))!==null){let J=wX(Y[1]||""),G=Y[2]||"",Q=String(J.label||J.title||`Space ${$.length+1}`);$.push({id:String(J.id||V5(Q)),label:Q,icon:J.icon?String(J.icon):void 0,tint:J.tint?String(J.tint):void 0,sections:W2(G)})}return $}function AW(X){if(!X)return;if(Array.isArray(X))return X;if(typeof X!=="string")return;try{let $=JSON.parse(X);return Array.isArray($)?$:void 0}catch{return}}function RW(X,$,Z){let Y=X.map((G)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${g0(G.id)}" data-selected="${G.id===$?"true":"false"}" title="${g0(G.label||G.id)}">${G.icon?`<span class="craft-sidebar-item-icon" data-icon="${g0(G.icon)}"></span>`:_1((G.label||G.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${X.map((G)=>`<section class="craft-sidebar-space" data-space-id="${g0(G.id)}" data-selected="${G.id===$?"true":"false"}">
18082
- ${G.label?`<div class="craft-sidebar-space-title">${_1(G.label)}</div>`:""}
18083
- ${G.sections.map((Q)=>K2(Q,Z)).join("")}
18076
+ </section>`}function DW(X,$){let Z={id:String(X.id||A5(String(X.label||$||"item"))),label:String(X.label||$||""),icon:X.icon?String(X.icon):void 0,badge:X.badge?String(X.badge):void 0,tintColor:X.tintColor?String(X.tintColor):void 0};return O2(Z,String(X.selected||"")==="true")}function H2(X){let $=[],Z=/<@craft-sidebar-section\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-section>)/g,Y;while((Y=Z.exec(X))!==null){let J=qX(Y[1]||""),G=Y[2]||"",Q=String(J.id||A5(String(J.header||J.title||`section-${$.length+1}`))),w=String(J.header||J.title||Q),q=yW(G);$.push({id:Q,header:w,title:w,items:q})}return $}function yW(X){let $=[],Z=/<@craft-sidebar-item\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-item>)/g,Y;while((Y=Z.exec(X))!==null){let J=qX(Y[1]||""),G=String(J.label||(Y[2]||"").replace(/<[^>]*>/g,"").trim()),Q=String(J.id||A5(G||`item-${$.length+1}`));$.push({id:Q,label:G,icon:J.icon?String(J.icon):void 0,badge:J.badge?String(J.badge):void 0,tintColor:J.tintColor?String(J.tintColor):void 0})}return $}function bW(X){let $=[],Z=/<@craft-sidebar-space\s*([^>]*?)(?:\/>|>([\s\S]*?)<\/@craft-sidebar-space>)/g,Y;while((Y=Z.exec(X))!==null){let J=qX(Y[1]||""),G=Y[2]||"",Q=String(J.label||J.title||`Space ${$.length+1}`);$.push({id:String(J.id||A5(Q)),label:Q,icon:J.icon?String(J.icon):void 0,tint:J.tint?String(J.tint):void 0,sections:H2(G)})}return $}function SW(X){if(!X)return;if(Array.isArray(X))return X;if(typeof X!=="string")return;try{let $=JSON.parse(X);return Array.isArray($)?$:void 0}catch{return}}function CW(X,$,Z){let Y=X.map((G)=>`<button class="craft-sidebar-space-tab" type="button" data-space-target="${g0(G.id)}" data-selected="${G.id===$?"true":"false"}" title="${g0(G.label||G.id)}">${G.icon?`<span class="craft-sidebar-item-icon" data-icon="${g0(G.icon)}"></span>`:z1((G.label||G.id).charAt(0))}</button>`).join("");return`<div class="craft-sidebar-spaces">${X.map((G)=>`<section class="craft-sidebar-space" data-space-id="${g0(G.id)}" data-selected="${G.id===$?"true":"false"}">
18077
+ ${G.label?`<div class="craft-sidebar-space-title">${z1(G.label)}</div>`:""}
18078
+ ${G.sections.map((Q)=>L2(Q,Z)).join("")}
18084
18079
  </section>`).join("")}</div>
18085
- <div class="craft-sidebar-space-switcher">${Y}</div>`}function TW(X){if(!X)return;if(Array.isArray(X))return X;if(typeof X!=="string")return;try{let $=JSON.parse(X);return Array.isArray($)?$:void 0}catch{return}}function K2(X,$){let Z=X.header||X.title||X.id;return`<section class="craft-sidebar-section" data-section-id="${g0(X.id)}">
18086
- <div class="craft-sidebar-section-title">${_1(Z)}</div>
18087
- ${X.items.map((Y)=>U2(Y,Y.id===$)).join("")}
18088
- </section>`}function U2(X,$){let Z=X.tintColor?` style="--craft-sidebar-icon-color:${g0(X.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${g0(X.id)}" data-selected="${$?"true":"false"}">
18080
+ <div class="craft-sidebar-space-switcher">${Y}</div>`}function PW(X){if(!X)return;if(Array.isArray(X))return X;if(typeof X!=="string")return;try{let $=JSON.parse(X);return Array.isArray($)?$:void 0}catch{return}}function L2(X,$){let Z=X.header||X.title||X.id;return`<section class="craft-sidebar-section" data-section-id="${g0(X.id)}">
18081
+ <div class="craft-sidebar-section-title">${z1(Z)}</div>
18082
+ ${X.items.map((Y)=>O2(Y,Y.id===$)).join("")}
18083
+ </section>`}function O2(X,$){let Z=X.tintColor?` style="--craft-sidebar-icon-color:${g0(X.tintColor)}"`:"";return`<button class="craft-sidebar-item" type="button" data-item-id="${g0(X.id)}" data-selected="${$?"true":"false"}">
18089
18084
  ${X.icon?`<span class="craft-sidebar-item-icon" data-icon="${g0(X.icon)}"${Z}></span>`:""}
18090
- <span class="craft-sidebar-item-label">${_1(X.label)}</span>
18091
- ${X.badge?`<span class="craft-sidebar-item-badge">${_1(X.badge)}</span>`:""}
18092
- </button>`}function V5(X){return X.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function MW(X){let $=5381;for(let Z=0;Z<X.length;Z++)$=$*33^X.charCodeAt(Z);return($>>>0).toString(36)}function _1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function g0(X){return _1(X).replace(/`/g,"&#96;")}function NW(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function kW(X,$,Z){let Y=[];Y.push(`class="${Z.join(" ")}"`),Y.push(`data-craft="${$.nativeType}"`);for(let[J,G]of Object.entries(X))if(G===!0)Y.push(J);else if(G!==!1&&G!==void 0&&G!==null){let Q=String(G).replace(/"/g,"&quot;");Y.push(`${J}="${Q}"`)}return Y.join(" ")}function ZV(X,$){H$[X]=$}function YV(){return{...H$}}var G7=new Map,Q7=new Map;function IW(X,$){let Z=$?.id||hW(X),Y=uW(X),J=G7.get(Z);if(J&&J.hash===Y)return J;let G=EW(X),Q=vW(X),w=xW(X),q=CW(G),{staticParts:W,dynamicParts:K}=PW(G),U=fW(X),z={id:Z,hash:Y,tree:G,scripts:Q,styles:w,staticParts:W,dynamicParts:K,dependencies:U,metadata:q};return G7.set(Z,z),z}async function GV(X,$={},Z={}){let Y=performance.now();if(Z.cache){let w=`${X.id}:${JSON.stringify($)}`,q=Q7.get(w);if(q&&Date.now()-q.timestamp<(Z.cacheTTL||60000))return{html:q.html,styles:X.styles.join(`
18085
+ <span class="craft-sidebar-item-label">${z1(X.label)}</span>
18086
+ ${X.badge?`<span class="craft-sidebar-item-badge">${z1(X.badge)}</span>`:""}
18087
+ </button>`}function A5(X){return X.trim().toLowerCase().replace(/[^a-z0-9_-]+/g,"-").replace(/^-|-$/g,"")||"craft-sidebar"}function vW(X){let $=5381;for(let Z=0;Z<X.length;Z++)$=$*33^X.charCodeAt(Z);return($>>>0).toString(36)}function z1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function g0(X){return z1(X).replace(/`/g,"&#96;")}function xW(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026")}function fW(X,$,Z){let Y=[];Y.push(`class="${Z.join(" ")}"`),Y.push(`data-craft="${$.nativeType}"`);for(let[J,G]of Object.entries(X))if(G===!0)Y.push(J);else if(G!==!1&&G!==void 0&&G!==null){let Q=String(G).replace(/"/g,"&quot;");Y.push(`${J}="${Q}"`)}return Y.join(" ")}function _V(X,$){H$[X]=$}function BV(){return{...H$}}var Q7=new Map,w7=new Map;function gW(X,$){let Z=$?.id||oW(X),Y=aW(X),J=Q7.get(Z);if(J&&J.hash===Y)return J;let G=hW(X),Q=iW(X),w=nW(X),q=cW(G),{staticParts:W,dynamicParts:U}=pW(G),K=rW(X),z={id:Z,hash:Y,tree:G,scripts:Q,styles:w,staticParts:W,dynamicParts:U,dependencies:K,metadata:q};return Q7.set(Z,z),z}async function HV(X,$={},Z={}){let Y=performance.now();if(Z.cache){let w=`${X.id}:${JSON.stringify($)}`,q=w7.get(w);if(q&&Date.now()-q.timestamp<(Z.cacheTTL||60000))return{html:q.html,styles:X.styles.join(`
18093
18088
  `),scripts:X.scripts.join(`
18094
- `),metadata:{renderTime:0,cacheHit:!0,totalSize:q.html.length,componentCount:X.metadata.componentCount}}}let J;if(Z.streaming)J=await yW(X.tree,$);else J=w7(X.tree,$);let G;if(Z.hydrate){let w=SW(J,X,$);J=w.html,G=w.data}if(Z.minify)J=gW(J);if(Z.cache){let w=`${X.id}:${JSON.stringify($)}`;Q7.set(w,{html:J,timestamp:Date.now()})}let Q=performance.now()-Y;return{html:J,styles:X.styles.join(`
18089
+ `),metadata:{renderTime:0,cacheHit:!0,totalSize:q.html.length,componentCount:X.metadata.componentCount}}}let J;if(Z.streaming)J=await dW(X.tree,$);else J=q7(X.tree,$);let G;if(Z.hydrate){let w=lW(J,X,$);J=w.html,G=w.data}if(Z.minify)J=sW(J);if(Z.cache){let w=`${X.id}:${JSON.stringify($)}`;w7.set(w,{html:J,timestamp:Date.now()})}let Q=performance.now()-Y;return{html:J,styles:X.styles.join(`
18095
18090
  `),scripts:X.scripts.join(`
18096
- `),hydrationData:G,metadata:{renderTime:Q,cacheHit:!1,totalSize:J.length,componentCount:X.metadata.componentCount}}}function QV(X,$){let Z=[],Y=[],J=[],G=new Map,Q=[];return q7(X.tree,(w,q)=>{if(w.type==="component"&&w.componentName){if(O2(w.componentName))Z.push(w.componentName)}if(w.type==="element"&&w.tag){let W=lW(w);if(W)Q.push(W);if(w.props){for(let[K,U]of Object.entries(w.props))if(K.startsWith("on")&&typeof U==="string"){let z=`handler_${G.size}`;G.set(z,U)}}}if(w.isStatic&&w.type==="element")Y.push(B2(w));else if(!w.isStatic&&w.type!=="text")J.push(w.tag||w.componentName||"unknown")}),{nativeComponents:Z,staticHTML:Y,dynamicParts:J,eventHandlers:G,nativeWidgets:Q}}function wV(X,$={}){let Z=IW(X),Y=bW(Z,$),J=new Map,G=[];return q7(Z.tree,(Q)=>{if(Q.type==="component"&&Q.componentName){if(O2(Q.componentName)){G.push(Q.componentName);let w=`<!--craft:${Q.componentName}:${Q.hydrationKey||"default"}-->`;J.set(Q.hydrationKey||Q.componentName,w)}}}),{staticHTML:Y,dynamicPlaceholders:J,craftComponents:G}}function EW(X){let $={type:"fragment",children:[]},Z=$,Y=[$],J=X,G=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(J.length>0){let Q=J.match(/^<(@?[\w-]+)([^>]*)>/);if(Q){let[W,K,U]=Q,z=DW(U),B=K.startsWith("@craft-"),_=B?K:K.toLowerCase(),j={type:B?"component":"element",tag:_,props:z,children:[],componentName:B?_.slice(1):void 0,isStatic:!z2(U),hydrationKey:mW()};if(Z.children=Z.children||[],Z.children.push(j),!G.has(_)&&!U.endsWith("/"))Y.push(j),Z=j;J=J.slice(W.length);continue}let w=J.match(/^<\/(@?[\w-]+)>/);if(w){let[W,K]=w,z=K.startsWith("@craft-")?K:K.toLowerCase();while(Y.length>1){let B=Y.pop();if(Z=Y[Y.length-1],B.tag===z)break}J=J.slice(W.length);continue}let q=J.match(/^[^<]+/);if(q){let W=q[0];if(W.trim()){let K={type:"text",text:W,isStatic:!z2(W)};Z.children=Z.children||[],Z.children.push(K)}J=J.slice(W.length);continue}J=J.slice(1)}return $}function DW(X){let $={},Z=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,Y;while((Y=Z.exec(X))!==null){let[,J,G,Q,w]=Y,q=G??Q??w??!0;$[J]=q}return $}function q7(X,$,Z=[]){if($(X,Z),X.children)X.children.forEach((Y,J)=>{q7(Y,$,[...Z,`${J}`])})}function w7(X,$){switch(X.type){case"text":return H2(X.text||"",$);case"element":case"component":{let Z=X.tag||"div",Y=j2(X.props||{},$),J=(X.children||[]).map((G)=>w7(G,$)).join("");if(!X.children||X.children.length===0){if(["input","br","hr","img","meta","link"].includes(Z))return`<${Z}${Y} />`}return`<${Z}${Y}>${J}</${Z}>`}case"fragment":return(X.children||[]).map((Z)=>w7(Z,$)).join("");case"slot":return`<!--slot:${X.slotName||"default"}-->`;default:return""}}function B2(X){if(X.type==="text")return X.text||"";let $=X.tag||"div",Z=j2(X.props||{},{});return`<${$}${Z}></${$}>`}function j2(X,$){let Z=[];for(let[Y,J]of Object.entries(X))if(J===!0)Z.push(` ${Y}`);else if(J!==!1&&J!==null&&J!==void 0){let G=H2(String(J),$);Z.push(` ${Y}="${L2(G)}"`)}return Z.join("")}async function yW(X,$){return w7(X,$)}function bW(X,$){let Z=[];return q7(X.tree,(Y)=>{if(Y.isStatic)Z.push(w7(Y,$))}),Z.join("")}function SW(X,$,Z){let Y={templateId:$.id,context:Z,dynamicParts:Array.from($.dynamicParts.entries())},J=`
18091
+ `),hydrationData:G,metadata:{renderTime:Q,cacheHit:!1,totalSize:J.length,componentCount:X.metadata.componentCount}}}function LV(X,$){let Z=[],Y=[],J=[],G=new Map,Q=[];return W7(X.tree,(w,q)=>{if(w.type==="component"&&w.componentName){if(N2(w.componentName))Z.push(w.componentName)}if(w.type==="element"&&w.tag){let W=XU(w);if(W)Q.push(W);if(w.props){for(let[U,K]of Object.entries(w.props))if(U.startsWith("on")&&typeof K==="string"){let z=`handler_${G.size}`;G.set(z,K)}}}if(w.isStatic&&w.type==="element")Y.push(A2(w));else if(!w.isStatic&&w.type!=="text")J.push(w.tag||w.componentName||"unknown")}),{nativeComponents:Z,staticHTML:Y,dynamicParts:J,eventHandlers:G,nativeWidgets:Q}}function OV(X,$={}){let Z=gW(X),Y=mW(Z,$),J=new Map,G=[];return W7(Z.tree,(Q)=>{if(Q.type==="component"&&Q.componentName){if(N2(Q.componentName)){G.push(Q.componentName);let w=`<!--craft:${Q.componentName}:${Q.hydrationKey||"default"}-->`;J.set(Q.hydrationKey||Q.componentName,w)}}}),{staticHTML:Y,dynamicPlaceholders:J,craftComponents:G}}function hW(X){let $={type:"fragment",children:[]},Z=$,Y=[$],J=X,G=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);while(J.length>0){let Q=J.match(/^<(@?[\w-]+)([^>]*)>/);if(Q){let[W,U,K]=Q,z=uW(K),B=U.startsWith("@craft-"),_=B?U:U.toLowerCase(),j={type:B?"component":"element",tag:_,props:z,children:[],componentName:B?_.slice(1):void 0,isStatic:!F2(K),hydrationKey:eW()};if(Z.children=Z.children||[],Z.children.push(j),!G.has(_)&&!K.endsWith("/"))Y.push(j),Z=j;J=J.slice(W.length);continue}let w=J.match(/^<\/(@?[\w-]+)>/);if(w){let[W,U]=w,z=U.startsWith("@craft-")?U:U.toLowerCase();while(Y.length>1){let B=Y.pop();if(Z=Y[Y.length-1],B.tag===z)break}J=J.slice(W.length);continue}let q=J.match(/^[^<]+/);if(q){let W=q[0];if(W.trim()){let U={type:"text",text:W,isStatic:!F2(W)};Z.children=Z.children||[],Z.children.push(U)}J=J.slice(W.length);continue}J=J.slice(1)}return $}function uW(X){let $={},Z=/([\w-:@]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S+)))?/g,Y;while((Y=Z.exec(X))!==null){let[,J,G,Q,w]=Y,q=G??Q??w??!0;$[J]=q}return $}function W7(X,$,Z=[]){if($(X,Z),X.children)X.children.forEach((Y,J)=>{W7(Y,$,[...Z,`${J}`])})}function q7(X,$){switch(X.type){case"text":return T2(X.text||"",$);case"element":case"component":{let Z=X.tag||"div",Y=R2(X.props||{},$),J=(X.children||[]).map((G)=>q7(G,$)).join("");if(!X.children||X.children.length===0){if(["input","br","hr","img","meta","link"].includes(Z))return`<${Z}${Y} />`}return`<${Z}${Y}>${J}</${Z}>`}case"fragment":return(X.children||[]).map((Z)=>q7(Z,$)).join("");case"slot":return`<!--slot:${X.slotName||"default"}-->`;default:return""}}function A2(X){if(X.type==="text")return X.text||"";let $=X.tag||"div",Z=R2(X.props||{},{});return`<${$}${Z}></${$}>`}function R2(X,$){let Z=[];for(let[Y,J]of Object.entries(X))if(J===!0)Z.push(` ${Y}`);else if(J!==!1&&J!==null&&J!==void 0){let G=T2(String(J),$);Z.push(` ${Y}="${M2(G)}"`)}return Z.join("")}async function dW(X,$){return q7(X,$)}function mW(X,$){let Z=[];return W7(X.tree,(Y)=>{if(Y.isStatic)Z.push(q7(Y,$))}),Z.join("")}function lW(X,$,Z){let Y={templateId:$.id,context:Z,dynamicParts:Array.from($.dynamicParts.entries())},J=`
18097
18092
  <script data-craft-hydration>
18098
18093
  window.__CRAFT_HYDRATION__ = ${JSON.stringify(Y)};
18099
- </script>`;return{html:X+J,data:Y}}function CW(X){let $=!1,Z=!1,Y=!1,J=!1,G=0,Q=0;function w(q,W){if(Q=Math.max(Q,W),q.type==="slot")$=!0;if(q.type==="component")G++;if(!q.isStatic)Z=!0;if(q.props)for(let K of Object.keys(q.props)){if(K.startsWith("on"))Y=!0;if(K==="@async"||K==="data-async")J=!0}if(q.children)q.children.forEach((K)=>w(K,W+1))}return w(X,0),{hasSlots:$,hasDynamicContent:Z,hasEventHandlers:Y,hasAsyncContent:J,componentCount:G,maxDepth:Q,estimatedSize:JSON.stringify(X).length}}function PW(X){let $=new Map,Z=new Map;return q7(X,(Y,J)=>{let G=J.join(".");if(Y.isStatic)$.set(G,B2(Y));else Z.set(G,Y.tag||Y.componentName||"dynamic")}),{staticParts:$,dynamicParts:Z}}function vW(X){let $=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function xW(X){let $=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function fW(X){let $=[],Z=/@include\s*\(\s*['"]([^'"]+)['"]/g,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);let J=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((Y=J.exec(X))!==null)$.push(Y[1]);let G=/<@craft-[\w-]+/g;while((Y=G.exec(X))!==null)$.push(Y[0].slice(2));return[...new Set($)]}function z2(X){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(X)}function H2(X,$){let Z=X.replace(/\{\{\s*(.+?)\s*\}\}/g,(Y,J)=>{try{let G=_2(J.trim(),$);return L2(String(G??""))}catch{return""}});return Z=Z.replace(/\{!!\s*(.+?)\s*!!\}/g,(Y,J)=>{try{let G=_2(J.trim(),$);return String(G??"")}catch{return""}}),Z}function _2(X,$){if(/^[\w.]+$/.test(X)){let Z=X.split("."),Y=$;for(let J of Z)if(Y&&typeof Y==="object"&&J in Y)Y=Y[J];else return;return Y}try{return Function(...Object.keys($),`return ${X}`)(...Object.values($))}catch{return}}function L2(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function gW(X){return X.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function hW(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return`tpl_${Math.abs($).toString(36)}`}function uW(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(36)}var dW=0;function mW(){return`h_${++dW}`}function O2(X){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(X)}function lW(X){let $=X.tag?.toLowerCase(),Z=X.props?.type,Y={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},J=Z?`${$}:${Z}`:$,G=Y[J||""]||Y[$||""];if(G)return{htmlSelector:J||$||"",nativeComponent:G.component,confidence:G.confidence,reason:G.reason};return null}function cW(){G7.clear()}function pW(){Q7.clear()}function qV(){cW(),pW()}function WV(){return{templateCacheSize:G7.size,renderCacheSize:Q7.size,totalEntries:G7.size+Q7.size}}import{existsSync as dq,mkdirSync as r0,copyFileSync as c1,chmodSync as p1}from"fs";import{join as h,basename as bF}from"path";import{spawn as U$,execSync as SF}from"child_process";import{tmpdir as mq,homedir as s4,platform as CF}from"os";H1();p5();sX();D5();nX();import{dirname as EF,resolve as gq}from"path";function xq(X){return X.endsWith(".md")||X.endsWith(".markdown")}function IF(X){let $=[];Y(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let Z=[...$];Y(/<code\b[^>]*>[\s\S]*?<\/code>/gi,Z);function Y(Q,w){let q;while((q=Q.exec(X))!==null){let W=q.index,K=W+q[0].length;if(w?.some((U)=>W>=U.start&&K<=U.end))continue;$.push({start:W,end:K})}}if($.length===0)return X;$.sort((Q,w)=>Q.start-w.start);let J="",G=0;for(let Q of $){if(Q.start<G)continue;J+=X.slice(G,Q.start),J+=`@raw${X.slice(Q.start,Q.end)}@endraw`,G=Q.end}return J+=X.slice(G),J}async function fq(X,$={}){let{data:Z,content:Y}=HX(X),G=await($.renderer??((Q)=>r1(Q)))(Y);return{html:IF(G),frontmatter:Z??{}}}function DF(X){let $=X,Z=g5(X);if(Z)$=Z.content.trim();let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J=[],G=[],Q=[],w=(K)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(K),q;while((q=Y.exec(X))!==null){let K=q[1],U=q[2],z=q[0],B=K.includes("server");if(w(U))Q.push(z);else if(B)G.push(U);else J.push(z)}let W=$;{let K=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,U,z=[];while((U=K.exec(W))!==null){let B=U.index+U[0].length,_=1,j=B;while(j<W.length&&_>0){let H=W.indexOf("<script",j),O=W.indexOf("</script>",j);if(O===-1)break;if(H!==-1&&H<O)_++,j=H+7;else{if(_--,_===0){z.push({start:U.index,end:O+9});break}j=O+9}}}for(let B=z.length-1;B>=0;B--)W=W.substring(0,z[B].start)+W.substring(z[B].end)}for(let K of J)W=W.replace(K,"");return{templateContent:W,serverScripts:G,clientScripts:J,signalsScripts:Q}}function yF(X,$){return`<!DOCTYPE html>
18094
+ </script>`;return{html:X+J,data:Y}}function cW(X){let $=!1,Z=!1,Y=!1,J=!1,G=0,Q=0;function w(q,W){if(Q=Math.max(Q,W),q.type==="slot")$=!0;if(q.type==="component")G++;if(!q.isStatic)Z=!0;if(q.props)for(let U of Object.keys(q.props)){if(U.startsWith("on"))Y=!0;if(U==="@async"||U==="data-async")J=!0}if(q.children)q.children.forEach((U)=>w(U,W+1))}return w(X,0),{hasSlots:$,hasDynamicContent:Z,hasEventHandlers:Y,hasAsyncContent:J,componentCount:G,maxDepth:Q,estimatedSize:JSON.stringify(X).length}}function pW(X){let $=new Map,Z=new Map;return W7(X,(Y,J)=>{let G=J.join(".");if(Y.isStatic)$.set(G,A2(Y));else Z.set(G,Y.tag||Y.componentName||"dynamic")}),{staticParts:$,dynamicParts:Z}}function iW(X){let $=[],Z=/<script[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function nW(X){let $=[],Z=/<style[^>]*>([\s\S]*?)<\/style>/gi,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);return $}function rW(X){let $=[],Z=/@include\s*\(\s*['"]([^'"]+)['"]/g,Y;while((Y=Z.exec(X))!==null)$.push(Y[1]);let J=/@component\s*\(\s*['"]([^'"]+)['"]/g;while((Y=J.exec(X))!==null)$.push(Y[1]);let G=/<@craft-[\w-]+/g;while((Y=G.exec(X))!==null)$.push(Y[0].slice(2));return[...new Set($)]}function F2(X){return/\{\{.*?\}\}|\{\!\!.*?\!\!\}/.test(X)}function T2(X,$){let Z=X.replace(/\{\{\s*(.+?)\s*\}\}/g,(Y,J)=>{try{let G=V2(J.trim(),$);return M2(String(G??""))}catch{return""}});return Z=Z.replace(/\{!!\s*(.+?)\s*!!\}/g,(Y,J)=>{try{let G=V2(J.trim(),$);return String(G??"")}catch{return""}}),Z}function V2(X,$){if(/^[\w.]+$/.test(X)){let Z=X.split("."),Y=$;for(let J of Z)if(Y&&typeof Y==="object"&&J in Y)Y=Y[J];else return;return Y}try{return Function(...Object.keys($),`return ${X}`)(...Object.values($))}catch{return}}function M2(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function sW(X){return X.replace(/\s+/g," ").replace(/>\s+</g,"><").replace(/\s+>/g,">").replace(/<\s+/g,"<").trim()}function oW(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return`tpl_${Math.abs($).toString(36)}`}function aW(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X.charCodeAt(Z);$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(36)}var tW=0;function eW(){return`h_${++tW}`}function N2(X){return["craft-button","craft-text-input","craft-textarea","craft-checkbox","craft-radio","craft-select","craft-slider","craft-toggle","craft-date-picker","craft-time-picker","craft-color-picker","craft-file-input","craft-modal","craft-alert","craft-toast","craft-progress","craft-spinner","craft-avatar","craft-badge","craft-card","craft-accordion","craft-tabs","craft-tooltip","craft-popover","craft-dropdown","craft-context-menu","craft-data-table","craft-virtual-list","craft-tree-view","craft-map","craft-chart","craft-video","craft-audio","craft-webview","craft-canvas","craft-image-viewer","craft-pdf-viewer","craft-code-editor","craft-rich-editor"].includes(X)}function XU(X){let $=X.tag?.toLowerCase(),Z=X.props?.type,Y={button:{component:"craft-button",confidence:0.95,reason:"Native button provides better touch feedback"},"input:text":{component:"craft-text-input",confidence:0.9,reason:"Native text input has better keyboard handling"},"input:checkbox":{component:"craft-checkbox",confidence:0.95,reason:"Native checkbox follows platform conventions"},"input:range":{component:"craft-slider",confidence:0.9,reason:"Native slider provides smooth interaction"},"input:date":{component:"craft-date-picker",confidence:0.95,reason:"Native date picker provides platform-specific UI"},"input:time":{component:"craft-time-picker",confidence:0.95,reason:"Native time picker provides platform-specific UI"},"input:color":{component:"craft-color-picker",confidence:0.9,reason:"Native color picker provides platform-specific UI"},textarea:{component:"craft-textarea",confidence:0.85,reason:"Native textarea handles multiline input better"},select:{component:"craft-select",confidence:0.9,reason:"Native select provides platform dropdown UI"},progress:{component:"craft-progress",confidence:0.95,reason:"Native progress bar matches platform style"},video:{component:"craft-video",confidence:0.95,reason:"Native video provides hardware acceleration"},audio:{component:"craft-audio",confidence:0.95,reason:"Native audio provides system integration"},dialog:{component:"craft-modal",confidence:0.9,reason:"Native modal provides proper layering and focus"}},J=Z?`${$}:${Z}`:$,G=Y[J||""]||Y[$||""];if(G)return{htmlSelector:J||$||"",nativeComponent:G.component,confidence:G.confidence,reason:G.reason};return null}function $U(){Q7.clear()}function ZU(){w7.clear()}function FV(){$U(),ZU()}function VV(){return{templateCacheSize:Q7.size,renderCacheSize:w7.size,totalEntries:Q7.size+w7.size}}import{existsSync as tq,mkdirSync as n0,copyFileSync as c1,chmodSync as p1}from"fs";import{join as h,basename as mF}from"path";import{spawn as K$,execSync as lF}from"child_process";import{tmpdir as eq,homedir as Z2,platform as cF}from"os";j1();i5();oX();y5();rX();import{dirname as hF,resolve as sq}from"path";function nq(X){return X.endsWith(".md")||X.endsWith(".markdown")}function gF(X){let $=[];Y(/<pre\b[^>]*>[\s\S]*?<\/pre>/gi);let Z=[...$];Y(/<code\b[^>]*>[\s\S]*?<\/code>/gi,Z);function Y(Q,w){let q;while((q=Q.exec(X))!==null){let W=q.index,U=W+q[0].length;if(w?.some((K)=>W>=K.start&&U<=K.end))continue;$.push({start:W,end:U})}}if($.length===0)return X;$.sort((Q,w)=>Q.start-w.start);let J="",G=0;for(let Q of $){if(Q.start<G)continue;J+=X.slice(G,Q.start),J+=`@raw${X.slice(Q.start,Q.end)}@endraw`,G=Q.end}return J+=X.slice(G),J}async function rq(X,$={}){let{data:Z,content:Y}=LX(X),G=await($.renderer??((Q)=>r1(Q)))(Y);return{html:gF(G),frontmatter:Z??{}}}function uF(X){let $=X,Z=h5(X);if(Z)$=Z.content.trim();let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J=[],G=[],Q=[],w=(U)=>/\b(?:state|derived|effect|batch)\s*(?:<[^<>()]*>)?\s*\(/.test(U),q;while((q=Y.exec(X))!==null){let U=q[1],K=q[2],z=q[0],B=U.includes("server");if(w(K))Q.push(z);else if(B)G.push(K);else J.push(z)}let W=$;{let U=/<script\b(?![^>]*\b(?:client|type\s*=\s*["']module["']|src\s*=))[^>]*>/gi,K,z=[];while((K=U.exec(W))!==null){let B=K.index+K[0].length,_=1,j=B;while(j<W.length&&_>0){let H=W.indexOf("<script",j),O=W.indexOf("</script>",j);if(O===-1)break;if(H!==-1&&H<O)_++,j=H+7;else{if(_--,_===0){z.push({start:K.index,end:O+9});break}j=O+9}}}for(let B=z.length-1;B>=0;B--)W=W.substring(0,z[B].start)+W.substring(z[B].end)}for(let U of J)W=W.replace(U,"");return{templateContent:W,serverScripts:G,clientScripts:J,signalsScripts:Q}}function dF(X,$){return`<!DOCTYPE html>
18100
18095
  <html lang="en">
18101
18096
  <head>
18102
18097
  <meta charset="UTF-8">
@@ -18106,30 +18101,30 @@ ${Z} `)}]`:"";return`Craft.create("${X.zigType}", ${J}${Q})`}function qW(X,$,
18106
18101
  <body>
18107
18102
  ${X}
18108
18103
  </body>
18109
- </html>`}function n4(X,$,Z){if(X&&typeof X==="object")X[$]=Z}async function hq(X,$={}){let Z=gq(X),Y=Bun.file(Z);if(!await Y.exists())throw Error(`Template file not found: ${Z}`);let J=await Y.text(),G=null;if(xq(Z)){let Q=await fq(J,{renderer:$.markdownRenderer});J=Q.html,G=Q.frontmatter}if(G)$={...$,context:{...G,...$.context||{}}};if($.layout){let Q=gq($.layout),w=Bun.file(Q);if(!await w.exists())throw Error(`Layout template not found: ${Q}`);let{layout:q,injectCSS:W,...K}=$,U=await r4(J,Z,{...K,injectCSS:!1}),z=await w.text(),B={...$.context||{},content:U},_={...K,context:B,injectCSS:W};return r4(z,Q,_)}return r4(J,Z,$)}async function r4(X,$,Z={}){let{templateContent:Y,serverScripts:J,clientScripts:G}=DF(X),Q={...A1,...Z.options},w={__filename:$,__dirname:EF($),__stx:{},__stx_options:Q,__stx_sfc_mode:!0,__stx_inject_css:Z.injectCSS===!0,__stxServeContext:void 0,setResponseStatus:(K)=>{if(Number.isInteger(K)&&K>=100&&K<=599)n4(Z.context,"__stxResponseStatus",K)},notFound:(K=404)=>{let U=Number.isInteger(K)&&K>=400&&K<=599?K:404;n4(Z.context,"__stxResponseStatus",U)},setResponseHeader:(K,U)=>{if(!K)return;let z=Z.context?.__stxResponseHeaders||{};z[String(K)]=String(U),n4(Z.context,"__stxResponseHeaders",z)},definePageMeta:()=>{},...Z.context||{}};for(let K of J)await V1(K,w,$);let q=new Set,W=Y;if(W=await V0(W,w,$,Q,q),Z.templateOnly){if(W=W.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),W=W.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),G.length>0)W+=`
18104
+ </html>`}function X2(X,$,Z){if(X&&typeof X==="object")X[$]=Z}async function oq(X,$={}){let Z=sq(X),Y=Bun.file(Z);if(!await Y.exists())throw Error(`Template file not found: ${Z}`);let J=await Y.text(),G=null;if(nq(Z)){let Q=await rq(J,{renderer:$.markdownRenderer});J=Q.html,G=Q.frontmatter}if(G)$={...$,context:{...G,...$.context||{}}};if($.layout){let Q=sq($.layout),w=Bun.file(Q);if(!await w.exists())throw Error(`Layout template not found: ${Q}`);let{layout:q,injectCSS:W,...U}=$,K=await $2(J,Z,{...U,injectCSS:!1}),z=await w.text(),B={...$.context||{},content:K},_={...U,context:B,injectCSS:W};return $2(z,Q,_)}return $2(J,Z,$)}async function $2(X,$,Z={}){let{templateContent:Y,serverScripts:J,clientScripts:G}=uF(X),Q={...V1,...Z.options},w={__filename:$,__dirname:hF($),__stx:{},__stx_options:Q,__stx_sfc_mode:!0,__stx_inject_css:Z.injectCSS===!0,__stxServeContext:void 0,setResponseStatus:(U)=>{if(Number.isInteger(U)&&U>=100&&U<=599)X2(Z.context,"__stxResponseStatus",U)},notFound:(U=404)=>{let K=Number.isInteger(U)&&U>=400&&U<=599?U:404;X2(Z.context,"__stxResponseStatus",K)},setResponseHeader:(U,K)=>{if(!U)return;let z=Z.context?.__stxResponseHeaders||{};z[String(U)]=String(K),X2(Z.context,"__stxResponseHeaders",z)},definePageMeta:()=>{},...Z.context||{}};for(let U of J)await F1(U,w,$);let q=new Set,W=Y;if(W=await V0(W,w,$,Q,q),Z.templateOnly){if(W=W.replace(/<script data-stx-scoped>[\s\S]*?<\/script>\s*/gi,""),W=W.replace(/<!-- stx SEO Tags -->[\s\S]*?(?=<)/i,""),G.length>0)W+=`
18110
18105
  ${G.join(`
18111
- `)}`}else{if(Z.processClientScripts!==!1&&G.length>0){let K=w.__stx_event_bindings||[],U=a1(w),B=(await Promise.all(G.map(async(j)=>{let H=j.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!H)return j;return await t1(H[1],{eventBindings:K,templateContent:W,serverData:U,filePath:$})}))).join(`
18106
+ `)}`}else{if(Z.processClientScripts!==!1&&G.length>0){let U=w.__stx_event_bindings||[],K=a1(w),B=(await Promise.all(G.map(async(j)=>{let H=j.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!H)return j;return await t1(H[1],{eventBindings:U,templateContent:W,serverData:K,filePath:$})}))).join(`
18112
18107
  `);if(W.match(/(<\/body>)/i))W=W.replace(/(<\/body>)/i,`${B}
18113
18108
  $1`);else W+=`
18114
- ${B}`}W=await m3(W)}if(Z.wrapInDocument){if(!W.trim().toLowerCase().startsWith("<!doctype")&&!W.trim().toLowerCase().startsWith("<html"))W=yF(W,Z.title)}if(Z.injectCSS)try{let{injectCrosswindCSS:K}=await Promise.resolve().then(() => (G9(),UZ));W=await K(W)}catch{}return W}async function Py(X){let $=Date.now();try{if(!await Bun.file(X.input).exists())return{success:!1,target:X.target||K$(),format:X.format||"app",error:`Input file not found: ${X.input}`};let Z=X.target||K$(),Y=X.format||mF(Z),J=X.output||h(process.cwd(),"dist","native");if(!dq(J))r0(J,{recursive:!0});let G=await hq(X.input,{context:X.context,options:{isDev:!1}});if(G=t4(G,{debug:X.verbose}),G=q2(G),!G.includes("craft-component-styles")){if(G.includes("</head>"))G=G.replace("</head>",`${w2}
18115
- </head>`)}let Q=X.name||bF(X.input,".stx"),w=X.version||"1.0.0",q=X.craftPath||await dF();if(!q)return{success:!1,target:Z,format:Y,error:"Craft binary not found. Please install Craft or specify craftPath."};if(X.verbose)console.log(`\uD83D\uDCE6 Building native app for ${Z}...`),console.log(` Input: ${X.input}`),console.log(` Output: ${J}`),console.log(` Craft: ${q}`);let W;switch(Z){case"macos":W=await PF(G,Q,w,J,Y,X,q);break;case"windows":W=await fF(G,Q,w,J,Y,X,q);break;case"linux":W=await gF(G,Q,w,J,Y,X,q);break;case"ios":W=await hF(G,Q,w,J,X,q);break;case"android":W=await uF(G,Q,w,J,X,q);break;default:W={success:!1,target:Z,format:Y,error:`Unsupported target: ${Z}`}}return W.duration=Date.now()-$,W}catch(Z){return{success:!1,target:X.target||K$(),format:X.format||"app",error:Z.message,duration:Date.now()-$}}}async function PF(X,$,Z,Y,J,G,Q){let w=G.bundleId||`com.stx.${$.toLowerCase().replace(/[^a-z0-9]/g,"")}`,q=h(Y,`${$}.app`),W=h(q,"Contents"),K=h(W,"MacOS"),U=h(W,"Resources");r0(K,{recursive:!0}),r0(U,{recursive:!0});let z=h(U,"index.html");await Bun.write(z,X);let B="";if(G.sidebar?.enabled&&G.sidebar?.config)B=h(U,"sidebar-config.json"),await Bun.write(B,JSON.stringify(G.sidebar.config));let _=G.sidebar?.enabled?`--native-sidebar --sidebar-width ${G.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",j=G.menubarOnly??G.systemTray;if((G.bundleStyle||(await vF(Q)?"executable":"launcher"))==="executable"){let F=h(K,$);c1(Q,F),p1(F,493);let V={html:"index.html",title:G.window?.title||$,width:G.window?.width||1200,height:G.window?.height||800,devTools:Boolean(G.devTools)};if(j)V.menubarOnly=!0;else if(G.systemTray)V.systemTray=!0;if(G.window?.frameless)V.frameless=!0;if(G.window?.transparent)V.transparent=!0;if(G.window?.alwaysOnTop)V.alwaysOnTop=!0;if(G.window?.resizable===!1)V.resizable=!1;await Bun.write(h(U,"craft.json"),`${JSON.stringify(V,null,2)}
18116
- `)}else{let F=h(K,"craft");c1(Q,F),p1(F,493);let V=G.sidebar?.enabled?`--native-sidebar --sidebar-width ${G.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",R=`#!/bin/bash
18109
+ ${B}`}W=await s3(W)}if(Z.wrapInDocument){if(!W.trim().toLowerCase().startsWith("<!doctype")&&!W.trim().toLowerCase().startsWith("<html"))W=dF(W,Z.title)}if(Z.injectCSS)try{let{injectCrosswindCSS:U}=await Promise.resolve().then(() => (G9(),LZ));W=await U(W)}catch{}return W}async function ty(X){let $=Date.now();try{if(!await Bun.file(X.input).exists())return{success:!1,target:X.target||U$(),format:X.format||"app",error:`Input file not found: ${X.input}`};let Z=X.target||U$(),Y=X.format||eF(Z),J=X.output||h(process.cwd(),"dist","native");if(!tq(J))n0(J,{recursive:!0});let G=await oq(X.input,{context:X.context,options:{isDev:!1}});if(G=G2(G,{debug:X.verbose}),G=j2(G),!G.includes("craft-component-styles")){if(G.includes("</head>"))G=G.replace("</head>",`${B2}
18110
+ </head>`)}let Q=X.name||mF(X.input,".stx"),w=X.version||"1.0.0",q=X.craftPath||await tF();if(!q)return{success:!1,target:Z,format:Y,error:"Craft binary not found. Please install Craft or specify craftPath."};if(X.verbose)console.log(`\uD83D\uDCE6 Building native app for ${Z}...`),console.log(` Input: ${X.input}`),console.log(` Output: ${J}`),console.log(` Craft: ${q}`);let W;switch(Z){case"macos":W=await pF(G,Q,w,J,Y,X,q);break;case"windows":W=await rF(G,Q,w,J,Y,X,q);break;case"linux":W=await sF(G,Q,w,J,Y,X,q);break;case"ios":W=await oF(G,Q,w,J,X,q);break;case"android":W=await aF(G,Q,w,J,X,q);break;default:W={success:!1,target:Z,format:Y,error:`Unsupported target: ${Z}`}}return W.duration=Date.now()-$,W}catch(Z){return{success:!1,target:X.target||U$(),format:X.format||"app",error:Z.message,duration:Date.now()-$}}}async function pF(X,$,Z,Y,J,G,Q){let w=G.bundleId||`com.stx.${$.toLowerCase().replace(/[^a-z0-9]/g,"")}`,q=h(Y,`${$}.app`),W=h(q,"Contents"),U=h(W,"MacOS"),K=h(W,"Resources");n0(U,{recursive:!0}),n0(K,{recursive:!0});let z=h(K,"index.html");await Bun.write(z,X);let B="";if(G.sidebar?.enabled&&G.sidebar?.config)B=h(K,"sidebar-config.json"),await Bun.write(B,JSON.stringify(G.sidebar.config));let _=G.sidebar?.enabled?`--native-sidebar --sidebar-width ${G.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",j=G.menubarOnly??G.systemTray;if((G.bundleStyle||(await iF(Q)?"executable":"launcher"))==="executable"){let F=h(U,$);c1(Q,F),p1(F,493);let V={html:"index.html",title:G.window?.title||$,width:G.window?.width||1200,height:G.window?.height||800,devTools:Boolean(G.devTools)};if(j)V.menubarOnly=!0;else if(G.systemTray)V.systemTray=!0;if(G.window?.frameless)V.frameless=!0;if(G.window?.transparent)V.transparent=!0;if(G.window?.alwaysOnTop)V.alwaysOnTop=!0;if(G.window?.resizable===!1)V.resizable=!1;await Bun.write(h(K,"craft.json"),`${JSON.stringify(V,null,2)}
18111
+ `)}else{let F=h(U,"craft");c1(Q,F),p1(F,493);let V=G.sidebar?.enabled?`--native-sidebar --sidebar-width ${G.sidebar?.width||240} --sidebar-config "$(cat "$RESOURCES/sidebar-config.json")"`:"",R=`#!/bin/bash
18117
18112
  set -euo pipefail
18118
18113
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
18119
18114
  RESOURCES="$DIR/../Resources"
18120
18115
  exec "$DIR/craft" --html-file "$RESOURCES/index.html" \\
18121
18116
  ${[`--title "${G.window?.title||$}"`,`--width ${G.window?.width||1200}`,`--height ${G.window?.height||800}`,j?"--menubar-only":G.systemTray?"--system-tray":"",G.devTools?"":"--no-devtools",G.window?.frameless?"--frameless":"",G.window?.transparent?"--transparent":"",G.window?.alwaysOnTop?"--always-on-top":"",G.window?.resizable===!1?"--no-resize":"",V].filter(Boolean).join(" \\\n ")}
18122
- `,T=h(K,$);await Bun.write(T,R),p1(T,493)}let O=Boolean(G.icon&&await Bun.file(G.icon).exists());if(O)c1(G.icon,h(U,"AppIcon.icns"));let L={CFBundleExecutable:$,CFBundleIdentifier:w,CFBundleName:$,CFBundleDisplayName:$,CFBundleShortVersionString:Z,CFBundleVersion:Z,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:G.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:G.menubarOnly??Boolean(G.systemTray),...O?{CFBundleIconFile:"AppIcon"}:{},...G.category?{LSApplicationCategoryType:G.category}:{},...G.copyright?{NSHumanReadableCopyright:G.copyright}:{},...G.infoPlist||{}};if(await Bun.write(h(W,"Info.plist"),xF(L)),J==="dmg"){let F=h(Y,`${$}-${Z}.dmg`),V=await lF(q,F,$);if(!V.success)return{success:!1,target:"macos",format:"dmg",error:V.error};return{success:!0,target:"macos",format:"dmg",outputPath:F}}return{success:!0,target:"macos",format:"app",outputPath:q}}async function vF(X){try{let $=Bun.spawn([X,"--version"],{stdout:"pipe",stderr:"pipe"}),[Z,Y]=await Promise.all([new Response($.stdout).text(),new Response($.stderr).text()]);await $.exited;let G=`${Z}
18123
- ${Y}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!G)return!1;let[Q,w,q]=G.slice(1).map(Number);if(Q>0||w>0)return!0;return q>=57}catch{return!1}}function uq(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xF(X){return`<?xml version="1.0" encoding="UTF-8"?>
18117
+ `,T=h(U,$);await Bun.write(T,R),p1(T,493)}let O=Boolean(G.icon&&await Bun.file(G.icon).exists());if(O)c1(G.icon,h(K,"AppIcon.icns"));let L={CFBundleExecutable:$,CFBundleIdentifier:w,CFBundleName:$,CFBundleDisplayName:$,CFBundleShortVersionString:Z,CFBundleVersion:Z,CFBundlePackageType:"APPL",CFBundleSignature:"????",LSMinimumSystemVersion:G.minimumSystemVersion||"13.0",NSHighResolutionCapable:!0,NSSupportsAutomaticGraphicsSwitching:!0,LSUIElement:G.menubarOnly??Boolean(G.systemTray),...O?{CFBundleIconFile:"AppIcon"}:{},...G.category?{LSApplicationCategoryType:G.category}:{},...G.copyright?{NSHumanReadableCopyright:G.copyright}:{},...G.infoPlist||{}};if(await Bun.write(h(W,"Info.plist"),nF(L)),J==="dmg"){let F=h(Y,`${$}-${Z}.dmg`),V=await XV(q,F,$);if(!V.success)return{success:!1,target:"macos",format:"dmg",error:V.error};return{success:!0,target:"macos",format:"dmg",outputPath:F}}return{success:!0,target:"macos",format:"app",outputPath:q}}async function iF(X){try{let $=Bun.spawn([X,"--version"],{stdout:"pipe",stderr:"pipe"}),[Z,Y]=await Promise.all([new Response($.stdout).text(),new Response($.stderr).text()]);await $.exited;let G=`${Z}
18118
+ ${Y}`.match(/(\d+)\.(\d+)\.(\d+)/);if(!G)return!1;let[Q,w,q]=G.slice(1).map(Number);if(Q>0||w>0)return!0;return q>=57}catch{return!1}}function aq(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function nF(X){return`<?xml version="1.0" encoding="UTF-8"?>
18124
18119
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
18125
18120
  <plist version="1.0">
18126
18121
  <dict>
18127
- ${Object.entries(X).map(([Z,Y])=>{let J=typeof Y==="boolean"?`<${Y}/>`:typeof Y==="number"?`<integer>${Y}</integer>`:`<string>${uq(String(Y))}</string>`;return` <key>${uq(Z)}</key>
18122
+ ${Object.entries(X).map(([Z,Y])=>{let J=typeof Y==="boolean"?`<${Y}/>`:typeof Y==="number"?`<integer>${Y}</integer>`:`<string>${aq(String(Y))}</string>`;return` <key>${aq(Z)}</key>
18128
18123
  ${J}`}).join(`
18129
18124
  `)}
18130
18125
  </dict>
18131
18126
  </plist>
18132
- `}async function fF(X,$,Z,Y,J,G,Q){let w=h(Y,$);r0(w,{recursive:!0});let q=h(w,"index.html");await Bun.write(q,X),c1(Q,h(w,"craft.exe"));let W=`@echo off
18127
+ `}async function rF(X,$,Z,Y,J,G,Q){let w=h(Y,$);n0(w,{recursive:!0});let q=h(w,"index.html");await Bun.write(q,X),c1(Q,h(w,"craft.exe"));let W=`@echo off
18133
18128
  set DIR=%~dp0
18134
18129
  "%DIR%craft.exe" --html-file "%DIR%index.html" ^
18135
18130
  --title "${G.window?.title||$}" ^
@@ -18137,7 +18132,7 @@ set DIR=%~dp0
18137
18132
  --height ${G.window?.height||800} ^
18138
18133
  ${G.systemTray?"--system-tray":""} ^
18139
18134
  ${G.devTools?"":"--no-devtools"}
18140
- `;if(await Bun.write(h(w,`${$}.bat`),W),J==="zip"){let K=h(Y,`${$}-${Z}-windows.zip`),U=await cF(w,K);if(!U.success)return{success:!1,target:"windows",format:"zip",error:U.error};return{success:!0,target:"windows",format:"zip",outputPath:K}}return{success:!0,target:"windows",format:"app",outputPath:w}}async function gF(X,$,Z,Y,J,G,Q){let w=h(Y,$);r0(w,{recursive:!0});let q=h(w,"index.html");await Bun.write(q,X);let W=h(w,"craft");c1(Q,W),p1(W,493);let K=`#!/bin/bash
18135
+ `;if(await Bun.write(h(w,`${$}.bat`),W),J==="zip"){let U=h(Y,`${$}-${Z}-windows.zip`),K=await $V(w,U);if(!K.success)return{success:!1,target:"windows",format:"zip",error:K.error};return{success:!0,target:"windows",format:"zip",outputPath:U}}return{success:!0,target:"windows",format:"app",outputPath:w}}async function sF(X,$,Z,Y,J,G,Q){let w=h(Y,$);n0(w,{recursive:!0});let q=h(w,"index.html");await Bun.write(q,X);let W=h(w,"craft");c1(Q,W),p1(W,493);let U=`#!/bin/bash
18141
18136
  set -euo pipefail
18142
18137
  DIR="$( cd "$( dirname "\${BASH_SOURCE[0]}" )" && pwd )"
18143
18138
  exec "$DIR/craft" --html-file "$DIR/index.html" \\
@@ -18146,14 +18141,14 @@ exec "$DIR/craft" --html-file "$DIR/index.html" \\
18146
18141
  --height ${G.window?.height||800} \\
18147
18142
  ${G.systemTray?"--system-tray":""} \\
18148
18143
  ${G.devTools?"":"--no-devtools"}
18149
- `,U=h(w,$.toLowerCase());await Bun.write(U,K),p1(U,493);let z=`[Desktop Entry]
18144
+ `,K=h(w,$.toLowerCase());await Bun.write(K,U),p1(K,493);let z=`[Desktop Entry]
18150
18145
  Type=Application
18151
18146
  Name=${$}
18152
- Exec=${U}
18147
+ Exec=${K}
18153
18148
  Terminal=false
18154
18149
  Categories=Utility;
18155
- `;if(await Bun.write(h(w,`${$.toLowerCase()}.desktop`),z),J==="deb"){let B=h(Y,`${$.toLowerCase()}_${Z}_amd64.deb`),_=await pF(w,B,$,Z,G);if(!_.success)return{success:!1,target:"linux",format:"deb",error:_.error};return{success:!0,target:"linux",format:"deb",outputPath:B}}if(J==="appimage"){let B=h(Y,`${$}-${Z}-x86_64.AppImage`),_=await iF(w,B,$,G);if(!_.success)return{success:!1,target:"linux",format:"appimage",error:_.error};return{success:!0,target:"linux",format:"appimage",outputPath:B}}return{success:!0,target:"linux",format:"app",outputPath:w}}async function hF(X,$,Z,Y,J,G){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${$}' to create an iOS project.`}}async function uF(X,$,Z,Y,J,G){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${$}' to create an Android project.`}}async function dF(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let X=[h(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),h(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),h(s4(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),h(s4(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",h(s4(),".local/bin/craft"),h(process.env.LOCALAPPDATA||"","craft","craft.exe"),h(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let $ of X)if(await Bun.file($).exists())return $;try{let Z=SF("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
18156
- `)[0];if(Z&&await Bun.file(Z).exists())return Z}catch{}return null}function K$(){switch(CF()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function mF(X){switch(X){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function lF(X,$,Z){return new Promise((Y)=>{let J=U$("hdiutil",["create","-volname",Z,"-srcfolder",X,"-ov","-format","UDZO",$]);J.on("close",(G)=>{if(G===0)Y({success:!0});else Y({success:!1,error:`hdiutil exited with code ${G}`})}),J.on("error",(G)=>{Y({success:!1,error:G.message})})})}async function cF(X,$){return new Promise((Z)=>{let Y=U$("zip",["-r",$,"."],{cwd:X});Y.on("close",(J)=>{if(J===0)Z({success:!0});else Z({success:!1,error:`zip exited with code ${J}`})}),Y.on("error",(J)=>{Z({success:!1,error:J.message})})})}async function pF(X,$,Z,Y,J){return new Promise((G)=>{try{let Q=h(mq(),`stx-deb-${Date.now()}`),w=h(Q,"DEBIAN"),q=h(Q,"usr","bin"),W=h(Q,"usr","share","applications"),K=h(Q,"usr","share",Z.toLowerCase());r0(w,{recursive:!0}),r0(q,{recursive:!0}),r0(W,{recursive:!0}),r0(K,{recursive:!0});let U=X0("fs").readdirSync(X);for(let j of U)c1(h(X,j),h(K,j));let z=`#!/bin/bash
18150
+ `;if(await Bun.write(h(w,`${$.toLowerCase()}.desktop`),z),J==="deb"){let B=h(Y,`${$.toLowerCase()}_${Z}_amd64.deb`),_=await ZV(w,B,$,Z,G);if(!_.success)return{success:!1,target:"linux",format:"deb",error:_.error};return{success:!0,target:"linux",format:"deb",outputPath:B}}if(J==="appimage"){let B=h(Y,`${$}-${Z}-x86_64.AppImage`),_=await YV(w,B,$,G);if(!_.success)return{success:!1,target:"linux",format:"appimage",error:_.error};return{success:!0,target:"linux",format:"appimage",outputPath:B}}return{success:!0,target:"linux",format:"app",outputPath:w}}async function oF(X,$,Z,Y,J,G){return{success:!1,target:"ios",format:"ipa",error:`iOS build requires Xcode and additional setup. Use 'stx init:ios ${$}' to create an iOS project.`}}async function aF(X,$,Z,Y,J,G){return{success:!1,target:"android",format:"apk",error:`Android build requires Android SDK and additional setup. Use 'stx init:android ${$}' to create an Android project.`}}async function tF(){if(process.env.CRAFT_BIN&&await Bun.file(process.env.CRAFT_BIN).exists())return process.env.CRAFT_BIN;let X=[h(process.cwd(),"../../craft/packages/zig/zig-out/bin/craft"),h(process.cwd(),"../craft/packages/zig/zig-out/bin/craft"),h(Z2(),"Code/Tools/craft/packages/zig/zig-out/bin/craft"),h(Z2(),"Code/craft/packages/zig/zig-out/bin/craft"),"/usr/local/bin/craft","/usr/bin/craft",h(Z2(),".local/bin/craft"),h(process.env.LOCALAPPDATA||"","craft","craft.exe"),h(process.env.PROGRAMFILES||"","craft","craft.exe")];for(let $ of X)if(await Bun.file($).exists())return $;try{let Z=lF("which craft 2>/dev/null || where craft 2>nul",{encoding:"utf-8"}).trim().split(`
18151
+ `)[0];if(Z&&await Bun.file(Z).exists())return Z}catch{}return null}function U$(){switch(cF()){case"darwin":return"macos";case"win32":return"windows";default:return"linux"}}function eF(X){switch(X){case"macos":return"app";case"windows":return"zip";case"linux":return"appimage";case"ios":return"ipa";case"android":return"apk";default:return"app"}}async function XV(X,$,Z){return new Promise((Y)=>{let J=K$("hdiutil",["create","-volname",Z,"-srcfolder",X,"-ov","-format","UDZO",$]);J.on("close",(G)=>{if(G===0)Y({success:!0});else Y({success:!1,error:`hdiutil exited with code ${G}`})}),J.on("error",(G)=>{Y({success:!1,error:G.message})})})}async function $V(X,$){return new Promise((Z)=>{let Y=K$("zip",["-r",$,"."],{cwd:X});Y.on("close",(J)=>{if(J===0)Z({success:!0});else Z({success:!1,error:`zip exited with code ${J}`})}),Y.on("error",(J)=>{Z({success:!1,error:J.message})})})}async function ZV(X,$,Z,Y,J){return new Promise((G)=>{try{let Q=h(eq(),`stx-deb-${Date.now()}`),w=h(Q,"DEBIAN"),q=h(Q,"usr","bin"),W=h(Q,"usr","share","applications"),U=h(Q,"usr","share",Z.toLowerCase());n0(w,{recursive:!0}),n0(q,{recursive:!0}),n0(W,{recursive:!0}),n0(U,{recursive:!0});let K=X0("fs").readdirSync(X);for(let j of K)c1(h(X,j),h(U,j));let z=`#!/bin/bash
18157
18152
  exec /usr/share/${Z.toLowerCase()}/${Z.toLowerCase()} "$@"`;X0("fs").writeFileSync(h(q,Z.toLowerCase()),z),p1(h(q,Z.toLowerCase()),493);let B=`Package: ${Z.toLowerCase()}
18158
18153
  Version: ${Y}
18159
18154
  Section: utils
@@ -18162,7 +18157,7 @@ Architecture: amd64
18162
18157
  Depends: libgtk-3-0, libwebkit2gtk-4.0-37
18163
18158
  Maintainer: ${J.author||"Unknown"}
18164
18159
  Description: ${J.description||Z}
18165
- `;X0("fs").writeFileSync(h(w,"control"),B);let _=U$("dpkg-deb",["--build",Q,$]);_.on("close",(j)=>{if(X0("fs").rmSync(Q,{recursive:!0,force:!0}),j===0)G({success:!0});else G({success:!1,error:`dpkg-deb exited with code ${j}`})}),_.on("error",(j)=>{X0("fs").rmSync(Q,{recursive:!0,force:!0}),G({success:!1,error:j.message})})}catch(Q){G({success:!1,error:Q.message})}})}async function iF(X,$,Z,Y){return new Promise((J)=>{try{let G=h(mq(),`stx-appimage-${Date.now()}`),Q=h(G,`${Z}.AppDir`),w=h(Q,"usr"),q=h(w,"bin"),W=h(w,"share");r0(q,{recursive:!0}),r0(W,{recursive:!0});let K=h(W,Z.toLowerCase());r0(K,{recursive:!0});let U=X0("fs").readdirSync(X);for(let H of U)c1(h(X,H),h(K,H));let z=`#!/bin/bash
18160
+ `;X0("fs").writeFileSync(h(w,"control"),B);let _=K$("dpkg-deb",["--build",Q,$]);_.on("close",(j)=>{if(X0("fs").rmSync(Q,{recursive:!0,force:!0}),j===0)G({success:!0});else G({success:!1,error:`dpkg-deb exited with code ${j}`})}),_.on("error",(j)=>{X0("fs").rmSync(Q,{recursive:!0,force:!0}),G({success:!1,error:j.message})})}catch(Q){G({success:!1,error:Q.message})}})}async function YV(X,$,Z,Y){return new Promise((J)=>{try{let G=h(eq(),`stx-appimage-${Date.now()}`),Q=h(G,`${Z}.AppDir`),w=h(Q,"usr"),q=h(w,"bin"),W=h(w,"share");n0(q,{recursive:!0}),n0(W,{recursive:!0});let U=h(W,Z.toLowerCase());n0(U,{recursive:!0});let K=X0("fs").readdirSync(X);for(let H of K)c1(h(X,H),h(U,H));let z=`#!/bin/bash
18166
18161
  SELF=$(readlink -f "$0")
18167
18162
  HERE=\${SELF%/*}
18168
18163
  export PATH="\${HERE}/usr/bin:\${PATH}"
@@ -18174,4 +18169,4 @@ Exec=${Z.toLowerCase()}
18174
18169
  Terminal=false
18175
18170
  Categories=Utility;
18176
18171
  Icon=${Z.toLowerCase()}
18177
- `;X0("fs").writeFileSync(h(Q,`${Z.toLowerCase()}.desktop`),B);let _=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(X0("fs").writeFileSync(h(Q,`${Z.toLowerCase()}.png`),_),Y.icon&&dq(Y.icon))c1(Y.icon,h(Q,`${Z.toLowerCase()}.png`));let j=U$("appimagetool",[Q,$],{env:{...process.env,ARCH:"x86_64"}});j.on("close",(H)=>{if(X0("fs").rmSync(G,{recursive:!0,force:!0}),H===0)p1($,493),J({success:!0});else J({success:!1,error:`appimagetool exited with code ${H}. Install from https://appimage.github.io/appimagetool/`})}),j.on("error",(H)=>{X0("fs").rmSync(G,{recursive:!0,force:!0}),J({success:!1,error:`appimagetool not found: ${H.message}`})})}catch(G){J({success:!1,error:G.message})}})}function vy(){return[K$()]}function xy(X){switch(X){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}export{GV as renderSSR,ZV as registerCraftComponent,oF as processCraftDirective,q2 as processCraftComponents,wV as prerenderForCraft,sF as isCraftEnvironment,t4 as injectCraftBridge,WV as getSSRCacheStats,YV as getCraftComponents,vy as getAvailableTargets,xy as getAvailableFormats,QV as generateCraftOptimizations,a4 as generateCraftBridgeScript,eF as createHotReloadServer,tF as compileToNative,IW as compileTemplate,cW as clearTemplateCache,pW as clearRenderCache,qV as clearAllCaches,Py as buildNative,nq as NATIVE_COMPONENTS,w2 as CRAFT_COMPONENT_STYLES,$V as CRAFT_COMPONENT_RUNTIME,H$ as CRAFT_COMPONENTS,rF as CRAFT_BRIDGE_SCRIPT};
18172
+ `;X0("fs").writeFileSync(h(Q,`${Z.toLowerCase()}.desktop`),B);let _=Buffer.from([137,80,78,71,13,10,26,10,0,0,0,13,73,72,68,82,0,0,0,1,0,0,0,1,8,2,0,0,0,144,119,83,222,0,0,0,12,73,68,65,84,8,215,99,248,255,255,63,0,5,254,2,254,220,204,89,231,0,0,0,0,73,69,78,68,174,66,96,130]);if(X0("fs").writeFileSync(h(Q,`${Z.toLowerCase()}.png`),_),Y.icon&&tq(Y.icon))c1(Y.icon,h(Q,`${Z.toLowerCase()}.png`));let j=K$("appimagetool",[Q,$],{env:{...process.env,ARCH:"x86_64"}});j.on("close",(H)=>{if(X0("fs").rmSync(G,{recursive:!0,force:!0}),H===0)p1($,493),J({success:!0});else J({success:!1,error:`appimagetool exited with code ${H}. Install from https://appimage.github.io/appimagetool/`})}),j.on("error",(H)=>{X0("fs").rmSync(G,{recursive:!0,force:!0}),J({success:!1,error:`appimagetool not found: ${H.message}`})})}catch(G){J({success:!1,error:G.message})}})}function ey(){return[U$()]}function Xb(X){switch(X){case"macos":return["app","dmg","pkg"];case"windows":return["app","zip","msi"];case"linux":return["app","deb","rpm","appimage"];case"ios":return["ipa"];case"android":return["apk"];default:return["app"]}}export{HV as renderSSR,_V as registerCraftComponent,wV as processCraftDirective,j2 as processCraftComponents,OV as prerenderForCraft,QV as isCraftEnvironment,G2 as injectCraftBridge,VV as getSSRCacheStats,BV as getCraftComponents,ey as getAvailableTargets,Xb as getAvailableFormats,LV as generateCraftOptimizations,J2 as generateCraftBridgeScript,UV as createHotReloadServer,WV as compileToNative,gW as compileTemplate,$U as clearTemplateCache,ZU as clearRenderCache,FV as clearAllCaches,ty as buildNative,JW as NATIVE_COMPONENTS,B2 as CRAFT_COMPONENT_STYLES,zV as CRAFT_COMPONENT_RUNTIME,H$ as CRAFT_COMPONENTS,GV as CRAFT_BRIDGE_SCRIPT};