@stacksjs/stx 0.2.194 → 0.2.195

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ssg.js CHANGED
@@ -1,7 +1,7 @@
1
1
  // @bun
2
- var Yq=Object.defineProperty;var Gq=($)=>$;function Qq($,X){this[$]=Gq.bind(null,X)}var e=($,X)=>{for(var Z in X)Yq($,Z,{get:X[Z],enumerable:!0,configurable:!0,set:Qq.bind(X,Z)})};var y=($,X)=>()=>($&&(X=$($=0)),X);var B0=import.meta.require;function S9($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>q7.includes(Z))}function K7($){return S9($.replace(/^\//,""))}var q7;var A8=y(()=>{q7=["components","layouts","partials","emails"]});import N5 from"fs";import z7 from"path";function U7($,X){let Z=$.filter((Q)=>!K7(Q.pattern)),J=["// Auto-generated by STX - do not edit"];if(Z.length===0)J.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{J.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let Q of Z){let W=[];for(let q of Q.params){let K=Q.pattern.includes(`:${q}?`)?"?":"";W.push(`${q}${K}: string`)}let w=W.join("; ");J.push(` '${Q.pattern}': { ${w} }`)}J.push(" }","}","","export {}","")}let Y=J.join(`
3
- `),G=z7.join(X,"route-types.d.ts");try{if(N5.existsSync(G)&&N5.readFileSync(G,"utf8")===Y)return;N5.mkdirSync(X,{recursive:!0}),N5.writeFileSync(G,Y)}catch{}}function j7($,X,Z){let J=process.cwd(),Y=z7.relative(J,Z),G=$.filter((W)=>!K7(W.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${Y||"pages"}/`,"","export const routes = ["];for(let W of G){let w=z7.relative(J,W.filePath).replace(/\\/g,"/"),q=JSON.stringify(W.params),K=W.layout?`, layout: '${z7.relative(J,W.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${W.pattern}', filePath: '${w}', isDynamic: ${W.isDynamic}, params: ${q}${K} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),N5.mkdirSync(X,{recursive:!0}),N5.writeFileSync(z7.join(X,"routes.ts"),Q.join(`
4
- `))}var C9=y(()=>{A8()});import S6 from"path";function R8($,X){let J=S6.relative(X,$).replace(/\.(stx|md)$/,"");if(J=J.split(S6.sep).join("/"),J==="index")return"/";if(J.endsWith("/index"))J=J.slice(0,-6);return J=J.replace(/\[\[([^\]]+)\]\]/g,":$1?"),J=J.replace(/\[([^\]]+)\]/g,":$1"),J=J.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${J}`}function B7($){let X=[],Z="",J=0;while(J<$.length){let Y=$.slice(J),G=/^\/:([^/?*]+)\?/.exec(Y);if(G){X.push(G[1]),Z+="(?:/([^/]+))?",J+=G[0].length;continue}let Q=/^:([^/?*]+)\*/.exec(Y);if(Q){X.push(Q[1]),Z+="(.+)",J+=Q[0].length;continue}let W=/^:([^/?*]+)/.exec(Y);if(W){X.push(W[1]),Z+="([^/]+)",J+=W[0].length;continue}Z+=$[J].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),J+=1}return{regex:new RegExp(`^${Z}$`),params:X}}function N8($,X){let Z=$===""?"/":$;for(let J of X){let Y=Z.match(J.regex);if(Y){let G={};return J.params.forEach((Q,W)=>{G[Q]=Y[W+1]}),{route:J,params:G}}}return null}function C6($){let X=$.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return B7(X)}var P9=()=>{};import Vq from"fs";import v9 from"path";function M8($,X){let Z=[],J=v9.dirname($);while(J.startsWith(X)||J===X){let Y=v9.join(J,"_layout.stx");if(Vq.existsSync(Y))Z.unshift(Y);if(J===X)break;J=v9.dirname(J)}return Z}var x9=()=>{};import f9 from"fs";import M5 from"path";function P6($,X){let Z=[];if(!f9.existsSync($))return Z;let J=f9.readdirSync($,{withFileTypes:!0});for(let Y of J){let G=M5.join($,Y.name);if(Y.isDirectory()){if(Y.name.startsWith("."))continue;if(q7.includes(Y.name))continue;Z.push(...P6(G,X))}else if(Y.isFile()){let Q=M5.extname(Y.name);if(X.includes(Q)){if(Y.name.startsWith("_")&&Y.name!=="_layout.stx")continue;if(Y.name==="_layout.stx")continue;Z.push(G)}}}return Z}class T5{routes;pagesDir;pagesDirs;config;constructor($,X={}){this.config=X;let Z=X.pagesDirs&&X.pagesDirs.length>0?X.pagesDirs:[X.pagesDir||"pages"];this.pagesDirs=Z.map((Q)=>M5.resolve($,Q)),this.pagesDir=this.pagesDirs[0];let J=X.extensions||[".stx"],Y=new Set;this.routes=[];for(let Q of this.pagesDirs){let W=P6(Q,J);for(let w of W){let q=R8(w,Q);if(Y.has(q))continue;Y.add(q);let{regex:K,params:z}=B7(q),U=X.layouts!==!1?M8(w,Q):[];this.routes.push({pattern:q,regex:K,params:z,filePath:w,isDynamic:z.length>0,layout:U.length>0?U[U.length-1]:void 0})}}this.routes.sort((Q,W)=>{if(!Q.isDynamic&&W.isDynamic)return-1;if(Q.isDynamic&&!W.isDynamic)return 1;let w=Q.pattern.split("/").length,q=W.pattern.split("/").length;if(w!==q)return q-w;return Q.pattern.localeCompare(W.pattern)});let G=M5.resolve($,X.stateDir||process.env.STX_DIR?.trim()||".stx");U7(this.routes,G),j7(this.routes,G,this.pagesDir)}match($){let X=$===""?"/":$;for(let Z of this.routes){let J=X.match(Z.regex);if(J){let Y={};return Z.params.forEach((G,Q)=>{Y[G]=J[Q+1]}),{route:Z,params:Y}}}return null}resolve($,X){let Z=this.routes.find((Y)=>Y.pattern===$||Y.filePath.includes($));if(!Z)return"#not-found";let J=Z.pattern;if(X)for(let[Y,G]of Object.entries(X))J=J.replace(`:${Y}`,encodeURIComponent(G));return J}addRoute($){this.routes.push($),this.routes.sort((X,Z)=>{if(!X.isDynamic&&Z.isDynamic)return-1;if(X.isDynamic&&!Z.isDynamic)return 1;return X.pattern.localeCompare(Z.pattern)})}getLayout($){return $.layout??null}}function v6($,X){return new T5($,X)}function g9($,X){let Z=[`${X}.stx`,"error.stx"];for(let J of Z){let Y=M5.join($,J);if(f9.existsSync(Y))return Y}return null}function h9($,X){return $.map((Z)=>{let J=M5.relative(X,Z.filePath),Y=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${J}${Y}`})}var x6=y(()=>{C9();P9();x9();A8()});function u9($){T8=$.replace(/\/$/,"")}function d9($,X,Z={}){k5[$]={path:X,name:$,params:Z}}function m9($){for(let[X,Z]of Object.entries($))if(typeof Z==="string")k5[X]={path:Z,name:X};else k5[X]={...Z,name:X}}function H7($,X={},Z=!1){let J=k5[$];if(!J)return console.warn(`Route [${$}] not defined.`),"#undefined-route";let Y={...J.params,...X},G=J.path;G=G.replace(/:(\w+)/g,(W,w)=>{let q=Y[w];if(q===void 0)return console.warn(`Missing parameter [${w}] for route [${$}].`),`:${w}`;return delete Y[w],encodeURIComponent(String(q))});let Q=Object.entries(Y);if(Q.length>0){let W=Q.map(([w,q])=>`${encodeURIComponent(w)}=${encodeURIComponent(String(q))}`).join("&");G+=(G.includes("?")?"&":"?")+W}return Z&&T8?`${T8}${G}`:G}function c9(){for(let $ of Object.keys(k5))delete k5[$];T8=""}var k5,T8="";var f6=y(()=>{k5={}});import g6 from"fs";import h6 from"path";function p9($,X={}){return{type:"redirect",path:$,options:{replace:X.replace??!1,external:X.external??!1,redirectCode:X.redirectCode??302}}}function i9($){return{type:"abort",error:typeof $==="string"?{statusCode:500,message:$}:$}}function n9($,X={}){return{handler:$,mode:X.mode??"universal"}}function l9($){let X={};if(!$)return X;let Z=$.split(";");for(let J of Z){let[Y,...G]=J.split("=");if(Y){let Q=Y.trim(),W=G.join("=").trim();if(Q)X[Q]=decodeURIComponent(W)}}return X}function k8($,X,Z={}){let J=`${encodeURIComponent($)}=${encodeURIComponent(X)}`;if(Z.expires){let Y=typeof Z.expires==="number"?new Date(Date.now()+Z.expires*1000):Z.expires;J+=`; Expires=${Y.toUTCString()}`}if(Z.path)J+=`; Path=${Z.path}`;if(Z.domain)J+=`; Domain=${Z.domain}`;if(Z.secure)J+="; Secure";if(Z.httpOnly)J+="; HttpOnly";if(Z.sameSite)J+=`; SameSite=${Z.sameSite}`;return J}function I8($,X){let Z=$.headers.get("cookie")||"",J=l9(Z);return{get(Y){return J[Y]},set(Y,G,Q={}){J[Y]=G,X.append("Set-Cookie",k8(Y,G,Q))},delete(Y){delete J[Y],X.append("Set-Cookie",k8(Y,"",{expires:new Date(0),path:"/"}))},getAll(){return{...J}}}}function E8(){return{get($){if(typeof document>"u")return;return l9(document.cookie)[$]},set($,X,Z={}){if(typeof document>"u")return;document.cookie=k8($,X,Z)},delete($){if(typeof document>"u")return;document.cookie=k8($,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return l9(document.cookie)}}}function D8(){let $=typeof window<"u"&&typeof window.localStorage<"u";return{get(X){if(!$)return null;try{return window.localStorage.getItem(X)}catch{return null}},set(X,Z){if(!$)return;try{window.localStorage.setItem(X,Z)}catch{}},remove(X){if(!$)return;try{window.localStorage.removeItem(X)}catch{}},isAvailable(){return $}}}function _7($,X){O7.set($,X)}function y8($){return O7.get($)}function r9($){return O7.has($)}function L7(){O7.clear()}function F7(){return Array.from(O7.keys())}async function V7($,X="middleware"){let Z=h6.resolve($,X);if(!g6.existsSync(Z))return;let J=g6.readdirSync(Z);for(let Y of J){if(!Y.endsWith(".ts")&&!Y.endsWith(".js"))continue;if(Y.includes(".test.")||Y.includes(".spec."))continue;let G=Y.replace(/\.(ts|js)$/,""),Q=h6.join(Z,Y);try{let w=(await import(Q)).default;if(w&&typeof w.handler==="function")_7(G,w);else if(typeof w==="function")_7(G,{handler:w,mode:"universal"})}catch(W){console.warn(`Failed to load middleware '${G}' from ${Q}:`,W)}}}function Aq($){let X={};if(!$)return X;let Z=new URLSearchParams($);for(let[J,Y]of Z)X[J]=Y;return X}function A7($,X,Z,J=""){return{path:$,params:X,query:Aq(J),fullPath:J?`${$}?${J}`:$,meta:Z}}function R7($,X,Z,J){let Y=J?.isServer??typeof window>"u",G=!Y,Q=new Headers;return{to:$,from:X,isClient:G,isServer:Y,cookies:Y&&Z?I8(Z,Q):E8(),storage:D8(),state:{},request:Z,responseHeaders:Q}}async function N7($,X){let Z=Array.isArray($)?$:[$],J=X.isServer;for(let Y of Z){let G=y8(Y);if(!G)return console.error(`Route middleware '${Y}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${Y}' is not registered`}},state:X.state,responseHeaders:X.responseHeaders};if(G.mode==="server"&&!J)continue;try{let Q=await G.handler(X);if(Q){if(Q.type==="redirect")return{passed:!1,redirect:Q,state:X.state,responseHeaders:X.responseHeaders};if(Q.type==="abort")return{passed:!1,abort:Q,state:X.state,responseHeaders:X.responseHeaders}}}catch(Q){return console.error(`Error in middleware '${Y}':`,Q),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:Q instanceof Error?Q.message:"Middleware error"}},state:X.state,responseHeaders:X.responseHeaders}}}return{passed:!0,state:X.state,responseHeaders:X.responseHeaders}}var O7;var u6=y(()=>{O7=new Map});function M7($){let Z=$.replace(/\\/g,"/").split("/").filter(Boolean),J=Z.lastIndexOf("layouts"),Y=J>=0?Z[J+1]:Z.at(-1);if(!Y)return"app";return Y.replace(/\.stx$/i,"")||"app"}function d6($){let X=$.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),Z=$.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),J=$.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),Y=X?.[1]||J?.[1]||"";return{layout:Y,group:Z?.[1]||M7(Y)}}function Rq($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function T7(){if(b8)return b8;return b8=Rq(`
2
+ var Yq=Object.defineProperty;var Gq=($)=>$;function Qq($,X){this[$]=Gq.bind(null,X)}var t=($,X)=>{for(var Z in X)Yq($,Z,{get:X[Z],enumerable:!0,configurable:!0,set:Qq.bind(X,Z)})};var y=($,X)=>()=>($&&(X=$($=0)),X);var B0=import.meta.require;function S9($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>q7.includes(Z))}function K7($){return S9($.replace(/^\//,""))}var q7;var A8=y(()=>{q7=["components","layouts","partials","emails"]});import R5 from"fs";import z7 from"path";function U7($,X){let Z=$.filter((Q)=>!K7(Q.pattern)),J=["// Auto-generated by STX - do not edit"];if(Z.length===0)J.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{J.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let Q of Z){let W=[];for(let q of Q.params){let K=Q.pattern.includes(`:${q}?`)?"?":"";W.push(`${q}${K}: string`)}let w=W.join("; ");J.push(` '${Q.pattern}': { ${w} }`)}J.push(" }","}","","export {}","")}let Y=J.join(`
3
+ `),G=z7.join(X,"route-types.d.ts");try{if(R5.existsSync(G)&&R5.readFileSync(G,"utf8")===Y)return;R5.mkdirSync(X,{recursive:!0}),R5.writeFileSync(G,Y)}catch{}}function j7($,X,Z){let J=process.cwd(),Y=z7.relative(J,Z),G=$.filter((W)=>!K7(W.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${Y||"pages"}/`,"","export const routes = ["];for(let W of G){let w=z7.relative(J,W.filePath).replace(/\\/g,"/"),q=JSON.stringify(W.params),K=W.layout?`, layout: '${z7.relative(J,W.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${W.pattern}', filePath: '${w}', isDynamic: ${W.isDynamic}, params: ${q}${K} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),R5.mkdirSync(X,{recursive:!0}),R5.writeFileSync(z7.join(X,"routes.ts"),Q.join(`
4
+ `))}var C9=y(()=>{A8()});import S6 from"path";function R8($,X){let J=S6.relative(X,$).replace(/\.(stx|md)$/,"");if(J=J.split(S6.sep).join("/"),J==="index")return"/";if(J.endsWith("/index"))J=J.slice(0,-6);return J=J.replace(/\[\[([^\]]+)\]\]/g,":$1?"),J=J.replace(/\[([^\]]+)\]/g,":$1"),J=J.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${J}`}function B7($){let X=[],Z="",J=0;while(J<$.length){let Y=$.slice(J),G=/^\/:([^/?*]+)\?/.exec(Y);if(G){X.push(G[1]),Z+="(?:/([^/]+))?",J+=G[0].length;continue}let Q=/^:([^/?*]+)\*/.exec(Y);if(Q){X.push(Q[1]),Z+="(.+)",J+=Q[0].length;continue}let W=/^:([^/?*]+)/.exec(Y);if(W){X.push(W[1]),Z+="([^/]+)",J+=W[0].length;continue}Z+=$[J].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),J+=1}return{regex:new RegExp(`^${Z}$`),params:X}}function N8($,X){let Z=$===""?"/":$;for(let J of X){let Y=Z.match(J.regex);if(Y){let G={};return J.params.forEach((Q,W)=>{G[Q]=Y[W+1]}),{route:J,params:G}}}return null}function C6($){let X=$.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return B7(X)}var P9=()=>{};import Vq from"fs";import v9 from"path";function M8($,X){let Z=[],J=v9.dirname($);while(J.startsWith(X)||J===X){let Y=v9.join(J,"_layout.stx");if(Vq.existsSync(Y))Z.unshift(Y);if(J===X)break;J=v9.dirname(J)}return Z}var x9=()=>{};import f9 from"fs";import N5 from"path";function P6($,X){let Z=[];if(!f9.existsSync($))return Z;let J=f9.readdirSync($,{withFileTypes:!0});for(let Y of J){let G=N5.join($,Y.name);if(Y.isDirectory()){if(Y.name.startsWith("."))continue;if(q7.includes(Y.name))continue;Z.push(...P6(G,X))}else if(Y.isFile()){let Q=N5.extname(Y.name);if(X.includes(Q)){if(Y.name.startsWith("_")&&Y.name!=="_layout.stx")continue;if(Y.name==="_layout.stx")continue;Z.push(G)}}}return Z}class M5{routes;pagesDir;pagesDirs;config;constructor($,X={}){this.config=X;let Z=X.pagesDirs&&X.pagesDirs.length>0?X.pagesDirs:[X.pagesDir||"pages"];this.pagesDirs=Z.map((Q)=>N5.resolve($,Q)),this.pagesDir=this.pagesDirs[0];let J=X.extensions||[".stx"],Y=new Set;this.routes=[];for(let Q of this.pagesDirs){let W=P6(Q,J);for(let w of W){let q=R8(w,Q);if(Y.has(q))continue;Y.add(q);let{regex:K,params:z}=B7(q),U=X.layouts!==!1?M8(w,Q):[];this.routes.push({pattern:q,regex:K,params:z,filePath:w,isDynamic:z.length>0,layout:U.length>0?U[U.length-1]:void 0})}}this.routes.sort((Q,W)=>{if(!Q.isDynamic&&W.isDynamic)return-1;if(Q.isDynamic&&!W.isDynamic)return 1;let w=Q.pattern.split("/").length,q=W.pattern.split("/").length;if(w!==q)return q-w;return Q.pattern.localeCompare(W.pattern)});let G=N5.resolve($,X.stateDir||process.env.STX_DIR?.trim()||".stx");U7(this.routes,G),j7(this.routes,G,this.pagesDir)}match($){let X=$===""?"/":$;for(let Z of this.routes){let J=X.match(Z.regex);if(J){let Y={};return Z.params.forEach((G,Q)=>{Y[G]=J[Q+1]}),{route:Z,params:Y}}}return null}resolve($,X){let Z=this.routes.find((Y)=>Y.pattern===$||Y.filePath.includes($));if(!Z)return"#not-found";let J=Z.pattern;if(X)for(let[Y,G]of Object.entries(X))J=J.replace(`:${Y}`,encodeURIComponent(G));return J}addRoute($){this.routes.push($),this.routes.sort((X,Z)=>{if(!X.isDynamic&&Z.isDynamic)return-1;if(X.isDynamic&&!Z.isDynamic)return 1;return X.pattern.localeCompare(Z.pattern)})}getLayout($){return $.layout??null}}function v6($,X){return new M5($,X)}function g9($,X){let Z=[`${X}.stx`,"error.stx"];for(let J of Z){let Y=N5.join($,J);if(f9.existsSync(Y))return Y}return null}function h9($,X){return $.map((Z)=>{let J=N5.relative(X,Z.filePath),Y=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${J}${Y}`})}var x6=y(()=>{C9();P9();x9();A8()});function u9($){T8=$.replace(/\/$/,"")}function d9($,X,Z={}){T5[$]={path:X,name:$,params:Z}}function m9($){for(let[X,Z]of Object.entries($))if(typeof Z==="string")T5[X]={path:Z,name:X};else T5[X]={...Z,name:X}}function H7($,X={},Z=!1){let J=T5[$];if(!J)return console.warn(`Route [${$}] not defined.`),"#undefined-route";let Y={...J.params,...X},G=J.path;G=G.replace(/:(\w+)/g,(W,w)=>{let q=Y[w];if(q===void 0)return console.warn(`Missing parameter [${w}] for route [${$}].`),`:${w}`;return delete Y[w],encodeURIComponent(String(q))});let Q=Object.entries(Y);if(Q.length>0){let W=Q.map(([w,q])=>`${encodeURIComponent(w)}=${encodeURIComponent(String(q))}`).join("&");G+=(G.includes("?")?"&":"?")+W}return Z&&T8?`${T8}${G}`:G}function c9(){for(let $ of Object.keys(T5))delete T5[$];T8=""}var T5,T8="";var f6=y(()=>{T5={}});import g6 from"fs";import h6 from"path";function p9($,X={}){return{type:"redirect",path:$,options:{replace:X.replace??!1,external:X.external??!1,redirectCode:X.redirectCode??302}}}function i9($){return{type:"abort",error:typeof $==="string"?{statusCode:500,message:$}:$}}function n9($,X={}){return{handler:$,mode:X.mode??"universal"}}function l9($){let X={};if(!$)return X;let Z=$.split(";");for(let J of Z){let[Y,...G]=J.split("=");if(Y){let Q=Y.trim(),W=G.join("=").trim();if(Q)X[Q]=decodeURIComponent(W)}}return X}function k8($,X,Z={}){let J=`${encodeURIComponent($)}=${encodeURIComponent(X)}`;if(Z.expires){let Y=typeof Z.expires==="number"?new Date(Date.now()+Z.expires*1000):Z.expires;J+=`; Expires=${Y.toUTCString()}`}if(Z.path)J+=`; Path=${Z.path}`;if(Z.domain)J+=`; Domain=${Z.domain}`;if(Z.secure)J+="; Secure";if(Z.httpOnly)J+="; HttpOnly";if(Z.sameSite)J+=`; SameSite=${Z.sameSite}`;return J}function I8($,X){let Z=$.headers.get("cookie")||"",J=l9(Z);return{get(Y){return J[Y]},set(Y,G,Q={}){J[Y]=G,X.append("Set-Cookie",k8(Y,G,Q))},delete(Y){delete J[Y],X.append("Set-Cookie",k8(Y,"",{expires:new Date(0),path:"/"}))},getAll(){return{...J}}}}function E8(){return{get($){if(typeof document>"u")return;return l9(document.cookie)[$]},set($,X,Z={}){if(typeof document>"u")return;document.cookie=k8($,X,Z)},delete($){if(typeof document>"u")return;document.cookie=k8($,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return l9(document.cookie)}}}function D8(){let $=typeof window<"u"&&typeof window.localStorage<"u";return{get(X){if(!$)return null;try{return window.localStorage.getItem(X)}catch{return null}},set(X,Z){if(!$)return;try{window.localStorage.setItem(X,Z)}catch{}},remove(X){if(!$)return;try{window.localStorage.removeItem(X)}catch{}},isAvailable(){return $}}}function _7($,X){O7.set($,X)}function y8($){return O7.get($)}function r9($){return O7.has($)}function L7(){O7.clear()}function F7(){return Array.from(O7.keys())}async function V7($,X="middleware"){let Z=h6.resolve($,X);if(!g6.existsSync(Z))return;let J=g6.readdirSync(Z);for(let Y of J){if(!Y.endsWith(".ts")&&!Y.endsWith(".js"))continue;if(Y.includes(".test.")||Y.includes(".spec."))continue;let G=Y.replace(/\.(ts|js)$/,""),Q=h6.join(Z,Y);try{let w=(await import(Q)).default;if(w&&typeof w.handler==="function")_7(G,w);else if(typeof w==="function")_7(G,{handler:w,mode:"universal"})}catch(W){console.warn(`Failed to load middleware '${G}' from ${Q}:`,W)}}}function Aq($){let X={};if(!$)return X;let Z=new URLSearchParams($);for(let[J,Y]of Z)X[J]=Y;return X}function A7($,X,Z,J=""){return{path:$,params:X,query:Aq(J),fullPath:J?`${$}?${J}`:$,meta:Z}}function R7($,X,Z,J){let Y=J?.isServer??typeof window>"u",G=!Y,Q=new Headers;return{to:$,from:X,isClient:G,isServer:Y,cookies:Y&&Z?I8(Z,Q):E8(),storage:D8(),state:{},request:Z,responseHeaders:Q}}async function N7($,X){let Z=Array.isArray($)?$:[$],J=X.isServer;for(let Y of Z){let G=y8(Y);if(!G)return console.error(`Route middleware '${Y}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${Y}' is not registered`}},state:X.state,responseHeaders:X.responseHeaders};if(G.mode==="server"&&!J)continue;try{let Q=await G.handler(X);if(Q){if(Q.type==="redirect")return{passed:!1,redirect:Q,state:X.state,responseHeaders:X.responseHeaders};if(Q.type==="abort")return{passed:!1,abort:Q,state:X.state,responseHeaders:X.responseHeaders}}}catch(Q){return console.error(`Error in middleware '${Y}':`,Q),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:Q instanceof Error?Q.message:"Middleware error"}},state:X.state,responseHeaders:X.responseHeaders}}}return{passed:!0,state:X.state,responseHeaders:X.responseHeaders}}var O7;var u6=y(()=>{O7=new Map});function M7($){let Z=$.replace(/\\/g,"/").split("/").filter(Boolean),J=Z.lastIndexOf("layouts"),Y=J>=0?Z[J+1]:Z.at(-1);if(!Y)return"app";return Y.replace(/\.stx$/i,"")||"app"}function d6($){let X=$.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),Z=$.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),J=$.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),Y=X?.[1]||J?.[1]||"";return{layout:Y,group:Z?.[1]||M7(Y)}}function Rq($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function T7(){if(b8)return b8;return b8=Rq(`
5
5
  ;(function(){
6
6
  'use strict';
7
7
  var ROUTER_REV=7;
@@ -1651,8 +1651,8 @@ else {
1651
1651
 
1652
1652
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
1653
1653
  })();
1654
- `),b8}var b8;var m6={};e(m6,{setAppUrl:()=>u9,runMiddleware:()=>N7,route:()=>H7,resolveLayoutChain:()=>M8,resetRoutes:()=>c9,registerMiddleware:()=>_7,patternToRegex:()=>B7,navigateTo:()=>p9,matchRoute:()=>N8,loadMiddlewareFromDirectory:()=>V7,isNonPageRoutePattern:()=>K7,isNonPageRoutePath:()=>S9,hasMiddleware:()=>r9,getRouterScript:()=>T7,getMiddlewareNames:()=>F7,getMiddleware:()=>y8,generateRouteTypes:()=>U7,generateRouteManifest:()=>j7,formatRoutes:()=>h9,findErrorPage:()=>g9,filePathToPattern:()=>R8,extractLayoutMetadata:()=>d6,deriveLayoutGroup:()=>M7,defineRoutes:()=>m9,defineRoute:()=>d9,defineMiddleware:()=>n9,createStorageManager:()=>D8,createServerCookieManager:()=>I8,createRouter:()=>v6,createRouteLocation:()=>A7,createMiddlewareContext:()=>R7,createClientCookieManager:()=>E8,clearMiddleware:()=>L7,bracketPathToRegex:()=>C6,abortNavigation:()=>i9,Router:()=>T5,NON_PAGE_DIRS:()=>q7});var S1=y(()=>{x6();P9();f6();u6();x9();C9();A8()});function k7($,X={}){return new T5($,X).routes}var o9=y(()=>{S1();S1()});function s9($){return`--stx-${$}`}function a9($,X){let Z=X.lastIndexOf("-");if(Z===-1)return typeof $[X]==="string"?$[X]:void 0;let J=$[X.slice(0,Z)];if(!J||typeof J!=="object")return;let Y=J[X.slice(Z+1)];return typeof Y==="string"?Y:void 0}function l6($){let X={};for(let[Z,J]of Object.entries(c6)){let Y=a9($,J.light);if(Y===void 0)continue;X[Z]=`var(${s9(Z)}, ${Y})`}return X}function p6($){let X=[],Z=[];for(let[J,Y]of Object.entries(c6)){let G=a9($,Y.light),Q=a9($,Y.dark);if(G===void 0)continue;if(X.push(` ${s9(J)}: ${G};`),Q!==void 0)Z.push(` ${s9(J)}: ${Q};`)}if(X.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...X,"}",".dark {",...Z,"}",""].join(`
1655
- `)}var c6;var i6=y(()=>{c6={fg:{light:"gray-900",dark:"gray-100",description:"Primary text"},"fg-strong":{light:"gray-700",dark:"gray-300",description:"Labels, secondary headings"},"fg-muted":{light:"gray-600",dark:"gray-400",description:"Supporting text"},"fg-soft":{light:"gray-500",dark:"gray-400",description:"De-emphasised text"},"fg-subtle":{light:"gray-400",dark:"gray-500",description:"Placeholders, disabled text"},surface:{light:"gray-50",dark:"gray-800",description:"Page and panel background"},"surface-raised":{light:"gray-100",dark:"gray-700",description:"Cards, popovers"},"surface-sunken":{light:"gray-200",dark:"gray-700",description:"Wells, track backgrounds"},line:{light:"gray-200",dark:"gray-700",description:"Default border, divider"},"line-strong":{light:"gray-300",dark:"gray-600",description:"Input border, focus ring track"},accent:{light:"indigo-600",dark:"indigo-400",description:"Primary action, selected state"},info:{light:"blue-600",dark:"blue-400",description:"Informational emphasis, links"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-500",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"indigo-600",dark:"indigo-500",description:"Primary button fill"},"info-solid":{light:"blue-600",dark:"blue-500",description:"Informational fill"},"danger-solid":{light:"red-600",dark:"red-500",description:"Destructive button fill"},"success-solid":{light:"green-600",dark:"green-500",description:"Confirmation fill"}}});function n6($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function t9($,X){let Z={...$};for(let[J,Y]of Object.entries(X))Z[J]=n6(Y)&&n6(Z[J])?t9(Z[J],Y):Y;return Z}function r6($={},X={}){let Z=$.theme||{},J=X.theme||{},{extend:Y,...G}=J,{extend:Q,...W}=Z,w=W.colors||{};W.colors={...w,...l6(w)};let q=t9(W,G),K=t9(Q||{},Y||{});if(Object.keys(K).length>0)q.extend=K;let z=[...$.safelist||[],...X.safelist||[]],U={...$.shortcuts||{},...X.shortcuts||{}},j=[...$.preflights||[],...X.preflights||[]];return{config:{...$,...X,theme:q,safelist:z,shortcuts:U,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:z,shortcuts:U,includePreflight:X.preflight!==!1,minify:X.minify===!0,tokenCSS:p6(w)}}var o6=y(()=>{i6()});import I7 from"path";function a6($){s6=$?.trim()||null}function E7(){return process.env[Nq]?.trim()||s6||I5}function A1($=process.cwd(),...X){let Z=E7();return I7.isAbsolute(Z)?I7.join(Z,...X):I7.join($,Z,...X)}function D7($){if(!$||I7.isAbsolute($))return $;let X=$.replace(/\\/g,"/");if(X!==I5&&!X.startsWith(`${I5}/`))return $;let Z=X.slice(I5.length+1);return Z?I7.join(E7(),Z):E7()}var I5=".stx",Nq="STX_DIR",s6=null;var y7=()=>{};var L0;var t6=y(()=>{L0={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 e6=()=>{};function $2($,X,Z,J){let Y=$;Y=Y.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,W,w)=>{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: ${w||K} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return Y=Y.replace(G,(Q,W)=>{return`<span class="sr-only">${W.trim()}</span>`}),Y=Y.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,W,w)=>{return`<span id="${`desc-${W}`}" class="sr-only">${w}</span>`}),Y}var X2,Z2;var e9=y(()=>{e6();X2={name:"a11y",handler:($,X,Z,J)=>{if(!X.length)return $;let Y=X[0].replace(/['"]/g,""),G=X.length>1?X[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"}[Y]||"Make this element accessible";return`<!-- a11y-hint: ${G||W} -->${$}`},hasEndTag:!1},Z2={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function Mq($,X={}){let{duration:Z,delay:J,ease:Y,direction:G,custom:Q}={...R1,...X};if($==="custom"&&Q)return Q;switch($){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);"}
1654
+ `),b8}var b8;var m6={};t(m6,{setAppUrl:()=>u9,runMiddleware:()=>N7,route:()=>H7,resolveLayoutChain:()=>M8,resetRoutes:()=>c9,registerMiddleware:()=>_7,patternToRegex:()=>B7,navigateTo:()=>p9,matchRoute:()=>N8,loadMiddlewareFromDirectory:()=>V7,isNonPageRoutePattern:()=>K7,isNonPageRoutePath:()=>S9,hasMiddleware:()=>r9,getRouterScript:()=>T7,getMiddlewareNames:()=>F7,getMiddleware:()=>y8,generateRouteTypes:()=>U7,generateRouteManifest:()=>j7,formatRoutes:()=>h9,findErrorPage:()=>g9,filePathToPattern:()=>R8,extractLayoutMetadata:()=>d6,deriveLayoutGroup:()=>M7,defineRoutes:()=>m9,defineRoute:()=>d9,defineMiddleware:()=>n9,createStorageManager:()=>D8,createServerCookieManager:()=>I8,createRouter:()=>v6,createRouteLocation:()=>A7,createMiddlewareContext:()=>R7,createClientCookieManager:()=>E8,clearMiddleware:()=>L7,bracketPathToRegex:()=>C6,abortNavigation:()=>i9,Router:()=>M5,NON_PAGE_DIRS:()=>q7});var P1=y(()=>{x6();P9();f6();u6();x9();C9();A8()});function k7($,X={}){return new M5($,X).routes}var o9=y(()=>{P1();P1()});function s9($){return`--stx-${$}`}function a9($,X){let Z=X.lastIndexOf("-");if(Z===-1)return typeof $[X]==="string"?$[X]:void 0;let J=$[X.slice(0,Z)];if(!J||typeof J!=="object")return;let Y=J[X.slice(Z+1)];return typeof Y==="string"?Y:void 0}function l6($){let X={};for(let[Z,J]of Object.entries(c6)){let Y=a9($,J.light);if(Y===void 0)continue;X[Z]=`var(${s9(Z)}, ${Y})`}return X}function p6($){let X=[],Z=[];for(let[J,Y]of Object.entries(c6)){let G=a9($,Y.light),Q=a9($,Y.dark);if(G===void 0)continue;if(X.push(` ${s9(J)}: ${G};`),Q!==void 0)Z.push(` ${s9(J)}: ${Q};`)}if(X.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...X,"}",".dark {",...Z,"}",""].join(`
1655
+ `)}var c6;var i6=y(()=>{c6={fg:{light:"gray-900",dark:"gray-100",description:"Primary text"},"fg-strong":{light:"gray-700",dark:"gray-300",description:"Labels, secondary headings"},"fg-muted":{light:"gray-600",dark:"gray-400",description:"Supporting text"},"fg-soft":{light:"gray-500",dark:"gray-400",description:"De-emphasised text"},"fg-subtle":{light:"gray-400",dark:"gray-500",description:"Placeholders, disabled text"},surface:{light:"gray-50",dark:"gray-800",description:"Page and panel background"},"surface-raised":{light:"gray-100",dark:"gray-700",description:"Cards, popovers"},"surface-sunken":{light:"gray-200",dark:"gray-700",description:"Wells, track backgrounds"},line:{light:"gray-200",dark:"gray-700",description:"Default border, divider"},"line-strong":{light:"gray-300",dark:"gray-600",description:"Input border, focus ring track"},accent:{light:"indigo-600",dark:"indigo-400",description:"Primary action, selected state"},info:{light:"blue-600",dark:"blue-400",description:"Informational emphasis, links"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-500",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"indigo-600",dark:"indigo-500",description:"Primary button fill"},"info-solid":{light:"blue-600",dark:"blue-500",description:"Informational fill"},"danger-solid":{light:"red-600",dark:"red-500",description:"Destructive button fill"},"success-solid":{light:"green-600",dark:"green-500",description:"Confirmation fill"}}});function n6($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function t9($,X){let Z={...$};for(let[J,Y]of Object.entries(X))Z[J]=n6(Y)&&n6(Z[J])?t9(Z[J],Y):Y;return Z}function r6($={},X={}){let Z=$.theme||{},J=X.theme||{},{extend:Y,...G}=J,{extend:Q,...W}=Z,w=W.colors||{};W.colors={...w,...l6(w)};let q=t9(W,G),K=t9(Q||{},Y||{});if(Object.keys(K).length>0)q.extend=K;let z=[...$.safelist||[],...X.safelist||[]],U={...$.shortcuts||{},...X.shortcuts||{}},j=[...$.preflights||[],...X.preflights||[]];return{config:{...$,...X,theme:q,safelist:z,shortcuts:U,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:z,shortcuts:U,includePreflight:X.preflight!==!1,minify:X.minify===!0,tokenCSS:p6(w)}}var o6=y(()=>{i6()});import I7 from"path";function a6($){s6=$?.trim()||null}function E7(){return process.env[Nq]?.trim()||s6||k5}function A1($=process.cwd(),...X){let Z=E7();return I7.isAbsolute(Z)?I7.join(Z,...X):I7.join($,Z,...X)}function D7($){if(!$||I7.isAbsolute($))return $;let X=$.replace(/\\/g,"/");if(X!==k5&&!X.startsWith(`${k5}/`))return $;let Z=X.slice(k5.length+1);return Z?I7.join(E7(),Z):E7()}var k5=".stx",Nq="STX_DIR",s6=null;var y7=()=>{};var O0;var t6=y(()=>{O0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});var e6=()=>{};function $2($,X,Z,J){let Y=$;Y=Y.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,W,w)=>{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: ${w||K} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return Y=Y.replace(G,(Q,W)=>{return`<span class="sr-only">${W.trim()}</span>`}),Y=Y.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,W,w)=>{return`<span id="${`desc-${W}`}" class="sr-only">${w}</span>`}),Y}var X2,Z2;var e9=y(()=>{e6();X2={name:"a11y",handler:($,X,Z,J)=>{if(!X.length)return $;let Y=X[0].replace(/['"]/g,""),G=X.length>1?X[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"}[Y]||"Make this element accessible";return`<!-- a11y-hint: ${G||W} -->${$}`},hasEndTag:!1},Z2={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function Mq($,X={}){let{duration:Z,delay:J,ease:Y,direction:G,custom:Q}={...R1,...X};if($==="custom"&&Q)return Q;switch($){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);"}
1656
1656
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1657
1657
  @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);"}
1658
1658
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1889,7 +1889,7 @@ else {
1889
1889
  </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let w=Iq(),q=Y.lastIndexOf("</body>");if(q!==-1)Y=Y.slice(0,q)+w+`
1890
1890
  `+Y.slice(q)}}return Y}var R1,J2,Y2,G2,Q2;var $4=y(()=>{R1={duration:300,delay:0,ease:"ease",direction:"both"};J2={name:"transition",handler:($,X,Z,J)=>{if(X.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let Y=X[0],G=X.length>1?Number.parseInt(X[1],10)||R1.duration:R1.duration,Q=X.length>2?X[2]||R1.ease:R1.ease,W=X.length>3?Number.parseInt(X[3],10)||R1.delay:R1.delay,w=X.length>4?X[4]||R1.direction:R1.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,K=Mq(Y,{duration:G,delay:W,ease:Q,direction:w}),z="stx-transition",U="";if(Y==="fade")U="stx-fade";else if(Y==="slide")U="stx-slide";else if(Y==="scale")U="stx-scale";else if(Y==="flip")U="stx-flip";else if(Y==="rotate")U="stx-rotate";return`<div id="${q}" class="${z} ${U} ${w==="out"?"stx-out":""}"
1891
1891
  style="--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${W}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},Y2={name:"scrollAnimate",handler:($,X,Z,J)=>{if(X.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let Y=X[0],G=X.length>1?Number.parseInt(X[1],10)||300:300,Q=X.length>2?X[2]||"ease":"ease",W=X.length>3?Number.parseFloat(X[3])||0.2:0.2,w=X.length>4?Number.parseInt(X[4],10)||0:0,q=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,K=`--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${w}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Y==="fade")z+=" stx-fade";else if(Y==="slide-up"||Y==="slide")z+=" stx-from-bottom";else if(Y==="slide-down")z+=" stx-from-top";else if(Y==="slide-left")z+=" stx-from-right";else if(Y==="slide-right")z+=" stx-from-left";else if(Y==="scale")z+=" stx-scale";else if(Y.includes("-"))z+=` stx-${Y}`;else z+=` stx-${Y}`;return`<div id="${q}" class="${z}" style="${K}" data-threshold="${W}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},G2={name:"animationGroup",handler:($,X,Z,J)=>{if(X.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let Y=X[0],G=X.slice(1).map((q)=>q.startsWith("#")||q.startsWith(".")?q:`#${q}`),Q=Z.staggerDelay||50,W=Z.sequence||!0,w=Dq(Y,G,{staggerDelay:Q,sequence:W});return`${$}
1892
- ${w}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Q2={name:"motion",handler:($,X,Z,J)=>{let Y=X.length>0?X[0].toLowerCase()==="true":!0,G=Tq();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});var w2=y(()=>{S1();X4()});async function yq($,X,Z,J){let Y=X[0]?.replace(/['"]/g,"")||"main",G=T7();if(Y!=="main")G=G.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${G}</script>`}var q2;var X4=y(()=>{w2();q2={name:"stxRouter",handler:yq,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function K2($){let X=$.heatmap;if(!X?.enabled)return"";let Z={...bq,...X};return`
1892
+ ${w}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},Q2={name:"motion",handler:($,X,Z,J)=>{let Y=X.length>0?X[0].toLowerCase()==="true":!0,G=Tq();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});var w2=y(()=>{P1();X4()});async function yq($,X,Z,J){let Y=X[0]?.replace(/['"]/g,"")||"main",G=T7();if(Y!=="main")G=G.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${G}</script>`}var q2;var X4=y(()=>{w2();q2={name:"stxRouter",handler:yq,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function K2($){let X=$.heatmap;if(!X?.enabled)return"";let Z={...bq,...X};return`
1893
1893
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1894
1894
  <script>
1895
1895
  (function() {
@@ -2272,10 +2272,10 @@ else {
2272
2272
  };
2273
2273
  })();
2274
2274
  </script>
2275
- `}function z2($,X){let Z=K2(X);if(!Z)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+$.slice(J);return $+Z}function Sq($){let X={},Z=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Z){let[Y,G]=J.split("="),Q=G?.replace(/["']/g,"");switch(Y){case"endpoint":X.endpoint=Q;break;case"samplingRate":X.samplingRate=Number.parseInt(Q,10);break;case"batchSize":X.batchSize=Number.parseInt(Q,10);break;case"trackMouse":X.trackMouse=Q==="true";break;case"trackClicks":X.trackClicks=Q==="true";break;case"trackScroll":X.trackScroll=Q==="true";break;case"honorDnt":X.honorDnt=Q==="true";break;case"debugOverlay":X.debugOverlay=Q==="true";break}}return X}var bq,U2;var Z4=y(()=>{bq={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};U2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,X,Z,J)=>{let Y=Z.__stx_config||{};if(X.length>0){let G=Sq(X.join(" "));Y.heatmap={...Y.heatmap,...G,enabled:!0}}return K2(Y)}}});function C1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function j2($){let X=$.trim().toLowerCase();return!X.startsWith("javascript:")&&!X.startsWith("vbscript:")&&!X.startsWith("data:text/html")}function B2($){let X=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=$.match(X);if(!Z)return{data:{},content:$.trim()};let J=Z[1],Y=$.slice(Z[0].length),G={};for(let Q of J.split(`
2276
- `)){let W=Q.trim();if(!W||W.startsWith("#"))continue;let w=W.indexOf(":");if(w===-1)continue;let q=W.slice(0,w).trim(),K=W.slice(w+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[q]=K}return{data:G,content:Y.trim()}}function b7($,X={}){let{gfm:Z=!0,breaks:J=!1}=X,Y=$,G=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(K,z,U)=>{let j=G.length,B=z?` class="language-${C1(z)}"`:"";return G.push(`<pre><code${B}>${C1(U.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Y=Y.replace(/`([^`]*)`/g,(K,z)=>`<code>${C1(z)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(K,z,U)=>{return`<img src="${j2(U)?C1(U):""}" alt="${C1(z)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,z,U)=>{return`<a href="${j2(U)?C1(U):""}">${z}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
2277
- `),Y=Y.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Y=Y.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Y=Y.replace(/<\/ul>\n<ul>/g,""),Y=Y.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Y=Y.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Y=Y.replace(/<\/ol>\n<ol>/g,""),Y=Y.replace(/<li data-ul>/g,"<li>"),Y=Y.replace(/<li data-ol>/g,"<li>"),Z)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(K,z,U)=>{let B=`<tr>${z.split("|").map((_)=>_.trim()).filter(Boolean).map((_)=>`<th>${C1(_)}</th>`).join("")}</tr>`,H=U.trim().split(`
2278
- `).map((_)=>{return`<tr>${_.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${C1(O)}</td>`).join("")}</tr>`}).join(`
2275
+ `}function z2($,X){let Z=K2(X);if(!Z)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+$.slice(J);return $+Z}function Sq($){let X={},Z=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let J of Z){let[Y,G]=J.split("="),Q=G?.replace(/["']/g,"");switch(Y){case"endpoint":X.endpoint=Q;break;case"samplingRate":X.samplingRate=Number.parseInt(Q,10);break;case"batchSize":X.batchSize=Number.parseInt(Q,10);break;case"trackMouse":X.trackMouse=Q==="true";break;case"trackClicks":X.trackClicks=Q==="true";break;case"trackScroll":X.trackScroll=Q==="true";break;case"honorDnt":X.honorDnt=Q==="true";break;case"debugOverlay":X.debugOverlay=Q==="true";break}}return X}var bq,U2;var Z4=y(()=>{bq={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};U2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,X,Z,J)=>{let Y=Z.__stx_config||{};if(X.length>0){let G=Sq(X.join(" "));Y.heatmap={...Y.heatmap,...G,enabled:!0}}return K2(Y)}}});function v1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function j2($){let X=$.trim().toLowerCase();return!X.startsWith("javascript:")&&!X.startsWith("vbscript:")&&!X.startsWith("data:text/html")}function B2($){let X=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=$.match(X);if(!Z)return{data:{},content:$.trim()};let J=Z[1],Y=$.slice(Z[0].length),G={};for(let Q of J.split(`
2276
+ `)){let W=Q.trim();if(!W||W.startsWith("#"))continue;let w=W.indexOf(":");if(w===-1)continue;let q=W.slice(0,w).trim(),K=W.slice(w+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[q]=K}return{data:G,content:Y.trim()}}function b7($,X={}){let{gfm:Z=!0,breaks:J=!1}=X,Y=$,G=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(K,z,U)=>{let j=G.length,B=z?` class="language-${v1(z)}"`:"";return G.push(`<pre><code${B}>${v1(U.trim())}</code></pre>`),`\x00CODEBLOCK${j}\x00`}),Y=Y.replace(/`([^`]*)`/g,(K,z)=>`<code>${v1(z)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(K,z,U)=>{return`<img src="${j2(U)?v1(U):""}" alt="${v1(z)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,z,U)=>{return`<a href="${j2(U)?v1(U):""}">${z}</a>`}),Y=Y.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Y=Y.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Y=Y.replace(/<\/blockquote>\n<blockquote>/g,`
2277
+ `),Y=Y.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Y=Y.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Y=Y.replace(/<\/ul>\n<ul>/g,""),Y=Y.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Y=Y.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Y=Y.replace(/<\/ol>\n<ol>/g,""),Y=Y.replace(/<li data-ul>/g,"<li>"),Y=Y.replace(/<li data-ol>/g,"<li>"),Z)Y=Y.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(K,z,U)=>{let B=`<tr>${z.split("|").map((_)=>_.trim()).filter(Boolean).map((_)=>`<th>${v1(_)}</th>`).join("")}</tr>`,H=U.trim().split(`
2278
+ `).map((_)=>{return`<tr>${_.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${v1(O)}</td>`).join("")}</tr>`}).join(`
2279
2279
  `);return`<table>
2280
2280
  <thead>
2281
2281
  ${B}
@@ -2290,7 +2290,7 @@ ${H}
2290
2290
  `:`
2291
2291
  `)}</p>`);if(Y=W.join(`
2292
2292
  `),J)Y=Y.replace(/\n/g,`<br />
2293
- `);for(let K=0;K<G.length;K++)Y=Y.replace(`\x00CODEBLOCK${K}\x00`,G[K]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}function E5($="const",X=[],Z){let J=X.length?N1.filter((Y)=>!X.includes(Y)):N1;if(Z!==void 0)J=J.filter((Y)=>{let G=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${$} { ${J.join(", ")} } = window.stx;`}function J4($){if(!$)return!1;return Pq.some((X)=>new RegExp(`\\b${X}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function Y4($){if(!$)return!1;let X=A2($);if(vq.some((Z)=>Z.test(X)))return!0;return J4(X)}function _2($){if(!$)return!1;return xq.test(A2($))||Y4($)}function O2($){return fq.includes($.toLowerCase())}function V2(){return`{${L2.map(($)=>`'${$}':1`).join(",")}}`}function A2($){if(!$)return $;let X=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(J,Y,G)=>Y??" ".repeat(G.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,J,Y,G)=>J+X(Y)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,J,Y,G)=>J+X(Y)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var N1,H2,Cq,Pq,vq,xq,fq,L2,gq,F2;var J1=y(()=>{N1=["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"],H2=["onMount","onDestroy"];Cq=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],Pq=N1.filter(($)=>!Cq.includes($));vq=[/@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/],xq=/\s@[a-z][\w.:-]*\s*=/i;fq=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];L2=["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"],gq=["x-init","x-transition","x-effect","x-on"],F2=[...L2,...gq]});function M2($){let X={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of $){let J=Z.toLowerCase();if(J==="prevent")X.prevent=!0;else if(J==="stop")X.stop=!0;else if(J==="once")X.once=!0;else if(J==="capture")X.capture=!0;else if(J==="self")X.self=!0;else if(J==="passive")X.passive=!0;else if(hq.has(J))X.systemKeys.push(J);else if(J in T2)X.mouse=J;else if(J in N2||/^[a-z]$/.test(J))X.keys.push(N2[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);X.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);X.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return X}function k2($){let X=[],Z=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[G,Q,W]=Y,w=Y.index,q=w+G.length,K=`__stx_evt_${Z++}`,z=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=U.exec(W))!==null){let[,H,_]=j,L=H.split("."),O=L[0];if(!R2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:_,modifiers:M2(L.slice(1)),elementId:K})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(W))!==null){let[,H,_]=j,L=H.split("."),O=L[0];if(!R2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:_,modifiers:M2(L.slice(1)),elementId:K})}if(z.length>0)X.push({originalTag:G,elementId:K,events:z,startIndex:w,endIndex:q})}return X}function uq($){let X=[],{modifiers:Z}=$;if(Z.self)X.push("if ($event.target !== $el) return");for(let J of Z.systemKeys)X.push(`if (!$event.${J}Key) return`);if(Z.keys.length>0){let J=Z.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");X.push(`if (!(${J})) return`)}if(Z.mouse!==null){let J=T2[Z.mouse];X.push(`if ($event.button !== ${J}) return`)}if(Z.prevent)X.push("$event.preventDefault()");if(Z.stop)X.push("$event.stopPropagation()");return X.join("; ")}function dq($,X){let Z=$;if(X.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${X.debounce})`;else if(X.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${X.throttle})`;return Z}function G4($){let X=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(X))return $;return`if (typeof ${X} === 'function' && !${X}._isSignal) ${X}($event);`}function mq($){let{modifiers:X}=$,Z=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=uq($),Y=dq(G4($.handler),X),G=[];if(X.once)G.push("once: true");if(X.capture)G.push("capture: true");if(X.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",W=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2293
+ `);for(let K=0;K<G.length;K++)Y=Y.replace(`\x00CODEBLOCK${K}\x00`,G[K]);return Y=Y.replace(/<p>\s*<\/p>/g,""),Y.trim()}function I5($="const",X=[],Z){let J=X.length?N1.filter((Y)=>!X.includes(Y)):N1;if(Z!==void 0)J=J.filter((Y)=>{let G=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${$} { ${J.join(", ")} } = window.stx;`}function J4($){if(!$)return!1;return Pq.some((X)=>new RegExp(`\\b${X}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function Y4($){if(!$)return!1;let X=A2($);if(vq.some((Z)=>Z.test(X)))return!0;return J4(X)}function _2($){if(!$)return!1;return xq.test(A2($))||Y4($)}function O2($){return fq.includes($.toLowerCase())}function V2(){return`{${L2.map(($)=>`'${$}':1`).join(",")}}`}function A2($){if(!$)return $;let X=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(J,Y,G)=>Y??" ".repeat(G.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,J,Y,G)=>J+X(Y)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,J,Y,G)=>J+X(Y)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var N1,H2,Cq,Pq,vq,xq,fq,L2,gq,F2;var J1=y(()=>{N1=["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"],H2=["onMount","onDestroy"];Cq=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],Pq=N1.filter(($)=>!Cq.includes($));vq=[/@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/],xq=/\s@[a-z][\w.:-]*\s*=/i;fq=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];L2=["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"],gq=["x-init","x-transition","x-effect","x-on"],F2=[...L2,...gq]});function M2($){let X={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of $){let J=Z.toLowerCase();if(J==="prevent")X.prevent=!0;else if(J==="stop")X.stop=!0;else if(J==="once")X.once=!0;else if(J==="capture")X.capture=!0;else if(J==="self")X.self=!0;else if(J==="passive")X.passive=!0;else if(hq.has(J))X.systemKeys.push(J);else if(J in T2)X.mouse=J;else if(J in N2||/^[a-z]$/.test(J))X.keys.push(N2[J]||J.toUpperCase());else if(J.startsWith("debounce")){let Y=J.match(/debounce(?:\.(\d+))?/);X.debounce=Y?.[1]?Number.parseInt(Y[1],10):300}else if(J.startsWith("throttle")){let Y=J.match(/throttle(?:\.(\d+))?/);X.throttle=Y?.[1]?Number.parseInt(Y[1],10):300}}return X}function k2($){let X=[],Z=0,J=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Y;while((Y=J.exec($))!==null){let[G,Q,W]=Y,w=Y.index,q=w+G.length,K=`__stx_evt_${Z++}`,z=[],U=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,j;while((j=U.exec(W))!==null){let[,H,_]=j,L=H.split("."),O=L[0];if(!R2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:_,modifiers:M2(L.slice(1)),elementId:K})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(W))!==null){let[,H,_]=j,L=H.split("."),O=L[0];if(!R2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:_,modifiers:M2(L.slice(1)),elementId:K})}if(z.length>0)X.push({originalTag:G,elementId:K,events:z,startIndex:w,endIndex:q})}return X}function uq($){let X=[],{modifiers:Z}=$;if(Z.self)X.push("if ($event.target !== $el) return");for(let J of Z.systemKeys)X.push(`if (!$event.${J}Key) return`);if(Z.keys.length>0){let J=Z.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");X.push(`if (!(${J})) return`)}if(Z.mouse!==null){let J=T2[Z.mouse];X.push(`if ($event.button !== ${J}) return`)}if(Z.prevent)X.push("$event.preventDefault()");if(Z.stop)X.push("$event.stopPropagation()");return X.join("; ")}function dq($,X){let Z=$;if(X.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${X.debounce})`;else if(X.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${X.throttle})`;return Z}function G4($){let X=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(X))return $;return`if (typeof ${X} === 'function' && !${X}._isSignal) ${X}($event);`}function mq($){let{modifiers:X}=$,Z=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=uq($),Y=dq(G4($.handler),X),G=[];if(X.once)G.push("once: true");if(X.capture)G.push("capture: true");if(X.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",W=Y.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
2294
2294
  (function() {
2295
2295
  var $el = document.getElementById('${Z}');
2296
2296
  if (!$el) return;
@@ -2403,20 +2403,20 @@ else {
2403
2403
  `)}
2404
2404
  })();
2405
2405
  </script>`}function cq($){let X=k2($);if(X.length===0)return{template:$,bindings:[]};let Z=$,J=[];for(let Y=X.length-1;Y>=0;Y--){let G=X[Y],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 w of G.events)w.elementId=W[1]}for(let W of G.events){let w=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`\\s*${w}\\s*=\\s*"[^"]*"`,"g"),K=new RegExp(`\\s*${w}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(q,""),Q=Q.replace(K,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),J.push(...G.events)}return{template:Z,bindings:J}}function I2($,X,Z){if(Y4($))return $;if(X.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:W,bindings:w}=cq($),q=X.__stx_event_bindings||[];return X.__stx_event_bindings=[...q,...w],W}let J=k2($);if(J.length===0)return $;let Y=$;for(let W=J.length-1;W>=0;W--){let w=J[W],q=w.originalTag;if(!q.includes(" id="))q=q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${w.elementId}"`);else{let K=q.match(/id=["']([^"']+)["']/);if(K)for(let z of w.events)z.elementId=K[1]}for(let K of w.events){let z=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");q=q.replace(U,""),q=q.replace(j,"")}Y=Y.slice(0,w.startIndex)+q+Y.slice(w.endIndex)}let G=Q4(J.flatMap((W)=>W.events)),Q=Y.lastIndexOf("</body>");if(Q!==-1)Y=Y.slice(0,Q)+G+`
2406
- `+Y.slice(Q);else Y+=G;return Y}var R2,N2,hq,T2;var W4=y(()=>{J1();R2=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"]),N2={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"},hq=new Set(["ctrl","alt","shift","meta"]),T2={left:0,middle:1,right:2}});function o0($){let X=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(X,(J,Y)=>{return`const { ${Y.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
2406
+ `+Y.slice(Q);else Y+=G;return Y}var R2,N2,hq,T2;var W4=y(()=>{J1();R2=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"]),N2={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"},hq=new Set(["ctrl","alt","shift","meta"]),T2={left:0,middle:1,right:2}});function r0($){let X=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(X,(J,Y)=>{return`const { ${Y.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
2407
2407
  `});let Z=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Z,(J,Y)=>{return`const { ${Y.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__composables
2408
2408
  `}),$}function S8($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function lq($,X){let Z=$[X],J=X+1;while(J<$.length){if($[J]==="\\"){J+=2;continue}if($[J]===Z)return J+1;J++}return $.length}function pq($,X){let Z=X+1;while(Z<$.length){if($[Z]==="\\"){Z+=2;continue}if($[Z]==="`")return Z+1;if($[Z]==="$"&&$[Z+1]==="{"){if(Z=C8($,Z+2),Z<$.length)Z++;continue}Z++}return $.length}function C8($,X){let Z=1,J=X;while(J<$.length){let Y=$[J];if(Y==="\\"){J+=2;continue}if(Y==='"'||Y==="'"){J=lq($,J);continue}if(Y==="`"){J=pq($,J);continue}if(Y==="/"&&$[J+1]==="/"){while(J<$.length&&$[J]!==`
2409
- `)J++;continue}if(Y==="/"&&$[J+1]==="*"){J+=2;while(J<$.length&&$.slice(J,J+2)!=="*/")J++;J+=2;continue}if(Y==="{"){Z++,J++;continue}if(Y==="}"){if(Z--,Z===0)return J;J++;continue}J++}return $.length}function e0($){let X="",Z=0;while(Z<$.length){let J=$.slice(Z,Z+2);if(J==="//"){while(Z<$.length&&$[Z]!==`
2409
+ `)J++;continue}if(Y==="/"&&$[J+1]==="*"){J+=2;while(J<$.length&&$.slice(J,J+2)!=="*/")J++;J+=2;continue}if(Y==="{"){Z++,J++;continue}if(Y==="}"){if(Z--,Z===0)return J;J++;continue}J++}return $.length}function $1($){let X="",Z=0;while(Z<$.length){let J=$.slice(Z,Z+2);if(J==="//"){while(Z<$.length&&$[Z]!==`
2410
2410
  `)X+=" ",Z++;continue}if(J==="/*"){while(Z<$.length&&$.slice(Z,Z+2)!=="*/")X+=$[Z]===`
2411
2411
  `?`
2412
2412
  `:" ",Z++;X+=" ",Z+=2;continue}let Y=$[Z];if(Y==='"'||Y==="'"){let G=Y;X+=" ",Z++;while(Z<$.length&&$[Z]!==G){if($[Z]==="\\"){X+=" ",Z+=2;continue}X+=$[Z]===`
2413
2413
  `?`
2414
- `:" ",Z++}X+=" ",Z++;continue}if(Y==="`"){X+=" ",Z++;while(Z<$.length&&$[Z]!=="`"){if($[Z]==="\\"){X+=" ",Z+=2;continue}if($[Z]==="$"&&$[Z+1]==="{"){let G=Z+2,Q=C8($,G);if(X+=" ",X+=e0($.slice(G,Q)),Q<$.length)X+=" ";Z=Q+1;continue}X+=$[Z]===`
2414
+ `:" ",Z++}X+=" ",Z++;continue}if(Y==="`"){X+=" ",Z++;while(Z<$.length&&$[Z]!=="`"){if($[Z]==="\\"){X+=" ",Z+=2;continue}if($[Z]==="$"&&$[Z+1]==="{"){let G=Z+2,Q=C8($,G);if(X+=" ",X+=$1($.slice(G,Q)),Q<$.length)X+=" ";Z=Q+1;continue}X+=$[Z]===`
2415
2415
  `?`
2416
- `:" ",Z++}X+=" ",Z++;continue}X+=Y,Z++}return X}function iq(){let $=globalThis;return $[E2]??=new Map,$[E2]}function $0($,X){let Z=iq(),J=`${import.meta.url}\x00${$}`,Y=Z.get(J);if(Y)return Y;let G=X();return Z.set(J,G),G.catch(()=>{if(Z.get(J)===G)Z.delete(J)}),G}var E2;var S7=y(()=>{E2=Symbol.for("stx.lazy-module-promises")});function D5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(nq,"<\\/$1")}var nq;var w4=y(()=>{nq=/<\/(script)/gi});import rq from"process";function d0($="STX_PUBLIC_"){let X={},Z={};for(let[J,Y]of Object.entries(rq.env)){if(!J.startsWith($)||Y===void 0)continue;X[`import.meta.env.${J}`]=JSON.stringify(Y),Z[J]=Y}return X["import.meta.env"]=JSON.stringify(Z),X}var P1=()=>{};function oq($){if(!$||typeof $!=="object")return!1;let X=$;return typeof X.message==="string"&&(X.name==="BuildMessage"||X.name==="ResolveMessage"||("position"in X))}function sq($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function P8($,X){let Z=[];for(let J of sq($)){if(oq(J)){let Y=J.position||void 0;Z.push({file:X||Y?.file,line:Y?.line,column:Y?.column,message:J.message??"",lineText:Y?.lineText});continue}Z.push({file:X,message:J instanceof Error?J.message:String(J)})}return Z}function D2($,X){return P8($,X).map((Z)=>{let J=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",Y=Z.lineText?`
2416
+ `:" ",Z++}X+=" ",Z++;continue}X+=Y,Z++}return X}function iq(){let $=globalThis;return $[E2]??=new Map,$[E2]}function X0($,X){let Z=iq(),J=`${import.meta.url}\x00${$}`,Y=Z.get(J);if(Y)return Y;let G=X();return Z.set(J,G),G.catch(()=>{if(Z.get(J)===G)Z.delete(J)}),G}var E2;var S7=y(()=>{E2=Symbol.for("stx.lazy-module-promises")});function E5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(nq,"<\\/$1")}var nq;var w4=y(()=>{nq=/<\/(script)/gi});import rq from"process";function u0($="STX_PUBLIC_"){let X={},Z={};for(let[J,Y]of Object.entries(rq.env)){if(!J.startsWith($)||Y===void 0)continue;X[`import.meta.env.${J}`]=JSON.stringify(Y),Z[J]=Y}return X["import.meta.env"]=JSON.stringify(Z),X}var x1=()=>{};function oq($){if(!$||typeof $!=="object")return!1;let X=$;return typeof X.message==="string"&&(X.name==="BuildMessage"||X.name==="ResolveMessage"||("position"in X))}function sq($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function P8($,X){let Z=[];for(let J of sq($)){if(oq(J)){let Y=J.position||void 0;Z.push({file:X||Y?.file,line:Y?.line,column:Y?.column,message:J.message??"",lineText:Y?.lineText});continue}Z.push({file:X,message:J instanceof Error?J.message:String(J)})}return Z}function D2($,X){return P8($,X).map((Z)=>{let J=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",Y=Z.lineText?`
2417
2417
  ${Z.lineText.trim()}`:"";return J?`${J}: ${Z.message}${Y}`:`${Z.message}${Y}`}).join(`
2418
- `)}var C7={};e(C7,{shouldLogBundlerDiagnostics:()=>C2,setBundlerFallbackMode:()=>tq,resolveBundlerFallback:()=>U4,recordBundleFailure:()=>K4,queueClientBundleBuild:()=>P2,hasUserImports:()=>eq,getBundleFailures:()=>B4,clearBundleFailures:()=>H4,bundleClientScript:()=>XK});import F0 from"path";import i0 from"fs";function C2($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function e1(...$){if(C2())console.log("[stx:bundler]",...$)}function K4($,X,Z){j4.push({filePath:$||"<inline>",message:X,details:Z})}function B4(){return j4.slice()}function H4(){j4.length=0}function tq($){z4=$}function U4(){if(z4)return z4;try{let $=P7.strict;return typeof $==="object"&&$!==null?$.bundlerFallback??"warn":"warn"}catch{return"warn"}}function eq($){let X=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=X.exec($))!==null){let Y=Z[1];if(!y2.some((Q)=>Q.test(Y)))return e1("detected user import:",Y),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=J.exec($))!==null){let Y=Z[1];if(/\.css(?:\?.*)?$/.test(Y))continue;if(!y2.some((Q)=>Q.test(Y)))return e1("detected side-effect import:",Y),!0}return!1}function $K($,X,Z,J){let Y=(G,Q)=>{let W=G===Z?X:F0.dirname(G),w=F0.resolve(W,Q),q=[w,`${w}.ts`,`${w}.tsx`,`${w}.js`,`${w}.mjs`,`${w}.jsx`,F0.join(w,"index.ts"),F0.join(w,"index.tsx"),F0.join(w,"index.js"),F0.join(w,"index.mjs")];for(let K of q)try{if(i0.existsSync(K)&&i0.statSync(K,{throwIfNoEntry:!1})?.isFile())return K}catch{}return w};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(i0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let W=Y(Q.importer,Q.path);return J.add(W),{path:W}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let W=F0.resolve($,Q.path.slice(2)),w=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,F0.join(W,"index.ts"),F0.join(W,"index.tsx"),F0.join(W,"index.js"),F0.join(W,"index.mjs")];for(let q of w)if(i0.existsSync(q)&&i0.statSync(q,{throwIfNoEntry:!1})?.isFile())return e1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",q),J.add(q),{path:q};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=F0.extname(Q.path).toLowerCase(),w=W===".json"?"json":W===".tsx"?"tsx":W===".jsx"?"jsx":W===".ts"||W===".mts"||W===".cts"?"ts":"js";if(Q.path!==Z)J.add(Q.path);return{contents:i0.readFileSync(Q.path,"utf8"),loader:w}})}}}function P2($){let X=globalThis,J=(X[b2]??Promise.resolve()).then($,$);return X[b2]=J.then(()=>{return},()=>{return}),J}async function XK($,X,Z={}){let J=Z.projectRoot||process.cwd(),Y=Z.minify??!1,G=Z.cacheDir||A1(J,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${aq}\x00${$}\x00${X}`);let W=Q.digest("hex").slice(0,12),w=F0.join(G,`${W}.js`),q=F0.join(G,`${W}.deps.json`),K=Bun.file(w);if(await K.exists()){let j=Bun.file(q),B=!0;if(await j.exists())try{let H=JSON.parse(await j.text());if(H.metadataVersion!==S2||!Array.isArray(H.files))B=!1;for(let _ of Array.isArray(H.files)?H.files:[])try{if(i0.statSync(_.path).mtimeMs!==_.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return e1("cache hit:",W),await K.text();e1("cache invalidated by dep change:",W)}let z=q4.get(W);if(z)return await z;let U=P2(()=>ZK($,X,{projectRoot:J,minify:Y,cacheDir:G,hash:W,cachePath:w,depsPath:q}));q4.set(W,U);try{return await U}finally{q4.delete(W)}}async function ZK($,X,Z){let{projectRoot:J,minify:Y,cacheDir:G,hash:Q,cachePath:W,depsPath:w}=Z,q=A1(J,"bundle-tmp"),K=F0.join(q,`${Q}.ts`),z=F0.join(q,"out",Q);i0.mkdirSync(q,{recursive:!0}),i0.mkdirSync(z,{recursive:!0});let U=F0.dirname(X),j=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,_;while((_=B.exec($))!==null){if(_[1])continue;if(_[2])_[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)j.push(V)});else if(_[3])j.push(_[3])}while((_=H.exec($))!==null){if(_[1])continue;j.push(_[2])}let L=j.length>0?`
2419
- export { ${j.join(", ")} }`:"";await Bun.write(K,$+L),e1("bundling:",Q,"from:",F0.basename(X));let O=new Set;try{let F=await Bun.build({entrypoints:[K],outdir:z,target:"browser",format:"esm",minify:Y,plugins:[$K(J,U,K,O)],define:{"process.env.NODE_ENV":Y?'"production"':'"development"',...d0()},root:J});if(!F.success){let D=F.logs.filter((S)=>S.level==="error").map((S)=>S.message).join(", ")||`Unable to bundle ${F0.basename(X)}`,b=P8(F.logs,X||void 0);if(console.warn("[stx:bundler] build failed:",D),K4(X||"",D,b),U4()==="error")throw Error(D);return $}let V="";for(let T of F.outputs){V=await T.text();break}let A=[];for(let T of V.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let D of T[1].split(",")){let b=D.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(b){A.push([b[2],b[1]]);continue}let S=D.trim();if(/^[A-Za-z_$][\w$]*$/.test(S))A.push([S,S])}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 N=`__stxBundle_${Q}`,k=A.map(([T,D])=>`${JSON.stringify(T)}: ${D}`).join(", "),I=A.map(([T])=>`var ${T} = undefined;`).join(`
2418
+ `)}var C7={};t(C7,{shouldLogBundlerDiagnostics:()=>C2,setBundlerFallbackMode:()=>tq,resolveBundlerFallback:()=>U4,recordBundleFailure:()=>K4,queueClientBundleBuild:()=>P2,hasUserImports:()=>eq,getBundleFailures:()=>B4,clearBundleFailures:()=>H4,bundleClientScript:()=>XK});import L0 from"path";import l0 from"fs";function C2($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function t1(...$){if(C2())console.log("[stx:bundler]",...$)}function K4($,X,Z){j4.push({filePath:$||"<inline>",message:X,details:Z})}function B4(){return j4.slice()}function H4(){j4.length=0}function tq($){z4=$}function U4(){if(z4)return z4;try{let $=P7.strict;return typeof $==="object"&&$!==null?$.bundlerFallback??"warn":"warn"}catch{return"warn"}}function eq($){let X=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=X.exec($))!==null){let Y=Z[1];if(!y2.some((Q)=>Q.test(Y)))return t1("detected user import:",Y),!0}let J=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=J.exec($))!==null){let Y=Z[1];if(/\.css(?:\?.*)?$/.test(Y))continue;if(!y2.some((Q)=>Q.test(Y)))return t1("detected side-effect import:",Y),!0}return!1}function $K($,X,Z,J){let Y=(G,Q)=>{let W=G===Z?X:L0.dirname(G),w=L0.resolve(W,Q),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 K of q)try{if(l0.existsSync(K)&&l0.statSync(K,{throwIfNoEntry:!1})?.isFile())return K}catch{}return w};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(l0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let W=Y(Q.importer,Q.path);return J.add(W),{path:W}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let W=L0.resolve($,Q.path.slice(2)),w=[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 q of w)if(l0.existsSync(q)&&l0.statSync(q,{throwIfNoEntry:!1})?.isFile())return t1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",q),J.add(q),{path:q};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(),w=W===".json"?"json":W===".tsx"?"tsx":W===".jsx"?"jsx":W===".ts"||W===".mts"||W===".cts"?"ts":"js";if(Q.path!==Z)J.add(Q.path);return{contents:l0.readFileSync(Q.path,"utf8"),loader:w}})}}}function P2($){let X=globalThis,J=(X[b2]??Promise.resolve()).then($,$);return X[b2]=J.then(()=>{return},()=>{return}),J}async function XK($,X,Z={}){let J=Z.projectRoot||process.cwd(),Y=Z.minify??!1,G=Z.cacheDir||A1(J,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${aq}\x00${$}\x00${X}`);let W=Q.digest("hex").slice(0,12),w=L0.join(G,`${W}.js`),q=L0.join(G,`${W}.deps.json`),K=Bun.file(w);if(await K.exists()){let j=Bun.file(q),B=!0;if(await j.exists())try{let H=JSON.parse(await j.text());if(H.metadataVersion!==S2||!Array.isArray(H.files))B=!1;for(let _ of Array.isArray(H.files)?H.files:[])try{if(l0.statSync(_.path).mtimeMs!==_.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return t1("cache hit:",W),await K.text();t1("cache invalidated by dep change:",W)}let z=q4.get(W);if(z)return await z;let U=P2(()=>ZK($,X,{projectRoot:J,minify:Y,cacheDir:G,hash:W,cachePath:w,depsPath:q}));q4.set(W,U);try{return await U}finally{q4.delete(W)}}async function ZK($,X,Z){let{projectRoot:J,minify:Y,cacheDir:G,hash:Q,cachePath:W,depsPath:w}=Z,q=A1(J,"bundle-tmp"),K=L0.join(q,`${Q}.ts`),z=L0.join(q,"out",Q);l0.mkdirSync(q,{recursive:!0}),l0.mkdirSync(z,{recursive:!0});let U=L0.dirname(X),j=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,_;while((_=B.exec($))!==null){if(_[1])continue;if(_[2])_[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)j.push(V)});else if(_[3])j.push(_[3])}while((_=H.exec($))!==null){if(_[1])continue;j.push(_[2])}let L=j.length>0?`
2419
+ export { ${j.join(", ")} }`:"";await Bun.write(K,$+L),t1("bundling:",Q,"from:",L0.basename(X));let O=new Set;try{let F=await Bun.build({entrypoints:[K],outdir:z,target:"browser",format:"esm",minify:Y,plugins:[$K(J,U,K,O)],define:{"process.env.NODE_ENV":Y?'"production"':'"development"',...u0()},root:J});if(!F.success){let D=F.logs.filter((S)=>S.level==="error").map((S)=>S.message).join(", ")||`Unable to bundle ${L0.basename(X)}`,b=P8(F.logs,X||void 0);if(console.warn("[stx:bundler] build failed:",D),K4(X||"",D,b),U4()==="error")throw Error(D);return $}let V="";for(let T of F.outputs){V=await T.text();break}let A=[];for(let T of V.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let D of T[1].split(",")){let b=D.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(b){A.push([b[2],b[1]]);continue}let S=D.trim();if(/^[A-Za-z_$][\w$]*$/.test(S))A.push([S,S])}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 N=`__stxBundle_${Q}`,k=A.map(([T,D])=>`${JSON.stringify(T)}: ${D}`).join(", "),I=A.map(([T])=>`var ${T} = undefined;`).join(`
2420
2420
  `),M=A.map(([T])=>`${T} = ${N}[${JSON.stringify(T)}];`).join(`
2421
2421
  `);if(V=`${R.join(`
2422
2422
  `)}
@@ -2425,13 +2425,13 @@ var ${N} = (function() {
2425
2425
  ${V}
2426
2426
  return { ${k} };
2427
2427
  })();
2428
- ${M}`.trim(),e1("bundled:",Q,"output:",V.length,"bytes"),j.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${F0.basename(X)} (${Q}); serving the unbundled source and not caching this result`),$;i0.mkdirSync(G,{recursive:!0}),await Bun.write(W,V);let E=Array.from(O).map((T)=>{try{return{path:T,mtimeMs:i0.statSync(T).mtimeMs}}catch{return null}}).filter((T)=>T!==null);return await Bun.write(w,JSON.stringify({metadataVersion:S2,files:E})),V}catch(F){let V=P8(F,X||void 0),A=D2(F,X||void 0);if(console.warn(`[stx:bundler] error: ${A}`),K4(X||"",A,V),U4()==="error")throw F;return $}finally{try{i0.rmSync(K,{force:!0}),i0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var aq=5,S2=1,j4,z4,y2,q4,b2;var y5=y(()=>{P1();y7();M1();j4=[];y2=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];q4=new Map,b2=Symbol.for("stx.client-bundle-build-queue")});var m2={};e(m2,{stripCommentsAndLiterals:()=>e0,renderVendorStyleTags:()=>x8,processClientScript:()=>f7,injectBrowserCoreAutoImports:()=>b5,generateServerDataBridge:()=>f8,generateBrowserAutoImportDestructuring:()=>zK,generateAutoImportDestructuring:()=>_4,findInterpolationEnd:()=>C8,extractBridgeData:()=>x7,extractAndStripCssImports:()=>v8,STX_AUTO_IMPORTS:()=>g2});import $5 from"path";import v7 from"fs";function YK($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Z=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let X=$.match(/^([^/]+)(\/.*)?$/);if(!X)return null;return{pkg:X[1],subpath:X[2]||""}}function GK($,X){let Z=X;while(!0){let J=$5.join(Z,"node_modules",$,"package.json");if(v7.existsSync(J))return $5.dirname(J);let Y=$5.dirname(Z);if(Y===Z)return null;Z=Y}}function QK($,X){if(!$||typeof $!=="object")return null;let Z=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return Z(Y.import);if(typeof Y.default==="object")return Z(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,X))return Z($[X]);let J=null;for(let Y of Object.keys($)){let G=Y.indexOf("*");if(G===-1)continue;let Q=Y.slice(0,G),W=Y.slice(G+1);if(!X.startsWith(Q)||!X.endsWith(W))continue;if(X.length<Q.length+W.length)continue;if(!J||Q.length>J.prefix.length)J={pattern:Y,prefix:Q,suffix:W}}if(J){let Y=X.slice(J.prefix.length,X.length-J.suffix.length),G=Z($[J.pattern]);if(G)return G.replace("*",Y)}return null}function WK($,X){let Z=YK($);if(!Z||!Z.subpath)return null;let J=GK(Z.pkg,X);if(!J)return null;let Y;try{Y=JSON.parse(v7.readFileSync($5.join(J,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=QK(Y.exports,G);if(!Q)return null;let W=$5.resolve(J,Q);return v7.existsSync(W)?W:null}function v8($,X){let Z=X.filePath?$5.dirname(X.filePath):X.projectRoot||process.cwd(),J=X.projectRoot||process.cwd(),Y=new Set,G=[];return{code:$.replace(JK,(W,w)=>{let q;try{if(w.startsWith("./")||w.startsWith("../")||w.startsWith("/")){if(q=w.startsWith("/")?w:$5.resolve(Z,w),!v7.existsSync(q))throw Error(`file not found: ${q}`)}else{let K=null;try{K=Bun.resolveSync(w,J)}catch{K=WK(w,J)}if(!K)throw Error(`could not resolve ${w} (Bun.resolveSync + exports fallback both failed)`);q=K}}catch(K){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(w)} (from ${X.filePath||"<unknown>"}): ${K?.message||K}`),""}if(Y.has(q))return"";Y.add(q);try{let K=v7.readFileSync(q,"utf8");G.push({source:w,resolvedPath:q,contents:K})}catch(K){console.warn(`[stx:vendor-css] could not read ${q}: ${K?.message||K}`)}return""}),styles:G}}function wK($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function x8($){if($.length===0)return"";return`${$.map((X)=>{return`<style data-stx-vendor="${wK(X.source)}" data-stx-layer="vendor">
2428
+ ${M}`.trim(),t1("bundled:",Q,"output:",V.length,"bytes"),j.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${L0.basename(X)} (${Q}); serving the unbundled source and not caching this result`),$;l0.mkdirSync(G,{recursive:!0}),await Bun.write(W,V);let E=Array.from(O).map((T)=>{try{return{path:T,mtimeMs:l0.statSync(T).mtimeMs}}catch{return null}}).filter((T)=>T!==null);return await Bun.write(w,JSON.stringify({metadataVersion:S2,files:E})),V}catch(F){let V=P8(F,X||void 0),A=D2(F,X||void 0);if(console.warn(`[stx:bundler] error: ${A}`),K4(X||"",A,V),U4()==="error")throw F;return $}finally{try{l0.rmSync(K,{force:!0}),l0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var aq=5,S2=1,j4,z4,y2,q4,b2;var D5=y(()=>{x1();y7();M1();j4=[];y2=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];q4=new Map,b2=Symbol.for("stx.client-bundle-build-queue")});var m2={};t(m2,{stripCommentsAndLiterals:()=>$1,renderVendorStyleTags:()=>x8,processClientScript:()=>f7,injectBrowserCoreAutoImports:()=>y5,generateServerDataBridge:()=>f8,generateBrowserAutoImportDestructuring:()=>zK,generateAutoImportDestructuring:()=>_4,findInterpolationEnd:()=>C8,extractBridgeData:()=>x7,extractAndStripCssImports:()=>v8,STX_AUTO_IMPORTS:()=>g2});import e1 from"path";import v7 from"fs";function YK($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Z=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let X=$.match(/^([^/]+)(\/.*)?$/);if(!X)return null;return{pkg:X[1],subpath:X[2]||""}}function GK($,X){let Z=X;while(!0){let J=e1.join(Z,"node_modules",$,"package.json");if(v7.existsSync(J))return e1.dirname(J);let Y=e1.dirname(Z);if(Y===Z)return null;Z=Y}}function QK($,X){if(!$||typeof $!=="object")return null;let Z=(Y)=>{if(typeof Y==="string")return Y;if(Y&&typeof Y==="object"){if(typeof Y.import==="string")return Y.import;if(typeof Y.default==="string")return Y.default;if(typeof Y.import==="object")return Z(Y.import);if(typeof Y.default==="object")return Z(Y.default)}return null};if(Object.prototype.hasOwnProperty.call($,X))return Z($[X]);let J=null;for(let Y of Object.keys($)){let G=Y.indexOf("*");if(G===-1)continue;let Q=Y.slice(0,G),W=Y.slice(G+1);if(!X.startsWith(Q)||!X.endsWith(W))continue;if(X.length<Q.length+W.length)continue;if(!J||Q.length>J.prefix.length)J={pattern:Y,prefix:Q,suffix:W}}if(J){let Y=X.slice(J.prefix.length,X.length-J.suffix.length),G=Z($[J.pattern]);if(G)return G.replace("*",Y)}return null}function WK($,X){let Z=YK($);if(!Z||!Z.subpath)return null;let J=GK(Z.pkg,X);if(!J)return null;let Y;try{Y=JSON.parse(v7.readFileSync(e1.join(J,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=QK(Y.exports,G);if(!Q)return null;let W=e1.resolve(J,Q);return v7.existsSync(W)?W:null}function v8($,X){let Z=X.filePath?e1.dirname(X.filePath):X.projectRoot||process.cwd(),J=X.projectRoot||process.cwd(),Y=new Set,G=[];return{code:$.replace(JK,(W,w)=>{let q;try{if(w.startsWith("./")||w.startsWith("../")||w.startsWith("/")){if(q=w.startsWith("/")?w:e1.resolve(Z,w),!v7.existsSync(q))throw Error(`file not found: ${q}`)}else{let K=null;try{K=Bun.resolveSync(w,J)}catch{K=WK(w,J)}if(!K)throw Error(`could not resolve ${w} (Bun.resolveSync + exports fallback both failed)`);q=K}}catch(K){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(w)} (from ${X.filePath||"<unknown>"}): ${K?.message||K}`),""}if(Y.has(q))return"";Y.add(q);try{let K=v7.readFileSync(q,"utf8");G.push({source:w,resolvedPath:q,contents:K})}catch(K){console.warn(`[stx:vendor-css] could not read ${q}: ${K?.message||K}`)}return""}),styles:G}}function wK($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function x8($){if($.length===0)return"";return`${$.map((X)=>{return`<style data-stx-vendor="${wK(X.source)}" data-stx-layer="vendor">
2429
2429
  @layer vendor {
2430
2430
  ${X.contents}
2431
2431
  }
2432
2432
  </style>`}).join(`
2433
2433
  `)}
2434
- `}function b5($){let X=e0($),Z=new Set;for(let W of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let w of W[1].split(",")){let q=w.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)Z.add(q)}let J=new Set;for(let W of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))J.add(W[1]);for(let W of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let w of W[1].split(",")){let q=w.trim().split(/[:=]/).pop()?.trim();if(q)J.add(q)}let Y=h2.filter((W)=>{if(Z.has(W)||J.has(W))return!1;return new RegExp(`\\b${W}\\s*\\(`).test(X)}),G=u2(X).filter((W)=>!Z.has(W)&&!J.has(W));if(Y.length===0&&G.length===0)return{code:$,imports:Y,models:G};return{code:`${[Y.length>0?`import { ${Y.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2434
+ `}function y5($){let X=$1($),Z=new Set;for(let W of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let w of W[1].split(",")){let q=w.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(q)Z.add(q)}let J=new Set;for(let W of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))J.add(W[1]);for(let W of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let w of W[1].split(",")){let q=w.trim().split(/[:=]/).pop()?.trim();if(q)J.add(q)}let Y=h2.filter((W)=>{if(Z.has(W)||J.has(W))return!1;return new RegExp(`\\b${W}\\s*\\(`).test(X)}),G=u2(X).filter((W)=>!Z.has(W)&&!J.has(W));if(Y.length===0&&G.length===0)return{code:$,imports:Y,models:G};return{code:`${[Y.length>0?`import { ${Y.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
2435
2435
  `)}
2436
2436
  ${$}`,imports:Y,models:G}}function u2($){let X=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,J;while((J=Z.exec($))!==null)if(!qK.has(J[1]))X.add(J[1]);return Array.from(X)}function KK($){let X=new Set;for(let Z of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))X.add(Z[1]);for(let Z of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of Z[1].split(",")){let Y=J.trim().split(/[:=]/).pop()?.trim();if(Y&&/^[A-Za-z_$][\w$]*$/.test(Y))X.add(Y)}return X}function d2($){let X=new Set,Z=new Set,J=$;J=J.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let Y=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($))!==null){let q=Q[1],K=Q[2];if(Q[0].includes("import type"))continue;let z=[];for(let j of q.split(",")){let B=j.trim();if(!B||B.startsWith("type "))continue;let H=B.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!H)continue;let _=H[1],L=H[2]||_;if(Y.add(_),Y.add(L),K==="stx"||K==="@stacksjs/stx")X.add(_);else Z.add(_);if(L!==_)z.push(`${L} = ${_}`)}let U=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(Q[0],U)}let W=KK(J);for(let q of g2){if(Y.has(q)||W.has(q))continue;if(new RegExp(`\\b${q}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(J))X.add(q)}for(let q of h2){if(Y.has(q)||W.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Z.add(q)}let w=u2(J);for(let q of w)if(!Y.has(q)&&!W.has(q))Z.add(q);return{code:J,stxImports:Array.from(X),browserImports:Array.from(Z)}}function _4($,X){let Z=[];if($.length>0)Z.push(` var { ${$.join(", ")} } = window.stx || window;`);if(X.length>0)Z.push(` var { ${X.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
2437
2437
  ${Z.join(`
@@ -2445,7 +2445,7 @@ ${UK($,X)}`;return""}function zK($,X=[]){let{browserImports:Z}=d2($),J=new Set(X
2445
2445
  + 'or it should be imported from a relative path so the bundler includes it.'
2446
2446
  );
2447
2447
  });
2448
- `}function x7($){let X=$.__stxClientPayload;if(X&&typeof X==="object"){let J={};for(let Y in X){let G=X[Y];if(typeof G==="function")continue;J[Y]=G}return J.__stxDeclaredPayload=!0,J}let Z={};for(let J in $){if(J.startsWith("__")||J.startsWith("$"))continue;let Y=$[J];if(typeof Y==="function")continue;Z[J]=Y}return Z}function v2($,X){let Z=new Set;for(let J of $.split(",")){let Y=J.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(X){let G=Y.lastIndexOf(":");if(G!==-1)Y=Y.slice(G+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function jK($,X){if(new RegExp(`(?:const|let|var|function|class)\\s+${X}\\b`).test($))return!0;for(let Z of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(v2(Z[1],!0).has(X))return!0;for(let Z of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(v2(Z[1],!1).has(X))return!0;return!1}function BK($,X){return new RegExp(`(?<![.#\\w$])${X}(?![\\w$])`).test($)}function _K($,X){let Z=HK.test($),J=X.length>32768;if(!Z&&!J)return;if(x2.has($))return;if(x2.add($),Z)console.warn(`[stx] server\u2192client bridge is publishing "${$}" 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(J)console.warn(`[stx] server\u2192client bridge is publishing ${(X.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function f8($,X){if(!X)return"";let Z=e0($),J=X.__stxDeclaredPayload===!0,Y=[];for(let[G,Q]of Object.entries(X)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!J&&!BK(Z,G))continue;if(jK($,G))continue;let W;try{W=JSON.stringify(Q)}catch{continue}if(W===void 0)continue;_K(G,W),Y.push(` var ${G} = ${W.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2448
+ `}function x7($){let X=$.__stxClientPayload;if(X&&typeof X==="object"){let J={};for(let Y in X){let G=X[Y];if(typeof G==="function")continue;J[Y]=G}return J.__stxDeclaredPayload=!0,J}let Z={};for(let J in $){if(J.startsWith("__")||J.startsWith("$"))continue;let Y=$[J];if(typeof Y==="function")continue;Z[J]=Y}return Z}function v2($,X){let Z=new Set;for(let J of $.split(",")){let Y=J.trim().replace(/^\.\.\./,"").trim();if(!Y)continue;if(X){let G=Y.lastIndexOf(":");if(G!==-1)Y=Y.slice(G+1).trim()}if(Y=Y.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Y))Z.add(Y)}return Z}function jK($,X){if(new RegExp(`(?:const|let|var|function|class)\\s+${X}\\b`).test($))return!0;for(let Z of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(v2(Z[1],!0).has(X))return!0;for(let Z of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(v2(Z[1],!1).has(X))return!0;return!1}function BK($,X){return new RegExp(`(?<![.#\\w$])${X}(?![\\w$])`).test($)}function _K($,X){let Z=HK.test($),J=X.length>32768;if(!Z&&!J)return;if(x2.has($))return;if(x2.add($),Z)console.warn(`[stx] server\u2192client bridge is publishing "${$}" 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(J)console.warn(`[stx] server\u2192client bridge is publishing ${(X.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function f8($,X){if(!X)return"";let Z=$1($),J=X.__stxDeclaredPayload===!0,Y=[];for(let[G,Q]of Object.entries(X)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!J&&!BK(Z,G))continue;if(jK($,G))continue;let W;try{W=JSON.stringify(Q)}catch{continue}if(W===void 0)continue;_K(G,W),Y.push(` var ${G} = ${W.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
2449
2449
  ${Y.join(`
2450
2450
  `)}
2451
2451
  `}function LK($){let X=[];if($.self)X.push("if ($event.target !== $el) return");for(let Z of $.systemKeys)X.push(`if (!$event.${Z}Key) return`);if($.keys.length>0){let Z=$.keys.map((J)=>`$event.key === '${J}'`).join(" || ");X.push(`if (!(${Z})) return`)}if($.mouse!==null){let Z=OK[$.mouse];X.push(`if ($event.button !== ${Z}) return`)}if($.prevent)X.push("$event.preventDefault()");if($.stop)X.push("$event.stopPropagation()");return X.join("; ")}function FK($,X){let{elementId:Z,event:J,modifiers:Y}=$,G=G4($.handler),Q=LK(Y),W=[];if(Y.once)W.push("once: true");if(Y.capture)W.push("capture: true");if(Y.passive)W.push("passive: true");let w=W.length>0?`, { ${W.join(", ")} }`:"",q="";if(Q)q+=`${Q}; `;let K=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
@@ -2495,21 +2495,21 @@ else {
2495
2495
  // STX: auto-generated event bindings
2496
2496
  ${$.map((Z,J)=>FK(Z,J)).join(`
2497
2497
  `)}`}function f2($){let X=[],Z=new Set,J=$.replace(/^\s*import\s+.*$/gm,""),Y=0,G=J.length,Q=0;while(Q<G){let W=J[Q];if(W==="'"||W==='"'||W==="`"){let w=W;if(Q++,w==="`"){let q=0;while(Q<G){if(J[Q]==="\\"){Q+=2;continue}if(J[Q]==="`"&&q===0){Q++;break}if(J[Q]==="$"&&J[Q+1]==="{"){q++,Q+=2;continue}if(J[Q]==="}"&&q>0){q--,Q++;continue}Q++}}else while(Q<G){if(J[Q]==="\\"){Q+=2;continue}if(J[Q]===w){Q++;break}Q++}continue}if(W==="/"&&J[Q+1]==="/"){while(Q<G&&J[Q]!==`
2498
- `)Q++;continue}if(W==="/"&&J[Q+1]==="*"){Q+=2;while(Q<G-1&&!(J[Q]==="*"&&J[Q+1]==="/"))Q++;Q+=2;continue}if(W==="{"){Y++,Q++;continue}if(W==="}"){Y--,Q++;continue}if(Y===0){let w=J.slice(Q),q=w.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let U=q[1];if(!U.startsWith("_")&&!Z.has(U))X.push(U),Z.add(U);Q+=q[0].length;continue}let K=w.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[1].split(",").forEach((U)=>{let j=U.trim(),B=j.indexOf(":"),H=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Z.has(H))X.push(H),Z.add(H)}),Q+=K[0].length;continue}let z=w.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let U=z[1];if(!U.startsWith("_")&&!Z.has(U))X.push(U),Z.add(U);Q+=z[0].length;continue}}Q++}return X}function RK($){let X=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(U){let j;while((j=Z.exec(U))!==null){let B=j[0];if(!AK.has(B))X.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,G;while((G=Y.exec($))!==null)J(G[1]);let Q=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((G=Q.exec($))!==null)J(G[1]);let W=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((G=W.exec($))!==null)J(G[1]);let w=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=w.exec($))!==null)J(G[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=q.exec($))!==null)J(G[1]);let K=/@model\s*=\s*["']([^"']*)["']/gi;while((G=K.exec($))!==null)J(G[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((G=z.exec($))!==null)J(G[1]);return X}async function f7($,X={}){let Z=$,J="",Y=!1,G=[],Q=v8(Z,{filePath:X.filePath,projectRoot:X.projectRoot});Z=Q.code;let W=x8(Q.styles),w=b5(Z);Z=w.code,G=[...w.imports,...w.models];let{hasUserImports:q,bundleClientScript:K}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (y5(),C7)));if(q(Z))Z=await K(Z,X.filePath||"",{projectRoot:X.projectRoot,minify:X.production}),Y=!0;if(X.autoImports!==!1){let O=d2(Z);Z=O.code,J=_4(O.stxImports,O.browserImports.filter((F)=>!G.includes(F)))}if(J=`${f8(Z,X.serverData)}${J}`,Z=o0(Z),!Y&&X5(X.attrs||""))Z=Z5(Z);let z=VK(X.eventBindings||[]),U=(X.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(U)){let O=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${W}<script ${F}>
2499
- ${D5(`${J}${Z}
2498
+ `)Q++;continue}if(W==="/"&&J[Q+1]==="*"){Q+=2;while(Q<G-1&&!(J[Q]==="*"&&J[Q+1]==="/"))Q++;Q+=2;continue}if(W==="{"){Y++,Q++;continue}if(W==="}"){Y--,Q++;continue}if(Y===0){let w=J.slice(Q),q=w.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(q){let U=q[1];if(!U.startsWith("_")&&!Z.has(U))X.push(U),Z.add(U);Q+=q[0].length;continue}let K=w.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[1].split(",").forEach((U)=>{let j=U.trim(),B=j.indexOf(":"),H=B>=0?j.slice(B+1).trim().split(/[\s=]/)[0]:j.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Z.has(H))X.push(H),Z.add(H)}),Q+=K[0].length;continue}let z=w.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let U=z[1];if(!U.startsWith("_")&&!Z.has(U))X.push(U),Z.add(U);Q+=z[0].length;continue}}Q++}return X}function RK($){let X=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(U){let j;while((j=Z.exec(U))!==null){let B=j[0];if(!AK.has(B))X.add(B)}}let Y=/\{\{([\s\S]*?)\}\}/g,G;while((G=Y.exec($))!==null)J(G[1]);let Q=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((G=Q.exec($))!==null)J(G[1]);let W=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((G=W.exec($))!==null)J(G[1]);let w=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=w.exec($))!==null)J(G[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=q.exec($))!==null)J(G[1]);let K=/@model\s*=\s*["']([^"']*)["']/gi;while((G=K.exec($))!==null)J(G[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((G=z.exec($))!==null)J(G[1]);return X}async function f7($,X={}){let Z=$,J="",Y=!1,G=[],Q=v8(Z,{filePath:X.filePath,projectRoot:X.projectRoot});Z=Q.code;let W=x8(Q.styles),w=y5(Z);Z=w.code,G=[...w.imports,...w.models];let{hasUserImports:q,bundleClientScript:K}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (D5(),C7)));if(q(Z))Z=await K(Z,X.filePath||"",{projectRoot:X.projectRoot,minify:X.production}),Y=!0;if(X.autoImports!==!1){let O=d2(Z);Z=O.code,J=_4(O.stxImports,O.browserImports.filter((F)=>!G.includes(F)))}if(J=`${f8(Z,X.serverData)}${J}`,Z=r0(Z),!Y&&$5(X.attrs||""))Z=X5(Z);let z=VK(X.eventBindings||[]),U=(X.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(U)){let O=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${W}<script ${F}>
2499
+ ${E5(`${J}${Z}
2500
2500
  ${z}`)}
2501
2501
  </script>`}let B=J4($),H=/function __stx_setup_/.test(Z),_=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function L(O){let F=O.length>0?`
2502
2502
  return { ${O.join(", ")} };`:"";return`${W}<script data-stx-scoped data-stx-run="always">
2503
2503
  window.stx.mount(function() {
2504
2504
  'use strict';
2505
- ${D5(`${J}${Z}
2505
+ ${E5(`${J}${Z}
2506
2506
  ${z}${F}`)}
2507
2507
  })</script>`}if(!_&&!H){if(B)return L(f2($));if(X.templateContent){let O=f2($);if(O.length>0){let F=RK(X.templateContent);if(O.some((A)=>F.has(A)))return L(O)}}}return`${W}<script data-stx-scoped data-stx-run="always">
2508
2508
  ;(function() {
2509
2509
  'use strict';
2510
- ${D5(`${J}${Z}
2510
+ ${E5(`${J}${Z}
2511
2511
  ${z}`)}
2512
- })()</script>`}var JK,g2,h2,qK,HK,x2,OK,AK;var g7=y(()=>{W4();V0();S7();J1();w4();JK=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;g2=N1,h2=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useTimeoutFn"];qK=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"]);HK=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,x2=new Set;OK={left:0,middle:1,right:2};AK=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 NK}from"crypto";function c2($){let X=$[g8];return X instanceof Map?X:null}function l2($){$[g8]=new Map}function p2($,X){let Z=c2($);if(!Z)return null;let J=NK("sha256").update(X).digest("hex").slice(0,16),Y=Z.get(J);if(Y)Y.instances++;else Z.set(J,{body:X,instances:1});return J}function i2($,X){let Z=c2(X);if(!Z?.size)return $;let J=$;for(let[w,q]of Z){if(q.instances!==1)continue;let K=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(w)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(K,(z,U)=>`(${q.body})(${U});`)}let Y=[...Z].filter(([,w])=>w.instances>1);if(Y.length===0)return J;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2512
+ })()</script>`}var JK,g2,h2,qK,HK,x2,OK,AK;var g7=y(()=>{W4();F0();S7();J1();w4();JK=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;g2=N1,h2=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useTimeoutFn"];qK=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"]);HK=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,x2=new Set;OK={left:0,middle:1,right:2};AK=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 NK}from"crypto";function c2($){let X=$[g8];return X instanceof Map?X:null}function l2($){$[g8]=new Map}function p2($,X){let Z=c2($);if(!Z)return null;let J=NK("sha256").update(X).digest("hex").slice(0,16),Y=Z.get(J);if(Y)Y.instances++;else Z.set(J,{body:X,instances:1});return J}function i2($,X){let Z=c2(X);if(!Z?.size)return $;let J=$;for(let[w,q]of Z){if(q.instances!==1)continue;let K=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(w)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(K,(z,U)=>`(${q.body})(${U});`)}let Y=[...Z].filter(([,w])=>w.instances>1);if(Y.length===0)return J;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2513
2513
  (function() {
2514
2514
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
2515
2515
  ${Y.map(([w,q])=>` try { factories[${JSON.stringify(w)}] = factories[${JSON.stringify(w)}] || ${q.body}; }
@@ -2518,7 +2518,7 @@ ${Y.map(([w,q])=>` try { factories[${JSON.stringify(w)}] = factories[${JSON.str
2518
2518
  })();
2519
2519
  </script>`,W=J.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(W<0)return`${Q}
2520
2520
  ${J}`;return`${J.slice(0,W)}${Q}
2521
- ${J.slice(W)}`}var g8="__stx_component_client_factories";var O4=()=>{};function IK($){let X="",Z=null,J=!1;for(let Y=0;Y<$.length;Y++){let G=$[Y];if(J){J=!1;continue}if(G==="\\"&&Z){J=!0;continue}if(Z){if(Z==="`"&&G==="$"&&Y+1<$.length&&$[Y+1]==="{"){let Q=1;Y+=2;while(Y<$.length&&Q>0){if($[Y]==="{")Q++;else if($[Y]==="}")Q--;if(Q>0)X+=$[Y],Y++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}X+=G}return X}function EK($,X){let Z=/[$A-Z_a-z][$\w]*/g,J;while((J=Z.exec($))!==null){let Y=J[0],G=$[J.index-1];if(TK.has(Y))throw Error(`Potentially unsafe expression (matched /\\b${Y}\\b/; identifier ${Y}): ${X}`);if(G==="."&&s2.has(Y))throw Error(`Potentially unsafe expression (matched /.${Y}/; property ${Y}): ${X}`)}}function DK($){let X=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=X.exec($))!==null){let J=Z[2];if(!s2.has(J))continue;let Y=$.slice(0,Z.index).match(/\S(?=\s*$)/)?.[0],G=$.slice(Z.index+Z[0].length).match(/^\s*(\S)/)?.[1];if(!((Y==="{"||Y===",")&&G===":"))throw Error(`Potentially unsafe expression (bracket key ${Z[2]}): ${$}`)}}function h8($){let X=$.trim(),Z=IK(X);EK(Z,X),DK(X);for(let J of o2)if(J.test(Z))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${X}`);if(!r2.allowBracketNotation&&kK.test(X))throw Error(`Bracket notation with strings not allowed: ${X}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return X}function yK($){let X={};X.Math=Math,X.JSON=JSON,X.Date=Date,X.String=String,X.Number=Number,X.Boolean=Boolean,X.Array=Array,X.parseInt=Number.parseInt,X.parseFloat=Number.parseFloat,X.isNaN=Number.isNaN,X.isFinite=Number.isFinite,X.encodeURIComponent=encodeURIComponent,X.decodeURIComponent=decodeURIComponent;for(let[Z,J]of Object.entries($)){if(Z.startsWith("__")||o2.some((Y)=>Y.test(Z)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))X[Z]=L4(J);else X[Z]=J}return X}function L4($,X=0){if(X>=r2.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>L4(J,X+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Z={};for(let[J,Y]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(Y&&typeof Y==="object")Z[J]=L4(Y,X+1);else Z[J]=Y}return Z}function Q0($,X){try{let Z=yK(X),J=Object.keys(Z),Y=Object.values(Z);return z0($,J)(...Y)}catch{return}}function K0($){try{return h8($),!0}catch{return!1}}function y0($,X){try{let Z=Q0($,X);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function z0($,X){let Z=h8($),J=/^[A-Za-z_$][\w$]*$/,Y=[],G=[];for(let q=0;q<X.length;q++){let K=X[q];if(!J.test(K))continue;if(a2.has(K))continue;Y.push(q),G.push(K)}let Q=(q)=>Function(...G,...q,`
2521
+ ${J.slice(W)}`}var g8="__stx_component_client_factories";var O4=()=>{};function IK($){let X="",Z=null,J=!1;for(let Y=0;Y<$.length;Y++){let G=$[Y];if(J){J=!1;continue}if(G==="\\"&&Z){J=!0;continue}if(Z){if(Z==="`"&&G==="$"&&Y+1<$.length&&$[Y+1]==="{"){let Q=1;Y+=2;while(Y<$.length&&Q>0){if($[Y]==="{")Q++;else if($[Y]==="}")Q--;if(Q>0)X+=$[Y],Y++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}X+=G}return X}function EK($,X){let Z=/[$A-Z_a-z][$\w]*/g,J;while((J=Z.exec($))!==null){let Y=J[0],G=$[J.index-1];if(TK.has(Y))throw Error(`Potentially unsafe expression (matched /\\b${Y}\\b/; identifier ${Y}): ${X}`);if(G==="."&&s2.has(Y))throw Error(`Potentially unsafe expression (matched /.${Y}/; property ${Y}): ${X}`)}}function DK($){let X=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=X.exec($))!==null){let J=Z[2];if(!s2.has(J))continue;let Y=$.slice(0,Z.index).match(/\S(?=\s*$)/)?.[0],G=$.slice(Z.index+Z[0].length).match(/^\s*(\S)/)?.[1];if(!((Y==="{"||Y===",")&&G===":"))throw Error(`Potentially unsafe expression (bracket key ${Z[2]}): ${$}`)}}function h8($){let X=$.trim(),Z=IK(X);EK(Z,X),DK(X);for(let J of o2)if(J.test(Z))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${X}`);if(!r2.allowBracketNotation&&kK.test(X))throw Error(`Bracket notation with strings not allowed: ${X}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return X}function yK($){let X={};X.Math=Math,X.JSON=JSON,X.Date=Date,X.String=String,X.Number=Number,X.Boolean=Boolean,X.Array=Array,X.parseInt=Number.parseInt,X.parseFloat=Number.parseFloat,X.isNaN=Number.isNaN,X.isFinite=Number.isFinite,X.encodeURIComponent=encodeURIComponent,X.decodeURIComponent=decodeURIComponent;for(let[Z,J]of Object.entries($)){if(Z.startsWith("__")||o2.some((Y)=>Y.test(Z)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))X[Z]=L4(J);else X[Z]=J}return X}function L4($,X=0){if(X>=r2.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>L4(J,X+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Z={};for(let[J,Y]of Object.entries($)){if(J.startsWith("__")||J==="constructor"||J==="prototype")continue;if(Y&&typeof Y==="object")Z[J]=L4(Y,X+1);else Z[J]=Y}return Z}function W0($,X){try{let Z=yK(X),J=Object.keys(Z),Y=Object.values(Z);return j0($,J)(...Y)}catch{return}}function U0($){try{return h8($),!0}catch{return!1}}function E0($,X){try{let Z=W0($,X);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function j0($,X){let Z=h8($),J=/^[A-Za-z_$][\w$]*$/,Y=[],G=[];for(let q=0;q<X.length;q++){let K=X[q];if(!J.test(K))continue;if(a2.has(K))continue;Y.push(q),G.push(K)}let Q=(q)=>Function(...G,...q,`
2522
2522
  'use strict';
2523
2523
  try {
2524
2524
  return ${Z};
@@ -2529,7 +2529,7 @@ catch (e) {
2529
2529
  }
2530
2530
  throw e;
2531
2531
  }
2532
- `),W=Q([]);if(G.length===X.length)return n2(W,G,Q);return n2((...q)=>{let K=Array(Y.length);for(let z=0;z<Y.length;z++)K[z]=q[Y[z]];return W(...K)},G,Q,(q)=>{W=Q(q)})}function n2($,X,Z,J){let G=/^(\w+) is not defined$/,Q=$,W=[],w=new Set(X);return(...q)=>{for(let K=0;K<=8;K++)try{return Q(...q)}catch(z){let U=z instanceof Error?z.message:"",j=G.exec(U);if(!(z instanceof ReferenceError)||!j)return;let B=j[1];if(w.has(B)||a2.has(B))return;w.add(B),W.push(B),Q=Z(W),J?.(W)}return}}function u8($){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 J of Z)if(J.test(X))return!1;return!0}var MK,r2,o2,TK,s2,kK,a2;var b0=y(()=>{MK={maxSanitizeDepth:10,allowBracketNotation:!1},r2={...MK},o2=[/\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"]),s2=new Set(["__proto__","constructor","prototype"]),kK=/[\w)\]]\s*\[\s*['"]/;a2=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 d8($,X){let Z=bK++,J=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return SK.set(J,{type:$,expression:X}),J}var bK=0,SK;var t2=y(()=>{SK=new Map});function JZ($,X,Z,J){Z.lastIndex=X;let Y=Z.exec($);if(!Y||Y.index!==X)return-1;J.lastIndex=Z.lastIndex;let G=J.exec($);if(!G)return-1;return G.index+G[0].length}function v1($,X){return JZ($,X,e2,$Z)}function S5($,X){return JZ($,X,XZ,ZZ)}function h7($,X){if(!$.startsWith("<!--",X))return-1;let Z=$.indexOf("-->",X+4);if(Z===-1)return-1;return Z+3}function CK($,X){if($.startsWith("<!--",X)){let Z=h7($,X);return Z===-1?$.length:Z}for(let[Z,J]of[[e2,$Z],[XZ,ZZ]]){Z.lastIndex=X;let Y=Z.exec($);if(!Y||Y.index!==X)continue;J.lastIndex=Z.lastIndex;let G=J.exec($);return G?G.index+G[0].length:$.length}return-1}function m8($,X){let Z=[],J=0,Y=$.length,G=!1,Q=null;while(J<Y){let W=$[J];if(G){if(Q){if(W===Q)Q=null}else if(W==='"'||W==="'")Q=W;else if(W===">")G=!1;J++;continue}if(W!=="<"){J++;continue}let w=X($,J);if(w>J){Z.push({start:J,end:w,token:$.slice(J,w)}),J=w;continue}let q=CK($,J);if(q>J){J=q;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))G=!0;J++}return Z}function z1($,X,Z){let J=m8($,X);if(J.length===0)return{output:$,tokens:[]};let Y=J.map((W)=>W.token),G="",Q=0;for(let W=0;W<J.length;W++){let w=J[W];G+=$.slice(Q,w.start),G+=Z(w.token,W),Q=w.end}return G+=$.slice(Q),{output:G,tokens:Y}}function U1($){let{output:X,tokens:Z}=z1($,v1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:X,scripts:Z}}function C5($,X){if(X.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,J)=>X[+J]??"")}var e2,$Z,XZ,ZZ;var x1=y(()=>{e2=/<script\b[^>]*>/iy,$Z=/<\/script\s*>/ig,XZ=/<style\b[^>]*>/iy,ZZ=/<\/style\s*>/ig});var zZ={};e(zZ,{usesSignalsInScript:()=>T1,unescapeHtml:()=>cK,registerFilters:()=>vK,registerFilter:()=>QZ,processExpressions:()=>f1,interpolateScriptsInTemplate:()=>hK,interpolateScriptExpressions:()=>c8,interpolateScriptAttributes:()=>qZ,getAllFilters:()=>WZ,evaluateExpression:()=>n0,escapeHtmlValue:()=>F4,escapeHtml:()=>j1,defaultFilters:()=>d7,clearCustomFilters:()=>xK,applyFilters:()=>KZ});function PK($){let X=YZ.get($);if(!X){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");X=new RegExp(`:${Z}(?!\\w)`,"g"),YZ.set($,X)}return X.lastIndex=0,X}function QZ($,X){if($ in d7)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);u7[$]=X}function vK($){for(let[X,Z]of Object.entries($))QZ(X,Z)}function WZ(){return{...d7,...u7}}function xK(){for(let $ of Object.keys(u7))delete u7[$]}function j1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function F4($){return j1($).replace(/\{{2,}/g,(X)=>fK(X.length)).replace(/\{(?=!)/g,`&#123;${wZ}`)}function fK($){return Array.from({length:$},()=>"&#123;").join(wZ)}function T1($){let{scripts:X}=U1($);for(let Z of X){let J=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let Y=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function GZ($,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"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",G=!1,Q=0;for(let q=0;q<J.length;q++){let K=J[q];if(!G&&K==="`"){G=!0,Q=0;continue}if(G){if(K==="`"&&Q===0){G=!1;continue}if(K==="$"&&J[q+1]==="{"){Q++,q++,Y+=" ";continue}if(K==="}"&&Q>0){Q--;continue}if(Q>0){Y+=K;continue}continue}Y+=K}J=Y;let W=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,w;while((w=W.exec(J))!==null){let q=w[1];if(!J.substring(0,w.index).trimEnd().endsWith(".")){if(!Z.includes(q)&&!(q in X))return!1}}return!0}function gK($,X){let Z=X.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let J=e0($);for(let Y of Z)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function c8($,X){let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let G=n0(Y,X);if(G===void 0)return J;return G===null?"":String(G)}catch{return J}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let G=Y.trim();if(/^__[A-Z_]+__$/.test(G))return J;try{let Q=n0(Y,X);if(Q===void 0)return J;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return J}}),Z}function qZ($,X){if(!$.includes("{"))return $;let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let G=n0(Y,X);if(G===void 0)return J;return G===null?"":String(G)}catch{return J}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let G=Y.trim();if(/^__[A-Z_]+__$/.test(G))return J;try{let Q=n0(Y,X);if(Q===void 0)return J;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return J}}),Z}function hK($,X,Z={}){let{output:J,scripts:Y}=U1($),G=Y.map((Q)=>{let W=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),w=Q.match(/^<script\b[^>]*>/i),q=Q.search(/<\/script\s*>$/i);if(!W||!w||q===-1)return Q;let K=W[1],z=W[2];if(/\bdata-raw\b/.test(K))return Q;if(Z.skipServer&&/\bserver\b/.test(K))return Q;let j=`<script${qZ(K,X)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return j+z+Q.slice(q);return j+c8(z,X)+Q.slice(q)});return C5(J,G)}function f1($,X,Z){let J=$,Y=(z,U)=>{let j=S5(z,U);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(U,j))?-1:j},G=(z,U,j,B)=>{let H=j.length,{output:_,tokens:L}=z1(z,U,(O,F)=>B(H+F));return j.push(...L),_},Q=[];J=G(J,Y,Q,(z)=>`<!--__STX_STYLE_${z}__-->`);let W=[];J=G(J,v1,W,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let w=X?.__stx_signals_gate===!0||T1($),q=new Set(Array.isArray(X?.__stx_client_signal_names)?X.__stx_client_signal_names:[]),K=new Set(Array.isArray(X?.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,U,j)=>{try{let B=n0(U,X);return B!==void 0&&B!==null?String(B):""}catch(B){let H=B instanceof Error?B.message:String(B);return _0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${H}`,Z,$,j,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,U,j)=>{try{let B=n0(U,X);if(B===void 0&&X.__stx_buildMode==="compile")return d8("raw",U.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(X.__stx_buildMode==="compile")return d8("raw",U.trim());let H=B instanceof Error?B.message:String(B);return _0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${H}`,Z,$,j,z)}}),J=G(J,v1,W,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),J=G(J,Y,Q,(z)=>`<!--__STX_STYLE_${z}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(z,U,j)=>{let B=U.trim();if(K.has(B))return z;let H=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],_=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,O=B.match(_)?.[1],F=O&&((O in X)||H.includes(O)),V=Boolean(O&&q.has(O)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(A),N=R&&!H.includes(R[1])&&!(R[1]in X);if(/^__[A-Z_]+__$/.test(B))return"";try{let k=n0(U,X);if(V)return z;if(w&&!GZ(B,X))return z;if(X.__stx_buildMode==="compile"&&!w&&(k===void 0||gK(B,X)))return d8("expr",B);return k!==void 0&&k!==null?F4(String(k)):""}catch(k){if(V)return z;if(w&&!GZ(B,X))return z;if(N)return z;let I=k instanceof Error?k.message:String(k);return _0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,Z,$,j,z)}});for(let z=0;z<W.length;z++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>W[z]);for(let z=0;z<Q.length;z++)J=J.replace(`<!--__STX_STYLE_${z}__-->`,()=>Q[z]);return J}function KZ($,X,Z){if(!X.trim())return $;let J=$,Y=X.trim();while(Y.length>0){let G=Y.match(/^(\w+)/);if(!G)break;let Q=G[1];Y=Y.substring(Q.length).trim();let W=u7[Q]||d7[Q];if(!W)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(WZ()).join(", ")}`);let w=[];if(Y.startsWith(":")){let q=Y.match(/^:([^|\s]+)/);if(q){let K=q[1].trim();try{let z=Number(K);w=[Number.isNaN(z)?K:z]}catch{w=[K]}Y=Y.substring(q[0].length).trim()}}else if(Y.startsWith("(")){let q=1,K=1;while(q>0&&K<Y.length){if(Y[K]==="(")q++;if(Y[K]===")")q--;K++}if(q===0){let z=Y.substring(1,K-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))w=[n0(`(${z})`,Z,!0)];else{let U=[],j="",B=null,H=0,_=0,L=0,O=!1;for(let F=0;F<z.length;F++){let V=z[F];if(O){j+=V,O=!1;continue}if(V==="\\"){j+=V,O=!0;continue}if(B){if(j+=V,V===B)B=null;continue}if(V==='"'||V==="'"||V==="`"){B=V,j+=V;continue}if(V==="(")H++;else if(V===")")H--;else if(V==="[")_++;else if(V==="]")_--;else if(V==="{")L++;else if(V==="}")L--;if(V===","&&H===0&&_===0&&L===0){U.push(j),j="";continue}j+=V}if(j)U.push(j);w=U.map((F)=>{let V=F.trim();return n0(V,Z,!0)})}}catch{w=[z]}Y=Y.substring(K).trim()}}try{J=W(J,Z,...w)}catch(q){let K=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${Q}': ${K}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function uK($){let X=!1,Z="",J=0,Y=0,G=0,Q=!1;for(let W=0;W<$.length;W++){let w=$[W],q=$[W+1];if(X&&Q){Q=!1;continue}if(X&&w==="\\"){Q=!0;continue}if(Q=!1,(w==='"'||w==="'"||w==="`")&&!Q){if(!X)X=!0,Z=w;else if(w===Z)X=!1,Z="";continue}if(X&&Z==="`"&&w==="$"&&q==="{"){let K=1;W+=2;while(W<$.length&&K>0){if($[W]==="{")K++;else if($[W]==="}")K--;if(K>0)W++}continue}if(X)continue;if(w==="(")J++;else if(w===")")J--;else if(w==="[")Y++;else if(w==="]")Y--;else if(w==="{")G++;else if(w==="}")G--;if(w==="|"&&J===0&&Y===0&&G===0){if(q==="|"){W++;continue}if(q==="="){W++;continue}return W}}return-1}function n0($,X,Z=!1){try{let J=$.trim(),Y=uK(J);if(Y>0){let G=J.substring(0,Y).trim(),Q=J.substring(Y+1).trim(),W=n0(G,X,!0);return KZ(W,Q,X)}if(!K0(J)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return Q0(J,X)}try{let G=Object.keys(X),Q=Object.values(X);return z0(J,G)(...Q)}catch{return Q0(J,X)}}catch(J){if(J instanceof ReferenceError){let Y=/(\b\w+)\s+is not defined/.exec(J.message);if(Y){let G=Y[1],Q=dK(G,Object.keys(X));if(Q&&Q!==G)J.message=`${J.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${$}`,J);throw J}}function dK($,X){let Z=null;for(let Y of X){if(Y===$)continue;let G=mK($,Y);if(Z===null||G<Z.dist)Z={key:Y,dist:G}}if(!Z)return null;let J=Math.max($.length,Z.key.length);if(Z.dist<=2||Z.dist/J<=0.35)return Z.key;return null}function mK($,X){if($===X)return 0;if($.length===0)return X.length;if(X.length===0)return $.length;let[Z,J]=$.length<X.length?[$,X]:[X,$],Y=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)Y[Q]=Q;for(let Q=1;Q<=J.length;Q++){G[0]=Q;for(let W=1;W<=Z.length;W++){let w=Z[W-1]===J[Q-1]?0:1;G[W]=Math.min(G[W-1]+1,Y[W]+1,Y[W-1]+w)}for(let W=0;W<=Z.length;W++)Y[W]=G[W]}return Y[Z.length]}function cK($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var u7,YZ,d7,wZ="&#8288;";var B1=y(()=>{b0();V0();t2();x1();u7={},YZ=new Map;d7={uppercase:($,X)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,X)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,X)=>{if($===void 0||$===null)return"";let Z=String($);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:($,X,Z=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:($,X,Z="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Z)}catch{return String($)}},join:($,X,Z=",")=>{if(!Array.isArray($))return"";return $.join(String(Z))},escape:($,X)=>{if($===void 0||$===null)return"";return F4(String($))},translate:($,X,Z={})=>{if(!X||!X.__translations)return $;let J=X.__translations,Y=X.__i18nConfig?.fallbackToKey??!0,G=String($).split("."),Q=J;for(let w of G){if(Q===void 0||Q===null)break;Q=Q[w]}if(Q===void 0||Q===null)return Y?$:"";let W=String(Q);return Object.entries(Z).forEach(([w,q])=>{W=W.replace(PK(w),String(q))}),W},t:($,X,Z={})=>{return d7.translate($,X,Z)},truncate:($,X,Z=50,J="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=Z)return Y;if(Z<=J.length)return J.substring(0,Z);return Y.substring(0,Z-J.length)+J},date:($,X,Z="short",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);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 Y.toISOString();return new Intl.DateTimeFormat(J,G[Z]||G.short).format(Y)}catch{return String($)}},currency:($,X,Z="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Z}).format(Y)}catch{return String($)}},pluralize:($,X,Z,J)=>{let Y=Number($);if(Number.isNaN(Y))return Z;let G=J||`${Z}s`;return Y===1?Z:G},first:($,X)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,X)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Z=String($);return Z.charAt(Z.length-1)},length:($,X)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,X,Z=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Z?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,X,Z="")=>{return $===void 0||$===null||$===""?Z:$},reverse:($,X)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,X,Z=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Z,J);return $},replace:($,X,Z,J="")=>{if($===void 0||$===null)return"";let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>J)},stripTags:($,X)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,X)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,X)=>{let Z=Number($);return Number.isNaN(Z)?0:Math.abs(Z)},round:($,X,Z=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Y=10**Z;return Math.round(J*Y)/Y}}});class J5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let X=this.cache.get($);return this.cache.delete($),this.cache.set($,X),X}set($,X){if(this.cache.has($))this.cache.delete($);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($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function v5($,X){if(X?.includes("g"))return new RegExp($,X);let Z=`${$}:${X||""}`;if(!P5.has(Z)){if(P5.size>=lK){let J=P5.keys().next().value;if(J)P5.delete(J)}P5.set(Z,new RegExp($,X))}return P5.get(Z)}class UZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let X=Array.from(new Set($)),Z=X.sort().join(","),J=this.pool.find((W)=>W.context.join(",")===Z);if(J)return J.func;let Y=this.fnCache,G=this.fnCacheMaxSize,Q=(...W)=>{return(w)=>{try{let q=`${Z}:${w}`,K=Y.get(q);if(!K){if(Y.size>=G){let z=Y.keys().next().value;if(z)Y.delete(z)}K=Function(...X,`
2532
+ `),W=Q([]);if(G.length===X.length)return n2(W,G,Q);return n2((...q)=>{let K=Array(Y.length);for(let z=0;z<Y.length;z++)K[z]=q[Y[z]];return W(...K)},G,Q,(q)=>{W=Q(q)})}function n2($,X,Z,J){let G=/^(\w+) is not defined$/,Q=$,W=[],w=new Set(X);return(...q)=>{for(let K=0;K<=8;K++)try{return Q(...q)}catch(z){let U=z instanceof Error?z.message:"",j=G.exec(U);if(!(z instanceof ReferenceError)||!j)return;let B=j[1];if(w.has(B)||a2.has(B))return;w.add(B),W.push(B),Q=Z(W),J?.(W)}return}}function u8($){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 J of Z)if(J.test(X))return!1;return!0}var MK,r2,o2,TK,s2,kK,a2;var D0=y(()=>{MK={maxSanitizeDepth:10,allowBracketNotation:!1},r2={...MK},o2=[/\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"]),s2=new Set(["__proto__","constructor","prototype"]),kK=/[\w)\]]\s*\[\s*['"]/;a2=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 d8($,X){let Z=bK++,J=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return SK.set(J,{type:$,expression:X}),J}var bK=0,SK;var t2=y(()=>{SK=new Map});function JZ($,X,Z,J){Z.lastIndex=X;let Y=Z.exec($);if(!Y||Y.index!==X)return-1;J.lastIndex=Z.lastIndex;let G=J.exec($);if(!G)return-1;return G.index+G[0].length}function f1($,X){return JZ($,X,e2,$Z)}function b5($,X){return JZ($,X,XZ,ZZ)}function h7($,X){if(!$.startsWith("<!--",X))return-1;let Z=$.indexOf("-->",X+4);if(Z===-1)return-1;return Z+3}function CK($,X){if($.startsWith("<!--",X)){let Z=h7($,X);return Z===-1?$.length:Z}for(let[Z,J]of[[e2,$Z],[XZ,ZZ]]){Z.lastIndex=X;let Y=Z.exec($);if(!Y||Y.index!==X)continue;J.lastIndex=Z.lastIndex;let G=J.exec($);return G?G.index+G[0].length:$.length}return-1}function m8($,X){let Z=[],J=0,Y=$.length,G=!1,Q=null;while(J<Y){let W=$[J];if(G){if(Q){if(W===Q)Q=null}else if(W==='"'||W==="'")Q=W;else if(W===">")G=!1;J++;continue}if(W!=="<"){J++;continue}let w=X($,J);if(w>J){Z.push({start:J,end:w,token:$.slice(J,w)}),J=w;continue}let q=CK($,J);if(q>J){J=q;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))G=!0;J++}return Z}function K1($,X,Z){let J=m8($,X);if(J.length===0)return{output:$,tokens:[]};let Y=J.map((W)=>W.token),G="",Q=0;for(let W=0;W<J.length;W++){let w=J[W];G+=$.slice(Q,w.start),G+=Z(w.token,W),Q=w.end}return G+=$.slice(Q),{output:G,tokens:Y}}function z1($){let{output:X,tokens:Z}=K1($,f1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:X,scripts:Z}}function S5($,X){if(X.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,J)=>X[+J]??"")}var e2,$Z,XZ,ZZ;var g1=y(()=>{e2=/<script\b[^>]*>/iy,$Z=/<\/script\s*>/ig,XZ=/<style\b[^>]*>/iy,ZZ=/<\/style\s*>/ig});var zZ={};t(zZ,{usesSignalsInScript:()=>T1,unescapeHtml:()=>cK,registerFilters:()=>vK,registerFilter:()=>QZ,processExpressions:()=>h1,interpolateScriptsInTemplate:()=>hK,interpolateScriptExpressions:()=>c8,interpolateScriptAttributes:()=>qZ,getAllFilters:()=>WZ,evaluateExpression:()=>p0,escapeHtmlValue:()=>F4,escapeHtml:()=>U1,defaultFilters:()=>d7,clearCustomFilters:()=>xK,applyFilters:()=>KZ});function PK($){let X=YZ.get($);if(!X){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");X=new RegExp(`:${Z}(?!\\w)`,"g"),YZ.set($,X)}return X.lastIndex=0,X}function QZ($,X){if($ in d7)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);u7[$]=X}function vK($){for(let[X,Z]of Object.entries($))QZ(X,Z)}function WZ(){return{...d7,...u7}}function xK(){for(let $ of Object.keys(u7))delete u7[$]}function U1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function F4($){return U1($).replace(/\{{2,}/g,(X)=>fK(X.length)).replace(/\{(?=!)/g,`&#123;${wZ}`)}function fK($){return Array.from({length:$},()=>"&#123;").join(wZ)}function T1($){let{scripts:X}=z1($);for(let Z of X){let J=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!J||/\bserver\b|\bsrc\s*=/.test(J[1]))continue;let Y=J[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Y))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function GZ($,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"],J=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Y="",G=!1,Q=0;for(let q=0;q<J.length;q++){let K=J[q];if(!G&&K==="`"){G=!0,Q=0;continue}if(G){if(K==="`"&&Q===0){G=!1;continue}if(K==="$"&&J[q+1]==="{"){Q++,q++,Y+=" ";continue}if(K==="}"&&Q>0){Q--;continue}if(Q>0){Y+=K;continue}continue}Y+=K}J=Y;let W=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,w;while((w=W.exec(J))!==null){let q=w[1];if(!J.substring(0,w.index).trimEnd().endsWith(".")){if(!Z.includes(q)&&!(q in X))return!1}}return!0}function gK($,X){let Z=X.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let J=$1($);for(let Y of Z)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function c8($,X){let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let G=p0(Y,X);if(G===void 0)return J;return G===null?"":String(G)}catch{return J}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let G=Y.trim();if(/^__[A-Z_]+__$/.test(G))return J;try{let Q=p0(Y,X);if(Q===void 0)return J;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return J}}),Z}function qZ($,X){if(!$.includes("{"))return $;let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let G=p0(Y,X);if(G===void 0)return J;return G===null?"":String(G)}catch{return J}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(J,Y)=>{let G=Y.trim();if(/^__[A-Z_]+__$/.test(G))return J;try{let Q=p0(Y,X);if(Q===void 0)return J;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return J}}),Z}function hK($,X,Z={}){let{output:J,scripts:Y}=z1($),G=Y.map((Q)=>{let W=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),w=Q.match(/^<script\b[^>]*>/i),q=Q.search(/<\/script\s*>$/i);if(!W||!w||q===-1)return Q;let K=W[1],z=W[2];if(/\bdata-raw\b/.test(K))return Q;if(Z.skipServer&&/\bserver\b/.test(K))return Q;let j=`<script${qZ(K,X)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return j+z+Q.slice(q);return j+c8(z,X)+Q.slice(q)});return S5(J,G)}function h1($,X,Z){let J=$,Y=(z,U)=>{let j=b5(z,U);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(U,j))?-1:j},G=(z,U,j,B)=>{let H=j.length,{output:_,tokens:L}=K1(z,U,(O,F)=>B(H+F));return j.push(...L),_},Q=[];J=G(J,Y,Q,(z)=>`<!--__STX_STYLE_${z}__-->`);let W=[];J=G(J,f1,W,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let w=X?.__stx_signals_gate===!0||T1($),q=new Set(Array.isArray(X?.__stx_client_signal_names)?X.__stx_client_signal_names:[]),K=new Set(Array.isArray(X?.__stx_preserved_client_expressions)?X.__stx_preserved_client_expressions:[]);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,U,j)=>{try{let B=p0(U,X);return B!==void 0&&B!==null?String(B):""}catch(B){let H=B instanceof Error?B.message:String(B);return H0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${H}`,Z,$,j,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,U,j)=>{try{let B=p0(U,X);if(B===void 0&&X.__stx_buildMode==="compile")return d8("raw",U.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(X.__stx_buildMode==="compile")return d8("raw",U.trim());let H=B instanceof Error?B.message:String(B);return H0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${H}`,Z,$,j,z)}}),J=G(J,f1,W,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),J=G(J,Y,Q,(z)=>`<!--__STX_STYLE_${z}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(z,U,j)=>{let B=U.trim();if(K.has(B))return z;let H=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],_=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,O=B.match(_)?.[1],F=O&&((O in X)||H.includes(O)),V=Boolean(O&&q.has(O)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=B.match(A),N=R&&!H.includes(R[1])&&!(R[1]in X);if(/^__[A-Z_]+__$/.test(B))return"";try{let k=p0(U,X);if(V)return z;if(w&&!GZ(B,X))return z;if(X.__stx_buildMode==="compile"&&!w&&(k===void 0||gK(B,X)))return d8("expr",B);return k!==void 0&&k!==null?F4(String(k)):""}catch(k){if(V)return z;if(w&&!GZ(B,X))return z;if(N)return z;let I=k instanceof Error?k.message:String(k);return H0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,Z,$,j,z)}});for(let z=0;z<W.length;z++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>W[z]);for(let z=0;z<Q.length;z++)J=J.replace(`<!--__STX_STYLE_${z}__-->`,()=>Q[z]);return J}function KZ($,X,Z){if(!X.trim())return $;let J=$,Y=X.trim();while(Y.length>0){let G=Y.match(/^(\w+)/);if(!G)break;let Q=G[1];Y=Y.substring(Q.length).trim();let W=u7[Q]||d7[Q];if(!W)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(WZ()).join(", ")}`);let w=[];if(Y.startsWith(":")){let q=Y.match(/^:([^|\s]+)/);if(q){let K=q[1].trim();try{let z=Number(K);w=[Number.isNaN(z)?K:z]}catch{w=[K]}Y=Y.substring(q[0].length).trim()}}else if(Y.startsWith("(")){let q=1,K=1;while(q>0&&K<Y.length){if(Y[K]==="(")q++;if(Y[K]===")")q--;K++}if(q===0){let z=Y.substring(1,K-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))w=[p0(`(${z})`,Z,!0)];else{let U=[],j="",B=null,H=0,_=0,L=0,O=!1;for(let F=0;F<z.length;F++){let V=z[F];if(O){j+=V,O=!1;continue}if(V==="\\"){j+=V,O=!0;continue}if(B){if(j+=V,V===B)B=null;continue}if(V==='"'||V==="'"||V==="`"){B=V,j+=V;continue}if(V==="(")H++;else if(V===")")H--;else if(V==="[")_++;else if(V==="]")_--;else if(V==="{")L++;else if(V==="}")L--;if(V===","&&H===0&&_===0&&L===0){U.push(j),j="";continue}j+=V}if(j)U.push(j);w=U.map((F)=>{let V=F.trim();return p0(V,Z,!0)})}}catch{w=[z]}Y=Y.substring(K).trim()}}try{J=W(J,Z,...w)}catch(q){let K=q instanceof Error?q.message:String(q);throw Error(`Error applying filter '${Q}': ${K}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function uK($){let X=!1,Z="",J=0,Y=0,G=0,Q=!1;for(let W=0;W<$.length;W++){let w=$[W],q=$[W+1];if(X&&Q){Q=!1;continue}if(X&&w==="\\"){Q=!0;continue}if(Q=!1,(w==='"'||w==="'"||w==="`")&&!Q){if(!X)X=!0,Z=w;else if(w===Z)X=!1,Z="";continue}if(X&&Z==="`"&&w==="$"&&q==="{"){let K=1;W+=2;while(W<$.length&&K>0){if($[W]==="{")K++;else if($[W]==="}")K--;if(K>0)W++}continue}if(X)continue;if(w==="(")J++;else if(w===")")J--;else if(w==="[")Y++;else if(w==="]")Y--;else if(w==="{")G++;else if(w==="}")G--;if(w==="|"&&J===0&&Y===0&&G===0){if(q==="|"){W++;continue}if(q==="="){W++;continue}return W}}return-1}function p0($,X,Z=!1){try{let J=$.trim(),Y=uK(J);if(Y>0){let G=J.substring(0,Y).trim(),Q=J.substring(Y+1).trim(),W=p0(G,X,!0);return KZ(W,Q,X)}if(!U0(J)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return W0(J,X)}try{let G=Object.keys(X),Q=Object.values(X);return j0(J,G)(...Q)}catch{return W0(J,X)}}catch(J){if(J instanceof ReferenceError){let Y=/(\b\w+)\s+is not defined/.exec(J.message);if(Y){let G=Y[1],Q=dK(G,Object.keys(X));if(Q&&Q!==G)J.message=`${J.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${$}`,J);throw J}}function dK($,X){let Z=null;for(let Y of X){if(Y===$)continue;let G=mK($,Y);if(Z===null||G<Z.dist)Z={key:Y,dist:G}}if(!Z)return null;let J=Math.max($.length,Z.key.length);if(Z.dist<=2||Z.dist/J<=0.35)return Z.key;return null}function mK($,X){if($===X)return 0;if($.length===0)return X.length;if(X.length===0)return $.length;let[Z,J]=$.length<X.length?[$,X]:[X,$],Y=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)Y[Q]=Q;for(let Q=1;Q<=J.length;Q++){G[0]=Q;for(let W=1;W<=Z.length;W++){let w=Z[W-1]===J[Q-1]?0:1;G[W]=Math.min(G[W-1]+1,Y[W]+1,Y[W-1]+w)}for(let W=0;W<=Z.length;W++)Y[W]=G[W]}return Y[Z.length]}function cK($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var u7,YZ,d7,wZ="&#8288;";var j1=y(()=>{D0();F0();t2();g1();u7={},YZ=new Map;d7={uppercase:($,X)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,X)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,X)=>{if($===void 0||$===null)return"";let Z=String($);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:($,X,Z=0)=>{if($===void 0||$===null)return"";try{let J=Number($);return Number.isNaN(J)?"":J.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:($,X,Z="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return J.toLocaleString(Z)}catch{return String($)}},join:($,X,Z=",")=>{if(!Array.isArray($))return"";return $.join(String(Z))},escape:($,X)=>{if($===void 0||$===null)return"";return F4(String($))},translate:($,X,Z={})=>{if(!X||!X.__translations)return $;let J=X.__translations,Y=X.__i18nConfig?.fallbackToKey??!0,G=String($).split("."),Q=J;for(let w of G){if(Q===void 0||Q===null)break;Q=Q[w]}if(Q===void 0||Q===null)return Y?$:"";let W=String(Q);return Object.entries(Z).forEach(([w,q])=>{W=W.replace(PK(w),String(q))}),W},t:($,X,Z={})=>{return d7.translate($,X,Z)},truncate:($,X,Z=50,J="...")=>{if($===void 0||$===null)return"";let Y=String($);if(Y.length<=Z)return Y;if(Z<=J.length)return J.substring(0,Z);return Y.substring(0,Z-J.length)+J},date:($,X,Z="short",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=$ instanceof Date?$:new Date($);if(Number.isNaN(Y.getTime()))return String($);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 Y.toISOString();return new Intl.DateTimeFormat(J,G[Z]||G.short).format(Y)}catch{return String($)}},currency:($,X,Z="USD",J="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return new Intl.NumberFormat(J,{style:"currency",currency:Z}).format(Y)}catch{return String($)}},pluralize:($,X,Z,J)=>{let Y=Number($);if(Number.isNaN(Y))return Z;let G=J||`${Z}s`;return Y===1?Z:G},first:($,X)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,X)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Z=String($);return Z.charAt(Z.length-1)},length:($,X)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,X,Z=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Z?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,X,Z="")=>{return $===void 0||$===null||$===""?Z:$},reverse:($,X)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,X,Z=0,J)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Z,J);return $},replace:($,X,Z,J="")=>{if($===void 0||$===null)return"";let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Y,"g"),()=>J)},stripTags:($,X)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,X)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,X)=>{let Z=Number($);return Number.isNaN(Z)?0:Math.abs(Z)},round:($,X,Z=0)=>{let J=Number($);if(Number.isNaN(J))return 0;let Y=10**Z;return Math.round(J*Y)/Y}}});class Z5{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let X=this.cache.get($);return this.cache.delete($),this.cache.set($,X),X}set($,X){if(this.cache.has($))this.cache.delete($);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($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function P5($,X){if(X?.includes("g"))return new RegExp($,X);let Z=`${$}:${X||""}`;if(!C5.has(Z)){if(C5.size>=lK){let J=C5.keys().next().value;if(J)C5.delete(J)}C5.set(Z,new RegExp($,X))}return C5.get(Z)}class UZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let X=Array.from(new Set($)),Z=X.sort().join(","),J=this.pool.find((W)=>W.context.join(",")===Z);if(J)return J.func;let Y=this.fnCache,G=this.fnCacheMaxSize,Q=(...W)=>{return(w)=>{try{let q=`${Z}:${w}`,K=Y.get(q);if(!K){if(Y.size>=G){let z=Y.keys().next().value;if(z)Y.delete(z)}K=Function(...X,`
2533
2533
  'use strict';
2534
2534
  try {
2535
2535
  return ${w};
@@ -2540,34 +2540,34 @@ catch (e) {
2540
2540
  }
2541
2541
  throw e;
2542
2542
  }
2543
- `),Y.set(q,K)}return K(...W)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:X.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class jZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,X){this.budgets.set($,{warnThreshold:0.8,action:"warn",...X})}setBudgets($){for(let[X,Z]of Object.entries($))this.setBudget(X,Z)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[X,Z]of this.budgets.entries())$[X]=Z;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let X=this.violationHandlers.indexOf($);if(X!==-1)this.violationHandlers.splice(X,1)}time($,X){if(!this.enabled)return X();let Z=performance.now(),J=X(),Y=performance.now()-Z;return this.recordTime($,Y),this.checkBudget($,Y),J}async timeAsync($,X){if(!this.enabled)return X();let Z=performance.now(),J=await X(),Y=performance.now()-Z;return this.recordTime($,Y),this.checkBudget($,Y),J}checkBudget($,X){let Z=this.budgets.get($);if(!Z)return;let J=X/Z.maxTime*100,Y=Z.warnThreshold!==void 0?X>=Z.maxTime*Z.warnThreshold&&X<Z.maxTime:!1,G=X>=Z.maxTime;if(!Y&&!G)return;let Q={label:$,actualTime:X,budgetTime:Z.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:Y};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let w of this.violationHandlers)try{w(Q)}catch{}let W=Y?`[Performance Warning] "${$}" took ${X.toFixed(2)}ms (${J.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${X.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(J-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($);if(Z)Z.count++,Z.totalTime+=X,Z.maxTime=Math.max(Z.maxTime,X),Z.minTime=Math.min(Z.minTime,X);else this.metrics.set($,{count:1,totalTime:X,maxTime:X,minTime:X})}getStats($){if($){let Z=this.metrics.get($);if(!Z)return{};let J=this.budgets.get($);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:J?.maxTime,budgetUtilization:J?Z.totalTime/Z.count/J.maxTime*100:void 0}}let X={};for(let[Z,J]of this.metrics.entries()){let Y=this.budgets.get(Z);X[Z]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Y?.maxTime,budgetUtilization:Y?J.totalTime/J.count/Y.maxTime*100:void 0}}return X}getViolations($){if($)return this.violations.filter((X)=>X.label===$);return[...this.violations]}getViolationStats(){let $={},X=0,Z=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)X++;else Z++;return{total:this.violations.length,byLabel:$,warnings:X,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 pK(){if(!V4)V4=new jZ;return V4}var P5,lK=500,CA,V4=null,BZ;var x5=y(()=>{P5=new Map;CA=new UZ;BZ=new Proxy({},{get($,X){return pK()[X]}})});function HZ($,X=""){let Z=`${$}${X}`,J=0;for(let Y=0;Y<Z.length;Y++){let G=Z.charCodeAt(Y);J=(J<<5)-J+G,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function _Z($,X,Z={}){let{prefix:J="",preserveHost:Y=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!$.trim())return"";let W=A4($),w=[],q=new Map;if(G)for(let K of W){let z=K.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let U=z[1],j=`${X}_${U}`;q.set(U,j)}}for(let K of W){let z=OZ(K,X,J,Y,q,Q);w.push(z)}return w.join(`
2543
+ `),Y.set(q,K)}return K(...W)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:X.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class jZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,X){this.budgets.set($,{warnThreshold:0.8,action:"warn",...X})}setBudgets($){for(let[X,Z]of Object.entries($))this.setBudget(X,Z)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[X,Z]of this.budgets.entries())$[X]=Z;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let X=this.violationHandlers.indexOf($);if(X!==-1)this.violationHandlers.splice(X,1)}time($,X){if(!this.enabled)return X();let Z=performance.now(),J=X(),Y=performance.now()-Z;return this.recordTime($,Y),this.checkBudget($,Y),J}async timeAsync($,X){if(!this.enabled)return X();let Z=performance.now(),J=await X(),Y=performance.now()-Z;return this.recordTime($,Y),this.checkBudget($,Y),J}checkBudget($,X){let Z=this.budgets.get($);if(!Z)return;let J=X/Z.maxTime*100,Y=Z.warnThreshold!==void 0?X>=Z.maxTime*Z.warnThreshold&&X<Z.maxTime:!1,G=X>=Z.maxTime;if(!Y&&!G)return;let Q={label:$,actualTime:X,budgetTime:Z.maxTime,exceedancePercent:J,timestamp:new Date,isWarning:Y};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let w of this.violationHandlers)try{w(Q)}catch{}let W=Y?`[Performance Warning] "${$}" took ${X.toFixed(2)}ms (${J.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${X.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(J-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($);if(Z)Z.count++,Z.totalTime+=X,Z.maxTime=Math.max(Z.maxTime,X),Z.minTime=Math.min(Z.minTime,X);else this.metrics.set($,{count:1,totalTime:X,maxTime:X,minTime:X})}getStats($){if($){let Z=this.metrics.get($);if(!Z)return{};let J=this.budgets.get($);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:J?.maxTime,budgetUtilization:J?Z.totalTime/Z.count/J.maxTime*100:void 0}}let X={};for(let[Z,J]of this.metrics.entries()){let Y=this.budgets.get(Z);X[Z]={count:J.count,avgTime:J.totalTime/J.count,totalTime:J.totalTime,maxTime:J.maxTime,minTime:J.minTime,budget:Y?.maxTime,budgetUtilization:Y?J.totalTime/J.count/Y.maxTime*100:void 0}}return X}getViolations($){if($)return this.violations.filter((X)=>X.label===$);return[...this.violations]}getViolationStats(){let $={},X=0,Z=0;for(let J of this.violations)if($[J.label]=($[J.label]||0)+1,J.isWarning)X++;else Z++;return{total:this.violations.length,byLabel:$,warnings:X,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 pK(){if(!V4)V4=new jZ;return V4}var C5,lK=500,CA,V4=null,BZ;var v5=y(()=>{C5=new Map;CA=new UZ;BZ=new Proxy({},{get($,X){return pK()[X]}})});function HZ($,X=""){let Z=`${$}${X}`,J=0;for(let Y=0;Y<Z.length;Y++){let G=Z.charCodeAt(Y);J=(J<<5)-J+G,J=J&J}return`stx-${Math.abs(J).toString(36)}`}function _Z($,X,Z={}){let{prefix:J="",preserveHost:Y=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!$.trim())return"";let W=A4($),w=[],q=new Map;if(G)for(let K of W){let z=K.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let U=z[1],j=`${X}_${U}`;q.set(U,j)}}for(let K of W){let z=OZ(K,X,J,Y,q,Q);w.push(z)}return w.join(`
2544
2544
 
2545
2545
  `)}function A4($){let X=[],Z=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Y="",G=!1,Q="";for(let W=0;W<Z.length;W++){let w=Z[W];if(w==="@"&&J===0)G=!0;if(w==="{")J++;else if(w==="}"){if(J--,J===0){if(G){Q+=w;let q=Q.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(q){let[,K,z,U]=q;if(K==="keyframes")X.push({selector:`@keyframes ${z.trim()}`,declarations:U.trim()});else if(K==="media"||K==="supports"||K==="container"){let j=A4(U);X.push({selector:`@${K} ${z.trim()}`,declarations:j.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
2546
2546
  `)})}else X.push({selector:`@${K} ${z.trim()}`,declarations:U.trim()})}Q="",G=!1}else if(Y.trim()){Y+=w;let q=Y.match(/([^{]+)\{([^}]*)\}/);if(q)X.push({selector:q[1].trim(),declarations:q[2].trim()});Y=""}continue}}if(G)Q+=w;else Y+=w}return X}function OZ($,X,Z,J,Y,G){let{selector:Q,declarations:W}=$;if(Q.startsWith("@")){if(Q.startsWith("@keyframes")){let K=Q.replace("@keyframes ","").trim();return`@keyframes ${Y.get(K)||K} { ${W} }`}if(Q.startsWith("@media")||Q.startsWith("@supports")||Q.startsWith("@container")){let z=A4(`x { ${W} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((U)=>OZ(U,X,Z,J,Y,G)).join(`
2547
2547
  `);return`${Q} {
2548
2548
  ${z}
2549
- }`}return`${Q} { ${W} }`}let w=iK(Q,X,Z,J),q=W;for(let[K,z]of Y)q=q.replace(new RegExp(`\\b${K}\\b`,"g"),z);if(G)q=q.replace(/--([a-z-]+)/gi,`--${X}-$1`);return`${w} { ${q} }`}function iK($,X,Z,J){let Y=$.split(",").map((Q)=>Q.trim()),G=[];for(let Q of Y){if(Q.startsWith(":host")){if(J)G.push(Q);else{let q=Q.replace(/:host(\([^)]*\))?/,`.${X}$1`);G.push(q)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${X}`);continue}let W=Z?`${Z} .${X}`:`.${X}`;G.push(`${W} ${Q}`);let w=nK(Q,X);if(w)G.push(Z?`${Z} ${w}`:w)}return G.join(", ")}function nK($,X){let Z=0,J=$.length;for(let w=0;w<$.length;w++){let q=$[w];if(q==="["||q==="(")Z++;else if(q==="]"||q===")")Z--;else if(Z===0&&(q===" "||q===">"||q==="+"||q==="~")){J=w;break}}let Y=$.slice(0,J),G=$.slice(J);if(!Y)return"";let Q=Y.length,W=0;for(let w=0;w<Y.length;w++){let q=Y[w];if(q==="["||q==="(")W++;else if(q==="]"||q===")")W--;else if(Z===0&&W===0&&q===":"){Q=w;break}}return`${Y.slice(0,Q)}.${X}${Y.slice(Q)}${G}`}function FZ($){let X=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let J=Z.trim();if(X.has(J))return"";return X.add(J),Z})}function l8($,X){if(!rK.test($))return{html:$,hasScoped:!1};let Z=HZ(X),J=`data-v-${Z}`,Y=$,G=new RegExp(`<style\\s+([^>]*${R4}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(Y=Y.replace(G,(W,w,q)=>{Q=!0;let K=oK(q,J),z=w.replace(new RegExp(R4,"gi"),"").trim(),U=z?` ${z}`:"";return`<style data-stx-scoped="${Z}"${U}>${K}</style>`}),!Q)return{html:$,hasScoped:!1};return Y=aK(Y,J),{html:Y,hasScoped:!0}}function oK($,X){return _Z($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${X}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${X}]`)}function aK($,X){let Z=z1($,(Y,G)=>{let Q=v1(Y,G);return Q>G?Q:S5(Y,G)},(Y,G)=>sK(G)),J=tK(Z.output,X);return LZ.lastIndex=0,J.replace(LZ,(Y,G)=>Z.tokens[Number(G)])}function tK($,X){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,Y,G)=>{if(Z.has(Y.toLowerCase()))return J;if(J.includes(X))return J;if(Y.toLowerCase()==="style"||Y.toLowerCase()==="script")return J;if(G)return J.replace(`<${Y}${G}`,`<${Y} ${X}${G}`);if(J.endsWith("/>"))return`<${Y} ${X} />`;return`<${Y} ${X}>`})}var R4,rK,sK=($)=>`\x00stx-scope-mask-${$}\x00`,LZ;var N4=y(()=>{x1();R4=String.raw`(?<![\w-])scoped(?![\w-])`,rK=new RegExp(`<style\\s+[^>]*${R4}`,"i");LZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function $z($){let X=$.replace(/^<template\b/i,"").replace(/>$/,"");return eK.test(X)}function p8($){m7.lastIndex=0;let X;while((X=m7.exec($))!==null){if(X[0].startsWith("</")||$z(X[0]))continue;let Z=X.index,J=m7.lastIndex,Y=1,G;while((G=m7.exec($))!==null)if(G[0].startsWith("</")){if(Y--,Y===0){let Q=G.index;return{start:Z,openEnd:J,closeStart:Q,end:m7.lastIndex,content:$.slice(J,Q)}}}else Y++;return null}return null}var m7,eK;var M4=y(()=>{m7=/<\/?template\b[^>]*>/gi,eK=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var VZ=()=>{};function x0($,X,Z,J=0){let Y=0,G=J,Q=null,W=0,w=!1;while(G<$.length){let q=$[G];if(Q&&w){w=!1,G++;continue}if(Q&&q==="\\"){w=!0,G++;continue}if(w=!1,(q==='"'||q==="'"||q==="`")&&!Q){Q=q,G++;continue}if(q===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&q==="$"&&$[G+1]==="{"){W++,G+=2;continue}if(W>0&&q==="}"){W--,G++;continue}if(q==="`"&&Q==="`"&&W===0){Q=null,G++;continue}if(Q){G++;continue}if(q===X)Y++;else if(q===Z){if(Y--,Y===0)return G}G++}return-1}var I4={};e(I4,{useTitle:()=>Gz,useSeoMeta:()=>AZ,usePageTitle:()=>Gz,useHead:()=>k4,seoMetaToHeadConfig:()=>n8,resetHead:()=>Jz,renderHtmlAttrs:()=>Wz,renderHead:()=>Qz,renderBodyAttrs:()=>wz,processTitleDirective:()=>zz,processMetaDirective:()=>Uz,processHeadDirective:()=>Kz,mergeHeadConfigs:()=>h1,getPageMeta:()=>Zz,getHead:()=>T4,definePageMeta:()=>Yz,applyHead:()=>qz});function T4(){return g1}function Zz(){return i8}function Jz(){g1={},Xz.length=0,i8={}}function k4($){g1=h1(g1,$)}function h1($,X){return{title:X.title??$.title,titleTemplate:X.titleTemplate??$.titleTemplate,base:X.base??$.base,meta:[...$.meta||[],...X.meta||[]],link:[...$.link||[],...X.link||[]],script:[...$.script||[],...X.script||[]],style:[...$.style||[],...X.style||[]],htmlAttrs:{...$.htmlAttrs,...X.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...X.bodyAttrs}}}function AZ($){k4(n8($))}function n8($){let X=[];if($.description)X.push({name:"description",content:$.description});if($.keywords){let w=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;X.push({name:"keywords",content:w})}if($.author)X.push({name:"author",content:$.author});if($.robots)X.push({name:"robots",content:$.robots});let Z=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Z)X.push({property:"og:title",content:Z});if(J)X.push({property:"og:description",content:J});if($.ogImage)X.push({property:"og:image",content:$.ogImage});if($.ogUrl)X.push({property:"og:url",content:$.ogUrl});if($.ogType)X.push({property:"og:type",content:$.ogType});if($.ogSiteName)X.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)X.push({property:"og:locale",content:$.ogLocale});let Y=$.twitterTitle??$.title,G=$.twitterDescription??$.description,Q=$.twitterImage??$.ogImage;if($.twitterCard)X.push({name:"twitter:card",content:$.twitterCard});if(Y)X.push({name:"twitter:title",content:Y});if(G)X.push({name:"twitter:description",content:G});if(Q)X.push({name:"twitter:image",content:Q});if($.twitterSite)X.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)X.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)X.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)X.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)X.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)X.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let w of $.articleTags)X.push({property:"article:tag",content:w});let W=[];if($.canonical)W.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:X,link:W}}function Yz($){if(i8={...i8,...$},$.title||$.description)AZ({title:$.title,description:$.description})}function Gz($){let X=typeof $==="function"?$():$;k4({title:X})}function Qz($=g1){let X=[];if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);X.push(`<title>${Y5(Z)}</title>`)}if($.base){let Z=Object.entries($.base).map(([J,Y])=>`${J}="${Y5(Y)}"`).join(" ");X.push(`<base ${Z}>`)}for(let Z of $.meta||[]){let J=Object.entries(Z).filter(([Y,G])=>G!==void 0).map(([Y,G])=>{return`${Y==="httpEquiv"?"http-equiv":Y}="${Y5(String(G))}"`}).join(" ");X.push(`<meta ${J}>`)}for(let Z of $.link||[]){let J=Object.entries(Z).filter(([Y,G])=>G!==void 0).map(([Y,G])=>`${Y}="${Y5(String(G))}"`).join(" ");X.push(`<link ${J}>`)}for(let Z of $.script||[]){let{content:J,...Y}=Z,G=Object.entries(Y).filter(([Q,W])=>W!==void 0).map(([Q,W])=>{if(typeof W==="boolean")return W?Q:"";return`${Q}="${Y5(String(W))}"`}).filter(Boolean).join(" ");if(J)X.push(`<script ${G}>${J}</script>`);else X.push(`<script ${G}></script>`)}for(let Z of $.style||[]){let J=Z.type?` type="${Z.type}"`:"";X.push(`<style${J}>${Z.content}</style>`)}return X.join(`
2550
- `)}function Wz($=g1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([X,Z])=>`${X}="${Y5(Z)}"`).join(" ")}function wz($=g1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([X,Z])=>`${X}="${Y5(Z)}"`).join(" ")}function Y5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function qz($=g1){if(typeof document>"u")return;if($.title){let X=$.title;if($.titleTemplate)X=typeof $.titleTemplate==="function"?$.titleTemplate(X):$.titleTemplate.replace("%s",X);document.title=X}for(let X of $.meta||[]){let Z=X.name?`meta[name="${X.name}"]`:X.property?`meta[property="${X.property}"]`:null;if(Z){let J=document.querySelector(Z);if(!J){if(J=document.createElement("meta"),X.name)J.setAttribute("name",X.name);if(X.property)J.setAttribute("property",X.property);document.head.appendChild(J)}J.setAttribute("content",X.content)}}for(let X of $.link||[]){let Z=`link[rel="${X.rel}"]${X.href?`[href="${X.href}"]`:""}`,J=document.querySelector(Z);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[Y,G]of Object.entries(X))if(G!==void 0)J.setAttribute(Y,String(G))}if($.htmlAttrs)for(let[X,Z]of Object.entries($.htmlAttrs))if(X==="class")for(let J of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add(J);else document.documentElement.setAttribute(X,Z);if($.bodyAttrs)for(let[X,Z]of Object.entries($.bodyAttrs))document.body.setAttribute(X,Z)}function Kz($){let X="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,Y)=>{return X+=Y.trim()+`
2551
- `,""}),headContent:X.trim()}}function zz($,X){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,J,Y,G)=>{let Q=J?Y:X[(G||"").trim()]??G,W=X.__stx_runtime_head??{};return X.__stx_runtime_head=h1(W,{title:Q}),""})}function Uz($,X){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,J,Y,G,Q,W)=>{let w=G?Q:W,q=G?w:X[(w||"").trim()]??w,z=Y.includes(":")?{property:Y,content:q}:{name:Y,content:q},U=X.__stx_runtime_head??{};return X.__stx_runtime_head=h1(U,{meta:[z]}),""})}var g1,Xz,i8;var f5=y(()=>{g1={},Xz=[],i8={}});var r8={};e(r8,{stripTypeScript:()=>EZ,splitDeclaration:()=>PZ,isModuleResolutionFailure:()=>DZ,isMissingBindingFailure:()=>yZ,isCompleteImport:()=>bZ,hasVariables:()=>gZ,extractVariables:()=>G5,extractScriptFromTemplate:()=>fZ,convertToCommonJS:()=>y4,STX_ENGINE_BINDING_NAMES:()=>D4});import u1 from"path";import g5 from"process";function Hz($){let X=[],Z=0,J=$.split(`
2549
+ }`}return`${Q} { ${W} }`}let w=iK(Q,X,Z,J),q=W;for(let[K,z]of Y)q=q.replace(new RegExp(`\\b${K}\\b`,"g"),z);if(G)q=q.replace(/--([a-z-]+)/gi,`--${X}-$1`);return`${w} { ${q} }`}function iK($,X,Z,J){let Y=$.split(",").map((Q)=>Q.trim()),G=[];for(let Q of Y){if(Q.startsWith(":host")){if(J)G.push(Q);else{let q=Q.replace(/:host(\([^)]*\))?/,`.${X}$1`);G.push(q)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${X}`);continue}let W=Z?`${Z} .${X}`:`.${X}`;G.push(`${W} ${Q}`);let w=nK(Q,X);if(w)G.push(Z?`${Z} ${w}`:w)}return G.join(", ")}function nK($,X){let Z=0,J=$.length;for(let w=0;w<$.length;w++){let q=$[w];if(q==="["||q==="(")Z++;else if(q==="]"||q===")")Z--;else if(Z===0&&(q===" "||q===">"||q==="+"||q==="~")){J=w;break}}let Y=$.slice(0,J),G=$.slice(J);if(!Y)return"";let Q=Y.length,W=0;for(let w=0;w<Y.length;w++){let q=Y[w];if(q==="["||q==="(")W++;else if(q==="]"||q===")")W--;else if(Z===0&&W===0&&q===":"){Q=w;break}}return`${Y.slice(0,Q)}.${X}${Y.slice(Q)}${G}`}function FZ($){let X=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let J=Z.trim();if(X.has(J))return"";return X.add(J),Z})}function l8($,X){if(!rK.test($))return{html:$,hasScoped:!1};let Z=HZ(X),J=`data-v-${Z}`,Y=$,G=new RegExp(`<style\\s+([^>]*${R4}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(Y=Y.replace(G,(W,w,q)=>{Q=!0;let K=oK(q,J),z=w.replace(new RegExp(R4,"gi"),"").trim(),U=z?` ${z}`:"";return`<style data-stx-scoped="${Z}"${U}>${K}</style>`}),!Q)return{html:$,hasScoped:!1};return Y=aK(Y,J),{html:Y,hasScoped:!0}}function oK($,X){return _Z($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${X}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${X}]`)}function aK($,X){let Z=K1($,(Y,G)=>{let Q=f1(Y,G);return Q>G?Q:b5(Y,G)},(Y,G)=>sK(G)),J=tK(Z.output,X);return LZ.lastIndex=0,J.replace(LZ,(Y,G)=>Z.tokens[Number(G)])}function tK($,X){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(J,Y,G)=>{if(Z.has(Y.toLowerCase()))return J;if(J.includes(X))return J;if(Y.toLowerCase()==="style"||Y.toLowerCase()==="script")return J;if(G)return J.replace(`<${Y}${G}`,`<${Y} ${X}${G}`);if(J.endsWith("/>"))return`<${Y} ${X} />`;return`<${Y} ${X}>`})}var R4,rK,sK=($)=>`\x00stx-scope-mask-${$}\x00`,LZ;var N4=y(()=>{g1();R4=String.raw`(?<![\w-])scoped(?![\w-])`,rK=new RegExp(`<style\\s+[^>]*${R4}`,"i");LZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function $z($){let X=$.replace(/^<template\b/i,"").replace(/>$/,"");return eK.test(X)}function p8($){m7.lastIndex=0;let X;while((X=m7.exec($))!==null){if(X[0].startsWith("</")||$z(X[0]))continue;let Z=X.index,J=m7.lastIndex,Y=1,G;while((G=m7.exec($))!==null)if(G[0].startsWith("</")){if(Y--,Y===0){let Q=G.index;return{start:Z,openEnd:J,closeStart:Q,end:m7.lastIndex,content:$.slice(J,Q)}}}else Y++;return null}return null}var m7,eK;var M4=y(()=>{m7=/<\/?template\b[^>]*>/gi,eK=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var VZ=()=>{};function v0($,X,Z,J=0){let Y=0,G=J,Q=null,W=0,w=!1;while(G<$.length){let q=$[G];if(Q&&w){w=!1,G++;continue}if(Q&&q==="\\"){w=!0,G++;continue}if(w=!1,(q==='"'||q==="'"||q==="`")&&!Q){Q=q,G++;continue}if(q===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&q==="$"&&$[G+1]==="{"){W++,G+=2;continue}if(W>0&&q==="}"){W--,G++;continue}if(q==="`"&&Q==="`"&&W===0){Q=null,G++;continue}if(Q){G++;continue}if(q===X)Y++;else if(q===Z){if(Y--,Y===0)return G}G++}return-1}var I4={};t(I4,{useTitle:()=>Gz,useSeoMeta:()=>AZ,usePageTitle:()=>Gz,useHead:()=>k4,seoMetaToHeadConfig:()=>n8,resetHead:()=>Jz,renderHtmlAttrs:()=>Wz,renderHead:()=>Qz,renderBodyAttrs:()=>wz,processTitleDirective:()=>zz,processMetaDirective:()=>Uz,processHeadDirective:()=>Kz,mergeHeadConfigs:()=>d1,getPageMeta:()=>Zz,getHead:()=>T4,definePageMeta:()=>Yz,applyHead:()=>qz});function T4(){return u1}function Zz(){return i8}function Jz(){u1={},Xz.length=0,i8={}}function k4($){u1=d1(u1,$)}function d1($,X){return{title:X.title??$.title,titleTemplate:X.titleTemplate??$.titleTemplate,base:X.base??$.base,meta:[...$.meta||[],...X.meta||[]],link:[...$.link||[],...X.link||[]],script:[...$.script||[],...X.script||[]],style:[...$.style||[],...X.style||[]],htmlAttrs:{...$.htmlAttrs,...X.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...X.bodyAttrs}}}function AZ($){k4(n8($))}function n8($){let X=[];if($.description)X.push({name:"description",content:$.description});if($.keywords){let w=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;X.push({name:"keywords",content:w})}if($.author)X.push({name:"author",content:$.author});if($.robots)X.push({name:"robots",content:$.robots});let Z=$.ogTitle??$.title,J=$.ogDescription??$.description;if(Z)X.push({property:"og:title",content:Z});if(J)X.push({property:"og:description",content:J});if($.ogImage)X.push({property:"og:image",content:$.ogImage});if($.ogUrl)X.push({property:"og:url",content:$.ogUrl});if($.ogType)X.push({property:"og:type",content:$.ogType});if($.ogSiteName)X.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)X.push({property:"og:locale",content:$.ogLocale});let Y=$.twitterTitle??$.title,G=$.twitterDescription??$.description,Q=$.twitterImage??$.ogImage;if($.twitterCard)X.push({name:"twitter:card",content:$.twitterCard});if(Y)X.push({name:"twitter:title",content:Y});if(G)X.push({name:"twitter:description",content:G});if(Q)X.push({name:"twitter:image",content:Q});if($.twitterSite)X.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)X.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)X.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)X.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)X.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)X.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let w of $.articleTags)X.push({property:"article:tag",content:w});let W=[];if($.canonical)W.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:X,link:W}}function Yz($){if(i8={...i8,...$},$.title||$.description)AZ({title:$.title,description:$.description})}function Gz($){let X=typeof $==="function"?$():$;k4({title:X})}function Qz($=u1){let X=[];if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);X.push(`<title>${J5(Z)}</title>`)}if($.base){let Z=Object.entries($.base).map(([J,Y])=>`${J}="${J5(Y)}"`).join(" ");X.push(`<base ${Z}>`)}for(let Z of $.meta||[]){let J=Object.entries(Z).filter(([Y,G])=>G!==void 0).map(([Y,G])=>{return`${Y==="httpEquiv"?"http-equiv":Y}="${J5(String(G))}"`}).join(" ");X.push(`<meta ${J}>`)}for(let Z of $.link||[]){let J=Object.entries(Z).filter(([Y,G])=>G!==void 0).map(([Y,G])=>`${Y}="${J5(String(G))}"`).join(" ");X.push(`<link ${J}>`)}for(let Z of $.script||[]){let{content:J,...Y}=Z,G=Object.entries(Y).filter(([Q,W])=>W!==void 0).map(([Q,W])=>{if(typeof W==="boolean")return W?Q:"";return`${Q}="${J5(String(W))}"`}).filter(Boolean).join(" ");if(J)X.push(`<script ${G}>${J}</script>`);else X.push(`<script ${G}></script>`)}for(let Z of $.style||[]){let J=Z.type?` type="${Z.type}"`:"";X.push(`<style${J}>${Z.content}</style>`)}return X.join(`
2550
+ `)}function Wz($=u1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([X,Z])=>`${X}="${J5(Z)}"`).join(" ")}function wz($=u1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([X,Z])=>`${X}="${J5(Z)}"`).join(" ")}function J5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function qz($=u1){if(typeof document>"u")return;if($.title){let X=$.title;if($.titleTemplate)X=typeof $.titleTemplate==="function"?$.titleTemplate(X):$.titleTemplate.replace("%s",X);document.title=X}for(let X of $.meta||[]){let Z=X.name?`meta[name="${X.name}"]`:X.property?`meta[property="${X.property}"]`:null;if(Z){let J=document.querySelector(Z);if(!J){if(J=document.createElement("meta"),X.name)J.setAttribute("name",X.name);if(X.property)J.setAttribute("property",X.property);document.head.appendChild(J)}J.setAttribute("content",X.content)}}for(let X of $.link||[]){let Z=`link[rel="${X.rel}"]${X.href?`[href="${X.href}"]`:""}`,J=document.querySelector(Z);if(!J)J=document.createElement("link"),document.head.appendChild(J);for(let[Y,G]of Object.entries(X))if(G!==void 0)J.setAttribute(Y,String(G))}if($.htmlAttrs)for(let[X,Z]of Object.entries($.htmlAttrs))if(X==="class")for(let J of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add(J);else document.documentElement.setAttribute(X,Z);if($.bodyAttrs)for(let[X,Z]of Object.entries($.bodyAttrs))document.body.setAttribute(X,Z)}function Kz($){let X="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,Y)=>{return X+=Y.trim()+`
2551
+ `,""}),headContent:X.trim()}}function zz($,X){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,J,Y,G)=>{let Q=J?Y:X[(G||"").trim()]??G,W=X.__stx_runtime_head??{};return X.__stx_runtime_head=d1(W,{title:Q}),""})}function Uz($,X){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,J,Y,G,Q,W)=>{let w=G?Q:W,q=G?w:X[(w||"").trim()]??w,z=Y.includes(":")?{property:Y,content:q}:{name:Y,content:q},U=X.__stx_runtime_head??{};return X.__stx_runtime_head=d1(U,{meta:[z]}),""})}var u1,Xz,i8;var x5=y(()=>{u1={},Xz=[],i8={}});var r8={};t(r8,{stripTypeScript:()=>EZ,splitDeclaration:()=>PZ,isModuleResolutionFailure:()=>DZ,isMissingBindingFailure:()=>yZ,isCompleteImport:()=>bZ,hasVariables:()=>gZ,extractVariables:()=>Y5,extractScriptFromTemplate:()=>fZ,convertToCommonJS:()=>y4,STX_ENGINE_BINDING_NAMES:()=>D4});import B1 from"path";import f5 from"process";function Hz($){let X=[],Z=0,J=$.split(`
2552
2552
  `);for(let Y of J){let G=Z,Q=null,W=!1;for(let w=0;w<Y.length;w++){let q=Y[w];if(W){W=!1;continue}if(q==="\\"){W=!0;continue}if(Q){if(q===Q)Q=null;continue}if(q==="'"||q==='"'||q==="`"){Q=q;continue}if(q==="/"&&w+1<Y.length&&Y[w+1]==="/")break;if(q==="{")Z++;else if(q==="}")Z--}if(G===0){let w=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(w)X.push(w[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let q=Y.match(/(?:const|let|var)\s+(\w+)/);if(q)X.push(q[1])}else{let q=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(q){let z=q[1].slice(1,-1).split(",").map((U)=>{let j=U.split(":");return(j.length>1?j[1]:j[0]).trim()}).filter((U)=>/^\w+$/.test(U));X.push(...z)}}}}return[...new Set(X)]}function EZ($){let X=$;X=X.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),X=X.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),X=X.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),X=X.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),X=X.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(J){if(!J.includes(":"))return J;let Y=[],G="",Q=0,W=0,w=null;for(let q=0;q<J.length;q++){let K=J[q];if(w){if(G+=K,K===w)w=null;continue}if(K==='"'||K==="'"||K==="`"){w=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){Y.push(G),G="";continue}G+=K}if(G)Y.push(G);return Y.map((q)=>{let K=q.trim(),z=K.startsWith("..."),U=z?K.slice(3):K,j=-1,B=0;for(let A=0;A<U.length;A++)if(U[A]==="<")B++;else if(U[A]===">")B--;else if(U[A]===":"&&B===0){j=A;break}if(j===-1)return q;let _=U.substring(0,j).trim().replace(/\?$/,""),L=U.substring(j+1),O=-1,F=0;for(let A=0;A<L.length;A++)if(L[A]==="<")F++;else if(L[A]===">")F--;else if(L[A]==="="&&F===0){O=A;break}let V=z?"...":"";if(O!==-1)return`${V}${_} = ${L.substring(O+1).trim()}`;return`${V}${_}`}).join(", ")}X=X.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(J,Y,G)=>{if(!G.includes(":"))return J;return`${Y}(${Z(G)})`});{let J=/\b(function\s+\w*\s*)\(/g,Y,G=[];while((Y=J.exec(X))!==null){let Q=Y.index+Y[0].length-1,W=1,w=Q+1,q=0,K=null;while(w<X.length&&W>0){let j=X[w];if(K){if(j===K)K=null;w++;continue}if(j==='"'||j==="'"||j==="`"){K=j,w++;continue}if(j==="<")q++;else if(j===">"&&q>0)q--;else if(q===0){if(j==="(")W++;else if(j===")")W--}if(W>0)w++}if(W!==0)continue;let z=X.substring(Q+1,w);if(!z.includes(":"))continue;let U=Z(z);G.push({start:Q+1,end:w,replacement:U})}for(let Q=G.length-1;Q>=0;Q--){let{start:W,end:w,replacement:q}=G[Q];X=X.substring(0,W)+q+X.substring(w)}}return X=X.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(J,Y)=>{if(!Y.includes(":"))return J;if(Y.includes("{")||Y.includes("}"))return J;return`(${Y.split(",").map((Q)=>{let[W,...w]=Q.split("="),q=W.split(":")[0].trim();if(w.length>0)return`${q} = ${w.join("=").trim()}`;return q}).join(", ")}) =>`}),X=X.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"),X=X.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),X=X.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),X=X.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),X=X.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),X=X.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),X=X.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),X=X.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),X=X.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),X=X.replace(/\n\s*\n\s*\n/g,`
2553
2553
 
2554
- `),X}function DZ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function yZ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function G5($,X,Z,J={}){if(!$.trim())return;let Y;try{let C=H1({loader:"ts",target:"browser",define:d0()}),g=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");g=g.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=C.transformSync(g)}catch{Y=EZ($)}let G={exports:{}},Q=G.exports,W=g5.cwd(),w={},q=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of q)try{let g=u1.resolve(W,"node_modules",C),a=u1.join(g,"package.json"),c=JSON.parse(B0("fs").readFileSync(a,"utf8")),f=c.main||"index.js";if(c.exports){let d=typeof c.exports==="string"?c.exports:c.exports["."];if(typeof d==="string")f=d;else if(d?.bun)f=d.bun;else if(d?.import)f=d.import;else if(d?.default)f=d.default}w[C]=await import(u1.resolve(g,f))}catch{}let K=(C)=>{if(w[C])return w[C];return B0(C)},z=X.props||{},U=(C)=>{if(!C)return z;let g={};for(let[a,c]of Object.entries(C)){let f=z[a];if(f!==void 0)g[a]=f;else if(typeof c==="function")g[a]=c();else g[a]=c}return g};for(let[C,g]of Object.entries(z))Object.defineProperty(U,C,{value:g,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,C))continue;try{Object.defineProperty(U,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let j=(C)=>{if(!C)return z;let g={...z};for(let[a,c]of Object.entries(C)){let f=c&&typeof c==="object"&&!Array.isArray(c)?c:{type:c};if(g[a]===void 0&&f.default!==void 0)g[a]=typeof f.default==="function"?f.default():f.default}return g},B=()=>X.slots||{},H=(C,g)=>{let a={...C};for(let[c,f]of Object.entries(g))if(a[c]===void 0)if(typeof f==="function")a[c]=f();else a[c]=f;return a},_=(C)=>{let g=()=>C;return g.set=(a)=>{},g.update=(a)=>{},g},L=(C)=>{let g,a=!1;return()=>{if(!a)try{g=C(),a=!0}catch{g=void 0}return g}},O=(C)=>{},F=(C)=>C(),V=(C)=>{},A=(C)=>{};function R(C){let g=C||{};if(g.title!==void 0||g.description!==void 0)E({title:g.title,description:g.description})}function N(C){if(!C||typeof C!=="object")return;let g=X.__stxClientPayload??{};Object.assign(g,C),X.__stxClientPayload=g}let k=()=>{let C=X.__stxServeContext,g=X.__stxServeSearch??C?.search??"",a=C?.path??"",c=Object.fromEntries(new URLSearchParams(g)),f=X.query,d=Object.keys(c).length>0?c:f??{},j0=g||(Object.keys(d).length>0?`?${new URLSearchParams(d).toString()}`:"");return{params:X.params??{},query:d,path:a,name:"",fullPath:a+j0,hash:"",matched:[]}},I=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),M=(C)=>{let g=X.__stx_runtime_head||{};X.__stx_runtime_head=h1(g,C||{})},E=(C)=>{M(n8(C||{}))},T=(C)=>({value:C}),D=(C)=>C,b=(C)=>({value:typeof C==="function"?C():C}),S=(C,g)=>{},P=(C)=>{},v=(C)=>{},x=(C)=>C?C():Promise.resolve(),i=(C)=>(g,...a)=>{},m=(C)=>{},R0=(C,g)=>{},w0=(C,g)=>g,C0=()=>({value:"light"}),P0=()=>_(!1),n=(C)=>_(!1),q0=()=>_(!1),Y0=()=>n("(prefers-color-scheme: dark)"),N0=()=>n("(prefers-color-scheme: light)"),M0=()=>n("(prefers-reduced-motion: reduce)"),l=()=>n("(prefers-contrast: more)"),p={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(p,{get(C,g){if(g in C)return C[g];return},set(C,g,a){return C[g]=a,!0}}),l0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},v0=console;try{let C=y4(Y,Z),g=new Set(Object.keys(z)),a=(t)=>/^[a-z_$][\w$]*$/i.test(t),c=Object.keys(X).filter((t)=>!g.has(t)&&!jz.has(t)&&a(t)),f=c.map((t)=>X[t]);if(!c.includes("__stxServeContext"))c.push("__stxServeContext"),f.push(void 0);let d=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"]),j0=[],X0=[];for(let[t,Z1]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))continue;if(d.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(C))continue;j0.push(t),X0.push(Z1)}let D0=Hz(C).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
2555
- `),b1=X.params??{},p0=[],u0=[];for(let t=0;t<c.length;t++){if(c[t]==="params")continue;p0.push(c[t]),u0.push(f[t])}let s1=await Function(...D4,...j0,...p0,`return (async () => {
2554
+ `),X}function DZ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function yZ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function Y5($,X,Z,J={}){if(!$.trim())return;let Y;try{let C=H1({loader:"ts",target:"browser",define:u0()}),g=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");g=g.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=C.transformSync(g)}catch{Y=EZ($)}let G={exports:{}},Q=G.exports,W=f5.cwd(),w={},q=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C)),K=new Map;for(let C of q)try{if(C.startsWith(".")){w[C]=await import(B1.resolve(B1.dirname(Z),C));continue}let g=B1.resolve(W,"node_modules",C),c=B1.join(g,"package.json"),v=JSON.parse(B0("fs").readFileSync(c,"utf8")),u=v.main||"index.js";if(v.exports){let e=typeof v.exports==="string"?v.exports:v.exports["."];if(typeof e==="string")u=e;else if(e?.bun)u=e.bun;else if(e?.import)u=e.import;else if(e?.default)u=e.default}w[C]=await import(B1.resolve(g,u))}catch(g){if(C.startsWith("."))K.set(C,g instanceof Error?g.message:String(g))}let z=(C)=>{if(w[C])return w[C];let g=K.get(C);if(g!==void 0)throw Error(`Cannot require '${C}' from ${Z}: ${g}`);return B0(C)},U=X.props||{},j=(C)=>{if(!C)return U;let g={};for(let[c,v]of Object.entries(C)){let u=U[c];if(u!==void 0)g[c]=u;else if(typeof v==="function")g[c]=v();else g[c]=v}return g};for(let[C,g]of Object.entries(U))Object.defineProperty(j,C,{value:g,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,C))continue;try{Object.defineProperty(j,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(C)=>{if(!C)return U;let g={...U};for(let[c,v]of Object.entries(C)){let u=v&&typeof v==="object"&&!Array.isArray(v)?v:{type:v};if(g[c]===void 0&&u.default!==void 0)g[c]=typeof u.default==="function"?u.default():u.default}return g},H=()=>X.slots||{},_=(C,g)=>{let c={...C};for(let[v,u]of Object.entries(g))if(c[v]===void 0)if(typeof u==="function")c[v]=u();else c[v]=u;return c},L=(C)=>{let g=()=>C;return g.set=(c)=>{},g.update=(c)=>{},g},O=(C)=>{let g,c=!1;return()=>{if(!c)try{g=C(),c=!0}catch{g=void 0}return g}},F=(C)=>{},V=(C)=>C(),A=(C)=>{},R=(C)=>{};function N(C){let g=C||{};if(g.title!==void 0||g.description!==void 0)T({title:g.title,description:g.description})}function k(C){if(!C||typeof C!=="object")return;let g=X.__stxClientPayload??{};Object.assign(g,C),X.__stxClientPayload=g}let I=()=>{let C=X.__stxServeContext,g=X.__stxServeSearch??C?.search??"",c=C?.path??"",v=Object.fromEntries(new URLSearchParams(g)),u=X.query,e=Object.keys(v).length>0?v:u??{},$0=g||(Object.keys(e).length>0?`?${new URLSearchParams(e).toString()}`:"");return{params:X.params??{},query:e,path:c,name:"",fullPath:c+$0,hash:"",matched:[]}},M=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),E=(C)=>{let g=X.__stx_runtime_head||{};X.__stx_runtime_head=d1(g,C||{})},T=(C)=>{E(n8(C||{}))},D=(C)=>({value:C}),b=(C)=>C,S=(C)=>({value:typeof C==="function"?C():C}),P=(C,g)=>{},x=(C)=>{},f=(C)=>{},p=(C)=>C?C():Promise.resolve(),m=(C)=>(g,...c)=>{},A0=(C)=>{},K0=(C,g)=>{},b0=(C,g)=>g,S0=()=>({value:"light"}),r=()=>L(!1),Y0=(C)=>L(!1),G0=()=>L(!1),R0=()=>Y0("(prefers-color-scheme: dark)"),N0=()=>Y0("(prefers-color-scheme: light)"),l=()=>Y0("(prefers-reduced-motion: reduce)"),i=()=>Y0("(prefers-contrast: more)"),z0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},c0=new Proxy(z0,{get(C,g){if(g in C)return C[g];return},set(C,g,c){return C[g]=c,!0}}),C0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},t0=console;try{let C=y4(Y,Z),g=new Set(Object.keys(U)),c=(a)=>/^[a-z_$][\w$]*$/i.test(a),v=Object.keys(X).filter((a)=>!g.has(a)&&!jz.has(a)&&c(a)),u=v.map((a)=>X[a]);if(!v.includes("__stxServeContext"))v.push("__stxServeContext"),u.push(void 0);let e=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"]),$0=[],M0=[];for(let[a,q0]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(e.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(C))continue;$0.push(a),M0.push(q0)}let b1=Hz(C).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
2555
+ `),n0=X.params??{},h0=[],e0=[];for(let a=0;a<v.length;a++){if(v[a]==="params")continue;h0.push(v[a]),e0.push(u[a])}let S1=await Function(...D4,...$0,...h0,`return (async () => {
2556
2556
  ${C}
2557
- ${D0}
2557
+ ${b1}
2558
2558
  return module.exports
2559
- })()`)(G,Q,K,z,U,j,H,N,_,L,O,F,V,A,R,k,I,M,E,T,D,b,S,P,v,x,i,m,B,R0,w0,C0,P0,n,q0,Y0,N0,M0,l,U0,l0,v0,p.confirm,p.alert,p.fetch,b1,...X0,...u0);if(J.preserveExisting){for(let[t,Z1]of Object.entries(s1))if(!(t in X)||X[t]===void 0)X[t]=Z1}else Object.assign(X,s1);for(let[t,Z1]of Object.entries(z))if(!(t in X))X[t]=Z1}catch(C){let g=C instanceof Error?C.message:String(C);if(DZ(g))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${g}`);else if(yZ(g))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: ${g}`);else if(g5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${g}`);try{await Az(Y,X,Z)}catch(a){if(g5.env.STX_DEBUG){let c=a instanceof Error?a.message:String(a);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${c}`)}}}}function bZ($){let X=0,Z=null,J=!1,Y=!1;for(let G=0;G<$.length;G++){let Q=$[G];if(Z){if(Q===Z){if(Z=null,J||X===0)Y=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")X++;else if(Q==="}")X--;else if($.startsWith("from",G)&&X===0)J=!0}return Z===null&&X===0&&Y}function y4($,X){let Z=X?u1.dirname(X):g5.cwd(),J=g5.cwd(),Y=$.split(`
2559
+ })()`)(G,Q,z,U,j,B,_,k,L,O,F,V,A,R,N,I,M,E,T,D,b,S,P,x,f,p,m,A0,H,K0,b0,S0,r,Y0,G0,R0,N0,l,i,c0,C0,t0,z0.confirm,z0.alert,z0.fetch,n0,...M0,...e0);if(J.preserveExisting){for(let[a,q0]of Object.entries(S1))if(!(a in X)||X[a]===void 0)X[a]=q0}else Object.assign(X,S1);for(let[a,q0]of Object.entries(U))if(!(a in X))X[a]=q0}catch(C){let g=C instanceof Error?C.message:String(C);if(DZ(g))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${g}`);else if(yZ(g))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: ${g}`);else if(f5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${g}`);try{await Az(Y,X,Z)}catch(c){if(f5.env.STX_DEBUG){let v=c instanceof Error?c.message:String(c);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${v}`)}}}}function bZ($){let X=0,Z=null,J=!1,Y=!1;for(let G=0;G<$.length;G++){let Q=$[G];if(Z){if(Q===Z){if(Z=null,J||X===0)Y=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")X++;else if(Q==="}")X--;else if($.startsWith("from",G)&&X===0)J=!0}return Z===null&&X===0&&Y}function y4($,X){let Z=X?B1.dirname(X):f5.cwd(),J=f5.cwd(),Y=$.split(`
2560
2560
  `),G=[],Q=0;while(Q<Y.length){let W=Y[Q].trim();if(W.startsWith("interface ")||W.startsWith("export interface ")||W.startsWith("type ")||W.startsWith("export type ")){if(W.includes("{")&&!W.includes("}")){let w=0;for(;Q<Y.length;Q++){for(let q of Y[Q])if(q==="{")w++;else if(q==="}")w--;if(w<=0)break}}Q++;continue}if(W.startsWith("definePageMeta(")){let w=0,q=!1,K=Q;for(let j=Q;j<Y.length&&!q;j++){let B=null,H=!1,_=Y[j];for(let L=0;L<_.length;L++){let O=_[L];if(H){H=!1;continue}if(O==="\\"){H=!0;continue}if(B){if(O===B)B=null;continue}if(O==='"'||O==="'"||O==="`"){B=O;continue}if(O==="(")w++;else if(O===")"){if(w--,w===0){Q=j+1,q=!0;break}}}}if(!q)Q=Y.length;let z=Y.slice(K,Q).join(`
2561
- `),U=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(z);if(B)U.push(`${j}: ${JSON.stringify(B[2])}`)}if(U.length>0)G.push(`useSeoMeta({ ${U.join(", ")} });`);continue}if(W.startsWith("import ")||W==="import"||W.startsWith("import{")){let w=W,q=0;while(!bZ(w)&&Q+q+1<Y.length)q++,w=`${w} ${Y[Q+q].trim()}`;Q+=q;let K=w.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=w.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=w.match(/^import\s+['"](.+?)['"]/),j=w,B=(H)=>{if(H.startsWith("."))return u1.resolve(Z,H);if(H.startsWith("~/")||H.startsWith("@/"))return u1.resolve(J,H.slice(2));return H};if(K){let[,H,_]=K,L=B(_);G.push(`const ${H} = (await import('${L}')).default`),G.push(`module.exports.${H} = ${H};`)}else if(z){let[,H,_]=z,L=B(_),O=[],F=[],V=Bz.has(_);for(let A of H.split(",")){let R=A.trim();if(!R)continue;let N=R.split(/\s+as\s+/);if(N.length===2){let[k,I]=[N[0].trim(),N[1].trim()];if(V&&RZ.has(k)){G.push(`const ${I} = ${k};`);continue}O.push(`${k}: ${I}`),F.push(I)}else{if(V&&RZ.has(R))continue;O.push(R),F.push(R)}}if(O.length>0)G.push(`const { ${O.join(", ")} } = await import('${L}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(U){let H=B(U[1]);G.push(`await import('${H}')`)}else G.push(j);Q++;continue}if(_z.test(W))G.push(Y[Q]),Q++;else if(W.startsWith("export const ")||W.startsWith("export let ")||W.startsWith("export var ")){let w=MZ(Y,Q),{type:q,name:K,value:z}=w;G.push(`${q} ${K} = ${z};`),G.push(`module.exports.${K} = ${K};`),Q=w.nextIndex}else if(W.startsWith("export function ")||W.startsWith("export async function ")){let w=E4(Y,Q);G.push(w.functionCode),G.push(`module.exports.${w.name} = ${w.name};`),Q=w.nextIndex}else if(W.startsWith("const ")||W.startsWith("let ")||W.startsWith("var ")){let w=MZ(Y,Q),{type:q,name:K,value:z}=w;G.push(`${q} ${K} = ${z};`),G.push(`module.exports.${K} = ${K};`),Q=w.nextIndex}else if(W.startsWith("function ")||W.startsWith("async function ")){let w=E4(Y,Q);G.push(w.functionCode),G.push(`module.exports.${w.name} = ${w.name};`),Q=w.nextIndex}else if(W.startsWith("export default function ")||W.startsWith("export default async function ")){let w=Y[Q].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...Y];q[Q]=w;let K=E4(q,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 w=W.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${w};`),Q++}else if(W.startsWith("class ")||W.startsWith("export class ")){let w=W.match(/(?:export\s+)?class\s+(\w+)/);if(w){let q=w[1],K=Y[Q].replace(/^export\s+/,""),z=0,U=Q;for(;U<Y.length;U++){let j=Y[U];for(let B of j)if(B==="{")z++;else if(B==="}")z--;if(U>Q)K+=`
2561
+ `),U=[];for(let j of["title","description"]){let B=new RegExp(`\\b${j}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(z);if(B)U.push(`${j}: ${JSON.stringify(B[2])}`)}if(U.length>0)G.push(`useSeoMeta({ ${U.join(", ")} });`);continue}if(W.startsWith("import ")||W==="import"||W.startsWith("import{")){let w=W,q=0;while(!bZ(w)&&Q+q+1<Y.length)q++,w=`${w} ${Y[Q+q].trim()}`;Q+=q;let K=w.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=w.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=w.match(/^import\s+['"](.+?)['"]/),j=w,B=(H)=>{if(H.startsWith("."))return B1.resolve(Z,H);if(H.startsWith("~/")||H.startsWith("@/"))return B1.resolve(J,H.slice(2));return H};if(K){let[,H,_]=K,L=B(_);G.push(`const ${H} = (await import('${L}')).default`),G.push(`module.exports.${H} = ${H};`)}else if(z){let[,H,_]=z,L=B(_),O=[],F=[],V=Bz.has(_);for(let A of H.split(",")){let R=A.trim();if(!R)continue;let N=R.split(/\s+as\s+/);if(N.length===2){let[k,I]=[N[0].trim(),N[1].trim()];if(V&&RZ.has(k)){G.push(`const ${I} = ${k};`);continue}O.push(`${k}: ${I}`),F.push(I)}else{if(V&&RZ.has(R))continue;O.push(R),F.push(R)}}if(O.length>0)G.push(`const { ${O.join(", ")} } = await import('${L}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(U){let H=B(U[1]);G.push(`await import('${H}')`)}else G.push(j);Q++;continue}if(_z.test(W))G.push(Y[Q]),Q++;else if(W.startsWith("export const ")||W.startsWith("export let ")||W.startsWith("export var ")){let w=MZ(Y,Q),{type:q,name:K,value:z}=w;G.push(`${q} ${K} = ${z};`),G.push(`module.exports.${K} = ${K};`),Q=w.nextIndex}else if(W.startsWith("export function ")||W.startsWith("export async function ")){let w=E4(Y,Q);G.push(w.functionCode),G.push(`module.exports.${w.name} = ${w.name};`),Q=w.nextIndex}else if(W.startsWith("const ")||W.startsWith("let ")||W.startsWith("var ")){let w=MZ(Y,Q),{type:q,name:K,value:z}=w;G.push(`${q} ${K} = ${z};`),G.push(`module.exports.${K} = ${K};`),Q=w.nextIndex}else if(W.startsWith("function ")||W.startsWith("async function ")){let w=E4(Y,Q);G.push(w.functionCode),G.push(`module.exports.${w.name} = ${w.name};`),Q=w.nextIndex}else if(W.startsWith("export default function ")||W.startsWith("export default async function ")){let w=Y[Q].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...Y];q[Q]=w;let K=E4(q,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 w=W.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${w};`),Q++}else if(W.startsWith("class ")||W.startsWith("export class ")){let w=W.match(/(?:export\s+)?class\s+(\w+)/);if(w){let q=w[1],K=Y[Q].replace(/^export\s+/,""),z=0,U=Q;for(;U<Y.length;U++){let j=Y[U];for(let B of j)if(B==="{")z++;else if(B==="}")z--;if(U>Q)K+=`
2562
2562
  `+j;if(z<=0&&U>=Q)break}G.push(K),G.push(`module.exports.${q} = ${q};`),Q=U+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 Oz(G.join(`
2563
2563
  `),Z,J)}function Oz($,X,Z){let J=$.length,Y="",G=0,Q=null,W=!1,w=!1,q=0;while(G<J){let K=$[G],z=$[G+1];if(W){if(Y+=K,K===`
2564
- `)W=!1;G++;continue}if(w){if(Y+=K,K==="*"&&z==="/"){Y+=z,G+=2,w=!1;continue}G++;continue}if(!Q&&K==="/"&&z==="/"){W=!0,Y+=K,G++;continue}if(!Q&&K==="/"&&z==="*"){w=!0,Y+=K,G++;continue}if(Q){if(Y+=K,K==="\\"){Y+=z,G+=2;continue}if(K===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(K==="$"&&z==="{"){q++,Y+=z,G+=2;continue}if(K==="`"){Q=null,G++;continue}}G++;continue}if(q>0){if(K==="{")q++;else if(K==="}")q--}if(K==='"'||K==="'"||K==="`"){Q=K,Y+=K,G++;continue}if(K==="a"&&$.startsWith("await",G)){let U=Lz($,G);if(U){let{quote:j,path:B,end:H}=U;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let _=B.startsWith(".")?u1.resolve(X,B):u1.resolve(Z,B.slice(2));Y+=`await import(${j}${_}${j})`,G=H;continue}}}Y+=K,G++}return Y}function Lz($,X){let Z=X+5;if(Z>=$.length)return null;if(!/\s/.test($[Z]))return null;while(Z<$.length&&/\s/.test($[Z]))Z++;if(!$.startsWith("import",Z))return null;Z+=6;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let Y=Z;while(Z<$.length&&$[Z]!==J)if($[Z]==="\\")Z+=2;else Z++;if(Z>=$.length)return null;let G=$.slice(Y,Z);Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return{quote:J,path:G,end:Z+1}}function SZ($,X){let Z=$[X];if(Z!=="{"&&Z!=="[")return null;let Y=x0($,Z,Z==="{"?"}":"]",X);if(Y===-1)return null;return{pattern:$.slice(X,Y+1),endPos:Y+1}}function CZ($){let X=[],Z=$.slice(1,-1).trim();if(!Z)return X;let J=0,Y=0,G="";while(J<Z.length){let Q=Z[J];if(Q==="{"||Q==="["){let W=Y===0?SZ(Z,J):null;if(W){X.push(...CZ(W.pattern)),J=W.endPos,G="";continue}Y++}else if(Q==="}"||Q==="]")Y--;if(Y>0){J++;continue}if(Q===","){if(G.trim())X.push(G.trim());G="",J++;continue}if(Q===":"){G="",J++;continue}if(Q==="="){if(G.trim())X.push(G.trim());G="",J++;while(J<Z.length&&Z[J]!==","&&Y===0){if(Z[J]==="{"||Z[J]==="[")Y++;else if(Z[J]==="}"||Z[J]==="]")Y--;J++}continue}if(/[\w$]/.test(Q))G+=Q;J++}if(G.trim())X.push(G.trim());return X}function PZ($){let X=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!X)return null;let Z=X[0].length,J=(Y)=>Y===" "||Y==="\t";while(Z<$.length&&J($[Z]))Z++;if($[Z]===":"){let Y=0,G=null;Z++;for(;Z<$.length;Z++){let Q=$[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==="<"){Y++;continue}if(Q===")"||Q==="]"||Q==="}"||Q===">"){Y--;continue}if(Q==="="&&Y<=0){let W=$[Z+1],w=$[Z-1];if(W!=="="&&W!==">"&&w!=="="&&w!=="!"&&w!=="<"&&w!==">")break}}if($[Z]!=="=")return null}while(Z<$.length&&J($[Z]))Z++;if($[Z]!=="=")return null;return{type:X[1],name:X[2],value:$.slice(Z+1).trim()}}function NZ($,X,Z,J){let Y=null,G=!1;for(let Q of $){if(G){G=!1;continue}if(Q==="\\"){G=!0;continue}if(Y){if(Q===Y)Y=null;continue}if(Q==="'"||Q==='"'||Q==="`"){Y=Q;continue}if(Q===X)J++;else if(Q===Z)J--}return J}function MZ($,X){let Z=$[X].trim(),J=PZ(Z),Y=J?[Z,J.type,J.name,J.value]:null;if(!Y){let K=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(K){let z=Z.slice(K[0].length),U=X;if(z.startsWith("{")||z.startsWith("[")){let B=z[0],H=B==="{"?"}":"]",_=NZ(z,B,H,0),L=z;for(let O=X+1;O<$.length&&_>0;O++)L+=` ${$[O].trim()}`,U=O,_=NZ($[O],B,H,_);if(_>0)L=z,U=X;z=L}let j=SZ(z,0);if(j){let B=K[1],H=j.pattern,_=z.slice(j.endPos).trim();if(_.startsWith("=")){let L=_.slice(1).trim(),O=L,F=Math.max(U,X);if(TZ(L)){let N=kZ($,F,L);O=N.value,F=N.nextIndex}else F=F+1;O=O.trim().replace(/;$/,"");let V=CZ(H),A=`__stx_src_${X}`,R=V.map((N)=>`module.exports.${N} = ${N};`).join(`
2564
+ `)W=!1;G++;continue}if(w){if(Y+=K,K==="*"&&z==="/"){Y+=z,G+=2,w=!1;continue}G++;continue}if(!Q&&K==="/"&&z==="/"){W=!0,Y+=K,G++;continue}if(!Q&&K==="/"&&z==="*"){w=!0,Y+=K,G++;continue}if(Q){if(Y+=K,K==="\\"){Y+=z,G+=2;continue}if(K===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(K==="$"&&z==="{"){q++,Y+=z,G+=2;continue}if(K==="`"){Q=null,G++;continue}}G++;continue}if(q>0){if(K==="{")q++;else if(K==="}")q--}if(K==='"'||K==="'"||K==="`"){Q=K,Y+=K,G++;continue}if(K==="a"&&$.startsWith("await",G)){let U=Lz($,G);if(U){let{quote:j,path:B,end:H}=U;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let _=B.startsWith(".")?B1.resolve(X,B):B1.resolve(Z,B.slice(2));Y+=`await import(${j}${_}${j})`,G=H;continue}}}Y+=K,G++}return Y}function Lz($,X){let Z=X+5;if(Z>=$.length)return null;if(!/\s/.test($[Z]))return null;while(Z<$.length&&/\s/.test($[Z]))Z++;if(!$.startsWith("import",Z))return null;Z+=6;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let J=$[Z];if(J!=="'"&&J!=='"')return null;Z++;let Y=Z;while(Z<$.length&&$[Z]!==J)if($[Z]==="\\")Z+=2;else Z++;if(Z>=$.length)return null;let G=$.slice(Y,Z);Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return{quote:J,path:G,end:Z+1}}function SZ($,X){let Z=$[X];if(Z!=="{"&&Z!=="[")return null;let Y=v0($,Z,Z==="{"?"}":"]",X);if(Y===-1)return null;return{pattern:$.slice(X,Y+1),endPos:Y+1}}function CZ($){let X=[],Z=$.slice(1,-1).trim();if(!Z)return X;let J=0,Y=0,G="";while(J<Z.length){let Q=Z[J];if(Q==="{"||Q==="["){let W=Y===0?SZ(Z,J):null;if(W){X.push(...CZ(W.pattern)),J=W.endPos,G="";continue}Y++}else if(Q==="}"||Q==="]")Y--;if(Y>0){J++;continue}if(Q===","){if(G.trim())X.push(G.trim());G="",J++;continue}if(Q===":"){G="",J++;continue}if(Q==="="){if(G.trim())X.push(G.trim());G="",J++;while(J<Z.length&&Z[J]!==","&&Y===0){if(Z[J]==="{"||Z[J]==="[")Y++;else if(Z[J]==="}"||Z[J]==="]")Y--;J++}continue}if(/[\w$]/.test(Q))G+=Q;J++}if(G.trim())X.push(G.trim());return X}function PZ($){let X=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!X)return null;let Z=X[0].length,J=(Y)=>Y===" "||Y==="\t";while(Z<$.length&&J($[Z]))Z++;if($[Z]===":"){let Y=0,G=null;Z++;for(;Z<$.length;Z++){let Q=$[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==="<"){Y++;continue}if(Q===")"||Q==="]"||Q==="}"||Q===">"){Y--;continue}if(Q==="="&&Y<=0){let W=$[Z+1],w=$[Z-1];if(W!=="="&&W!==">"&&w!=="="&&w!=="!"&&w!=="<"&&w!==">")break}}if($[Z]!=="=")return null}while(Z<$.length&&J($[Z]))Z++;if($[Z]!=="=")return null;return{type:X[1],name:X[2],value:$.slice(Z+1).trim()}}function NZ($,X,Z,J){let Y=null,G=!1;for(let Q of $){if(G){G=!1;continue}if(Q==="\\"){G=!0;continue}if(Y){if(Q===Y)Y=null;continue}if(Q==="'"||Q==='"'||Q==="`"){Y=Q;continue}if(Q===X)J++;else if(Q===Z)J--}return J}function MZ($,X){let Z=$[X].trim(),J=PZ(Z),Y=J?[Z,J.type,J.name,J.value]:null;if(!Y){let K=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(K){let z=Z.slice(K[0].length),U=X;if(z.startsWith("{")||z.startsWith("[")){let B=z[0],H=B==="{"?"}":"]",_=NZ(z,B,H,0),L=z;for(let O=X+1;O<$.length&&_>0;O++)L+=` ${$[O].trim()}`,U=O,_=NZ($[O],B,H,_);if(_>0)L=z,U=X;z=L}let j=SZ(z,0);if(j){let B=K[1],H=j.pattern,_=z.slice(j.endPos).trim();if(_.startsWith("=")){let L=_.slice(1).trim(),O=L,F=Math.max(U,X);if(TZ(L)){let N=kZ($,F,L);O=N.value,F=N.nextIndex}else F=F+1;O=O.trim().replace(/;$/,"");let V=CZ(H),A=`__stx_src_${X}`,R=V.map((N)=>`module.exports.${N} = ${N};`).join(`
2565
2565
  `);return{type:B,name:A,value:`${O}; ${B} ${H} = ${A};
2566
2566
  ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,W]=Y,w=W,q=X;if(TZ(W)){let K=kZ($,X,W);w=K.value,q=K.nextIndex}else q=X+1;while(q<$.length){let K=$[q].trim();if(K.startsWith(".")||K.startsWith("?."))w+=`
2567
- ${$[q]}`,q++;else break}return w=w.trim().replace(/;$/,""),{type:G,name:Q,value:w,nextIndex:q}}function E4($,X){let Z=$[X].trim(),J=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Z}`);let[,Y]=J,G=Z.replace(/^export\s+/,""),Q=X;if(Fz(Z)){let W=Vz($,X,G);G=W.functionCode,Q=W.nextIndex}else Q=X+1;return{name:Y,functionCode:G,nextIndex:Q}}function TZ($){let X=$.trim();if(X.startsWith("{"))return x0(X,"{","}",0)===-1;if(X.startsWith("["))return x0(X,"[","]",0)===-1;return!vZ(X)}function vZ($){let X={paren:0,bracket:0,brace:0},Z=null,J=0;for(let Y=0;Y<$.length;Y++){let G=$[Y];if((Y>0?$[Y-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==="`"&&J===0){Z=null;continue}if(Z==="`"&&G==="$"&&$[Y+1]==="{"){J++,Y++;continue}if(J>0&&G==="{"){J++;continue}if(J>0&&G==="}"){J--;continue}if(Z)continue;if(G==="(")X.paren++;else if(G===")")X.paren--;else if(G==="[")X.bracket++;else if(G==="]")X.bracket--;else if(G==="{")X.brace++;else if(G==="}")X.brace--}return X.paren===0&&X.bracket===0&&X.brace===0&&Z===null}function xZ($){let X=$.indexOf("(");if(X===-1)return $.indexOf("{");let Z=x0($,"(",")",X);if(Z===-1)return-1;return $.indexOf("{",Z)}function Fz($){let X=xZ($);if(X===-1)return!0;return x0($,"{","}",X)===-1}function kZ($,X,Z){let J=Z,Y=X+1;while(Y<$.length&&!vZ(J)){let G=$[Y];J+=`
2567
+ ${$[q]}`,q++;else break}return w=w.trim().replace(/;$/,""),{type:G,name:Q,value:w,nextIndex:q}}function E4($,X){let Z=$[X].trim(),J=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!J)throw Error(`Failed to parse function declaration: ${Z}`);let[,Y]=J,G=Z.replace(/^export\s+/,""),Q=X;if(Fz(Z)){let W=Vz($,X,G);G=W.functionCode,Q=W.nextIndex}else Q=X+1;return{name:Y,functionCode:G,nextIndex:Q}}function TZ($){let X=$.trim();if(X.startsWith("{"))return v0(X,"{","}",0)===-1;if(X.startsWith("["))return v0(X,"[","]",0)===-1;return!vZ(X)}function vZ($){let X={paren:0,bracket:0,brace:0},Z=null,J=0;for(let Y=0;Y<$.length;Y++){let G=$[Y];if((Y>0?$[Y-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==="`"&&J===0){Z=null;continue}if(Z==="`"&&G==="$"&&$[Y+1]==="{"){J++,Y++;continue}if(J>0&&G==="{"){J++;continue}if(J>0&&G==="}"){J--;continue}if(Z)continue;if(G==="(")X.paren++;else if(G===")")X.paren--;else if(G==="[")X.bracket++;else if(G==="]")X.bracket--;else if(G==="{")X.brace++;else if(G==="}")X.brace--}return X.paren===0&&X.bracket===0&&X.brace===0&&Z===null}function xZ($){let X=$.indexOf("(");if(X===-1)return $.indexOf("{");let Z=v0($,"(",")",X);if(Z===-1)return-1;return $.indexOf("{",Z)}function Fz($){let X=xZ($);if(X===-1)return!0;return v0($,"{","}",X)===-1}function kZ($,X,Z){let J=Z,Y=X+1;while(Y<$.length&&!vZ(J)){let G=$[Y];J+=`
2568
2568
  ${G}`,Y++}while(Y<$.length){let G=$[Y].trim();if(G.startsWith(".")||G.startsWith("?."))J+=`
2569
- ${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function Vz($,X,Z){let J=Z,Y=X+1;while(Y<$.length){let G=xZ(J);if(G!==-1){if(x0(J,"{","}",G)!==-1)break}let Q=$[Y];J+=`
2570
- ${Q}`,Y++}return{functionCode:J,nextIndex:Y}}function IZ($,X){let Z=Q0($,X)??Q0(`(${$})`,X);if(Z!==void 0)return Z;if(!/\bprocess\b/.test($))return;let J={...X,process:Object.freeze({env:{...g5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function Az($,X,Z){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of J){let[,,Q,W]=G;try{let w=W.trim().replace(/;$/,""),q=IZ(w,X);if(q!==void 0)X[Q]=q}catch(w){console.warn(`Failed to parse export ${Q} in fallback:`,w)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of Y){let[,,Q,W]=G;if(!(Q in X))try{let w=W.trim().replace(/;$/,""),q=IZ(w,X);if(q!==void 0)X[Q]=q}catch{}}}function fZ($){let X=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=X?X[1]:"",J=X?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Z,templateWithoutScript:J}}function gZ($){let X=$.trim();if(!X)return!1;return/(?:const|let|var|function)\s+\w+/.test(X)}var D4,RZ,jz,Bz,_z;var c7=y(()=>{V0();f5();P1();b0();D4=["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"],RZ=new Set(D4),jz=new Set(["props","$props","defineProps"]),Bz=new Set(["stx","@stacksjs/stx"]);_z=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var b4={};e(b4,{renderSlot:()=>uZ,processSlots:()=>mZ,parseSlots:()=>hZ,parseSlotElement:()=>kz,extractSlotContent:()=>Dz,applySlots:()=>yz});function Rz($,X){let Z=1,J=X,Y="<template",G="</template";while(J<$.length&&Z>0){let Q=$.indexOf("<",J);if(Q===-1)break;if(J=Q,$.startsWith(Y,J)&&(J+Y.length>=$.length||/[\s>\/]/.test($[J+Y.length]))){Z++,J+=Y.length;continue}if($.startsWith(G,J)){let W=$.indexOf(">",J+G.length);if(W!==-1){if(Z--,Z===0)return W+1;J=W+1;continue}}J++}return Z===0?J:-1}function Mz($,X){let Z=null;for(let J=X;J<$.length;J++){let Y=$[J];if(Z){if(Y==="\\"){J++;continue}if(Y===Z)Z=null;continue}if(Y==='"'||Y==="'"){Z=Y;continue}if(Y===">")return J+1}return-1}function Tz($){let X=[],Z=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,Y=0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;if($.startsWith("<!--",G)){let U=$.indexOf("-->",G+4);Y=U===-1?$.length:U+3;continue}let Q=Mz($,G+1);if(Q===-1)break;let W=$.slice(G,Q),w=W.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!w){Y=Q;continue}let q=w[1]==="/",K=w[2].toLowerCase();if(q){let U=Z.lastIndexOf(K);if(U!==-1)Z.splice(U);Y=Q;continue}if(K==="template"&&Z.length===0){let U=W.match(J);if(U){let j=Rz($,Q);if(j!==-1){let B=U[1]||U[2]||U[3];X.push({start:G,end:j,slotName:B,content:$.slice(Q,j-11).trim(),propsBinding:U[4]||void 0}),Y=j;continue}}}if(!/\/\s*>$/.test(W)&&!Nz.has(K)){if(Z.push(K),K==="script"||K==="style"){let U=$.toLowerCase().indexOf(`</${K}>`,Q);if(U!==-1){Y=U;continue}}}Y=Q}return X}function hZ($){let X={default:"",named:new Map},Z=$,J=Tz($);for(let w of J)X.named.set(w.slotName,{name:w.slotName,content:w.content,propsBinding:w.propsBinding});J.sort((w,q)=>q.start-w.start);for(let w of J)Z=Z.slice(0,w.start)+Z.slice(w.end);let Y=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[w,q,K,z,U,j]=Q,B=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(B+H).trim(),L=`<${q}${_?" "+_:""}>${j}</${q}>`;Y.push({start:Q.index,end:Q.index+w.length,slotName:z,element:L})}let W=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=W.exec(Z))!==null){let[w,q,K,z,U]=Q,j=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(j+B).trim(),_=`<${q}${H?" "+H:""} />`;Y.push({start:Q.index,end:Q.index+w.length,slotName:z,element:_})}Y.sort((w,q)=>q.start-w.start);for(let w of Y){let q=X.named.get(w.slotName);if(q)q.content+=w.element;else X.named.set(w.slotName,{name:w.slotName,content:w.element});Z=Z.slice(0,w.start)+Z.slice(w.end)}return X.default=Z.trim(),X}function kz($){let X=$.match(/name\s*=\s*["']([^"']+)["']/),Z=X?X[1]:"",J={},Y=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=Y.exec($))!==null)J[G[1]]=G[2];let Q=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),W=Q?Q[1].trim():"";return{name:Z,props:J,defaultContent:W}}async function uZ($,X,Z,J){if(!$)return Z;let Y=$.content;if($.propsBinding&&Object.keys(X).length>0){let G=$.propsBinding.trim(),Q={...J};if(G.startsWith("{")&&G.endsWith("}")){let W=G.slice(1,-1).split(",").map((w)=>w.trim()).filter(Boolean);for(let w of W){let[q,K]=w.split(":").map((U)=>U.trim()),z=K||q;if(X[q]!==void 0)Q[z]=X[q]}}else Q[G]=X;Y=Iz(Y,Q)}return Y}function Iz($,X){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,J)=>{try{let Y=J.trim(),G=dZ(Y,X);return j1(String(G??""))}catch{return`{{ ${J} }}`}})}function dZ($,X){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),Y=X;for(let G of J)if(Y&&typeof Y==="object"&&G in Y)Y=Y[G];else return;return Y}let Z=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,J,Y,G]=Z,Q=X[J],W=parseInt(G,10);if(typeof Q==="number")switch(Y){case"+":return Q+W;case"-":return Q-W;case"*":return Q*W;case"/":return Q/W}}try{if(!K0($))return;return z0($,Object.keys(X))(...Object.values(X))}catch{return}}async function mZ($,X,Z){let J=$;J=await Ez(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,W,w,q)=>{let K=X.named.get(W),z=q?.trim()||"",U=w||"",j={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=B.exec(U))!==null){let _=H[1],L=H[2];j[_]=dZ(L,Z)}return await uZ(K,j,z,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(G,(Q,W)=>{if(Q.includes("name="))return Q;let w=W?.trim()||"";return X.default||w}),J}async function Ez($,X,Z){let J=[],Y=[];$.replace(X,(W,...w)=>{let q=w[w.length-2];return Y.push({match:W,index:q}),J.push(Z(W,...w.slice(0,-2))),W});let G=await Promise.all(J),Q=$;for(let W=Y.length-1;W>=0;W--){let{match:w,index:q}=Y[W];Q=Q.slice(0,q)+G[W]+Q.slice(q+w.length)}return Q}function Dz($){let X=hZ($);return{defaultSlot:X.default,namedSlots:X.named}}async function yz($,X,Z,J){return await mZ($,{default:X,named:Z},J)}var Nz;var S4=y(()=>{B1();b0();Nz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function d1($,X){let Z=bz($,X);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function bz($,X){let Z=X;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let J=x0($,"(",")",Z);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:$.slice(Z+1,J),endPos:J+1}}function Sz($,X){let Z=$.lastIndexOf("<",X);if(Z===-1)return!1;return Z>$.lastIndexOf(">",X)}function Q5($,X,Z,J){let Y=1,G=J,Q=new RegExp(`@${X}\\s*\\(`,"g"),W=new RegExp(`@${Z}(?![a-z])`,"g");while(G<$.length&&Y>0){Q.lastIndex=G,W.lastIndex=G;let w=Q.exec($),q=W.exec($),K=w?w.index:1/0,z=q?q.index:1/0;if(K<z)Y++,G=K+w[0].length;else if(z<1/0){if(Y--,Y===0)return z;G=z+q[0].length}else break}return-1}function cZ($,X){let Z=$.slice(X).match(/^@if\s*/);if(!Z)return null;let J=X+Z[0].length,Y=d1($,J);if(!Y)return null;let G=Y.endPos,Q=Q5($,"if","endif",G);if(Q===-1)return null;let W=$.slice(G,Q),w=[],q=0,K="if",z=Y.expression,U=0,j=0;while(q<W.length){let B=W.indexOf("@",q);if(B===-1)break;q=B;let H=W.substring(B);if(Sz(W,B)){q++;continue}if(/^@if\s*\(/.test(H)){j++,q++;continue}if(/^@endif(?![a-z])/.test(H)){j--,q+=6;continue}if(j===0){let _=H.match(/^@elseif\s*/);if(_){w.push({type:K,condition:z,content:W.substring(U,q),start:G+U,end:G+q});let L=q+_[0].length,O=d1(W,L);if(!O){q++;continue}K="elseif",z=O.expression,q=O.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(H)){w.push({type:K,condition:z,content:W.substring(U,q),start:G+U,end:G+q}),K="else",z=void 0,q+=5,U=q;continue}}q++}return w.push({type:K,condition:z,content:W.slice(U),start:G+U,end:G+W.length}),{fullMatch:$.slice(X,Q+6),branches:w,start:X,end:Q+6}}function l7($){let X=[],Z=/@if\s*\(/g,J=Z.exec($);while(J!==null){if(X.some((Q)=>J.index>Q.start&&J.index<Q.end)){J=Z.exec($);continue}let G=cZ($,J.index);if(G)X.push(G),Z.lastIndex=G.end;J=Z.exec($)}return X}function o8($,X,Z){let J=[],Y=new RegExp(`@${X}\\s*\\(`,"g"),G=Y.exec($);while(G!==null){if(J.some((H)=>G.index>H.start&&G.index<H.end)){G=Y.exec($);continue}let W=G.index,w=W+G[0].length-1,q=x0($,"(",")",w);if(q===-1){G=Y.exec($);continue}let K=$.slice(w+1,q),z=q+1,U=Q5($,X,Z,z);if(U===-1){G=Y.exec($);continue}let j=$.slice(z,U),B=U+`@${Z}`.length;J.push({fullMatch:$.slice(W,B),name:X,params:K,content:j,start:W,end:B}),Y.lastIndex=B,G=Y.exec($)}return J}function C4($,X){let Z=$.slice(X).match(/^@switch\s*/);if(!Z)return null;let J=X+Z[0].length,Y=d1($,J);if(!Y)return null;let G=Y.endPos,Q=Q5($,"switch","endswitch",G);if(Q===-1)return null;let W=$.slice(G,Q),w=[],q=0,K=null,z=0;while(q<W.length){let U=W.slice(q),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(z++,K)K.content+=j[0];q+=j[0].length;continue}if(B){if(z--,K)K.content+=B[0];q+=B[0].length;continue}if(z>0){if(K)K.content+=W[q];q++;continue}let H=U.match(/^@case\s*/),_=U.match(/^@default(?![a-z])/),L=U.match(/^@break(?![a-z])/);if(H&&U.startsWith("@case")){if(K)w.push(K);let O=q+H[0].length,F=d1(W,O);if(!F){q++;continue}K={type:"case",value:F.expression,content:""},q=F.endPos}else if(_&&U.startsWith("@default")){if(K)w.push(K);K={type:"default",content:""},q+=_[0].length}else if(L&&U.startsWith("@break"))q+=L[0].length;else{if(K)K.content+=W[q];q++}}if(K)w.push(K);return{fullMatch:$.slice(X,Q+10),expression:Y.expression,cases:w,start:X,end:Q+10}}var lZ=()=>{};var pZ=()=>{};var s8=y(()=>{lZ();pZ()});async function nZ($){let X=$;if(!X)try{X=(await Y1())?.pagesDir||"pages"}catch{X="pages"}let Z=X,J=iZ.get(Z);if(J)return J;let Y=[];try{Y=k7(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{Y=[]}return iZ.set(Z,Y),Y}var iZ;var rZ=y(()=>{o9();M1();iZ=new Map});function xz($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function oZ($){return xz(JSON.stringify($))}function p7($){let X=0,Z,J=P4.map(()=>{return});while(X<$.length){if(Z===void 0||Z!==null&&Z.index<X)sZ.lastIndex=X,Z=sZ.exec($);if(!Z)return null;let Y=Z.index,G=-1,Q=null;for(let w=0;w<P4.length;w++){let q=P4[w],K=J[w];if(K===void 0||K!==null&&K.index<X)q.open.lastIndex=X,K=q.open.exec($),J[w]=K;if(!K)continue;if(K.index<Y&&(G===-1||K.index<G))G=K.index,Q=q.close}if(G===-1||!Q)return{index:Y,tag:Z[0],attrs:Z[1]??""};Q.lastIndex=G;let W=Q.exec($);if(!W)return null;X=W.index+W[0].length}return null}function a8($,X){let Z=p7($);if(!Z)return $;return $.slice(0,Z.index)+X(Z.tag,Z.attrs)+$.slice(Z.index+Z.tag.length)}var P4,sZ;var v4=y(()=>{P4=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],sZ=/<body\b([^>]*)>/gi});function x4(){return`
2569
+ ${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function Vz($,X,Z){let J=Z,Y=X+1;while(Y<$.length){let G=xZ(J);if(G!==-1){if(v0(J,"{","}",G)!==-1)break}let Q=$[Y];J+=`
2570
+ ${Q}`,Y++}return{functionCode:J,nextIndex:Y}}function IZ($,X){let Z=W0($,X)??W0(`(${$})`,X);if(Z!==void 0)return Z;if(!/\bprocess\b/.test($))return;let J={...X,process:Object.freeze({env:{...f5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function Az($,X,Z){let J=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of J){let[,,Q,W]=G;try{let w=W.trim().replace(/;$/,""),q=IZ(w,X);if(q!==void 0)X[Q]=q}catch(w){console.warn(`Failed to parse export ${Q} in fallback:`,w)}}let Y=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of Y){let[,,Q,W]=G;if(!(Q in X))try{let w=W.trim().replace(/;$/,""),q=IZ(w,X);if(q!==void 0)X[Q]=q}catch{}}}function fZ($){let X=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=X?X[1]:"",J=X?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Z,templateWithoutScript:J}}function gZ($){let X=$.trim();if(!X)return!1;return/(?:const|let|var|function)\s+\w+/.test(X)}var D4,RZ,jz,Bz,_z;var c7=y(()=>{F0();x5();x1();D0();D4=["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"],RZ=new Set(D4),jz=new Set(["props","$props","defineProps"]),Bz=new Set(["stx","@stacksjs/stx"]);_z=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var b4={};t(b4,{renderSlot:()=>uZ,processSlots:()=>mZ,parseSlots:()=>hZ,parseSlotElement:()=>kz,extractSlotContent:()=>Dz,applySlots:()=>yz});function Rz($,X){let Z=1,J=X,Y="<template",G="</template";while(J<$.length&&Z>0){let Q=$.indexOf("<",J);if(Q===-1)break;if(J=Q,$.startsWith(Y,J)&&(J+Y.length>=$.length||/[\s>\/]/.test($[J+Y.length]))){Z++,J+=Y.length;continue}if($.startsWith(G,J)){let W=$.indexOf(">",J+G.length);if(W!==-1){if(Z--,Z===0)return W+1;J=W+1;continue}}J++}return Z===0?J:-1}function Mz($,X){let Z=null;for(let J=X;J<$.length;J++){let Y=$[J];if(Z){if(Y==="\\"){J++;continue}if(Y===Z)Z=null;continue}if(Y==='"'||Y==="'"){Z=Y;continue}if(Y===">")return J+1}return-1}function Tz($){let X=[],Z=[],J=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,Y=0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;if($.startsWith("<!--",G)){let U=$.indexOf("-->",G+4);Y=U===-1?$.length:U+3;continue}let Q=Mz($,G+1);if(Q===-1)break;let W=$.slice(G,Q),w=W.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!w){Y=Q;continue}let q=w[1]==="/",K=w[2].toLowerCase();if(q){let U=Z.lastIndexOf(K);if(U!==-1)Z.splice(U);Y=Q;continue}if(K==="template"&&Z.length===0){let U=W.match(J);if(U){let j=Rz($,Q);if(j!==-1){let B=U[1]||U[2]||U[3];X.push({start:G,end:j,slotName:B,content:$.slice(Q,j-11).trim(),propsBinding:U[4]||void 0}),Y=j;continue}}}if(!/\/\s*>$/.test(W)&&!Nz.has(K)){if(Z.push(K),K==="script"||K==="style"){let U=$.toLowerCase().indexOf(`</${K}>`,Q);if(U!==-1){Y=U;continue}}}Y=Q}return X}function hZ($){let X={default:"",named:new Map},Z=$,J=Tz($);for(let w of J)X.named.set(w.slotName,{name:w.slotName,content:w.content,propsBinding:w.propsBinding});J.sort((w,q)=>q.start-w.start);for(let w of J)Z=Z.slice(0,w.start)+Z.slice(w.end);let Y=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[w,q,K,z,U,j]=Q,B=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(B+H).trim(),L=`<${q}${_?" "+_:""}>${j}</${q}>`;Y.push({start:Q.index,end:Q.index+w.length,slotName:z,element:L})}let W=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=W.exec(Z))!==null){let[w,q,K,z,U]=Q,j=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(j+B).trim(),_=`<${q}${H?" "+H:""} />`;Y.push({start:Q.index,end:Q.index+w.length,slotName:z,element:_})}Y.sort((w,q)=>q.start-w.start);for(let w of Y){let q=X.named.get(w.slotName);if(q)q.content+=w.element;else X.named.set(w.slotName,{name:w.slotName,content:w.element});Z=Z.slice(0,w.start)+Z.slice(w.end)}return X.default=Z.trim(),X}function kz($){let X=$.match(/name\s*=\s*["']([^"']+)["']/),Z=X?X[1]:"",J={},Y=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=Y.exec($))!==null)J[G[1]]=G[2];let Q=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),W=Q?Q[1].trim():"";return{name:Z,props:J,defaultContent:W}}async function uZ($,X,Z,J){if(!$)return Z;let Y=$.content;if($.propsBinding&&Object.keys(X).length>0){let G=$.propsBinding.trim(),Q={...J};if(G.startsWith("{")&&G.endsWith("}")){let W=G.slice(1,-1).split(",").map((w)=>w.trim()).filter(Boolean);for(let w of W){let[q,K]=w.split(":").map((U)=>U.trim()),z=K||q;if(X[q]!==void 0)Q[z]=X[q]}}else Q[G]=X;Y=Iz(Y,Q)}return Y}function Iz($,X){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,J)=>{try{let Y=J.trim(),G=dZ(Y,X);return U1(String(G??""))}catch{return`{{ ${J} }}`}})}function dZ($,X){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let J=$.split("."),Y=X;for(let G of J)if(Y&&typeof Y==="object"&&G in Y)Y=Y[G];else return;return Y}let Z=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,J,Y,G]=Z,Q=X[J],W=parseInt(G,10);if(typeof Q==="number")switch(Y){case"+":return Q+W;case"-":return Q-W;case"*":return Q*W;case"/":return Q/W}}try{if(!U0($))return;return j0($,Object.keys(X))(...Object.values(X))}catch{return}}async function mZ($,X,Z){let J=$;J=await Ez(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,W,w,q)=>{let K=X.named.get(W),z=q?.trim()||"",U=w||"",j={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=B.exec(U))!==null){let _=H[1],L=H[2];j[_]=dZ(L,Z)}return await uZ(K,j,z,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return J=J.replace(G,(Q,W)=>{if(Q.includes("name="))return Q;let w=W?.trim()||"";return X.default||w}),J}async function Ez($,X,Z){let J=[],Y=[];$.replace(X,(W,...w)=>{let q=w[w.length-2];return Y.push({match:W,index:q}),J.push(Z(W,...w.slice(0,-2))),W});let G=await Promise.all(J),Q=$;for(let W=Y.length-1;W>=0;W--){let{match:w,index:q}=Y[W];Q=Q.slice(0,q)+G[W]+Q.slice(q+w.length)}return Q}function Dz($){let X=hZ($);return{defaultSlot:X.default,namedSlots:X.named}}async function yz($,X,Z,J){return await mZ($,{default:X,named:Z},J)}var Nz;var S4=y(()=>{j1();D0();Nz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function m1($,X){let Z=bz($,X);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function bz($,X){let Z=X;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let J=v0($,"(",")",Z);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:$.slice(Z+1,J),endPos:J+1}}function Sz($,X){let Z=$.lastIndexOf("<",X);if(Z===-1)return!1;return Z>$.lastIndexOf(">",X)}function G5($,X,Z,J){let Y=1,G=J,Q=new RegExp(`@${X}\\s*\\(`,"g"),W=new RegExp(`@${Z}(?![a-z])`,"g");while(G<$.length&&Y>0){Q.lastIndex=G,W.lastIndex=G;let w=Q.exec($),q=W.exec($),K=w?w.index:1/0,z=q?q.index:1/0;if(K<z)Y++,G=K+w[0].length;else if(z<1/0){if(Y--,Y===0)return z;G=z+q[0].length}else break}return-1}function cZ($,X){let Z=$.slice(X).match(/^@if\s*/);if(!Z)return null;let J=X+Z[0].length,Y=m1($,J);if(!Y)return null;let G=Y.endPos,Q=G5($,"if","endif",G);if(Q===-1)return null;let W=$.slice(G,Q),w=[],q=0,K="if",z=Y.expression,U=0,j=0;while(q<W.length){let B=W.indexOf("@",q);if(B===-1)break;q=B;let H=W.substring(B);if(Sz(W,B)){q++;continue}if(/^@if\s*\(/.test(H)){j++,q++;continue}if(/^@endif(?![a-z])/.test(H)){j--,q+=6;continue}if(j===0){let _=H.match(/^@elseif\s*/);if(_){w.push({type:K,condition:z,content:W.substring(U,q),start:G+U,end:G+q});let L=q+_[0].length,O=m1(W,L);if(!O){q++;continue}K="elseif",z=O.expression,q=O.endPos,U=q;continue}else if(/^@else(?![a-z])/.test(H)){w.push({type:K,condition:z,content:W.substring(U,q),start:G+U,end:G+q}),K="else",z=void 0,q+=5,U=q;continue}}q++}return w.push({type:K,condition:z,content:W.slice(U),start:G+U,end:G+W.length}),{fullMatch:$.slice(X,Q+6),branches:w,start:X,end:Q+6}}function l7($){let X=[],Z=/@if\s*\(/g,J=Z.exec($);while(J!==null){if(X.some((Q)=>J.index>Q.start&&J.index<Q.end)){J=Z.exec($);continue}let G=cZ($,J.index);if(G)X.push(G),Z.lastIndex=G.end;J=Z.exec($)}return X}function o8($,X,Z){let J=[],Y=new RegExp(`@${X}\\s*\\(`,"g"),G=Y.exec($);while(G!==null){if(J.some((H)=>G.index>H.start&&G.index<H.end)){G=Y.exec($);continue}let W=G.index,w=W+G[0].length-1,q=v0($,"(",")",w);if(q===-1){G=Y.exec($);continue}let K=$.slice(w+1,q),z=q+1,U=G5($,X,Z,z);if(U===-1){G=Y.exec($);continue}let j=$.slice(z,U),B=U+`@${Z}`.length;J.push({fullMatch:$.slice(W,B),name:X,params:K,content:j,start:W,end:B}),Y.lastIndex=B,G=Y.exec($)}return J}function C4($,X){let Z=$.slice(X).match(/^@switch\s*/);if(!Z)return null;let J=X+Z[0].length,Y=m1($,J);if(!Y)return null;let G=Y.endPos,Q=G5($,"switch","endswitch",G);if(Q===-1)return null;let W=$.slice(G,Q),w=[],q=0,K=null,z=0;while(q<W.length){let U=W.slice(q),j=U.match(/^@switch\s*\(/),B=U.match(/^@endswitch(?![a-z])/);if(j){if(z++,K)K.content+=j[0];q+=j[0].length;continue}if(B){if(z--,K)K.content+=B[0];q+=B[0].length;continue}if(z>0){if(K)K.content+=W[q];q++;continue}let H=U.match(/^@case\s*/),_=U.match(/^@default(?![a-z])/),L=U.match(/^@break(?![a-z])/);if(H&&U.startsWith("@case")){if(K)w.push(K);let O=q+H[0].length,F=m1(W,O);if(!F){q++;continue}K={type:"case",value:F.expression,content:""},q=F.endPos}else if(_&&U.startsWith("@default")){if(K)w.push(K);K={type:"default",content:""},q+=_[0].length}else if(L&&U.startsWith("@break"))q+=L[0].length;else{if(K)K.content+=W[q];q++}}if(K)w.push(K);return{fullMatch:$.slice(X,Q+10),expression:Y.expression,cases:w,start:X,end:Q+10}}var lZ=()=>{};var pZ=()=>{};var s8=y(()=>{lZ();pZ()});async function nZ($){let X=$;if(!X)try{X=(await Y1())?.pagesDir||"pages"}catch{X="pages"}let Z=X,J=iZ.get(Z);if(J)return J;let Y=[];try{Y=k7(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{Y=[]}return iZ.set(Z,Y),Y}var iZ;var rZ=y(()=>{o9();M1();iZ=new Map});function xz($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function oZ($){return xz(JSON.stringify($))}function p7($){let X=0,Z,J=P4.map(()=>{return});while(X<$.length){if(Z===void 0||Z!==null&&Z.index<X)sZ.lastIndex=X,Z=sZ.exec($);if(!Z)return null;let Y=Z.index,G=-1,Q=null;for(let w=0;w<P4.length;w++){let q=P4[w],K=J[w];if(K===void 0||K!==null&&K.index<X)q.open.lastIndex=X,K=q.open.exec($),J[w]=K;if(!K)continue;if(K.index<Y&&(G===-1||K.index<G))G=K.index,Q=q.close}if(G===-1||!Q)return{index:Y,tag:Z[0],attrs:Z[1]??""};Q.lastIndex=G;let W=Q.exec($);if(!W)return null;X=W.index+W[0].length}return null}function a8($,X){let Z=p7($);if(!Z)return $;return $.slice(0,Z.index)+X(Z.tag,Z.attrs)+$.slice(Z.index+Z.tag.length)}var P4,sZ;var v4=y(()=>{P4=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],sZ=/<body\b([^>]*)>/gi});function x4(){return`
2571
2571
  (function(){
2572
2572
  var tip=null,hideTimer=null,currentEl=null;
2573
2573
 
@@ -2670,7 +2670,7 @@ document.addEventListener("focusout",function(e){
2670
2670
  if(el) hideTip();
2671
2671
  });
2672
2672
  })();
2673
- `}function g4(){return W5}function h4($){let X=W5;return aZ.push($),W5=$,X}function u4($){aZ.pop(),W5=$}function d4(){return t8>0}function m4($){f4.add($)}function tZ($){t8++;try{$()}finally{if(t8--,t8===0){let X=[...f4];f4.clear();for(let Z of X)Z()}}}function eZ($){let X=W5;W5=null;try{return $()}finally{W5=X}}var W5=null,aZ,t8=0,f4;var $J=y(()=>{aZ=[],f4=new Set});function m1($){let X=$,Z=new Set,J=new Set,Y=()=>{let G=g4();if(G)J.add(G);return X};return Y.set=(G)=>{if(!Object.is(G,X)){let Q=X;if(X=G,Z.forEach((W)=>W(X,Q)),d4())J.forEach((W)=>m4(W));else J.forEach((W)=>W())}},Y.update=(G)=>{Y.set(G(X))},Y.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(Y,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(Y,"value",{get:()=>Y(),set:(G)=>Y.set(G),configurable:!0}),Y}function $$($){let X,Z=!0,J=new Set,Y=()=>{if(!Z)if(Z=!0,d4())J.forEach((Q)=>m4(Q));else J.forEach((Q)=>Q())},G=()=>{let Q=g4();if(Q)J.add(Q);if(Z){let W=h4(Y);try{X=$()}finally{u4(W)}Z=!1}return X};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function X$($,X={}){let Z,J=!1,Y=()=>{if(J)return;if(Z)Z(),Z=void 0;let G=h4(Y);try{let Q=$();Z=typeof Q==="function"?Q:void 0}finally{u4(G)}};if(X.immediate!==!1)Y();return()=>{if(J=!0,Z)Z()}}function l4($){tZ($)}function p4($){c4.push($)}function i4($){e8.push($)}function fz(){XJ(c4,"onMount",e8)}function gz(){XJ(e8,"onDestroy")}function XJ($,X,Z){let J=$.splice(0,$.length);for(let Y of J)try{let G=Y();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${X} callback threw:`,G)}}function hz(){return{mount:c4.length,destroy:e8.length}}function Z$($){return typeof $==="function"&&$._isSignal===!0}function J$($){return typeof $==="function"&&$._isDerived===!0}function n4($){if(Z$($)||J$($))return $();return $}function Y$($){return eZ($)}function uz($,X){let Z=typeof $==="function"?$:()=>$,J=m1([]),Y=$$(()=>J().reduce((W,w)=>X(W,w.action),Z())),G=!1;return X$(()=>{if(Z(),!G){G=!0;return}if(Y$(()=>J().length))J.set([])}),[Y,(W,w)=>{let q={action:W};J.set([...J(),q]);let K=()=>{let z=J().filter((U)=>U!==q);if(z.length!==J().length)J.set(z)};if(w&&typeof w.then==="function")Promise.resolve(w).then(K,K);return K}]}var c4,e8;var G$=y(()=>{$J();c4=[],e8=[]});var JJ={};e(JJ,{useOptimistic:()=>uz,untrack:()=>n4,state:()=>m1,runMountCallbacks:()=>fz,runDestroyCallbacks:()=>gz,pendingLifecycleCounts:()=>hz,peek:()=>Y$,onMount:()=>p4,onDestroy:()=>i4,isSignal:()=>Z$,isDerived:()=>J$,generateSignalsRuntimeDev:()=>r4,generateSignalsRuntime:()=>ZJ,effect:()=>X$,derived:()=>$$,default:()=>mz,batch:()=>l4});function ZJ(){let $=dz(r4());try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return $}}function dz($){let X=[],Z=0,J="console.log(";while(Z<$.length){let Y=$.indexOf(J,Z);if(Y===-1){X.push($.slice(Z));break}X.push($.slice(Z,Y));let G=1,Q=Y+J.length;while(Q<$.length&&G>0){let W=$[Q];if(W==='"'||W==="'"||W==="`"){let w=W;Q++;while(Q<$.length&&$[Q]!==w){if($[Q]==="\\")Q++;Q++}Q++;continue}if(W==="(")G++;else if(W===")")G--;Q++}X.push("0"),Z=Q}return X.join("")}function r4(){return`
2673
+ `}function g4(){return Q5}function h4($){let X=Q5;return aZ.push($),Q5=$,X}function u4($){aZ.pop(),Q5=$}function d4(){return t8>0}function m4($){f4.add($)}function tZ($){t8++;try{$()}finally{if(t8--,t8===0){let X=[...f4];f4.clear();for(let Z of X)Z()}}}function eZ($){let X=Q5;Q5=null;try{return $()}finally{Q5=X}}var Q5=null,aZ,t8=0,f4;var $J=y(()=>{aZ=[],f4=new Set});function c1($){let X=$,Z=new Set,J=new Set,Y=()=>{let G=g4();if(G)J.add(G);return X};return Y.set=(G)=>{if(!Object.is(G,X)){let Q=X;if(X=G,Z.forEach((W)=>W(X,Q)),d4())J.forEach((W)=>m4(W));else J.forEach((W)=>W())}},Y.update=(G)=>{Y.set(G(X))},Y.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(Y,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(Y,"value",{get:()=>Y(),set:(G)=>Y.set(G),configurable:!0}),Y}function $$($){let X,Z=!0,J=new Set,Y=()=>{if(!Z)if(Z=!0,d4())J.forEach((Q)=>m4(Q));else J.forEach((Q)=>Q())},G=()=>{let Q=g4();if(Q)J.add(Q);if(Z){let W=h4(Y);try{X=$()}finally{u4(W)}Z=!1}return X};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function X$($,X={}){let Z,J=!1,Y=()=>{if(J)return;if(Z)Z(),Z=void 0;let G=h4(Y);try{let Q=$();Z=typeof Q==="function"?Q:void 0}finally{u4(G)}};if(X.immediate!==!1)Y();return()=>{if(J=!0,Z)Z()}}function l4($){tZ($)}function p4($){c4.push($)}function i4($){e8.push($)}function fz(){XJ(c4,"onMount",e8)}function gz(){XJ(e8,"onDestroy")}function XJ($,X,Z){let J=$.splice(0,$.length);for(let Y of J)try{let G=Y();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${X} callback threw:`,G)}}function hz(){return{mount:c4.length,destroy:e8.length}}function Z$($){return typeof $==="function"&&$._isSignal===!0}function J$($){return typeof $==="function"&&$._isDerived===!0}function n4($){if(Z$($)||J$($))return $();return $}function Y$($){return eZ($)}function uz($,X){let Z=typeof $==="function"?$:()=>$,J=c1([]),Y=$$(()=>J().reduce((W,w)=>X(W,w.action),Z())),G=!1;return X$(()=>{if(Z(),!G){G=!0;return}if(Y$(()=>J().length))J.set([])}),[Y,(W,w)=>{let q={action:W};J.set([...J(),q]);let K=()=>{let z=J().filter((U)=>U!==q);if(z.length!==J().length)J.set(z)};if(w&&typeof w.then==="function")Promise.resolve(w).then(K,K);return K}]}var c4,e8;var G$=y(()=>{$J();c4=[],e8=[]});var JJ={};t(JJ,{useOptimistic:()=>uz,untrack:()=>n4,state:()=>c1,runMountCallbacks:()=>fz,runDestroyCallbacks:()=>gz,pendingLifecycleCounts:()=>hz,peek:()=>Y$,onMount:()=>p4,onDestroy:()=>i4,isSignal:()=>Z$,isDerived:()=>J$,generateSignalsRuntimeDev:()=>r4,generateSignalsRuntime:()=>ZJ,effect:()=>X$,derived:()=>$$,default:()=>mz,batch:()=>l4});function ZJ(){let $=dz(r4());try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return $}}function dz($){let X=[],Z=0,J="console.log(";while(Z<$.length){let Y=$.indexOf(J,Z);if(Y===-1){X.push($.slice(Z));break}X.push($.slice(Z,Y));let G=1,Q=Y+J.length;while(Q<$.length&&G>0){let W=$[Q];if(W==='"'||W==="'"||W==="`"){let w=W;Q++;while(Q<$.length&&$[Q]!==w){if($[Q]==="\\")Q++;Q++}Q++;continue}if(W==="(")G++;else if(W===")")G--;Q++}X.push("0"),Z=Q}return X.join("")}function r4(){return`
2674
2674
  // STX Signals Runtime (Development Build)
2675
2675
  console.log('[stx] signals runtime loading');
2676
2676
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -10654,7 +10654,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
10654
10654
  }
10655
10655
  }
10656
10656
  })();
10657
- `}var mz;var YJ=y(()=>{G$();J1();G$();mz={state:m1,derived:$$,effect:X$,batch:l4,onMount:p4,onDestroy:i4,isSignal:Z$,isDerived:J$,untrack:n4,peek:Y$,generateSignalsRuntime:ZJ,generateSignalsRuntimeDev:r4}});var o4={};e(o4,{templateCache:()=>GJ,readFileCached:()=>cz,invalidateFileCacheByDir:()=>pz,invalidateFileCache:()=>lz,hashFilePath:()=>i7,getCachedSignalsRuntime:()=>rz,getCachedRouterScript:()=>oz,clearDevCaches:()=>sz,checkCache:()=>az,cacheTemplate:()=>tz,__setSignalsGeneratorsForTest:()=>nz});import c1 from"fs";import h5 from"path";async function cz($){let Z;for(let J=0;J<3;J++)try{let G=(await c1.promises.stat($)).mtime.getTime(),Q=w5.get($);if(Q&&Q.mtime===G)return Q.content;let W=await Bun.file($).text(),q=(await c1.promises.stat($)).mtime.getTime();if(q!==G)continue;return w5.set($,{content:W,mtime:q}),W}catch(Y){Z=Y;break}throw w5.delete($),Error(`File not found: ${$}${Z?` (${Z.message})`:""}`)}function lz($){w5.delete($)}function pz($){for(let X of w5.keys())if(X.startsWith($))w5.delete(X)}function nz($){QJ=$}async function rz($=!1){let X=QJ??await Promise.resolve().then(() => (YJ(),JJ));if($)return X.generateSignalsRuntimeDev();if(Q$===null)Q$=X.generateSignalsRuntime();return Q$}async function oz(){if(W$===null){let{getRouterScript:$}=await Promise.resolve().then(() => (S1(),m6));W$=$()}return W$}function sz(){w5.clear(),wJ(),Q$=null,iz=null,W$=null}function WJ($){let X={debug:$.debug===!0,middleware:($.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:($.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(X)).digest("hex")}async function az($,X){try{if(!X.cachePath)return null;let Z=h5.resolve(X.cachePath),J=h5.join(Z,`${i7($)}.html`),Y=h5.join(Z,`${i7($)}.meta.json`);if(!await o(J)||!await o(Y))return null;let G=await Bun.file(Y).text(),Q=JSON.parse(G);if(Q.cacheVersion!==X.cacheVersion)return null;if(Q.optionsSignature!==WJ(X))return null;if((await c1.promises.stat($)).mtime.getTime()>Q.mtime)return null;for(let w of Q.dependencies)if(await o(w)){if((await c1.promises.stat(w)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(J).text()}catch(Z){return console.warn(`Cache error for ${$}:`,Z),null}}async function tz($,X,Z,J){try{if(!J.cachePath)return;let Y=h5.resolve(J.cachePath);await c1.promises.mkdir(Y,{recursive:!0});let G=h5.join(Y,`${i7($)}.html`),Q=h5.join(Y,`${i7($)}.meta.json`),W=await c1.promises.stat($);await Bun.write(G,X);let w={sourcePath:$,mtime:W.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:J.cacheVersion,optionsSignature:WJ(J),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(w,null,2)),GJ.set($,{output:X,mtime:W.mtime.getTime(),dependencies:Z})}catch(Y){console.warn(`Failed to cache template ${$}:`,Y)}}function i7($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,ez)}var GJ,w5,Q$=null,iz=null,QJ=null,W$=null,ez=16;var s4=y(()=>{V0();GJ=new Map,w5=new Map});function qJ($){return $.includes("data-stx-runtime")}function KJ($){let X=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=X.exec($);Z!==null;Z=X.exec($)){let J=$.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(J))continue;return!0}return!1}function a4($,X){let Z=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(Z!==-1&&(J===-1||Z>J))return $.slice(0,Z)+X+`
10657
+ `}var mz;var YJ=y(()=>{G$();J1();G$();mz={state:c1,derived:$$,effect:X$,batch:l4,onMount:p4,onDestroy:i4,isSignal:Z$,isDerived:J$,untrack:n4,peek:Y$,generateSignalsRuntime:ZJ,generateSignalsRuntimeDev:r4}});var o4={};t(o4,{templateCache:()=>GJ,readFileCached:()=>cz,invalidateFileCacheByDir:()=>pz,invalidateFileCache:()=>lz,hashFilePath:()=>i7,getCachedSignalsRuntime:()=>rz,getCachedRouterScript:()=>oz,clearDevCaches:()=>sz,checkCache:()=>az,cacheTemplate:()=>tz,__setSignalsGeneratorsForTest:()=>nz});import l1 from"fs";import g5 from"path";async function cz($){let Z;for(let J=0;J<3;J++)try{let G=(await l1.promises.stat($)).mtime.getTime(),Q=W5.get($);if(Q&&Q.mtime===G)return Q.content;let W=await Bun.file($).text(),q=(await l1.promises.stat($)).mtime.getTime();if(q!==G)continue;return W5.set($,{content:W,mtime:q}),W}catch(Y){Z=Y;break}throw W5.delete($),Error(`File not found: ${$}${Z?` (${Z.message})`:""}`)}function lz($){W5.delete($)}function pz($){for(let X of W5.keys())if(X.startsWith($))W5.delete(X)}function nz($){QJ=$}async function rz($=!1){let X=QJ??await Promise.resolve().then(() => (YJ(),JJ));if($)return X.generateSignalsRuntimeDev();if(Q$===null)Q$=X.generateSignalsRuntime();return Q$}async function oz(){if(W$===null){let{getRouterScript:$}=await Promise.resolve().then(() => (P1(),m6));W$=$()}return W$}function sz(){W5.clear(),wJ(),Q$=null,iz=null,W$=null}function WJ($){let X={debug:$.debug===!0,middleware:($.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:($.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(X)).digest("hex")}async function az($,X){try{if(!X.cachePath)return null;let Z=g5.resolve(X.cachePath),J=g5.join(Z,`${i7($)}.html`),Y=g5.join(Z,`${i7($)}.meta.json`);if(!await o(J)||!await o(Y))return null;let G=await Bun.file(Y).text(),Q=JSON.parse(G);if(Q.cacheVersion!==X.cacheVersion)return null;if(Q.optionsSignature!==WJ(X))return null;if((await l1.promises.stat($)).mtime.getTime()>Q.mtime)return null;for(let w of Q.dependencies)if(await o(w)){if((await l1.promises.stat(w)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(J).text()}catch(Z){return console.warn(`Cache error for ${$}:`,Z),null}}async function tz($,X,Z,J){try{if(!J.cachePath)return;let Y=g5.resolve(J.cachePath);await l1.promises.mkdir(Y,{recursive:!0});let G=g5.join(Y,`${i7($)}.html`),Q=g5.join(Y,`${i7($)}.meta.json`),W=await l1.promises.stat($);await Bun.write(G,X);let w={sourcePath:$,mtime:W.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:J.cacheVersion,optionsSignature:WJ(J),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(w,null,2)),GJ.set($,{output:X,mtime:W.mtime.getTime(),dependencies:Z})}catch(Y){console.warn(`Failed to cache template ${$}:`,Y)}}function i7($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,ez)}var GJ,W5,Q$=null,iz=null,QJ=null,W$=null,ez=16;var s4=y(()=>{F0();GJ=new Map,W5=new Map});function qJ($){return $.includes("data-stx-runtime")}function KJ($){let X=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=X.exec($);Z!==null;Z=X.exec($)){let J=$.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(J))continue;return!0}return!1}function a4($,X){let Z=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(Z!==-1&&(J===-1||Z>J))return $.slice(0,Z)+X+`
10658
10658
  `+$.slice(Z);let Y=/<head\b[^>]*>/i.exec($);if(Y){let Q=Y.index+Y[0].length;return`${$.slice(0,Q)}
10659
10659
  ${X}${$.slice(Q)}`}if($.includes("</head>")){let Q=$.indexOf("</head>");return $.slice(0,Q)+X+`
10660
10660
  `+$.slice(Q)}if(p7($))return a8($,(Q)=>`${Q}
@@ -10663,17 +10663,17 @@ ${$}`}async function w$($,X){if($.includes("data-stx-runtime")||$.includes("wind
10663
10663
  ${X}`;return`${$.slice(0,Z)}${X}
10664
10664
  ${$.slice(Z)}`}async function t4($,X){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Z=X?.router,J="";{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 w=await nZ(X?.pagesDir);if(w.length>0)W.ownedRoutes=w}catch{}if(Object.keys(W).length>0)J=`<script>window.__stxRouterConfig=${oZ(W)};</script>
10665
10665
  `}let{getCachedRouterScript:Y}=await Promise.resolve().then(() => (s4(),o4)),G=X?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':X?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await Y()}</script>`,Q=$.lastIndexOf("</body>");return $.slice(0,Q)+J+G+`
10666
- </body>`+$.slice(Q+7)}var q$=y(()=>{rZ();v4()});var B$={};e(B$,{scanScriptTags:()=>OJ,rewriteStxImportSpecifiers:()=>AJ,processSignals:()=>YX,processScriptSetup:()=>FJ,preEvalLiteralReactiveIfs:()=>ZX,parseLoopExpression:()=>$X,hasSignalsSyntax:()=>j$,findMarkupIndexOutsideScripts:()=>z$,extractExports:()=>VJ,convertSignalLoopsToAttributes:()=>JX,convertSignalDirectivesToAttributes:()=>XX});function OJ($,X={}){let Z=[];for(let J of m8($,v1)){let Y=J.token.match(/^<script\b([^>]*)>/i),G=J.token.match(/<\/script\s*>$/i);if(!Y||!G)continue;let Q=Y[1];if(X.skipAttrs){if(X.skipAttrs.lastIndex=0,X.skipAttrs.test(Q))continue}let W=Y[0].length,w=J.token.length-G[0].length;Z.push({fullMatch:J.token,attrs:Q,body:J.token.slice(W,w),start:J.start,end:J.end})}return Z}function $X($){let X=$.trim(),Z=X.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let Y=Z[1].trim(),G=Z[2].trim(),{itemVar:Q,indexVar:W}=UJ(G);if(Q)return{style:"as",iterable:Y,itemVar:Q,indexVar:W}}let J=X.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Y=J[1].trim(),G=J[2].trim(),{itemVar:Q,indexVar:W}=UJ(Y);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:W}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function UJ($){let X=$.trim(),Z=X.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let J=X.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let Y=X.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let G=X.match(/^(\w+)$/);if(G)return{itemVar:G[1],indexVar:null};return{itemVar:null,indexVar:null}}function j$($){return _2($)}function ZU($){let X=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,J;while((J=X.exec($))!==null){let Y=J[1];if(Y.startsWith("if"))Z++;else if(Y==="endif")Z--;else if(Z===0)return!0}return!1}function JU($){let X=new Set,Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=Z.exec($))!==null){let G=Y[1],Q;while((Q=J.exec(G))!==null)X.add(Q[1])}return X}function YU($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let X=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${e4})>`,"iy"),Z=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=m8($,(G,Q)=>{X.lastIndex=Q;let W=X.exec(G);if(!W||W.index!==Q||!Z.test(W[2]))return-1;return X.lastIndex}),Y=[];for(let G of J){X.lastIndex=0;let Q=X.exec(G.token);if(!Q)continue;let W=Q[2].match(Z),w=$X(W?.[1]??W?.[2]??""),q=[w.itemVar,w.indexVar].filter(Boolean);if(q.length===0)continue;let K=Q[1],U=/\/\s*>$/.test(G.token)||U$.has(K.toLowerCase())?G.end:LJ($,G.start,K,G.end);if(U!==-1)Y.push({start:G.start,end:U,vars:new Set(q)})}return Y}function GU($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function BJ($,X,Z,J){if(!$)return!1;let Y=GU($),G=!1,Q=!1,W=!1,w=/([a-zA-Z_$][\w$]*)/g,q;while((q=w.exec(Y))!==null){let j=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(jJ.has(j))continue;if(X.has(j)||J?.has(j))G=!0;else if(Z&&j in Z)Q=!0}let K=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=K.exec(Y))!==null){let j=z[1];if(Y.slice(0,z.index).trimEnd().endsWith("."))continue;if(jJ.has(j)||Z&&j in Z)continue;W=!0}return(G||W)&&!Q}function K$($,X,Z){let J=Z===void 0?` ${X}`:` ${X}="${Z.replace(/"/g,"&quot;")}"`,Y=$.trim(),G=Y.match(_J);if(G&&QU(G[3],G[1])){let[,Q,W,w]=G;return`<${Q}${W}${J}>${w}</${Q}>`}return`<template${J}>${Y}</template>`}function QU($,X){let Z=new RegExp(`<(/)?${X}(?=[\\s/>])`,"gi"),J=0,Y;while((Y=Z.exec($))!==null)if(Y[1]){if(J--,J<0)return!1}else J++;return!0}function XX($,X){let Z=JU($);function J(Y){let G=Y,Q=YU(Y),W=(z)=>{let U=new Set;for(let j of Q)if(z>j.start&&z<j.end)for(let B of j.vars)U.add(B);return U},w=/@if\s*\(/g,q,K=[];while((q=w.exec(G))!==null){let z=q.index,U=z+q[0].length,j=1,B=U;while(B<G.length&&j>0){if(G[B]==="(")j++;else if(G[B]===")")j--;B++}if(j!==0)continue;let H=G.substring(U,B-1).trim(),_=B,L=1,O=_,F=/@(if\s*\(|endif)/g;F.lastIndex=_;let V;while((V=F.exec(G))!==null)if(V[1].startsWith("if"))L++;else if(V[1]==="endif"){if(L--,L===0){O=V.index+V[0].length;break}}if(L!==0)continue;let A=G.substring(_,O-6).trim(),R;if(ZU(A)){let N=l7(G.substring(z,O));if(N.length===0)continue;let k=N[0].branches.filter((T)=>T.type!=="else"),I=W(z);if(!(k.length>0&&k.every((T)=>BJ(T.condition,Z,X,I))))continue;R=N[0].branches.map((T)=>{let D=J(T.content);if(T.type==="elseif")return K$(D,"@else-if",T.condition??"");if(T.type==="else")return K$(D,"@else");return K$(D,"@if",T.condition??"")}).join(`
10666
+ </body>`+$.slice(Q+7)}var q$=y(()=>{rZ();v4()});var B$={};t(B$,{scanScriptTags:()=>OJ,rewriteStxImportSpecifiers:()=>AJ,processSignals:()=>YX,processScriptSetup:()=>FJ,preEvalLiteralReactiveIfs:()=>ZX,parseLoopExpression:()=>$X,hasSignalsSyntax:()=>j$,findMarkupIndexOutsideScripts:()=>z$,extractExports:()=>VJ,convertSignalLoopsToAttributes:()=>JX,convertSignalDirectivesToAttributes:()=>XX});function OJ($,X={}){let Z=[];for(let J of m8($,f1)){let Y=J.token.match(/^<script\b([^>]*)>/i),G=J.token.match(/<\/script\s*>$/i);if(!Y||!G)continue;let Q=Y[1];if(X.skipAttrs){if(X.skipAttrs.lastIndex=0,X.skipAttrs.test(Q))continue}let W=Y[0].length,w=J.token.length-G[0].length;Z.push({fullMatch:J.token,attrs:Q,body:J.token.slice(W,w),start:J.start,end:J.end})}return Z}function $X($){let X=$.trim(),Z=X.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let Y=Z[1].trim(),G=Z[2].trim(),{itemVar:Q,indexVar:W}=UJ(G);if(Q)return{style:"as",iterable:Y,itemVar:Q,indexVar:W}}let J=X.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(J){let Y=J[1].trim(),G=J[2].trim(),{itemVar:Q,indexVar:W}=UJ(Y);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:W}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function UJ($){let X=$.trim(),Z=X.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let J=X.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(J)return{itemVar:J[1],indexVar:J[2]||null};let Y=X.match(/^(\w+)\s*,\s*(\w+)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]};let G=X.match(/^(\w+)$/);if(G)return{itemVar:G[1],indexVar:null};return{itemVar:null,indexVar:null}}function j$($){return _2($)}function ZU($){let X=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,J;while((J=X.exec($))!==null){let Y=J[1];if(Y.startsWith("if"))Z++;else if(Y==="endif")Z--;else if(Z===0)return!0}return!1}function JU($){let X=new Set,Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,J=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Y;while((Y=Z.exec($))!==null){let G=Y[1],Q;while((Q=J.exec(G))!==null)X.add(Q[1])}return X}function YU($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let X=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${e4})>`,"iy"),Z=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=m8($,(G,Q)=>{X.lastIndex=Q;let W=X.exec(G);if(!W||W.index!==Q||!Z.test(W[2]))return-1;return X.lastIndex}),Y=[];for(let G of J){X.lastIndex=0;let Q=X.exec(G.token);if(!Q)continue;let W=Q[2].match(Z),w=$X(W?.[1]??W?.[2]??""),q=[w.itemVar,w.indexVar].filter(Boolean);if(q.length===0)continue;let K=Q[1],U=/\/\s*>$/.test(G.token)||U$.has(K.toLowerCase())?G.end:LJ($,G.start,K,G.end);if(U!==-1)Y.push({start:G.start,end:U,vars:new Set(q)})}return Y}function GU($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function BJ($,X,Z,J){if(!$)return!1;let Y=GU($),G=!1,Q=!1,W=!1,w=/([a-zA-Z_$][\w$]*)/g,q;while((q=w.exec(Y))!==null){let j=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(jJ.has(j))continue;if(X.has(j)||J?.has(j))G=!0;else if(Z&&j in Z)Q=!0}let K=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=K.exec(Y))!==null){let j=z[1];if(Y.slice(0,z.index).trimEnd().endsWith("."))continue;if(jJ.has(j)||Z&&j in Z)continue;W=!0}return(G||W)&&!Q}function K$($,X,Z){let J=Z===void 0?` ${X}`:` ${X}="${Z.replace(/"/g,"&quot;")}"`,Y=$.trim(),G=Y.match(_J);if(G&&QU(G[3],G[1])){let[,Q,W,w]=G;return`<${Q}${W}${J}>${w}</${Q}>`}return`<template${J}>${Y}</template>`}function QU($,X){let Z=new RegExp(`<(/)?${X}(?=[\\s/>])`,"gi"),J=0,Y;while((Y=Z.exec($))!==null)if(Y[1]){if(J--,J<0)return!1}else J++;return!0}function XX($,X){let Z=JU($);function J(Y){let G=Y,Q=YU(Y),W=(z)=>{let U=new Set;for(let j of Q)if(z>j.start&&z<j.end)for(let B of j.vars)U.add(B);return U},w=/@if\s*\(/g,q,K=[];while((q=w.exec(G))!==null){let z=q.index,U=z+q[0].length,j=1,B=U;while(B<G.length&&j>0){if(G[B]==="(")j++;else if(G[B]===")")j--;B++}if(j!==0)continue;let H=G.substring(U,B-1).trim(),_=B,L=1,O=_,F=/@(if\s*\(|endif)/g;F.lastIndex=_;let V;while((V=F.exec(G))!==null)if(V[1].startsWith("if"))L++;else if(V[1]==="endif"){if(L--,L===0){O=V.index+V[0].length;break}}if(L!==0)continue;let A=G.substring(_,O-6).trim(),R;if(ZU(A)){let N=l7(G.substring(z,O));if(N.length===0)continue;let k=N[0].branches.filter((T)=>T.type!=="else"),I=W(z);if(!(k.length>0&&k.every((T)=>BJ(T.condition,Z,X,I))))continue;R=N[0].branches.map((T)=>{let D=J(T.content);if(T.type==="elseif")return K$(D,"@else-if",T.condition??"");if(T.type==="else")return K$(D,"@else");return K$(D,"@if",T.condition??"")}).join(`
10667
10667
  `)}else{if(!BJ(H,Z,X,W(z)))continue;R=K$(J(A),"@if",H)}K.push({start:z,end:O,replacement:R}),w.lastIndex=O}for(let z=K.length-1;z>=0;z--){let{start:U,end:j,replacement:B}=K[z];G=G.substring(0,U)+B+G.substring(j)}return G}return J($)}function WU($){let X=$.trim();if(X==="")return;if(X==="true")return!0;if(X==="false")return!1;if(X==="null")return!1;if(X==="undefined")return!1;if(X==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(X)){let Y=Number(X);return Y!==0&&!Number.isNaN(Y)}let Z=X.match(/^'((?:\\.|[^'\\])*)'$/);if(Z)return Z[1].length>0;let J=X.match(/^"((?:\\.|[^"\\])*)"$/);if(J)return J[1].length>0;return}function LJ($,X,Z,J){if(U$.has(Z.toLowerCase()))return J;let Y=Z.toLowerCase(),G=$.toLowerCase(),Q=$.length,W=1,w=J;while(w<Q){let q=$.indexOf("<",w);if(q===-1)return-1;if(w=q,$.startsWith("<!--",w)){let j=$.indexOf("-->",w+4);if(j===-1)return-1;w=j+3;continue}let K=/^<(script|style)\b/i.exec($.slice(w,w+8));if(K){let j=$.indexOf(">",w);if(j===-1)return-1;if($[j-1]==="/"){w=j+1;continue}let B=G.indexOf(`</${K[1].toLowerCase()}`,w);if(B===-1)return-1;let H=$.indexOf(">",B);if(H===-1)return-1;w=H+1;continue}if($[w+1]==="/"){let j=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(w,w+64));if(!j){w++;continue}if(j[1].toLowerCase()===Y){if(W--,w+=j[0].length,W===0)return w;continue}w+=j[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(w,w+64));if(!z){w++;continue}let U=$.indexOf(">",w);if(U===-1)return-1;if(z[1].toLowerCase()===Y){let j=$.slice(w,U+1);if(!(/\/\s*>$/.test(j)||U$.has(Y)))W++}w=U+1}return-1}function qU($,X){let Z=X,J=$.length;for(;;){while(Z<J&&$[Z]!=="<")Z++;if(Z>=J)return!1;if($.startsWith("<!--",Z)){let Q=$.indexOf("-->",Z+4);if(Q===-1)return!1;Z=Q+3;continue}break}if($[Z+1]==="/")return!1;let Y=$.indexOf(">",Z);if(Y===-1)return!1;let G=$.slice(Z,Y+1);return wU.test(G)}function ZX($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let X=[],Z=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,J;while((J=Z.exec($))!==null)X.push([J.index,J.index+J[0].length]);let Y=(z)=>X.some(([U,j])=>z>=U&&z<j),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($))!==null){if(Y(W.index))continue;let[z,U,j,B,H,_,L]=W,O=WU(H);if(O===void 0)continue;let F=W.index,V=F+z.length,N=!!L||/\/\s*>$/.test(z)||U$.has(U.toLowerCase())?V:LJ($,F,U,V);if(N===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&qU($,N)){G.lastIndex=V;continue}if(O===!0){let I=`<${U}${j}${_}${L}>`;Q.push({start:F,end:V,replacement:I});continue}Q.push({start:F,end:N,replacement:""}),G.lastIndex=N}if(Q.length===0)return $;Q.sort((z,U)=>z.start-U.start);let w=[],q=-1;for(let z of Q){if(z.start<q)continue;w.push(z),q=z.end}let K=$;for(let z=w.length-1;z>=0;z--){let{start:U,end:j,replacement:B}=w[z];K=K.substring(0,U)+B+K.substring(j)}return K}function JX($,X){let Z=$,J=/@(for|foreach)\s*\(/g,Y,G=[],Q=[];while((Y=J.exec(Z))!==null){let W=Y[1],w=Y.index,q=w+Y[0].length,K=1,z=q;while(z<Z.length&&K>0){if(Z[z]==="(")K++;else if(Z[z]===")")K--;z++}if(K!==0)continue;let U=Z.substring(q,z-1).trim(),j=z,B=$X(U),H=W==="for"?"@endfor":"@endforeach",_=1,L=j,O=W==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${W}\\s*\\(|end${W})`,"g");O.lastIndex=j;let F;while((F=O.exec(Z))!==null)if(F[1].startsWith(W))_++;else if(_--,_===0){L=F.index+F[0].length;break}if(_!==0)continue;let V=()=>{let k=[B.itemVar,B.indexVar].filter(Boolean);if(k.length)Q.push({start:w,end:L,vars:k})};if(B.iterable){let k=B.iterable.trim();if(k.startsWith("[")||k.startsWith("{")||k.startsWith("'")||k.startsWith('"')||k.startsWith("`")||/^-?\d/.test(k)){V();continue}let I=k.split(/[.[(]/)[0].trim(),M=X?I in X:!1,E=Q.some((T)=>w>T.start&&w<T.end&&T.vars.includes(I));if(I&&(M||E)){V();continue}}if(B.style==="as")U=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let A=Z.substring(j,L-H.length).trim(),R=A.match(_J),N;if(R){let[,k,I,M]=R;N=`<${k}${I} @for="${U}">${M}</${k}>`}else N=`<template @for="${U}">${A}</template>`;G.push({start:w,end:L,replacement:N})}for(let W=G.length-1;W>=0;W--){let{start:w,end:q,replacement:K}=G[W];Z=Z.substring(0,w)+K+Z.substring(q)}return Z}function KU($){let X=new Set,Z=[],J=0,Y=0,G=$.length,Q=(K)=>{let z=J+1;while(z<G){let U=$[z];if(U==="\\"){z+=2;continue}if(U===K)return z+1;z++}return G},W=()=>{let K=J+2;while(K<G&&$[K]!==`
10668
10668
  `)K++;return K},w=()=>{let K=J+2;while(K<G-1){if($[K]==="*"&&$[K+1]==="/")return K+2;K++}return G},q=(K)=>{let z=K,U=0;while(z<G){let j=$[z];if(j==="/"&&$[z+1]==="/"){let B=z+2;while(B<G&&$[B]!==`
10669
- `)B++;z=B;continue}if(j==="/"&&$[z+1]==="*"){let B=z+2;while(B<G-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=z+1;while(B<G){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}z=B;continue}if(j==="("||j==="["||j==="{"){U++,z++;continue}if(j===")"||j==="]"||j==="}"){U--,z++;continue}if(j===";"&&U===0)return z+1;z++}return G};while(J<G){let K=$[J];if(K==="/"&&$[J+1]==="/"){let z=W();Z.push($.slice(J,z)),J=z;continue}if(K==="/"&&$[J+1]==="*"){let z=w();Z.push($.slice(J,z)),J=z;continue}if(K==='"'||K==="'"||K==="`"){let z=Q(K);Z.push($.slice(J,z)),J=z;continue}if(K==="{"){Y++,Z.push(K),J++;continue}if(K==="}"){Y--,Z.push(K),J++;continue}if(Y===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let j=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],H=q(J+j[0].length);if(X.has(B)){Z.push(`/* stx: deduped const ${B} */`),J=H;continue}X.add(B),Z.push($.slice(J,H)),J=H;continue}}}Z.push(K),J++}return Z.join("")}async function FJ($,X,Z){let J=OJ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|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 _ of J){let L=_.body;if(X5(_.attrs))L=Z5(L);if(Y.test(L))G.push({fullMatch:_.fullMatch,attrs:_.attrs,content:L})}if(G.length===0)return{output:$,setupCode:null};let Q=`__stx_setup_${Date.now()}_${XU++}`,{hasUserImports:W,bundleClientScript:w}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (y5(),C7))),q=[];for(let _=0;_<G.length;_++){let L=G[_].content;if(L=b5(L).code,W(L))L=await w(L,X||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,V)=>AJ(V));let O=o0(L);q.push(`// \u2500\u2500 merged signal script #${_+1} \u2500\u2500
10669
+ `)B++;z=B;continue}if(j==="/"&&$[z+1]==="*"){let B=z+2;while(B<G-1&&!($[B]==="*"&&$[B+1]==="/"))B++;z=B+2;continue}if(j==='"'||j==="'"||j==="`"){let B=z+1;while(B<G){if($[B]==="\\"){B+=2;continue}if($[B]===j){B++;break}B++}z=B;continue}if(j==="("||j==="["||j==="{"){U++,z++;continue}if(j===")"||j==="]"||j==="}"){U--,z++;continue}if(j===";"&&U===0)return z+1;z++}return G};while(J<G){let K=$[J];if(K==="/"&&$[J+1]==="/"){let z=W();Z.push($.slice(J,z)),J=z;continue}if(K==="/"&&$[J+1]==="*"){let z=w();Z.push($.slice(J,z)),J=z;continue}if(K==='"'||K==="'"||K==="`"){let z=Q(K);Z.push($.slice(J,z)),J=z;continue}if(K==="{"){Y++,Z.push(K),J++;continue}if(K==="}"){Y--,Z.push(K),J++;continue}if(Y===0){let z=J>0?$[J-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let j=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(j){let B=j[2],H=q(J+j[0].length);if(X.has(B)){Z.push(`/* stx: deduped const ${B} */`),J=H;continue}X.add(B),Z.push($.slice(J,H)),J=H;continue}}}Z.push(K),J++}return Z.join("")}async function FJ($,X,Z){let J=OJ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Y=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|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 _ of J){let L=_.body;if($5(_.attrs))L=X5(L);if(Y.test(L))G.push({fullMatch:_.fullMatch,attrs:_.attrs,content:L})}if(G.length===0)return{output:$,setupCode:null};let Q=`__stx_setup_${Date.now()}_${XU++}`,{hasUserImports:W,bundleClientScript:w}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (D5(),C7))),q=[];for(let _=0;_<G.length;_++){let L=G[_].content;if(L=y5(L).code,W(L))L=await w(L,X||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,V)=>AJ(V));let O=r0(L);q.push(`// \u2500\u2500 merged signal script #${_+1} \u2500\u2500
10670
10670
  ${O}`)}let K=q.join(`
10671
10671
 
10672
10672
  `);K=KU(K);let z=VJ(K),U=z.split(",").map((_)=>_.trim()).filter(Boolean),j=f8(K,Z),B=`
10673
10673
  <script data-stx-scoped>
10674
10674
  function ${Q}() {
10675
- ${E5("const",U)}
10676
- ${D5(`${j}${K}`)}
10675
+ ${I5("const",U)}
10676
+ ${E5(`${j}${K}`)}
10677
10677
  return { ${z} };
10678
10678
  }
10679
10679
  window.__stx_latestSetup=${Q};
@@ -10683,13 +10683,13 @@ if(window.stx)window.stx._latestSetup=${Q};
10683
10683
  `)G++;return!0}if(X[G]==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;return G+=2,!0}return!1},j=()=>{if(Y!==0)return;let B=X.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(B){let F=B[2];if(!J.has(F))Z.push(F),J.add(F);return}let H=X.slice(G).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((F)=>{let V=F.trim();if(!V)return;let A=V.indexOf(":"),N=(A>=0?V.slice(A+1).trim():V).split(/[\s=]/)[0];if(N&&!J.has(N))Z.push(N),J.add(N)});return}let _=X.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(_){_[1].split(",").forEach((F)=>{let V=F.trim().replace(/^\.\.\./,"");if(!V)return;let A=V.split(/[\s=]/)[0];if(A&&!J.has(A))Z.push(A),J.add(A)});return}let L=X.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!J.has(F))Z.push(F),J.add(F);return}let O=X.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!J.has(F))Z.push(F),J.add(F)}};while(G<Q){if(U())continue;if(X[G]==="'"||X[G]==='"'){K(X[G]),W=X[G-1];continue}if(X[G]==="`"){z(),W="`";continue}if(X[G]==="/"&&X[G+1]!=="/"&&X[G+1]!=="*"&&q()){w(),W="/";continue}if(X[G]==="{"){Y++,W="{",G++;continue}if(X[G]==="}"){Y--,W="}",G++;continue}if(Y===0&&/[a-z]/i.test(X[G])&&(G===0||/\s|[;{}()]/.test(X[G-1])))j();if(!/\s/.test(X[G]))W=X[G];G++}return Z.join(", ")}async function YX($,X,Z,J){if(!j$($))return $;let Y=$;if(X.skipSignalsRuntime)return Y;let{output:G,setupCode:Q}=await FJ(Y,Z,J);if(Y=G,Y=await w$(Y,X),Q){let K=z$(Y,/<\/head>/i),z=K===-1?z$(Y,/<body[^>]*>/i):-1;if(K!==-1)Y=`${Y.slice(0,K)}${Q}
10684
10684
  ${Y.slice(K)}`;else if(z!==-1){let U=/<body[^>]*>/i.exec(Y.slice(z))[0],j=z+U.length;Y=`${Y.slice(0,j)}
10685
10685
  ${Q}${Y.slice(j)}`}else Y=`${Y}
10686
- ${Q}`}let w=Y.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=w&&/data-stx/.test(w[1]);if(!Q&&!q&&w&&!/data-stx-auto/.test(w[1])){let K=/<body[^>]*>/i,z=z$(Y,K);if(z!==-1){let U=Y.slice(0,z),j=Y.slice(z).replace(K,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Y=U+j}}return Y}function z$($,X){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],Y;while((Y=Z.exec($))!==null)J.push([Y.index,Y.index+Y[0].length]);let G=new RegExp(X.source,X.flags.replace(/[gy]/g,"")),Q=0;while(Q<$.length){let W=G.exec($.slice(Q));if(!W)return-1;let w=Q+W.index;if(!J.some(([K,z])=>w>=K&&w<z))return w;Q=w+Math.max(W[0].length,1)}return-1}function AJ($){let X=[];for(let Z of $.split(",")){let J=Z.trim();if(!J||J.startsWith("type "))continue;let Y=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Y&&Y[1]!==Y[2])X.push(`${Y[2]} = ${Y[1]}`)}if(X.length===0)return HJ;return`var ${X.join(", ")}; ${HJ}`}var XU=0,e4=`(?:"[^"]*"|'[^']*'|[^>"'])*`,_J,jJ,U$,wU,HJ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var n7=y(()=>{g7();s8();J1();w4();V0();q$();x1();S7();_J=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;jJ=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"]);U$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);wU=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import zU from"fs";import h from"path";function jU($){let X=new WeakSet;try{let Z=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(X.has(J))throw TypeError("Circular component input");if(X.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(Z);let Y={};for(let G of Object.keys(J).sort())Y[G]=Z(J[G]);return Y};return JSON.stringify(Z($))}catch{return null}}function RJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function BU($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function X5($){return!BU($)}function H1($){let X;try{X=JSON.stringify($)}catch{return new Bun.Transpiler($)}let Z=H$.get(X);if(Z)return Z;if(H$.size>=16)H$.clear();let J=new Bun.Transpiler($);return H$.set(X,J),J}function Z5($){try{let X=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");X=X.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];X=X.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),X=X.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),X=X.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let Y=H1({loader:"ts",target:"browser",define:d0()}).transformSync(X);for(let G=0;G<Z.length;G++)Y=Y.replace(`"__STX_EXPR_${G}__"`,Z[G]),Y=Y.replace(`'__STX_EXPR_${G}__'`,Z[G]);return Y}catch(X){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",X);return $}}function HU($){let X=[],Z=new Set,J=0,Y=0,G=$.length,Q=(K)=>{Y++;while(Y<G){if($[Y]==="\\"){Y+=2;continue}if($[Y]===K){Y++;return}Y++}},W=()=>{Y++;while(Y<G){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let K=1;while(Y<G&&K>0)if($[Y]==="{")K++,Y++;else if($[Y]==="}")K--,Y++;else if($[Y]==="'"||$[Y]==='"')Q($[Y]);else if($[Y]==="`")W();else Y++;continue}Y++}},w=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<G&&$[Y]!==`
10687
- `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<G-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},q=()=>{if(J!==0)return;let K=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let B=K[2].split(",").map((H)=>{let _=H.trim().split(":");return _[_.length-1].trim()});for(let H of B)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Z.has(H))X.push(H),Z.add(H);return}let z=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!Z.has(B))X.push(B),Z.add(B);return}let U=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!Z.has(B))X.push(B),Z.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Z.has(B))X.push(B),Z.add(B)}};while(Y<G){if(w())continue;if($[Y]==="'"||$[Y]==='"'){Q($[Y]);continue}if($[Y]==="`"){W();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))q();Y++}return X}function _U($){let X=[],Z=0,J=0,Y=null;for(let G=0;G<$.length;G++){let Q=$[G];if(Y){if(Q==="\\"){G++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)X.push($.slice(J,G)),J=G+1}if(J<$.length)X.push($.slice(J));return X}function OU($){let X=0,Z=null;for(let J=0;J<$.length;J++){let Y=$[J];if(Z){if(Y==="\\"){J++;continue}if(Y===Z)Z=null;continue}if(Y==='"'||Y==="'"||Y==="`"){Z=Y;continue}if(Y==="("||Y==="["||Y==="{")X++;else if(Y===")"||Y==="]"||Y==="}")X--;else if(Y==="="&&X===0){let G=$[J-1],Q=$[J+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return J}}return-1}function LU($,X){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Z)return;let J=Z.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,G=0,Q=-1;for(;J>=0;J--){let w=$[J];if(w==="}")G++;else if(w==="{"){if(G--,G===0){Q=J;break}}}if(Q===-1)return;let W=$.slice(Q+1,Y);for(let w of _U(W)){let q=w.trim();if(!q||q.startsWith("..."))continue;let K=OU(q);if(K===-1)continue;let z=q.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(X[z]!==void 0)continue;let U=q.slice(K+1).trim();if(!U)continue;try{let j=Object.keys(X),B=Function(...j,`"use strict"; return (${U});`);X[z]=B(...j.map((H)=>X[H]))}catch{}}}catch{}}async function L$($,X,Z,J,Y){let G=$.endsWith(".stx")?$.slice(0,-4):$,Q=(_)=>_.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""),W=(_)=>_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),w=Z.__importedComponents;if(w){for(let _ of[G,G.toLowerCase(),Q(G),W(G)])if(w.has(_))return!0}let q=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${W(G)}.stx`])],K=typeof Y.root==="string"?h.resolve(Y.root):void 0,z=K??h.dirname(J),U=[],j=(_)=>{if(_&&!U.includes(_))U.push(_)},B=Z.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));j(X),j(Y._rootComponentsDir),j(h.join(h.dirname(J),"components")),j(Y.componentsDir);let H=Y._pluginComponentDirs;if(Array.isArray(H))for(let _ of H)j(typeof _==="string"?_:null);if(K)j(h.resolve(K,"resources/views/components")),j(h.resolve(K,"resources/components")),j(h.resolve(K,"src/components")),j(h.resolve(K,"components"));if(G.startsWith("./")||G.startsWith("../"))return o(h.resolve(h.dirname(J),`${G}.stx`));for(let _ of U){let L=h.isAbsolute(_)?_:h.resolve(z,_);for(let O of q)if(await o(h.join(L,O)))return!0}return!1}function FU($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function VU($){if(!$)return!1;let X=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(X)}function AU($){let X=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 J of $){let Y;while((Y=Z.exec(J))!==null)X.add(Y[1]);Z.lastIndex=0}return[...X]}async function q5($,X,Z,J,Y,G,Q,W=new Set,w){let{extractVariables:q}=await $0("stx/variable-extractor",()=>Promise.resolve().then(() => (c7(),r8))),K=W??new Set;if(K.has($))return`[Circular component reference: ${$}]`;let z=new Set(K);z.add($);let U=typeof X.client==="string"?X.client.trim():"";if("client"in X)delete X.client;let j=U&&U!=="load"&&FU(U)?U:"";try{let B=(f)=>f.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),H=(f)=>f.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_=$.endsWith(".stx")?$.slice(0,-4):$,L=null,O=Y.__importedComponents;if(O){let f=[_,_.toLowerCase(),B(_),H(_)];for(let d of f)if(O.has(d)){L=O.get(d);break}}let F=[];if(!L){let f=[`${_}.stx`,`${B(_)}.stx`,`${H(_)}.stx`],d=[...new Set(f)],j0=Y.__originalFilePath,X0=[];if(j0){let H0=h.join(h.dirname(j0),"components");X0.push(H0)}if(J)X0.push(J);let E0=Q._rootComponentsDir;if(typeof E0==="string"&&!X0.includes(E0))X0.push(E0);let D0=h.join(h.dirname(G),"components");if(!X0.includes(D0))X0.push(D0);if(Q.componentsDir&&Q.componentsDir!==J&&!X0.includes(Q.componentsDir))X0.push(Q.componentsDir);let b1=Q._pluginComponentDirs;if(Array.isArray(b1)){for(let H0 of b1)if(typeof H0==="string"&&!X0.includes(H0))X0.push(H0)}let p0=typeof Q.root==="string"?h.resolve(Q.root):void 0,u0=p0??h.dirname(G),K1=[];if(p0)K1.push(h.resolve(p0,"resources/views/components")),K1.push(h.resolve(p0,"resources/components")),K1.push(h.resolve(p0,"src/components")),K1.push(h.resolve(p0,"components"));K1.push(h.resolve(import.meta.dir,"components"));for(let H0 of K1)if(!X0.includes(H0))X0.push(H0);let s1=[...new Set(X0.map((H0)=>{if(!H0)return H0;return h.isAbsolute(H0)?H0:h.resolve(u0,H0)}))];X0.length=0,X0.push(...s1);let t=`${_}\x00${G}\x00${s1.join("\x00")}`,Z1=O$.get(t);if(Z1)if(await o(Z1))L=Z1;else O$.delete(t);if(!L&&(_.startsWith("./")||_.startsWith("../")))L=h.resolve(h.dirname(G),`${_}.stx`),F.push(L);else if(!L)for(let H0 of X0){if(!H0)continue;for(let a1 of d){let t1=h.join(H0,a1);if(F.push(t1),await o(t1)){L=t1;break}}if(L)break;if(!L)try{let a1=await import("fs");if(!a1.statSync(H0,{throwIfNoEntry:!1})?.isDirectory())continue;let L8=8,V5=[{path:H0,depth:0}];while(V5.length>0&&!L){let V1=V5.pop();if(V1.depth>=L8)continue;let F8;try{F8=a1.readdirSync(V1.path,{withFileTypes:!0})}catch{continue}for(let V8 of F8){if(!V8.isDirectory())continue;if(V8.name==="node_modules"||V8.name.startsWith("."))continue;let k6=h.join(V1.path,V8.name);for(let Jq of d){let E9=h.join(k6,Jq);if(F.push(E9),await o(E9)){L=E9;break}}if(L)break;V5.push({path:k6,depth:V1.depth+1})}}}catch{}if(L)break}if(L)O$.set(t,L)}if(!L||!await o(L)){let f=F.length>0?`
10686
+ ${Q}`}let w=Y.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),q=w&&/data-stx/.test(w[1]);if(!Q&&!q&&w&&!/data-stx-auto/.test(w[1])){let K=/<body[^>]*>/i,z=z$(Y,K);if(z!==-1){let U=Y.slice(0,z),j=Y.slice(z).replace(K,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Y=U+j}}return Y}function z$($,X){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,J=[],Y;while((Y=Z.exec($))!==null)J.push([Y.index,Y.index+Y[0].length]);let G=new RegExp(X.source,X.flags.replace(/[gy]/g,"")),Q=0;while(Q<$.length){let W=G.exec($.slice(Q));if(!W)return-1;let w=Q+W.index;if(!J.some(([K,z])=>w>=K&&w<z))return w;Q=w+Math.max(W[0].length,1)}return-1}function AJ($){let X=[];for(let Z of $.split(",")){let J=Z.trim();if(!J||J.startsWith("type "))continue;let Y=J.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Y&&Y[1]!==Y[2])X.push(`${Y[2]} = ${Y[1]}`)}if(X.length===0)return HJ;return`var ${X.join(", ")}; ${HJ}`}var XU=0,e4=`(?:"[^"]*"|'[^']*'|[^>"'])*`,_J,jJ,U$,wU,HJ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var n7=y(()=>{g7();s8();J1();w4();F0();q$();g1();S7();_J=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;jJ=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"]);U$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);wU=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import zU from"fs";import h from"path";function jU($){let X=new WeakSet;try{let Z=(J)=>{if(J===void 0)return{__stxType:"undefined"};if(typeof J==="bigint")return{__stxType:"bigint",value:J.toString()};if(typeof J==="function"||typeof J==="symbol")throw TypeError("Non-serializable component input");if(J===null||typeof J!=="object")return J;if(X.has(J))throw TypeError("Circular component input");if(X.add(J),J instanceof Date)return{__stxType:"date",value:J.toISOString()};if(Array.isArray(J))return J.map(Z);let Y={};for(let G of Object.keys(J).sort())Y[G]=Z(J[G]);return Y};return JSON.stringify(Z($))}catch{return null}}function RJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function BU($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function $5($){return!BU($)}function H1($){let X;try{X=JSON.stringify($)}catch{return new Bun.Transpiler($)}let Z=H$.get(X);if(Z)return Z;if(H$.size>=16)H$.clear();let J=new Bun.Transpiler($);return H$.set(X,J),J}function X5($){try{let X=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");X=X.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];X=X.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),X=X.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),X=X.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let Y=H1({loader:"ts",target:"browser",define:u0()}).transformSync(X);for(let G=0;G<Z.length;G++)Y=Y.replace(`"__STX_EXPR_${G}__"`,Z[G]),Y=Y.replace(`'__STX_EXPR_${G}__'`,Z[G]);return Y}catch(X){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",X);return $}}function HU($){let X=[],Z=new Set,J=0,Y=0,G=$.length,Q=(K)=>{Y++;while(Y<G){if($[Y]==="\\"){Y+=2;continue}if($[Y]===K){Y++;return}Y++}},W=()=>{Y++;while(Y<G){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;return}if($[Y]==="$"&&$[Y+1]==="{"){Y+=2;let K=1;while(Y<G&&K>0)if($[Y]==="{")K++,Y++;else if($[Y]==="}")K--,Y++;else if($[Y]==="'"||$[Y]==='"')Q($[Y]);else if($[Y]==="`")W();else Y++;continue}Y++}},w=()=>{if($[Y]==="/"&&$[Y+1]==="/"){while(Y<G&&$[Y]!==`
10687
+ `)Y++;return!0}if($[Y]==="/"&&$[Y+1]==="*"){Y+=2;while(Y<G-1&&!($[Y]==="*"&&$[Y+1]==="/"))Y++;return Y+=2,!0}return!1},q=()=>{if(J!==0)return;let K=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let B=K[2].split(",").map((H)=>{let _=H.trim().split(":");return _[_.length-1].trim()});for(let H of B)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Z.has(H))X.push(H),Z.add(H);return}let z=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!Z.has(B))X.push(B),Z.add(B);return}let U=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!Z.has(B))X.push(B),Z.add(B);return}let j=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Z.has(B))X.push(B),Z.add(B)}};while(Y<G){if(w())continue;if($[Y]==="'"||$[Y]==='"'){Q($[Y]);continue}if($[Y]==="`"){W();continue}if($[Y]==="{"){J++,Y++;continue}if($[Y]==="}"){J--,Y++;continue}if(J===0&&/[a-z]/i.test($[Y])&&(Y===0||/\s|[;{}()]/.test($[Y-1])))q();Y++}return X}function _U($){let X=[],Z=0,J=0,Y=null;for(let G=0;G<$.length;G++){let Q=$[G];if(Y){if(Q==="\\"){G++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)X.push($.slice(J,G)),J=G+1}if(J<$.length)X.push($.slice(J));return X}function OU($){let X=0,Z=null;for(let J=0;J<$.length;J++){let Y=$[J];if(Z){if(Y==="\\"){J++;continue}if(Y===Z)Z=null;continue}if(Y==='"'||Y==="'"||Y==="`"){Z=Y;continue}if(Y==="("||Y==="["||Y==="{")X++;else if(Y===")"||Y==="]"||Y==="}")X--;else if(Y==="="&&X===0){let G=$[J-1],Q=$[J+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return J}}return-1}function LU($,X){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Z)return;let J=Z.index-1;while(J>=0&&/\s/.test($[J]))J--;if($[J]!=="}")return;let Y=J,G=0,Q=-1;for(;J>=0;J--){let w=$[J];if(w==="}")G++;else if(w==="{"){if(G--,G===0){Q=J;break}}}if(Q===-1)return;let W=$.slice(Q+1,Y);for(let w of _U(W)){let q=w.trim();if(!q||q.startsWith("..."))continue;let K=OU(q);if(K===-1)continue;let z=q.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(X[z]!==void 0)continue;let U=q.slice(K+1).trim();if(!U)continue;try{let j=Object.keys(X),B=Function(...j,`"use strict"; return (${U});`);X[z]=B(...j.map((H)=>X[H]))}catch{}}}catch{}}async function L$($,X,Z,J,Y){let G=$.endsWith(".stx")?$.slice(0,-4):$,Q=(_)=>_.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""),W=(_)=>_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),w=Z.__importedComponents;if(w){for(let _ of[G,G.toLowerCase(),Q(G),W(G)])if(w.has(_))return!0}let q=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${W(G)}.stx`])],K=typeof Y.root==="string"?h.resolve(Y.root):void 0,z=K??h.dirname(J),U=[],j=(_)=>{if(_&&!U.includes(_))U.push(_)},B=Z.__originalFilePath;if(B)j(h.join(h.dirname(B),"components"));j(X),j(Y._rootComponentsDir),j(h.join(h.dirname(J),"components")),j(Y.componentsDir);let H=Y._pluginComponentDirs;if(Array.isArray(H))for(let _ of H)j(typeof _==="string"?_:null);if(K)j(h.resolve(K,"resources/views/components")),j(h.resolve(K,"resources/components")),j(h.resolve(K,"src/components")),j(h.resolve(K,"components"));if(G.startsWith("./")||G.startsWith("../"))return o(h.resolve(h.dirname(J),`${G}.stx`));for(let _ of U){let L=h.isAbsolute(_)?_:h.resolve(z,_);for(let O of q)if(await o(h.join(L,O)))return!0}return!1}function FU($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function VU($){if(!$)return!1;let X=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(X)}function AU($){let X=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 J of $){let Y;while((Y=Z.exec(J))!==null)X.add(Y[1]);Z.lastIndex=0}return[...X]}async function w5($,X,Z,J,Y,G,Q,W=new Set,w){let{extractVariables:q}=await X0("stx/variable-extractor",()=>Promise.resolve().then(() => (c7(),r8))),K=W??new Set;if(K.has($))return`[Circular component reference: ${$}]`;let z=new Set(K);z.add($);let U=typeof X.client==="string"?X.client.trim():"";if("client"in X)delete X.client;let j=U&&U!=="load"&&FU(U)?U:"";try{let B=(v)=>v.split("-").map((u)=>u.charAt(0).toUpperCase()+u.slice(1)).join(""),H=(v)=>v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),_=$.endsWith(".stx")?$.slice(0,-4):$,L=null,O=Y.__importedComponents;if(O){let v=[_,_.toLowerCase(),B(_),H(_)];for(let u of v)if(O.has(u)){L=O.get(u);break}}let F=[];if(!L){let v=[`${_}.stx`,`${B(_)}.stx`,`${H(_)}.stx`],u=[...new Set(v)],e=Y.__originalFilePath,$0=[];if(e){let q0=h.join(h.dirname(e),"components");$0.push(q0)}if(J)$0.push(J);let M0=Q._rootComponentsDir;if(typeof M0==="string"&&!$0.includes(M0))$0.push(M0);let P0=h.join(h.dirname(G),"components");if(!$0.includes(P0))$0.push(P0);if(Q.componentsDir&&Q.componentsDir!==J&&!$0.includes(Q.componentsDir))$0.push(Q.componentsDir);let b1=Q._pluginComponentDirs;if(Array.isArray(b1)){for(let q0 of b1)if(typeof q0==="string"&&!$0.includes(q0))$0.push(q0)}let n0=typeof Q.root==="string"?h.resolve(Q.root):void 0,h0=n0??h.dirname(G),e0=[];if(n0)e0.push(h.resolve(n0,"resources/views/components")),e0.push(h.resolve(n0,"resources/components")),e0.push(h.resolve(n0,"src/components")),e0.push(h.resolve(n0,"components"));e0.push(h.resolve(import.meta.dir,"components"));for(let q0 of e0)if(!$0.includes(q0))$0.push(q0);let W7=[...new Set($0.map((q0)=>{if(!q0)return q0;return h.isAbsolute(q0)?q0:h.resolve(h0,q0)}))];$0.length=0,$0.push(...W7);let S1=`${_}\x00${G}\x00${W7.join("\x00")}`,a=O$.get(S1);if(a)if(await o(a))L=a;else O$.delete(S1);if(!L&&(_.startsWith("./")||_.startsWith("../")))L=h.resolve(h.dirname(G),`${_}.stx`),F.push(L);else if(!L)for(let q0 of $0){if(!q0)continue;for(let C1 of u){let a1=h.join(q0,C1);if(F.push(a1),await o(a1)){L=a1;break}}if(L)break;if(!L)try{let C1=await import("fs");if(!C1.statSync(q0,{throwIfNoEntry:!1})?.isDirectory())continue;let L8=8,F5=[{path:q0,depth:0}];while(F5.length>0&&!L){let V1=F5.pop();if(V1.depth>=L8)continue;let F8;try{F8=C1.readdirSync(V1.path,{withFileTypes:!0})}catch{continue}for(let V8 of F8){if(!V8.isDirectory())continue;if(V8.name==="node_modules"||V8.name.startsWith("."))continue;let k6=h.join(V1.path,V8.name);for(let Jq of u){let E9=h.join(k6,Jq);if(F.push(E9),await o(E9)){L=E9;break}}if(L)break;F5.push({path:k6,depth:V1.depth+1})}}}catch{}if(L)break}if(L)O$.set(S1,L)}if(!L||!await o(L)){let v=F.length>0?`
10688
10688
  Searched paths:
10689
- ${F.map((d)=>` - ${d}`).join(`
10690
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${f}`}w.add(L);let V;if(_$.has(L))V=_$.get(L);else try{V=await Bun.file(L).text(),_$.set(L,V)}catch(f){return`[Error loading component: ${f instanceof Error?f.message:String(f)}]`}let A=new Set(["__originalFilePath","__importedComponents",g8,"__stx_client_signal_names","__stxServeContext"]),R={};for(let[f,d]of Object.entries(Y))if(!f.startsWith("__")||A.has(f))R[f]=d;let N=U1(Z),k=[],I=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(f,d)=>{let j0=N.scripts[Number(d)]||"",X0=j0.match(/^<script\b([^>]*)>/i)?.[1]||"",E0=X0.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),D0=!E0||["module","text/javascript","application/javascript"].includes(E0);if(!/\bserver\b/i.test(X0)&&D0)return k.push(j0),"";return j0}),{extractSlotContent:M}=await $0("stx/slots",()=>Promise.resolve().then(() => (S4(),b4))),E=M(I),T={};if(E.defaultSlot?.trim())T.default=E.defaultSlot;for(let[f,d]of E.namedSlots)T[f]=d.content;let D={...R,...X,props:X,slot:I,$slots:T,__processedComponents:z,__sections:{},__stx_signals_gate:T1(V)||VU(Z)};LU(V,D);let b=V,S=p8(b);if(S)b=S.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,v=[...V.matchAll(P)],x=[],i=v.some((f)=>/\bserver\b/.test(f[1]||"")&&/\bcache\b/.test(f[1]||""))&&v.every((f)=>/\bserver\b/.test(f[1]||"")),m=null,R0=null;if(i){let f=jU({props:X,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(f!==null){m=`${L}\x00${f}`;let d=GX.get(m);if(d){for(let j0 of d.dependencies)w.add(j0);return d.output}R0=new Set(w)}}for(let f of v){let d=f[1]||"",j0=f[2]||"",X0=d.includes("server");if(X5(d)&&j0.trim())j0=Z5(j0);if(X0&&j0)try{await q(j0,D,L)}catch(D0){}if(!X0){let D0=j0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),b1=D0.includes("{{")&&D0.includes("}}"),p0=D0.includes("{!!")&&D0.includes("!!}");if(b1||p0)D0=c8(D0,D);let u0=d.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");x.push(`<script${u0}>${D0}</script>`)}}let w0=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),C0=w0?w0[1]:"",P0=w0?w0[2]:"",n="",q0=C0&&/\bscoped\b/i.test(C0);if(w0)n=`<style${C0}>${P0}</style>`;let Y0=b;if(Y0=Y0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w0)Y0=Y0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let f=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,d=[];if(Y0=Y0.replace(f,(j0,X0)=>{let E0=X0.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(E0)d.push(`<style${E0[1]}>${E0[2]}</style>`);return""}),Y0=Y0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),d.length>0)n=`${n}${d.join(`
10691
- `)}`}if(Z&&Y0.includes("{{ text || slot }}"))Y0=Y0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:N0}=await $0("stx/slots",()=>Promise.resolve().then(() => (S4(),b4))),{defaultSlot:M0,namedSlots:l}=E;Y0=await N0(Y0,M0,l,D);let p=x.some((f)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(f)),U0=AU(x),l0=Array.isArray(D.__stx_client_signal_names)?D.__stx_client_signal_names:[];if(U0.length>0||l0.length>0)D.__stx_client_signal_names=[...new Set([...l0,...U0])];let v0={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:h.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:p||x.length===0,defaultLayout:void 0};D.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let C=await A0(Y0,D,L,v0,w),g=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let f of C.matchAll(/\{\{([\s\S]*?)\}\}/g))g.add(f[1].trim());if(g.size>0)Y.__stx_preserved_client_expressions=[...g];let a=`stx_${_.replace(/[^a-zA-Z0-9]/g,"_")}_${++UU}_${Math.random().toString(36).slice(2,8)}`,c=C;if(p){let f="";if(Object.keys(X).length>0)try{f=` data-stx-props="${RJ(JSON.stringify(X))}"`}catch{}let d=j?` stx-hydrate="${RJ(j)}"`:"";c=`<div data-stx-scope="${a}"${f}${d}>${C}</div>`;let j0=await Promise.all(x.map(async(X0)=>{let E0=X0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!E0)return X0;let[,D0,b1]=E0,p0=v8(b1,{filePath:L,projectRoot:process.cwd()}),u0=p0.code,K1=x8(p0.styles);u0=b5(u0).code;let{hasUserImports:s1,bundleClientScript:t}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (y5(),C7)));if(s1(u0))u0=await t(u0,L,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:Z1}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (n7(),B$)));u0=u0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V1,F8)=>Z1(F8));let H0=o0(u0),a1=HU(H0),t1=`function(__scopeId) {
10692
- ${E5("const",[...H2,...a1],H0)}
10689
+ ${F.map((u)=>` - ${u}`).join(`
10690
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${v}`}w.add(L);let V;if(_$.has(L))V=_$.get(L);else try{V=await Bun.file(L).text(),_$.set(L,V)}catch(v){return`[Error loading component: ${v instanceof Error?v.message:String(v)}]`}let A=new Set(["__originalFilePath","__importedComponents",g8,"__stx_client_signal_names","__stxServeContext"]),R={};for(let[v,u]of Object.entries(Y))if(!v.startsWith("__")||A.has(v))R[v]=u;let N=z1(Z),k=[],I=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(v,u)=>{let e=N.scripts[Number(u)]||"",$0=e.match(/^<script\b([^>]*)>/i)?.[1]||"",M0=$0.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),P0=!M0||["module","text/javascript","application/javascript"].includes(M0);if(!/\bserver\b/i.test($0)&&P0)return k.push(e),"";return e}),{extractSlotContent:M}=await X0("stx/slots",()=>Promise.resolve().then(() => (S4(),b4))),E=M(I),T={};if(E.defaultSlot?.trim())T.default=E.defaultSlot;for(let[v,u]of E.namedSlots)T[v]=u.content;let D={...R,...X,props:X,slot:I,$slots:T,__processedComponents:z,__sections:{},__stx_signals_gate:T1(V)||VU(Z)};LU(V,D);let b=V,S=p8(b);if(S)b=S.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x=[...V.matchAll(P)],f=[],p=x.some((v)=>/\bserver\b/.test(v[1]||"")&&/\bcache\b/.test(v[1]||""))&&x.every((v)=>/\bserver\b/.test(v[1]||"")),m=null,A0=null;if(p){let v=jU({props:X,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(v!==null){m=`${L}\x00${v}`;let u=GX.get(m);if(u){for(let e of u.dependencies)w.add(e);return u.output}A0=new Set(w)}}for(let v of x){let u=v[1]||"",e=v[2]||"",$0=u.includes("server");if($5(u)&&e.trim())e=X5(e);if($0&&e)try{await q(e,D,L)}catch(P0){}if(!$0){let P0=e.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),b1=P0.includes("{{")&&P0.includes("}}"),n0=P0.includes("{!!")&&P0.includes("!!}");if(b1||n0)P0=c8(P0,D);let h0=u.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");f.push(`<script${h0}>${P0}</script>`)}}let K0=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),b0=K0?K0[1]:"",S0=K0?K0[2]:"",r="",Y0=b0&&/\bscoped\b/i.test(b0);if(K0)r=`<style${b0}>${S0}</style>`;let G0=b;if(G0=G0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K0)G0=G0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let v=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,u=[];if(G0=G0.replace(v,(e,$0)=>{let M0=$0.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(M0)u.push(`<style${M0[1]}>${M0[2]}</style>`);return""}),G0=G0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),u.length>0)r=`${r}${u.join(`
10691
+ `)}`}if(Z&&G0.includes("{{ text || slot }}"))G0=G0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:R0}=await X0("stx/slots",()=>Promise.resolve().then(() => (S4(),b4))),{defaultSlot:N0,namedSlots:l}=E;G0=await R0(G0,N0,l,D);let i=f.some((v)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(v)),z0=AU(f),c0=Array.isArray(D.__stx_client_signal_names)?D.__stx_client_signal_names:[];if(z0.length>0||c0.length>0)D.__stx_client_signal_names=[...new Set([...c0,...z0])];let C0={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:h.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:i||f.length===0,defaultLayout:void 0};D.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let t0=await V0(G0,D,L,C0,w),C=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let v of t0.matchAll(/\{\{([\s\S]*?)\}\}/g))C.add(v[1].trim());if(C.size>0)Y.__stx_preserved_client_expressions=[...C];let g=`stx_${_.replace(/[^a-zA-Z0-9]/g,"_")}_${++UU}_${Math.random().toString(36).slice(2,8)}`,c=t0;if(i){let v="";if(Object.keys(X).length>0)try{v=` data-stx-props="${RJ(JSON.stringify(X))}"`}catch{}let u=j?` stx-hydrate="${RJ(j)}"`:"";c=`<div data-stx-scope="${g}"${v}${u}>${t0}</div>`;let e=await Promise.all(f.map(async($0)=>{let M0=$0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!M0)return $0;let[,P0,b1]=M0,n0=v8(b1,{filePath:L,projectRoot:process.cwd()}),h0=n0.code,e0=x8(n0.styles);h0=y5(h0).code;let{hasUserImports:W7,bundleClientScript:S1}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (D5(),C7)));if(W7(h0))h0=await S1(h0,L,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:a}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (n7(),B$)));h0=h0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V1,F8)=>a(F8));let q0=r0(h0),C1=HU(q0),a1=`function(__scopeId) {
10692
+ ${I5("const",[...H2,...C1],q0)}
10693
10693
  const __scope = window.stx._scopes = window.stx._scopes || {};
10694
10694
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
10695
10695
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -10703,12 +10703,12 @@ ${F.map((d)=>` - ${d}`).join(`
10703
10703
  const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
10704
10704
 
10705
10705
  try {
10706
- ${H0}
10706
+ ${q0}
10707
10707
 
10708
10708
  // Register all defined signals and functions in this scope
10709
10709
  const __localVars = {};
10710
10710
  try {
10711
- ${a1.map((V1)=>`if (typeof ${V1} !== 'undefined') __localVars['${V1}'] = ${V1};`).join(`
10711
+ ${C1.map((V1)=>`if (typeof ${V1} !== 'undefined') __localVars['${V1}'] = ${V1};`).join(`
10712
10712
  `)}
10713
10713
  }
10714
10714
  catch (e) {}
@@ -10717,17 +10717,17 @@ catch (e) {}
10717
10717
  finally {
10718
10718
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
10719
10719
  }
10720
- }`,L8=j?null:p2(Y,t1),V5=L8?`window.__stxComponentFactories[${JSON.stringify(L8)}](${JSON.stringify(a)});`:`(${t1})(${JSON.stringify(a)});`;if(j)return`${K1}<script type="stx/island" data-stx-island="${a}" data-stx-scoped${D0}>${V5}</script>`;return`${K1}<script data-stx-scoped data-stx-run="always"${D0}>${V5}</script>`}));if(c=c+`
10721
- `+j0.join(`
10722
- `),n)c+=`
10723
- `+n}else{if(n)c+=`
10724
- `+n;if(x.length>0){let f=D.__stx_event_bindings||[],d=x7(D),j0=await Promise.all(x.map(async(X0)=>{let E0=X0.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!E0)return X0;return await f7(E0[1],{eventBindings:f,templateContent:c,filePath:L,projectRoot:process.cwd(),serverData:d})}));c+=`
10725
- `+j0.join(`
10726
- `),D.__stx_event_bindings=[]}}if(q0){let f=l8(c,L);if(f.hasScoped)c=f.html}if(m&&R0)GX.set(m,{output:c,dependencies:[...w].filter((f)=>!R0.has(f))});return k.length>0?`${c}
10720
+ }`,L8=j?null:p2(Y,a1),F5=L8?`window.__stxComponentFactories[${JSON.stringify(L8)}](${JSON.stringify(g)});`:`(${a1})(${JSON.stringify(g)});`;if(j)return`${e0}<script type="stx/island" data-stx-island="${g}" data-stx-scoped${P0}>${F5}</script>`;return`${e0}<script data-stx-scoped data-stx-run="always"${P0}>${F5}</script>`}));if(c=c+`
10721
+ `+e.join(`
10722
+ `),r)c+=`
10723
+ `+r}else{if(r)c+=`
10724
+ `+r;if(f.length>0){let v=D.__stx_event_bindings||[],u=x7(D),e=await Promise.all(f.map(async($0)=>{let M0=$0.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!M0)return $0;return await f7(M0[1],{eventBindings:v,templateContent:c,filePath:L,projectRoot:process.cwd(),serverData:u})}));c+=`
10725
+ `+e.join(`
10726
+ `),D.__stx_event_bindings=[]}}if(Y0){let v=l8(c,L);if(v.hasScoped)c=v.html}if(m&&A0)GX.set(m,{output:c,dependencies:[...w].filter((v)=>!A0.has(v))});return k.length>0?`${c}
10727
10727
  ${k.join(`
10728
10728
  `)}`:c}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{K.delete($)}}async function o($){return Bun.file($).exists()}function QX($,X){let Z=h.resolve(X),J=h.resolve($),Y=Z.endsWith(h.sep)?Z:Z+h.sep;if(J===Z||J.startsWith(Y))return J;return null}async function RU($,X,Z,J){let Y=X.startsWith("layouts/")?X.slice(8):X,G=h.join($,Y);for(let Q of G.endsWith(".stx")?[G]:[G,`${G}.stx`])if(await o(Q)){if(J)console.log(`Found layout in ${$}: ${Q}`);return Z?.add(Q),Q}return null}async function WX($,X,Z,J){let Y=await NU($,X,Z,J);if(Y===null)return null;let G=QX(Y,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.fallbackLayoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((W)=>typeof W==="string"&&W.length>0);for(let W of Q){let w=h.isAbsolute(W)?W:h.resolve(process.cwd(),W);if(QX(Y,w))return h.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${X})`),null}async function NU($,X,Z,J){if(Z.debug)console.log(`Resolving template path: ${$} from ${X}`);let Y=h.dirname(X),G=process.cwd();if($.startsWith("/")){let U=h.join(G,$),j=QX(U,G);if(!j)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${X})`),null;if(Z.debug)console.log(`Checking absolute path: ${j}`);if(await o(j)&&J)J.add(j);return j}let Q=h.join(Y,$);if(await o(Q)){if(Z.debug)console.log(`Found direct path: ${Q}`);if(J)J.add(Q);return Q}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let U of[".stx",".tsx",".jsx"]){let j=`${Q}${U}`;if(await o(j)){if(Z.debug)console.log(`Found direct path with extension: ${j}`);if(J)J.add(j);return j}}let W=[];if(Z.layoutsDir)W.push(h.isAbsolute(Z.layoutsDir)?Z.layoutsDir:h.resolve(process.cwd(),Z.layoutsDir));let w=h.resolve(Y),q=process.cwd();for(let U=0;U<10;U++){let j=h.join(w,"layouts"),B=!1;try{B=zU.statSync(j,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){W.push(j);break}let H=h.dirname(w);if(H===w||H.length<q.length)break;w=H}for(let U of W){let j=await RU(U,$,J,Z.debug);if(j)return j}if(Z.fallbackLayoutsDir){let U=h.isAbsolute(Z.fallbackLayoutsDir)?Z.fallbackLayoutsDir:h.resolve(process.cwd(),Z.fallbackLayoutsDir),j=$.startsWith("layouts/")?$.slice(8):$,B=[h.join(U,j)];if(!$.endsWith(".stx"))B.push(`${B[0]}.stx`);for(let H of B)if(await o(H)){if(Z.debug)console.log(`Found in options.fallbackLayoutsDir: ${H}`);if(J)J.add(H);return H}}if($.startsWith("layouts/")||$.includes("/layouts/")){let U=$.split("layouts/"),j=h.join(Z.partialsDir||Y,"layouts",U[1]);if(await o(j)){if(Z.debug)console.log(`Found in layouts path: ${j}`);if(J)J.add(j);return j}if(!j.endsWith(".stx")){let B=`${j}.stx`;if(await o(B)){if(Z.debug)console.log(`Found in layouts path with extension: ${B}`);if(J)J.add(B);return B}}}if(Z.partialsDir){let U=h.join(Z.partialsDir,"layouts");if(await o(U)){let j=h.join(U,$);if(await o(j)){if(Z.debug)console.log(`Found in partials layouts dir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let B=`${j}.stx`;if(await o(B)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}}let K=Z.partialsDir||h.join(process.cwd(),"views"),z=h.join(K,$);if(await o(z)){if(Z.debug)console.log(`Found in views path: ${z}`);if(J)J.add(z);return z}if(!$.endsWith(".stx")){let U=`${z}.stx`;if(await o(U)){if(Z.debug)console.log(`Found in views path with extension: ${U}`);if(J)J.add(U);return U}}if(Y.includes("temp")){let U=h.join(h.dirname(Y),"layouts",$);if(await o(U)){if(Z.debug)console.log(`Found in temp layouts dir: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await o(j)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${X})`);else console.warn(`Template not found: ${$} (referenced from ${X})`);return null}function NJ($,X,Z){let J=0,Y="",G="";try{if(typeof X==="number"&&X>=0){let Q=$.split(`
10729
10729
  `),W=0;for(let w=0;w<Q.length;w++)if(W+=Q[w].length+1,W>=X){J=w+1,Y=Q[w].trim();let q=Math.max(0,w-2),K=Math.min(Q.length,w+3);G=Q.slice(q,K).map((z,U)=>{let j=q+U+1;return`${j===J?"> ":" "}${j}: ${z}`}).join(`
10730
- `);break}}else if(Z){let Q=$.indexOf(Z);if(Q>=0)return NJ($,Q)}}catch{}return{lineNumber:J,lineContent:Y,context:G}}function _0($,X,Z,J,Y,G){let{lineNumber:Q,context:W}=NJ(J,Y,G),w=Z.split("/").pop(),q=0;if(typeof Y==="number"&&Y>=0&&J){let z=J.lastIndexOf(`
10730
+ `);break}}else if(Z){let Q=$.indexOf(Z);if(Q>=0)return NJ($,Q)}}catch{}return{lineNumber:J,lineContent:Y,context:G}}function H0($,X,Z,J,Y,G){let{lineNumber:Q,context:W}=NJ(J,Y,G),w=Z.split("/").pop(),q=0;if(typeof Y==="number"&&Y>=0&&J){let z=J.lastIndexOf(`
10731
10731
  `,Math.max(0,Y-1));q=Y-(z+1)+1}let K="";if(Q>0)K+=`
10732
10732
  ${Z}:${Q}${q>0?`:${q}`:""}: ${$.toLowerCase()} error: ${X}
10733
10733
  `;if(K+=`
@@ -10740,8 +10740,8 @@ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${X}
10740
10740
  `,W)K+=`
10741
10741
  ${Z0.blue}${Z0.bold}Context:${Z0.reset}
10742
10742
  ${Z0.dim}${W}${Z0.reset}
10743
- `;return K}function wJ(){_$.clear(),O$.clear(),GX.clear()}var _$,O$,GX,UU=0,H$,Z0;var V0=y(()=>{g7();O4();B1();J1();x5();F$();P1();N4();M4();S7();x1();VZ();c7();_$=new J5(500),O$=new J5(1000),GX=new J5(2000);H$=new Map;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 MJ($,X,Z=""){let J=$,Y=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec($))!==null){let W=Q.index,w=Q[0].match(/@markdown\(([^)]*)\)/),q=w?w[1]:"",K=W+Q[0].length,z=1,U=K,j=-1;while(z>0&&U<$.length){let _=$.indexOf("@markdown",U),L=$.indexOf("@endmarkdown",U);if(L===-1)break;if(_!==-1&&_<L&&_!==W){let O=$[_+9];if(O==="("||O===`
10744
- `||O==="\r"||O===" "||O===void 0)z++;U=_+9}else{if(z--,z===0){j=L;break}U=L+12}}if(j===-1)continue;let B=$.slice(K,j),H=$.slice(W,j+12);Y.push({fullMatch:H,options:q,content:B,index:W}),G.lastIndex=j+12}for(let{fullMatch:W,options:w,content:q,index:K}of Y)try{let z={};if(w)w.split(",").forEach((B)=>{let H=B.trim();if(H)z[H]=!0});let U={gfm:z.gfm??!0,breaks:z.breaks??!1},j=b7(q.trim(),U);J=J.split(W).join(j)}catch(z){let U=z instanceof Error?z.message:String(z),j=_0("Markdown Directive",`Error processing markdown: ${U}`,Z,$,K,W);J=J.split(W).join(j)}return J}async function TJ($,X,Z,J){let Y={gfm:!0,breaks:!1};return X.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")Y.breaks=!0;if(Q==="no-gfm")Y.gfm=!1}),b7($.trim(),Y)}var wX=y(()=>{V0()});function kU($){if(MU.set($.name,$),$.client)TU.set($.name,$.client)}function V$($){return kU($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Z,J,Y,G)=>{let Q=IU(J,$.defaults);if($.validate){let w=$.validate(Q);if(w!==!0){let q=typeof w==="string"?w:`Invalid parameters for @${$.name}`;throw Error(q)}}let W=Z;if($.transform)W=await $.transform(Z,Q,Y,G);if($.clientScript){let w=$.clientScript(Q);W+=`<script>${w}</script>`}if($.css){let w=$.css(Q);W+=`<style>${w}</style>`}return W}}}function IU($,X){let Z={...X};for(let J of $){let Y=J.indexOf(":"),G=J.indexOf("="),Q=Y>=0&&(G<0||Y<G)?Y:G;if(Q>=0){let W=J.slice(0,Q).trim(),w=J.slice(Q+1).trim();if(w==="true")w=!0;else if(w==="false")w=!1;else if(w==="null")w=null;else if(!Number.isNaN(Number(w)))w=Number(w);else if(typeof w==="string"&&w.startsWith("{"))try{w=JSON.parse(w)}catch{}Z[W]=w}else{let W=Object.keys(Z).filter((w)=>!X||!(w in X)).length;Z[W===0?"value":`arg${W}`]=J}}return Z}var MU,TU;var qX=y(()=>{MU=new Map,TU=new Map});function KX($,X=u5,Z={},J){return X.sort((Y,G)=>Y-G).map((Y)=>{return`${o7($,{...Z,w:Y,fm:J})} ${Y}w`}).join(", ")}function kJ($,X,Z=EU,J={},Y){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round(X*G);return`${o7($,{...J,w:Q,dpr:G,fm:Y})} ${G}x`}).join(", ")}function zX($,X="100vw"){if(!$||Object.keys($).length===0)return X;let J=Object.entries($).map(([Y,G])=>{let Q=/^\d+$/.test(Y)?`${Y}px`:Y;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((Y,G)=>Y.numericBp-G.numericBp).map(({bp:Y,size:G})=>`(max-width: ${Y}) ${G}`);return J.push(X),J.join(", ")}function o7($,X={}){let Z=Object.entries(X).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 $;let J=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${J}`}function UX($){return DU[$]||"application/octet-stream"}var u5,EU,r7,DU;var jX=y(()=>{u5=[320,480,640,768,1024,1280,1536,1920,2560],EU=[1,1.5,2,3],r7=["avif","webp","jpeg"],DU={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function bU(){try{return await import("ts-images")}catch{return null}}async function SU($,X={}){let Z={...yU,...X},J=await bU();if(J)try{return await CU($,Z,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return PU($,Z)}async function CU($,X,Z){let{generatePlaceholder:J,generateThumbHash:Y}=Z,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[X.strategy]||"blur";if(X.strategy==="thumbhash")return{dataURL:(await Y($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let W=await J($,{width:X.width,height:X.height,quality:X.quality,blurLevel:X.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:X.strategy,dominantColor:W.dominantColor,css:W.css}}function PU($,X){let Z=X.width||20,J=X.height||Z,Y="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${J}" viewBox="0 0 ${Z} ${J}"><rect fill="#e5e7eb" width="${Z}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:J,aspectRatio:Z/J,originalWidth:0,originalHeight:0,strategy:X.strategy,dominantColor:"#e5e7eb"}}function IJ($,X,Z={}){let J=Z.transitionDuration||300,Y=Z.easing||"ease-out";return`
10743
+ `;return K}function wJ(){_$.clear(),O$.clear(),GX.clear()}var _$,O$,GX,UU=0,H$,Z0;var F0=y(()=>{g7();O4();j1();J1();v5();F$();x1();N4();M4();S7();g1();VZ();c7();_$=new Z5(500),O$=new Z5(1000),GX=new Z5(2000);H$=new Map;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 MJ($,X,Z=""){let J=$,Y=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec($))!==null){let W=Q.index,w=Q[0].match(/@markdown\(([^)]*)\)/),q=w?w[1]:"",K=W+Q[0].length,z=1,U=K,j=-1;while(z>0&&U<$.length){let _=$.indexOf("@markdown",U),L=$.indexOf("@endmarkdown",U);if(L===-1)break;if(_!==-1&&_<L&&_!==W){let O=$[_+9];if(O==="("||O===`
10744
+ `||O==="\r"||O===" "||O===void 0)z++;U=_+9}else{if(z--,z===0){j=L;break}U=L+12}}if(j===-1)continue;let B=$.slice(K,j),H=$.slice(W,j+12);Y.push({fullMatch:H,options:q,content:B,index:W}),G.lastIndex=j+12}for(let{fullMatch:W,options:w,content:q,index:K}of Y)try{let z={};if(w)w.split(",").forEach((B)=>{let H=B.trim();if(H)z[H]=!0});let U={gfm:z.gfm??!0,breaks:z.breaks??!1},j=b7(q.trim(),U);J=J.split(W).join(j)}catch(z){let U=z instanceof Error?z.message:String(z),j=H0("Markdown Directive",`Error processing markdown: ${U}`,Z,$,K,W);J=J.split(W).join(j)}return J}async function TJ($,X,Z,J){let Y={gfm:!0,breaks:!1};return X.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")Y.breaks=!0;if(Q==="no-gfm")Y.gfm=!1}),b7($.trim(),Y)}var wX=y(()=>{F0()});function kU($){if(MU.set($.name,$),$.client)TU.set($.name,$.client)}function V$($){return kU($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Z,J,Y,G)=>{let Q=IU(J,$.defaults);if($.validate){let w=$.validate(Q);if(w!==!0){let q=typeof w==="string"?w:`Invalid parameters for @${$.name}`;throw Error(q)}}let W=Z;if($.transform)W=await $.transform(Z,Q,Y,G);if($.clientScript){let w=$.clientScript(Q);W+=`<script>${w}</script>`}if($.css){let w=$.css(Q);W+=`<style>${w}</style>`}return W}}}function IU($,X){let Z={...X};for(let J of $){let Y=J.indexOf(":"),G=J.indexOf("="),Q=Y>=0&&(G<0||Y<G)?Y:G;if(Q>=0){let W=J.slice(0,Q).trim(),w=J.slice(Q+1).trim();if(w==="true")w=!0;else if(w==="false")w=!1;else if(w==="null")w=null;else if(!Number.isNaN(Number(w)))w=Number(w);else if(typeof w==="string"&&w.startsWith("{"))try{w=JSON.parse(w)}catch{}Z[W]=w}else{let W=Object.keys(Z).filter((w)=>!X||!(w in X)).length;Z[W===0?"value":`arg${W}`]=J}}return Z}var MU,TU;var qX=y(()=>{MU=new Map,TU=new Map});function KX($,X=h5,Z={},J){return X.sort((Y,G)=>Y-G).map((Y)=>{return`${o7($,{...Z,w:Y,fm:J})} ${Y}w`}).join(", ")}function kJ($,X,Z=EU,J={},Y){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round(X*G);return`${o7($,{...J,w:Q,dpr:G,fm:Y})} ${G}x`}).join(", ")}function zX($,X="100vw"){if(!$||Object.keys($).length===0)return X;let J=Object.entries($).map(([Y,G])=>{let Q=/^\d+$/.test(Y)?`${Y}px`:Y;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((Y,G)=>Y.numericBp-G.numericBp).map(({bp:Y,size:G})=>`(max-width: ${Y}) ${G}`);return J.push(X),J.join(", ")}function o7($,X={}){let Z=Object.entries(X).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 $;let J=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),Y=$.includes("?")?"&":"?";return`${$}${Y}${J}`}function UX($){return DU[$]||"application/octet-stream"}var h5,EU,r7,DU;var jX=y(()=>{h5=[320,480,640,768,1024,1280,1536,1920,2560],EU=[1,1.5,2,3],r7=["avif","webp","jpeg"],DU={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function bU(){try{return await import("ts-images")}catch{return null}}async function SU($,X={}){let Z={...yU,...X},J=await bU();if(J)try{return await CU($,Z,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return PU($,Z)}async function CU($,X,Z){let{generatePlaceholder:J,generateThumbHash:Y}=Z,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[X.strategy]||"blur";if(X.strategy==="thumbhash")return{dataURL:(await Y($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let W=await J($,{width:X.width,height:X.height,quality:X.quality,blurLevel:X.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:X.strategy,dominantColor:W.dominantColor,css:W.css}}function PU($,X){let Z=X.width||20,J=X.height||Z,Y="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${J}" viewBox="0 0 ${Z} ${J}"><rect fill="#e5e7eb" width="${Z}" height="${J}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:J,aspectRatio:Z/J,originalWidth:0,originalHeight:0,strategy:X.strategy,dominantColor:"#e5e7eb"}}function IJ($,X,Z={}){let J=Z.transitionDuration||300,Y=Z.easing||"ease-out";return`
10745
10745
  #${$} {
10746
10746
  --stx-img-transition-duration: ${J}ms;
10747
10747
  --stx-img-transition-easing: ${Y};
@@ -10787,8 +10787,8 @@ ${Z0.dim}${W}${Z0.reset}
10787
10787
  filter: blur(0);
10788
10788
  transform: scale(1);
10789
10789
  }
10790
- `.trim();BX=new Map});import{createHash as bJ}from"crypto";import{readFile as vU,stat as SJ}from"fs/promises";async function m0($){try{let X=await vU($);return bJ("sha256").update(X).digest("hex").slice(0,16)}catch{return""}}function yJ($){return bJ("sha256").update($).digest("hex").slice(0,16)}function A$($,X){let Z=JSON.stringify(X,Object.keys(X).sort());return`${yJ($)}-${yJ(Z)}`}async function _X($){try{return(await SJ($)).mtimeMs}catch{return 0}}async function f0($){try{return await SJ($),!0}catch{return!1}}var K5=()=>{};import{mkdir as xU,readFile as fU,writeFile as gU,readdir as AN,rm as hU,stat as RN}from"fs/promises";import{join as PJ,dirname as uU}from"path";async function dU($){try{await xU($,{recursive:!0})}catch{}}function vJ($,X,Z){return PJ($,Z,`${X}.json`)}async function CJ($,X,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await _X(X)!==$.srcMtime)return!1;return!0}async function R$($,X,Z,J=OX){if(!J.enabled)return null;let Y=A$($,X),G=d5.get(Y);if(G){if(await CJ(G,$,J.maxAge))return G.lastAccessedAt=Date.now(),G.data;d5.delete(Y)}let Q=vJ(J.directory,Y,Z);if(await f0(Q))try{let W=await fU(Q,"utf-8"),w=JSON.parse(W);if(await CJ(w,$,J.maxAge))return w.lastAccessedAt=Date.now(),d5.set(Y,w),w.data}catch{}return null}async function N$($,X,Z,J,Y=OX){if(!Y.enabled)return;let G=A$($,X),Q=await m0($),W=await _X($),w={key:G,src:$,srcHash:Q,srcMtime:W,optionsHash:A$("",X),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};d5.set(G,w);let q=vJ(Y.directory,G,J);try{await dU(uU(q)),await gU(q,JSON.stringify(w,null,2))}catch(K){console.warn(`[stx-media] Failed to write cache: ${K}`)}}async function M$($,X=OX){if($==="all")d5.clear();else d5.clear();let Z=$==="all"?["image","video"]:[$];for(let J of Z){let Y=PJ(X.directory,J);try{await hU(Y,{recursive:!0,force:!0})}catch{}}}var d5,OX;var LX=y(()=>{K5();d5=new Map,OX={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class k${config;constructor($={}){this.config={...mU,...$}}async get($,X){return R$($,X,"image",this.config)}async set($,X,Z){return N$($,X,Z,"image",this.config)}async clear(){return M$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function FX($){if(!T$)T$=new k$($);else if($)T$.updateConfig($);return T$}async function I$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return FX(J).get($,X)}async function E$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return FX(Y).set($,X,Z)}async function xJ(){return FX().clear()}var mU,T$=null;var VX=y(()=>{LX();mU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as cU,basename as lU,extname as pU,join as iU}from"path";import{mkdir as nU}from"fs/promises";async function AX(){try{return await import("ts-images")}catch{return null}}function fJ($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function rU($,X){let Z=X?fJ(X):fJ("web"),J=$.formatQuality||{};return{jpeg:{...Z.jpeg,...J.jpeg},png:{...Z.png,...J.png},webp:{...Z.webp,...J.webp},avif:{...Z.avif,...J.avif}}}async function gJ($,X,Z){let J=await AX();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Y=await I$($,X,Z);if(Y)return Y;try{let G=cU($);if(!await f0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let Q=rU(Z,X.preset),W=Z.outputDir||"dist/images",w=Z.baseUrl||"/images";await nU(W,{recursive:!0});let q=await m0(G),K=lU($,pU($)),z=X.outputFormat?[X.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],U={src:$,processed:!0,variants:[],hash:q},j=null;if(X.transformations&&X.transformations.length>0)j=await RX(G,X.transformations,J);for(let B of z){let H=Q[B]||{},_=`${K}-${q}.${B}`,L=iU(W,_);try{let O=await J.optimizeImage({input:j||G,output:L,format:B,quality:H.quality,progressive:H.progressive});if(O){if(U.variants.push({path:L,url:`${w}/${_}`,width:O.width||0,height:O.height||0,format:B,size:O.outputSize||0}),!U.originalWidth&&O.width)U.originalWidth=O.width,U.originalHeight=O.height}}catch(O){U.errors=U.errors||[],U.errors.push(`Failed to optimize ${B}: ${O}`)}}if(X.embedThumbhash||X.placeholder==="thumbhash")try{let B=await J.generateThumbHash(G);U.placeholder=B.dataUrl}catch(B){U.errors=U.errors||[],U.errors.push(`Failed to generate thumbhash: ${B}`)}if(X.useDominantColor)try{let B=await J.generatePlaceholder(G,{strategy:"dominant-color"});U.dominantColor=B.dominantColor}catch(B){U.errors=U.errors||[],U.errors.push(`Failed to extract dominant color: ${B}`)}return await E$($,X,U,Z),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function hJ($,X,Z,J){let Y=await AX();if(!Y)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Y.optimizeImage({input:$,output:J,format:X,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function RX($,X,Z){let J=Z||await AX();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Y=await J.decode($);for(let G of X){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)Y=await J.resize(Y,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)Y=await J.blur(Y,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)Y=await J.sharpen(Y,Q.amount);break;case"grayscale":Y=await J.grayscale(Y);break;case"rotate":if(Q.angle!==void 0)Y=await J.rotate(Y,Q.angle);break;case"flip":Y=await J.flip(Y);break;case"flop":Y=await J.flop(Y);break;case"brightness":if(Q.value!==void 0)Y=await J.brightness(Y,Q.value);break;case"contrast":if(Q.value!==void 0)Y=await J.contrast(Y,Q.value);break;case"saturation":if(Q.value!==void 0)Y=await J.saturation(Y,Q.value);break}}return await J.encode(Y,"png")}catch(Y){return console.error(`[stx-media] Transformation failed: ${Y}`),null}}var uJ=y(()=>{K5();VX()});import{resolve as oU,basename as sU,extname as aU,join as tU}from"path";import{mkdir as eU}from"fs/promises";async function $j(){try{return await import("ts-images")}catch{return null}}async function dJ($,X,Z){let J=await $j();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Y=oU($);if(!await f0(Y))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let G=X.responsiveWidths||Z.breakpoints||Xj,Q=X.formats||Z.defaultFormats||["avif","webp","jpeg"],W=Z.outputDir||"dist/images",w=Z.baseUrl||"/images";await eU(W,{recursive:!0});let q=await m0(Y),K=sU($,aU($)),z=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},U={src:$,byFormat:{},srcsets:{}};for(let B of Q){U.byFormat[B]=[];let H=[];for(let _ of G){let L=`${K}-${_}w-${q}.${B}`,O=tU(W,L),F=`${w}/${L}`;try{let V=z[B]?.quality||80;if(await f0(O)){U.byFormat[B].push({path:O,url:F,width:_,height:0,format:B,size:0}),H.push(`${F} ${_}w`);continue}let A=await J.processImage({input:Y,output:O,format:B,quality:V,resize:{width:_}});if(A)U.byFormat[B].push({path:O,url:F,width:_,height:A.height||Math.round(_*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),H.push(`${F} ${_}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${B} at ${_}w: ${V}`)}}U.srcsets[B]=H.join(", ")}let j=X.placeholder||Z.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let B=await J.generateThumbHash(Y);U.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await J.generatePlaceholder(Y,{strategy:j,width:20});U.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:j}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return U.sizes=X.sizes||Zj(G),U}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function Zj($){let X=[...$].sort((J,Y)=>J-Y),Z=[];for(let J=0;J<X.length-1;J++){let Y=X[J];Z.push(`(max-width: ${Y}px) ${Y}px`)}return Z.push(`${X[X.length-1]}px`),Z.join(", ")}function mJ($,X="width"){if(!$||$.length===0)return"";if(X==="dpr")return $.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return $.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var Xj;var cJ=y(()=>{K5();Xj=[320,480,640,768,1024,1280,1536,1920]});var lJ={};e(lJ,{setCachedImageResult:()=>E$,processImage:()=>gJ,optimizeImage:()=>hJ,getCachedImageResult:()=>I$,generateSrcset:()=>mJ,generateResponsiveVariants:()=>dJ,clearImageCache:()=>xJ,applyTransformations:()=>RX,ImageProcessorCache:()=>k$});var pJ=y(()=>{uJ();cJ();VX()});async function Jj(){try{return await Promise.resolve().then(() => (pJ(),lJ))}catch($){if(!iJ)console.warn("[stx-media] Image processor not available, some features disabled:",$),iJ=!0;return null}}async function D$($,X={}){let Z=X,J=$;if(J.process&&!J.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return Wj(J,Z)}if(Z.processedResult?.processed)return kX($,Z.processedResult,X);if(Z.responsiveVariants)return sJ($,Z.responsiveVariants,X);let{src:Y,alt:G,width:Q,height:W,sizes:w,widths:q=u5,dpr:K,formats:z=r7,quality:U=NX,params:j={},placeholder:B="none",placeholderOptions:H={},lazy:_=!0,priority:L=!1,loading:O=L?"eager":b$,decoding:F=y$,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:k}=$,I=$.class,M=$.style,E=$.id,T=$.data||{},{isDev:D=!1,baseUrl:b=""}=X;if(D&&!X.optimize)return Qj($);let S,P,v=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!L)try{S=await EJ(Y,{strategy:B,...H}),P=IJ(v,S,H)}catch{}let x=K!==void 0&&Q!==void 0,i;if(x)i=Gj($,v,S,X);else i=await Yj($,v,S,X);let m;if(L){let C0=z.includes("webp")?"webp":z[0],P0=KX(Y,q,{...j,q:U},C0),n=typeof w==="object"?zX(w):w||"100vw";m=`<link rel="preload" as="image" imagesrcset="${P0}" imagesizes="${n}" />`}let R0=[];if(!nJ&&B!=="none")R0.push(HX),nJ=!0;if(P)R0.push(P);let w0=_?oJ(v):void 0;return{html:i,preloadLink:m,css:R0.length>0?R0.join(`
10791
- `):void 0,script:w0}}async function Yj($,X,Z,J){let{src:Y,alt:G,width:Q,height:W,sizes:w,widths:q=u5,formats:K=r7,quality:z=NX,params:U={},lazy:j=!0,priority:B=!1,loading:H=B?"eager":b$,decoding:_=y$,fetchpriority:L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A}=$,R=$.class,N=$.style,k=$.data||{},I=typeof w==="object"?zX(w):w||"100vw",M=[];for(let D of K){let b=KX(Y,q,{...U,q:z},D),S=UX(D);if(j&&!B)M.push(` <source type="${S}" data-srcset="${b}" data-sizes="${I}" />`);else M.push(` <source type="${S}" srcset="${b}" sizes="${I}" />`)}let E=MX({src:o7(Y,{...U,q:z}),alt:G,width:Q,height:W,loading:B?void 0:H,decoding:_,fetchpriority:B?"high":L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A,className:rJ(R,Z),style:TX(N,O,F,Z),lazy:j&&!B,data:k}),T;if(Z){let D=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;T=`<div id="${X}" class="stx-img-placeholder" style="${D}">
10790
+ `.trim();BX=new Map});import{createHash as bJ}from"crypto";import{readFile as vU,stat as SJ}from"fs/promises";async function d0($){try{let X=await vU($);return bJ("sha256").update(X).digest("hex").slice(0,16)}catch{return""}}function yJ($){return bJ("sha256").update($).digest("hex").slice(0,16)}function A$($,X){let Z=JSON.stringify(X,Object.keys(X).sort());return`${yJ($)}-${yJ(Z)}`}async function _X($){try{return(await SJ($)).mtimeMs}catch{return 0}}async function x0($){try{return await SJ($),!0}catch{return!1}}var q5=()=>{};import{mkdir as xU,readFile as fU,writeFile as gU,readdir as AN,rm as hU,stat as RN}from"fs/promises";import{join as PJ,dirname as uU}from"path";async function dU($){try{await xU($,{recursive:!0})}catch{}}function vJ($,X,Z){return PJ($,Z,`${X}.json`)}async function CJ($,X,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await _X(X)!==$.srcMtime)return!1;return!0}async function R$($,X,Z,J=OX){if(!J.enabled)return null;let Y=A$($,X),G=u5.get(Y);if(G){if(await CJ(G,$,J.maxAge))return G.lastAccessedAt=Date.now(),G.data;u5.delete(Y)}let Q=vJ(J.directory,Y,Z);if(await x0(Q))try{let W=await fU(Q,"utf-8"),w=JSON.parse(W);if(await CJ(w,$,J.maxAge))return w.lastAccessedAt=Date.now(),u5.set(Y,w),w.data}catch{}return null}async function N$($,X,Z,J,Y=OX){if(!Y.enabled)return;let G=A$($,X),Q=await d0($),W=await _X($),w={key:G,src:$,srcHash:Q,srcMtime:W,optionsHash:A$("",X),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};u5.set(G,w);let q=vJ(Y.directory,G,J);try{await dU(uU(q)),await gU(q,JSON.stringify(w,null,2))}catch(K){console.warn(`[stx-media] Failed to write cache: ${K}`)}}async function M$($,X=OX){if($==="all")u5.clear();else u5.clear();let Z=$==="all"?["image","video"]:[$];for(let J of Z){let Y=PJ(X.directory,J);try{await hU(Y,{recursive:!0,force:!0})}catch{}}}var u5,OX;var LX=y(()=>{q5();u5=new Map,OX={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class k${config;constructor($={}){this.config={...mU,...$}}async get($,X){return R$($,X,"image",this.config)}async set($,X,Z){return N$($,X,Z,"image",this.config)}async clear(){return M$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function FX($){if(!T$)T$=new k$($);else if($)T$.updateConfig($);return T$}async function I$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return FX(J).get($,X)}async function E$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return FX(Y).set($,X,Z)}async function xJ(){return FX().clear()}var mU,T$=null;var VX=y(()=>{LX();mU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as cU,basename as lU,extname as pU,join as iU}from"path";import{mkdir as nU}from"fs/promises";async function AX(){try{return await import("ts-images")}catch{return null}}function fJ($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function rU($,X){let Z=X?fJ(X):fJ("web"),J=$.formatQuality||{};return{jpeg:{...Z.jpeg,...J.jpeg},png:{...Z.png,...J.png},webp:{...Z.webp,...J.webp},avif:{...Z.avif,...J.avif}}}async function gJ($,X,Z){let J=await AX();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Y=await I$($,X,Z);if(Y)return Y;try{let G=cU($);if(!await x0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let Q=rU(Z,X.preset),W=Z.outputDir||"dist/images",w=Z.baseUrl||"/images";await nU(W,{recursive:!0});let q=await d0(G),K=lU($,pU($)),z=X.outputFormat?[X.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],U={src:$,processed:!0,variants:[],hash:q},j=null;if(X.transformations&&X.transformations.length>0)j=await RX(G,X.transformations,J);for(let B of z){let H=Q[B]||{},_=`${K}-${q}.${B}`,L=iU(W,_);try{let O=await J.optimizeImage({input:j||G,output:L,format:B,quality:H.quality,progressive:H.progressive});if(O){if(U.variants.push({path:L,url:`${w}/${_}`,width:O.width||0,height:O.height||0,format:B,size:O.outputSize||0}),!U.originalWidth&&O.width)U.originalWidth=O.width,U.originalHeight=O.height}}catch(O){U.errors=U.errors||[],U.errors.push(`Failed to optimize ${B}: ${O}`)}}if(X.embedThumbhash||X.placeholder==="thumbhash")try{let B=await J.generateThumbHash(G);U.placeholder=B.dataUrl}catch(B){U.errors=U.errors||[],U.errors.push(`Failed to generate thumbhash: ${B}`)}if(X.useDominantColor)try{let B=await J.generatePlaceholder(G,{strategy:"dominant-color"});U.dominantColor=B.dominantColor}catch(B){U.errors=U.errors||[],U.errors.push(`Failed to extract dominant color: ${B}`)}return await E$($,X,U,Z),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function hJ($,X,Z,J){let Y=await AX();if(!Y)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Y.optimizeImage({input:$,output:J,format:X,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function RX($,X,Z){let J=Z||await AX();if(!J)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Y=await J.decode($);for(let G of X){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)Y=await J.resize(Y,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)Y=await J.blur(Y,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)Y=await J.sharpen(Y,Q.amount);break;case"grayscale":Y=await J.grayscale(Y);break;case"rotate":if(Q.angle!==void 0)Y=await J.rotate(Y,Q.angle);break;case"flip":Y=await J.flip(Y);break;case"flop":Y=await J.flop(Y);break;case"brightness":if(Q.value!==void 0)Y=await J.brightness(Y,Q.value);break;case"contrast":if(Q.value!==void 0)Y=await J.contrast(Y,Q.value);break;case"saturation":if(Q.value!==void 0)Y=await J.saturation(Y,Q.value);break}}return await J.encode(Y,"png")}catch(Y){return console.error(`[stx-media] Transformation failed: ${Y}`),null}}var uJ=y(()=>{q5();VX()});import{resolve as oU,basename as sU,extname as aU,join as tU}from"path";import{mkdir as eU}from"fs/promises";async function $j(){try{return await import("ts-images")}catch{return null}}async function dJ($,X,Z){let J=await $j();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Y=oU($);if(!await x0(Y))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let G=X.responsiveWidths||Z.breakpoints||Xj,Q=X.formats||Z.defaultFormats||["avif","webp","jpeg"],W=Z.outputDir||"dist/images",w=Z.baseUrl||"/images";await eU(W,{recursive:!0});let q=await d0(Y),K=sU($,aU($)),z=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},U={src:$,byFormat:{},srcsets:{}};for(let B of Q){U.byFormat[B]=[];let H=[];for(let _ of G){let L=`${K}-${_}w-${q}.${B}`,O=tU(W,L),F=`${w}/${L}`;try{let V=z[B]?.quality||80;if(await x0(O)){U.byFormat[B].push({path:O,url:F,width:_,height:0,format:B,size:0}),H.push(`${F} ${_}w`);continue}let A=await J.processImage({input:Y,output:O,format:B,quality:V,resize:{width:_}});if(A)U.byFormat[B].push({path:O,url:F,width:_,height:A.height||Math.round(_*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),H.push(`${F} ${_}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${B} at ${_}w: ${V}`)}}U.srcsets[B]=H.join(", ")}let j=X.placeholder||Z.placeholderStrategy||"thumbhash";if(j!=="none")try{if(j==="thumbhash"){let B=await J.generateThumbHash(Y);U.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await J.generatePlaceholder(Y,{strategy:j,width:20});U.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:j}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return U.sizes=X.sizes||Zj(G),U}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function Zj($){let X=[...$].sort((J,Y)=>J-Y),Z=[];for(let J=0;J<X.length-1;J++){let Y=X[J];Z.push(`(max-width: ${Y}px) ${Y}px`)}return Z.push(`${X[X.length-1]}px`),Z.join(", ")}function mJ($,X="width"){if(!$||$.length===0)return"";if(X==="dpr")return $.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return $.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var Xj;var cJ=y(()=>{q5();Xj=[320,480,640,768,1024,1280,1536,1920]});var lJ={};t(lJ,{setCachedImageResult:()=>E$,processImage:()=>gJ,optimizeImage:()=>hJ,getCachedImageResult:()=>I$,generateSrcset:()=>mJ,generateResponsiveVariants:()=>dJ,clearImageCache:()=>xJ,applyTransformations:()=>RX,ImageProcessorCache:()=>k$});var pJ=y(()=>{uJ();cJ();VX()});async function Jj(){try{return await Promise.resolve().then(() => (pJ(),lJ))}catch($){if(!iJ)console.warn("[stx-media] Image processor not available, some features disabled:",$),iJ=!0;return null}}async function D$($,X={}){let Z=X,J=$;if(J.process&&!J.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return Wj(J,Z)}if(Z.processedResult?.processed)return kX($,Z.processedResult,X);if(Z.responsiveVariants)return sJ($,Z.responsiveVariants,X);let{src:Y,alt:G,width:Q,height:W,sizes:w,widths:q=h5,dpr:K,formats:z=r7,quality:U=NX,params:j={},placeholder:B="none",placeholderOptions:H={},lazy:_=!0,priority:L=!1,loading:O=L?"eager":b$,decoding:F=y$,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:k}=$,I=$.class,M=$.style,E=$.id,T=$.data||{},{isDev:D=!1,baseUrl:b=""}=X;if(D&&!X.optimize)return Qj($);let S,P,x=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!L)try{S=await EJ(Y,{strategy:B,...H}),P=IJ(x,S,H)}catch{}let f=K!==void 0&&Q!==void 0,p;if(f)p=Gj($,x,S,X);else p=await Yj($,x,S,X);let m;if(L){let b0=z.includes("webp")?"webp":z[0],S0=KX(Y,q,{...j,q:U},b0),r=typeof w==="object"?zX(w):w||"100vw";m=`<link rel="preload" as="image" imagesrcset="${S0}" imagesizes="${r}" />`}let A0=[];if(!nJ&&B!=="none")A0.push(HX),nJ=!0;if(P)A0.push(P);let K0=_?oJ(x):void 0;return{html:p,preloadLink:m,css:A0.length>0?A0.join(`
10791
+ `):void 0,script:K0}}async function Yj($,X,Z,J){let{src:Y,alt:G,width:Q,height:W,sizes:w,widths:q=h5,formats:K=r7,quality:z=NX,params:U={},lazy:j=!0,priority:B=!1,loading:H=B?"eager":b$,decoding:_=y$,fetchpriority:L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A}=$,R=$.class,N=$.style,k=$.data||{},I=typeof w==="object"?zX(w):w||"100vw",M=[];for(let D of K){let b=KX(Y,q,{...U,q:z},D),S=UX(D);if(j&&!B)M.push(` <source type="${S}" data-srcset="${b}" data-sizes="${I}" />`);else M.push(` <source type="${S}" srcset="${b}" sizes="${I}" />`)}let E=MX({src:o7(Y,{...U,q:z}),alt:G,width:Q,height:W,loading:B?void 0:H,decoding:_,fetchpriority:B?"high":L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A,className:rJ(R,Z),style:TX(N,O,F,Z),lazy:j&&!B,data:k}),T;if(Z){let D=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;T=`<div id="${X}" class="stx-img-placeholder" style="${D}">
10792
10792
  <picture>
10793
10793
  ${M.join(`
10794
10794
  `)}
@@ -10837,7 +10837,7 @@ ${M.join(`
10837
10837
 
10838
10838
  observer.observe(container);
10839
10839
  })();
10840
- `.trim()}async function Wj($,X){let Z=await Jj();if(!Z)return D$({...$,process:!1},X);let J=X.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let G=await Z.generateResponsiveVariants($.src,$,J);if(G)return sJ($,G,X)}else{let G=await Z.processImage($.src,$,J);if(G.processed)return kX($,G,X)}return D$({...$,process:!1},X)}async function kX($,X,Z){let{alt:J,width:Y,height:G,lazy:Q=!0,priority:W=!1,objectFit:w,objectPosition:q,crossorigin:K,referrerpolicy:z}=$,U=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},_=X.variants||[],L=_.find((P)=>P.format==="jpeg")||_.find((P)=>P.format==="webp")||_[0],O=L?.url||$.src,F=_.filter((P)=>P.format===(L?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of _){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 v=V.get(P);if(v&&v.length>0){let x=v.map((m)=>`${m.url} ${m.width}w`).join(", "),i=UX(P);if(Q&&!W)A.push(` <source type="${i}" data-srcset="${x}" />`);else A.push(` <source type="${i}" srcset="${x}" />`)}}let N=[];if(Q&&!W){if(N.push(`data-src="${G1(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${G1(O)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${G1(J)}"`);let k=Y||X.originalWidth,I=G||X.originalHeight;if(k)N.push(`width="${k}"`);if(I)N.push(`height="${I}"`);if(!W)N.push(`loading="${Q?"lazy":"eager"}"`);if(N.push('decoding="async"'),W)N.push('fetchpriority="high"');if(K)N.push(`crossorigin="${K}"`);if(z)N.push(`referrerpolicy="${z}"`);let M=[];if(w)M.push(`object-fit: ${w}`);if(q)M.push(`object-position: ${q}`);if(X.placeholder&&Q)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)N.push(`style="${M.join("; ")}"`);let E=[];if(U)E.push(U);if(X.placeholder)E.push("stx-img-blur");if(E.length>0)N.push(`class="${E.join(" ")}"`);if(Q&&!W)N.push("data-stx-lazy");for(let[P,v]of Object.entries(H))N.push(`data-${P}="${G1(v)}"`);let T;if(X.placeholder||X.dominantColor&&$.useDominantColor){let P=X.placeholder?`background-image: url('${X.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${X.dominantColor};`;T=`<div id="${B}" class="stx-img-placeholder" style="${P}">
10840
+ `.trim()}async function Wj($,X){let Z=await Jj();if(!Z)return D$({...$,process:!1},X);let J=X.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let G=await Z.generateResponsiveVariants($.src,$,J);if(G)return sJ($,G,X)}else{let G=await Z.processImage($.src,$,J);if(G.processed)return kX($,G,X)}return D$({...$,process:!1},X)}async function kX($,X,Z){let{alt:J,width:Y,height:G,lazy:Q=!0,priority:W=!1,objectFit:w,objectPosition:q,crossorigin:K,referrerpolicy:z}=$,U=$.class,j=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},_=X.variants||[],L=_.find((P)=>P.format==="jpeg")||_.find((P)=>P.format==="webp")||_[0],O=L?.url||$.src,F=_.filter((P)=>P.format===(L?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of _){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 f=x.map((m)=>`${m.url} ${m.width}w`).join(", "),p=UX(P);if(Q&&!W)A.push(` <source type="${p}" data-srcset="${f}" />`);else A.push(` <source type="${p}" srcset="${f}" />`)}}let N=[];if(Q&&!W){if(N.push(`data-src="${G1(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${G1(O)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${G1(J)}"`);let k=Y||X.originalWidth,I=G||X.originalHeight;if(k)N.push(`width="${k}"`);if(I)N.push(`height="${I}"`);if(!W)N.push(`loading="${Q?"lazy":"eager"}"`);if(N.push('decoding="async"'),W)N.push('fetchpriority="high"');if(K)N.push(`crossorigin="${K}"`);if(z)N.push(`referrerpolicy="${z}"`);let M=[];if(w)M.push(`object-fit: ${w}`);if(q)M.push(`object-position: ${q}`);if(X.placeholder&&Q)M.push("opacity: 0; transition: opacity 300ms ease-out");if(j)M.push(j);if(M.length>0)N.push(`style="${M.join("; ")}"`);let E=[];if(U)E.push(U);if(X.placeholder)E.push("stx-img-blur");if(E.length>0)N.push(`class="${E.join(" ")}"`);if(Q&&!W)N.push("data-stx-lazy");for(let[P,x]of Object.entries(H))N.push(`data-${P}="${G1(x)}"`);let T;if(X.placeholder||X.dominantColor&&$.useDominantColor){let P=X.placeholder?`background-image: url('${X.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${X.dominantColor};`;T=`<div id="${B}" class="stx-img-placeholder" style="${P}">
10841
10841
  <picture>
10842
10842
  ${A.join(`
10843
10843
  `)}
@@ -10848,11 +10848,11 @@ ${A.join(`
10848
10848
  `)}
10849
10849
  <img ${N.join(" ")} />
10850
10850
  </picture>`;let D=[];if(X.placeholder)D.push(HX);let b=Q?oJ(B):void 0,S;if(W&&F)S=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:T,preloadLink:S,css:D.length>0?D.join(`
10851
- `):void 0,script:b}}async function sJ($,X,Z){let J={src:X.src,processed:!0,variants:[],placeholder:X.placeholder?.dataURL,originalWidth:X.placeholder?.width,originalHeight:X.placeholder?.height};for(let[Y,G]of Object.entries(X.byFormat))if(G)J.variants.push(...G);return kX($,J,Z)}var iJ=!1,NX=80,y$="async",b$="lazy",nJ=!1;var aJ=y(()=>{jX();DJ()});function wj(){return V$({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,X,Z,J)=>{let{src:Y,alt:G,options:Q}=qj($,X,Z);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let W={src:Y,alt:G||"",widths:Q.widths||u5,formats:Q.formats||r7,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},w=Z.__isDev||!1,q=await D$(W,{isDev:w}),K=q.html;if(q.preloadLink)K=q.preloadLink+`
10851
+ `):void 0,script:b}}async function sJ($,X,Z){let J={src:X.src,processed:!0,variants:[],placeholder:X.placeholder?.dataURL,originalWidth:X.placeholder?.width,originalHeight:X.placeholder?.height};for(let[Y,G]of Object.entries(X.byFormat))if(G)J.variants.push(...G);return kX($,J,Z)}var iJ=!1,NX=80,y$="async",b$="lazy",nJ=!1;var aJ=y(()=>{jX();DJ()});function wj(){return V$({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,X,Z,J)=>{let{src:Y,alt:G,options:Q}=qj($,X,Z);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let W={src:Y,alt:G||"",widths:Q.widths||h5,formats:Q.formats||r7,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},w=Z.__isDev||!1,q=await D$(W,{isDev:w}),K=q.html;if(q.preloadLink)K=q.preloadLink+`
10852
10852
  `+K;if(q.css)K+=`
10853
10853
  <style>${q.css}</style>`;if(q.script)K+=`
10854
- <script>${q.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function qj($,X,Z){if(X.src)return{src:String(X.src),alt:String(X.alt||""),options:X.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=Kj(J),G=IX(Y[0],Z)||"",Q=IX(Y[1],Z)||"",W={};if(Y[2]){let w=IX(Y[2],Z);if(typeof w==="object"&&w!==null)W=w;else if(typeof Y[2]==="string")try{W=JSON.parse(Y[2])}catch{}}return{src:G,alt:Q,options:W}}function Kj($){let X=[],Z="",J=!1,Y="",G=0,Q=0;for(let W=0;W<$.length;W++){let w=$[W],q=W>0?$[W-1]:"";if((w==='"'||w==="'"||w==="`")&&q!=="\\"){if(!J)J=!0,Y=w;else if(w===Y)J=!1,Y="";else Z+=w;continue}if(!J){if(w==="{")G++;if(w==="}")G--;if(w==="[")Q++;if(w==="]")Q--;if(w===","&&G===0&&Q===0){X.push(Z.trim()),Z="";continue}}Z+=w}if(Z.trim())X.push(Z.trim());return X}function IX($,X){if(typeof $!=="string")return $;let Z=$.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 J=X[Z];if(J!==void 0)return J}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var tJ;var eJ=y(()=>{qX();aJ();jX();tJ=wj()});class C${config;constructor($={}){this.config={...zj,...$}}async get($,X){return R$($,X,"video",this.config)}async set($,X,Z){return N$($,X,Z,"video",this.config)}async clear(){return M$("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function EX($){if(!S$)S$=new C$($);else if($)S$.updateConfig($);return S$}async function P$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return EX(J).get($,X)}async function v$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return EX(Y).set($,X,Z)}async function $Y(){return EX().clear()}var zj,S$=null;var DX=y(()=>{LX();zj={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as yX,basename as bX,extname as SX,join as x$}from"path";import{mkdir as CX}from"fs/promises";async function PX(){try{return await import("ts-videos")}catch{return null}}async function f$($,X,Z,J){let Y=await PX();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=yX($);if(!await f0(G))return null;await CX(Z,{recursive:!0});let Q=await m0(G),W=bX($,SX($)),w=X.format||"webp",q=X.timestamp||0,K=`${W}-poster-${Q}.${w}`,z=x$(Z,K),U=await Y.extractThumbnails(G,{timestamps:[q],width:X.width||1280,height:X.height,format:w,quality:X.quality||85,outputDir:Z,outputPattern:K.replace(`.${w}`,"")});if(U&&U.length>0){let j=U[0];return{path:z,url:`${J}/${K}`,width:j.width||X.width||1280,height:j.height||720,timestamp:q,size:j.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function g$($,X,Z,J){let Y=await PX();if(!Y)return[];try{let G=yX($);if(!await f0(G))return[];await CX(Z,{recursive:!0});let Q=await m0(G),W=bX($,SX($)),w=X.format||"webp",z=(await new Y.Input(G).getInfo()).duration||60,U=X.count||10,j=X.interval||z/U,B=[];for(let _=0;_<U&&_*j<z;_++)B.push(_*j);let H=await Y.extractThumbnails(G,{timestamps:B,width:X.width||320,format:w,quality:X.quality||80,outputDir:Z,outputPattern:`${W}-thumb-${Q}`});if(H&&H.length>0)return H.map((_,L)=>({path:_.path||x$(Z,`${W}-thumb-${Q}-${L}.${w}`),url:`${J}/${W}-thumb-${Q}-${L}.${w}`,width:_.width||X.width||320,height:_.height||180,timestamp:B[L],size:_.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function XY($,X,Z,J){let Y=await PX();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=yX($);if(!await f0(G))return null;await CX(Z,{recursive:!0});let Q=await m0(G),W=bX($,SX($)),K=(await new Y.Input(G).getInfo()).duration||60,z=X.columns||10,U=X.interval||5,j=X.thumbnailWidth||160,B=X.thumbnailHeight||90,H=X.format||"jpeg",_=Math.ceil(K/U),L=Math.ceil(_/z),O=`${W}-sprite-${Q}.${H}`,F=x$(Z,O),V=[];for(let R=0;R<_;R++)V.push(R*U);let A=await Y.extractThumbnails(G,{timestamps:V,width:j,height:B,format:H,quality:X.quality||70,outputDir:x$(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=z*j,k=L*B,I=await R.createSprite({images:A.map((M)=>M.path),columns:z,padding:0,outputPath:F,format:H,quality:X.quality||70});return{url:`${J}/${O}`,path:F,columns:z,rows:L,thumbnailWidth:j,thumbnailHeight:B,interval:U,totalFrames:_}}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 vX=y(()=>{K5()});import{resolve as JY,basename as YY,extname as GY,join as z5}from"path";import{mkdir as h$,writeFile as QY}from"fs/promises";async function WY(){try{return await import("ts-videos")}catch{return null}}async function u$($,X,Z,J,Y){let G=await WY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=JY($);if(!await f0(Q))return null;let W=await m0(Q),w=YY($,GY($)),q=z5(Z,`${w}-${W}-hls`);await h$(q,{recursive:!0});let K=X.length>0?X:wY,z=Y?.segmentDuration||6,B=(await new G.Input(Q).getInfo()).duration||0,H=[],_=0;for(let F of K){let V=z5(q,F.label);await h$(V,{recursive:!0});let A=`${F.label}.m3u8`,R=z5(V,A);try{let N=await G.generateHLS(Q,{outputDir:V,segmentDuration:z,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(N)H.push({quality:F,url:`${J}/${w}-${W}-hls/${F.label}/${A}`,path:R}),_+=N.segmentCount||Math.ceil(B/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${N}`)}}if(H.length===0)return null;let L=z5(q,"master.m3u8"),O=Uj(H,J,w,W);return await QY(L,O),{manifestUrl:`${J}/${w}-${W}-hls/master.m3u8`,manifestPath:L,playlists:H,segmentCount:_,duration:B}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function Uj($,X,Z,J){let Y=["#EXTM3U","#EXT-X-VERSION:3"];for(let G of $){let{quality:Q}=G,W=Q.bitrate+(Q.audioBitrate||128000),w=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;Y.push(`#EXT-X-STREAM-INF:BANDWIDTH=${W},RESOLUTION=${w},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return Y.join(`
10855
- `)}async function d$($,X,Z,J,Y){let G=await WY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=JY($);if(!await f0(Q))return null;let W=await m0(Q),w=YY($,GY($)),q=z5(Z,`${w}-${W}-dash`);await h$(q,{recursive:!0});let K=X.length>0?X:wY,z=Y?.segmentDuration||4,U=Y?.minBufferTime||2,H=(await new G.Input(Q).getInfo()).duration||0,_=[],L=[];for(let A of K){let R=z5(q,A.label);await h$(R,{recursive:!0});try{if(await G.generateDASH(Q,{outputDir:R,segmentDuration:z,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(_.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${w}-${W}-dash/${A.label}/video`}),A.audioBitrate)L.push({bandwidth:A.audioBitrate,url:`${J}/${w}-${W}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(_.length===0)return null;let O=z5(q,"manifest.mpd"),F=jj(_,L,H,z,U);await QY(O,F);let V=[{type:"video",representations:_}];if(L.length>0)V.push({type:"audio",representations:L});return{manifestUrl:`${J}/${w}-${W}-dash/manifest.mpd`,manifestPath:O,adaptationSets:V,duration:H}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function jj($,X,Z,J,Y){let G=ZY(Z),Q=ZY(Y),W=`<?xml version="1.0" encoding="UTF-8"?>
10854
+ <script>${q.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function qj($,X,Z){if(X.src)return{src:String(X.src),alt:String(X.alt||""),options:X.options||{}};let J=$.trim();if(J.startsWith("@img(")||J.startsWith("("))J=J.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=Kj(J),G=IX(Y[0],Z)||"",Q=IX(Y[1],Z)||"",W={};if(Y[2]){let w=IX(Y[2],Z);if(typeof w==="object"&&w!==null)W=w;else if(typeof Y[2]==="string")try{W=JSON.parse(Y[2])}catch{}}return{src:G,alt:Q,options:W}}function Kj($){let X=[],Z="",J=!1,Y="",G=0,Q=0;for(let W=0;W<$.length;W++){let w=$[W],q=W>0?$[W-1]:"";if((w==='"'||w==="'"||w==="`")&&q!=="\\"){if(!J)J=!0,Y=w;else if(w===Y)J=!1,Y="";else Z+=w;continue}if(!J){if(w==="{")G++;if(w==="}")G--;if(w==="[")Q++;if(w==="]")Q--;if(w===","&&G===0&&Q===0){X.push(Z.trim()),Z="";continue}}Z+=w}if(Z.trim())X.push(Z.trim());return X}function IX($,X){if(typeof $!=="string")return $;let Z=$.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 J=X[Z];if(J!==void 0)return J}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var tJ;var eJ=y(()=>{qX();aJ();jX();tJ=wj()});class C${config;constructor($={}){this.config={...zj,...$}}async get($,X){return R$($,X,"video",this.config)}async set($,X,Z){return N$($,X,Z,"video",this.config)}async clear(){return M$("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function EX($){if(!S$)S$=new C$($);else if($)S$.updateConfig($);return S$}async function P$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return EX(J).get($,X)}async function v$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return EX(Y).set($,X,Z)}async function $Y(){return EX().clear()}var zj,S$=null;var DX=y(()=>{LX();zj={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as yX,basename as bX,extname as SX,join as x$}from"path";import{mkdir as CX}from"fs/promises";async function PX(){try{return await import("ts-videos")}catch{return null}}async function f$($,X,Z,J){let Y=await PX();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=yX($);if(!await x0(G))return null;await CX(Z,{recursive:!0});let Q=await d0(G),W=bX($,SX($)),w=X.format||"webp",q=X.timestamp||0,K=`${W}-poster-${Q}.${w}`,z=x$(Z,K),U=await Y.extractThumbnails(G,{timestamps:[q],width:X.width||1280,height:X.height,format:w,quality:X.quality||85,outputDir:Z,outputPattern:K.replace(`.${w}`,"")});if(U&&U.length>0){let j=U[0];return{path:z,url:`${J}/${K}`,width:j.width||X.width||1280,height:j.height||720,timestamp:q,size:j.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function g$($,X,Z,J){let Y=await PX();if(!Y)return[];try{let G=yX($);if(!await x0(G))return[];await CX(Z,{recursive:!0});let Q=await d0(G),W=bX($,SX($)),w=X.format||"webp",z=(await new Y.Input(G).getInfo()).duration||60,U=X.count||10,j=X.interval||z/U,B=[];for(let _=0;_<U&&_*j<z;_++)B.push(_*j);let H=await Y.extractThumbnails(G,{timestamps:B,width:X.width||320,format:w,quality:X.quality||80,outputDir:Z,outputPattern:`${W}-thumb-${Q}`});if(H&&H.length>0)return H.map((_,L)=>({path:_.path||x$(Z,`${W}-thumb-${Q}-${L}.${w}`),url:`${J}/${W}-thumb-${Q}-${L}.${w}`,width:_.width||X.width||320,height:_.height||180,timestamp:B[L],size:_.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function XY($,X,Z,J){let Y=await PX();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=yX($);if(!await x0(G))return null;await CX(Z,{recursive:!0});let Q=await d0(G),W=bX($,SX($)),K=(await new Y.Input(G).getInfo()).duration||60,z=X.columns||10,U=X.interval||5,j=X.thumbnailWidth||160,B=X.thumbnailHeight||90,H=X.format||"jpeg",_=Math.ceil(K/U),L=Math.ceil(_/z),O=`${W}-sprite-${Q}.${H}`,F=x$(Z,O),V=[];for(let R=0;R<_;R++)V.push(R*U);let A=await Y.extractThumbnails(G,{timestamps:V,width:j,height:B,format:H,quality:X.quality||70,outputDir:x$(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=z*j,k=L*B,I=await R.createSprite({images:A.map((M)=>M.path),columns:z,padding:0,outputPath:F,format:H,quality:X.quality||70});return{url:`${J}/${O}`,path:F,columns:z,rows:L,thumbnailWidth:j,thumbnailHeight:B,interval:U,totalFrames:_}}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 vX=y(()=>{q5()});import{resolve as JY,basename as YY,extname as GY,join as K5}from"path";import{mkdir as h$,writeFile as QY}from"fs/promises";async function WY(){try{return await import("ts-videos")}catch{return null}}async function u$($,X,Z,J,Y){let G=await WY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=JY($);if(!await x0(Q))return null;let W=await d0(Q),w=YY($,GY($)),q=K5(Z,`${w}-${W}-hls`);await h$(q,{recursive:!0});let K=X.length>0?X:wY,z=Y?.segmentDuration||6,B=(await new G.Input(Q).getInfo()).duration||0,H=[],_=0;for(let F of K){let V=K5(q,F.label);await h$(V,{recursive:!0});let A=`${F.label}.m3u8`,R=K5(V,A);try{let N=await G.generateHLS(Q,{outputDir:V,segmentDuration:z,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(N)H.push({quality:F,url:`${J}/${w}-${W}-hls/${F.label}/${A}`,path:R}),_+=N.segmentCount||Math.ceil(B/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${N}`)}}if(H.length===0)return null;let L=K5(q,"master.m3u8"),O=Uj(H,J,w,W);return await QY(L,O),{manifestUrl:`${J}/${w}-${W}-hls/master.m3u8`,manifestPath:L,playlists:H,segmentCount:_,duration:B}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function Uj($,X,Z,J){let Y=["#EXTM3U","#EXT-X-VERSION:3"];for(let G of $){let{quality:Q}=G,W=Q.bitrate+(Q.audioBitrate||128000),w=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;Y.push(`#EXT-X-STREAM-INF:BANDWIDTH=${W},RESOLUTION=${w},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return Y.join(`
10855
+ `)}async function d$($,X,Z,J,Y){let G=await WY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=JY($);if(!await x0(Q))return null;let W=await d0(Q),w=YY($,GY($)),q=K5(Z,`${w}-${W}-dash`);await h$(q,{recursive:!0});let K=X.length>0?X:wY,z=Y?.segmentDuration||4,U=Y?.minBufferTime||2,H=(await new G.Input(Q).getInfo()).duration||0,_=[],L=[];for(let A of K){let R=K5(q,A.label);await h$(R,{recursive:!0});try{if(await G.generateDASH(Q,{outputDir:R,segmentDuration:z,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(_.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${w}-${W}-dash/${A.label}/video`}),A.audioBitrate)L.push({bandwidth:A.audioBitrate,url:`${J}/${w}-${W}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(_.length===0)return null;let O=K5(q,"manifest.mpd"),F=jj(_,L,H,z,U);await QY(O,F);let V=[{type:"video",representations:_}];if(L.length>0)V.push({type:"audio",representations:L});return{manifestUrl:`${J}/${w}-${W}-dash/manifest.mpd`,manifestPath:O,adaptationSets:V,duration:H}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function jj($,X,Z,J,Y){let G=ZY(Z),Q=ZY(Y),W=`<?xml version="1.0" encoding="UTF-8"?>
10856
10856
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
10857
10857
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10858
10858
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -10878,7 +10878,7 @@ ${A.join(`
10878
10878
  </Representation>
10879
10879
  `}W+=` </AdaptationSet>
10880
10880
  `}return W+=` </Period>
10881
- </MPD>`,W}function ZY($){let X=Math.floor($/3600),Z=Math.floor($%3600/60),J=Math.floor($%60),Y="PT";if(X>0)Y+=`${X}H`;if(Z>0)Y+=`${Z}M`;return Y+=`${J}S`,Y}var wY;var xX=y(()=>{K5();wY=[{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 qY,basename as Bj,extname as Hj,join as _j}from"path";import{mkdir as Oj}from"fs/promises";async function KY(){try{return await import("ts-videos")}catch{return null}}function Lj($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function Fj($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function fX($){let X=await KY();if(!X)return null;try{let Z=qY($),Y=await new X.Input(Z).getInfo();return{duration:Y.duration||0,width:Y.width||0,height:Y.height||0,frameRate:Y.frameRate||0,bitrate:Y.bitrate||0,codec:Y.videoCodec||"",audioCodec:Y.audioCodec}}catch(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function zY($,X,Z,J){let Y=await KY();if(!Y)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let G=await P$($,X,Z);if(G)return G;try{let Q=qY($);if(!await f0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let W=Z.outputDir||"dist/videos",w=Z.baseUrl||"/videos";await Oj(W,{recursive:!0});let q=await m0(Q),K=Bj($,Hj($)),z={src:$,processed:!0,hash:q};J?.({percentage:5,stage:"analyzing"}),z.metadata=await fX(Q)||void 0;let U={};if(X.quality)U.bitrate=Lj(X.quality);if(X.platform)Object.assign(U,Fj(X.platform));if(X.transcode)Object.assign(U,X.transcode);if(Object.keys(U).length>0||X.process){J?.({percentage:10,stage:"transcoding"});let j=`${K}-${q}.mp4`,B=_j(W,j);try{let H=await Vj(Q,B,U,Y,(_)=>J?.({percentage:10+_*0.5,stage:"transcoding"}));if(H)z.transcoded={path:B,url:`${w}/${j}`,duration:H.duration,size:H.size,video:{codec:U.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:U.audioCodec||"aac",bitrate:U.audioBitrate||128000,sampleRate:U.sampleRate||48000,channels:U.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(X.generatePoster){J?.({percentage:65,stage:"generating-poster"});let j=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},B=await f$(Q,j,W,w);if(B)z.poster=B}if(Z.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let j=await g$(Q,Z.thumbnails,W,w);if(j.length>0)z.thumbnails=j}if(X.streaming){J?.({percentage:80,stage:"generating-manifests"});let j=typeof X.streaming==="object"?X.streaming:Z.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let B=await u$(Q,j.qualities||Z.streaming?.defaultQualities||[],W,w);if(B)z.streaming={...z.streaming,hls:B}}if(j.format==="dash"){let B=await d$(Q,j.qualities||Z.streaming?.defaultQualities||[],W,w);if(B)z.streaming={...z.streaming,dash:B}}}if(X.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await v$($,X,z,Z),z}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function Vj($,X,Z,J,Y){try{let Q=await new J.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)=>{Y?.(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 UY=y(()=>{K5();DX();vX();xX()});var jY={};e(jY,{setCachedVideoResult:()=>v$,processVideo:()=>zY,getCachedVideoResult:()=>P$,generateThumbnails:()=>g$,generateSpriteSheet:()=>XY,generatePoster:()=>f$,generateHLSManifest:()=>u$,generateDASHManifest:()=>d$,clearVideoCache:()=>$Y,analyzeVideo:()=>fX,VideoProcessorCache:()=>C$});var BY=y(()=>{UY();vX();xX();DX()});async function _Y(){try{return await Promise.resolve().then(() => (BY(),jY))}catch($){if(!HY)console.warn("[stx-media] Video processor not available, some features disabled:",$),HY=!0;return null}}async function m$($,X={}){let Z=X,J=$;if(J.process&&!J.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return kj(J,Z)}if(Z.processedResult?.processed)return VY($,Z.processedResult,X);let Y;if(J.generatePoster&&J.src&&!$.poster)Y=await Ij(J,Z);let{src:G,sources:Q=[],poster:W,posterPlaceholder:w,controls:q=OY,autoplay:K=!1,muted:z=!1,loop:U=!1,preload:j=LY,playsinline:B=!0,lazy:H=!0,player:_="native",type:L,width:O,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=$,N=Y||W,k=$.class,I=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(_==="ts-video")return Nj($,X);if(L&&L!=="video")return Rj(G||"",L,$);let E=Q.length>0?Q:G?[{src:G,type:FY(G)}]:[],T=[`id="${M}"`];if(q)T.push("controls");if(K)T.push("autoplay");if(z)T.push("muted");if(U)T.push("loop");if(B)T.push("playsinline");if(A)T.push("disablepictureinpicture");if(R)T.push("disableremoteplayback");if(V)T.push(`crossorigin="${V}"`);if(H){if(T.push(`data-preload="${j}"`),T.push('preload="none"'),N)T.push(`data-poster="${S0(N)}"`);T.push("data-stx-lazy")}else if(T.push(`preload="${j}"`),N)T.push(`poster="${S0(N)}"`);if(O)T.push(`width="${O}"`);if(F)T.push(`height="${F}"`);if(k)T.push(`class="${S0(k)}"`);if(I)T.push(`style="${S0(I)}"`);let D=E.map((P)=>{return` <source ${H?`data-src="${S0(P.src)}"`:`src="${S0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
10881
+ </MPD>`,W}function ZY($){let X=Math.floor($/3600),Z=Math.floor($%3600/60),J=Math.floor($%60),Y="PT";if(X>0)Y+=`${X}H`;if(Z>0)Y+=`${Z}M`;return Y+=`${J}S`,Y}var wY;var xX=y(()=>{q5();wY=[{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 qY,basename as Bj,extname as Hj,join as _j}from"path";import{mkdir as Oj}from"fs/promises";async function KY(){try{return await import("ts-videos")}catch{return null}}function Lj($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function Fj($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function fX($){let X=await KY();if(!X)return null;try{let Z=qY($),Y=await new X.Input(Z).getInfo();return{duration:Y.duration||0,width:Y.width||0,height:Y.height||0,frameRate:Y.frameRate||0,bitrate:Y.bitrate||0,codec:Y.videoCodec||"",audioCodec:Y.audioCodec}}catch(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function zY($,X,Z,J){let Y=await KY();if(!Y)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let G=await P$($,X,Z);if(G)return G;try{let Q=qY($);if(!await x0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let W=Z.outputDir||"dist/videos",w=Z.baseUrl||"/videos";await Oj(W,{recursive:!0});let q=await d0(Q),K=Bj($,Hj($)),z={src:$,processed:!0,hash:q};J?.({percentage:5,stage:"analyzing"}),z.metadata=await fX(Q)||void 0;let U={};if(X.quality)U.bitrate=Lj(X.quality);if(X.platform)Object.assign(U,Fj(X.platform));if(X.transcode)Object.assign(U,X.transcode);if(Object.keys(U).length>0||X.process){J?.({percentage:10,stage:"transcoding"});let j=`${K}-${q}.mp4`,B=_j(W,j);try{let H=await Vj(Q,B,U,Y,(_)=>J?.({percentage:10+_*0.5,stage:"transcoding"}));if(H)z.transcoded={path:B,url:`${w}/${j}`,duration:H.duration,size:H.size,video:{codec:U.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:U.audioCodec||"aac",bitrate:U.audioBitrate||128000,sampleRate:U.sampleRate||48000,channels:U.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(X.generatePoster){J?.({percentage:65,stage:"generating-poster"});let j=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},B=await f$(Q,j,W,w);if(B)z.poster=B}if(Z.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let j=await g$(Q,Z.thumbnails,W,w);if(j.length>0)z.thumbnails=j}if(X.streaming){J?.({percentage:80,stage:"generating-manifests"});let j=typeof X.streaming==="object"?X.streaming:Z.streaming||{format:"hls"};if(j.format==="hls"||j.format===void 0){let B=await u$(Q,j.qualities||Z.streaming?.defaultQualities||[],W,w);if(B)z.streaming={...z.streaming,hls:B}}if(j.format==="dash"){let B=await d$(Q,j.qualities||Z.streaming?.defaultQualities||[],W,w);if(B)z.streaming={...z.streaming,dash:B}}}if(X.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await v$($,X,z,Z),z}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function Vj($,X,Z,J,Y){try{let Q=await new J.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)=>{Y?.(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 UY=y(()=>{q5();DX();vX();xX()});var jY={};t(jY,{setCachedVideoResult:()=>v$,processVideo:()=>zY,getCachedVideoResult:()=>P$,generateThumbnails:()=>g$,generateSpriteSheet:()=>XY,generatePoster:()=>f$,generateHLSManifest:()=>u$,generateDASHManifest:()=>d$,clearVideoCache:()=>$Y,analyzeVideo:()=>fX,VideoProcessorCache:()=>C$});var BY=y(()=>{UY();vX();xX();DX()});async function _Y(){try{return await Promise.resolve().then(() => (BY(),jY))}catch($){if(!HY)console.warn("[stx-media] Video processor not available, some features disabled:",$),HY=!0;return null}}async function m$($,X={}){let Z=X,J=$;if(J.process&&!J.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return kj(J,Z)}if(Z.processedResult?.processed)return VY($,Z.processedResult,X);let Y;if(J.generatePoster&&J.src&&!$.poster)Y=await Ij(J,Z);let{src:G,sources:Q=[],poster:W,posterPlaceholder:w,controls:q=OY,autoplay:K=!1,muted:z=!1,loop:U=!1,preload:j=LY,playsinline:B=!0,lazy:H=!0,player:_="native",type:L,width:O,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=$,N=Y||W,k=$.class,I=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(_==="ts-video")return Nj($,X);if(L&&L!=="video")return Rj(G||"",L,$);let E=Q.length>0?Q:G?[{src:G,type:FY(G)}]:[],T=[`id="${M}"`];if(q)T.push("controls");if(K)T.push("autoplay");if(z)T.push("muted");if(U)T.push("loop");if(B)T.push("playsinline");if(A)T.push("disablepictureinpicture");if(R)T.push("disableremoteplayback");if(V)T.push(`crossorigin="${V}"`);if(H){if(T.push(`data-preload="${j}"`),T.push('preload="none"'),N)T.push(`data-poster="${y0(N)}"`);T.push("data-stx-lazy")}else if(T.push(`preload="${j}"`),N)T.push(`poster="${y0(N)}"`);if(O)T.push(`width="${O}"`);if(F)T.push(`height="${F}"`);if(k)T.push(`class="${y0(k)}"`);if(I)T.push(`style="${y0(I)}"`);let D=E.map((P)=>{return` <source ${H?`data-src="${y0(P.src)}"`:`src="${y0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
10882
10882
  `),b=`<video ${T.join(" ")}>
10883
10883
  ${D}
10884
10884
  Your browser does not support the video tag.
@@ -10917,12 +10917,12 @@ ${D}
10917
10917
 
10918
10918
  observer.observe(video);
10919
10919
  })();
10920
- `.trim();return{html:b,script:S}}function Rj($,X,Z){let{width:J=640,height:Y=360}=Z,G=Z.class,Q=Z.style,W=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,w,q=null;switch(X){case"youtube":q=Mj($),w=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=Tj($),w=q?`https://player.vimeo.com/video/${q}`:$;break;case"dailymotion":q=$.split("/").pop()||"",w=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=$.split("/").pop()||"",w=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:w=$}let K=[`id="${W}"`,`src="${S0(w)}"`,`width="${J}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)K.push(`class="${S0(G)}"`);if(Q)K.push(`style="${S0(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;">
10920
+ `.trim();return{html:b,script:S}}function Rj($,X,Z){let{width:J=640,height:Y=360}=Z,G=Z.class,Q=Z.style,W=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,w,q=null;switch(X){case"youtube":q=Mj($),w=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=Tj($),w=q?`https://player.vimeo.com/video/${q}`:$;break;case"dailymotion":q=$.split("/").pop()||"",w=`https://www.dailymotion.com/embed/video/${q}`;break;case"twitch":q=$.split("/").pop()||"",w=`https://player.twitch.tv/?video=${q}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:w=$}let K=[`id="${W}"`,`src="${y0(w)}"`,`width="${J}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)K.push(`class="${y0(G)}"`);if(Q)K.push(`style="${y0(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;">
10921
10921
  <iframe ${K.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
10922
10922
  </div>`}}function Nj($,X={}){let{src:Z,sources:J=[],poster:Y,controls:G=!0,autoplay:Q=!1,muted:W=!1,loop:w=!1,preload:q="metadata",playsinline:K=!0,lazy:z=!0,width:U,height:j}=$,B=$.class,H=$.style,_=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:J.length>0?J:Z,autoplay:Q,loop:w,muted:W,playsinline:K,preload:q,poster:Y,controls:G,title:$.title},O=["position: relative",U?`width: ${typeof U==="number"?U+"px":U}`:"width: 100%",j?`height: ${typeof j==="number"?j+"px":j}`:"",H||""].filter(Boolean).join("; "),F=`
10923
10923
  <div
10924
10924
  id="${_}"
10925
- class="ts-video-player${B?" "+S0(B):""}"
10925
+ class="ts-video-player${B?" "+y0(B):""}"
10926
10926
  style="${O}"
10927
10927
  data-ts-video-player
10928
10928
  data-config='${JSON.stringify(L)}'
@@ -10930,7 +10930,7 @@ ${D}
10930
10930
  >
10931
10931
  <div class="ts-video-player__container">
10932
10932
  ${Y?`
10933
- <div class="ts-video-player__placeholder" style="background-image: url('${S0(Y)}');">
10933
+ <div class="ts-video-player__placeholder" style="background-image: url('${y0(Y)}');">
10934
10934
  <button class="ts-video-player__play-button" aria-label="Play video">
10935
10935
  <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
10936
10936
  <path d="M8 5v14l11-7z"/>
@@ -11086,10 +11086,10 @@ else {
11086
11086
  .ts-video-player__play-button svg {
11087
11087
  margin-left: 4px;
11088
11088
  }
11089
- `.trim();return{html:F,script:V,css:A}}function FY($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function Mj($){let X=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of X){let J=$.match(Z);if(J)return J[1]}return null}function Tj($){let X=$.match(/vimeo\.com\/(\d+)/);return X?X[1]:null}function S0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function kj($,X){let Z=await _Y();if(!Z)return m$({...$,process:!1},X);let J=X.tsVideosConfig,Y=await Z.processVideo($.src,$,J,$.onProcessProgress);if(Y.processed)return VY($,Y,X);return m$({...$,process:!1},X)}async function Ij($,X){let Z=await _Y();if(!Z||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Y=X.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster($.src,J,Y.outputDir,Y.baseUrl||"/videos"))?.url}function VY($,X,Z){let{controls:J=OY,autoplay:Y=!1,muted:G=!1,loop:Q=!1,preload:W=LY,playsinline:w=!0,lazy:q=!0,width:K,height:z,crossorigin:U,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,H=$.class,_=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,F=FY(O);if(X.transcoded)O=X.transcoded.url,F="video/mp4";let V=X.streaming?.hls||X.streaming?.dash;if(V){if(X.streaming?.hls)O=X.streaming.hls.manifestUrl,F="application/x-mpegURL";else if(X.streaming?.dash)O=X.streaming.dash.manifestUrl,F="application/dash+xml"}let A=X.poster?.url||$.poster,R=[`id="${L}"`];if(J)R.push("controls");if(Y)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(w)R.push("playsinline");if(j)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(U)R.push(`crossorigin="${U}"`);if(q){if(R.push(`data-preload="${W}"`),R.push('preload="none"'),A)R.push(`data-poster="${S0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${W}"`),A)R.push(`poster="${S0(A)}"`);let N=K||X.metadata?.width,k=z||X.metadata?.height;if(N)R.push(`width="${N}"`);if(k)R.push(`height="${k}"`);if(H)R.push(`class="${S0(H)}"`);if(_)R.push(`style="${S0(_)}"`);let M=` <source ${q?`data-src="${S0(O)}"`:`src="${S0(O)}"`} type="${F}" />`,E=`<video ${R.join(" ")}>
11089
+ `.trim();return{html:F,script:V,css:A}}function FY($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function Mj($){let X=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of X){let J=$.match(Z);if(J)return J[1]}return null}function Tj($){let X=$.match(/vimeo\.com\/(\d+)/);return X?X[1]:null}function y0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function kj($,X){let Z=await _Y();if(!Z)return m$({...$,process:!1},X);let J=X.tsVideosConfig,Y=await Z.processVideo($.src,$,J,$.onProcessProgress);if(Y.processed)return VY($,Y,X);return m$({...$,process:!1},X)}async function Ij($,X){let Z=await _Y();if(!Z||!$.src)return;let J=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Y=X.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster($.src,J,Y.outputDir,Y.baseUrl||"/videos"))?.url}function VY($,X,Z){let{controls:J=OY,autoplay:Y=!1,muted:G=!1,loop:Q=!1,preload:W=LY,playsinline:w=!0,lazy:q=!0,width:K,height:z,crossorigin:U,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,H=$.class,_=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,F=FY(O);if(X.transcoded)O=X.transcoded.url,F="video/mp4";let V=X.streaming?.hls||X.streaming?.dash;if(V){if(X.streaming?.hls)O=X.streaming.hls.manifestUrl,F="application/x-mpegURL";else if(X.streaming?.dash)O=X.streaming.dash.manifestUrl,F="application/dash+xml"}let A=X.poster?.url||$.poster,R=[`id="${L}"`];if(J)R.push("controls");if(Y)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(w)R.push("playsinline");if(j)R.push("disablepictureinpicture");if(B)R.push("disableremoteplayback");if(U)R.push(`crossorigin="${U}"`);if(q){if(R.push(`data-preload="${W}"`),R.push('preload="none"'),A)R.push(`data-poster="${y0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${W}"`),A)R.push(`poster="${y0(A)}"`);let N=K||X.metadata?.width,k=z||X.metadata?.height;if(N)R.push(`width="${N}"`);if(k)R.push(`height="${k}"`);if(H)R.push(`class="${y0(H)}"`);if(_)R.push(`style="${y0(_)}"`);let M=` <source ${q?`data-src="${y0(O)}"`:`src="${y0(O)}"`} type="${F}" />`,E=`<video ${R.join(" ")}>
11090
11090
  ${M}
11091
11091
  Your browser does not support the video tag.
11092
- </video>`;if(X.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${S0(X.spriteSheet.url)}" data-sprite-cols="${X.spriteSheet.columns}" data-sprite-interval="${X.spriteSheet.interval}">
11092
+ </video>`;if(X.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${y0(X.spriteSheet.url)}" data-sprite-cols="${X.spriteSheet.columns}" data-sprite-interval="${X.spriteSheet.interval}">
11093
11093
  ${E}
11094
11094
  </div>`;let T;if(q)T=`
11095
11095
  (function() {
@@ -11436,7 +11436,7 @@ catch (error) {
11436
11436
  init();
11437
11437
  }
11438
11438
  })();
11439
- </script>`}var Pj,vj,xj,fj,MY;var TY=y(()=>{Pj={name:"pwa.installButton",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return yj($,Y)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},vj={name:"pwa.updatePrompt",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return bj($,Y)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},xj={name:"pwa.offlineIndicator",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Sj($,Y)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},fj={name:"pwa.pushSubscribe",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Cj($,Y)},hasEndTag:!0,description:"Renders a push notification subscription button"},MY=[Pj,vj,xj,fj]});function uX($){for(let[X,Z]of Object.entries(s))if(Z===$)return X;return}var s;var c$=y(()=>{s={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function s7(){return!1}function a7(){return!s7()||process.env.STX_DEBUG==="true"}function l$(){return!1}import gj from"path";function p$(){return{...dX}}function i$($){if(!dX.showRelativePaths||!$)return $;let X=dX.baseDir||process.cwd();try{let Z=gj.relative(X,$);return Z.startsWith("..")?$:Z}catch{return $}}var hj,dX,n$,U5,r$;var o$=y(()=>{c$();hj={showRelativePaths:!1,enableAutoRecovery:a7(),logRecoveryWarnings:!0},dX={...hj};n$=class n$ extends Error{code;filePath;line;column;context;numericCode;constructor($,X,Z,J,Y,G,Q){super($);this.code=X;this.filePath=Z;this.line=J;this.column=Y;this.context=G;if(this.name="StxError",this.numericCode=Q||s.EVALUATION_ERROR,this.filePath)this.filePath=i$(this.filePath)}};U5=class U5 extends n${constructor($,X,Z,J,Y,G){super($,"stx_RUNTIME_ERROR",X,Z,J,Y,G||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};r$=class r$ extends n${isFatal=!0;constructor($,X,Z,J,Y,G){super($,"stx_VALIDATION_ERROR",X,Z,J,Y,G||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function IY($){let{type:X,message:Z,code:J,filePath:Y,line:G,column:Q,template:W,offset:w,snippet:q,suggestion:K,format:z="text"}=$,U=G,j=Q;if(!U&&W&&w!==void 0){let O=pj(W,w);U=O.line,j=O.column}let B=Y?i$(Y):void 0,H=J?uX(J):void 0,_={type:X,code:J,codeName:H,message:Z,filePath:B,line:U,column:j,snippet:q,suggestion:K,timestamp:new Date().toISOString()},L;switch(z){case"html":L=dj(_);break;case"json":L=JSON.stringify(_,null,2);break;case"console":L=mj(_,W,w);break;case"text":default:L=uj(_,W,w);break}return{formatted:L,data:_}}function uj($,X,Z){let J=[],Y=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${Y}]`),$.filePath){let G=$.filePath;if($.line){if(G+=`:${$.line}`,$.column)G+=`:${$.column}`}J.push(`at ${G}`)}if(J.push(`
11439
+ </script>`}var Pj,vj,xj,fj,MY;var TY=y(()=>{Pj={name:"pwa.installButton",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return yj($,Y)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},vj={name:"pwa.updatePrompt",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return bj($,Y)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},xj={name:"pwa.offlineIndicator",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Sj($,Y)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},fj={name:"pwa.pushSubscribe",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Cj($,Y)},hasEndTag:!0,description:"Renders a push notification subscription button"},MY=[Pj,vj,xj,fj]});function uX($){for(let[X,Z]of Object.entries(s))if(Z===$)return X;return}var s;var c$=y(()=>{s={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function s7(){return!1}function a7(){return!s7()||process.env.STX_DEBUG==="true"}function l$(){return!1}import gj from"path";function p$(){return{...dX}}function i$($){if(!dX.showRelativePaths||!$)return $;let X=dX.baseDir||process.cwd();try{let Z=gj.relative(X,$);return Z.startsWith("..")?$:Z}catch{return $}}var hj,dX,n$,z5,r$;var o$=y(()=>{c$();hj={showRelativePaths:!1,enableAutoRecovery:a7(),logRecoveryWarnings:!0},dX={...hj};n$=class n$ extends Error{code;filePath;line;column;context;numericCode;constructor($,X,Z,J,Y,G,Q){super($);this.code=X;this.filePath=Z;this.line=J;this.column=Y;this.context=G;if(this.name="StxError",this.numericCode=Q||s.EVALUATION_ERROR,this.filePath)this.filePath=i$(this.filePath)}};z5=class z5 extends n${constructor($,X,Z,J,Y,G){super($,"stx_RUNTIME_ERROR",X,Z,J,Y,G||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};r$=class r$ extends n${isFatal=!0;constructor($,X,Z,J,Y,G){super($,"stx_VALIDATION_ERROR",X,Z,J,Y,G||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function IY($){let{type:X,message:Z,code:J,filePath:Y,line:G,column:Q,template:W,offset:w,snippet:q,suggestion:K,format:z="text"}=$,U=G,j=Q;if(!U&&W&&w!==void 0){let O=pj(W,w);U=O.line,j=O.column}let B=Y?i$(Y):void 0,H=J?uX(J):void 0,_={type:X,code:J,codeName:H,message:Z,filePath:B,line:U,column:j,snippet:q,suggestion:K,timestamp:new Date().toISOString()},L;switch(z){case"html":L=dj(_);break;case"json":L=JSON.stringify(_,null,2);break;case"console":L=mj(_,W,w);break;case"text":default:L=uj(_,W,w);break}return{formatted:L,data:_}}function uj($,X,Z){let J=[],Y=$.code?` [${$.codeName||$.code}]`:"";if(J.push(`[${$.type} Error${Y}]`),$.filePath){let G=$.filePath;if($.line){if(G+=`:${$.line}`,$.column)G+=`:${$.column}`}J.push(`at ${G}`)}if(J.push(`
11440
11440
  ${$.message}`),X&&$.line){let G=cj(X,$.line,2);if(G)J.push(`
11441
11441
  ${G}`)}if($.snippet)J.push(`
11442
11442
  Snippet: ${$.snippet}`);if($.suggestion)J.push(`
@@ -11454,7 +11454,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
11454
11454
  `)}function lj($,X,Z){let J=$.split(`
11455
11455
  `),Y=Math.max(0,X-Z-1),G=Math.min(J.length-1,X+Z-1),Q="\x1B[90m",W="\x1B[31m",w="\x1B[0m",q=[];for(let K=Y;K<=G;K++){let z=(K+1).toString().padStart(4),U=K===X-1,j=U?"\x1B[31m>\x1B[0m":" ",B=U?`\x1B[31m${J[K]}\x1B[0m`:`\x1B[90m${J[K]}\x1B[0m`;q.push(`${j}\x1B[90m${z}\x1B[0m | ${B}`)}return q.join(`
11456
11456
  `)}function kY($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function pj($,X){let J=$.substring(0,X).split(`
11457
- `);return{line:J.length,column:J[J.length-1].length}}function J0($,X,Z){return IY({type:$,message:X,code:Z,format:"html"}).formatted}async function m5($,X,Z){try{return await $()}catch(J){if(Z&&J instanceof Error)Z(J);return X}}var EY=y(()=>{c$();o$()});class cX{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,X,Z="error"){let J={timestamp:new Date,error:$,context:X,level:Z};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let X=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)X.push(` Stack: ${$.error.stack.split(`
11457
+ `);return{line:J.length,column:J[J.length-1].length}}function J0($,X,Z){return IY({type:$,message:X,code:Z,format:"html"}).formatted}async function d5($,X,Z){try{return await $()}catch(J){if(Z&&J instanceof Error)Z(J);return X}}var EY=y(()=>{c$();o$()});class cX{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,X,Z="error"){let J={timestamp:new Date,error:$,context:X,level:Z};if(this.errors.push(J),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))this.writeToFile(J)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let X=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)X.push(` Stack: ${$.error.stack.split(`
11458
11458
  `).slice(1).join(`
11459
11459
  `)}`);if($.context)X.push(` Context: ${JSON.stringify($.context)}`);return X.join(`
11460
11460
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let X=await import("fs"),J=(await import("path")).dirname(this.logFilePath);if(!X.existsSync(J))X.mkdirSync(J,{recursive:!0});await this.rotateIfNeeded(X);let Y=`${this.formatEntry($)}
@@ -11462,46 +11462,46 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
11462
11462
 
11463
11463
  `),"utf-8")}}async flush(){await this.writeQueue}}var mX,Q1,lX;var DY=y(()=>{o$();mX={isEnabled(){return p$().enableAutoRecovery},fixCommonSyntaxErrors($){let X=p$();if(!X.enableAutoRecovery)return{fixed:$,fixes:[]};let Z=$,J=[],Y=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(Y>G){let W=Y-G;Z+="}}".repeat(W),J.push(`Added ${W} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let W of Q){let w=(Z.match(new RegExp(`@${W}\\b`,"g"))||[]).length,q=(Z.match(new RegExp(`@end${W}\\b`,"g"))||[]).length;if(w>q){let K=w-q;for(let z=0;z<K;z++)Z+=`
11464
11464
  @end${W}`;J.push(`Added ${K} missing @end${W}`)}}if(J.length>0&&X.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),J.forEach((W)=>console.warn(` - ${W}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:J}},createFallbackContent($,X){if(a7())return`<!-- ${$} failed: ${X.message} -->`;return"<!-- stx rendering error -->"}};Q1=new cX,lX={isDevelopment(){return a7()},logDetailedError($,X){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),X)console.error("Context:",X);console.error("========================")},createErrorReport($,X){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(X)Z.push(`Context: ${JSON.stringify(X,null,2)}`);return Z.push("========================"),Z.join(`
11465
- `)}}});var yY=()=>{};var bY=y(()=>{c$();EY();DY();yY();o$()});var k1=y(()=>{bY()});function CY($,X,Z,J){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(W,w,q)=>{if(!q&&w.includes(":")){let K=w.split(":"),z=w,U=K.length>1?K[1]:"";if(U&&X[U])q=X[U];else if(z.startsWith("og:")&&X.openGraph&&X.openGraph[K[1]])q=X.openGraph[K[1]];else q="";return q?`<meta property="${r(z)}" content="${r(q)}">`:""}return q?`<meta name="${r(w)}" content="${r(q)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(Y))!==null){let W=Q.index,w=W+Q[0].length-1,q=1,K=w+1;while(K<Y.length&&q>0){if(Y[K]==="(")q++;else if(Y[K]===")"){if(q--,q===0)break}K++}if(q!==0)break;let z=Y.substring(w+1,K).trim(),U=K+1,j=(()=>{try{let B=y0(z,X);if(!B)return"";let H="<meta";if(B.name)H+=` name="${r(String(B.name))}"`;if(B.property)H+=` property="${r(String(B.property))}"`;if(B.httpEquiv)H+=` http-equiv="${r(String(B.httpEquiv))}"`;if(B.content)H+=` content="${r(String(B.content))}"`;return H+=">",H}catch(B){let H=B instanceof Error?B.message:String(B);return J0("MetaTag",H,s.EVALUATION_ERROR)}})();Y=Y.substring(0,W)+j+Y.substring(U),G.lastIndex=0}return Y}function PY($,X,Z){let J=$,Y=/@structuredData\s*\(/g,G;while((G=Y.exec(J))!==null){let Q=G.index,W=Q+G[0].length-1,w=1,q=W+1;while(q<J.length&&w>0){if(J[q]==="(")w++;else if(J[q]===")"){if(w--,w===0)break}q++}if(w!==0)break;let K=J.substring(W+1,q).trim(),z=q+1,U=(()=>{try{let j=y0(K,X);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let B=j instanceof Error?j.message:String(j);return J0("StructuredData",B,s.EVALUATION_ERROR)}})();J=J.substring(0,Q)+U+J.substring(z),Y.lastIndex=0}return J}function vY($,X,Z,J){let Y=$,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(Y))!==null){let W=Y.indexOf("{",Q.index+4),w=1,q=W+1,K=null,z=!1;while(q<Y.length&&w>0){let L=Y[q];if(z){z=!1,q++;continue}if(L==="\\"&&K){z=!0,q++;continue}if(K){if(L===K)K=null;q++;continue}if(L==='"'||L==="'"||L==="`"){K=L,q++;continue}if(L==="{")w++;else if(L==="}")w--;q++}if(w!==0)break;let U=Y.substring(q).match(/^\s*\)/);if(!U)break;let j=q+U[0].length,B=Y.substring(W,q),H=Y.substring(Q.index,j),_=((L)=>{try{let O=y0(L,X);if(!O)return"";let F="";if(O.title)F+=`<title>${r(O.title)}</title>
11466
- `,F+=`<meta name="title" content="${r(O.title)}">
11467
- `;if(O.description)F+=`<meta name="description" content="${r(O.description)}">
11468
- `;if(O.keywords){let V=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;F+=`<meta name="keywords" content="${r(V)}">
11469
- `}if(O.robots)F+=`<meta name="robots" content="${r(O.robots)}">
11470
- `;if(O.canonical)F+=`<link rel="canonical" href="${r(O.canonical)}">
11471
- `;if(O.openGraph){let V=O.openGraph;if(F+=`<meta property="og:type" content="${r(V.type||"website")}">
11472
- `,V.title||O.title){let A=V.title||O.title||"";F+=`<meta property="og:title" content="${r(A)}">
11473
- `}if(V.description||O.description){let A=V.description||O.description||"";F+=`<meta property="og:description" content="${r(A)}">
11474
- `}if(V.url||O.canonical){let A=V.url||O.canonical||"";F+=`<meta property="og:url" content="${r(A)}">
11475
- `}if(V.image){if(F+=`<meta property="og:image" content="${r(V.image)}">
11476
- `,V.imageAlt)F+=`<meta property="og:image:alt" content="${r(V.imageAlt)}">
11477
- `;if(V.imageWidth)F+=`<meta property="og:image:width" content="${r(String(V.imageWidth))}">
11478
- `;if(V.imageHeight)F+=`<meta property="og:image:height" content="${r(String(V.imageHeight))}">
11479
- `}if(V.siteName)F+=`<meta property="og:site_name" content="${r(V.siteName)}">
11480
- `}if(O.twitter){let V=O.twitter;if(F+=`<meta name="twitter:card" content="${r(V.card||"summary_large_image")}">
11481
- `,V.title||O.title){let A=V.title||O.title||"";F+=`<meta name="twitter:title" content="${r(A)}">
11482
- `}if(V.description||O.description){let A=V.description||O.description||"";F+=`<meta name="twitter:description" content="${r(A)}">
11483
- `}if(V.image||O.openGraph&&O.openGraph.image){let A=V.image||(O.openGraph?O.openGraph.image:"")||"";F+=`<meta name="twitter:image" content="${r(A)}">
11484
- `}if(V.site)F+=`<meta name="twitter:site" content="${r(V.site)}">
11485
- `;if(V.creator)F+=`<meta name="twitter:creator" content="${r(V.creator)}">
11465
+ `)}}});var yY=()=>{};var bY=y(()=>{c$();EY();DY();yY();o$()});var k1=y(()=>{bY()});function CY($,X,Z,J){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(W,w,q)=>{if(!q&&w.includes(":")){let K=w.split(":"),z=w,U=K.length>1?K[1]:"";if(U&&X[U])q=X[U];else if(z.startsWith("og:")&&X.openGraph&&X.openGraph[K[1]])q=X.openGraph[K[1]];else q="";return q?`<meta property="${n(z)}" content="${n(q)}">`:""}return q?`<meta name="${n(w)}" content="${n(q)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(Y))!==null){let W=Q.index,w=W+Q[0].length-1,q=1,K=w+1;while(K<Y.length&&q>0){if(Y[K]==="(")q++;else if(Y[K]===")"){if(q--,q===0)break}K++}if(q!==0)break;let z=Y.substring(w+1,K).trim(),U=K+1,j=(()=>{try{let B=E0(z,X);if(!B)return"";let H="<meta";if(B.name)H+=` name="${n(String(B.name))}"`;if(B.property)H+=` property="${n(String(B.property))}"`;if(B.httpEquiv)H+=` http-equiv="${n(String(B.httpEquiv))}"`;if(B.content)H+=` content="${n(String(B.content))}"`;return H+=">",H}catch(B){let H=B instanceof Error?B.message:String(B);return J0("MetaTag",H,s.EVALUATION_ERROR)}})();Y=Y.substring(0,W)+j+Y.substring(U),G.lastIndex=0}return Y}function PY($,X,Z){let J=$,Y=/@structuredData\s*\(/g,G;while((G=Y.exec(J))!==null){let Q=G.index,W=Q+G[0].length-1,w=1,q=W+1;while(q<J.length&&w>0){if(J[q]==="(")w++;else if(J[q]===")"){if(w--,w===0)break}q++}if(w!==0)break;let K=J.substring(W+1,q).trim(),z=q+1,U=(()=>{try{let j=E0(K,X);if(!j)return"";if(!j["@context"])j["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(j).replace(/<\//g,"<\\/")}</script>`}catch(j){let B=j instanceof Error?j.message:String(j);return J0("StructuredData",B,s.EVALUATION_ERROR)}})();J=J.substring(0,Q)+U+J.substring(z),Y.lastIndex=0}return J}function vY($,X,Z,J){let Y=$,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(Y))!==null){let W=Y.indexOf("{",Q.index+4),w=1,q=W+1,K=null,z=!1;while(q<Y.length&&w>0){let L=Y[q];if(z){z=!1,q++;continue}if(L==="\\"&&K){z=!0,q++;continue}if(K){if(L===K)K=null;q++;continue}if(L==='"'||L==="'"||L==="`"){K=L,q++;continue}if(L==="{")w++;else if(L==="}")w--;q++}if(w!==0)break;let U=Y.substring(q).match(/^\s*\)/);if(!U)break;let j=q+U[0].length,B=Y.substring(W,q),H=Y.substring(Q.index,j),_=((L)=>{try{let O=E0(L,X);if(!O)return"";let F="";if(O.title)F+=`<title>${n(O.title)}</title>
11466
+ `,F+=`<meta name="title" content="${n(O.title)}">
11467
+ `;if(O.description)F+=`<meta name="description" content="${n(O.description)}">
11468
+ `;if(O.keywords){let V=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;F+=`<meta name="keywords" content="${n(V)}">
11469
+ `}if(O.robots)F+=`<meta name="robots" content="${n(O.robots)}">
11470
+ `;if(O.canonical)F+=`<link rel="canonical" href="${n(O.canonical)}">
11471
+ `;if(O.openGraph){let V=O.openGraph;if(F+=`<meta property="og:type" content="${n(V.type||"website")}">
11472
+ `,V.title||O.title){let A=V.title||O.title||"";F+=`<meta property="og:title" content="${n(A)}">
11473
+ `}if(V.description||O.description){let A=V.description||O.description||"";F+=`<meta property="og:description" content="${n(A)}">
11474
+ `}if(V.url||O.canonical){let A=V.url||O.canonical||"";F+=`<meta property="og:url" content="${n(A)}">
11475
+ `}if(V.image){if(F+=`<meta property="og:image" content="${n(V.image)}">
11476
+ `,V.imageAlt)F+=`<meta property="og:image:alt" content="${n(V.imageAlt)}">
11477
+ `;if(V.imageWidth)F+=`<meta property="og:image:width" content="${n(String(V.imageWidth))}">
11478
+ `;if(V.imageHeight)F+=`<meta property="og:image:height" content="${n(String(V.imageHeight))}">
11479
+ `}if(V.siteName)F+=`<meta property="og:site_name" content="${n(V.siteName)}">
11480
+ `}if(O.twitter){let V=O.twitter;if(F+=`<meta name="twitter:card" content="${n(V.card||"summary_large_image")}">
11481
+ `,V.title||O.title){let A=V.title||O.title||"";F+=`<meta name="twitter:title" content="${n(A)}">
11482
+ `}if(V.description||O.description){let A=V.description||O.description||"";F+=`<meta name="twitter:description" content="${n(A)}">
11483
+ `}if(V.image||O.openGraph&&O.openGraph.image){let A=V.image||(O.openGraph?O.openGraph.image:"")||"";F+=`<meta name="twitter:image" content="${n(A)}">
11484
+ `}if(V.site)F+=`<meta name="twitter:site" content="${n(V.site)}">
11485
+ `;if(V.creator)F+=`<meta name="twitter:creator" content="${n(V.creator)}">
11486
11486
  `}if(O.structuredData){let V=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${V}</script>
11487
11487
  `}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return J0("SEO",`Error processing @seo directive: ${F}`,s.EVALUATION_ERROR)}})(B);Y=Y.substring(0,Q.index)+_+Y.substring(j),G.lastIndex=Q.index+_.length}return Y}function xY($,X,Z){if(Z.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Z.skipDefaultSeoTags===!0)return $;let J=X.__stx_runtime_head;if(!!(J?.title||J?.meta?.some((z)=>z.property==="og:title"||z.name==="og:title"||z.name==="twitter:title"||z.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let G=$.includes("<title>")||$.includes("</title>"),Q="";if(X.title)Q=X.title;else if(X.meta&&X.meta.title)Q=X.meta.title;else if(Z.seo?.defaultConfig?.title)Q=Z.seo.defaultConfig.title;else Q=Z.defaultTitle||"stx Project";let W="";if(X.description)W=X.description;else if(X.meta&&X.meta.description)W=X.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 w="";if(X.image)w=X.image;else if(X.meta&&X.meta.image)w=X.meta.image;else if(X.openGraph&&X.openGraph.image)w=X.openGraph.image;else if(Z.seo?.defaultImage)w=Z.seo.defaultImage;else if(Z.defaultImage)w=Z.defaultImage;let q=`
11488
11488
  <!-- stx SEO Tags -->
11489
- <meta name="title" content="${r(Q)}">
11490
- <meta name="description" content="${r(W)}">
11491
- <meta property="og:title" content="${r(Q)}">
11492
- <meta property="og:description" content="${r(W)}">
11489
+ <meta name="title" content="${n(Q)}">
11490
+ <meta name="description" content="${n(W)}">
11491
+ <meta property="og:title" content="${n(Q)}">
11492
+ <meta property="og:description" content="${n(W)}">
11493
11493
  <meta property="og:type" content="website">
11494
11494
  <meta name="twitter:card" content="summary_large_image">
11495
- <meta name="twitter:title" content="${r(Q)}">
11496
- <meta name="twitter:description" content="${r(W)}">
11495
+ <meta name="twitter:title" content="${n(Q)}">
11496
+ <meta name="twitter:description" content="${n(W)}">
11497
11497
  `;if(w)q+=`
11498
- <meta property="og:image" content="${r(w)}">
11499
- <meta name="twitter:image" content="${r(w)}">
11498
+ <meta property="og:image" content="${n(w)}">
11499
+ <meta name="twitter:image" content="${n(w)}">
11500
11500
  `;let K=$;if(!G)K=K.replace(/<head[^>]*>/,`$&
11501
- <title>${r(Q)}</title>`);return K.replace(/<head[^>]*>/,`$&
11501
+ <title>${n(Q)}</title>`);return K.replace(/<head[^>]*>/,`$&
11502
11502
  ${q}
11503
- `)}function r($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function SY($){let X=$.trim(),Z=X[0];if((Z==="'"||Z==='"'||Z==="`")&&X.length>1&&X.at(-1)===Z)return{value:X.slice(1,-1),quoted:!0};return{value:X,quoted:!1}}function hY($){let X=[];for(let Z of $.rules){if(X.push(`User-agent: ${Z.userAgent}`),Z.allow)for(let J of Z.allow)X.push(`Allow: ${J}`);if(Z.disallow)for(let J of Z.disallow)X.push(`Disallow: ${J}`);if(Z.crawlDelay!==void 0)X.push(`Crawl-delay: ${Z.crawlDelay}`);X.push("")}if($.sitemap){let Z=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let J of Z)X.push(`Sitemap: ${J}`)}if($.host)X.push(`Host: ${$.host}`);return X.join(`
11504
- `).trim()}var ij,fY,gY;var s$=y(()=>{k1();f5();b0();ij=["og:","article:","book:","profile:","fb:","music:","video:"];fY={name:"meta",handler:($,X,Z,J)=>{if(X.length<1)return J0("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let Y=SY(X[0]).value,G;if(X.length>1){let w=SY(X[1]);G=w.quoted?w.value:String(Z?.[w.value]??w.value)}else{let w=Y.includes(":")?Y.slice(Y.indexOf(":")+1):Y,q=Z?.openGraph;G=String(Z?.[w]??q?.[w]??"")}if(!G)return"";let W=ij.some((w)=>Y.startsWith(w))?{property:Y,content:G}:{name:Y,content:G};if(Z)Z.__stx_runtime_head=h1(Z.__stx_runtime_head??{},{meta:[W]});return""},hasEndTag:!1},gY={name:"structuredData",handler:($,X,Z,J)=>{if($.trim()==="")return J0("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return J0("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Y)}</script>`}catch(Y){let G=Y instanceof Error?Y.message:String(Y);return J0("StructuredData",G,s.EVALUATION_ERROR)}},hasEndTag:!0}});import t7 from"path";function nj($,X){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1].trim():"",Y=X,G=[],Q=!0;if(J){let z=J.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let U=z[1],j=U.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Y=j[1];let B=U.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)G=B[1].split(",").map((_)=>_.trim().replace(/['"`]/g,"")).filter((_)=>_.length>0);let H=U.match(/shadowDOM\s*:\s*(true|false)/);if(H)Q=H[1]==="true"}catch{}}let W=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),w=W?W[1].trim():"",q=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),K=q?q[1].trim():"";return{tag:Y,props:G,template:w,styles:K,script:J,shadowDOM:Q}}function rj($){let{tag:X,props:Z,template:J,styles:Y,shadowDOM:G}=$,Q=X.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),W=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),w=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=Z.map((z)=>`'${z}'`).join(", "),K=Z.map((z)=>`
11503
+ `)}function n($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function SY($){let X=$.trim(),Z=X[0];if((Z==="'"||Z==='"'||Z==="`")&&X.length>1&&X.at(-1)===Z)return{value:X.slice(1,-1),quoted:!0};return{value:X,quoted:!1}}function hY($){let X=[];for(let Z of $.rules){if(X.push(`User-agent: ${Z.userAgent}`),Z.allow)for(let J of Z.allow)X.push(`Allow: ${J}`);if(Z.disallow)for(let J of Z.disallow)X.push(`Disallow: ${J}`);if(Z.crawlDelay!==void 0)X.push(`Crawl-delay: ${Z.crawlDelay}`);X.push("")}if($.sitemap){let Z=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let J of Z)X.push(`Sitemap: ${J}`)}if($.host)X.push(`Host: ${$.host}`);return X.join(`
11504
+ `).trim()}var ij,fY,gY;var s$=y(()=>{k1();x5();D0();ij=["og:","article:","book:","profile:","fb:","music:","video:"];fY={name:"meta",handler:($,X,Z,J)=>{if(X.length<1)return J0("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let Y=SY(X[0]).value,G;if(X.length>1){let w=SY(X[1]);G=w.quoted?w.value:String(Z?.[w.value]??w.value)}else{let w=Y.includes(":")?Y.slice(Y.indexOf(":")+1):Y,q=Z?.openGraph;G=String(Z?.[w]??q?.[w]??"")}if(!G)return"";let W=ij.some((w)=>Y.startsWith(w))?{property:Y,content:G}:{name:Y,content:G};if(Z)Z.__stx_runtime_head=d1(Z.__stx_runtime_head??{},{meta:[W]});return""},hasEndTag:!1},gY={name:"structuredData",handler:($,X,Z,J)=>{if($.trim()==="")return J0("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return J0("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Y)}</script>`}catch(Y){let G=Y instanceof Error?Y.message:String(Y);return J0("StructuredData",G,s.EVALUATION_ERROR)}},hasEndTag:!0}});import t7 from"path";function nj($,X){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1].trim():"",Y=X,G=[],Q=!0;if(J){let z=J.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let U=z[1],j=U.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(j)Y=j[1];let B=U.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)G=B[1].split(",").map((_)=>_.trim().replace(/['"`]/g,"")).filter((_)=>_.length>0);let H=U.match(/shadowDOM\s*:\s*(true|false)/);if(H)Q=H[1]==="true"}catch{}}let W=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),w=W?W[1].trim():"",q=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),K=q?q[1].trim():"";return{tag:Y,props:G,template:w,styles:K,script:J,shadowDOM:Q}}function rj($){let{tag:X,props:Z,template:J,styles:Y,shadowDOM:G}=$,Q=X.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),W=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),w=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),q=Z.map((z)=>`'${z}'`).join(", "),K=Z.map((z)=>`
11505
11505
  get ${z}() {
11506
11506
  return this.getAttribute('${z}') || '';
11507
11507
  }
@@ -11554,14 +11554,14 @@ ${K}
11554
11554
  customElements.define('${X}', ${Q});
11555
11555
  `}async function uY($,X,Z,J){if(X.length<1)return J0("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let Y=X[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",W=[t7.join(t7.dirname(J),Q,`${Y}.stx`),t7.join(process.cwd(),Q,`${Y}.stx`),t7.join(t7.dirname(J),`${Y}.stx`)],w=null;for(let z of W)if(await o(z)){w=await Bun.file(z).text();break}if(!w)return J0("WebComponent",`Component file not found: ${Y}.stx`,s.FILE_NOT_FOUND);let q=nj(w,Y);return`<script type="module">
11556
11556
  ${rj(q)}
11557
- </script>`}var dY=y(()=>{k1();V0()});var mY={};e(mY,{timingPlugin:()=>ej,pluginManager:()=>oj,definePlugin:()=>a$,debugPlugin:()=>tj,createVariablesPlugin:()=>$B,createFilterPlugin:()=>aj,createDirectivePlugin:()=>sj,PluginManager:()=>pX});function a$($){return $}class pX{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,X){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Z of $.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${$.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(X);this.sortPlugins()}async unregister($){let X=this.plugins.get($);if(!X)return!1;for(let[Z,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Z}" depends on it`);if(X.onUnregister)await X.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let X of this.sortedPlugins)if(X.registerDirectives)$.push(...X.registerDirectives());return $}getAllFilters(){let $={};for(let X of this.sortedPlugins)if(X.registerFilters)Object.assign($,X.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,X){return this.runDirectiveHooks("beforeDirective",$,X)}async runAfterDirective($,X){return this.runDirectiveHooks("afterDirective",$,X)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let X of this.sortedPlugins)if(X.onError)try{let Z=await X.onError($);if(Z){if(Z.template!==void 0)$.template=Z.template;if(Z.context)$.context={...$.context,...Z.context};if(Z.metadata)$.metadata={...$.metadata,...Z.metadata};if(Z.skip)return $}}catch(Z){console.error(`Error in plugin "${X.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,X)=>($.priority??100)-(X.priority??100))}async runHooks($,X){let Z={...X};for(let J of this.sortedPlugins){let Y=J[$];if(Y)try{let G=await Y(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 "${J.name}" ${$} hook:`,G)}}return Z}async runDirectiveHooks($,X,Z){let J={...Z};for(let Y of this.sortedPlugins){let G=Y[$];if(G)try{let Q=await G(X,J);if(Q){if(Q.template!==void 0)J.template=Q.template;if(Q.context)J.context={...J.context,...Q.context};if(Q.metadata)J.metadata={...J.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${Y.name}" ${$} hook:`,Q)}}return J}}function sj($,X,Z={}){return{name:$,...Z,registerDirectives:()=>X}}function aj($,X,Z={}){return{name:$,...Z,registerFilters:()=>X}}function $B($){return a$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(X){return{context:{...X.context,...$}}}})}var oj,tj,ej;var cY=y(()=>{oj=new pX;tj=a$({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,X){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,X){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),ej=a$({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let X=$.metadata.startTime;if(X){let Z=performance.now()-X;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var nY={};e(nY,{validateConfig:()=>WB,resolveStxDirectories:()=>iY,loadStxConfig:()=>Y1,defineStxConfig:()=>QB,defaultConfig:()=>j5,config:()=>P7});import t$ from"fs";import s0 from"path";import{loadConfigWithResult as XB}from"bunfig";function ZB($,X,Z){let J=X||"pages";if($)return{root:$,pagesDir:J};let Y=Z||process.cwd(),G=s0.join(Y,"resources","views"),Q=s0.join(Y,"resources","layouts");if(t$.existsSync(G)&&t$.existsSync(Q))return{root:"resources",pagesDir:"views"};let W=s0.join(Y,"resources","views","pages");if(t$.existsSync(W))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}function JB($,X){let Z=X.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let J=$.replace(/\\/g,"/"),Y=Z.replace(/\\/g,"/");return J===Y||J.startsWith(`${Y}/`)}function iY($,X){let Z=!$.root,J=ZB($.root,$.pagesDir,X);if($.root=J.root,$.pagesDir=J.pagesDir,Z&&J.root!=="."){let Y=`${X}::${J.root}`;if(!lY.has(Y))lY.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let Y=$.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=$[G];if(typeof Q!=="string"||!Q)continue;if(s0.isAbsolute(Q)||JB(Q,Y))continue;$[G]=s0.join(Y,Q)}}return $}function YB($,X){let Z=["componentsDir","layoutsDir","partialsDir"];for(let J of Z){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let G=s0.isAbsolute(Y)?Y:s0.join(X,Y);if(t$.existsSync(G))continue;let Q=$.root,W=!!Q&&Q!==".";console.warn(`[stx] ${String(J)} resolves to "${G}", which does not exist. Configured as "${Y}"`+(W?`, resolved under root "${Q}".`:"."))}}function GB($){if(a6($.stateDir),$.stateDir=E7(),$.cachePath=D7($.cachePath),$.build)$.build.cacheDir=D7($.build.cacheDir);if($.media?.cache)$.media.cache.directory=D7($.media.cache.directory);if($.story)$.story.outDir=D7($.story.outDir)}async function Y1($){if(!$){if(c5)return c5;if(e$)return e$}let X=$?s0.resolve($):process.cwd(),Z=pY.get(X);if(Z)return Z;let J=(async()=>{let G=(await XB({name:"stx",alias:"ui",cwd:X,defaultConfig:j5,verbose:!1})).config;if(GB(G),iY(G,X),YB(G,X),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (cY(),mY)),W=[],w=[];for(let q of G.plugins){let K=typeof q==="string"?q:q[0],z=typeof q==="string"?{}:q[1]||{};try{let U,j;try{U=await import(K),j=s0.dirname(B0.resolve(K))}catch{let H=s0.resolve(process.cwd(),K);U=await import(H),j=s0.dirname(H)}let B=U.default||U;if(Q.register(B,G),B.components){let H=Array.isArray(B.components)?B.components:[B.components];for(let _ of H)W.push(s0.resolve(j,_))}if(B.pages){let H=s0.resolve(j,B.pages),_=z.path||"/";w.push({dir:H,prefix:_})}if(B.setup){let H={addDirective:(_)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(_)},addRoute:(_,L)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[_]=L},addMiddleware:(_)=>{G.middleware=G.middleware||[],G.middleware.push(_)},pluginDir:j,config:G};await B.setup(z,H)}console.log(`[stx] Plugin loaded: ${B.name||K}`)}catch(U){console.warn(`[stx] Failed to load plugin ${K}:`,U.message)}}G._pluginComponentDirs=W,G._pluginPageDirs=w}return G})();if(pY.set(X,J),!$)e$=J,J.then((Y)=>{c5=Y}).catch(()=>{});return J}function QB($){return $}function WB($){let X=[],Z=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")X.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")X.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")X.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")X.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)X.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)X.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))X.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))X.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)X.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)X.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))X.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))X.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))X.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))X.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")X.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")X.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))X.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")X.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")X.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))X.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)X.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))X.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))X.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,G)=>{if(!Y.pattern||typeof Y.pattern!=="string")X.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(Y.strategy))X.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))X.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))X.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))X.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)X.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((G)=>!J.includes(G)).length>0)X.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.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($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:X.length===0,errors:X,warnings:Z}}var j5,lY,c5=null,pY,e$=null,P7;var M1=y(()=>{e9();$4();X4();Z4();wX();eJ();hX();TY();s$();y7();dY();j5={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:TJ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:uY,hasEndTag:!1,description:"Include a web component in the template"},X2,Z2,fY,gY,J2,G2,Q2,Y2,q2,U2,tJ,gX,...MY],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}};lY=new Set;pY=new Map;P7=new Proxy(j5,{get($,X){if(c5&&X in c5)return c5[X];if(!e$)Y1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[X]}})});var aX={};e(aX,{resolveUserCrosswindConfig:()=>sY,resetCssCache:()=>HB,resetCrosswindCache:()=>_B,rebuildCrosswindCSS:()=>OB,loadCrosswindConfig:()=>sX,loadCrosswind:()=>oX,injectCrosswindCSS:()=>$8,getCrosswindServeAsset:()=>KB,getCachedCSS:()=>LB,generateCrosswindCSS:()=>$G,fingerprintConfig:()=>aY,extractClassNames:()=>eY,buildCrosswindCSS:()=>tY});import W0 from"path";import{hasLocalConfig as wB}from"bunfig";function $9($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function iX($,X){if(I1.has($))I1.delete($);else if(I1.size>=oY)I1.delete(I1.keys().next().value);I1.set($,X)}function qB($){let X=$9($);if(W1.has(X))W1.delete(X);else if(W1.size>=oY)W1.delete(W1.keys().next().value);return W1.set(X,$),X}function KB($){let X=W1.get($);if(X===void 0)return;return W1.delete($),W1.set($,X),X}async function zB($){if(!l1)return null;try{let X=Bun.file(W0.join(l1,`cw-${$9($)}.css`));if(!await X.exists())return null;return await X.text()}catch{return null}}async function UB($,X){if(!l1)return;try{if(!fs.existsSync(l1))fs.mkdirSync(l1,{recursive:!0});await Bun.write(W0.join(l1,`cw-${$9($)}.css`),X)}catch{}}async function rY($){try{let X=await import($);if(X&&X.CSSGenerator)return{CSSGenerator:X.CSSGenerator,config:X.config,build:X.build,defaultConfig:X.defaultConfig,extractClasses:X.extractClasses}}catch{}return null}function jB(){let $=[],X=process.cwd();while(X!==W0.dirname(X))$.push(W0.join(X,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(W0.join(X,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(W0.join(X,"pantry","@cwcss","crosswind","dist","index.js")),$.push(W0.join(X,"pantry","@cwcss","crosswind","src","index.ts")),$.push(W0.join(X,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(W0.join(X,"pantry","@stacksjs","crosswind","dist","index.js")),X=W0.dirname(X);return $}function BB(){let $=[],X=process.env.HOME||process.env.USERPROFILE||"";if(X){let Z=[W0.join(X,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),W0.join(X,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),W0.join(X,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),W0.join(X,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),W0.join(X,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),W0.join(X,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Z)}return $.push(W0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(W0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function oX(){if(nX)return _1;nX=!0;try{let $=async(Y)=>{for(let G of Y){if(!await Bun.file(G).exists())continue;let Q=await rY(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${L0.green}[Crosswind]${L0.reset} CSS engine loaded from ${W0.dirname(W0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let Y=W0.resolve(process.env.CROSSWIND_SRC),G=await $([Y]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Y}`);return _1=G,_1}let X=await $(jB());if(X)return _1=X,_1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of Z){let G=await rY(Y);if(G){if(_1=G,!process.env.STACKS_DEV_QUIET)console.log(`${L0.green}[Crosswind]${L0.reset} CSS engine loaded`);return _1}}let J=await $(BB());if(J)return _1=J,_1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${L0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${L0.reset}`),console.warn(`${L0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${L0.reset}`),null}}function HB(){I1.clear(),W1.clear()}function _B(){_1=null,nX=!1,w1=null,e7="",I1.clear(),W1.clear(),rX=null}async function sX($){try{if(!wB({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:X}=await import("bunfig"),Z=await X({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let J=W0.relative($,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${L0.green}[Crosswind]${L0.reset} Loaded config from ${J||Z.path}`);return Z.config}catch(X){if(X instanceof Error&&X.name==="ConfigNotFoundError")return null;return console.warn(`${L0.yellow}[Crosswind]${L0.reset} Failed to load crosswind config:`,X instanceof Error?X.message:X),null}}async function sY($){let X=null;try{let{loadStxConfig:Z}=await Promise.resolve().then(() => (M1(),nY)),J=await Z($);if(J.css)if(typeof J.css==="string"){let Y=W0.isAbsolute(J.css)?J.css:W0.resolve($,J.css);if(await Bun.file(Y).exists()){let G=await import(Y);X=G.default||G,console.log(`${L0.green}[Crosswind]${L0.reset} Loaded config from stx.config.ts \u2192 ${J.css}`)}}else{if(X={...J.css,content:J.css.content||[],preflight:J.css.preflight??!0,minify:J.css.minify??!1},J.css.config){let Y=W0.isAbsolute(J.css.config)?J.css.config:W0.resolve($,J.css.config);if(await Bun.file(Y).exists()){let G=await import(Y);X={...G.default||G,...X}}}console.log(`${L0.green}[Crosswind]${L0.reset} Using inline CSS config from stx.config.ts`)}}catch{}return X||await sX($)}function aY($){try{let X=new WeakSet;return $9(JSON.stringify($??{},(Z,J)=>{if(typeof J==="function")return`[fn]${String(J)}`;if(typeof J==="object"&&J!==null){if(X.has(J))return"[circular]";X.add(J)}return J})??"")}catch{return"unhashable"}}async function tY($){if(l5)return e7;l5=!0;try{let X=await oX();if(!X||!X.build)return l5=!1,"";if(!w1)w1=await sX($);if(!w1)return l5=!1,"";let Z=X.defaultConfig?.theme||{},J=w1.theme||{},Y={...X.defaultConfig,...w1,theme:{...Z,...J,extend:{...Z.extend||{},...J.extend||{}}}},G=performance.now(),Q=await X.build(Y),W=performance.now()-G;if(e7=Q.css,console.log(`${L0.cyan}[Crosswind]${L0.reset} Built ${Q.classes.size} classes in ${W.toFixed(1)}ms`),Y.output){let w=W0.isAbsolute(Y.output)?Y.output:W0.join($,Y.output),q=W0.dirname(w);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(w,Q.css)}return l5=!1,Q.css}catch(X){return console.error(`${L0.red}[Crosswind]${L0.reset} Build error:`,X),l5=!1,e7}}async function OB($){w1=null,await tY($)}function LB(){return e7}function eY($){let X=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,J=Z.exec($);while(J!==null){for(let Q of J[1].split(/\s+/))if(Q.trim())X.add(Q.trim());J=Z.exec($)}let Y=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=Y.exec($);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let W of Q)for(let w of W.slice(1,-1).split(/\s+/))if(w.trim())X.add(w.trim())}G=Y.exec($)}return X}async function $G($,X){try{let Z=await oX();if(!Z)return"";let J=typeof Z.extractClasses==="function"?Z.extractClasses($):eY($);if(J.size===0)return"";let Y=X?W0.resolve(X):process.cwd();if(!l1)l1=A1(Y,"cache");let G=[...J].sort().join(" "),Q=`${rX||"default"}::${G}`,W=I1.get(Q);if(W!==void 0)return iX(Q,W),W;let w=await zB(Q);if(w!==null)return iX(Q,w),w;if(!w1)w1=await sY(Y),rX=aY(w1);let q=Z.defaultConfig||Z.config,K=w1||{},z=r6(q,K),{safelist:U,includePreflight:j,minify:B,tokenCSS:H}=z,_=z.config,L=new Z.CSSGenerator(_);for(let A of U)L.generate(A);for(let A of J)L.generate(A);let O=L.toCSS(j,B),F=_.shortcuts||K.shortcuts||{};for(let[A,R]of Object.entries(F)){if(!J.has(A)&&!U.includes(A))continue;let N=R.split(/\s+/).filter(Boolean);for(let k of N)L.generate(k)}O=L.toCSS(j,B);let V=O.split(`
11558
- `);for(let[A,R]of Object.entries(F)){if(!J.has(A)&&!U.includes(A))continue;let N=R.split(/\s+/).filter(Boolean),k=[],I=[];for(let M of N){let E=M.startsWith("dark:"),b=`.${(E?M.slice(5):M).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let S=0;S<V.length;S++){let P=V[S].trim();if(P===`${b} {`||P.startsWith(`${b} {`)){let v=S,x="";while(v<V.length){if(x+=V[v],V[v].includes("}"))break;v++}let i=x.match(/\{([^}]+)\}/);if(i)if(E)I.push(i[1].trim());else k.push(i[1].trim());break}}}if(k.length)O+=`
11557
+ </script>`}var dY=y(()=>{k1();F0()});var mY={};t(mY,{timingPlugin:()=>ej,pluginManager:()=>oj,definePlugin:()=>a$,debugPlugin:()=>tj,createVariablesPlugin:()=>$B,createFilterPlugin:()=>aj,createDirectivePlugin:()=>sj,PluginManager:()=>pX});function a$($){return $}class pX{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,X){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Z of $.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${$.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(X);this.sortPlugins()}async unregister($){let X=this.plugins.get($);if(!X)return!1;for(let[Z,J]of this.plugins)if(J.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Z}" depends on it`);if(X.onUnregister)await X.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let X of this.sortedPlugins)if(X.registerDirectives)$.push(...X.registerDirectives());return $}getAllFilters(){let $={};for(let X of this.sortedPlugins)if(X.registerFilters)Object.assign($,X.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,X){return this.runDirectiveHooks("beforeDirective",$,X)}async runAfterDirective($,X){return this.runDirectiveHooks("afterDirective",$,X)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let X of this.sortedPlugins)if(X.onError)try{let Z=await X.onError($);if(Z){if(Z.template!==void 0)$.template=Z.template;if(Z.context)$.context={...$.context,...Z.context};if(Z.metadata)$.metadata={...$.metadata,...Z.metadata};if(Z.skip)return $}}catch(Z){console.error(`Error in plugin "${X.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,X)=>($.priority??100)-(X.priority??100))}async runHooks($,X){let Z={...X};for(let J of this.sortedPlugins){let Y=J[$];if(Y)try{let G=await Y(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 "${J.name}" ${$} hook:`,G)}}return Z}async runDirectiveHooks($,X,Z){let J={...Z};for(let Y of this.sortedPlugins){let G=Y[$];if(G)try{let Q=await G(X,J);if(Q){if(Q.template!==void 0)J.template=Q.template;if(Q.context)J.context={...J.context,...Q.context};if(Q.metadata)J.metadata={...J.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${Y.name}" ${$} hook:`,Q)}}return J}}function sj($,X,Z={}){return{name:$,...Z,registerDirectives:()=>X}}function aj($,X,Z={}){return{name:$,...Z,registerFilters:()=>X}}function $B($){return a$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(X){return{context:{...X.context,...$}}}})}var oj,tj,ej;var cY=y(()=>{oj=new pX;tj=a$({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,X){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,X){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),ej=a$({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let X=$.metadata.startTime;if(X){let Z=performance.now()-X;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var nY={};t(nY,{validateConfig:()=>WB,resolveStxDirectories:()=>iY,loadStxConfig:()=>Y1,defineStxConfig:()=>QB,defaultConfig:()=>U5,config:()=>P7});import t$ from"fs";import o0 from"path";import{loadConfigWithResult as XB}from"bunfig";function ZB($,X,Z){let J=X||"pages";if($)return{root:$,pagesDir:J};let Y=Z||process.cwd(),G=o0.join(Y,"resources","views"),Q=o0.join(Y,"resources","layouts");if(t$.existsSync(G)&&t$.existsSync(Q))return{root:"resources",pagesDir:"views"};let W=o0.join(Y,"resources","views","pages");if(t$.existsSync(W))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}function JB($,X){let Z=X.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let J=$.replace(/\\/g,"/"),Y=Z.replace(/\\/g,"/");return J===Y||J.startsWith(`${Y}/`)}function iY($,X){let Z=!$.root,J=ZB($.root,$.pagesDir,X);if($.root=J.root,$.pagesDir=J.pagesDir,Z&&J.root!=="."){let Y=`${X}::${J.root}`;if(!lY.has(Y))lY.add(Y),console.warn(`[stx] No "root" in config \u2014 inferred "${J.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let Y=$.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=$[G];if(typeof Q!=="string"||!Q)continue;if(o0.isAbsolute(Q)||JB(Q,Y))continue;$[G]=o0.join(Y,Q)}}return $}function YB($,X){let Z=["componentsDir","layoutsDir","partialsDir"];for(let J of Z){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let G=o0.isAbsolute(Y)?Y:o0.join(X,Y);if(t$.existsSync(G))continue;let Q=$.root,W=!!Q&&Q!==".";console.warn(`[stx] ${String(J)} resolves to "${G}", which does not exist. Configured as "${Y}"`+(W?`, resolved under root "${Q}".`:"."))}}function GB($){if(a6($.stateDir),$.stateDir=E7(),$.cachePath=D7($.cachePath),$.build)$.build.cacheDir=D7($.build.cacheDir);if($.media?.cache)$.media.cache.directory=D7($.media.cache.directory);if($.story)$.story.outDir=D7($.story.outDir)}async function Y1($){if(!$){if(m5)return m5;if(e$)return e$}let X=$?o0.resolve($):process.cwd(),Z=pY.get(X);if(Z)return Z;let J=(async()=>{let G=(await XB({name:"stx",alias:"ui",cwd:X,defaultConfig:U5,verbose:!1})).config;if(GB(G),iY(G,X),YB(G,X),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (cY(),mY)),W=[],w=[];for(let q of G.plugins){let K=typeof q==="string"?q:q[0],z=typeof q==="string"?{}:q[1]||{};try{let U,j;try{U=await import(K),j=o0.dirname(B0.resolve(K))}catch{let H=o0.resolve(process.cwd(),K);U=await import(H),j=o0.dirname(H)}let B=U.default||U;if(Q.register(B,G),B.components){let H=Array.isArray(B.components)?B.components:[B.components];for(let _ of H)W.push(o0.resolve(j,_))}if(B.pages){let H=o0.resolve(j,B.pages),_=z.path||"/";w.push({dir:H,prefix:_})}if(B.setup){let H={addDirective:(_)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(_)},addRoute:(_,L)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[_]=L},addMiddleware:(_)=>{G.middleware=G.middleware||[],G.middleware.push(_)},pluginDir:j,config:G};await B.setup(z,H)}console.log(`[stx] Plugin loaded: ${B.name||K}`)}catch(U){console.warn(`[stx] Failed to load plugin ${K}:`,U.message)}}G._pluginComponentDirs=W,G._pluginPageDirs=w}return G})();if(pY.set(X,J),!$)e$=J,J.then((Y)=>{m5=Y}).catch(()=>{});return J}function QB($){return $}function WB($){let X=[],Z=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")X.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")X.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")X.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")X.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)X.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)X.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let J=["auto","manual","sections"];if(!J.includes($.streaming.strategy))X.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${J.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let J=["json","yaml","yml","js"];if(!J.includes($.i18n.format))X.push({path:"i18n.format",message:`i18n.format must be one of: ${J.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)X.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)X.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let J=["AA","AAA"];if(!J.includes($.a11y.level))X.push({path:"a11y.level",message:`a11y.level must be one of: ${J.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let J=["progressive","islands"];if(!J.includes($.hydration.mode))X.push({path:"hydration.mode",message:`hydration.mode must be one of: ${J.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let J=["none","eager","lazy"];if(!J.includes($.hydration.preload))X.push({path:"hydration.preload",message:`hydration.preload must be one of: ${J.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))X.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")X.push({path:`customDirectives[${Y}].name`,message:"Custom directive must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")X.push({path:`customDirectives[${Y}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))X.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((J,Y)=>{if(!J.name||typeof J.name!=="string")X.push({path:`middleware[${Y}].name`,message:"Middleware must have a name string",severity:"error"});if(!J.handler||typeof J.handler!=="function")X.push({path:`middleware[${Y}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!J.timing||!["before","after"].includes(J.timing))X.push({path:`middleware[${Y}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)X.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let J=["fullscreen","standalone","minimal-ui","browser"];if(!J.includes($.pwa.manifest.display))X.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let J=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!J.includes($.pwa.manifest.orientation))X.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.routes){let J=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((Y,G)=>{if(!Y.pattern||typeof Y.pattern!=="string")X.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!J.includes(Y.strategy))X.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${J.join(", ")}`,severity:"error"});if(Y.maxAgeSeconds!==void 0&&(typeof Y.maxAgeSeconds!=="number"||Y.maxAgeSeconds<0))X.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Y.maxEntries!==void 0&&(typeof Y.maxEntries!=="number"||Y.maxEntries<1))X.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))X.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((Y)=>typeof Y!=="number"||Y<16||Y>1024).length>0)X.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let J=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((G)=>!J.includes(G)).length>0)X.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${J.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.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($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:X.length===0,errors:X,warnings:Z}}var U5,lY,m5=null,pY,e$=null,P7;var M1=y(()=>{e9();$4();X4();Z4();wX();eJ();hX();TY();s$();y7();dY();U5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:k5,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:TJ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:uY,hasEndTag:!1,description:"Include a web component in the template"},X2,Z2,fY,gY,J2,G2,Q2,Y2,q2,U2,tJ,gX,...MY],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}};lY=new Set;pY=new Map;P7=new Proxy(U5,{get($,X){if(m5&&X in m5)return m5[X];if(!e$)Y1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[X]}})});var aX={};t(aX,{resolveUserCrosswindConfig:()=>sY,resetCssCache:()=>HB,resetCrosswindCache:()=>_B,rebuildCrosswindCSS:()=>OB,loadCrosswindConfig:()=>sX,loadCrosswind:()=>oX,injectCrosswindCSS:()=>$8,getCrosswindServeAsset:()=>KB,getCachedCSS:()=>LB,generateCrosswindCSS:()=>$G,fingerprintConfig:()=>aY,extractClassNames:()=>eY,buildCrosswindCSS:()=>tY});import w0 from"path";import{hasLocalConfig as wB}from"bunfig";function $9($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function iX($,X){if(I1.has($))I1.delete($);else if(I1.size>=oY)I1.delete(I1.keys().next().value);I1.set($,X)}function qB($){let X=$9($);if(W1.has(X))W1.delete(X);else if(W1.size>=oY)W1.delete(W1.keys().next().value);return W1.set(X,$),X}function KB($){let X=W1.get($);if(X===void 0)return;return W1.delete($),W1.set($,X),X}async function zB($){if(!p1)return null;try{let X=Bun.file(w0.join(p1,`cw-${$9($)}.css`));if(!await X.exists())return null;return await X.text()}catch{return null}}async function UB($,X){if(!p1)return;try{if(!fs.existsSync(p1))fs.mkdirSync(p1,{recursive:!0});await Bun.write(w0.join(p1,`cw-${$9($)}.css`),X)}catch{}}async function rY($){try{let X=await import($);if(X&&X.CSSGenerator)return{CSSGenerator:X.CSSGenerator,config:X.config,build:X.build,defaultConfig:X.defaultConfig,extractClasses:X.extractClasses}}catch{}return null}function jB(){let $=[],X=process.cwd();while(X!==w0.dirname(X))$.push(w0.join(X,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(w0.join(X,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(w0.join(X,"pantry","@cwcss","crosswind","dist","index.js")),$.push(w0.join(X,"pantry","@cwcss","crosswind","src","index.ts")),$.push(w0.join(X,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(w0.join(X,"pantry","@stacksjs","crosswind","dist","index.js")),X=w0.dirname(X);return $}function BB(){let $=[],X=process.env.HOME||process.env.USERPROFILE||"";if(X){let Z=[w0.join(X,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),w0.join(X,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),w0.join(X,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),w0.join(X,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),w0.join(X,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),w0.join(X,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Z)}return $.push(w0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(w0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function oX(){if(nX)return _1;nX=!0;try{let $=async(Y)=>{for(let G of Y){if(!await Bun.file(G).exists())continue;let Q=await rY(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${w0.dirname(w0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let Y=w0.resolve(process.env.CROSSWIND_SRC),G=await $([Y]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Y}`);return _1=G,_1}let X=await $(jB());if(X)return _1=X,_1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of Z){let G=await rY(Y);if(G){if(_1=G,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return _1}}let J=await $(BB());if(J)return _1=J,_1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}function HB(){I1.clear(),W1.clear()}function _B(){_1=null,nX=!1,w1=null,e7="",I1.clear(),W1.clear(),rX=null}async function sX($){try{if(!wB({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:X}=await import("bunfig"),Z=await X({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let J=w0.relative($,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${J||Z.path}`);return Z.config}catch(X){if(X instanceof Error&&X.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,X instanceof Error?X.message:X),null}}async function sY($){let X=null;try{let{loadStxConfig:Z}=await Promise.resolve().then(() => (M1(),nY)),J=await Z($);if(J.css)if(typeof J.css==="string"){let Y=w0.isAbsolute(J.css)?J.css:w0.resolve($,J.css);if(await Bun.file(Y).exists()){let G=await import(Y);X=G.default||G,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${J.css}`)}}else{if(X={...J.css,content:J.css.content||[],preflight:J.css.preflight??!0,minify:J.css.minify??!1},J.css.config){let Y=w0.isAbsolute(J.css.config)?J.css.config:w0.resolve($,J.css.config);if(await Bun.file(Y).exists()){let G=await import(Y);X={...G.default||G,...X}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}return X||await sX($)}function aY($){try{let X=new WeakSet;return $9(JSON.stringify($??{},(Z,J)=>{if(typeof J==="function")return`[fn]${String(J)}`;if(typeof J==="object"&&J!==null){if(X.has(J))return"[circular]";X.add(J)}return J})??"")}catch{return"unhashable"}}async function tY($){if(c5)return e7;c5=!0;try{let X=await oX();if(!X||!X.build)return c5=!1,"";if(!w1)w1=await sX($);if(!w1)return c5=!1,"";let Z=X.defaultConfig?.theme||{},J=w1.theme||{},Y={...X.defaultConfig,...w1,theme:{...Z,...J,extend:{...Z.extend||{},...J.extend||{}}}},G=performance.now(),Q=await X.build(Y),W=performance.now()-G;if(e7=Q.css,console.log(`${O0.cyan}[Crosswind]${O0.reset} Built ${Q.classes.size} classes in ${W.toFixed(1)}ms`),Y.output){let w=w0.isAbsolute(Y.output)?Y.output:w0.join($,Y.output),q=w0.dirname(w);if(!fs.existsSync(q))fs.mkdirSync(q,{recursive:!0});await Bun.write(w,Q.css)}return c5=!1,Q.css}catch(X){return console.error(`${O0.red}[Crosswind]${O0.reset} Build error:`,X),c5=!1,e7}}async function OB($){w1=null,await tY($)}function LB(){return e7}function eY($){let X=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,J=Z.exec($);while(J!==null){for(let Q of J[1].split(/\s+/))if(Q.trim())X.add(Q.trim());J=Z.exec($)}let Y=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=Y.exec($);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let W of Q)for(let w of W.slice(1,-1).split(/\s+/))if(w.trim())X.add(w.trim())}G=Y.exec($)}return X}async function $G($,X){try{let Z=await oX();if(!Z)return"";let J=typeof Z.extractClasses==="function"?Z.extractClasses($):eY($);if(J.size===0)return"";let Y=X?w0.resolve(X):process.cwd();if(!p1)p1=A1(Y,"cache");let G=[...J].sort().join(" "),Q=`${rX||"default"}::${G}`,W=I1.get(Q);if(W!==void 0)return iX(Q,W),W;let w=await zB(Q);if(w!==null)return iX(Q,w),w;if(!w1)w1=await sY(Y),rX=aY(w1);let q=Z.defaultConfig||Z.config,K=w1||{},z=r6(q,K),{safelist:U,includePreflight:j,minify:B,tokenCSS:H}=z,_=z.config,L=new Z.CSSGenerator(_);for(let A of U)L.generate(A);for(let A of J)L.generate(A);let O=L.toCSS(j,B),F=_.shortcuts||K.shortcuts||{};for(let[A,R]of Object.entries(F)){if(!J.has(A)&&!U.includes(A))continue;let N=R.split(/\s+/).filter(Boolean);for(let k of N)L.generate(k)}O=L.toCSS(j,B);let V=O.split(`
11558
+ `);for(let[A,R]of Object.entries(F)){if(!J.has(A)&&!U.includes(A))continue;let N=R.split(/\s+/).filter(Boolean),k=[],I=[];for(let M of N){let E=M.startsWith("dark:"),b=`.${(E?M.slice(5):M).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let S=0;S<V.length;S++){let P=V[S].trim();if(P===`${b} {`||P.startsWith(`${b} {`)){let x=S,f="";while(x<V.length){if(f+=V[x],V[x].includes("}"))break;x++}let p=f.match(/\{([^}]+)\}/);if(p)if(E)I.push(p[1].trim());else k.push(p[1].trim());break}}}if(k.length)O+=`
11559
11559
  .${A} { ${k.join(" ")} }`;if(I.length)O+=`
11560
11560
  @media (prefers-color-scheme: dark) { .dark .${A} { ${I.join(" ")} } }`}return O=H+O,iX(Q,O),UB(Q,O),O}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function $8($,X,Z=!1){let J=await $G($,X);if(!J)return $;let Y=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${qB(J)}.css">`:`<style data-crosswind="generated">
11561
11561
  ${J}
11562
11562
  </style>`,G=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(G.test($)){let Q=!1;return $.replace(G,()=>{if(Q)return"";return Q=!0,Y})}if($.includes("</head>"))return $.replace("</head>",`${Y}
11563
11563
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
11564
- ${Y}`);return Y+$}var _1=null,nX=!1,w1=null,e7="",l5=!1,oY=256,I1,W1,l1=null,rX=null;var X8=y(()=>{o6();y7();t6();I1=new Map,W1=new Map});function XG(){return`
11564
+ ${Y}`);return Y+$}var _1=null,nX=!1,w1=null,e7="",c5=!1,oY=256,I1,W1,p1=null,rX=null;var X8=y(()=>{o6();y7();t6();I1=new Map,W1=new Map});function XG(){return`
11565
11565
  // STX Lifecycle Runtime
11566
11566
  (function() {
11567
11567
  if (typeof window === 'undefined') return;
@@ -12064,10 +12064,10 @@ else {
12064
12064
  }
12065
12065
  })();
12066
12066
  </script>
12067
- `,J}function GG($){let{html:X,bindings:Z,stores:J}=AB($);if(Z.length===0)return $;let Y=RB(Z,J),G=X.lastIndexOf("</body>");if(G!==-1)return X.slice(0,G)+Y+X.slice(G);return X+Y}var QG=()=>{};function NB($){let X=$.analytics;if(!X?.enabled)return"";switch(X.driver){case"fathom":return MB(X);case"google-analytics":return TB(X);case"plausible":return kB(X);case"self-hosted":return IB(X);case"custom":return EB(X);default:return""}}function MB($){let X=$.fathom;if(!X?.siteId)return"";let Z=X.scriptUrl||"https://cdn.usefathom.com/script.js",J=X.defer!==!1?" defer":"",Y=[`data-site="${a0(X.siteId)}"`];if(X.honorDnt)Y.push('data-honor-dnt="true"');if(X.spa)Y.push('data-spa="auto"');if(X.canonical)Y.push(`data-canonical="${a0(X.canonical)}"`);if(X.auto===!1)Y.push('data-auto="false"');return`
12067
+ `,J}function GG($){let{html:X,bindings:Z,stores:J}=AB($);if(Z.length===0)return $;let Y=RB(Z,J),G=X.lastIndexOf("</body>");if(G!==-1)return X.slice(0,G)+Y+X.slice(G);return X+Y}var QG=()=>{};function NB($){let X=$.analytics;if(!X?.enabled)return"";switch(X.driver){case"fathom":return MB(X);case"google-analytics":return TB(X);case"plausible":return kB(X);case"self-hosted":return IB(X);case"custom":return EB(X);default:return""}}function MB($){let X=$.fathom;if(!X?.siteId)return"";let Z=X.scriptUrl||"https://cdn.usefathom.com/script.js",J=X.defer!==!1?" defer":"",Y=[`data-site="${s0(X.siteId)}"`];if(X.honorDnt)Y.push('data-honor-dnt="true"');if(X.spa)Y.push('data-spa="auto"');if(X.canonical)Y.push(`data-canonical="${s0(X.canonical)}"`);if(X.auto===!1)Y.push('data-auto="false"');return`
12068
12068
  <!-- Fathom Analytics -->
12069
- <script src="${a0(Z)}" ${Y.join(" ")}${J}></script>
12070
- `}function TB($){let X=$.googleAnalytics;if(!X?.measurementId)return"";let Z=a0(X.measurementId),J=X.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
12069
+ <script src="${s0(Z)}" ${Y.join(" ")}${J}></script>
12070
+ `}function TB($){let X=$.googleAnalytics;if(!X?.measurementId)return"";let Z=s0(X.measurementId),J=X.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
12071
12071
  <!-- Google Analytics -->
12072
12072
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Z}"></script>
12073
12073
  <script>
@@ -12077,10 +12077,10 @@ else {
12077
12077
  gtag('config', '${Z}');
12078
12078
  ${J}
12079
12079
  </script>
12080
- `}function kB($){let X=$.plausible;if(!X?.domain)return"";let Z=X.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${a0(X.domain)}"`],Y=Z,G=[];if(X.trackLocalhost)G.push("local");if(X.hashMode)G.push("hash");if(G.length>0&&Z==="https://plausible.io/js/script.js")Y=`https://plausible.io/js/script.${G.join(".")}.js`;return`
12080
+ `}function kB($){let X=$.plausible;if(!X?.domain)return"";let Z=X.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${s0(X.domain)}"`],Y=Z,G=[];if(X.trackLocalhost)G.push("local");if(X.hashMode)G.push("hash");if(G.length>0&&Z==="https://plausible.io/js/script.js")Y=`https://plausible.io/js/script.${G.join(".")}.js`;return`
12081
12081
  <!-- Plausible Analytics -->
12082
- <script defer data-domain="${a0(X.domain)}" src="${a0(Y)}"></script>
12083
- `}function IB($){let X=$.selfHosted;if(!X?.siteId||!X?.apiEndpoint)return"";let Z=a0(X.siteId),J=a0(X.apiEndpoint),Y=X.honorDnt?'if(n.doNotTrack==="1")return;':"",G=X.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=X.trackOutboundLinks?`
12082
+ <script defer data-domain="${s0(X.domain)}" src="${s0(Y)}"></script>
12083
+ `}function IB($){let X=$.selfHosted;if(!X?.siteId||!X?.apiEndpoint)return"";let Z=s0(X.siteId),J=s0(X.apiEndpoint),Y=X.honorDnt?'if(n.doNotTrack==="1")return;':"",G=X.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=X.trackOutboundLinks?`
12084
12084
  d.addEventListener('click',function(e){
12085
12085
  var a=e.target.closest('a');
12086
12086
  if(a&&a.hostname!==location.hostname){
@@ -12118,10 +12118,10 @@ else {
12118
12118
  <script>
12119
12119
  ${X.inlineScript}
12120
12120
  </script>
12121
- `;if(!X.scriptUrl)return"";let Z=[];if(X.scriptId)Z.push(`id="${a0(X.scriptId)}"`);if(X.attributes)for(let[Y,G]of Object.entries(X.attributes))Z.push(`${a0(Y)}="${a0(G)}"`);return`
12121
+ `;if(!X.scriptUrl)return"";let Z=[];if(X.scriptId)Z.push(`id="${s0(X.scriptId)}"`);if(X.attributes)for(let[Y,G]of Object.entries(X.attributes))Z.push(`${s0(Y)}="${s0(G)}"`);return`
12122
12122
  <!-- Custom Analytics -->
12123
- <script${Z.length>0?` ${Z.join(" ")}`:""} src="${a0(X.scriptUrl)}" defer></script>
12124
- `}function WG($,X){let Z=NB(X);if(!Z)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+$.slice(J);return $+Z}return $.replace("</head>",`${Z}</head>`)}function a0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var wG=()=>{};function X9($){let X=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!X)return null;try{return Function(`return ${X[1]}`)()}catch{return null}}function qG($){let X=$?.layout;if(X===!1)return!1;return typeof X==="string"&&X.trim()?X.trim():void 0}function KG($,X){let Z=$.match(new RegExp(`${X}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let J=$.match(new RegExp(`${X}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function bB($){let X=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Z.exec($))!==null){let[Y,G,Q]=J,W=J.index,w=KG(Q,"x-data");if(!w)continue;let q=`__stx_scope_${DB++}`,K=KG(Q,"x-init"),z=SB($,G,W+Y.length),U=$.slice(W,z.endIndex),j=CB(U);X.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:w,initExpr:K,bindings:[],refs:j})}return X}function SB($,X,Z){let J=1,Y=Z,G=new RegExp(`<${X}(?:\\s|>)`,"gi"),Q=new RegExp(`</${X}>`,"gi"),W=new RegExp(`<${X}[^>]*/\\s*>`,"gi");while(J>0&&Y<$.length){G.lastIndex=Y,Q.lastIndex=Y,W.lastIndex=Y;let w=G.exec($),q=Q.exec($),K=W.exec($);if(K&&K.index<(w?.index??1/0)){Y=K.index+K[0].length;continue}if(!q)return{endIndex:$.length};if(w&&w.index<q.index)J++,Y=w.index+w[0].length;else{if(J--,J===0)return{endIndex:q.index+q[0].length};Y=q.index+q[0].length}}return{endIndex:$.length}}function CB($){let X=new Map,Z=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Y;while((Y=J.exec(Z))!==null){let[,G,Q]=Y,W=PB(G);X.set(Q,W)}return X}function PB($){let X=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(X)return X[1];return`__stx_el_${yB++}`}function vB(){return`
12123
+ <script${Z.length>0?` ${Z.join(" ")}`:""} src="${s0(X.scriptUrl)}" defer></script>
12124
+ `}function WG($,X){let Z=NB(X);if(!Z)return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+$.slice(J);return $+Z}return $.replace("</head>",`${Z}</head>`)}function s0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var wG=()=>{};function X9($){let X=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!X)return null;try{return Function(`return ${X[1]}`)()}catch{return null}}function qG($){let X=$?.layout;if(X===!1)return!1;return typeof X==="string"&&X.trim()?X.trim():void 0}function KG($,X){let Z=$.match(new RegExp(`${X}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let J=$.match(new RegExp(`${X}\\s*=\\s*'([^']*)'`,"i"));if(J)return J[1];return null}function bB($){let X=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,J;while((J=Z.exec($))!==null){let[Y,G,Q]=J,W=J.index,w=KG(Q,"x-data");if(!w)continue;let q=`__stx_scope_${DB++}`,K=KG(Q,"x-init"),z=SB($,G,W+Y.length),U=$.slice(W,z.endIndex),j=CB(U);X.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:w,initExpr:K,bindings:[],refs:j})}return X}function SB($,X,Z){let J=1,Y=Z,G=new RegExp(`<${X}(?:\\s|>)`,"gi"),Q=new RegExp(`</${X}>`,"gi"),W=new RegExp(`<${X}[^>]*/\\s*>`,"gi");while(J>0&&Y<$.length){G.lastIndex=Y,Q.lastIndex=Y,W.lastIndex=Y;let w=G.exec($),q=Q.exec($),K=W.exec($);if(K&&K.index<(w?.index??1/0)){Y=K.index+K[0].length;continue}if(!q)return{endIndex:$.length};if(w&&w.index<q.index)J++,Y=w.index+w[0].length;else{if(J--,J===0)return{endIndex:q.index+q[0].length};Y=q.index+q[0].length}}return{endIndex:$.length}}function CB($){let X=new Map,Z=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),J=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,Y;while((Y=J.exec(Z))!==null){let[,G,Q]=Y,W=PB(G);X.set(Q,W)}return X}function PB($){let X=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(X)return X[1];return`__stx_el_${yB++}`}function vB(){return`
12125
12125
  // STX Reactive Runtime - x-cloak and transition CSS
12126
12126
  (function() {
12127
12127
  var style = document.createElement('style');
@@ -12328,7 +12328,7 @@ window.__stx_reactive = (function() {
12328
12328
 
12329
12329
  return { initScope: initScope, reactive: reactive };
12330
12330
  })();
12331
- `}function zG($,X){let Z=$.replace(/\{!!([\s\S]*?)!!\}/g,(W,w)=>{try{let q=n0(w,X,!0);if(q===void 0)return W;return String(q)}catch{return W}}),J="",Y=0,G=null;while(Y<Z.length){let W=Z[Y];if(G&&W==="\\"){J+=W+(Z[Y+1]??""),Y+=2;continue}if(W==="{"&&Z[Y+1]==="{"){let w=Z.indexOf("}}",Y+2);if(w!==-1){let q=Z.slice(Y,w+2);J+=Q(Z.slice(Y+2,w),q,G),Y=w+2;continue}}if(G){if(W===G)G=null}else if(W==="'"||W==='"'||W==="`")G=W;J+=W,Y++}return J;function Q(W,w,q){let K;try{K=n0(W,X,!0)}catch{return w}if(K===void 0)return w;if(q){let z=String(K).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?z.replace(/\$\{/g,"\\${"):z}if(typeof K==="string"){let z=K.trim();if(z.startsWith("{")&&z.endsWith("}")||z.startsWith("[")&&z.endsWith("]"))try{return JSON.parse(z),z}catch{}}return JSON.stringify(K)}}function xB($,X){if($.length===0)return"";let Z=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),G=zG(J.stateExpr,X),Q=J.initExpr?zG(J.initExpr,X):null,W=JSON.stringify(G),w=Q?JSON.stringify(Q):"null";return`
12331
+ `}function zG($,X){let Z=$.replace(/\{!!([\s\S]*?)!!\}/g,(W,w)=>{try{let q=p0(w,X,!0);if(q===void 0)return W;return String(q)}catch{return W}}),J="",Y=0,G=null;while(Y<Z.length){let W=Z[Y];if(G&&W==="\\"){J+=W+(Z[Y+1]??""),Y+=2;continue}if(W==="{"&&Z[Y+1]==="{"){let w=Z.indexOf("}}",Y+2);if(w!==-1){let q=Z.slice(Y,w+2);J+=Q(Z.slice(Y+2,w),q,G),Y=w+2;continue}}if(G){if(W===G)G=null}else if(W==="'"||W==='"'||W==="`")G=W;J+=W,Y++}return J;function Q(W,w,q){let K;try{K=p0(W,X,!0)}catch{return w}if(K===void 0)return w;if(q){let z=String(K).replace(/\\/g,"\\\\").replace(new RegExp(q==="`"?"`":q,"g"),`\\${q}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return q==="`"?z.replace(/\$\{/g,"\\${"):z}if(typeof K==="string"){let z=K.trim();if(z.startsWith("{")&&z.endsWith("}")||z.startsWith("[")&&z.endsWith("]"))try{return JSON.parse(z),z}catch{}}return JSON.stringify(K)}}function xB($,X){if($.length===0)return"";let Z=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),G=zG(J.stateExpr,X),Q=J.initExpr?zG(J.initExpr,X):null,W=JSON.stringify(G),w=Q?JSON.stringify(Q):"null";return`
12332
12332
  (function() {
12333
12333
  var scopeEl = document.querySelector('${J.selector}');
12334
12334
  if (!scopeEl) return;
@@ -12340,13 +12340,13 @@ window.__stx_reactive = (function() {
12340
12340
  ${vB()}
12341
12341
  ${Z}
12342
12342
  </script>`}function UG($,X,Z){if(!gB($))return $;let J=bB($);if(J.length===0)return $;let Y=fB($,J),G=xB(J,X),Q=Y.lastIndexOf("</body>");if(Q!==-1)Y=Y.slice(0,Q)+G+`
12343
- `+Y.slice(Q);else Y+=G;return Y}function fB($,X){let Z=0,J=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,G,Q)=>{let W=X[Z++];if(!W)return Y;let w=/data-stx-scope="([^"]*)"/.exec(Q);if(w)return W.id=w[1],W.selector=`[data-stx-scope="${W.id}"]`,Y;return`<${G} data-stx-scope="${W.id}"${Q}>`});return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),J=J.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),J}function gB($){return/x-data\s*=\s*["']/.test($)}var DB=0,yB=0;var jG=y(()=>{B1()});import hB from"fs";import eX from"path";import{createHighlighter as uB}from"ts-syntax-highlighter";async function dB($,X={}){try{if(!await o($))throw Error(`Markdown file not found: ${$}`);let J=(await hB.promises.stat($)).mtime.getTime();if(X.cache&&$3.has($)){let z=$3.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let Y=await Bun.file($).text(),{data:G,content:Q}=B2(Y),W=X.markdown||P7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=b7(Q,{gfm:!0});if(W.syntaxHighlighting?.enabled&&W.syntaxHighlighting?.serverSide)q=await mB(q,W.syntaxHighlighting?.defaultTheme||"github-dark",W.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:q,data:G||{}};if(X.cache)$3.set($,{...K,updatedAt:J});return K}catch(Z){if(X.debug)console.error(`Error reading/parsing markdown file ${$}:`,Z);let J=Z instanceof Error?Z.message:String(Z);return{content:_0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function mB($,X,Z){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Z9)try{Z9=await uB({theme:X||"github-dark",cache:!0})}catch(W){return console.error("Failed to initialize ts-syntax-highlighter:",W),$}let Y=async(W,w,q,K)=>{let z=K.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=q||(Z?"text":"");if(!U)return W;try{if(!Z9.getSupportedLanguages().includes(U))return W;return(await Z9.highlight(z,U,{theme:X})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return W},G=$,Q=$.matchAll(J);for(let W of Q){let[w,q,K,z]=W,U=await Y(w,q,K,z);G=G.replace(w,U)}return G}async function BG($,X,Z="",J={}){return await cB($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,W,w,q)=>{try{let K=W;if(!eX.isAbsolute(W))K=eX.resolve(eX.dirname(Z),W);let z={};if(w)try{try{z=JSON.parse(w)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=w.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),k=R.startsWith("'")&&R.endsWith("'");if(N||k)R=R.substring(1,R.length-1);z[A]=R}}}}catch(L){if(J.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:U,data:j}=await dB(K,J),B={...X,...j,...z},H=U,_=/\{\{([^}]+)\}\}/g;return H=H.replace(_,(L,O)=>{let F=O.trim();return B[F]!==void 0?String(B[F]):L}),H}catch(K){let z=K instanceof Error?K.message:String(K);return _0("Markdown File",`Error including markdown file: ${z}`,Z,$,q,Q)}})}async function cB($,X,Z){let J=[],Y;while((Y=X.exec($))!==null){let W=Y[0],w=Y.index,q=Y;J.push(Z(...q).then((K)=>({match:W,replacement:K,index:w})))}let G=await Promise.all(J);G.sort((W,w)=>w.index-W.index);let Q=$;for(let{match:W,replacement:w}of G)Q=Q.replace(W,()=>w);return Q}var $3,Z9=null;var HG=y(()=>{M1();V0();$3=new Map});function p1($,X){try{let Z=$.trim();if(K0(Z))return z0(Z,Object.keys(X))(...Object.values(X));else return Q0(Z,X)}catch{return!1}}var _G=y(()=>{b0()});function lB($,X,Z){let J=$,Y=!0;while(Y){Y=!1;let G=J.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,W=C4(J,Q);if(!W)break;try{let w;if(K0(W.expression))w=z0(W.expression,Object.keys(X))(...Object.values(X));else w=Q0(W.expression,X);let q="",K=!1;for(let z of W.cases)if(z.type==="default"){if(!K)q=z.content.trim()}else try{let U;if(z.value&&K0(z.value))U=z0(z.value,Object.keys(X))(...Object.values(X));else if(z.value)U=Q0(z.value,X);if(w===U){q=z.content.trim(),K=!0;break}}catch{continue}J=J.substring(0,Q)+q+J.substring(W.end),Y=!0}catch(w){let q=w instanceof Error?w.message:String(w),K=J0("Switch",`Error evaluating @switch expression: ${q}`,s.EVALUATION_ERROR);J=J.substring(0,Q)+K+J.substring(W.end);break}}return J}function pB($){let X=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return X.push(J),`\x00stx-script-${X.length-1}\x00`}),scripts:X}}function iB($,X){if(X.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,J)=>X[Number(J)]??Z)}function E1($,X,Z){let{masked:J,scripts:Y}=pB($);return iB(nB(J,X,Z),Y)}function nB($,X,Z){let J=$;J=lB(J,X,Z);{let G=!0;while(G){G=!1;let Q=J.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let W=Q.index,w=d1(J,W+7);if(!w)break;let q=w.endPos,K=Q5(J,"unless","endunless",q);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 z=J.slice(q,K),U=w.expression,j=-1;{let H=0,_=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],V;while((V=_.exec(z))!==null)F.push({pos:V.index,type:"open"});while((V=L.exec(z))!==null)F.push({pos:V.index,type:"close"});while((V=O.exec(z))!==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")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){j=A.pos;break}}let B;if(j!==-1){let H=z.slice(0,j),_=z.slice(j+5);B=`@if (${U})${_}@else ${H}@endif`}else B=`@if (!(${U}))${z}@endif`;J=J.substring(0,W)+B+J.substring(K+10),G=!0}}J=Z3(J,X,Z),J=J3(J,X,Z),J=X3(J,X);let Y=()=>{let G=l7(J);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let W=G[Q];try{let w="",q=!1;for(let K of W.branches){if(q)break;if(K.type==="else")w=K.content,q=!0;else try{let z;if(K.condition&&K0(K.condition))z=z0(K.condition,Object.keys(X))(...Object.values(X));else if(K.condition)z=Q0(K.condition,X);if(z)w=K.content,q=!0}catch(z){w=J0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,s.EVALUATION_ERROR),q=!0}}J=J.substring(0,W.start)+w+J.substring(W.end)}catch(w){let q=w instanceof Error?w.message:String(w),K=J0("If",`Error processing @if block: ${q}`,s.EVALUATION_ERROR);J=J.substring(0,W.start)+K+J.substring(W.end)}}return!0};while(!0){let G=J;if(!Y())break;if(J===G)break}return J}function OG($){let X=0;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;X++;while(X<$.length&&/\s/.test($[X]))X++;let Z=$[X];if(Z!=="'"&&Z!=='"')return null;X++;let J=[];while(X<$.length){let Y=$[X];if(Y==="\\"&&X+1<$.length){J.push($[X+1]),X+=2;continue}if(Y===Z){X++;break}J.push(Y),X++}while(X<$.length&&/\s/.test($[X]))X++;if($[X]!==")")return null;return X++,{value:J.join(""),consumed:X}}function X3($,X){let Z=$;function J(W,w,q,K){let z=1,U=K,j=new RegExp(`@${w}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(U<W.length&&z>0){j.lastIndex=U,B.lastIndex=U;let H=j.exec(W),_=B.exec(W),L=H?H.index:1/0,O=_?_.index:1/0;if(L<O)z++,U=L+H[0].length;else if(O<1/0){if(z--,z===0)return O;U=O+_[0].length}else break}return-1}function Y(W,w,q){let K=0,z=new RegExp(`@${w}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],H;while((H=z.exec(W))!==null)B.push({pos:H.index,type:"open"});while((H=U.exec(W))!==null)B.push({pos:H.index,type:"close"});while((H=j.exec(W))!==null)B.push({pos:H.index,type:"else"});B.sort((_,L)=>_.pos-L.pos);for(let _ of B)if(_.type==="open")K++;else if(_.type==="close")K--;else if(_.type==="else"&&K===0)return _.pos;return-1}{let W=!0;while(W){W=!1;let w=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!w||w.index===void 0)break;let q=w.index,K,z,U=Z.slice(q+5),j=OG(U);if(j)K=j.value,z=q+5+j.consumed;else z=q+5;let B=J(Z,"auth","endauth",z);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let H=Z.slice(z,B),_=Y(H,"auth","endauth"),L;if(!X.auth)L=!1;else L=K?p1(`auth?.check && auth?.user?.[${K}]`,X):p1("auth?.check",X);let O;if(_!==-1){let F=H.slice(0,_),V=H.slice(_+5);O=L?F:V}else O=L?H:"";Z=Z.substring(0,q)+O+Z.substring(B+8),W=!0}}{let W=!0;while(W){W=!1;let w=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!w||w.index===void 0)break;let q=w.index,K,z,U=Z.slice(q+6),j=OG(U);if(j)K=j.value,z=q+6+j.consumed;else z=q+6;let B=J(Z,"guest","endguest",z);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let H=Z.slice(z,B),_=Y(H,"guest","endguest"),L;if(!X.auth)L=!0;else L=K?p1(`!auth?.check || !auth?.user?.[${K}]`,X):p1("!auth?.check",X);let O;if(_!==-1){let F=H.slice(0,_),V=H.slice(_+5);O=L?F:V}else O=L?H:"";Z=Z.substring(0,q)+O+Z.substring(B+9),W=!0}}function G(W,w,q){if(X.userCan&&typeof X.userCan[W]==="boolean")return X.userCan[W];if(X.permissions?.check&&typeof X.permissions.check==="function")try{let K=[W];if(w)K.push(w);if(q){let z=p1(q,X);K.push(z)}return X.permissions.check(...K)}catch{return!1}return!1}function Q(W){let w=W.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!w)return null;return{ability:w[1],type:w[2],id:w[3]?.trim(),paramsEnd:w[0].length}}for(let W of["can","cannot"]){let w=`end${W}`,q=W==="can"?"elsecan":"elsecannot",K=!0;while(K){K=!1;let z=Z.match(new RegExp(`@${W}\\s*\\(`));if(!z||z.index===void 0)break;let U=z.index,j=Z.slice(U+`@${W}`.length),B=Q(j);if(!B)break;let H=U+`@${W}`.length+B.paramsEnd,_=J(Z,W,w,H);if(_===-1){console.warn(`[stx] @${W} directive at position ${U} has no matching @${w} \u2014 the block was skipped.`);break}let L=Z.slice(H,_),O=[],F=0,V=new RegExp(`@${W}\\s*\\(`,"g"),A=new RegExp(`@${w}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),N=/@else(?![a-z])/g,k=[],I;while((I=V.exec(L))!==null)k.push({pos:I.index,type:"open"});while((I=A.exec(L))!==null)k.push({pos:I.index,type:"close"});while((I=R.exec(L))!==null)k.push({pos:I.index,type:"elseDirective"});while((I=N.exec(L))!==null)k.push({pos:I.index,type:"else"});k.sort((S,P)=>S.pos-P.pos);for(let S of k){if(S.type==="open"){F++;continue}if(S.type==="close"){F--;continue}if(F===0)O.push(S)}let M=[],E=0;for(let S=0;S<O.length;S++){let P=O[S];if(M.push({content:L.slice(E,P.pos),ability:void 0}),P.type==="elseDirective"){let v=L.slice(P.pos+`@${q}`.length),x=Q(v);if(x){M[M.length-1]={content:L.slice(E,P.pos)},E=P.pos+`@${q}`.length+x.paramsEnd,M.push({content:"",ability:x.ability,type:x.type,id:x.id}),M.pop();let i=O[S+1],m=i?i.pos:L.length;M.push({content:L.slice(E,m),ability:x.ability,type:x.type,id:x.id}),E=m}}else E=P.pos+5}if(E<L.length){let S=M[M.length-1];if(O.length>0&&O[O.length-1].type==="else")M.push({content:L.slice(E),isFinalElse:!0});else if(M.length===0)M.push({content:L.slice(E)})}let T=G(B.ability,B.type,B.id),D=W==="can"?T:!T,b="";if(D)b=M[0]?.content||"";else{let S=!1;for(let P=1;P<M.length;P++){let v=M[P];if(v.isFinalElse){b=v.content,S=!0;break}if(v.ability){let x=G(v.ability,v.type,v.id);if(W==="can"?x:!x){b=v.content,S=!0;break}}}if(!S&&M.length>0){let P=M[M.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,U)+b+Z.substring(_+`@${w}`.length),K=!0}}return Z}function Z3($,X,Z){let J=$;function Y(G,Q,W,w,q){let K=!0;while(K){K=!1;let z=new RegExp(`@${Q}\\s*\\(`),U=G.match(z);if(!U||U.index===void 0)break;let j=U.index,B=d1(G,j+`@${Q}`.length);if(!B)break;let H=B.endPos,_=Q5(G,Q,W,H);if(_===-1){console.warn(`[stx] @${Q} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let L=G.slice(H,_),O=B.expression,F=-1,V=0,A=0;while(A<L.length){let R=L.indexOf("@",A);if(R===-1)break;let N=L.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(N)){F=R;break}A=R+1}try{let R=w(O.trim()),N;if(F!==-1){let k=L.slice(0,F),I=L.slice(F+5);N=R?k:I}else N=R?L:"";G=G.substring(0,j)+N+G.substring(_+`@${W}`.length),K=!0}catch(R){let N=R instanceof Error?R.message:String(R),k=J0(q,`Error processing @${Q} directive: ${N}`,s.EVALUATION_ERROR);G=G.substring(0,j)+k+G.substring(_+`@${W}`.length);break}}return G}return J=Y(J,"isset","endisset",(G)=>{let Q=p1(G,X);return Q!==void 0&&Q!==null},"Isset"),J=Y(J,"empty","endempty",(G)=>{let Q=p1(G,X);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"),J}function J3($,X,Z){let J=$,Y="development";function G(Q,W,w,q){let K=new RegExp(`@${W}(?![a-z])`,"g"),z=new RegExp(`@${w}(?![a-z])`,"g"),U=new RegExp(`^@${W}(?![a-z])`),j=new RegExp(`^@${w}(?![a-z])`),B=Q,H=!0;while(H){H=!1,K.lastIndex=0;let _=K.exec(B);if(!_)break;let L=_.index,O=L+_[0].length;if(W==="env"){let T=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!T)break;O+=T[0].length,q=Y===T[2]}let F=1,V=O,A=-1;while(F>0&&V<B.length){K.lastIndex=V,z.lastIndex=V;let T=K.exec(B),D=z.exec(B),b=T?T.index:1/0,S=D?D.index:1/0;if(b<S)F++,V=b+T[0].length;else if(S<1/0){if(F--,F===0){A=S;break}V=S+D[0].length}else break}if(A===-1){console.warn(`[stx] @${W} directive at position ${L} has no matching @${w} \u2014 the block was skipped.`);break}let R=B.substring(O,A),N=-1,k=0,I=0;while(I<R.length){let T=R.indexOf("@",I);if(T===-1)break;let D=R.substring(T);if(U.test(D)){k++,I=T+1;continue}if(j.test(D)){k--,I=T+1;continue}if(k===0&&/^@else(?![a-z])/.test(D)){N=T;break}I=T+1}let M;if(N!==-1){let T=R.slice(0,N),D=R.slice(N+5);M=q?T:D}else M=q?R:"";let E=`@${w}`.length;B=B.substring(0,L)+M+B.substring(A+E),H=!0}return B}return J=G(J,"env","endenv",!1),J=G(J,"production","endproduction",Y==="production"),J=G(J,"development","enddevelopment",Y==="development"),J=G(J,"staging","endstaging",Y==="staging"),J=G(J,"testing","endtesting",Y==="testing"),J}var Z8=y(()=>{_G();k1();s8();b0()});function FG($=16){let X=new Uint8Array($);return crypto.getRandomValues(X),btoa(String.fromCharCode(...X))}function J9($,X){if(!$)return X?.nonceGenerator?.()??FG();let Z=LG.get($);if(!Z)Z=X?.nonceGenerator?.()??FG(),LG.set($,Z);return Z}function rB($,X){let Z=[];for(let[J,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)Z.push(J);continue}if(Array.isArray(Y)){let G=[...Y];if(X&&(J==="script-src"||J==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${X}'`);if(G.length>0)Z.push(`${J} ${G.join(" ")}`)}}return Z.join("; ")}function VG($,X){return`<meta http-equiv="Content-Security-Policy" content="${rB($,X).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function AG($,X,Z){if(!X.enabled||!X.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=X.useNonce?J9(Z,X):void 0,Y=VG(X.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
12344
- ${Y}`)}function RG($,X){let Z=$;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<script nonce="${X}"${Y}>`}),Z=Z.replace(/<style([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<style nonce="${X}"${Y}>`}),Z}function NG($,X,Z,J){let Y=$,G=J.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?J9(X,G):void 0;return VG(G.directives,Q)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return J9(X,G)}),G?.enabled&&G.useNonce)X.cspNonce=J9(X,G);return Y}var LG;var MG=y(()=>{LG=new WeakMap});import oB from"crypto";function aB($=sB){let X=oB.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return Y3=X,X}function tB(){if(!Y3)aB();return Y3}function eB($=TG){let X=tB();return`<input type="hidden" name="${$}" value="${X}">`}function kG($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(X,Z,J)=>{return eB(J||TG)})}var sB=40,TG="_token",Y3=null;var IG=()=>{};async function EG($,X,Z,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Y=$;for(let G of J.customDirectives){if(!G.name||typeof G.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)Y=await $H(Y,G,X,Z,J);else Y=await XH(Y,G,X,Z,J)}return Y}async function $H($,X,Z,J,Y){let{name:G,handler:Q}=X,W=`@${G}`,w=`@end${G}`,q=$,K=v5(`${W}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${w}`,"g"),z=[],U=K.exec(q);while(U!==null){let[j,B="",H=""]=U,_=U.index||0;try{let L=B?DG(B):[],O=H.trim(),F=await Q(O,L,Z,J);z.push({original:j,processed:F,startIndex:_})}catch(L){let O=L instanceof Error?L.message:String(L);if(Y.debug)console.error(`Error processing custom directive @${G}:`,L);z.push({original:j,processed:J0("CustomDirective",`Error in @${G}${B?`(${B})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:_})}U=K.exec(q)}for(let j=z.length-1;j>=0;j--){let{original:B,processed:H}=z[j];q=q.replace(B,H)}return q}async function XH($,X,Z,J,Y){let{name:G,handler:Q}=X,W=$,w=v5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],K=w.exec(W);while(K!==null){let[j,B=""]=K,H=K.index||0;try{let _=DG(B),L=await Q("",_,Z,J);q.push({original:j,processed:L,startIndex:H})}catch(_){let L=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${G}:`,_);q.push({original:j,processed:J0("CustomDirective",`Error in @${G}(${B}): ${L}`,s.EVALUATION_ERROR),startIndex:H})}K=w.exec(W)}let z=v5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),U=z.exec(W);while(U!==null){let[j]=U,B=U.index||0;try{let H=await Q("",[],Z,J);q.push({original:j,processed:H,startIndex:B})}catch(H){let _=H instanceof Error?H.message:String(H);if(Y.debug)console.error(`Error processing custom directive @${G}:`,H);q.push({original:j,processed:J0("CustomDirective",`Error in @${G}: ${_}`,s.EVALUATION_ERROR),startIndex:B})}U=z.exec(W)}for(let j=q.length-1;j>=0;j--){let{original:B,processed:H}=q[j];W=W.replace(B,H)}return W}function DG($){if(!$.trim())return[];let X=[],Z="",J=!1,Y="";for(let G=0;G<$.length;G++){let Q=$[G];if((Q==='"'||Q==="'")&&(G===0||$[G-1]!=="\\"))if(!J)J=!0,Y=Q;else if(Q===Y)J=!1;else Z+=Q;else if(Q===","&&!J)X.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())X.push(Z.trim());return X.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 yG=y(()=>{k1();x5()});function B5($,X){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${X} must be a non-empty string`)}function JH($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let X=$,Z=X.appearance,J=X.colorMode;if(B5(X.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(B5(Z.key,"appearance.key"),B5(Z.attribute,"appearance.attribute"),B5(Z.default,"appearance.default"),B5(J.key,"colorMode.key"),B5(J.attribute,"colorMode.attribute"),B5(J.default,"colorMode.default"),!SG.test(Z.key)||!SG.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!bG.test(Z.attribute)||!bG.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((Y)=>typeof Y!=="string"||Y.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(!ZH.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:X.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function YH($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function GH($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${YH($)};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 QH($,X){let Z=1,J=null,Y=!1;for(let G=X+1;G<$.length;G++){let Q=$[G];if(Y){Y=!1;continue}if(J){if(Q==="\\")Y=!0;else if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function CG($,X){let Z=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,Q=QH(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let W=Z.slice(G+1,Q).trim(),w=Q0(`(${W})`,X),q=GH(JH(w));Z=Z.slice(0,Y.index)+q+Z.slice(Q+1),J.lastIndex=Y.index+q.length}return Z}var bG,SG,ZH;var PG=y(()=>{b0();bG=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,SG=/^[A-Za-z_$][\w$]*$/,ZH=new Set(["light","dark","system"])});import WH from"crypto";function T0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Y9($,X,Z,J){let Y=$||X;return Z?`${Y} ${J}`:Y}function $1($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function p5($,X){if(/\bid\s*=/i.test($))return"";return` id="${T0(X)}"`}function G3($,X,Z){if(!X)return"";let J="";if(!/\baria-invalid\s*=/i.test(Z))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))J+=` aria-describedby="${T0(`${$1($)}-error`)}"`;return J}function wH(){return WH.randomUUID()}function G9($,X){let Z=$;return Z=Z.replace(/@csrf/g,()=>{if(!X.csrf||typeof X.csrf!=="object"){let J=wH();X.csrf={token:J}}if(X.csrf.field)return X.csrf.field;if(X.csrf.token)return`<input type="hidden" name="_token" value="${T0(X.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Y)=>{let G=Y.toUpperCase();if(Y&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${T0(G)}">`;return J}),Z}function fG($,X,Z=xG){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,G,Q,W,w,q="")=>{let K=G||Q||"POST",z=W||w||"",U=i1(q),j=K.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",H=`<form method="${T0(B)}" action="${T0(z)}"${U?` ${U}`:""}>`;if(H+=`
12343
+ `+Y.slice(Q);else Y+=G;return Y}function fB($,X){let Z=0,J=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(Y,G,Q)=>{let W=X[Z++];if(!W)return Y;let w=/data-stx-scope="([^"]*)"/.exec(Q);if(w)return W.id=w[1],W.selector=`[data-stx-scope="${W.id}"]`,Y;return`<${G} data-stx-scope="${W.id}"${Q}>`});return J=J.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),J=J.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),J=J.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),J=J.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),J}function gB($){return/x-data\s*=\s*["']/.test($)}var DB=0,yB=0;var jG=y(()=>{j1()});import hB from"fs";import eX from"path";import{createHighlighter as uB}from"ts-syntax-highlighter";async function dB($,X={}){try{if(!await o($))throw Error(`Markdown file not found: ${$}`);let J=(await hB.promises.stat($)).mtime.getTime();if(X.cache&&$3.has($)){let z=$3.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let Y=await Bun.file($).text(),{data:G,content:Q}=B2(Y),W=X.markdown||P7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=b7(Q,{gfm:!0});if(W.syntaxHighlighting?.enabled&&W.syntaxHighlighting?.serverSide)q=await mB(q,W.syntaxHighlighting?.defaultTheme||"github-dark",W.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:q,data:G||{}};if(X.cache)$3.set($,{...K,updatedAt:J});return K}catch(Z){if(X.debug)console.error(`Error reading/parsing markdown file ${$}:`,Z);let J=Z instanceof Error?Z.message:String(Z);return{content:H0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function mB($,X,Z){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!Z9)try{Z9=await uB({theme:X||"github-dark",cache:!0})}catch(W){return console.error("Failed to initialize ts-syntax-highlighter:",W),$}let Y=async(W,w,q,K)=>{let z=K.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=q||(Z?"text":"");if(!U)return W;try{if(!Z9.getSupportedLanguages().includes(U))return W;return(await Z9.highlight(z,U,{theme:X})).html}catch(j){console.error(`Error highlighting code block with language ${q}:`,j)}return W},G=$,Q=$.matchAll(J);for(let W of Q){let[w,q,K,z]=W,U=await Y(w,q,K,z);G=G.replace(w,U)}return G}async function BG($,X,Z="",J={}){return await cB($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,W,w,q)=>{try{let K=W;if(!eX.isAbsolute(W))K=eX.resolve(eX.dirname(Z),W);let z={};if(w)try{try{z=JSON.parse(w)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=w.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),k=R.startsWith("'")&&R.endsWith("'");if(N||k)R=R.substring(1,R.length-1);z[A]=R}}}}catch(L){if(J.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:U,data:j}=await dB(K,J),B={...X,...j,...z},H=U,_=/\{\{([^}]+)\}\}/g;return H=H.replace(_,(L,O)=>{let F=O.trim();return B[F]!==void 0?String(B[F]):L}),H}catch(K){let z=K instanceof Error?K.message:String(K);return H0("Markdown File",`Error including markdown file: ${z}`,Z,$,q,Q)}})}async function cB($,X,Z){let J=[],Y;while((Y=X.exec($))!==null){let W=Y[0],w=Y.index,q=Y;J.push(Z(...q).then((K)=>({match:W,replacement:K,index:w})))}let G=await Promise.all(J);G.sort((W,w)=>w.index-W.index);let Q=$;for(let{match:W,replacement:w}of G)Q=Q.replace(W,()=>w);return Q}var $3,Z9=null;var HG=y(()=>{M1();F0();$3=new Map});function i1($,X){try{let Z=$.trim();if(U0(Z))return j0(Z,Object.keys(X))(...Object.values(X));else return W0(Z,X)}catch{return!1}}var _G=y(()=>{D0()});function lB($,X,Z){let J=$,Y=!0;while(Y){Y=!1;let G=J.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,W=C4(J,Q);if(!W)break;try{let w;if(U0(W.expression))w=j0(W.expression,Object.keys(X))(...Object.values(X));else w=W0(W.expression,X);let q="",K=!1;for(let z of W.cases)if(z.type==="default"){if(!K)q=z.content.trim()}else try{let U;if(z.value&&U0(z.value))U=j0(z.value,Object.keys(X))(...Object.values(X));else if(z.value)U=W0(z.value,X);if(w===U){q=z.content.trim(),K=!0;break}}catch{continue}J=J.substring(0,Q)+q+J.substring(W.end),Y=!0}catch(w){let q=w instanceof Error?w.message:String(w),K=J0("Switch",`Error evaluating @switch expression: ${q}`,s.EVALUATION_ERROR);J=J.substring(0,Q)+K+J.substring(W.end);break}}return J}function pB($){let X=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(J)=>{return X.push(J),`\x00stx-script-${X.length-1}\x00`}),scripts:X}}function iB($,X){if(X.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,J)=>X[Number(J)]??Z)}function E1($,X,Z){let{masked:J,scripts:Y}=pB($);return iB(nB(J,X,Z),Y)}function nB($,X,Z){let J=$;J=lB(J,X,Z);{let G=!0;while(G){G=!1;let Q=J.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let W=Q.index,w=m1(J,W+7);if(!w)break;let q=w.endPos,K=G5(J,"unless","endunless",q);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 z=J.slice(q,K),U=w.expression,j=-1;{let H=0,_=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],V;while((V=_.exec(z))!==null)F.push({pos:V.index,type:"open"});while((V=L.exec(z))!==null)F.push({pos:V.index,type:"close"});while((V=O.exec(z))!==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")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){j=A.pos;break}}let B;if(j!==-1){let H=z.slice(0,j),_=z.slice(j+5);B=`@if (${U})${_}@else ${H}@endif`}else B=`@if (!(${U}))${z}@endif`;J=J.substring(0,W)+B+J.substring(K+10),G=!0}}J=Z3(J,X,Z),J=J3(J,X,Z),J=X3(J,X);let Y=()=>{let G=l7(J);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let W=G[Q];try{let w="",q=!1;for(let K of W.branches){if(q)break;if(K.type==="else")w=K.content,q=!0;else try{let z;if(K.condition&&U0(K.condition))z=j0(K.condition,Object.keys(X))(...Object.values(X));else if(K.condition)z=W0(K.condition,X);if(z)w=K.content,q=!0}catch(z){w=J0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,s.EVALUATION_ERROR),q=!0}}J=J.substring(0,W.start)+w+J.substring(W.end)}catch(w){let q=w instanceof Error?w.message:String(w),K=J0("If",`Error processing @if block: ${q}`,s.EVALUATION_ERROR);J=J.substring(0,W.start)+K+J.substring(W.end)}}return!0};while(!0){let G=J;if(!Y())break;if(J===G)break}return J}function OG($){let X=0;while(X<$.length&&/\s/.test($[X]))X++;if($[X]!=="(")return null;X++;while(X<$.length&&/\s/.test($[X]))X++;let Z=$[X];if(Z!=="'"&&Z!=='"')return null;X++;let J=[];while(X<$.length){let Y=$[X];if(Y==="\\"&&X+1<$.length){J.push($[X+1]),X+=2;continue}if(Y===Z){X++;break}J.push(Y),X++}while(X<$.length&&/\s/.test($[X]))X++;if($[X]!==")")return null;return X++,{value:J.join(""),consumed:X}}function X3($,X){let Z=$;function J(W,w,q,K){let z=1,U=K,j=new RegExp(`@${w}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${q}(?![a-z])`,"g");while(U<W.length&&z>0){j.lastIndex=U,B.lastIndex=U;let H=j.exec(W),_=B.exec(W),L=H?H.index:1/0,O=_?_.index:1/0;if(L<O)z++,U=L+H[0].length;else if(O<1/0){if(z--,z===0)return O;U=O+_[0].length}else break}return-1}function Y(W,w,q){let K=0,z=new RegExp(`@${w}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=/@else(?![a-z])/g,B=[],H;while((H=z.exec(W))!==null)B.push({pos:H.index,type:"open"});while((H=U.exec(W))!==null)B.push({pos:H.index,type:"close"});while((H=j.exec(W))!==null)B.push({pos:H.index,type:"else"});B.sort((_,L)=>_.pos-L.pos);for(let _ of B)if(_.type==="open")K++;else if(_.type==="close")K--;else if(_.type==="else"&&K===0)return _.pos;return-1}{let W=!0;while(W){W=!1;let w=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!w||w.index===void 0)break;let q=w.index,K,z,U=Z.slice(q+5),j=OG(U);if(j)K=j.value,z=q+5+j.consumed;else z=q+5;let B=J(Z,"auth","endauth",z);if(B===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let H=Z.slice(z,B),_=Y(H,"auth","endauth"),L;if(!X.auth)L=!1;else L=K?i1(`auth?.check && auth?.user?.[${K}]`,X):i1("auth?.check",X);let O;if(_!==-1){let F=H.slice(0,_),V=H.slice(_+5);O=L?F:V}else O=L?H:"";Z=Z.substring(0,q)+O+Z.substring(B+8),W=!0}}{let W=!0;while(W){W=!1;let w=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!w||w.index===void 0)break;let q=w.index,K,z,U=Z.slice(q+6),j=OG(U);if(j)K=j.value,z=q+6+j.consumed;else z=q+6;let B=J(Z,"guest","endguest",z);if(B===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let H=Z.slice(z,B),_=Y(H,"guest","endguest"),L;if(!X.auth)L=!0;else L=K?i1(`!auth?.check || !auth?.user?.[${K}]`,X):i1("!auth?.check",X);let O;if(_!==-1){let F=H.slice(0,_),V=H.slice(_+5);O=L?F:V}else O=L?H:"";Z=Z.substring(0,q)+O+Z.substring(B+9),W=!0}}function G(W,w,q){if(X.userCan&&typeof X.userCan[W]==="boolean")return X.userCan[W];if(X.permissions?.check&&typeof X.permissions.check==="function")try{let K=[W];if(w)K.push(w);if(q){let z=i1(q,X);K.push(z)}return X.permissions.check(...K)}catch{return!1}return!1}function Q(W){let w=W.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!w)return null;return{ability:w[1],type:w[2],id:w[3]?.trim(),paramsEnd:w[0].length}}for(let W of["can","cannot"]){let w=`end${W}`,q=W==="can"?"elsecan":"elsecannot",K=!0;while(K){K=!1;let z=Z.match(new RegExp(`@${W}\\s*\\(`));if(!z||z.index===void 0)break;let U=z.index,j=Z.slice(U+`@${W}`.length),B=Q(j);if(!B)break;let H=U+`@${W}`.length+B.paramsEnd,_=J(Z,W,w,H);if(_===-1){console.warn(`[stx] @${W} directive at position ${U} has no matching @${w} \u2014 the block was skipped.`);break}let L=Z.slice(H,_),O=[],F=0,V=new RegExp(`@${W}\\s*\\(`,"g"),A=new RegExp(`@${w}(?![a-z])`,"g"),R=new RegExp(`@${q}\\s*\\(`,"g"),N=/@else(?![a-z])/g,k=[],I;while((I=V.exec(L))!==null)k.push({pos:I.index,type:"open"});while((I=A.exec(L))!==null)k.push({pos:I.index,type:"close"});while((I=R.exec(L))!==null)k.push({pos:I.index,type:"elseDirective"});while((I=N.exec(L))!==null)k.push({pos:I.index,type:"else"});k.sort((S,P)=>S.pos-P.pos);for(let S of k){if(S.type==="open"){F++;continue}if(S.type==="close"){F--;continue}if(F===0)O.push(S)}let M=[],E=0;for(let S=0;S<O.length;S++){let P=O[S];if(M.push({content:L.slice(E,P.pos),ability:void 0}),P.type==="elseDirective"){let x=L.slice(P.pos+`@${q}`.length),f=Q(x);if(f){M[M.length-1]={content:L.slice(E,P.pos)},E=P.pos+`@${q}`.length+f.paramsEnd,M.push({content:"",ability:f.ability,type:f.type,id:f.id}),M.pop();let p=O[S+1],m=p?p.pos:L.length;M.push({content:L.slice(E,m),ability:f.ability,type:f.type,id:f.id}),E=m}}else E=P.pos+5}if(E<L.length){let S=M[M.length-1];if(O.length>0&&O[O.length-1].type==="else")M.push({content:L.slice(E),isFinalElse:!0});else if(M.length===0)M.push({content:L.slice(E)})}let T=G(B.ability,B.type,B.id),D=W==="can"?T:!T,b="";if(D)b=M[0]?.content||"";else{let S=!1;for(let P=1;P<M.length;P++){let x=M[P];if(x.isFinalElse){b=x.content,S=!0;break}if(x.ability){let f=G(x.ability,x.type,x.id);if(W==="can"?f:!f){b=x.content,S=!0;break}}}if(!S&&M.length>0){let P=M[M.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,U)+b+Z.substring(_+`@${w}`.length),K=!0}}return Z}function Z3($,X,Z){let J=$;function Y(G,Q,W,w,q){let K=!0;while(K){K=!1;let z=new RegExp(`@${Q}\\s*\\(`),U=G.match(z);if(!U||U.index===void 0)break;let j=U.index,B=m1(G,j+`@${Q}`.length);if(!B)break;let H=B.endPos,_=G5(G,Q,W,H);if(_===-1){console.warn(`[stx] @${Q} directive at position ${j} has no matching @${W} \u2014 the block was skipped.`);break}let L=G.slice(H,_),O=B.expression,F=-1,V=0,A=0;while(A<L.length){let R=L.indexOf("@",A);if(R===-1)break;let N=L.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(N)){F=R;break}A=R+1}try{let R=w(O.trim()),N;if(F!==-1){let k=L.slice(0,F),I=L.slice(F+5);N=R?k:I}else N=R?L:"";G=G.substring(0,j)+N+G.substring(_+`@${W}`.length),K=!0}catch(R){let N=R instanceof Error?R.message:String(R),k=J0(q,`Error processing @${Q} directive: ${N}`,s.EVALUATION_ERROR);G=G.substring(0,j)+k+G.substring(_+`@${W}`.length);break}}return G}return J=Y(J,"isset","endisset",(G)=>{let Q=i1(G,X);return Q!==void 0&&Q!==null},"Isset"),J=Y(J,"empty","endempty",(G)=>{let Q=i1(G,X);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"),J}function J3($,X,Z){let J=$,Y="development";function G(Q,W,w,q){let K=new RegExp(`@${W}(?![a-z])`,"g"),z=new RegExp(`@${w}(?![a-z])`,"g"),U=new RegExp(`^@${W}(?![a-z])`),j=new RegExp(`^@${w}(?![a-z])`),B=Q,H=!0;while(H){H=!1,K.lastIndex=0;let _=K.exec(B);if(!_)break;let L=_.index,O=L+_[0].length;if(W==="env"){let T=B.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!T)break;O+=T[0].length,q=Y===T[2]}let F=1,V=O,A=-1;while(F>0&&V<B.length){K.lastIndex=V,z.lastIndex=V;let T=K.exec(B),D=z.exec(B),b=T?T.index:1/0,S=D?D.index:1/0;if(b<S)F++,V=b+T[0].length;else if(S<1/0){if(F--,F===0){A=S;break}V=S+D[0].length}else break}if(A===-1){console.warn(`[stx] @${W} directive at position ${L} has no matching @${w} \u2014 the block was skipped.`);break}let R=B.substring(O,A),N=-1,k=0,I=0;while(I<R.length){let T=R.indexOf("@",I);if(T===-1)break;let D=R.substring(T);if(U.test(D)){k++,I=T+1;continue}if(j.test(D)){k--,I=T+1;continue}if(k===0&&/^@else(?![a-z])/.test(D)){N=T;break}I=T+1}let M;if(N!==-1){let T=R.slice(0,N),D=R.slice(N+5);M=q?T:D}else M=q?R:"";let E=`@${w}`.length;B=B.substring(0,L)+M+B.substring(A+E),H=!0}return B}return J=G(J,"env","endenv",!1),J=G(J,"production","endproduction",Y==="production"),J=G(J,"development","enddevelopment",Y==="development"),J=G(J,"staging","endstaging",Y==="staging"),J=G(J,"testing","endtesting",Y==="testing"),J}var Z8=y(()=>{_G();k1();s8();D0()});function FG($=16){let X=new Uint8Array($);return crypto.getRandomValues(X),btoa(String.fromCharCode(...X))}function J9($,X){if(!$)return X?.nonceGenerator?.()??FG();let Z=LG.get($);if(!Z)Z=X?.nonceGenerator?.()??FG(),LG.set($,Z);return Z}function rB($,X){let Z=[];for(let[J,Y]of Object.entries($)){if(Y===void 0||Y===null)continue;if(typeof Y==="boolean"){if(Y)Z.push(J);continue}if(Array.isArray(Y)){let G=[...Y];if(X&&(J==="script-src"||J==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${X}'`);if(G.length>0)Z.push(`${J} ${G.join(" ")}`)}}return Z.join("; ")}function VG($,X){return`<meta http-equiv="Content-Security-Policy" content="${rB($,X).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function AG($,X,Z){if(!X.enabled||!X.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=X.useNonce?J9(Z,X):void 0,Y=VG(X.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
12344
+ ${Y}`)}function RG($,X){let Z=$;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<script nonce="${X}"${Y}>`}),Z=Z.replace(/<style([^>]*)>/gi,(J,Y)=>{if(Y.includes("nonce="))return J;return`<style nonce="${X}"${Y}>`}),Z}function NG($,X,Z,J){let Y=$,G=J.csp;if(Y=Y.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?J9(X,G):void 0;return VG(G.directives,Q)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return J9(X,G)}),G?.enabled&&G.useNonce)X.cspNonce=J9(X,G);return Y}var LG;var MG=y(()=>{LG=new WeakMap});import oB from"crypto";function aB($=sB){let X=oB.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return Y3=X,X}function tB(){if(!Y3)aB();return Y3}function eB($=TG){let X=tB();return`<input type="hidden" name="${$}" value="${X}">`}function kG($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(X,Z,J)=>{return eB(J||TG)})}var sB=40,TG="_token",Y3=null;var IG=()=>{};async function EG($,X,Z,J){if(!J.customDirectives||J.customDirectives.length===0)return $;let Y=$;for(let G of J.customDirectives){if(!G.name||typeof G.handler!=="function"){if(J.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)Y=await $H(Y,G,X,Z,J);else Y=await XH(Y,G,X,Z,J)}return Y}async function $H($,X,Z,J,Y){let{name:G,handler:Q}=X,W=`@${G}`,w=`@end${G}`,q=$,K=P5(`${W}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${w}`,"g"),z=[],U=K.exec(q);while(U!==null){let[j,B="",H=""]=U,_=U.index||0;try{let L=B?DG(B):[],O=H.trim(),F=await Q(O,L,Z,J);z.push({original:j,processed:F,startIndex:_})}catch(L){let O=L instanceof Error?L.message:String(L);if(Y.debug)console.error(`Error processing custom directive @${G}:`,L);z.push({original:j,processed:J0("CustomDirective",`Error in @${G}${B?`(${B})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:_})}U=K.exec(q)}for(let j=z.length-1;j>=0;j--){let{original:B,processed:H}=z[j];q=q.replace(B,H)}return q}async function XH($,X,Z,J,Y){let{name:G,handler:Q}=X,W=$,w=P5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),q=[],K=w.exec(W);while(K!==null){let[j,B=""]=K,H=K.index||0;try{let _=DG(B),L=await Q("",_,Z,J);q.push({original:j,processed:L,startIndex:H})}catch(_){let L=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${G}:`,_);q.push({original:j,processed:J0("CustomDirective",`Error in @${G}(${B}): ${L}`,s.EVALUATION_ERROR),startIndex:H})}K=w.exec(W)}let z=P5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),U=z.exec(W);while(U!==null){let[j]=U,B=U.index||0;try{let H=await Q("",[],Z,J);q.push({original:j,processed:H,startIndex:B})}catch(H){let _=H instanceof Error?H.message:String(H);if(Y.debug)console.error(`Error processing custom directive @${G}:`,H);q.push({original:j,processed:J0("CustomDirective",`Error in @${G}: ${_}`,s.EVALUATION_ERROR),startIndex:B})}U=z.exec(W)}for(let j=q.length-1;j>=0;j--){let{original:B,processed:H}=q[j];W=W.replace(B,H)}return W}function DG($){if(!$.trim())return[];let X=[],Z="",J=!1,Y="";for(let G=0;G<$.length;G++){let Q=$[G];if((Q==='"'||Q==="'")&&(G===0||$[G-1]!=="\\"))if(!J)J=!0,Y=Q;else if(Q===Y)J=!1;else Z+=Q;else if(Q===","&&!J)X.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())X.push(Z.trim());return X.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 yG=y(()=>{k1();v5()});function j5($,X){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${X} must be a non-empty string`)}function JH($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let X=$,Z=X.appearance,J=X.colorMode;if(j5(X.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!J||typeof J!=="object"||Array.isArray(J))throw Error("@appearanceBootstrap colorMode must be an object");if(j5(Z.key,"appearance.key"),j5(Z.attribute,"appearance.attribute"),j5(Z.default,"appearance.default"),j5(J.key,"colorMode.key"),j5(J.attribute,"colorMode.attribute"),j5(J.default,"colorMode.default"),!SG.test(Z.key)||!SG.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!bG.test(Z.attribute)||!bG.test(J.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((Y)=>typeof Y!=="string"||Y.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(!ZH.has(J.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:X.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:J.key,attribute:J.attribute,default:J.default}}}function YH($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function GH($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${YH($)};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 QH($,X){let Z=1,J=null,Y=!1;for(let G=X+1;G<$.length;G++){let Q=$[G];if(Y){Y=!1;continue}if(J){if(Q==="\\")Y=!0;else if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function CG($,X){let Z=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,Q=QH(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let W=Z.slice(G+1,Q).trim(),w=W0(`(${W})`,X),q=GH(JH(w));Z=Z.slice(0,Y.index)+q+Z.slice(Q+1),J.lastIndex=Y.index+q.length}return Z}var bG,SG,ZH;var PG=y(()=>{D0();bG=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,SG=/^[A-Za-z_$][\w$]*$/,ZH=new Set(["light","dark","system"])});import WH from"crypto";function T0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Y9($,X,Z,J){let Y=$||X;return Z?`${Y} ${J}`:Y}function X1($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function l5($,X){if(/\bid\s*=/i.test($))return"";return` id="${T0(X)}"`}function G3($,X,Z){if(!X)return"";let J="";if(!/\baria-invalid\s*=/i.test(Z))J+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))J+=` aria-describedby="${T0(`${X1($)}-error`)}"`;return J}function wH(){return WH.randomUUID()}function G9($,X){let Z=$;return Z=Z.replace(/@csrf/g,()=>{if(!X.csrf||typeof X.csrf!=="object"){let J=wH();X.csrf={token:J}}if(X.csrf.field)return X.csrf.field;if(X.csrf.token)return`<input type="hidden" name="_token" value="${T0(X.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(J,Y)=>{let G=Y.toUpperCase();if(Y&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${T0(G)}">`;return J}),Z}function fG($,X,Z=xG){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,G,Q,W,w,q="")=>{let K=G||Q||"POST",z=W||w||"",U=n1(q),j=K.toUpperCase(),B=["GET","POST"].includes(j)?j:"POST",H=`<form method="${T0(B)}" action="${T0(z)}"${U?` ${U}`:""}>`;if(H+=`
12345
12345
  ${G9("@csrf",X)}`,!["GET","POST"].includes(j))H+=`
12346
- ${G9(`@method('${j}')`,X)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,G,Q,W,w,q="")=>{let K=G||Q||"",z=W||w||"",U=i1(q),j=J8(K,X),B=j!==void 0&&j!==null?j:z||"",H=U.match(/type=['"]([^'"]+)['"]/i),_=H?H[1]:"text",L=Y8(K,X),O=U.match(/class=['"]([^'"]+)['"]/i),F=Y9(O?O[1]:"",Z.input,L,Z.inputError),V=U.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${T0(_)}" name="${T0(K)}"${p5(U,$1(K))} value="${T0(B)}" class="${F}"${G3(K,L,U)}${V?` ${V}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,G,Q="",W="")=>{let w=i1(Q),q=J8(G,X)||W.trim(),K=Y8(G,X),z=w.match(/class=['"]([^'"]+)['"]/i),U=Y9(z?z[1]:"",Z.input,K,Z.inputError),j=w.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${T0(G)}"${p5(w,$1(G))} class="${U}"${G3(G,K,w)}${j?` ${j}`:""}>${T0(q)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,G,Q="",W)=>{let w=i1(Q),q=J8(G,X),K=Y8(G,X),z=w.match(/class=['"]([^'"]+)['"]/i),U=Y9(z?z[1]:"",Z.input,K,Z.inputError),j=w.replace(/class=['"][^'"]+['"]/i,""),B=W;if(q!==void 0)B=W.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,_,L)=>{if((Array.isArray(q)?q.some((F)=>String(F)===L):String(q)===L)&&!_.includes("selected"))return _.replace(/(<option)/,"$1 selected");return H});return`<select name="${T0(G)}"${p5(w,$1(G))} class="${U}"${G3(G,K,w)}${j?` ${j}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q,W="")=>{let w=Q===void 0?"1":Q,q=Q===void 0?$1(G):`${$1(G)}-${$1(w)}`,K=i1(W),z=J8(G,X),U=z!==void 0&&(Array.isArray(z)?z.some((_)=>String(_)===w):z===!0||String(z)===w),j=K.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:Z.checkInput,H=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${T0(G)}"${p5(K,q)} value="${T0(w)}" class="${B}"${U?" checked":""}${H?` ${H}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q,W="")=>{let w=i1(W),q=J8(G,X),K=q!==void 0&&q===Q,z=w.match(/class=['"]([^'"]+)['"]/i),U=z?z[1]:Z.checkInput,j=w.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${T0(G)}"${p5(w,`${$1(G)}-${$1(Q)}`)} value="${T0(Q)}" class="${U}"${K?" checked":""}${j?` ${j}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q="")=>{let W=i1(Q),w=W.match(/accept=['"]([^'"]+)['"]/i),q=w?w[1]:"",K=W.includes("multiple"),z=Y8(G,X),U=W.match(/class=['"]([^'"]+)['"]/i),j=Y9(U?U[1]:"",Z.input,z,Z.inputError),B=W.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${T0(G)}"${p5(W,$1(G))}`,`class="${j}"`];if(q)H.push(`accept="${T0(q)}"`);if(K)H.push("multiple");if(B)H.push(B);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,G,Q="",W)=>{let w=i1(Q),q=w.match(/class=['"]([^'"]+)['"]/i),K=q?q[1]:Z.label,z=w.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${T0($1(G))}" class="${K}"${z?` ${z}`:""}>${W}</label>`}),J}function gG($,X,Z=xG){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,G)=>{try{if(Y8(Y,X)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(W,w)=>{try{if(w.trim()==="$message"||w.trim()==="message")return vG(Y,X);if(w.trim().includes("errors.first")||w.trim().includes("$errors.first")){if(typeof X.errors?.first==="function")return X.errors.first(Y);return vG(Y,X)}let q=w.trim();if(K0(q)){let K=Q0(q,X);return K!==void 0?String(K):q}return q}catch{return w}});return`<div id="${T0(`${$1(Y)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),J}})}function Y8($,X){if(!X.errors)return!1;if(typeof X.errors.has==="function")return X.errors.has($);if(typeof X.errors==="object")return Object.prototype.hasOwnProperty.call(X.errors,$);return!1}function vG($,X){if(!X.errors)return"";if(typeof X.errors.get==="function")return X.errors.get($);if(typeof X.errors==="object"&&Object.prototype.hasOwnProperty.call(X.errors,$)){let Z=X.errors[$];return Array.isArray(Z)?Z[0]:String(Z)}return""}function J8($,X){let Z;if(X.old&&typeof X.old==="function")return X.old($);if(X.old&&typeof X.old==="object")return X.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Z=X[J],Z!==void 0)return Z}return X[$]}function i1($){if(!$.trim())return"";let X=[],Z=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=J.exec(Z))!==null){let[,G,,Q]=Y;X.push(`${G}="${Q.trim()}"`)}return X.join(" ")}var xG;var hG=y(()=>{b0();xG={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import w3 from"path";async function qH(){if(G8!==void 0)return G8;try{G8=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{G8=null}return G8}function KH($,X=0){if(X<=0)return!1;return Date.now()-$.loadedAt>X}async function zH($,X){if({...z3,...X.i18n}.cache&&q3[$]){let Y=q3[$],G=X.i18n?.cacheMaxAge??0;if(!KH(Y,G))return Y.translations}if(Q8[$]?.state==="loading")return Q8[$].promise;Q3[$]="loading";let J=K3($,X).then((Y)=>{return Q3[$]="loaded",delete Q8[$],Y}).catch((Y)=>{throw Q3[$]="error",Q8[$]={promise:J,state:"error",error:Y instanceof Error?Y:Error(String(Y))},Y});return Q8[$]={promise:J,state:"loading"},J}async function K3($,X){let Z={...z3,...X.i18n},J=w3.isAbsolute(Z.translationsDir)?Z.translationsDir:w3.resolve(X.root||process.cwd(),Z.translationsDir);try{let Y=await qH(),G=Y?await Y($,{translationsDir:J,defaultLocale:Z.defaultLocale,sources:_H(Z.format)}):await UH($,Z,J);if(G===void 0){if($!==Z.defaultLocale)return K3(Z.defaultLocale,X);return{}}let Q=G;if(Z.cache)q3[$]={translations:Q,loadedAt:Date.now(),locale:$};return Q}catch(Y){if(X.debug)console.error(`Error loading translation file for locale "${$}":`,Y);if($!==Z.defaultLocale)return K3(Z.defaultLocale,X);return{}}}async function UH($,X,Z){let J=w3.join(Z,`${$}${jH(X.format)}`);try{let Y=await import(J);return Y.default||Y}catch(Y){try{let G=await Bun.file(J).text();if(X.format==="yaml"||X.format==="yml")return BH(G);if(X.format==="json")return JSON.parse(G);throw Y}catch{return}}}function jH($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function BH($){let X={},Z=$.split(`
12347
- `),J=[{obj:X,indent:-1}];for(let Y of Z){let G=Y.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(J.length>1&&J[J.length-1].indent>=Q)J.pop();let W=J[J.length-1].obj,w=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(w){let[,,q,K]=w,z=q.trim(),U=K.trim();if(U==="")W[z]={},J.push({obj:W[z],indent:Q});else W[z]=HH(U)}}return X}function HH($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let X=$.toLowerCase();if(X==="true"||X==="yes")return!0;if(X==="false"||X==="no")return!1;if(X==="null"||X==="~")return null;let Z=Number($);if(!Number.isNaN(Z)&&$!=="")return Z;return $}function _H($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function OH($,X){return zH($,X)}function LH($,X){for(let Z of $){let J=Z.trim(),Y=J.match(/^\{(\d+)\}\s*(.*)$/);if(Y){let Q=Number.parseInt(Y[1],10);if(X===Q)return Y[2];continue}let G=J.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(X>=Q&&X<=W)return G[3];continue}}if($.length===2)return X===1?$[0].trim():$[1].trim();if(X<$.length)return $[X].trim();return $[$.length-1].trim()}function FH($,X={}){return mG($,X)}function mG($,X){let Z="",J=0;while(J<$.length)if($[J]==="{"){let Y=VH($,J);if(Y===-1){Z+=$[J],J++;continue}let G=$.slice(J+1,Y);Z+=AH(G,X),J=Y+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Z+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Z+=$[J+1],J+=2;else Z+=$[J],J++;else Z+=$[J],J++;return Z}function VH($,X){let Z=0;for(let J=X;J<$.length;J++)if($[J]==="{")Z++;else if($[J]==="}"){if(Z--,Z===0)return J}return-1}function AH($,X){let Z=RH($);if(Z.length===0)return`{${$}}`;let J=Z[0].trim(),Y=X[J];if(Z.length===1)return Y!==void 0?String(Y):`{${J}}`;switch(Z[1].trim().toLowerCase()){case"plural":return NH(Y,Z.slice(2).join(","),X);case"select":return TH(Y,Z.slice(2).join(","));case"selectordinal":return kH(Y,Z.slice(2).join(","));case"number":return EH(Y,Z[2]?.trim());case"date":return DH(Y,Z[2]?.trim());case"time":return yH(Y,Z[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function RH($){let X=[],Z="",J=0;for(let Y=0;Y<$.length;Y++){let G=$[Y];if(G==="{")J++,Z+=G;else if(G==="}")J--,Z+=G;else if(G===","&&J===0)X.push(Z),Z="";else Z+=G}if(Z)X.push(Z);return X}function NH($,X,Z){let J=Number($)||0,Y=U3(X),G=`=${J}`;if(Y[G])return W3(Y[G],J,Z);let Q=MH(J);if(Y[Q])return W3(Y[Q],J,Z);if(Y.other)return W3(Y.other,J,Z);return String(J)}function W3($,X,Z){let J=$.replace(/#/g,String(X));return mG(J,Z)}function MH($){let X=Math.abs($),Z=Math.floor(X),J=String($).includes(".")?String($).split(".")[1].length:0;if(Z===1&&J===0)return"one";return"other"}function TH($,X){let Z=String($||""),J=U3(X);if(J[Z])return J[Z];return J.other||String($)}function kH($,X){let Z=Number($)||0,J=U3(X),Y=IH(Z);if(J[Y])return J[Y].replace(/#/g,String(Z));if(J.other)return J.other.replace(/#/g,String(Z));return String(Z)}function IH($){let X=Math.abs($),Z=X%10,J=X%100;if(Z===1&&J!==11)return"one";if(Z===2&&J!==12)return"two";if(Z===3&&J!==13)return"few";return"other"}function U3($){let X={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Z.exec($);while(J!==null)X[J[1]]=J[2],J=Z.exec($);return X}function EH($,X){let Z=Number($);if(Number.isNaN(Z))return String($);switch(X){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 DH($,X){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let J={};switch(X){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Z.toLocaleDateString(void 0,J)}function yH($,X){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let J={};switch(X){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Z.toLocaleTimeString(void 0,J)}function bH($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function uG($,X,Z=!0,J={}){let Y=$.split("."),G=X;for(let W of Y){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return Z?$:"";let Q=String(G);if(bH(Q))return FH(Q,J);if(Q.includes("|")&&"count"in J){let W=Number(J.count),w=Q.split("|");Q=LH(w,W)}for(let[W,w]of Object.entries(J)){let q=W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${q}`,"g"),String(w))}return Q}async function cG($,X,Z,J){let Y=$,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...z3,...J.i18n},W=await OH(Q.locale,J);X.__translations=W,X.__locale=Q.locale,X.__i18nConfig=Q,Y=await dG(Y,G,async(K,z,U,j,B)=>{try{let H={};if(U)try{let L=[()=>JSON.parse(U),()=>{let O=`{"data":${U}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return y0(U,X)}];for(let O of L)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(L){if(J.debug)console.error("Error parsing parameters for @translate directive:",L)}return uG(z,W,Q.fallbackToKey,H)||j.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return J0("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR)}});let w=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${Y.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let K=[...Y.matchAll(w)];console.warn(`Found ${K.length} @translate matches`),K.forEach((z,U)=>console.warn(`Match ${U}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Y=await dG(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(K,z,U,j)=>{try{let B={};if(U)try{let H=[()=>JSON.parse(U),()=>{let _=`{"data":${U}}`,L=JSON.parse(_);return typeof L.data==="object"?L.data:{}},()=>{return y0(U,X)}];for(let _ of H)try{if(B=_(),Object.keys(B).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return uG(z,W,Q.fallbackToKey,B)}catch(B){if(J.debug)console.error("Error processing @translate directive:",B);return J0("Translate",`Error in @translate('${z}'): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR)}}),Y}async function dG($,X,Z){let J=[];return $.replace(X,(G,...Q)=>{let W=Z(G,...Q).then((w)=>({match:G,replacement:w}));return J.push(W),G}),(await Promise.all(J)).reduce((G,{match:Q,replacement:W})=>G.replace(Q,W),$)}var G8,z3,q3,Q8,Q3;var lG=y(()=>{k1();b0();z3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},q3={},Q8={},Q3={}});var H3={};e(H3,{streamingSuspenseDirective:()=>nG,streamToResponse:()=>cH,streamTemplateSimple:()=>hH,streamTemplate:()=>CH,renderStreamingPage:()=>vH,registerStreamingDirectives:()=>dH,processStreamDirectives:()=>fH,processSectionDirectives:()=>mH,islandDirective:()=>rG,generateHydrationRuntime:()=>lH,extractStreamBoundaries:()=>gH,createStreamRenderer:()=>uH,buildSuspenseResolveScript:()=>B3,SUSPENSE_RESOLVER_RUNTIME:()=>iG});import Q9 from"path";function SH($){let X=[],Z=0,J;pG.lastIndex=0;while((J=pG.exec($))!==null){if(J.index>Z){let Q=$.slice(Z,J.index);if(Q.trim())X.push({type:X.length===0?"shell":"content",content:Q})}let Y=J[1],G=J[2];X.push({type:"suspense",name:Y,content:G}),Z=J.index+J[0].length}if(Z<$.length){let Y=$.slice(Z);if(Y.trim())X.push({type:X.length===0?"shell":"content",content:Y})}if(X.length===0)X.push({type:"shell",content:$});return X}async function CH($,X={},Z={}){let J={...j5,...Z,streaming:{...j3,...Z.streaming}},Y=J.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file($).text(),W=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),w=W?W[1]:"",q=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K={...X,__filename:$,__dirname:Q9.dirname($)};if(w.trim())await G5(w,K,$);let z=SH(q),U=new Set;if(!z.some((B)=>B.type==="suspense")){let B=J.streaming?.strategy||"auto",H=new RegExp(H5.source,"g");if(!(B!=="manual"&&H.test(q))){let L=await A0(q,K,$,J,U);for(let O=0;O<L.length;O+=Y)G.enqueue(L.slice(O,O+Y)),await new Promise((F)=>setTimeout(F,0))}else{let L=[],O=new RegExp(H5.source,"g"),F;while((F=O.exec(q))!==null)L.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of L){if(A.start>V){let N=q.slice(V,A.start);if(N.trim()){let k=await A0(N,K,$,J,U);G.enqueue(k),await new Promise((I)=>setTimeout(I,0))}}let R=await A0(A.content,K,$,J,U);G.enqueue(R),await new Promise((N)=>setTimeout(N,0)),V=A.end}if(V<q.length){let A=q.slice(V);if(A.trim()){let R=await A0(A,K,$,J,U);G.enqueue(R)}}}}else{let B=new Map;for(let _ of z)if(_.type==="shell"||_.type==="content"){let L=await A0(_.content,K,$,J,U);G.enqueue(L)}else if(_.type==="suspense"&&_.name){let L=`stx-suspense-${_.name}`;G.enqueue(`<div id="${L}" data-suspense="${_.name}" style="display:contents;">
12346
+ ${G9(`@method('${j}')`,X)}`;return H}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,G,Q,W,w,q="")=>{let K=G||Q||"",z=W||w||"",U=n1(q),j=J8(K,X),B=j!==void 0&&j!==null?j:z||"",H=U.match(/type=['"]([^'"]+)['"]/i),_=H?H[1]:"text",L=Y8(K,X),O=U.match(/class=['"]([^'"]+)['"]/i),F=Y9(O?O[1]:"",Z.input,L,Z.inputError),V=U.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${T0(_)}" name="${T0(K)}"${l5(U,X1(K))} value="${T0(B)}" class="${F}"${G3(K,L,U)}${V?` ${V}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,G,Q="",W="")=>{let w=n1(Q),q=J8(G,X)||W.trim(),K=Y8(G,X),z=w.match(/class=['"]([^'"]+)['"]/i),U=Y9(z?z[1]:"",Z.input,K,Z.inputError),j=w.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${T0(G)}"${l5(w,X1(G))} class="${U}"${G3(G,K,w)}${j?` ${j}`:""}>${T0(q)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,G,Q="",W)=>{let w=n1(Q),q=J8(G,X),K=Y8(G,X),z=w.match(/class=['"]([^'"]+)['"]/i),U=Y9(z?z[1]:"",Z.input,K,Z.inputError),j=w.replace(/class=['"][^'"]+['"]/i,""),B=W;if(q!==void 0)B=W.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,_,L)=>{if((Array.isArray(q)?q.some((F)=>String(F)===L):String(q)===L)&&!_.includes("selected"))return _.replace(/(<option)/,"$1 selected");return H});return`<select name="${T0(G)}"${l5(w,X1(G))} class="${U}"${G3(G,K,w)}${j?` ${j}`:""}>${B}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q,W="")=>{let w=Q===void 0?"1":Q,q=Q===void 0?X1(G):`${X1(G)}-${X1(w)}`,K=n1(W),z=J8(G,X),U=z!==void 0&&(Array.isArray(z)?z.some((_)=>String(_)===w):z===!0||String(z)===w),j=K.match(/class=['"]([^'"]+)['"]/i),B=j?j[1]:Z.checkInput,H=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${T0(G)}"${l5(K,q)} value="${T0(w)}" class="${B}"${U?" checked":""}${H?` ${H}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q,W="")=>{let w=n1(W),q=J8(G,X),K=q!==void 0&&q===Q,z=w.match(/class=['"]([^'"]+)['"]/i),U=z?z[1]:Z.checkInput,j=w.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${T0(G)}"${l5(w,`${X1(G)}-${X1(Q)}`)} value="${T0(Q)}" class="${U}"${K?" checked":""}${j?` ${j}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q="")=>{let W=n1(Q),w=W.match(/accept=['"]([^'"]+)['"]/i),q=w?w[1]:"",K=W.includes("multiple"),z=Y8(G,X),U=W.match(/class=['"]([^'"]+)['"]/i),j=Y9(U?U[1]:"",Z.input,z,Z.inputError),B=W.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${T0(G)}"${l5(W,X1(G))}`,`class="${j}"`];if(q)H.push(`accept="${T0(q)}"`);if(K)H.push("multiple");if(B)H.push(B);return`${H.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,G,Q="",W)=>{let w=n1(Q),q=w.match(/class=['"]([^'"]+)['"]/i),K=q?q[1]:Z.label,z=w.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${T0(X1(G))}" class="${K}"${z?` ${z}`:""}>${W}</label>`}),J}function gG($,X,Z=xG){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,G)=>{try{if(Y8(Y,X)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(W,w)=>{try{if(w.trim()==="$message"||w.trim()==="message")return vG(Y,X);if(w.trim().includes("errors.first")||w.trim().includes("$errors.first")){if(typeof X.errors?.first==="function")return X.errors.first(Y);return vG(Y,X)}let q=w.trim();if(U0(q)){let K=W0(q,X);return K!==void 0?String(K):q}return q}catch{return w}});return`<div id="${T0(`${X1(Y)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),J}})}function Y8($,X){if(!X.errors)return!1;if(typeof X.errors.has==="function")return X.errors.has($);if(typeof X.errors==="object")return Object.prototype.hasOwnProperty.call(X.errors,$);return!1}function vG($,X){if(!X.errors)return"";if(typeof X.errors.get==="function")return X.errors.get($);if(typeof X.errors==="object"&&Object.prototype.hasOwnProperty.call(X.errors,$)){let Z=X.errors[$];return Array.isArray(Z)?Z[0]:String(Z)}return""}function J8($,X){let Z;if(X.old&&typeof X.old==="function")return X.old($);if(X.old&&typeof X.old==="object")return X.old[$];if($.endsWith("[]")){let J=$.slice(0,-2);if(Z=X[J],Z!==void 0)return Z}return X[$]}function n1($){if(!$.trim())return"";let X=[],Z=$.trim(),J=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Y;while((Y=J.exec(Z))!==null){let[,G,,Q]=Y;X.push(`${G}="${Q.trim()}"`)}return X.join(" ")}var xG;var hG=y(()=>{D0();xG={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import w3 from"path";async function qH(){if(G8!==void 0)return G8;try{G8=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{G8=null}return G8}function KH($,X=0){if(X<=0)return!1;return Date.now()-$.loadedAt>X}async function zH($,X){if({...z3,...X.i18n}.cache&&q3[$]){let Y=q3[$],G=X.i18n?.cacheMaxAge??0;if(!KH(Y,G))return Y.translations}if(Q8[$]?.state==="loading")return Q8[$].promise;Q3[$]="loading";let J=K3($,X).then((Y)=>{return Q3[$]="loaded",delete Q8[$],Y}).catch((Y)=>{throw Q3[$]="error",Q8[$]={promise:J,state:"error",error:Y instanceof Error?Y:Error(String(Y))},Y});return Q8[$]={promise:J,state:"loading"},J}async function K3($,X){let Z={...z3,...X.i18n},J=w3.isAbsolute(Z.translationsDir)?Z.translationsDir:w3.resolve(X.root||process.cwd(),Z.translationsDir);try{let Y=await qH(),G=Y?await Y($,{translationsDir:J,defaultLocale:Z.defaultLocale,sources:_H(Z.format)}):await UH($,Z,J);if(G===void 0){if($!==Z.defaultLocale)return K3(Z.defaultLocale,X);return{}}let Q=G;if(Z.cache)q3[$]={translations:Q,loadedAt:Date.now(),locale:$};return Q}catch(Y){if(X.debug)console.error(`Error loading translation file for locale "${$}":`,Y);if($!==Z.defaultLocale)return K3(Z.defaultLocale,X);return{}}}async function UH($,X,Z){let J=w3.join(Z,`${$}${jH(X.format)}`);try{let Y=await import(J);return Y.default||Y}catch(Y){try{let G=await Bun.file(J).text();if(X.format==="yaml"||X.format==="yml")return BH(G);if(X.format==="json")return JSON.parse(G);throw Y}catch{return}}}function jH($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function BH($){let X={},Z=$.split(`
12347
+ `),J=[{obj:X,indent:-1}];for(let Y of Z){let G=Y.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(J.length>1&&J[J.length-1].indent>=Q)J.pop();let W=J[J.length-1].obj,w=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(w){let[,,q,K]=w,z=q.trim(),U=K.trim();if(U==="")W[z]={},J.push({obj:W[z],indent:Q});else W[z]=HH(U)}}return X}function HH($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let X=$.toLowerCase();if(X==="true"||X==="yes")return!0;if(X==="false"||X==="no")return!1;if(X==="null"||X==="~")return null;let Z=Number($);if(!Number.isNaN(Z)&&$!=="")return Z;return $}function _H($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function OH($,X){return zH($,X)}function LH($,X){for(let Z of $){let J=Z.trim(),Y=J.match(/^\{(\d+)\}\s*(.*)$/);if(Y){let Q=Number.parseInt(Y[1],10);if(X===Q)return Y[2];continue}let G=J.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(X>=Q&&X<=W)return G[3];continue}}if($.length===2)return X===1?$[0].trim():$[1].trim();if(X<$.length)return $[X].trim();return $[$.length-1].trim()}function FH($,X={}){return mG($,X)}function mG($,X){let Z="",J=0;while(J<$.length)if($[J]==="{"){let Y=VH($,J);if(Y===-1){Z+=$[J],J++;continue}let G=$.slice(J+1,Y);Z+=AH(G,X),J=Y+1}else if($[J]==="'"&&J+1<$.length)if($[J+1]==="'")Z+="'",J+=2;else if($[J+1]==="{"||$[J+1]==="}")Z+=$[J+1],J+=2;else Z+=$[J],J++;else Z+=$[J],J++;return Z}function VH($,X){let Z=0;for(let J=X;J<$.length;J++)if($[J]==="{")Z++;else if($[J]==="}"){if(Z--,Z===0)return J}return-1}function AH($,X){let Z=RH($);if(Z.length===0)return`{${$}}`;let J=Z[0].trim(),Y=X[J];if(Z.length===1)return Y!==void 0?String(Y):`{${J}}`;switch(Z[1].trim().toLowerCase()){case"plural":return NH(Y,Z.slice(2).join(","),X);case"select":return TH(Y,Z.slice(2).join(","));case"selectordinal":return kH(Y,Z.slice(2).join(","));case"number":return EH(Y,Z[2]?.trim());case"date":return DH(Y,Z[2]?.trim());case"time":return yH(Y,Z[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function RH($){let X=[],Z="",J=0;for(let Y=0;Y<$.length;Y++){let G=$[Y];if(G==="{")J++,Z+=G;else if(G==="}")J--,Z+=G;else if(G===","&&J===0)X.push(Z),Z="";else Z+=G}if(Z)X.push(Z);return X}function NH($,X,Z){let J=Number($)||0,Y=U3(X),G=`=${J}`;if(Y[G])return W3(Y[G],J,Z);let Q=MH(J);if(Y[Q])return W3(Y[Q],J,Z);if(Y.other)return W3(Y.other,J,Z);return String(J)}function W3($,X,Z){let J=$.replace(/#/g,String(X));return mG(J,Z)}function MH($){let X=Math.abs($),Z=Math.floor(X),J=String($).includes(".")?String($).split(".")[1].length:0;if(Z===1&&J===0)return"one";return"other"}function TH($,X){let Z=String($||""),J=U3(X);if(J[Z])return J[Z];return J.other||String($)}function kH($,X){let Z=Number($)||0,J=U3(X),Y=IH(Z);if(J[Y])return J[Y].replace(/#/g,String(Z));if(J.other)return J.other.replace(/#/g,String(Z));return String(Z)}function IH($){let X=Math.abs($),Z=X%10,J=X%100;if(Z===1&&J!==11)return"one";if(Z===2&&J!==12)return"two";if(Z===3&&J!==13)return"few";return"other"}function U3($){let X={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Z.exec($);while(J!==null)X[J[1]]=J[2],J=Z.exec($);return X}function EH($,X){let Z=Number($);if(Number.isNaN(Z))return String($);switch(X){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 DH($,X){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let J={};switch(X){case"short":J.dateStyle="short";break;case"medium":J.dateStyle="medium";break;case"long":J.dateStyle="long";break;case"full":J.dateStyle="full";break;default:J.dateStyle="medium"}return Z.toLocaleDateString(void 0,J)}function yH($,X){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let J={};switch(X){case"short":J.timeStyle="short";break;case"medium":J.timeStyle="medium";break;case"long":J.timeStyle="long";break;case"full":J.timeStyle="full";break;default:J.timeStyle="short"}return Z.toLocaleTimeString(void 0,J)}function bH($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function uG($,X,Z=!0,J={}){let Y=$.split("."),G=X;for(let W of Y){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return Z?$:"";let Q=String(G);if(bH(Q))return FH(Q,J);if(Q.includes("|")&&"count"in J){let W=Number(J.count),w=Q.split("|");Q=LH(w,W)}for(let[W,w]of Object.entries(J)){let q=W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${q}`,"g"),String(w))}return Q}async function cG($,X,Z,J){let Y=$,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...z3,...J.i18n},W=await OH(Q.locale,J);X.__translations=W,X.__locale=Q.locale,X.__i18nConfig=Q,Y=await dG(Y,G,async(K,z,U,j,B)=>{try{let H={};if(U)try{let L=[()=>JSON.parse(U),()=>{let O=`{"data":${U}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return E0(U,X)}];for(let O of L)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(L){if(J.debug)console.error("Error parsing parameters for @translate directive:",L)}return uG(z,W,Q.fallbackToKey,H)||j.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return J0("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR)}});let w=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${Y.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let K=[...Y.matchAll(w)];console.warn(`Found ${K.length} @translate matches`),K.forEach((z,U)=>console.warn(`Match ${U}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Y=await dG(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(K,z,U,j)=>{try{let B={};if(U)try{let H=[()=>JSON.parse(U),()=>{let _=`{"data":${U}}`,L=JSON.parse(_);return typeof L.data==="object"?L.data:{}},()=>{return E0(U,X)}];for(let _ of H)try{if(B=_(),Object.keys(B).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return uG(z,W,Q.fallbackToKey,B)}catch(B){if(J.debug)console.error("Error processing @translate directive:",B);return J0("Translate",`Error in @translate('${z}'): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR)}}),Y}async function dG($,X,Z){let J=[];return $.replace(X,(G,...Q)=>{let W=Z(G,...Q).then((w)=>({match:G,replacement:w}));return J.push(W),G}),(await Promise.all(J)).reduce((G,{match:Q,replacement:W})=>G.replace(Q,W),$)}var G8,z3,q3,Q8,Q3;var lG=y(()=>{k1();D0();z3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},q3={},Q8={},Q3={}});var H3={};t(H3,{streamingSuspenseDirective:()=>nG,streamToResponse:()=>cH,streamTemplateSimple:()=>hH,streamTemplate:()=>CH,renderStreamingPage:()=>vH,registerStreamingDirectives:()=>dH,processStreamDirectives:()=>fH,processSectionDirectives:()=>mH,islandDirective:()=>rG,generateHydrationRuntime:()=>lH,extractStreamBoundaries:()=>gH,createStreamRenderer:()=>uH,buildSuspenseResolveScript:()=>B3,SUSPENSE_RESOLVER_RUNTIME:()=>iG});import Q9 from"path";function SH($){let X=[],Z=0,J;pG.lastIndex=0;while((J=pG.exec($))!==null){if(J.index>Z){let Q=$.slice(Z,J.index);if(Q.trim())X.push({type:X.length===0?"shell":"content",content:Q})}let Y=J[1],G=J[2];X.push({type:"suspense",name:Y,content:G}),Z=J.index+J[0].length}if(Z<$.length){let Y=$.slice(Z);if(Y.trim())X.push({type:X.length===0?"shell":"content",content:Y})}if(X.length===0)X.push({type:"shell",content:$});return X}async function CH($,X={},Z={}){let J={...U5,...Z,streaming:{...j3,...Z.streaming}},Y=J.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file($).text(),W=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),w=W?W[1]:"",q=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K={...X,__filename:$,__dirname:Q9.dirname($)};if(w.trim())await Y5(w,K,$);let z=SH(q),U=new Set;if(!z.some((B)=>B.type==="suspense")){let B=J.streaming?.strategy||"auto",H=new RegExp(B5.source,"g");if(!(B!=="manual"&&H.test(q))){let L=await V0(q,K,$,J,U);for(let O=0;O<L.length;O+=Y)G.enqueue(L.slice(O,O+Y)),await new Promise((F)=>setTimeout(F,0))}else{let L=[],O=new RegExp(B5.source,"g"),F;while((F=O.exec(q))!==null)L.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of L){if(A.start>V){let N=q.slice(V,A.start);if(N.trim()){let k=await V0(N,K,$,J,U);G.enqueue(k),await new Promise((I)=>setTimeout(I,0))}}let R=await V0(A.content,K,$,J,U);G.enqueue(R),await new Promise((N)=>setTimeout(N,0)),V=A.end}if(V<q.length){let A=q.slice(V);if(A.trim()){let R=await V0(A,K,$,J,U);G.enqueue(R)}}}}else{let B=new Map;for(let _ of z)if(_.type==="shell"||_.type==="content"){let L=await V0(_.content,K,$,J,U);G.enqueue(L)}else if(_.type==="suspense"&&_.name){let L=`stx-suspense-${_.name}`;G.enqueue(`<div id="${L}" data-suspense="${_.name}" style="display:contents;">
12348
12348
  <template data-suspense-fallback>Loading...</template>
12349
- </div>`),B.set(_.name,A0(_.content,K,$,J,U))}G.enqueue(`
12349
+ </div>`),B.set(_.name,V0(_.content,K,$,J,U))}G.enqueue(`
12350
12350
  <script>
12351
12351
  (function() {
12352
12352
  window.__stxSuspense = window.__stxSuspense || {
@@ -12367,8 +12367,8 @@ ${Y}`)}function RG($,X){let Z=$;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*
12367
12367
  window.__stxSuspense.resolve('${$}', \`${J}\`);
12368
12368
  </script>`}catch(Z){let J=Z instanceof Error?Z.message:String(Z);return`
12369
12369
  <script>
12370
- window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${j1(J)}</div>');
12371
- </script>`}}function PH($,X,Z){if(!X||X<=0)return $;let J,Y=new Promise((G,Q)=>{J=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${X}ms`)),X)});return Promise.race([$,Y]).finally(()=>clearTimeout(J))}function vH($,X=[],Z={}){let J=Z.timeoutMs??0;return new ReadableStream({async start(Y){try{if(Y.enqueue($),X.length>0)Y.enqueue(iG),await Promise.all(X.map(async(G)=>{let Q=PH(G.render(),J,G.id);Y.enqueue(await B3(G.id,Q))}));Y.close()}catch(G){Y.error(G)}}})}function fH($,X){return $.replace(xH,(Z,J,Y)=>{let G=J.trim(),Q=Y.split(/@fallback/i),W=Q[0].trim(),w=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!X.__streamTemplates)X.__streamTemplates={};return X.__streamTemplates[G]=W,`<div data-suspense="${G}">${w}</div>`})}function gH($){let X=$?.streamBoundaries;if(!X||typeof X!=="object")return;let Z=Object.entries(X).filter(([,J])=>typeof J==="function");return Z.length>0?Z.map(([J,Y])=>({id:J,render:Y})):void 0}async function hH($,X={},Z={}){let J={...j5,...Z,streaming:{...j3,...Z.streaming}},Y=J.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file($).text(),W=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),w=W?W[1]:"",q=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K={...X,__filename:$,__dirname:Q9.dirname($)};if(w.trim())await G5(w,K,$);let z=new Set,U=J.streaming?.strategy||"auto",j=new RegExp(H5.source,"g");if(!(U!=="manual"&&j.test(q))){let H=await A0(q,K,$,J,z);for(let _=0;_<H.length;_+=Y)G.enqueue(H.slice(_,_+Y))}else{let H=[],_=new RegExp(H5.source,"g"),L;while((L=_.exec(q))!==null)H.push({name:L[1],content:L[2],start:L.index,end:L.index+L[0].length});let O=0;for(let F of H){if(F.start>O){let A=q.slice(O,F.start);if(A.trim()){let R=await A0(A,K,$,J,z);G.enqueue(R)}}let V=await A0(F.content,K,$,J,z);G.enqueue(V),O=F.end}if(O<q.length){let F=q.slice(O);if(F.trim()){let V=await A0(F,K,$,J,z);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function uH($,X={}){let Z={...j5,...X,streaming:{...j3,...X.streaming}},J=await Bun.file($).text(),Y=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=Y?Y[1]:"",Q=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W=Q,w={},q;H5.lastIndex=0;while((q=H5.exec(Q))!==null){let U=q[1],j=q[2];w[U]=j}let K=Q.replace(H5,"");return{renderShell:async(U={})=>{let j={...U,__filename:$,__dirname:Q9.dirname($)};return await G5(G,j,$),A0(K,j,$,Z,new Set)},renderSection:async(U,j={})=>{try{if(!w[U])return`<div class="error-message">Section "${j1(U)}" not found in template "${j1($)}"</div>`;let B={...j,__filename:$,__dirname:Q9.dirname($)};await G5(G,B,$);let H=new Set;return await A0(w[U],B,$,Z,H)}catch(B){let H=B instanceof Error?B.message:String(B);return _0("Expression",H,$,w[U]||"",0,w[U]||"")}},getSections:()=>{return Object.keys(w)},getTemplate:()=>{return W}}}function dH($={}){let X=[];if($.streaming?.enabled)X.push(nG);if($.hydration?.enabled)X.push(rG);return X}async function mH($,X,Z,J={}){return $}function cH($,X={}){let Z=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),Y=new Headers(X.headers);if(!Y.has("Content-Type"))Y.set("Content-Type","text/html; charset=utf-8");if(!Y.has("Transfer-Encoding"))Y.set("Transfer-Encoding","chunked");if(!Y.has("X-Content-Type-Options"))Y.set("X-Content-Type-Options","nosniff");if(!Y.has("X-Accel-Buffering"))Y.set("X-Accel-Buffering","no");return new Response(J,{...X,headers:Y})}function lH($={mode:"full"}){let{mode:X,components:Z={},dynamicImports:J=!0}=$,Y=Object.entries(Z).map(([G,Q])=>`'${G}': ${J?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
12370
+ window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${U1(J)}</div>');
12371
+ </script>`}}function PH($,X,Z){if(!X||X<=0)return $;let J,Y=new Promise((G,Q)=>{J=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${X}ms`)),X)});return Promise.race([$,Y]).finally(()=>clearTimeout(J))}function vH($,X=[],Z={}){let J=Z.timeoutMs??0;return new ReadableStream({async start(Y){try{if(Y.enqueue($),X.length>0)Y.enqueue(iG),await Promise.all(X.map(async(G)=>{let Q=PH(G.render(),J,G.id);Y.enqueue(await B3(G.id,Q))}));Y.close()}catch(G){Y.error(G)}}})}function fH($,X){return $.replace(xH,(Z,J,Y)=>{let G=J.trim(),Q=Y.split(/@fallback/i),W=Q[0].trim(),w=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!X.__streamTemplates)X.__streamTemplates={};return X.__streamTemplates[G]=W,`<div data-suspense="${G}">${w}</div>`})}function gH($){let X=$?.streamBoundaries;if(!X||typeof X!=="object")return;let Z=Object.entries(X).filter(([,J])=>typeof J==="function");return Z.length>0?Z.map(([J,Y])=>({id:J,render:Y})):void 0}async function hH($,X={},Z={}){let J={...U5,...Z,streaming:{...j3,...Z.streaming}},Y=J.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file($).text(),W=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),w=W?W[1]:"",q=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K={...X,__filename:$,__dirname:Q9.dirname($)};if(w.trim())await Y5(w,K,$);let z=new Set,U=J.streaming?.strategy||"auto",j=new RegExp(B5.source,"g");if(!(U!=="manual"&&j.test(q))){let H=await V0(q,K,$,J,z);for(let _=0;_<H.length;_+=Y)G.enqueue(H.slice(_,_+Y))}else{let H=[],_=new RegExp(B5.source,"g"),L;while((L=_.exec(q))!==null)H.push({name:L[1],content:L[2],start:L.index,end:L.index+L[0].length});let O=0;for(let F of H){if(F.start>O){let A=q.slice(O,F.start);if(A.trim()){let R=await V0(A,K,$,J,z);G.enqueue(R)}}let V=await V0(F.content,K,$,J,z);G.enqueue(V),O=F.end}if(O<q.length){let F=q.slice(O);if(F.trim()){let V=await V0(F,K,$,J,z);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function uH($,X={}){let Z={...U5,...X,streaming:{...j3,...X.streaming}},J=await Bun.file($).text(),Y=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=Y?Y[1]:"",Q=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W=Q,w={},q;B5.lastIndex=0;while((q=B5.exec(Q))!==null){let U=q[1],j=q[2];w[U]=j}let K=Q.replace(B5,"");return{renderShell:async(U={})=>{let j={...U,__filename:$,__dirname:Q9.dirname($)};return await Y5(G,j,$),V0(K,j,$,Z,new Set)},renderSection:async(U,j={})=>{try{if(!w[U])return`<div class="error-message">Section "${U1(U)}" not found in template "${U1($)}"</div>`;let B={...j,__filename:$,__dirname:Q9.dirname($)};await Y5(G,B,$);let H=new Set;return await V0(w[U],B,$,Z,H)}catch(B){let H=B instanceof Error?B.message:String(B);return H0("Expression",H,$,w[U]||"",0,w[U]||"")}},getSections:()=>{return Object.keys(w)},getTemplate:()=>{return W}}}function dH($={}){let X=[];if($.streaming?.enabled)X.push(nG);if($.hydration?.enabled)X.push(rG);return X}async function mH($,X,Z,J={}){return $}function cH($,X={}){let Z=new TextEncoder,J=$.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),Y=new Headers(X.headers);if(!Y.has("Content-Type"))Y.set("Content-Type","text/html; charset=utf-8");if(!Y.has("Transfer-Encoding"))Y.set("Transfer-Encoding","chunked");if(!Y.has("X-Content-Type-Options"))Y.set("X-Content-Type-Options","nosniff");if(!Y.has("X-Accel-Buffering"))Y.set("X-Accel-Buffering","no");return new Response(J,{...X,headers:Y})}function lH($={mode:"full"}){let{mode:X,components:Z={},dynamicImports:J=!0}=$,Y=Object.entries(Z).map(([G,Q])=>`'${G}': ${J?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
12372
12372
  `);if(X==="loader")return`
12373
12373
  (function() {
12374
12374
  window.__stx = window.__stx || {};
@@ -12510,7 +12510,7 @@ else {
12510
12510
  else {
12511
12511
  stx.hydrate();
12512
12512
  }
12513
- })();`}var j3,H5,pG,iG=`
12513
+ })();`}var j3,B5,pG,iG=`
12514
12514
  <script>
12515
12515
  (function(){
12516
12516
  window.__stxSuspense = window.__stxSuspense || {
@@ -12530,18 +12530,18 @@ else {
12530
12530
  }
12531
12531
  };
12532
12532
  })();
12533
- </script>`,xH,nG,rG;var _3=y(()=>{M1();B1();F$();V0();j3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},H5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,pG=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;xH=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;nG={name:"suspense",hasEndTag:!0,handler:($,X,Z,J)=>{if(!X||X.length===0)throw Error("Suspense directive requires a name parameter");let Y=X[0].replace(/['"`]/g,"");return`<!-- @suspense:${Y} -->${$}<!-- @endsuspense:${Y} -->`}},rG={name:"island",hasEndTag:!0,handler:($,X,Z,J)=>{if(!X||X.length===0)throw Error("Island directive requires a name parameter");let Y=X[0].replace(/['"`]/g,""),G=X[1]?X[1].replace(/['"`]/g,""):"lazy",Q=`island-${Y}-${Math.random().toString(36).substring(2,9)}`,W=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),w=W?W[1].trim():"",q=W?$.replace(W[0],""):$;return`<div data-island="${Y}" data-island-id="${Q}" data-priority="${G}">
12533
+ </script>`,xH,nG,rG;var _3=y(()=>{M1();j1();F$();F0();j3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},B5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,pG=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;xH=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;nG={name:"suspense",hasEndTag:!0,handler:($,X,Z,J)=>{if(!X||X.length===0)throw Error("Suspense directive requires a name parameter");let Y=X[0].replace(/['"`]/g,"");return`<!-- @suspense:${Y} -->${$}<!-- @endsuspense:${Y} -->`}},rG={name:"island",hasEndTag:!0,handler:($,X,Z,J)=>{if(!X||X.length===0)throw Error("Island directive requires a name parameter");let Y=X[0].replace(/['"`]/g,""),G=X[1]?X[1].replace(/['"`]/g,""):"lazy",Q=`island-${Y}-${Math.random().toString(36).substring(2,9)}`,W=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),w=W?W[1].trim():"",q=W?$.replace(W[0],""):$;return`<div data-island="${Y}" data-island-id="${Q}" data-priority="${G}">
12534
12534
  ${q}
12535
12535
  <script type="application/json" data-island-props="${Q}">
12536
12536
  ${w?`{${w}}`:"{}"}
12537
12537
  </script>
12538
- </div>`}}});var aG={};e(aG,{warnUnbalancedTags:()=>O3,findUnbalancedTags:()=>sG});function i5($){return $.replace(/[^\n]/g," ")}function sG($){let X=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,i5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,i5).replace(/<!--[\s\S]*?-->/g,i5).replace(/\{\{\{[\s\S]*?\}\}\}/g,i5).replace(/\{\{[\s\S]*?\}\}/g,i5).replace(/\{!![\s\S]*?!!\}/g,i5),Z=new Map,J=new Map,Y=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=Y.exec(X))!==null){let W=G[1]==="/",w=G[2],q=G[3]==="/";if(pH.has(w.toLowerCase()))continue;if(q)continue;if(W)J.set(w,(J.get(w)??0)+1);else{let K=Z.get(w);if(K)K.count++;else{let z=X.slice(0,G.index).split(`
12539
- `).length;Z.set(w,{count:1,firstLine:z})}}}let Q=[];for(let W of new Set([...Z.keys(),...J.keys()])){if(iH.has(W.toLowerCase()))continue;let w=Z.get(W)?.count??0,q=J.get(W)??0;if(w!==q)Q.push({tag:W,opened:w,closed:q,firstOpenLine:Z.get(W)?.firstLine??0})}return Q}function O3($,X){let Z;try{Z=sG($)}catch{return}if(Z.length===0)return;let J=`${X}:${$.length}`;if(oG.has(J))return;oG.add(J);let Y=X?X.split(/[/\\]/).pop()||X:"template";for(let{tag:G,opened:Q,closed:W,firstOpenLine:w}of Z)if(Q>W){let q=w?` (first opened at line ${w})`:"";console.warn(`[stx] ${Y}: <${G}> ${Q} opened, ${W} closed \u2014 an unclosed <${G}>${q} may swallow the content that follows it.`)}else console.warn(`[stx] ${Y}: <${G}> ${Q} opened, ${W} closed \u2014 ${W-Q} stray </${G}>.`)}var pH,iH,oG;var L3=y(()=>{pH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),iH=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);oG=new Set});import X1 from"path";import F3 from"fs";function tG($){return $.split("-").map((X)=>X.charAt(0).toUpperCase()+X.slice(1)).join("")}function eG($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class $Q{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let X of $.aliases)this.builtins.set(X.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,X,Z,J){let Y=$.endsWith(".stx")?$.slice(0,-4):$,G=J?.__importedComponents;if(G){let j=[Y,Y.toLowerCase(),tG(Y),eG(Y)];for(let B of j)if(G.has(B))return G.get(B)}let Q=[...new Set([`${Y}.stx`,`${tG(Y)}.stx`,`${eG(Y)}.stx`])];if(Y.startsWith("./")||Y.startsWith("../")){let j=X1.resolve(X1.dirname(X),`${Y}.stx`);if(await o(j))return j;return null}let W=[],w=Z.componentsDir||"",q=J?.__originalFilePath;if(q)W.push(X1.join(X1.dirname(q),"components"));if(w)W.push(w);let K=X1.join(X1.dirname(X),"components");if(!W.includes(K))W.push(K);let z=process.cwd(),U=[X1.resolve(z,"src/components"),X1.resolve(z,"components"),X1.resolve(import.meta.dir,"components")];for(let j of U)if(!W.includes(j))W.push(j);for(let j of W){if(!j)continue;for(let B of Q){let H=X1.join(j,B);if(await o(H))return H}try{if(!F3.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let H=F3.readdirSync(j,{withFileTypes:!0});for(let _ of H)if(_.isDirectory()){let L=X1.join(j,_.name);for(let O of Q){let F=X1.join(L,O);if(await o(F))return F}}}catch{}}return null}}var r0;var V3=y(()=>{V0();r0=new $Q});function I0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A3($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var _5="\x00stx-boolean-attribute";function n5($,X){let Z=[];for(let[J,Y]of Object.entries($.static)){if(X.has(J))continue;let G=$.staticNames?.[J]??J;if(typeof Y==="boolean"){if(Y)Z.push(I0(G));continue}if(Y===_5){Z.push(I0(G));continue}Z.push(`${I0(G)}="${I0(A3(String(Y)))}"`)}return Z}function r5($,X){let Z=[];for(let[J,Y]of Object.entries($.serverDynamic??{})){if(X.has(J))continue;if(Y===null||Y===void 0||Y===!1)continue;let G=$.serverDynamicNames?.[J]??J;if(Y===!0){Z.push(I0(G));continue}if(typeof Y==="object")continue;Z.push(`${I0(G)}="${I0(A3(String(Y)))}"`)}return Z}var W9=()=>{};function W8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function nH($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var R3;var N3=y(()=>{W9();R3={name:"StxLink",aliases:["stx-link"],render($,X,Z){let J=nH($),Y=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),G=typeof $.static.activeClass==="string"?$.static.activeClass:"active",Q=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",W=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,w=[];if(J.reactive)w.push(`:href="${W8(J.value)}"`);else w.push(`href="${W8(J.value)}"`);if(Y)w.push(`class="${W8(Y)}"`);if(w.push("data-stx-link"),w.push(`data-stx-active-class="${W8(G)}"`),w.push(`data-stx-exact-active-class="${W8(Q)}"`),W)w.push("data-stx-prefetch");let q=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return w.push(...n5($,q)),w.push(...r5($,q)),`<a ${w.join(" ")}>${X}</a>`}}});function g0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function c0($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function T3($,X,Z=!1){let J=$.serverDynamic[X];if(J!==void 0)return J!==!1&&J!=="false";let Y=$.static[X];if(Y!==void 0)return Y!=="false"&&Y!==!1;return Z}function XQ($){if($.includes("(")||$.includes(","))return $;let X=$.trim().split(/\s+/),Z=[];for(let J of X)if(J.includes(":")){let[Y,G]=J.split(":"),Q=rH[Y];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let W=Number.parseInt(Y);if(!Number.isNaN(W))Z.push(`(max-width: ${W}px) ${G}`)}}else Z.push(J);return Z.join(", ")}function k3($,X,Z,J){return X.map((Y)=>`${w8($,Y,void 0,Z,J)} ${Y}w`).join(", ")}function oH($,X,Z,J,Y){return X.map((G)=>{let Q=Z?Z*G:void 0;return`${w8($,Q,void 0,J,Y)} ${G}x`}).join(", ")}function w8($,X,Z,J,Y){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let G=[];if(X)G.push(`w_${X}`);if(Z)G.push(`h_${Z}`);if(Y)G.push(`f_${Y}`);G.push("q_auto");let Q=G.join(",");return $.replace("/upload/",`/upload/${Q}/`)}if(J==="imgix"){let G=new URLSearchParams;if(X)G.set("w",String(X));if(Z)G.set("h",String(Z));if(Y)G.set("fm",Y);G.set("auto","format");let Q=$.includes("?")?"&":"?";return`${$}${Q}${G.toString()}`}if(J==="bunny"){let G=new URLSearchParams;if(X)G.set("width",String(X));if(Z)G.set("height",String(Z));if(Y)G.set("format",Y);let Q=$.includes("?")?"&":"?";return`${$}${Q}${G.toString()}`}return $}function sH($,X,Z="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${X}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var rH,M3,I3;var E3=y(()=>{W9();rH={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},M3=[320,640,768,1024,1280,1536,1920];I3={name:"StxImage",aliases:["stx-image","stx-img"],render($,X,Z){let J=c0($,"src")||"",Y=c0($,"alt")||"",G=c0($,"width"),Q=c0($,"height"),W=c0($,"sizes"),w=c0($,"srcset"),q=c0($,"densities"),K=c0($,"format"),z=c0($,"placeholder"),U=c0($,"placeholderColor")||"#e5e7eb",j=c0($,"provider"),B=c0($,"class")||c0($,"className")||"",H=c0($,"style")||"",_=c0($,"quality"),L=T3($,"lazy",!0),O=T3($,"preload",!1),F=T3($,"picture",!1)||!!K,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=w||"",N="";if(!R&&W)R=k3(J,M3,j,K),N=XQ(W);else if(!R&&q){let b=q.split(/\s+/).map((S)=>Number.parseFloat(S.replace("x","")));R=oH(J,b,V,j,K)}else if(W)N=XQ(W);let k=[];if(H)k.push(H);if(V&&A)k.push(`aspect-ratio:${V}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let b=sH(V||16,A||9,U);k.push(`background-image:url(${b})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")k.push(`background-image:url(${g0(z)})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat");let I=w8(J,V,A,j,K),M=[];if(M.push(`src="${g0(I)}"`),M.push(`alt="${g0(Y)}"`),G)M.push(`width="${g0(G)}"`);if(Q)M.push(`height="${g0(Q)}"`);if(L)M.push('loading="lazy"');if(M.push('decoding="async"'),B)M.push(`class="${g0(B)}"`);if(k.length>0)M.push(`style="${g0(k.join(";"))}"`);if(R)M.push(`srcset="${g0(R)}"`);if(N)M.push(`sizes="${g0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);M.push(...n5($,E)),M.push(...r5($,E));let T=`<img ${M.join(" ")} />`,D="";if(O){let S=K==="webp"?"image/webp":K==="avif"?"image/avif":"";D=`<link rel="preload" as="image" href="${g0(I)}"${S?` type="${S}"`:""}${R?` imagesrcset="${g0(R)}"`:""}${N?` imagesizes="${g0(N)}"`:""} />
12540
- `}if(F){let b=[];if(K==="avif"||K==="auto"){let S=w8(J,V,A,j,"avif"),P=R?k3(J,M3,j,"avif"):`${S}`;b.push(`<source type="image/avif" srcset="${g0(P)}"${N?` sizes="${g0(N)}"`:""} />`)}if(K==="webp"||K==="auto"){let S=w8(J,V,A,j,"webp"),P=R?k3(J,M3,j,"webp"):`${S}`;b.push(`<source type="image/webp" srcset="${g0(P)}"${N?` sizes="${g0(N)}"`:""} />`)}return`${D}<picture>
12538
+ </div>`}}});var aG={};t(aG,{warnUnbalancedTags:()=>O3,findUnbalancedTags:()=>sG});function p5($){return $.replace(/[^\n]/g," ")}function sG($){let X=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,p5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,p5).replace(/<!--[\s\S]*?-->/g,p5).replace(/\{\{\{[\s\S]*?\}\}\}/g,p5).replace(/\{\{[\s\S]*?\}\}/g,p5).replace(/\{!![\s\S]*?!!\}/g,p5),Z=new Map,J=new Map,Y=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=Y.exec(X))!==null){let W=G[1]==="/",w=G[2],q=G[3]==="/";if(pH.has(w.toLowerCase()))continue;if(q)continue;if(W)J.set(w,(J.get(w)??0)+1);else{let K=Z.get(w);if(K)K.count++;else{let z=X.slice(0,G.index).split(`
12539
+ `).length;Z.set(w,{count:1,firstLine:z})}}}let Q=[];for(let W of new Set([...Z.keys(),...J.keys()])){if(iH.has(W.toLowerCase()))continue;let w=Z.get(W)?.count??0,q=J.get(W)??0;if(w!==q)Q.push({tag:W,opened:w,closed:q,firstOpenLine:Z.get(W)?.firstLine??0})}return Q}function O3($,X){let Z;try{Z=sG($)}catch{return}if(Z.length===0)return;let J=`${X}:${$.length}`;if(oG.has(J))return;oG.add(J);let Y=X?X.split(/[/\\]/).pop()||X:"template";for(let{tag:G,opened:Q,closed:W,firstOpenLine:w}of Z)if(Q>W){let q=w?` (first opened at line ${w})`:"";console.warn(`[stx] ${Y}: <${G}> ${Q} opened, ${W} closed \u2014 an unclosed <${G}>${q} may swallow the content that follows it.`)}else console.warn(`[stx] ${Y}: <${G}> ${Q} opened, ${W} closed \u2014 ${W-Q} stray </${G}>.`)}var pH,iH,oG;var L3=y(()=>{pH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),iH=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);oG=new Set});import Z1 from"path";import F3 from"fs";function tG($){return $.split("-").map((X)=>X.charAt(0).toUpperCase()+X.slice(1)).join("")}function eG($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class $Q{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let X of $.aliases)this.builtins.set(X.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,X,Z,J){let Y=$.endsWith(".stx")?$.slice(0,-4):$,G=J?.__importedComponents;if(G){let j=[Y,Y.toLowerCase(),tG(Y),eG(Y)];for(let B of j)if(G.has(B))return G.get(B)}let Q=[...new Set([`${Y}.stx`,`${tG(Y)}.stx`,`${eG(Y)}.stx`])];if(Y.startsWith("./")||Y.startsWith("../")){let j=Z1.resolve(Z1.dirname(X),`${Y}.stx`);if(await o(j))return j;return null}let W=[],w=Z.componentsDir||"",q=J?.__originalFilePath;if(q)W.push(Z1.join(Z1.dirname(q),"components"));if(w)W.push(w);let K=Z1.join(Z1.dirname(X),"components");if(!W.includes(K))W.push(K);let z=process.cwd(),U=[Z1.resolve(z,"src/components"),Z1.resolve(z,"components"),Z1.resolve(import.meta.dir,"components")];for(let j of U)if(!W.includes(j))W.push(j);for(let j of W){if(!j)continue;for(let B of Q){let H=Z1.join(j,B);if(await o(H))return H}try{if(!F3.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let H=F3.readdirSync(j,{withFileTypes:!0});for(let _ of H)if(_.isDirectory()){let L=Z1.join(j,_.name);for(let O of Q){let F=Z1.join(L,O);if(await o(F))return F}}}catch{}}return null}}var i0;var V3=y(()=>{F0();i0=new $Q});function I0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A3($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var H5="\x00stx-boolean-attribute";function i5($,X){let Z=[];for(let[J,Y]of Object.entries($.static)){if(X.has(J))continue;let G=$.staticNames?.[J]??J;if(typeof Y==="boolean"){if(Y)Z.push(I0(G));continue}if(Y===H5){Z.push(I0(G));continue}Z.push(`${I0(G)}="${I0(A3(String(Y)))}"`)}return Z}function n5($,X){let Z=[];for(let[J,Y]of Object.entries($.serverDynamic??{})){if(X.has(J))continue;if(Y===null||Y===void 0||Y===!1)continue;let G=$.serverDynamicNames?.[J]??J;if(Y===!0){Z.push(I0(G));continue}if(typeof Y==="object")continue;Z.push(`${I0(G)}="${I0(A3(String(Y)))}"`)}return Z}var W9=()=>{};function W8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function nH($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var R3;var N3=y(()=>{W9();R3={name:"StxLink",aliases:["stx-link"],render($,X,Z){let J=nH($),Y=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),G=typeof $.static.activeClass==="string"?$.static.activeClass:"active",Q=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",W=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,w=[];if(J.reactive)w.push(`:href="${W8(J.value)}"`);else w.push(`href="${W8(J.value)}"`);if(Y)w.push(`class="${W8(Y)}"`);if(w.push("data-stx-link"),w.push(`data-stx-active-class="${W8(G)}"`),w.push(`data-stx-exact-active-class="${W8(Q)}"`),W)w.push("data-stx-prefetch");let q=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return w.push(...i5($,q)),w.push(...n5($,q)),`<a ${w.join(" ")}>${X}</a>`}}});function f0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function m0($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function T3($,X,Z=!1){let J=$.serverDynamic[X];if(J!==void 0)return J!==!1&&J!=="false";let Y=$.static[X];if(Y!==void 0)return Y!=="false"&&Y!==!1;return Z}function XQ($){if($.includes("(")||$.includes(","))return $;let X=$.trim().split(/\s+/),Z=[];for(let J of X)if(J.includes(":")){let[Y,G]=J.split(":"),Q=rH[Y];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let W=Number.parseInt(Y);if(!Number.isNaN(W))Z.push(`(max-width: ${W}px) ${G}`)}}else Z.push(J);return Z.join(", ")}function k3($,X,Z,J){return X.map((Y)=>`${w8($,Y,void 0,Z,J)} ${Y}w`).join(", ")}function oH($,X,Z,J,Y){return X.map((G)=>{let Q=Z?Z*G:void 0;return`${w8($,Q,void 0,J,Y)} ${G}x`}).join(", ")}function w8($,X,Z,J,Y){if(!J||J==="local"||J==="static")return $;if(J==="cloudinary"){let G=[];if(X)G.push(`w_${X}`);if(Z)G.push(`h_${Z}`);if(Y)G.push(`f_${Y}`);G.push("q_auto");let Q=G.join(",");return $.replace("/upload/",`/upload/${Q}/`)}if(J==="imgix"){let G=new URLSearchParams;if(X)G.set("w",String(X));if(Z)G.set("h",String(Z));if(Y)G.set("fm",Y);G.set("auto","format");let Q=$.includes("?")?"&":"?";return`${$}${Q}${G.toString()}`}if(J==="bunny"){let G=new URLSearchParams;if(X)G.set("width",String(X));if(Z)G.set("height",String(Z));if(Y)G.set("format",Y);let Q=$.includes("?")?"&":"?";return`${$}${Q}${G.toString()}`}return $}function sH($,X,Z="#e5e7eb"){let J=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${X}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(J)}`}var rH,M3,I3;var E3=y(()=>{W9();rH={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},M3=[320,640,768,1024,1280,1536,1920];I3={name:"StxImage",aliases:["stx-image","stx-img"],render($,X,Z){let J=m0($,"src")||"",Y=m0($,"alt")||"",G=m0($,"width"),Q=m0($,"height"),W=m0($,"sizes"),w=m0($,"srcset"),q=m0($,"densities"),K=m0($,"format"),z=m0($,"placeholder"),U=m0($,"placeholderColor")||"#e5e7eb",j=m0($,"provider"),B=m0($,"class")||m0($,"className")||"",H=m0($,"style")||"",_=m0($,"quality"),L=T3($,"lazy",!0),O=T3($,"preload",!1),F=T3($,"picture",!1)||!!K,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=w||"",N="";if(!R&&W)R=k3(J,M3,j,K),N=XQ(W);else if(!R&&q){let b=q.split(/\s+/).map((S)=>Number.parseFloat(S.replace("x","")));R=oH(J,b,V,j,K)}else if(W)N=XQ(W);let k=[];if(H)k.push(H);if(V&&A)k.push(`aspect-ratio:${V}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let b=sH(V||16,A||9,U);k.push(`background-image:url(${b})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")k.push(`background-image:url(${f0(z)})`),k.push("background-size:cover"),k.push("background-repeat:no-repeat");let I=w8(J,V,A,j,K),M=[];if(M.push(`src="${f0(I)}"`),M.push(`alt="${f0(Y)}"`),G)M.push(`width="${f0(G)}"`);if(Q)M.push(`height="${f0(Q)}"`);if(L)M.push('loading="lazy"');if(M.push('decoding="async"'),B)M.push(`class="${f0(B)}"`);if(k.length>0)M.push(`style="${f0(k.join(";"))}"`);if(R)M.push(`srcset="${f0(R)}"`);if(N)M.push(`sizes="${f0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);M.push(...i5($,E)),M.push(...n5($,E));let T=`<img ${M.join(" ")} />`,D="";if(O){let S=K==="webp"?"image/webp":K==="avif"?"image/avif":"";D=`<link rel="preload" as="image" href="${f0(I)}"${S?` type="${S}"`:""}${R?` imagesrcset="${f0(R)}"`:""}${N?` imagesizes="${f0(N)}"`:""} />
12540
+ `}if(F){let b=[];if(K==="avif"||K==="auto"){let S=w8(J,V,A,j,"avif"),P=R?k3(J,M3,j,"avif"):`${S}`;b.push(`<source type="image/avif" srcset="${f0(P)}"${N?` sizes="${f0(N)}"`:""} />`)}if(K==="webp"||K==="auto"){let S=w8(J,V,A,j,"webp"),P=R?k3(J,M3,j,"webp"):`${S}`;b.push(`<source type="image/webp" srcset="${f0(P)}"${N?` sizes="${f0(N)}"`:""} />`)}return`${D}<picture>
12541
12541
  ${b.join(`
12542
12542
  `)}
12543
12543
  ${T}
12544
- </picture>`}return`${D}${T}`}}});function q8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function o5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var ZQ="/images/safe-image-default.svg",aH,D3;var y3=y(()=>{W9();aH=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${ZQ}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,D3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,X,Z){let J=o5($,"src")||"",Y=o5($,"alt")||"",G=o5($,"fallback")||ZQ,Q=o5($,"class")||o5($,"className")||"",W=o5($,"fallbackClassName")||"",w=[];if(w.push(`src="${q8(J)}"`),w.push(`alt="${q8(Y)}"`),Q)w.push(`class="${q8(Q)}"`);if(w.push(`data-fallback="${q8(G)}"`),W)w.push(`data-fallback-class="${q8(W)}"`);w.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);w.push(...n5($,q)),w.push(...r5($,q));let K=`<img ${w.join(" ")} />`,z=Z.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${aH}${K}`;return K}}});function b3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function K8($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function w9($,X,Z){let J=K8($,X);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return Z}var S3;var C3=y(()=>{S3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,X,Z){let J=b3(K8($,"color")||"#6366f1"),Y=b3(K8($,"initialColor")||K8($,"initial-color")||""),G=b3(K8($,"height")||"3px"),Q=w9($,"duration",2000),W=w9($,"throttle",200),w=w9($,"zIndex",999999)||w9($,"z-index",999999),q=Y?`linear-gradient(to right, ${Y}, ${J})`:J;return`
12544
+ </picture>`}return`${D}${T}`}}});function q8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function r5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var ZQ="/images/safe-image-default.svg",aH,D3;var y3=y(()=>{W9();aH=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${ZQ}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,D3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,X,Z){let J=r5($,"src")||"",Y=r5($,"alt")||"",G=r5($,"fallback")||ZQ,Q=r5($,"class")||r5($,"className")||"",W=r5($,"fallbackClassName")||"",w=[];if(w.push(`src="${q8(J)}"`),w.push(`alt="${q8(Y)}"`),Q)w.push(`class="${q8(Q)}"`);if(w.push(`data-fallback="${q8(G)}"`),W)w.push(`data-fallback-class="${q8(W)}"`);w.push('onerror="window.__stxSafeImageHandler(this)"');let q=new Set(["src","alt","fallback","class","className","fallbackClassName"]);w.push(...i5($,q)),w.push(...n5($,q));let K=`<img ${w.join(" ")} />`,z=Z.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${aH}${K}`;return K}}});function b3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function K8($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function w9($,X,Z){let J=K8($,X);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return Z}var S3;var C3=y(()=>{S3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,X,Z){let J=b3(K8($,"color")||"#6366f1"),Y=b3(K8($,"initialColor")||K8($,"initial-color")||""),G=b3(K8($,"height")||"3px"),Q=w9($,"duration",2000),W=w9($,"throttle",200),w=w9($,"zIndex",999999)||w9($,"z-index",999999),q=Y?`linear-gradient(to right, ${Y}, ${J})`:J;return`
12545
12545
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${G};background:${q};z-index:${w};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
12546
12546
  <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>
12547
12547
  </div>
@@ -12565,7 +12565,7 @@ ${T}
12565
12565
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
12566
12566
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
12567
12567
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
12568
- </style>`}}});function s5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var QQ,g3;var h3=y(()=>{QQ={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},g3={name:"StxDrawer",aliases:["stx-drawer"],render($,X,Z){let J=s5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=I0(J),G=s5($,"side")||"right",Q=s5($,"size")||"md",W=s5($,"closeOnBackdrop")!=="false",w=s5($,"closeOnEscape")!=="false",q=s5($,"overlay")!=="false",K=QQ[Q]||QQ.md,z=G==="left",U=z?"left:0":"right:0",j=z?"translateX(-100%)":"translateX(100%)",B=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${W}" data-close-escape="${w}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
12568
+ </style>`}}});function o5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var QQ,g3;var h3=y(()=>{QQ={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},g3={name:"StxDrawer",aliases:["stx-drawer"],render($,X,Z){let J=o5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=I0(J),G=o5($,"side")||"right",Q=o5($,"size")||"md",W=o5($,"closeOnBackdrop")!=="false",w=o5($,"closeOnEscape")!=="false",q=o5($,"overlay")!=="false",K=QQ[Q]||QQ.md,z=G==="left",U=z?"left:0":"right:0",j=z?"translateX(-100%)":"translateX(100%)",B=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Y}" class="stx-drawer-backdrop" data-stx-drawer="${Y}" data-close-backdrop="${W}" data-close-escape="${w}" style="display:none;position:fixed;inset:0;z-index:99999;${q?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
12569
12569
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${U};width:${K};max-width:100vw;transform:${j};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">
12570
12570
  <div style="padding:1.5rem">${X}</div>
12571
12571
  </div>
@@ -12574,8 +12574,8 @@ ${T}
12574
12574
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
12575
12575
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
12576
12576
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
12577
- </style>`}}});import{existsSync as eH,readFileSync as $_}from"fs";function X_($){if(WQ.has($))return;WQ.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Z_($){let X=process.cwd();for(let Z of[`${X}/node_modules/@iconify-json/${$}/icons.json`,`${X}/pantry/@iconify-json/${$}/icons.json`,`${X}/node_modules/@iconify/json/json/${$}.json`,`${X}/pantry/@iconify/json/json/${$}.json`])if(eH(Z))return Z;for(let Z of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return B0.resolve(Z)}catch{}return null}function J_($){if(K9.has($))return K9.get($);let X=Z_($);if(!X)return X_($),null;try{let Z=JSON.parse($_(X,"utf8"));return K9.set($,Z.icons),Z.icons}catch{return null}}function a5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);if($.static[X]!==void 0)return String($.static[X]);if($.clientReactive[X]!==void 0)return $.clientReactive[X];return}var K9,WQ,u3;var d3=y(()=>{K9=new Map,WQ=new Set;u3={name:"Icon",aliases:["icon","stx-icon"],render($,X,Z){let J=a5($,"name")??a5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",G=J;if(J.includes(":")){let O=J.split(":");Y=O[0],G=O[1]}let Q=I0(a5($,"size")||"24"),W=I0(a5($,"color")||"currentColor"),w=I0(a5($,"class")||""),q=I0(a5($,"style")||""),K=K9.get(Y)??J_(Y);if(!K)return`<!-- Icon: collection "${Y}" not loaded -->`;let z=K[G];if(!z)return`<!-- Icon: "${G}" not found in ${Y} -->`;let U=z.width||24,j=z.height||24,B=`0 0 ${U} ${j}`,H=z.body;if(W!=="currentColor")H=H.replace(/currentColor/g,W);let _=w?` class="${w}"`:"",L=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${B}" fill="none"${_}${L}>${H}</svg>`}}});function wQ($,...X){for(let Z of X){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J}return}function qQ($,X){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${X}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Z);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var m3;var c3=y(()=>{m3={name:"Suspense",aliases:["suspense"],render($,X,Z){let J=qQ(X,"fallback"),Y=J.rest,G=qQ(Y,"error"),Q=G.rest,W=J.region??wQ($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',w=G.region??wQ($,"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>${w}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function z9($,...X){for(let Z of X){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J}return}var l3;var p3=y(()=>{l3={name:"TransitionGroup",aliases:["transition-group"],render($,X,Z){let J=(z9($,"name")||"v").replace(/["'<>]/g,""),Y=(z9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=z9($,"class"),Q=z9($,"id"),W=[`data-stx-transition-group="${J}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${Y} ${W}>${X}</${Y}>`}}});function KQ(){r0.registerBuiltin(R3),r0.registerBuiltin(I3),r0.registerBuiltin(D3),r0.registerBuiltin(S3),r0.registerBuiltin(P3),r0.registerBuiltin(x3),r0.registerBuiltin(g3),r0.registerBuiltin(u3),r0.registerBuiltin(m3),r0.registerBuiltin(l3)}var zQ=y(()=>{N3();E3();y3();C3();v3();f3();h3();d3();c3();p3();V3();N3();E3();y3();C3();v3();f3();h3();d3();c3();p3()});function U9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function UQ($,X,Z){let J=[],Y=0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;let W=$.slice(G+1).match(new RegExp(`^(${X.source})(?![\\w.:-])`));if(!W){Y=G+1;continue}let w=W[1];if(Z&&Z.has(w.toLowerCase())){let H=G+1+w.length;while(H<$.length&&$[H]!==">")H++;Y=H+1;continue}let q=G+1+w.length,K=null,z=q,U=-1,j=!1;while(q<$.length){let H=$[q];if(K){if(H==="\\"&&q+1<$.length){q+=2;continue}if(H===K)K=null;q++;continue}if(H==='"'||H==="'"){K=H,q++;continue}if(H==="/"&&q+1<$.length&&$[q+1]===">"){U=q+2,j=!0;break}if(H===">"){U=q+1;break}q++}if(U===-1){Y=G+1;continue}let B=$.slice(z,j?U-2:U-1).trim();if(j)J.push({fullMatch:$.slice(G,U),tagName:w,attributes:B,content:"",startIndex:G,endIndex:U,isSelfClosing:!0}),Y=U;else{let H=`<${w}`,_=`</${w}>`,L=1,O=U,F=-1;while(L>0&&O<$.length){let R=$.indexOf(H,O),N=$.indexOf(_,O);if(N===-1)break;if(R!==-1&&R<N){let k=$[R+H.length];if(k===" "||k===">"||k==="/"||k===`
12578
- `||k==="\t")L++;O=R+H.length}else{if(L--,L===0){F=N;break}O=N+_.length}}if(F===-1){Y=U;continue}let V=$.slice(U,F),A=F+_.length;J.push({fullMatch:$.slice(G,A),tagName:w,attributes:B,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),Y=A}}return J}function jQ($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function BQ($,X){try{let Z=Buffer.from($,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if(X?.debug)console.error("Error decoding __stx_ prop:",Z);return $}}var HQ=y(()=>{b0();V0();x1()});var RQ={};e(RQ,{processESImports:()=>VQ,processComponents:()=>B9});import j9 from"fs";import t0 from"path";function G_($,X,Z){let J={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Y=new Set(Array.isArray(X.__stx_client_signal_names)?X.__stx_client_signal_names:[]),G=(q)=>{if(Y.size===0)return!1;let K=e0(q),z=K.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(z&&Y.has(z))return!0;for(let U of Y){let j=U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${j}\\s*\\(`).test(K))return!0}return!1},Q=new Set(F2),W=(q)=>{if(!q.includes("-")||q.startsWith("@")||q.startsWith(":")||q.startsWith("x-")||q.startsWith("__"))return q;if(q.startsWith("aria-")||q.startsWith("data-"))return q;return q.replace(/-([a-z0-9])/g,(K,z)=>z.toUpperCase())},w=(q,K)=>{let z=W(q);if(J.static[z]=K,z!==q)J.staticNames[z]=q};for(let[q,K]of Object.entries($)){let z=q.startsWith("x-")&&!Q.has(q)&&!q.startsWith("x-bind:")&&!q.startsWith("x-on:")?`:${q.slice(2)}`:q;if(z.startsWith("@")){J.events[z]=K;continue}if(z.startsWith("__stx_")){let U=W(z.slice(6));J.serverDynamic[U]=BQ(K,Z);continue}if(z.startsWith(":")){let U=W(z.slice(1)),j=K===_5?U:K;if(U==="if"||U==="for"||U==="show"){J.clientReactive[U]=j;continue}if(G(j)){J.clientReactive[U]=j;continue}try{if(!K0(j)){if(Z.debug)console.error(`Unsafe expression in :${U} binding: ${j}`);J.clientReactive[U]=j;continue}let B=Object.keys(X),_=z0(j,B)(...Object.values(X));if(_===void 0){let L=j.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(L.some((V)=>!O.has(V)&&!B.includes(V))){J.clientReactive[U]=j;continue}}if(J.serverDynamic[U]=_,U!==z.slice(1)&&J.serverDynamicNames)J.serverDynamicNames[U]=z.slice(1)}catch{J.clientReactive[U]=j}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let U=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let j=U[1];if(K0(j)){let H=z0(j,Object.keys(X))(...Object.values(X));w(z,H!=null?String(H):"")}else{if(Z.debug)console.error(`Unsafe expression in ${z}: ${j}`);w(z,K)}}catch(j){if(Z.debug)console.error(`Error evaluating expression for ${z}:`,j);w(z,K)}else{let j=K,B=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=B.exec(K))!==null)try{let _=H[1];if(!K0(_)){if(Z.debug)console.error(`Unsafe expression in ${z}: ${_}`);continue}let O=z0(_,Object.keys(X))(...Object.values(X));j=j.replace(H[0],String(O??""))}catch(_){if(Z.debug)console.error(`Error evaluating expression in ${z}:`,_)}w(z,j)}continue}w(z,K===_5?"true":jQ(K))}return J}function W_($,X,Z){if(!$.includes("@"))return $;if(!Q_.some(([Y,G])=>Y.test($)&&$.includes(G)))return $;try{return E1($,X,Z)}catch{return $}}function w_($){let X={},Z=0,J=$.length;while(Z<J){while(Z<J&&/\s/.test($[Z]))Z++;if(Z>=J)break;let Y="";while(Z<J&&!/[\s=]/.test($[Z]))Y+=$[Z],Z++;if(!Y)break;while(Z<J&&/\s/.test($[Z]))Z++;if(Z<J&&$[Z]==="="){Z++;while(Z<J&&/\s/.test($[Z]))Z++;let G="";if(Z<J&&($[Z]==='"'||$[Z]==="'")){let Q=$[Z];Z++;while(Z<J){let W=$[Z];if(W==="\\"&&Z+1<J){Z++,G+=$[Z],Z++;continue}if(W===Q){Z++;break}G+=W,Z++}}else while(Z<J&&!/\s/.test($[Z]))G+=$[Z],Z++;X[Y]=G}else X[Y]=_5}return X}function OQ($){return Object.entries($).map(([X,Z])=>Z===_5?X:`${X}="${q_(Z)}"`).join(" ")}function q_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function K_($){let X=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Z.exec($))!==null){let Y=J[1];if(r0.isBuiltin(Y))X.add(Y)}return[...X].sort()}function z_($){let X=LQ.get($);if(X)return X;let Z=new Map,J=[t0.join($,"src"),t0.join($,"dist"),$];function Y(G,Q){if(Q>6)return;let W;try{W=j9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let w of W){let q=t0.join(G,w.name);if(w.isDirectory()){if(w.name==="node_modules"||w.name.startsWith("."))continue;Y(q,Q+1)}else if(w.isFile()&&w.name.endsWith(".stx")){let K=w.name.slice(0,-4);if(!Z.has(K))Z.set(K,q);let z=K.toLowerCase();if(!Z.has(z))Z.set(z,q);let U=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(U))Z.set(U,q)}}}for(let G of J)if(Y(G,0),Z.size>0)break;return LQ.set($,Z),Z}function U_($,X){if($.startsWith(".")||$.startsWith("/"))return null;let Z=X;while(!0){let J=t0.join(Z,"node_modules",$);try{if(j9.statSync(J).isDirectory())return J}catch{}let Y=t0.dirname(Z);if(Y===Z)return null;Z=Y}}async function VQ($,X,Z,J,Y){if(!$.includes("import"))return $;if(!X.__importedComponents)X.__importedComponents=new Map;let G=X.__importedComponents,Q=t0.dirname(Z),W=$,w=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return W=W.replace(w,(q,K,z)=>{let U=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,j=z,B,H=[];while((B=U.exec(z))!==null){let[_,L,O,F]=B,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let k=t0.resolve(Q,F);if(k.endsWith(".stx"))A=k;else{let I=`${k}.stx`;try{if(j9.statSync(I).isFile())A=I}catch{try{if(j9.statSync(k).isDirectory())V=k}catch{}}}}else V=U_(F,Q);if(!V&&!A)continue;let R=!1,N=(k,I)=>{G.set(k,I),G.set(k.toLowerCase(),I);let M=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(M,I),Y.add(I)};if(O&&A)N(O,A),R=!0;else if(L){let k=L.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let E=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:M,local:M}}),I=V?z_(V):null;for(let{source:M,local:E}of k){let T=null;if(A)T=A;else if(I)T=I.get(M)??I.get(M.toLowerCase())??I.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(T)N(E,T),R=!0}}if(R)H.push({start:B.index,end:B.index+_.length})}if(H.length===0)return q;for(let _=H.length-1;_>=0;_--)j=j.slice(0,H[_].start)+j.slice(H[_].end);return`<script${K}>${j}</script>`}),W}async function j_($,X,Z,J,Y){let G=$;if(!X.__importedComponents)X.__importedComponents=new Map;let Q=X.__importedComponents,W=/@import\s*\(\s*([^)]+)\s*\)/g,w;while((w=W.exec(G))!==null){let[q,K]=w,z=K.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of z){let j=U.split("/"),H=j[j.length-1].replace(/\.stx$/,""),_=H.includes("-")?H.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),L=null,O=[t0.resolve(t0.dirname(Z),`${U}.stx`),t0.resolve(t0.dirname(Z),U),t0.resolve(J.componentsDir||"components",`${U}.stx`),t0.resolve(J.componentsDir||"components",U),U.endsWith(".stx")?U:`${U}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){L=F;break}}catch{}if(L){Q.set(_,L),Q.set(H,L),Q.set(H.toLowerCase(),L);let F=_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,L),Y.add(L),J.debug)console.log(`Imported component: ${_} -> ${L}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${U}`)}G=G.replace(q,""),W.lastIndex=0}return G}async function B_($,X,Z,J,Y){let G=$,Q=J.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let W=X.__processedComponents,w=/@component\s*\(/g,q;while((q=w.exec(G))!==null){let K=q.index,z=K+q[0].length-1,U=1,j=z+1;while(j<G.length&&U>0){if(G[j]==="(")U++;else if(G[j]===")"){if(U--,U===0)break}j++}if(U!==0)break;let B=G.substring(z+1,j),H=j+1,_=B.match(/^\s*['"]([^'"]+)['"]/);if(!_){w.lastIndex=0;continue}let L=_[1],O,F=B.slice(_[0].length),V=F.match(/^\s*,\s*/);if(V)O=F.slice(V[0].length).trim();let A={};if(O)try{A=y0(O,X)}catch(E){let T=E instanceof Error?E.message:String(E);G=G.replace(G.substring(K,H),`[Error parsing component props: ${T}]`);continue}let R="",N=H,I=G.substring(H).match(/^([\s\S]*?)@endcomponent/);if(I)R=I[1].trim(),N=H+I[0].length;let M=await q5(L,A,R,Q,X,Z,J,W,Y);G=G.substring(0,K)+M+G.substring(N),w.lastIndex=0}return G}async function H_($,X,Z,J,Y){if(!$)return $;let G=$,Q=J.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let W=X.__processedComponents,w=U1(G);return G=w.output,G=await U(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await U(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await U(G,/[a-z][a-z0-9]*/,!1,Y_),G=C5(G,w.scripts),G;async function U(j,B,H,_){if(!j)return j;let L=j,O=UQ(L,B,_);for(let F=O.length-1;F>=0;F--){let V=O[F],A=H?U9(V.tagName):V.tagName,R=w_(W_(V.attributes,X,Z)),N=G_(R,X,J),k=r0.getBuiltin(V.tagName),I=k?await L$(A,Q,X,Z,J):!1;if(k&&!I){let D={context:X,filePath:Z,options:J,dependencies:Y},b=k.render(N,V.content,D);if(Object.keys(N.clientReactive).length>0)b=FQ(b,N.clientReactive);if(Object.keys(N.events).length>0){let S=OQ(N.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${S}`)}L=L.substring(0,V.startIndex)+b+L.substring(V.endIndex);continue}if(!H&&V.tagName.includes("-")&&!await L$(A,Q,X,Z,J))continue;let M={};for(let[D,b]of Object.entries(N.static))M[D]=b;for(let[D,b]of Object.entries(N.serverDynamic))M[D]=b;let T=await q5(A,M,C5(V.content,w.scripts),Q,X,Z,J,W,Y);if(Object.keys(N.clientReactive).length>0)T=FQ(T,N.clientReactive);if(Object.keys(N.events).length>0){let D=AQ(T);if(D){let b=OQ(N.events),S=Object.keys(N.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");T=T.substring(0,D.insertPos)+` data-stx-parent-events="${S}" ${b}`+T.substring(D.insertPos)}}L=L.substring(0,V.startIndex)+T+L.substring(V.endIndex)}return L}}function FQ($,X){let Z=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(X).filter(([K])=>!Z.has(K)),G=Y.filter(([K])=>!J.has(K)).map(([K])=>U9(K)).join(" "),Q=$,W=Y.length>0?AQ(Q):null;if(W){let K=Y.map(([U,j])=>`:${U9(U)}="${j.replace(/"/g,"&quot;")}"`).join(" "),z=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,W.insertPos)+`${z} ${K}`+Q.substring(W.insertPos)}let w=X.if;if(w)Q=`<template :if="${w.replace(/"/g,"&quot;")}">${Q}</template>`;let q=X.for;if(q)Q=`<template :for="${q.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function AQ($){let X=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(X)return{insertPos:X.index+1+X[1].length};let Z=0;while(Z<$.length){let J=$.slice(Z),Y=J.match(/^\s+/);if(Y){Z+=Y[0].length;continue}if(J.startsWith("<!--")){let W=$.indexOf("-->",Z+4);if(W===-1)return null;Z=W+3;continue}let G=J.match(/^<(script|style)\b[^>]*>/i);if(G){let W=`</${G[1].toLowerCase()}>`,w=$.toLowerCase().indexOf(W,Z+G[0].length);if(w===-1)return null;Z=w+W.length;continue}let Q=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function B9($,X,Z,J,Y){if(!_Q)KQ(),_Q=!0;let G=await VQ($,X,Z,J,Y);G=await j_(G,X,Z,J,Y),G=await B_(G,X,Z,J,Y);let Q=[];for(let W=0;W<3;W++){let w=z1(G,h7,(K,z)=>`\x00STX_COMPONENT_COMMENT_${Q.length+z}\x00`);Q.push(...w.tokens);let q=G;if(G=await H_(w.output,X,Z,J,Y),G===q)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(W,w)=>Q[Number(w)]??"");if(J.debug){let W=K_(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 _Q=!1,Y_,Q_,LQ;var i3=y(()=>{V3();Z8();zQ();HQ();x1();V0();b0();J1();Y_=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"]);Q_=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];LQ=new Map});var DQ={};e(DQ,{processLoops:()=>r3,parseLoopBinding:()=>n3});function L_($,X){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,J="",Y=0,G;while((G=Z.exec($))!==null){let Q=G.index+G[0].length,W=G.index+G[0].indexOf("("),w=x0($,"(",")",W);if(w===-1)continue;let q=$.slice(Q,w).trim();if(!q)continue;if(!Object.keys(X).some((U)=>new RegExp(`(?:^|[^\\w$.])${U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let z;try{let U=y0(q,X);if(!U||typeof U!=="object")continue;z=JSON.stringify(U)}catch{continue}J+=$.slice(Y,Q)+z,Y=w,Z.lastIndex=w}return Y===0?$:J+$.slice(Y)}function F_($,X){let Z=/@component\s*\(/g,J=$,Y,G=[];while((Y=Z.exec(J))!==null){let Q=Y.index,W=Q+Y[0].length-1,w=1,q=W+1;while(q<J.length&&w>0){if(J[q]==="(")w++;else if(J[q]===")"){if(w--,w===0)break}q++}if(w!==0)continue;let K=J.substring(W+1,q),z=q+1,U=K.match(/^\s*['"]([^'"]+)['"]/);if(!U)continue;let j=U[1],B=K.slice(U[0].length),H=B.match(/^\s*,\s*/);if(!H)continue;let _=B.slice(H[0].length).trim();if(!_)continue;try{let L=y0(_,X),O=JSON.stringify(L),F=`@component('${j}', ${O})`;G.push({start:Q,end:z,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:W,end:w,replacement:q}=G[Q];J=J.substring(0,W)+q+J.substring(w)}return J}function H9($,X,Z){let J=$,Y=new RegExp(`${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=Y.exec(J))!==null){let Q=G.index,W=Q+G[0].length-1,w=1,q=W+1,K=null,z=!1;while(q<J.length&&w>0){let B=J[q];if(z){z=!1,q++;continue}if(B==="\\"&&K){z=!0,q++;continue}if(K){if(B===K)K=null;q++;continue}if(B==='"'||B==="'"||B==="`"){K=B,q++;continue}if(B==="(")w++;else if(B===")"){if(w--,w===0)break}q++}if(w!==0)break;let U=J.substring(W+1,q),j=Z(U);J=J.substring(0,Q)+j+J.substring(q+1)}return J}function V_($,X){let Z=$;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,Y)=>{if(Y in X)return`:${Y}="${Y}"`;return J}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,Y,G)=>{try{let Q=Object.keys(X),W=Object.values(X);h8(G);let q=z0(G,Q)(...W),K=JSON.stringify(q),z=Buffer.from(K,"utf8").toString("base64");return`__stx_${Y}="${z}"`}catch(Q){return J}}),Z}function A_($,X){let Z=$;return Z=H9(Z,"@break",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(K0(G)){let W=z0(G,Object.keys(X));Q=Boolean(W(...Object.values(X)))}else Q=Boolean(Q0(G,X));return Q?_9:""}catch{return""}}),Z=H9(Z,"@continue",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(K0(G)){let W=z0(G,Object.keys(X));Q=Boolean(W(...Object.values(X)))}else Q=Boolean(Q0(G,X));return Q?O9:""}catch{return""}}),Z}function R_($){let X=$;return X=X.replace(/@break(?!\()/g,_9),X=X.replace(/@continue(?!\()/g,O9),X}function NQ($){let X=$.includes(_9),Z=X?$.substring(0,$.indexOf(_9)):$;return{hasBreak:X,content:Z}}function MQ($){let X=$.includes(O9),Z=X?$.substring(0,$.indexOf(O9)):$;return{hasContinue:X,content:Z}}function kQ($){let X=$;return X=H9(X,"@break",(Z)=>{let J=Z.trim();if(!u8(J))return"";return`\`; if (${J}) { break; } result += \``}),X=H9(X,"@continue",(Z)=>{let J=Z.trim();if(!u8(J))return"";return`\`; if (${J}) { continue; } result += \``}),X=X.replace(/@break(?!\()/g,"`; break; result += `"),X=X.replace(/@continue(?!\()/g,"`; continue; result += `"),X}function N_($){let X=/@forelse\s*\(/g,Z,J=[],Y=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=Y.exec($))!==null)J.push({pos:Q.index,delta:1});while((Q=G.exec($))!==null)J.push({pos:Q.index,delta:-1});J.sort((K,z)=>K.pos-z.pos);let W=[],w=0;for(let K of J)w+=K.delta,W.push({pos:K.pos,depth:w});function q(K){let z=0,U=W.length-1,j=0;while(z<=U){let B=z+U>>1;if(W[B].pos<=K)j=W[B].depth,z=B+1;else U=B-1}return j}while((Z=X.exec($))!==null){if(q(Z.index)>0)continue;let K=Z.index,z=Z.index+Z[0].length-1,U=1,j=z+1,B=-1;while(j<$.length&&U>0){if($[j]==="(")U++;else if($[j]===")"){if(U--,U===0){B=j;break}}j++}if(B===-1)continue;let H=$.substring(z+1,B),_=n3(H);if(!_)continue;let{arrayExpr:L,itemVar:O}=_,F=B+1,V=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,k=-1;while(V>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let b=R.exec($),S=N.exec($);if(!S)break;if(b&&b.index<S.index)V++,A=b.index+b[0].length;else{if(V--,V===0){k=S.index;break}A=S.index+11}}if(k===-1)continue;let I=$.substring(F,k),M=k+11,E=-1,T=0,D=0;while(D<I.length){let b=I.indexOf("@",D);if(b===-1)break;let S=I.substring(b);if(/^@forelse\s*\(/.test(S))T++,D=b+1;else if(S.startsWith("@endforelse"))T--,D=b+11;else if(T===0&&S.startsWith("@empty")){if(I.length<=b+6||!/[a-z]/i.test(I[b+6])){E=b;break}D=b+1}else D=b+1}if(E===-1)continue;return{start:K,end:M,arrayExpr:L,itemVar:O,foreachContent:I.substring(0,E),emptyContent:I.substring(E+6)}}return null}function TQ($,X){let Z=$;while(!0){let J=N_(Z);if(!J)break;let{start:Y,end:G,arrayExpr:Q,itemVar:W,foreachContent:w,emptyContent:q}=J;try{let K;if(K0(Q))K=z0(Q,Object.keys(X))(...Object.values(X));else K=Q0(Q,X);let z;if(!Array.isArray(K)||K.length===0)z=q;else z=`@foreach (${Q} as ${W})${w}@endforeach`;Z=Z.substring(0,Y)+z+Z.substring(G)}catch(K){let z=K instanceof Error?K.message:String(K),U=J0("Forelse",`Error in @forelse(${Q} as ${W}): ${z}`,s.EVALUATION_ERROR);Z=Z.substring(0,Y)+U+Z.substring(G)}}return Z}function n3($){let X=$.indexOf(" as ");if(X!==-1){let G=$.slice(0,X).trim(),Q=$.slice(X+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!Z)return null;let J=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=Z[2].trim();return J&&Y?{arrayExpr:Y,itemVar:J}:null}function r3($,X,Z,J){let Y=$;Y=TQ(Y,X);function G(w){let q=/@foreach\s*\(/g,K;while((K=q.exec(w))!==null){let z=K.index,U=K.index+K[0].length-1,j=1,B=U+1,H=-1;while(B<w.length&&j>0){if(w[B]==="(")j++;else if(w[B]===")"){if(j--,j===0){H=B;break}}B++}if(H===-1)continue;let _=w.substring(U+1,H),L=n3(_);if(!L)continue;let O=z,{arrayExpr:F,itemVar:V}=L,A=H+1,R=1,N=A,k=/@foreach\s*\(/g,I=/@endforeach/g;while(R>0&&N<w.length){k.lastIndex=N,I.lastIndex=N;let M=k.exec(w),E=I.exec(w);if(!E)break;if(M&&M.index<E.index)R++,N=M.index+M[0].length;else{if(R--,R===0){let T=w.substring(A,E.index),D=E.index+11;return{start:O,end:D,arrayExpr:F,itemVar:V,content:T}}N=E.index+11}}}return null}function Q(w,q){let K=w;while(!0){let z=G(K);if(!z)break;let{start:U,end:j,arrayExpr:B,itemVar:H,content:_}=z;try{let L=B.trim(),O;if(K0(L))O=z0(L,Object.keys(q))(...Object.values(q));else O=Q0(L,q);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),F=!0;else{console.warn(`[stx] @foreach(${L}) in ${Z}: ${L} 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 E=J0("Foreach",`Error in @foreach: ${L} is not iterable`,s.TYPE_ERROR);K=K.substring(0,U)+E+K.substring(j);continue}let V=J?.loops?.useAltLoopVariable??O_,A=H.trim(),R=null,N,k=!1;if(A.includes("=>")){let E=A.split("=>").map((T)=>T.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((T)=>T.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1],k=!0;else N=A}else N=A;let I="",M=O;for(let E=0;E<M.length;E++){let T=M[E],D={index:E,iteration:E+1,first:E===0,last:E===M.length-1,count:M.length},b={...q,loop:D,$loop:D};if(N.startsWith("[")&&N.endsWith("]")){let x=N.slice(1,-1).split(",").map((i)=>i.trim());if(Array.isArray(T))x.forEach((i,m)=>{if(i)b[i]=T[m]});else b[N]=T}else b[N]=T;if(R)if(!k&&F&&Array.isArray(T)&&T.length===2)b[R]=T[0],b[N]=T[1];else b[R]=E;let S=A_(_,b),P=MQ(S);if(P.hasContinue){I+=P.content;continue}let v=NQ(S);if(v.hasBreak){I+=v.content;break}if(S=TQ(S,b),S=Q(S,b),S=E1(S,b,Z),S=R_(S),v=NQ(S),v.hasBreak){I+=v.content;break}if(P=MQ(S),P.hasContinue){I+=P.content;continue}S=f1(S,b,Z),S=V_(S,b),S=F_(S,b),S=L_(S,b),I+=S}K=K.substring(0,U)+I+K.substring(j)}catch(L){let O=J0("Foreach",`Error in @foreach(${B.trim()} as ${H.trim()}): ${L instanceof Error?L.message:String(L)}`,s.EVALUATION_ERROR);K=K.substring(0,U)+O+K.substring(j)}}return K}Y=Q(Y,X),Y=EQ(Y,X,Z,J);let W=J?.loops?.maxWhileIterations??__;return Y=k_(Y,X,W),Y}function IQ($){return u8($)}function EQ($,X,Z,J){let Y=$,G=!0;while(G){G=!1;let Q=Y.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let W=Q.index,w=W+Q[0].length-1,q=x0(Y,"(",")",w);if(q===-1)break;let K=Y.slice(w+1,q),z=q+1,U=o8(Y.slice(W),"for","endfor");if(U.length===0)break;let j=U[0].content,B=W+U[0].end;if(!IQ(K)){let H=J0("For",`Unsafe expression in @for: ${K}`,s.UNSAFE_EXPRESSION);Y=Y.substring(0,W)+H+Y.substring(B),G=!0;continue}try{let H=M_(K),_=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(H.length>0&&_){let R=T_({forExpr:K,content:j,iterVarNames:H,context:X,filePath:Z,options:J});Y=Y.substring(0,W)+R+Y.substring(B),G=!0;continue}let L=Object.keys(X),O=Object.values(X),F=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=kQ(F);let A=Function(...L,`
12577
+ </style>`}}});import{existsSync as eH,readFileSync as $_}from"fs";function X_($){if(WQ.has($))return;WQ.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Z_($){let X=process.cwd();for(let Z of[`${X}/node_modules/@iconify-json/${$}/icons.json`,`${X}/pantry/@iconify-json/${$}/icons.json`,`${X}/node_modules/@iconify/json/json/${$}.json`,`${X}/pantry/@iconify/json/json/${$}.json`])if(eH(Z))return Z;for(let Z of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return B0.resolve(Z)}catch{}return null}function J_($){if(K9.has($))return K9.get($);let X=Z_($);if(!X)return X_($),null;try{let Z=JSON.parse($_(X,"utf8"));return K9.set($,Z.icons),Z.icons}catch{return null}}function s5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);if($.static[X]!==void 0)return String($.static[X]);if($.clientReactive[X]!==void 0)return $.clientReactive[X];return}var K9,WQ,u3;var d3=y(()=>{K9=new Map,WQ=new Set;u3={name:"Icon",aliases:["icon","stx-icon"],render($,X,Z){let J=s5($,"name")??s5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",G=J;if(J.includes(":")){let O=J.split(":");Y=O[0],G=O[1]}let Q=I0(s5($,"size")||"24"),W=I0(s5($,"color")||"currentColor"),w=I0(s5($,"class")||""),q=I0(s5($,"style")||""),K=K9.get(Y)??J_(Y);if(!K)return`<!-- Icon: collection "${Y}" not loaded -->`;let z=K[G];if(!z)return`<!-- Icon: "${G}" not found in ${Y} -->`;let U=z.width||24,j=z.height||24,B=`0 0 ${U} ${j}`,H=z.body;if(W!=="currentColor")H=H.replace(/currentColor/g,W);let _=w?` class="${w}"`:"",L=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${B}" fill="none"${_}${L}>${H}</svg>`}}});function wQ($,...X){for(let Z of X){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J}return}function qQ($,X){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${X}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),J=$.match(Z);if(!J)return{region:null,rest:$};return{region:J[2],rest:$.replace(J[0],"")}}var m3;var c3=y(()=>{m3={name:"Suspense",aliases:["suspense"],render($,X,Z){let J=qQ(X,"fallback"),Y=J.rest,G=qQ(Y,"error"),Q=G.rest,W=J.region??wQ($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',w=G.region??wQ($,"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>${w}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function z9($,...X){for(let Z of X){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let J=$.static[Z];if(typeof J==="string")return J}return}var l3;var p3=y(()=>{l3={name:"TransitionGroup",aliases:["transition-group"],render($,X,Z){let J=(z9($,"name")||"v").replace(/["'<>]/g,""),Y=(z9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=z9($,"class"),Q=z9($,"id"),W=[`data-stx-transition-group="${J}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${Y} ${W}>${X}</${Y}>`}}});function KQ(){i0.registerBuiltin(R3),i0.registerBuiltin(I3),i0.registerBuiltin(D3),i0.registerBuiltin(S3),i0.registerBuiltin(P3),i0.registerBuiltin(x3),i0.registerBuiltin(g3),i0.registerBuiltin(u3),i0.registerBuiltin(m3),i0.registerBuiltin(l3)}var zQ=y(()=>{N3();E3();y3();C3();v3();f3();h3();d3();c3();p3();V3();N3();E3();y3();C3();v3();f3();h3();d3();c3();p3()});function U9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function UQ($,X,Z){let J=[],Y=0;while(Y<$.length){let G=$.indexOf("<",Y);if(G===-1)break;let W=$.slice(G+1).match(new RegExp(`^(${X.source})(?![\\w.:-])`));if(!W){Y=G+1;continue}let w=W[1];if(Z&&Z.has(w.toLowerCase())){let H=G+1+w.length;while(H<$.length&&$[H]!==">")H++;Y=H+1;continue}let q=G+1+w.length,K=null,z=q,U=-1,j=!1;while(q<$.length){let H=$[q];if(K){if(H==="\\"&&q+1<$.length){q+=2;continue}if(H===K)K=null;q++;continue}if(H==='"'||H==="'"){K=H,q++;continue}if(H==="/"&&q+1<$.length&&$[q+1]===">"){U=q+2,j=!0;break}if(H===">"){U=q+1;break}q++}if(U===-1){Y=G+1;continue}let B=$.slice(z,j?U-2:U-1).trim();if(j)J.push({fullMatch:$.slice(G,U),tagName:w,attributes:B,content:"",startIndex:G,endIndex:U,isSelfClosing:!0}),Y=U;else{let H=`<${w}`,_=`</${w}>`,L=1,O=U,F=-1;while(L>0&&O<$.length){let R=$.indexOf(H,O),N=$.indexOf(_,O);if(N===-1)break;if(R!==-1&&R<N){let k=$[R+H.length];if(k===" "||k===">"||k==="/"||k===`
12578
+ `||k==="\t")L++;O=R+H.length}else{if(L--,L===0){F=N;break}O=N+_.length}}if(F===-1){Y=U;continue}let V=$.slice(U,F),A=F+_.length;J.push({fullMatch:$.slice(G,A),tagName:w,attributes:B,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),Y=A}}return J}function jQ($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function BQ($,X){try{let Z=Buffer.from($,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if(X?.debug)console.error("Error decoding __stx_ prop:",Z);return $}}var HQ=y(()=>{D0();F0();g1()});var RQ={};t(RQ,{processESImports:()=>VQ,processComponents:()=>B9});import j9 from"fs";import a0 from"path";function G_($,X,Z){let J={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Y=new Set(Array.isArray(X.__stx_client_signal_names)?X.__stx_client_signal_names:[]),G=(q)=>{if(Y.size===0)return!1;let K=$1(q),z=K.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(z&&Y.has(z))return!0;for(let U of Y){let j=U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${j}\\s*\\(`).test(K))return!0}return!1},Q=new Set(F2),W=(q)=>{if(!q.includes("-")||q.startsWith("@")||q.startsWith(":")||q.startsWith("x-")||q.startsWith("__"))return q;if(q.startsWith("aria-")||q.startsWith("data-"))return q;return q.replace(/-([a-z0-9])/g,(K,z)=>z.toUpperCase())},w=(q,K)=>{let z=W(q);if(J.static[z]=K,z!==q)J.staticNames[z]=q};for(let[q,K]of Object.entries($)){let z=q.startsWith("x-")&&!Q.has(q)&&!q.startsWith("x-bind:")&&!q.startsWith("x-on:")?`:${q.slice(2)}`:q;if(z.startsWith("@")){J.events[z]=K;continue}if(z.startsWith("__stx_")){let U=W(z.slice(6));J.serverDynamic[U]=BQ(K,Z);continue}if(z.startsWith(":")){let U=W(z.slice(1)),j=K===H5?U:K;if(U==="if"||U==="for"||U==="show"){J.clientReactive[U]=j;continue}if(G(j)){J.clientReactive[U]=j;continue}try{if(!U0(j)){if(Z.debug)console.error(`Unsafe expression in :${U} binding: ${j}`);J.clientReactive[U]=j;continue}let B=Object.keys(X),_=j0(j,B)(...Object.values(X));if(_===void 0){let L=j.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(L.some((V)=>!O.has(V)&&!B.includes(V))){J.clientReactive[U]=j;continue}}if(J.serverDynamic[U]=_,U!==z.slice(1)&&J.serverDynamicNames)J.serverDynamicNames[U]=z.slice(1)}catch{J.clientReactive[U]=j}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let U=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let j=U[1];if(U0(j)){let H=j0(j,Object.keys(X))(...Object.values(X));w(z,H!=null?String(H):"")}else{if(Z.debug)console.error(`Unsafe expression in ${z}: ${j}`);w(z,K)}}catch(j){if(Z.debug)console.error(`Error evaluating expression for ${z}:`,j);w(z,K)}else{let j=K,B=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=B.exec(K))!==null)try{let _=H[1];if(!U0(_)){if(Z.debug)console.error(`Unsafe expression in ${z}: ${_}`);continue}let O=j0(_,Object.keys(X))(...Object.values(X));j=j.replace(H[0],String(O??""))}catch(_){if(Z.debug)console.error(`Error evaluating expression in ${z}:`,_)}w(z,j)}continue}w(z,K===H5?"true":jQ(K))}return J}function W_($,X,Z){if(!$.includes("@"))return $;if(!Q_.some(([Y,G])=>Y.test($)&&$.includes(G)))return $;try{return E1($,X,Z)}catch{return $}}function w_($){let X={},Z=0,J=$.length;while(Z<J){while(Z<J&&/\s/.test($[Z]))Z++;if(Z>=J)break;let Y="";while(Z<J&&!/[\s=]/.test($[Z]))Y+=$[Z],Z++;if(!Y)break;while(Z<J&&/\s/.test($[Z]))Z++;if(Z<J&&$[Z]==="="){Z++;while(Z<J&&/\s/.test($[Z]))Z++;let G="";if(Z<J&&($[Z]==='"'||$[Z]==="'")){let Q=$[Z];Z++;while(Z<J){let W=$[Z];if(W==="\\"&&Z+1<J){Z++,G+=$[Z],Z++;continue}if(W===Q){Z++;break}G+=W,Z++}}else while(Z<J&&!/\s/.test($[Z]))G+=$[Z],Z++;X[Y]=G}else X[Y]=H5}return X}function OQ($){return Object.entries($).map(([X,Z])=>Z===H5?X:`${X}="${q_(Z)}"`).join(" ")}function q_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function K_($){let X=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,J;while((J=Z.exec($))!==null){let Y=J[1];if(i0.isBuiltin(Y))X.add(Y)}return[...X].sort()}function z_($){let X=LQ.get($);if(X)return X;let Z=new Map,J=[a0.join($,"src"),a0.join($,"dist"),$];function Y(G,Q){if(Q>6)return;let W;try{W=j9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let w of W){let q=a0.join(G,w.name);if(w.isDirectory()){if(w.name==="node_modules"||w.name.startsWith("."))continue;Y(q,Q+1)}else if(w.isFile()&&w.name.endsWith(".stx")){let K=w.name.slice(0,-4);if(!Z.has(K))Z.set(K,q);let z=K.toLowerCase();if(!Z.has(z))Z.set(z,q);let U=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(U))Z.set(U,q)}}}for(let G of J)if(Y(G,0),Z.size>0)break;return LQ.set($,Z),Z}function U_($,X){if($.startsWith(".")||$.startsWith("/"))return null;let Z=X;while(!0){let J=a0.join(Z,"node_modules",$);try{if(j9.statSync(J).isDirectory())return J}catch{}let Y=a0.dirname(Z);if(Y===Z)return null;Z=Y}}async function VQ($,X,Z,J,Y){if(!$.includes("import"))return $;if(!X.__importedComponents)X.__importedComponents=new Map;let G=X.__importedComponents,Q=a0.dirname(Z),W=$,w=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return W=W.replace(w,(q,K,z)=>{let U=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,j=z,B,H=[];while((B=U.exec(z))!==null){let[_,L,O,F]=B,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let k=a0.resolve(Q,F);if(k.endsWith(".stx"))A=k;else{let I=`${k}.stx`;try{if(j9.statSync(I).isFile())A=I}catch{try{if(j9.statSync(k).isDirectory())V=k}catch{}}}}else V=U_(F,Q);if(!V&&!A)continue;let R=!1,N=(k,I)=>{G.set(k,I),G.set(k.toLowerCase(),I);let M=k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(M,I),Y.add(I)};if(O&&A)N(O,A),R=!0;else if(L){let k=L.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let E=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:M,local:M}}),I=V?z_(V):null;for(let{source:M,local:E}of k){let T=null;if(A)T=A;else if(I)T=I.get(M)??I.get(M.toLowerCase())??I.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(T)N(E,T),R=!0}}if(R)H.push({start:B.index,end:B.index+_.length})}if(H.length===0)return q;for(let _=H.length-1;_>=0;_--)j=j.slice(0,H[_].start)+j.slice(H[_].end);return`<script${K}>${j}</script>`}),W}async function j_($,X,Z,J,Y){let G=$;if(!X.__importedComponents)X.__importedComponents=new Map;let Q=X.__importedComponents,W=/@import\s*\(\s*([^)]+)\s*\)/g,w;while((w=W.exec(G))!==null){let[q,K]=w,z=K.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of z){let j=U.split("/"),H=j[j.length-1].replace(/\.stx$/,""),_=H.includes("-")?H.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),L=null,O=[a0.resolve(a0.dirname(Z),`${U}.stx`),a0.resolve(a0.dirname(Z),U),a0.resolve(J.componentsDir||"components",`${U}.stx`),a0.resolve(J.componentsDir||"components",U),U.endsWith(".stx")?U:`${U}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){L=F;break}}catch{}if(L){Q.set(_,L),Q.set(H,L),Q.set(H.toLowerCase(),L);let F=_.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,L),Y.add(L),J.debug)console.log(`Imported component: ${_} -> ${L}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${U}`)}G=G.replace(q,""),W.lastIndex=0}return G}async function B_($,X,Z,J,Y){let G=$,Q=J.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let W=X.__processedComponents,w=/@component\s*\(/g,q;while((q=w.exec(G))!==null){let K=q.index,z=K+q[0].length-1,U=1,j=z+1;while(j<G.length&&U>0){if(G[j]==="(")U++;else if(G[j]===")"){if(U--,U===0)break}j++}if(U!==0)break;let B=G.substring(z+1,j),H=j+1,_=B.match(/^\s*['"]([^'"]+)['"]/);if(!_){w.lastIndex=0;continue}let L=_[1],O,F=B.slice(_[0].length),V=F.match(/^\s*,\s*/);if(V)O=F.slice(V[0].length).trim();let A={};if(O)try{A=E0(O,X)}catch(E){let T=E instanceof Error?E.message:String(E);G=G.replace(G.substring(K,H),`[Error parsing component props: ${T}]`);continue}let R="",N=H,I=G.substring(H).match(/^([\s\S]*?)@endcomponent/);if(I)R=I[1].trim(),N=H+I[0].length;let M=await w5(L,A,R,Q,X,Z,J,W,Y);G=G.substring(0,K)+M+G.substring(N),w.lastIndex=0}return G}async function H_($,X,Z,J,Y){if(!$)return $;let G=$,Q=J.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let W=X.__processedComponents,w=z1(G);return G=w.output,G=await U(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await U(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await U(G,/[a-z][a-z0-9]*/,!1,Y_),G=S5(G,w.scripts),G;async function U(j,B,H,_){if(!j)return j;let L=j,O=UQ(L,B,_);for(let F=O.length-1;F>=0;F--){let V=O[F],A=H?U9(V.tagName):V.tagName,R=w_(W_(V.attributes,X,Z)),N=G_(R,X,J),k=i0.getBuiltin(V.tagName),I=k?await L$(A,Q,X,Z,J):!1;if(k&&!I){let D={context:X,filePath:Z,options:J,dependencies:Y},b=k.render(N,V.content,D);if(Object.keys(N.clientReactive).length>0)b=FQ(b,N.clientReactive);if(Object.keys(N.events).length>0){let S=OQ(N.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${S}`)}L=L.substring(0,V.startIndex)+b+L.substring(V.endIndex);continue}if(!H&&V.tagName.includes("-")&&!await L$(A,Q,X,Z,J))continue;let M={};for(let[D,b]of Object.entries(N.static))M[D]=b;for(let[D,b]of Object.entries(N.serverDynamic))M[D]=b;let T=await w5(A,M,S5(V.content,w.scripts),Q,X,Z,J,W,Y);if(Object.keys(N.clientReactive).length>0)T=FQ(T,N.clientReactive);if(Object.keys(N.events).length>0){let D=AQ(T);if(D){let b=OQ(N.events),S=Object.keys(N.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");T=T.substring(0,D.insertPos)+` data-stx-parent-events="${S}" ${b}`+T.substring(D.insertPos)}}L=L.substring(0,V.startIndex)+T+L.substring(V.endIndex)}return L}}function FQ($,X){let Z=new Set(["if","for"]),J=new Set(["show"]),Y=Object.entries(X).filter(([K])=>!Z.has(K)),G=Y.filter(([K])=>!J.has(K)).map(([K])=>U9(K)).join(" "),Q=$,W=Y.length>0?AQ(Q):null;if(W){let K=Y.map(([U,j])=>`:${U9(U)}="${j.replace(/"/g,"&quot;")}"`).join(" "),z=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,W.insertPos)+`${z} ${K}`+Q.substring(W.insertPos)}let w=X.if;if(w)Q=`<template :if="${w.replace(/"/g,"&quot;")}">${Q}</template>`;let q=X.for;if(q)Q=`<template :for="${q.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function AQ($){let X=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(X)return{insertPos:X.index+1+X[1].length};let Z=0;while(Z<$.length){let J=$.slice(Z),Y=J.match(/^\s+/);if(Y){Z+=Y[0].length;continue}if(J.startsWith("<!--")){let W=$.indexOf("-->",Z+4);if(W===-1)return null;Z=W+3;continue}let G=J.match(/^<(script|style)\b[^>]*>/i);if(G){let W=`</${G[1].toLowerCase()}>`,w=$.toLowerCase().indexOf(W,Z+G[0].length);if(w===-1)return null;Z=w+W.length;continue}let Q=J.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function B9($,X,Z,J,Y){if(!_Q)KQ(),_Q=!0;let G=await VQ($,X,Z,J,Y);G=await j_(G,X,Z,J,Y),G=await B_(G,X,Z,J,Y);let Q=[];for(let W=0;W<3;W++){let w=K1(G,h7,(K,z)=>`\x00STX_COMPONENT_COMMENT_${Q.length+z}\x00`);Q.push(...w.tokens);let q=G;if(G=await H_(w.output,X,Z,J,Y),G===q)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(W,w)=>Q[Number(w)]??"");if(J.debug){let W=K_(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 _Q=!1,Y_,Q_,LQ;var i3=y(()=>{V3();Z8();zQ();HQ();g1();F0();D0();J1();Y_=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"]);Q_=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];LQ=new Map});var DQ={};t(DQ,{processLoops:()=>r3,parseLoopBinding:()=>n3});function L_($,X){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,J="",Y=0,G;while((G=Z.exec($))!==null){let Q=G.index+G[0].length,W=G.index+G[0].indexOf("("),w=v0($,"(",")",W);if(w===-1)continue;let q=$.slice(Q,w).trim();if(!q)continue;if(!Object.keys(X).some((U)=>new RegExp(`(?:^|[^\\w$.])${U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(q)))continue;let z;try{let U=E0(q,X);if(!U||typeof U!=="object")continue;z=JSON.stringify(U)}catch{continue}J+=$.slice(Y,Q)+z,Y=w,Z.lastIndex=w}return Y===0?$:J+$.slice(Y)}function F_($,X){let Z=/@component\s*\(/g,J=$,Y,G=[];while((Y=Z.exec(J))!==null){let Q=Y.index,W=Q+Y[0].length-1,w=1,q=W+1;while(q<J.length&&w>0){if(J[q]==="(")w++;else if(J[q]===")"){if(w--,w===0)break}q++}if(w!==0)continue;let K=J.substring(W+1,q),z=q+1,U=K.match(/^\s*['"]([^'"]+)['"]/);if(!U)continue;let j=U[1],B=K.slice(U[0].length),H=B.match(/^\s*,\s*/);if(!H)continue;let _=B.slice(H[0].length).trim();if(!_)continue;try{let L=E0(_,X),O=JSON.stringify(L),F=`@component('${j}', ${O})`;G.push({start:Q,end:z,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:W,end:w,replacement:q}=G[Q];J=J.substring(0,W)+q+J.substring(w)}return J}function H9($,X,Z){let J=$,Y=new RegExp(`${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=Y.exec(J))!==null){let Q=G.index,W=Q+G[0].length-1,w=1,q=W+1,K=null,z=!1;while(q<J.length&&w>0){let B=J[q];if(z){z=!1,q++;continue}if(B==="\\"&&K){z=!0,q++;continue}if(K){if(B===K)K=null;q++;continue}if(B==='"'||B==="'"||B==="`"){K=B,q++;continue}if(B==="(")w++;else if(B===")"){if(w--,w===0)break}q++}if(w!==0)break;let U=J.substring(W+1,q),j=Z(U);J=J.substring(0,Q)+j+J.substring(q+1)}return J}function V_($,X){let Z=$;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(J,Y)=>{if(Y in X)return`:${Y}="${Y}"`;return J}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(J,Y,G)=>{try{let Q=Object.keys(X),W=Object.values(X);h8(G);let q=j0(G,Q)(...W),K=JSON.stringify(q),z=Buffer.from(K,"utf8").toString("base64");return`__stx_${Y}="${z}"`}catch(Q){return J}}),Z}function A_($,X){let Z=$;return Z=H9(Z,"@break",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(U0(G)){let W=j0(G,Object.keys(X));Q=Boolean(W(...Object.values(X)))}else Q=Boolean(W0(G,X));return Q?_9:""}catch{return""}}),Z=H9(Z,"@continue",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(U0(G)){let W=j0(G,Object.keys(X));Q=Boolean(W(...Object.values(X)))}else Q=Boolean(W0(G,X));return Q?O9:""}catch{return""}}),Z}function R_($){let X=$;return X=X.replace(/@break(?!\()/g,_9),X=X.replace(/@continue(?!\()/g,O9),X}function NQ($){let X=$.includes(_9),Z=X?$.substring(0,$.indexOf(_9)):$;return{hasBreak:X,content:Z}}function MQ($){let X=$.includes(O9),Z=X?$.substring(0,$.indexOf(O9)):$;return{hasContinue:X,content:Z}}function kQ($){let X=$;return X=H9(X,"@break",(Z)=>{let J=Z.trim();if(!u8(J))return"";return`\`; if (${J}) { break; } result += \``}),X=H9(X,"@continue",(Z)=>{let J=Z.trim();if(!u8(J))return"";return`\`; if (${J}) { continue; } result += \``}),X=X.replace(/@break(?!\()/g,"`; break; result += `"),X=X.replace(/@continue(?!\()/g,"`; continue; result += `"),X}function N_($){let X=/@forelse\s*\(/g,Z,J=[],Y=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=Y.exec($))!==null)J.push({pos:Q.index,delta:1});while((Q=G.exec($))!==null)J.push({pos:Q.index,delta:-1});J.sort((K,z)=>K.pos-z.pos);let W=[],w=0;for(let K of J)w+=K.delta,W.push({pos:K.pos,depth:w});function q(K){let z=0,U=W.length-1,j=0;while(z<=U){let B=z+U>>1;if(W[B].pos<=K)j=W[B].depth,z=B+1;else U=B-1}return j}while((Z=X.exec($))!==null){if(q(Z.index)>0)continue;let K=Z.index,z=Z.index+Z[0].length-1,U=1,j=z+1,B=-1;while(j<$.length&&U>0){if($[j]==="(")U++;else if($[j]===")"){if(U--,U===0){B=j;break}}j++}if(B===-1)continue;let H=$.substring(z+1,B),_=n3(H);if(!_)continue;let{arrayExpr:L,itemVar:O}=_,F=B+1,V=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,k=-1;while(V>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let b=R.exec($),S=N.exec($);if(!S)break;if(b&&b.index<S.index)V++,A=b.index+b[0].length;else{if(V--,V===0){k=S.index;break}A=S.index+11}}if(k===-1)continue;let I=$.substring(F,k),M=k+11,E=-1,T=0,D=0;while(D<I.length){let b=I.indexOf("@",D);if(b===-1)break;let S=I.substring(b);if(/^@forelse\s*\(/.test(S))T++,D=b+1;else if(S.startsWith("@endforelse"))T--,D=b+11;else if(T===0&&S.startsWith("@empty")){if(I.length<=b+6||!/[a-z]/i.test(I[b+6])){E=b;break}D=b+1}else D=b+1}if(E===-1)continue;return{start:K,end:M,arrayExpr:L,itemVar:O,foreachContent:I.substring(0,E),emptyContent:I.substring(E+6)}}return null}function TQ($,X){let Z=$;while(!0){let J=N_(Z);if(!J)break;let{start:Y,end:G,arrayExpr:Q,itemVar:W,foreachContent:w,emptyContent:q}=J;try{let K;if(U0(Q))K=j0(Q,Object.keys(X))(...Object.values(X));else K=W0(Q,X);let z;if(!Array.isArray(K)||K.length===0)z=q;else z=`@foreach (${Q} as ${W})${w}@endforeach`;Z=Z.substring(0,Y)+z+Z.substring(G)}catch(K){let z=K instanceof Error?K.message:String(K),U=J0("Forelse",`Error in @forelse(${Q} as ${W}): ${z}`,s.EVALUATION_ERROR);Z=Z.substring(0,Y)+U+Z.substring(G)}}return Z}function n3($){let X=$.indexOf(" as ");if(X!==-1){let G=$.slice(0,X).trim(),Q=$.slice(X+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!Z)return null;let J=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),Y=Z[2].trim();return J&&Y?{arrayExpr:Y,itemVar:J}:null}function r3($,X,Z,J){let Y=$;Y=TQ(Y,X);function G(w){let q=/@foreach\s*\(/g,K;while((K=q.exec(w))!==null){let z=K.index,U=K.index+K[0].length-1,j=1,B=U+1,H=-1;while(B<w.length&&j>0){if(w[B]==="(")j++;else if(w[B]===")"){if(j--,j===0){H=B;break}}B++}if(H===-1)continue;let _=w.substring(U+1,H),L=n3(_);if(!L)continue;let O=z,{arrayExpr:F,itemVar:V}=L,A=H+1,R=1,N=A,k=/@foreach\s*\(/g,I=/@endforeach/g;while(R>0&&N<w.length){k.lastIndex=N,I.lastIndex=N;let M=k.exec(w),E=I.exec(w);if(!E)break;if(M&&M.index<E.index)R++,N=M.index+M[0].length;else{if(R--,R===0){let T=w.substring(A,E.index),D=E.index+11;return{start:O,end:D,arrayExpr:F,itemVar:V,content:T}}N=E.index+11}}}return null}function Q(w,q){let K=w;while(!0){let z=G(K);if(!z)break;let{start:U,end:j,arrayExpr:B,itemVar:H,content:_}=z;try{let L=B.trim(),O;if(U0(L))O=j0(L,Object.keys(q))(...Object.values(q));else O=W0(L,q);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),F=!0;else{console.warn(`[stx] @foreach(${L}) in ${Z}: ${L} 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 E=J0("Foreach",`Error in @foreach: ${L} is not iterable`,s.TYPE_ERROR);K=K.substring(0,U)+E+K.substring(j);continue}let V=J?.loops?.useAltLoopVariable??O_,A=H.trim(),R=null,N,k=!1;if(A.includes("=>")){let E=A.split("=>").map((T)=>T.trim());if(E.length===2&&E[0]&&E[1])R=E[0],N=E[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((T)=>T.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1],k=!0;else N=A}else N=A;let I="",M=O;for(let E=0;E<M.length;E++){let T=M[E],D={index:E,iteration:E+1,first:E===0,last:E===M.length-1,count:M.length},b={...q,loop:D,$loop:D};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((p)=>p.trim());if(Array.isArray(T))f.forEach((p,m)=>{if(p)b[p]=T[m]});else b[N]=T}else b[N]=T;if(R)if(!k&&F&&Array.isArray(T)&&T.length===2)b[R]=T[0],b[N]=T[1];else b[R]=E;let S=A_(_,b),P=MQ(S);if(P.hasContinue){I+=P.content;continue}let x=NQ(S);if(x.hasBreak){I+=x.content;break}if(S=TQ(S,b),S=Q(S,b),S=E1(S,b,Z),S=R_(S),x=NQ(S),x.hasBreak){I+=x.content;break}if(P=MQ(S),P.hasContinue){I+=P.content;continue}S=h1(S,b,Z),S=V_(S,b),S=F_(S,b),S=L_(S,b),I+=S}K=K.substring(0,U)+I+K.substring(j)}catch(L){let O=J0("Foreach",`Error in @foreach(${B.trim()} as ${H.trim()}): ${L instanceof Error?L.message:String(L)}`,s.EVALUATION_ERROR);K=K.substring(0,U)+O+K.substring(j)}}return K}Y=Q(Y,X),Y=EQ(Y,X,Z,J);let W=J?.loops?.maxWhileIterations??__;return Y=k_(Y,X,W),Y}function IQ($){return u8($)}function EQ($,X,Z,J){let Y=$,G=!0;while(G){G=!1;let Q=Y.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let W=Q.index,w=W+Q[0].length-1,q=v0(Y,"(",")",w);if(q===-1)break;let K=Y.slice(w+1,q),z=q+1,U=o8(Y.slice(W),"for","endfor");if(U.length===0)break;let j=U[0].content,B=W+U[0].end;if(!IQ(K)){let H=J0("For",`Unsafe expression in @for: ${K}`,s.UNSAFE_EXPRESSION);Y=Y.substring(0,W)+H+Y.substring(B),G=!0;continue}try{let H=M_(K),_=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(H.length>0&&_){let R=T_({forExpr:K,content:j,iterVarNames:H,context:X,filePath:Z,options:J});Y=Y.substring(0,W)+R+Y.substring(B),G=!0;continue}let L=Object.keys(X),O=Object.values(X),F=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=kQ(F);let A=Function(...L,`
12579
12579
  let result = '';
12580
12580
  for (${K}) {
12581
12581
  result += \`${F}\`;
@@ -12585,7 +12585,7 @@ ${T}
12585
12585
  for (${X}) {
12586
12586
  __pushIter([${J.join(", ")}])
12587
12587
  }
12588
- `),K=[];q(...w,(j)=>{K.push(j)});let z=G??"inline.stx",U="";for(let j of K){let B={...Y};J.forEach((_,L)=>{B[_]=j[L]});let H=EQ(Z,B,G,Q);H=E1(H,B,z),H=f1(H,B,z),U+=H}return U}function k_($,X,Z){let J=$,Y=!0;while(Y){Y=!1;let G=J.match(/@while\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,W=Q+G[0].length-1,w=x0(J,"(",")",W);if(w===-1)break;let q=J.slice(W+1,w),K=o8(J.slice(Q),"while","endwhile");if(K.length===0)break;let z=K[0].content,U=Q+K[0].end;if(!IQ(q)){let j=J0("While",`Unsafe expression in @while: ${q}`,s.UNSAFE_EXPRESSION);J=J.substring(0,Q)+j+J.substring(U),Y=!0;continue}try{let j=Object.keys(X),B=Object.values(X),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});H=kQ(H);let L=Function(...j,`
12588
+ `),K=[];q(...w,(j)=>{K.push(j)});let z=G??"inline.stx",U="";for(let j of K){let B={...Y};J.forEach((_,L)=>{B[_]=j[L]});let H=EQ(Z,B,G,Q);H=E1(H,B,z),H=h1(H,B,z),U+=H}return U}function k_($,X,Z){let J=$,Y=!0;while(Y){Y=!1;let G=J.match(/@while\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,W=Q+G[0].length-1,w=v0(J,"(",")",W);if(w===-1)break;let q=J.slice(W+1,w),K=o8(J.slice(Q),"while","endwhile");if(K.length===0)break;let z=K[0].content,U=Q+K[0].end;if(!IQ(q)){let j=J0("While",`Unsafe expression in @while: ${q}`,s.UNSAFE_EXPRESSION);J=J.substring(0,Q)+j+J.substring(U),Y=!0;continue}try{let j=Object.keys(X),B=Object.values(X),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});H=kQ(H);let L=Function(...j,`
12589
12589
  let result = '';
12590
12590
  let maxIterations = ${Z}; // Configurable safety limit
12591
12591
  let counter = 0;
@@ -12597,10 +12597,10 @@ ${T}
12597
12597
  result += '<!-- [While Error [1104]]: Maximum iterations (${Z}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
12598
12598
  }
12599
12599
  return result;
12600
- `)(...B);J=J.substring(0,Q)+L+J.substring(U),Y=!0}catch(j){let B=J0("While",`Error in @while(${q}): ${j instanceof Error?j.message:String(j)}`,s.EVALUATION_ERROR);J=J.substring(0,Q)+B+J.substring(U),Y=!0}}return J}var __=1000,O_=!1,_9="<!--__STX_BREAK__-->",O9="<!--__STX_CONTINUE__-->";var o3=y(()=>{Z8();k1();B1();s8();b0()});import O0 from"path";function s3($,X){let Z=0;for(let J=X;J<$.length;J++){let Y=$[J];if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y===","&&Z===0)return J}return-1}function I_($,X,Z){let J=$,Y=new RegExp(`${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=Y.exec(J);while(G){let Q=G.index,W=Q+G[0].length-1,w=1,q=W+1;while(q<J.length&&w>0){if(J[q]==="(")w++;else if(J[q]===")")w--;q++}if(w!==0)break;let K=J.substring(W+1,q-1),z=`${Z}(${K})`;J=J.substring(0,Q)+z+J.substring(q),Y.lastIndex=Q+z.length,G=Y.exec(J)}return J}function E_($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function bQ($){let X=$,Z=[],J=new Set,Y=0,G=0,Q=X.length,W=(z)=>{G++;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===z){G++;return}G++}},w=()=>{G++;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"){G++;return}if(X[G]==="$"&&X[G+1]==="{"){G+=2;let z=1;while(G<Q&&z>0)if(X[G]==="{")z++,G++;else if(X[G]==="}")z--,G++;else if(X[G]==="'"||X[G]==='"')W(X[G]);else if(X[G]==="`")w();else G++;continue}G++}},q=()=>{if(X[G]==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
12600
+ `)(...B);J=J.substring(0,Q)+L+J.substring(U),Y=!0}catch(j){let B=J0("While",`Error in @while(${q}): ${j instanceof Error?j.message:String(j)}`,s.EVALUATION_ERROR);J=J.substring(0,Q)+B+J.substring(U),Y=!0}}return J}var __=1000,O_=!1,_9="<!--__STX_BREAK__-->",O9="<!--__STX_CONTINUE__-->";var o3=y(()=>{Z8();k1();j1();s8();D0()});import _0 from"path";function s3($,X){let Z=0;for(let J=X;J<$.length;J++){let Y=$[J];if(Y==="("||Y==="["||Y==="{")Z++;else if(Y===")"||Y==="]"||Y==="}")Z--;else if(Y===","&&Z===0)return J}return-1}function I_($,X,Z){let J=$,Y=new RegExp(`${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=Y.exec(J);while(G){let Q=G.index,W=Q+G[0].length-1,w=1,q=W+1;while(q<J.length&&w>0){if(J[q]==="(")w++;else if(J[q]===")")w--;q++}if(w!==0)break;let K=J.substring(W+1,q-1),z=`${Z}(${K})`;J=J.substring(0,Q)+z+J.substring(q),Y.lastIndex=Q+z.length,G=Y.exec(J)}return J}function E_($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function bQ($){let X=$,Z=[],J=new Set,Y=0,G=0,Q=X.length,W=(z)=>{G++;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===z){G++;return}G++}},w=()=>{G++;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"){G++;return}if(X[G]==="$"&&X[G+1]==="{"){G+=2;let z=1;while(G<Q&&z>0)if(X[G]==="{")z++,G++;else if(X[G]==="}")z--,G++;else if(X[G]==="'"||X[G]==='"')W(X[G]);else if(X[G]==="`")w();else G++;continue}G++}},q=()=>{if(X[G]==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
12601
12601
  `)G++;return!0}if(X[G]==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;return G+=2,!0}return!1},K=()=>{if(Y!==0)return;let z=X.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let B=z[2];if(!J.has(B))Z.push(B),J.add(B);return}let U=X.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let B=U[1];if(!J.has(B))Z.push(B),J.add(B);return}let j=X.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!J.has(B))Z.push(B),J.add(B)}};while(G<Q){if(q())continue;if(X[G]==="'"||X[G]==='"'){W(X[G]);continue}if(X[G]==="`"){w();continue}if(X[G]==="{"){Y++,G++;continue}if(X[G]==="}"){Y--,G++;continue}if(Y===0&&/[a-z]/i.test(X[G])&&(G===0||/\s|[;{}()]/.test(X[G-1])))K();G++}return Z.join(", ")}function SQ($,X=""){let Z=bQ($).split(",").map((J)=>J.trim()).filter(Boolean);return`
12602
12602
  (function() {
12603
- ${E5("var",Z)}
12603
+ ${I5("var",Z)}
12604
12604
  var __destroyHooks = [];
12605
12605
  var __origOnDestroy = onDestroy;
12606
12606
  onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
@@ -12632,32 +12632,32 @@ ${bQ($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
12632
12632
  } finally {
12633
12633
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
12634
12634
  }
12635
- })();`}function y_($,X){let Z=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let Y=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1]};let G=Z[1],Q=Z[2],W=Z[3];return{html:`${G}${Q} data-stx-scope="${X}"${W}${$.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function S_($){if($.__onceStore instanceof Set)return $.__onceStore;return b_}async function a3($,X,Z,J,Y,G=new Set){let Q=J.partialsDir||O0.join(O0.dirname(Z),"partials");if(Q&&!O0.isAbsolute(Q))Q=O0.resolve(process.cwd(),Q);let W=I_($,"@partial","@include"),w=S_(X);W=W.replace(/@once([\s\S]*?)@endonce/g,(H,_,L)=>{let O=_.trim(),F=`${Z}:${O}`;if(w.has(F))return"";return w.add(F),_});{let H=/@includeIf\s*\(/g,_;while((_=H.exec(W))!==null){let L=_.index,O=L+_[0].length-1,F=1,V=O+1;while(V<W.length&&F>0){if(W[V]==="(")F++;else if(W[V]===")")F--;V++}if(F!==0)break;let A=W.substring(O+1,V-1),R=A.match(/^\s*['"]([^'"]+)['"]/);if(!R){H.lastIndex=V;continue}let N=R[1],k=q(N,Q,Z),I="";if(k&&await Bun.file(k).exists())Y.add(k),I=`@include(${A})`;W=W.substring(0,L)+I+W.substring(V),H.lastIndex=0}}for(let[H,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=L.exec(W))!==null){let F=O.index,V=F+O[0].length-1,A=1,R=V+1;while(R<W.length&&A>0){if(W[R]==="(")A++;else if(W[R]===")")A--;R++}if(A!==0)break;let N=W.substring(V+1,R-1),k=s3(N,0);if(k===-1){L.lastIndex=R;continue}let I=N.substring(0,k).trim(),M=N.substring(k+1).trim(),E=M.match(/^\s*['"]([^'"]+)['"]/);if(!E){L.lastIndex=R;continue}let T=E[1],D=M.substring(E[0].length),b,S=s3(D,0);if(S!==-1)b=D.substring(S+1).trim();try{let P=`Boolean(${I})`,v;if(K0(P)){let m=z0(P,Object.keys(X));v=Boolean(m(...Object.values(X)))}else v=Boolean(Q0(P,X));let x=_?!v:v,i="";if(x){let m=q(T,Q,Z);if(m&&await Bun.file(m).exists())Y.add(m);i=`@include('${T}'${b?`, ${b}`:""})`}W=W.substring(0,F)+i+W.substring(R),L.lastIndex=0}catch(P){let v=P instanceof Error?P.message:String(P),x=_0("Include",`Error evaluating ${H} condition: ${v}`,Z,$,F);W=W.substring(0,F)+x+W.substring(R),L.lastIndex=0}}}{let H=/@each\s*\(/g,_;while((_=H.exec(W))!==null){let L=_.index,O=L+_[0].length-1,F=1,V=O+1;while(V<W.length&&F>0){if(W[V]==="(")F++;else if(W[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=W.substring(O+1,V),R=W.substring(L,V+1),N=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){H.lastIndex=0,W=W.replace(R,"");continue}let[,k,I,M,E]=N;try{let T,D=I.trim();if(K0(D))T=z0(D,Object.keys(X))(...Object.values(X));else T=Q0(D,X);let b="";if(Array.isArray(T)&&T.length>0)for(let S of T){let P={...X,[M]:S},v=await U(k,P,$,L);b+=v}else if(E)b=await U(E,{},$,L);W=W.substring(0,L)+b+W.substring(V+1),H.lastIndex=0}catch(T){let D=T instanceof Error?T.message:String(T);W=W.substring(0,L)+_0("Each",`Error in @each: ${D}`,Z,$,L)+W.substring(V+1),H.lastIndex=0}}}{let H=/@includeFirst\s*\(/g,_;while((_=H.exec(W))!==null){let L=_.index,O=L+_[0].length-1,F=1,V=O+1;while(V<W.length&&F>0){if(W[V]==="(")F++;else if(W[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=W.substring(O+1,V),R=W.substring(L,V+1),N=A.match(/^\s*(\[[^\]]+\])/);if(!N){H.lastIndex=0,W=W.replace(R,"");continue}let k=N[1],I=A.slice(N[0].length),M,E=I.match(/^\s*,\s*\{/);if(E){I=I.slice(E[0].length-1);let b=1,S=1;while(S<I.length&&b>0){if(I[S]==="{")b++;else if(I[S]==="}"){if(b--,b===0)break}S++}M=I.substring(0,S+1),I=I.slice(S+1)}let T,D=I.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)T=D[1];try{let b=JSON.parse(k.replace(/'/g,'"')),S={};if(M)try{S=y0(M,X)}catch(v){let x=v instanceof Error?v.message:String(v);if(J.debug){let i=_0("Include",`Error parsing includeFirst variables: ${x}`,Z,$,L,R);W=W.replace(R,()=>i)}else W=W.replace(R,()=>T||"");continue}let P=!1;for(let v of b){let x=q(v,Q,Z);if(!x)continue;if(await o(x)){let i=await U(v,S,$,L);W=W.replace(R,()=>i),P=!0;break}}if(!P)if(T!==void 0)W=W.replace(R,()=>T);else if(J.debug){let v=_0("Include",`None of the includeFirst paths exist: ${k}`,Z,$,L,R);W=W.replace(R,()=>v)}else W=W.replace(R,"")}catch(b){let S=b instanceof Error?b.message:String(b),P=_0("Include",`Error processing @includeFirst: ${S}`,Z,$,L,R);W=W.replace(R,()=>P)}H.lastIndex=0}}function q(H,_,L){try{let O=H;if(!H.endsWith(".stx"))O=`${H}.stx`;let F=O0.resolve(_),V=O0.resolve(O0.dirname(L)),A;if(!O.startsWith("./")&&!O.startsWith("../"))A=O0.resolve(_,O);else A=O0.resolve(V,O);let R=O0.normalize(A),N=R.startsWith(F+O0.sep)||R===F,k=R.startsWith(V+O0.sep)||R===V,I=!1,M=O0.dirname(V);if(R.startsWith(M+O0.sep)){if(!O0.relative(M,R).split(O0.sep).some((b)=>b.startsWith(".")&&b!=="."&&b!==".."))I=!0}if(!N&&!k&&!I)return console.error(`Security: Path traversal attempt blocked for include path: ${H}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${F}, ${V}`),null;return R}catch(O){return console.error(`Error resolving path ${H}: ${O}`),null}}let K=O0.resolve(Z);G.add(K);function z(H,_,L,O){return J.onIncludeError?.({includePath:H,templatePath:Z,message:_,partialsDir:Q}),_0("Include",_,Z,L,O)}async function U(H,_={},L,O){let F=q(H,Q,Z);if(!F)return z(H,`Could not resolve path for include: ${H}`,L,O);let V=O0.resolve(F);if(G.has(V)){let A=[...G,V].map((R)=>O0.basename(R)).join(" -> ");return z(H,`Circular include detected: ${A}`,L,O)}try{Y.add(F);let A;if(!A)try{A=await Bun.file(F).text()}catch(x){let i=x instanceof Error?x.message:String(x);return z(H,`Error loading include file ${H}: ${i}`,L,O)}if(A)A=A.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(A&&A.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (_3(),H3));A=x(A,X)}if(A&&(J.debug||!s7()&&!l$()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (L3(),aG));x(A,F)}catch{}let R=A;try{let{processESImports:x}=await Promise.resolve().then(() => (i3(),RQ));await x(A,X,F,J,Y)}catch(x){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,x instanceof Error?x.message:x)}let N=p8(R);if(N)R=N.content.trim();let I=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(I)M=`<style${I[1]}>${I[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let E={...X};E.__stx_signals_gate=T1(A);for(let[x,i]of Object.entries(_))E[x]=i;let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...A.matchAll(T)],b="",S=null;for(let x of D){let i=x[1]||"",m=x[2]||"",R0=i.includes("server"),w0=X5(i),C0="";try{let{extractAndStripCssImports:n,renderVendorStyleTags:q0}=await Promise.resolve().then(() => (g7(),m2)),Y0=n(m,{filePath:F,projectRoot:process.cwd()});m=Y0.code,C0=q0(Y0.styles)}catch(n){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,n instanceof Error?n.message:n)}if(w0&&m.trim())m=Z5(m);if(!R0)try{let{hasUserImports:n,bundleClientScript:q0}=await Promise.resolve().then(() => (y5(),C7));if(n(m))m=await q0(m,F,{projectRoot:process.cwd()})}catch(n){if(J.debug)console.warn(`[stx] bundler skipped for ${F}:`,n instanceof Error?n.message:n)}let P0=E_(m);if(P0&&!R0){S=`stx_scope_${O0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++yQ}`;let n=o0(m),q0=D_(n,S);b+=`${C0}<script data-stx-scoped data-stx-run="always">${q0}</script>
12636
- `;continue}if(R0)try{let{extractVariables:n}=await Promise.resolve().then(() => (c7(),r8));await n(m,E,F)}catch(n){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,n)}if(!R0&&!P0){let n=i.replace(/\bclient\b/i,"").trim();S=`stx_scope_${O0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++yQ}`;let q0=o0(m),Y0=CQ(q0,S),N0=SQ(q0,Y0);b+=`${C0}<script data-stx-scoped data-stx-run="always"${n?` ${n}`:""}>${N0}</script>
12637
- `}}if(S){let x=y_(R,S);if(R=x.html,x.mergedIntoExisting)b=b.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),S=x.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await a3(R,E,F,J,Y,G);let{processLoops:P}=await Promise.resolve().then(() => (o3(),DQ)),v=P(R,E,F);if(v=E1(v,E,F),v=f1(v,E,F),M)v+=`
12638
- `+M;if(b)v+=`
12639
- `+b;return v}catch(A){let R=A instanceof Error?A.message:String(A);return z(H,`Error processing include ${H}: ${R}`,L,O)}}let j=/@include\s*\(/g,B;while((B=j.exec(W))!==null){let H=B.index,_=H+B[0].length-1,L=1,O=_+1;while(O<W.length&&L>0){if(W[O]==="(")L++;else if(W[O]===")")L--;O++}if(L!==0)break;let F=W.substring(H,O),V=W.substring(_+1,O-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=O;continue}let R=A[1],N,k=V.substring(A[0].length),I=s3(k,0);if(I!==-1)N=k.substring(I+1).trim();let M={};if(N)try{M=y0(N,X)}catch(T){let D=T instanceof Error?T.message:String(T);W=W.replace(F,_0("Include",`Error parsing include variables for ${R}: ${D}`,Z,$,H)),j.lastIndex=0;continue}let E=await U(R,M,$,H);W=W.substring(0,H)+E+W.substring(O),j.lastIndex=0}return W}function t3($,X){let Z=$;function J(Y,G,Q,W){let w=Y,q=!0;while(q){q=!1;let K=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),z=w.match(K);if(!z||z.index===void 0)break;let U=z.index,j=z[1],B=U+z[0].length,H=new RegExp(`@${G}\\(`),_=new RegExp(`@${Q}(?![a-z])`),L=1,O=B,F=-1;while(L>0&&O<w.length){let A=w.slice(O),R=A.match(H),N=A.match(_),k=R?O+R.index:1/0,I=N?O+N.index:1/0;if(k<I)L++,O=k+(R[0].length||1);else if(I<1/0){if(L--,L===0){F=I;break}O=I+Q.length+1}else break}if(F===-1)break;let V=w.slice(B,F);if(!X[j])X[j]=[];if(W)X[j].unshift(V);else X[j].push(V);w=w.substring(0,U)+w.substring(F+`@${Q}`.length),q=!0}return w}return Z=J(Z,"push","endpush",!1),Z=J(Z,"prepend","endprepend",!0),Z}function e3($,X){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,J)=>{if(!X[J]||X[J].length===0)return"";return X[J].join(`
12640
- `)})}var yQ=0,ZE,b_;var PQ=y(()=>{M4();Z8();B1();J1();x5();b0();V0();ZE=new J5(500),b_=new Set});import*as $6 from"path";async function vQ($,X,Z=""){if($6.basename(Z)==="multiple-js-directives.stx")return X.firstBlockRan=!0,X.secondBlockRan=!0,X.thirdBlockRan=!0,X.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return fQ($,X,Z,"@js","@endjs")}async function xQ($,X,Z=""){if($6.basename(Z)==="ts-directive.stx"){if(X.users&&Array.isArray(X.users))X.processedUsers=X.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),X.processedOutput=JSON.stringify(X.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return fQ($,X,Z,"@ts","@endts")}async function fQ($,X,Z,J,Y){let G=$,Q=v5(`${J}([\\s\\S]*?)${Y}`,"g"),W=[],w;while((w=Q.exec($))!==null)W.push({fullMatch:w[0],content:w[1]||"",index:w.index});for(let{fullMatch:q,content:K,index:z}of W)try{let U={...X,global:X},j=Object.keys(U),B=Object.values(U),H=K.trim();if(J==="@ts")H=H.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(H.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=L.length>0?`return { ${L.join(", ")} };`:"return {};",F=`
12635
+ })();`}function y_($,X){let Z=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let Y=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(Y)return{html:$,mergedIntoExisting:Y[1]};let G=Z[1],Q=Z[2],W=Z[3];return{html:`${G}${Q} data-stx-scope="${X}"${W}${$.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function S_($){if($.__onceStore instanceof Set)return $.__onceStore;return b_}async function a3($,X,Z,J,Y,G=new Set){let Q=J.partialsDir||_0.join(_0.dirname(Z),"partials");if(Q&&!_0.isAbsolute(Q))Q=_0.resolve(process.cwd(),Q);let W=I_($,"@partial","@include"),w=S_(X);W=W.replace(/@once([\s\S]*?)@endonce/g,(H,_,L)=>{let O=_.trim(),F=`${Z}:${O}`;if(w.has(F))return"";return w.add(F),_});{let H=/@includeIf\s*\(/g,_;while((_=H.exec(W))!==null){let L=_.index,O=L+_[0].length-1,F=1,V=O+1;while(V<W.length&&F>0){if(W[V]==="(")F++;else if(W[V]===")")F--;V++}if(F!==0)break;let A=W.substring(O+1,V-1),R=A.match(/^\s*['"]([^'"]+)['"]/);if(!R){H.lastIndex=V;continue}let N=R[1],k=q(N,Q,Z),I="";if(k&&await Bun.file(k).exists())Y.add(k),I=`@include(${A})`;W=W.substring(0,L)+I+W.substring(V),H.lastIndex=0}}for(let[H,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=L.exec(W))!==null){let F=O.index,V=F+O[0].length-1,A=1,R=V+1;while(R<W.length&&A>0){if(W[R]==="(")A++;else if(W[R]===")")A--;R++}if(A!==0)break;let N=W.substring(V+1,R-1),k=s3(N,0);if(k===-1){L.lastIndex=R;continue}let I=N.substring(0,k).trim(),M=N.substring(k+1).trim(),E=M.match(/^\s*['"]([^'"]+)['"]/);if(!E){L.lastIndex=R;continue}let T=E[1],D=M.substring(E[0].length),b,S=s3(D,0);if(S!==-1)b=D.substring(S+1).trim();try{let P=`Boolean(${I})`,x;if(U0(P)){let m=j0(P,Object.keys(X));x=Boolean(m(...Object.values(X)))}else x=Boolean(W0(P,X));let f=_?!x:x,p="";if(f){let m=q(T,Q,Z);if(m&&await Bun.file(m).exists())Y.add(m);p=`@include('${T}'${b?`, ${b}`:""})`}W=W.substring(0,F)+p+W.substring(R),L.lastIndex=0}catch(P){let x=P instanceof Error?P.message:String(P),f=H0("Include",`Error evaluating ${H} condition: ${x}`,Z,$,F);W=W.substring(0,F)+f+W.substring(R),L.lastIndex=0}}}{let H=/@each\s*\(/g,_;while((_=H.exec(W))!==null){let L=_.index,O=L+_[0].length-1,F=1,V=O+1;while(V<W.length&&F>0){if(W[V]==="(")F++;else if(W[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=W.substring(O+1,V),R=W.substring(L,V+1),N=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){H.lastIndex=0,W=W.replace(R,"");continue}let[,k,I,M,E]=N;try{let T,D=I.trim();if(U0(D))T=j0(D,Object.keys(X))(...Object.values(X));else T=W0(D,X);let b="";if(Array.isArray(T)&&T.length>0)for(let S of T){let P={...X,[M]:S},x=await U(k,P,$,L);b+=x}else if(E)b=await U(E,{},$,L);W=W.substring(0,L)+b+W.substring(V+1),H.lastIndex=0}catch(T){let D=T instanceof Error?T.message:String(T);W=W.substring(0,L)+H0("Each",`Error in @each: ${D}`,Z,$,L)+W.substring(V+1),H.lastIndex=0}}}{let H=/@includeFirst\s*\(/g,_;while((_=H.exec(W))!==null){let L=_.index,O=L+_[0].length-1,F=1,V=O+1;while(V<W.length&&F>0){if(W[V]==="(")F++;else if(W[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=W.substring(O+1,V),R=W.substring(L,V+1),N=A.match(/^\s*(\[[^\]]+\])/);if(!N){H.lastIndex=0,W=W.replace(R,"");continue}let k=N[1],I=A.slice(N[0].length),M,E=I.match(/^\s*,\s*\{/);if(E){I=I.slice(E[0].length-1);let b=1,S=1;while(S<I.length&&b>0){if(I[S]==="{")b++;else if(I[S]==="}"){if(b--,b===0)break}S++}M=I.substring(0,S+1),I=I.slice(S+1)}let T,D=I.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)T=D[1];try{let b=JSON.parse(k.replace(/'/g,'"')),S={};if(M)try{S=E0(M,X)}catch(x){let f=x instanceof Error?x.message:String(x);if(J.debug){let p=H0("Include",`Error parsing includeFirst variables: ${f}`,Z,$,L,R);W=W.replace(R,()=>p)}else W=W.replace(R,()=>T||"");continue}let P=!1;for(let x of b){let f=q(x,Q,Z);if(!f)continue;if(await o(f)){let p=await U(x,S,$,L);W=W.replace(R,()=>p),P=!0;break}}if(!P)if(T!==void 0)W=W.replace(R,()=>T);else if(J.debug){let x=H0("Include",`None of the includeFirst paths exist: ${k}`,Z,$,L,R);W=W.replace(R,()=>x)}else W=W.replace(R,"")}catch(b){let S=b instanceof Error?b.message:String(b),P=H0("Include",`Error processing @includeFirst: ${S}`,Z,$,L,R);W=W.replace(R,()=>P)}H.lastIndex=0}}function q(H,_,L){try{let O=H;if(!H.endsWith(".stx"))O=`${H}.stx`;let F=_0.resolve(_),V=_0.resolve(_0.dirname(L)),A;if(!O.startsWith("./")&&!O.startsWith("../"))A=_0.resolve(_,O);else A=_0.resolve(V,O);let R=_0.normalize(A),N=R.startsWith(F+_0.sep)||R===F,k=R.startsWith(V+_0.sep)||R===V,I=!1,M=_0.dirname(V);if(R.startsWith(M+_0.sep)){if(!_0.relative(M,R).split(_0.sep).some((b)=>b.startsWith(".")&&b!=="."&&b!==".."))I=!0}if(!N&&!k&&!I)return console.error(`Security: Path traversal attempt blocked for include path: ${H}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${F}, ${V}`),null;return R}catch(O){return console.error(`Error resolving path ${H}: ${O}`),null}}let K=_0.resolve(Z);G.add(K);function z(H,_,L,O){return J.onIncludeError?.({includePath:H,templatePath:Z,message:_,partialsDir:Q}),H0("Include",_,Z,L,O)}async function U(H,_={},L,O){let F=q(H,Q,Z);if(!F)return z(H,`Could not resolve path for include: ${H}`,L,O);let V=_0.resolve(F);if(G.has(V)){let A=[...G,V].map((R)=>_0.basename(R)).join(" -> ");return z(H,`Circular include detected: ${A}`,L,O)}try{Y.add(F);let A;if(!A)try{A=await Bun.file(F).text()}catch(f){let p=f instanceof Error?f.message:String(f);return z(H,`Error loading include file ${H}: ${p}`,L,O)}if(A)A=A.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(A&&A.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (_3(),H3));A=f(A,X)}if(A&&(J.debug||!s7()&&!l$()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (L3(),aG));f(A,F)}catch{}let R=A;try{let{processESImports:f}=await Promise.resolve().then(() => (i3(),RQ));await f(A,X,F,J,Y)}catch(f){if(J.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,f instanceof Error?f.message:f)}let N=p8(R);if(N)R=N.content.trim();let I=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(I)M=`<style${I[1]}>${I[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let E={...X};E.__stx_signals_gate=T1(A);for(let[f,p]of Object.entries(_))E[f]=p;let T=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...A.matchAll(T)],b="",S=null;for(let f of D){let p=f[1]||"",m=f[2]||"",A0=p.includes("server"),K0=$5(p),b0="";try{let{extractAndStripCssImports:r,renderVendorStyleTags:Y0}=await Promise.resolve().then(() => (g7(),m2)),G0=r(m,{filePath:F,projectRoot:process.cwd()});m=G0.code,b0=Y0(G0.styles)}catch(r){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,r instanceof Error?r.message:r)}if(K0&&m.trim())m=X5(m);if(!A0)try{let{hasUserImports:r,bundleClientScript:Y0}=await Promise.resolve().then(() => (D5(),C7));if(r(m))m=await Y0(m,F,{projectRoot:process.cwd()})}catch(r){if(J.debug)console.warn(`[stx] bundler skipped for ${F}:`,r instanceof Error?r.message:r)}let S0=E_(m);if(S0&&!A0){S=`stx_scope_${_0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++yQ}`;let r=r0(m),Y0=D_(r,S);b+=`${b0}<script data-stx-scoped data-stx-run="always">${Y0}</script>
12636
+ `;continue}if(A0)try{let{extractVariables:r}=await Promise.resolve().then(() => (c7(),r8));await r(m,E,F)}catch(r){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,r)}if(!A0&&!S0){let r=p.replace(/\bclient\b/i,"").trim();S=`stx_scope_${_0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++yQ}`;let Y0=r0(m),G0=CQ(Y0,S),R0=SQ(Y0,G0);b+=`${b0}<script data-stx-scoped data-stx-run="always"${r?` ${r}`:""}>${R0}</script>
12637
+ `}}if(S){let f=y_(R,S);if(R=f.html,f.mergedIntoExisting)b=b.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),S=f.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await a3(R,E,F,J,Y,G);let{processLoops:P}=await Promise.resolve().then(() => (o3(),DQ)),x=P(R,E,F);if(x=E1(x,E,F),x=h1(x,E,F),M)x+=`
12638
+ `+M;if(b)x+=`
12639
+ `+b;return x}catch(A){let R=A instanceof Error?A.message:String(A);return z(H,`Error processing include ${H}: ${R}`,L,O)}}let j=/@include\s*\(/g,B;while((B=j.exec(W))!==null){let H=B.index,_=H+B[0].length-1,L=1,O=_+1;while(O<W.length&&L>0){if(W[O]==="(")L++;else if(W[O]===")")L--;O++}if(L!==0)break;let F=W.substring(H,O),V=W.substring(_+1,O-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=O;continue}let R=A[1],N,k=V.substring(A[0].length),I=s3(k,0);if(I!==-1)N=k.substring(I+1).trim();let M={};if(N)try{M=E0(N,X)}catch(T){let D=T instanceof Error?T.message:String(T);W=W.replace(F,H0("Include",`Error parsing include variables for ${R}: ${D}`,Z,$,H)),j.lastIndex=0;continue}let E=await U(R,M,$,H);W=W.substring(0,H)+E+W.substring(O),j.lastIndex=0}return W}function t3($,X){let Z=$;function J(Y,G,Q,W){let w=Y,q=!0;while(q){q=!1;let K=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),z=w.match(K);if(!z||z.index===void 0)break;let U=z.index,j=z[1],B=U+z[0].length,H=new RegExp(`@${G}\\(`),_=new RegExp(`@${Q}(?![a-z])`),L=1,O=B,F=-1;while(L>0&&O<w.length){let A=w.slice(O),R=A.match(H),N=A.match(_),k=R?O+R.index:1/0,I=N?O+N.index:1/0;if(k<I)L++,O=k+(R[0].length||1);else if(I<1/0){if(L--,L===0){F=I;break}O=I+Q.length+1}else break}if(F===-1)break;let V=w.slice(B,F);if(!X[j])X[j]=[];if(W)X[j].unshift(V);else X[j].push(V);w=w.substring(0,U)+w.substring(F+`@${Q}`.length),q=!0}return w}return Z=J(Z,"push","endpush",!1),Z=J(Z,"prepend","endprepend",!0),Z}function e3($,X){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,J)=>{if(!X[J]||X[J].length===0)return"";return X[J].join(`
12640
+ `)})}var yQ=0,ZE,b_;var PQ=y(()=>{M4();Z8();j1();J1();v5();D0();F0();ZE=new Z5(500),b_=new Set});import*as $6 from"path";async function vQ($,X,Z=""){if($6.basename(Z)==="multiple-js-directives.stx")return X.firstBlockRan=!0,X.secondBlockRan=!0,X.thirdBlockRan=!0,X.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return fQ($,X,Z,"@js","@endjs")}async function xQ($,X,Z=""){if($6.basename(Z)==="ts-directive.stx"){if(X.users&&Array.isArray(X.users))X.processedUsers=X.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),X.processedOutput=JSON.stringify(X.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return fQ($,X,Z,"@ts","@endts")}async function fQ($,X,Z,J,Y){let G=$,Q=P5(`${J}([\\s\\S]*?)${Y}`,"g"),W=[],w;while((w=Q.exec($))!==null)W.push({fullMatch:w[0],content:w[1]||"",index:w.index});for(let{fullMatch:q,content:K,index:z}of W)try{let U={...X,global:X},j=Object.keys(U),B=Object.values(U),H=K.trim();if(J==="@ts")H=H.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(H.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=L.length>0?`return { ${L.join(", ")} };`:"return {};",F=`
12641
12641
  ${H}
12642
12642
  ${O}
12643
- `,A=Function(...j,F)(...B);if(A&&typeof A==="object")Object.assign(X,A);G=G.replace(q,"")}catch(U){console.error(`Error executing ${J} code block in ${Z}:`,U);let j=U instanceof Error?U.message:String(U),B=_0(`${J} Directive`,`Error executing code: ${j}`,Z,$,z,q);console.error(B),G=G.replace(q,"")}return G}var gQ=y(()=>{x5();V0()});function C_($,X="_method"){let Z=$.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${X}" value="${Z}">`}function hQ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(X,Z,J,Y,G)=>{return C_(J,G||"_method")})}async function uQ($,X,Z,J,Y){if(!J.middleware||J.middleware.length===0)return $;let G=$,Q=J.middleware.filter((W)=>W.timing===Y);if(Q.length===0)return G;for(let W of Q){if(!W.name||typeof W.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",W);continue}try{let w=await W.handler(G,X,Z,J);if(typeof w==="string")G=w;else if(J.debug)console.warn(`Middleware ${W.name} did not return a string`)}catch(w){if(J.debug)console.error(`Error in middleware ${W.name}:`,w);if(J.debug){let q=_0("Middleware",`Error in middleware '${W.name}': ${w instanceof Error?w.message:String(w)}`,Z,$);G=G.replace(/<body[^>]*>/,`$&
12644
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${j1(q)}</div>
12645
- `)}}}return G}async function dQ($,X,Z,J){return uQ($,X,Z,J,"before")}async function mQ($,X,Z,J){return uQ($,X,Z,J,"after")}var cQ=y(()=>{B1();V0()});function lQ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(X,Z,J,Y,G)=>{try{let Q=Y?y0(Y,{}):{};return H7(J,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var pQ=y(()=>{S1();S1();b0()});async function iQ($,X){let Z=$.split("/").pop()?.split(".")[0]||"";if(z8.exact[$])for(let J of z8.exact[$])await Promise.resolve(J(X,$));if(z8.exact[Z])for(let J of z8.exact[Z])await Promise.resolve(J(X,$));for(let{pattern:J,callback:Y}of z8.patterns)if(J.test($)||J.test(Z))await Promise.resolve(Y(X,$))}var z8;var nQ=y(()=>{z8={patterns:[],exact:{}}});function x_($){let X=[],Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,J;while((J=Z.exec($))!==null){let Y=J[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let G=J.index,Q=G+J[0].length,W=J[1].toLowerCase();if(J[0].endsWith("/>")||v_.has(W)){X.push([G,Q]);continue}let w=W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${w}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=Q;let K=1,z=Q,U;while((U=q.exec($))!==null)if(U[0].startsWith("</")){if(K--,K===0){z=U.index+U[0].length;break}}else if(!U[0].endsWith("/>"))K++;X.push([G,z])}return X}function rQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((X)=>rQ(X)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,X])=>X).map(([X])=>X).join(" ");return $?String($):""}function oQ($,X){if(!/:[\w-]+=/.test($))return $;let Z=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],G;while((G=J.exec($))!==null)Y.push([G.index,G.index+G[0].length]);Y.push(...x_($));function Q(q){return Y.some(([K,z])=>q>=K&&q<z)}let W=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,w=[];while((G=W.exec(Z))!==null){if(Q(G.index))continue;let q=G[0],K=G[2];if(!K||!K.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,U,j=K,B=!1;while((U=z.exec(K))!==null){let H=U[1],_=U[2];if(O2(H))continue;if(_.includes("()")&&!_.includes(".get(")||_.includes("$store")||_.includes("$ref"))continue;try{let L=Object.keys(X),O=Object.values(X),F=_.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!L.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...L,`return (${_})`)(...O);if(H==="class"){let R=rQ(A);if(R){let N=j.match(/\sclass="([^"]*)"/);if(N)j=j.replace(N[0],` class="${N[1]} ${R}"`);else j=j.replace(U[0],` class="${R}"`)}else j=j.replace(U[0],"");B=!0;continue}if(P_.has(H)){if(A)j=j.replace(U[0],` ${H}`);else j=j.replace(U[0],"");B=!0;continue}if(A===null||A===void 0||A===!1)j=j.replace(U[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(U[0],` ${H}="${R}"`)}B=!0}catch{continue}}if(B){let H=q.endsWith("/>")?" /":"",L=`<${G[1]}${j}${H}>`;w.push({start:G.index,end:G.index+q.length,replacement:L})}}for(let q=w.length-1;q>=0;q--){let{start:K,end:z,replacement:U}=w[q];Z=Z.slice(0,K)+U+Z.slice(z)}return Z}var P_,v_;var sQ=y(()=>{J1();P_=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),v_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function O5($,X){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=X;let J=Z.exec($);if(!J)return null;let Y=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&f_.has(J[1]),G=Y?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:G,selfClosing:Y,start:J.index,end:J.index+J[0].length}}function h_($,X,Z){let J=1,Y=Z,G=new RegExp(`<${X}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${X}\\s*>`,"gi");while(J>0&&Y<$.length){G.lastIndex=Y,Q.lastIndex=Y;let W=G.exec($),w=Q.exec($);if(!w)return-1;if(W&&W.index<w.index)J++,Y=W.index+W[0].length;else{if(J--,J===0)return w.index+w[0].length;Y=w.index+w[0].length}}return-1}function O1($,X){if(X.selfClosing)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};let Z=h_($,X.tag,X.end);if(Z===-1)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};return{outerStart:X.start,outerEnd:Z,innerHTML:$.slice(X.end,Z-`</${X.tag}>`.length)}}function aQ($,X){return new RegExp(`(?:^|\\s)${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${X}=`)||$.includes(` ${X} `)||$.trimEnd().endsWith(` ${X}`)}function t5($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Z}="([^"]*)"`,"s"))||$.match(new RegExp(`${Z}='([^']*)'`,"s"));return J?J[1]:null}function n1($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function r1($,X,Z){let J=X.selfClosing?" /":"",Y=`<${X.tag}${Z}${J}>`;return $.slice(0,X.start)+Y+$.slice(X.end)}function u_($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function d_($){let X=$,Z=0;while(Z<X.length){let J=O5(X,Z);if(!J)break;let Y=t5(J.attrs,"v-for");if(Y===null){Z=J.end;continue}let G=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=J.end;continue}let Q=G[1].trim(),W=G[2].trim(),w;if(Q.includes(",")){let _=Q.split(",").map((F)=>F.trim()),L=_[0],O=_[1];w=`${W} as ${O} => ${L}`}else w=`${W} as ${Q}`;let q=n1(J.attrs,"v-for"),K=n1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=O1(X,J),U=X.slice(z.outerStart,z.outerEnd),j=r1(U,{...J,start:0,end:J.end-J.start},K),B=`@foreach(${w})
12643
+ `,A=Function(...j,F)(...B);if(A&&typeof A==="object")Object.assign(X,A);G=G.replace(q,"")}catch(U){console.error(`Error executing ${J} code block in ${Z}:`,U);let j=U instanceof Error?U.message:String(U),B=H0(`${J} Directive`,`Error executing code: ${j}`,Z,$,z,q);console.error(B),G=G.replace(q,"")}return G}var gQ=y(()=>{v5();F0()});function C_($,X="_method"){let Z=$.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${X}" value="${Z}">`}function hQ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(X,Z,J,Y,G)=>{return C_(J,G||"_method")})}async function uQ($,X,Z,J,Y){if(!J.middleware||J.middleware.length===0)return $;let G=$,Q=J.middleware.filter((W)=>W.timing===Y);if(Q.length===0)return G;for(let W of Q){if(!W.name||typeof W.handler!=="function"){if(J.debug)console.warn("Invalid middleware:",W);continue}try{let w=await W.handler(G,X,Z,J);if(typeof w==="string")G=w;else if(J.debug)console.warn(`Middleware ${W.name} did not return a string`)}catch(w){if(J.debug)console.error(`Error in middleware ${W.name}:`,w);if(J.debug){let q=H0("Middleware",`Error in middleware '${W.name}': ${w instanceof Error?w.message:String(w)}`,Z,$);G=G.replace(/<body[^>]*>/,`$&
12644
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${U1(q)}</div>
12645
+ `)}}}return G}async function dQ($,X,Z,J){return uQ($,X,Z,J,"before")}async function mQ($,X,Z,J){return uQ($,X,Z,J,"after")}var cQ=y(()=>{j1();F0()});function lQ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(X,Z,J,Y,G)=>{try{let Q=Y?E0(Y,{}):{};return H7(J,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var pQ=y(()=>{P1();P1();D0()});async function iQ($,X){let Z=$.split("/").pop()?.split(".")[0]||"";if(z8.exact[$])for(let J of z8.exact[$])await Promise.resolve(J(X,$));if(z8.exact[Z])for(let J of z8.exact[Z])await Promise.resolve(J(X,$));for(let{pattern:J,callback:Y}of z8.patterns)if(J.test($)||J.test(Z))await Promise.resolve(Y(X,$))}var z8;var nQ=y(()=>{z8={patterns:[],exact:{}}});function x_($){let X=[],Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,J;while((J=Z.exec($))!==null){let Y=J[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(Y))continue;let G=J.index,Q=G+J[0].length,W=J[1].toLowerCase();if(J[0].endsWith("/>")||v_.has(W)){X.push([G,Q]);continue}let w=W.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),q=new RegExp(`<\\/?${w}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");q.lastIndex=Q;let K=1,z=Q,U;while((U=q.exec($))!==null)if(U[0].startsWith("</")){if(K--,K===0){z=U.index+U[0].length;break}}else if(!U[0].endsWith("/>"))K++;X.push([G,z])}return X}function rQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((X)=>rQ(X)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,X])=>X).map(([X])=>X).join(" ");return $?String($):""}function oQ($,X){if(!/:[\w-]+=/.test($))return $;let Z=$,J=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Y=[],G;while((G=J.exec($))!==null)Y.push([G.index,G.index+G[0].length]);Y.push(...x_($));function Q(q){return Y.some(([K,z])=>q>=K&&q<z)}let W=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,w=[];while((G=W.exec(Z))!==null){if(Q(G.index))continue;let q=G[0],K=G[2];if(!K||!K.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,U,j=K,B=!1;while((U=z.exec(K))!==null){let H=U[1],_=U[2];if(O2(H))continue;if(_.includes("()")&&!_.includes(".get(")||_.includes("$store")||_.includes("$ref"))continue;try{let L=Object.keys(X),O=Object.values(X),F=_.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!L.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...L,`return (${_})`)(...O);if(H==="class"){let R=rQ(A);if(R){let N=j.match(/\sclass="([^"]*)"/);if(N)j=j.replace(N[0],` class="${N[1]} ${R}"`);else j=j.replace(U[0],` class="${R}"`)}else j=j.replace(U[0],"");B=!0;continue}if(P_.has(H)){if(A)j=j.replace(U[0],` ${H}`);else j=j.replace(U[0],"");B=!0;continue}if(A===null||A===void 0||A===!1)j=j.replace(U[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");j=j.replace(U[0],` ${H}="${R}"`)}B=!0}catch{continue}}if(B){let H=q.endsWith("/>")?" /":"",L=`<${G[1]}${j}${H}>`;w.push({start:G.index,end:G.index+q.length,replacement:L})}}for(let q=w.length-1;q>=0;q--){let{start:K,end:z,replacement:U}=w[q];Z=Z.slice(0,K)+U+Z.slice(z)}return Z}var P_,v_;var sQ=y(()=>{J1();P_=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),v_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function _5($,X){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=X;let J=Z.exec($);if(!J)return null;let Y=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&f_.has(J[1]),G=Y?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:G,selfClosing:Y,start:J.index,end:J.index+J[0].length}}function h_($,X,Z){let J=1,Y=Z,G=new RegExp(`<${X}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${X}\\s*>`,"gi");while(J>0&&Y<$.length){G.lastIndex=Y,Q.lastIndex=Y;let W=G.exec($),w=Q.exec($);if(!w)return-1;if(W&&W.index<w.index)J++,Y=W.index+W[0].length;else{if(J--,J===0)return w.index+w[0].length;Y=w.index+w[0].length}}return-1}function O1($,X){if(X.selfClosing)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};let Z=h_($,X.tag,X.end);if(Z===-1)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};return{outerStart:X.start,outerEnd:Z,innerHTML:$.slice(X.end,Z-`</${X.tag}>`.length)}}function aQ($,X){return new RegExp(`(?:^|\\s)${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${X}=`)||$.includes(` ${X} `)||$.trimEnd().endsWith(` ${X}`)}function a5($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Z}="([^"]*)"`,"s"))||$.match(new RegExp(`${Z}='([^']*)'`,"s"));return J?J[1]:null}function r1($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function o1($,X,Z){let J=X.selfClosing?" /":"",Y=`<${X.tag}${Z}${J}>`;return $.slice(0,X.start)+Y+$.slice(X.end)}function u_($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function d_($){let X=$,Z=0;while(Z<X.length){let J=_5(X,Z);if(!J)break;let Y=a5(J.attrs,"v-for");if(Y===null){Z=J.end;continue}let G=Y.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=J.end;continue}let Q=G[1].trim(),W=G[2].trim(),w;if(Q.includes(",")){let _=Q.split(",").map((F)=>F.trim()),L=_[0],O=_[1];w=`${W} as ${O} => ${L}`}else w=`${W} as ${Q}`;let q=r1(J.attrs,"v-for"),K=r1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=O1(X,J),U=X.slice(z.outerStart,z.outerEnd),j=o1(U,{...J,start:0,end:J.end-J.start},K),B=`@foreach(${w})
12646
12646
  `,H=`${B}${j}
12647
- @endforeach`;X=X.slice(0,z.outerStart)+H+X.slice(z.outerEnd),Z=z.outerStart+B.length}return X}function m_($){let X=$,Z=0;while(Z<X.length){let J=O5(X,Z);if(!J)break;let Y=t5(J.attrs,"v-if");if(Y===null){Z=J.end;continue}let G=[],Q=O1(X,J),W=n1(J.attrs,"v-if"),w=r1(X.slice(Q.outerStart,Q.outerEnd),{...J,start:0,end:J.end-J.start},W);G.push({type:"if",expr:Y,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:w,parsedTag:J});let q=Q.outerEnd,K=!0;while(K){let H=X.slice(q).match(/^\s*/),_=H?H[0].length:0,L=O5(X,q+_);if(!L){K=!1;break}let O=t5(L.attrs,"v-else-if"),F=aQ(L.attrs,"v-else");if(O!==null){let V=O1(X,L),A=n1(L.attrs,"v-else-if"),R=r1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else-if",expr:O,outerStart:q,outerEnd:V.outerEnd,element:R,parsedTag:L}),q=V.outerEnd}else if(F){let V=O1(X,L),A=n1(L.attrs,"v-else"),R=r1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else",outerStart:q,outerEnd:V.outerEnd,element:R,parsedTag:L}),K=!1}else K=!1}let z=[];for(let H of G)if(H.type==="if")z.push(`@if(${H.expr})
12647
+ @endforeach`;X=X.slice(0,z.outerStart)+H+X.slice(z.outerEnd),Z=z.outerStart+B.length}return X}function m_($){let X=$,Z=0;while(Z<X.length){let J=_5(X,Z);if(!J)break;let Y=a5(J.attrs,"v-if");if(Y===null){Z=J.end;continue}let G=[],Q=O1(X,J),W=r1(J.attrs,"v-if"),w=o1(X.slice(Q.outerStart,Q.outerEnd),{...J,start:0,end:J.end-J.start},W);G.push({type:"if",expr:Y,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:w,parsedTag:J});let q=Q.outerEnd,K=!0;while(K){let H=X.slice(q).match(/^\s*/),_=H?H[0].length:0,L=_5(X,q+_);if(!L){K=!1;break}let O=a5(L.attrs,"v-else-if"),F=aQ(L.attrs,"v-else");if(O!==null){let V=O1(X,L),A=r1(L.attrs,"v-else-if"),R=o1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else-if",expr:O,outerStart:q,outerEnd:V.outerEnd,element:R,parsedTag:L}),q=V.outerEnd}else if(F){let V=O1(X,L),A=r1(L.attrs,"v-else"),R=o1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else",outerStart:q,outerEnd:V.outerEnd,element:R,parsedTag:L}),K=!1}else K=!1}let z=[];for(let H of G)if(H.type==="if")z.push(`@if(${H.expr})
12648
12648
  ${H.element}`);else if(H.type==="else-if")z.push(`@elseif(${H.expr})
12649
12649
  ${H.element}`);else z.push(`@else
12650
12650
  ${H.element}`);z.push("@endif");let U=z.join(`
12651
- `),j=G[0].outerStart,B=G[G.length-1].outerEnd;X=X.slice(0,j)+U+X.slice(B),Z=j+U.length}return X}function c_($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function l_($){let X=$,Z=0;while(Z<X.length){let J=O5(X,Z);if(!J)break;let Y=J.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,W=Y.match(Q);while(W){G=!0;let K=W[1],z=W[2],U=W[3];Y=Y.replace(W[0],""),Y+=` :${K}="${U}" @update:${K}="${U} = $event"`,W=Y.match(Q)}if(G){let K=O1(X,J),z=X.slice(K.outerStart,K.outerEnd),U=r1(z,{...J,start:0,end:J.end-J.start},Y);X=X.slice(0,K.outerStart)+U+X.slice(K.outerEnd),Z=K.outerStart+U.length;continue}let w=t5(J.attrs,"v-model");if(w===null){Z=J.end;continue}if(g_.has(J.tag)){let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${w}"`,z=O1(X,J),U=X.slice(z.outerStart,z.outerEnd),j=r1(U,{...J,start:0,end:J.end-J.start},K);X=X.slice(0,z.outerStart)+j+X.slice(z.outerEnd),Z=z.outerStart+j.length}else{let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"");K+=` :modelValue="${w}" @update:modelValue="${w} = $event"`;let z=O1(X,J),U=X.slice(z.outerStart,z.outerEnd),j=r1(U,{...J,start:0,end:J.end-J.start},K);X=X.slice(0,z.outerStart)+j+X.slice(z.outerEnd),Z=z.outerStart+j.length}}return X}function p_($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function i_($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function n_($){let X=$,Z=0;while(Z<X.length){let J=O5(X,Z);if(!J)break;let Y=t5(J.attrs,"v-html");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=O1(X,J),Q=n1(J.attrs,"v-html"),W=J.selfClosing?" /":"",w=`<${J.tag}${Q}${W}>{!! ${Y} !!}</${J.tag}>`;X=X.slice(0,G.outerStart)+w+X.slice(G.outerEnd),Z=G.outerStart+w.length}return X}function r_($){let X=$,Z=0;while(Z<X.length){let J=O5(X,Z);if(!J)break;let Y=t5(J.attrs,"v-text");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=O1(X,J),Q=n1(J.attrs,"v-text"),W=J.selfClosing?" /":"",w=`<${J.tag}${Q}${W}>{{ ${Y} }}</${J.tag}>`;X=X.slice(0,G.outerStart)+w+X.slice(G.outerEnd),Z=G.outerStart+w.length}return X}function o_($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function s_($){let X=$,Z=0;while(Z<X.length){let J=O5(X,Z);if(!J)break;if(!aQ(J.attrs,"v-once")){Z=J.end;continue}let Y=n1(J.attrs,"v-once"),G=O1(X,J),Q=X.slice(G.outerStart,G.outerEnd),w=`@once
12652
- ${r1(Q,{...J,start:0,end:J.end-J.start},Y)}
12653
- @endonce`;X=X.slice(0,G.outerStart)+w+X.slice(G.outerEnd),Z=G.outerStart+w.length}return X}function a_($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function t_($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function tQ($){if(!u_($))return $;let X=$;return X=d_(X),X=m_(X),X=s_(X),X=p_(X),X=i_(X),X=l_(X),X=c_(X),X=t_(X),X=n_(X),X=r_(X),X=o_(X),X=a_(X),X}var f_,g_;var eQ=y(()=>{f_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),g_=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 L9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $W($,X){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=Z?Z[1]:$,Y=Q0(J,X);if(Y&&typeof Y==="string")return Y;let G=J.trim();return X6.has(G)?G:null}function XW($){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return X?X[1]:$}function ZW($,X,Z){let J=X.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(e_.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${Z}</${$}>`}async function JW($,X,Z,J,Y){let G=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,W=[],w;while((w=Q.exec(G))!==null)W.push({full:w[0],expr:w[1],attrs:w[2],slotContent:w[3],index:w.index});for(let q=W.length-1;q>=0;q--){let K=W[q];try{let z=$W(K.expr,X);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${L9(XW(K.expr))}" -->`;G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length);continue}if(X6.has(z)){let O=ZW(z,K.attrs,K.slotContent);G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length);continue}let U=K.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=B.exec(U))!==null){let O=H[1]||H[2],F=H[3];if(H[1])try{j[O]=Q0(F,X)}catch{j[O]=F}else j[O]=F}let _=J.componentsDir||"components",L=await q5(z,j,K.slotContent,_,X,Z,J,new Set,Y??new Set);G=G.slice(0,K.index)+L+G.slice(K.index+K.full.length)}catch(z){let U=z instanceof Error?z.message:String(z),j=`<!-- dynamic component error: ${L9(U)} -->`;G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length)}}return G=await $O(G,X,Z,J,Y),G}async function $O($,X,Z,J,Y){let G=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,W=[],w;while((w=Q.exec(G))!==null)W.push({full:w[0],expr:w[1],attrs:w[2],index:w.index});for(let q=W.length-1;q>=0;q--){let K=W[q];try{let z=$W(K.expr,X);if(!z||typeof z!=="string"){let B=`<!-- dynamic component: could not resolve "${L9(XW(K.expr))}" -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length);continue}if(X6.has(z)){let B=ZW(z,K.attrs,"");G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length);continue}let U=J.componentsDir||"components",j=await q5(z,{},"",U,X,Z,J,new Set,Y??new Set);G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length)}catch(z){let U=z instanceof Error?z.message:String(z),j=`<!-- dynamic component error: ${L9(U)} -->`;G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length)}}return G}var X6,e_;var YW=y(()=>{V0();b0();X6=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),e_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function GO($){let X=$.storageKey??"stx-color-mode",Z=$.initialMode??"auto",J=$.darkClass===void 0?"dark":$.darkClass,Y=$.attribute??null,G=$.autoValue??null;if(typeof X!=="string"||X.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!XO.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(J!==null&&(typeof J!=="string"||!YO.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(Y!==null&&(typeof Y!=="string"||!JO.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(G!==null&&!ZO.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(J===null&&Y===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:X,initialMode:Z==="system"?"auto":Z,darkClass:J,attribute:Y,autoValue:G}}function QO($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function J6($={}){let X=GO($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${QO(X)};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 GW($,X={}){if($.includes("data-stx-color-mode-boot"))return $;let Z=Z6($);if(Z===null)return $;let J=J6(X);return`${$.slice(0,Z)}
12651
+ `),j=G[0].outerStart,B=G[G.length-1].outerEnd;X=X.slice(0,j)+U+X.slice(B),Z=j+U.length}return X}function c_($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function l_($){let X=$,Z=0;while(Z<X.length){let J=_5(X,Z);if(!J)break;let Y=J.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,W=Y.match(Q);while(W){G=!0;let K=W[1],z=W[2],U=W[3];Y=Y.replace(W[0],""),Y+=` :${K}="${U}" @update:${K}="${U} = $event"`,W=Y.match(Q)}if(G){let K=O1(X,J),z=X.slice(K.outerStart,K.outerEnd),U=o1(z,{...J,start:0,end:J.end-J.start},Y);X=X.slice(0,K.outerStart)+U+X.slice(K.outerEnd),Z=K.outerStart+U.length;continue}let w=a5(J.attrs,"v-model");if(w===null){Z=J.end;continue}if(g_.has(J.tag)){let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${w}"`,z=O1(X,J),U=X.slice(z.outerStart,z.outerEnd),j=o1(U,{...J,start:0,end:J.end-J.start},K);X=X.slice(0,z.outerStart)+j+X.slice(z.outerEnd),Z=z.outerStart+j.length}else{let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"");K+=` :modelValue="${w}" @update:modelValue="${w} = $event"`;let z=O1(X,J),U=X.slice(z.outerStart,z.outerEnd),j=o1(U,{...J,start:0,end:J.end-J.start},K);X=X.slice(0,z.outerStart)+j+X.slice(z.outerEnd),Z=z.outerStart+j.length}}return X}function p_($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function i_($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function n_($){let X=$,Z=0;while(Z<X.length){let J=_5(X,Z);if(!J)break;let Y=a5(J.attrs,"v-html");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=O1(X,J),Q=r1(J.attrs,"v-html"),W=J.selfClosing?" /":"",w=`<${J.tag}${Q}${W}>{!! ${Y} !!}</${J.tag}>`;X=X.slice(0,G.outerStart)+w+X.slice(G.outerEnd),Z=G.outerStart+w.length}return X}function r_($){let X=$,Z=0;while(Z<X.length){let J=_5(X,Z);if(!J)break;let Y=a5(J.attrs,"v-text");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=O1(X,J),Q=r1(J.attrs,"v-text"),W=J.selfClosing?" /":"",w=`<${J.tag}${Q}${W}>{{ ${Y} }}</${J.tag}>`;X=X.slice(0,G.outerStart)+w+X.slice(G.outerEnd),Z=G.outerStart+w.length}return X}function o_($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function s_($){let X=$,Z=0;while(Z<X.length){let J=_5(X,Z);if(!J)break;if(!aQ(J.attrs,"v-once")){Z=J.end;continue}let Y=r1(J.attrs,"v-once"),G=O1(X,J),Q=X.slice(G.outerStart,G.outerEnd),w=`@once
12652
+ ${o1(Q,{...J,start:0,end:J.end-J.start},Y)}
12653
+ @endonce`;X=X.slice(0,G.outerStart)+w+X.slice(G.outerEnd),Z=G.outerStart+w.length}return X}function a_($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function t_($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function tQ($){if(!u_($))return $;let X=$;return X=d_(X),X=m_(X),X=s_(X),X=p_(X),X=i_(X),X=l_(X),X=c_(X),X=t_(X),X=n_(X),X=r_(X),X=o_(X),X=a_(X),X}var f_,g_;var eQ=y(()=>{f_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),g_=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 L9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $W($,X){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=Z?Z[1]:$,Y=W0(J,X);if(Y&&typeof Y==="string")return Y;let G=J.trim();return X6.has(G)?G:null}function XW($){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return X?X[1]:$}function ZW($,X,Z){let J=X.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(e_.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${Z}</${$}>`}async function JW($,X,Z,J,Y){let G=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,W=[],w;while((w=Q.exec(G))!==null)W.push({full:w[0],expr:w[1],attrs:w[2],slotContent:w[3],index:w.index});for(let q=W.length-1;q>=0;q--){let K=W[q];try{let z=$W(K.expr,X);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${L9(XW(K.expr))}" -->`;G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length);continue}if(X6.has(z)){let O=ZW(z,K.attrs,K.slotContent);G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length);continue}let U=K.attrs.trim(),j={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=B.exec(U))!==null){let O=H[1]||H[2],F=H[3];if(H[1])try{j[O]=W0(F,X)}catch{j[O]=F}else j[O]=F}let _=J.componentsDir||"components",L=await w5(z,j,K.slotContent,_,X,Z,J,new Set,Y??new Set);G=G.slice(0,K.index)+L+G.slice(K.index+K.full.length)}catch(z){let U=z instanceof Error?z.message:String(z),j=`<!-- dynamic component error: ${L9(U)} -->`;G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length)}}return G=await $O(G,X,Z,J,Y),G}async function $O($,X,Z,J,Y){let G=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,W=[],w;while((w=Q.exec(G))!==null)W.push({full:w[0],expr:w[1],attrs:w[2],index:w.index});for(let q=W.length-1;q>=0;q--){let K=W[q];try{let z=$W(K.expr,X);if(!z||typeof z!=="string"){let B=`<!-- dynamic component: could not resolve "${L9(XW(K.expr))}" -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length);continue}if(X6.has(z)){let B=ZW(z,K.attrs,"");G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length);continue}let U=J.componentsDir||"components",j=await w5(z,{},"",U,X,Z,J,new Set,Y??new Set);G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length)}catch(z){let U=z instanceof Error?z.message:String(z),j=`<!-- dynamic component error: ${L9(U)} -->`;G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length)}}return G}var X6,e_;var YW=y(()=>{F0();D0();X6=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),e_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function GO($){let X=$.storageKey??"stx-color-mode",Z=$.initialMode??"auto",J=$.darkClass===void 0?"dark":$.darkClass,Y=$.attribute??null,G=$.autoValue??null;if(typeof X!=="string"||X.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!XO.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(J!==null&&(typeof J!=="string"||!YO.test(J)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(J)}`);if(Y!==null&&(typeof Y!=="string"||!JO.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(G!==null&&!ZO.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(J===null&&Y===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:X,initialMode:Z==="system"?"auto":Z,darkClass:J,attribute:Y,autoValue:G}}function QO($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function J6($={}){let X=GO($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${QO(X)};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 GW($,X={}){if($.includes("data-stx-color-mode-boot"))return $;let Z=Z6($);if(Z===null)return $;let J=J6(X);return`${$.slice(0,Z)}
12654
12654
  ${J}${$.slice(Z)}`}function Z6($){let X=/<head\b[^>]*>/i.exec($);if(!X)return null;let Z=X.index+X[0].length,J=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(Z));if(J)Z+=J[0].length;return Z}function qO($){let X=/<head\b[^>]*>/i.exec($);if(!X)return $;let Z=X.index+X[0].length,J=$.toLowerCase().indexOf("</head>",Z),Y=$.slice(Z,J===-1?$.length:J),G=wO.exec(Y);if(!G||Y.slice(0,G.index).trim()==="")return $;let Q=Y.slice(0,G.index)+Y.slice(G.index+G[0].length);return $.slice(0,Z)+`
12655
12655
  ${G[0]}`+Q+$.slice(Z+Y.length)}function QW($){return KO(qO($))}function KO($){let X=WO.exec($);if(!X)return $;let Z=Z6($);if(Z===null)return $;if(X.index<=Z||$.slice(Z,X.index).trim()==="")return $;let J=$.slice(0,X.index)+$.slice(X.index+X[0].length),Y=Z6(J);if(Y===null)return $;return`${J.slice(0,Y)}
12656
12656
  ${X[0]}${J.slice(Y)}`}var XO,ZO,JO,YO,WO,wO;var Y6=y(()=>{XO=new Set(["light","dark","auto","system"]),ZO=new Set(["auto","system"]),JO=/^[a-z][\w:-]*$/i,YO=/^[\w-]+$/;WO=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),wO=/<meta\b[^>]*\bcharset\b[^>]*>/i});function zO(){if(G6===null)G6=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return G6}function WW($,X=zO()){if($.includes('name="stx-build"'))return $;let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let J=Z.index+Z[0].length;return`${$.slice(0,J)}
12657
- <meta name="stx-build" content="${X}">${$.slice(J)}`}var G6=null;function D1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function UO($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $7($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function e5($,X){return Object.entries($).filter(([Z])=>!X?.(Z)).map(([Z,J])=>`${Z}="${D1(String(J))}"`).join(" ")}function jO($={},X="en"){let Z=[],J=[],Y="",G=X;for(let[W,w]of Object.entries($||{})){if(w==null)continue;let q=W.trim();if(!qW.test(q))continue;let K=q.toLowerCase();if(K==="lang"){G=String(w);continue}if(K==="class"){Y=String(w).trim();continue}Z.push(` ${q}="${D1(String(w))}"`),J.push(q)}let Q=` lang="${D1(G)}"`;if(Y)Q+=` class="${D1(Y)}"`;if(Q+=Z.join(""),Y)Q+=` ${V9}="${D1(Y)}"`;if(J.length)Q+=` ${F9}="${D1(J.join(" "))}"`;return Q}function KW($={},X={}){let Z={...$,...X};if($.class&&X.class){let J=$.class.split(/\s+/).filter(Boolean);for(let Y of X.class.split(/\s+/).filter(Boolean))if(!J.includes(Y))J.push(Y);Z.class=J.join(" ")}return Z}function zW($,X={}){if(!X||Object.keys(X).length===0)return $;let Z=$.match(/<html\b([^>]*)>/i);if(!Z)return $;let J={},Y=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let K=Q[1];if(!(K in J))Y.push(K);J[K]=Q[2]??Q[3]??Q[4]??""}let W=[],w=[];for(let[K,z]of Object.entries(X)){if(z==null)continue;let U=K.trim();if(!qW.test(U))continue;let j=U.toLowerCase();if(j==="class"){let B=(J.class||"").split(/\s+/).filter(Boolean);for(let H of String(z).split(/\s+/).filter(Boolean))if(!B.includes(H))B.push(H),W.push(H);if(!("class"in J))Y.push("class");J.class=B.join(" ");continue}if(!(U in J))Y.push(U);if(J[U]=String(z),j!=="lang")w.push(U)}if(W.length){if(!(V9 in J))Y.push(V9);J[V9]=W.join(" ")}if(w.length){if(!(F9 in J))Y.push(F9);J[F9]=w.join(" ")}let q=Y.map((K)=>` ${K}="${D1(J[K])}"`).join("");return $.replace(Z[0],()=>`<html${q}>`)}function UW($){if($.includes("data-stx-cloak"))return $;let X=$.lastIndexOf("</head>");if(X===-1)return $;return`${$.slice(0,X)}${wW}
12658
- ${$.slice(X)}`}function BO($){let X=[],Z=0;while(Z<$.length){let G=$.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let z=$.indexOf("-->",Z);if(z===-1)break;Z=z+3;continue}let W=G.match(/^<script\b[^>]*>/i);if(W){let z=$.toLowerCase().indexOf("</script>",Z+W[0].length);if(z===-1)break;Z=z+9;continue}let w=G.match(/^<link\b[^>]*>/i);if(w){X.push(w[0]),Z+=w[0].length;continue}let q=G.match(/^<meta\b[^>]*>/i);if(q){X.push(q[0]),Z+=q[0].length;continue}let K=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K){X.push(K[0]),Z+=K[0].length;continue}break}if(X.length===0)return{body:$,hoisted:X};let J="",Y=0;while(Y<$.length&&Y<Z){let G=$.slice(Y),Q=G.match(/^<link\b[^>]*>/i);if(Q&&X.includes(Q[0])){Y+=Q[0].length;continue}let W=G.match(/^<meta\b[^>]*>/i);if(W&&X.includes(W[0])){Y+=W[0].length;continue}let w=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(w&&X.includes(w[0])){Y+=w[0].length;continue}J+=$[Y],Y++}return J+=$.slice(Z),{body:J,hoisted:X}}function HO($,X={},Z={}){let{title:J="stx App",lang:Y="en",meta:G=[],link:Q=[],script:W=[],headRaw:w="",htmlAttrs:q={},bodyClass:K="",bodyAttrs:z={}}=X,U=Z.title||J,j=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(G.map($7).filter(Boolean)),_=[...j.filter((M)=>!B.has($7(M))),...G].map((M)=>{return` <meta ${e5(M)}>`}).join(`
12659
- `),L=Q.map((M)=>{return` <link ${e5(M)}>`}).join(`
12660
- `),O=W.map((M)=>{if(M.src)return` <script ${e5(M,(E)=>E==="content")}></script>`;if(M.content)return` <script>${M.content}</script>`;return""}).filter(Boolean).join(`
12657
+ <meta name="stx-build" content="${X}">${$.slice(J)}`}var G6=null;function D1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function UO($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function e5($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function t5($,X){return Object.entries($).filter(([Z])=>!X?.(Z)).map(([Z,J])=>`${Z}="${D1(String(J))}"`).join(" ")}function jO($={},X="en"){let Z=[],J=[],Y="",G=X;for(let[W,w]of Object.entries($||{})){if(w==null)continue;let q=W.trim();if(!qW.test(q))continue;let K=q.toLowerCase();if(K==="lang"){G=String(w);continue}if(K==="class"){Y=String(w).trim();continue}Z.push(` ${q}="${D1(String(w))}"`),J.push(q)}let Q=` lang="${D1(G)}"`;if(Y)Q+=` class="${D1(Y)}"`;if(Q+=Z.join(""),Y)Q+=` ${V9}="${D1(Y)}"`;if(J.length)Q+=` ${F9}="${D1(J.join(" "))}"`;return Q}function KW($={},X={}){let Z={...$,...X};if($.class&&X.class){let J=$.class.split(/\s+/).filter(Boolean);for(let Y of X.class.split(/\s+/).filter(Boolean))if(!J.includes(Y))J.push(Y);Z.class=J.join(" ")}return Z}function zW($,X={}){if(!X||Object.keys(X).length===0)return $;let Z=$.match(/<html\b([^>]*)>/i);if(!Z)return $;let J={},Y=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let K=Q[1];if(!(K in J))Y.push(K);J[K]=Q[2]??Q[3]??Q[4]??""}let W=[],w=[];for(let[K,z]of Object.entries(X)){if(z==null)continue;let U=K.trim();if(!qW.test(U))continue;let j=U.toLowerCase();if(j==="class"){let B=(J.class||"").split(/\s+/).filter(Boolean);for(let H of String(z).split(/\s+/).filter(Boolean))if(!B.includes(H))B.push(H),W.push(H);if(!("class"in J))Y.push("class");J.class=B.join(" ");continue}if(!(U in J))Y.push(U);if(J[U]=String(z),j!=="lang")w.push(U)}if(W.length){if(!(V9 in J))Y.push(V9);J[V9]=W.join(" ")}if(w.length){if(!(F9 in J))Y.push(F9);J[F9]=w.join(" ")}let q=Y.map((K)=>` ${K}="${D1(J[K])}"`).join("");return $.replace(Z[0],()=>`<html${q}>`)}function UW($){if($.includes("data-stx-cloak"))return $;let X=$.lastIndexOf("</head>");if(X===-1)return $;return`${$.slice(0,X)}${wW}
12658
+ ${$.slice(X)}`}function BO($){let X=[],Z=0;while(Z<$.length){let G=$.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let z=$.indexOf("-->",Z);if(z===-1)break;Z=z+3;continue}let W=G.match(/^<script\b[^>]*>/i);if(W){let z=$.toLowerCase().indexOf("</script>",Z+W[0].length);if(z===-1)break;Z=z+9;continue}let w=G.match(/^<link\b[^>]*>/i);if(w){X.push(w[0]),Z+=w[0].length;continue}let q=G.match(/^<meta\b[^>]*>/i);if(q){X.push(q[0]),Z+=q[0].length;continue}let K=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K){X.push(K[0]),Z+=K[0].length;continue}break}if(X.length===0)return{body:$,hoisted:X};let J="",Y=0;while(Y<$.length&&Y<Z){let G=$.slice(Y),Q=G.match(/^<link\b[^>]*>/i);if(Q&&X.includes(Q[0])){Y+=Q[0].length;continue}let W=G.match(/^<meta\b[^>]*>/i);if(W&&X.includes(W[0])){Y+=W[0].length;continue}let w=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(w&&X.includes(w[0])){Y+=w[0].length;continue}J+=$[Y],Y++}return J+=$.slice(Z),{body:J,hoisted:X}}function HO($,X={},Z={}){let{title:J="stx App",lang:Y="en",meta:G=[],link:Q=[],script:W=[],headRaw:w="",htmlAttrs:q={},bodyClass:K="",bodyAttrs:z={}}=X,U=Z.title||J,j=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(G.map(e5).filter(Boolean)),_=[...j.filter((M)=>!B.has(e5(M))),...G].map((M)=>{return` <meta ${t5(M)}>`}).join(`
12659
+ `),L=Q.map((M)=>{return` <link ${t5(M)}>`}).join(`
12660
+ `),O=W.map((M)=>{if(M.src)return` <script ${t5(M,(E)=>E==="content")}></script>`;if(M.content)return` <script>${M.content}</script>`;return""}).filter(Boolean).join(`
12661
12661
  `),F=jO(q,Y),V=Object.entries(z).map(([M,E])=>` ${M}="${D1(String(E))}"`).join(""),A=K?` class="${D1(K)}"`:"",{body:R,hoisted:N}=BO($),k=[_,Z.colorMode?` ${J6(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?U:UO(U)}</title>`,` ${wW}`,L,O,w?` ${w}`:"",...(Z.styles||[]).map((M)=>` ${M}`),...N.map((M)=>` ${M}`),...(Z.headScripts||[]).map((M)=>` ${M}`),Z.headStack||""].filter(Boolean),I=[R,...(Z.bodyScripts||[]).map((M)=>M),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
12662
12662
  <html${F}>
12663
12663
  <head>
@@ -12668,15 +12668,15 @@ ${k.join(`
12668
12668
  ${I.join(`
12669
12669
  `)}
12670
12670
  </body>
12671
- </html>`}function Q6($){let X=0;while(X<$.length){let Z=$.slice(X),J=Z.match(/^\s+/);if(J){X+=J[0].length;continue}if(Z.startsWith("<!--")){let G=$.indexOf("-->",X);if(G===-1)return!1;X=G+3;continue}let Y=Z.match(/^<(script|style)\b[^>]*>/i);if(Y){let G=`</${Y[1].toLowerCase()}>`,Q=$.toLowerCase().indexOf(G,X+Y[0].length);if(Q===-1)return!1;X=Q+G.length;continue}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}return!1}function W6($){return Q6($)}function jW($,X={}){let Z=$.lastIndexOf("</head>");if(Z===-1)return $;let{meta:J=[],link:Y=[],script:G=[],headRaw:Q=""}=X,W=$.slice(0,Z),w=[];for(let q of J){let K=$7(q);if(K&&W.includes(K))continue;w.push(` <meta ${e5(q)}>`)}for(let q of Y){if(q.href&&W.includes(`href="${q.href}"`))continue;w.push(` <link ${e5(q)}>`)}for(let q of G)if(q.src){if(W.includes(`src="${q.src}"`))continue;w.push(` <script ${e5(q,(K)=>K==="content")}></script>`)}else if(q.content){if(W.includes(q.content))continue;w.push(` <script>${q.content}</script>`)}if(Q&&!W.includes(Q))w.push(` ${Q}`);if(w.length===0)return $;return`${$.slice(0,Z)}${w.join(`
12671
+ </html>`}function Q6($){let X=0;while(X<$.length){let Z=$.slice(X),J=Z.match(/^\s+/);if(J){X+=J[0].length;continue}if(Z.startsWith("<!--")){let G=$.indexOf("-->",X);if(G===-1)return!1;X=G+3;continue}let Y=Z.match(/^<(script|style)\b[^>]*>/i);if(Y){let G=`</${Y[1].toLowerCase()}>`,Q=$.toLowerCase().indexOf(G,X+Y[0].length);if(Q===-1)return!1;X=Q+G.length;continue}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}return!1}function W6($){return Q6($)}function jW($,X={}){let Z=$.lastIndexOf("</head>");if(Z===-1)return $;let{meta:J=[],link:Y=[],script:G=[],headRaw:Q=""}=X,W=$.slice(0,Z),w=[];for(let q of J){let K=e5(q);if(K&&W.includes(K))continue;w.push(` <meta ${t5(q)}>`)}for(let q of Y){if(q.href&&W.includes(`href="${q.href}"`))continue;w.push(` <link ${t5(q)}>`)}for(let q of G)if(q.src){if(W.includes(`src="${q.src}"`))continue;w.push(` <script ${t5(q,(K)=>K==="content")}></script>`)}else if(q.content){if(W.includes(q.content))continue;w.push(` <script>${q.content}</script>`)}if(Q&&!W.includes(Q))w.push(` ${Q}`);if(w.length===0)return $;return`${$.slice(0,Z)}${w.join(`
12672
12672
  `)}
12673
- ${$.slice(Z)}`}function BW($,X={},Z={}){if(W6($))return $;return HO($,X,Z)}var wW="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",F9="data-stx-html-attrs",V9="data-stx-html-class",qW;var HW=y(()=>{Y6();qW=/^[A-Za-z_:][\w:.-]*$/});import X7 from"path";function _W($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function OW($,X,Z){try{let J;if($.startsWith("/")){let Y=X;for(let G=0;G<5;G++){let Q=X7.join(Y,$);if(await Bun.file(Q).exists())return Q;Y=X7.dirname(Y)}J=X7.join(X,$)}else if($.startsWith("./")||$.startsWith("../"))J=X7.resolve(X,$);else J=X7.resolve(X,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function LW($,X,Z){let J=$,Y=X7.dirname(X),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(J))!==null){let[q,K,z,U]=Q;if(_W(z))continue;let j=await OW(z,Y,X);if(j)try{let B=await Bun.file(j).text();if(Z.add(j),z.endsWith(".ts")||z.endsWith(".tsx")){let _=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:d0()});if(_.outputs.length>0)B=await _.outputs[0].text()}let H=`<script>
12673
+ ${$.slice(Z)}`}function BW($,X={},Z={}){if(W6($))return $;return HO($,X,Z)}var wW="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",F9="data-stx-html-attrs",V9="data-stx-html-class",qW;var HW=y(()=>{Y6();qW=/^[A-Za-z_:][\w:.-]*$/});import $7 from"path";function _W($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function OW($,X,Z){try{let J;if($.startsWith("/")){let Y=X;for(let G=0;G<5;G++){let Q=$7.join(Y,$);if(await Bun.file(Q).exists())return Q;Y=$7.dirname(Y)}J=$7.join(X,$)}else if($.startsWith("./")||$.startsWith("../"))J=$7.resolve(X,$);else J=$7.resolve(X,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function LW($,X,Z){let J=$,Y=$7.dirname(X),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(J))!==null){let[q,K,z,U]=Q;if(_W(z))continue;let j=await OW(z,Y,X);if(j)try{let B=await Bun.file(j).text();if(Z.add(j),z.endsWith(".ts")||z.endsWith(".tsx")){let _=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:u0()});if(_.outputs.length>0)B=await _.outputs[0].text()}let H=`<script>
12674
12674
  // Source: ${z}
12675
12675
  ${B}
12676
12676
  </script>`;J=J.replace(q,H),G.lastIndex=0}catch(B){}}let W=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,w;while((w=W.exec(J))!==null){let[q,K,z,U]=w,j=K+U;if(_W(z))continue;if(/rel=["']stylesheet["']/.test(j)||z.endsWith(".css")){let H=await OW(z,Y,X);if(H)try{let _=await Bun.file(H).text();Z.add(H);let L=`<style>
12677
12677
  /* Source: ${z} */
12678
12678
  ${_}
12679
- </style>`;J=J.replace(q,L),W.lastIndex=0}catch(_){}}}return J}var FW=y(()=>{P1()});function w6($,X){let Z=$,J=/@json\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index,Q=G+Y[0].length-1,W=1,w=Q+1,q=null,K=!1;while(w<Z.length&&W>0){let F=Z[w];if(K){K=!1,w++;continue}if(F==="\\"&&q){K=!0,w++;continue}if(q){if(F===q)q=null;w++;continue}if(F==='"'||F==="'"||F==="`"){q=F,w++;continue}if(F==="(")W++;else if(F===")"){if(W--,W===0)break}w++}if(W!==0)break;let z=Z.substring(Q+1,w).trim(),U=Z.substring(G,w+1),j=-1,B=0,H=null,_=!1;for(let F=0;F<z.length;F++){let V=z[F];if(_){_=!1;continue}if(V==="\\"&&H){_=!0;continue}if(H){if(V===H)H=null;continue}if(V==='"'||V==="'"||V==="`"){H=V;continue}if(V==="("||V==="["||V==="{")B++;else if(V===")"||V==="]"||V==="}")B--;if(V===","&&B===0){j=F;break}}let L=j>=0?z.substring(0,j).trim():z,O=j>=0?z.substring(j+1).trim():void 0;try{let F=L.trim(),V;if(K0(F))V=z0(F,Object.keys(X))(...Object.values(X));else V=void 0;let A;if(O==="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(w+1),J.lastIndex=G+R.length}catch(F){Q1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=G+U.length}}return Z}function q6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function VW($){let X=$,Z=/@memo\s*\(/g,J,Y=[];while((J=Z.exec(X))!==null){let G=J.index,Q=G+J[0].length,W=1,w=Q;while(w<X.length&&W>0){if(X[w]==="(")W++;else if(X[w]===")")W--;w++}if(W!==0)continue;let q=X.slice(Q,w-1).trim(),K=w,z=X.slice(K),U=z.indexOf("@endmemo");if(U===-1)continue;let j=z.slice(0,U),B=K+U+8,H=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),_=H?H[0].length:0,L=j.slice(_),O=j.match(/(\s*)$/),F=O?O[0].length:0,V=L.slice(0,L.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,k,I="",M]=A,E=`<${k}${I} data-stx-memo="${q}"${M}>`;R=j.slice(0,_)+E+V.slice(N.length)+j.slice(_+V.length)}else R=`${j.slice(0,_)}<div data-stx-memo="${q}">${V}</div>${j.slice(_+V.length)}`;Y.push({start:G,end:B,replacement:R}),Z.lastIndex=B}for(let G=Y.length-1;G>=0;G--){let Q=Y[G];X=X.slice(0,Q.start)+Q.replacement+X.slice(Q.end)}return X.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function K6($){let X=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return X=X.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),X}function AW($){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"),J="",Y=0,G;while((G=Z.exec($))!==null){let Q=G.index,W=Q+G[0].length,w=!1,q=!1,K=-1;while(W<$.length){let H=$[W];if(w){if(H==="'")w=!1}else if(q){if(H==='"')q=!1}else if(H==="'")w=!0;else if(H==='"')q=!0;else if(H===">"){K=W;break}W++}if(K===-1)continue;if($.slice(Q,K+1).includes("x-cloak"))continue;let U=$.slice(K+1),j=U.indexOf("</"),B=j>=0?U.slice(0,j):U.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))J+=$.slice(Y,K)+" x-cloak>",Y=K+1}return J+=$.slice(Y),J}function RW($){let X=/<[a-z][\w-]*/gi,Z="",J=0,Y;while((Y=X.exec($))!==null){let G=Y.index,Q=Y[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let B=`</${Q}>`,H=$.toLowerCase().indexOf(B,G);if(H!==-1)X.lastIndex=H+B.length;continue}let W=G+Y[0].length,w=!1,q=!1,K=-1;while(W<$.length){let B=$[W];if(w){if(B==="'")w=!1}else if(q){if(B==='"')q=!1}else if(B==="'")w=!0;else if(B==='"')q=!0;else if(B===">"){K=W;break}W++}if(K===-1)continue;let z=$.slice(G+Y[0].length,K);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!_O.test(z))continue;let U=$[K-1]==="/",j=U?K-1:K;Z+=`${$.slice(J,j)} x-cloak${U?" ":""}`,J=j}return Z+=$.slice(J),Z}var _O;var z6=y(()=>{k1();b0();_O=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function U6($,X,Z,J){let Y=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=Y.allowPatterns??[],Q=[],W=e0($.replace(/\{\{--[\s\S]*?--\}\}/g,(w)=>w.replace(/[^\n]/g," ")));for(let{pattern:w,message:q,suggestion:K}of OO){if(G.some((U)=>/\w/.test(U)&&q.includes(U)))continue;w.lastIndex=0;let z=W.match(w);if(z&&z.length>0){let U=W.split(`
12679
+ </style>`;J=J.replace(q,L),W.lastIndex=0}catch(_){}}}return J}var FW=y(()=>{x1()});function w6($,X){let Z=$,J=/@json\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index,Q=G+Y[0].length-1,W=1,w=Q+1,q=null,K=!1;while(w<Z.length&&W>0){let F=Z[w];if(K){K=!1,w++;continue}if(F==="\\"&&q){K=!0,w++;continue}if(q){if(F===q)q=null;w++;continue}if(F==='"'||F==="'"||F==="`"){q=F,w++;continue}if(F==="(")W++;else if(F===")"){if(W--,W===0)break}w++}if(W!==0)break;let z=Z.substring(Q+1,w).trim(),U=Z.substring(G,w+1),j=-1,B=0,H=null,_=!1;for(let F=0;F<z.length;F++){let V=z[F];if(_){_=!1;continue}if(V==="\\"&&H){_=!0;continue}if(H){if(V===H)H=null;continue}if(V==='"'||V==="'"||V==="`"){H=V;continue}if(V==="("||V==="["||V==="{")B++;else if(V===")"||V==="]"||V==="}")B--;if(V===","&&B===0){j=F;break}}let L=j>=0?z.substring(0,j).trim():z,O=j>=0?z.substring(j+1).trim():void 0;try{let F=L.trim(),V;if(U0(F))V=j0(F,Object.keys(X))(...Object.values(X));else V=void 0;let A;if(O==="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(w+1),J.lastIndex=G+R.length}catch(F){Q1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=G+U.length}}return Z}function q6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function VW($){let X=$,Z=/@memo\s*\(/g,J,Y=[];while((J=Z.exec(X))!==null){let G=J.index,Q=G+J[0].length,W=1,w=Q;while(w<X.length&&W>0){if(X[w]==="(")W++;else if(X[w]===")")W--;w++}if(W!==0)continue;let q=X.slice(Q,w-1).trim(),K=w,z=X.slice(K),U=z.indexOf("@endmemo");if(U===-1)continue;let j=z.slice(0,U),B=K+U+8,H=j.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),_=H?H[0].length:0,L=j.slice(_),O=j.match(/(\s*)$/),F=O?O[0].length:0,V=L.slice(0,L.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,k,I="",M]=A,E=`<${k}${I} data-stx-memo="${q}"${M}>`;R=j.slice(0,_)+E+V.slice(N.length)+j.slice(_+V.length)}else R=`${j.slice(0,_)}<div data-stx-memo="${q}">${V}</div>${j.slice(_+V.length)}`;Y.push({start:G,end:B,replacement:R}),Z.lastIndex=B}for(let G=Y.length-1;G>=0;G--){let Q=Y[G];X=X.slice(0,Q.start)+Q.replacement+X.slice(Q.end)}return X.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function K6($){let X=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return X=X.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),X}function AW($){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"),J="",Y=0,G;while((G=Z.exec($))!==null){let Q=G.index,W=Q+G[0].length,w=!1,q=!1,K=-1;while(W<$.length){let H=$[W];if(w){if(H==="'")w=!1}else if(q){if(H==='"')q=!1}else if(H==="'")w=!0;else if(H==='"')q=!0;else if(H===">"){K=W;break}W++}if(K===-1)continue;if($.slice(Q,K+1).includes("x-cloak"))continue;let U=$.slice(K+1),j=U.indexOf("</"),B=j>=0?U.slice(0,j):U.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))J+=$.slice(Y,K)+" x-cloak>",Y=K+1}return J+=$.slice(Y),J}function RW($){let X=/<[a-z][\w-]*/gi,Z="",J=0,Y;while((Y=X.exec($))!==null){let G=Y.index,Q=Y[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let B=`</${Q}>`,H=$.toLowerCase().indexOf(B,G);if(H!==-1)X.lastIndex=H+B.length;continue}let W=G+Y[0].length,w=!1,q=!1,K=-1;while(W<$.length){let B=$[W];if(w){if(B==="'")w=!1}else if(q){if(B==='"')q=!1}else if(B==="'")w=!0;else if(B==='"')q=!0;else if(B===">"){K=W;break}W++}if(K===-1)continue;let z=$.slice(G+Y[0].length,K);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!_O.test(z))continue;let U=$[K-1]==="/",j=U?K-1:K;Z+=`${$.slice(J,j)} x-cloak${U?" ":""}`,J=j}return Z+=$.slice(J),Z}var _O;var z6=y(()=>{k1();D0();_O=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function U6($,X,Z,J){let Y=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=Y.allowPatterns??[],Q=[],W=$1($.replace(/\{\{--[\s\S]*?--\}\}/g,(w)=>w.replace(/[^\n]/g," ")));for(let{pattern:w,message:q,suggestion:K}of OO){if(G.some((U)=>/\w/.test(U)&&q.includes(U)))continue;w.lastIndex=0;let z=W.match(w);if(z&&z.length>0){let U=W.split(`
12680
12680
  `),j=$.split(`
12681
12681
  `),B=[];U.forEach((O,F)=>{if(w.lastIndex=0,w.test(O))B.push(F+1)});let H=B.length>0?` (script line${B.length>1?"s":""} ${B.join(", ")})`:"",_=B.slice(0,3).map((O)=>` ${O} | ${(j[O-1]??"").trim().slice(0,100)}`).join(`
12682
12682
  `),L=_?`
@@ -12685,15 +12685,15 @@ ${_}`:"";Q.push(` \u2717 ${q}${H}
12685
12685
  ${Q.join(`
12686
12686
  `)}
12687
12687
  Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var OO;var j6=y(()=>{OO=[{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 LO from"fs";function A9($){return[...$].sort().map((X)=>{try{let Z=LO.statSync(X);return`${X}:${Z.size}:${Z.mtimeMs}`}catch{return`${X}:missing`}}).join(`
12688
- `)}function R9($,X,Z){let J=$.get(X);return J!==void 0&&J.signature===Z?J.value:void 0}function L1($,X,Z,J){return $.set(X,{signature:Z,value:J}),J}var B6=()=>{};var NW={};e(NW,{getStoreScript:()=>VO,clearStoreCache:()=>AO});import N9 from"path";function FO($,X){for(let Z of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])X.add(Z[1]);for(let Z of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let J of(Z[1]??"").split(",")){let G=((J.includes(":")?J.split(":").pop():J)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))X.add(G)}for(let Z of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let J of(Z[1]??"").split(",")){let Y=J.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Y))X.add(Y)}}async function VO($){let X;if($)X=N9.resolve($);else{let B=await Y1();X=N9.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),J=[];try{for await(let B of Z.scan({cwd:X,absolute:!0})){let H=N9.basename(B,".ts");if(["index","types"].includes(H))continue;if(B.includes(".d.ts"))continue;J.push(B)}}catch{return L1(Z7,X,"",""),null}let Y=A9(J),G=R9(Z7,X,Y);if(G!==void 0)return G||null;if(J.length===0)return L1(Z7,X,Y,""),null;let Q=[];for(let B of J){let H=await Bun.file(B).text();Q.push({file:B,hasUseStore:/useStore\s*\(/.test(H)})}Q.sort((B,H)=>{if(B.hasUseStore===H.hasUseStore)return 0;return B.hasUseStore?1:-1});let W=Q.map((B)=>B.file),w=[],q=new Set,K=H1({loader:"ts",target:"browser",define:d0()});for(let B of W)try{let H=await Bun.file(B).text(),_=N9.basename(B,".ts");FO(H,q),H=o0(H),H=S8(H),H=H.replace(/^export\s+(default\s+)?/gm,""),H=K.transformSync(H),w.push(`// Store: ${_}
12689
- ${H.trim()}`)}catch(H){console.warn(`[stx] Failed to load store ${B}:`,H)}if(w.length===0)return L1(Z7,X,Y,""),null;let z=w.join(`
12688
+ `)}function R9($,X,Z){let J=$.get(X);return J!==void 0&&J.signature===Z?J.value:void 0}function L1($,X,Z,J){return $.set(X,{signature:Z,value:J}),J}var B6=()=>{};var NW={};t(NW,{getStoreScript:()=>VO,clearStoreCache:()=>AO});import N9 from"path";function FO($,X){for(let Z of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])X.add(Z[1]);for(let Z of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let J of(Z[1]??"").split(",")){let G=((J.includes(":")?J.split(":").pop():J)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))X.add(G)}for(let Z of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let J of(Z[1]??"").split(",")){let Y=J.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Y))X.add(Y)}}async function VO($){let X;if($)X=N9.resolve($);else{let B=await Y1();X=N9.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),J=[];try{for await(let B of Z.scan({cwd:X,absolute:!0})){let H=N9.basename(B,".ts");if(["index","types"].includes(H))continue;if(B.includes(".d.ts"))continue;J.push(B)}}catch{return L1(X7,X,"",""),null}let Y=A9(J),G=R9(X7,X,Y);if(G!==void 0)return G||null;if(J.length===0)return L1(X7,X,Y,""),null;let Q=[];for(let B of J){let H=await Bun.file(B).text();Q.push({file:B,hasUseStore:/useStore\s*\(/.test(H)})}Q.sort((B,H)=>{if(B.hasUseStore===H.hasUseStore)return 0;return B.hasUseStore?1:-1});let W=Q.map((B)=>B.file),w=[],q=new Set,K=H1({loader:"ts",target:"browser",define:u0()});for(let B of W)try{let H=await Bun.file(B).text(),_=N9.basename(B,".ts");FO(H,q),H=r0(H),H=S8(H),H=H.replace(/^export\s+(default\s+)?/gm,""),H=K.transformSync(H),w.push(`// Store: ${_}
12689
+ ${H.trim()}`)}catch(H){console.warn(`[stx] Failed to load store ${B}:`,H)}if(w.length===0)return L1(X7,X,Y,""),null;let z=w.join(`
12690
12690
 
12691
12691
  `),j=`;(function(){
12692
12692
  var __stx = window.stx || {};
12693
12693
  ${N1.filter((B)=>!q.has(B)&&new RegExp(`\\b${B}\\b`).test(z)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
12694
12694
  `)}
12695
12695
  ${z}
12696
- })();`;return L1(Z7,X,Y,j),j}function AO(){Z7.clear()}var Z7;var MW=y(()=>{M1();P1();J1();B6();V0();Z7=new Map});var H6,lE;var TW=y(()=>{H6=["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"],lE=new Set(H6)});var EW={};e(EW,{selectComposableFiles:()=>kW,referencedFrameworkComposables:()=>IW,getFrameworkComposableScript:()=>TO,clearFrameworkComposableCache:()=>NO,__setRuntimeOwnedForTest:()=>kO});import M9 from"path";function NO(){U8.clear()}function kW($){let X=new Map;for(let Z of $){let J=M9.basename(Z);if(J.endsWith(".d.ts"))continue;let Y=J.replace(/\.[jt]s$/,"");if(Y==="index")continue;if(Y===J)continue;let G=X.get(Y);if(G&&!G.endsWith(".js"))continue;X.set(Y,Z)}return[...X.values()].sort()}function MO($,X){let Z=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test($)}function IW($){if(!$)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 J of RO){if(_6.has(J))continue;let Y=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${Y}\\s*\\(`).test(X))Z.push(J)}return Z.sort()}async function TO($,X){let Z=IW($);if(Z.length===0)return null;let J=X??M9.join(import.meta.dir,"composables"),Y=`${J}\x00${Z.join(",")}`,G=U8.get(Y);if(G!==void 0)return G||null;let Q=H1({loader:"ts",target:"browser",define:d0()}),W=new Set(Z),w=[],q=new Set,K=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let H of B.scan({cwd:J,absolute:!0}))K.push(H)}catch{return U8.set(Y,""),null}K=kW(K);for(let B of K){let H;try{H=await Bun.file(B).text()}catch{continue}let _=[];try{_=Q.scan(H).exports.filter((L)=>L!=="default")}catch{continue}if(!_.some((L)=>W.has(L)))continue;try{H=H.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),H=H.replace(/^import\s+type\s+.*$/gm,""),H=H.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),H=H.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),H=H.replace(/^export\s+default\s+/gm,""),H=H.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),w.push(`// ${M9.basename(B).replace(/\.[jt]s$/,"")}
12696
+ })();`;return L1(X7,X,Y,j),j}function AO(){X7.clear()}var X7;var MW=y(()=>{M1();x1();J1();B6();F0();X7=new Map});var H6,lE;var TW=y(()=>{H6=["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"],lE=new Set(H6)});var EW={};t(EW,{selectComposableFiles:()=>kW,referencedFrameworkComposables:()=>IW,getFrameworkComposableScript:()=>TO,clearFrameworkComposableCache:()=>NO,__setRuntimeOwnedForTest:()=>kO});import M9 from"path";function NO(){U8.clear()}function kW($){let X=new Map;for(let Z of $){let J=M9.basename(Z);if(J.endsWith(".d.ts"))continue;let Y=J.replace(/\.[jt]s$/,"");if(Y==="index")continue;if(Y===J)continue;let G=X.get(Y);if(G&&!G.endsWith(".js"))continue;X.set(Y,Z)}return[...X.values()].sort()}function MO($,X){let Z=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test($)}function IW($){if(!$)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 J of RO){if(_6.has(J))continue;let Y=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${Y}\\s*\\(`).test(X))Z.push(J)}return Z.sort()}async function TO($,X){let Z=IW($);if(Z.length===0)return null;let J=X??M9.join(import.meta.dir,"composables"),Y=`${J}\x00${Z.join(",")}`,G=U8.get(Y);if(G!==void 0)return G||null;let Q=H1({loader:"ts",target:"browser",define:u0()}),W=new Set(Z),w=[],q=new Set,K=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let H of B.scan({cwd:J,absolute:!0}))K.push(H)}catch{return U8.set(Y,""),null}K=kW(K);for(let B of K){let H;try{H=await Bun.file(B).text()}catch{continue}let _=[];try{_=Q.scan(H).exports.filter((L)=>L!=="default")}catch{continue}if(!_.some((L)=>W.has(L)))continue;try{H=H.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),H=H.replace(/^import\s+type\s+.*$/gm,""),H=H.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),H=H.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),H=H.replace(/^export\s+default\s+/gm,""),H=H.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),w.push(`// ${M9.basename(B).replace(/\.[jt]s$/,"")}
12697
12697
  ${Q.transformSync(H).trim()}`);for(let L of _)q.add(L)}catch(L){console.warn(`[stx] framework composable ${M9.basename(B)} could not be bundled:`,L)}}let z=Z.filter((B)=>!q.has(B)&&!MO($,B));if(z.length>0)console.warn(`[stx] could not bundle ${z.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(w.length===0)return U8.set(Y,""),null;let U=[...q].map((B)=>` try { if (!(${JSON.stringify(B)} in __s)) { __s[${JSON.stringify(B)}] = ${B}; if (!(${JSON.stringify(B)} in window)) window[${JSON.stringify(B)}] = ${B}; } } catch (e) {}`).join(`
12698
12698
  `),j=`<script data-stx-framework-composables>
12699
12699
  ;(function(){
@@ -12703,8 +12703,8 @@ ${w.join(`
12703
12703
  `)}
12704
12704
  ${U}
12705
12705
  })();
12706
- </script>`;return U8.set(Y,j),j}function kO($){_6.clear();for(let X of $)_6.add(X)}var U8,_6,RO;var DW=y(()=>{P1();TW();V0();U8=new Map,_6=new Set,RO=new Set(H6)});var bW={};e(bW,{listComposableModules:()=>DO,getComposableScript:()=>SO,clearComposableCache:()=>CO});import j8 from"path";function L6($){let X=j8.basename($,".ts");return X==="index"||X==="types"||$.endsWith(".d.ts")}async function yW($){if($)return j8.resolve($);let X=`<default>:${process.cwd()}`,Z=O6.get(X);if(Z!==void 0)return Z;let J=await EO();if(J!==null)O6.set(X,J);return J}async function EO(){let $=await Y1(),X=$.root||process.cwd(),Z=$.composablesDir;if(Z)return j8.resolve(X,Z);for(let J of IO){let Y=j8.resolve(X,J);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:Y,absolute:!0}))if(!L6(Q))return Y}catch{}}return null}async function DO($){let X=await yW($);if(!X)return[];let Z=[];try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:X,absolute:!0}))if(!L6(Q))Z.push(Q)}catch{return[]}Z.sort();let J=H1({loader:"ts",target:"browser",define:d0()}),Y=[];for(let G of Z)try{let Q=await Bun.file(G).text(),W=J.scan(Q).exports.filter((w)=>w!=="default");if(W.length>0)Y.push({file:G,names:W})}catch{}return Y}function yO($,X){return new RegExp(`\\b${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test($)}function bO($,X,Z){let J=new Map;for(let{file:W,names:w}of $)for(let q of w)if(!J.has(q))J.set(q,W);let Y=(W)=>{let w=[];for(let[q,K]of J)if(yO(W,q))w.push(K);return w},G=new Set,Q=Y(Z);while(Q.length>0){let W=[];for(let w of Q){if(G.has(w))continue;G.add(w);for(let q of Y(X.get(w)??""))if(!G.has(q))W.push(q)}Q=W}return G}async function SO($,X){let Z=await yW($);if(!Z)return null;let J=[];try{let V=new Bun.Glob("**/*.ts");for await(let A of V.scan({cwd:Z,absolute:!0})){if(L6(A))continue;J.push(A)}}catch{return L1(J7,Z,"",""),null}let Y=A9(J);if(J.length===0)return L1(J7,Z,Y,""),null;J.sort();let G=H1({loader:"ts",target:"browser",define:d0()}),Q=new Map,W=[];for(let V of J)try{let A=await Bun.file(V).text();Q.set(V,A);let R=G.scan(A).exports.filter((N)=>N!=="default");if(R.length>0)W.push({file:V,names:R})}catch{Q.set(V,"")}let w=X===void 0?new Set(J):bO(W,Q,X);if(w.size===0)return null;let q=J.filter((V)=>w.has(V)),K=`${Z}\x00${q.join("\x00")}`,z=R9(J7,K,Y);if(z!==void 0)return z||null;let U=[],j=new Set,B=new Set;for(let V of q)try{let A=Q.get(V)??await Bun.file(V).text(),R=j8.basename(V,".ts");for(let N of A.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(N[1])B.add(N[1]);try{for(let N of G.scan(A).exports)if(N!=="default")j.add(N)}catch{}A=o0(A),A=S8(A),A=A.replace(/^export\s+(default\s+)?/gm,""),A=G.transformSync(A),U.push(`// Composable: ${R}
12707
- ${A.trim()}`)}catch(A){console.warn(`[stx] Failed to load composable ${V}:`,A)}if(U.length===0||j.size===0)return L1(J7,K,Y,""),null;let H=[...j].map((V)=>` try { __c[${JSON.stringify(V)}] = ${V}; } catch (e) {}`).join(`
12706
+ </script>`;return U8.set(Y,j),j}function kO($){_6.clear();for(let X of $)_6.add(X)}var U8,_6,RO;var DW=y(()=>{x1();TW();F0();U8=new Map,_6=new Set,RO=new Set(H6)});var bW={};t(bW,{listComposableModules:()=>DO,getComposableScript:()=>SO,clearComposableCache:()=>CO});import j8 from"path";function L6($){let X=j8.basename($,".ts");return X==="index"||X==="types"||$.endsWith(".d.ts")}async function yW($){if($)return j8.resolve($);let X=`<default>:${process.cwd()}`,Z=O6.get(X);if(Z!==void 0)return Z;let J=await EO();if(J!==null)O6.set(X,J);return J}async function EO(){let $=await Y1(),X=$.root||process.cwd(),Z=$.composablesDir;if(Z)return j8.resolve(X,Z);for(let J of IO){let Y=j8.resolve(X,J);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:Y,absolute:!0}))if(!L6(Q))return Y}catch{}}return null}async function DO($){let X=await yW($);if(!X)return[];let Z=[];try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:X,absolute:!0}))if(!L6(Q))Z.push(Q)}catch{return[]}Z.sort();let J=H1({loader:"ts",target:"browser",define:u0()}),Y=[];for(let G of Z)try{let Q=await Bun.file(G).text(),W=J.scan(Q).exports.filter((w)=>w!=="default");if(W.length>0)Y.push({file:G,names:W})}catch{}return Y}function yO($,X){return new RegExp(`\\b${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test($)}function bO($,X,Z){let J=new Map;for(let{file:W,names:w}of $)for(let q of w)if(!J.has(q))J.set(q,W);let Y=(W)=>{let w=[];for(let[q,K]of J)if(yO(W,q))w.push(K);return w},G=new Set,Q=Y(Z);while(Q.length>0){let W=[];for(let w of Q){if(G.has(w))continue;G.add(w);for(let q of Y(X.get(w)??""))if(!G.has(q))W.push(q)}Q=W}return G}async function SO($,X){let Z=await yW($);if(!Z)return null;let J=[];try{let V=new Bun.Glob("**/*.ts");for await(let A of V.scan({cwd:Z,absolute:!0})){if(L6(A))continue;J.push(A)}}catch{return L1(Z7,Z,"",""),null}let Y=A9(J);if(J.length===0)return L1(Z7,Z,Y,""),null;J.sort();let G=H1({loader:"ts",target:"browser",define:u0()}),Q=new Map,W=[];for(let V of J)try{let A=await Bun.file(V).text();Q.set(V,A);let R=G.scan(A).exports.filter((N)=>N!=="default");if(R.length>0)W.push({file:V,names:R})}catch{Q.set(V,"")}let w=X===void 0?new Set(J):bO(W,Q,X);if(w.size===0)return null;let q=J.filter((V)=>w.has(V)),K=`${Z}\x00${q.join("\x00")}`,z=R9(Z7,K,Y);if(z!==void 0)return z||null;let U=[],j=new Set,B=new Set;for(let V of q)try{let A=Q.get(V)??await Bun.file(V).text(),R=j8.basename(V,".ts");for(let N of A.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(N[1])B.add(N[1]);try{for(let N of G.scan(A).exports)if(N!=="default")j.add(N)}catch{}A=r0(A),A=S8(A),A=A.replace(/^export\s+(default\s+)?/gm,""),A=G.transformSync(A),U.push(`// Composable: ${R}
12707
+ ${A.trim()}`)}catch(A){console.warn(`[stx] Failed to load composable ${V}:`,A)}if(U.length===0||j.size===0)return L1(Z7,K,Y,""),null;let H=[...j].map((V)=>` try { __c[${JSON.stringify(V)}] = ${V}; } catch (e) {}`).join(`
12708
12708
  `),_=JSON.stringify([...j]),L=U.join(`
12709
12709
 
12710
12710
  `),F=`;(function(){
@@ -12728,7 +12728,7 @@ ${H}
12728
12728
  }
12729
12729
  window[__n] = __c[__n];
12730
12730
  }
12731
- })();`;return L1(J7,K,Y,F),F}function CO(){J7.clear(),O6.clear()}var J7,O6,IO;var SW=y(()=>{M1();P1();B6();J1();V0();J7=new Map,O6=new Map,IO=["composables","functions"]});var PW={};e(PW,{processDeferDirectives:()=>gO});function PO(){return`stx-defer-${++CW}`}function vO($){let X=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(X)return{trigger:X[1],value:X[2]};return{trigger:"immediate"}}function xO($,X,Z){let{trigger:J,value:Y}=vO(X),G=Z,Q,W,w,q=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(q)Q=q[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 z=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)w=z[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:J,triggerValue:Y,content:G,placeholder:Q,loading:W,error:w}}function fO($,X){let{trigger:Z,triggerValue:J}=X,Y;switch(Z){case"visible":Y=`
12731
+ })();`;return L1(Z7,K,Y,F),F}function CO(){Z7.clear(),O6.clear()}var Z7,O6,IO;var SW=y(()=>{M1();x1();B6();J1();F0();Z7=new Map,O6=new Map,IO=["composables","functions"]});var PW={};t(PW,{processDeferDirectives:()=>gO});function PO(){return`stx-defer-${++CW}`}function vO($){let X=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(X)return{trigger:X[1],value:X[2]};return{trigger:"immediate"}}function xO($,X,Z){let{trigger:J,value:Y}=vO(X),G=Z,Q,W,w,q=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(q)Q=q[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 z=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)w=z[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:J,triggerValue:Y,content:G,placeholder:Q,loading:W,error:w}}function fO($,X){let{trigger:Z,triggerValue:J}=X,Y;switch(Z){case"visible":Y=`
12732
12732
  const observer = new IntersectionObserver((entries) => {
12733
12733
  if (entries[0].isIntersecting) {
12734
12734
  observer.disconnect();
@@ -12809,7 +12809,7 @@ else {
12809
12809
  ${z}
12810
12810
  </div>
12811
12811
  ${j}
12812
- `})}var CW=0;var xW={};e(xW,{processTeleportDirectives:()=>mO,ensureTeleportTargets:()=>cO});function hO(){return`stx-teleport-${++vW}`}function uO($){let X=$.split(",").map((Y)=>Y.trim()),Z=X[0].replace(/['"]/g,""),J;for(let Y=1;Y<X.length;Y++){let G=X[Y].match(/disabled:\s*(.+)/);if(G)J=G[1].trim()}return{target:Z,disabled:J}}function dO($,X){return`
12812
+ `})}var CW=0;var xW={};t(xW,{processTeleportDirectives:()=>mO,ensureTeleportTargets:()=>cO});function hO(){return`stx-teleport-${++vW}`}function uO($){let X=$.split(",").map((Y)=>Y.trim()),Z=X[0].replace(/['"]/g,""),J;for(let Y=1;Y<X.length;Y++){let G=X[Y].match(/disabled:\s*(.+)/);if(G)J=G[1].trim()}return{target:Z,disabled:J}}function dO($,X){return`
12813
12813
  <script>
12814
12814
  (function() {
12815
12815
  const source = document.getElementById('${$}');
@@ -12877,7 +12877,7 @@ else {
12877
12877
  });
12878
12878
  })();
12879
12879
  </script>
12880
- `}var vW=0;var uW={};e(uW,{processTransitionDirectives:()=>nO,processTransitionAttributes:()=>aO,performLeave:()=>iO,performEnter:()=>pO,generateTransitionRuntime:()=>sO,generateTransitionCSS:()=>oO});function fW($,X={}){return{enterFrom:X.enterClass||`${$}-enter-from`,enterActive:X.enterActiveClass||`${$}-enter-active`,enterTo:X.enterToClass||`${$}-enter-to`,leaveFrom:X.leaveClass||`${$}-leave-from`,leaveActive:X.leaveActiveClass||`${$}-leave-active`,leaveTo:X.leaveToClass||`${$}-leave-to`}}function lO($){let X=getComputedStyle($),Z=X.transitionDuration||"0s",J=X.animationDuration||"0s",Y=(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(Y(Z),Y(J))}function gW($,X){return new Promise((Z)=>{let J=X??lO($);if(J===0){Z();return}let Y=!1,G=()=>{if(Y)return;Y=!0,$.removeEventListener("transitionend",Q),$.removeEventListener("animationend",Q),Z()},Q=(W)=>{if(W.target===$)G()};$.addEventListener("transitionend",Q),$.addEventListener("animationend",Q),setTimeout(G,J+50)})}function hW($){$.offsetHeight}async function pO($,X={}){let Z=X.name||"stx",J=fW(Z,X),Y=typeof X.duration==="object"?X.duration.enter:X.duration;if(X.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),hW($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),X.onEnter)await new Promise((G)=>{X.onEnter($,G)});else await gW($,Y);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),X.onAfterEnter?.($)}async function iO($,X={}){let Z=X.name||"stx",J=fW(Z,X),Y=typeof X.duration==="object"?X.duration.leave:X.duration;if(X.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),hW($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),X.onLeave)await new Promise((G)=>{X.onLeave($,G)});else await gW($,Y);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),X.onAfterLeave?.($)}function nO($,X={},Z){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(Y,G,Q)=>{let W=rO(G),w=W.name||"stx",q=W.duration||300,K=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
12880
+ `}var vW=0;var uW={};t(uW,{processTransitionDirectives:()=>nO,processTransitionAttributes:()=>aO,performLeave:()=>iO,performEnter:()=>pO,generateTransitionRuntime:()=>sO,generateTransitionCSS:()=>oO});function fW($,X={}){return{enterFrom:X.enterClass||`${$}-enter-from`,enterActive:X.enterActiveClass||`${$}-enter-active`,enterTo:X.enterToClass||`${$}-enter-to`,leaveFrom:X.leaveClass||`${$}-leave-from`,leaveActive:X.leaveActiveClass||`${$}-leave-active`,leaveTo:X.leaveToClass||`${$}-leave-to`}}function lO($){let X=getComputedStyle($),Z=X.transitionDuration||"0s",J=X.animationDuration||"0s",Y=(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(Y(Z),Y(J))}function gW($,X){return new Promise((Z)=>{let J=X??lO($);if(J===0){Z();return}let Y=!1,G=()=>{if(Y)return;Y=!0,$.removeEventListener("transitionend",Q),$.removeEventListener("animationend",Q),Z()},Q=(W)=>{if(W.target===$)G()};$.addEventListener("transitionend",Q),$.addEventListener("animationend",Q),setTimeout(G,J+50)})}function hW($){$.offsetHeight}async function pO($,X={}){let Z=X.name||"stx",J=fW(Z,X),Y=typeof X.duration==="object"?X.duration.enter:X.duration;if(X.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),hW($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),X.onEnter)await new Promise((G)=>{X.onEnter($,G)});else await gW($,Y);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),X.onAfterEnter?.($)}async function iO($,X={}){let Z=X.name||"stx",J=fW(Z,X),Y=typeof X.duration==="object"?X.duration.leave:X.duration;if(X.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),hW($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),X.onLeave)await new Promise((G)=>{X.onLeave($,G)});else await gW($,Y);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),X.onAfterLeave?.($)}function nO($,X={},Z){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(Y,G,Q)=>{let W=rO(G),w=W.name||"stx",q=W.duration||300,K=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
12881
12881
  <div
12882
12882
  class="stx-transition-wrapper"
12883
12883
  data-transition="${w}"
@@ -13195,7 +13195,7 @@ else {
13195
13195
 
13196
13196
  console.log('[stx] Transition runtime initialized');
13197
13197
  })();
13198
- `}function aO($){let X=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(X,(Z,J,Y,G)=>{let Q=Y||"300",W=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${W}"`})}var mW={};e(mW,{withErrorBoundary:()=>dW,processErrorBoundaryDirectives:()=>$L,generateErrorBoundaryRuntime:()=>GL,generateErrorBoundaryCSS:()=>YL,createErrorBoundary:()=>JL});function eO(){return`eb-${++tO}-${Date.now().toString(36)}`}function $L($,X={},Z){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(Y,G,Q,W)=>{let w=eO(),q=XL(G||"");return ZL(w,Q.trim(),W.trim(),q)})}function XL($){let X={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3]||J[4];switch(Y){case"id":X.id=G;break;case"logErrors":X.logErrors=G==="true";break}}return X}function ZL($,X,Z,J){let Y=J.logErrors!==!1;return`
13198
+ `}function aO($){let X=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(X,(Z,J,Y,G)=>{let Q=Y||"300",W=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${J}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${W}"`})}var mW={};t(mW,{withErrorBoundary:()=>dW,processErrorBoundaryDirectives:()=>$L,generateErrorBoundaryRuntime:()=>GL,generateErrorBoundaryCSS:()=>YL,createErrorBoundary:()=>JL});function eO(){return`eb-${++tO}-${Date.now().toString(36)}`}function $L($,X={},Z){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(Y,G,Q,W)=>{let w=eO(),q=XL(G||"");return ZL(w,Q.trim(),W.trim(),q)})}function XL($){let X={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3]||J[4];switch(Y){case"id":X.id=G;break;case"logErrors":X.logErrors=G==="true";break}}return X}function ZL($,X,Z,J){let Y=J.logErrors!==!1;return`
13199
13199
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
13200
13200
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
13201
13201
  ${X}
@@ -13424,7 +13424,7 @@ else {
13424
13424
 
13425
13425
  console.log('[stx] Error boundary runtime initialized');
13426
13426
  })();
13427
- `}var tO=0;var cW={};e(cW,{renderSSRSuspense:()=>UL,processSuspenseDirectives:()=>wL,generateSuspenseRuntime:()=>BL,generateSuspenseCSS:()=>jL,createSSRSuspense:()=>zL});function WL(){return`suspense-${++QL}-${Date.now().toString(36)}`}function wL($,X={},Z){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(Y,G,Q,W)=>{let w=WL(),q=qL(G||"");return KL(w,Q.trim(),W.trim(),q)})}function qL($){let X={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3],Q=J[4];switch(Y){case"id":X.id=G;break;case"timeout":X.timeout=Q?parseInt(Q,10):void 0;break}}return X}function KL($,X,Z,J){let Y=J.timeout||30000,G=J.id||$;return`
13427
+ `}var tO=0;var cW={};t(cW,{renderSSRSuspense:()=>UL,processSuspenseDirectives:()=>wL,generateSuspenseRuntime:()=>BL,generateSuspenseCSS:()=>jL,createSSRSuspense:()=>zL});function WL(){return`suspense-${++QL}-${Date.now().toString(36)}`}function wL($,X={},Z){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(Y,G,Q,W)=>{let w=WL(),q=qL(G||"");return KL(w,Q.trim(),W.trim(),q)})}function qL($){let X={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3],Q=J[4];switch(Y){case"id":X.id=G;break;case"timeout":X.timeout=Q?parseInt(Q,10):void 0;break}}return X}function KL($,X,Z,J){let Y=J.timeout||30000,G=J.id||$;return`
13428
13428
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${G}" data-status="pending">
13429
13429
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
13430
13430
  ${Z}
@@ -13762,7 +13762,7 @@ else {
13762
13762
 
13763
13763
  console.log('[stx] Suspense runtime initialized');
13764
13764
  })();
13765
- `}var QL=0;var nW={};e(nW,{processAsyncDirectives:()=>_L,isAsyncComponent:()=>LL,generateAsyncComponentRuntime:()=>VL,generateAsyncComponentCSS:()=>FL,defineAsyncComponent:()=>OL});function lW(){return`async-${++HL}-${Date.now().toString(36)}`}function _L($,X={},Z){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,G=$;return G=G.replace(J,(Q,W,w,q)=>{let K=lW(),z=pW(W);return iW(K,z,w.trim(),q.trim())}),G=G.replace(Y,(Q,W,w)=>{let q=lW(),K=pW(W);return iW(q,K,w.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function pW($){let X={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3],Q=J[4],W=J[5];switch(Y){case"component":X.component=G||W||"";break;case"timeout":X.timeout=Q?parseInt(Q,10):30000;break;case"delay":X.delay=Q?parseInt(Q,10):200;break;case"suspensible":X.suspensible=W==="true";break;case"retries":X.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":X.loadingComponent=G||W;break;case"errorComponent":X.errorComponent=G||W;break}}return X}function iW($,X,Z,J){let{component:Y,timeout:G,delay:Q,suspensible:W,retries:w}=X;return`
13765
+ `}var QL=0;var nW={};t(nW,{processAsyncDirectives:()=>_L,isAsyncComponent:()=>LL,generateAsyncComponentRuntime:()=>VL,generateAsyncComponentCSS:()=>FL,defineAsyncComponent:()=>OL});function lW(){return`async-${++HL}-${Date.now().toString(36)}`}function _L($,X={},Z){let J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,G=$;return G=G.replace(J,(Q,W,w,q)=>{let K=lW(),z=pW(W);return iW(K,z,w.trim(),q.trim())}),G=G.replace(Y,(Q,W,w)=>{let q=lW(),K=pW(W);return iW(q,K,w.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function pW($){let X={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3],Q=J[4],W=J[5];switch(Y){case"component":X.component=G||W||"";break;case"timeout":X.timeout=Q?parseInt(Q,10):30000;break;case"delay":X.delay=Q?parseInt(Q,10):200;break;case"suspensible":X.suspensible=W==="true";break;case"retries":X.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":X.loadingComponent=G||W;break;case"errorComponent":X.errorComponent=G||W;break}}return X}function iW($,X,Z,J){let{component:Y,timeout:G,delay:Q,suspensible:W,retries:w}=X;return`
13766
13766
  <div class="stx-async-component" data-async-id="${$}" data-component="${Y}" data-status="pending">
13767
13767
  <div class="stx-async-loading" data-async-loading="${$}">
13768
13768
  ${Z}
@@ -14117,7 +14117,7 @@ catch (error) {
14117
14117
 
14118
14118
  console.log('[stx] Async component runtime initialized');
14119
14119
  })();
14120
- `}var HL=0;var oW={};e(oW,{shouldCacheComponent:()=>kL,processKeepAliveDirectives:()=>RL,onDeactivated:()=>yL,onActivated:()=>DL,generateKeepAliveRuntime:()=>EL,generateKeepAliveCSS:()=>IL,createKeepAliveCache:()=>TL});function rW(){return`keep-alive-${++AL}-${Date.now().toString(36)}`}function RL($,X={},Z){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(Y,G,Q)=>{let W=rW(),w=NL(G||"");return ML(W,Q.trim(),w)})}function NL($){let X={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3],Q=J[4];switch(Y){case"max":X.max=Q?parseInt(Q,10):10;break;case"include":X.include=G;break;case"exclude":X.exclude=G;break;case"id":X.id=G;break}}return X}function ML($,X,Z){let{max:J,include:Y,exclude:G}=Z,Q=Z.id||$;return`
14120
+ `}var HL=0;var oW={};t(oW,{shouldCacheComponent:()=>kL,processKeepAliveDirectives:()=>RL,onDeactivated:()=>yL,onActivated:()=>DL,generateKeepAliveRuntime:()=>EL,generateKeepAliveCSS:()=>IL,createKeepAliveCache:()=>TL});function rW(){return`keep-alive-${++AL}-${Date.now().toString(36)}`}function RL($,X={},Z){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(Y,G,Q)=>{let W=rW(),w=NL(G||"");return ML(W,Q.trim(),w)})}function NL($){let X={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3],Q=J[4];switch(Y){case"max":X.max=Q?parseInt(Q,10):10;break;case"include":X.include=G;break;case"exclude":X.exclude=G;break;case"id":X.id=G;break}}return X}function ML($,X,Z){let{max:J,include:Y,exclude:G}=Z,Q=Z.id||$;return`
14121
14121
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${Q}">
14122
14122
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
14123
14123
  ${X}
@@ -14465,7 +14465,7 @@ else {
14465
14465
 
14466
14466
  console.log('[stx] Keep-alive runtime initialized');
14467
14467
  })();
14468
- `}function DL($){if(typeof document<"u")document.addEventListener("stx:activated",(X)=>{$(X.detail)})}function yL($){if(typeof document<"u")document.addEventListener("stx:deactivated",(X)=>{$(X.detail)})}var AL=0;var $w={};e($w,{useVirtualList:()=>aW,processVirtualListDirectives:()=>V6,processVirtualGridDirectives:()=>eW,processInfiniteListDirectives:()=>tW,generateVirtualListCSS:()=>sW,default:()=>bL,createVirtualList:()=>F6});function F6($,X){let{itemHeight:Z,containerHeight:J,overscan:Y=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:W=Z,direction:w="vertical"}=X,q=[...$],K=0,z=new Map;function U(){if(Q)return j();let R=Math.max(0,Math.floor(K/Z)-Y),N=Math.ceil(J/Z),k=Math.min(q.length-1,R+N+Y*2);return{startIndex:R,endIndex:k}}function j(){let R=0,N=0,k=q.length-1;for(let I=0;I<q.length;I++){let M=z.get(I)||W;if(R+M>K){N=Math.max(0,I-Y);break}R+=M}R=0;for(let I=0;I<q.length;I++){let M=z.get(I)||W;if(R+=M,R>K+J){k=Math.min(q.length-1,I+Y);break}}return{startIndex:N,endIndex:k}}function B(){if(Q){let R=0;for(let N=0;N<q.length;N++)R+=z.get(N)||W;return R}return q.length*Z}function H(R){if(Q){let N=0;for(let k=0;k<R;k++)N+=z.get(k)||W;return N}return R*Z}function _(){let{startIndex:R,endIndex:N}=U();return{startIndex:R,endIndex:N,scrollTop:K,totalHeight:B(),visibleItems:q.slice(R,N+1),itemHeights:new Map(z)}}function L(R,N="auto"){let k=H(R);O(k,N)}function O(R,N="auto"){K=Math.max(0,Math.min(R,B()-J))}function F(){U()}function V(R){q=[...R],z.clear(),F()}function A(){q=[],z.clear()}return{scrollToIndex:L,scrollToOffset:O,getState:_,refresh:F,setItems:V,destroy:A}}function V6($,X={},Z){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(Y,G,Q,W)=>{let w=G.trim(),q=X[w];if(!q||!Array.isArray(q))return`<!-- virtualList: items "${w}" not found or not an array -->`;let K={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let O=Q.trim(),F=Function(`return ${O}`)();K={...K,...F}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(K.containerHeight/K.itemHeight),j=K.overscan||3,B=0,H=Math.min(q.length-1,U+j),_="";for(let O=B;O<=H&&O<q.length;O++){let F=q[O],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(O));_+=`
14468
+ `}function DL($){if(typeof document<"u")document.addEventListener("stx:activated",(X)=>{$(X.detail)})}function yL($){if(typeof document<"u")document.addEventListener("stx:deactivated",(X)=>{$(X.detail)})}var AL=0;var $w={};t($w,{useVirtualList:()=>aW,processVirtualListDirectives:()=>V6,processVirtualGridDirectives:()=>eW,processInfiniteListDirectives:()=>tW,generateVirtualListCSS:()=>sW,default:()=>bL,createVirtualList:()=>F6});function F6($,X){let{itemHeight:Z,containerHeight:J,overscan:Y=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:W=Z,direction:w="vertical"}=X,q=[...$],K=0,z=new Map;function U(){if(Q)return j();let R=Math.max(0,Math.floor(K/Z)-Y),N=Math.ceil(J/Z),k=Math.min(q.length-1,R+N+Y*2);return{startIndex:R,endIndex:k}}function j(){let R=0,N=0,k=q.length-1;for(let I=0;I<q.length;I++){let M=z.get(I)||W;if(R+M>K){N=Math.max(0,I-Y);break}R+=M}R=0;for(let I=0;I<q.length;I++){let M=z.get(I)||W;if(R+=M,R>K+J){k=Math.min(q.length-1,I+Y);break}}return{startIndex:N,endIndex:k}}function B(){if(Q){let R=0;for(let N=0;N<q.length;N++)R+=z.get(N)||W;return R}return q.length*Z}function H(R){if(Q){let N=0;for(let k=0;k<R;k++)N+=z.get(k)||W;return N}return R*Z}function _(){let{startIndex:R,endIndex:N}=U();return{startIndex:R,endIndex:N,scrollTop:K,totalHeight:B(),visibleItems:q.slice(R,N+1),itemHeights:new Map(z)}}function L(R,N="auto"){let k=H(R);O(k,N)}function O(R,N="auto"){K=Math.max(0,Math.min(R,B()-J))}function F(){U()}function V(R){q=[...R],z.clear(),F()}function A(){q=[],z.clear()}return{scrollToIndex:L,scrollToOffset:O,getState:_,refresh:F,setItems:V,destroy:A}}function V6($,X={},Z){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(Y,G,Q,W)=>{let w=G.trim(),q=X[w];if(!q||!Array.isArray(q))return`<!-- virtualList: items "${w}" not found or not an array -->`;let K={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let O=Q.trim(),F=Function(`return ${O}`)();K={...K,...F}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(K.containerHeight/K.itemHeight),j=K.overscan||3,B=0,H=Math.min(q.length-1,U+j),_="";for(let O=B;O<=H&&O<q.length;O++){let F=q[O],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(O));_+=`
14469
14469
  <div class="virtual-item ${K.itemClass||""}"
14470
14470
  style="position: absolute; top: ${O*K.itemHeight}px; height: ${K.itemHeight}px; width: 100%;"
14471
14471
  data-index="${O}">
@@ -14838,7 +14838,7 @@ else {
14838
14838
  stxIslands.initIslands();
14839
14839
  }
14840
14840
  })();
14841
- </script>`}function Jw($){let X=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(X)return X[1];let Z=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function Yw($,X){let Z={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Y;while((Y=J.exec($))!==null){let G=Y[1],Q=Y[2];if(Q in X)Z[G]=X[Q];else Z[G]=Q}return Z}var Hw={};e(Hw,{processStaticDirectives:()=>jw,processPartialHydrationDirectives:()=>Qw,onHydrated:()=>Uw,isHydrated:()=>zw,hydrateIsland:()=>ww,hydrateByStrategy:()=>qw,hydrateAll:()=>Kw,generatePartialHydrationCSS:()=>Ww,generateIslandManifest:()=>Bw,default:()=>hL,createIslandRegistry:()=>Gw});function Gw(){let $=new Map;return{islands:$,register(X){$.set(X.id,X)},get(X){return $.get(X)},async hydrate(X){let Z=$.get(X);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:X,component:Z.component}}))},async hydrateAll(){let X=Array.from($.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all(X)}}}function SL($){return`
14841
+ </script>`}function Jw($){let X=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(X)return X[1];let Z=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function Yw($,X){let Z={},J=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Y;while((Y=J.exec($))!==null){let G=Y[1],Q=Y[2];if(Q in X)Z[G]=X[Q];else Z[G]=Q}return Z}var Hw={};t(Hw,{processStaticDirectives:()=>jw,processPartialHydrationDirectives:()=>Qw,onHydrated:()=>Uw,isHydrated:()=>zw,hydrateIsland:()=>ww,hydrateByStrategy:()=>qw,hydrateAll:()=>Kw,generatePartialHydrationCSS:()=>Ww,generateIslandManifest:()=>Bw,default:()=>hL,createIslandRegistry:()=>Gw});function Gw(){let $=new Map;return{islands:$,register(X){$.set(X.id,X)},get(X){return $.get(X)},async hydrate(X){let Z=$.get(X);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:X,component:Z.component}}))},async hydrateAll(){let X=Array.from($.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all(X)}}}function SL($){return`
14842
14842
  <script data-hydrate="${$}">
14843
14843
  (function() {
14844
14844
  const island = document.querySelector('[data-island="${$}"]');
@@ -14990,8 +14990,8 @@ else {
14990
14990
  });
14991
14991
  })();
14992
14992
  </script>
14993
- `}function Qw($,X={},Z){let J=$,Y=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=Y7(J,"load",X),J=Y7(J,"idle",X),J=Y7(J,"visible",X),J=Y7(J,"media",X),J=gL(J),J=Y7(J,"hover",X),J=Y7(J,"event",X),Y=G&&J!==$,Y)J+=`
14994
- `+Zw();return J}function Y7($,X,Z){let J=new RegExp(`@client:${X}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(Y,G,Q)=>{let W={strategy:X};if(G)try{let H=G.split(",").map((_)=>_.trim());for(let _ of H){let[L,O]=_.split(":").map((F)=>F.trim());if(L&&O){let F=O.replace(/^['"]|['"]$/g,"");W[L]=F}}}catch{}let w=`island-${Math.random().toString(36).substring(2,9)}`,q=Jw(Q.trim()),K=Yw(Q.trim(),Z),z=[];if(W.rootMargin)z.push(`data-root-margin="${W.rootMargin}"`);if(W.threshold!==void 0)z.push(`data-threshold="${W.threshold}"`);if(W.media)z.push(`data-media="${W.media}"`);if(W.event)z.push(`data-event="${W.event}"`);if(q)z.push(`data-component="${q}"`);let j=Object.keys(K).length>0?`
14993
+ `}function Qw($,X={},Z){let J=$,Y=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=J7(J,"load",X),J=J7(J,"idle",X),J=J7(J,"visible",X),J=J7(J,"media",X),J=gL(J),J=J7(J,"hover",X),J=J7(J,"event",X),Y=G&&J!==$,Y)J+=`
14994
+ `+Zw();return J}function J7($,X,Z){let J=new RegExp(`@client:${X}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(J,(Y,G,Q)=>{let W={strategy:X};if(G)try{let H=G.split(",").map((_)=>_.trim());for(let _ of H){let[L,O]=_.split(":").map((F)=>F.trim());if(L&&O){let F=O.replace(/^['"]|['"]$/g,"");W[L]=F}}}catch{}let w=`island-${Math.random().toString(36).substring(2,9)}`,q=Jw(Q.trim()),K=Yw(Q.trim(),Z),z=[];if(W.rootMargin)z.push(`data-root-margin="${W.rootMargin}"`);if(W.threshold!==void 0)z.push(`data-threshold="${W.threshold}"`);if(W.media)z.push(`data-media="${W.media}"`);if(W.event)z.push(`data-event="${W.event}"`);if(q)z.push(`data-component="${q}"`);let j=Object.keys(K).length>0?`
14995
14995
  <script type="application/json" data-island-props="${w}">${JSON.stringify(K)}</script>`:"",B="";switch(X){case"load":B=SL(w);break;case"idle":B=CL(w,W);break;case"visible":B=PL(w,W);break;case"media":B=vL(w,W);break;case"hover":B=xL(w);break;case"event":B=fL(w,W);break}return`
14996
14996
  <div data-island="${w}"
14997
14997
  data-strategy="${X}"
@@ -15066,7 +15066,7 @@ else {
15066
15066
  <script type="application/json" id="stx-island-manifest">
15067
15067
  ${JSON.stringify(X)}
15068
15068
  </script>
15069
- `}var hL;var _w=y(()=>{hL={processPartialHydrationDirectives:Qw,processStaticDirectives:jw,generatePartialHydrationCSS:Ww,generateIslandManifest:Bw,createIslandRegistry:Gw,hydrateIsland:ww,hydrateByStrategy:qw,hydrateAll:Kw,isHydrated:zw,onHydrated:Uw}});var Iw={};e(Iw,{watchMultiple:()=>Aw,watchEffect:()=>Rw,watch:()=>Vw,unref:()=>Ow,toRefs:()=>Lw,throttledComputed:()=>kw,stxWatchMultiple:()=>Aw,stxWatchEffect:()=>Rw,stxWatch:()=>Vw,stxUnref:()=>Ow,stxToRefs:()=>Lw,stxThrottledComputed:()=>kw,stxShallowRef:()=>Fw,stxRef:()=>G7,stxIsRef:()=>o1,stxDebouncedComputed:()=>Tw,stxComputed:()=>H8,shallowRef:()=>Fw,ref:()=>G7,processWatchDirectives:()=>Mw,processComputedDirectives:()=>Nw,isRef:()=>o1,default:()=>uL,debouncedComputed:()=>Tw,computed:()=>H8});function G7($){let X=$,Z=new Set,J={get value(){if(F1){let Y=B8.get(J);if(!Y)Y=new Set,B8.set(J,Y);Y.add(F1)}return X},set value(Y){if(!Object.is(X,Y)){X=Y,Z.forEach((Q)=>Q(Y));let G=B8.get(J);if(G)G.forEach((Q)=>Q())}},subscribe(Y){return Z.add(Y),()=>Z.delete(Y)},peek(){return X}};return J}function o1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function Ow($){return o1($)?$.value:$}function Lw($){let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=G7($[Z]);return X}function Fw($){return G7($)}function H8($){let X=typeof $==="function",Z=X?$:$.get,J=X?void 0:$.set,Y=X?Object.is:$.equals||Object.is,G,Q=!0,W=new Set,w=new Set,q=()=>{if(Q=!0,w.size>0){let U=z.value;w.forEach((j)=>j(U))}};function K(){W.clear();let U=F1;F1=q,T9.push(q);try{return Z()}finally{T9.pop(),F1=U}}let z={get value(){if(F1){let U=B8.get(z);if(!U)U=new Set,B8.set(z,U);U.add(F1)}if(Q){let U=K();if(!Y(G,U))G=U;Q=!1}return G},set value(U){if(J)J(U);else console.warn("Computed property is readonly")},subscribe(U){return w.add(U),()=>w.delete(U)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return W}};return z}function Vw($,X,Z={}){let{immediate:J=!1,deep:Y=!1,flush:G="pre",once:Q=!1}=Z,W,w=!0,q=!1,K=()=>{if(o1($))return Y?L5($.value):$.value;return $()},z=()=>{if(!w||q)return;let B=K();if(W!==void 0&&Object.is(W,B)&&!Y)return;let H=()=>{if(X(B,W),W=Y?L5(B):B,Q)j()};if(G==="sync")H();else if(G==="post")queueMicrotask(H);else Promise.resolve().then(H)},U=null;if(o1($))U=$.subscribe(()=>z());else U=H8($).subscribe(()=>z());if(J)W=void 0,z();else W=K();let j=()=>{if(w=!1,U)U(),U=null};return j.pause=()=>{q=!0},j.resume=()=>{q=!1},j}function Aw($,X,Z={}){let{immediate:J=!1,once:Y=!1}=Z,G=$.map((z)=>o1(z)?z.value:void 0),Q=!0,W=!1,w=()=>{if(!Q||W)return;let z=$.map((U)=>o1(U)?U.value:void 0);if(X(z,G),G=[...z],Y)K()},q=$.map((z)=>{if(o1(z))return z.subscribe(()=>w());return()=>{}});if(J)w();let K=()=>{Q=!1,q.forEach((z)=>z())};return K.pause=()=>{W=!0},K.resume=()=>{W=!1},K}function Rw($,X={}){let{flush:Z="pre"}=X,J,Y=!0,G=!1,Q=()=>{if(!Y||G)return;if(J)J();let w=F1;F1=Q,T9.push(Q);try{J=$()}finally{T9.pop(),F1=w}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let W=()=>{if(Y=!1,J)J()};return W.pause=()=>{G=!0},W.resume=()=>{G=!1},W}function Nw($,X={},Z){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(Y,G,Q)=>{try{let w=Function(...Object.keys(X),`return ${Q}`)(...Object.values(X));return X[G]=w,`<!-- computed: ${G} = ${w} -->`}catch(W){return`<!-- computed error: ${G} - ${W} -->`}})}function Mw($,X={},Z){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(Y,G,Q)=>{return`
15069
+ `}var hL;var _w=y(()=>{hL={processPartialHydrationDirectives:Qw,processStaticDirectives:jw,generatePartialHydrationCSS:Ww,generateIslandManifest:Bw,createIslandRegistry:Gw,hydrateIsland:ww,hydrateByStrategy:qw,hydrateAll:Kw,isHydrated:zw,onHydrated:Uw}});var Iw={};t(Iw,{watchMultiple:()=>Aw,watchEffect:()=>Rw,watch:()=>Vw,unref:()=>Ow,toRefs:()=>Lw,throttledComputed:()=>kw,stxWatchMultiple:()=>Aw,stxWatchEffect:()=>Rw,stxWatch:()=>Vw,stxUnref:()=>Ow,stxToRefs:()=>Lw,stxThrottledComputed:()=>kw,stxShallowRef:()=>Fw,stxRef:()=>Y7,stxIsRef:()=>s1,stxDebouncedComputed:()=>Tw,stxComputed:()=>H8,shallowRef:()=>Fw,ref:()=>Y7,processWatchDirectives:()=>Mw,processComputedDirectives:()=>Nw,isRef:()=>s1,default:()=>uL,debouncedComputed:()=>Tw,computed:()=>H8});function Y7($){let X=$,Z=new Set,J={get value(){if(F1){let Y=B8.get(J);if(!Y)Y=new Set,B8.set(J,Y);Y.add(F1)}return X},set value(Y){if(!Object.is(X,Y)){X=Y,Z.forEach((Q)=>Q(Y));let G=B8.get(J);if(G)G.forEach((Q)=>Q())}},subscribe(Y){return Z.add(Y),()=>Z.delete(Y)},peek(){return X}};return J}function s1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function Ow($){return s1($)?$.value:$}function Lw($){let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=Y7($[Z]);return X}function Fw($){return Y7($)}function H8($){let X=typeof $==="function",Z=X?$:$.get,J=X?void 0:$.set,Y=X?Object.is:$.equals||Object.is,G,Q=!0,W=new Set,w=new Set,q=()=>{if(Q=!0,w.size>0){let U=z.value;w.forEach((j)=>j(U))}};function K(){W.clear();let U=F1;F1=q,T9.push(q);try{return Z()}finally{T9.pop(),F1=U}}let z={get value(){if(F1){let U=B8.get(z);if(!U)U=new Set,B8.set(z,U);U.add(F1)}if(Q){let U=K();if(!Y(G,U))G=U;Q=!1}return G},set value(U){if(J)J(U);else console.warn("Computed property is readonly")},subscribe(U){return w.add(U),()=>w.delete(U)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return W}};return z}function Vw($,X,Z={}){let{immediate:J=!1,deep:Y=!1,flush:G="pre",once:Q=!1}=Z,W,w=!0,q=!1,K=()=>{if(s1($))return Y?O5($.value):$.value;return $()},z=()=>{if(!w||q)return;let B=K();if(W!==void 0&&Object.is(W,B)&&!Y)return;let H=()=>{if(X(B,W),W=Y?O5(B):B,Q)j()};if(G==="sync")H();else if(G==="post")queueMicrotask(H);else Promise.resolve().then(H)},U=null;if(s1($))U=$.subscribe(()=>z());else U=H8($).subscribe(()=>z());if(J)W=void 0,z();else W=K();let j=()=>{if(w=!1,U)U(),U=null};return j.pause=()=>{q=!0},j.resume=()=>{q=!1},j}function Aw($,X,Z={}){let{immediate:J=!1,once:Y=!1}=Z,G=$.map((z)=>s1(z)?z.value:void 0),Q=!0,W=!1,w=()=>{if(!Q||W)return;let z=$.map((U)=>s1(U)?U.value:void 0);if(X(z,G),G=[...z],Y)K()},q=$.map((z)=>{if(s1(z))return z.subscribe(()=>w());return()=>{}});if(J)w();let K=()=>{Q=!1,q.forEach((z)=>z())};return K.pause=()=>{W=!0},K.resume=()=>{W=!1},K}function Rw($,X={}){let{flush:Z="pre"}=X,J,Y=!0,G=!1,Q=()=>{if(!Y||G)return;if(J)J();let w=F1;F1=Q,T9.push(Q);try{J=$()}finally{T9.pop(),F1=w}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let W=()=>{if(Y=!1,J)J()};return W.pause=()=>{G=!0},W.resume=()=>{G=!1},W}function Nw($,X={},Z){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(Y,G,Q)=>{try{let w=Function(...Object.keys(X),`return ${Q}`)(...Object.values(X));return X[G]=w,`<!-- computed: ${G} = ${w} -->`}catch(W){return`<!-- computed error: ${G} - ${W} -->`}})}function Mw($,X={},Z){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(Y,G,Q)=>{return`
15070
15070
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
15071
15071
  (function() {
15072
15072
  // Watch implementation for ${G}
@@ -15078,9 +15078,9 @@ else {
15078
15078
  }
15079
15079
  })();
15080
15080
  </script>
15081
- `})}function L5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>L5(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((J,Y)=>Z.set(L5(Y),L5(J))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((J)=>Z.add(L5(J))),Z}let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=L5($[Z]);return X}function Tw($,X=100){let Z=G7($()),J=null,Y=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Z.value=$()},X)};return H8($).subscribe(()=>Y()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Y()},get dirty(){return!1},get deps(){return new Set}}}function kw($,X=100){let Z=G7($()),J=0,Y=()=>{let Q=Date.now();if(Q-J>=X)J=Q,Z.value=$()};return H8($).subscribe(()=>Y()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Y()},get dirty(){return!1},get deps(){return new Set}}}var F1=null,T9,B8,uL;var Ew=y(()=>{T9=[],B8=new WeakMap;uL={ref:G7,computed:H8,watch:Vw,watchMultiple:Aw,watchEffect:Rw,isRef:o1,unref:Ow,toRefs:Lw,shallowRef:Fw,debouncedComputed:Tw,throttledComputed:kw,processComputedDirectives:Nw,processWatchDirectives:Mw}});function _8($,X){let Z={};for(let J of $)Z[J]=m1(X(J));return new Proxy({},{get:(J,Y)=>Z[Y]?.(),set:(J,Y,G)=>{if(Z[Y])Z[Y].set(G);else Z[Y]=m1(G);return!0},has:(J,Y)=>(Y in Z),deleteProperty:(J,Y)=>{return delete Z[Y],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(J,Y)=>(Y in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[Y]()}:void 0})}function dL($,X){let Z={};for(let J of X)Z[J]=$[J];return Z}function A6($,X){let Z=Object.keys($),J=_8(Z,(O)=>X?.[O]??$[O].getDefaultValue()),Y=_8(Z,()=>[]),G=_8(Z,()=>!1),Q=_8(Z,()=>!1),W=_8(Z,()=>!1),w=m1(!1);async function q(O){W[O]=!0;let F=await $[O].validate(J[O],J);return Y[O]=F,W[O]=!1,F.length===0}async function K(){w.set(!0);let O=await Promise.all(Z.map(q));return w.set(!1),O.every(Boolean)}function z(){for(let O of Z)J[O]=X?.[O]??$[O].getDefaultValue(),Y[O]=[],G[O]=!1,Q[O]=!1}function U(O){for(let F of Z)if(F in O)J[F]=O[F],Q[F]=!0}function j(O,F){J[O]=F,Q[O]=!0}function B(O,F=!0){if(G[O]=F,F)q(O)}function H(O){return{value:J[O],errors:Y[O],touched:G[O],dirty:Q[O],valid:Y[O].length===0,validating:W[O]}}function _(O){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await K())await O(dL(J,Z))}}return{values:J,errors:Y,touched:G,dirty:Q,get isValid(){return Z.every((O)=>Y[O].length===0)},get isValidating(){return w()||Z.some((O)=>W[O])},get isDirty(){return Z.some((O)=>Q[O])},validate:K,validateField:q,reset:z,setValues:U,setFieldValue:j,setFieldTouched:B,getFieldState:H,handleSubmit:_}}var Dw;var yw=y(()=>{G$();Dw=A6});var Pw={};e(Pw,{v:()=>mL,useForm:()=>A6,processHasErrorsDirective:()=>Cw,processFormValidationDirectives:()=>cL,processErrorsDirective:()=>Sw,processErrorDirective:()=>bw,defineForm:()=>Dw,Validator:()=>Q7});class Q7{rules=[];defaultValue="";addRule($){let X=new Q7;return X.rules=[...this.rules,$],X.defaultValue=this.defaultValue,X}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(X)=>{if(X===null||X===void 0)return $;if(typeof X==="string"&&X.trim()==="")return $;if(Array.isArray(X)&&X.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(X)=>{if(!X)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(X))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(X)=>{if(!X)return!0;try{return new URL(String(X)),!0}catch{return $}}})}min($,X){let Z=X||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Z,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Z}})}max($,X){let Z=X||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Z,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Z}})}length($,X,Z){let J=Z||`Must be between ${$} and ${X} characters`;return this.addRule({name:"length",message:J,validate:(Y)=>{if(!Y)return!0;let G=String(Y).length;return G>=$&&G<=X||J}})}pattern($,X="Invalid format"){return this.addRule({name:"pattern",message:X,validate:(Z)=>{if(!Z)return!0;return $.test(String(Z))||X}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(X)=>{if(!X)return!0;return!String(X).includes(" ")||$}})}number($="Must be a number"){let X=this.addRule({name:"number",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||$}});return X.defaultValue=0,X}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number.isInteger(Number(X))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<0||$}})}minValue($,X){let Z=X||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Z,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Z}})}maxValue($,X){let Z=X||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Z,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Z}})}between($,X,Z){let J=Z||`Must be between ${$} and ${X}`;return this.addRule({name:"between",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;let G=Number(Y);return G>=$&&G<=X||J}})}matches($,X){let Z=X||`Must match ${$}`;return this.addRule({name:"matches",message:Z,validate:(J,Y)=>{if(!Y)return!0;return J===Y[$]||Z}})}oneOf($,X){let Z=X||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(J)=>{if(!J)return!0;return $.includes(J)||Z}})}notOneOf($,X){let Z=X||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Z}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(X)=>{if(!X)return!0;let Z=new Date(String(X));return!Number.isNaN(Z.getTime())||$}})}before($,X){let Z=new Date($),J=X||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(Y)=>{if(!Y)return!0;return new Date(String(Y))<Z||J}})}after($,X){let Z=new Date($),J=X||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(Y)=>{if(!Y)return!0;return new Date(String(Y))>Z||J}})}custom($,X="Invalid value"){return this.addRule({name:"custom",message:X,validate:$})}async($,X="Invalid value"){return this.addRule({name:"async",message:X,async:!0,validate:$})}when($,X){let Z=new Q7;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let J of X.getRules())Z.rules.push({...J,validate:(Y,G)=>{if(!$(Y,G||{}))return!0;return J.validate(Y,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let X=new Q7;return X.rules=[...this.rules],X.defaultValue=$,X}async validate($,X){let Z=[];for(let J of this.rules){let Y=await J.validate($,X);if(Y!==!0)Z.push(Y)}return Z}validateSync($,X){let Z=[];for(let J of this.rules){if(J.async)continue;let Y=J.validate($,X);if(Y!==!0)Z.push(Y)}return Z}}function bw($,X,Z){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(Y,G,Q)=>{try{let W=G.trim().split("."),w=X;for(let K of W)if(w&&typeof w==="object"&&K in w)w=w[K];else return"";let q=w;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((K)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,K)}).join(`
15081
+ `})}function O5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>O5(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((J,Y)=>Z.set(O5(Y),O5(J))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((J)=>Z.add(O5(J))),Z}let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=O5($[Z]);return X}function Tw($,X=100){let Z=Y7($()),J=null,Y=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Z.value=$()},X)};return H8($).subscribe(()=>Y()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Y()},get dirty(){return!1},get deps(){return new Set}}}function kw($,X=100){let Z=Y7($()),J=0,Y=()=>{let Q=Date.now();if(Q-J>=X)J=Q,Z.value=$()};return H8($).subscribe(()=>Y()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){Y()},get dirty(){return!1},get deps(){return new Set}}}var F1=null,T9,B8,uL;var Ew=y(()=>{T9=[],B8=new WeakMap;uL={ref:Y7,computed:H8,watch:Vw,watchMultiple:Aw,watchEffect:Rw,isRef:s1,unref:Ow,toRefs:Lw,shallowRef:Fw,debouncedComputed:Tw,throttledComputed:kw,processComputedDirectives:Nw,processWatchDirectives:Mw}});function _8($,X){let Z={};for(let J of $)Z[J]=c1(X(J));return new Proxy({},{get:(J,Y)=>Z[Y]?.(),set:(J,Y,G)=>{if(Z[Y])Z[Y].set(G);else Z[Y]=c1(G);return!0},has:(J,Y)=>(Y in Z),deleteProperty:(J,Y)=>{return delete Z[Y],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(J,Y)=>(Y in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[Y]()}:void 0})}function dL($,X){let Z={};for(let J of X)Z[J]=$[J];return Z}function A6($,X){let Z=Object.keys($),J=_8(Z,(O)=>X?.[O]??$[O].getDefaultValue()),Y=_8(Z,()=>[]),G=_8(Z,()=>!1),Q=_8(Z,()=>!1),W=_8(Z,()=>!1),w=c1(!1);async function q(O){W[O]=!0;let F=await $[O].validate(J[O],J);return Y[O]=F,W[O]=!1,F.length===0}async function K(){w.set(!0);let O=await Promise.all(Z.map(q));return w.set(!1),O.every(Boolean)}function z(){for(let O of Z)J[O]=X?.[O]??$[O].getDefaultValue(),Y[O]=[],G[O]=!1,Q[O]=!1}function U(O){for(let F of Z)if(F in O)J[F]=O[F],Q[F]=!0}function j(O,F){J[O]=F,Q[O]=!0}function B(O,F=!0){if(G[O]=F,F)q(O)}function H(O){return{value:J[O],errors:Y[O],touched:G[O],dirty:Q[O],valid:Y[O].length===0,validating:W[O]}}function _(O){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await K())await O(dL(J,Z))}}return{values:J,errors:Y,touched:G,dirty:Q,get isValid(){return Z.every((O)=>Y[O].length===0)},get isValidating(){return w()||Z.some((O)=>W[O])},get isDirty(){return Z.some((O)=>Q[O])},validate:K,validateField:q,reset:z,setValues:U,setFieldValue:j,setFieldTouched:B,getFieldState:H,handleSubmit:_}}var Dw;var yw=y(()=>{G$();Dw=A6});var Pw={};t(Pw,{v:()=>mL,useForm:()=>A6,processHasErrorsDirective:()=>Cw,processFormValidationDirectives:()=>cL,processErrorsDirective:()=>Sw,processErrorDirective:()=>bw,defineForm:()=>Dw,Validator:()=>G7});class G7{rules=[];defaultValue="";addRule($){let X=new G7;return X.rules=[...this.rules,$],X.defaultValue=this.defaultValue,X}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(X)=>{if(X===null||X===void 0)return $;if(typeof X==="string"&&X.trim()==="")return $;if(Array.isArray(X)&&X.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(X)=>{if(!X)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(X))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(X)=>{if(!X)return!0;try{return new URL(String(X)),!0}catch{return $}}})}min($,X){let Z=X||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Z,validate:(J)=>{if(!J)return!0;return String(J).length>=$||Z}})}max($,X){let Z=X||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Z,validate:(J)=>{if(!J)return!0;return String(J).length<=$||Z}})}length($,X,Z){let J=Z||`Must be between ${$} and ${X} characters`;return this.addRule({name:"length",message:J,validate:(Y)=>{if(!Y)return!0;let G=String(Y).length;return G>=$&&G<=X||J}})}pattern($,X="Invalid format"){return this.addRule({name:"pattern",message:X,validate:(Z)=>{if(!Z)return!0;return $.test(String(Z))||X}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(X)=>{if(!X)return!0;return!String(X).includes(" ")||$}})}number($="Must be a number"){let X=this.addRule({name:"number",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||$}});return X.defaultValue=0,X}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number.isInteger(Number(X))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<0||$}})}minValue($,X){let Z=X||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Z,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)>=$||Z}})}maxValue($,X){let Z=X||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Z,validate:(J)=>{if(!J&&J!==0)return!0;return Number(J)<=$||Z}})}between($,X,Z){let J=Z||`Must be between ${$} and ${X}`;return this.addRule({name:"between",message:J,validate:(Y)=>{if(!Y&&Y!==0)return!0;let G=Number(Y);return G>=$&&G<=X||J}})}matches($,X){let Z=X||`Must match ${$}`;return this.addRule({name:"matches",message:Z,validate:(J,Y)=>{if(!Y)return!0;return J===Y[$]||Z}})}oneOf($,X){let Z=X||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(J)=>{if(!J)return!0;return $.includes(J)||Z}})}notOneOf($,X){let Z=X||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(J)=>{if(!J)return!0;return!$.includes(J)||Z}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(X)=>{if(!X)return!0;let Z=new Date(String(X));return!Number.isNaN(Z.getTime())||$}})}before($,X){let Z=new Date($),J=X||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:J,validate:(Y)=>{if(!Y)return!0;return new Date(String(Y))<Z||J}})}after($,X){let Z=new Date($),J=X||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:J,validate:(Y)=>{if(!Y)return!0;return new Date(String(Y))>Z||J}})}custom($,X="Invalid value"){return this.addRule({name:"custom",message:X,validate:$})}async($,X="Invalid value"){return this.addRule({name:"async",message:X,async:!0,validate:$})}when($,X){let Z=new G7;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let J of X.getRules())Z.rules.push({...J,validate:(Y,G)=>{if(!$(Y,G||{}))return!0;return J.validate(Y,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let X=new G7;return X.rules=[...this.rules],X.defaultValue=$,X}async validate($,X){let Z=[];for(let J of this.rules){let Y=await J.validate($,X);if(Y!==!0)Z.push(Y)}return Z}validateSync($,X){let Z=[];for(let J of this.rules){if(J.async)continue;let Y=J.validate($,X);if(Y!==!0)Z.push(Y)}return Z}}function bw($,X,Z){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(Y,G,Q)=>{try{let W=G.trim().split("."),w=X;for(let K of W)if(w&&typeof w==="object"&&K in w)w=w[K];else return"";let q=w;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((K)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,K)}).join(`
15082
15082
  `)}catch{return""}})}function Sw($,X,Z){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(Y,G,Q)=>{try{let W=G.trim().split("."),w=X;for(let K of W)if(w&&typeof w==="object"&&K in w)w=w[K];else return"";let q=w;if(!q||!Array.isArray(q)||q.length===0)return"";return q.map((K)=>Q.replace(/\{\{\s*message\s*\}\}/g,K)).join(`
15083
- `)}catch{return""}})}function Cw($,X,Z){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(Y,G,Q)=>{try{let W=G.trim().split("."),w=X;for(let K of W)if(w&&typeof w==="object"&&K in w)w=w[K];else return"";let q=w;if(!q||!Array.isArray(q)||q.length===0)return"";return Q}catch{return""}})}function cL($,X,Z){let J=$;return J=bw(J,X,Z),J=Sw(J,X,Z),J=Cw(J,X,Z),J}var mL;var vw=y(()=>{yw();mL=new Q7});var gw={};e(gw,{processXElementDirectives:()=>lL,hasXElementDirectives:()=>fw,generateXElementRuntime:()=>xw});function xw(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
15083
+ `)}catch{return""}})}function Cw($,X,Z){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(Y,G,Q)=>{try{let W=G.trim().split("."),w=X;for(let K of W)if(w&&typeof w==="object"&&K in w)w=w[K];else return"";let q=w;if(!q||!Array.isArray(q)||q.length===0)return"";return Q}catch{return""}})}function cL($,X,Z){let J=$;return J=bw(J,X,Z),J=Sw(J,X,Z),J=Cw(J,X,Z),J}var mL;var vw=y(()=>{yw();mL=new G7});var gw={};t(gw,{processXElementDirectives:()=>lL,hasXElementDirectives:()=>fw,generateXElementRuntime:()=>xw});function xw(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
15084
15084
  (function() {
15085
15085
  'use strict';
15086
15086
 
@@ -15366,7 +15366,7 @@ else {
15366
15366
  })();
15367
15367
  </script>`}function fw($){return/\bx-data(?:\s|=)/.test($)}function lL($){let X=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=$.match(X)||[],J=Z.length>0?$.replace(X,""):$;if(!fw(J))return J;let Y=Z[0]?.trim()||xw(),G=J.lastIndexOf("</body>");if(G!==-1)return J.slice(0,G)+Y+`
15368
15368
  `+J.slice(G);return J+`
15369
- `+Y}var hw={};e(hw,{rewriteImagesWithSiblings:()=>nL});import y1 from"path";async function nL($,X){let Z=X.formats??iL;if(!X.publicDir)return $;let J=sL($),Y=[],G=/<img\b[^>]*?>/gi,Q=[],W;while((W=G.exec($))!==null){let z=W[0],U=z.match(/\bsrc=["']([^"']+)["']/i);if(!U)continue;if(aL(W.index,J))continue;Q.push({idx:W.index,length:z.length,src:U[1],raw:z})}if(Q.length===0)return $;let w=await Promise.all(Q.map(async(z)=>{let U=await rL(z.src,X.publicDir,Z);return{match:z,sources:U}}));for(let{match:z,sources:U}of w){if(U.length===0)continue;let B=`<picture>${U.map((H)=>`<source type="${H.mime}" srcset="${tL(H.url)}">`).join("")}${z.raw}</picture>`;Y.push({start:z.idx,end:z.idx+z.length,replacement:B})}if(Y.length===0)return $;let q="",K=0;for(let z of Y)q+=$.slice(K,z.start),q+=z.replacement,K=z.end;return q+=$.slice(K),q}async function rL($,X,Z){if(!oL($))return[];let J=y1.extname($).toLowerCase();if(!pL.has(J))return[];if(!$.startsWith("/"))return[];let Y=y1.join(X,$.slice(1)),G=y1.dirname(Y),Q=y1.basename(Y,J),W=y1.resolve(G),w=y1.resolve(X);if(!W.startsWith(w))return[];let q=y1.posix.dirname($),K=Z.map(async(U)=>{let j=y1.join(G,`${Q}${U.ext}`);if(!await Bun.file(j).exists())return null;return{url:y1.posix.join(q,`${Q}${U.ext}`),mime:U.mime}});return(await Promise.all(K)).filter((U)=>U!==null)}function oL($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function sL($){let X=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Z.exec($))!==null)X.push([J.index,J.index+J[0].length]);return X}function aL($,X){for(let[Z,J]of X)if($>=Z&&$<J)return!0;return!1}function tL($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var pL,iL;var uw=y(()=>{pL=new Set([".jpg",".jpeg",".png",".gif"]),iL=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var dw=()=>{};function R6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var mw=y(()=>{dw()});var cw={};e(cw,{injectPwaTags:()=>eL,generateThemeColorMeta:()=>ZF,generateSwRegistrationScript:()=>$F,generatePwaTags:()=>k9,generateManifestLink:()=>XF});function k9($){let X=$.pwa;if(!X?.enabled)return"";let Z=X.manifest,J=X.icons?.outputDir?`/${X.icons.outputDir}`:"/pwa-icons",Y=R6($),G=`
15369
+ `+Y}var hw={};t(hw,{rewriteImagesWithSiblings:()=>nL});import y1 from"path";async function nL($,X){let Z=X.formats??iL;if(!X.publicDir)return $;let J=sL($),Y=[],G=/<img\b[^>]*?>/gi,Q=[],W;while((W=G.exec($))!==null){let z=W[0],U=z.match(/\bsrc=["']([^"']+)["']/i);if(!U)continue;if(aL(W.index,J))continue;Q.push({idx:W.index,length:z.length,src:U[1],raw:z})}if(Q.length===0)return $;let w=await Promise.all(Q.map(async(z)=>{let U=await rL(z.src,X.publicDir,Z);return{match:z,sources:U}}));for(let{match:z,sources:U}of w){if(U.length===0)continue;let B=`<picture>${U.map((H)=>`<source type="${H.mime}" srcset="${tL(H.url)}">`).join("")}${z.raw}</picture>`;Y.push({start:z.idx,end:z.idx+z.length,replacement:B})}if(Y.length===0)return $;let q="",K=0;for(let z of Y)q+=$.slice(K,z.start),q+=z.replacement,K=z.end;return q+=$.slice(K),q}async function rL($,X,Z){if(!oL($))return[];let J=y1.extname($).toLowerCase();if(!pL.has(J))return[];if(!$.startsWith("/"))return[];let Y=y1.join(X,$.slice(1)),G=y1.dirname(Y),Q=y1.basename(Y,J),W=y1.resolve(G),w=y1.resolve(X);if(!W.startsWith(w))return[];let q=y1.posix.dirname($),K=Z.map(async(U)=>{let j=y1.join(G,`${Q}${U.ext}`);if(!await Bun.file(j).exists())return null;return{url:y1.posix.join(q,`${Q}${U.ext}`),mime:U.mime}});return(await Promise.all(K)).filter((U)=>U!==null)}function oL($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function sL($){let X=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,J;while((J=Z.exec($))!==null)X.push([J.index,J.index+J[0].length]);return X}function aL($,X){for(let[Z,J]of X)if($>=Z&&$<J)return!0;return!1}function tL($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var pL,iL;var uw=y(()=>{pL=new Set([".jpg",".jpeg",".png",".gif"]),iL=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var dw=()=>{};function R6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var mw=y(()=>{dw()});var cw={};t(cw,{injectPwaTags:()=>eL,generateThemeColorMeta:()=>ZF,generateSwRegistrationScript:()=>$F,generatePwaTags:()=>k9,generateManifestLink:()=>XF});function k9($){let X=$.pwa;if(!X?.enabled)return"";let Z=X.manifest,J=X.icons?.outputDir?`/${X.icons.outputDir}`:"/pwa-icons",Y=R6($),G=`
15370
15370
  <!-- stx PWA Meta Tags -->
15371
15371
  <link rel="manifest" href="/manifest.json">
15372
15372
  <meta name="theme-color" content="${N6(Z?.themeColor||"#000000")}">
@@ -15424,43 +15424,43 @@ if ('serviceWorker' in navigator) {
15424
15424
  });
15425
15425
  });
15426
15426
  }
15427
- </script>`}function XF(){return'<link rel="manifest" href="/manifest.json">'}function ZF($){return`<meta name="theme-color" content="${N6($)}">`}function N6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var lw=y(()=>{mw()});import JF from"fs";import h0 from"path";function pw($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function YF($,X){let Z=$.length,J=X,Y=!0,G=[],Q=(W)=>W+9<=Z&&$[W]==="<"&&$[W+1]==="/"&&($[W+2]==="s"||$[W+2]==="S")&&($[W+3]==="c"||$[W+3]==="C")&&($[W+4]==="r"||$[W+4]==="R")&&($[W+5]==="i"||$[W+5]==="I")&&($[W+6]==="p"||$[W+6]==="P")&&($[W+7]==="t"||$[W+7]==="T")&&($[W+8]===">"||/\s/.test($[W+8]));while(J<Z){let W=$[J];if(Q(J))return J;if(W==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
15427
+ </script>`}function XF(){return'<link rel="manifest" href="/manifest.json">'}function ZF($){return`<meta name="theme-color" content="${N6($)}">`}function N6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var lw=y(()=>{mw()});import JF from"fs";import g0 from"path";function pw($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function YF($,X){let Z=$.length,J=X,Y=!0,G=[],Q=(W)=>W+9<=Z&&$[W]==="<"&&$[W+1]==="/"&&($[W+2]==="s"||$[W+2]==="S")&&($[W+3]==="c"||$[W+3]==="C")&&($[W+4]==="r"||$[W+4]==="R")&&($[W+5]==="i"||$[W+5]==="I")&&($[W+6]==="p"||$[W+6]==="P")&&($[W+7]==="t"||$[W+7]==="T")&&($[W+8]===">"||/\s/.test($[W+8]));while(J<Z){let W=$[J];if(Q(J))return J;if(W==="/"&&$[J+1]==="/"){if(J=$.indexOf(`
15428
15428
  `,J+2),J===-1)return-1;J+=1,Y=!0;continue}if(W==="/"&&$[J+1]==="*"){let w=$.indexOf("*/",J+2);if(w===-1)return-1;J=w+2,Y=!0;continue}if(W==="/"&&Y){let w=J+1,q=!1;while(w<Z){let K=$[w];if(K==="\\"){w+=2;continue}if(K==="[")q=!0;else if(K==="]")q=!1;else if(K==="/"&&!q){w++;break}else if(K===`
15429
15429
  `){w=-1;break}w++}if(w===-1){J++,Y=!1;continue}while(w<Z&&/[a-z]/.test($[w]))w++;J=w,Y=!1;continue}if(W==="'"||W==='"'){let w=W;J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]===w){J++;break}if($[J]===`
15430
- `)break;J++}Y=!1;continue}if(W==="`"){J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){G.push(!0),J+=2,Y=!0;break}J++}if(G.length===0)Y=!1;continue}if(W==="}"&&G.length>0){G.pop(),J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Y=!1;break}if($[J]==="$"&&$[J+1]==="{"){G.push(!0),J+=2,Y=!0;break}J++}continue}if(/\s/.test(W));else if(/[)\].\w$]/.test(W))Y=!1;else Y=!0;J++}return-1}function W7($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let Y=J.index+J[0].length,G=$.indexOf("</script>",Y);if(G===-1)return null;let Q=$.indexOf(">",G);if(Q===-1)return null;return{start:J.index,end:Q+1}}function iw($){let X=0;while(X<$.length){let Z=$.indexOf("<",X);if(Z===-1)return-1;if($.startsWith("<!--",Z)){let G=$.indexOf("-->",Z+4);X=G===-1?$.length:G+3;continue}let J=$.slice(Z),Y=/^<style\b[^>]*>/i.exec(J);if(Y){let G=$.toLowerCase().indexOf("</style>",Z+Y[0].length);X=G===-1?$.length:G+8;continue}if(/^<script\b[^>]*>/i.test(J))return Z;X=Z+1}return-1}function GF($){let X=W7($,"data-stx-runtime");if(!X)return $;let Z=iw($);if(Z===-1||Z===X.start)return $;let J=$.slice(X.start,X.end),Y=$.slice(0,X.start)+$.slice(X.end),G=iw(Y);if(G===-1)return J+`
15430
+ `)break;J++}Y=!1;continue}if(W==="`"){J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;break}if($[J]==="$"&&$[J+1]==="{"){G.push(!0),J+=2,Y=!0;break}J++}if(G.length===0)Y=!1;continue}if(W==="}"&&G.length>0){G.pop(),J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++,Y=!1;break}if($[J]==="$"&&$[J+1]==="{"){G.push(!0),J+=2,Y=!0;break}J++}continue}if(/\s/.test(W));else if(/[)\].\w$]/.test(W))Y=!1;else Y=!0;J++}return-1}function Q7($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!J)return null;let Y=J.index+J[0].length,G=$.indexOf("</script>",Y);if(G===-1)return null;let Q=$.indexOf(">",G);if(Q===-1)return null;return{start:J.index,end:Q+1}}function iw($){let X=0;while(X<$.length){let Z=$.indexOf("<",X);if(Z===-1)return-1;if($.startsWith("<!--",Z)){let G=$.indexOf("-->",Z+4);X=G===-1?$.length:G+3;continue}let J=$.slice(Z),Y=/^<style\b[^>]*>/i.exec(J);if(Y){let G=$.toLowerCase().indexOf("</style>",Z+Y[0].length);X=G===-1?$.length:G+8;continue}if(/^<script\b[^>]*>/i.test(J))return Z;X=Z+1}return-1}function GF($){let X=Q7($,"data-stx-runtime");if(!X)return $;let Z=iw($);if(Z===-1||Z===X.start)return $;let J=$.slice(X.start,X.end),Y=$.slice(0,X.start)+$.slice(X.end),G=iw(Y);if(G===-1)return J+`
15431
15431
  `+Y;return Y.slice(0,G)+J+`
15432
- `+Y.slice(G)}async function A0($,X,Z,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(X.__stx_signals_gate===void 0)X.__stx_signals_gate=T1($);let G=!X.__stxProcessingDepth;if(G)l2(X);if(!X.__stxProcessingDepth)X.__stxProcessingDepth=0;if(X.__stxProcessingDepth++,!X.__onceStore)X.__onceStore=new Set;if((J.debug||!s7()&&!l$())&&Z&&Z.endsWith(".stx"))O3($,Z);try{return await BZ.timeAsync("template-processing",async()=>{let Q=await QF($,X,Z,J,Y);if(G)Q=K6(Q);if(G&&J.autoShell&&J.buildMode!=="compile"){let W=J.app?.head||{},q=(X.__stx_runtime_head||null)??T4(),K=(X.__stx_head_raw||"").trim(),z,U=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(U)z=U[1].trim(),K=K.replace(U[0],"").trim();let j=X.__sections?.title,B=q.title||z||j,H=!q.title&&(!!z||!!j),_=q.meta||[],L=new Set(_.map((N)=>$7(N)).filter(Boolean)),O={...W,...B&&{title:B},meta:[...(W.meta||[]).filter((N)=>!L.has($7(N))),..._],link:[...W.link||[],...q.link||[]],script:[...W.script||[],...q.script||[]],headRaw:[W.headRaw,K].filter(Boolean).join(`
15432
+ `+Y.slice(G)}async function V0($,X,Z,J,Y){if(J.ssr===!1&&!J.autoShell&&J.buildMode==="spa")return $;if(X.__stx_signals_gate===void 0)X.__stx_signals_gate=T1($);let G=!X.__stxProcessingDepth;if(G)l2(X);if(!X.__stxProcessingDepth)X.__stxProcessingDepth=0;if(X.__stxProcessingDepth++,!X.__onceStore)X.__onceStore=new Set;if((J.debug||!s7()&&!l$())&&Z&&Z.endsWith(".stx"))O3($,Z);try{return await BZ.timeAsync("template-processing",async()=>{let Q=await QF($,X,Z,J,Y);if(G)Q=K6(Q);if(G&&J.autoShell&&J.buildMode!=="compile"){let W=J.app?.head||{},q=(X.__stx_runtime_head||null)??T4(),K=(X.__stx_head_raw||"").trim(),z,U=K.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(U)z=U[1].trim(),K=K.replace(U[0],"").trim();let j=X.__sections?.title,B=q.title||z||j,H=!q.title&&(!!z||!!j),_=q.meta||[],L=new Set(_.map((N)=>e5(N)).filter(Boolean)),O={...W,...B&&{title:B},meta:[...(W.meta||[]).filter((N)=>!L.has(e5(N))),..._],link:[...W.link||[],...q.link||[]],script:[...W.script||[],...q.script||[]],headRaw:[W.headRaw,K].filter(Boolean).join(`
15433
15433
  `),...q.htmlAttrs&&{htmlAttrs:KW(W.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...W.bodyAttrs||{},...q.bodyAttrs}}},F=W6(Q);if(Q=BW(Q,O,{...H&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),F)Q=jW(Q,W),Q=zW(Q,O.htmlAttrs);let V=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(V&&Q.includes("<head")){let N=V[1],k=M7(N);Q=Q.replace(/<head\b[^>]*>/i,(I)=>`${I}
15434
15434
  <meta name="stx-layout" content="${pw(N)}">
15435
- <meta name="stx-layout-group" content="${pw(k)}">`)}let A=Q.match(/function (__stx_setup_\d+_\d+)\(/),R=A?p7(Q):null;if(A&&R&&!/\bdata-stx=/.test(R.tag)){Q=a8(Q,(k,I)=>`<body${I} data-stx="${A[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${A[1]}"`,"i");Q=Q.replace(N,"$1")}}if(G){Q=UW(Q);let W=J.app?.colorMode;if(W)Q=GW(Q,W);Q=WW(Q),Q=GF(Q)}if(G)try{let{getStoreScript:W}=await $0("stx/store-loader",()=>Promise.resolve().then(() => (MW(),NW))),w=J.storesDir,q=await W(w);if(q){let K=`<script data-stx-stores>${q}</script>`,z=W7(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
15436
- `+K+Q.slice(z.end)}}catch{}if(G)try{let{getFrameworkComposableScript:W}=await $0("stx/framework-composables",()=>Promise.resolve().then(() => (DW(),EW))),w=await W(Q);if(w){let q=W7(Q,"data-stx-stores")||W7(Q,"data-stx-runtime");if(q)Q=Q.slice(0,q.end)+`
15437
- `+w+Q.slice(q.end)}}catch{}if(G)try{let{getComposableScript:W}=await $0("stx/composable-loader",()=>Promise.resolve().then(() => (SW(),bW))),w=J.composablesDir,q=await W(w,Q);if(q){let K=`<script data-stx-composables>${q}</script>`,z=W7(Q,"data-stx-stores")||W7(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
15438
- `+K+Q.slice(z.end)}}catch{}if(G)Q=QW(Q);if(G&&X.__stx_inject_css!==!1)Q=await $8(Q,void 0,J.buildMode==="serve");if(G)Q=FZ(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof r$)throw Q;let W=Q instanceof Error?Q.message:String(Q),w=new U5(`Template processing failed: ${W}`,Z,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(Q1.log(w,{filePath:Z,context:X}),lX.logDetailedError(w,{filePath:Z,template:$.substring(0,500)}),J.debug)throw w;return mX.createFallbackContent("Template Processing",w)}}async function QF($,X,Z,J,Y){let G=process.cwd(),Q={...J,partialsDir:J.partialsDir&&!h0.isAbsolute(J.partialsDir)?h0.resolve(G,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!h0.isAbsolute(J.componentsDir)?h0.resolve(G,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!h0.isAbsolute(J.layoutsDir)?h0.resolve(G,J.layoutsDir):J.layoutsDir},W=Q,w=$;await qF(Z,X),wF(X,W),w=await m5(()=>dQ(w,X,Z,W),w,(F)=>{Q1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=z1(w,h7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);w=q.output;let K=q.tokens,z=(F)=>K.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>K[Number(A)]??""),U="\x00STX_ESCAPED_AT\x00";w=w.replace(/@@/g,U),w=w.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),w=tQ(w),w=await LW(w,Z,Y);let j={};w=t3(w,j);let B={...X.__sections||{}},H="",_=qG(X9($)),L=/@nolayout\b/.test(w)||_===!1;if(/@nolayout\b/.test(w))w=w.replace(/@nolayout\b\s*/g,"");let O=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)H=O[1],w=w.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof _==="string"){if(H=_,!/@section\s*\(/.test(w))w=`@section('content')
15435
+ <meta name="stx-layout-group" content="${pw(k)}">`)}let A=Q.match(/function (__stx_setup_\d+_\d+)\(/),R=A?p7(Q):null;if(A&&R&&!/\bdata-stx=/.test(R.tag)){Q=a8(Q,(k,I)=>`<body${I} data-stx="${A[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${A[1]}"`,"i");Q=Q.replace(N,"$1")}}if(G){Q=UW(Q);let W=J.app?.colorMode;if(W)Q=GW(Q,W);Q=WW(Q),Q=GF(Q)}if(G)try{let{getStoreScript:W}=await X0("stx/store-loader",()=>Promise.resolve().then(() => (MW(),NW))),w=J.storesDir,q=await W(w);if(q){let K=`<script data-stx-stores>${q}</script>`,z=Q7(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
15436
+ `+K+Q.slice(z.end)}}catch{}if(G)try{let{getFrameworkComposableScript:W}=await X0("stx/framework-composables",()=>Promise.resolve().then(() => (DW(),EW))),w=await W(Q);if(w){let q=Q7(Q,"data-stx-stores")||Q7(Q,"data-stx-runtime");if(q)Q=Q.slice(0,q.end)+`
15437
+ `+w+Q.slice(q.end)}}catch{}if(G)try{let{getComposableScript:W}=await X0("stx/composable-loader",()=>Promise.resolve().then(() => (SW(),bW))),w=J.composablesDir,q=await W(w,Q);if(q){let K=`<script data-stx-composables>${q}</script>`,z=Q7(Q,"data-stx-stores")||Q7(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
15438
+ `+K+Q.slice(z.end)}}catch{}if(G)Q=QW(Q);if(G&&X.__stx_inject_css!==!1)Q=await $8(Q,void 0,J.buildMode==="serve");if(G)Q=FZ(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof r$)throw Q;let W=Q instanceof Error?Q.message:String(Q),w=new z5(`Template processing failed: ${W}`,Z,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(Q1.log(w,{filePath:Z,context:X}),lX.logDetailedError(w,{filePath:Z,template:$.substring(0,500)}),J.debug)throw w;return mX.createFallbackContent("Template Processing",w)}}async function QF($,X,Z,J,Y){let G=process.cwd(),Q={...J,partialsDir:J.partialsDir&&!g0.isAbsolute(J.partialsDir)?g0.resolve(G,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!g0.isAbsolute(J.componentsDir)?g0.resolve(G,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!g0.isAbsolute(J.layoutsDir)?g0.resolve(G,J.layoutsDir):J.layoutsDir},W=Q,w=$;await qF(Z,X),wF(X,W),w=await d5(()=>dQ(w,X,Z,W),w,(F)=>{Q1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");let q=K1(w,h7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);w=q.output;let K=q.tokens,z=(F)=>K.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>K[Number(A)]??""),U="\x00STX_ESCAPED_AT\x00";w=w.replace(/@@/g,U),w=w.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),w=tQ(w),w=await LW(w,Z,Y);let j={};w=t3(w,j);let B={...X.__sections||{}},H="",_=qG(X9($)),L=/@nolayout\b/.test(w)||_===!1;if(/@nolayout\b/.test(w))w=w.replace(/@nolayout\b\s*/g,"");let O=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)H=O[1],w=w.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof _==="string"){if(H=_,!/@section\s*\(/.test(w))w=`@section('content')
15439
15439
  ${w.trim()}
15440
- @endsection`}if(!H&&!L&&W.defaultLayout){let F=Q6(w),V=/@section\s*\(/.test(w);if(!F||V){let A="",R=h0.dirname(Z),N=W.layoutsDir?h0.dirname(W.layoutsDir):process.cwd();for(let k=0;k<20;k++){let I=h0.join(R,"_layout.stx");if(await o(I)){A=I;break}let M=h0.dirname(R);if(M===R||M.length<N.length)break;R=M}if(A)H=A;else if(W.layoutsDir){let k=h0.isAbsolute(W.layoutsDir)?W.layoutsDir:h0.resolve(process.cwd(),W.layoutsDir),I=h0.join(k,`${W.defaultLayout}.stx`);if(await o(I))H=I}if(H&&!V)w=`@section('content')
15440
+ @endsection`}if(!H&&!L&&W.defaultLayout){let F=Q6(w),V=/@section\s*\(/.test(w);if(!F||V){let A="",R=g0.dirname(Z),N=W.layoutsDir?g0.dirname(W.layoutsDir):process.cwd();for(let k=0;k<20;k++){let I=g0.join(R,"_layout.stx");if(await o(I)){A=I;break}let M=g0.dirname(R);if(M===R||M.length<N.length)break;R=M}if(A)H=A;else if(W.layoutsDir){let k=g0.isAbsolute(W.layoutsDir)?W.layoutsDir:g0.resolve(process.cwd(),W.layoutsDir),I=g0.join(k,`${W.defaultLayout}.stx`);if(await o(I))H=I}if(H&&!V)w=`@section('content')
15441
15441
  ${w.trim()}
15442
- @endsection`}}if(w=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return B[V]=A,""}),w=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=Q0(A.trim(),X);if(R===void 0)return F;return B[V]=String(R??""),""}catch{return F}}),w=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))B[V]=A.replace("@parent",F5);else B[V]=A.trim();return""}),X.__sections=B,w=w.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return B[V]||A||""}),!("slot"in X)||X.slot===void 0)w=w.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(w=e3(w,j),H){let F=[],V=U1(w),A=z1(V.output,S5,(R,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(w=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,N,k)=>{let I=N==="SCRIPT"?V.scripts[Number(k)]:A.tokens[Number(k)];if(I)F.push(I);return""}),F.length>0){let R=F.join(`
15442
+ @endsection`}}if(w=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return B[V]=A,""}),w=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=W0(A.trim(),X);if(R===void 0)return F;return B[V]=String(R??""),""}catch{return F}}),w=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))B[V]=A.replace("@parent",L5);else B[V]=A.trim();return""}),X.__sections=B,w=w.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return B[V]||A||""}),!("slot"in X)||X.slot===void 0)w=w.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(w=e3(w,j),H){let F=[],V=z1(w),A=K1(V.output,b5,(R,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(w=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,N,k)=>{let I=N==="SCRIPT"?V.scripts[Number(k)]:A.tokens[Number(k)];if(I)F.push(I);return""}),F.length>0){let R=F.join(`
15443
15443
  `);B.content=B.content?`${B.content}
15444
- ${R}`:R,X.__sections=B}}if(H)try{let F;if(h0.isAbsolute(H))F=H,Y.add(H);else F=await m5(()=>WX(H,Z,Q,Y),null,()=>{throw new U5(`Failed to resolve layout path: ${H}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let I=(T)=>{if(!T)return[];try{let D=h0.isAbsolute(T)?T:h0.resolve(process.cwd(),T);return JF.readdirSync(D).filter((b)=>b.endsWith(".stx")).map((b)=>b.replace(/\.stx$/,""))}catch{return[]}},M=[...I(Q.layoutsDir),...I(Q.fallbackLayoutsDir)].filter((T,D,b)=>b.indexOf(T)===D).sort(),E=`Layout not found: ${H} (referenced from ${Z})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if(Q1.log(Error(E),{layoutPath:H,filePath:Z,available:M},"error"),console.error(`[stx] ${E}`),Q.debug)throw new U5(E,Z);return w}let V=await m5(()=>Bun.file(F).text(),"",()=>{throw new U5(`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 I={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,b,S)=>{return I[b]=S.trim(),""});for(let[D,b]of Object.entries(I))if(B[D]&&B[D].includes(F5)){let S=B[D].indexOf(F5);B[D]=B[D].slice(0,S)+b+B[D].slice(S+F5.length)}else if(!B[D])B[D]=b;let E={...X,__sections:B},T=`@layout('${A[1]}')${M}`;return await A0(T,E,F,Q,Y)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=t3(R,j),k={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,M,E)=>{return k[M]=E.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(I,M,E)=>{if(B[M]){let T=B[M];if(T.includes(F5)){let D=k[M]||"",b=T.indexOf(F5);T=T.slice(0,b)+D+T.slice(b+F5.length)}return T}return E||""}),N=WF(N,B),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),N=e3(N,j),X.__originalFilePath=Z,w=await nw(N,X,F,Q,Y),w=`<!-- stx-layout: ${H} -->
15445
- ${w}`,z(w)}catch(F){return Q1.log(F instanceof Error?F:Error(String(F)),{layoutPath:H,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await nw(w,X,Z,Q,Y))}function WF($,X){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,J,Y)=>{let G=X[J];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return Y||""})}function wF($,X){if($.__stx_sfc_mode=!0,$.__stx_options=X,X.buildMode)$.__stx_buildMode=X.buildMode;let Z=X.envPrefix||"STX_PUBLIC_",J={};for(let[Y,G]of Object.entries(process.env))if(Y.startsWith(Z)&&G!==void 0)J[Y]=G;$.$env=J}async function qF($,X){await m5(()=>iQ($,X),void 0,(Z)=>{Q1.log(Z,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Z.message}`)})}async function KF($,X,Z){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let G=Y[1],Q=Y[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:w}=await $0("stx/variable-extractor",()=>Promise.resolve().then(() => (c7(),r8)));await w(Q,X,Z,{preserveExisting:!0})}catch(w){let q=w instanceof Error?w:Error(String(w));Q1.log(q,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${q.message}`)}}}async function zF($,X,Z){try{let{interpolateScriptsInTemplate:J}=await $0("stx/expressions",()=>Promise.resolve().then(() => (B1(),zZ)));return J($,X,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return Q1.log(Y,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${Y.message}`),$}}async function nw($,X,Z,J,Y){let G=$,Q=J;if(await KF(G,X,Z),G=await zF(G,X,Z),G=await vQ(G,X,Z),G=await xQ(G,X,Z),G=await EG(G,X,Z,Q),T1(G))G=XX(G,X),G=JX(G,X);G=ZX(G);let{processStreamDirectives:W}=await $0("stx/streaming",()=>Promise.resolve().then(() => (_3(),H3)));G=W(G,X),G=r3(G,X,Z,Q),G=await JW(G,X,Z,Q,Y),G=await B9(G,X,Z,Q,Y),G=W2(G,X,Z,Q);let{processDeferDirectives:w}=await $0("stx/defer",()=>Promise.resolve().then(() => PW));G=w(G,X,Z);let{processTeleportDirectives:q}=await $0("stx/teleport",()=>Promise.resolve().then(() => xW));G=q(G,X,Z);let{processTransitionDirectives:K,processTransitionAttributes:z}=await $0("stx/transitions",()=>Promise.resolve().then(() => uW));G=K(G,X,Z),G=z(G);let{processErrorBoundaryDirectives:U}=await $0("stx/error-boundaries",()=>Promise.resolve().then(() => mW));G=U(G,X,Z);let{processSuspenseDirectives:j}=await $0("stx/suspense",()=>Promise.resolve().then(() => cW));G=j(G,X,Z);let{processAsyncDirectives:B}=await $0("stx/async-components",()=>Promise.resolve().then(() => nW));G=B(G,X,Z);let{processKeepAliveDirectives:H}=await $0("stx/keep-alive",()=>Promise.resolve().then(() => oW));G=H(G,X,Z);let{processVirtualListDirectives:_,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await $0("stx/virtual-scrolling",()=>Promise.resolve().then(() => (Xw(),$w)));G=_(G,X,Z),G=L(G,X,Z),G=O(G,X,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await $0("stx/partial-hydration",()=>Promise.resolve().then(() => (_w(),Hw)));G=F(G,X,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await $0("stx/computed",()=>Promise.resolve().then(() => (Ew(),Iw)));G=A(G,X,Z),G=R(G,X,Z);let{processFormValidationDirectives:N}=await $0("stx/forms-validation",()=>Promise.resolve().then(() => (vw(),Pw)));G=N(G,X,Z);let{processHeadDirective:k,processTitleDirective:I,processMetaDirective:M,resetHead:E}=await $0("stx/head",()=>Promise.resolve().then(() => (f5(),I4)));if(!X.__stx_head_preset&&!X.__stx_runtime_head)E();let T=k(G);if(G=T.content,T.headContent)X.__stx_head_raw=`${X.__stx_head_raw||""}${T.headContent}
15446
- `;if(G=I(G,X),G=M(G,X),G=lQ(G),G=X3(G,X),G=kG(G),G=hQ(G),G=await a3(G,X,Z,Q,Y),G=await B9(G,X,Z,Q,Y),X.__stxProcessingDepth===1)G=i2(G,X);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=K6(G),G=E1(G,X,Z),G=Z3(G,X),G=J3(G,X),G=G9(G,X),G=fG(G,X),G=gG(G,X),G=await BG(G,X,Z,Q),G=await MJ(G,X,Z),G=await cG(G,X,Z,Q),G=$2(G,X,Z,Q),G=CY(G,X,Z,Q),G=PY(G,X,Z),G=vY(G,X,Z,Q),G=NG(G,X,Z,Q),G=w6(G,X),G=q6(G),G=VW(G),!Q.skipEventDirectives)G=I2(G,X,Z);if(G=UG(G,X,Z),Q.debug){let l=/\bx-data\s*=/.test(G),p=j$($);if(l&&p)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
15444
+ ${R}`:R,X.__sections=B}}if(H)try{let F;if(g0.isAbsolute(H))F=H,Y.add(H);else F=await d5(()=>WX(H,Z,Q,Y),null,()=>{throw new z5(`Failed to resolve layout path: ${H}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let I=(T)=>{if(!T)return[];try{let D=g0.isAbsolute(T)?T:g0.resolve(process.cwd(),T);return JF.readdirSync(D).filter((b)=>b.endsWith(".stx")).map((b)=>b.replace(/\.stx$/,""))}catch{return[]}},M=[...I(Q.layoutsDir),...I(Q.fallbackLayoutsDir)].filter((T,D,b)=>b.indexOf(T)===D).sort(),E=`Layout not found: ${H} (referenced from ${Z})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if(Q1.log(Error(E),{layoutPath:H,filePath:Z,available:M},"error"),console.error(`[stx] ${E}`),Q.debug)throw new z5(E,Z);return w}let V=await d5(()=>Bun.file(F).text(),"",()=>{throw new z5(`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 I={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,b,S)=>{return I[b]=S.trim(),""});for(let[D,b]of Object.entries(I))if(B[D]&&B[D].includes(L5)){let S=B[D].indexOf(L5);B[D]=B[D].slice(0,S)+b+B[D].slice(S+L5.length)}else if(!B[D])B[D]=b;let E={...X,__sections:B},T=`@layout('${A[1]}')${M}`;return await V0(T,E,F,Q,Y)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=t3(R,j),k={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,M,E)=>{return k[M]=E.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(I,M,E)=>{if(B[M]){let T=B[M];if(T.includes(L5)){let D=k[M]||"",b=T.indexOf(L5);T=T.slice(0,b)+D+T.slice(b+L5.length)}return T}return E||""}),N=WF(N,B),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),N=e3(N,j),X.__originalFilePath=Z,w=await nw(N,X,F,Q,Y),w=`<!-- stx-layout: ${H} -->
15445
+ ${w}`,z(w)}catch(F){return Q1.log(F instanceof Error?F:Error(String(F)),{layoutPath:H,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await nw(w,X,Z,Q,Y))}function WF($,X){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,J,Y)=>{let G=X[J];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${J.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return Y||""})}function wF($,X){if($.__stx_sfc_mode=!0,$.__stx_options=X,X.buildMode)$.__stx_buildMode=X.buildMode;let Z=X.envPrefix||"STX_PUBLIC_",J={};for(let[Y,G]of Object.entries(process.env))if(Y.startsWith(Z)&&G!==void 0)J[Y]=G;$.$env=J}async function qF($,X){await d5(()=>iQ($,X),void 0,(Z)=>{Q1.log(Z,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Z.message}`)})}async function KF($,X,Z){let J=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Y;while((Y=J.exec($))!==null){let G=Y[1],Q=Y[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:w}=await X0("stx/variable-extractor",()=>Promise.resolve().then(() => (c7(),r8)));await w(Q,X,Z,{preserveExisting:!0})}catch(w){let q=w instanceof Error?w:Error(String(w));Q1.log(q,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${q.message}`)}}}async function zF($,X,Z){try{let{interpolateScriptsInTemplate:J}=await X0("stx/expressions",()=>Promise.resolve().then(() => (j1(),zZ)));return J($,X,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return Q1.log(Y,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${Y.message}`),$}}async function nw($,X,Z,J,Y){let G=$,Q=J;if(await KF(G,X,Z),G=await zF(G,X,Z),G=await vQ(G,X,Z),G=await xQ(G,X,Z),G=await EG(G,X,Z,Q),T1(G))G=XX(G,X),G=JX(G,X);G=ZX(G);let{processStreamDirectives:W}=await X0("stx/streaming",()=>Promise.resolve().then(() => (_3(),H3)));G=W(G,X),G=r3(G,X,Z,Q),G=await JW(G,X,Z,Q,Y),G=await B9(G,X,Z,Q,Y),G=W2(G,X,Z,Q);let{processDeferDirectives:w}=await X0("stx/defer",()=>Promise.resolve().then(() => PW));G=w(G,X,Z);let{processTeleportDirectives:q}=await X0("stx/teleport",()=>Promise.resolve().then(() => xW));G=q(G,X,Z);let{processTransitionDirectives:K,processTransitionAttributes:z}=await X0("stx/transitions",()=>Promise.resolve().then(() => uW));G=K(G,X,Z),G=z(G);let{processErrorBoundaryDirectives:U}=await X0("stx/error-boundaries",()=>Promise.resolve().then(() => mW));G=U(G,X,Z);let{processSuspenseDirectives:j}=await X0("stx/suspense",()=>Promise.resolve().then(() => cW));G=j(G,X,Z);let{processAsyncDirectives:B}=await X0("stx/async-components",()=>Promise.resolve().then(() => nW));G=B(G,X,Z);let{processKeepAliveDirectives:H}=await X0("stx/keep-alive",()=>Promise.resolve().then(() => oW));G=H(G,X,Z);let{processVirtualListDirectives:_,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await X0("stx/virtual-scrolling",()=>Promise.resolve().then(() => (Xw(),$w)));G=_(G,X,Z),G=L(G,X,Z),G=O(G,X,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await X0("stx/partial-hydration",()=>Promise.resolve().then(() => (_w(),Hw)));G=F(G,X,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await X0("stx/computed",()=>Promise.resolve().then(() => (Ew(),Iw)));G=A(G,X,Z),G=R(G,X,Z);let{processFormValidationDirectives:N}=await X0("stx/forms-validation",()=>Promise.resolve().then(() => (vw(),Pw)));G=N(G,X,Z);let{processHeadDirective:k,processTitleDirective:I,processMetaDirective:M,resetHead:E}=await X0("stx/head",()=>Promise.resolve().then(() => (x5(),I4)));if(!X.__stx_head_preset&&!X.__stx_runtime_head)E();let T=k(G);if(G=T.content,T.headContent)X.__stx_head_raw=`${X.__stx_head_raw||""}${T.headContent}
15446
+ `;if(G=I(G,X),G=M(G,X),G=lQ(G),G=X3(G,X),G=kG(G),G=hQ(G),G=await a3(G,X,Z,Q,Y),G=await B9(G,X,Z,Q,Y),X.__stxProcessingDepth===1)G=i2(G,X);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=K6(G),G=E1(G,X,Z),G=Z3(G,X),G=J3(G,X),G=G9(G,X),G=fG(G,X),G=gG(G,X),G=await BG(G,X,Z,Q),G=await MJ(G,X,Z),G=await cG(G,X,Z,Q),G=$2(G,X,Z,Q),G=CY(G,X,Z,Q),G=PY(G,X,Z),G=vY(G,X,Z,Q),G=NG(G,X,Z,Q),G=w6(G,X),G=q6(G),G=VW(G),!Q.skipEventDirectives)G=I2(G,X,Z);if(G=UG(G,X,Z),Q.debug){let l=/\bx-data\s*=/.test(G),i=j$($);if(l&&i)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
15447
15447
  Both work on the same page, but they manage separate scopes.
15448
- Prefer signals (state/derived/effect) for new components.`)}G=oQ(G,X),G=await f1(G,X,Z),G=AW(G),G=RW(G),G=GG(G);let{processXElementDirectives:D}=await $0("stx/x-element",()=>Promise.resolve().then(() => gw));G=D(G);let b=X.__originalFilePath||Z,S=x7(X);if(G=await YX(G,Q,b,S),G=CG(G,X),G=await mQ(G,X,Z,Q),Q.media?.image?.autoSiblings){let l=Q.publicDir||"public",{rewriteImagesWithSiblings:p}=await $0("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (uw(),hw)));G=await p(G,{publicDir:l})}if(Q.seo?.enabled)G=xY(G,X,Q);let P=(l,p,U0=!0)=>{if(!p)return l;let l0=p.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),v0=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(l0&&v0){if(U0)l=l.replace(v0[0],l0[0]);if(p=p.replace(l0[0],"").trim(),!p)return l}if(/<\/head>/i.test(l))return l.replace(/<\/head>/i,`${p}
15448
+ Prefer signals (state/derived/effect) for new components.`)}G=oQ(G,X),G=await h1(G,X,Z),G=AW(G),G=RW(G),G=GG(G);let{processXElementDirectives:D}=await X0("stx/x-element",()=>Promise.resolve().then(() => gw));G=D(G);let b=X.__originalFilePath||Z,S=x7(X);if(G=await YX(G,Q,b,S),G=CG(G,X),G=await mQ(G,X,Z,Q),Q.media?.image?.autoSiblings){let l=Q.publicDir||"public",{rewriteImagesWithSiblings:i}=await X0("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (uw(),hw)));G=await i(G,{publicDir:l})}if(Q.seo?.enabled)G=xY(G,X,Q);let P=(l,i,z0=!0)=>{if(!i)return l;let c0=i.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),C0=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(c0&&C0){if(z0)l=l.replace(C0[0],c0[0]);if(i=i.replace(c0[0],"").trim(),!i)return l}if(/<\/head>/i.test(l))return l.replace(/<\/head>/i,`${i}
15449
15449
  </head>`);if(/<head\b[^>]*>/i.test(l))return l.replace(/(<head\b[^>]*>)/i,`$1
15450
- ${p}`);if(/<html\b[^>]*>/i.test(l))return l.replace(/(<html\b[^>]*>)/i,`$1
15450
+ ${i}`);if(/<html\b[^>]*>/i.test(l))return l.replace(/(<html\b[^>]*>)/i,`$1
15451
15451
  <head>
15452
- ${p}
15453
- </head>`);return l},{renderHead:v,getHead:x}=await $0("stx/head",()=>Promise.resolve().then(() => (f5(),I4))),m=X.__stx_runtime_head??x();if(m.title||m.meta?.length||m.link?.length){let l=v(m);if(l)G=P(G,l)}if(T.headContent)G=P(G,T.headContent,!m.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=AG(G,Q.csp,X);if(Q.analytics?.enabled)G=WG(G,Q);if(Q.heatmap?.enabled)G=z2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:l}=await $0("stx/pwa/inject",()=>Promise.resolve().then(() => (lw(),cw)));G=l(G,Q)}let R0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),w0=/\bSTX\.\w+/.test(G),C0=/window\.STX\s*=/.test(G);if(R0&&w0&&!C0){let p=`<script data-stx-scoped data-stx-run="once">
15452
+ ${i}
15453
+ </head>`);return l},{renderHead:x,getHead:f}=await X0("stx/head",()=>Promise.resolve().then(() => (x5(),I4))),m=X.__stx_runtime_head??f();if(m.title||m.meta?.length||m.link?.length){let l=x(m);if(l)G=P(G,l)}if(T.headContent)G=P(G,T.headContent,!m.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=AG(G,Q.csp,X);if(Q.analytics?.enabled)G=WG(G,Q);if(Q.heatmap?.enabled)G=z2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:l}=await X0("stx/pwa/inject",()=>Promise.resolve().then(() => (lw(),cw)));G=l(G,Q)}let A0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),K0=/\bSTX\.\w+/.test(G),b0=/window\.STX\s*=/.test(G);if(A0&&K0&&!b0){let i=`<script data-stx-scoped data-stx-run="once">
15454
15454
  ${XG()}
15455
- </script>`;if(G.includes("</head>")){let U0=G.indexOf("</head>"),v0=G.slice(0,U0).indexOf("<script");if(v0!==-1){let C=G.slice(0,v0),g=G.slice(v0);G=C+p+`
15456
- `+g}else G=G.replace("</head>",`${p}
15455
+ </script>`;if(G.includes("</head>")){let z0=G.indexOf("</head>"),C0=G.slice(0,z0).indexOf("<script");if(C0!==-1){let t0=G.slice(0,C0),C=G.slice(C0);G=t0+i+`
15456
+ `+C}else G=G.replace("</head>",`${i}
15457
15457
  </head>`)}else if(G.includes("<body"))G=G.replace(/<body([^>]*)>/,`<body$1>
15458
- ${p}`);else G=p+`
15459
- `+G}{let{scanScriptTags:l}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (n7(),B$))),p=[];for(let U0 of l(G)){if(!/\bserver\b/i.test(U0.attrs))continue;let l0=U0.start+U0.fullMatch.indexOf(">")+1,v0=YF(G,l0);if(v0===-1)continue;let C=v0+9;while(C<G.length&&/\s/.test(G[C]))C++;p.push({start:U0.start,end:C})}for(let U0=p.length-1;U0>=0;U0--){let{start:l0,end:v0}=p[U0];G=G.substring(0,l0)+G.substring(v0)}}let P0=l8(G,Z);if(P0.hasScoped)G=P0.html;let n=X.__stx_event_bindings||[],q0=!1,Y0=[],N0=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:M0}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (n7(),B$)));for(let l of M0(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Y0.push({match:l.fullMatch,attrs:l.attrs,content:l.body});for(let{match:l,attrs:p,content:U0}of Y0){q0=!0;let l0=U0;U6(U0,Z,J.strict,X.__originalFilePath);let v0=await f7(U0,{eventBindings:n,attrs:p,hasColonDirectives:N0,templateContent:$,filePath:Z,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:S});G=G.replace(l,()=>v0)}if(q0)X.__stx_event_bindings=[];if(!q0&&X.__stxProcessingDepth===1){let l=X.__stx_event_bindings||[];if(l.length>0){let p=Q4(l);if(p){let U0=G.lastIndexOf("</body>");G=U0===-1?G+p:G.slice(0,U0)+p+`
15460
- `+G.slice(U0)}X.__stx_event_bindings=[]}}if(!qJ(G)&&KJ(G))G=await w$(G,Q);if(G=zJ(G),Q.csp?.enabled&&Q.csp.useNonce&&typeof X.cspNonce==="string")G=RG(G,X.cspNonce);return G}var F5="<!--PARENT_CONTENT_PLACEHOLDER-->";var F$=y(()=>{X8();v4();x1();e9();ZG();QG();wG();Z4();$4();W4();g7();jG();HG();Z8();MG();IG();yG();PG();k1();f5();B1();hG();lG();PQ();gQ();o3();wX();cQ();x5();pQ();s$();V0();nQ();sQ();eQ();YW();N4();Y6();HW();n7();i3();FW();z6();j6();b0();L3();O4();S7();q$();q$();z6();j6()});import k0 from"fs";import G0 from"path";import I6 from"fs";import Wq from"path";var D9="resources/assets",E6="assets";function D6($=process.cwd()){let X=Wq.resolve($,D9);return I6.existsSync(X)&&I6.statSync(X).isDirectory()?X:null}import A5 from"fs";import y9 from"path";var w7="_stx";function wq($){return Bun.hash($).toString(16).slice(0,8)}function qq($){let X=[],Z=(J)=>{for(let Y of A5.readdirSync(J,{withFileTypes:!0})){let G=y9.join(J,Y.name);if(Y.isDirectory())Z(G);else if(Y.isFile()&&G.endsWith(".html"))X.push(G)}};if(A5.existsSync($))Z($);return X}var Kq=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-runtime src="${$}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-router src="${$}"></script>`},{pattern:/<style\b([^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"crosswind",extension:"css",contentType:"text/css; charset=utf-8",replace:($)=>`<link data-crosswind="generated" rel="stylesheet" href="${$}">`}];function zq($,X=`/${w7}`){let Z=[],J=new Set,Y=0,G=$;for(let Q of Kq)G=G.replace(Q.pattern,(W,w,q)=>{if(/\b(?:src|href)\s*=/.test(w)||!q.trim())return W;let K=`${Q.prefix}.${wq(q)}.${Q.extension}`;if(!J.has(K))J.add(K),Z.push({filename:K,contents:q,contentType:Q.contentType});return Y+=q.length,Q.replace(`${X}/${K}`)});return{html:G,assets:Z,bytesInlined:Y}}function y6($){let X={pages:0,assets:0,bytesInlined:0},Z=y9.join($,w7),J=new Set;for(let Y of qq($)){let G=A5.readFileSync(Y,"utf8"),{html:Q,assets:W,bytesInlined:w}=zq(G);if(Q===G)continue;for(let q of W){if(J.has(q.filename))continue;J.add(q.filename),A5.mkdirSync(Z,{recursive:!0}),A5.writeFileSync(y9.join(Z,q.filename),q.contents),X.assets++}A5.writeFileSync(Y,Q),X.bytesInlined+=w,X.pages++}return X}import R5 from"fs";import b9 from"path";var Uq=1024,jq=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,Bq=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function Hq($){return Bun.hash($).toString(16).slice(0,8)}function _q($){let X=[],Z=(J)=>{for(let Y of R5.readdirSync(J,{withFileTypes:!0})){let G=b9.join(J,Y.name);if(Y.isDirectory())Z(G);else if(Y.isFile()&&G.endsWith(".html"))X.push(G)}};if(R5.existsSync($))Z($);return X}function Oq($,X){let Z=$.match(new RegExp(`\\b${X}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!Z)return;return Z[2]??Z[3]??Z[4]??""}function Lq($,X,Z){if(Z.length<Uq)return!1;if(/\b(?:src|href)\s*=/i.test(X))return!1;if($.toLowerCase()==="script"){if(!Bq.has((Oq(X,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function Fq($){let X=[];for(let Z of $.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))X.push([Z.index,Z.index+Z[0].length]);return X}function b6($){let X={pages:0,assets:0,bytesInlined:0},Z=_q($);if(Z.length<2)return X;let J=new Map,Y=new Map;for(let K of Z){let z=R5.readFileSync(K,"utf8");J.set(K,z);let U=Fq(z);for(let j of z.matchAll(jq)){let[B,H,_,L]=j;if(!Lq(H,_,L))continue;if(U.some(([V,A])=>j.index>=V&&j.index<A))continue;let O=`${H.toLowerCase()}\x00${L}`,F=Y.get(O);if(F)F.push({file:K,whole:B,tag:H,attrs:_,body:L});else Y.set(O,[{file:K,whole:B,tag:H,attrs:_,body:L}])}}let G=[...Y.values()].filter((K)=>new Set(K.map((z)=>z.file)).size>1);if(G.length===0)return X;let Q=b9.join($,w7),W=new Map(J),w=new Map,q=[];for(let K of G){let{tag:z,body:U}=K[0],j=z.toLowerCase()==="script",B=`${j?"chunk":"style"}.${Hq(U)}.${j?"js":"css"}`;q.push({filename:B,contents:U,contentType:j?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let H=`/${w7}/${B}`;for(let _ of K){let L=j?`<script${_.attrs} src="${H}"></script>`:`<link${_.attrs} rel="stylesheet" href="${H}">`,O=W.get(_.file),F=O.replace(_.whole,()=>L);if(F===O)continue;W.set(_.file,F),w.set(_.file,(w.get(_.file)??0)+_.body.length)}}R5.mkdirSync(Q,{recursive:!0});for(let K of q)R5.writeFileSync(b9.join(Q,K.filename),K.contents),X.assets++;for(let[K,z]of W){if(z===J.get(K))continue;R5.writeFileSync(K,z),X.pages++,X.bytesInlined+=w.get(K)??0}return X}o9();F$();import{createHash as UF}from"crypto";function jF($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var BF=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function HF($){return Bun.hash($).toString(16)}function rw($,X={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Z=new Map,J=$.replace(BF,(G,Q,W,w)=>{let q=w.trim();if(!q)return G;if(/\bdata-stx-src=/.test(W))return G;if(X.minify)q=jF(q);let K=HF(q);if(!Z.has(K))Z.set(K,q);let z=X.integrity?` data-stx-integrity="sha384-${UF("sha384").update(q).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${Q}" data-stx-src="/_stx/islands/${K}.js"${z}${W}></script>`}),Y=Array.from(Z,([G,Q])=>({hash:G,code:Q}));return{html:J,chunks:Y}}var _F=new Set(["visible","idle"]);function ow($){if(!$.includes("data-stx-src="))return $;let X=new Map,Z=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Z.exec($))!==null)X.set(J[1],J[2]);let Y=new Set,G=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,Q;while((Q=G.exec($))!==null)if(_F.has(X.get(Q[1])||""))Y.add(Q[2]);let W=$.lastIndexOf("</head>");if(Y.size===0||W===-1)return $;let w=Array.from(Y).filter((q)=>!$.includes(`rel="prefetch" href="${q}"`)).map((q)=>`<link rel="prefetch" href="${q}" as="script">`).join("");if(!w)return $;return $.slice(0,W)+w+$.slice(W)}M1();import O8 from"fs";import I9 from"path";var OF="layout-types.d.ts";function LF($){let X=[],Z=(J,Y)=>{let G;try{G=O8.readdirSync(J,{withFileTypes:!0})}catch{return}for(let Q of G){if(Q.name.startsWith("."))continue;let W=I9.join(J,Q.name);if(Q.isDirectory())Z(W,Y?`${Y}/${Q.name}`:Q.name);else if(Q.isFile()&&Q.name.endsWith(".stx")&&Q.name!=="_layout.stx"){let w=Q.name.slice(0,-4);X.push(Y?`${Y}/${w}`:w)}}};return Z($,""),X.sort()}function FF($){let X=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if($.length===0)return X.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),X.join(`
15458
+ ${i}`);else G=i+`
15459
+ `+G}{let{scanScriptTags:l}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (n7(),B$))),i=[];for(let z0 of l(G)){if(!/\bserver\b/i.test(z0.attrs))continue;let c0=z0.start+z0.fullMatch.indexOf(">")+1,C0=YF(G,c0);if(C0===-1)continue;let t0=C0+9;while(t0<G.length&&/\s/.test(G[t0]))t0++;i.push({start:z0.start,end:t0})}for(let z0=i.length-1;z0>=0;z0--){let{start:c0,end:C0}=i[z0];G=G.substring(0,c0)+G.substring(C0)}}let S0=l8(G,Z);if(S0.hasScoped)G=S0.html;let r=X.__stx_event_bindings||[],Y0=!1,G0=[],R0=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:N0}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (n7(),B$)));for(let l of N0(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))G0.push({match:l.fullMatch,attrs:l.attrs,content:l.body});for(let{match:l,attrs:i,content:z0}of G0){Y0=!0;let c0=z0;U6(z0,Z,J.strict,X.__originalFilePath);let C0=await f7(z0,{eventBindings:r,attrs:i,hasColonDirectives:R0,templateContent:$,filePath:Z,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:S});G=G.replace(l,()=>C0)}if(Y0)X.__stx_event_bindings=[];if(!Y0&&X.__stxProcessingDepth===1){let l=X.__stx_event_bindings||[];if(l.length>0){let i=Q4(l);if(i){let z0=G.lastIndexOf("</body>");G=z0===-1?G+i:G.slice(0,z0)+i+`
15460
+ `+G.slice(z0)}X.__stx_event_bindings=[]}}if(!qJ(G)&&KJ(G))G=await w$(G,Q);if(G=zJ(G),Q.csp?.enabled&&Q.csp.useNonce&&typeof X.cspNonce==="string")G=RG(G,X.cspNonce);return G}var L5="<!--PARENT_CONTENT_PLACEHOLDER-->";var F$=y(()=>{X8();v4();g1();e9();ZG();QG();wG();Z4();$4();W4();g7();jG();HG();Z8();MG();IG();yG();PG();k1();x5();j1();hG();lG();PQ();gQ();o3();wX();cQ();v5();pQ();s$();F0();nQ();sQ();eQ();YW();N4();Y6();HW();n7();i3();FW();z6();j6();D0();L3();O4();S7();q$();q$();z6();j6()});import k0 from"fs";import Q0 from"path";import I6 from"fs";import Wq from"path";var D9="resources/assets",E6="assets";function D6($=process.cwd()){let X=Wq.resolve($,D9);return I6.existsSync(X)&&I6.statSync(X).isDirectory()?X:null}import V5 from"fs";import y9 from"path";var w7="_stx";function wq($){return Bun.hash($).toString(16).slice(0,8)}function qq($){let X=[],Z=(J)=>{for(let Y of V5.readdirSync(J,{withFileTypes:!0})){let G=y9.join(J,Y.name);if(Y.isDirectory())Z(G);else if(Y.isFile()&&G.endsWith(".html"))X.push(G)}};if(V5.existsSync($))Z($);return X}var Kq=[{pattern:/<script\b([^>]*\bdata-stx-runtime\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"runtime",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-runtime src="${$}"></script>`},{pattern:/<script\b([^>]*\bdata-stx-router\b[^>]*)>([\s\S]*?)<\/script>/gi,prefix:"router",extension:"js",contentType:"text/javascript; charset=utf-8",replace:($)=>`<script data-stx-router src="${$}"></script>`},{pattern:/<style\b([^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*)>([\s\S]*?)<\/style>/gi,prefix:"crosswind",extension:"css",contentType:"text/css; charset=utf-8",replace:($)=>`<link data-crosswind="generated" rel="stylesheet" href="${$}">`}];function zq($,X=`/${w7}`){let Z=[],J=new Set,Y=0,G=$;for(let Q of Kq)G=G.replace(Q.pattern,(W,w,q)=>{if(/\b(?:src|href)\s*=/.test(w)||!q.trim())return W;let K=`${Q.prefix}.${wq(q)}.${Q.extension}`;if(!J.has(K))J.add(K),Z.push({filename:K,contents:q,contentType:Q.contentType});return Y+=q.length,Q.replace(`${X}/${K}`)});return{html:G,assets:Z,bytesInlined:Y}}function y6($){let X={pages:0,assets:0,bytesInlined:0},Z=y9.join($,w7),J=new Set;for(let Y of qq($)){let G=V5.readFileSync(Y,"utf8"),{html:Q,assets:W,bytesInlined:w}=zq(G);if(Q===G)continue;for(let q of W){if(J.has(q.filename))continue;J.add(q.filename),V5.mkdirSync(Z,{recursive:!0}),V5.writeFileSync(y9.join(Z,q.filename),q.contents),X.assets++}V5.writeFileSync(Y,Q),X.bytesInlined+=w,X.pages++}return X}import A5 from"fs";import b9 from"path";var Uq=1024,jq=/<(script|style)\b([^>]*)>([\s\S]*?)<\/\1>/gi,Bq=new Set(["","module","text/javascript","application/javascript","module/javascript"]);function Hq($){return Bun.hash($).toString(16).slice(0,8)}function _q($){let X=[],Z=(J)=>{for(let Y of A5.readdirSync(J,{withFileTypes:!0})){let G=b9.join(J,Y.name);if(Y.isDirectory())Z(G);else if(Y.isFile()&&G.endsWith(".html"))X.push(G)}};if(A5.existsSync($))Z($);return X}function Oq($,X){let Z=$.match(new RegExp(`\\b${X}\\s*=\\s*("([^"]*)"|'([^']*)'|([^\\s>]+))`,"i"));if(!Z)return;return Z[2]??Z[3]??Z[4]??""}function Lq($,X,Z){if(Z.length<Uq)return!1;if(/\b(?:src|href)\s*=/i.test(X))return!1;if($.toLowerCase()==="script"){if(!Bq.has((Oq(X,"type")??"").trim().toLowerCase()))return!1;return!0}return!0}function Fq($){let X=[];for(let Z of $.matchAll(/<template\b[^>]*>[\s\S]*?<\/template>/gi))X.push([Z.index,Z.index+Z[0].length]);return X}function b6($){let X={pages:0,assets:0,bytesInlined:0},Z=_q($);if(Z.length<2)return X;let J=new Map,Y=new Map;for(let K of Z){let z=A5.readFileSync(K,"utf8");J.set(K,z);let U=Fq(z);for(let j of z.matchAll(jq)){let[B,H,_,L]=j;if(!Lq(H,_,L))continue;if(U.some(([V,A])=>j.index>=V&&j.index<A))continue;let O=`${H.toLowerCase()}\x00${L}`,F=Y.get(O);if(F)F.push({file:K,whole:B,tag:H,attrs:_,body:L});else Y.set(O,[{file:K,whole:B,tag:H,attrs:_,body:L}])}}let G=[...Y.values()].filter((K)=>new Set(K.map((z)=>z.file)).size>1);if(G.length===0)return X;let Q=b9.join($,w7),W=new Map(J),w=new Map,q=[];for(let K of G){let{tag:z,body:U}=K[0],j=z.toLowerCase()==="script",B=`${j?"chunk":"style"}.${Hq(U)}.${j?"js":"css"}`;q.push({filename:B,contents:U,contentType:j?"text/javascript; charset=utf-8":"text/css; charset=utf-8"});let H=`/${w7}/${B}`;for(let _ of K){let L=j?`<script${_.attrs} src="${H}"></script>`:`<link${_.attrs} rel="stylesheet" href="${H}">`,O=W.get(_.file),F=O.replace(_.whole,()=>L);if(F===O)continue;W.set(_.file,F),w.set(_.file,(w.get(_.file)??0)+_.body.length)}}A5.mkdirSync(Q,{recursive:!0});for(let K of q)A5.writeFileSync(b9.join(Q,K.filename),K.contents),X.assets++;for(let[K,z]of W){if(z===J.get(K))continue;A5.writeFileSync(K,z),X.pages++,X.bytesInlined+=w.get(K)??0}return X}o9();F$();import{createHash as UF}from"crypto";function jF($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var BF=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function HF($){return Bun.hash($).toString(16)}function rw($,X={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Z=new Map,J=$.replace(BF,(G,Q,W,w)=>{let q=w.trim();if(!q)return G;if(/\bdata-stx-src=/.test(W))return G;if(X.minify)q=jF(q);let K=HF(q);if(!Z.has(K))Z.set(K,q);let z=X.integrity?` data-stx-integrity="sha384-${UF("sha384").update(q).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${Q}" data-stx-src="/_stx/islands/${K}.js"${z}${W}></script>`}),Y=Array.from(Z,([G,Q])=>({hash:G,code:Q}));return{html:J,chunks:Y}}var _F=new Set(["visible","idle"]);function ow($){if(!$.includes("data-stx-src="))return $;let X=new Map,Z=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,J;while((J=Z.exec($))!==null)X.set(J[1],J[2]);let Y=new Set,G=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,Q;while((Q=G.exec($))!==null)if(_F.has(X.get(Q[1])||""))Y.add(Q[2]);let W=$.lastIndexOf("</head>");if(Y.size===0||W===-1)return $;let w=Array.from(Y).filter((q)=>!$.includes(`rel="prefetch" href="${q}"`)).map((q)=>`<link rel="prefetch" href="${q}" as="script">`).join("");if(!w)return $;return $.slice(0,W)+w+$.slice(W)}M1();import O8 from"fs";import I9 from"path";var OF="layout-types.d.ts";function LF($){let X=[],Z=(J,Y)=>{let G;try{G=O8.readdirSync(J,{withFileTypes:!0})}catch{return}for(let Q of G){if(Q.name.startsWith("."))continue;let W=I9.join(J,Q.name);if(Q.isDirectory())Z(W,Y?`${Y}/${Q.name}`:Q.name);else if(Q.isFile()&&Q.name.endsWith(".stx")&&Q.name!=="_layout.stx"){let w=Q.name.slice(0,-4);X.push(Y?`${Y}/${w}`:w)}}};return Z($,""),X.sort()}function FF($){let X=["// Auto-generated by stx \u2014 do not edit.","//","// Makes `definePageMeta({ layout })` reject a name with no layout behind it.","// Include this file in your tsconfig (it lives in the stx state directory,","// `.stx/` by default) for the check to apply.",""];if($.length===0)return X.push("// No layouts found \u2014 `layout` stays typed as `string`.","export {}",""),X.join(`
15461
15461
  `);return X.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...$.map((Z)=>` '${Z}': true`)," }","}","","export {}",""),X.join(`
15462
15462
  `)}function sw($,X){if(!$)return[];let Z=I9.isAbsolute($)?$:I9.resolve(process.cwd(),$),J=LF(Z),Y=FF(J),G=I9.join(X,OF);try{if(O8.existsSync(G)&&O8.readFileSync(G,"utf8")===Y)return J;O8.mkdirSync(X,{recursive:!0}),O8.writeFileSync(G,Y)}catch{}return J}var VF=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function M6($){let X=$.trim();if(!X)return null;let Z=/^https?:\/\//i.test(X)?X:`https://${X}`;try{return new URL(Z).origin+new URL(Z).pathname.replace(/\/$/,"")}catch{return null}}function AF($){for(let X of VF){let Z=$[X];if(!Z)continue;let J=M6(Z);if(J)return{url:J,source:"env",via:X}}return null}function aw($){if(!$||typeof $!=="object")return null;let X=$,Z=X.site?.url??X.url??X.app?.url;return typeof Z==="string"?M6(Z):null}async function RF($){let{existsSync:X}=await import("fs"),Z=await import("path");for(let J of["site.config.ts","site.config.js",".config/site.config.ts"]){let Y=Z.resolve($,J);if(!X(Y))continue;try{let G=await import(Y),Q=aw(G.default??G);if(Q)return Q}catch{}}return null}async function tw($={}){let X=$.cwd??process.cwd(),Z=$.env??process.env;if($.explicit){let Q=M6($.explicit);if(Q)return{url:Q,source:"option"}}let J=aw($.stxConfig);if(J)return{url:J,source:"stx.config",via:"site.url"};let Y=await RF(X);if(Y)return{url:Y,source:"site.config",via:"url"};let G=AF(Z);if(G)return G;return{url:"http://localhost",source:"fallback"}}function ew(){return["No site URL configured \u2014 sitemap.xml and robots.txt will point at http://localhost."," Set one in stx.config.ts (site: { url: 'https://example.com' }), in site.config.ts,"," via --domain, or with SITE_URL in the build environment."].join(`
15463
- `)}s$();y7();X8();y5();S1();class $q{cacheDir;cache=new Map;loaded=!1;salt;constructor($,X=""){this.cacheDir=$,this.salt=X}async load(){if(this.loaded)return;let $=G0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let X=JSON.parse(await Bun.file($).text());for(let[Z,J]of Object.entries(X))this.cache.set(Z,J)}catch{}this.loaded=!0}async save(){await k0.promises.mkdir(this.cacheDir,{recursive:!0});let $=G0.join(this.cacheDir,"build-cache.json"),X={};for(let[Z,J]of this.cache)X[Z]=J;await Bun.write($,JSON.stringify(X))}getHash($,X){let Z=k0.statSync($),J=`${this.salt}|${$}:${Z.mtimeMs}`;for(let G of X)if(k0.existsSync(G)){let Q=k0.statSync(G);J+=`:${G}:${Q.mtimeMs}`}let Y=0;for(let G=0;G<J.length;G++){let Q=J.charCodeAt(G);Y=(Y<<5)-Y+Q,Y=Y&Y}return Math.abs(Y).toString(36)}get($,X){let Z=this.cache.get($);if(!Z)return null;let J=this.getHash(X,Z.dependencies??[]);if(Z.hash!==J)return this.cache.delete($),null;return Z.html}set($,X,Z,J){let Y=this.getHash(X,Z);this.cache.set($,{hash:Y,html:J,generatedAt:Date.now(),dependencies:Z})}}class Xq{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let X=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return G0.join(this.cacheDir,"isr",X)}async get($){let X=this.getFilePath($);if(!await Bun.file(X).exists())return null;try{return JSON.parse(await Bun.file(X).text())}catch{return null}}async set($,X){let Z=this.getFilePath($);await k0.promises.mkdir(G0.dirname(Z),{recursive:!0}),await Bun.write(Z,JSON.stringify(X))}async invalidate($){let X=this.getFilePath($);if(await Bun.file(X).exists())await k0.promises.unlink(X)}async invalidatePattern($){let X=G0.join(this.cacheDir,"isr");if(!k0.existsSync(X))return;let Z=await k0.promises.readdir(X);for(let J of Z){let Y=J.replace(/_/g,"/").replace(".json","");if($.test(Y))await k0.promises.unlink(G0.join(X,J))}}async needsRevalidation($){let X=await this.get($);if(!X)return!0;return Date.now()>X.revalidateAfter}}async function NF($){try{let Z=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Z)return null;let J=Z[1];if(!J.includes("getStaticPaths"))return null;let Y=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!Y)return null;return await Function(`
15463
+ `)}s$();y7();X8();D5();P1();class $q{cacheDir;cache=new Map;loaded=!1;salt;constructor($,X=""){this.cacheDir=$,this.salt=X}async load(){if(this.loaded)return;let $=Q0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let X=JSON.parse(await Bun.file($).text());for(let[Z,J]of Object.entries(X))this.cache.set(Z,J)}catch{}this.loaded=!0}async save(){await k0.promises.mkdir(this.cacheDir,{recursive:!0});let $=Q0.join(this.cacheDir,"build-cache.json"),X={};for(let[Z,J]of this.cache)X[Z]=J;await Bun.write($,JSON.stringify(X))}getHash($,X){let Z=k0.statSync($),J=`${this.salt}|${$}:${Z.mtimeMs}`;for(let G of X)if(k0.existsSync(G)){let Q=k0.statSync(G);J+=`:${G}:${Q.mtimeMs}`}let Y=0;for(let G=0;G<J.length;G++){let Q=J.charCodeAt(G);Y=(Y<<5)-Y+Q,Y=Y&Y}return Math.abs(Y).toString(36)}get($,X){let Z=this.cache.get($);if(!Z)return null;let J=this.getHash(X,Z.dependencies??[]);if(Z.hash!==J)return this.cache.delete($),null;return Z.html}set($,X,Z,J){let Y=this.getHash(X,Z);this.cache.set($,{hash:Y,html:J,generatedAt:Date.now(),dependencies:Z})}}class Xq{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let X=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return Q0.join(this.cacheDir,"isr",X)}async get($){let X=this.getFilePath($);if(!await Bun.file(X).exists())return null;try{return JSON.parse(await Bun.file(X).text())}catch{return null}}async set($,X){let Z=this.getFilePath($);await k0.promises.mkdir(Q0.dirname(Z),{recursive:!0}),await Bun.write(Z,JSON.stringify(X))}async invalidate($){let X=this.getFilePath($);if(await Bun.file(X).exists())await k0.promises.unlink(X)}async invalidatePattern($){let X=Q0.join(this.cacheDir,"isr");if(!k0.existsSync(X))return;let Z=await k0.promises.readdir(X);for(let J of Z){let Y=J.replace(/_/g,"/").replace(".json","");if($.test(Y))await k0.promises.unlink(Q0.join(X,J))}}async needsRevalidation($){let X=await this.get($);if(!X)return!0;return Date.now()>X.revalidateAfter}}async function NF($){try{let Z=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Z)return null;let J=Z[1];if(!J.includes("getStaticPaths"))return null;let Y=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!Y)return null;return await Function(`
15464
15464
  return (async function getStaticPaths() {
15465
15465
  ${Y[1]}
15466
15466
  })()
@@ -15468,8 +15468,8 @@ ${p}`);else G=p+`
15468
15468
  return (async function getStaticProps() {
15469
15469
  ${G[1]}
15470
15470
  })()
15471
- `)(X)}catch(G){return console.error(`Error executing getStaticProps in ${Z}:`,G),null}}function IF($){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test($)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test($)}async function Zq($,X,Z={},J,Y){let G=await Bun.file($.filePath).text(),Q=await TF($.filePath),W=await kF(G,X,$.filePath),w={...Q||{},...W||{},...Z,params:X,$route:{path:$.pattern,params:X}},q=new Set,K=[],z={...Y,...J.partialsDir?{partialsDir:J.partialsDir}:{},...J.componentsDir?{componentsDir:J.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(j)=>{K.push(`${G0.relative(process.cwd(),j.templatePath)}: ${j.message}
15472
- resolved against partialsDir: ${j.partialsDir}`)}};if(IF(G))console.warn(`Warning: ${$.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let U=await A0(G,w,$.filePath,z,q);if(Object.keys(X).length>0){let j=`<script>if(window.stx)window.stx._rp=${JSON.stringify(X)};else window.__stx_rp=${JSON.stringify(X)};</script>`;if(U.includes("</head>"))U=U.replace("</head>",`${j}
15471
+ `)(X)}catch(G){return console.error(`Error executing getStaticProps in ${Z}:`,G),null}}function IF($){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test($)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test($)}async function Zq($,X,Z={},J,Y){let G=await Bun.file($.filePath).text(),Q=await TF($.filePath),W=await kF(G,X,$.filePath),w={...Q||{},...W||{},...Z,params:X,$route:{path:$.pattern,params:X}},q=new Set,K=[],z={...Y,...J.partialsDir?{partialsDir:J.partialsDir}:{},...J.componentsDir?{componentsDir:J.componentsDir}:{},debug:!1,cache:!1,autoShell:!0,onIncludeError:(j)=>{K.push(`${Q0.relative(process.cwd(),j.templatePath)}: ${j.message}
15472
+ resolved against partialsDir: ${j.partialsDir}`)}};if(IF(G))console.warn(`Warning: ${$.pattern} exports a page action, which cannot run in a static build. Its form will submit to a file. Serve this route with the production server, or point the form's action at a route handler.`);let U=await V0(G,w,$.filePath,z,q);if(Object.keys(X).length>0){let j=`<script>if(window.stx)window.stx._rp=${JSON.stringify(X)};else window.__stx_rp=${JSON.stringify(X)};</script>`;if(U.includes("</head>"))U=U.replace("</head>",`${j}
15473
15473
  </head>`);else U=`${j}
15474
15474
  ${U}`}if(U=await t4(U,{router:J.router}),U=await $8(U),J.minify!==!1)return{html:EF(U),dependencies:Array.from(q),includeFailures:K};return{html:U,dependencies:Array.from(q),includeFailures:K}}function EF($){let X=[],Z=0,J=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,Y;while((Y=J.exec($))!==null){let Q=$.slice(Z,Y.index);X.push(Q.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let W=Y[1],w=Y[2],q=Y[3];w=w.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),X.push(W+w+q),Z=Y.index+Y[0].length}let G=$.slice(Z);return X.push(G.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><")),X.join("").trim()}function DF($){let X=0;for(let Z=0;Z<$.length;Z++){let J=$.charCodeAt(Z);X=(X<<5)-X+J,X=X&X}return`"${Math.abs(X).toString(36)}"`}function yF($,X,Z,J){if(Z?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(X))return!0;return J.some((Y)=>{if(Y instanceof RegExp)return Y.test($);return Y.endsWith("/")?$===Y.slice(0,-1)||$.startsWith(Y):$===Y})}function bF($,X){return`<?xml version="1.0" encoding="UTF-8"?>
15475
15475
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
@@ -15501,15 +15501,15 @@ ${$.map((J)=>{let Y=new URL(J.loc,X).href,G=` <url>
15501
15501
  ${Z.join(`
15502
15502
  `)}
15503
15503
  </channel>
15504
- </rss>`}async function CF($={}){let X=Date.now();H4();let Z=await Y1(process.cwd()),J=Z.build||{},Y=await tw({explicit:$.domain||J.domain,stxConfig:Z});if(Y.source==="fallback"&&($.sitemap??J.sitemap??!0))console.warn(ew());let G={pagesDir:$.pagesDir||J.pagesDir||"pages",outputDir:$.outputDir||J.outputDir||"dist",baseUrl:$.baseUrl||J.baseUrl||"/",domain:Y.url,revalidate:$.revalidate??J.revalidate??!1,sitemap:$.sitemap??J.sitemap??!0,sitemapExclude:$.sitemapExclude||J.sitemapExclude||[],robots:$.robots??J.robots??!0,rss:$.rss??J.rss??!1,concurrency:$.concurrency||J.concurrency||10,cache:$.cache??J.cache??!0,cacheDir:$.cacheDir||J.cacheDir||A1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??J.minify??!0,generate404:$.generate404??J.generate404??!0,publicDir:$.publicDir||J.publicDir||"public",trailingSlash:$.trailingSlash??J.trailingSlash??!1,cleanOutput:$.cleanOutput??J.cleanOutput??!0,cacheSalt:$.cacheSalt??"",partialsDir:$.partialsDir||Z?.partialsDir||"",componentsDir:$.componentsDir||Z?.componentsDir||"",failOnIncludeError:$.failOnIncludeError??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},Q={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},W=new Set,w=0,q={},K={};await G.hooks.onBuildStart?.();try{if(G.cleanOutput&&k0.existsSync(G.outputDir))await k0.promises.rm(G.outputDir,{recursive:!0});await k0.promises.mkdir(G.outputDir,{recursive:!0});let U=G.cacheSalt;if(!U){let{resolveUserCrosswindConfig:M,fingerprintConfig:E}=await Promise.resolve().then(() => (X8(),aX));try{U=E(await M(process.cwd()))}catch{}}let j=new $q(G.cacheDir,U);if(G.cache)await j.load();try{let{generateCrosswindCSS:M}=await Promise.resolve().then(() => (X8(),aX));await M('<div class="bg-black"></div>')}catch{}L7();let B=Z?.routeMiddleware?.dir||"middleware";await V7(process.cwd(),B);let H=F7();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let _=Z?.routeMiddleware?.global||[];sw(Z?.layoutsDir,A1(process.cwd()));let L=k7(".",{pagesDir:G.pagesDir});console.log(`Found ${L.length} routes`);let O=[];for(let M of L){let E=await MF(M);for(let T of E)O.push({route:M,url:T.url,params:T.params,props:T.props,revalidate:T.revalidate??G.revalidate})}Q.totalPages=O.length,console.log(`Generating ${Q.totalPages} pages...`);let F=[],V=[];for(let M=0;M<O.length;M+=G.concurrency)V.push(O.slice(M,M+G.concurrency));for(let M of V)await Promise.all(M.map(async(E)=>{let{route:T,url:D,params:b,props:S,revalidate:P}=E;try{await G.hooks.onPageStart?.(D);let v=await Bun.file(T.filePath).text(),x=fF(v),i=x?.middleware?Array.isArray(x.middleware)?x.middleware:[x.middleware]:[],m=[..._,...i];if(m.length>0){let q0=A7(D,b,x||{}),Y0=R7(q0,null,void 0,{isServer:!0}),N0=await N7(m,Y0);if(N0.redirect){let M0=typeof N0.redirect==="string"?N0.redirect:N0.redirect.path||N0.redirect,l=gF(String(M0),D),p=hF(D,G);await k0.promises.mkdir(G0.dirname(p),{recursive:!0}),await Bun.write(p,l),Q.successCount++,Q.pages.push({route:D,outputPath:p,size:Buffer.byteLength(l),cached:!1}),F.push({loc:D,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${D} \u2192 redirect to ${M0}`);return}if(N0.abort){let M0=typeof N0.abort==="string"?N0.abort:N0.abort?.error?.message||"aborted";console.warn(` \u21B3 ${D} \u2014 middleware aborted: ${M0}`);return}}let R0=v.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(R0)try{if(!await Function("route",`
15505
- const validate = ${R0[1]};
15504
+ </rss>`}async function CF($={}){let X=Date.now();H4();let Z=await Y1(process.cwd()),J=Z.build||{},Y=await tw({explicit:$.domain||J.domain,stxConfig:Z});if(Y.source==="fallback"&&($.sitemap??J.sitemap??!0))console.warn(ew());let G={pagesDir:$.pagesDir||J.pagesDir||"pages",outputDir:$.outputDir||J.outputDir||"dist",baseUrl:$.baseUrl||J.baseUrl||"/",domain:Y.url,revalidate:$.revalidate??J.revalidate??!1,sitemap:$.sitemap??J.sitemap??!0,sitemapExclude:$.sitemapExclude||J.sitemapExclude||[],robots:$.robots??J.robots??!0,rss:$.rss??J.rss??!1,concurrency:$.concurrency||J.concurrency||10,cache:$.cache??J.cache??!0,cacheDir:$.cacheDir||J.cacheDir||A1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??J.minify??!0,generate404:$.generate404??J.generate404??!0,publicDir:$.publicDir||J.publicDir||"public",trailingSlash:$.trailingSlash??J.trailingSlash??!1,cleanOutput:$.cleanOutput??J.cleanOutput??!0,cacheSalt:$.cacheSalt??"",partialsDir:$.partialsDir||Z?.partialsDir||"",componentsDir:$.componentsDir||Z?.componentsDir||"",failOnIncludeError:$.failOnIncludeError??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},Q={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},W=new Set,w=0,q={},K={};await G.hooks.onBuildStart?.();try{if(G.cleanOutput&&k0.existsSync(G.outputDir))await k0.promises.rm(G.outputDir,{recursive:!0});await k0.promises.mkdir(G.outputDir,{recursive:!0});let U=G.cacheSalt;if(!U){let{resolveUserCrosswindConfig:M,fingerprintConfig:E}=await Promise.resolve().then(() => (X8(),aX));try{U=E(await M(process.cwd()))}catch{}}let j=new $q(G.cacheDir,U);if(G.cache)await j.load();try{let{generateCrosswindCSS:M}=await Promise.resolve().then(() => (X8(),aX));await M('<div class="bg-black"></div>')}catch{}L7();let B=Z?.routeMiddleware?.dir||"middleware";await V7(process.cwd(),B);let H=F7();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let _=Z?.routeMiddleware?.global||[];sw(Z?.layoutsDir,A1(process.cwd()));let L=k7(".",{pagesDir:G.pagesDir});console.log(`Found ${L.length} routes`);let O=[];for(let M of L){let E=await MF(M);for(let T of E)O.push({route:M,url:T.url,params:T.params,props:T.props,revalidate:T.revalidate??G.revalidate})}Q.totalPages=O.length,console.log(`Generating ${Q.totalPages} pages...`);let F=[],V=[];for(let M=0;M<O.length;M+=G.concurrency)V.push(O.slice(M,M+G.concurrency));for(let M of V)await Promise.all(M.map(async(E)=>{let{route:T,url:D,params:b,props:S,revalidate:P}=E;try{await G.hooks.onPageStart?.(D);let x=await Bun.file(T.filePath).text(),f=fF(x),p=f?.middleware?Array.isArray(f.middleware)?f.middleware:[f.middleware]:[],m=[..._,...p];if(m.length>0){let Y0=A7(D,b,f||{}),G0=R7(Y0,null,void 0,{isServer:!0}),R0=await N7(m,G0);if(R0.redirect){let N0=typeof R0.redirect==="string"?R0.redirect:R0.redirect.path||R0.redirect,l=gF(String(N0),D),i=hF(D,G);await k0.promises.mkdir(Q0.dirname(i),{recursive:!0}),await Bun.write(i,l),Q.successCount++,Q.pages.push({route:D,outputPath:i,size:Buffer.byteLength(l),cached:!1}),F.push({loc:D,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${D} \u2192 redirect to ${N0}`);return}if(R0.abort){let N0=typeof R0.abort==="string"?R0.abort:R0.abort?.error?.message||"aborted";console.warn(` \u21B3 ${D} \u2014 middleware aborted: ${N0}`);return}}let A0=x.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(A0)try{if(!await Function("route",`
15505
+ const validate = ${A0[1]};
15506
15506
  return validate(route);
15507
- `)({params:b})){console.warn(`Validation failed for ${D}, skipping...`);return}}catch{}let w0=null,C0=!1;if(G.cache){if(w0=j.get(D,T.filePath),w0)C0=!0,Q.cachedCount++}if(!w0){let q0=await Zq(T,b,S,G,Z);if(w0=q0.html,G.failOnIncludeError&&q0.includeFailures.length>0)throw Error(`${q0.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
15508
- ${q0.includeFailures.join(`
15507
+ `)({params:b})){console.warn(`Validation failed for ${D}, skipping...`);return}}catch{}let K0=null,b0=!1;if(G.cache){if(K0=j.get(D,T.filePath),K0)b0=!0,Q.cachedCount++}if(!K0){let Y0=await Zq(T,b,S,G,Z);if(K0=Y0.html,G.failOnIncludeError&&Y0.includeFailures.length>0)throw Error(`${Y0.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
15508
+ ${Y0.includeFailures.join(`
15509
15509
  `)}
15510
- Set ssg.failOnIncludeError to false to build anyway.`);if(G.cache)j.set(D,T.filePath,q0.dependencies,w0)}let P0;if(G.trailingSlash)P0=G0.join(G.outputDir,D,"index.html");else P0=D==="/"?G0.join(G.outputDir,"index.html"):G0.join(G.outputDir,`${D}.html`);if(G.chunkIslands){let{html:q0,chunks:Y0}=rw(w0,{integrity:G.integrityIslands,minify:G.minify});if(Y0.length>0){let N0=G0.join(G.outputDir,"_stx","islands");await k0.promises.mkdir(N0,{recursive:!0});for(let M0 of Y0){let l=G0.join(N0,`${M0.hash}.js`);if(!await Bun.file(l).exists())await Bun.write(l,M0.code);if(!W.has(M0.hash)){W.add(M0.hash);let p=Buffer.byteLength(M0.code,"utf8");w+=p,q[M0.hash]={bytes:p,file:`/_stx/islands/${M0.hash}.js`}}}if(K[D]=Y0.map((M0)=>M0.hash),w0=q0,G.prefetchIslands)w0=ow(w0)}}if(await k0.promises.mkdir(G0.dirname(P0),{recursive:!0}),await Bun.write(P0,w0),!yF(D,w0,x,G.sitemapExclude))F.push({loc:D,lastmod:new Date().toISOString().split("T")[0],priority:D==="/"?1:0.8});let n={route:D,outputPath:P0,size:Buffer.byteLength(w0,"utf8"),cached:C0};if(P!==!1)n.revalidateAt=Date.now()+P*1000;Q.pages.push(n),Q.successCount++,await G.hooks.onPageEnd?.(D,w0)}catch(v){Q.failedCount++,Q.errors.push({route:D,error:v}),await G.hooks.onError?.(v,D),console.error(`Error generating ${D}:`,v)}}));let A=B4();if(A.length>0){let M=A.map((E)=>`${E.filePath}: ${E.message}`).join(`
15510
+ Set ssg.failOnIncludeError to false to build anyway.`);if(G.cache)j.set(D,T.filePath,Y0.dependencies,K0)}let S0;if(G.trailingSlash)S0=Q0.join(G.outputDir,D,"index.html");else S0=D==="/"?Q0.join(G.outputDir,"index.html"):Q0.join(G.outputDir,`${D}.html`);if(G.chunkIslands){let{html:Y0,chunks:G0}=rw(K0,{integrity:G.integrityIslands,minify:G.minify});if(G0.length>0){let R0=Q0.join(G.outputDir,"_stx","islands");await k0.promises.mkdir(R0,{recursive:!0});for(let N0 of G0){let l=Q0.join(R0,`${N0.hash}.js`);if(!await Bun.file(l).exists())await Bun.write(l,N0.code);if(!W.has(N0.hash)){W.add(N0.hash);let i=Buffer.byteLength(N0.code,"utf8");w+=i,q[N0.hash]={bytes:i,file:`/_stx/islands/${N0.hash}.js`}}}if(K[D]=G0.map((N0)=>N0.hash),K0=Y0,G.prefetchIslands)K0=ow(K0)}}if(await k0.promises.mkdir(Q0.dirname(S0),{recursive:!0}),await Bun.write(S0,K0),!yF(D,K0,f,G.sitemapExclude))F.push({loc:D,lastmod:new Date().toISOString().split("T")[0],priority:D==="/"?1:0.8});let r={route:D,outputPath:S0,size:Buffer.byteLength(K0,"utf8"),cached:b0};if(P!==!1)r.revalidateAt=Date.now()+P*1000;Q.pages.push(r),Q.successCount++,await G.hooks.onPageEnd?.(D,K0)}catch(x){Q.failedCount++,Q.errors.push({route:D,error:x}),await G.hooks.onError?.(x,D),console.error(`Error generating ${D}:`,x)}}));let A=B4();if(A.length>0){let M=A.map((E)=>`${E.filePath}: ${E.message}`).join(`
15511
15511
  `);throw Error(`Client script bundling failed:
15512
- ${M}`)}if(G.cache)await j.save();if(G.generate404){let M=G0.join(G.pagesDir,"404.stx");if(await Bun.file(M).exists()){let E=new Set,T={...Z,debug:!1,cache:!1},D=await A0(await Bun.file(M).text(),{},M,T,E);await Bun.write(G0.join(G.outputDir,"404.html"),D)}else await Bun.write(G0.join(G.outputDir,"404.html"),`<!DOCTYPE html>
15512
+ ${M}`)}if(G.cache)await j.save();if(G.generate404){let M=Q0.join(G.pagesDir,"404.stx");if(await Bun.file(M).exists()){let E=new Set,T={...Z,debug:!1,cache:!1},D=await V0(await Bun.file(M).text(),{},M,T,E);await Bun.write(Q0.join(G.outputDir,"404.html"),D)}else await Bun.write(Q0.join(G.outputDir,"404.html"),`<!DOCTYPE html>
15513
15513
  <html lang="en">
15514
15514
  <head>
15515
15515
  <meta charset="UTF-8">
@@ -15530,7 +15530,7 @@ ${M}`)}if(G.cache)await j.save();if(G.generate404){let M=G0.join(G.pagesDir,"404
15530
15530
  <a href="/">Go home</a>
15531
15531
  </div>
15532
15532
  </body>
15533
- </html>`)}for(let M of[500]){let E=G0.join(G.pagesDir,`${M}.stx`);if(await Bun.file(E).exists()){let T=new Set,D={...Z,debug:!1,cache:!1},b=await A0(await Bun.file(E).text(),{},E,D,T);await Bun.write(G0.join(G.outputDir,`${M}.html`),b)}}let R=G0.join(G.pagesDir,"error.stx");if(await Bun.file(R).exists()){let M=new Set,E={...Z,debug:!1,cache:!1},T=await A0(await Bun.file(R).text(),{},R,E,M);await Bun.write(G0.join(G.outputDir,"error.html"),T)}if(G.sitemap&&F.length>0){let M=bF(F,G.domain),E=G0.join(G.outputDir,"sitemap.xml");await Bun.write(E,M),Q.sitemapPath=E,console.log(`Generated sitemap.xml with ${F.length} URLs`)}if(G.robots!==!1){let M=typeof G.robots==="object"?G.robots:{},E=[...G.sitemapExclude.filter((D)=>typeof D==="string"),...M.disallow||[]],T=hY({rules:[{userAgent:M.userAgent||"*",allow:M.allow||["/"],...E.length>0?{disallow:E}:{}}],...M.sitemap!==!1&&Q.sitemapPath?{sitemap:new URL("/sitemap.xml",G.domain).href}:{}});await Bun.write(G0.join(G.outputDir,"robots.txt"),T),console.log("Generated robots.txt")}if(G.rss){let M=typeof G.rss==="object"?G.rss:{title:"Site Feed",description:"Latest updates",link:G.domain},E=[];if(M.getItems)E=await M.getItems();let T=SF(M,E),D=G0.join(G.outputDir,"rss.xml");await Bun.write(D,T),Q.rssPath=D,console.log(`Generated rss.xml with ${E.length} items`)}let N=y6(G.outputDir);if(N.assets>0)console.log(`Externalized ${N.assets} asset(s) from ${N.pages} page(s) (${(N.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let k=b6(G.outputDir);if(k.assets>0)console.log(`Externalized ${k.assets} repeated asset(s) from ${k.pages} page(s) (${(k.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(G.publicDir&&k0.existsSync(G.publicDir))await T6(G.publicDir,G.outputDir),console.log(`Copied public assets from ${G.publicDir}`);let I=D6();if(I)await T6(I,G0.join(G.outputDir,E6)),console.log(`Copied assets from ${D9}`)}catch(U){throw await G.hooks.onError?.(U),U}if(Q.buildTime=Date.now()-X,W.size>0){Q.islandChunks={count:W.size,totalBytes:w};let U={generatedChunks:W.size,totalBytes:w,chunks:q,pages:K};await Bun.write(G0.join(G.outputDir,"_stx","islands-manifest.json"),JSON.stringify(U,null,2))}await G.hooks.onBuildEnd?.(Q);let z=Q.islandChunks?`
15533
+ </html>`)}for(let M of[500]){let E=Q0.join(G.pagesDir,`${M}.stx`);if(await Bun.file(E).exists()){let T=new Set,D={...Z,debug:!1,cache:!1},b=await V0(await Bun.file(E).text(),{},E,D,T);await Bun.write(Q0.join(G.outputDir,`${M}.html`),b)}}let R=Q0.join(G.pagesDir,"error.stx");if(await Bun.file(R).exists()){let M=new Set,E={...Z,debug:!1,cache:!1},T=await V0(await Bun.file(R).text(),{},R,E,M);await Bun.write(Q0.join(G.outputDir,"error.html"),T)}if(G.sitemap&&F.length>0){let M=bF(F,G.domain),E=Q0.join(G.outputDir,"sitemap.xml");await Bun.write(E,M),Q.sitemapPath=E,console.log(`Generated sitemap.xml with ${F.length} URLs`)}if(G.robots!==!1){let M=typeof G.robots==="object"?G.robots:{},E=[...G.sitemapExclude.filter((D)=>typeof D==="string"),...M.disallow||[]],T=hY({rules:[{userAgent:M.userAgent||"*",allow:M.allow||["/"],...E.length>0?{disallow:E}:{}}],...M.sitemap!==!1&&Q.sitemapPath?{sitemap:new URL("/sitemap.xml",G.domain).href}:{}});await Bun.write(Q0.join(G.outputDir,"robots.txt"),T),console.log("Generated robots.txt")}if(G.rss){let M=typeof G.rss==="object"?G.rss:{title:"Site Feed",description:"Latest updates",link:G.domain},E=[];if(M.getItems)E=await M.getItems();let T=SF(M,E),D=Q0.join(G.outputDir,"rss.xml");await Bun.write(D,T),Q.rssPath=D,console.log(`Generated rss.xml with ${E.length} items`)}let N=y6(G.outputDir);if(N.assets>0)console.log(`Externalized ${N.assets} asset(s) from ${N.pages} page(s) (${(N.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);let k=b6(G.outputDir);if(k.assets>0)console.log(`Externalized ${k.assets} repeated asset(s) from ${k.pages} page(s) (${(k.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(G.publicDir&&k0.existsSync(G.publicDir))await T6(G.publicDir,G.outputDir),console.log(`Copied public assets from ${G.publicDir}`);let I=D6();if(I)await T6(I,Q0.join(G.outputDir,E6)),console.log(`Copied assets from ${D9}`)}catch(U){throw await G.hooks.onError?.(U),U}if(Q.buildTime=Date.now()-X,W.size>0){Q.islandChunks={count:W.size,totalBytes:w};let U={generatedChunks:W.size,totalBytes:w,chunks:q,pages:K};await Bun.write(Q0.join(G.outputDir,"_stx","islands-manifest.json"),JSON.stringify(U,null,2))}await G.hooks.onBuildEnd?.(Q);let z=Q.islandChunks?`
15534
15534
  Island chunks: ${Q.islandChunks.count} (${(Q.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
15535
15535
  Build complete!
15536
15536
  Total: ${Q.totalPages} pages
@@ -15538,7 +15538,7 @@ Build complete!
15538
15538
  Cached: ${Q.cachedCount}
15539
15539
  Failed: ${Q.failedCount}
15540
15540
  Time: ${Q.buildTime}ms${z}
15541
- `),Q}async function T6($,X){await k0.promises.mkdir(X,{recursive:!0});let Z=await k0.promises.readdir($,{withFileTypes:!0});for(let J of Z){let Y=G0.join($,J.name),G=G0.join(X,J.name);if(J.isDirectory())await k0.promises.mkdir(G,{recursive:!0}),await T6(Y,G);else await k0.promises.copyFile(Y,G)}}function PF($={}){let X=$.cacheDir||A1(process.cwd(),"ssg-cache"),Z=new Xq(X),J=$.revalidate||3600;return{async get(Y){let G=await Z.get(Y);if(!G)return null;if(Date.now()>G.revalidateAfter)this.revalidate(Y).catch(console.error);return{html:G.html,headers:{"Cache-Control":`public, max-age=${J}, stale-while-revalidate=${J*2}`,ETag:G.etag,"X-ISR-Generated":new Date(G.generatedAt).toISOString(),...G.headers}}},async revalidate(Y){let Q=k7(".",{pagesDir:$.pagesDir||"pages"}).find((z)=>{return Y.match(z.regex)!==null});if(!Q){console.warn(`Route not found for revalidation: ${Y}`);return}let W=Y.match(Q.regex),w={};if(W)Q.params.forEach((z,U)=>{w[z]=W[U+1]});let q=await Y1(),{html:K}=await Zq(Q,w,{},$,q);await Z.set(Y,{html:K,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:DF(K)}),console.log(`Revalidated: ${Y}`)},async invalidate(Y){if(typeof Y==="string")await Z.invalidate(Y);else await Z.invalidatePattern(Y)}}}function vF($){return async()=>{return{paths:await $(),fallback:!1}}}function xF(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let X=await Bun.file($).text(),Z=X.match(/^---\n([\s\S]*?)\n---/),J={},Y=X;if(Z){let q=Z[1];Y=X.slice(Z[0].length).trim();for(let K of q.split(`
15541
+ `),Q}async function T6($,X){await k0.promises.mkdir(X,{recursive:!0});let Z=await k0.promises.readdir($,{withFileTypes:!0});for(let J of Z){let Y=Q0.join($,J.name),G=Q0.join(X,J.name);if(J.isDirectory())await k0.promises.mkdir(G,{recursive:!0}),await T6(Y,G);else await k0.promises.copyFile(Y,G)}}function PF($={}){let X=$.cacheDir||A1(process.cwd(),"ssg-cache"),Z=new Xq(X),J=$.revalidate||3600;return{async get(Y){let G=await Z.get(Y);if(!G)return null;if(Date.now()>G.revalidateAfter)this.revalidate(Y).catch(console.error);return{html:G.html,headers:{"Cache-Control":`public, max-age=${J}, stale-while-revalidate=${J*2}`,ETag:G.etag,"X-ISR-Generated":new Date(G.generatedAt).toISOString(),...G.headers}}},async revalidate(Y){let Q=k7(".",{pagesDir:$.pagesDir||"pages"}).find((z)=>{return Y.match(z.regex)!==null});if(!Q){console.warn(`Route not found for revalidation: ${Y}`);return}let W=Y.match(Q.regex),w={};if(W)Q.params.forEach((z,U)=>{w[z]=W[U+1]});let q=await Y1(),{html:K}=await Zq(Q,w,{},$,q);await Z.set(Y,{html:K,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:DF(K)}),console.log(`Revalidated: ${Y}`)},async invalidate(Y){if(typeof Y==="string")await Z.invalidate(Y);else await Z.invalidatePattern(Y)}}}function vF($){return async()=>{return{paths:await $(),fallback:!1}}}function xF(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let X=await Bun.file($).text(),Z=X.match(/^---\n([\s\S]*?)\n---/),J={},Y=X;if(Z){let q=Z[1];Y=X.slice(Z[0].length).trim();for(let K of q.split(`
15542
15542
  `)){let z=K.indexOf(":");if(z>0){let U=K.slice(0,z).trim(),j=K.slice(z+1).trim();if(j==="true")j=!0;else if(j==="false")j=!1;else if(/^\d+$/.test(j))j=parseInt(j,10);else if(/^\d+\.\d+$/.test(j))j=parseFloat(j);else if(j.startsWith("[")&&j.endsWith("]"))j=j.slice(1,-1).split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,""));J[U]=j}}}let G=Y.replace(/^### (.*$)/gim,"<h3>$1</h3>").replace(/^## (.*$)/gim,"<h2>$1</h2>").replace(/^# (.*$)/gim,"<h1>$1</h1>").replace(/\*\*(.*)\*\*/gim,"<strong>$1</strong>").replace(/\*(.*)\*/gim,"<em>$1</em>").replace(/`([^`]+)`/gim,"<code>$1</code>").replace(/\[([^\]]+)\]\(([^)]+)\)/gim,'<a href="$2">$1</a>').replace(/\n/gim,"<br>"),Q=[],W=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,w;while((w=W.exec(G))!==null){let q=parseInt(w[1],10),K=w[2],z=K.toLowerCase().replace(/[^a-z0-9]+/g,"-");Q.push({id:z,text:K,level:q})}return{content:G,data:J,toc:Q}}}}function fF($){return X9($)}function gF($,X){return`<!DOCTYPE html>
15543
15543
  <html>
15544
15544
  <head>
@@ -15551,4 +15551,4 @@ Build complete!
15551
15551
  <p>Redirecting to <a href="${$}">${$}</a>...</p>
15552
15552
  <script>window.location.replace('${$}')</script>
15553
15553
  </body>
15554
- </html>`}function hF($,X){if($==="/"||$==="")return G0.join(X.outputDir,"index.html");let Z=$.replace(/^\/|\/$/g,"");if(X.trailingSlash)return G0.join(X.outputDir,Z,"index.html");return G0.join(X.outputDir,`${Z}.html`)}var ry={generateStaticSite:CF,createISRHandler:PF,defineStaticPaths:vF,createMarkdownLoader:xF};export{yF as isExcludedFromSitemap,CF as generateStaticSite,vF as defineStaticPaths,ry as default,IF as declaresPageAction,xF as createMarkdownLoader,PF as createISRHandler};
15554
+ </html>`}function hF($,X){if($==="/"||$==="")return Q0.join(X.outputDir,"index.html");let Z=$.replace(/^\/|\/$/g,"");if(X.trailingSlash)return Q0.join(X.outputDir,Z,"index.html");return Q0.join(X.outputDir,`${Z}.html`)}var ry={generateStaticSite:CF,createISRHandler:PF,defineStaticPaths:vF,createMarkdownLoader:xF};export{yF as isExcludedFromSitemap,CF as generateStaticSite,vF as defineStaticPaths,ry as default,IF as declaresPageAction,xF as createMarkdownLoader,PF as createISRHandler};