@stacksjs/stx 0.2.189 → 0.2.190

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 tW=Object.defineProperty;var eW=($)=>$;function $q($,X){this[$]=eW.bind(null,X)}var t=($,X)=>{for(var Z in X)tW($,Z,{get:X[Z],enumerable:!0,configurable:!0,set:$q.bind(X,Z)})};var D=($,X)=>()=>($&&(X=$($=0)),X);var j0=import.meta.require;function y9($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>w7.includes(Z))}function W7($){return y9($.replace(/^\//,""))}var w7;var L8=D(()=>{w7=["components","layouts","partials","emails"]});import R5 from"fs";import q7 from"path";function K7($,X){let Z=$.filter((Q)=>!W7(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(`
2
+ var Xq=Object.defineProperty;var Zq=($)=>$;function Jq($,X){this[$]=Zq.bind(null,X)}var t=($,X)=>{for(var Z in X)Xq($,Z,{get:X[Z],enumerable:!0,configurable:!0,set:Jq.bind(X,Z)})};var D=($,X)=>()=>($&&(X=$($=0)),X);var j0=import.meta.require;function D9($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>w7.includes(Z))}function W7($){return D9($.replace(/^\//,""))}var w7;var F8=D(()=>{w7=["components","layouts","partials","emails"]});import R5 from"fs";import q7 from"path";function K7($,X){let Z=$.filter((Q)=>!W7(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
3
  `),G=q7.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 z7($,X,Z){let J=process.cwd(),Y=q7.relative(J,Z),G=$.filter((w)=>!W7(w.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${Y||"pages"}/`,"","export const routes = ["];for(let w of G){let W=q7.relative(J,w.filePath).replace(/\\/g,"/"),q=JSON.stringify(w.params),K=w.layout?`, layout: '${q7.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(q7.join(X,"routes.ts"),Q.join(`
4
- `))}var b9=D(()=>{L8()});import I6 from"path";function F8($,X){let J=I6.relative(X,$).replace(/\.(stx|md)$/,"");if(J=J.split(I6.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 U7($){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 V8($,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 E6($){let X=$.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return U7(X)}var S9=()=>{};import Qq from"fs";import C9 from"path";function A8($,X){let Z=[],J=C9.dirname($);while(J.startsWith(X)||J===X){let Y=C9.join(J,"_layout.stx");if(Qq.existsSync(Y))Z.unshift(Y);if(J===X)break;J=C9.dirname(J)}return Z}var P9=()=>{};import v9 from"fs";import N5 from"path";function D6($,X){let Z=[];if(!v9.existsSync($))return Z;let J=v9.readdirSync($,{withFileTypes:!0});for(let Y of J){let G=N5.join($,Y.name);if(Y.isDirectory()){if(Y.name.startsWith("."))continue;if(w7.includes(Y.name))continue;Z.push(...D6(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 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)=>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=D6(Q,J);for(let W of w){let q=F8(W,Q);if(Y.has(q))continue;Y.add(q);let{regex:K,params:z}=U7(q),U=X.layouts!==!1?A8(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");K7(this.routes,G),z7(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 y6($,X){return new T5($,X)}function x9($,X){let Z=[`${X}.stx`,"error.stx"];for(let J of Z){let Y=N5.join($,J);if(v9.existsSync(Y))return Y}return null}function f9($,X){return $.map((Z)=>{let J=N5.relative(X,Z.filePath),Y=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${J}${Y}`})}var b6=D(()=>{b9();S9();P9();L8()});function g9($){R8=$.replace(/\/$/,"")}function h9($,X,Z={}){M5[$]={path:X,name:$,params:Z}}function u9($){for(let[X,Z]of Object.entries($))if(typeof Z==="string")M5[X]={path:Z,name:X};else M5[X]={...Z,name:X}}function j7($,X={},Z=!1){let J=M5[$];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&&R8?`${R8}${G}`:G}function d9(){for(let $ of Object.keys(M5))delete M5[$];R8=""}var M5,R8="";var S6=D(()=>{M5={}});import C6 from"fs";import P6 from"path";function c9($,X={}){return{type:"redirect",path:$,options:{replace:X.replace??!1,external:X.external??!1,redirectCode:X.redirectCode??302}}}function l9($){return{type:"abort",error:typeof $==="string"?{statusCode:500,message:$}:$}}function p9($,X={}){return{handler:$,mode:X.mode??"universal"}}function m9($){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 N8($,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 T8($,X){let Z=$.headers.get("cookie")||"",J=m9(Z);return{get(Y){return J[Y]},set(Y,G,Q={}){J[Y]=G,X.append("Set-Cookie",N8(Y,G,Q))},delete(Y){delete J[Y],X.append("Set-Cookie",N8(Y,"",{expires:new Date(0),path:"/"}))},getAll(){return{...J}}}}function M8(){return{get($){if(typeof document>"u")return;return m9(document.cookie)[$]},set($,X,Z={}){if(typeof document>"u")return;document.cookie=N8($,X,Z)},delete($){if(typeof document>"u")return;document.cookie=N8($,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return m9(document.cookie)}}}function k8(){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 B7($,X){H7.set($,X)}function I8($){return H7.get($)}function i9($){return H7.has($)}function _7(){H7.clear()}function O7(){return Array.from(H7.keys())}async function L7($,X="middleware"){let Z=P6.resolve($,X);if(!C6.existsSync(Z))return;let J=C6.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=P6.join(Z,Y);try{let W=(await import(Q)).default;if(W&&typeof W.handler==="function")B7(G,W);else if(typeof W==="function")B7(G,{handler:W,mode:"universal"})}catch(w){console.warn(`Failed to load middleware '${G}' from ${Q}:`,w)}}}function wq($){let X={};if(!$)return X;let Z=new URLSearchParams($);for(let[J,Y]of Z)X[J]=Y;return X}function F7($,X,Z,J=""){return{path:$,params:X,query:wq(J),fullPath:J?`${$}?${J}`:$,meta:Z}}function V7($,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?T8(Z,Q):M8(),storage:k8(),state:{},request:Z,responseHeaders:Q}}async function A7($,X){let Z=Array.isArray($)?$:[$],J=X.isServer;for(let Y of Z){let G=I8(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 H7;var v6=D(()=>{H7=new Map});function R7($){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 x6($){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]||R7(Y)}}function Wq($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function N7(){if(E8)return E8;return E8=Wq(`
4
+ `))}var y9=D(()=>{F8()});import D6 from"path";function V8($,X){let J=D6.relative(X,$).replace(/\.(stx|md)$/,"");if(J=J.split(D6.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 U7($){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 A8($,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 y6($){let X=$.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return U7(X)}var b9=()=>{};import qq from"fs";import S9 from"path";function R8($,X){let Z=[],J=S9.dirname($);while(J.startsWith(X)||J===X){let Y=S9.join(J,"_layout.stx");if(qq.existsSync(Y))Z.unshift(Y);if(J===X)break;J=S9.dirname(J)}return Z}var C9=()=>{};import P9 from"fs";import N5 from"path";function b6($,X){let Z=[];if(!P9.existsSync($))return Z;let J=P9.readdirSync($,{withFileTypes:!0});for(let Y of J){let G=N5.join($,Y.name);if(Y.isDirectory()){if(Y.name.startsWith("."))continue;if(w7.includes(Y.name))continue;Z.push(...b6(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 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)=>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=b6(Q,J);for(let W of w){let q=V8(W,Q);if(Y.has(q))continue;Y.add(q);let{regex:K,params:z}=U7(q),U=X.layouts!==!1?R8(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");K7(this.routes,G),z7(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 S6($,X){return new T5($,X)}function v9($,X){let Z=[`${X}.stx`,"error.stx"];for(let J of Z){let Y=N5.join($,J);if(P9.existsSync(Y))return Y}return null}function x9($,X){return $.map((Z)=>{let J=N5.relative(X,Z.filePath),Y=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${J}${Y}`})}var C6=D(()=>{y9();b9();C9();F8()});function f9($){N8=$.replace(/\/$/,"")}function g9($,X,Z={}){M5[$]={path:X,name:$,params:Z}}function h9($){for(let[X,Z]of Object.entries($))if(typeof Z==="string")M5[X]={path:Z,name:X};else M5[X]={...Z,name:X}}function j7($,X={},Z=!1){let J=M5[$];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&&N8?`${N8}${G}`:G}function u9(){for(let $ of Object.keys(M5))delete M5[$];N8=""}var M5,N8="";var P6=D(()=>{M5={}});import v6 from"fs";import x6 from"path";function m9($,X={}){return{type:"redirect",path:$,options:{replace:X.replace??!1,external:X.external??!1,redirectCode:X.redirectCode??302}}}function c9($){return{type:"abort",error:typeof $==="string"?{statusCode:500,message:$}:$}}function l9($,X={}){return{handler:$,mode:X.mode??"universal"}}function d9($){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 T8($,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 M8($,X){let Z=$.headers.get("cookie")||"",J=d9(Z);return{get(Y){return J[Y]},set(Y,G,Q={}){J[Y]=G,X.append("Set-Cookie",T8(Y,G,Q))},delete(Y){delete J[Y],X.append("Set-Cookie",T8(Y,"",{expires:new Date(0),path:"/"}))},getAll(){return{...J}}}}function k8(){return{get($){if(typeof document>"u")return;return d9(document.cookie)[$]},set($,X,Z={}){if(typeof document>"u")return;document.cookie=T8($,X,Z)},delete($){if(typeof document>"u")return;document.cookie=T8($,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return d9(document.cookie)}}}function I8(){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 B7($,X){H7.set($,X)}function E8($){return H7.get($)}function p9($){return H7.has($)}function _7(){H7.clear()}function O7(){return Array.from(H7.keys())}async function L7($,X="middleware"){let Z=x6.resolve($,X);if(!v6.existsSync(Z))return;let J=v6.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=x6.join(Z,Y);try{let W=(await import(Q)).default;if(W&&typeof W.handler==="function")B7(G,W);else if(typeof W==="function")B7(G,{handler:W,mode:"universal"})}catch(w){console.warn(`Failed to load middleware '${G}' from ${Q}:`,w)}}}function Kq($){let X={};if(!$)return X;let Z=new URLSearchParams($);for(let[J,Y]of Z)X[J]=Y;return X}function F7($,X,Z,J=""){return{path:$,params:X,query:Kq(J),fullPath:J?`${$}?${J}`:$,meta:Z}}function V7($,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?M8(Z,Q):k8(),storage:I8(),state:{},request:Z,responseHeaders:Q}}async function A7($,X){let Z=Array.isArray($)?$:[$],J=X.isServer;for(let Y of Z){let G=E8(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 H7;var f6=D(()=>{H7=new Map});function R7($){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 g6($){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]||R7(Y)}}function zq($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function N7(){if(D8)return D8;return D8=zq(`
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
- `),E8}var E8;var f6={};t(f6,{setAppUrl:()=>g9,runMiddleware:()=>A7,route:()=>j7,resolveLayoutChain:()=>A8,resetRoutes:()=>d9,registerMiddleware:()=>B7,patternToRegex:()=>U7,navigateTo:()=>c9,matchRoute:()=>V8,loadMiddlewareFromDirectory:()=>L7,isNonPageRoutePattern:()=>W7,isNonPageRoutePath:()=>y9,hasMiddleware:()=>i9,getRouterScript:()=>N7,getMiddlewareNames:()=>O7,getMiddleware:()=>I8,generateRouteTypes:()=>K7,generateRouteManifest:()=>z7,formatRoutes:()=>f9,findErrorPage:()=>x9,filePathToPattern:()=>F8,extractLayoutMetadata:()=>x6,deriveLayoutGroup:()=>R7,defineRoutes:()=>u9,defineRoute:()=>h9,defineMiddleware:()=>p9,createStorageManager:()=>k8,createServerCookieManager:()=>T8,createRouter:()=>y6,createRouteLocation:()=>F7,createMiddlewareContext:()=>V7,createClientCookieManager:()=>M8,clearMiddleware:()=>_7,bracketPathToRegex:()=>E6,abortNavigation:()=>l9,Router:()=>T5,NON_PAGE_DIRS:()=>w7});var S1=D(()=>{b6();S9();S6();v6();P9();b9();L8()});function T7($,X={}){return new T5($,X).routes}var n9=D(()=>{S1();S1()});function r9($){return`--stx-${$}`}function o9($,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 h6($){let X={};for(let[Z,J]of Object.entries(g6)){let Y=o9($,J.light);if(Y===void 0)continue;X[Z]=`var(${r9(Z)}, ${Y})`}return X}function u6($){let X=[],Z=[];for(let[J,Y]of Object.entries(g6)){let G=o9($,Y.light),Q=o9($,Y.dark);if(G===void 0)continue;if(X.push(` ${r9(J)}: ${G};`),Q!==void 0)Z.push(` ${r9(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 g6;var d6=D(()=>{g6={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 m6($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function s9($,X){let Z={...$};for(let[J,Y]of Object.entries(X))Z[J]=m6(Y)&&m6(Z[J])?s9(Z[J],Y):Y;return Z}function c6($={},X={}){let Z=$.theme||{},J=X.theme||{},{extend:Y,...G}=J,{extend:Q,...w}=Z,W=w.colors||{};w.colors={...W,...h6(W)};let q=s9(w,G),K=s9(Q||{},Y||{});if(Object.keys(K).length>0)q.extend=K;let z=[...$.safelist||[],...X.safelist||[]],U={...$.shortcuts||{},...X.shortcuts||{}},B=[...$.preflights||[],...X.preflights||[]];return{config:{...$,...X,theme:q,safelist:z,shortcuts:U,...B.length>0?{preflights:B}:{},content:[],output:""},safelist:z,shortcuts:U,includePreflight:X.preflight!==!1,minify:X.minify===!0,tokenCSS:u6(W)}}var l6=D(()=>{d6()});import M7 from"path";function i6($){p6=$?.trim()||null}function k7(){return process.env[qq]?.trim()||p6||k5}function V1($=process.cwd(),...X){let Z=k7();return M7.isAbsolute(Z)?M7.join(Z,...X):M7.join($,Z,...X)}function I7($){if(!$||M7.isAbsolute($))return $;let X=$.replace(/\\/g,"/");if(X!==k5&&!X.startsWith(`${k5}/`))return $;let Z=X.slice(k5.length+1);return Z?M7.join(k7(),Z):k7()}var k5=".stx",qq="STX_DIR",p6=null;var E7=()=>{};var L0;var n6=D(()=>{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 r6=()=>{};function o6($,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 s6,a6;var a9=D(()=>{r6();s6={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},a6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function Kq($,X={}){let{duration:Z,delay:J,ease:Y,direction:G,custom:Q}={...A1,...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
+ `),D8}var D8;var h6={};t(h6,{setAppUrl:()=>f9,runMiddleware:()=>A7,route:()=>j7,resolveLayoutChain:()=>R8,resetRoutes:()=>u9,registerMiddleware:()=>B7,patternToRegex:()=>U7,navigateTo:()=>m9,matchRoute:()=>A8,loadMiddlewareFromDirectory:()=>L7,isNonPageRoutePattern:()=>W7,isNonPageRoutePath:()=>D9,hasMiddleware:()=>p9,getRouterScript:()=>N7,getMiddlewareNames:()=>O7,getMiddleware:()=>E8,generateRouteTypes:()=>K7,generateRouteManifest:()=>z7,formatRoutes:()=>x9,findErrorPage:()=>v9,filePathToPattern:()=>V8,extractLayoutMetadata:()=>g6,deriveLayoutGroup:()=>R7,defineRoutes:()=>h9,defineRoute:()=>g9,defineMiddleware:()=>l9,createStorageManager:()=>I8,createServerCookieManager:()=>M8,createRouter:()=>S6,createRouteLocation:()=>F7,createMiddlewareContext:()=>V7,createClientCookieManager:()=>k8,clearMiddleware:()=>_7,bracketPathToRegex:()=>y6,abortNavigation:()=>c9,Router:()=>T5,NON_PAGE_DIRS:()=>w7});var S1=D(()=>{C6();b9();P6();f6();C9();y9();F8()});function T7($,X={}){return new T5($,X).routes}var i9=D(()=>{S1();S1()});function n9($){return`--stx-${$}`}function r9($,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 d6($){let X={};for(let[Z,J]of Object.entries(u6)){let Y=r9($,J.light);if(Y===void 0)continue;X[Z]=`var(${n9(Z)}, ${Y})`}return X}function m6($){let X=[],Z=[];for(let[J,Y]of Object.entries(u6)){let G=r9($,Y.light),Q=r9($,Y.dark);if(G===void 0)continue;if(X.push(` ${n9(J)}: ${G};`),Q!==void 0)Z.push(` ${n9(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 u6;var c6=D(()=>{u6={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 l6($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function o9($,X){let Z={...$};for(let[J,Y]of Object.entries(X))Z[J]=l6(Y)&&l6(Z[J])?o9(Z[J],Y):Y;return Z}function p6($={},X={}){let Z=$.theme||{},J=X.theme||{},{extend:Y,...G}=J,{extend:Q,...w}=Z,W=w.colors||{};w.colors={...W,...d6(W)};let q=o9(w,G),K=o9(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:m6(W)}}var i6=D(()=>{c6()});import M7 from"path";function r6($){n6=$?.trim()||null}function k7(){return process.env[Uq]?.trim()||n6||k5}function A1($=process.cwd(),...X){let Z=k7();return M7.isAbsolute(Z)?M7.join(Z,...X):M7.join($,Z,...X)}function I7($){if(!$||M7.isAbsolute($))return $;let X=$.replace(/\\/g,"/");if(X!==k5&&!X.startsWith(`${k5}/`))return $;let Z=X.slice(k5.length+1);return Z?M7.join(k7(),Z):k7()}var k5=".stx",Uq="STX_DIR",n6=null;var E7=()=>{};var F0;var o6=D(()=>{F0={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 s6=()=>{};function a6($,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 t6,e6;var s9=D(()=>{s6();t6={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},e6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function jq($,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; } }
@@ -1662,7 +1662,7 @@ else {
1662
1662
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1663
1663
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${G==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1664
1664
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1665
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function zq(){return`
1665
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function Bq(){return`
1666
1666
  <script data-stx-scoped data-stx-run="once">
1667
1667
  // Motion preferences handling
1668
1668
  (function() {
@@ -1690,7 +1690,7 @@ else {
1690
1690
  });
1691
1691
  })();
1692
1692
  </script>
1693
- `}function Uq($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Z)=>Z.test($))}function jq($=0.1,X="0px"){return`
1693
+ `}function Hq($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Z)=>Z.test($))}function _q($=0.1,X="0px"){return`
1694
1694
  <script data-stx-scoped data-stx-run="always">
1695
1695
  // Intersection Observer for scroll animations
1696
1696
  (function() {
@@ -1733,7 +1733,7 @@ else {
1733
1733
  }
1734
1734
  })();
1735
1735
  </script>
1736
- `}function Bq(){return`
1736
+ `}function Oq(){return`
1737
1737
  <style id="stx-animation-base">
1738
1738
  :root {
1739
1739
  --stx-transition-duration: 300ms;
@@ -1848,7 +1848,7 @@ else {
1848
1848
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1849
1849
  }
1850
1850
  </style>
1851
- `}function Hq($,X,Z={}){let{staggerDelay:J=50,sequence:Y=!1}=Z;return`
1851
+ `}function Lq($,X,Z={}){let{staggerDelay:J=50,sequence:Y=!1}=Z;return`
1852
1852
  <script data-stx-scoped data-stx-run="always">
1853
1853
  // Animation Group: ${$}
1854
1854
  (function() {
@@ -1885,11 +1885,11 @@ else {
1885
1885
  }
1886
1886
  })();
1887
1887
  </script>
1888
- `}function Z2($,X,Z,J){let Y=$;if(J.animation?.enabled===!1)return Y;let G=Z.includes("test")&&Z.includes("animation");if(!Uq(Y)&&!G)return Y;if(!Y.includes('<style id="stx-animation-base">')){let w=Bq();Y=Y.replace("</head>",`${w}
1889
- </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let W=jq(),q=Y.lastIndexOf("</body>");if(q!==-1)Y=Y.slice(0,q)+W+`
1890
- `+Y.slice(q)}}return Y}var A1,t6,e6,$2,X2;var t9=D(()=>{A1={duration:300,delay:0,ease:"ease",direction:"both"};t6={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)||A1.duration:A1.duration,Q=X.length>2?X[2]||A1.ease:A1.ease,w=X.length>3?Number.parseInt(X[3],10)||A1.delay:A1.delay,W=X.length>4?X[4]||A1.direction:A1.direction,q=`stx-transition-${Math.random().toString(36).substr(2,9)}`,K=Kq(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
- 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"},e6={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"},$2={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=Hq(Y,G,{staggerDelay:Q,sequence:w});return`${$}
1892
- ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},X2={name:"motion",handler:($,X,Z,J)=>{let Y=X.length>0?X[0].toLowerCase()==="true":!0,G=zq();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});var J2=D(()=>{S1();e9()});async function _q($,X,Z,J){let Y=X[0]?.replace(/['"]/g,"")||"main",G=N7();if(Y!=="main")G=G.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${G}</script>`}var Y2;var e9=D(()=>{J2();Y2={name:"stxRouter",handler:_q,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function G2($){let X=$.heatmap;if(!X?.enabled)return"";let Z={...Oq,...X};return`
1888
+ `}function Y2($,X,Z,J){let Y=$;if(J.animation?.enabled===!1)return Y;let G=Z.includes("test")&&Z.includes("animation");if(!Hq(Y)&&!G)return Y;if(!Y.includes('<style id="stx-animation-base">')){let w=Oq();Y=Y.replace("</head>",`${w}
1889
+ </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let W=_q(),q=Y.lastIndexOf("</body>");if(q!==-1)Y=Y.slice(0,q)+W+`
1890
+ `+Y.slice(q)}}return Y}var R1,$2,X2,Z2,J2;var a9=D(()=>{R1={duration:300,delay:0,ease:"ease",direction:"both"};$2={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=jq(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
+ 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"},X2={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"},Z2={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=Lq(Y,G,{staggerDelay:Q,sequence:w});return`${$}
1892
+ ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},J2={name:"motion",handler:($,X,Z,J)=>{let Y=X.length>0?X[0].toLowerCase()==="true":!0,G=Bq();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});var G2=D(()=>{S1();t9()});async function Fq($,X,Z,J){let Y=X[0]?.replace(/['"]/g,"")||"main",G=N7();if(Y!=="main")G=G.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${G}</script>`}var Q2;var t9=D(()=>{G2();Q2={name:"stxRouter",handler:Fq,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function w2($){let X=$.heatmap;if(!X?.enabled)return"";let Z={...Vq,...X};return`
1893
1893
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1894
1894
  <script>
1895
1895
  (function() {
@@ -2272,13 +2272,13 @@ else {
2272
2272
  };
2273
2273
  })();
2274
2274
  </script>
2275
- `}function Q2($,X){let Z=G2(X);if(!Z)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+$.slice(J);return $+Z}function Lq($){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 Oq,w2;var $X=D(()=>{Oq={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};w2={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=Lq(X.join(" "));Y.heatmap={...Y.heatmap,...G,enabled:!0}}return G2(Y)}}});function C1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function W2($){let X=$.trim().toLowerCase();return!X.startsWith("javascript:")&&!X.startsWith("vbscript:")&&!X.startsWith("data:text/html")}function q2($){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 D7($,X={}){let{gfm:Z=!0,breaks:J=!1}=X,Y=$,G=[];if(Y=Y.replace(/```(\w*)\n([\s\S]*?)```/g,(K,z,U)=>{let B=G.length,j=z?` class="language-${C1(z)}"`:"";return G.push(`<pre><code${j}>${C1(U.trim())}</code></pre>`),`\x00CODEBLOCK${B}\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="${W2(U)?C1(U):""}" alt="${C1(z)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,z,U)=>{return`<a href="${W2(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 j=`<tr>${z.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<th>${C1(O)}</th>`).join("")}</tr>`,H=U.trim().split(`
2275
+ `}function W2($,X){let Z=w2(X);if(!Z)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+$.slice(J);return $+Z}function Aq($){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 Vq,q2;var e9=D(()=>{Vq={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};q2={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=Aq(X.join(" "));Y.heatmap={...Y.heatmap,...G,enabled:!0}}return w2(Y)}}});function C1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function K2($){let X=$.trim().toLowerCase();return!X.startsWith("javascript:")&&!X.startsWith("vbscript:")&&!X.startsWith("data:text/html")}function z2($){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 D7($,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="${K2(U)?C1(U):""}" alt="${C1(z)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,z,U)=>{return`<a href="${K2(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((O)=>O.trim()).filter(Boolean).map((O)=>`<th>${C1(O)}</th>`).join("")}</tr>`,H=U.trim().split(`
2278
2278
  `).map((O)=>{return`<tr>${O.split("|").map((_)=>_.trim()).filter(Boolean).map((_)=>`<td>${C1(_)}</td>`).join("")}</tr>`}).join(`
2279
2279
  `);return`<table>
2280
2280
  <thead>
2281
- ${j}
2281
+ ${B}
2282
2282
  </thead>
2283
2283
  <tbody>
2284
2284
  ${H}
@@ -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 I5($="const",X=[],Z){let J=X.length?R1.filter((Y)=>!X.includes(Y)):R1;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 XX($){if(!$)return!1;return Vq.some((X)=>new RegExp(`\\b${X}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function ZX($){if(!$)return!1;let X=_2($);if(Aq.some((Z)=>Z.test(X)))return!0;return XX(X)}function z2($){if(!$)return!1;return Rq.test(_2($))||ZX($)}function U2($){return Nq.includes($.toLowerCase())}function H2(){return`{${j2.map(($)=>`'${$}':1`).join(",")}}`}function _2($){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 R1,K2,Fq,Vq,Aq,Rq,Nq,j2,Tq,B2;var J1=D(()=>{R1=["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"],K2=["onMount","onDestroy"];Fq=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],Vq=R1.filter(($)=>!Fq.includes($));Aq=[/@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/],Rq=/\s@[a-z][\w.:-]*\s*=/i;Nq=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];j2=["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"],Tq=["x-init","x-transition","x-effect","x-on"],B2=[...j2,...Tq]});function F2($){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(Mq.has(J))X.systemKeys.push(J);else if(J in V2)X.mouse=J;else if(J in L2||/^[a-z]$/.test(J))X.keys.push(L2[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 A2($){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,B;while((B=U.exec(w))!==null){let[,H,O]=B,L=H.split("."),_=L[0];if(!O2.has(_))continue;z.push({attribute:`@${H}`,event:_,handler:O,modifiers:F2(L.slice(1)),elementId:K})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(w))!==null){let[,H,O]=B,L=H.split("."),_=L[0];if(!O2.has(_))continue;z.push({attribute:`@${H}`,event:_,handler:O,modifiers:F2(L.slice(1)),elementId:K})}if(z.length>0)X.push({originalTag:G,elementId:K,events:z,startIndex:W,endIndex:q})}return X}function kq($){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=V2[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 Iq($,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 JX($){let X=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(X))return $;return`if (typeof ${X} === 'function' && !${X}._isSignal) ${X}($event);`}function Eq($){let{modifiers:X}=$,Z=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=kq($),Y=Iq(JX($.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 $X($){if(!$)return!1;return Nq.some((X)=>new RegExp(`\\b${X}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function XX($){if(!$)return!1;let X=L2($);if(Tq.some((Z)=>Z.test(X)))return!0;return $X(X)}function j2($){if(!$)return!1;return Mq.test(L2($))||XX($)}function B2($){return kq.includes($.toLowerCase())}function O2(){return`{${H2.map(($)=>`'${$}':1`).join(",")}}`}function L2($){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,U2,Rq,Nq,Tq,Mq,kq,H2,Iq,_2;var J1=D(()=>{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"],U2=["onMount","onDestroy"];Rq=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],Nq=N1.filter(($)=>!Rq.includes($));Tq=[/@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/],Mq=/\s@[a-z][\w.:-]*\s*=/i;kq=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];H2=["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"],Iq=["x-init","x-transition","x-effect","x-on"],_2=[...H2,...Iq]});function A2($){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(Eq.has(J))X.systemKeys.push(J);else if(J in R2)X.mouse=J;else if(J in V2||/^[a-z]$/.test(J))X.keys.push(V2[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 N2($){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,O]=j,L=H.split("."),_=L[0];if(!F2.has(_))continue;z.push({attribute:`@${H}`,event:_,handler:O,modifiers:A2(L.slice(1)),elementId:K})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((j=B.exec(w))!==null){let[,H,O]=j,L=H.split("."),_=L[0];if(!F2.has(_))continue;z.push({attribute:`@${H}`,event:_,handler:O,modifiers:A2(L.slice(1)),elementId:K})}if(z.length>0)X.push({originalTag:G,elementId:K,events:z,startIndex:W,endIndex:q})}return X}function Dq($){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=R2[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 yq($,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 ZX($){let X=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(X))return $;return`if (typeof ${X} === 'function' && !${X}._isSignal) ${X}($event);`}function bq($){let{modifiers:X}=$,Z=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=Dq($),Y=yq(ZX($.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;
@@ -2344,7 +2344,7 @@ else {
2344
2344
  __stx_runHandler('${w}', $event, $el);
2345
2345
  }
2346
2346
  }${Q});
2347
- })();`}function YX($){if($.length===0)return"";return`
2347
+ })();`}function JX($){if($.length===0)return"";return`
2348
2348
  <script data-stx-events>
2349
2349
  (function() {
2350
2350
  'use strict';
@@ -2399,44 +2399,44 @@ else {
2399
2399
  }
2400
2400
 
2401
2401
  // Event listeners
2402
- ${$.map(Eq).join(`
2402
+ ${$.map(bq).join(`
2403
2403
  `)}
2404
2404
  })();
2405
- </script>`}function Dq($){let X=A2($);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 R2($,X,Z){if(ZX($))return $;if(X.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:w,bindings:W}=Dq($),q=X.__stx_event_bindings||[];return X.__stx_event_bindings=[...q,...W],w}let J=A2($);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"),B=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");q=q.replace(U,""),q=q.replace(B,"")}Y=Y.slice(0,W.startIndex)+q+Y.slice(W.endIndex)}let G=YX(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 O2,L2,Mq,V2;var GX=D(()=>{J1();O2=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"]),L2={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"},Mq=new Set(["ctrl","alt","shift","meta"]),V2={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__
2405
+ </script>`}function Sq($){let X=N2($);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 T2($,X,Z){if(XX($))return $;if(X.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:w,bindings:W}=Sq($),q=X.__stx_event_bindings||[];return X.__stx_event_bindings=[...q,...W],w}let J=N2($);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=JX(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 F2,V2,Eq,R2;var YX=D(()=>{J1();F2=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),V2={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},Eq=new Set(["ctrl","alt","shift","meta"]),R2={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
- `}),$}function D8($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function yq($,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 bq($,X){let Z=X+1;while(Z<$.length){if($[Z]==="\\"){Z+=2;continue}if($[Z]==="`")return Z+1;if($[Z]==="$"&&$[Z+1]==="{"){if(Z=y8($,Z+2),Z<$.length)Z++;continue}Z++}return $.length}function y8($,X){let Z=1,J=X;while(J<$.length){let Y=$[J];if(Y==="\\"){J+=2;continue}if(Y==='"'||Y==="'"){J=yq($,J);continue}if(Y==="`"){J=bq($,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]!==`
2408
+ `}),$}function y8($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function Cq($,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=b8($,Z+2),Z<$.length)Z++;continue}Z++}return $.length}function b8($,X){let Z=1,J=X;while(J<$.length){let Y=$[J];if(Y==="\\"){J+=2;continue}if(Y==='"'||Y==="'"){J=Cq($,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 t0($){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=y8($,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=b8($,G);if(X+=" ",X+=t0($.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 Sq(){let $=globalThis;return $[N2]??=new Map,$[N2]}function X0($,X){let Z=Sq(),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 N2;var y7=D(()=>{N2=Symbol.for("stx.lazy-module-promises")});function E5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(Cq,"<\\/$1")}var Cq;var QX=D(()=>{Cq=/<\/(script)/gi});import Pq from"process";function c0($="STX_PUBLIC_"){let X={},Z={};for(let[J,Y]of Object.entries(Pq.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 vq($){if(!$||typeof $!=="object")return!1;let X=$;return typeof X.message==="string"&&(X.name==="BuildMessage"||X.name==="ResolveMessage"||("position"in X))}function xq($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function b8($,X){let Z=[];for(let J of xq($)){if(vq(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 T2($,X){return b8($,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 vq(){let $=globalThis;return $[M2]??=new Map,$[M2]}function X0($,X){let Z=vq(),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 M2;var y7=D(()=>{M2=Symbol.for("stx.lazy-module-promises")});function E5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(xq,"<\\/$1")}var xq;var GX=D(()=>{xq=/<\/(script)/gi});import fq from"process";function h0($="STX_PUBLIC_"){let X={},Z={};for(let[J,Y]of Object.entries(fq.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 gq($){if(!$||typeof $!=="object")return!1;let X=$;return typeof X.message==="string"&&(X.name==="BuildMessage"||X.name==="ResolveMessage"||("position"in X))}function hq($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function S8($,X){let Z=[];for(let J of hq($)){if(gq(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 k2($,X){return S8($,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 b7={};t(b7,{shouldLogBundlerDiagnostics:()=>E2,setBundlerFallbackMode:()=>gq,resolveBundlerFallback:()=>KX,recordBundleFailure:()=>WX,queueClientBundleBuild:()=>D2,hasUserImports:()=>hq,getBundleFailures:()=>UX,clearBundleFailures:()=>jX,bundleClientScript:()=>dq});import F0 from"path";import l0 from"fs";function E2($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function e1(...$){if(E2())console.log("[stx:bundler]",...$)}function WX($,X,Z){zX.push({filePath:$||"<inline>",message:X,details:Z})}function UX(){return zX.slice()}function jX(){zX.length=0}function gq($){qX=$}function KX(){if(qX)return qX;try{let $=S7.strict;return typeof $==="object"&&$!==null?$.bundlerFallback??"warn":"warn"}catch{return"warn"}}function hq($){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(!M2.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(!M2.some((Q)=>Q.test(Y)))return e1("detected side-effect import:",Y),!0}return!1}function uq($,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(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=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(l0.existsSync(q)&&l0.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:l0.readFileSync(Q.path,"utf8"),loader:W}})}}}function D2($){let X=globalThis,J=(X[k2]??Promise.resolve()).then($,$);return X[k2]=J.then(()=>{return},()=>{return}),J}async function dq($,X,Z={}){let J=Z.projectRoot||process.cwd(),Y=Z.minify??!1,G=Z.cacheDir||V1(J,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${fq}\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 B=Bun.file(q),j=!0;if(await B.exists())try{let H=JSON.parse(await B.text());if(H.metadataVersion!==I2||!Array.isArray(H.files))j=!1;for(let O of Array.isArray(H.files)?H.files:[])try{if(l0.statSync(O.path).mtimeMs!==O.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return e1("cache hit:",w),await K.text();e1("cache invalidated by dep change:",w)}let z=wX.get(w);if(z)return await z;let U=D2(()=>mq($,X,{projectRoot:J,minify:Y,cacheDir:G,hash:w,cachePath:W,depsPath:q}));wX.set(w,U);try{return await U}finally{wX.delete(w)}}async function mq($,X,Z){let{projectRoot:J,minify:Y,cacheDir:G,hash:Q,cachePath:w,depsPath:W}=Z,q=V1(J,"bundle-tmp"),K=F0.join(q,`${Q}.ts`),z=F0.join(q,"out",Q);l0.mkdirSync(q,{recursive:!0}),l0.mkdirSync(z,{recursive:!0});let U=F0.dirname(X),B=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=j.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)B.push(V)});else if(O[3])B.push(O[3])}while((O=H.exec($))!==null){if(O[1])continue;B.push(O[2])}let L=B.length>0?`
2419
- export { ${B.join(", ")} }`:"";await Bun.write(K,$+L),e1("bundling:",Q,"from:",F0.basename(X));let _=new Set;try{let F=await Bun.build({entrypoints:[K],outdir:z,target:"browser",format:"esm",minify:Y,plugins:[uq(J,U,K,_)],define:{"process.env.NODE_ENV":Y?'"production"':'"development"',...c0()},root:J});if(!F.success){let S=F.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||`Unable to bundle ${F0.basename(X)}`,b=b8(F.logs,X||void 0);if(console.warn("[stx:bundler] build failed:",S),WX(X||"",S,b),KX()==="error")throw Error(S);return $}let V="";for(let I of F.outputs){V=await I.text();break}let A=[];for(let I of V.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let S of I[1].split(",")){let b=S.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(b){A.push([b[2],b[1]]);continue}let y=S.trim();if(/^[A-Za-z_$][\w$]*$/.test(y))A.push([y,y])}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}`,T=A.map(([I,S])=>`${JSON.stringify(I)}: ${S}`).join(", "),M=A.map(([I])=>`var ${I} = undefined;`).join(`
2420
- `),k=A.map(([I])=>`${I} = ${N}[${JSON.stringify(I)}];`).join(`
2418
+ `)}var b7={};t(b7,{shouldLogBundlerDiagnostics:()=>y2,setBundlerFallbackMode:()=>dq,resolveBundlerFallback:()=>qX,recordBundleFailure:()=>wX,queueClientBundleBuild:()=>b2,hasUserImports:()=>mq,getBundleFailures:()=>zX,clearBundleFailures:()=>UX,bundleClientScript:()=>lq});import V0 from"path";import p0 from"fs";function y2($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function e1(...$){if(y2())console.log("[stx:bundler]",...$)}function wX($,X,Z){KX.push({filePath:$||"<inline>",message:X,details:Z})}function zX(){return KX.slice()}function UX(){KX.length=0}function dq($){WX=$}function qX(){if(WX)return WX;try{let $=S7.strict;return typeof $==="object"&&$!==null?$.bundlerFallback??"warn":"warn"}catch{return"warn"}}function mq($){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(!I2.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(!I2.some((Q)=>Q.test(Y)))return e1("detected side-effect import:",Y),!0}return!1}function cq($,X,Z,J){let Y=(G,Q)=>{let w=G===Z?X:V0.dirname(G),W=V0.resolve(w,Q),q=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,V0.join(W,"index.ts"),V0.join(W,"index.tsx"),V0.join(W,"index.js"),V0.join(W,"index.mjs")];for(let K of q)try{if(p0.existsSync(K)&&p0.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(p0.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=V0.resolve($,Q.path.slice(2)),W=[w,`${w}.ts`,`${w}.tsx`,`${w}.js`,`${w}.mjs`,`${w}.jsx`,V0.join(w,"index.ts"),V0.join(w,"index.tsx"),V0.join(w,"index.js"),V0.join(w,"index.mjs")];for(let q of W)if(p0.existsSync(q)&&p0.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=V0.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:p0.readFileSync(Q.path,"utf8"),loader:W}})}}}function b2($){let X=globalThis,J=(X[E2]??Promise.resolve()).then($,$);return X[E2]=J.then(()=>{return},()=>{return}),J}async function lq($,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(`${uq}\x00${$}\x00${X}`);let w=Q.digest("hex").slice(0,12),W=V0.join(G,`${w}.js`),q=V0.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!==D2||!Array.isArray(H.files))B=!1;for(let O of Array.isArray(H.files)?H.files:[])try{if(p0.statSync(O.path).mtimeMs!==O.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=QX.get(w);if(z)return await z;let U=b2(()=>pq($,X,{projectRoot:J,minify:Y,cacheDir:G,hash:w,cachePath:W,depsPath:q}));QX.set(w,U);try{return await U}finally{QX.delete(w)}}async function pq($,X,Z){let{projectRoot:J,minify:Y,cacheDir:G,hash:Q,cachePath:w,depsPath:W}=Z,q=A1(J,"bundle-tmp"),K=V0.join(q,`${Q}.ts`),z=V0.join(q,"out",Q);p0.mkdirSync(q,{recursive:!0}),p0.mkdirSync(z,{recursive:!0});let U=V0.dirname(X),j=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=B.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)j.push(V)});else if(O[3])j.push(O[3])}while((O=H.exec($))!==null){if(O[1])continue;j.push(O[2])}let L=j.length>0?`
2419
+ export { ${j.join(", ")} }`:"";await Bun.write(K,$+L),e1("bundling:",Q,"from:",V0.basename(X));let _=new Set;try{let F=await Bun.build({entrypoints:[K],outdir:z,target:"browser",format:"esm",minify:Y,plugins:[cq(J,U,K,_)],define:{"process.env.NODE_ENV":Y?'"production"':'"development"',...h0()},root:J});if(!F.success){let S=F.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||`Unable to bundle ${V0.basename(X)}`,b=S8(F.logs,X||void 0);if(console.warn("[stx:bundler] build failed:",S),wX(X||"",S,b),qX()==="error")throw Error(S);return $}let V="";for(let M of F.outputs){V=await M.text();break}let A=[];for(let M of V.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let S of M[1].split(",")){let b=S.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(b){A.push([b[2],b[1]]);continue}let y=S.trim();if(/^[A-Za-z_$][\w$]*$/.test(y))A.push([y,y])}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}`,I=A.map(([M,S])=>`${JSON.stringify(M)}: ${S}`).join(", "),T=A.map(([M])=>`var ${M} = undefined;`).join(`
2420
+ `),k=A.map(([M])=>`${M} = ${N}[${JSON.stringify(M)}];`).join(`
2421
2421
  `);if(V=`${R.join(`
2422
2422
  `)}
2423
- ${M}
2423
+ ${T}
2424
2424
  var ${N} = (function() {
2425
2425
  ${V}
2426
- return { ${T} };
2426
+ return { ${I} };
2427
2427
  })();
2428
- ${k}`.trim(),e1("bundled:",Q,"output:",V.length,"bytes"),B.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`),$;l0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let E=Array.from(_).map((I)=>{try{return{path:I,mtimeMs:l0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(W,JSON.stringify({metadataVersion:I2,files:E})),V}catch(F){let V=b8(F,X||void 0),A=T2(F,X||void 0);if(console.warn(`[stx:bundler] error: ${A}`),WX(X||"",A,V),KX()==="error")throw F;return $}finally{try{l0.rmSync(K,{force:!0}),l0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var fq=5,I2=1,zX,qX,M2,wX,k2;var D5=D(()=>{P1();E7();N1();zX=[];M2=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];wX=new Map,k2=Symbol.for("stx.client-bundle-build-queue")});var f2={};t(f2,{stripCommentsAndLiterals:()=>e0,renderVendorStyleTags:()=>C8,processClientScript:()=>v7,injectBrowserCoreAutoImports:()=>y5,generateServerDataBridge:()=>P8,generateBrowserAutoImportDestructuring:()=>aq,generateAutoImportDestructuring:()=>BX,findInterpolationEnd:()=>y8,extractBridgeData:()=>P7,extractAndStripCssImports:()=>S8,STX_AUTO_IMPORTS:()=>C2});import $5 from"path";import C7 from"fs";function lq($){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 pq($,X){let Z=X;while(!0){let J=$5.join(Z,"node_modules",$,"package.json");if(C7.existsSync(J))return $5.dirname(J);let Y=$5.dirname(Z);if(Y===Z)return null;Z=Y}}function iq($,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 nq($,X){let Z=lq($);if(!Z||!Z.subpath)return null;let J=pq(Z.pkg,X);if(!J)return null;let Y;try{Y=JSON.parse(C7.readFileSync($5.join(J,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=iq(Y.exports,G);if(!Q)return null;let w=$5.resolve(J,Q);return C7.existsSync(w)?w:null}function S8($,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(cq,(w,W)=>{let q;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(q=W.startsWith("/")?W:$5.resolve(Z,W),!C7.existsSync(q))throw Error(`file not found: ${q}`)}else{let K=null;try{K=Bun.resolveSync(W,J)}catch{K=nq(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=C7.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 rq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function C8($){if($.length===0)return"";return`${$.map((X)=>{return`<style data-stx-vendor="${rq(X.source)}" data-stx-layer="vendor">
2428
+ ${k}`.trim(),e1("bundled:",Q,"output:",V.length,"bytes"),j.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${V0.basename(X)} (${Q}); serving the unbundled source and not caching this result`),$;p0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let E=Array.from(_).map((M)=>{try{return{path:M,mtimeMs:p0.statSync(M).mtimeMs}}catch{return null}}).filter((M)=>M!==null);return await Bun.write(W,JSON.stringify({metadataVersion:D2,files:E})),V}catch(F){let V=S8(F,X||void 0),A=k2(F,X||void 0);if(console.warn(`[stx:bundler] error: ${A}`),wX(X||"",A,V),qX()==="error")throw F;return $}finally{try{p0.rmSync(K,{force:!0}),p0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var uq=5,D2=1,KX,WX,I2,QX,E2;var D5=D(()=>{P1();E7();T1();KX=[];I2=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];QX=new Map,E2=Symbol.for("stx.client-bundle-build-queue")});var h2={};t(h2,{stripCommentsAndLiterals:()=>t0,renderVendorStyleTags:()=>P8,processClientScript:()=>v7,injectBrowserCoreAutoImports:()=>y5,generateServerDataBridge:()=>v8,generateBrowserAutoImportDestructuring:()=>$K,generateAutoImportDestructuring:()=>jX,findInterpolationEnd:()=>b8,extractBridgeData:()=>P7,extractAndStripCssImports:()=>C8,STX_AUTO_IMPORTS:()=>v2});import $5 from"path";import C7 from"fs";function nq($){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 rq($,X){let Z=X;while(!0){let J=$5.join(Z,"node_modules",$,"package.json");if(C7.existsSync(J))return $5.dirname(J);let Y=$5.dirname(Z);if(Y===Z)return null;Z=Y}}function oq($,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 sq($,X){let Z=nq($);if(!Z||!Z.subpath)return null;let J=rq(Z.pkg,X);if(!J)return null;let Y;try{Y=JSON.parse(C7.readFileSync($5.join(J,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=oq(Y.exports,G);if(!Q)return null;let w=$5.resolve(J,Q);return C7.existsSync(w)?w:null}function C8($,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(iq,(w,W)=>{let q;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(q=W.startsWith("/")?W:$5.resolve(Z,W),!C7.existsSync(q))throw Error(`file not found: ${q}`)}else{let K=null;try{K=Bun.resolveSync(W,J)}catch{K=sq(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=C7.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 aq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function P8($){if($.length===0)return"";return`${$.map((X)=>{return`<style data-stx-vendor="${aq(X.source)}" data-stx-layer="vendor">
2429
2429
  @layer vendor {
2430
2430
  ${X.contents}
2431
2431
  }
2432
2432
  </style>`}).join(`
2433
2433
  `)}
2434
- `}function y5($){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=P2.filter((w)=>{if(Z.has(w)||J.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test(X)}),G=v2(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=t0($),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=x2.filter((w)=>{if(Z.has(w)||J.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test(X)}),G=f2(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
- ${$}`,imports:Y,models:G}}function v2($){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(!oq.has(J[1]))X.add(J[1]);return Array.from(X)}function sq($){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 x2($){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 B of q.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let H=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!H)continue;let O=H[1],L=H[2]||O;if(Y.add(O),Y.add(L),K==="stx"||K==="@stacksjs/stx")X.add(O);else Z.add(O);if(L!==O)z.push(`${L} = ${O}`)}let U=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(Q[0],U)}let w=sq(J);for(let q of C2){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 P2){if(Y.has(q)||w.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Z.add(q)}let W=v2(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 BX($,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
2436
+ ${$}`,imports:Y,models:G}}function f2($){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(!tq.has(J[1]))X.add(J[1]);return Array.from(X)}function eq($){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 g2($){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 O=H[1],L=H[2]||O;if(Y.add(O),Y.add(L),K==="stx"||K==="@stacksjs/stx")X.add(O);else Z.add(O);if(L!==O)z.push(`${L} = ${O}`)}let U=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(Q[0],U)}let w=eq(J);for(let q of v2){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 x2){if(Y.has(q)||w.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(J))Z.add(q)}let W=f2(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 jX($,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(`
2438
2438
  `)}
2439
- ${tq($,X)}`;return""}function aq($,X=[]){let{browserImports:Z}=x2($),J=new Set(X);return BX([],Z.filter((Y)=>!J.has(Y)))}function tq($,X){let Z=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...X.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(Z.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
2439
+ ${XK($,X)}`;return""}function $K($,X=[]){let{browserImports:Z}=g2($),J=new Set(X);return jX([],Z.filter((Y)=>!J.has(Y)))}function XK($,X){let Z=[...$.map((J)=>`['${J}', typeof ${J}, 'stx']`),...X.map((J)=>`['${J}', typeof ${J}, '@stacksjs/browser']`)];if(Z.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
2440
2440
  [${Z.join(", ")}].forEach(function (e) {
2441
2441
  if (e[1] !== 'undefined') return;
2442
2442
  console.error(
@@ -2445,18 +2445,18 @@ ${tq($,X)}`;return""}function aq($,X=[]){let{browserImports:Z}=x2($),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 P7($){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 y2($,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 eq($,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(y2(Z[1],!0).has(X))return!0;for(let Z of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(y2(Z[1],!1).has(X))return!0;return!1}function $K($,X){return new RegExp(`(?<![.#\\w$])${X}(?![\\w$])`).test($)}function ZK($,X){let Z=XK.test($),J=X.length>32768;if(!Z&&!J)return;if(b2.has($))return;if(b2.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 P8($,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&&!$K(Z,G))continue;if(eq($,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;ZK(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 P7($){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 S2($,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 ZK($,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(S2(Z[1],!0).has(X))return!0;for(let Z of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(S2(Z[1],!1).has(X))return!0;return!1}function JK($,X){return new RegExp(`(?<![.#\\w$])${X}(?![\\w$])`).test($)}function GK($,X){let Z=YK.test($),J=X.length>32768;if(!Z&&!J)return;if(C2.has($))return;if(C2.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 v8($,X){if(!X)return"";let Z=t0($),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&&!JK(Z,G))continue;if(ZK($,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;GK(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
- `}function YK($){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=JK[$.mouse];X.push(`if ($event.button !== ${Z}) return`)}if($.prevent)X.push("$event.preventDefault()");if($.stop)X.push("$event.stopPropagation()");return X.join("; ")}function GK($,X){let{elementId:Z,event:J,modifiers:Y}=$,G=JX($.handler),Q=YK(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) {
2451
+ `}function wK($){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=QK[$.mouse];X.push(`if ($event.button !== ${Z}) return`)}if($.prevent)X.push("$event.preventDefault()");if($.stop)X.push("$event.stopPropagation()");return X.join("; ")}function WK($,X){let{elementId:Z,event:J,modifiers:Y}=$,G=ZX($.handler),Q=wK(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) {
2452
2452
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
2453
- };`;function U(B){if(/\$emit\s*\(/.test(B))return`${z}
2454
- ${B}`;return`var scope = $el.closest('[data-stx-scope]');
2453
+ };`;function U(j){if(/\$emit\s*\(/.test(j))return`${z}
2454
+ ${j}`;return`var scope = $el.closest('[data-stx-scope]');
2455
2455
  if (scope && scope.__stx_execute) {
2456
2456
  scope.__stx_execute('${K}', $event, $el);
2457
2457
  }
2458
2458
  else {
2459
- ${B}
2459
+ ${j}
2460
2460
  }`}if(Y.debounce!==null)return` ;(function() {
2461
2461
  // eslint-disable-next-line pickier/no-unused-vars
2462
2462
  var $el = document.getElementById('${Z}')
@@ -2491,25 +2491,25 @@ else {
2491
2491
  else {
2492
2492
  ${G}
2493
2493
  }
2494
- }${W})`}function QK($){if($.length===0)return"";return`
2494
+ }${W})`}function qK($){if($.length===0)return"";return`
2495
2495
  // STX: auto-generated event bindings
2496
- ${$.map((Z,J)=>GK(Z,J)).join(`
2497
- `)}`}function S2($){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 B=U.trim(),j=B.indexOf(":"),H=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.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 WK($){let X=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function J(U){let B;while((B=Z.exec(U))!==null){let j=B[0];if(!wK.has(j))X.add(j)}}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 v7($,X={}){let Z=$,J="",Y=!1,G=[],Q=S8(Z,{filePath:X.filePath,projectRoot:X.projectRoot});Z=Q.code;let w=C8(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(),b7)));if(q(Z))Z=await K(Z,X.filePath||"",{projectRoot:X.projectRoot,minify:X.production}),Y=!0;if(X.autoImports!==!1){let _=x2(Z);Z=_.code,J=BX(_.stxImports,_.browserImports.filter((F)=>!G.includes(F)))}if(J=`${P8(Z,X.serverData)}${J}`,Z=r0(Z),!Y&&X5(X.attrs||""))Z=Z5(Z);let z=QK(X.eventBindings||[]),U=(X.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(U)){let _=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${_?` ${_}`:""}`;return`${w}<script ${F}>
2496
+ ${$.map((Z,J)=>WK(Z,J)).join(`
2497
+ `)}`}function P2($){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 zK($){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(!KK.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 v7($,X={}){let Z=$,J="",Y=!1,G=[],Q=C8(Z,{filePath:X.filePath,projectRoot:X.projectRoot});Z=Q.code;let w=P8(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(),b7)));if(q(Z))Z=await K(Z,X.filePath||"",{projectRoot:X.projectRoot,minify:X.production}),Y=!0;if(X.autoImports!==!1){let _=g2(Z);Z=_.code,J=jX(_.stxImports,_.browserImports.filter((F)=>!G.includes(F)))}if(J=`${v8(Z,X.serverData)}${J}`,Z=r0(Z),!Y&&X5(X.attrs||""))Z=Z5(Z);let z=qK(X.eventBindings||[]),U=(X.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(U)){let _=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${_?` ${_}`:""}`;return`${w}<script ${F}>
2499
2499
  ${E5(`${J}${Z}
2500
2500
  ${z}`)}
2501
- </script>`}let j=XX($),H=/function __stx_setup_/.test(Z),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function L(_){let F=_.length>0?`
2501
+ </script>`}let B=$X($),H=/function __stx_setup_/.test(Z),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function L(_){let F=_.length>0?`
2502
2502
  return { ${_.join(", ")} };`:"";return`${w}<script data-stx-scoped data-stx-run="always">
2503
2503
  window.stx.mount(function() {
2504
2504
  'use strict';
2505
2505
  ${E5(`${J}${Z}
2506
2506
  ${z}${F}`)}
2507
- })</script>`}if(!O&&!H){if(j)return L(S2($));if(X.templateContent){let _=S2($);if(_.length>0){let F=WK(X.templateContent);if(_.some((A)=>F.has(A)))return L(_)}}}return`${w}<script data-stx-scoped data-stx-run="always">
2507
+ })</script>`}if(!O&&!H){if(B)return L(P2($));if(X.templateContent){let _=P2($);if(_.length>0){let F=zK(X.templateContent);if(_.some((A)=>F.has(A)))return L(_)}}}return`${w}<script data-stx-scoped data-stx-run="always">
2508
2508
  ;(function() {
2509
2509
  'use strict';
2510
2510
  ${E5(`${J}${Z}
2511
2511
  ${z}`)}
2512
- })()</script>`}var cq,C2,P2,oq,XK,b2,JK,wK;var x7=D(()=>{GX();V0();y7();J1();QX();cq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;C2=R1,P2=["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"];oq=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"]);XK=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,b2=new Set;JK={left:0,middle:1,right:2};wK=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 qK}from"crypto";function g2($){let X=$[v8];return X instanceof Map?X:null}function h2($){$[v8]=new Map}function u2($,X){let Z=g2($);if(!Z)return null;let J=qK("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 d2($,X){let Z=g2(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 iq,v2,x2,tq,YK,C2,QK,KK;var x7=D(()=>{YX();A0();y7();J1();GX();iq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;v2=N1,x2=["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"];tq=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"]);YK=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,C2=new Set;QK={left:0,middle:1,right:2};KK=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 UK}from"crypto";function u2($){let X=$[x8];return X instanceof Map?X:null}function d2($){$[x8]=new Map}function m2($,X){let Z=u2($);if(!Z)return null;let J=UK("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 c2($,X){let Z=u2(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 v8="__stx_component_client_factories";var HX=()=>{};function jK($){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 BK($,X){let Z=/[$A-Z_a-z][$\w]*/g,J;while((J=Z.exec($))!==null){let Y=J[0],G=$[J.index-1];if(zK.has(Y))throw Error(`Potentially unsafe expression (matched /\\b${Y}\\b/; identifier ${Y}): ${X}`);if(G==="."&&p2.has(Y))throw Error(`Potentially unsafe expression (matched /.${Y}/; property ${Y}): ${X}`)}}function HK($){let X=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=X.exec($))!==null){let J=Z[2];if(!p2.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 x8($){let X=$.trim(),Z=jK(X);BK(Z,X),HK(X);for(let J of l2)if(J.test(Z))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${X}`);if(!c2.allowBracketNotation&&UK.test(X))throw Error(`Bracket notation with strings not allowed: ${X}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return X}function _K($){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("__")||l2.some((Y)=>Y.test(Z)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))X[Z]=_X(J);else X[Z]=J}return X}function _X($,X=0){if(X>=c2.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>_X(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]=_X(Y,X+1);else Z[J]=Y}return Z}function Q0($,X){try{let Z=_K(X),J=Object.keys(Z),Y=Object.values(Z);return K0($,J)(...Y)}catch{return}}function q0($){try{return x8($),!0}catch{return!1}}function D0($,X){try{let Z=Q0($,X);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function K0($,X){let Z=x8($),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(i2.has(K))continue;Y.push(q),G.push(K)}let Q=(q)=>Function(...G,...q,`
2521
+ ${J.slice(w)}`}var x8="__stx_component_client_factories";var BX=()=>{};function _K($){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 OK($,X){let Z=/[$A-Z_a-z][$\w]*/g,J;while((J=Z.exec($))!==null){let Y=J[0],G=$[J.index-1];if(BK.has(Y))throw Error(`Potentially unsafe expression (matched /\\b${Y}\\b/; identifier ${Y}): ${X}`);if(G==="."&&n2.has(Y))throw Error(`Potentially unsafe expression (matched /.${Y}/; property ${Y}): ${X}`)}}function LK($){let X=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=X.exec($))!==null){let J=Z[2];if(!n2.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 f8($){let X=$.trim(),Z=_K(X);OK(Z,X),LK(X);for(let J of i2)if(J.test(Z))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${X}`);if(!p2.allowBracketNotation&&HK.test(X))throw Error(`Bracket notation with strings not allowed: ${X}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return X}function FK($){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("__")||i2.some((Y)=>Y.test(Z)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))X[Z]=HX(J);else X[Z]=J}return X}function HX($,X=0){if(X>=p2.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>HX(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]=HX(Y,X+1);else Z[J]=Y}return Z}function w0($,X){try{let Z=FK(X),J=Object.keys(Z),Y=Object.values(Z);return K0($,J)(...Y)}catch{return}}function q0($){try{return f8($),!0}catch{return!1}}function D0($,X){try{let Z=w0($,X);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function K0($,X){let Z=f8($),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(r2.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 m2(w,G,Q);return m2((...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 m2($,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:"",B=G.exec(U);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(W.has(j)||i2.has(j))return;W.add(j),w.push(j),Q=Z(w),J?.(w)}return}}function f8($){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 KK,c2,l2,zK,p2,UK,i2;var y0=D(()=>{KK={maxSanitizeDepth:10,allowBracketNotation:!1},c2={...KK},l2=[/\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/],zK=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"]),p2=new Set(["__proto__","constructor","prototype"]),UK=/[\w)\]]\s*\[\s*['"]/;i2=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 g8($,X){let Z=OK++,J=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return LK.set(J,{type:$,expression:X}),J}var OK=0,LK;var n2=D(()=>{LK=new Map});function t2($,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 t2($,X,r2,o2)}function b5($,X){return t2($,X,s2,a2)}function f7($,X){if(!$.startsWith("<!--",X))return-1;let Z=$.indexOf("-->",X+4);if(Z===-1)return-1;return Z+3}function FK($,X){if($.startsWith("<!--",X)){let Z=f7($,X);return Z===-1?$.length:Z}for(let[Z,J]of[[r2,o2],[s2,a2]]){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 h8($,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=FK($,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=h8($,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 S5($,X){if(X.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,J)=>X[+J]??"")}var r2,o2,s2,a2;var x1=D(()=>{r2=/<script\b[^>]*>/iy,o2=/<\/script\s*>/ig,s2=/<style\b[^>]*>/iy,a2=/<\/style\s*>/ig});var QZ={};t(QZ,{usesSignalsInScript:()=>T1,unescapeHtml:()=>DK,registerFilters:()=>AK,registerFilter:()=>XZ,processExpressions:()=>f1,interpolateScriptsInTemplate:()=>MK,interpolateScriptExpressions:()=>u8,interpolateScriptAttributes:()=>YZ,getAllFilters:()=>ZZ,evaluateExpression:()=>p0,escapeHtmlValue:()=>OX,escapeHtml:()=>j1,defaultFilters:()=>h7,clearCustomFilters:()=>RK,applyFilters:()=>GZ});function VK($){let X=e2.get($);if(!X){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");X=new RegExp(`:${Z}(?!\\w)`,"g"),e2.set($,X)}return X.lastIndex=0,X}function XZ($,X){if($ in h7)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);g7[$]=X}function AK($){for(let[X,Z]of Object.entries($))XZ(X,Z)}function ZZ(){return{...h7,...g7}}function RK(){for(let $ of Object.keys(g7))delete g7[$]}function j1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function OX($){return j1($).replace(/\{{2,}/g,(X)=>NK(X.length)).replace(/\{(?=!)/g,`&#123;${JZ}`)}function NK($){return Array.from({length:$},()=>"&#123;").join(JZ)}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 $Z($,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 TK($,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 u8($,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 YZ($,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 MK($,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 B=`<script${YZ(K,X)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return B+z+Q.slice(q);return B+u8(z,X)+Q.slice(q)});return S5(J,G)}function f1($,X,Z){let J=$,Y=(z,U)=>{let B=b5(z,U);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(U,B))?-1:B},G=(z,U,B,j)=>{let H=B.length,{output:O,tokens:L}=z1(z,U,(_,F)=>j(H+F));return B.push(...L),O},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,B)=>{try{let j=p0(U,X);return j!==void 0&&j!==null?String(j):""}catch(j){let H=j instanceof Error?j.message:String(j);return H0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${H}`,Z,$,B,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,U,B)=>{try{let j=p0(U,X);if(j===void 0&&X.__stx_buildMode==="compile")return g8("raw",U.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(X.__stx_buildMode==="compile")return g8("raw",U.trim());let H=j instanceof Error?j.message:String(j);return H0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${H}`,Z,$,B,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,B)=>{let j=U.trim();if(K.has(j))return z;let H=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,_=j.match(O)?.[1],F=_&&((_ in X)||H.includes(_)),V=Boolean(_&&q.has(_)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=j.match(A),N=R&&!H.includes(R[1])&&!(R[1]in X);if(/^__[A-Z_]+__$/.test(j))return"";try{let T=p0(U,X);if(V)return z;if(W&&!$Z(j,X))return z;if(X.__stx_buildMode==="compile"&&!W&&(T===void 0||TK(j,X)))return g8("expr",j);return T!==void 0&&T!==null?OX(String(T)):""}catch(T){if(V)return z;if(W&&!$Z(j,X))return z;if(N)return z;let M=T instanceof Error?T.message:String(T);return H0("Expression",`Error evaluating: {{ ${j} }}: ${M}`,Z,$,B,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 GZ($,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=g7[Q]||h7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(ZZ()).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=[],B="",j=null,H=0,O=0,L=0,_=!1;for(let F=0;F<z.length;F++){let V=z[F];if(_){B+=V,_=!1;continue}if(V==="\\"){B+=V,_=!0;continue}if(j){if(B+=V,V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V,B+=V;continue}if(V==="(")H++;else if(V===")")H--;else if(V==="[")O++;else if(V==="]")O--;else if(V==="{")L++;else if(V==="}")L--;if(V===","&&H===0&&O===0&&L===0){U.push(B),B="";continue}B+=V}if(B)U.push(B);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 kK($){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=kK(J);if(Y>0){let G=J.substring(0,Y).trim(),Q=J.substring(Y+1).trim(),w=p0(G,X,!0);return GZ(w,Q,X)}if(!q0(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 K0(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=IK(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 IK($,X){let Z=null;for(let Y of X){if(Y===$)continue;let G=EK($,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 EK($,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 DK($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var g7,e2,h7,JZ="&#8288;";var B1=D(()=>{y0();V0();n2();x1();g7={},e2=new Map;h7={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 OX(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(VK(W),String(q))}),w},t:($,X,Z={})=>{return h7.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 P5($,X){if(X?.includes("g"))return new RegExp($,X);let Z=`${$}:${X||""}`;if(!C5.has(Z)){if(C5.size>=yK){let J=C5.keys().next().value;if(J)C5.delete(J)}C5.set(Z,new RegExp($,X))}return C5.get(Z)}class wZ{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 l2(w,G,Q);return l2((...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 l2($,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)||r2.has(B))return;W.add(B),w.push(B),Q=Z(w),J?.(w)}return}}function g8($){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 jK,p2,i2,BK,n2,HK,r2;var y0=D(()=>{jK={maxSanitizeDepth:10,allowBracketNotation:!1},p2={...jK},i2=[/\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/],BK=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"]),n2=new Set(["__proto__","constructor","prototype"]),HK=/[\w)\]]\s*\[\s*['"]/;r2=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 h8($,X){let Z=VK++,J=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return AK.set(J,{type:$,expression:X}),J}var VK=0,AK;var o2=D(()=>{AK=new Map});function $Z($,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 $Z($,X,s2,a2)}function b5($,X){return $Z($,X,t2,e2)}function f7($,X){if(!$.startsWith("<!--",X))return-1;let Z=$.indexOf("-->",X+4);if(Z===-1)return-1;return Z+3}function RK($,X){if($.startsWith("<!--",X)){let Z=f7($,X);return Z===-1?$.length:Z}for(let[Z,J]of[[s2,a2],[t2,e2]]){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 u8($,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=RK($,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=u8($,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 S5($,X){if(X.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,J)=>X[+J]??"")}var s2,a2,t2,e2;var x1=D(()=>{s2=/<script\b[^>]*>/iy,a2=/<\/script\s*>/ig,t2=/<style\b[^>]*>/iy,e2=/<\/style\s*>/ig});var WZ={};t(WZ,{usesSignalsInScript:()=>M1,unescapeHtml:()=>SK,registerFilters:()=>TK,registerFilter:()=>JZ,processExpressions:()=>f1,interpolateScriptsInTemplate:()=>EK,interpolateScriptExpressions:()=>d8,interpolateScriptAttributes:()=>QZ,getAllFilters:()=>YZ,evaluateExpression:()=>i0,escapeHtmlValue:()=>_X,escapeHtml:()=>j1,defaultFilters:()=>h7,clearCustomFilters:()=>MK,applyFilters:()=>wZ});function NK($){let X=XZ.get($);if(!X){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");X=new RegExp(`:${Z}(?!\\w)`,"g"),XZ.set($,X)}return X.lastIndex=0,X}function JZ($,X){if($ in h7)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);g7[$]=X}function TK($){for(let[X,Z]of Object.entries($))JZ(X,Z)}function YZ(){return{...h7,...g7}}function MK(){for(let $ of Object.keys(g7))delete g7[$]}function j1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function _X($){return j1($).replace(/\{{2,}/g,(X)=>kK(X.length)).replace(/\{(?=!)/g,`&#123;${GZ}`)}function kK($){return Array.from({length:$},()=>"&#123;").join(GZ)}function M1($){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 ZZ($,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 IK($,X){let Z=X.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let J=t0($);for(let Y of Z)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function d8($,X){let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let G=i0(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=i0(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=i0(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=i0(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 EK($,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+d8(z,X)+Q.slice(q)});return S5(J,G)}function f1($,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:O,tokens:L}=z1(z,U,(_,F)=>B(H+F));return j.push(...L),O},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||M1($),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=i0(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=i0(U,X);if(B===void 0&&X.__stx_buildMode==="compile")return h8("raw",U.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(X.__stx_buildMode==="compile")return h8("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"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,_=B.match(O)?.[1],F=_&&((_ in X)||H.includes(_)),V=Boolean(_&&q.has(_)),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 I=i0(U,X);if(V)return z;if(W&&!ZZ(B,X))return z;if(X.__stx_buildMode==="compile"&&!W&&(I===void 0||IK(B,X)))return h8("expr",B);return I!==void 0&&I!==null?_X(String(I)):""}catch(I){if(V)return z;if(W&&!ZZ(B,X))return z;if(N)return z;let T=I instanceof Error?I.message:String(I);return _0("Expression",`Error evaluating: {{ ${B} }}: ${T}`,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 wZ($,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=g7[Q]||h7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(YZ()).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=[i0(`(${z})`,Z,!0)];else{let U=[],j="",B=null,H=0,O=0,L=0,_=!1;for(let F=0;F<z.length;F++){let V=z[F];if(_){j+=V,_=!1;continue}if(V==="\\"){j+=V,_=!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==="[")O++;else if(V==="]")O--;else if(V==="{")L++;else if(V==="}")L--;if(V===","&&H===0&&O===0&&L===0){U.push(j),j="";continue}j+=V}if(j)U.push(j);W=U.map((F)=>{let V=F.trim();return i0(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 DK($){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 i0($,X,Z=!1){try{let J=$.trim(),Y=DK(J);if(Y>0){let G=J.substring(0,Y).trim(),Q=J.substring(Y+1).trim(),w=i0(G,X,!0);return wZ(w,Q,X)}if(!q0(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 K0(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=yK(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 yK($,X){let Z=null;for(let Y of X){if(Y===$)continue;let G=bK($,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 bK($,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 SK($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var g7,XZ,h7,GZ="&#8288;";var B1=D(()=>{y0();A0();o2();x1();g7={},XZ=new Map;h7={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 _X(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(NK(W),String(q))}),w},t:($,X,Z={})=>{return h7.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 P5($,X){if(X?.includes("g"))return new RegExp($,X);let Z=`${$}:${X||""}`;if(!C5.has(Z)){if(C5.size>=CK){let J=C5.keys().next().value;if(J)C5.delete(J)}C5.set(Z,new RegExp($,X))}return C5.get(Z)}class qZ{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 WZ{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 bK(){if(!LX)LX=new WZ;return LX}var C5,yK=500,jA,LX=null,qZ;var v5=D(()=>{C5=new Map;jA=new wZ;qZ=new Proxy({},{get($,X){return bK()[X]}})});function KZ($,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 zZ($,X,Z={}){let{prefix:J="",preserveHost:Y=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!$.trim())return"";let w=FX($),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],B=`${X}_${U}`;q.set(U,B)}}for(let K of w){let z=UZ(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 KZ{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(!OX)OX=new KZ;return OX}var C5,CK=500,LA,OX=null,zZ;var v5=D(()=>{C5=new Map;LA=new qZ;zZ=new Proxy({},{get($,X){return PK()[X]}})});function UZ($,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 jZ($,X,Z={}){let{prefix:J="",preserveHost:Y=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!$.trim())return"";let w=LX($),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=BZ(K,X,J,Y,q,Q);W.push(z)}return W.join(`
2544
2544
 
2545
- `)}function FX($){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 B=FX(U);X.push({selector:`@${K} ${z.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
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 UZ($,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=FX(`x { ${w} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((U)=>UZ(U,X,Z,J,Y,G)).join(`
2545
+ `)}function LX($){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=LX(U);X.push({selector:`@${K} ${z.trim()}`,declarations:j.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
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 BZ($,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=LX(`x { ${w} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((U)=>BZ(U,X,Z,J,Y,G)).join(`
2547
2547
  `);return`${Q} {
2548
2548
  ${z}
2549
- }`}return`${Q} { ${w} }`}let W=SK(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 SK($,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=CK(Q,X);if(W)G.push(Z?`${Z} ${W}`:W)}return G.join(", ")}function CK($,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 BZ($){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 d8($,X){if(!PK.test($))return{html:$,hasScoped:!1};let Z=KZ(X),J=`data-v-${Z}`,Y=$,G=new RegExp(`<style\\s+([^>]*${VX}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(Y=Y.replace(G,(w,W,q)=>{Q=!0;let K=vK(q,J),z=W.replace(new RegExp(VX,"gi"),"").trim(),U=z?` ${z}`:"";return`<style data-stx-scoped="${Z}"${U}>${K}</style>`}),!Q)return{html:$,hasScoped:!1};return Y=fK(Y,J),{html:Y,hasScoped:!0}}function vK($,X){return zZ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${X}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${X}]`)}function fK($,X){let Z=z1($,(Y,G)=>{let Q=v1(Y,G);return Q>G?Q:b5(Y,G)},(Y,G)=>xK(G)),J=gK(Z.output,X);return jZ.lastIndex=0,J.replace(jZ,(Y,G)=>Z.tokens[Number(G)])}function gK($,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 VX,PK,xK=($)=>`\x00stx-scope-mask-${$}\x00`,jZ;var AX=D(()=>{x1();VX=String.raw`(?<![\w-])scoped(?![\w-])`,PK=new RegExp(`<style\\s+[^>]*${VX}`,"i");jZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function uK($){let X=$.replace(/^<template\b/i,"").replace(/>$/,"");return hK.test(X)}function m8($){u7.lastIndex=0;let X;while((X=u7.exec($))!==null){if(X[0].startsWith("</")||uK(X[0]))continue;let Z=X.index,J=u7.lastIndex,Y=1,G;while((G=u7.exec($))!==null)if(G[0].startsWith("</")){if(Y--,Y===0){let Q=G.index;return{start:Z,openEnd:J,closeStart:Q,end:u7.lastIndex,content:$.slice(J,Q)}}}else Y++;return null}return null}var u7,hK;var RX=D(()=>{u7=/<\/?template\b[^>]*>/gi,hK=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var HZ=()=>{};function P0($,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 MX={};t(MX,{useTitle:()=>pK,useSeoMeta:()=>_Z,usePageTitle:()=>pK,useHead:()=>TX,seoMetaToHeadConfig:()=>l8,resetHead:()=>cK,renderHtmlAttrs:()=>nK,renderHead:()=>iK,renderBodyAttrs:()=>rK,processTitleDirective:()=>aK,processMetaDirective:()=>tK,processHeadDirective:()=>sK,mergeHeadConfigs:()=>h1,getPageMeta:()=>mK,getHead:()=>NX,definePageMeta:()=>lK,applyHead:()=>oK});function NX(){return g1}function mK(){return c8}function cK(){g1={},dK.length=0,c8={}}function TX($){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 _Z($){TX(l8($))}function l8($){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 lK($){if(c8={...c8,...$},$.title||$.description)_Z({title:$.title,description:$.description})}function pK($){let X=typeof $==="function"?$():$;TX({title:X})}function iK($=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 nK($=g1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([X,Z])=>`${X}="${Y5(Z)}"`).join(" ")}function rK($=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 oK($=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 sK($){let X="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,Y)=>{return X+=Y.trim()+`
2551
- `,""}),headContent:X.trim()}}function aK($,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 tK($,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,dK,c8;var x5=D(()=>{g1={},dK=[],c8={}});var p8={};t(p8,{stripTypeScript:()=>NZ,splitDeclaration:()=>DZ,isModuleResolutionFailure:()=>TZ,isMissingBindingFailure:()=>MZ,isCompleteImport:()=>kZ,hasVariables:()=>CZ,extractVariables:()=>G5,extractScriptFromTemplate:()=>SZ,convertToCommonJS:()=>EX,STX_ENGINE_BINDING_NAMES:()=>IX});import u1 from"path";import f5 from"process";function Xz($){let X=[],Z=0,J=$.split(`
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 B=U.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((U)=>/^\w+$/.test(U));X.push(...z)}}}}return[...new Set(X)]}function NZ($){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,B=-1,j=0;for(let A=0;A<U.length;A++)if(U[A]==="<")j++;else if(U[A]===">")j--;else if(U[A]===":"&&j===0){B=A;break}if(B===-1)return q;let O=U.substring(0,B).trim().replace(/\?$/,""),L=U.substring(B+1),_=-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){_=A;break}let V=z?"...":"";if(_!==-1)return`${V}${O} = ${L.substring(_+1).trim()}`;return`${V}${O}`}).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 B=X[W];if(K){if(B===K)K=null;W++;continue}if(B==='"'||B==="'"||B==="`"){K=B,W++;continue}if(B==="<")q++;else if(B===">"&&q>0)q--;else if(q===0){if(B==="(")w++;else if(B===")")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,`
2549
+ }`}return`${Q} { ${w} }`}let W=vK(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 vK($,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=xK(Q,X);if(W)G.push(Z?`${Z} ${W}`:W)}return G.join(", ")}function xK($,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 _Z($){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 m8($,X){if(!fK.test($))return{html:$,hasScoped:!1};let Z=UZ(X),J=`data-v-${Z}`,Y=$,G=new RegExp(`<style\\s+([^>]*${FX}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(Y=Y.replace(G,(w,W,q)=>{Q=!0;let K=gK(q,J),z=W.replace(new RegExp(FX,"gi"),"").trim(),U=z?` ${z}`:"";return`<style data-stx-scoped="${Z}"${U}>${K}</style>`}),!Q)return{html:$,hasScoped:!1};return Y=uK(Y,J),{html:Y,hasScoped:!0}}function gK($,X){return jZ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${X}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${X}]`)}function uK($,X){let Z=z1($,(Y,G)=>{let Q=v1(Y,G);return Q>G?Q:b5(Y,G)},(Y,G)=>hK(G)),J=dK(Z.output,X);return HZ.lastIndex=0,J.replace(HZ,(Y,G)=>Z.tokens[Number(G)])}function dK($,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 FX,fK,hK=($)=>`\x00stx-scope-mask-${$}\x00`,HZ;var VX=D(()=>{x1();FX=String.raw`(?<![\w-])scoped(?![\w-])`,fK=new RegExp(`<style\\s+[^>]*${FX}`,"i");HZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function cK($){let X=$.replace(/^<template\b/i,"").replace(/>$/,"");return mK.test(X)}function c8($){u7.lastIndex=0;let X;while((X=u7.exec($))!==null){if(X[0].startsWith("</")||cK(X[0]))continue;let Z=X.index,J=u7.lastIndex,Y=1,G;while((G=u7.exec($))!==null)if(G[0].startsWith("</")){if(Y--,Y===0){let Q=G.index;return{start:Z,openEnd:J,closeStart:Q,end:u7.lastIndex,content:$.slice(J,Q)}}}else Y++;return null}return null}var u7,mK;var AX=D(()=>{u7=/<\/?template\b[^>]*>/gi,mK=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var OZ=()=>{};function P0($,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 TX={};t(TX,{useTitle:()=>rK,useSeoMeta:()=>LZ,usePageTitle:()=>rK,useHead:()=>NX,seoMetaToHeadConfig:()=>p8,resetHead:()=>iK,renderHtmlAttrs:()=>sK,renderHead:()=>oK,renderBodyAttrs:()=>aK,processTitleDirective:()=>$z,processMetaDirective:()=>Xz,processHeadDirective:()=>eK,mergeHeadConfigs:()=>h1,getPageMeta:()=>pK,getHead:()=>RX,definePageMeta:()=>nK,applyHead:()=>tK});function RX(){return g1}function pK(){return l8}function iK(){g1={},lK.length=0,l8={}}function NX($){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 LZ($){NX(p8($))}function p8($){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 nK($){if(l8={...l8,...$},$.title||$.description)LZ({title:$.title,description:$.description})}function rK($){let X=typeof $==="function"?$():$;NX({title:X})}function oK($=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 sK($=g1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([X,Z])=>`${X}="${Y5(Z)}"`).join(" ")}function aK($=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 tK($=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 eK($){let X="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,Y)=>{return X+=Y.trim()+`
2551
+ `,""}),headContent:X.trim()}}function $z($,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 Xz($,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,lK,l8;var x5=D(()=>{g1={},lK=[],l8={}});var i8={};t(i8,{stripTypeScript:()=>MZ,splitDeclaration:()=>bZ,isModuleResolutionFailure:()=>kZ,isMissingBindingFailure:()=>IZ,isCompleteImport:()=>EZ,hasVariables:()=>vZ,extractVariables:()=>G5,extractScriptFromTemplate:()=>PZ,convertToCommonJS:()=>IX,STX_ENGINE_BINDING_NAMES:()=>kX});import u1 from"path";import f5 from"process";function Yz($){let X=[],Z=0,J=$.split(`
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 MZ($){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 O=U.substring(0,j).trim().replace(/\?$/,""),L=U.substring(j+1),_=-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){_=A;break}let V=z?"...":"";if(_!==-1)return`${V}${O} = ${L.substring(_+1).trim()}`;return`${V}${O}`}).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 TZ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function MZ($){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=M1({loader:"ts",target:"browser",define:c0()}),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=NZ($)}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:")&&!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),s=u1.join(g,"package.json"),l=JSON.parse(j0("fs").readFileSync(s,"utf8")),v=l.main||"index.js";if(l.exports){let m=typeof l.exports==="string"?l.exports:l.exports["."];if(typeof m==="string")v=m;else if(m?.bun)v=m.bun;else if(m?.import)v=m.import;else if(m?.default)v=m.default}W[C]=await import(u1.resolve(g,v))}catch{}let K=(C)=>{if(W[C])return W[C];return j0(C)},z=X.props||{},U=(C)=>{if(!C)return z;let g={};for(let[s,l]of Object.entries(C)){let v=z[s];if(v!==void 0)g[s]=v;else if(typeof l==="function")g[s]=l();else g[s]=l}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 B=(C)=>{if(!C)return z;let g={...z};for(let[s,l]of Object.entries(C)){let v=l&&typeof l==="object"&&!Array.isArray(l)?l:{type:l};if(g[s]===void 0&&v.default!==void 0)g[s]=typeof v.default==="function"?v.default():v.default}return g},j=()=>X.slots||{},H=(C,g)=>{let s={...C};for(let[l,v]of Object.entries(g))if(s[l]===void 0)if(typeof v==="function")s[l]=v();else s[l]=v;return s},O=(C)=>{let g=()=>C;return g.set=(s)=>{},g.update=(s)=>{},g},L=(C)=>{let g,s=!1;return()=>{if(!s)try{g=C(),s=!0}catch{g=void 0}return g}},_=(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 T=()=>{let C=X.__stxServeContext,g=X.__stxServeSearch??C?.search??"",s=C?.path??"",l=Object.fromEntries(new URLSearchParams(g)),v=X.query,m=Object.keys(l).length>0?l:v??{},U0=g||(Object.keys(m).length>0?`?${new URLSearchParams(m).toString()}`:"");return{params:X.params??{},query:m,path:s,name:"",fullPath:s+U0,hash:"",matched:[]}},M=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),k=(C)=>{let g=X.__stx_runtime_head||{};X.__stx_runtime_head=h1(g,C||{})},E=(C)=>{k(l8(C||{}))},I=(C)=>({value:C}),S=(C)=>C,b=(C)=>({value:typeof C==="function"?C():C}),y=(C,g)=>{},P=(C)=>{},f=(C)=>{},x=(C)=>C?C():Promise.resolve(),p=(C)=>(g,...s)=>{},u=(C)=>{},R0=(C,g)=>{},N0=(C,g)=>g,S0=()=>({value:"light"}),O0=()=>O(!1),c=(C)=>O(!1),W0=()=>O(!1),i=()=>c("(prefers-color-scheme: dark)"),n0=()=>c("(prefers-color-scheme: light)"),t0=()=>c("(prefers-reduced-motion: reduce)"),r=()=>c("(prefers-contrast: more)"),$0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},z0=new Proxy($0,{get(C,g){if(g in C)return C[g];return},set(C,g,s){return C[g]=s,!0}}),d0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},C0=console;try{let C=EX(Y,Z),g=new Set(Object.keys(z)),s=(a)=>/^[a-z_$][\w$]*$/i.test(a),l=Object.keys(X).filter((a)=>!g.has(a)&&!eK.has(a)&&s(a)),v=l.map((a)=>X[a]);if(!l.includes("__stxServeContext"))l.push("__stxServeContext"),v.push(void 0);let m=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"]),U0=[],Z0=[];for(let[a,Z1]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(m.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(C))continue;U0.push(a),Z0.push(Z1)}let E0=Xz(C).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
2555
- `),b1=X.params??{},m0=[],g0=[];for(let a=0;a<l.length;a++){if(l[a]==="params")continue;m0.push(l[a]),g0.push(v[a])}let s1=await Function(...IX,...U0,...m0,`return (async () => {
2554
+ `),X}function kZ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function IZ($){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:h0()}),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=MZ($)}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:")&&!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),s=u1.join(g,"package.json"),p=JSON.parse(j0("fs").readFileSync(s,"utf8")),x=p.main||"index.js";if(p.exports){let m=typeof p.exports==="string"?p.exports:p.exports["."];if(typeof m==="string")x=m;else if(m?.bun)x=m.bun;else if(m?.import)x=m.import;else if(m?.default)x=m.default}W[C]=await import(u1.resolve(g,x))}catch{}let K=(C)=>{if(W[C])return W[C];return j0(C)},z=X.props||{},U=(C)=>{if(!C)return z;let g={};for(let[s,p]of Object.entries(C)){let x=z[s];if(x!==void 0)g[s]=x;else if(typeof p==="function")g[s]=p();else g[s]=p}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[s,p]of Object.entries(C)){let x=p&&typeof p==="object"&&!Array.isArray(p)?p:{type:p};if(g[s]===void 0&&x.default!==void 0)g[s]=typeof x.default==="function"?x.default():x.default}return g},B=()=>X.slots||{},H=(C,g)=>{let s={...C};for(let[p,x]of Object.entries(g))if(s[p]===void 0)if(typeof x==="function")s[p]=x();else s[p]=x;return s},O=(C)=>{let g=()=>C;return g.set=(s)=>{},g.update=(s)=>{},g},L=(C)=>{let g,s=!1;return()=>{if(!s)try{g=C(),s=!0}catch{g=void 0}return g}},_=(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 I=()=>{let C=X.__stxServeContext,g=X.__stxServeSearch??C?.search??"",s=C?.path??"",p=Object.fromEntries(new URLSearchParams(g)),x=X.query,m=Object.keys(p).length>0?p:x??{},U0=g||(Object.keys(m).length>0?`?${new URLSearchParams(m).toString()}`:"");return{params:X.params??{},query:m,path:s,name:"",fullPath:s+U0,hash:"",matched:[]}},T=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),k=(C)=>{let g=X.__stx_runtime_head||{};X.__stx_runtime_head=h1(g,C||{})},E=(C)=>{k(p8(C||{}))},M=(C)=>({value:C}),S=(C)=>C,b=(C)=>({value:typeof C==="function"?C():C}),y=(C,g)=>{},P=(C)=>{},v=(C)=>{},f=(C)=>C?C():Promise.resolve(),i=(C)=>(g,...s)=>{},c=(C)=>{},G0=(C,g)=>{},S0=(C,g)=>g,N0=()=>({value:"light"}),m0=()=>O(!1),u=(C)=>O(!1),H0=()=>O(!1),r=()=>u("(prefers-color-scheme: dark)"),L0=()=>u("(prefers-color-scheme: light)"),X1=()=>u("(prefers-reduced-motion: reduce)"),l=()=>u("(prefers-contrast: more)"),$0={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},z0=new Proxy($0,{get(C,g){if(g in C)return C[g];return},set(C,g,s){return C[g]=s,!0}}),c0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},C0=console;try{let C=IX(Y,Z),g=new Set(Object.keys(z)),s=(a)=>/^[a-z_$][\w$]*$/i.test(a),p=Object.keys(X).filter((a)=>!g.has(a)&&!Zz.has(a)&&s(a)),x=p.map((a)=>X[a]);if(!p.includes("__stxServeContext"))p.push("__stxServeContext"),x.push(void 0);let m=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"]),U0=[],Z0=[];for(let[a,Z1]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(m.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(C))continue;U0.push(a),Z0.push(Z1)}let E0=Yz(C).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
2555
+ `),b1=X.params??{},l0=[],g0=[];for(let a=0;a<p.length;a++){if(p[a]==="params")continue;l0.push(p[a]),g0.push(x[a])}let s1=await Function(...kX,...U0,...l0,`return (async () => {
2556
2556
  ${C}
2557
2557
  ${E0}
2558
2558
  return module.exports
2559
- })()`)(G,Q,K,z,U,B,H,N,O,L,_,F,V,A,R,T,M,k,E,I,S,b,y,P,f,x,p,u,j,R0,N0,S0,O0,c,W0,i,n0,t0,r,z0,d0,C0,$0.confirm,$0.alert,$0.fetch,b1,...Z0,...g0);if(J.preserveExisting){for(let[a,Z1]of Object.entries(s1))if(!(a in X)||X[a]===void 0)X[a]=Z1}else Object.assign(X,s1);for(let[a,Z1]of Object.entries(z))if(!(a in X))X[a]=Z1}catch(C){let g=C instanceof Error?C.message:String(C);if(TZ(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(MZ(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 wz(Y,X,Z)}catch(s){if(f5.env.STX_DEBUG){let l=s instanceof Error?s.message:String(s);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${l}`)}}}}function kZ($){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 EX($,X){let Z=X?u1.dirname(X):f5.cwd(),J=f5.cwd(),Y=$.split(`
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 B=Q;B<Y.length&&!q;B++){let j=null,H=!1,O=Y[B];for(let L=0;L<O.length;L++){let _=O[L];if(H){H=!1;continue}if(_==="\\"){H=!0;continue}if(j){if(_===j)j=null;continue}if(_==='"'||_==="'"||_==="`"){j=_;continue}if(_==="(")W++;else if(_===")"){if(W--,W===0){Q=B+1,q=!0;break}}}}if(!q)Q=Y.length;let z=Y.slice(K,Q).join(`
2561
- `),U=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(z);if(j)U.push(`${B}: ${JSON.stringify(j[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(!kZ(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+['"](.+?)['"]/),B=W,j=(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,O]=K,L=j(O);G.push(`const ${H} = (await import('${L}')).default`),G.push(`module.exports.${H} = ${H};`)}else if(z){let[,H,O]=z,L=j(O),_=[],F=[],V=$z.has(O);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[T,M]=[N[0].trim(),N[1].trim()];if(V&&OZ.has(T)){G.push(`const ${M} = ${T};`);continue}_.push(`${T}: ${M}`),F.push(M)}else{if(V&&OZ.has(R))continue;_.push(R),F.push(R)}}if(_.length>0)G.push(`const { ${_.join(", ")} } = await import('${L}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(U){let H=j(U[1]);G.push(`await import('${H}')`)}else G.push(B);Q++;continue}if(Zz.test(w))G.push(Y[Q]),Q++;else if(w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var ")){let W=FZ(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=kX(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=FZ(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=kX(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=kX(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 B=Y[U];for(let j of B)if(j==="{")z++;else if(j==="}")z--;if(U>Q)K+=`
2562
- `+B;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 Jz(G.join(`
2563
- `),Z,J)}function Jz($,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=Yz($,G);if(U){let{quote:B,path:j,end:H}=U;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let O=j.startsWith(".")?u1.resolve(X,j):u1.resolve(Z,j.slice(2));Y+=`await import(${B}${O}${B})`,G=H;continue}}}Y+=K,G++}return Y}function Yz($,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 IZ($,X){let Z=$[X];if(Z!=="{"&&Z!=="[")return null;let Y=P0($,Z,Z==="{"?"}":"]",X);if(Y===-1)return null;return{pattern:$.slice(X,Y+1),endPos:Y+1}}function EZ($){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?IZ(Z,J):null;if(w){X.push(...EZ(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 DZ($){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 LZ($,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 FZ($,X){let Z=$[X].trim(),J=DZ(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 j=z[0],H=j==="{"?"}":"]",O=LZ(z,j,H,0),L=z;for(let _=X+1;_<$.length&&O>0;_++)L+=` ${$[_].trim()}`,U=_,O=LZ($[_],j,H,O);if(O>0)L=z,U=X;z=L}let B=IZ(z,0);if(B){let j=K[1],H=B.pattern,O=z.slice(B.endPos).trim();if(O.startsWith("=")){let L=O.slice(1).trim(),_=L,F=Math.max(U,X);if(VZ(L)){let N=AZ($,F,L);_=N.value,F=N.nextIndex}else F=F+1;_=_.trim().replace(/;$/,"");let V=EZ(H),A=`__stx_src_${X}`,R=V.map((N)=>`module.exports.${N} = ${N};`).join(`
2565
- `);return{type:j,name:A,value:`${_}; ${j} ${H} = ${A};
2566
- ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,w]=Y,W=w,q=X;if(VZ(w)){let K=AZ($,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 kX($,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(Gz(Z)){let w=Qz($,X,G);G=w.functionCode,Q=w.nextIndex}else Q=X+1;return{name:Y,functionCode:G,nextIndex:Q}}function VZ($){let X=$.trim();if(X.startsWith("{"))return P0(X,"{","}",0)===-1;if(X.startsWith("["))return P0(X,"[","]",0)===-1;return!yZ(X)}function yZ($){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 bZ($){let X=$.indexOf("(");if(X===-1)return $.indexOf("{");let Z=P0($,"(",")",X);if(Z===-1)return-1;return $.indexOf("{",Z)}function Gz($){let X=bZ($);if(X===-1)return!0;return P0($,"{","}",X)===-1}function AZ($,X,Z){let J=Z,Y=X+1;while(Y<$.length&&!yZ(J)){let G=$[Y];J+=`
2559
+ })()`)(G,Q,K,z,U,j,H,N,O,L,_,F,V,A,R,I,T,k,E,M,S,b,y,P,v,f,i,c,B,G0,S0,N0,m0,u,H0,r,L0,X1,l,z0,c0,C0,$0.confirm,$0.alert,$0.fetch,b1,...Z0,...g0);if(J.preserveExisting){for(let[a,Z1]of Object.entries(s1))if(!(a in X)||X[a]===void 0)X[a]=Z1}else Object.assign(X,s1);for(let[a,Z1]of Object.entries(z))if(!(a in X))X[a]=Z1}catch(C){let g=C instanceof Error?C.message:String(C);if(kZ(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(IZ(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 Kz(Y,X,Z)}catch(s){if(f5.env.STX_DEBUG){let p=s instanceof Error?s.message:String(s);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${p}`)}}}}function EZ($){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 IX($,X){let Z=X?u1.dirname(X):f5.cwd(),J=f5.cwd(),Y=$.split(`
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,O=Y[j];for(let L=0;L<O.length;L++){let _=O[L];if(H){H=!1;continue}if(_==="\\"){H=!0;continue}if(B){if(_===B)B=null;continue}if(_==='"'||_==="'"||_==="`"){B=_;continue}if(_==="(")W++;else if(_===")"){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(!EZ(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,O]=K,L=B(O);G.push(`const ${H} = (await import('${L}')).default`),G.push(`module.exports.${H} = ${H};`)}else if(z){let[,H,O]=z,L=B(O),_=[],F=[],V=Jz.has(O);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[I,T]=[N[0].trim(),N[1].trim()];if(V&&FZ.has(I)){G.push(`const ${T} = ${I};`);continue}_.push(`${I}: ${T}`),F.push(T)}else{if(V&&FZ.has(R))continue;_.push(R),F.push(R)}}if(_.length>0)G.push(`const { ${_.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(Gz.test(w))G.push(Y[Q]),Q++;else if(w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var ")){let W=AZ(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=MX(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=AZ(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=MX(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=MX(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
+ `+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 Qz(G.join(`
2563
+ `),Z,J)}function Qz($,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=wz($,G);if(U){let{quote:j,path:B,end:H}=U;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let O=B.startsWith(".")?u1.resolve(X,B):u1.resolve(Z,B.slice(2));Y+=`await import(${j}${O}${j})`,G=H;continue}}}Y+=K,G++}return Y}function wz($,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 DZ($,X){let Z=$[X];if(Z!=="{"&&Z!=="[")return null;let Y=P0($,Z,Z==="{"?"}":"]",X);if(Y===-1)return null;return{pattern:$.slice(X,Y+1),endPos:Y+1}}function yZ($){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?DZ(Z,J):null;if(w){X.push(...yZ(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 bZ($){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 VZ($,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 AZ($,X){let Z=$[X].trim(),J=bZ(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==="{"?"}":"]",O=VZ(z,B,H,0),L=z;for(let _=X+1;_<$.length&&O>0;_++)L+=` ${$[_].trim()}`,U=_,O=VZ($[_],B,H,O);if(O>0)L=z,U=X;z=L}let j=DZ(z,0);if(j){let B=K[1],H=j.pattern,O=z.slice(j.endPos).trim();if(O.startsWith("=")){let L=O.slice(1).trim(),_=L,F=Math.max(U,X);if(RZ(L)){let N=NZ($,F,L);_=N.value,F=N.nextIndex}else F=F+1;_=_.trim().replace(/;$/,"");let V=yZ(H),A=`__stx_src_${X}`,R=V.map((N)=>`module.exports.${N} = ${N};`).join(`
2565
+ `);return{type:B,name:A,value:`${_}; ${B} ${H} = ${A};
2566
+ ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,w]=Y,W=w,q=X;if(RZ(w)){let K=NZ($,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 MX($,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(Wz(Z)){let w=qz($,X,G);G=w.functionCode,Q=w.nextIndex}else Q=X+1;return{name:Y,functionCode:G,nextIndex:Q}}function RZ($){let X=$.trim();if(X.startsWith("{"))return P0(X,"{","}",0)===-1;if(X.startsWith("["))return P0(X,"[","]",0)===-1;return!SZ(X)}function SZ($){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 CZ($){let X=$.indexOf("(");if(X===-1)return $.indexOf("{");let Z=P0($,"(",")",X);if(Z===-1)return-1;return $.indexOf("{",Z)}function Wz($){let X=CZ($);if(X===-1)return!0;return P0($,"{","}",X)===-1}function NZ($,X,Z){let J=Z,Y=X+1;while(Y<$.length&&!SZ(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 Qz($,X,Z){let J=Z,Y=X+1;while(Y<$.length){let G=bZ(J);if(G!==-1){if(P0(J,"{","}",G)!==-1)break}let Q=$[Y];J+=`
2570
- ${Q}`,Y++}return{functionCode:J,nextIndex:Y}}function RZ($,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:{...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 wz($,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=RZ(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=RZ(W,X);if(q!==void 0)X[Q]=q}catch{}}}function SZ($){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 CZ($){let X=$.trim();if(!X)return!1;return/(?:const|let|var|function)\s+\w+/.test(X)}var IX,OZ,eK,$z,Zz;var d7=D(()=>{V0();x5();P1();y0();IX=["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"],OZ=new Set(IX),eK=new Set(["props","$props","defineProps"]),$z=new Set(["stx","@stacksjs/stx"]);Zz=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var DX={};t(DX,{renderSlot:()=>vZ,processSlots:()=>fZ,parseSlots:()=>PZ,parseSlotElement:()=>Uz,extractSlotContent:()=>Hz,applySlots:()=>_z});function Wz($,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 Kz($,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 zz($){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=Kz($,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 B=Wz($,Q);if(B!==-1){let j=U[1]||U[2]||U[3];X.push({start:G,end:B,slotName:j,content:$.slice(Q,B-11).trim(),propsBinding:U[4]||void 0}),Y=B;continue}}}if(!/\/\s*>$/.test(w)&&!qz.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 PZ($){let X={default:"",named:new Map},Z=$,J=zz($);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,B]=Q,j=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(j+H).trim(),L=`<${q}${O?" "+O:""}>${B}</${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,B=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(B+j).trim(),O=`<${q}${H?" "+H:""} />`;Y.push({start:Q.index,end:Q.index+W.length,slotName:z,element:O})}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 Uz($){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 vZ($,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=jz(Y,Q)}return Y}function jz($,X){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,J)=>{try{let Y=J.trim(),G=xZ(Y,X);return j1(String(G??""))}catch{return`{{ ${J} }}`}})}function xZ($,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(!q0($))return;return K0($,Object.keys(X))(...Object.values(X))}catch{return}}async function fZ($,X,Z){let J=$;J=await Bz(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||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(U))!==null){let O=H[1],L=H[2];B[O]=xZ(L,Z)}return await vZ(K,B,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 Bz($,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 Hz($){let X=PZ($);return{defaultSlot:X.default,namedSlots:X.named}}async function _z($,X,Z,J){return await fZ($,{default:X,named:Z},J)}var qz;var yX=D(()=>{B1();y0();qz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function d1($,X){let Z=Oz($,X);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function Oz($,X){let Z=X;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let J=P0($,"(",")",Z);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:$.slice(Z+1,J),endPos:J+1}}function Lz($,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 gZ($,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,B=0;while(q<w.length){let j=w.indexOf("@",q);if(j===-1)break;q=j;let H=w.substring(j);if(Lz(w,j)){q++;continue}if(/^@if\s*\(/.test(H)){B++,q++;continue}if(/^@endif(?![a-z])/.test(H)){B--,q+=6;continue}if(B===0){let O=H.match(/^@elseif\s*/);if(O){W.push({type:K,condition:z,content:w.substring(U,q),start:G+U,end:G+q});let L=q+O[0].length,_=d1(w,L);if(!_){q++;continue}K="elseif",z=_.expression,q=_.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 m7($){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=gZ($,J.index);if(G)X.push(G),Z.lastIndex=G.end;J=Z.exec($)}return X}function i8($,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=P0($,"(",")",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 B=$.slice(z,U),j=U+`@${Z}`.length;J.push({fullMatch:$.slice(w,j),name:X,params:K,content:B,start:w,end:j}),Y.lastIndex=j,G=Y.exec($)}return J}function bX($,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),B=U.match(/^@switch\s*\(/),j=U.match(/^@endswitch(?![a-z])/);if(B){if(z++,K)K.content+=B[0];q+=B[0].length;continue}if(j){if(z--,K)K.content+=j[0];q+=j[0].length;continue}if(z>0){if(K)K.content+=w[q];q++;continue}let H=U.match(/^@case\s*/),O=U.match(/^@default(?![a-z])/),L=U.match(/^@break(?![a-z])/);if(H&&U.startsWith("@case")){if(K)W.push(K);let _=q+H[0].length,F=d1(w,_);if(!F){q++;continue}K={type:"case",value:F.expression,content:""},q=F.endPos}else if(O&&U.startsWith("@default")){if(K)W.push(K);K={type:"default",content:""},q+=O[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 hZ=()=>{};var uZ=()=>{};var n8=D(()=>{hZ();uZ()});async function mZ($){let X=$;if(!X)try{X=(await Y1())?.pagesDir||"pages"}catch{X="pages"}let Z=X,J=dZ.get(Z);if(J)return J;let Y=[];try{Y=T7(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{Y=[]}return dZ.set(Z,Y),Y}var dZ;var cZ=D(()=>{n9();N1();dZ=new Map});function Rz($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function lZ($){return Rz(JSON.stringify($))}function c7($){let X=0,Z,J=SX.map(()=>{return});while(X<$.length){if(Z===void 0||Z!==null&&Z.index<X)pZ.lastIndex=X,Z=pZ.exec($);if(!Z)return null;let Y=Z.index,G=-1,Q=null;for(let W=0;W<SX.length;W++){let q=SX[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 r8($,X){let Z=c7($);if(!Z)return $;return $.slice(0,Z.index)+X(Z.tag,Z.attrs)+$.slice(Z.index+Z.tag.length)}var SX,pZ;var CX=D(()=>{SX=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],pZ=/<body\b([^>]*)>/gi});function PX(){return`
2569
+ ${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function qz($,X,Z){let J=Z,Y=X+1;while(Y<$.length){let G=CZ(J);if(G!==-1){if(P0(J,"{","}",G)!==-1)break}let Q=$[Y];J+=`
2570
+ ${Q}`,Y++}return{functionCode:J,nextIndex:Y}}function TZ($,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 Kz($,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=TZ(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=TZ(W,X);if(q!==void 0)X[Q]=q}catch{}}}function PZ($){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 vZ($){let X=$.trim();if(!X)return!1;return/(?:const|let|var|function)\s+\w+/.test(X)}var kX,FZ,Zz,Jz,Gz;var d7=D(()=>{A0();x5();P1();y0();kX=["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"],FZ=new Set(kX),Zz=new Set(["props","$props","defineProps"]),Jz=new Set(["stx","@stacksjs/stx"]);Gz=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var EX={};t(EX,{renderSlot:()=>fZ,processSlots:()=>hZ,parseSlots:()=>xZ,parseSlotElement:()=>Hz,extractSlotContent:()=>Lz,applySlots:()=>Fz});function zz($,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 jz($,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 Bz($){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=jz($,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=zz($,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)&&!Uz.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 xZ($){let X={default:"",named:new Map},Z=$,J=Bz($);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(),O=(B+H).trim(),L=`<${q}${O?" "+O:""}>${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(),O=`<${q}${H?" "+H:""} />`;Y.push({start:Q.index,end:Q.index+W.length,slotName:z,element:O})}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 Hz($){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 fZ($,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=_z(Y,Q)}return Y}function _z($,X){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,J)=>{try{let Y=J.trim(),G=gZ(Y,X);return j1(String(G??""))}catch{return`{{ ${J} }}`}})}function gZ($,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(!q0($))return;return K0($,Object.keys(X))(...Object.values(X))}catch{return}}async function hZ($,X,Z){let J=$;J=await Oz(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 O=H[1],L=H[2];j[O]=gZ(L,Z)}return await fZ(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 Oz($,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 Lz($){let X=xZ($);return{defaultSlot:X.default,namedSlots:X.named}}async function Fz($,X,Z,J){return await hZ($,{default:X,named:Z},J)}var Uz;var DX=D(()=>{B1();y0();Uz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function d1($,X){let Z=Vz($,X);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function Vz($,X){let Z=X;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let J=P0($,"(",")",Z);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:$.slice(Z+1,J),endPos:J+1}}function Az($,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 uZ($,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(Az(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 O=H.match(/^@elseif\s*/);if(O){W.push({type:K,condition:z,content:w.substring(U,q),start:G+U,end:G+q});let L=q+O[0].length,_=d1(w,L);if(!_){q++;continue}K="elseif",z=_.expression,q=_.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 m7($){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=uZ($,J.index);if(G)X.push(G),Z.lastIndex=G.end;J=Z.exec($)}return X}function n8($,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=P0($,"(",")",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 yX($,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*/),O=U.match(/^@default(?![a-z])/),L=U.match(/^@break(?![a-z])/);if(H&&U.startsWith("@case")){if(K)W.push(K);let _=q+H[0].length,F=d1(w,_);if(!F){q++;continue}K={type:"case",value:F.expression,content:""},q=F.endPos}else if(O&&U.startsWith("@default")){if(K)W.push(K);K={type:"default",content:""},q+=O[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 dZ=()=>{};var mZ=()=>{};var r8=D(()=>{dZ();mZ()});async function lZ($){let X=$;if(!X)try{X=(await Y1())?.pagesDir||"pages"}catch{X="pages"}let Z=X,J=cZ.get(Z);if(J)return J;let Y=[];try{Y=T7(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{Y=[]}return cZ.set(Z,Y),Y}var cZ;var pZ=D(()=>{i9();T1();cZ=new Map});function Mz($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function iZ($){return Mz(JSON.stringify($))}function c7($){let X=0,Z,J=bX.map(()=>{return});while(X<$.length){if(Z===void 0||Z!==null&&Z.index<X)nZ.lastIndex=X,Z=nZ.exec($);if(!Z)return null;let Y=Z.index,G=-1,Q=null;for(let W=0;W<bX.length;W++){let q=bX[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 o8($,X){let Z=c7($);if(!Z)return $;return $.slice(0,Z.index)+X(Z.tag,Z.attrs)+$.slice(Z.index+Z.tag.length)}var bX,nZ;var SX=D(()=>{bX=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],nZ=/<body\b([^>]*)>/gi});function CX(){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 xX(){return w5}function fX($){let X=w5;return iZ.push($),w5=$,X}function gX($){iZ.pop(),w5=$}function hX(){return o8>0}function uX($){vX.add($)}function nZ($){o8++;try{$()}finally{if(o8--,o8===0){let X=[...vX];vX.clear();for(let Z of X)Z()}}}function rZ($){let X=w5;w5=null;try{return $()}finally{w5=X}}var w5=null,iZ,o8=0,vX;var oZ=D(()=>{iZ=[],vX=new Set});function m1($){let X=$,Z=new Set,J=new Set,Y=()=>{let G=xX();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)),hX())J.forEach((w)=>uX(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 a8($){let X,Z=!0,J=new Set,Y=()=>{if(!Z)if(Z=!0,hX())J.forEach((Q)=>uX(Q));else J.forEach((Q)=>Q())},G=()=>{let Q=xX();if(Q)J.add(Q);if(Z){let w=fX(Y);try{X=$()}finally{gX(w)}Z=!1}return X};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function t8($,X={}){let Z,J=!1,Y=()=>{if(J)return;if(Z)Z(),Z=void 0;let G=fX(Y);try{let Q=$();Z=typeof Q==="function"?Q:void 0}finally{gX(G)}};if(X.immediate!==!1)Y();return()=>{if(J=!0,Z)Z()}}function mX($){nZ($)}function cX($){dX.push($)}function lX($){s8.push($)}function Nz(){sZ(dX,"onMount",s8)}function Tz(){sZ(s8,"onDestroy")}function sZ($,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 Mz(){return{mount:dX.length,destroy:s8.length}}function e8($){return typeof $==="function"&&$._isSignal===!0}function $$($){return typeof $==="function"&&$._isDerived===!0}function pX($){if(e8($)||$$($))return $();return $}function X$($){return rZ($)}function kz($,X){let Z=typeof $==="function"?$:()=>$,J=m1([]),Y=a8(()=>J().reduce((w,W)=>X(w,W.action),Z())),G=!1;return t8(()=>{if(Z(),!G){G=!0;return}if(X$(()=>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 dX,s8;var Z$=D(()=>{oZ();dX=[],s8=[]});var tZ={};t(tZ,{useOptimistic:()=>kz,untrack:()=>pX,state:()=>m1,runMountCallbacks:()=>Nz,runDestroyCallbacks:()=>Tz,pendingLifecycleCounts:()=>Mz,peek:()=>X$,onMount:()=>cX,onDestroy:()=>lX,isSignal:()=>e8,isDerived:()=>$$,generateSignalsRuntimeDev:()=>iX,generateSignalsRuntime:()=>aZ,effect:()=>t8,derived:()=>a8,default:()=>Ez,batch:()=>mX});function aZ(){let $=Iz(iX());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 Iz($){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 iX(){return`
2673
+ `}function vX(){return w5}function xX($){let X=w5;return rZ.push($),w5=$,X}function fX($){rZ.pop(),w5=$}function gX(){return s8>0}function hX($){PX.add($)}function oZ($){s8++;try{$()}finally{if(s8--,s8===0){let X=[...PX];PX.clear();for(let Z of X)Z()}}}function sZ($){let X=w5;w5=null;try{return $()}finally{w5=X}}var w5=null,rZ,s8=0,PX;var aZ=D(()=>{rZ=[],PX=new Set});function m1($){let X=$,Z=new Set,J=new Set,Y=()=>{let G=vX();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)),gX())J.forEach((w)=>hX(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 t8($){let X,Z=!0,J=new Set,Y=()=>{if(!Z)if(Z=!0,gX())J.forEach((Q)=>hX(Q));else J.forEach((Q)=>Q())},G=()=>{let Q=vX();if(Q)J.add(Q);if(Z){let w=xX(Y);try{X=$()}finally{fX(w)}Z=!1}return X};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function e8($,X={}){let Z,J=!1,Y=()=>{if(J)return;if(Z)Z(),Z=void 0;let G=xX(Y);try{let Q=$();Z=typeof Q==="function"?Q:void 0}finally{fX(G)}};if(X.immediate!==!1)Y();return()=>{if(J=!0,Z)Z()}}function dX($){oZ($)}function mX($){uX.push($)}function cX($){a8.push($)}function kz(){tZ(uX,"onMount",a8)}function Iz(){tZ(a8,"onDestroy")}function tZ($,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 Ez(){return{mount:uX.length,destroy:a8.length}}function $$($){return typeof $==="function"&&$._isSignal===!0}function X$($){return typeof $==="function"&&$._isDerived===!0}function lX($){if($$($)||X$($))return $();return $}function Z$($){return sZ($)}function Dz($,X){let Z=typeof $==="function"?$:()=>$,J=m1([]),Y=t8(()=>J().reduce((w,W)=>X(w,W.action),Z())),G=!1;return e8(()=>{if(Z(),!G){G=!0;return}if(Z$(()=>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 uX,a8;var J$=D(()=>{aZ();uX=[],a8=[]});var $J={};t($J,{useOptimistic:()=>Dz,untrack:()=>lX,state:()=>m1,runMountCallbacks:()=>kz,runDestroyCallbacks:()=>Iz,pendingLifecycleCounts:()=>Ez,peek:()=>Z$,onMount:()=>mX,onDestroy:()=>cX,isSignal:()=>$$,isDerived:()=>X$,generateSignalsRuntimeDev:()=>pX,generateSignalsRuntime:()=>eZ,effect:()=>e8,derived:()=>t8,default:()=>bz,batch:()=>dX});function eZ(){let $=yz(pX());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 yz($){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 pX(){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
@@ -5276,7 +5276,7 @@ catch (e2) {
5276
5276
  // :attr still works for backward compat but is reserved for structural directives.
5277
5277
  // x-text, x-html, x-model, x-show, x-if, x-for, x-cloak, x-ref, x-data are
5278
5278
  // handled by their own code paths below \u2014 exclude them here.
5279
- var X_HANDLED = ${H2()};
5279
+ var X_HANDLED = ${O2()};
5280
5280
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
5281
5281
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
5282
5282
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
@@ -8034,16 +8034,34 @@ catch (e) {} }
8034
8034
  if (opts.domain) parts.push('domain=' + opts.domain);
8035
8035
  if (value === '') parts.push('max-age=0');
8036
8036
  else if (typeof opts.maxAge === 'number') parts.push('max-age=' + opts.maxAge);
8037
- else if (opts.expires) parts.push('expires=' + opts.expires.toUTCString());
8037
+ else if (opts.expires !== undefined) {
8038
+ // Date, seconds-from-now, or anything Date can parse \u2014 matching the
8039
+ // composable. Accepting only a Date here meant the same option silently
8040
+ // produced a session cookie on the runtime path.
8041
+ var expiresDate = opts.expires instanceof Date
8042
+ ? opts.expires
8043
+ : (typeof opts.expires === 'number' ? new Date(Date.now() + opts.expires * 1000) : new Date(opts.expires));
8044
+ parts.push('expires=' + expiresDate.toUTCString());
8045
+ }
8038
8046
  parts.push('SameSite=' + (opts.sameSite || 'Lax'));
8039
8047
  var secure = opts.secure;
8040
8048
  if (secure === undefined) secure = typeof location !== 'undefined' && location.protocol === 'https:';
8041
8049
  if (secure) parts.push('Secure');
8042
8050
  return parts.join('; ');
8043
8051
  }
8044
- effect(function() {
8052
+ // subscribe, not effect: an effect runs once at creation, so merely
8053
+ // DECLARING a cookie rewrote it from these options. A second declaration
8054
+ // that only wanted to read - no options, because it is not the owner of the
8055
+ // policy - therefore reserialised it with no max-age, which is the
8056
+ // definition of a session cookie. A 30-day login died at browser close
8057
+ // because the user opened a settings page (#1933).
8058
+ //
8059
+ // subscribe fires on set() only, so construction is a pure read: read()
8060
+ // above already seeds the signal. This matches the composable, which has
8061
+ // always used subscribe.
8062
+ s.subscribe(function(value) {
8045
8063
  if (typeof document === 'undefined') return;
8046
- document.cookie = serialise(s());
8064
+ document.cookie = serialise(value);
8047
8065
  });
8048
8066
  return s;
8049
8067
  }
@@ -10636,42 +10654,42 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
10636
10654
  }
10637
10655
  }
10638
10656
  })();
10639
- `}var Ez;var eZ=D(()=>{Z$();J1();Z$();Ez={state:m1,derived:a8,effect:t8,batch:mX,onMount:cX,onDestroy:lX,isSignal:e8,isDerived:$$,untrack:pX,peek:X$,generateSignalsRuntime:aZ,generateSignalsRuntimeDev:iX}});var nX={};t(nX,{templateCache:()=>$J,readFileCached:()=>Dz,invalidateFileCacheByDir:()=>bz,invalidateFileCache:()=>yz,hashFilePath:()=>l7,getCachedSignalsRuntime:()=>Pz,getCachedRouterScript:()=>vz,clearDevCaches:()=>xz,checkCache:()=>fz,cacheTemplate:()=>gz,__setSignalsGeneratorsForTest:()=>Cz});import c1 from"fs";import g5 from"path";async function Dz($){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 yz($){W5.delete($)}function bz($){for(let X of W5.keys())if(X.startsWith($))W5.delete(X)}function Cz($){XJ=$}async function Pz($=!1){let X=XJ??await Promise.resolve().then(() => (eZ(),tZ));if($)return X.generateSignalsRuntimeDev();if(J$===null)J$=X.generateSignalsRuntime();return J$}async function vz(){if(Y$===null){let{getRouterScript:$}=await Promise.resolve().then(() => (S1(),f6));Y$=$()}return Y$}function xz(){W5.clear(),JJ(),J$=null,Sz=null,Y$=null}function ZJ($){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 fz($,X){try{if(!X.cachePath)return null;let Z=g5.resolve(X.cachePath),J=g5.join(Z,`${l7($)}.html`),Y=g5.join(Z,`${l7($)}.meta.json`);if(!await e(J)||!await e(Y))return null;let G=await Bun.file(Y).text(),Q=JSON.parse(G);if(Q.cacheVersion!==X.cacheVersion)return null;if(Q.optionsSignature!==ZJ(X))return null;if((await c1.promises.stat($)).mtime.getTime()>Q.mtime)return null;for(let W of Q.dependencies)if(await e(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 gz($,X,Z,J){try{if(!J.cachePath)return;let Y=g5.resolve(J.cachePath);await c1.promises.mkdir(Y,{recursive:!0});let G=g5.join(Y,`${l7($)}.html`),Q=g5.join(Y,`${l7($)}.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:ZJ(J),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(W,null,2)),$J.set($,{output:X,mtime:w.mtime.getTime(),dependencies:Z})}catch(Y){console.warn(`Failed to cache template ${$}:`,Y)}}function l7($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,hz)}var $J,W5,J$=null,Sz=null,XJ=null,Y$=null,hz=16;var rX=D(()=>{V0();$J=new Map,W5=new Map});function YJ($){return $.includes("data-stx-runtime")}function GJ($){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 oX($,X){let Z=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(Z!==-1&&(J===-1||Z>J))return $.slice(0,Z)+X+`
10657
+ `}var bz;var XJ=D(()=>{J$();J1();J$();bz={state:m1,derived:t8,effect:e8,batch:dX,onMount:mX,onDestroy:cX,isSignal:$$,isDerived:X$,untrack:lX,peek:Z$,generateSignalsRuntime:eZ,generateSignalsRuntimeDev:pX}});var iX={};t(iX,{templateCache:()=>ZJ,readFileCached:()=>Sz,invalidateFileCacheByDir:()=>Pz,invalidateFileCache:()=>Cz,hashFilePath:()=>l7,getCachedSignalsRuntime:()=>fz,getCachedRouterScript:()=>gz,clearDevCaches:()=>hz,checkCache:()=>uz,cacheTemplate:()=>dz,__setSignalsGeneratorsForTest:()=>xz});import c1 from"fs";import g5 from"path";async function Sz($){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 Cz($){W5.delete($)}function Pz($){for(let X of W5.keys())if(X.startsWith($))W5.delete(X)}function xz($){JJ=$}async function fz($=!1){let X=JJ??await Promise.resolve().then(() => (XJ(),$J));if($)return X.generateSignalsRuntimeDev();if(Y$===null)Y$=X.generateSignalsRuntime();return Y$}async function gz(){if(G$===null){let{getRouterScript:$}=await Promise.resolve().then(() => (S1(),h6));G$=$()}return G$}function hz(){W5.clear(),GJ(),Y$=null,vz=null,G$=null}function YJ($){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 uz($,X){try{if(!X.cachePath)return null;let Z=g5.resolve(X.cachePath),J=g5.join(Z,`${l7($)}.html`),Y=g5.join(Z,`${l7($)}.meta.json`);if(!await e(J)||!await e(Y))return null;let G=await Bun.file(Y).text(),Q=JSON.parse(G);if(Q.cacheVersion!==X.cacheVersion)return null;if(Q.optionsSignature!==YJ(X))return null;if((await c1.promises.stat($)).mtime.getTime()>Q.mtime)return null;for(let W of Q.dependencies)if(await e(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 dz($,X,Z,J){try{if(!J.cachePath)return;let Y=g5.resolve(J.cachePath);await c1.promises.mkdir(Y,{recursive:!0});let G=g5.join(Y,`${l7($)}.html`),Q=g5.join(Y,`${l7($)}.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:YJ(J),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(W,null,2)),ZJ.set($,{output:X,mtime:w.mtime.getTime(),dependencies:Z})}catch(Y){console.warn(`Failed to cache template ${$}:`,Y)}}function l7($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,mz)}var ZJ,W5,Y$=null,vz=null,JJ=null,G$=null,mz=16;var nX=D(()=>{A0();ZJ=new Map,W5=new Map});function QJ($){return $.includes("data-stx-runtime")}function wJ($){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 rX($,X){let Z=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(Z!==-1&&(J===-1||Z>J))return $.slice(0,Z)+X+`
10640
10658
  `+$.slice(Z);let Y=/<head\b[^>]*>/i.exec($);if(Y){let Q=Y.index+Y[0].length;return`${$.slice(0,Q)}
10641
10659
  ${X}${$.slice(Q)}`}if($.includes("</head>")){let Q=$.indexOf("</head>");return $.slice(0,Q)+X+`
10642
- `+$.slice(Q)}if(c7($))return r8($,(Q)=>`${Q}
10660
+ `+$.slice(Q)}if(c7($))return o8($,(Q)=>`${Q}
10643
10661
  ${X}`);return`${X}
10644
- ${$}`}async function G$($,X){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(X.buildMode==="serve")return oX($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(X.buildMode==="compile")return oX($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (rX(),nX)),J=await Z(X.debug);return oX($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function uz($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function QJ($){if($.includes("data-stx-tooltip-runtime")||!uz($))return $;let X=`<script data-stx-scoped data-stx-tooltip-runtime>${PX()}</script>`,Z=$.lastIndexOf("</body>");if(Z===-1)return`${$}
10662
+ ${$}`}async function Q$($,X){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(X.buildMode==="serve")return rX($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(X.buildMode==="compile")return rX($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (nX(),iX)),J=await Z(X.debug);return rX($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function cz($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function WJ($){if($.includes("data-stx-tooltip-runtime")||!cz($))return $;let X=`<script data-stx-scoped data-stx-tooltip-runtime>${CX()}</script>`,Z=$.lastIndexOf("</body>");if(Z===-1)return`${$}
10645
10663
  ${X}`;return`${$.slice(0,Z)}${X}
10646
- ${$.slice(Z)}`}async function sX($,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 mZ(X?.pagesDir);if(W.length>0)w.ownedRoutes=W}catch{}if(Object.keys(w).length>0)J=`<script>window.__stxRouterConfig=${lZ(w)};</script>
10647
- `}let{getCachedRouterScript:Y}=await Promise.resolve().then(() => (rX(),nX)),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+`
10648
- </body>`+$.slice(Q+7)}var Q$=D(()=>{cZ();CX()});var z$={};t(z$,{scanScriptTags:()=>UJ,rewriteStxImportSpecifiers:()=>_J,processSignals:()=>Z4,processScriptSetup:()=>BJ,preEvalLiteralReactiveIfs:()=>$4,parseLoopExpression:()=>tX,hasSignalsSyntax:()=>K$,findMarkupIndexOutsideScripts:()=>W$,extractExports:()=>HJ,convertSignalLoopsToAttributes:()=>X4,convertSignalDirectivesToAttributes:()=>eX});function UJ($,X={}){let Z=[];for(let J of h8($,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 tX($){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}=wJ(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}=wJ(Y);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:w}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function wJ($){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 K$($){return z2($)}function mz($){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 cz($){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 lz($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let X=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${aX})>`,"iy"),Z=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=h8($,(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=tX(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)||q$.has(K.toLowerCase())?G.end:jJ($,G.start,K,G.end);if(U!==-1)Y.push({start:G.start,end:U,vars:new Set(q)})}return Y}function pz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function qJ($,X,Z,J){if(!$)return!1;let Y=pz($),G=!1,Q=!1,w=!1,W=/([a-zA-Z_$][\w$]*)/g,q;while((q=W.exec(Y))!==null){let B=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(WJ.has(B))continue;if(X.has(B)||J?.has(B))G=!0;else if(Z&&B 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 B=z[1];if(Y.slice(0,z.index).trimEnd().endsWith("."))continue;if(WJ.has(B)||Z&&B in Z)continue;w=!0}return(G||w)&&!Q}function w$($,X,Z){let J=Z===void 0?` ${X}`:` ${X}="${Z.replace(/"/g,"&quot;")}"`,Y=$.trim(),G=Y.match(zJ);if(G&&iz(G[3],G[1])){let[,Q,w,W]=G;return`<${Q}${w}${J}>${W}</${Q}>`}return`<template${J}>${Y}</template>`}function iz($,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 eX($,X){let Z=cz($);function J(Y){let G=Y,Q=lz(Y),w=(z)=>{let U=new Set;for(let B of Q)if(z>B.start&&z<B.end)for(let j of B.vars)U.add(j);return U},W=/@if\s*\(/g,q,K=[];while((q=W.exec(G))!==null){let z=q.index,U=z+q[0].length,B=1,j=U;while(j<G.length&&B>0){if(G[j]==="(")B++;else if(G[j]===")")B--;j++}if(B!==0)continue;let H=G.substring(U,j-1).trim(),O=j,L=1,_=O,F=/@(if\s*\(|endif)/g;F.lastIndex=O;let V;while((V=F.exec(G))!==null)if(V[1].startsWith("if"))L++;else if(V[1]==="endif"){if(L--,L===0){_=V.index+V[0].length;break}}if(L!==0)continue;let A=G.substring(O,_-6).trim(),R;if(mz(A)){let N=m7(G.substring(z,_));if(N.length===0)continue;let T=N[0].branches.filter((I)=>I.type!=="else"),M=w(z);if(!(T.length>0&&T.every((I)=>qJ(I.condition,Z,X,M))))continue;R=N[0].branches.map((I)=>{let S=J(I.content);if(I.type==="elseif")return w$(S,"@else-if",I.condition??"");if(I.type==="else")return w$(S,"@else");return w$(S,"@if",I.condition??"")}).join(`
10649
- `)}else{if(!qJ(H,Z,X,w(z)))continue;R=w$(J(A),"@if",H)}K.push({start:z,end:_,replacement:R}),W.lastIndex=_}for(let z=K.length-1;z>=0;z--){let{start:U,end:B,replacement:j}=K[z];G=G.substring(0,U)+j+G.substring(B)}return G}return J($)}function nz($){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 jJ($,X,Z,J){if(q$.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 B=$.indexOf("-->",W+4);if(B===-1)return-1;W=B+3;continue}let K=/^<(script|style)\b/i.exec($.slice(W,W+8));if(K){let B=$.indexOf(">",W);if(B===-1)return-1;if($[B-1]==="/"){W=B+1;continue}let j=G.indexOf(`</${K[1].toLowerCase()}`,W);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;W=H+1;continue}if($[W+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(W,W+64));if(!B){W++;continue}if(B[1].toLowerCase()===Y){if(w--,W+=B[0].length,w===0)return W;continue}W+=B[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 B=$.slice(W,U+1);if(!(/\/\s*>$/.test(B)||q$.has(Y)))w++}W=U+1}return-1}function oz($,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 rz.test(G)}function $4($){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,B])=>z>=U&&z<B),G=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,Q=[],w;while((w=G.exec($))!==null){if(Y(w.index))continue;let[z,U,B,j,H,O,L]=w,_=nz(H);if(_===void 0)continue;let F=w.index,V=F+z.length,N=!!L||/\/\s*>$/.test(z)||q$.has(U.toLowerCase())?V:jJ($,F,U,V);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&oz($,N)){G.lastIndex=V;continue}if(_===!0){let M=`<${U}${B}${O}${L}>`;Q.push({start:F,end:V,replacement:M});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:B,replacement:j}=W[z];K=K.substring(0,U)+j+K.substring(B)}return K}function X4($,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(),B=z,j=tX(U),H=w==="for"?"@endfor":"@endforeach",O=1,L=B,_=w==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${w}\\s*\\(|end${w})`,"g");_.lastIndex=B;let F;while((F=_.exec(Z))!==null)if(F[1].startsWith(w))O++;else if(O--,O===0){L=F.index+F[0].length;break}if(O!==0)continue;let V=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)Q.push({start:W,end:L,vars:T})};if(j.iterable){let T=j.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){V();continue}let M=T.split(/[.[(]/)[0].trim(),k=X?M in X:!1,E=Q.some((I)=>W>I.start&&W<I.end&&I.vars.includes(M));if(M&&(k||E)){V();continue}}if(j.style==="as")U=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let A=Z.substring(B,L-H.length).trim(),R=A.match(zJ),N;if(R){let[,T,M,k]=R;N=`<${T}${M} @for="${U}">${k}</${T}>`}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 sz($){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]!==`
10650
- `)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 B=$[z];if(B==="/"&&$[z+1]==="/"){let j=z+2;while(j<G&&$[j]!==`
10651
- `)j++;z=j;continue}if(B==="/"&&$[z+1]==="*"){let j=z+2;while(j<G-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=z+1;while(j<G){if($[j]==="\\"){j+=2;continue}if($[j]===B){j++;break}j++}z=j;continue}if(B==="("||B==="["||B==="{"){U++,z++;continue}if(B===")"||B==="]"||B==="}"){U--,z++;continue}if(B===";"&&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 B=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],H=q(J+B[0].length);if(X.has(j)){Z.push(`/* stx: deduped const ${j} */`),J=H;continue}X.add(j),Z.push($.slice(J,H)),J=H;continue}}}Z.push(K),J++}return Z.join("")}async function BJ($,X,Z){let J=UJ($,{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 O of J){let L=O.body;if(X5(O.attrs))L=Z5(L);if(Y.test(L))G.push({fullMatch:O.fullMatch,attrs:O.attrs,content:L})}if(G.length===0)return{output:$,setupCode:null};let Q=`__stx_setup_${Date.now()}_${dz++}`,{hasUserImports:w,bundleClientScript:W}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (D5(),b7))),q=[];for(let O=0;O<G.length;O++){let L=G[O].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)=>_J(V));let _=r0(L);q.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
10664
+ ${$.slice(Z)}`}async function oX($,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 lZ(X?.pagesDir);if(W.length>0)w.ownedRoutes=W}catch{}if(Object.keys(w).length>0)J=`<script>window.__stxRouterConfig=${iZ(w)};</script>
10665
+ `}let{getCachedRouterScript:Y}=await Promise.resolve().then(() => (nX(),iX)),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 w$=D(()=>{pZ();SX()});var U$={};t(U$,{scanScriptTags:()=>BJ,rewriteStxImportSpecifiers:()=>LJ,processSignals:()=>X4,processScriptSetup:()=>_J,preEvalLiteralReactiveIfs:()=>eX,parseLoopExpression:()=>aX,hasSignalsSyntax:()=>z$,findMarkupIndexOutsideScripts:()=>q$,extractExports:()=>OJ,convertSignalLoopsToAttributes:()=>$4,convertSignalDirectivesToAttributes:()=>tX});function BJ($,X={}){let Z=[];for(let J of u8($,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 aX($){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}=qJ(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}=qJ(Y);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:w}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function qJ($){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 z$($){return j2($)}function pz($){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 iz($){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 nz($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let X=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${sX})>`,"iy"),Z=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=u8($,(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=aX(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)||K$.has(K.toLowerCase())?G.end:HJ($,G.start,K,G.end);if(U!==-1)Y.push({start:G.start,end:U,vars:new Set(q)})}return Y}function rz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function zJ($,X,Z,J){if(!$)return!1;let Y=rz($),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(KJ.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(KJ.has(j)||Z&&j in Z)continue;w=!0}return(G||w)&&!Q}function W$($,X,Z){let J=Z===void 0?` ${X}`:` ${X}="${Z.replace(/"/g,"&quot;")}"`,Y=$.trim(),G=Y.match(jJ);if(G&&oz(G[3],G[1])){let[,Q,w,W]=G;return`<${Q}${w}${J}>${W}</${Q}>`}return`<template${J}>${Y}</template>`}function oz($,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 tX($,X){let Z=iz($);function J(Y){let G=Y,Q=nz(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(),O=B,L=1,_=O,F=/@(if\s*\(|endif)/g;F.lastIndex=O;let V;while((V=F.exec(G))!==null)if(V[1].startsWith("if"))L++;else if(V[1]==="endif"){if(L--,L===0){_=V.index+V[0].length;break}}if(L!==0)continue;let A=G.substring(O,_-6).trim(),R;if(pz(A)){let N=m7(G.substring(z,_));if(N.length===0)continue;let I=N[0].branches.filter((M)=>M.type!=="else"),T=w(z);if(!(I.length>0&&I.every((M)=>zJ(M.condition,Z,X,T))))continue;R=N[0].branches.map((M)=>{let S=J(M.content);if(M.type==="elseif")return W$(S,"@else-if",M.condition??"");if(M.type==="else")return W$(S,"@else");return W$(S,"@if",M.condition??"")}).join(`
10667
+ `)}else{if(!zJ(H,Z,X,w(z)))continue;R=W$(J(A),"@if",H)}K.push({start:z,end:_,replacement:R}),W.lastIndex=_}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 sz($){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 HJ($,X,Z,J){if(K$.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)||K$.has(Y)))w++}W=U+1}return-1}function tz($,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 az.test(G)}function eX($){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,O,L]=w,_=sz(H);if(_===void 0)continue;let F=w.index,V=F+z.length,N=!!L||/\/\s*>$/.test(z)||K$.has(U.toLowerCase())?V:HJ($,F,U,V);if(N===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&tz($,N)){G.lastIndex=V;continue}if(_===!0){let T=`<${U}${j}${O}${L}>`;Q.push({start:F,end:V,replacement:T});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 $4($,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=aX(U),H=w==="for"?"@endfor":"@endforeach",O=1,L=j,_=w==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${w}\\s*\\(|end${w})`,"g");_.lastIndex=j;let F;while((F=_.exec(Z))!==null)if(F[1].startsWith(w))O++;else if(O--,O===0){L=F.index+F[0].length;break}if(O!==0)continue;let V=()=>{let I=[B.itemVar,B.indexVar].filter(Boolean);if(I.length)Q.push({start:W,end:L,vars:I})};if(B.iterable){let I=B.iterable.trim();if(I.startsWith("[")||I.startsWith("{")||I.startsWith("'")||I.startsWith('"')||I.startsWith("`")||/^-?\d/.test(I)){V();continue}let T=I.split(/[.[(]/)[0].trim(),k=X?T in X:!1,E=Q.some((M)=>W>M.start&&W<M.end&&M.vars.includes(T));if(T&&(k||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(jJ),N;if(R){let[,I,T,k]=R;N=`<${I}${T} @for="${U}">${k}</${I}>`}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 ez($){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
+ `)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 _J($,X,Z){let J=BJ($,{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 O of J){let L=O.body;if(X5(O.attrs))L=Z5(L);if(Y.test(L))G.push({fullMatch:O.fullMatch,attrs:O.attrs,content:L})}if(G.length===0)return{output:$,setupCode:null};let Q=`__stx_setup_${Date.now()}_${lz++}`,{hasUserImports:w,bundleClientScript:W}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (D5(),b7))),q=[];for(let O=0;O<G.length;O++){let L=G[O].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)=>LJ(V));let _=r0(L);q.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
10652
10670
  ${_}`)}let K=q.join(`
10653
10671
 
10654
- `);K=sz(K);let z=HJ(K),U=z.split(",").map((O)=>O.trim()).filter(Boolean),B=P8(K,Z),j=`
10672
+ `);K=ez(K);let z=OJ(K),U=z.split(",").map((O)=>O.trim()).filter(Boolean),j=v8(K,Z),B=`
10655
10673
  <script data-stx-scoped>
10656
10674
  function ${Q}() {
10657
10675
  ${I5("const",U)}
10658
- ${E5(`${B}${K}`)}
10676
+ ${E5(`${j}${K}`)}
10659
10677
  return { ${z} };
10660
10678
  }
10661
10679
  window.__stx_latestSetup=${Q};
10662
10680
  if(window.stx)window.stx._latestSetup=${Q};
10663
- </script>`,H=$;for(let O of G)H=H.split(O.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${aX})>`),`<body$1 data-stx="${Q}">`);else{let O=["script","style","html","head","meta","link","title","!doctype"],L=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${aX})>`,"gi"),(_,F,V)=>{if(L||O.includes(F.toLowerCase()))return _;return L=!0,`<${F}${V} data-stx="${Q}">`})}return{output:H,setupCode:j}}function HJ($){let X=$,Z=[],J=new Set,Y=0,G=0,Q=X.length,w="",W=()=>{G++;let j=!1;while(G<Q){let H=X[G];if(H==="\\"){G+=2;continue}if(H==="["&&!j){j=!0,G++;continue}if(H==="]"&&j){j=!1,G++;continue}if(H==="/"&&!j){G++;while(G<Q&&/[gimsuyd]/.test(X[G]))G++;return}if(H===`
10664
- `)return;G++}},q=()=>{if(!w)return!0;if(/[\w)\]]/.test(w))return!1;return!0},K=(j)=>{G++;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===j){G++;return}G++}},z=()=>{G++;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"){G++;return}if(X[G]==="$"&&X[G+1]==="{"){G+=2;let j=1;while(G<Q&&j>0)if(X[G]==="{")j++,G++;else if(X[G]==="}")j--,G++;else if(X[G]==="'"||X[G]==='"')K(X[G]);else if(X[G]==="`")z();else G++;continue}G++}},U=()=>{if(X[G]==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
10665
- `)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},B=()=>{if(Y!==0)return;let j=X.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(j){let F=j[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 O=X.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[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 _=X.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let F=_[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])))B();if(!/\s/.test(X[G]))w=X[G];G++}return Z.join(", ")}async function Z4($,X,Z,J){if(!K$($))return $;let Y=$;if(X.skipSignalsRuntime)return Y;let{output:G,setupCode:Q}=await BJ(Y,Z,J);if(Y=G,Y=await G$(Y,X),Q){let K=W$(Y,/<\/head>/i),z=K===-1?W$(Y,/<body[^>]*>/i):-1;if(K!==-1)Y=`${Y.slice(0,K)}${Q}
10666
- ${Y.slice(K)}`;else if(z!==-1){let U=/<body[^>]*>/i.exec(Y.slice(z))[0],B=z+U.length;Y=`${Y.slice(0,B)}
10667
- ${Q}${Y.slice(B)}`}else Y=`${Y}
10668
- ${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=W$(Y,K);if(z!==-1){let U=Y.slice(0,z),B=Y.slice(z).replace(K,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Y=U+B}}return Y}function W$($,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 _J($){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 KJ;return`var ${X.join(", ")}; ${KJ}`}var dz=0,aX=`(?:"[^"]*"|'[^']*'|[^>"'])*`,zJ,WJ,q$,rz,KJ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var p7=D(()=>{x7();n8();J1();QX();V0();Q$();x1();y7();zJ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;WJ=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"]);q$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);rz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import az from"fs";import h from"path";function ez($){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 OJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $U($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function X5($){return!$U($)}function M1($){let X;try{X=JSON.stringify($)}catch{return new Bun.Transpiler($)}let Z=U$.get(X);if(Z)return Z;if(U$.size>=16)U$.clear();let J=new Bun.Transpiler($);return U$.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=M1({loader:"ts",target:"browser",define:c0()}).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 XU($){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]!==`
10669
- `)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 j=K[2].split(",").map((H)=>{let O=H.trim().split(":");return O[O.length-1].trim()});for(let H of j)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 j=z[2];if(!Z.has(j))X.push(j),Z.add(j);return}let U=$.slice(Y).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let j=U[1];if(!Z.has(j))X.push(j),Z.add(j);return}let B=$.slice(Y).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Z.has(j))X.push(j),Z.add(j)}};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 ZU($){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 JU($){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 YU($,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 ZU(w)){let q=W.trim();if(!q||q.startsWith("..."))continue;let K=JU(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 B=Object.keys(X),j=Function(...B,`"use strict"; return (${U});`);X[z]=j(...B.map((H)=>X[H]))}catch{}}}catch{}}async function H$($,X,Z,J,Y){let G=$.endsWith(".stx")?$.slice(0,-4):$,Q=(O)=>O.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""),w=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Z.__importedComponents;if(W){for(let O of[G,G.toLowerCase(),Q(G),w(G)])if(W.has(O))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=[],B=(O)=>{if(O&&!U.includes(O))U.push(O)},j=Z.__originalFilePath;if(j)B(h.join(h.dirname(j),"components"));B(X),B(Y._rootComponentsDir),B(h.join(h.dirname(J),"components")),B(Y.componentsDir);let H=Y._pluginComponentDirs;if(Array.isArray(H))for(let O of H)B(typeof O==="string"?O:null);if(K)B(h.resolve(K,"resources/views/components")),B(h.resolve(K,"resources/components")),B(h.resolve(K,"src/components")),B(h.resolve(K,"components"));if(G.startsWith("./")||G.startsWith("../"))return e(h.resolve(h.dirname(J),`${G}.stx`));for(let O of U){let L=h.isAbsolute(O)?O:h.resolve(z,O);for(let _ of q)if(await e(h.join(L,_)))return!0}return!1}function GU($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function QU($){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 wU($){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 X0("stx/variable-extractor",()=>Promise.resolve().then(() => (d7(),p8))),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 B=U&&U!=="load"&&GU(U)?U:"";try{let j=(v)=>v.split("-").map((m)=>m.charAt(0).toUpperCase()+m.slice(1)).join(""),H=(v)=>v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,L=null,_=Y.__importedComponents;if(_){let v=[O,O.toLowerCase(),j(O),H(O)];for(let m of v)if(_.has(m)){L=_.get(m);break}}let F=[];if(!L){let v=[`${O}.stx`,`${j(O)}.stx`,`${H(O)}.stx`],m=[...new Set(v)],U0=Y.__originalFilePath,Z0=[];if(U0){let B0=h.join(h.dirname(U0),"components");Z0.push(B0)}if(J)Z0.push(J);let I0=Q._rootComponentsDir;if(typeof I0==="string"&&!Z0.includes(I0))Z0.push(I0);let E0=h.join(h.dirname(G),"components");if(!Z0.includes(E0))Z0.push(E0);if(Q.componentsDir&&Q.componentsDir!==J&&!Z0.includes(Q.componentsDir))Z0.push(Q.componentsDir);let b1=Q._pluginComponentDirs;if(Array.isArray(b1)){for(let B0 of b1)if(typeof B0==="string"&&!Z0.includes(B0))Z0.push(B0)}let m0=typeof Q.root==="string"?h.resolve(Q.root):void 0,g0=m0??h.dirname(G),K1=[];if(m0)K1.push(h.resolve(m0,"resources/views/components")),K1.push(h.resolve(m0,"resources/components")),K1.push(h.resolve(m0,"src/components")),K1.push(h.resolve(m0,"components"));K1.push(h.resolve(import.meta.dir,"components"));for(let B0 of K1)if(!Z0.includes(B0))Z0.push(B0);let s1=[...new Set(Z0.map((B0)=>{if(!B0)return B0;return h.isAbsolute(B0)?B0:h.resolve(g0,B0)}))];Z0.length=0,Z0.push(...s1);let a=`${O}\x00${G}\x00${s1.join("\x00")}`,Z1=B$.get(a);if(Z1)if(await e(Z1))L=Z1;else B$.delete(a);if(!L&&(O.startsWith("./")||O.startsWith("../")))L=h.resolve(h.dirname(G),`${O}.stx`),F.push(L);else if(!L)for(let B0 of Z0){if(!B0)continue;for(let a1 of m){let t1=h.join(B0,a1);if(F.push(t1),await e(t1)){L=t1;break}}if(L)break;if(!L)try{let a1=await import("fs");if(!a1.statSync(B0,{throwIfNoEntry:!1})?.isDirectory())continue;let H8=8,V5=[{path:B0,depth:0}];while(V5.length>0&&!L){let F1=V5.pop();if(F1.depth>=H8)continue;let _8;try{_8=a1.readdirSync(F1.path,{withFileTypes:!0})}catch{continue}for(let O8 of _8){if(!O8.isDirectory())continue;if(O8.name==="node_modules"||O8.name.startsWith("."))continue;let A6=h.join(F1.path,O8.name);for(let aW of m){let I9=h.join(A6,aW);if(F.push(I9),await e(I9)){L=I9;break}}if(L)break;V5.push({path:A6,depth:F1.depth+1})}}}catch{}if(L)break}if(L)B$.set(a,L)}if(!L||!await e(L)){let v=F.length>0?`
10681
+ </script>`,H=$;for(let O of G)H=H.split(O.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${sX})>`),`<body$1 data-stx="${Q}">`);else{let O=["script","style","html","head","meta","link","title","!doctype"],L=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${sX})>`,"gi"),(_,F,V)=>{if(L||O.includes(F.toLowerCase()))return _;return L=!0,`<${F}${V} data-stx="${Q}">`})}return{output:H,setupCode:B}}function OJ($){let X=$,Z=[],J=new Set,Y=0,G=0,Q=X.length,w="",W=()=>{G++;let B=!1;while(G<Q){let H=X[G];if(H==="\\"){G+=2;continue}if(H==="["&&!B){B=!0,G++;continue}if(H==="]"&&B){B=!1,G++;continue}if(H==="/"&&!B){G++;while(G<Q&&/[gimsuyd]/.test(X[G]))G++;return}if(H===`
10682
+ `)return;G++}},q=()=>{if(!w)return!0;if(/[\w)\]]/.test(w))return!1;return!0},K=(B)=>{G++;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===B){G++;return}G++}},z=()=>{G++;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"){G++;return}if(X[G]==="$"&&X[G+1]==="{"){G+=2;let B=1;while(G<Q&&B>0)if(X[G]==="{")B++,G++;else if(X[G]==="}")B--,G++;else if(X[G]==="'"||X[G]==='"')K(X[G]);else if(X[G]==="`")z();else G++;continue}G++}},U=()=>{if(X[G]==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
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 O=X.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[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 _=X.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let F=_[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 X4($,X,Z,J){if(!z$($))return $;let Y=$;if(X.skipSignalsRuntime)return Y;let{output:G,setupCode:Q}=await _J(Y,Z,J);if(Y=G,Y=await Q$(Y,X),Q){let K=q$(Y,/<\/head>/i),z=K===-1?q$(Y,/<body[^>]*>/i):-1;if(K!==-1)Y=`${Y.slice(0,K)}${Q}
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
+ ${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=q$(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 q$($,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 LJ($){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 UJ;return`var ${X.join(", ")}; ${UJ}`}var lz=0,sX=`(?:"[^"]*"|'[^']*'|[^>"'])*`,jJ,KJ,K$,az,UJ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var p7=D(()=>{x7();r8();J1();GX();A0();w$();x1();y7();jJ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;KJ=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"]);K$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);az=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import $U from"fs";import h from"path";function ZU($){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 FJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function JU($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function X5($){return!JU($)}function H1($){let X;try{X=JSON.stringify($)}catch{return new Bun.Transpiler($)}let Z=j$.get(X);if(Z)return Z;if(j$.size>=16)j$.clear();let J=new Bun.Transpiler($);return j$.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:h0()}).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 YU($){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 O=H.trim().split(":");return O[O.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 GU($){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 QU($){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 wU($,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 GU(w)){let q=W.trim();if(!q||q.startsWith("..."))continue;let K=QU(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 _$($,X,Z,J,Y){let G=$.endsWith(".stx")?$.slice(0,-4):$,Q=(O)=>O.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""),w=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Z.__importedComponents;if(W){for(let O of[G,G.toLowerCase(),Q(G),w(G)])if(W.has(O))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=(O)=>{if(O&&!U.includes(O))U.push(O)},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 O of H)j(typeof O==="string"?O: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 e(h.resolve(h.dirname(J),`${G}.stx`));for(let O of U){let L=h.isAbsolute(O)?O:h.resolve(z,O);for(let _ of q)if(await e(h.join(L,_)))return!0}return!1}function WU($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function qU($){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 KU($){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 X0("stx/variable-extractor",()=>Promise.resolve().then(() => (d7(),i8))),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"&&WU(U)?U:"";try{let B=(x)=>x.split("-").map((m)=>m.charAt(0).toUpperCase()+m.slice(1)).join(""),H=(x)=>x.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,L=null,_=Y.__importedComponents;if(_){let x=[O,O.toLowerCase(),B(O),H(O)];for(let m of x)if(_.has(m)){L=_.get(m);break}}let F=[];if(!L){let x=[`${O}.stx`,`${B(O)}.stx`,`${H(O)}.stx`],m=[...new Set(x)],U0=Y.__originalFilePath,Z0=[];if(U0){let B0=h.join(h.dirname(U0),"components");Z0.push(B0)}if(J)Z0.push(J);let I0=Q._rootComponentsDir;if(typeof I0==="string"&&!Z0.includes(I0))Z0.push(I0);let E0=h.join(h.dirname(G),"components");if(!Z0.includes(E0))Z0.push(E0);if(Q.componentsDir&&Q.componentsDir!==J&&!Z0.includes(Q.componentsDir))Z0.push(Q.componentsDir);let b1=Q._pluginComponentDirs;if(Array.isArray(b1)){for(let B0 of b1)if(typeof B0==="string"&&!Z0.includes(B0))Z0.push(B0)}let l0=typeof Q.root==="string"?h.resolve(Q.root):void 0,g0=l0??h.dirname(G),K1=[];if(l0)K1.push(h.resolve(l0,"resources/views/components")),K1.push(h.resolve(l0,"resources/components")),K1.push(h.resolve(l0,"src/components")),K1.push(h.resolve(l0,"components"));K1.push(h.resolve(import.meta.dir,"components"));for(let B0 of K1)if(!Z0.includes(B0))Z0.push(B0);let s1=[...new Set(Z0.map((B0)=>{if(!B0)return B0;return h.isAbsolute(B0)?B0:h.resolve(g0,B0)}))];Z0.length=0,Z0.push(...s1);let a=`${O}\x00${G}\x00${s1.join("\x00")}`,Z1=H$.get(a);if(Z1)if(await e(Z1))L=Z1;else H$.delete(a);if(!L&&(O.startsWith("./")||O.startsWith("../")))L=h.resolve(h.dirname(G),`${O}.stx`),F.push(L);else if(!L)for(let B0 of Z0){if(!B0)continue;for(let a1 of m){let t1=h.join(B0,a1);if(F.push(t1),await e(t1)){L=t1;break}}if(L)break;if(!L)try{let a1=await import("fs");if(!a1.statSync(B0,{throwIfNoEntry:!1})?.isDirectory())continue;let _8=8,V5=[{path:B0,depth:0}];while(V5.length>0&&!L){let V1=V5.pop();if(V1.depth>=_8)continue;let O8;try{O8=a1.readdirSync(V1.path,{withFileTypes:!0})}catch{continue}for(let L8 of O8){if(!L8.isDirectory())continue;if(L8.name==="node_modules"||L8.name.startsWith("."))continue;let N6=h.join(V1.path,L8.name);for(let $q of m){let k9=h.join(N6,$q);if(F.push(k9),await e(k9)){L=k9;break}}if(L)break;V5.push({path:N6,depth:V1.depth+1})}}}catch{}if(L)break}if(L)H$.set(a,L)}if(!L||!await e(L)){let x=F.length>0?`
10670
10688
  Searched paths:
10671
10689
  ${F.map((m)=>` - ${m}`).join(`
10672
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${v}`}W.add(L);let V;if(j$.has(L))V=j$.get(L);else try{V=await Bun.file(L).text(),j$.set(L,V)}catch(v){return`[Error loading component: ${v instanceof Error?v.message:String(v)}]`}let A=new Set(["__originalFilePath","__importedComponents",v8,"__stx_client_signal_names"]),R={};for(let[v,m]of Object.entries(Y))if(!v.startsWith("__")||A.has(v))R[v]=m;let N=U1(Z),T=[],M=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(v,m)=>{let U0=N.scripts[Number(m)]||"",Z0=U0.match(/^<script\b([^>]*)>/i)?.[1]||"",I0=Z0.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),E0=!I0||["module","text/javascript","application/javascript"].includes(I0);if(!/\bserver\b/i.test(Z0)&&E0)return T.push(U0),"";return U0}),{extractSlotContent:k}=await X0("stx/slots",()=>Promise.resolve().then(() => (yX(),DX))),E=k(M),I={};if(E.defaultSlot?.trim())I.default=E.defaultSlot;for(let[v,m]of E.namedSlots)I[v]=m.content;let S={...R,...X,props:X,slot:M,$slots:I,__processedComponents:z,__sections:{},__stx_signals_gate:T1(V)||QU(Z)};YU(V,S);let b=V,y=m8(b);if(y)b=y.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,f=[...V.matchAll(P)],x=[],p=f.some((v)=>/\bserver\b/.test(v[1]||"")&&/\bcache\b/.test(v[1]||""))&&f.every((v)=>/\bserver\b/.test(v[1]||"")),u=null,R0=null;if(p){let v=ez({props:X,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(v!==null){u=`${L}\x00${v}`;let m=J4.get(u);if(m){for(let U0 of m.dependencies)W.add(U0);return m.output}R0=new Set(W)}}for(let v of f){let m=v[1]||"",U0=v[2]||"",Z0=m.includes("server");if(X5(m)&&U0.trim())U0=Z5(U0);if(Z0&&U0)try{await q(U0,S,L)}catch(E0){}if(!Z0){let E0=U0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),b1=E0.includes("{{")&&E0.includes("}}"),m0=E0.includes("{!!")&&E0.includes("!!}");if(b1||m0)E0=u8(E0,S);let g0=m.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");x.push(`<script${g0}>${E0}</script>`)}}let N0=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),S0=N0?N0[1]:"",O0=N0?N0[2]:"",c="",W0=S0&&/\bscoped\b/i.test(S0);if(N0)c=`<style${S0}>${O0}</style>`;let i=b;if(i=i.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),N0)i=i.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let v=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,m=[];if(i=i.replace(v,(U0,Z0)=>{let I0=Z0.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(I0)m.push(`<style${I0[1]}>${I0[2]}</style>`);return""}),i=i.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),m.length>0)c=`${c}${m.join(`
10673
- `)}`}if(Z&&i.includes("{{ text || slot }}"))i=i.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:n0}=await X0("stx/slots",()=>Promise.resolve().then(() => (yX(),DX))),{defaultSlot:t0,namedSlots:r}=E;i=await n0(i,t0,r,S);let $0=x.some((v)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(v)),z0=wU(x),d0=Array.isArray(S.__stx_client_signal_names)?S.__stx_client_signal_names:[];if(z0.length>0||d0.length>0)S.__stx_client_signal_names=[...new Set([...d0,...z0])];let C0={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:h.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:$0||x.length===0,defaultLayout:void 0};S.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let C=await A0(i,S,L,C0,W),g=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let v of C.matchAll(/\{\{([\s\S]*?)\}\}/g))g.add(v[1].trim());if(g.size>0)Y.__stx_preserved_client_expressions=[...g];let s=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++tz}_${Math.random().toString(36).slice(2,8)}`,l=C;if($0){let v="";if(Object.keys(X).length>0)try{v=` data-stx-props="${OJ(JSON.stringify(X))}"`}catch{}let m=B?` stx-hydrate="${OJ(B)}"`:"";l=`<div data-stx-scope="${s}"${v}${m}>${C}</div>`;let U0=await Promise.all(x.map(async(Z0)=>{let I0=Z0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!I0)return Z0;let[,E0,b1]=I0,m0=S8(b1,{filePath:L,projectRoot:process.cwd()}),g0=m0.code,K1=C8(m0.styles);g0=y5(g0).code;let{hasUserImports:s1,bundleClientScript:a}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (D5(),b7)));if(s1(g0))g0=await a(g0,L,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:Z1}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (p7(),z$)));g0=g0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F1,_8)=>Z1(_8));let B0=r0(g0),a1=XU(B0),t1=`function(__scopeId) {
10674
- ${I5("const",[...K2,...a1],B0)}
10690
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${x}`}W.add(L);let V;if(B$.has(L))V=B$.get(L);else try{V=await Bun.file(L).text(),B$.set(L,V)}catch(x){return`[Error loading component: ${x instanceof Error?x.message:String(x)}]`}let A=new Set(["__originalFilePath","__importedComponents",x8,"__stx_client_signal_names"]),R={};for(let[x,m]of Object.entries(Y))if(!x.startsWith("__")||A.has(x))R[x]=m;let N=U1(Z),I=[],T=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(x,m)=>{let U0=N.scripts[Number(m)]||"",Z0=U0.match(/^<script\b([^>]*)>/i)?.[1]||"",I0=Z0.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),E0=!I0||["module","text/javascript","application/javascript"].includes(I0);if(!/\bserver\b/i.test(Z0)&&E0)return I.push(U0),"";return U0}),{extractSlotContent:k}=await X0("stx/slots",()=>Promise.resolve().then(() => (DX(),EX))),E=k(T),M={};if(E.defaultSlot?.trim())M.default=E.defaultSlot;for(let[x,m]of E.namedSlots)M[x]=m.content;let S={...R,...X,props:X,slot:T,$slots:M,__processedComponents:z,__sections:{},__stx_signals_gate:M1(V)||qU(Z)};wU(V,S);let b=V,y=c8(b);if(y)b=y.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,v=[...V.matchAll(P)],f=[],i=v.some((x)=>/\bserver\b/.test(x[1]||"")&&/\bcache\b/.test(x[1]||""))&&v.every((x)=>/\bserver\b/.test(x[1]||"")),c=null,G0=null;if(i){let x=ZU({props:X,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(x!==null){c=`${L}\x00${x}`;let m=Z4.get(c);if(m){for(let U0 of m.dependencies)W.add(U0);return m.output}G0=new Set(W)}}for(let x of v){let m=x[1]||"",U0=x[2]||"",Z0=m.includes("server");if(X5(m)&&U0.trim())U0=Z5(U0);if(Z0&&U0)try{await q(U0,S,L)}catch(E0){}if(!Z0){let E0=U0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),b1=E0.includes("{{")&&E0.includes("}}"),l0=E0.includes("{!!")&&E0.includes("!!}");if(b1||l0)E0=d8(E0,S);let g0=m.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");f.push(`<script${g0}>${E0}</script>`)}}let S0=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),N0=S0?S0[1]:"",m0=S0?S0[2]:"",u="",H0=N0&&/\bscoped\b/i.test(N0);if(S0)u=`<style${N0}>${m0}</style>`;let r=b;if(r=r.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S0)r=r.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let x=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,m=[];if(r=r.replace(x,(U0,Z0)=>{let I0=Z0.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(I0)m.push(`<style${I0[1]}>${I0[2]}</style>`);return""}),r=r.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),m.length>0)u=`${u}${m.join(`
10691
+ `)}`}if(Z&&r.includes("{{ text || slot }}"))r=r.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:L0}=await X0("stx/slots",()=>Promise.resolve().then(() => (DX(),EX))),{defaultSlot:X1,namedSlots:l}=E;r=await L0(r,X1,l,S);let $0=f.some((x)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(x)),z0=KU(f),c0=Array.isArray(S.__stx_client_signal_names)?S.__stx_client_signal_names:[];if(z0.length>0||c0.length>0)S.__stx_client_signal_names=[...new Set([...c0,...z0])];let C0={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:h.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:$0||f.length===0,defaultLayout:void 0};S.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let C=await R0(r,S,L,C0,W),g=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let x of C.matchAll(/\{\{([\s\S]*?)\}\}/g))g.add(x[1].trim());if(g.size>0)Y.__stx_preserved_client_expressions=[...g];let s=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++XU}_${Math.random().toString(36).slice(2,8)}`,p=C;if($0){let x="";if(Object.keys(X).length>0)try{x=` data-stx-props="${FJ(JSON.stringify(X))}"`}catch{}let m=j?` stx-hydrate="${FJ(j)}"`:"";p=`<div data-stx-scope="${s}"${x}${m}>${C}</div>`;let U0=await Promise.all(f.map(async(Z0)=>{let I0=Z0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!I0)return Z0;let[,E0,b1]=I0,l0=C8(b1,{filePath:L,projectRoot:process.cwd()}),g0=l0.code,K1=P8(l0.styles);g0=y5(g0).code;let{hasUserImports:s1,bundleClientScript:a}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (D5(),b7)));if(s1(g0))g0=await a(g0,L,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:Z1}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (p7(),U$)));g0=g0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V1,O8)=>Z1(O8));let B0=r0(g0),a1=YU(B0),t1=`function(__scopeId) {
10692
+ ${I5("const",[...U2,...a1],B0)}
10675
10693
  const __scope = window.stx._scopes = window.stx._scopes || {};
10676
10694
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
10677
10695
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -10690,7 +10708,7 @@ ${B0}
10690
10708
  // Register all defined signals and functions in this scope
10691
10709
  const __localVars = {};
10692
10710
  try {
10693
- ${a1.map((F1)=>`if (typeof ${F1} !== 'undefined') __localVars['${F1}'] = ${F1};`).join(`
10711
+ ${a1.map((V1)=>`if (typeof ${V1} !== 'undefined') __localVars['${V1}'] = ${V1};`).join(`
10694
10712
  `)}
10695
10713
  }
10696
10714
  catch (e) {}
@@ -10699,17 +10717,17 @@ catch (e) {}
10699
10717
  finally {
10700
10718
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
10701
10719
  }
10702
- }`,H8=B?null:u2(Y,t1),V5=H8?`window.__stxComponentFactories[${JSON.stringify(H8)}](${JSON.stringify(s)});`:`(${t1})(${JSON.stringify(s)});`;if(B)return`${K1}<script type="stx/island" data-stx-island="${s}" data-stx-scoped${E0}>${V5}</script>`;return`${K1}<script data-stx-scoped data-stx-run="always"${E0}>${V5}</script>`}));if(l=l+`
10720
+ }`,_8=j?null:m2(Y,t1),V5=_8?`window.__stxComponentFactories[${JSON.stringify(_8)}](${JSON.stringify(s)});`:`(${t1})(${JSON.stringify(s)});`;if(j)return`${K1}<script type="stx/island" data-stx-island="${s}" data-stx-scoped${E0}>${V5}</script>`;return`${K1}<script data-stx-scoped data-stx-run="always"${E0}>${V5}</script>`}));if(p=p+`
10703
10721
  `+U0.join(`
10704
- `),c)l+=`
10705
- `+c}else{if(c)l+=`
10706
- `+c;if(x.length>0){let v=S.__stx_event_bindings||[],m=P7(S),U0=await Promise.all(x.map(async(Z0)=>{let I0=Z0.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!I0)return Z0;return await v7(I0[1],{eventBindings:v,templateContent:l,filePath:L,projectRoot:process.cwd(),serverData:m})}));l+=`
10722
+ `),u)p+=`
10723
+ `+u}else{if(u)p+=`
10724
+ `+u;if(f.length>0){let x=S.__stx_event_bindings||[],m=P7(S),U0=await Promise.all(f.map(async(Z0)=>{let I0=Z0.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!I0)return Z0;return await v7(I0[1],{eventBindings:x,templateContent:p,filePath:L,projectRoot:process.cwd(),serverData:m})}));p+=`
10707
10725
  `+U0.join(`
10708
- `),S.__stx_event_bindings=[]}}if(W0){let v=d8(l,L);if(v.hasScoped)l=v.html}if(u&&R0)J4.set(u,{output:l,dependencies:[...W].filter((v)=>!R0.has(v))});return T.length>0?`${l}
10709
- ${T.join(`
10710
- `)}`:l}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{K.delete($)}}async function e($){return Bun.file($).exists()}function Y4($,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 WU($,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 e(Q)){if(J)console.log(`Found layout in ${$}: ${Q}`);return Z?.add(Q),Q}return null}async function G4($,X,Z,J){let Y=await qU($,X,Z,J);if(Y===null)return null;let G=Y4(Y,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((w)=>typeof w==="string"&&w.length>0);for(let w of Q){let W=h.isAbsolute(w)?w:h.resolve(process.cwd(),w);if(Y4(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 qU($,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,$),B=Y4(U,G);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${X})`),null;if(Z.debug)console.log(`Checking absolute path: ${B}`);if(await e(B)&&J)J.add(B);return B}let Q=h.join(Y,$);if(await e(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 B=`${Q}${U}`;if(await e(B)){if(Z.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}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 B=h.join(W,"layouts"),j=!1;try{j=az.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){w.push(B);break}let H=h.dirname(W);if(H===W||H.length<q.length)break;W=H}for(let U of w){let B=await WU(U,$,J,Z.debug);if(B)return B}if($.startsWith("layouts/")||$.includes("/layouts/")){let U=$.split("layouts/"),B=h.join(Z.partialsDir||Y,"layouts",U[1]);if(await e(B)){if(Z.debug)console.log(`Found in layouts path: ${B}`);if(J)J.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await e(j)){if(Z.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(Z.partialsDir){let U=h.join(Z.partialsDir,"layouts");if(await e(U)){let B=h.join(U,$);if(await e(B)){if(Z.debug)console.log(`Found in partials layouts dir: ${B}`);if(J)J.add(B);return B}if(!$.endsWith(".stx")){let j=`${B}.stx`;if(await e(j)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}}let K=Z.partialsDir||h.join(process.cwd(),"views"),z=h.join(K,$);if(await e(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 e(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 e(U)){if(Z.debug)console.log(`Found in temp layouts dir: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let B=`${U}.stx`;if(await e(B)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(J)J.add(B);return B}}}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 LJ($,X,Z){let J=0,Y="",G="";try{if(typeof X==="number"&&X>=0){let Q=$.split(`
10711
- `),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 B=q+U+1;return`${B===J?"> ":" "}${B}: ${z}`}).join(`
10712
- `);break}}else if(Z){let Q=$.indexOf(Z);if(Q>=0)return LJ($,Q)}}catch{}return{lineNumber:J,lineContent:Y,context:G}}function H0($,X,Z,J,Y,G){let{lineNumber:Q,context:w}=LJ(J,Y,G),W=Z.split("/").pop(),q=0;if(typeof Y==="number"&&Y>=0&&J){let z=J.lastIndexOf(`
10726
+ `),S.__stx_event_bindings=[]}}if(H0){let x=m8(p,L);if(x.hasScoped)p=x.html}if(c&&G0)Z4.set(c,{output:p,dependencies:[...W].filter((x)=>!G0.has(x))});return I.length>0?`${p}
10727
+ ${I.join(`
10728
+ `)}`:p}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{K.delete($)}}async function e($){return Bun.file($).exists()}function J4($,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 zU($,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 e(Q)){if(J)console.log(`Found layout in ${$}: ${Q}`);return Z?.add(Q),Q}return null}async function Y4($,X,Z,J){let Y=await UU($,X,Z,J);if(Y===null)return null;let G=J4(Y,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((w)=>typeof w==="string"&&w.length>0);for(let w of Q){let W=h.isAbsolute(w)?w:h.resolve(process.cwd(),w);if(J4(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 UU($,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=J4(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 e(j)&&J)J.add(j);return j}let Q=h.join(Y,$);if(await e(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 e(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=$U.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 zU(U,$,J,Z.debug);if(j)return j}if($.startsWith("layouts/")||$.includes("/layouts/")){let U=$.split("layouts/"),j=h.join(Z.partialsDir||Y,"layouts",U[1]);if(await e(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 e(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 e(U)){let j=h.join(U,$);if(await e(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 e(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 e(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 e(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 e(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 e(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 VJ($,X,Z){let J=0,Y="",G="";try{if(typeof X==="number"&&X>=0){let Q=$.split(`
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 VJ($,Q)}}catch{}return{lineNumber:J,lineContent:Y,context:G}}function _0($,X,Z,J,Y,G){let{lineNumber:Q,context:w}=VJ(J,Y,G),W=Z.split("/").pop(),q=0;if(typeof Y==="number"&&Y>=0&&J){let z=J.lastIndexOf(`
10713
10731
  `,Math.max(0,Y-1));q=Y-(z+1)+1}let K="";if(Q>0)K+=`
10714
10732
  ${Z}:${Q}${q>0?`:${q}`:""}: ${$.toLowerCase()} error: ${X}
10715
10733
  `;if(K+=`
@@ -10722,8 +10740,8 @@ ${J0.yellow}${J0.bold}Message:${J0.reset} ${X}
10722
10740
  `,w)K+=`
10723
10741
  ${J0.blue}${J0.bold}Context:${J0.reset}
10724
10742
  ${J0.dim}${w}${J0.reset}
10725
- `;return K}function JJ(){j$.clear(),B$.clear(),J4.clear()}var j$,B$,J4,tz=0,U$,J0;var V0=D(()=>{x7();HX();B1();J1();v5();_$();P1();AX();RX();y7();x1();HZ();d7();j$=new J5(500),B$=new J5(1000),J4=new J5(2000);U$=new Map;J0={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 FJ($,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,B=-1;while(z>0&&U<$.length){let O=$.indexOf("@markdown",U),L=$.indexOf("@endmarkdown",U);if(L===-1)break;if(O!==-1&&O<L&&O!==w){let _=$[O+9];if(_==="("||_===`
10726
- `||_==="\r"||_===" "||_===void 0)z++;U=O+9}else{if(z--,z===0){B=L;break}U=L+12}}if(B===-1)continue;let j=$.slice(K,B),H=$.slice(w,B+12);Y.push({fullMatch:H,options:q,content:j,index:w}),G.lastIndex=B+12}for(let{fullMatch:w,options:W,content:q,index:K}of Y)try{let z={};if(W)W.split(",").forEach((j)=>{let H=j.trim();if(H)z[H]=!0});let U={gfm:z.gfm??!0,breaks:z.breaks??!1},B=D7(q.trim(),U);J=J.split(w).join(B)}catch(z){let U=z instanceof Error?z.message:String(z),B=H0("Markdown Directive",`Error processing markdown: ${U}`,Z,$,K,w);J=J.split(w).join(B)}return J}async function VJ($,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}),D7($.trim(),Y)}var Q4=D(()=>{V0()});function UU($){if(KU.set($.name,$),$.client)zU.set($.name,$.client)}function O$($){return UU($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Z,J,Y,G)=>{let Q=jU(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 jU($,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 KU,zU;var w4=D(()=>{KU=new Map,zU=new Map});function W4($,X=h5,Z={},J){return X.sort((Y,G)=>Y-G).map((Y)=>{return`${n7($,{...Z,w:Y,fm:J})} ${Y}w`}).join(", ")}function AJ($,X,Z=BU,J={},Y){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round(X*G);return`${n7($,{...J,w:Q,dpr:G,fm:Y})} ${G}x`}).join(", ")}function q4($,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 n7($,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 K4($){return HU[$]||"application/octet-stream"}var h5,BU,i7,HU;var z4=D(()=>{h5=[320,480,640,768,1024,1280,1536,1920,2560],BU=[1,1.5,2,3],i7=["avif","webp","jpeg"],HU={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function OU(){try{return await import("ts-images")}catch{return null}}async function LU($,X={}){let Z={..._U,...X},J=await OU();if(J)try{return await FU($,Z,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return VU($,Z)}async function FU($,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 VU($,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 RJ($,X,Z={}){let J=Z.transitionDuration||300,Y=Z.easing||"ease-out";return`
10743
+ `;return K}function GJ(){B$.clear(),H$.clear(),Z4.clear()}var B$,H$,Z4,XU=0,j$,J0;var A0=D(()=>{x7();BX();B1();J1();v5();O$();P1();VX();AX();y7();x1();OZ();d7();B$=new J5(500),H$=new J5(1000),Z4=new J5(2000);j$=new Map;J0={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 AJ($,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 O=$.indexOf("@markdown",U),L=$.indexOf("@endmarkdown",U);if(L===-1)break;if(O!==-1&&O<L&&O!==w){let _=$[O+9];if(_==="("||_===`
10744
+ `||_==="\r"||_===" "||_===void 0)z++;U=O+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=D7(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 RJ($,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}),D7($.trim(),Y)}var G4=D(()=>{A0()});function HU($){if(jU.set($.name,$),$.client)BU.set($.name,$.client)}function L$($){return HU($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Z,J,Y,G)=>{let Q=_U(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 _U($,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 jU,BU;var Q4=D(()=>{jU=new Map,BU=new Map});function w4($,X=h5,Z={},J){return X.sort((Y,G)=>Y-G).map((Y)=>{return`${n7($,{...Z,w:Y,fm:J})} ${Y}w`}).join(", ")}function NJ($,X,Z=OU,J={},Y){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round(X*G);return`${n7($,{...J,w:Q,dpr:G,fm:Y})} ${G}x`}).join(", ")}function W4($,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 n7($,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 q4($){return LU[$]||"application/octet-stream"}var h5,OU,i7,LU;var K4=D(()=>{h5=[320,480,640,768,1024,1280,1536,1920,2560],OU=[1,1.5,2,3],i7=["avif","webp","jpeg"],LU={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function VU(){try{return await import("ts-images")}catch{return null}}async function AU($,X={}){let Z={...FU,...X},J=await VU();if(J)try{return await RU($,Z,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return NU($,Z)}async function RU($,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 NU($,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 TJ($,X,Z={}){let J=Z.transitionDuration||300,Y=Z.easing||"ease-out";return`
10727
10745
  #${$} {
10728
10746
  --stx-img-transition-duration: ${J}ms;
10729
10747
  --stx-img-transition-easing: ${Y};
@@ -10740,7 +10758,7 @@ ${J0.dim}${w}${J0.reset}
10740
10758
  #${$}.stx-img-loaded img {
10741
10759
  opacity: 1;
10742
10760
  }
10743
- `.trim()}async function NJ($,X={}){let Z=`${$}:${JSON.stringify(X)}`;if(U4.has(Z))return U4.get(Z);let J=await LU($,X);return U4.set(Z,J),J}var _U,j4,U4;var TJ=D(()=>{_U={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},j4=`
10761
+ `.trim()}async function MJ($,X={}){let Z=`${$}:${JSON.stringify(X)}`;if(z4.has(Z))return z4.get(Z);let J=await AU($,X);return z4.set(Z,J),J}var FU,U4,z4;var kJ=D(()=>{FU={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},U4=`
10744
10762
  .stx-img-placeholder {
10745
10763
  position: relative;
10746
10764
  overflow: hidden;
@@ -10769,20 +10787,20 @@ ${J0.dim}${w}${J0.reset}
10769
10787
  filter: blur(0);
10770
10788
  transform: scale(1);
10771
10789
  }
10772
- `.trim();U4=new Map});import{createHash as kJ}from"crypto";import{readFile as AU,stat as IJ}from"fs/promises";async function h0($){try{let X=await AU($);return kJ("sha256").update(X).digest("hex").slice(0,16)}catch{return""}}function MJ($){return kJ("sha256").update($).digest("hex").slice(0,16)}function L$($,X){let Z=JSON.stringify(X,Object.keys(X).sort());return`${MJ($)}-${MJ(Z)}`}async function B4($){try{return(await IJ($)).mtimeMs}catch{return 0}}async function v0($){try{return await IJ($),!0}catch{return!1}}var K5=()=>{};import{mkdir as RU,readFile as NU,writeFile as TU,readdir as XN,rm as MU,stat as ZN}from"fs/promises";import{join as DJ,dirname as kU}from"path";async function IU($){try{await RU($,{recursive:!0})}catch{}}function yJ($,X,Z){return DJ($,Z,`${X}.json`)}async function EJ($,X,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await B4(X)!==$.srcMtime)return!1;return!0}async function F$($,X,Z,J=H4){if(!J.enabled)return null;let Y=L$($,X),G=u5.get(Y);if(G){if(await EJ(G,$,J.maxAge))return G.lastAccessedAt=Date.now(),G.data;u5.delete(Y)}let Q=yJ(J.directory,Y,Z);if(await v0(Q))try{let w=await NU(Q,"utf-8"),W=JSON.parse(w);if(await EJ(W,$,J.maxAge))return W.lastAccessedAt=Date.now(),u5.set(Y,W),W.data}catch{}return null}async function V$($,X,Z,J,Y=H4){if(!Y.enabled)return;let G=L$($,X),Q=await h0($),w=await B4($),W={key:G,src:$,srcHash:Q,srcMtime:w,optionsHash:L$("",X),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};u5.set(G,W);let q=yJ(Y.directory,G,J);try{await IU(kU(q)),await TU(q,JSON.stringify(W,null,2))}catch(K){console.warn(`[stx-media] Failed to write cache: ${K}`)}}async function A$($,X=H4){if($==="all")u5.clear();else u5.clear();let Z=$==="all"?["image","video"]:[$];for(let J of Z){let Y=DJ(X.directory,J);try{await MU(Y,{recursive:!0,force:!0})}catch{}}}var u5,H4;var _4=D(()=>{K5();u5=new Map,H4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class N${config;constructor($={}){this.config={...EU,...$}}async get($,X){return F$($,X,"image",this.config)}async set($,X,Z){return V$($,X,Z,"image",this.config)}async clear(){return A$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function O4($){if(!R$)R$=new N$($);else if($)R$.updateConfig($);return R$}async function T$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return O4(J).get($,X)}async function M$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return O4(Y).set($,X,Z)}async function bJ(){return O4().clear()}var EU,R$=null;var L4=D(()=>{_4();EU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as DU,basename as yU,extname as bU,join as SU}from"path";import{mkdir as CU}from"fs/promises";async function F4(){try{return await import("ts-images")}catch{return null}}function SJ($){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 PU($,X){let Z=X?SJ(X):SJ("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 CJ($,X,Z){let J=await F4();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Y=await T$($,X,Z);if(Y)return Y;try{let G=DU($);if(!await v0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let Q=PU(Z,X.preset),w=Z.outputDir||"dist/images",W=Z.baseUrl||"/images";await CU(w,{recursive:!0});let q=await h0(G),K=yU($,bU($)),z=X.outputFormat?[X.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],U={src:$,processed:!0,variants:[],hash:q},B=null;if(X.transformations&&X.transformations.length>0)B=await V4(G,X.transformations,J);for(let j of z){let H=Q[j]||{},O=`${K}-${q}.${j}`,L=SU(w,O);try{let _=await J.optimizeImage({input:B||G,output:L,format:j,quality:H.quality,progressive:H.progressive});if(_){if(U.variants.push({path:L,url:`${W}/${O}`,width:_.width||0,height:_.height||0,format:j,size:_.outputSize||0}),!U.originalWidth&&_.width)U.originalWidth=_.width,U.originalHeight=_.height}}catch(_){U.errors=U.errors||[],U.errors.push(`Failed to optimize ${j}: ${_}`)}}if(X.embedThumbhash||X.placeholder==="thumbhash")try{let j=await J.generateThumbHash(G);U.placeholder=j.dataUrl}catch(j){U.errors=U.errors||[],U.errors.push(`Failed to generate thumbhash: ${j}`)}if(X.useDominantColor)try{let j=await J.generatePlaceholder(G,{strategy:"dominant-color"});U.dominantColor=j.dominantColor}catch(j){U.errors=U.errors||[],U.errors.push(`Failed to extract dominant color: ${j}`)}return await M$($,X,U,Z),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function PJ($,X,Z,J){let Y=await F4();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 V4($,X,Z){let J=Z||await F4();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 vJ=D(()=>{K5();L4()});import{resolve as vU,basename as xU,extname as fU,join as gU}from"path";import{mkdir as hU}from"fs/promises";async function uU(){try{return await import("ts-images")}catch{return null}}async function xJ($,X,Z){let J=await uU();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Y=vU($);if(!await v0(Y))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let G=X.responsiveWidths||Z.breakpoints||dU,Q=X.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",W=Z.baseUrl||"/images";await hU(w,{recursive:!0});let q=await h0(Y),K=xU($,fU($)),z=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},U={src:$,byFormat:{},srcsets:{}};for(let j of Q){U.byFormat[j]=[];let H=[];for(let O of G){let L=`${K}-${O}w-${q}.${j}`,_=gU(w,L),F=`${W}/${L}`;try{let V=z[j]?.quality||80;if(await v0(_)){U.byFormat[j].push({path:_,url:F,width:O,height:0,format:j,size:0}),H.push(`${F} ${O}w`);continue}let A=await J.processImage({input:Y,output:_,format:j,quality:V,resize:{width:O}});if(A)U.byFormat[j].push({path:_,url:F,width:O,height:A.height||Math.round(O*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${F} ${O}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${j} at ${O}w: ${V}`)}}U.srcsets[j]=H.join(", ")}let B=X.placeholder||Z.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await J.generateThumbHash(Y);U.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await J.generatePlaceholder(Y,{strategy:B,width:20});U.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return U.sizes=X.sizes||mU(G),U}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function mU($){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 fJ($,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 dU;var gJ=D(()=>{K5();dU=[320,480,640,768,1024,1280,1536,1920]});var hJ={};t(hJ,{setCachedImageResult:()=>M$,processImage:()=>CJ,optimizeImage:()=>PJ,getCachedImageResult:()=>T$,generateSrcset:()=>fJ,generateResponsiveVariants:()=>xJ,clearImageCache:()=>bJ,applyTransformations:()=>V4,ImageProcessorCache:()=>N$});var uJ=D(()=>{vJ();gJ();L4()});async function cU(){try{return await Promise.resolve().then(() => (uJ(),hJ))}catch($){if(!dJ)console.warn("[stx-media] Image processor not available, some features disabled:",$),dJ=!0;return null}}async function k$($,X={}){let Z=X,J=$;if(J.process&&!J.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return nU(J,Z)}if(Z.processedResult?.processed)return T4($,Z.processedResult,X);if(Z.responsiveVariants)return pJ($,Z.responsiveVariants,X);let{src:Y,alt:G,width:Q,height:w,sizes:W,widths:q=h5,dpr:K,formats:z=i7,quality:U=A4,params:B={},placeholder:j="none",placeholderOptions:H={},lazy:O=!0,priority:L=!1,loading:_=L?"eager":E$,decoding:F=I$,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:T}=$,M=$.class,k=$.style,E=$.id,I=$.data||{},{isDev:S=!1,baseUrl:b=""}=X;if(S&&!X.optimize)return iU($);let y,P,f=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!L)try{y=await NJ(Y,{strategy:j,...H}),P=RJ(f,y,H)}catch{}let x=K!==void 0&&Q!==void 0,p;if(x)p=pU($,f,y,X);else p=await lU($,f,y,X);let u;if(L){let S0=z.includes("webp")?"webp":z[0],O0=W4(Y,q,{...B,q:U},S0),c=typeof W==="object"?q4(W):W||"100vw";u=`<link rel="preload" as="image" imagesrcset="${O0}" imagesizes="${c}" />`}let R0=[];if(!mJ&&j!=="none")R0.push(j4),mJ=!0;if(P)R0.push(P);let N0=O?lJ(f):void 0;return{html:p,preloadLink:u,css:R0.length>0?R0.join(`
10773
- `):void 0,script:N0}}async function lU($,X,Z,J){let{src:Y,alt:G,width:Q,height:w,sizes:W,widths:q=h5,formats:K=i7,quality:z=A4,params:U={},lazy:B=!0,priority:j=!1,loading:H=j?"eager":E$,decoding:O=I$,fetchpriority:L,objectFit:_,objectPosition:F,crossorigin:V,referrerpolicy:A}=$,R=$.class,N=$.style,T=$.data||{},M=typeof W==="object"?q4(W):W||"100vw",k=[];for(let S of K){let b=W4(Y,q,{...U,q:z},S),y=K4(S);if(B&&!j)k.push(` <source type="${y}" data-srcset="${b}" data-sizes="${M}" />`);else k.push(` <source type="${y}" srcset="${b}" sizes="${M}" />`)}let E=R4({src:n7(Y,{...U,q:z}),alt:G,width:Q,height:w,loading:j?void 0:H,decoding:O,fetchpriority:j?"high":L,objectFit:_,objectPosition:F,crossorigin:V,referrerpolicy:A,className:cJ(R,Z),style:N4(N,_,F,Z),lazy:B&&!j,data:T}),I;if(Z){let S=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${X}" class="stx-img-placeholder" style="${S}">
10790
+ `.trim();z4=new Map});import{createHash as EJ}from"crypto";import{readFile as TU,stat as DJ}from"fs/promises";async function u0($){try{let X=await TU($);return EJ("sha256").update(X).digest("hex").slice(0,16)}catch{return""}}function IJ($){return EJ("sha256").update($).digest("hex").slice(0,16)}function F$($,X){let Z=JSON.stringify(X,Object.keys(X).sort());return`${IJ($)}-${IJ(Z)}`}async function j4($){try{return(await DJ($)).mtimeMs}catch{return 0}}async function v0($){try{return await DJ($),!0}catch{return!1}}var K5=()=>{};import{mkdir as MU,readFile as kU,writeFile as IU,readdir as QN,rm as EU,stat as wN}from"fs/promises";import{join as bJ,dirname as DU}from"path";async function yU($){try{await MU($,{recursive:!0})}catch{}}function SJ($,X,Z){return bJ($,Z,`${X}.json`)}async function yJ($,X,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await j4(X)!==$.srcMtime)return!1;return!0}async function V$($,X,Z,J=B4){if(!J.enabled)return null;let Y=F$($,X),G=u5.get(Y);if(G){if(await yJ(G,$,J.maxAge))return G.lastAccessedAt=Date.now(),G.data;u5.delete(Y)}let Q=SJ(J.directory,Y,Z);if(await v0(Q))try{let w=await kU(Q,"utf-8"),W=JSON.parse(w);if(await yJ(W,$,J.maxAge))return W.lastAccessedAt=Date.now(),u5.set(Y,W),W.data}catch{}return null}async function A$($,X,Z,J,Y=B4){if(!Y.enabled)return;let G=F$($,X),Q=await u0($),w=await j4($),W={key:G,src:$,srcHash:Q,srcMtime:w,optionsHash:F$("",X),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};u5.set(G,W);let q=SJ(Y.directory,G,J);try{await yU(DU(q)),await IU(q,JSON.stringify(W,null,2))}catch(K){console.warn(`[stx-media] Failed to write cache: ${K}`)}}async function R$($,X=B4){if($==="all")u5.clear();else u5.clear();let Z=$==="all"?["image","video"]:[$];for(let J of Z){let Y=bJ(X.directory,J);try{await EU(Y,{recursive:!0,force:!0})}catch{}}}var u5,B4;var H4=D(()=>{K5();u5=new Map,B4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class T${config;constructor($={}){this.config={...bU,...$}}async get($,X){return V$($,X,"image",this.config)}async set($,X,Z){return A$($,X,Z,"image",this.config)}async clear(){return R$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function _4($){if(!N$)N$=new T$($);else if($)N$.updateConfig($);return N$}async function M$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return _4(J).get($,X)}async function k$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return _4(Y).set($,X,Z)}async function CJ(){return _4().clear()}var bU,N$=null;var O4=D(()=>{H4();bU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as SU,basename as CU,extname as PU,join as vU}from"path";import{mkdir as xU}from"fs/promises";async function L4(){try{return await import("ts-images")}catch{return null}}function PJ($){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 fU($,X){let Z=X?PJ(X):PJ("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 vJ($,X,Z){let J=await L4();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Y=await M$($,X,Z);if(Y)return Y;try{let G=SU($);if(!await v0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let Q=fU(Z,X.preset),w=Z.outputDir||"dist/images",W=Z.baseUrl||"/images";await xU(w,{recursive:!0});let q=await u0(G),K=CU($,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 F4(G,X.transformations,J);for(let B of z){let H=Q[B]||{},O=`${K}-${q}.${B}`,L=vU(w,O);try{let _=await J.optimizeImage({input:j||G,output:L,format:B,quality:H.quality,progressive:H.progressive});if(_){if(U.variants.push({path:L,url:`${W}/${O}`,width:_.width||0,height:_.height||0,format:B,size:_.outputSize||0}),!U.originalWidth&&_.width)U.originalWidth=_.width,U.originalHeight=_.height}}catch(_){U.errors=U.errors||[],U.errors.push(`Failed to optimize ${B}: ${_}`)}}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 k$($,X,U,Z),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function xJ($,X,Z,J){let Y=await L4();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 F4($,X,Z){let J=Z||await L4();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 fJ=D(()=>{K5();O4()});import{resolve as gU,basename as hU,extname as uU,join as dU}from"path";import{mkdir as mU}from"fs/promises";async function cU(){try{return await import("ts-images")}catch{return null}}async function gJ($,X,Z){let J=await cU();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Y=gU($);if(!await v0(Y))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let G=X.responsiveWidths||Z.breakpoints||lU,Q=X.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",W=Z.baseUrl||"/images";await mU(w,{recursive:!0});let q=await u0(Y),K=hU($,uU($)),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 O of G){let L=`${K}-${O}w-${q}.${B}`,_=dU(w,L),F=`${W}/${L}`;try{let V=z[B]?.quality||80;if(await v0(_)){U.byFormat[B].push({path:_,url:F,width:O,height:0,format:B,size:0}),H.push(`${F} ${O}w`);continue}let A=await J.processImage({input:Y,output:_,format:B,quality:V,resize:{width:O}});if(A)U.byFormat[B].push({path:_,url:F,width:O,height:A.height||Math.round(O*(A.height||1)/(A.width||1)),format:B,size:A.outputSize||0}),H.push(`${F} ${O}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${B} at ${O}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||pU(G),U}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function pU($){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 hJ($,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 lU;var uJ=D(()=>{K5();lU=[320,480,640,768,1024,1280,1536,1920]});var dJ={};t(dJ,{setCachedImageResult:()=>k$,processImage:()=>vJ,optimizeImage:()=>xJ,getCachedImageResult:()=>M$,generateSrcset:()=>hJ,generateResponsiveVariants:()=>gJ,clearImageCache:()=>CJ,applyTransformations:()=>F4,ImageProcessorCache:()=>T$});var mJ=D(()=>{fJ();uJ();O4()});async function iU(){try{return await Promise.resolve().then(() => (mJ(),dJ))}catch($){if(!cJ)console.warn("[stx-media] Image processor not available, some features disabled:",$),cJ=!0;return null}}async function I$($,X={}){let Z=X,J=$;if(J.process&&!J.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return sU(J,Z)}if(Z.processedResult?.processed)return N4($,Z.processedResult,X);if(Z.responsiveVariants)return nJ($,Z.responsiveVariants,X);let{src:Y,alt:G,width:Q,height:w,sizes:W,widths:q=h5,dpr:K,formats:z=i7,quality:U=V4,params:j={},placeholder:B="none",placeholderOptions:H={},lazy:O=!0,priority:L=!1,loading:_=L?"eager":D$,decoding:F=E$,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:I}=$,T=$.class,k=$.style,E=$.id,M=$.data||{},{isDev:S=!1,baseUrl:b=""}=X;if(S&&!X.optimize)return oU($);let y,P,v=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!L)try{y=await MJ(Y,{strategy:B,...H}),P=TJ(v,y,H)}catch{}let f=K!==void 0&&Q!==void 0,i;if(f)i=rU($,v,y,X);else i=await nU($,v,y,X);let c;if(L){let N0=z.includes("webp")?"webp":z[0],m0=w4(Y,q,{...j,q:U},N0),u=typeof W==="object"?W4(W):W||"100vw";c=`<link rel="preload" as="image" imagesrcset="${m0}" imagesizes="${u}" />`}let G0=[];if(!lJ&&B!=="none")G0.push(U4),lJ=!0;if(P)G0.push(P);let S0=O?iJ(v):void 0;return{html:i,preloadLink:c,css:G0.length>0?G0.join(`
10791
+ `):void 0,script:S0}}async function nU($,X,Z,J){let{src:Y,alt:G,width:Q,height:w,sizes:W,widths:q=h5,formats:K=i7,quality:z=V4,params:U={},lazy:j=!0,priority:B=!1,loading:H=B?"eager":D$,decoding:O=E$,fetchpriority:L,objectFit:_,objectPosition:F,crossorigin:V,referrerpolicy:A}=$,R=$.class,N=$.style,I=$.data||{},T=typeof W==="object"?W4(W):W||"100vw",k=[];for(let S of K){let b=w4(Y,q,{...U,q:z},S),y=q4(S);if(j&&!B)k.push(` <source type="${y}" data-srcset="${b}" data-sizes="${T}" />`);else k.push(` <source type="${y}" srcset="${b}" sizes="${T}" />`)}let E=A4({src:n7(Y,{...U,q:z}),alt:G,width:Q,height:w,loading:B?void 0:H,decoding:O,fetchpriority:B?"high":L,objectFit:_,objectPosition:F,crossorigin:V,referrerpolicy:A,className:pJ(R,Z),style:R4(N,_,F,Z),lazy:j&&!B,data:I}),M;if(Z){let S=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;M=`<div id="${X}" class="stx-img-placeholder" style="${S}">
10774
10792
  <picture>
10775
10793
  ${k.join(`
10776
10794
  `)}
10777
10795
  <img ${E} />
10778
10796
  </picture>
10779
- </div>`}else I=`<picture${X?` id="${X}"`:""}>
10797
+ </div>`}else M=`<picture${X?` id="${X}"`:""}>
10780
10798
  ${k.join(`
10781
10799
  `)}
10782
10800
  <img ${E} />
10783
- </picture>`;return I}function pU($,X,Z,J){let{src:Y,alt:G,width:Q,height:w,dpr:W=[1,2,3],quality:q=A4,params:K={},lazy:z=!0,priority:U=!1,loading:B=U?"eager":E$,decoding:j=I$,fetchpriority:H,objectFit:O,objectPosition:L,crossorigin:_,referrerpolicy:F}=$,V=$.class,A=$.style,R=$.data||{},N=typeof Q==="number"?Q:Number.parseInt(String(Q),10),T=AJ(Y,N,W,{...K,q}),M=R4({src:n7(Y,{...K,w:N,q}),alt:G,width:Q,height:w,loading:U?void 0:B,decoding:j,fetchpriority:U?"high":H,objectFit:O,objectPosition:L,crossorigin:_,referrerpolicy:F,className:cJ(V,Z),style:N4(A,O,L,Z),lazy:z&&!U,data:R}),k=z&&!U?`data-srcset="${T}"`:`srcset="${T}"`;if(Z){let E=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${X}" class="stx-img-placeholder" style="${E}">
10784
- <img ${M} ${k} />
10785
- </div>`}return`<img ${X?`id="${X}" `:""}${M} ${k} />`}function iU($){let{src:X,alt:Z,width:J,height:Y,loading:G=E$,decoding:Q=I$,fetchpriority:w,objectFit:W,objectPosition:q,crossorigin:K,referrerpolicy:z,priority:U=!1}=$,B=$.class,j=$.style,H=$.id,O=$.data||{};return{html:`<img ${R4({src:X,alt:Z,width:J,height:Y,loading:U?"eager":G,decoding:Q,fetchpriority:U?"high":w,objectFit:W,objectPosition:q,crossorigin:K,referrerpolicy:z,className:B,style:N4(j,W,q),id:H,data:O})} />`}}function R4($){let X=[];if($.lazy)X.push(`data-src="${G1($.src)}"`),X.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else X.push(`src="${G1($.src)}"`);if(X.push(`alt="${G1($.alt)}"`),$.width)X.push(`width="${$.width}"`);if($.height)X.push(`height="${$.height}"`);if($.loading)X.push(`loading="${$.loading}"`);if($.decoding)X.push(`decoding="${$.decoding}"`);if($.fetchpriority)X.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)X.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)X.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)X.push(`class="${G1($.className)}"`);if($.style)X.push(`style="${G1($.style)}"`);if($.id)X.push(`id="${G1($.id)}"`);if($.data)for(let[Z,J]of Object.entries($.data))X.push(`data-${Z}="${G1(J)}"`);if($.lazy)X.push("data-stx-lazy");return X.join(" ")}function cJ($,X){let Z=[];if($)Z.push($);if(X)Z.push("stx-img-blur");return Z.join(" ")||""}function N4($,X,Z,J){let Y=[];if(X)Y.push(`object-fit: ${X}`);if(Z)Y.push(`object-position: ${Z}`);if(J)Y.push("opacity: 0; transition: opacity 300ms ease-out");if($)Y.push($);return Y.join("; ")}function G1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function lJ($){return`
10801
+ </picture>`;return M}function rU($,X,Z,J){let{src:Y,alt:G,width:Q,height:w,dpr:W=[1,2,3],quality:q=V4,params:K={},lazy:z=!0,priority:U=!1,loading:j=U?"eager":D$,decoding:B=E$,fetchpriority:H,objectFit:O,objectPosition:L,crossorigin:_,referrerpolicy:F}=$,V=$.class,A=$.style,R=$.data||{},N=typeof Q==="number"?Q:Number.parseInt(String(Q),10),I=NJ(Y,N,W,{...K,q}),T=A4({src:n7(Y,{...K,w:N,q}),alt:G,width:Q,height:w,loading:U?void 0:j,decoding:B,fetchpriority:U?"high":H,objectFit:O,objectPosition:L,crossorigin:_,referrerpolicy:F,className:pJ(V,Z),style:R4(A,O,L,Z),lazy:z&&!U,data:R}),k=z&&!U?`data-srcset="${I}"`:`srcset="${I}"`;if(Z){let E=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${X}" class="stx-img-placeholder" style="${E}">
10802
+ <img ${T} ${k} />
10803
+ </div>`}return`<img ${X?`id="${X}" `:""}${T} ${k} />`}function oU($){let{src:X,alt:Z,width:J,height:Y,loading:G=D$,decoding:Q=E$,fetchpriority:w,objectFit:W,objectPosition:q,crossorigin:K,referrerpolicy:z,priority:U=!1}=$,j=$.class,B=$.style,H=$.id,O=$.data||{};return{html:`<img ${A4({src:X,alt:Z,width:J,height:Y,loading:U?"eager":G,decoding:Q,fetchpriority:U?"high":w,objectFit:W,objectPosition:q,crossorigin:K,referrerpolicy:z,className:j,style:R4(B,W,q),id:H,data:O})} />`}}function A4($){let X=[];if($.lazy)X.push(`data-src="${G1($.src)}"`),X.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else X.push(`src="${G1($.src)}"`);if(X.push(`alt="${G1($.alt)}"`),$.width)X.push(`width="${$.width}"`);if($.height)X.push(`height="${$.height}"`);if($.loading)X.push(`loading="${$.loading}"`);if($.decoding)X.push(`decoding="${$.decoding}"`);if($.fetchpriority)X.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)X.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)X.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)X.push(`class="${G1($.className)}"`);if($.style)X.push(`style="${G1($.style)}"`);if($.id)X.push(`id="${G1($.id)}"`);if($.data)for(let[Z,J]of Object.entries($.data))X.push(`data-${Z}="${G1(J)}"`);if($.lazy)X.push("data-stx-lazy");return X.join(" ")}function pJ($,X){let Z=[];if($)Z.push($);if(X)Z.push("stx-img-blur");return Z.join(" ")||""}function R4($,X,Z,J){let Y=[];if(X)Y.push(`object-fit: ${X}`);if(Z)Y.push(`object-position: ${Z}`);if(J)Y.push("opacity: 0; transition: opacity 300ms ease-out");if($)Y.push($);return Y.join("; ")}function G1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function iJ($){return`
10786
10804
  (function() {
10787
10805
  const container = document.getElementById('${$}');
10788
10806
  if (!container) return;
@@ -10819,22 +10837,22 @@ ${k.join(`
10819
10837
 
10820
10838
  observer.observe(container);
10821
10839
  })();
10822
- `.trim()}async function nU($,X){let Z=await cU();if(!Z)return k$({...$,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 pJ($,G,X)}else{let G=await Z.processImage($.src,$,J);if(G.processed)return T4($,G,X)}return k$({...$,process:!1},X)}async function T4($,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,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},O=X.variants||[],L=O.find((P)=>P.format==="jpeg")||O.find((P)=>P.format==="webp")||O[0],_=L?.url||$.src,F=O.filter((P)=>P.format===(L?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of O){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 f=V.get(P);if(f&&f.length>0){let x=f.map((u)=>`${u.url} ${u.width}w`).join(", "),p=K4(P);if(Q&&!w)A.push(` <source type="${p}" data-srcset="${x}" />`);else A.push(` <source type="${p}" srcset="${x}" />`)}}let N=[];if(Q&&!w){if(N.push(`data-src="${G1(_)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${G1(_)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${G1(J)}"`);let T=Y||X.originalWidth,M=G||X.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);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 k=[];if(W)k.push(`object-fit: ${W}`);if(q)k.push(`object-position: ${q}`);if(X.placeholder&&Q)k.push("opacity: 0; transition: opacity 300ms ease-out");if(B)k.push(B);if(k.length>0)N.push(`style="${k.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,f]of Object.entries(H))N.push(`data-${P}="${G1(f)}"`);let I;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};`;I=`<div id="${j}" class="stx-img-placeholder" style="${P}">
10840
+ `.trim()}async function sU($,X){let Z=await iU();if(!Z)return I$({...$,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 nJ($,G,X)}else{let G=await Z.processImage($.src,$,J);if(G.processed)return N4($,G,X)}return I$({...$,process:!1},X)}async function N4($,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||{},O=X.variants||[],L=O.find((P)=>P.format==="jpeg")||O.find((P)=>P.format==="webp")||O[0],_=L?.url||$.src,F=O.filter((P)=>P.format===(L?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of O){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 f=v.map((c)=>`${c.url} ${c.width}w`).join(", "),i=q4(P);if(Q&&!w)A.push(` <source type="${i}" data-srcset="${f}" />`);else A.push(` <source type="${i}" srcset="${f}" />`)}}let N=[];if(Q&&!w){if(N.push(`data-src="${G1(_)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${G1(_)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${G1(J)}"`);let I=Y||X.originalWidth,T=G||X.originalHeight;if(I)N.push(`width="${I}"`);if(T)N.push(`height="${T}"`);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 k=[];if(W)k.push(`object-fit: ${W}`);if(q)k.push(`object-position: ${q}`);if(X.placeholder&&Q)k.push("opacity: 0; transition: opacity 300ms ease-out");if(j)k.push(j);if(k.length>0)N.push(`style="${k.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 M;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};`;M=`<div id="${B}" class="stx-img-placeholder" style="${P}">
10823
10841
  <picture>
10824
10842
  ${A.join(`
10825
10843
  `)}
10826
10844
  <img ${N.join(" ")} />
10827
10845
  </picture>
10828
- </div>`}else I=`<picture${j?` id="${j}"`:""}>
10846
+ </div>`}else M=`<picture${B?` id="${B}"`:""}>
10829
10847
  ${A.join(`
10830
10848
  `)}
10831
10849
  <img ${N.join(" ")} />
10832
- </picture>`;let S=[];if(X.placeholder)S.push(j4);let b=Q?lJ(j):void 0,y;if(w&&F)y=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:I,preloadLink:y,css:S.length>0?S.join(`
10833
- `):void 0,script:b}}async function pJ($,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 T4($,J,Z)}var dJ=!1,A4=80,I$="async",E$="lazy",mJ=!1;var iJ=D(()=>{z4();TJ()});function rU(){return O$({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}=oU($,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||i7,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 k$(w,{isDev:W}),K=q.html;if(q.preloadLink)K=q.preloadLink+`
10850
+ </picture>`;let S=[];if(X.placeholder)S.push(U4);let b=Q?iJ(B):void 0,y;if(w&&F)y=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:M,preloadLink:y,css:S.length>0?S.join(`
10851
+ `):void 0,script:b}}async function nJ($,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 N4($,J,Z)}var cJ=!1,V4=80,E$="async",D$="lazy",lJ=!1;var rJ=D(()=>{K4();kJ()});function aU(){return L$({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}=tU($,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||i7,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 I$(w,{isDev:W}),K=q.html;if(q.preloadLink)K=q.preloadLink+`
10834
10852
  `+K;if(q.css)K+=`
10835
10853
  <style>${q.css}</style>`;if(q.script)K+=`
10836
- <script>${q.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function oU($,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=sU(J),G=M4(Y[0],Z)||"",Q=M4(Y[1],Z)||"",w={};if(Y[2]){let W=M4(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 sU($){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 M4($,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 nJ;var rJ=D(()=>{w4();iJ();z4();nJ=rU()});class y${config;constructor($={}){this.config={...aU,...$}}async get($,X){return F$($,X,"video",this.config)}async set($,X,Z){return V$($,X,Z,"video",this.config)}async clear(){return A$("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function k4($){if(!D$)D$=new y$($);else if($)D$.updateConfig($);return D$}async function b$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return k4(J).get($,X)}async function S$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return k4(Y).set($,X,Z)}async function oJ(){return k4().clear()}var aU,D$=null;var I4=D(()=>{_4();aU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as E4,basename as D4,extname as y4,join as C$}from"path";import{mkdir as b4}from"fs/promises";async function S4(){try{return await import("ts-videos")}catch{return null}}async function P$($,X,Z,J){let Y=await S4();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=E4($);if(!await v0(G))return null;await b4(Z,{recursive:!0});let Q=await h0(G),w=D4($,y4($)),W=X.format||"webp",q=X.timestamp||0,K=`${w}-poster-${Q}.${W}`,z=C$(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 B=U[0];return{path:z,url:`${J}/${K}`,width:B.width||X.width||1280,height:B.height||720,timestamp:q,size:B.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function v$($,X,Z,J){let Y=await S4();if(!Y)return[];try{let G=E4($);if(!await v0(G))return[];await b4(Z,{recursive:!0});let Q=await h0(G),w=D4($,y4($)),W=X.format||"webp",z=(await new Y.Input(G).getInfo()).duration||60,U=X.count||10,B=X.interval||z/U,j=[];for(let O=0;O<U&&O*B<z;O++)j.push(O*B);let H=await Y.extractThumbnails(G,{timestamps:j,width:X.width||320,format:W,quality:X.quality||80,outputDir:Z,outputPattern:`${w}-thumb-${Q}`});if(H&&H.length>0)return H.map((O,L)=>({path:O.path||C$(Z,`${w}-thumb-${Q}-${L}.${W}`),url:`${J}/${w}-thumb-${Q}-${L}.${W}`,width:O.width||X.width||320,height:O.height||180,timestamp:j[L],size:O.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function sJ($,X,Z,J){let Y=await S4();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=E4($);if(!await v0(G))return null;await b4(Z,{recursive:!0});let Q=await h0(G),w=D4($,y4($)),K=(await new Y.Input(G).getInfo()).duration||60,z=X.columns||10,U=X.interval||5,B=X.thumbnailWidth||160,j=X.thumbnailHeight||90,H=X.format||"jpeg",O=Math.ceil(K/U),L=Math.ceil(O/z),_=`${w}-sprite-${Q}.${H}`,F=C$(Z,_),V=[];for(let R=0;R<O;R++)V.push(R*U);let A=await Y.extractThumbnails(G,{timestamps:V,width:B,height:j,format:H,quality:X.quality||70,outputDir:C$(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=z*B,T=L*j,M=await R.createSprite({images:A.map((k)=>k.path),columns:z,padding:0,outputPath:F,format:H,quality:X.quality||70});return{url:`${J}/${_}`,path:F,columns:z,rows:L,thumbnailWidth:B,thumbnailHeight:j,interval:U,totalFrames:O}}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 C4=D(()=>{K5()});import{resolve as tJ,basename as eJ,extname as $Y,join as z5}from"path";import{mkdir as x$,writeFile as XY}from"fs/promises";async function ZY(){try{return await import("ts-videos")}catch{return null}}async function f$($,X,Z,J,Y){let G=await ZY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=tJ($);if(!await v0(Q))return null;let w=await h0(Q),W=eJ($,$Y($)),q=z5(Z,`${W}-${w}-hls`);await x$(q,{recursive:!0});let K=X.length>0?X:JY,z=Y?.segmentDuration||6,j=(await new G.Input(Q).getInfo()).duration||0,H=[],O=0;for(let F of K){let V=z5(q,F.label);await x$(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}),O+=N.segmentCount||Math.ceil(j/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"),_=tU(H,J,W,w);return await XY(L,_),{manifestUrl:`${J}/${W}-${w}-hls/master.m3u8`,manifestPath:L,playlists:H,segmentCount:O,duration:j}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function tU($,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(`
10837
- `)}async function g$($,X,Z,J,Y){let G=await ZY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=tJ($);if(!await v0(Q))return null;let w=await h0(Q),W=eJ($,$Y($)),q=z5(Z,`${W}-${w}-dash`);await x$(q,{recursive:!0});let K=X.length>0?X:JY,z=Y?.segmentDuration||4,U=Y?.minBufferTime||2,H=(await new G.Input(Q).getInfo()).duration||0,O=[],L=[];for(let A of K){let R=z5(q,A.label);await x$(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(O.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(O.length===0)return null;let _=z5(q,"manifest.mpd"),F=eU(O,L,H,z,U);await XY(_,F);let V=[{type:"video",representations:O}];if(L.length>0)V.push({type:"audio",representations:L});return{manifestUrl:`${J}/${W}-${w}-dash/manifest.mpd`,manifestPath:_,adaptationSets:V,duration:H}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function eU($,X,Z,J,Y){let G=aJ(Z),Q=aJ(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 tU($,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=eU(J),G=T4(Y[0],Z)||"",Q=T4(Y[1],Z)||"",w={};if(Y[2]){let W=T4(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 eU($){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 T4($,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 oJ;var sJ=D(()=>{Q4();rJ();K4();oJ=aU()});class b${config;constructor($={}){this.config={...$j,...$}}async get($,X){return V$($,X,"video",this.config)}async set($,X,Z){return A$($,X,Z,"video",this.config)}async clear(){return R$("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function M4($){if(!y$)y$=new b$($);else if($)y$.updateConfig($);return y$}async function S$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return M4(J).get($,X)}async function C$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return M4(Y).set($,X,Z)}async function aJ(){return M4().clear()}var $j,y$=null;var k4=D(()=>{H4();$j={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as I4,basename as E4,extname as D4,join as P$}from"path";import{mkdir as y4}from"fs/promises";async function b4(){try{return await import("ts-videos")}catch{return null}}async function v$($,X,Z,J){let Y=await b4();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=I4($);if(!await v0(G))return null;await y4(Z,{recursive:!0});let Q=await u0(G),w=E4($,D4($)),W=X.format||"webp",q=X.timestamp||0,K=`${w}-poster-${Q}.${W}`,z=P$(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 x$($,X,Z,J){let Y=await b4();if(!Y)return[];try{let G=I4($);if(!await v0(G))return[];await y4(Z,{recursive:!0});let Q=await u0(G),w=E4($,D4($)),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 O=0;O<U&&O*j<z;O++)B.push(O*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((O,L)=>({path:O.path||P$(Z,`${w}-thumb-${Q}-${L}.${W}`),url:`${J}/${w}-thumb-${Q}-${L}.${W}`,width:O.width||X.width||320,height:O.height||180,timestamp:B[L],size:O.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function tJ($,X,Z,J){let Y=await b4();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=I4($);if(!await v0(G))return null;await y4(Z,{recursive:!0});let Q=await u0(G),w=E4($,D4($)),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",O=Math.ceil(K/U),L=Math.ceil(O/z),_=`${w}-sprite-${Q}.${H}`,F=P$(Z,_),V=[];for(let R=0;R<O;R++)V.push(R*U);let A=await Y.extractThumbnails(G,{timestamps:V,width:j,height:B,format:H,quality:X.quality||70,outputDir:P$(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=z*j,I=L*B,T=await R.createSprite({images:A.map((k)=>k.path),columns:z,padding:0,outputPath:F,format:H,quality:X.quality||70});return{url:`${J}/${_}`,path:F,columns:z,rows:L,thumbnailWidth:j,thumbnailHeight:B,interval:U,totalFrames:O}}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 S4=D(()=>{K5()});import{resolve as $Y,basename as XY,extname as ZY,join as z5}from"path";import{mkdir as f$,writeFile as JY}from"fs/promises";async function YY(){try{return await import("ts-videos")}catch{return null}}async function g$($,X,Z,J,Y){let G=await YY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=$Y($);if(!await v0(Q))return null;let w=await u0(Q),W=XY($,ZY($)),q=z5(Z,`${W}-${w}-hls`);await f$(q,{recursive:!0});let K=X.length>0?X:GY,z=Y?.segmentDuration||6,B=(await new G.Input(Q).getInfo()).duration||0,H=[],O=0;for(let F of K){let V=z5(q,F.label);await f$(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}),O+=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"),_=Xj(H,J,W,w);return await JY(L,_),{manifestUrl:`${J}/${W}-${w}-hls/master.m3u8`,manifestPath:L,playlists:H,segmentCount:O,duration:B}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function Xj($,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 h$($,X,Z,J,Y){let G=await YY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=$Y($);if(!await v0(Q))return null;let w=await u0(Q),W=XY($,ZY($)),q=z5(Z,`${W}-${w}-dash`);await f$(q,{recursive:!0});let K=X.length>0?X:GY,z=Y?.segmentDuration||4,U=Y?.minBufferTime||2,H=(await new G.Input(Q).getInfo()).duration||0,O=[],L=[];for(let A of K){let R=z5(q,A.label);await f$(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(O.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(O.length===0)return null;let _=z5(q,"manifest.mpd"),F=Zj(O,L,H,z,U);await JY(_,F);let V=[{type:"video",representations:O}];if(L.length>0)V.push({type:"audio",representations:L});return{manifestUrl:`${J}/${W}-${w}-dash/manifest.mpd`,manifestPath:_,adaptationSets:V,duration:H}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function Zj($,X,Z,J,Y){let G=eJ(Z),Q=eJ(Y),w=`<?xml version="1.0" encoding="UTF-8"?>
10838
10856
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
10839
10857
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10840
10858
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -10860,8 +10878,8 @@ ${A.join(`
10860
10878
  </Representation>
10861
10879
  `}w+=` </AdaptationSet>
10862
10880
  `}return w+=` </Period>
10863
- </MPD>`,w}function aJ($){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 JY;var P4=D(()=>{K5();JY=[{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 YY,basename as $j,extname as Xj,join as Zj}from"path";import{mkdir as Jj}from"fs/promises";async function GY(){try{return await import("ts-videos")}catch{return null}}function Yj($){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 Gj($){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 v4($){let X=await GY();if(!X)return null;try{let Z=YY($),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 QY($,X,Z,J){let Y=await GY();if(!Y)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let G=await b$($,X,Z);if(G)return G;try{let Q=YY($);if(!await v0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let w=Z.outputDir||"dist/videos",W=Z.baseUrl||"/videos";await Jj(w,{recursive:!0});let q=await h0(Q),K=$j($,Xj($)),z={src:$,processed:!0,hash:q};J?.({percentage:5,stage:"analyzing"}),z.metadata=await v4(Q)||void 0;let U={};if(X.quality)U.bitrate=Yj(X.quality);if(X.platform)Object.assign(U,Gj(X.platform));if(X.transcode)Object.assign(U,X.transcode);if(Object.keys(U).length>0||X.process){J?.({percentage:10,stage:"transcoding"});let B=`${K}-${q}.mp4`,j=Zj(w,B);try{let H=await Qj(Q,j,U,Y,(O)=>J?.({percentage:10+O*0.5,stage:"transcoding"}));if(H)z.transcoded={path:j,url:`${W}/${B}`,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 B=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},j=await P$(Q,B,w,W);if(j)z.poster=j}if(Z.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let B=await v$(Q,Z.thumbnails,w,W);if(B.length>0)z.thumbnails=B}if(X.streaming){J?.({percentage:80,stage:"generating-manifests"});let B=typeof X.streaming==="object"?X.streaming:Z.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let j=await f$(Q,B.qualities||Z.streaming?.defaultQualities||[],w,W);if(j)z.streaming={...z.streaming,hls:j}}if(B.format==="dash"){let j=await g$(Q,B.qualities||Z.streaming?.defaultQualities||[],w,W);if(j)z.streaming={...z.streaming,dash:j}}}if(X.spriteSheet)J?.({percentage:90,stage:"generating-sprite-sheet"});return J?.({percentage:100,stage:"complete"}),await S$($,X,z,Z),z}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function Qj($,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 wY=D(()=>{K5();I4();C4();P4()});var WY={};t(WY,{setCachedVideoResult:()=>S$,processVideo:()=>QY,getCachedVideoResult:()=>b$,generateThumbnails:()=>v$,generateSpriteSheet:()=>sJ,generatePoster:()=>P$,generateHLSManifest:()=>f$,generateDASHManifest:()=>g$,clearVideoCache:()=>oJ,analyzeVideo:()=>v4,VideoProcessorCache:()=>y$});var qY=D(()=>{wY();C4();P4();I4()});async function zY(){try{return await Promise.resolve().then(() => (qY(),WY))}catch($){if(!KY)console.warn("[stx-media] Video processor not available, some features disabled:",$),KY=!0;return null}}async function h$($,X={}){let Z=X,J=$;if(J.process&&!J.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return Uj(J,Z)}if(Z.processedResult?.processed)return HY($,Z.processedResult,X);let Y;if(J.generatePoster&&J.src&&!$.poster)Y=await jj(J,Z);let{src:G,sources:Q=[],poster:w,posterPlaceholder:W,controls:q=UY,autoplay:K=!1,muted:z=!1,loop:U=!1,preload:B=jY,playsinline:j=!0,lazy:H=!0,player:O="native",type:L,width:_,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=$,N=Y||w,T=$.class,M=$.style,k=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return qj($,X);if(L&&L!=="video")return Wj(G||"",L,$);let E=Q.length>0?Q:G?[{src:G,type:BY(G)}]:[],I=[`id="${k}"`];if(q)I.push("controls");if(K)I.push("autoplay");if(z)I.push("muted");if(U)I.push("loop");if(j)I.push("playsinline");if(A)I.push("disablepictureinpicture");if(R)I.push("disableremoteplayback");if(V)I.push(`crossorigin="${V}"`);if(H){if(I.push(`data-preload="${B}"`),I.push('preload="none"'),N)I.push(`data-poster="${b0(N)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),N)I.push(`poster="${b0(N)}"`);if(_)I.push(`width="${_}"`);if(F)I.push(`height="${F}"`);if(T)I.push(`class="${b0(T)}"`);if(M)I.push(`style="${b0(M)}"`);let S=E.map((P)=>{return` <source ${H?`data-src="${b0(P.src)}"`:`src="${b0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
10864
- `),b=`<video ${I.join(" ")}>
10881
+ </MPD>`,w}function eJ($){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 GY;var C4=D(()=>{K5();GY=[{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 Jj,extname as Yj,join as Gj}from"path";import{mkdir as Qj}from"fs/promises";async function wY(){try{return await import("ts-videos")}catch{return null}}function wj($){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 Wj($){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 P4($){let X=await wY();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 WY($,X,Z,J){let Y=await wY();if(!Y)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let G=await S$($,X,Z);if(G)return G;try{let Q=QY($);if(!await v0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let w=Z.outputDir||"dist/videos",W=Z.baseUrl||"/videos";await Qj(w,{recursive:!0});let q=await u0(Q),K=Jj($,Yj($)),z={src:$,processed:!0,hash:q};J?.({percentage:5,stage:"analyzing"}),z.metadata=await P4(Q)||void 0;let U={};if(X.quality)U.bitrate=wj(X.quality);if(X.platform)Object.assign(U,Wj(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=Gj(w,j);try{let H=await qj(Q,B,U,Y,(O)=>J?.({percentage:10+O*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 v$(Q,j,w,W);if(B)z.poster=B}if(Z.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let j=await x$(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 g$(Q,j.qualities||Z.streaming?.defaultQualities||[],w,W);if(B)z.streaming={...z.streaming,hls:B}}if(j.format==="dash"){let B=await h$(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 C$($,X,z,Z),z}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function qj($,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 qY=D(()=>{K5();k4();S4();C4()});var KY={};t(KY,{setCachedVideoResult:()=>C$,processVideo:()=>WY,getCachedVideoResult:()=>S$,generateThumbnails:()=>x$,generateSpriteSheet:()=>tJ,generatePoster:()=>v$,generateHLSManifest:()=>g$,generateDASHManifest:()=>h$,clearVideoCache:()=>aJ,analyzeVideo:()=>P4,VideoProcessorCache:()=>b$});var zY=D(()=>{qY();S4();C4();k4()});async function jY(){try{return await Promise.resolve().then(() => (zY(),KY))}catch($){if(!UY)console.warn("[stx-media] Video processor not available, some features disabled:",$),UY=!0;return null}}async function u$($,X={}){let Z=X,J=$;if(J.process&&!J.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return Hj(J,Z)}if(Z.processedResult?.processed)return OY($,Z.processedResult,X);let Y;if(J.generatePoster&&J.src&&!$.poster)Y=await _j(J,Z);let{src:G,sources:Q=[],poster:w,posterPlaceholder:W,controls:q=BY,autoplay:K=!1,muted:z=!1,loop:U=!1,preload:j=HY,playsinline:B=!0,lazy:H=!0,player:O="native",type:L,width:_,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=$,N=Y||w,I=$.class,T=$.style,k=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return Uj($,X);if(L&&L!=="video")return zj(G||"",L,$);let E=Q.length>0?Q:G?[{src:G,type:_Y(G)}]:[],M=[`id="${k}"`];if(q)M.push("controls");if(K)M.push("autoplay");if(z)M.push("muted");if(U)M.push("loop");if(B)M.push("playsinline");if(A)M.push("disablepictureinpicture");if(R)M.push("disableremoteplayback");if(V)M.push(`crossorigin="${V}"`);if(H){if(M.push(`data-preload="${j}"`),M.push('preload="none"'),N)M.push(`data-poster="${b0(N)}"`);M.push("data-stx-lazy")}else if(M.push(`preload="${j}"`),N)M.push(`poster="${b0(N)}"`);if(_)M.push(`width="${_}"`);if(F)M.push(`height="${F}"`);if(I)M.push(`class="${b0(I)}"`);if(T)M.push(`style="${b0(T)}"`);let S=E.map((P)=>{return` <source ${H?`data-src="${b0(P.src)}"`:`src="${b0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
10882
+ `),b=`<video ${M.join(" ")}>
10865
10883
  ${S}
10866
10884
  Your browser does not support the video tag.
10867
10885
  </video>`,y;if(H)y=`
@@ -10899,12 +10917,12 @@ ${S}
10899
10917
 
10900
10918
  observer.observe(video);
10901
10919
  })();
10902
- `.trim();return{html:b,script:y}}function Wj($,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=Kj($),W=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=zj($),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="${b0(W)}"`,`width="${J}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)K.push(`class="${b0(G)}"`);if(Q)K.push(`style="${b0(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:y}}function zj($,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=jj($),W=q?`https://www.youtube-nocookie.com/embed/${q}`:$;break;case"vimeo":q=Bj($),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="${b0(W)}"`,`width="${J}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)K.push(`class="${b0(G)}"`);if(Q)K.push(`style="${b0(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;">
10903
10921
  <iframe ${K.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
10904
- </div>`}}function qj($,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:B}=$,j=$.class,H=$.style,O=$.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},_=["position: relative",U?`width: ${typeof U==="number"?U+"px":U}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",H||""].filter(Boolean).join("; "),F=`
10922
+ </div>`}}function Uj($,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,O=$.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},_=["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=`
10905
10923
  <div
10906
10924
  id="${O}"
10907
- class="ts-video-player${j?" "+b0(j):""}"
10925
+ class="ts-video-player${B?" "+b0(B):""}"
10908
10926
  style="${_}"
10909
10927
  data-ts-video-player
10910
10928
  data-config='${JSON.stringify(L)}'
@@ -10938,7 +10956,7 @@ ${S}
10938
10956
 
10939
10957
  // Load ts-video-player from CDN
10940
10958
  var script = document.createElement('script');
10941
- script.src = '${wj}';
10959
+ script.src = '${Kj}';
10942
10960
  script.onload = initPlayer;
10943
10961
  script.onerror = function() {
10944
10962
  console.error('[stx] Failed to load ts-video-player');
@@ -11068,12 +11086,12 @@ else {
11068
11086
  .ts-video-player__play-button svg {
11069
11087
  margin-left: 4px;
11070
11088
  }
11071
- `.trim();return{html:F,script:V,css:A}}function BY($){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 Kj($){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 zj($){let X=$.match(/vimeo\.com\/(\d+)/);return X?X[1]:null}function b0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function Uj($,X){let Z=await zY();if(!Z)return h$({...$,process:!1},X);let J=X.tsVideosConfig,Y=await Z.processVideo($.src,$,J,$.onProcessProgress);if(Y.processed)return HY($,Y,X);return h$({...$,process:!1},X)}async function jj($,X){let Z=await zY();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 HY($,X,Z){let{controls:J=UY,autoplay:Y=!1,muted:G=!1,loop:Q=!1,preload:w=jY,playsinline:W=!0,lazy:q=!0,width:K,height:z,crossorigin:U,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,H=$.class,O=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,_=$.src,F=BY(_);if(X.transcoded)_=X.transcoded.url,F="video/mp4";let V=X.streaming?.hls||X.streaming?.dash;if(V){if(X.streaming?.hls)_=X.streaming.hls.manifestUrl,F="application/x-mpegURL";else if(X.streaming?.dash)_=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(B)R.push("disablepictureinpicture");if(j)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="${b0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${w}"`),A)R.push(`poster="${b0(A)}"`);let N=K||X.metadata?.width,T=z||X.metadata?.height;if(N)R.push(`width="${N}"`);if(T)R.push(`height="${T}"`);if(H)R.push(`class="${b0(H)}"`);if(O)R.push(`style="${b0(O)}"`);let k=` <source ${q?`data-src="${b0(_)}"`:`src="${b0(_)}"`} type="${F}" />`,E=`<video ${R.join(" ")}>
11089
+ `.trim();return{html:F,script:V,css:A}}function _Y($){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 jj($){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 Bj($){let X=$.match(/vimeo\.com\/(\d+)/);return X?X[1]:null}function b0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function Hj($,X){let Z=await jY();if(!Z)return u$({...$,process:!1},X);let J=X.tsVideosConfig,Y=await Z.processVideo($.src,$,J,$.onProcessProgress);if(Y.processed)return OY($,Y,X);return u$({...$,process:!1},X)}async function _j($,X){let Z=await jY();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 OY($,X,Z){let{controls:J=BY,autoplay:Y=!1,muted:G=!1,loop:Q=!1,preload:w=HY,playsinline:W=!0,lazy:q=!0,width:K,height:z,crossorigin:U,disablePictureInPicture:j=!1,disableRemotePlayback:B=!1}=$,H=$.class,O=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,_=$.src,F=_Y(_);if(X.transcoded)_=X.transcoded.url,F="video/mp4";let V=X.streaming?.hls||X.streaming?.dash;if(V){if(X.streaming?.hls)_=X.streaming.hls.manifestUrl,F="application/x-mpegURL";else if(X.streaming?.dash)_=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="${b0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${w}"`),A)R.push(`poster="${b0(A)}"`);let N=K||X.metadata?.width,I=z||X.metadata?.height;if(N)R.push(`width="${N}"`);if(I)R.push(`height="${I}"`);if(H)R.push(`class="${b0(H)}"`);if(O)R.push(`style="${b0(O)}"`);let k=` <source ${q?`data-src="${b0(_)}"`:`src="${b0(_)}"`} type="${F}" />`,E=`<video ${R.join(" ")}>
11072
11090
  ${k}
11073
11091
  Your browser does not support the video tag.
11074
11092
  </video>`;if(X.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${b0(X.spriteSheet.url)}" data-sprite-cols="${X.spriteSheet.columns}" data-sprite-interval="${X.spriteSheet.interval}">
11075
11093
  ${E}
11076
- </div>`;let I;if(q)I=`
11094
+ </div>`;let M;if(q)M=`
11077
11095
  (function() {
11078
11096
  var video = document.getElementById('${L}');
11079
11097
  if (!video) return;
@@ -11117,9 +11135,9 @@ ${E}
11117
11135
  width: 100%;
11118
11136
  height: auto;
11119
11137
  }
11120
- `.trim();return{html:E,script:I,css:S}}var KY=!1,UY=!0,jY="metadata",wj="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var _Y=D(()=>{f4()});function OY(){return O$({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,X,Z,J)=>{let{src:Y,options:G}=Bj($,X,Z);if(!Y)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:Y,poster:G.poster,controls:G.controls!==!1,autoplay:G.autoplay||!1,muted:G.muted||!1,loop:G.loop||!1,preload:G.preload||"metadata",playsinline:G.playsinline!==!1,lazy:G.lazy!==!1,player:G.player||"native",type:G.type,width:G.width,height:G.height,class:G.class,style:G.style,id:G.id,crossorigin:G.crossorigin,disablePictureInPicture:G.disablePictureInPicture,disableRemotePlayback:G.disableRemotePlayback,title:G.title,quality:G.quality,platform:G.platform,process:G.process,generatePoster:G.generatePoster,streaming:G.streaming,transcode:G.transcode,spriteSheet:G.spriteSheet,waveform:G.waveform},W={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},q=await h$(Q,W),K=q.html;if(q.css)K+=`
11138
+ `.trim();return{html:E,script:M,css:S}}var UY=!1,BY=!0,HY="metadata",Kj="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var LY=D(()=>{x4()});function FY(){return L$({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,X,Z,J)=>{let{src:Y,options:G}=Oj($,X,Z);if(!Y)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:Y,poster:G.poster,controls:G.controls!==!1,autoplay:G.autoplay||!1,muted:G.muted||!1,loop:G.loop||!1,preload:G.preload||"metadata",playsinline:G.playsinline!==!1,lazy:G.lazy!==!1,player:G.player||"native",type:G.type,width:G.width,height:G.height,class:G.class,style:G.style,id:G.id,crossorigin:G.crossorigin,disablePictureInPicture:G.disablePictureInPicture,disableRemotePlayback:G.disableRemotePlayback,title:G.title,quality:G.quality,platform:G.platform,process:G.process,generatePoster:G.generatePoster,streaming:G.streaming,transcode:G.transcode,spriteSheet:G.spriteSheet,waveform:G.waveform},W={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},q=await u$(Q,W),K=q.html;if(q.css)K+=`
11121
11139
  <style>${q.css}</style>`;if(q.script)K+=`
11122
- <script>${q.script}</script>`;return K},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Bj($,X,Z){if(X.src)return{src:String(X.src),options:X.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=Hj(J),G=LY(Y[0],Z)||"",Q={};if(Y[1]){let w=LY(Y[1],Z);if(typeof w==="object"&&w!==null)Q=w;else if(typeof Y[1]==="string")try{Q=JSON.parse(Y[1])}catch{}}return{src:G,options:Q}}function Hj($){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 LY($,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 x4;var f4=D(()=>{w4();_Y();x4=OY()});function _j($,X){let Z=X.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
11140
+ <script>${q.script}</script>`;return K},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Oj($,X,Z){if(X.src)return{src:String(X.src),options:X.options||{}};let J=$.trim();if(J.startsWith("@video(")||J.startsWith("("))J=J.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let Y=Lj(J),G=VY(Y[0],Z)||"",Q={};if(Y[1]){let w=VY(Y[1],Z);if(typeof w==="object"&&w!==null)Q=w;else if(typeof Y[1]==="string")try{Q=JSON.parse(Y[1])}catch{}}return{src:G,options:Q}}function Lj($){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 VY($,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 v4;var x4=D(()=>{Q4();LY();v4=FY()});function Fj($,X){let Z=X.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
11123
11141
  ${$}
11124
11142
  </div>
11125
11143
  <script>
@@ -11164,7 +11182,7 @@ ${E}
11164
11182
  }
11165
11183
  }
11166
11184
  })();
11167
- </script>`}function Oj($,X){let Z=X.pwa?.updates,J=Z?.message||"A new version is available. Reload to update?",Y=Z?.autoReload||!1,G=$.trim().length>0,Q=`
11185
+ </script>`}function Vj($,X){let Z=X.pwa?.updates,J=Z?.message||"A new version is available. Reload to update?",Y=Z?.autoReload||!1,G=$.trim().length>0,Q=`
11168
11186
  <div class="stx-pwa-update-banner" style="
11169
11187
  position: fixed;
11170
11188
  bottom: 0;
@@ -11275,7 +11293,7 @@ else {
11275
11293
  // Also listen for custom event
11276
11294
  window.addEventListener('pwa-update-available', showUpdate);
11277
11295
  })();
11278
- </script>`}function Lj($,X){let Z=$.trim().length>0,J=`
11296
+ </script>`}function Aj($,X){let Z=$.trim().length>0,J=`
11279
11297
  <div class="stx-offline-indicator" style="
11280
11298
  position: fixed;
11281
11299
  top: 16px;
@@ -11336,7 +11354,7 @@ else {
11336
11354
  window.addEventListener('offline', updateStatus);
11337
11355
  updateStatus();
11338
11356
  })();
11339
- </script>`}function Fj($,X){let Z=X.pwa?.push,J=Z?.vapidPublicKey||"",Y=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
11357
+ </script>`}function Rj($,X){let Z=X.pwa?.push,J=Z?.vapidPublicKey||"",Y=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
11340
11358
  ${$}
11341
11359
  </div>
11342
11360
  <script>
@@ -11418,33 +11436,33 @@ catch (error) {
11418
11436
  init();
11419
11437
  }
11420
11438
  })();
11421
- </script>`}var Vj,Aj,Rj,Nj,FY;var VY=D(()=>{Vj={name:"pwa.installButton",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return _j($,Y)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Aj={name:"pwa.updatePrompt",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Oj($,Y)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Rj={name:"pwa.offlineIndicator",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Lj($,Y)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Nj={name:"pwa.pushSubscribe",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Fj($,Y)},hasEndTag:!0,description:"Renders a push notification subscription button"},FY=[Vj,Aj,Rj,Nj]});function g4($){for(let[X,Z]of Object.entries(o))if(Z===$)return X;return}var o;var u$=D(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function r7(){return!1}function o7(){return!r7()||process.env.STX_DEBUG==="true"}function d$(){return!1}import Tj from"path";function m$(){return{...h4}}function c$($){if(!h4.showRelativePaths||!$)return $;let X=h4.baseDir||process.cwd();try{let Z=Tj.relative(X,$);return Z.startsWith("..")?$:Z}catch{return $}}var Mj,h4,l$,U5,p$;var i$=D(()=>{u$();Mj={showRelativePaths:!1,enableAutoRecovery:o7(),logRecoveryWarnings:!0},h4={...Mj};l$=class l$ 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||o.EVALUATION_ERROR,this.filePath)this.filePath=c$(this.filePath)}};U5=class U5 extends l${constructor($,X,Z,J,Y,G){super($,"stx_RUNTIME_ERROR",X,Z,J,Y,G||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};p$=class p$ extends l${isFatal=!0;constructor($,X,Z,J,Y,G){super($,"stx_VALIDATION_ERROR",X,Z,J,Y,G||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function RY($){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,B=Q;if(!U&&w&&W!==void 0){let _=bj(w,W);U=_.line,B=_.column}let j=Y?c$(Y):void 0,H=J?g4(J):void 0,O={type:X,code:J,codeName:H,message:Z,filePath:j,line:U,column:B,snippet:q,suggestion:K,timestamp:new Date().toISOString()},L;switch(z){case"html":L=Ij(O);break;case"json":L=JSON.stringify(O,null,2);break;case"console":L=Ej(O,w,W);break;case"text":default:L=kj(O,w,W);break}return{formatted:L,data:O}}function kj($,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(`
11422
- ${$.message}`),X&&$.line){let G=Dj(X,$.line,2);if(G)J.push(`
11439
+ </script>`}var Nj,Tj,Mj,kj,AY;var RY=D(()=>{Nj={name:"pwa.installButton",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Fj($,Y)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Tj={name:"pwa.updatePrompt",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Vj($,Y)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Mj={name:"pwa.offlineIndicator",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Aj($,Y)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},kj={name:"pwa.pushSubscribe",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Rj($,Y)},hasEndTag:!0,description:"Renders a push notification subscription button"},AY=[Nj,Tj,Mj,kj]});function f4($){for(let[X,Z]of Object.entries(o))if(Z===$)return X;return}var o;var d$=D(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function r7(){return!1}function o7(){return!r7()||process.env.STX_DEBUG==="true"}function m$(){return!1}import Ij from"path";function c$(){return{...g4}}function l$($){if(!g4.showRelativePaths||!$)return $;let X=g4.baseDir||process.cwd();try{let Z=Ij.relative(X,$);return Z.startsWith("..")?$:Z}catch{return $}}var Ej,g4,p$,U5,i$;var n$=D(()=>{d$();Ej={showRelativePaths:!1,enableAutoRecovery:o7(),logRecoveryWarnings:!0},g4={...Ej};p$=class p$ 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||o.EVALUATION_ERROR,this.filePath)this.filePath=l$(this.filePath)}};U5=class U5 extends p${constructor($,X,Z,J,Y,G){super($,"stx_RUNTIME_ERROR",X,Z,J,Y,G||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};i$=class i$ extends p${isFatal=!0;constructor($,X,Z,J,Y,G){super($,"stx_VALIDATION_ERROR",X,Z,J,Y,G||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function TY($){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 _=Pj(w,W);U=_.line,j=_.column}let B=Y?l$(Y):void 0,H=J?f4(J):void 0,O={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=yj(O);break;case"json":L=JSON.stringify(O,null,2);break;case"console":L=bj(O,w,W);break;case"text":default:L=Dj(O,w,W);break}return{formatted:L,data:O}}function Dj($,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
+ ${$.message}`),X&&$.line){let G=Sj(X,$.line,2);if(G)J.push(`
11423
11441
  ${G}`)}if($.snippet)J.push(`
11424
11442
  Snippet: ${$.snippet}`);if($.suggestion)J.push(`
11425
- Suggestion: ${$.suggestion}`);return J.join(" ")}function Ij($){let X=$.code?` [${$.code}]`:"",Z=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${X}]${Z}: ${AY($.message)}`;if($.suggestion)J+=` | Suggestion: ${AY($.suggestion)}`;return J+=" -->",J}function Ej($,X,Z){let q=[],K=$.code?` [${$.codeName||$.code}]`:"";if(q.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${K} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}q.push(`
11443
+ Suggestion: ${$.suggestion}`);return J.join(" ")}function yj($){let X=$.code?` [${$.code}]`:"",Z=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${X}]${Z}: ${NY($.message)}`;if($.suggestion)J+=` | Suggestion: ${NY($.suggestion)}`;return J+=" -->",J}function bj($,X,Z){let q=[],K=$.code?` [${$.codeName||$.code}]`:"";if(q.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${K} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}q.push(`
11426
11444
  \x1B[90mat\x1B[0m ${z}`)}if(q.push(`
11427
11445
 
11428
- ${$.message}`),X&&$.line){let z=yj(X,$.line,2);if(z)q.push(`
11446
+ ${$.message}`),X&&$.line){let z=Cj(X,$.line,2);if(z)q.push(`
11429
11447
 
11430
11448
  \x1B[90mContext:\x1B[0m
11431
11449
  ${z}`)}if($.suggestion)q.push(`
11432
11450
 
11433
11451
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return q.push(`
11434
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),q.join("")}function Dj($,X,Z){let J=$.split(`
11452
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),q.join("")}function Sj($,X,Z){let J=$.split(`
11435
11453
  `),Y=Math.max(0,X-Z-1),G=Math.min(J.length-1,X+Z-1),Q=[];for(let w=Y;w<=G;w++){let W=(w+1).toString().padStart(4),q=w===X-1?">":" ";Q.push(`${q}${W} | ${J[w]}`)}return Q.join(`
11436
- `)}function yj($,X,Z){let J=$.split(`
11437
- `),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,B=U?"\x1B[31m>\x1B[0m":" ",j=U?`\x1B[31m${J[K]}\x1B[0m`:`\x1B[90m${J[K]}\x1B[0m`;q.push(`${B}\x1B[90m${z}\x1B[0m | ${j}`)}return q.join(`
11438
- `)}function AY($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function bj($,X){let J=$.substring(0,X).split(`
11439
- `);return{line:J.length,column:J[J.length-1].length}}function Y0($,X,Z){return RY({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 NY=D(()=>{u$();i$()});class d4{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(`
11454
+ `)}function Cj($,X,Z){let J=$.split(`
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
+ `)}function NY($){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 Y0($,X,Z){return TY({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 MY=D(()=>{d$();n$()});class u4{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(`
11440
11458
  `).slice(1).join(`
11441
11459
  `)}`);if($.context)X.push(` Context: ${JSON.stringify($.context)}`);return X.join(`
11442
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($)}
11443
11461
  `;X.appendFileSync(this.logFilePath,Y,"utf-8")}catch(X){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",X)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Z=this.maxLogFiles-1;Z>=1;Z--){let J=`${this.logFilePath}.${Z}`,Y=`${this.logFilePath}.${Z+1}`;if($.existsSync(J))if(Z>=this.maxLogFiles-1)$.unlinkSync(J);else $.renameSync(J,Y)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(X){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",X)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((X)=>X.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((X)=>X.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},X={error:0,warning:0,info:0};for(let Z of this.errors){let J=Z.error.constructor.name;$[J]=($[J]||0)+1;let Y=Z.level||"error";X[Y]=(X[Y]||0)+1}return{total:this.errors.length,byType:$,byLevel:X}}async exportToFile($,X="json"){let Z=await import("fs"),Y=(await import("path")).dirname($);if(!Z.existsSync(Y))Z.mkdirSync(Y,{recursive:!0});if(X==="json"){let G=this.errors.map((Q)=>({timestamp:Q.timestamp.toISOString(),level:Q.level||"error",type:Q.error.constructor.name,message:Q.error.message,stack:Q.error.stack,context:Q.context}));Z.writeFileSync($,JSON.stringify(G,null,2),"utf-8")}else{let G=this.errors.map((Q)=>this.formatEntry(Q));Z.writeFileSync($,G.join(`
11444
11462
 
11445
- `),"utf-8")}}async flush(){await this.writeQueue}}var u4,Q1,m4;var TY=D(()=>{i$();u4={isEnabled(){return m$().enableAutoRecovery},fixCommonSyntaxErrors($){let X=m$();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+=`
11446
- @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(o7())return`<!-- ${$} failed: ${X.message} -->`;return"<!-- stx rendering error -->"}};Q1=new d4,m4={isDevelopment(){return o7()},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(`
11447
- `)}}});var MY=()=>{};var kY=D(()=>{u$();NY();TY();MY();i$()});var k1=D(()=>{kY()});function EY($,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,B=(()=>{try{let j=D0(z,X);if(!j)return"";let H="<meta";if(j.name)H+=` name="${n(String(j.name))}"`;if(j.property)H+=` property="${n(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${n(String(j.httpEquiv))}"`;if(j.content)H+=` content="${n(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return Y0("MetaTag",H,o.EVALUATION_ERROR)}})();Y=Y.substring(0,w)+B+Y.substring(U),G.lastIndex=0}return Y}function DY($,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 B=D0(K,X);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return Y0("StructuredData",j,o.EVALUATION_ERROR)}})();J=J.substring(0,Q)+U+J.substring(z),Y.lastIndex=0}return J}function yY($,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 B=q+U[0].length,j=Y.substring(w,q),H=Y.substring(Q.index,B),O=((L)=>{try{let _=D0(L,X);if(!_)return"";let F="";if(_.title)F+=`<title>${n(_.title)}</title>
11463
+ `),"utf-8")}}async flush(){await this.writeQueue}}var h4,Q1,d4;var kY=D(()=>{n$();h4={isEnabled(){return c$().enableAutoRecovery},fixCommonSyntaxErrors($){let X=c$();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
+ @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(o7())return`<!-- ${$} failed: ${X.message} -->`;return"<!-- stx rendering error -->"}};Q1=new u4,d4={isDevelopment(){return o7()},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 IY=()=>{};var EY=D(()=>{d$();MY();kY();IY();n$()});var k1=D(()=>{EY()});function yY($,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=D0(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 Y0("MetaTag",H,o.EVALUATION_ERROR)}})();Y=Y.substring(0,w)+j+Y.substring(U),G.lastIndex=0}return Y}function bY($,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=D0(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 Y0("StructuredData",B,o.EVALUATION_ERROR)}})();J=J.substring(0,Q)+U+J.substring(z),Y.lastIndex=0}return J}function SY($,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),O=((L)=>{try{let _=D0(L,X);if(!_)return"";let F="";if(_.title)F+=`<title>${n(_.title)}</title>
11448
11466
  `,F+=`<meta name="title" content="${n(_.title)}">
11449
11467
  `;if(_.description)F+=`<meta name="description" content="${n(_.description)}">
11450
11468
  `;if(_.keywords){let V=Array.isArray(_.keywords)?_.keywords.join(", "):_.keywords;F+=`<meta name="keywords" content="${n(V)}">
@@ -11466,7 +11484,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
11466
11484
  `}if(V.site)F+=`<meta name="twitter:site" content="${n(V.site)}">
11467
11485
  `;if(V.creator)F+=`<meta name="twitter:creator" content="${n(V.creator)}">
11468
11486
  `}if(_.structuredData){let V=JSON.stringify(_.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${V}</script>
11469
- `}return F.trim()}catch(_){let F=_ instanceof Error?_.message:String(_);return Y0("SEO",`Error processing @seo directive: ${F}`,o.EVALUATION_ERROR)}})(j);Y=Y.substring(0,Q.index)+O+Y.substring(B),G.lastIndex=Q.index+O.length}return Y}function bY($,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=`
11487
+ `}return F.trim()}catch(_){let F=_ instanceof Error?_.message:String(_);return Y0("SEO",`Error processing @seo directive: ${F}`,o.EVALUATION_ERROR)}})(B);Y=Y.substring(0,Q.index)+O+Y.substring(j),G.lastIndex=Q.index+O.length}return Y}function CY($,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=`
11470
11488
  <!-- stx SEO Tags -->
11471
11489
  <meta name="title" content="${n(Q)}">
11472
11490
  <meta name="description" content="${n(w)}">
@@ -11482,8 +11500,8 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
11482
11500
  `;let K=$;if(!G)K=K.replace(/<head[^>]*>/,`$&
11483
11501
  <title>${n(Q)}</title>`);return K.replace(/<head[^>]*>/,`$&
11484
11502
  ${q}
11485
- `)}function n($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function IY($){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 PY($){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(`
11486
- `).trim()}var Sj,SY,CY;var n$=D(()=>{k1();x5();y0();Sj=["og:","article:","book:","profile:","fb:","music:","video:"];SY={name:"meta",handler:($,X,Z,J)=>{if(X.length<1)return Y0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let Y=IY(X[0]).value,G;if(X.length>1){let W=IY(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=Sj.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},CY={name:"structuredData",handler:($,X,Z,J)=>{if($.trim()==="")return Y0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return Y0("StructuredData","structuredData requires @type property",o.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 Y0("StructuredData",G,o.EVALUATION_ERROR)}},hasEndTag:!0}});import s7 from"path";function Cj($,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],B=U.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)Y=B[1];let j=U.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)G=j[1].split(",").map((O)=>O.trim().replace(/['"`]/g,"")).filter((O)=>O.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 Pj($){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 DY($){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 xY($){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 vj,PY,vY;var r$=D(()=>{k1();x5();y0();vj=["og:","article:","book:","profile:","fb:","music:","video:"];PY={name:"meta",handler:($,X,Z,J)=>{if(X.length<1)return Y0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let Y=DY(X[0]).value,G;if(X.length>1){let W=DY(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=vj.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},vY={name:"structuredData",handler:($,X,Z,J)=>{if($.trim()==="")return Y0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return Y0("StructuredData","structuredData requires @type property",o.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 Y0("StructuredData",G,o.EVALUATION_ERROR)}},hasEndTag:!0}});import s7 from"path";function xj($,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((O)=>O.trim().replace(/['"`]/g,"")).filter((O)=>O.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 fj($){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)=>`
11487
11505
  get ${z}() {
11488
11506
  return this.getAttribute('${z}') || '';
11489
11507
  }
@@ -11534,16 +11552,16 @@ ${K}
11534
11552
  }
11535
11553
 
11536
11554
  customElements.define('${X}', ${Q});
11537
- `}async function vY($,X,Z,J){if(X.length<1)return Y0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let Y=X[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",w=[s7.join(s7.dirname(J),Q,`${Y}.stx`),s7.join(process.cwd(),Q,`${Y}.stx`),s7.join(s7.dirname(J),`${Y}.stx`)],W=null;for(let z of w)if(await e(z)){W=await Bun.file(z).text();break}if(!W)return Y0("WebComponent",`Component file not found: ${Y}.stx`,o.FILE_NOT_FOUND);let q=Cj(W,Y);return`<script type="module">
11538
- ${Pj(q)}
11539
- </script>`}var xY=D(()=>{k1();V0()});var fY={};t(fY,{timingPlugin:()=>hj,pluginManager:()=>vj,definePlugin:()=>r$,debugPlugin:()=>gj,createVariablesPlugin:()=>uj,createFilterPlugin:()=>fj,createDirectivePlugin:()=>xj,PluginManager:()=>c4});function r$($){return $}class c4{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 xj($,X,Z={}){return{name:$,...Z,registerDirectives:()=>X}}function fj($,X,Z={}){return{name:$,...Z,registerFilters:()=>X}}function uj($){return r$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(X){return{context:{...X.context,...$}}}})}var vj,gj,hj;var gY=D(()=>{vj=new c4;gj=r$({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)}}),hj=r$({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 mY={};t(mY,{validateConfig:()=>nj,resolveStxDirectories:()=>dY,loadStxConfig:()=>Y1,defineStxConfig:()=>ij,defaultConfig:()=>j5,config:()=>S7});import o$ from"fs";import o0 from"path";import{loadConfigWithResult as dj}from"bunfig";function mj($,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(o$.existsSync(G)&&o$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=o0.join(Y,"resources","views","pages");if(o$.existsSync(w))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}function cj($,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 dY($,X){let Z=!$.root,J=mj($.root,$.pagesDir,X);if($.root=J.root,$.pagesDir=J.pagesDir,Z&&J.root!=="."){let Y=`${X}::${J.root}`;if(!hY.has(Y))hY.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)||cj(Q,Y))continue;$[G]=o0.join(Y,Q)}}return $}function lj($,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(o$.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 pj($){if(i6($.stateDir),$.stateDir=k7(),$.cachePath=I7($.cachePath),$.build)$.build.cacheDir=I7($.build.cacheDir);if($.media?.cache)$.media.cache.directory=I7($.media.cache.directory);if($.story)$.story.outDir=I7($.story.outDir)}async function Y1($){if(!$){if(m5)return m5;if(s$)return s$}let X=$?o0.resolve($):process.cwd(),Z=uY.get(X);if(Z)return Z;let J=(async()=>{let G=(await dj({name:"stx",alias:"ui",cwd:X,defaultConfig:j5,verbose:!1})).config;if(pj(G),dY(G,X),lj(G,X),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (gY(),fY)),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,B;try{U=await import(K),B=o0.dirname(j0.resolve(K))}catch{let H=o0.resolve(process.cwd(),K);U=await import(H),B=o0.dirname(H)}let j=U.default||U;if(Q.register(j,G),j.components){let H=Array.isArray(j.components)?j.components:[j.components];for(let O of H)w.push(o0.resolve(B,O))}if(j.pages){let H=o0.resolve(B,j.pages),O=z.path||"/";W.push({dir:H,prefix:O})}if(j.setup){let H={addDirective:(O)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(O)},addRoute:(O,L)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[O]=L},addMiddleware:(O)=>{G.middleware=G.middleware||[],G.middleware.push(O)},pluginDir:B,config:G};await j.setup(z,H)}console.log(`[stx] Plugin loaded: ${j.name||K}`)}catch(U){console.warn(`[stx] Failed to load plugin ${K}:`,U.message)}}G._pluginComponentDirs=w,G._pluginPageDirs=W}return G})();if(uY.set(X,J),!$)s$=J,J.then((Y)=>{m5=Y}).catch(()=>{});return J}function ij($){return $}function nj($){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,hY,m5=null,uY,s$=null,S7;var N1=D(()=>{a9();t9();e9();$X();Q4();rJ();f4();VY();n$();E7();xY();j5={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:VJ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:vY,hasEndTag:!1,description:"Include a web component in the template"},s6,a6,SY,CY,t6,$2,X2,e6,Y2,w2,nJ,x4,...FY],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}};hY=new Set;uY=new Map;S7=new Proxy(j5,{get($,X){if(m5&&X in m5)return m5[X];if(!s$)Y1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[X]}})});var rY={};t(rY,{resetCssCache:()=>XB,resetCrosswindCache:()=>ZB,rebuildCrosswindCSS:()=>JB,loadCrosswindConfig:()=>n4,loadCrosswind:()=>i4,injectCrosswindCSS:()=>t7,getCrosswindServeAsset:()=>sj,getCachedCSS:()=>YB,generateCrosswindCSS:()=>nY,extractClassNames:()=>iY,buildCrosswindCSS:()=>pY});import w0 from"path";import{hasLocalConfig as rj}from"bunfig";function t$($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function l4($,X){if(I1.has($))I1.delete($);else if(I1.size>=lY)I1.delete(I1.keys().next().value);I1.set($,X)}function oj($){let X=t$($);if(w1.has(X))w1.delete(X);else if(w1.size>=lY)w1.delete(w1.keys().next().value);return w1.set(X,$),X}function sj($){let X=w1.get($);if(X===void 0)return;return w1.delete($),w1.set($,X),X}async function aj($){if(!l1)return null;try{let X=Bun.file(w0.join(l1,`cw-${t$($)}.css`));if(!await X.exists())return null;return await X.text()}catch{return null}}async function tj($,X){if(!l1)return;try{if(!fs.existsSync(l1))fs.mkdirSync(l1,{recursive:!0});await Bun.write(w0.join(l1,`cw-${t$($)}.css`),X)}catch{}}async function cY($){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 ej(){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 $B(){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 i4(){if(p4)return H1;p4=!0;try{let $=async(Y)=>{for(let G of Y){if(!await Bun.file(G).exists())continue;let Q=await cY(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 H1=G,H1}let X=await $(ej());if(X)return H1=X,H1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of Z){let G=await cY(Y);if(G){if(H1=G,!process.env.STACKS_DEV_QUIET)console.log(`${L0.green}[Crosswind]${L0.reset} CSS engine loaded`);return H1}}let J=await $($B());if(J)return H1=J,H1;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 XB(){I1.clear(),w1.clear()}function ZB(){H1=null,p4=!1,W1=null,a7="",I1.clear(),w1.clear(),a$=null}async function n4($){try{if(!rj({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 pY($){if(c5)return a7;c5=!0;try{let X=await i4();if(!X||!X.build)return c5=!1,"";if(!W1)W1=await n4($);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(a7=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 c5=!1,Q.css}catch(X){return console.error(`${L0.red}[Crosswind]${L0.reset} Build error:`,X),c5=!1,a7}}async function JB($){W1=null,await pY($)}function YB(){return a7}function iY($){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 nY($,X){try{let Z=await i4();if(!Z)return"";let J=typeof Z.extractClasses==="function"?Z.extractClasses($):iY($);if(J.size===0)return"";let Y=X?w0.resolve(X):process.cwd();if(!l1)l1=V1(Y,"cache");let G=[...J].sort().join(" "),Q=`${a$||"default"}::${G}`,w=I1.get(Q);if(w!==void 0)return l4(Q,w),w;let W=await aj(Q);if(W!==null)return l4(Q,W),W;if(!W1){let A=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (N1(),mY)),N=await R(Y);if(N.css)if(typeof N.css==="string"){let T=w0.isAbsolute(N.css)?N.css:w0.resolve(Y,N.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${L0.green}[Crosswind]${L0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(A={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let T=w0.isAbsolute(N.css.config)?N.css.config:w0.resolve(Y,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${L0.green}[Crosswind]${L0.reset} Using inline CSS config from stx.config.ts`)}}catch{}W1=A||await n4(Y);try{a$=t$(JSON.stringify(W1??{}))}catch{a$="unhashable"}}let q=Z.defaultConfig||Z.config,K=W1||{},z=c6(q,K),{safelist:U,includePreflight:B,minify:j,tokenCSS:H}=z,O=z.config,L=new Z.CSSGenerator(O);for(let A of U)L.generate(A);for(let A of J)L.generate(A);let _=L.toCSS(B,j),F=O.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 T of N)L.generate(T)}_=L.toCSS(B,j);let V=_.split(`
11540
- `);for(let[A,R]of Object.entries(F)){if(!J.has(A)&&!U.includes(A))continue;let N=R.split(/\s+/).filter(Boolean),T=[],M=[];for(let k of N){let E=k.startsWith("dark:"),b=`.${(E?k.slice(5):k).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<V.length;y++){let P=V[y].trim();if(P===`${b} {`||P.startsWith(`${b} {`)){let f=y,x="";while(f<V.length){if(x+=V[f],V[f].includes("}"))break;f++}let p=x.match(/\{([^}]+)\}/);if(p)if(E)M.push(p[1].trim());else T.push(p[1].trim());break}}}if(T.length)_+=`
11541
- .${A} { ${T.join(" ")} }`;if(M.length)_+=`
11542
- @media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return _=H+_,l4(Q,_),tj(Q,_),_}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function t7($,X,Z=!1){let J=await nY($,X);if(!J)return $;let Y=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${oj(J)}.css">`:`<style data-crosswind="generated">
11555
+ `}async function fY($,X,Z,J){if(X.length<1)return Y0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let Y=X[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",w=[s7.join(s7.dirname(J),Q,`${Y}.stx`),s7.join(process.cwd(),Q,`${Y}.stx`),s7.join(s7.dirname(J),`${Y}.stx`)],W=null;for(let z of w)if(await e(z)){W=await Bun.file(z).text();break}if(!W)return Y0("WebComponent",`Component file not found: ${Y}.stx`,o.FILE_NOT_FOUND);let q=xj(W,Y);return`<script type="module">
11556
+ ${fj(q)}
11557
+ </script>`}var gY=D(()=>{k1();A0()});var hY={};t(hY,{timingPlugin:()=>mj,pluginManager:()=>gj,definePlugin:()=>o$,debugPlugin:()=>dj,createVariablesPlugin:()=>cj,createFilterPlugin:()=>uj,createDirectivePlugin:()=>hj,PluginManager:()=>m4});function o$($){return $}class m4{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 hj($,X,Z={}){return{name:$,...Z,registerDirectives:()=>X}}function uj($,X,Z={}){return{name:$,...Z,registerFilters:()=>X}}function cj($){return o$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(X){return{context:{...X.context,...$}}}})}var gj,dj,mj;var uY=D(()=>{gj=new m4;dj=o$({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)}}),mj=o$({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 lY={};t(lY,{validateConfig:()=>sj,resolveStxDirectories:()=>cY,loadStxConfig:()=>Y1,defineStxConfig:()=>oj,defaultConfig:()=>j5,config:()=>S7});import s$ from"fs";import o0 from"path";import{loadConfigWithResult as lj}from"bunfig";function pj($,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(s$.existsSync(G)&&s$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=o0.join(Y,"resources","views","pages");if(s$.existsSync(w))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}function ij($,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 cY($,X){let Z=!$.root,J=pj($.root,$.pagesDir,X);if($.root=J.root,$.pagesDir=J.pagesDir,Z&&J.root!=="."){let Y=`${X}::${J.root}`;if(!dY.has(Y))dY.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)||ij(Q,Y))continue;$[G]=o0.join(Y,Q)}}return $}function nj($,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(s$.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 rj($){if(r6($.stateDir),$.stateDir=k7(),$.cachePath=I7($.cachePath),$.build)$.build.cacheDir=I7($.build.cacheDir);if($.media?.cache)$.media.cache.directory=I7($.media.cache.directory);if($.story)$.story.outDir=I7($.story.outDir)}async function Y1($){if(!$){if(m5)return m5;if(a$)return a$}let X=$?o0.resolve($):process.cwd(),Z=mY.get(X);if(Z)return Z;let J=(async()=>{let G=(await lj({name:"stx",alias:"ui",cwd:X,defaultConfig:j5,verbose:!1})).config;if(rj(G),cY(G,X),nj(G,X),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (uY(),hY)),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(j0.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 O of H)w.push(o0.resolve(j,O))}if(B.pages){let H=o0.resolve(j,B.pages),O=z.path||"/";W.push({dir:H,prefix:O})}if(B.setup){let H={addDirective:(O)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(O)},addRoute:(O,L)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[O]=L},addMiddleware:(O)=>{G.middleware=G.middleware||[],G.middleware.push(O)},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(mY.set(X,J),!$)a$=J,J.then((Y)=>{m5=Y}).catch(()=>{});return J}function oj($){return $}function sj($){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,dY,m5=null,mY,a$=null,S7;var T1=D(()=>{s9();a9();t9();e9();G4();sJ();x4();RY();r$();E7();gY();j5={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:RJ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:fY,hasEndTag:!1,description:"Include a web component in the template"},t6,e6,PY,vY,$2,Z2,J2,X2,Q2,q2,oJ,v4,...AY],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}};dY=new Set;mY=new Map;S7=new Proxy(j5,{get($,X){if(m5&&X in m5)return m5[X];if(!a$)Y1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[X]}})});var r4={};t(r4,{resolveUserCrosswindConfig:()=>nY,resetCssCache:()=>YB,resetCrosswindCache:()=>GB,rebuildCrosswindCSS:()=>QB,loadCrosswindConfig:()=>n4,loadCrosswind:()=>i4,injectCrosswindCSS:()=>t7,getCrosswindServeAsset:()=>ej,getCachedCSS:()=>wB,generateCrosswindCSS:()=>aY,fingerprintConfig:()=>rY,extractClassNames:()=>sY,buildCrosswindCSS:()=>oY});import W0 from"path";import{hasLocalConfig as aj}from"bunfig";function t$($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function c4($,X){if(I1.has($))I1.delete($);else if(I1.size>=iY)I1.delete(I1.keys().next().value);I1.set($,X)}function tj($){let X=t$($);if(w1.has(X))w1.delete(X);else if(w1.size>=iY)w1.delete(w1.keys().next().value);return w1.set(X,$),X}function ej($){let X=w1.get($);if(X===void 0)return;return w1.delete($),w1.set($,X),X}async function $B($){if(!l1)return null;try{let X=Bun.file(W0.join(l1,`cw-${t$($)}.css`));if(!await X.exists())return null;return await X.text()}catch{return null}}async function XB($,X){if(!l1)return;try{if(!fs.existsSync(l1))fs.mkdirSync(l1,{recursive:!0});await Bun.write(W0.join(l1,`cw-${t$($)}.css`),X)}catch{}}async function pY($){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 ZB(){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 JB(){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 i4(){if(l4)return _1;l4=!0;try{let $=async(Y)=>{for(let G of Y){if(!await Bun.file(G).exists())continue;let Q=await pY(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${F0.green}[Crosswind]${F0.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 $(ZB());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 pY(Y);if(G){if(_1=G,!process.env.STACKS_DEV_QUIET)console.log(`${F0.green}[Crosswind]${F0.reset} CSS engine loaded`);return _1}}let J=await $(JB());if(J)return _1=J,_1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${F0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${F0.reset}`),console.warn(`${F0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${F0.reset}`),null}}function YB(){I1.clear(),w1.clear()}function GB(){_1=null,l4=!1,W1=null,a7="",I1.clear(),w1.clear(),p4=null}async function n4($){try{if(!aj({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(`${F0.green}[Crosswind]${F0.reset} Loaded config from ${J||Z.path}`);return Z.config}catch(X){if(X instanceof Error&&X.name==="ConfigNotFoundError")return null;return console.warn(`${F0.yellow}[Crosswind]${F0.reset} Failed to load crosswind config:`,X instanceof Error?X.message:X),null}}async function nY($){let X=null;try{let{loadStxConfig:Z}=await Promise.resolve().then(() => (T1(),lY)),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(`${F0.green}[Crosswind]${F0.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(`${F0.green}[Crosswind]${F0.reset} Using inline CSS config from stx.config.ts`)}}catch{}return X||await n4($)}function rY($){try{let X=new WeakSet;return t$(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 oY($){if(c5)return a7;c5=!0;try{let X=await i4();if(!X||!X.build)return c5=!1,"";if(!W1)W1=await n4($);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(a7=Q.css,console.log(`${F0.cyan}[Crosswind]${F0.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(`${F0.red}[Crosswind]${F0.reset} Build error:`,X),c5=!1,a7}}async function QB($){W1=null,await oY($)}function wB(){return a7}function sY($){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 aY($,X){try{let Z=await i4();if(!Z)return"";let J=typeof Z.extractClasses==="function"?Z.extractClasses($):sY($);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=`${p4||"default"}::${G}`,w=I1.get(Q);if(w!==void 0)return c4(Q,w),w;let W=await $B(Q);if(W!==null)return c4(Q,W),W;if(!W1)W1=await nY(Y),p4=rY(W1);let q=Z.defaultConfig||Z.config,K=W1||{},z=p6(q,K),{safelist:U,includePreflight:j,minify:B,tokenCSS:H}=z,O=z.config,L=new Z.CSSGenerator(O);for(let A of U)L.generate(A);for(let A of J)L.generate(A);let _=L.toCSS(j,B),F=O.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 I of N)L.generate(I)}_=L.toCSS(j,B);let V=_.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),I=[],T=[];for(let k of N){let E=k.startsWith("dark:"),b=`.${(E?k.slice(5):k).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<V.length;y++){let P=V[y].trim();if(P===`${b} {`||P.startsWith(`${b} {`)){let v=y,f="";while(v<V.length){if(f+=V[v],V[v].includes("}"))break;v++}let i=f.match(/\{([^}]+)\}/);if(i)if(E)T.push(i[1].trim());else I.push(i[1].trim());break}}}if(I.length)_+=`
11559
+ .${A} { ${I.join(" ")} }`;if(T.length)_+=`
11560
+ @media (prefers-color-scheme: dark) { .dark .${A} { ${T.join(" ")} } }`}return _=H+_,c4(Q,_),XB(Q,_),_}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function t7($,X,Z=!1){let J=await aY($,X);if(!J)return $;let Y=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${tj(J)}.css">`:`<style data-crosswind="generated">
11543
11561
  ${J}
11544
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}
11545
11563
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
11546
- ${Y}`);return Y+$}var H1=null,p4=!1,W1=null,a7="",c5=!1,lY=256,I1,w1,l1=null,a$=null;var e$=D(()=>{l6();E7();n6();I1=new Map,w1=new Map});function oY(){return`
11564
+ ${Y}`);return Y+$}var _1=null,l4=!1,W1=null,a7="",c5=!1,iY=256,I1,w1,l1=null,p4=null;var e7=D(()=>{i6();E7();o6();I1=new Map,w1=new Map});function tY(){return`
11547
11565
  // STX Lifecycle Runtime
11548
11566
  (function() {
11549
11567
  if (typeof window === 'undefined') return;
@@ -11888,7 +11906,7 @@ else {
11888
11906
 
11889
11907
  console.log('[stx] Lifecycle runtime initialized');
11890
11908
  })();
11891
- `}function r4($){return Symbol($)}var OM,LM,FM;var sY=D(()=>{OM=r4("theme"),LM=r4("router"),FM=r4("i18n")});import*as tY from"crypto";function aY($){let X=/\$(\w+)\./g,Z=[],J;while((J=X.exec($))!==null)if(!Z.includes(J[1]))Z.push(J[1]);return Z}function GB(){return`stx-${tY.randomBytes(4).toString("hex")}`}function QB($){return/\$\w+\./.test($)}function wB($){let X=[],Z=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(J,(G,Q,w,W)=>{if(["script","style","template"].includes(Q.toLowerCase()))return G;let q=[],K=!1,z=w,U=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...w.matchAll(U)];for(let O of B){let L=O[0],_=O[1],F=O[2];if(QB(F)){K=!0;let V=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let A=V[1];if(q.push({attr:_,expr:A,fullMatch:L,originalAttr:_}),aY(A).forEach((N)=>Z.add(N)),_==="text")z=z.replace(L,"");else if(_==="class")z=z.replace(L,'class=""');else if(_==="disabled"||_==="hidden")z=z.replace(L,"");else z=z.replace(L,`${_}=""`)}}}if(!K)return G;let j=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=GB(),z=` id="${H}"${z}`;for(let O of q)X.push({elementId:H,attribute:O.attr,expression:O.expr,stores:aY(O.expr)});return`<${Q}${z}${W}`}),{html:Y,bindings:X,stores:Z}}function WB($,X){if($.length===0)return"";let Z=Array.from(X),J=`
11909
+ `}function o4($){return Symbol($)}var RM,NM,TM;var eY=D(()=>{RM=o4("theme"),NM=o4("router"),TM=o4("i18n")});import*as XG from"crypto";function $G($){let X=/\$(\w+)\./g,Z=[],J;while((J=X.exec($))!==null)if(!Z.includes(J[1]))Z.push(J[1]);return Z}function WB(){return`stx-${XG.randomBytes(4).toString("hex")}`}function qB($){return/\$\w+\./.test($)}function KB($){let X=[],Z=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(J,(G,Q,w,W)=>{if(["script","style","template"].includes(Q.toLowerCase()))return G;let q=[],K=!1,z=w,U=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,j=[...w.matchAll(U)];for(let O of j){let L=O[0],_=O[1],F=O[2];if(qB(F)){K=!0;let V=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let A=V[1];if(q.push({attr:_,expr:A,fullMatch:L,originalAttr:_}),$G(A).forEach((N)=>Z.add(N)),_==="text")z=z.replace(L,"");else if(_==="class")z=z.replace(L,'class=""');else if(_==="disabled"||_==="hidden")z=z.replace(L,"");else z=z.replace(L,`${_}=""`)}}}if(!K)return G;let B=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(B)H=B[1];else H=WB(),z=` id="${H}"${z}`;for(let O of q)X.push({elementId:H,attribute:O.attr,expression:O.expr,stores:$G(O.expr)});return`<${Q}${z}${W}`}),{html:Y,bindings:X,stores:Z}}function zB($,X){if($.length===0)return"";let Z=Array.from(X),J=`
11892
11910
  <script>
11893
11911
  (function() {
11894
11912
  'use strict';
@@ -12046,10 +12064,10 @@ else {
12046
12064
  }
12047
12065
  })();
12048
12066
  </script>
12049
- `,J}function eY($){let{html:X,bindings:Z,stores:J}=wB($);if(Z.length===0)return $;let Y=WB(Z,J),G=X.lastIndexOf("</body>");if(G!==-1)return X.slice(0,G)+Y+X.slice(G);return X+Y}var $G=()=>{};function qB($){let X=$.analytics;if(!X?.enabled)return"";switch(X.driver){case"fathom":return KB(X);case"google-analytics":return zB(X);case"plausible":return UB(X);case"self-hosted":return jB(X);case"custom":return BB(X);default:return""}}function KB($){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`
12067
+ `,J}function ZG($){let{html:X,bindings:Z,stores:J}=KB($);if(Z.length===0)return $;let Y=zB(Z,J),G=X.lastIndexOf("</body>");if(G!==-1)return X.slice(0,G)+Y+X.slice(G);return X+Y}var JG=()=>{};function UB($){let X=$.analytics;if(!X?.enabled)return"";switch(X.driver){case"fathom":return jB(X);case"google-analytics":return BB(X);case"plausible":return HB(X);case"self-hosted":return _B(X);case"custom":return OB(X);default:return""}}function jB($){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`
12050
12068
  <!-- Fathom Analytics -->
12051
12069
  <script src="${s0(Z)}" ${Y.join(" ")}${J}></script>
12052
- `}function zB($){let X=$.googleAnalytics;if(!X?.measurementId)return"";let Z=s0(X.measurementId),J=X.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
12070
+ `}function BB($){let X=$.googleAnalytics;if(!X?.measurementId)return"";let Z=s0(X.measurementId),J=X.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
12053
12071
  <!-- Google Analytics -->
12054
12072
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Z}"></script>
12055
12073
  <script>
@@ -12059,10 +12077,10 @@ else {
12059
12077
  gtag('config', '${Z}');
12060
12078
  ${J}
12061
12079
  </script>
12062
- `}function UB($){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`
12080
+ `}function HB($){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`
12063
12081
  <!-- Plausible Analytics -->
12064
12082
  <script defer data-domain="${s0(X.domain)}" src="${s0(Y)}"></script>
12065
- `}function jB($){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?`
12083
+ `}function _B($){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?`
12066
12084
  d.addEventListener('click',function(e){
12067
12085
  var a=e.target.closest('a');
12068
12086
  if(a&&a.hostname!==location.hostname){
@@ -12095,7 +12113,7 @@ else {
12095
12113
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
12096
12114
  })();
12097
12115
  </script>
12098
- `}function BB($){let X=$.custom;if(!X)return"";if(X.inlineScript)return`
12116
+ `}function OB($){let X=$.custom;if(!X)return"";if(X.inlineScript)return`
12099
12117
  <!-- Custom Analytics -->
12100
12118
  <script>
12101
12119
  ${X.inlineScript}
@@ -12103,7 +12121,7 @@ ${X.inlineScript}
12103
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`
12104
12122
  <!-- Custom Analytics -->
12105
12123
  <script${Z.length>0?` ${Z.join(" ")}`:""} src="${s0(X.scriptUrl)}" defer></script>
12106
- `}function XG($,X){let Z=qB(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 ZG=()=>{};function $9($){let X=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!X)return null;try{return Function(`return ${X[1]}`)()}catch{return null}}function JG($){let X=$?.layout;if(X===!1)return!1;return typeof X==="string"&&X.trim()?X.trim():void 0}function YG($,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 OB($){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=YG(Q,"x-data");if(!W)continue;let q=`__stx_scope_${HB++}`,K=YG(Q,"x-init"),z=LB($,G,w+Y.length),U=$.slice(w,z.endIndex),B=FB(U);X.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:W,initExpr:K,bindings:[],refs:B})}return X}function LB($,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 FB($){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=VB(G);X.set(Q,w)}return X}function VB($){let X=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(X)return X[1];return`__stx_el_${_B++}`}function AB(){return`
12124
+ `}function YG($,X){let Z=UB(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 GG=()=>{};function e$($){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 wG($,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 VB($){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=wG(Q,"x-data");if(!W)continue;let q=`__stx_scope_${LB++}`,K=wG(Q,"x-init"),z=AB($,G,w+Y.length),U=$.slice(w,z.endIndex),j=RB(U);X.push({id:q,selector:`[data-stx-scope="${q}"]`,stateExpr:W,initExpr:K,bindings:[],refs:j})}return X}function AB($,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 RB($){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=NB(G);X.set(Q,w)}return X}function NB($){let X=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(X)return X[1];return`__stx_el_${FB++}`}function TB(){return`
12107
12125
  // STX Reactive Runtime - x-cloak and transition CSS
12108
12126
  (function() {
12109
12127
  var style = document.createElement('style');
@@ -12310,7 +12328,7 @@ window.__stx_reactive = (function() {
12310
12328
 
12311
12329
  return { initScope: initScope, reactive: reactive };
12312
12330
  })();
12313
- `}function GG($,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 RB($,X){if($.length===0)return"";let Z=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),G=GG(J.stateExpr,X),Q=J.initExpr?GG(J.initExpr,X):null,w=JSON.stringify(G),W=Q?JSON.stringify(Q):"null";return`
12331
+ `}function WG($,X){let Z=$.replace(/\{!!([\s\S]*?)!!\}/g,(w,W)=>{try{let q=i0(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=i0(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 MB($,X){if($.length===0)return"";let Z=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),G=WG(J.stateExpr,X),Q=J.initExpr?WG(J.initExpr,X):null,w=JSON.stringify(G),W=Q?JSON.stringify(Q):"null";return`
12314
12332
  (function() {
12315
12333
  var scopeEl = document.querySelector('${J.selector}');
12316
12334
  if (!scopeEl) return;
@@ -12319,16 +12337,16 @@ window.__stx_reactive = (function() {
12319
12337
  })();`}).join(`
12320
12338
  `);return`
12321
12339
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
12322
- ${AB()}
12340
+ ${TB()}
12323
12341
  ${Z}
12324
- </script>`}function QG($,X,Z){if(!TB($))return $;let J=OB($);if(J.length===0)return $;let Y=NB($,J),G=RB(J,X),Q=Y.lastIndexOf("</body>");if(Q!==-1)Y=Y.slice(0,Q)+G+`
12325
- `+Y.slice(Q);else Y+=G;return Y}function NB($,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 TB($){return/x-data\s*=\s*["']/.test($)}var HB=0,_B=0;var wG=D(()=>{B1()});import MB from"fs";import o4 from"path";import{createHighlighter as kB}from"ts-syntax-highlighter";async function IB($,X={}){try{if(!await e($))throw Error(`Markdown file not found: ${$}`);let J=(await MB.promises.stat($)).mtime.getTime();if(X.cache&&s4.has($)){let z=s4.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let Y=await Bun.file($).text(),{data:G,content:Q}=q2(Y),w=X.markdown||S7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=D7(Q,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)q=await EB(q,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:q,data:G||{}};if(X.cache)s4.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 EB($,X,Z){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!X9)try{X9=await kB({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(!X9.getSupportedLanguages().includes(U))return w;return(await X9.highlight(z,U,{theme:X})).html}catch(B){console.error(`Error highlighting code block with language ${q}:`,B)}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 WG($,X,Z="",J={}){return await DB($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,w,W,q)=>{try{let K=w;if(!o4.isAbsolute(w))K=o4.resolve(o4.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 _=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of _){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('"'),T=R.startsWith("'")&&R.endsWith("'");if(N||T)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:B}=await IB(K,J),j={...X,...B,...z},H=U,O=/\{\{([^}]+)\}\}/g;return H=H.replace(O,(L,_)=>{let F=_.trim();return j[F]!==void 0?String(j[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 DB($,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 s4,X9=null;var qG=D(()=>{N1();V0();s4=new Map});function p1($,X){try{let Z=$.trim();if(q0(Z))return K0(Z,Object.keys(X))(...Object.values(X));else return Q0(Z,X)}catch{return!1}}var KG=D(()=>{y0()});function yB($,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=bX(J,Q);if(!w)break;try{let W;if(q0(w.expression))W=K0(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&&q0(z.value))U=K0(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=Y0("Switch",`Error evaluating @switch expression: ${q}`,o.EVALUATION_ERROR);J=J.substring(0,Q)+K+J.substring(w.end);break}}return J}function bB($){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 SB($,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}=bB($);return SB(CB(J,X,Z),Y)}function CB($,X,Z){let J=$;J=yB(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,B=-1;{let H=0,O=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,_=/@else(?![a-z])/g,F=[],V;while((V=O.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=_.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){B=A.pos;break}}let j;if(B!==-1){let H=z.slice(0,B),O=z.slice(B+5);j=`@if (${U})${O}@else ${H}@endif`}else j=`@if (!(${U}))${z}@endif`;J=J.substring(0,w)+j+J.substring(K+10),G=!0}}J=t4(J,X,Z),J=e4(J,X,Z),J=a4(J,X);let Y=()=>{let G=m7(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&&q0(K.condition))z=K0(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=Y0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,o.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=Y0("If",`Error processing @if block: ${q}`,o.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 zG($){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 a4($,X){let Z=$;function J(w,W,q,K){let z=1,U=K,B=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${q}(?![a-z])`,"g");while(U<w.length&&z>0){B.lastIndex=U,j.lastIndex=U;let H=B.exec(w),O=j.exec(w),L=H?H.index:1/0,_=O?O.index:1/0;if(L<_)z++,U=L+H[0].length;else if(_<1/0){if(z--,z===0)return _;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"),B=/@else(?![a-z])/g,j=[],H;while((H=z.exec(w))!==null)j.push({pos:H.index,type:"open"});while((H=U.exec(w))!==null)j.push({pos:H.index,type:"close"});while((H=B.exec(w))!==null)j.push({pos:H.index,type:"else"});j.sort((O,L)=>O.pos-L.pos);for(let O of j)if(O.type==="open")K++;else if(O.type==="close")K--;else if(O.type==="else"&&K===0)return O.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),B=zG(U);if(B)K=B.value,z=q+5+B.consumed;else z=q+5;let j=J(Z,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${q} has no matching @endauth \u2014 the block was skipped.`);break}let H=Z.slice(z,j),O=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 _;if(O!==-1){let F=H.slice(0,O),V=H.slice(O+5);_=L?F:V}else _=L?H:"";Z=Z.substring(0,q)+_+Z.substring(j+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),B=zG(U);if(B)K=B.value,z=q+6+B.consumed;else z=q+6;let j=J(Z,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${q} has no matching @endguest \u2014 the block was skipped.`);break}let H=Z.slice(z,j),O=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 _;if(O!==-1){let F=H.slice(0,O),V=H.slice(O+5);_=L?F:V}else _=L?H:"";Z=Z.substring(0,q)+_+Z.substring(j+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,B=Z.slice(U+`@${w}`.length),j=Q(B);if(!j)break;let H=U+`@${w}`.length+j.paramsEnd,O=J(Z,w,W,H);if(O===-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,T=[],M;while((M=V.exec(L))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(L))!==null)T.push({pos:M.index,type:"close"});while((M=R.exec(L))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(L))!==null)T.push({pos:M.index,type:"else"});T.sort((y,P)=>y.pos-P.pos);for(let y of T){if(y.type==="open"){F++;continue}if(y.type==="close"){F--;continue}if(F===0)_.push(y)}let k=[],E=0;for(let y=0;y<_.length;y++){let P=_[y];if(k.push({content:L.slice(E,P.pos),ability:void 0}),P.type==="elseDirective"){let f=L.slice(P.pos+`@${q}`.length),x=Q(f);if(x){k[k.length-1]={content:L.slice(E,P.pos)},E=P.pos+`@${q}`.length+x.paramsEnd,k.push({content:"",ability:x.ability,type:x.type,id:x.id}),k.pop();let p=_[y+1],u=p?p.pos:L.length;k.push({content:L.slice(E,u),ability:x.ability,type:x.type,id:x.id}),E=u}}else E=P.pos+5}if(E<L.length){let y=k[k.length-1];if(_.length>0&&_[_.length-1].type==="else")k.push({content:L.slice(E),isFinalElse:!0});else if(k.length===0)k.push({content:L.slice(E)})}let I=G(j.ability,j.type,j.id),S=w==="can"?I:!I,b="";if(S)b=k[0]?.content||"";else{let y=!1;for(let P=1;P<k.length;P++){let f=k[P];if(f.isFinalElse){b=f.content,y=!0;break}if(f.ability){let x=G(f.ability,f.type,f.id);if(w==="can"?x:!x){b=f.content,y=!0;break}}}if(!y&&k.length>0){let P=k[k.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,U)+b+Z.substring(O+`@${W}`.length),K=!0}}return Z}function t4($,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 B=U.index,j=d1(G,B+`@${Q}`.length);if(!j)break;let H=j.endPos,O=Q5(G,Q,w,H);if(O===-1){console.warn(`[stx] @${Q} directive at position ${B} has no matching @${w} \u2014 the block was skipped.`);break}let L=G.slice(H,O),_=j.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(_.trim()),N;if(F!==-1){let T=L.slice(0,F),M=L.slice(F+5);N=R?T:M}else N=R?L:"";G=G.substring(0,B)+N+G.substring(O+`@${w}`.length),K=!0}catch(R){let N=R instanceof Error?R.message:String(R),T=Y0(q,`Error processing @${Q} directive: ${N}`,o.EVALUATION_ERROR);G=G.substring(0,B)+T+G.substring(O+`@${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 e4($,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])`),B=new RegExp(`^@${W}(?![a-z])`),j=Q,H=!0;while(H){H=!1,K.lastIndex=0;let O=K.exec(j);if(!O)break;let L=O.index,_=L+O[0].length;if(w==="env"){let I=j.substring(_).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;_+=I[0].length,q=Y===I[2]}let F=1,V=_,A=-1;while(F>0&&V<j.length){K.lastIndex=V,z.lastIndex=V;let I=K.exec(j),S=z.exec(j),b=I?I.index:1/0,y=S?S.index:1/0;if(b<y)F++,V=b+I[0].length;else if(y<1/0){if(F--,F===0){A=y;break}V=y+S[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=j.substring(_,A),N=-1,T=0,M=0;while(M<R.length){let I=R.indexOf("@",M);if(I===-1)break;let S=R.substring(I);if(U.test(S)){T++,M=I+1;continue}if(B.test(S)){T--,M=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(S)){N=I;break}M=I+1}let k;if(N!==-1){let I=R.slice(0,N),S=R.slice(N+5);k=q?I:S}else k=q?R:"";let E=`@${W}`.length;j=j.substring(0,L)+k+j.substring(A+E),H=!0}return j}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 e7=D(()=>{KG();k1();n8();y0()});function jG($=16){let X=new Uint8Array($);return crypto.getRandomValues(X),btoa(String.fromCharCode(...X))}function Z9($,X){if(!$)return X?.nonceGenerator?.()??jG();let Z=UG.get($);if(!Z)Z=X?.nonceGenerator?.()??jG(),UG.set($,Z);return Z}function PB($,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 BG($,X){return`<meta http-equiv="Content-Security-Policy" content="${PB($,X).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function HG($,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?Z9(Z,X):void 0,Y=BG(X.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
12326
- ${Y}`)}function _G($,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 OG($,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?Z9(X,G):void 0;return BG(G.directives,Q)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return Z9(X,G)}),G?.enabled&&G.useNonce)X.cspNonce=Z9(X,G);return Y}var UG;var LG=D(()=>{UG=new WeakMap});import vB from"crypto";function fB($=xB){let X=vB.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return $3=X,X}function gB(){if(!$3)fB();return $3}function hB($=FG){let X=gB();return`<input type="hidden" name="${$}" value="${X}">`}function VG($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(X,Z,J)=>{return hB(J||FG)})}var xB=40,FG="_token",$3=null;var AG=()=>{};async function RG($,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 uB(Y,G,X,Z,J);else Y=await dB(Y,G,X,Z,J)}return Y}async function uB($,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[B,j="",H=""]=U,O=U.index||0;try{let L=j?NG(j):[],_=H.trim(),F=await Q(_,L,Z,J);z.push({original:B,processed:F,startIndex:O})}catch(L){let _=L instanceof Error?L.message:String(L);if(Y.debug)console.error(`Error processing custom directive @${G}:`,L);z.push({original:B,processed:Y0("CustomDirective",`Error in @${G}${j?`(${j})`:""}: ${_}`,o.EVALUATION_ERROR),startIndex:O})}U=K.exec(q)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:H}=z[B];q=q.replace(j,H)}return q}async function dB($,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[B,j=""]=K,H=K.index||0;try{let O=NG(j),L=await Q("",O,Z,J);q.push({original:B,processed:L,startIndex:H})}catch(O){let L=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${G}:`,O);q.push({original:B,processed:Y0("CustomDirective",`Error in @${G}(${j}): ${L}`,o.EVALUATION_ERROR),startIndex:H})}K=W.exec(w)}let z=P5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),U=z.exec(w);while(U!==null){let[B]=U,j=U.index||0;try{let H=await Q("",[],Z,J);q.push({original:B,processed:H,startIndex:j})}catch(H){let O=H instanceof Error?H.message:String(H);if(Y.debug)console.error(`Error processing custom directive @${G}:`,H);q.push({original:B,processed:Y0("CustomDirective",`Error in @${G}: ${O}`,o.EVALUATION_ERROR),startIndex:j})}U=z.exec(w)}for(let B=q.length-1;B>=0;B--){let{original:j,processed:H}=q[B];w=w.replace(j,H)}return w}function NG($){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 TG=D(()=>{k1();v5()});function B5($,X){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${X} must be a non-empty string`)}function cB($){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"),!kG.test(Z.key)||!kG.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!MG.test(Z.attribute)||!MG.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(!mB.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 lB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function pB($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${lB($)};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 iB($,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 IG($,X){let Z=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,Q=iB(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=pB(cB(W));Z=Z.slice(0,Y.index)+q+Z.slice(Q+1),J.lastIndex=Y.index+q.length}return Z}var MG,kG,mB;var EG=D(()=>{y0();MG=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,kG=/^[A-Za-z_$][\w$]*$/,mB=new Set(["light","dark","system"])});import nB from"crypto";function T0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function J9($,X,Z,J){let Y=$||X;return Z?`${Y} ${J}`:Y}function $1($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function l5($,X){if(/\bid\s*=/i.test($))return"";return` id="${T0(X)}"`}function X3($,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 rB(){return nB.randomUUID()}function Y9($,X){let Z=$;return Z=Z.replace(/@csrf/g,()=>{if(!X.csrf||typeof X.csrf!=="object"){let J=rB();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 bG($,X,Z=yG){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),B=K.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",H=`<form method="${T0(j)}" action="${T0(z)}"${U?` ${U}`:""}>`;if(H+=`
12327
- ${Y9("@csrf",X)}`,!["GET","POST"].includes(B))H+=`
12328
- ${Y9(`@method('${B}')`,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),B=$8(K,X),j=B!==void 0&&B!==null?B:z||"",H=U.match(/type=['"]([^'"]+)['"]/i),O=H?H[1]:"text",L=X8(K,X),_=U.match(/class=['"]([^'"]+)['"]/i),F=J9(_?_[1]:"",Z.input,L,Z.inputError),V=U.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${T0(O)}" name="${T0(K)}"${l5(U,$1(K))} value="${T0(j)}" class="${F}"${X3(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=$8(G,X)||w.trim(),K=X8(G,X),z=W.match(/class=['"]([^'"]+)['"]/i),U=J9(z?z[1]:"",Z.input,K,Z.inputError),B=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${T0(G)}"${l5(W,$1(G))} class="${U}"${X3(G,K,W)}${B?` ${B}`:""}>${T0(q)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,G,Q="",w)=>{let W=i1(Q),q=$8(G,X),K=X8(G,X),z=W.match(/class=['"]([^'"]+)['"]/i),U=J9(z?z[1]:"",Z.input,K,Z.inputError),B=W.replace(/class=['"][^'"]+['"]/i,""),j=w;if(q!==void 0)j=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,O,L)=>{if((Array.isArray(q)?q.some((F)=>String(F)===L):String(q)===L)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return H});return`<select name="${T0(G)}"${l5(W,$1(G))} class="${U}"${X3(G,K,W)}${B?` ${B}`:""}>${j}</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=$8(G,X),U=z!==void 0&&(Array.isArray(z)?z.some((O)=>String(O)===W):z===!0||String(z)===W),B=K.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:Z.checkInput,H=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${T0(G)}"${l5(K,q)} value="${T0(W)}" class="${j}"${U?" checked":""}${H?` ${H}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q,w="")=>{let W=i1(w),q=$8(G,X),K=q!==void 0&&q===Q,z=W.match(/class=['"]([^'"]+)['"]/i),U=z?z[1]:Z.checkInput,B=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${T0(G)}"${l5(W,`${$1(G)}-${$1(Q)}`)} value="${T0(Q)}" class="${U}"${K?" checked":""}${B?` ${B}`:""}>`}),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=X8(G,X),U=w.match(/class=['"]([^'"]+)['"]/i),B=J9(U?U[1]:"",Z.input,z,Z.inputError),j=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${T0(G)}"${l5(w,$1(G))}`,`class="${B}"`];if(q)H.push(`accept="${T0(q)}"`);if(K)H.push("multiple");if(j)H.push(j);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 SG($,X,Z=yG){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,G)=>{try{if(X8(Y,X)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(w,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return DG(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 DG(Y,X)}let q=W.trim();if(q0(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 X8($,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 DG($,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 $8($,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 yG;var CG=D(()=>{y0();yG={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import Y3 from"path";async function oB(){if(Z8!==void 0)return Z8;try{Z8=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{Z8=null}return Z8}function sB($,X=0){if(X<=0)return!1;return Date.now()-$.loadedAt>X}async function aB($,X){if({...w3,...X.i18n}.cache&&G3[$]){let Y=G3[$],G=X.i18n?.cacheMaxAge??0;if(!sB(Y,G))return Y.translations}if(J8[$]?.state==="loading")return J8[$].promise;Z3[$]="loading";let J=Q3($,X).then((Y)=>{return Z3[$]="loaded",delete J8[$],Y}).catch((Y)=>{throw Z3[$]="error",J8[$]={promise:J,state:"error",error:Y instanceof Error?Y:Error(String(Y))},Y});return J8[$]={promise:J,state:"loading"},J}async function Q3($,X){let Z={...w3,...X.i18n},J=Y3.isAbsolute(Z.translationsDir)?Z.translationsDir:Y3.resolve(X.root||process.cwd(),Z.translationsDir);try{let Y=await oB(),G=Y?await Y($,{translationsDir:J,defaultLocale:Z.defaultLocale,sources:ZH(Z.format)}):await tB($,Z,J);if(G===void 0){if($!==Z.defaultLocale)return Q3(Z.defaultLocale,X);return{}}let Q=G;if(Z.cache)G3[$]={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 Q3(Z.defaultLocale,X);return{}}}async function tB($,X,Z){let J=Y3.join(Z,`${$}${eB(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 $H(G);if(X.format==="json")return JSON.parse(G);throw Y}catch{return}}}function eB($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function $H($){let X={},Z=$.split(`
12329
- `),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]=XH(U)}}return X}function XH($){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 ZH($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function JH($,X){return aB($,X)}function YH($,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 GH($,X={}){return xG($,X)}function xG($,X){let Z="",J=0;while(J<$.length)if($[J]==="{"){let Y=QH($,J);if(Y===-1){Z+=$[J],J++;continue}let G=$.slice(J+1,Y);Z+=wH(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 QH($,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 wH($,X){let Z=WH($);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 qH(Y,Z.slice(2).join(","),X);case"select":return zH(Y,Z.slice(2).join(","));case"selectordinal":return UH(Y,Z.slice(2).join(","));case"number":return BH(Y,Z[2]?.trim());case"date":return HH(Y,Z[2]?.trim());case"time":return _H(Y,Z[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function WH($){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 qH($,X,Z){let J=Number($)||0,Y=W3(X),G=`=${J}`;if(Y[G])return J3(Y[G],J,Z);let Q=KH(J);if(Y[Q])return J3(Y[Q],J,Z);if(Y.other)return J3(Y.other,J,Z);return String(J)}function J3($,X,Z){let J=$.replace(/#/g,String(X));return xG(J,Z)}function KH($){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 zH($,X){let Z=String($||""),J=W3(X);if(J[Z])return J[Z];return J.other||String($)}function UH($,X){let Z=Number($)||0,J=W3(X),Y=jH(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 jH($){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 W3($){let X={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Z.exec($);while(J!==null)X[J[1]]=J[2],J=Z.exec($);return X}function BH($,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 HH($,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 _H($,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 OH($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function PG($,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(OH(Q))return GH(Q,J);if(Q.includes("|")&&"count"in J){let w=Number(J.count),W=Q.split("|");Q=YH(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 fG($,X,Z,J){let Y=$,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...w3,...J.i18n},w=await JH(Q.locale,J);X.__translations=w,X.__locale=Q.locale,X.__i18nConfig=Q,Y=await vG(Y,G,async(K,z,U,B,j)=>{try{let H={};if(U)try{let L=[()=>JSON.parse(U),()=>{let _=`{"data":${U}}`,F=JSON.parse(_);return typeof F.data==="object"?F.data:{}},()=>{return D0(U,X)}];for(let _ of L)try{if(H=_(),Object.keys(H).length>0)break}catch{}}catch(L){if(J.debug)console.error("Error parsing parameters for @translate directive:",L)}return PG(z,w,Q.fallbackToKey,H)||B.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return Y0("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${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 vG(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(K,z,U,B)=>{try{let j={};if(U)try{let H=[()=>JSON.parse(U),()=>{let O=`{"data":${U}}`,L=JSON.parse(O);return typeof L.data==="object"?L.data:{}},()=>{return D0(U,X)}];for(let O of H)try{if(j=O(),Object.keys(j).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return PG(z,w,Q.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return Y0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),Y}async function vG($,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 Z8,w3,G3,J8,Z3;var gG=D(()=>{k1();y0();w3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},G3={},J8={},Z3={}});var z3={};t(z3,{streamingSuspenseDirective:()=>dG,streamToResponse:()=>DH,streamTemplateSimple:()=>MH,streamTemplate:()=>FH,renderStreamingPage:()=>AH,registerStreamingDirectives:()=>IH,processStreamDirectives:()=>NH,processSectionDirectives:()=>EH,islandDirective:()=>mG,generateHydrationRuntime:()=>yH,extractStreamBoundaries:()=>TH,createStreamRenderer:()=>kH,buildSuspenseResolveScript:()=>K3,SUSPENSE_RESOLVER_RUNTIME:()=>uG});import G9 from"path";function LH($){let X=[],Z=0,J;hG.lastIndex=0;while((J=hG.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 FH($,X={},Z={}){let J={...j5,...Z,streaming:{...q3,...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:G9.dirname($)};if(W.trim())await G5(W,K,$);let z=LH(q),U=new Set;if(!z.some((j)=>j.type==="suspense")){let j=J.streaming?.strategy||"auto",H=new RegExp(H5.source,"g");if(!(j!=="manual"&&H.test(q))){let L=await A0(q,K,$,J,U);for(let _=0;_<L.length;_+=Y)G.enqueue(L.slice(_,_+Y)),await new Promise((F)=>setTimeout(F,0))}else{let L=[],_=new RegExp(H5.source,"g"),F;while((F=_.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 T=await A0(N,K,$,J,U);G.enqueue(T),await new Promise((M)=>setTimeout(M,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 j=new Map;for(let O of z)if(O.type==="shell"||O.type==="content"){let L=await A0(O.content,K,$,J,U);G.enqueue(L)}else if(O.type==="suspense"&&O.name){let L=`stx-suspense-${O.name}`;G.enqueue(`<div id="${L}" data-suspense="${O.name}" style="display:contents;">
12342
+ </script>`}function qG($,X,Z){if(!IB($))return $;let J=VB($);if(J.length===0)return $;let Y=kB($,J),G=MB(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 kB($,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 IB($){return/x-data\s*=\s*["']/.test($)}var LB=0,FB=0;var KG=D(()=>{B1()});import EB from"fs";import s4 from"path";import{createHighlighter as DB}from"ts-syntax-highlighter";async function yB($,X={}){try{if(!await e($))throw Error(`Markdown file not found: ${$}`);let J=(await EB.promises.stat($)).mtime.getTime();if(X.cache&&a4.has($)){let z=a4.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let Y=await Bun.file($).text(),{data:G,content:Q}=z2(Y),w=X.markdown||S7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},q=D7(Q,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)q=await bB(q,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:q,data:G||{}};if(X.cache)a4.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 bB($,X,Z){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!$9)try{$9=await DB({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(!$9.getSupportedLanguages().includes(U))return w;return(await $9.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 zG($,X,Z="",J={}){return await SB($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,w,W,q)=>{try{let K=w;if(!s4.isAbsolute(w))K=s4.resolve(s4.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 _=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of _){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('"'),I=R.startsWith("'")&&R.endsWith("'");if(N||I)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 yB(K,J),B={...X,...j,...z},H=U,O=/\{\{([^}]+)\}\}/g;return H=H.replace(O,(L,_)=>{let F=_.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 SB($,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 a4,$9=null;var UG=D(()=>{T1();A0();a4=new Map});function p1($,X){try{let Z=$.trim();if(q0(Z))return K0(Z,Object.keys(X))(...Object.values(X));else return w0(Z,X)}catch{return!1}}var jG=D(()=>{y0()});function CB($,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=yX(J,Q);if(!w)break;try{let W;if(q0(w.expression))W=K0(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&&q0(z.value))U=K0(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=Y0("Switch",`Error evaluating @switch expression: ${q}`,o.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 vB($,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 vB(xB(J,X,Z),Y)}function xB($,X,Z){let J=$;J=CB(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,O=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,_=/@else(?![a-z])/g,F=[],V;while((V=O.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=_.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),O=z.slice(j+5);B=`@if (${U})${O}@else ${H}@endif`}else B=`@if (!(${U}))${z}@endif`;J=J.substring(0,w)+B+J.substring(K+10),G=!0}}J=e4(J,X,Z),J=$3(J,X,Z),J=t4(J,X);let Y=()=>{let G=m7(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&&q0(K.condition))z=K0(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=Y0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,o.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=Y0("If",`Error processing @if block: ${q}`,o.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 BG($){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 t4($,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),O=B.exec(w),L=H?H.index:1/0,_=O?O.index:1/0;if(L<_)z++,U=L+H[0].length;else if(_<1/0){if(z--,z===0)return _;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((O,L)=>O.pos-L.pos);for(let O of B)if(O.type==="open")K++;else if(O.type==="close")K--;else if(O.type==="else"&&K===0)return O.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=BG(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),O=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 _;if(O!==-1){let F=H.slice(0,O),V=H.slice(O+5);_=L?F:V}else _=L?H:"";Z=Z.substring(0,q)+_+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=BG(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),O=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 _;if(O!==-1){let F=H.slice(0,O),V=H.slice(O+5);_=L?F:V}else _=L?H:"";Z=Z.substring(0,q)+_+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,O=J(Z,w,W,H);if(O===-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,I=[],T;while((T=V.exec(L))!==null)I.push({pos:T.index,type:"open"});while((T=A.exec(L))!==null)I.push({pos:T.index,type:"close"});while((T=R.exec(L))!==null)I.push({pos:T.index,type:"elseDirective"});while((T=N.exec(L))!==null)I.push({pos:T.index,type:"else"});I.sort((y,P)=>y.pos-P.pos);for(let y of I){if(y.type==="open"){F++;continue}if(y.type==="close"){F--;continue}if(F===0)_.push(y)}let k=[],E=0;for(let y=0;y<_.length;y++){let P=_[y];if(k.push({content:L.slice(E,P.pos),ability:void 0}),P.type==="elseDirective"){let v=L.slice(P.pos+`@${q}`.length),f=Q(v);if(f){k[k.length-1]={content:L.slice(E,P.pos)},E=P.pos+`@${q}`.length+f.paramsEnd,k.push({content:"",ability:f.ability,type:f.type,id:f.id}),k.pop();let i=_[y+1],c=i?i.pos:L.length;k.push({content:L.slice(E,c),ability:f.ability,type:f.type,id:f.id}),E=c}}else E=P.pos+5}if(E<L.length){let y=k[k.length-1];if(_.length>0&&_[_.length-1].type==="else")k.push({content:L.slice(E),isFinalElse:!0});else if(k.length===0)k.push({content:L.slice(E)})}let M=G(B.ability,B.type,B.id),S=w==="can"?M:!M,b="";if(S)b=k[0]?.content||"";else{let y=!1;for(let P=1;P<k.length;P++){let v=k[P];if(v.isFinalElse){b=v.content,y=!0;break}if(v.ability){let f=G(v.ability,v.type,v.id);if(w==="can"?f:!f){b=v.content,y=!0;break}}}if(!y&&k.length>0){let P=k[k.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,U)+b+Z.substring(O+`@${W}`.length),K=!0}}return Z}function e4($,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,O=Q5(G,Q,w,H);if(O===-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(_.trim()),N;if(F!==-1){let I=L.slice(0,F),T=L.slice(F+5);N=R?I:T}else N=R?L:"";G=G.substring(0,j)+N+G.substring(O+`@${w}`.length),K=!0}catch(R){let N=R instanceof Error?R.message:String(R),I=Y0(q,`Error processing @${Q} directive: ${N}`,o.EVALUATION_ERROR);G=G.substring(0,j)+I+G.substring(O+`@${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 $3($,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 O=K.exec(B);if(!O)break;let L=O.index,_=L+O[0].length;if(w==="env"){let M=B.substring(_).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!M)break;_+=M[0].length,q=Y===M[2]}let F=1,V=_,A=-1;while(F>0&&V<B.length){K.lastIndex=V,z.lastIndex=V;let M=K.exec(B),S=z.exec(B),b=M?M.index:1/0,y=S?S.index:1/0;if(b<y)F++,V=b+M[0].length;else if(y<1/0){if(F--,F===0){A=y;break}V=y+S[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(_,A),N=-1,I=0,T=0;while(T<R.length){let M=R.indexOf("@",T);if(M===-1)break;let S=R.substring(M);if(U.test(S)){I++,T=M+1;continue}if(j.test(S)){I--,T=M+1;continue}if(I===0&&/^@else(?![a-z])/.test(S)){N=M;break}T=M+1}let k;if(N!==-1){let M=R.slice(0,N),S=R.slice(N+5);k=q?M:S}else k=q?R:"";let E=`@${W}`.length;B=B.substring(0,L)+k+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 $8=D(()=>{jG();k1();r8();y0()});function _G($=16){let X=new Uint8Array($);return crypto.getRandomValues(X),btoa(String.fromCharCode(...X))}function X9($,X){if(!$)return X?.nonceGenerator?.()??_G();let Z=HG.get($);if(!Z)Z=X?.nonceGenerator?.()??_G(),HG.set($,Z);return Z}function fB($,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 OG($,X){return`<meta http-equiv="Content-Security-Policy" content="${fB($,X).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function LG($,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?X9(Z,X):void 0,Y=OG(X.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
12344
+ ${Y}`)}function FG($,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 VG($,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?X9(X,G):void 0;return OG(G.directives,Q)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return X9(X,G)}),G?.enabled&&G.useNonce)X.cspNonce=X9(X,G);return Y}var HG;var AG=D(()=>{HG=new WeakMap});import gB from"crypto";function uB($=hB){let X=gB.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return X3=X,X}function dB(){if(!X3)uB();return X3}function mB($=RG){let X=dB();return`<input type="hidden" name="${$}" value="${X}">`}function NG($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(X,Z,J)=>{return mB(J||RG)})}var hB=40,RG="_token",X3=null;var TG=()=>{};async function MG($,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 cB(Y,G,X,Z,J);else Y=await lB(Y,G,X,Z,J)}return Y}async function cB($,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,O=U.index||0;try{let L=B?kG(B):[],_=H.trim(),F=await Q(_,L,Z,J);z.push({original:j,processed:F,startIndex:O})}catch(L){let _=L instanceof Error?L.message:String(L);if(Y.debug)console.error(`Error processing custom directive @${G}:`,L);z.push({original:j,processed:Y0("CustomDirective",`Error in @${G}${B?`(${B})`:""}: ${_}`,o.EVALUATION_ERROR),startIndex:O})}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 lB($,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 O=kG(B),L=await Q("",O,Z,J);q.push({original:j,processed:L,startIndex:H})}catch(O){let L=O instanceof Error?O.message:String(O);if(Y.debug)console.error(`Error processing custom directive @${G}:`,O);q.push({original:j,processed:Y0("CustomDirective",`Error in @${G}(${B}): ${L}`,o.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 O=H instanceof Error?H.message:String(H);if(Y.debug)console.error(`Error processing custom directive @${G}:`,H);q.push({original:j,processed:Y0("CustomDirective",`Error in @${G}: ${O}`,o.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 kG($){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 IG=D(()=>{k1();v5()});function B5($,X){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${X} must be a non-empty string`)}function iB($){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"),!DG.test(Z.key)||!DG.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!EG.test(Z.attribute)||!EG.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(!pB.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 nB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function rB($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${nB($)};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 oB($,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 yG($,X){let Z=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,Q=oB(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=rB(iB(W));Z=Z.slice(0,Y.index)+q+Z.slice(Q+1),J.lastIndex=Y.index+q.length}return Z}var EG,DG,pB;var bG=D(()=>{y0();EG=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,DG=/^[A-Za-z_$][\w$]*$/,pB=new Set(["light","dark","system"])});import sB from"crypto";function T0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Z9($,X,Z,J){let Y=$||X;return Z?`${Y} ${J}`:Y}function e0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function l5($,X){if(/\bid\s*=/i.test($))return"";return` id="${T0(X)}"`}function Z3($,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(`${e0($)}-error`)}"`;return J}function aB(){return sB.randomUUID()}function J9($,X){let Z=$;return Z=Z.replace(/@csrf/g,()=>{if(!X.csrf||typeof X.csrf!=="object"){let J=aB();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 PG($,X,Z=CG){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+=`
12345
+ ${J9("@csrf",X)}`,!["GET","POST"].includes(j))H+=`
12346
+ ${J9(`@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=X8(K,X),B=j!==void 0&&j!==null?j:z||"",H=U.match(/type=['"]([^'"]+)['"]/i),O=H?H[1]:"text",L=Z8(K,X),_=U.match(/class=['"]([^'"]+)['"]/i),F=Z9(_?_[1]:"",Z.input,L,Z.inputError),V=U.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${T0(O)}" name="${T0(K)}"${l5(U,e0(K))} value="${T0(B)}" class="${F}"${Z3(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=X8(G,X)||w.trim(),K=Z8(G,X),z=W.match(/class=['"]([^'"]+)['"]/i),U=Z9(z?z[1]:"",Z.input,K,Z.inputError),j=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${T0(G)}"${l5(W,e0(G))} class="${U}"${Z3(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=X8(G,X),K=Z8(G,X),z=W.match(/class=['"]([^'"]+)['"]/i),U=Z9(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,O,L)=>{if((Array.isArray(q)?q.some((F)=>String(F)===L):String(q)===L)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return H});return`<select name="${T0(G)}"${l5(W,e0(G))} class="${U}"${Z3(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?e0(G):`${e0(G)}-${e0(W)}`,K=i1(w),z=X8(G,X),U=z!==void 0&&(Array.isArray(z)?z.some((O)=>String(O)===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=i1(w),q=X8(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,`${e0(G)}-${e0(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=Z8(G,X),U=w.match(/class=['"]([^'"]+)['"]/i),j=Z9(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,e0(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(e0(G))}" class="${K}"${z?` ${z}`:""}>${w}</label>`}),J}function vG($,X,Z=CG){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,G)=>{try{if(Z8(Y,X)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(w,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return SG(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 SG(Y,X)}let q=W.trim();if(q0(q)){let K=w0(q,X);return K!==void 0?String(K):q}return q}catch{return W}});return`<div id="${T0(`${e0(Y)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),J}})}function Z8($,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 SG($,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 X8($,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 CG;var xG=D(()=>{y0();CG={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import G3 from"path";async function tB(){if(J8!==void 0)return J8;try{J8=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{J8=null}return J8}function eB($,X=0){if(X<=0)return!1;return Date.now()-$.loadedAt>X}async function $H($,X){if({...W3,...X.i18n}.cache&&Q3[$]){let Y=Q3[$],G=X.i18n?.cacheMaxAge??0;if(!eB(Y,G))return Y.translations}if(Y8[$]?.state==="loading")return Y8[$].promise;J3[$]="loading";let J=w3($,X).then((Y)=>{return J3[$]="loaded",delete Y8[$],Y}).catch((Y)=>{throw J3[$]="error",Y8[$]={promise:J,state:"error",error:Y instanceof Error?Y:Error(String(Y))},Y});return Y8[$]={promise:J,state:"loading"},J}async function w3($,X){let Z={...W3,...X.i18n},J=G3.isAbsolute(Z.translationsDir)?Z.translationsDir:G3.resolve(X.root||process.cwd(),Z.translationsDir);try{let Y=await tB(),G=Y?await Y($,{translationsDir:J,defaultLocale:Z.defaultLocale,sources:GH(Z.format)}):await XH($,Z,J);if(G===void 0){if($!==Z.defaultLocale)return w3(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 w3(Z.defaultLocale,X);return{}}}async function XH($,X,Z){let J=G3.join(Z,`${$}${ZH(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 JH(G);if(X.format==="json")return JSON.parse(G);throw Y}catch{return}}}function ZH($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function JH($){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]=YH(U)}}return X}function YH($){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 GH($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function QH($,X){return $H($,X)}function wH($,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 WH($,X={}){return hG($,X)}function hG($,X){let Z="",J=0;while(J<$.length)if($[J]==="{"){let Y=qH($,J);if(Y===-1){Z+=$[J],J++;continue}let G=$.slice(J+1,Y);Z+=KH(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 qH($,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 KH($,X){let Z=zH($);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 UH(Y,Z.slice(2).join(","),X);case"select":return BH(Y,Z.slice(2).join(","));case"selectordinal":return HH(Y,Z.slice(2).join(","));case"number":return OH(Y,Z[2]?.trim());case"date":return LH(Y,Z[2]?.trim());case"time":return FH(Y,Z[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function zH($){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 UH($,X,Z){let J=Number($)||0,Y=q3(X),G=`=${J}`;if(Y[G])return Y3(Y[G],J,Z);let Q=jH(J);if(Y[Q])return Y3(Y[Q],J,Z);if(Y.other)return Y3(Y.other,J,Z);return String(J)}function Y3($,X,Z){let J=$.replace(/#/g,String(X));return hG(J,Z)}function jH($){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 BH($,X){let Z=String($||""),J=q3(X);if(J[Z])return J[Z];return J.other||String($)}function HH($,X){let Z=Number($)||0,J=q3(X),Y=_H(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 _H($){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 q3($){let X={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Z.exec($);while(J!==null)X[J[1]]=J[2],J=Z.exec($);return X}function OH($,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 LH($,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 FH($,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 VH($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function fG($,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(VH(Q))return WH(Q,J);if(Q.includes("|")&&"count"in J){let w=Number(J.count),W=Q.split("|");Q=wH(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 uG($,X,Z,J){let Y=$,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...W3,...J.i18n},w=await QH(Q.locale,J);X.__translations=w,X.__locale=Q.locale,X.__i18nConfig=Q,Y=await gG(Y,G,async(K,z,U,j,B)=>{try{let H={};if(U)try{let L=[()=>JSON.parse(U),()=>{let _=`{"data":${U}}`,F=JSON.parse(_);return typeof F.data==="object"?F.data:{}},()=>{return D0(U,X)}];for(let _ of L)try{if(H=_(),Object.keys(H).length>0)break}catch{}}catch(L){if(J.debug)console.error("Error parsing parameters for @translate directive:",L)}return fG(z,w,Q.fallbackToKey,H)||j.trim()}catch(H){if(J.debug)console.error("Error processing @translate directive:",H);return Y0("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(J.debug){console.warn(`Processing translations in template. Sections: ${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 gG(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(K,z,U,j)=>{try{let B={};if(U)try{let H=[()=>JSON.parse(U),()=>{let O=`{"data":${U}}`,L=JSON.parse(O);return typeof L.data==="object"?L.data:{}},()=>{return D0(U,X)}];for(let O of H)try{if(B=O(),Object.keys(B).length>0)break}catch{}}catch(H){if(J.debug)console.error("Error parsing parameters for @translate directive:",H)}return fG(z,w,Q.fallbackToKey,B)}catch(B){if(J.debug)console.error("Error processing @translate directive:",B);return Y0("Translate",`Error in @translate('${z}'): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR)}}),Y}async function gG($,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 J8,W3,Q3,Y8,J3;var dG=D(()=>{k1();y0();W3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},Q3={},Y8={},J3={}});var U3={};t(U3,{streamingSuspenseDirective:()=>lG,streamToResponse:()=>SH,streamTemplateSimple:()=>EH,streamTemplate:()=>RH,renderStreamingPage:()=>TH,registerStreamingDirectives:()=>yH,processStreamDirectives:()=>kH,processSectionDirectives:()=>bH,islandDirective:()=>pG,generateHydrationRuntime:()=>CH,extractStreamBoundaries:()=>IH,createStreamRenderer:()=>DH,buildSuspenseResolveScript:()=>z3,SUSPENSE_RESOLVER_RUNTIME:()=>cG});import Y9 from"path";function AH($){let X=[],Z=0,J;mG.lastIndex=0;while((J=mG.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 RH($,X={},Z={}){let J={...j5,...Z,streaming:{...K3,...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:Y9.dirname($)};if(W.trim())await G5(W,K,$);let z=AH(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 R0(q,K,$,J,U);for(let _=0;_<L.length;_+=Y)G.enqueue(L.slice(_,_+Y)),await new Promise((F)=>setTimeout(F,0))}else{let L=[],_=new RegExp(H5.source,"g"),F;while((F=_.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 I=await R0(N,K,$,J,U);G.enqueue(I),await new Promise((T)=>setTimeout(T,0))}}let R=await R0(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 R0(A,K,$,J,U);G.enqueue(R)}}}}else{let B=new Map;for(let O of z)if(O.type==="shell"||O.type==="content"){let L=await R0(O.content,K,$,J,U);G.enqueue(L)}else if(O.type==="suspense"&&O.name){let L=`stx-suspense-${O.name}`;G.enqueue(`<div id="${L}" data-suspense="${O.name}" style="display:contents;">
12330
12348
  <template data-suspense-fallback>Loading...</template>
12331
- </div>`),j.set(O.name,A0(O.content,K,$,J,U))}G.enqueue(`
12349
+ </div>`),B.set(O.name,R0(O.content,K,$,J,U))}G.enqueue(`
12332
12350
  <script>
12333
12351
  (function() {
12334
12352
  window.__stxSuspense = window.__stxSuspense || {
@@ -12344,13 +12362,13 @@ ${Y}`)}function _G($,X){let Z=$;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*
12344
12362
  }
12345
12363
  };
12346
12364
  })();
12347
- </script>`);let H=Array.from(j.entries()).map(async([O,L])=>{G.enqueue(await K3(O,L))});await Promise.all(H)}G.close()}catch(Q){G.error(Q)}}})}async function K3($,X){try{let J=(await X).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
12365
+ </script>`);let H=Array.from(B.entries()).map(async([O,L])=>{G.enqueue(await z3(O,L))});await Promise.all(H)}G.close()}catch(Q){G.error(Q)}}})}async function z3($,X){try{let J=(await X).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
12348
12366
  <script>
12349
12367
  window.__stxSuspense.resolve('${$}', \`${J}\`);
12350
12368
  </script>`}catch(Z){let J=Z instanceof Error?Z.message:String(Z);return`
12351
12369
  <script>
12352
12370
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${j1(J)}</div>');
12353
- </script>`}}function VH($,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 AH($,X=[],Z={}){let J=Z.timeoutMs??0;return new ReadableStream({async start(Y){try{if(Y.enqueue($),X.length>0)Y.enqueue(uG),await Promise.all(X.map(async(G)=>{let Q=VH(G.render(),J,G.id);Y.enqueue(await K3(G.id,Q))}));Y.close()}catch(G){Y.error(G)}}})}function NH($,X){return $.replace(RH,(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 TH($){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 MH($,X={},Z={}){let J={...j5,...Z,streaming:{...q3,...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:G9.dirname($)};if(W.trim())await G5(W,K,$);let z=new Set,U=J.streaming?.strategy||"auto",B=new RegExp(H5.source,"g");if(!(U!=="manual"&&B.test(q))){let H=await A0(q,K,$,J,z);for(let O=0;O<H.length;O+=Y)G.enqueue(H.slice(O,O+Y))}else{let H=[],O=new RegExp(H5.source,"g"),L;while((L=O.exec(q))!==null)H.push({name:L[1],content:L[2],start:L.index,end:L.index+L[0].length});let _=0;for(let F of H){if(F.start>_){let A=q.slice(_,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),_=F.end}if(_<q.length){let F=q.slice(_);if(F.trim()){let V=await A0(F,K,$,J,z);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function kH($,X={}){let Z={...j5,...X,streaming:{...q3,...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],B=q[2];W[U]=B}let K=Q.replace(H5,"");return{renderShell:async(U={})=>{let B={...U,__filename:$,__dirname:G9.dirname($)};return await G5(G,B,$),A0(K,B,$,Z,new Set)},renderSection:async(U,B={})=>{try{if(!W[U])return`<div class="error-message">Section "${j1(U)}" not found in template "${j1($)}"</div>`;let j={...B,__filename:$,__dirname:G9.dirname($)};await G5(G,j,$);let H=new Set;return await A0(W[U],j,$,Z,H)}catch(j){let H=j instanceof Error?j.message:String(j);return H0("Expression",H,$,W[U]||"",0,W[U]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return w}}}function IH($={}){let X=[];if($.streaming?.enabled)X.push(dG);if($.hydration?.enabled)X.push(mG);return X}async function EH($,X,Z,J={}){return $}function DH($,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 yH($={mode:"full"}){let{mode:X,components:Z={},dynamicImports:J=!0}=$,Y=Object.entries(Z).map(([G,Q])=>`'${G}': ${J?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
12371
+ </script>`}}function NH($,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 TH($,X=[],Z={}){let J=Z.timeoutMs??0;return new ReadableStream({async start(Y){try{if(Y.enqueue($),X.length>0)Y.enqueue(cG),await Promise.all(X.map(async(G)=>{let Q=NH(G.render(),J,G.id);Y.enqueue(await z3(G.id,Q))}));Y.close()}catch(G){Y.error(G)}}})}function kH($,X){return $.replace(MH,(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 IH($){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 EH($,X={},Z={}){let J={...j5,...Z,streaming:{...K3,...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:Y9.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 R0(q,K,$,J,z);for(let O=0;O<H.length;O+=Y)G.enqueue(H.slice(O,O+Y))}else{let H=[],O=new RegExp(H5.source,"g"),L;while((L=O.exec(q))!==null)H.push({name:L[1],content:L[2],start:L.index,end:L.index+L[0].length});let _=0;for(let F of H){if(F.start>_){let A=q.slice(_,F.start);if(A.trim()){let R=await R0(A,K,$,J,z);G.enqueue(R)}}let V=await R0(F.content,K,$,J,z);G.enqueue(V),_=F.end}if(_<q.length){let F=q.slice(_);if(F.trim()){let V=await R0(F,K,$,J,z);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function DH($,X={}){let Z={...j5,...X,streaming:{...K3,...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:Y9.dirname($)};return await G5(G,j,$),R0(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:Y9.dirname($)};await G5(G,B,$);let H=new Set;return await R0(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 yH($={}){let X=[];if($.streaming?.enabled)X.push(lG);if($.hydration?.enabled)X.push(pG);return X}async function bH($,X,Z,J={}){return $}function SH($,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 CH($={mode:"full"}){let{mode:X,components:Z={},dynamicImports:J=!0}=$,Y=Object.entries(Z).map(([G,Q])=>`'${G}': ${J?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
12354
12372
  `);if(X==="loader")return`
12355
12373
  (function() {
12356
12374
  window.__stx = window.__stx || {};
@@ -12492,7 +12510,7 @@ else {
12492
12510
  else {
12493
12511
  stx.hydrate();
12494
12512
  }
12495
- })();`}var q3,H5,hG,uG=`
12513
+ })();`}var K3,H5,mG,cG=`
12496
12514
  <script>
12497
12515
  (function(){
12498
12516
  window.__stxSuspense = window.__stxSuspense || {
@@ -12512,25 +12530,25 @@ else {
12512
12530
  }
12513
12531
  };
12514
12532
  })();
12515
- </script>`,RH,dG,mG;var U3=D(()=>{N1();B1();_$();V0();q3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},H5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,hG=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;RH=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;dG={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} -->`}},mG={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>`,MH,lG,pG;var j3=D(()=>{T1();B1();O$();A0();K3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},H5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,mG=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;MH=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;lG={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} -->`}},pG={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}">
12516
12534
  ${q}
12517
12535
  <script type="application/json" data-island-props="${Q}">
12518
12536
  ${W?`{${W}}`:"{}"}
12519
12537
  </script>
12520
- </div>`}}});var pG={};t(pG,{warnUnbalancedTags:()=>j3,findUnbalancedTags:()=>lG});function p5($){return $.replace(/[^\n]/g," ")}function lG($){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(bH.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(`
12521
- `).length;Z.set(W,{count:1,firstLine:z})}}}let Q=[];for(let w of new Set([...Z.keys(),...J.keys()])){if(SH.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 j3($,X){let Z;try{Z=lG($)}catch{return}if(Z.length===0)return;let J=`${X}:${$.length}`;if(cG.has(J))return;cG.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 bH,SH,cG;var B3=D(()=>{bH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),SH=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);cG=new Set});import X1 from"path";import H3 from"fs";function iG($){return $.split("-").map((X)=>X.charAt(0).toUpperCase()+X.slice(1)).join("")}function nG($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class rG{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 B=[Y,Y.toLowerCase(),iG(Y),nG(Y)];for(let j of B)if(G.has(j))return G.get(j)}let Q=[...new Set([`${Y}.stx`,`${iG(Y)}.stx`,`${nG(Y)}.stx`])];if(Y.startsWith("./")||Y.startsWith("../")){let B=X1.resolve(X1.dirname(X),`${Y}.stx`);if(await e(B))return B;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 B of U)if(!w.includes(B))w.push(B);for(let B of w){if(!B)continue;for(let j of Q){let H=X1.join(B,j);if(await e(H))return H}try{if(!H3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let H=H3.readdirSync(B,{withFileTypes:!0});for(let O of H)if(O.isDirectory()){let L=X1.join(B,O.name);for(let _ of Q){let F=X1.join(L,_);if(await e(F))return F}}}catch{}}return null}}var i0;var _3=D(()=>{V0();i0=new rG});function k0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function O3($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var _5="\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(k0(G));continue}if(Y===_5){Z.push(k0(G));continue}Z.push(`${k0(G)}="${k0(O3(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(k0(G));continue}if(typeof Y==="object")continue;Z.push(`${k0(G)}="${k0(O3(String(Y)))}"`)}return Z}var Q9=()=>{};function Y8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function CH($){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 L3;var F3=D(()=>{Q9();L3={name:"StxLink",aliases:["stx-link"],render($,X,Z){let J=CH($),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="${Y8(J.value)}"`);else W.push(`href="${Y8(J.value)}"`);if(Y)W.push(`class="${Y8(Y)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${Y8(G)}"`),W.push(`data-stx-exact-active-class="${Y8(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 x0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function u0($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function A3($,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 oG($){if($.includes("(")||$.includes(","))return $;let X=$.trim().split(/\s+/),Z=[];for(let J of X)if(J.includes(":")){let[Y,G]=J.split(":"),Q=PH[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 R3($,X,Z,J){return X.map((Y)=>`${G8($,Y,void 0,Z,J)} ${Y}w`).join(", ")}function vH($,X,Z,J,Y){return X.map((G)=>{let Q=Z?Z*G:void 0;return`${G8($,Q,void 0,J,Y)} ${G}x`}).join(", ")}function G8($,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 xH($,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 PH,V3,N3;var T3=D(()=>{Q9();PH={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},V3=[320,640,768,1024,1280,1536,1920];N3={name:"StxImage",aliases:["stx-image","stx-img"],render($,X,Z){let J=u0($,"src")||"",Y=u0($,"alt")||"",G=u0($,"width"),Q=u0($,"height"),w=u0($,"sizes"),W=u0($,"srcset"),q=u0($,"densities"),K=u0($,"format"),z=u0($,"placeholder"),U=u0($,"placeholderColor")||"#e5e7eb",B=u0($,"provider"),j=u0($,"class")||u0($,"className")||"",H=u0($,"style")||"",O=u0($,"quality"),L=A3($,"lazy",!0),_=A3($,"preload",!1),F=A3($,"picture",!1)||!!K,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=W||"",N="";if(!R&&w)R=R3(J,V3,B,K),N=oG(w);else if(!R&&q){let b=q.split(/\s+/).map((y)=>Number.parseFloat(y.replace("x","")));R=vH(J,b,V,B,K)}else if(w)N=oG(w);let T=[];if(H)T.push(H);if(V&&A)T.push(`aspect-ratio:${V}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let b=xH(V||16,A||9,U);T.push(`background-image:url(${b})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${x0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=G8(J,V,A,B,K),k=[];if(k.push(`src="${x0(M)}"`),k.push(`alt="${x0(Y)}"`),G)k.push(`width="${x0(G)}"`);if(Q)k.push(`height="${x0(Q)}"`);if(L)k.push('loading="lazy"');if(k.push('decoding="async"'),j)k.push(`class="${x0(j)}"`);if(T.length>0)k.push(`style="${x0(T.join(";"))}"`);if(R)k.push(`srcset="${x0(R)}"`);if(N)k.push(`sizes="${x0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);k.push(...i5($,E)),k.push(...n5($,E));let I=`<img ${k.join(" ")} />`,S="";if(_){let y=K==="webp"?"image/webp":K==="avif"?"image/avif":"";S=`<link rel="preload" as="image" href="${x0(M)}"${y?` type="${y}"`:""}${R?` imagesrcset="${x0(R)}"`:""}${N?` imagesizes="${x0(N)}"`:""} />
12522
- `}if(F){let b=[];if(K==="avif"||K==="auto"){let y=G8(J,V,A,B,"avif"),P=R?R3(J,V3,B,"avif"):`${y}`;b.push(`<source type="image/avif" srcset="${x0(P)}"${N?` sizes="${x0(N)}"`:""} />`)}if(K==="webp"||K==="auto"){let y=G8(J,V,A,B,"webp"),P=R?R3(J,V3,B,"webp"):`${y}`;b.push(`<source type="image/webp" srcset="${x0(P)}"${N?` sizes="${x0(N)}"`:""} />`)}return`${S}<picture>
12538
+ </div>`}}});var rG={};t(rG,{warnUnbalancedTags:()=>B3,findUnbalancedTags:()=>nG});function p5($){return $.replace(/[^\n]/g," ")}function nG($){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(vH.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 B3($,X){let Z;try{Z=nG($)}catch{return}if(Z.length===0)return;let J=`${X}:${$.length}`;if(iG.has(J))return;iG.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,vH,iG;var H3=D(()=>{PH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),vH=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);iG=new Set});import $1 from"path";import _3 from"fs";function oG($){return $.split("-").map((X)=>X.charAt(0).toUpperCase()+X.slice(1)).join("")}function sG($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class aG{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(),oG(Y),sG(Y)];for(let B of j)if(G.has(B))return G.get(B)}let Q=[...new Set([`${Y}.stx`,`${oG(Y)}.stx`,`${sG(Y)}.stx`])];if(Y.startsWith("./")||Y.startsWith("../")){let j=$1.resolve($1.dirname(X),`${Y}.stx`);if(await e(j))return j;return null}let w=[],W=Z.componentsDir||"",q=J?.__originalFilePath;if(q)w.push($1.join($1.dirname(q),"components"));if(W)w.push(W);let K=$1.join($1.dirname(X),"components");if(!w.includes(K))w.push(K);let z=process.cwd(),U=[$1.resolve(z,"src/components"),$1.resolve(z,"components"),$1.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=$1.join(j,B);if(await e(H))return H}try{if(!_3.statSync(j,{throwIfNoEntry:!1})?.isDirectory())continue;let H=_3.readdirSync(j,{withFileTypes:!0});for(let O of H)if(O.isDirectory()){let L=$1.join(j,O.name);for(let _ of Q){let F=$1.join(L,_);if(await e(F))return F}}}catch{}}return null}}var n0;var O3=D(()=>{A0();n0=new aG});function k0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function L3($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var _5="\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(k0(G));continue}if(Y===_5){Z.push(k0(G));continue}Z.push(`${k0(G)}="${k0(L3(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(k0(G));continue}if(typeof Y==="object")continue;Z.push(`${k0(G)}="${k0(L3(String(Y)))}"`)}return Z}var G9=()=>{};function G8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xH($){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 F3;var V3=D(()=>{G9();F3={name:"StxLink",aliases:["stx-link"],render($,X,Z){let J=xH($),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="${G8(J.value)}"`);else W.push(`href="${G8(J.value)}"`);if(Y)W.push(`class="${G8(Y)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${G8(G)}"`),W.push(`data-stx-exact-active-class="${G8(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 x0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function d0($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function R3($,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 tG($){if($.includes("(")||$.includes(","))return $;let X=$.trim().split(/\s+/),Z=[];for(let J of X)if(J.includes(":")){let[Y,G]=J.split(":"),Q=fH[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 N3($,X,Z,J){return X.map((Y)=>`${Q8($,Y,void 0,Z,J)} ${Y}w`).join(", ")}function gH($,X,Z,J,Y){return X.map((G)=>{let Q=Z?Z*G:void 0;return`${Q8($,Q,void 0,J,Y)} ${G}x`}).join(", ")}function Q8($,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 hH($,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 fH,A3,T3;var M3=D(()=>{G9();fH={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},A3=[320,640,768,1024,1280,1536,1920];T3={name:"StxImage",aliases:["stx-image","stx-img"],render($,X,Z){let J=d0($,"src")||"",Y=d0($,"alt")||"",G=d0($,"width"),Q=d0($,"height"),w=d0($,"sizes"),W=d0($,"srcset"),q=d0($,"densities"),K=d0($,"format"),z=d0($,"placeholder"),U=d0($,"placeholderColor")||"#e5e7eb",j=d0($,"provider"),B=d0($,"class")||d0($,"className")||"",H=d0($,"style")||"",O=d0($,"quality"),L=R3($,"lazy",!0),_=R3($,"preload",!1),F=R3($,"picture",!1)||!!K,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=W||"",N="";if(!R&&w)R=N3(J,A3,j,K),N=tG(w);else if(!R&&q){let b=q.split(/\s+/).map((y)=>Number.parseFloat(y.replace("x","")));R=gH(J,b,V,j,K)}else if(w)N=tG(w);let I=[];if(H)I.push(H);if(V&&A)I.push(`aspect-ratio:${V}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let b=hH(V||16,A||9,U);I.push(`background-image:url(${b})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")I.push(`background-image:url(${x0(z)})`),I.push("background-size:cover"),I.push("background-repeat:no-repeat");let T=Q8(J,V,A,j,K),k=[];if(k.push(`src="${x0(T)}"`),k.push(`alt="${x0(Y)}"`),G)k.push(`width="${x0(G)}"`);if(Q)k.push(`height="${x0(Q)}"`);if(L)k.push('loading="lazy"');if(k.push('decoding="async"'),B)k.push(`class="${x0(B)}"`);if(I.length>0)k.push(`style="${x0(I.join(";"))}"`);if(R)k.push(`srcset="${x0(R)}"`);if(N)k.push(`sizes="${x0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);k.push(...i5($,E)),k.push(...n5($,E));let M=`<img ${k.join(" ")} />`,S="";if(_){let y=K==="webp"?"image/webp":K==="avif"?"image/avif":"";S=`<link rel="preload" as="image" href="${x0(T)}"${y?` type="${y}"`:""}${R?` imagesrcset="${x0(R)}"`:""}${N?` imagesizes="${x0(N)}"`:""} />
12540
+ `}if(F){let b=[];if(K==="avif"||K==="auto"){let y=Q8(J,V,A,j,"avif"),P=R?N3(J,A3,j,"avif"):`${y}`;b.push(`<source type="image/avif" srcset="${x0(P)}"${N?` sizes="${x0(N)}"`:""} />`)}if(K==="webp"||K==="auto"){let y=Q8(J,V,A,j,"webp"),P=R?N3(J,A3,j,"webp"):`${y}`;b.push(`<source type="image/webp" srcset="${x0(P)}"${N?` sizes="${x0(N)}"`:""} />`)}return`${S}<picture>
12523
12541
  ${b.join(`
12524
12542
  `)}
12525
- ${I}
12526
- </picture>`}return`${S}${I}`}}});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 sG="/images/safe-image-default.svg",fH,M3;var k3=D(()=>{Q9();fH=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${sG}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,M3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,X,Z){let J=r5($,"src")||"",Y=r5($,"alt")||"",G=r5($,"fallback")||sG,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,`${fH}${K}`;return K}}});function I3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function w8($,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=w8($,X);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return Z}var E3;var D3=D(()=>{E3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,X,Z){let J=I3(w8($,"color")||"#6366f1"),Y=I3(w8($,"initialColor")||w8($,"initial-color")||""),G=I3(w8($,"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`
12543
+ ${M}
12544
+ </picture>`}return`${S}${M}`}}});function w8($){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 eG="/images/safe-image-default.svg",uH,k3;var I3=D(()=>{G9();uH=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${eG}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,k3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,X,Z){let J=r5($,"src")||"",Y=r5($,"alt")||"",G=r5($,"fallback")||eG,Q=r5($,"class")||r5($,"className")||"",w=r5($,"fallbackClassName")||"",W=[];if(W.push(`src="${w8(J)}"`),W.push(`alt="${w8(Y)}"`),Q)W.push(`class="${w8(Q)}"`);if(W.push(`data-fallback="${w8(G)}"`),w)W.push(`data-fallback-class="${w8(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,`${uH}${K}`;return K}}});function E3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function W8($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function Q9($,X,Z){let J=W8($,X);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return Z}var D3;var y3=D(()=>{D3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,X,Z){let J=E3(W8($,"color")||"#6366f1"),Y=E3(W8($,"initialColor")||W8($,"initial-color")||""),G=E3(W8($,"height")||"3px"),Q=Q9($,"duration",2000),w=Q9($,"throttle",200),W=Q9($,"zIndex",999999)||Q9($,"z-index",999999),q=Y?`linear-gradient(to right, ${Y}, ${J})`:J;return`
12527
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">
12528
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>
12529
12547
  </div>
12530
12548
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
12531
12549
  <script>
12532
12550
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${w})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
12533
- </script>`}}});function tG($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function gH($,X,Z){let J=tG($,X);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return Z}var aG,y3;var b3=D(()=>{aG={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},y3={name:"StxToast",aliases:["stx-toast"],render($,X,Z){let J=k0(tG($,"position")||"top-right"),Y=gH($,"max",5),G=aG[J]||aG["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${Y}" style="position:fixed;${G};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
12551
+ </script>`}}});function XQ($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function dH($,X,Z){let J=XQ($,X);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return Z}var $Q,b3;var S3=D(()=>{$Q={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},b3={name:"StxToast",aliases:["stx-toast"],render($,X,Z){let J=k0(XQ($,"position")||"top-right"),Y=dH($,"max",5),G=$Q[J]||$Q["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${J}" data-stx-toast-max="${Y}" style="position:fixed;${G};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
12534
12552
  <style>
12535
12553
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
12536
12554
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -12538,7 +12556,7 @@ ${I}
12538
12556
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
12539
12557
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
12540
12558
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
12541
- </style>`}}});function W9($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var eG,S3;var C3=D(()=>{eG={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},S3={name:"StxModal",aliases:["stx-modal"],render($,X,Z){let J=W9($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=k0(J),G=W9($,"size")||"md",Q=W9($,"closeOnBackdrop")!=="false",w=W9($,"closeOnEscape")!=="false",W=eG[G]||eG.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${Q}" data-close-escape="${w}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
12559
+ </style>`}}});function w9($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var ZQ,C3;var P3=D(()=>{ZQ={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},C3={name:"StxModal",aliases:["stx-modal"],render($,X,Z){let J=w9($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=k0(J),G=w9($,"size")||"md",Q=w9($,"closeOnBackdrop")!=="false",w=w9($,"closeOnEscape")!=="false",W=ZQ[G]||ZQ.md;return`<div id="stx-modal-${Y}" class="stx-modal-backdrop" data-stx-modal="${Y}" data-close-backdrop="${Q}" data-close-escape="${w}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
12542
12560
  <div class="stx-modal-panel" style="${W};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
12543
12561
  <div style="padding:1.5rem">${X}</div>
12544
12562
  </div>
@@ -12547,8 +12565,8 @@ ${I}
12547
12565
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
12548
12566
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
12549
12567
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
12550
- </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 $Q,P3;var v3=D(()=>{$Q={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},P3={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=k0(J),G=o5($,"side")||"right",Q=o5($,"size")||"md",w=o5($,"closeOnBackdrop")!=="false",W=o5($,"closeOnEscape")!=="false",q=o5($,"overlay")!=="false",K=$Q[Q]||$Q.md,z=G==="left",U=z?"left:0":"right:0",B=z?"translateX(-100%)":"translateX(100%)",j=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">
12551
- <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${U};width:${K};max-width:100vw;transform:${B};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
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 JQ,v3;var x3=D(()=>{JQ={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},v3={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=k0(J),G=o5($,"side")||"right",Q=o5($,"size")||"md",w=o5($,"closeOnBackdrop")!=="false",W=o5($,"closeOnEscape")!=="false",q=o5($,"overlay")!=="false",K=JQ[Q]||JQ.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
+ <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">
12552
12570
  <div style="padding:1.5rem">${X}</div>
12553
12571
  </div>
12554
12572
  </div>
@@ -12556,18 +12574,18 @@ ${I}
12556
12574
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
12557
12575
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
12558
12576
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
12559
- </style>`}}});import{existsSync as hH,readFileSync as uH}from"fs";function dH($){if(XQ.has($))return;XQ.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function mH($){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(hH(Z))return Z;for(let Z of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return j0.resolve(Z)}catch{}return null}function cH($){if(q9.has($))return q9.get($);let X=mH($);if(!X)return dH($),null;try{let Z=JSON.parse(uH(X,"utf8"));return q9.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 q9,XQ,x3;var f3=D(()=>{q9=new Map,XQ=new Set;x3={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 _=J.split(":");Y=_[0],G=_[1]}let Q=k0(s5($,"size")||"24"),w=k0(s5($,"color")||"currentColor"),W=k0(s5($,"class")||""),q=k0(s5($,"style")||""),K=q9.get(Y)??cH(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,B=z.height||24,j=`0 0 ${U} ${B}`,H=z.body;if(w!=="currentColor")H=H.replace(/currentColor/g,w);let O=W?` class="${W}"`:"",L=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${j}" fill="none"${O}${L}>${H}</svg>`}}});function ZQ($,...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 JQ($,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 g3;var h3=D(()=>{g3={name:"Suspense",aliases:["suspense"],render($,X,Z){let J=JQ(X,"fallback"),Y=J.rest,G=JQ(Y,"error"),Q=G.rest,w=J.region??ZQ($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=G.region??ZQ($,"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 K9($,...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 u3;var d3=D(()=>{u3={name:"TransitionGroup",aliases:["transition-group"],render($,X,Z){let J=(K9($,"name")||"v").replace(/["'<>]/g,""),Y=(K9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=K9($,"class"),Q=K9($,"id"),w=[`data-stx-transition-group="${J}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${Y} ${w}>${X}</${Y}>`}}});function YQ(){i0.registerBuiltin(L3),i0.registerBuiltin(N3),i0.registerBuiltin(M3),i0.registerBuiltin(E3),i0.registerBuiltin(y3),i0.registerBuiltin(S3),i0.registerBuiltin(P3),i0.registerBuiltin(x3),i0.registerBuiltin(g3),i0.registerBuiltin(u3)}var GQ=D(()=>{F3();T3();k3();D3();b3();C3();v3();f3();h3();d3();_3();F3();T3();k3();D3();b3();C3();v3();f3();h3();d3()});function z9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function QQ($,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,B=!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,B=!0;break}if(H===">"){U=q+1;break}q++}if(U===-1){Y=G+1;continue}let j=$.slice(z,B?U-2:U-1).trim();if(B)J.push({fullMatch:$.slice(G,U),tagName:W,attributes:j,content:"",startIndex:G,endIndex:U,isSelfClosing:!0}),Y=U;else{let H=`<${W}`,O=`</${W}>`,L=1,_=U,F=-1;while(L>0&&_<$.length){let R=$.indexOf(H,_),N=$.indexOf(O,_);if(N===-1)break;if(R!==-1&&R<N){let T=$[R+H.length];if(T===" "||T===">"||T==="/"||T===`
12560
- `||T==="\t")L++;_=R+H.length}else{if(L--,L===0){F=N;break}_=N+O.length}}if(F===-1){Y=U;continue}let V=$.slice(U,F),A=F+O.length;J.push({fullMatch:$.slice(G,A),tagName:W,attributes:j,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),Y=A}}return J}function wQ($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function WQ($,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 qQ=D(()=>{y0();V0();x1()});var _Q={};t(_Q,{processESImports:()=>BQ,processComponents:()=>j9});import U9 from"fs";import a0 from"path";function pH($,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 B=U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(K))return!0}return!1},Q=new Set(B2),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]=WQ(K,Z);continue}if(z.startsWith(":")){let U=w(z.slice(1)),B=K===_5?U:K;if(U==="if"||U==="for"||U==="show"){J.clientReactive[U]=B;continue}if(G(B)){J.clientReactive[U]=B;continue}try{if(!q0(B)){if(Z.debug)console.error(`Unsafe expression in :${U} binding: ${B}`);J.clientReactive[U]=B;continue}let j=Object.keys(X),O=K0(B,j)(...Object.values(X));if(O===void 0){let L=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],_=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(L.some((V)=>!_.has(V)&&!j.includes(V))){J.clientReactive[U]=B;continue}}if(J.serverDynamic[U]=O,U!==z.slice(1)&&J.serverDynamicNames)J.serverDynamicNames[U]=z.slice(1)}catch{J.clientReactive[U]=B}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let U=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let B=U[1];if(q0(B)){let H=K0(B,Object.keys(X))(...Object.values(X));W(z,H!=null?String(H):"")}else{if(Z.debug)console.error(`Unsafe expression in ${z}: ${B}`);W(z,K)}}catch(B){if(Z.debug)console.error(`Error evaluating expression for ${z}:`,B);W(z,K)}else{let B=K,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=j.exec(K))!==null)try{let O=H[1];if(!q0(O)){if(Z.debug)console.error(`Unsafe expression in ${z}: ${O}`);continue}let _=K0(O,Object.keys(X))(...Object.values(X));B=B.replace(H[0],String(_??""))}catch(O){if(Z.debug)console.error(`Error evaluating expression in ${z}:`,O)}W(z,B)}continue}W(z,K===_5?"true":wQ(K))}return J}function nH($,X,Z){if(!$.includes("@"))return $;if(!iH.some(([Y,G])=>Y.test($)&&$.includes(G)))return $;try{return E1($,X,Z)}catch{return $}}function rH($){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 zQ($){return Object.entries($).map(([X,Z])=>Z===_5?X:`${X}="${oH(Z)}"`).join(" ")}function oH($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function sH($){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 aH($){let X=UQ.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=U9.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 UQ.set($,Z),Z}function tH($,X){if($.startsWith(".")||$.startsWith("/"))return null;let Z=X;while(!0){let J=a0.join(Z,"node_modules",$);try{if(U9.statSync(J).isDirectory())return J}catch{}let Y=a0.dirname(Z);if(Y===Z)return null;Z=Y}}async function BQ($,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,B=z,j,H=[];while((j=U.exec(z))!==null){let[O,L,_,F]=j,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=a0.resolve(Q,F);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(U9.statSync(M).isFile())A=M}catch{try{if(U9.statSync(T).isDirectory())V=T}catch{}}}}else V=tH(F,Q);if(!V&&!A)continue;let R=!1,N=(T,M)=>{G.set(T,M),G.set(T.toLowerCase(),M);let k=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(k,M),Y.add(M)};if(_&&A)N(_,A),R=!0;else if(L){let T=L.slice(1,-1).split(",").map((k)=>k.trim()).filter(Boolean).map((k)=>{let E=k.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:k,local:k}}),M=V?aH(V):null;for(let{source:k,local:E}of T){let I=null;if(A)I=A;else if(M)I=M.get(k)??M.get(k.toLowerCase())??M.get(k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(E,I),R=!0}}if(R)H.push({start:j.index,end:j.index+O.length})}if(H.length===0)return q;for(let O=H.length-1;O>=0;O--)B=B.slice(0,H[O].start)+B.slice(H[O].end);return`<script${K}>${B}</script>`}),w}async function eH($,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 B=U.split("/"),H=B[B.length-1].replace(/\.stx$/,""),O=H.includes("-")?H.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),L=null,_=[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 _)try{if(await Bun.file(F).exists()){L=F;break}}catch{}if(L){Q.set(O,L),Q.set(H,L),Q.set(H.toLowerCase(),L);let F=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,L),Y.add(L),J.debug)console.log(`Imported component: ${O} -> ${L}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${U}`)}G=G.replace(q,""),w.lastIndex=0}return G}async function $_($,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,B=z+1;while(B<G.length&&U>0){if(G[B]==="(")U++;else if(G[B]===")"){if(U--,U===0)break}B++}if(U!==0)break;let j=G.substring(z+1,B),H=B+1,O=j.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let L=O[1],_,F=j.slice(O[0].length),V=F.match(/^\s*,\s*/);if(V)_=F.slice(V[0].length).trim();let A={};if(_)try{A=D0(_,X)}catch(E){let I=E instanceof Error?E.message:String(E);G=G.replace(G.substring(K,H),`[Error parsing component props: ${I}]`);continue}let R="",N=H,M=G.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)R=M[1].trim(),N=H+M[0].length;let k=await q5(L,A,R,Q,X,Z,J,w,Y);G=G.substring(0,K)+k+G.substring(N),W.lastIndex=0}return G}async function X_($,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,lH),G=S5(G,W.scripts),G;async function U(B,j,H,O){if(!B)return B;let L=B,_=QQ(L,j,O);for(let F=_.length-1;F>=0;F--){let V=_[F],A=H?z9(V.tagName):V.tagName,R=rH(nH(V.attributes,X,Z)),N=pH(R,X,J),T=i0.getBuiltin(V.tagName),M=T?await H$(A,Q,X,Z,J):!1;if(T&&!M){let S={context:X,filePath:Z,options:J,dependencies:Y},b=T.render(N,V.content,S);if(Object.keys(N.clientReactive).length>0)b=jQ(b,N.clientReactive);if(Object.keys(N.events).length>0){let y=zQ(N.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}L=L.substring(0,V.startIndex)+b+L.substring(V.endIndex);continue}if(!H&&V.tagName.includes("-")&&!await H$(A,Q,X,Z,J))continue;let k={};for(let[S,b]of Object.entries(N.static))k[S]=b;for(let[S,b]of Object.entries(N.serverDynamic))k[S]=b;let I=await q5(A,k,S5(V.content,W.scripts),Q,X,Z,J,w,Y);if(Object.keys(N.clientReactive).length>0)I=jQ(I,N.clientReactive);if(Object.keys(N.events).length>0){let S=HQ(I);if(S){let b=zQ(N.events),y=Object.keys(N.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,S.insertPos)+` data-stx-parent-events="${y}" ${b}`+I.substring(S.insertPos)}}L=L.substring(0,V.startIndex)+I+L.substring(V.endIndex)}return L}}function jQ($,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])=>z9(K)).join(" "),Q=$,w=Y.length>0?HQ(Q):null;if(w){let K=Y.map(([U,B])=>`:${z9(U)}="${B.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 HQ($){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 j9($,X,Z,J,Y){if(!KQ)YQ(),KQ=!0;let G=await BQ($,X,Z,J,Y);G=await eH(G,X,Z,J,Y),G=await $_(G,X,Z,J,Y);let Q=[];for(let w=0;w<3;w++){let W=z1(G,f7,(K,z)=>`\x00STX_COMPONENT_COMMENT_${Q.length+z}\x00`);Q.push(...W.tokens);let q=G;if(G=await X_(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=sH(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 KQ=!1,lH,iH,UQ;var m3=D(()=>{_3();e7();GQ();qQ();x1();V0();y0();J1();lH=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"]);iH=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];UQ=new Map});var NQ={};t(NQ,{processLoops:()=>l3,parseLoopBinding:()=>c3});function Y_($,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=P0($,"(",")",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=D0(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 G_($,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 B=U[1],j=K.slice(U[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let O=j.slice(H[0].length).trim();if(!O)continue;try{let L=D0(O,X),_=JSON.stringify(L),F=`@component('${B}', ${_})`;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 B9($,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 j=J[q];if(z){z=!1,q++;continue}if(j==="\\"&&K){z=!0,q++;continue}if(K){if(j===K)K=null;q++;continue}if(j==='"'||j==="'"||j==="`"){K=j,q++;continue}if(j==="(")W++;else if(j===")"){if(W--,W===0)break}q++}if(W!==0)break;let U=J.substring(w+1,q),B=Z(U);J=J.substring(0,Q)+B+J.substring(q+1)}return J}function Q_($,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);x8(G);let q=K0(G,Q)(...w),K=JSON.stringify(q),z=Buffer.from(K,"utf8").toString("base64");return`__stx_${Y}="${z}"`}catch(Q){return J}}),Z}function w_($,X){let Z=$;return Z=B9(Z,"@break",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(q0(G)){let w=K0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(Q0(G,X));return Q?H9:""}catch{return""}}),Z=B9(Z,"@continue",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(q0(G)){let w=K0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(Q0(G,X));return Q?_9:""}catch{return""}}),Z}function W_($){let X=$;return X=X.replace(/@break(?!\()/g,H9),X=X.replace(/@continue(?!\()/g,_9),X}function OQ($){let X=$.includes(H9),Z=X?$.substring(0,$.indexOf(H9)):$;return{hasBreak:X,content:Z}}function LQ($){let X=$.includes(_9),Z=X?$.substring(0,$.indexOf(_9)):$;return{hasContinue:X,content:Z}}function VQ($){let X=$;return X=B9(X,"@break",(Z)=>{let J=Z.trim();if(!f8(J))return"";return`\`; if (${J}) { break; } result += \``}),X=B9(X,"@continue",(Z)=>{let J=Z.trim();if(!f8(J))return"";return`\`; if (${J}) { continue; } result += \``}),X=X.replace(/@break(?!\()/g,"`; break; result += `"),X=X.replace(/@continue(?!\()/g,"`; continue; result += `"),X}function q_($){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,B=0;while(z<=U){let j=z+U>>1;if(w[j].pos<=K)B=w[j].depth,z=j+1;else U=j-1}return B}while((Z=X.exec($))!==null){if(q(Z.index)>0)continue;let K=Z.index,z=Z.index+Z[0].length-1,U=1,B=z+1,j=-1;while(B<$.length&&U>0){if($[B]==="(")U++;else if($[B]===")"){if(U--,U===0){j=B;break}}B++}if(j===-1)continue;let H=$.substring(z+1,j),O=c3(H);if(!O)continue;let{arrayExpr:L,itemVar:_}=O,F=j+1,V=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(V>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let b=R.exec($),y=N.exec($);if(!y)break;if(b&&b.index<y.index)V++,A=b.index+b[0].length;else{if(V--,V===0){T=y.index;break}A=y.index+11}}if(T===-1)continue;let M=$.substring(F,T),k=T+11,E=-1,I=0,S=0;while(S<M.length){let b=M.indexOf("@",S);if(b===-1)break;let y=M.substring(b);if(/^@forelse\s*\(/.test(y))I++,S=b+1;else if(y.startsWith("@endforelse"))I--,S=b+11;else if(I===0&&y.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){E=b;break}S=b+1}else S=b+1}if(E===-1)continue;return{start:K,end:k,arrayExpr:L,itemVar:_,foreachContent:M.substring(0,E),emptyContent:M.substring(E+6)}}return null}function FQ($,X){let Z=$;while(!0){let J=q_(Z);if(!J)break;let{start:Y,end:G,arrayExpr:Q,itemVar:w,foreachContent:W,emptyContent:q}=J;try{let K;if(q0(Q))K=K0(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=Y0("Forelse",`Error in @forelse(${Q} as ${w}): ${z}`,o.EVALUATION_ERROR);Z=Z.substring(0,Y)+U+Z.substring(G)}}return Z}function c3($){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 l3($,X,Z,J){let Y=$;Y=FQ(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,B=1,j=U+1,H=-1;while(j<W.length&&B>0){if(W[j]==="(")B++;else if(W[j]===")"){if(B--,B===0){H=j;break}}j++}if(H===-1)continue;let O=W.substring(U+1,H),L=c3(O);if(!L)continue;let _=z,{arrayExpr:F,itemVar:V}=L,A=H+1,R=1,N=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(R>0&&N<W.length){T.lastIndex=N,M.lastIndex=N;let k=T.exec(W),E=M.exec(W);if(!E)break;if(k&&k.index<E.index)R++,N=k.index+k[0].length;else{if(R--,R===0){let I=W.substring(A,E.index),S=E.index+11;return{start:_,end:S,arrayExpr:F,itemVar:V,content:I}}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:B,arrayExpr:j,itemVar:H,content:O}=z;try{let L=j.trim(),_;if(q0(L))_=K0(L,Object.keys(q))(...Object.values(q));else _=Q0(L,q);let F=!1;if(!Array.isArray(_))if(_ instanceof Map)_=Array.from(_),F=!0;else if(_ instanceof Set)_=Array.from(_);else if(typeof _==="string")_=Array.from(_);else if(_&&typeof _==="object"&&!(_ instanceof Date)&&!(_ instanceof RegExp))_=Object.entries(_),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=Y0("Foreach",`Error in @foreach: ${L} is not iterable`,o.TYPE_ERROR);K=K.substring(0,U)+E+K.substring(B);continue}let V=J?.loops?.useAltLoopVariable??J_,A=H.trim(),R=null,N,T=!1;if(A.includes("=>")){let E=A.split("=>").map((I)=>I.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((I)=>I.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1],T=!0;else N=A}else N=A;let M="",k=_;for(let E=0;E<k.length;E++){let I=k[E],S={index:E,iteration:E+1,first:E===0,last:E===k.length-1,count:k.length},b={...q,loop:S,$loop:S};if(N.startsWith("[")&&N.endsWith("]")){let x=N.slice(1,-1).split(",").map((p)=>p.trim());if(Array.isArray(I))x.forEach((p,u)=>{if(p)b[p]=I[u]});else b[N]=I}else b[N]=I;if(R)if(!T&&F&&Array.isArray(I)&&I.length===2)b[R]=I[0],b[N]=I[1];else b[R]=E;let y=w_(O,b),P=LQ(y);if(P.hasContinue){M+=P.content;continue}let f=OQ(y);if(f.hasBreak){M+=f.content;break}if(y=FQ(y,b),y=Q(y,b),y=E1(y,b,Z),y=W_(y),f=OQ(y),f.hasBreak){M+=f.content;break}if(P=LQ(y),P.hasContinue){M+=P.content;continue}y=f1(y,b,Z),y=Q_(y,b),y=G_(y,b),y=Y_(y,b),M+=y}K=K.substring(0,U)+M+K.substring(B)}catch(L){let _=Y0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${L instanceof Error?L.message:String(L)}`,o.EVALUATION_ERROR);K=K.substring(0,U)+_+K.substring(B)}}return K}Y=Q(Y,X),Y=RQ(Y,X,Z,J);let w=J?.loops?.maxWhileIterations??Z_;return Y=U_(Y,X,w),Y}function AQ($){return f8($)}function RQ($,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=P0(Y,"(",")",W);if(q===-1)break;let K=Y.slice(W+1,q),z=q+1,U=i8(Y.slice(w),"for","endfor");if(U.length===0)break;let B=U[0].content,j=w+U[0].end;if(!AQ(K)){let H=Y0("For",`Unsafe expression in @for: ${K}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,w)+H+Y.substring(j),G=!0;continue}try{let H=K_(K),O=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(H.length>0&&O){let R=z_({forExpr:K,content:B,iterVarNames:H,context:X,filePath:Z,options:J});Y=Y.substring(0,w)+R+Y.substring(j),G=!0;continue}let L=Object.keys(X),_=Object.values(X),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=VQ(F);let A=Function(...L,`
12577
+ </style>`}}});import{existsSync as mH,readFileSync as cH}from"fs";function lH($){if(YQ.has($))return;YQ.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function pH($){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(mH(Z))return Z;for(let Z of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return j0.resolve(Z)}catch{}return null}function iH($){if(W9.has($))return W9.get($);let X=pH($);if(!X)return lH($),null;try{let Z=JSON.parse(cH(X,"utf8"));return W9.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 W9,YQ,f3;var g3=D(()=>{W9=new Map,YQ=new Set;f3={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 _=J.split(":");Y=_[0],G=_[1]}let Q=k0(s5($,"size")||"24"),w=k0(s5($,"color")||"currentColor"),W=k0(s5($,"class")||""),q=k0(s5($,"style")||""),K=W9.get(Y)??iH(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 O=W?` class="${W}"`:"",L=q?` style="${q}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${B}" fill="none"${O}${L}>${H}</svg>`}}});function GQ($,...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 h3;var u3=D(()=>{h3={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??GQ($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=G.region??GQ($,"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 q9($,...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 d3;var m3=D(()=>{d3={name:"TransitionGroup",aliases:["transition-group"],render($,X,Z){let J=(q9($,"name")||"v").replace(/["'<>]/g,""),Y=(q9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=q9($,"class"),Q=q9($,"id"),w=[`data-stx-transition-group="${J}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${Y} ${w}>${X}</${Y}>`}}});function wQ(){n0.registerBuiltin(F3),n0.registerBuiltin(T3),n0.registerBuiltin(k3),n0.registerBuiltin(D3),n0.registerBuiltin(b3),n0.registerBuiltin(C3),n0.registerBuiltin(v3),n0.registerBuiltin(f3),n0.registerBuiltin(h3),n0.registerBuiltin(d3)}var WQ=D(()=>{V3();M3();I3();y3();S3();P3();x3();g3();u3();m3();O3();V3();M3();I3();y3();S3();P3();x3();g3();u3();m3()});function K9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function qQ($,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}`,O=`</${W}>`,L=1,_=U,F=-1;while(L>0&&_<$.length){let R=$.indexOf(H,_),N=$.indexOf(O,_);if(N===-1)break;if(R!==-1&&R<N){let I=$[R+H.length];if(I===" "||I===">"||I==="/"||I===`
12578
+ `||I==="\t")L++;_=R+H.length}else{if(L--,L===0){F=N;break}_=N+O.length}}if(F===-1){Y=U;continue}let V=$.slice(U,F),A=F+O.length;J.push({fullMatch:$.slice(G,A),tagName:W,attributes:B,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),Y=A}}return J}function KQ($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function zQ($,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 UQ=D(()=>{y0();A0();x1()});var FQ={};t(FQ,{processESImports:()=>OQ,processComponents:()=>U9});import z9 from"fs";import a0 from"path";function rH($,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=t0(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(_2),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]=zQ(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(!q0(j)){if(Z.debug)console.error(`Unsafe expression in :${U} binding: ${j}`);J.clientReactive[U]=j;continue}let B=Object.keys(X),O=K0(j,B)(...Object.values(X));if(O===void 0){let L=j.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],_=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(L.some((V)=>!_.has(V)&&!B.includes(V))){J.clientReactive[U]=j;continue}}if(J.serverDynamic[U]=O,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(q0(j)){let H=K0(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 O=H[1];if(!q0(O)){if(Z.debug)console.error(`Unsafe expression in ${z}: ${O}`);continue}let _=K0(O,Object.keys(X))(...Object.values(X));j=j.replace(H[0],String(_??""))}catch(O){if(Z.debug)console.error(`Error evaluating expression in ${z}:`,O)}W(z,j)}continue}W(z,K===_5?"true":KQ(K))}return J}function sH($,X,Z){if(!$.includes("@"))return $;if(!oH.some(([Y,G])=>Y.test($)&&$.includes(G)))return $;try{return E1($,X,Z)}catch{return $}}function aH($){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 BQ($){return Object.entries($).map(([X,Z])=>Z===_5?X:`${X}="${tH(Z)}"`).join(" ")}function tH($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function eH($){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(n0.isBuiltin(Y))X.add(Y)}return[...X].sort()}function $_($){let X=HQ.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=z9.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 HQ.set($,Z),Z}function X_($,X){if($.startsWith(".")||$.startsWith("/"))return null;let Z=X;while(!0){let J=a0.join(Z,"node_modules",$);try{if(z9.statSync(J).isDirectory())return J}catch{}let Y=a0.dirname(Z);if(Y===Z)return null;Z=Y}}async function OQ($,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[O,L,_,F]=B,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let I=a0.resolve(Q,F);if(I.endsWith(".stx"))A=I;else{let T=`${I}.stx`;try{if(z9.statSync(T).isFile())A=T}catch{try{if(z9.statSync(I).isDirectory())V=I}catch{}}}}else V=X_(F,Q);if(!V&&!A)continue;let R=!1,N=(I,T)=>{G.set(I,T),G.set(I.toLowerCase(),T);let k=I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(k,T),Y.add(T)};if(_&&A)N(_,A),R=!0;else if(L){let I=L.slice(1,-1).split(",").map((k)=>k.trim()).filter(Boolean).map((k)=>{let E=k.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:k,local:k}}),T=V?$_(V):null;for(let{source:k,local:E}of I){let M=null;if(A)M=A;else if(T)M=T.get(k)??T.get(k.toLowerCase())??T.get(k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(M)N(E,M),R=!0}}if(R)H.push({start:B.index,end:B.index+O.length})}if(H.length===0)return q;for(let O=H.length-1;O>=0;O--)j=j.slice(0,H[O].start)+j.slice(H[O].end);return`<script${K}>${j}</script>`}),w}async function Z_($,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$/,""),O=H.includes("-")?H.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),L=null,_=[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 _)try{if(await Bun.file(F).exists()){L=F;break}}catch{}if(L){Q.set(O,L),Q.set(H,L),Q.set(H.toLowerCase(),L);let F=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,L),Y.add(L),J.debug)console.log(`Imported component: ${O} -> ${L}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${U}`)}G=G.replace(q,""),w.lastIndex=0}return G}async function J_($,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,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let L=O[1],_,F=B.slice(O[0].length),V=F.match(/^\s*,\s*/);if(V)_=F.slice(V[0].length).trim();let A={};if(_)try{A=D0(_,X)}catch(E){let M=E instanceof Error?E.message:String(E);G=G.replace(G.substring(K,H),`[Error parsing component props: ${M}]`);continue}let R="",N=H,T=G.substring(H).match(/^([\s\S]*?)@endcomponent/);if(T)R=T[1].trim(),N=H+T[0].length;let k=await q5(L,A,R,Q,X,Z,J,w,Y);G=G.substring(0,K)+k+G.substring(N),W.lastIndex=0}return G}async function Y_($,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,nH),G=S5(G,W.scripts),G;async function U(j,B,H,O){if(!j)return j;let L=j,_=qQ(L,B,O);for(let F=_.length-1;F>=0;F--){let V=_[F],A=H?K9(V.tagName):V.tagName,R=aH(sH(V.attributes,X,Z)),N=rH(R,X,J),I=n0.getBuiltin(V.tagName),T=I?await _$(A,Q,X,Z,J):!1;if(I&&!T){let S={context:X,filePath:Z,options:J,dependencies:Y},b=I.render(N,V.content,S);if(Object.keys(N.clientReactive).length>0)b=_Q(b,N.clientReactive);if(Object.keys(N.events).length>0){let y=BQ(N.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}L=L.substring(0,V.startIndex)+b+L.substring(V.endIndex);continue}if(!H&&V.tagName.includes("-")&&!await _$(A,Q,X,Z,J))continue;let k={};for(let[S,b]of Object.entries(N.static))k[S]=b;for(let[S,b]of Object.entries(N.serverDynamic))k[S]=b;let M=await q5(A,k,S5(V.content,W.scripts),Q,X,Z,J,w,Y);if(Object.keys(N.clientReactive).length>0)M=_Q(M,N.clientReactive);if(Object.keys(N.events).length>0){let S=LQ(M);if(S){let b=BQ(N.events),y=Object.keys(N.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");M=M.substring(0,S.insertPos)+` data-stx-parent-events="${y}" ${b}`+M.substring(S.insertPos)}}L=L.substring(0,V.startIndex)+M+L.substring(V.endIndex)}return L}}function _Q($,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])=>K9(K)).join(" "),Q=$,w=Y.length>0?LQ(Q):null;if(w){let K=Y.map(([U,j])=>`:${K9(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 LQ($){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 U9($,X,Z,J,Y){if(!jQ)wQ(),jQ=!0;let G=await OQ($,X,Z,J,Y);G=await Z_(G,X,Z,J,Y),G=await J_(G,X,Z,J,Y);let Q=[];for(let w=0;w<3;w++){let W=z1(G,f7,(K,z)=>`\x00STX_COMPONENT_COMMENT_${Q.length+z}\x00`);Q.push(...W.tokens);let q=G;if(G=await Y_(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=eH(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 jQ=!1,nH,oH,HQ;var c3=D(()=>{O3();$8();WQ();UQ();x1();A0();y0();J1();nH=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"]);oH=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];HQ=new Map});var kQ={};t(kQ,{processLoops:()=>p3,parseLoopBinding:()=>l3});function w_($,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=P0($,"(",")",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=D0(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 W_($,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 O=B.slice(H[0].length).trim();if(!O)continue;try{let L=D0(O,X),_=JSON.stringify(L),F=`@component('${j}', ${_})`;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 j9($,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 q_($,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);f8(G);let q=K0(G,Q)(...w),K=JSON.stringify(q),z=Buffer.from(K,"utf8").toString("base64");return`__stx_${Y}="${z}"`}catch(Q){return J}}),Z}function K_($,X){let Z=$;return Z=j9(Z,"@break",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(q0(G)){let w=K0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(w0(G,X));return Q?B9:""}catch{return""}}),Z=j9(Z,"@continue",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(q0(G)){let w=K0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(w0(G,X));return Q?H9:""}catch{return""}}),Z}function z_($){let X=$;return X=X.replace(/@break(?!\()/g,B9),X=X.replace(/@continue(?!\()/g,H9),X}function VQ($){let X=$.includes(B9),Z=X?$.substring(0,$.indexOf(B9)):$;return{hasBreak:X,content:Z}}function AQ($){let X=$.includes(H9),Z=X?$.substring(0,$.indexOf(H9)):$;return{hasContinue:X,content:Z}}function NQ($){let X=$;return X=j9(X,"@break",(Z)=>{let J=Z.trim();if(!g8(J))return"";return`\`; if (${J}) { break; } result += \``}),X=j9(X,"@continue",(Z)=>{let J=Z.trim();if(!g8(J))return"";return`\`; if (${J}) { continue; } result += \``}),X=X.replace(/@break(?!\()/g,"`; break; result += `"),X=X.replace(/@continue(?!\()/g,"`; continue; result += `"),X}function U_($){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),O=l3(H);if(!O)continue;let{arrayExpr:L,itemVar:_}=O,F=B+1,V=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,I=-1;while(V>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let b=R.exec($),y=N.exec($);if(!y)break;if(b&&b.index<y.index)V++,A=b.index+b[0].length;else{if(V--,V===0){I=y.index;break}A=y.index+11}}if(I===-1)continue;let T=$.substring(F,I),k=I+11,E=-1,M=0,S=0;while(S<T.length){let b=T.indexOf("@",S);if(b===-1)break;let y=T.substring(b);if(/^@forelse\s*\(/.test(y))M++,S=b+1;else if(y.startsWith("@endforelse"))M--,S=b+11;else if(M===0&&y.startsWith("@empty")){if(T.length<=b+6||!/[a-z]/i.test(T[b+6])){E=b;break}S=b+1}else S=b+1}if(E===-1)continue;return{start:K,end:k,arrayExpr:L,itemVar:_,foreachContent:T.substring(0,E),emptyContent:T.substring(E+6)}}return null}function RQ($,X){let Z=$;while(!0){let J=U_(Z);if(!J)break;let{start:Y,end:G,arrayExpr:Q,itemVar:w,foreachContent:W,emptyContent:q}=J;try{let K;if(q0(Q))K=K0(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=Y0("Forelse",`Error in @forelse(${Q} as ${w}): ${z}`,o.EVALUATION_ERROR);Z=Z.substring(0,Y)+U+Z.substring(G)}}return Z}function l3($){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 p3($,X,Z,J){let Y=$;Y=RQ(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 O=W.substring(U+1,H),L=l3(O);if(!L)continue;let _=z,{arrayExpr:F,itemVar:V}=L,A=H+1,R=1,N=A,I=/@foreach\s*\(/g,T=/@endforeach/g;while(R>0&&N<W.length){I.lastIndex=N,T.lastIndex=N;let k=I.exec(W),E=T.exec(W);if(!E)break;if(k&&k.index<E.index)R++,N=k.index+k[0].length;else{if(R--,R===0){let M=W.substring(A,E.index),S=E.index+11;return{start:_,end:S,arrayExpr:F,itemVar:V,content:M}}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:O}=z;try{let L=B.trim(),_;if(q0(L))_=K0(L,Object.keys(q))(...Object.values(q));else _=w0(L,q);let F=!1;if(!Array.isArray(_))if(_ instanceof Map)_=Array.from(_),F=!0;else if(_ instanceof Set)_=Array.from(_);else if(typeof _==="string")_=Array.from(_);else if(_&&typeof _==="object"&&!(_ instanceof Date)&&!(_ instanceof RegExp))_=Object.entries(_),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=Y0("Foreach",`Error in @foreach: ${L} is not iterable`,o.TYPE_ERROR);K=K.substring(0,U)+E+K.substring(j);continue}let V=J?.loops?.useAltLoopVariable??Q_,A=H.trim(),R=null,N,I=!1;if(A.includes("=>")){let E=A.split("=>").map((M)=>M.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((M)=>M.trim());if(E.length===2&&E[0]&&E[1])N=E[0],R=E[1],I=!0;else N=A}else N=A;let T="",k=_;for(let E=0;E<k.length;E++){let M=k[E],S={index:E,iteration:E+1,first:E===0,last:E===k.length-1,count:k.length},b={...q,loop:S,$loop:S};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((i)=>i.trim());if(Array.isArray(M))f.forEach((i,c)=>{if(i)b[i]=M[c]});else b[N]=M}else b[N]=M;if(R)if(!I&&F&&Array.isArray(M)&&M.length===2)b[R]=M[0],b[N]=M[1];else b[R]=E;let y=K_(O,b),P=AQ(y);if(P.hasContinue){T+=P.content;continue}let v=VQ(y);if(v.hasBreak){T+=v.content;break}if(y=RQ(y,b),y=Q(y,b),y=E1(y,b,Z),y=z_(y),v=VQ(y),v.hasBreak){T+=v.content;break}if(P=AQ(y),P.hasContinue){T+=P.content;continue}y=f1(y,b,Z),y=q_(y,b),y=W_(y,b),y=w_(y,b),T+=y}K=K.substring(0,U)+T+K.substring(j)}catch(L){let _=Y0("Foreach",`Error in @foreach(${B.trim()} as ${H.trim()}): ${L instanceof Error?L.message:String(L)}`,o.EVALUATION_ERROR);K=K.substring(0,U)+_+K.substring(j)}}return K}Y=Q(Y,X),Y=MQ(Y,X,Z,J);let w=J?.loops?.maxWhileIterations??G_;return Y=H_(Y,X,w),Y}function TQ($){return g8($)}function MQ($,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=P0(Y,"(",")",W);if(q===-1)break;let K=Y.slice(W+1,q),z=q+1,U=n8(Y.slice(w),"for","endfor");if(U.length===0)break;let j=U[0].content,B=w+U[0].end;if(!TQ(K)){let H=Y0("For",`Unsafe expression in @for: ${K}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,w)+H+Y.substring(B),G=!0;continue}try{let H=j_(K),O=/@(?:for|foreach|if|unless)\s*\(/.test(j);if(H.length>0&&O){let R=B_({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),_=Object.values(X),F=j.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=NQ(F);let A=Function(...L,`
12561
12579
  let result = '';
12562
12580
  for (${K}) {
12563
12581
  result += \`${F}\`;
12564
12582
  }
12565
12583
  return result;
12566
- `)(..._);Y=Y.substring(0,w)+A+Y.substring(j),G=!0}catch(H){let O=Y0("For",`Error in @for(${K}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Y=Y.substring(0,w)+O+Y.substring(j),G=!0}}return Y}function K_($){let X=$.trim(),Z=X.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Z){let G=Z[1];return G.slice(1,-1).split(",").map((w)=>{let W=w.trim();if(!W)return"";let q=W.indexOf(":");if(q>=0&&G.startsWith("{")){let U=W.slice(q+1).trim(),B=U.indexOf("=");return(B>=0?U.slice(0,B):U).trim()}let K=W.indexOf("="),z=(K>=0?W.slice(0,K):W).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let J=X.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let Y=X.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Y)return[Y[1]];return[]}function z_($){let{forExpr:X,content:Z,iterVarNames:J,context:Y,filePath:G,options:Q}=$,w=Object.keys(Y),W=Object.values(Y),q=Function(...w,"__pushIter",`
12584
+ `)(..._);Y=Y.substring(0,w)+A+Y.substring(B),G=!0}catch(H){let O=Y0("For",`Error in @for(${K}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Y=Y.substring(0,w)+O+Y.substring(B),G=!0}}return Y}function j_($){let X=$.trim(),Z=X.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Z){let G=Z[1];return G.slice(1,-1).split(",").map((w)=>{let W=w.trim();if(!W)return"";let q=W.indexOf(":");if(q>=0&&G.startsWith("{")){let U=W.slice(q+1).trim(),j=U.indexOf("=");return(j>=0?U.slice(0,j):U).trim()}let K=W.indexOf("="),z=(K>=0?W.slice(0,K):W).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let J=X.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(J)return[J[1]];let Y=X.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Y)return[Y[1]];return[]}function B_($){let{forExpr:X,content:Z,iterVarNames:J,context:Y,filePath:G,options:Q}=$,w=Object.keys(Y),W=Object.values(Y),q=Function(...w,"__pushIter",`
12567
12585
  for (${X}) {
12568
12586
  __pushIter([${J.join(", ")}])
12569
12587
  }
12570
- `),K=[];q(...W,(B)=>{K.push(B)});let z=G??"inline.stx",U="";for(let B of K){let j={...Y};J.forEach((O,L)=>{j[O]=B[L]});let H=RQ(Z,j,G,Q);H=E1(H,j,z),H=f1(H,j,z),U+=H}return U}function U_($,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=P0(J,"(",")",w);if(W===-1)break;let q=J.slice(w+1,W),K=i8(J.slice(Q),"while","endwhile");if(K.length===0)break;let z=K[0].content,U=Q+K[0].end;if(!AQ(q)){let B=Y0("While",`Unsafe expression in @while: ${q}`,o.UNSAFE_EXPRESSION);J=J.substring(0,Q)+B+J.substring(U),Y=!0;continue}try{let B=Object.keys(X),j=Object.values(X),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(_,F)=>{return`\${${F}}`});H=VQ(H);let L=Function(...B,`
12588
+ `),K=[];q(...W,(j)=>{K.push(j)});let z=G??"inline.stx",U="";for(let j of K){let B={...Y};J.forEach((O,L)=>{B[O]=j[L]});let H=MQ(Z,B,G,Q);H=E1(H,B,z),H=f1(H,B,z),U+=H}return U}function H_($,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=P0(J,"(",")",w);if(W===-1)break;let q=J.slice(w+1,W),K=n8(J.slice(Q),"while","endwhile");if(K.length===0)break;let z=K[0].content,U=Q+K[0].end;if(!TQ(q)){let j=Y0("While",`Unsafe expression in @while: ${q}`,o.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,(_,F)=>{return`\${${F}}`});H=NQ(H);let L=Function(...j,`
12571
12589
  let result = '';
12572
12590
  let maxIterations = ${Z}; // Configurable safety limit
12573
12591
  let counter = 0;
@@ -12579,8 +12597,8 @@ ${I}
12579
12597
  result += '<!-- [While Error [1104]]: Maximum iterations (${Z}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
12580
12598
  }
12581
12599
  return result;
12582
- `)(...j);J=J.substring(0,Q)+L+J.substring(U),Y=!0}catch(B){let j=Y0("While",`Error in @while(${q}): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR);J=J.substring(0,Q)+j+J.substring(U),Y=!0}}return J}var Z_=1000,J_=!1,H9="<!--__STX_BREAK__-->",_9="<!--__STX_CONTINUE__-->";var p3=D(()=>{e7();k1();B1();n8();y0()});import _0 from"path";function i3($,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 j_($,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 B_($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function MQ($){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]!==`
12583
- `)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 j=z[2];if(!J.has(j))Z.push(j),J.add(j);return}let U=X.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(U){let j=U[1];if(!J.has(j))Z.push(j),J.add(j);return}let B=X.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!J.has(j))Z.push(j),J.add(j)}};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 kQ($,X=""){let Z=MQ($).split(",").map((J)=>J.trim()).filter(Boolean);return`
12600
+ `)(...B);J=J.substring(0,Q)+L+J.substring(U),Y=!0}catch(j){let B=Y0("While",`Error in @while(${q}): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR);J=J.substring(0,Q)+B+J.substring(U),Y=!0}}return J}var G_=1000,Q_=!1,B9="<!--__STX_BREAK__-->",H9="<!--__STX_CONTINUE__-->";var i3=D(()=>{$8();k1();B1();r8();y0()});import O0 from"path";function n3($,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 __($,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 O_($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function EQ($){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
+ `)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 DQ($,X=""){let Z=EQ($).split(",").map((J)=>J.trim()).filter(Boolean);return`
12584
12602
  (function() {
12585
12603
  ${I5("var",Z)}
12586
12604
  var __destroyHooks = [];
@@ -12589,11 +12607,11 @@ ${I}
12589
12607
 
12590
12608
  ${$}
12591
12609
  ${X}})();
12592
- `}function IQ($,X){return`
12610
+ `}function yQ($,X){return`
12593
12611
  // Register scope variables for STX runtime
12594
12612
  if (!window.stx._scopes) window.stx._scopes = {};
12595
12613
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
12596
- ${MQ($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeRegistration[${JSON.stringify(G)}] = ${G}; } catch (e) { /* not actually top-level */ }`).join(`
12614
+ ${EQ($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeRegistration[${JSON.stringify(G)}] = ${G}; } catch (e) { /* not actually top-level */ }`).join(`
12597
12615
  `)}
12598
12616
  // #1767: when the bundler renamed a component const that collided with an
12599
12617
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -12601,7 +12619,7 @@ ${MQ($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
12601
12619
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
12602
12620
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
12603
12621
  window.stx._scopes['${X}'] = __scopeRegistration;
12604
- `}function H_($,X){let Z=IQ($,X),J=`
12622
+ `}function L_($,X){let Z=yQ($,X),J=`
12605
12623
  (function() {
12606
12624
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${X}"]') : null;
12607
12625
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -12610,74 +12628,74 @@ ${MQ($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
12610
12628
  } finally {
12611
12629
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
12612
12630
  }
12613
- })();`;return J+kQ($,Z)+`
12631
+ })();`;return J+DQ($,Z)+`
12614
12632
  } finally {
12615
12633
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
12616
12634
  }
12617
- })();`}function __($,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 L_($){if($.__onceStore instanceof Set)return $.__onceStore;return O_}async function n3($,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=j_($,"@partial","@include"),W=L_(X);w=w.replace(/@once([\s\S]*?)@endonce/g,(H,O,L)=>{let _=O.trim(),F=`${Z}:${_}`;if(W.has(F))return"";return W.add(F),O});{let H=/@includeIf\s*\(/g,O;while((O=H.exec(w))!==null){let L=O.index,_=L+O[0].length-1,F=1,V=_+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(_+1,V-1),R=A.match(/^\s*['"]([^'"]+)['"]/);if(!R){H.lastIndex=V;continue}let N=R[1],T=q(N,Q,Z),M="";if(T&&await Bun.file(T).exists())Y.add(T),M=`@include(${A})`;w=w.substring(0,L)+M+w.substring(V),H.lastIndex=0}}for(let[H,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),_;while((_=L.exec(w))!==null){let F=_.index,V=F+_[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),T=i3(N,0);if(T===-1){L.lastIndex=R;continue}let M=N.substring(0,T).trim(),k=N.substring(T+1).trim(),E=k.match(/^\s*['"]([^'"]+)['"]/);if(!E){L.lastIndex=R;continue}let I=E[1],S=k.substring(E[0].length),b,y=i3(S,0);if(y!==-1)b=S.substring(y+1).trim();try{let P=`Boolean(${M})`,f;if(q0(P)){let u=K0(P,Object.keys(X));f=Boolean(u(...Object.values(X)))}else f=Boolean(Q0(P,X));let x=O?!f:f,p="";if(x){let u=q(I,Q,Z);if(u&&await Bun.file(u).exists())Y.add(u);p=`@include('${I}'${b?`, ${b}`:""})`}w=w.substring(0,F)+p+w.substring(R),L.lastIndex=0}catch(P){let f=P instanceof Error?P.message:String(P),x=H0("Include",`Error evaluating ${H} condition: ${f}`,Z,$,F);w=w.substring(0,F)+x+w.substring(R),L.lastIndex=0}}}{let H=/@each\s*\(/g,O;while((O=H.exec(w))!==null){let L=O.index,_=L+O[0].length-1,F=1,V=_+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(_+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[,T,M,k,E]=N;try{let I,S=M.trim();if(q0(S))I=K0(S,Object.keys(X))(...Object.values(X));else I=Q0(S,X);let b="";if(Array.isArray(I)&&I.length>0)for(let y of I){let P={...X,[k]:y},f=await U(T,P,$,L);b+=f}else if(E)b=await U(E,{},$,L);w=w.substring(0,L)+b+w.substring(V+1),H.lastIndex=0}catch(I){let S=I instanceof Error?I.message:String(I);w=w.substring(0,L)+H0("Each",`Error in @each: ${S}`,Z,$,L)+w.substring(V+1),H.lastIndex=0}}}{let H=/@includeFirst\s*\(/g,O;while((O=H.exec(w))!==null){let L=O.index,_=L+O[0].length-1,F=1,V=_+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(_+1,V),R=w.substring(L,V+1),N=A.match(/^\s*(\[[^\]]+\])/);if(!N){H.lastIndex=0,w=w.replace(R,"");continue}let T=N[1],M=A.slice(N[0].length),k,E=M.match(/^\s*,\s*\{/);if(E){M=M.slice(E[0].length-1);let b=1,y=1;while(y<M.length&&b>0){if(M[y]==="{")b++;else if(M[y]==="}"){if(b--,b===0)break}y++}k=M.substring(0,y+1),M=M.slice(y+1)}let I,S=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(S)I=S[1];try{let b=JSON.parse(T.replace(/'/g,'"')),y={};if(k)try{y=D0(k,X)}catch(f){let x=f instanceof Error?f.message:String(f);if(J.debug){let p=H0("Include",`Error parsing includeFirst variables: ${x}`,Z,$,L,R);w=w.replace(R,()=>p)}else w=w.replace(R,()=>I||"");continue}let P=!1;for(let f of b){let x=q(f,Q,Z);if(!x)continue;if(await e(x)){let p=await U(f,y,$,L);w=w.replace(R,()=>p),P=!0;break}}if(!P)if(I!==void 0)w=w.replace(R,()=>I);else if(J.debug){let f=H0("Include",`None of the includeFirst paths exist: ${T}`,Z,$,L,R);w=w.replace(R,()=>f)}else w=w.replace(R,"")}catch(b){let y=b instanceof Error?b.message:String(b),P=H0("Include",`Error processing @includeFirst: ${y}`,Z,$,L,R);w=w.replace(R,()=>P)}H.lastIndex=0}}function q(H,O,L){try{let _=H;if(!H.endsWith(".stx"))_=`${H}.stx`;let F=_0.resolve(O),V=_0.resolve(_0.dirname(L)),A;if(!_.startsWith("./")&&!_.startsWith("../"))A=_0.resolve(O,_);else A=_0.resolve(V,_);let R=_0.normalize(A),N=R.startsWith(F+_0.sep)||R===F,T=R.startsWith(V+_0.sep)||R===V,M=!1,k=_0.dirname(V);if(R.startsWith(k+_0.sep)){if(!_0.relative(k,R).split(_0.sep).some((b)=>b.startsWith(".")&&b!=="."&&b!==".."))M=!0}if(!N&&!T&&!M)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(_){return console.error(`Error resolving path ${H}: ${_}`),null}}let K=_0.resolve(Z);G.add(K);function z(H,O,L,_){return J.onIncludeError?.({includePath:H,templatePath:Z,message:O,partialsDir:Q}),H0("Include",O,Z,L,_)}async function U(H,O={},L,_){let F=q(H,Q,Z);if(!F)return z(H,`Could not resolve path for include: ${H}`,L,_);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,_)}try{Y.add(F);let A;if(!A)try{A=await Bun.file(F).text()}catch(x){let p=x instanceof Error?x.message:String(x);return z(H,`Error loading include file ${H}: ${p}`,L,_)}if(A)A=A.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(A&&A.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (U3(),z3));A=x(A,X)}if(A&&(J.debug||!r7()&&!d$()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (B3(),pG));x(A,F)}catch{}let R=A;try{let{processESImports:x}=await Promise.resolve().then(() => (m3(),_Q));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=m8(R);if(N)R=N.content.trim();let M=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k="";if(M)k=`<style${M[1]}>${M[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,p]of Object.entries(O))E[x]=p;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...A.matchAll(I)],b="",y=null;for(let x of S){let p=x[1]||"",u=x[2]||"",R0=p.includes("server"),N0=X5(p),S0="";try{let{extractAndStripCssImports:c,renderVendorStyleTags:W0}=await Promise.resolve().then(() => (x7(),f2)),i=c(u,{filePath:F,projectRoot:process.cwd()});u=i.code,S0=W0(i.styles)}catch(c){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,c instanceof Error?c.message:c)}if(N0&&u.trim())u=Z5(u);if(!R0)try{let{hasUserImports:c,bundleClientScript:W0}=await Promise.resolve().then(() => (D5(),b7));if(c(u))u=await W0(u,F,{projectRoot:process.cwd()})}catch(c){if(J.debug)console.warn(`[stx] bundler skipped for ${F}:`,c instanceof Error?c.message:c)}let O0=B_(u);if(O0&&!R0){y=`stx_scope_${_0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++TQ}`;let c=r0(u),W0=H_(c,y);b+=`${S0}<script data-stx-scoped data-stx-run="always">${W0}</script>
12618
- `;continue}if(R0)try{let{extractVariables:c}=await Promise.resolve().then(() => (d7(),p8));await c(u,E,F)}catch(c){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,c)}if(!R0&&!O0){let c=p.replace(/\bclient\b/i,"").trim();y=`stx_scope_${_0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++TQ}`;let W0=r0(u),i=IQ(W0,y),n0=kQ(W0,i);b+=`${S0}<script data-stx-scoped data-stx-run="always"${c?` ${c}`:""}>${n0}</script>
12619
- `}}if(y){let x=__(R,y);if(R=x.html,x.mergedIntoExisting)b=b.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),y=x.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await n3(R,E,F,J,Y,G);let{processLoops:P}=await Promise.resolve().then(() => (p3(),NQ)),f=P(R,E,F);if(f=E1(f,E,F),f=f1(f,E,F),k)f+=`
12620
- `+k;if(b)f+=`
12621
- `+b;return f}catch(A){let R=A instanceof Error?A.message:String(A);return z(H,`Error processing include ${H}: ${R}`,L,_)}}let B=/@include\s*\(/g,j;while((j=B.exec(w))!==null){let H=j.index,O=H+j[0].length-1,L=1,_=O+1;while(_<w.length&&L>0){if(w[_]==="(")L++;else if(w[_]===")")L--;_++}if(L!==0)break;let F=w.substring(H,_),V=w.substring(O+1,_-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){B.lastIndex=_;continue}let R=A[1],N,T=V.substring(A[0].length),M=i3(T,0);if(M!==-1)N=T.substring(M+1).trim();let k={};if(N)try{k=D0(N,X)}catch(I){let S=I instanceof Error?I.message:String(I);w=w.replace(F,H0("Include",`Error parsing include variables for ${R}: ${S}`,Z,$,H)),B.lastIndex=0;continue}let E=await U(R,k,$,H);w=w.substring(0,H)+E+w.substring(_),B.lastIndex=0}return w}function r3($,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,B=z[1],j=U+z[0].length,H=new RegExp(`@${G}\\(`),O=new RegExp(`@${Q}(?![a-z])`),L=1,_=j,F=-1;while(L>0&&_<W.length){let A=W.slice(_),R=A.match(H),N=A.match(O),T=R?_+R.index:1/0,M=N?_+N.index:1/0;if(T<M)L++,_=T+(R[0].length||1);else if(M<1/0){if(L--,L===0){F=M;break}_=M+Q.length+1}else break}if(F===-1)break;let V=W.slice(j,F);if(!X[B])X[B]=[];if(w)X[B].unshift(V);else X[B].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 o3($,X){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,J)=>{if(!X[J]||X[J].length===0)return"";return X[J].join(`
12622
- `)})}var TQ=0,xI,O_;var EQ=D(()=>{RX();e7();B1();J1();v5();y0();V0();xI=new J5(500),O_=new Set});import*as s3 from"path";async function DQ($,X,Z=""){if(s3.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 bQ($,X,Z,"@js","@endjs")}async function yQ($,X,Z=""){if(s3.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 bQ($,X,Z,"@ts","@endts")}async function bQ($,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},B=Object.keys(U),j=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),_=L.length>0?`return { ${L.join(", ")} };`:"return {};",F=`
12635
+ })();`}function F_($,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 A_($){if($.__onceStore instanceof Set)return $.__onceStore;return V_}async function r3($,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=__($,"@partial","@include"),W=A_(X);w=w.replace(/@once([\s\S]*?)@endonce/g,(H,O,L)=>{let _=O.trim(),F=`${Z}:${_}`;if(W.has(F))return"";return W.add(F),O});{let H=/@includeIf\s*\(/g,O;while((O=H.exec(w))!==null){let L=O.index,_=L+O[0].length-1,F=1,V=_+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(_+1,V-1),R=A.match(/^\s*['"]([^'"]+)['"]/);if(!R){H.lastIndex=V;continue}let N=R[1],I=q(N,Q,Z),T="";if(I&&await Bun.file(I).exists())Y.add(I),T=`@include(${A})`;w=w.substring(0,L)+T+w.substring(V),H.lastIndex=0}}for(let[H,O]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${H.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),_;while((_=L.exec(w))!==null){let F=_.index,V=F+_[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),I=n3(N,0);if(I===-1){L.lastIndex=R;continue}let T=N.substring(0,I).trim(),k=N.substring(I+1).trim(),E=k.match(/^\s*['"]([^'"]+)['"]/);if(!E){L.lastIndex=R;continue}let M=E[1],S=k.substring(E[0].length),b,y=n3(S,0);if(y!==-1)b=S.substring(y+1).trim();try{let P=`Boolean(${T})`,v;if(q0(P)){let c=K0(P,Object.keys(X));v=Boolean(c(...Object.values(X)))}else v=Boolean(w0(P,X));let f=O?!v:v,i="";if(f){let c=q(M,Q,Z);if(c&&await Bun.file(c).exists())Y.add(c);i=`@include('${M}'${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),f=_0("Include",`Error evaluating ${H} condition: ${v}`,Z,$,F);w=w.substring(0,F)+f+w.substring(R),L.lastIndex=0}}}{let H=/@each\s*\(/g,O;while((O=H.exec(w))!==null){let L=O.index,_=L+O[0].length-1,F=1,V=_+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(_+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[,I,T,k,E]=N;try{let M,S=T.trim();if(q0(S))M=K0(S,Object.keys(X))(...Object.values(X));else M=w0(S,X);let b="";if(Array.isArray(M)&&M.length>0)for(let y of M){let P={...X,[k]:y},v=await U(I,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(M){let S=M instanceof Error?M.message:String(M);w=w.substring(0,L)+_0("Each",`Error in @each: ${S}`,Z,$,L)+w.substring(V+1),H.lastIndex=0}}}{let H=/@includeFirst\s*\(/g,O;while((O=H.exec(w))!==null){let L=O.index,_=L+O[0].length-1,F=1,V=_+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(_+1,V),R=w.substring(L,V+1),N=A.match(/^\s*(\[[^\]]+\])/);if(!N){H.lastIndex=0,w=w.replace(R,"");continue}let I=N[1],T=A.slice(N[0].length),k,E=T.match(/^\s*,\s*\{/);if(E){T=T.slice(E[0].length-1);let b=1,y=1;while(y<T.length&&b>0){if(T[y]==="{")b++;else if(T[y]==="}"){if(b--,b===0)break}y++}k=T.substring(0,y+1),T=T.slice(y+1)}let M,S=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(S)M=S[1];try{let b=JSON.parse(I.replace(/'/g,'"')),y={};if(k)try{y=D0(k,X)}catch(v){let f=v instanceof Error?v.message:String(v);if(J.debug){let i=_0("Include",`Error parsing includeFirst variables: ${f}`,Z,$,L,R);w=w.replace(R,()=>i)}else w=w.replace(R,()=>M||"");continue}let P=!1;for(let v of b){let f=q(v,Q,Z);if(!f)continue;if(await e(f)){let i=await U(v,y,$,L);w=w.replace(R,()=>i),P=!0;break}}if(!P)if(M!==void 0)w=w.replace(R,()=>M);else if(J.debug){let v=_0("Include",`None of the includeFirst paths exist: ${I}`,Z,$,L,R);w=w.replace(R,()=>v)}else w=w.replace(R,"")}catch(b){let y=b instanceof Error?b.message:String(b),P=_0("Include",`Error processing @includeFirst: ${y}`,Z,$,L,R);w=w.replace(R,()=>P)}H.lastIndex=0}}function q(H,O,L){try{let _=H;if(!H.endsWith(".stx"))_=`${H}.stx`;let F=O0.resolve(O),V=O0.resolve(O0.dirname(L)),A;if(!_.startsWith("./")&&!_.startsWith("../"))A=O0.resolve(O,_);else A=O0.resolve(V,_);let R=O0.normalize(A),N=R.startsWith(F+O0.sep)||R===F,I=R.startsWith(V+O0.sep)||R===V,T=!1,k=O0.dirname(V);if(R.startsWith(k+O0.sep)){if(!O0.relative(k,R).split(O0.sep).some((b)=>b.startsWith(".")&&b!=="."&&b!==".."))T=!0}if(!N&&!I&&!T)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(_){return console.error(`Error resolving path ${H}: ${_}`),null}}let K=O0.resolve(Z);G.add(K);function z(H,O,L,_){return J.onIncludeError?.({includePath:H,templatePath:Z,message:O,partialsDir:Q}),_0("Include",O,Z,L,_)}async function U(H,O={},L,_){let F=q(H,Q,Z);if(!F)return z(H,`Could not resolve path for include: ${H}`,L,_);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,_)}try{Y.add(F);let A;if(!A)try{A=await Bun.file(F).text()}catch(f){let i=f instanceof Error?f.message:String(f);return z(H,`Error loading include file ${H}: ${i}`,L,_)}if(A)A=A.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(A&&A.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (j3(),U3));A=f(A,X)}if(A&&(J.debug||!r7()&&!m$()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (H3(),rG));f(A,F)}catch{}let R=A;try{let{processESImports:f}=await Promise.resolve().then(() => (c3(),FQ));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=c8(R);if(N)R=N.content.trim();let T=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k="";if(T)k=`<style${T[1]}>${T[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=M1(A);for(let[f,i]of Object.entries(O))E[f]=i;let M=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...A.matchAll(M)],b="",y=null;for(let f of S){let i=f[1]||"",c=f[2]||"",G0=i.includes("server"),S0=X5(i),N0="";try{let{extractAndStripCssImports:u,renderVendorStyleTags:H0}=await Promise.resolve().then(() => (x7(),h2)),r=u(c,{filePath:F,projectRoot:process.cwd()});c=r.code,N0=H0(r.styles)}catch(u){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,u instanceof Error?u.message:u)}if(S0&&c.trim())c=Z5(c);if(!G0)try{let{hasUserImports:u,bundleClientScript:H0}=await Promise.resolve().then(() => (D5(),b7));if(u(c))c=await H0(c,F,{projectRoot:process.cwd()})}catch(u){if(J.debug)console.warn(`[stx] bundler skipped for ${F}:`,u instanceof Error?u.message:u)}let m0=O_(c);if(m0&&!G0){y=`stx_scope_${O0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++IQ}`;let u=r0(c),H0=L_(u,y);b+=`${N0}<script data-stx-scoped data-stx-run="always">${H0}</script>
12636
+ `;continue}if(G0)try{let{extractVariables:u}=await Promise.resolve().then(() => (d7(),i8));await u(c,E,F)}catch(u){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,u)}if(!G0&&!m0){let u=i.replace(/\bclient\b/i,"").trim();y=`stx_scope_${O0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++IQ}`;let H0=r0(c),r=yQ(H0,y),L0=DQ(H0,r);b+=`${N0}<script data-stx-scoped data-stx-run="always"${u?` ${u}`:""}>${L0}</script>
12637
+ `}}if(y){let f=F_(R,y);if(R=f.html,f.mergedIntoExisting)b=b.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),y=f.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await r3(R,E,F,J,Y,G);let{processLoops:P}=await Promise.resolve().then(() => (i3(),kQ)),v=P(R,E,F);if(v=E1(v,E,F),v=f1(v,E,F),k)v+=`
12638
+ `+k;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,_)}}let j=/@include\s*\(/g,B;while((B=j.exec(w))!==null){let H=B.index,O=H+B[0].length-1,L=1,_=O+1;while(_<w.length&&L>0){if(w[_]==="(")L++;else if(w[_]===")")L--;_++}if(L!==0)break;let F=w.substring(H,_),V=w.substring(O+1,_-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=_;continue}let R=A[1],N,I=V.substring(A[0].length),T=n3(I,0);if(T!==-1)N=I.substring(T+1).trim();let k={};if(N)try{k=D0(N,X)}catch(M){let S=M instanceof Error?M.message:String(M);w=w.replace(F,_0("Include",`Error parsing include variables for ${R}: ${S}`,Z,$,H)),j.lastIndex=0;continue}let E=await U(R,k,$,H);w=w.substring(0,H)+E+w.substring(_),j.lastIndex=0}return w}function o3($,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}\\(`),O=new RegExp(`@${Q}(?![a-z])`),L=1,_=B,F=-1;while(L>0&&_<W.length){let A=W.slice(_),R=A.match(H),N=A.match(O),I=R?_+R.index:1/0,T=N?_+N.index:1/0;if(I<T)L++,_=I+(R[0].length||1);else if(T<1/0){if(L--,L===0){F=T;break}_=T+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 s3($,X){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,J)=>{if(!X[J]||X[J].length===0)return"";return X[J].join(`
12640
+ `)})}var IQ=0,dI,V_;var bQ=D(()=>{AX();$8();B1();J1();v5();y0();A0();dI=new J5(500),V_=new Set});import*as a3 from"path";async function SQ($,X,Z=""){if(a3.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 PQ($,X,Z,"@js","@endjs")}async function CQ($,X,Z=""){if(a3.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 PQ($,X,Z,"@ts","@endts")}async function PQ($,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),_=L.length>0?`return { ${L.join(", ")} };`:"return {};",F=`
12623
12641
  ${H}
12624
12642
  ${_}
12625
- `,A=Function(...B,F)(...j);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 B=U instanceof Error?U.message:String(U),j=H0(`${J} Directive`,`Error executing code: ${B}`,Z,$,z,q);console.error(j),G=G.replace(q,"")}return G}var SQ=D(()=>{v5();V0()});function F_($,X="_method"){let Z=$.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${X}" value="${Z}">`}function CQ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(X,Z,J,Y,G)=>{return F_(J,G||"_method")})}async function PQ($,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[^>]*>/,`$&
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 vQ=D(()=>{v5();A0()});function R_($,X="_method"){let Z=$.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${X}" value="${Z}">`}function xQ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(X,Z,J,Y,G)=>{return R_(J,G||"_method")})}async function fQ($,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[^>]*>/,`$&
12626
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>
12627
- `)}}}return G}async function vQ($,X,Z,J){return PQ($,X,Z,J,"before")}async function xQ($,X,Z,J){return PQ($,X,Z,J,"after")}var fQ=D(()=>{B1();V0()});function gQ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(X,Z,J,Y,G)=>{try{let Q=Y?D0(Y,{}):{};return j7(J,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var hQ=D(()=>{S1();S1();y0()});async function uQ($,X){let Z=$.split("/").pop()?.split(".")[0]||"";if(W8.exact[$])for(let J of W8.exact[$])await Promise.resolve(J(X,$));if(W8.exact[Z])for(let J of W8.exact[Z])await Promise.resolve(J(X,$));for(let{pattern:J,callback:Y}of W8.patterns)if(J.test($)||J.test(Z))await Promise.resolve(Y(X,$))}var W8;var dQ=D(()=>{W8={patterns:[],exact:{}}});function R_($){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("/>")||A_.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 mQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((X)=>mQ(X)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,X])=>X).map(([X])=>X).join(" ");return $?String($):""}function cQ($,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(...R_($));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,B=K,j=!1;while((U=z.exec(K))!==null){let H=U[1],O=U[2];if(U2(H))continue;if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let L=Object.keys(X),_=Object.values(X),F=O.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=mQ(A);if(R){let N=B.match(/\sclass="([^"]*)"/);if(N)B=B.replace(N[0],` class="${N[1]} ${R}"`);else B=B.replace(U[0],` class="${R}"`)}else B=B.replace(U[0],"");j=!0;continue}if(V_.has(H)){if(A)B=B.replace(U[0],` ${H}`);else B=B.replace(U[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(U[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(U[0],` ${H}="${R}"`)}j=!0}catch{continue}}if(j){let H=q.endsWith("/>")?" /":"",L=`<${G[1]}${B}${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 V_,A_;var lQ=D(()=>{J1();V_=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),A_=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()&&N_.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 M_($,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 _1($,X){if(X.selfClosing)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};let Z=M_($,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 pQ($,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 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 k_($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function I_($){let X=$,Z=0;while(Z<X.length){let J=O5(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 O=Q.split(",").map((F)=>F.trim()),L=O[0],_=O[1];W=`${w} as ${_} => ${L}`}else W=`${w} as ${Q}`;let q=n1(J.attrs,"v-for"),K=n1(q,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=_1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=r1(U,{...J,start:0,end:J.end-J.start},K),j=`@foreach(${W})
12628
- `,H=`${j}${B}
12629
- @endforeach`;X=X.slice(0,z.outerStart)+H+X.slice(z.outerEnd),Z=z.outerStart+j.length}return X}function E_($){let X=$,Z=0;while(Z<X.length){let J=O5(X,Z);if(!J)break;let Y=a5(J.attrs,"v-if");if(Y===null){Z=J.end;continue}let G=[],Q=_1(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*/),O=H?H[0].length:0,L=O5(X,q+O);if(!L){K=!1;break}let _=a5(L.attrs,"v-else-if"),F=pQ(L.attrs,"v-else");if(_!==null){let V=_1(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:_,outerStart:q,outerEnd:V.outerEnd,element:R,parsedTag:L}),q=V.outerEnd}else if(F){let V=_1(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})
12645
+ `)}}}return G}async function gQ($,X,Z,J){return fQ($,X,Z,J,"before")}async function hQ($,X,Z,J){return fQ($,X,Z,J,"after")}var uQ=D(()=>{B1();A0()});function dQ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(X,Z,J,Y,G)=>{try{let Q=Y?D0(Y,{}):{};return j7(J,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var mQ=D(()=>{S1();S1();y0()});async function cQ($,X){let Z=$.split("/").pop()?.split(".")[0]||"";if(q8.exact[$])for(let J of q8.exact[$])await Promise.resolve(J(X,$));if(q8.exact[Z])for(let J of q8.exact[Z])await Promise.resolve(J(X,$));for(let{pattern:J,callback:Y}of q8.patterns)if(J.test($)||J.test(Z))await Promise.resolve(Y(X,$))}var q8;var lQ=D(()=>{q8={patterns:[],exact:{}}});function M_($){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("/>")||T_.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 pQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((X)=>pQ(X)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,X])=>X).map(([X])=>X).join(" ");return $?String($):""}function iQ($,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(...M_($));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],O=U[2];if(B2(H))continue;if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let L=Object.keys(X),_=Object.values(X),F=O.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=pQ(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(N_.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 N_,T_;var nQ=D(()=>{J1();N_=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),T_=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()&&k_.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 E_($,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=E_($,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 rQ($,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 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 D_($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function y_($){let X=$,Z=0;while(Z<X.length){let J=O5(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 O=Q.split(",").map((F)=>F.trim()),L=O[0],_=O[1];W=`${w} as ${_} => ${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})
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 b_($){let X=$,Z=0;while(Z<X.length){let J=O5(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=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*/),O=H?H[0].length:0,L=O5(X,q+O);if(!L){K=!1;break}let _=a5(L.attrs,"v-else-if"),F=rQ(L.attrs,"v-else");if(_!==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:_,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})
12630
12648
  ${H.element}`);else if(H.type==="else-if")z.push(`@elseif(${H.expr})
12631
12649
  ${H.element}`);else z.push(`@else
12632
12650
  ${H.element}`);z.push("@endif");let U=z.join(`
12633
- `),B=G[0].outerStart,j=G[G.length-1].outerEnd;X=X.slice(0,B)+U+X.slice(j),Z=B+U.length}return X}function D_($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function y_($){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=_1(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=a5(J.attrs,"v-model");if(W===null){Z=J.end;continue}if(T_.has(J.tag)){let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,z=_1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=r1(U,{...J,start:0,end:J.end-J.start},K);X=X.slice(0,z.outerStart)+B+X.slice(z.outerEnd),Z=z.outerStart+B.length}else{let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"");K+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let z=_1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=r1(U,{...J,start:0,end:J.end-J.start},K);X=X.slice(0,z.outerStart)+B+X.slice(z.outerEnd),Z=z.outerStart+B.length}}return X}function b_($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function S_($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function C_($){let X=$,Z=0;while(Z<X.length){let J=O5(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=_1(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 P_($){let X=$,Z=0;while(Z<X.length){let J=O5(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=_1(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 v_($){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 x_($){let X=$,Z=0;while(Z<X.length){let J=O5(X,Z);if(!J)break;if(!pQ(J.attrs,"v-once")){Z=J.end;continue}let Y=n1(J.attrs,"v-once"),G=_1(X,J),Q=X.slice(G.outerStart,G.outerEnd),W=`@once
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 S_($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function C_($){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=a5(J.attrs,"v-model");if(W===null){Z=J.end;continue}if(I_.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 v_($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function x_($){let X=$,Z=0;while(Z<X.length){let J=O5(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=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 f_($){let X=$,Z=0;while(Z<X.length){let J=O5(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=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 g_($){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 h_($){let X=$,Z=0;while(Z<X.length){let J=O5(X,Z);if(!J)break;if(!rQ(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
12634
12652
  ${r1(Q,{...J,start:0,end:J.end-J.start},Y)}
12635
- @endonce`;X=X.slice(0,G.outerStart)+W+X.slice(G.outerEnd),Z=G.outerStart+W.length}return X}function f_($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function g_($){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 iQ($){if(!k_($))return $;let X=$;return X=I_(X),X=E_(X),X=x_(X),X=b_(X),X=S_(X),X=y_(X),X=D_(X),X=g_(X),X=C_(X),X=P_(X),X=v_(X),X=f_(X),X}var N_,T_;var nQ=D(()=>{N_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),T_=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 O9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function rQ($,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 a3.has(G)?G:null}function oQ($){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return X?X[1]:$}function sQ($,X,Z){let J=X.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(h_.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${Z}</${$}>`}async function aQ($,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=rQ(K.expr,X);if(!z||typeof z!=="string"){let _=`<!-- dynamic component: could not resolve "${O9(oQ(K.expr))}" -->`;G=G.slice(0,K.index)+_+G.slice(K.index+K.full.length);continue}if(a3.has(z)){let _=sQ(z,K.attrs,K.slotContent);G=G.slice(0,K.index)+_+G.slice(K.index+K.full.length);continue}let U=K.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(U))!==null){let _=H[1]||H[2],F=H[3];if(H[1])try{B[_]=Q0(F,X)}catch{B[_]=F}else B[_]=F}let O=J.componentsDir||"components",L=await q5(z,B,K.slotContent,O,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),B=`<!-- dynamic component error: ${O9(U)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G=await u_(G,X,Z,J,Y),G}async function u_($,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=rQ(K.expr,X);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${O9(oQ(K.expr))}" -->`;G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length);continue}if(a3.has(z)){let j=sQ(z,K.attrs,"");G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length);continue}let U=J.componentsDir||"components",B=await q5(z,{},"",U,X,Z,J,new Set,Y??new Set);G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}catch(z){let U=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${O9(U)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G}var a3,h_;var tQ=D(()=>{V0();y0();a3=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"]),h_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function p_($){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(!d_.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"||!l_.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"||!c_.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(G!==null&&!m_.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 i_($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function e3($={}){let X=p_($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${i_(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 eQ($,X={}){if($.includes("data-stx-color-mode-boot"))return $;let Z=t3($);if(Z===null)return $;let J=e3(X);return`${$.slice(0,Z)}
12636
- ${J}${$.slice(Z)}`}function t3($){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 o_($){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=r_.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)+`
12637
- ${G[0]}`+Q+$.slice(Z+Y.length)}function $w($){return s_(o_($))}function s_($){let X=n_.exec($);if(!X)return $;let Z=t3($);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=t3(J);if(Y===null)return $;return`${J.slice(0,Y)}
12638
- ${X[0]}${J.slice(Y)}`}var d_,m_,c_,l_,n_,r_;var $6=D(()=>{d_=new Set(["light","dark","auto","system"]),m_=new Set(["auto","system"]),c_=/^[a-z][\w:-]*$/i,l_=/^[\w-]+$/;n_=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),r_=/<meta\b[^>]*\bcharset\b[^>]*>/i});function a_(){if(X6===null)X6=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return X6}function Xw($,X=a_()){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)}
12639
- <meta name="stx-build" content="${X}">${$.slice(J)}`}var X6=null;function D1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function t_($){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 e_($={},X="en"){let Z=[],J=[],Y="",G=X;for(let[w,W]of Object.entries($||{})){if(W==null)continue;let q=w.trim();if(!Jw.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+=` ${F9}="${D1(Y)}"`;if(J.length)Q+=` ${L9}="${D1(J.join(" "))}"`;return Q}function Yw($={},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 Gw($,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(!Jw.test(U))continue;let B=U.toLowerCase();if(B==="class"){let j=(J.class||"").split(/\s+/).filter(Boolean);for(let H of String(z).split(/\s+/).filter(Boolean))if(!j.includes(H))j.push(H),w.push(H);if(!("class"in J))Y.push("class");J.class=j.join(" ");continue}if(!(U in J))Y.push(U);if(J[U]=String(z),B!=="lang")W.push(U)}if(w.length){if(!(F9 in J))Y.push(F9);J[F9]=w.join(" ")}if(W.length){if(!(L9 in J))Y.push(L9);J[L9]=W.join(" ")}let q=Y.map((K)=>` ${K}="${D1(J[K])}"`).join("");return $.replace(Z[0],()=>`<html${q}>`)}function Qw($){if($.includes("data-stx-cloak"))return $;let X=$.lastIndexOf("</head>");if(X===-1)return $;return`${$.slice(0,X)}${Zw}
12640
- ${$.slice(X)}`}function $O($){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 XO($,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,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],j=new Set(G.map(e5).filter(Boolean)),O=[...B.filter((k)=>!j.has(e5(k))),...G].map((k)=>{return` <meta ${t5(k)}>`}).join(`
12653
+ @endonce`;X=X.slice(0,G.outerStart)+W+X.slice(G.outerEnd),Z=G.outerStart+W.length}return X}function u_($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function d_($){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 oQ($){if(!D_($))return $;let X=$;return X=y_(X),X=b_(X),X=h_(X),X=P_(X),X=v_(X),X=C_(X),X=S_(X),X=d_(X),X=x_(X),X=f_(X),X=g_(X),X=u_(X),X}var k_,I_;var sQ=D(()=>{k_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),I_=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 _9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function aQ($,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 t3.has(G)?G:null}function tQ($){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return X?X[1]:$}function eQ($,X,Z){let J=X.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(m_.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${Z}</${$}>`}async function $w($,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=aQ(K.expr,X);if(!z||typeof z!=="string"){let _=`<!-- dynamic component: could not resolve "${_9(tQ(K.expr))}" -->`;G=G.slice(0,K.index)+_+G.slice(K.index+K.full.length);continue}if(t3.has(z)){let _=eQ(z,K.attrs,K.slotContent);G=G.slice(0,K.index)+_+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 _=H[1]||H[2],F=H[3];if(H[1])try{j[_]=w0(F,X)}catch{j[_]=F}else j[_]=F}let O=J.componentsDir||"components",L=await q5(z,j,K.slotContent,O,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: ${_9(U)} -->`;G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length)}}return G=await c_(G,X,Z,J,Y),G}async function c_($,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=aQ(K.expr,X);if(!z||typeof z!=="string"){let B=`<!-- dynamic component: could not resolve "${_9(tQ(K.expr))}" -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length);continue}if(t3.has(z)){let B=eQ(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: ${_9(U)} -->`;G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length)}}return G}var t3,m_;var Xw=D(()=>{A0();y0();t3=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),m_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function r_($){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(!l_.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"||!n_.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"||!i_.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(G!==null&&!p_.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 o_($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function $6($={}){let X=r_($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${o_(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 Zw($,X={}){if($.includes("data-stx-color-mode-boot"))return $;let Z=e3($);if(Z===null)return $;let J=$6(X);return`${$.slice(0,Z)}
12654
+ ${J}${$.slice(Z)}`}function e3($){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 t_($){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=a_.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
+ ${G[0]}`+Q+$.slice(Z+Y.length)}function Jw($){return e_(t_($))}function e_($){let X=s_.exec($);if(!X)return $;let Z=e3($);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=e3(J);if(Y===null)return $;return`${J.slice(0,Y)}
12656
+ ${X[0]}${J.slice(Y)}`}var l_,p_,i_,n_,s_,a_;var X6=D(()=>{l_=new Set(["light","dark","auto","system"]),p_=new Set(["auto","system"]),i_=/^[a-z][\w:-]*$/i,n_=/^[\w-]+$/;s_=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),a_=/<meta\b[^>]*\bcharset\b[^>]*>/i});function $O(){if(Z6===null)Z6=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return Z6}function Yw($,X=$O()){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 Z6=null;function D1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function XO($){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 ZO($={},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+=` ${L9}="${D1(Y)}"`;if(J.length)Q+=` ${O9}="${D1(J.join(" "))}"`;return Q}function ww($={},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 Ww($,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(!(L9 in J))Y.push(L9);J[L9]=w.join(" ")}if(W.length){if(!(O9 in J))Y.push(O9);J[O9]=W.join(" ")}let q=Y.map((K)=>` ${K}="${D1(J[K])}"`).join("");return $.replace(Z[0],()=>`<html${q}>`)}function qw($){if($.includes("data-stx-cloak"))return $;let X=$.lastIndexOf("</head>");if(X===-1)return $;return`${$.slice(0,X)}${Gw}
12658
+ ${$.slice(X)}`}function JO($){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 YO($,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)),O=[...j.filter((k)=>!B.has(e5(k))),...G].map((k)=>{return` <meta ${t5(k)}>`}).join(`
12641
12659
  `),L=Q.map((k)=>{return` <link ${t5(k)}>`}).join(`
12642
12660
  `),_=w.map((k)=>{if(k.src)return` <script ${t5(k,(E)=>E==="content")}></script>`;if(k.content)return` <script>${k.content}</script>`;return""}).filter(Boolean).join(`
12643
- `),F=e_(q,Y),V=Object.entries(z).map(([k,E])=>` ${k}="${D1(String(E))}"`).join(""),A=K?` class="${D1(K)}"`:"",{body:R,hoisted:N}=$O($),T=[O,Z.colorMode?` ${e3(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?U:t_(U)}</title>`,` ${Zw}`,L,_,W?` ${W}`:"",...(Z.styles||[]).map((k)=>` ${k}`),...N.map((k)=>` ${k}`),...(Z.headScripts||[]).map((k)=>` ${k}`),Z.headStack||""].filter(Boolean),M=[R,...(Z.bodyScripts||[]).map((k)=>k),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
12661
+ `),F=ZO(q,Y),V=Object.entries(z).map(([k,E])=>` ${k}="${D1(String(E))}"`).join(""),A=K?` class="${D1(K)}"`:"",{body:R,hoisted:N}=JO($),I=[O,Z.colorMode?` ${$6(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?U:XO(U)}</title>`,` ${Gw}`,L,_,W?` ${W}`:"",...(Z.styles||[]).map((k)=>` ${k}`),...N.map((k)=>` ${k}`),...(Z.headScripts||[]).map((k)=>` ${k}`),Z.headStack||""].filter(Boolean),T=[R,...(Z.bodyScripts||[]).map((k)=>k),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
12644
12662
  <html${F}>
12645
12663
  <head>
12646
- ${T.join(`
12664
+ ${I.join(`
12647
12665
  `)}
12648
12666
  </head>
12649
12667
  <body${A}${V}>
12650
- ${M.join(`
12668
+ ${T.join(`
12651
12669
  `)}
12652
12670
  </body>
12653
- </html>`}function Z6($){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 J6($){return Z6($)}function ww($,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(`
12671
+ </html>`}function J6($){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 Y6($){return J6($)}function Kw($,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(`
12654
12672
  `)}
12655
- ${$.slice(Z)}`}function Ww($,X={},Z={}){if(J6($))return $;return XO($,X,Z)}var Zw="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",L9="data-stx-html-attrs",F9="data-stx-html-class",Jw;var qw=D(()=>{$6();Jw=/^[A-Za-z_:][\w:.-]*$/});import $7 from"path";function Kw($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function zw($,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 Uw($,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(Kw(z))continue;let B=await zw(z,Y,X);if(B)try{let j=await Bun.file(B).text();if(Z.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let O=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:c0()});if(O.outputs.length>0)j=await O.outputs[0].text()}let H=`<script>
12673
+ ${$.slice(Z)}`}function zw($,X={},Z={}){if(Y6($))return $;return YO($,X,Z)}var Gw="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",O9="data-stx-html-attrs",L9="data-stx-html-class",Qw;var Uw=D(()=>{X6();Qw=/^[A-Za-z_:][\w:.-]*$/});import $7 from"path";function jw($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function Bw($,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 Hw($,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(jw(z))continue;let j=await Bw(z,Y,X);if(j)try{let B=await Bun.file(j).text();if(Z.add(j),z.endsWith(".ts")||z.endsWith(".tsx")){let O=await Bun.build({entrypoints:[j],target:"browser",minify:!1,define:h0()});if(O.outputs.length>0)B=await O.outputs[0].text()}let H=`<script>
12656
12674
  // Source: ${z}
12657
- ${j}
12658
- </script>`;J=J.replace(q,H),G.lastIndex=0}catch(j){}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=w.exec(J))!==null){let[q,K,z,U]=W,B=K+U;if(Kw(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let H=await zw(z,Y,X);if(H)try{let O=await Bun.file(H).text();Z.add(H);let L=`<style>
12675
+ ${B}
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(jw(z))continue;if(/rel=["']stylesheet["']/.test(j)||z.endsWith(".css")){let H=await Bw(z,Y,X);if(H)try{let O=await Bun.file(H).text();Z.add(H);let L=`<style>
12659
12677
  /* Source: ${z} */
12660
12678
  ${O}
12661
- </style>`;J=J.replace(q,L),w.lastIndex=0}catch(O){}}}return J}var jw=D(()=>{P1()});function Y6($,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),B=-1,j=0,H=null,O=!1;for(let F=0;F<z.length;F++){let V=z[F];if(O){O=!1;continue}if(V==="\\"&&H){O=!0;continue}if(H){if(V===H)H=null;continue}if(V==='"'||V==="'"||V==="`"){H=V;continue}if(V==="("||V==="["||V==="{")j++;else if(V===")"||V==="]"||V==="}")j--;if(V===","&&j===0){B=F;break}}let L=B>=0?z.substring(0,B).trim():z,_=B>=0?z.substring(B+1).trim():void 0;try{let F=L.trim(),V;if(q0(F))V=K0(F,Object.keys(X))(...Object.values(X));else V=void 0;let A;if(_==="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 G6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Bw($){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 B=z.slice(0,U),j=K+U+8,H=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=H?H[0].length:0,L=B.slice(O),_=B.match(/(\s*)$/),F=_?_[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,T,M="",k]=A,E=`<${T}${M} data-stx-memo="${q}"${k}>`;R=B.slice(0,O)+E+V.slice(N.length)+B.slice(O+V.length)}else R=`${B.slice(0,O)}<div data-stx-memo="${q}">${V}</div>${B.slice(O+V.length)}`;Y.push({start:G,end:j,replacement:R}),Z.lastIndex=j}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 Q6($){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 Hw($){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),B=U.indexOf("</"),j=B>=0?U.slice(0,B):U.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))J+=$.slice(Y,K)+" x-cloak>",Y=K+1}return J+=$.slice(Y),J}function _w($){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 j=`</${Q}>`,H=$.toLowerCase().indexOf(j,G);if(H!==-1)X.lastIndex=H+j.length;continue}let w=G+Y[0].length,W=!1,q=!1,K=-1;while(w<$.length){let j=$[w];if(W){if(j==="'")W=!1}else if(q){if(j==='"')q=!1}else if(j==="'")W=!0;else if(j==='"')q=!0;else if(j===">"){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(!ZO.test(z))continue;let U=$[K-1]==="/",B=U?K-1:K;Z+=`${$.slice(J,B)} x-cloak${U?" ":""}`,J=B}return Z+=$.slice(J),Z}var ZO;var w6=D(()=>{k1();y0();ZO=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function W6($,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 JO){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(`
12662
- `),B=$.split(`
12663
- `),j=[];U.forEach((_,F)=>{if(W.lastIndex=0,W.test(_))j.push(F+1)});let H=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",O=j.slice(0,3).map((_)=>` ${_} | ${(B[_-1]??"").trim().slice(0,100)}`).join(`
12679
+ </style>`;J=J.replace(q,L),w.lastIndex=0}catch(O){}}}return J}var _w=D(()=>{P1()});function G6($,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,O=!1;for(let F=0;F<z.length;F++){let V=z[F];if(O){O=!1;continue}if(V==="\\"&&H){O=!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,_=j>=0?z.substring(j+1).trim():void 0;try{let F=L.trim(),V;if(q0(F))V=K0(F,Object.keys(X))(...Object.values(X));else V=void 0;let A;if(_==="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 Ow($){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*)*)/),O=H?H[0].length:0,L=j.slice(O),_=j.match(/(\s*)$/),F=_?_[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,I,T="",k]=A,E=`<${I}${T} data-stx-memo="${q}"${k}>`;R=j.slice(0,O)+E+V.slice(N.length)+j.slice(O+V.length)}else R=`${j.slice(0,O)}<div data-stx-memo="${q}">${V}</div>${j.slice(O+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 w6($){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 Lw($){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 Fw($){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(!GO.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 GO;var W6=D(()=>{k1();y0();GO=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function q6($,X,Z,J){let Y=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=Y.allowPatterns??[],Q=[],w=t0($.replace(/\{\{--[\s\S]*?--\}\}/g,(W)=>W.replace(/[^\n]/g," ")));for(let{pattern:W,message:q,suggestion:K}of QO){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
+ `),j=$.split(`
12681
+ `),B=[];U.forEach((_,F)=>{if(W.lastIndex=0,W.test(_))B.push(F+1)});let H=B.length>0?` (script line${B.length>1?"s":""} ${B.join(", ")})`:"",O=B.slice(0,3).map((_)=>` ${_} | ${(j[_-1]??"").trim().slice(0,100)}`).join(`
12664
12682
  `),L=O?`
12665
12683
  ${O}`:"";Q.push(` \u2717 ${q}${H}
12666
12684
  \u2192 ${K}${L}`)}}if(Q.length>0&&Y.enabled){let W=(z)=>{let U=`${process.cwd()}/`;return z.startsWith(U)?z.slice(U.length):z},K=`[STX] DOM API violation in ${J&&J!==X?`${W(J)} (composed into ${W(X)})`:W(X)}:
12667
12685
  ${Q.join(`
12668
12686
  `)}
12669
- Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var JO;var q6=D(()=>{JO=[{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 YO from"fs";function V9($){return[...$].sort().map((X)=>{try{let Z=YO.statSync(X);return`${X}:${Z.size}:${Z.mtimeMs}`}catch{return`${X}:missing`}}).join(`
12670
- `)}function A9($,X,Z){let J=$.get(X);return J!==void 0&&J.signature===Z?J.value:void 0}function O1($,X,Z,J){return $.set(X,{signature:Z,value:J}),J}var K6=()=>{};var Ow={};t(Ow,{getStoreScript:()=>QO,clearStoreCache:()=>wO});import R9 from"path";function GO($,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 QO($){let X;if($)X=R9.resolve($);else{let j=await Y1();X=R9.resolve(j.root||process.cwd(),j.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),J=[];try{for await(let j of Z.scan({cwd:X,absolute:!0})){let H=R9.basename(j,".ts");if(["index","types"].includes(H))continue;if(j.includes(".d.ts"))continue;J.push(j)}}catch{return O1(X7,X,"",""),null}let Y=V9(J),G=A9(X7,X,Y);if(G!==void 0)return G||null;if(J.length===0)return O1(X7,X,Y,""),null;let Q=[];for(let j of J){let H=await Bun.file(j).text();Q.push({file:j,hasUseStore:/useStore\s*\(/.test(H)})}Q.sort((j,H)=>{if(j.hasUseStore===H.hasUseStore)return 0;return j.hasUseStore?1:-1});let w=Q.map((j)=>j.file),W=[],q=new Set,K=M1({loader:"ts",target:"browser",define:c0()});for(let j of w)try{let H=await Bun.file(j).text(),O=R9.basename(j,".ts");GO(H,q),H=r0(H),H=D8(H),H=H.replace(/^export\s+(default\s+)?/gm,""),H=K.transformSync(H),W.push(`// Store: ${O}
12671
- ${H.trim()}`)}catch(H){console.warn(`[stx] Failed to load store ${j}:`,H)}if(W.length===0)return O1(X7,X,Y,""),null;let z=W.join(`
12687
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var QO;var K6=D(()=>{QO=[{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 wO from"fs";function F9($){return[...$].sort().map((X)=>{try{let Z=wO.statSync(X);return`${X}:${Z.size}:${Z.mtimeMs}`}catch{return`${X}:missing`}}).join(`
12688
+ `)}function V9($,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 z6=()=>{};var Vw={};t(Vw,{getStoreScript:()=>qO,clearStoreCache:()=>KO});import A9 from"path";function WO($,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 qO($){let X;if($)X=A9.resolve($);else{let B=await Y1();X=A9.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=A9.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=F9(J),G=V9(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:h0()});for(let B of w)try{let H=await Bun.file(B).text(),O=A9.basename(B,".ts");WO(H,q),H=r0(H),H=y8(H),H=H.replace(/^export\s+(default\s+)?/gm,""),H=K.transformSync(H),W.push(`// Store: ${O}
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(`
12672
12690
 
12673
- `),B=`;(function(){
12691
+ `),j=`;(function(){
12674
12692
  var __stx = window.stx || {};
12675
- ${R1.filter((j)=>!q.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
12693
+ ${N1.filter((B)=>!q.has(B)&&new RegExp(`\\b${B}\\b`).test(z)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
12676
12694
  `)}
12677
12695
  ${z}
12678
- })();`;return O1(X7,X,Y,B),B}function wO(){X7.clear()}var X7;var Lw=D(()=>{N1();P1();J1();K6();V0();X7=new Map});var z6,TE;var Fw=D(()=>{z6=["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"],TE=new Set(z6)});var Rw={};t(Rw,{selectComposableFiles:()=>Vw,referencedFrameworkComposables:()=>Aw,getFrameworkComposableScript:()=>zO,clearFrameworkComposableCache:()=>qO,__setRuntimeOwnedForTest:()=>UO});import N9 from"path";function qO(){q8.clear()}function Vw($){let X=new Map;for(let Z of $){let J=N9.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 KO($,X){let Z=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test($)}function Aw($){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 WO){if(U6.has(J))continue;let Y=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${Y}\\s*\\(`).test(X))Z.push(J)}return Z.sort()}async function zO($,X){let Z=Aw($);if(Z.length===0)return null;let J=X??N9.join(import.meta.dir,"composables"),Y=`${J}\x00${Z.join(",")}`,G=q8.get(Y);if(G!==void 0)return G||null;let Q=M1({loader:"ts",target:"browser",define:c0()}),w=new Set(Z),W=[],q=new Set,K=[];try{let j=new Bun.Glob("*.{ts,js}");for await(let H of j.scan({cwd:J,absolute:!0}))K.push(H)}catch{return q8.set(Y,""),null}K=Vw(K);for(let j of K){let H;try{H=await Bun.file(j).text()}catch{continue}let O=[];try{O=Q.scan(H).exports.filter((L)=>L!=="default")}catch{continue}if(!O.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(`// ${N9.basename(j).replace(/\.[jt]s$/,"")}
12679
- ${Q.transformSync(H).trim()}`);for(let L of O)q.add(L)}catch(L){console.warn(`[stx] framework composable ${N9.basename(j)} could not be bundled:`,L)}}let z=Z.filter((j)=>!q.has(j)&&!KO($,j));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 q8.set(Y,""),null;let U=[...q].map((j)=>` try { if (!(${JSON.stringify(j)} in __s)) { __s[${JSON.stringify(j)}] = ${j}; if (!(${JSON.stringify(j)} in window)) window[${JSON.stringify(j)}] = ${j}; } } catch (e) {}`).join(`
12680
- `),B=`<script data-stx-framework-composables>
12696
+ })();`;return L1(X7,X,Y,j),j}function KO(){X7.clear()}var X7;var Aw=D(()=>{T1();P1();J1();z6();A0();X7=new Map});var U6,DE;var Rw=D(()=>{U6=["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"],DE=new Set(U6)});var Mw={};t(Mw,{selectComposableFiles:()=>Nw,referencedFrameworkComposables:()=>Tw,getFrameworkComposableScript:()=>BO,clearFrameworkComposableCache:()=>UO,__setRuntimeOwnedForTest:()=>HO});import R9 from"path";function UO(){K8.clear()}function Nw($){let X=new Map;for(let Z of $){let J=R9.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 jO($,X){let Z=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test($)}function Tw($){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 zO){if(j6.has(J))continue;let Y=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${Y}\\s*\\(`).test(X))Z.push(J)}return Z.sort()}async function BO($,X){let Z=Tw($);if(Z.length===0)return null;let J=X??R9.join(import.meta.dir,"composables"),Y=`${J}\x00${Z.join(",")}`,G=K8.get(Y);if(G!==void 0)return G||null;let Q=H1({loader:"ts",target:"browser",define:h0()}),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 K8.set(Y,""),null}K=Nw(K);for(let B of K){let H;try{H=await Bun.file(B).text()}catch{continue}let O=[];try{O=Q.scan(H).exports.filter((L)=>L!=="default")}catch{continue}if(!O.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(`// ${R9.basename(B).replace(/\.[jt]s$/,"")}
12697
+ ${Q.transformSync(H).trim()}`);for(let L of O)q.add(L)}catch(L){console.warn(`[stx] framework composable ${R9.basename(B)} could not be bundled:`,L)}}let z=Z.filter((B)=>!q.has(B)&&!jO($,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 K8.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
+ `),j=`<script data-stx-framework-composables>
12681
12699
  ;(function(){
12682
12700
  var __s = window.stx = window.stx || {};
12683
12701
  ${W.join(`
@@ -12685,19 +12703,19 @@ ${W.join(`
12685
12703
  `)}
12686
12704
  ${U}
12687
12705
  })();
12688
- </script>`;return q8.set(Y,B),B}function UO($){U6.clear();for(let X of $)U6.add(X)}var q8,U6,WO;var Nw=D(()=>{P1();Fw();V0();q8=new Map,U6=new Set,WO=new Set(z6)});var Mw={};t(Mw,{getComposableScript:()=>_O,clearComposableCache:()=>OO});import K8 from"path";function Tw($){let X=K8.basename($,".ts");return X==="index"||X==="types"||$.endsWith(".d.ts")}async function BO($){if($)return K8.resolve($);let X=`<default>:${process.cwd()}`,Z=j6.get(X);if(Z!==void 0)return Z;let J=await HO();if(J!==null)j6.set(X,J);return J}async function HO(){let $=await Y1(),X=$.root||process.cwd(),Z=$.composablesDir;if(Z)return K8.resolve(X,Z);for(let J of jO){let Y=K8.resolve(X,J);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:Y,absolute:!0}))if(!Tw(Q))return Y}catch{}}return null}async function _O($){let X=await BO($);if(!X)return null;let Z=[];try{let j=new Bun.Glob("**/*.ts");for await(let H of j.scan({cwd:X,absolute:!0})){if(Tw(H))continue;Z.push(H)}}catch{return O1(Z7,X,"",""),null}let J=V9(Z),Y=A9(Z7,X,J);if(Y!==void 0)return Y||null;if(Z.length===0)return O1(Z7,X,J,""),null;Z.sort();let G=M1({loader:"ts",target:"browser",define:c0()}),Q=[],w=new Set,W=new Set;for(let j of Z)try{let H=await Bun.file(j).text(),O=K8.basename(j,".ts");for(let L of H.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])W.add(L[1]);try{for(let L of G.scan(H).exports)if(L!=="default")w.add(L)}catch{}H=r0(H),H=D8(H),H=H.replace(/^export\s+(default\s+)?/gm,""),H=G.transformSync(H),Q.push(`// Composable: ${O}
12689
- ${H.trim()}`)}catch(H){console.warn(`[stx] Failed to load composable ${j}:`,H)}if(Q.length===0||w.size===0)return O1(Z7,X,J,""),null;let q=[...w].map((j)=>` try { __c[${JSON.stringify(j)}] = ${j}; } catch (e) {}`).join(`
12690
- `),K=JSON.stringify([...w]),z=Q.join(`
12706
+ </script>`;return K8.set(Y,j),j}function HO($){j6.clear();for(let X of $)j6.add(X)}var K8,j6,zO;var kw=D(()=>{P1();Rw();A0();K8=new Map,j6=new Set,zO=new Set(U6)});var Ew={};t(Ew,{listComposableModules:()=>LO,getComposableScript:()=>AO,clearComposableCache:()=>RO});import z8 from"path";function H6($){let X=z8.basename($,".ts");return X==="index"||X==="types"||$.endsWith(".d.ts")}async function Iw($){if($)return z8.resolve($);let X=`<default>:${process.cwd()}`,Z=B6.get(X);if(Z!==void 0)return Z;let J=await OO();if(J!==null)B6.set(X,J);return J}async function OO(){let $=await Y1(),X=$.root||process.cwd(),Z=$.composablesDir;if(Z)return z8.resolve(X,Z);for(let J of _O){let Y=z8.resolve(X,J);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:Y,absolute:!0}))if(!H6(Q))return Y}catch{}}return null}async function LO($){let X=await Iw($);if(!X)return[];let Z=[];try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:X,absolute:!0}))if(!H6(Q))Z.push(Q)}catch{return[]}Z.sort();let J=H1({loader:"ts",target:"browser",define:h0()}),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 FO($,X){return new RegExp(`\\b${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\b`).test($)}function VO($,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(FO(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 AO($,X){let Z=await Iw($);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(H6(A))continue;J.push(A)}}catch{return L1(Z7,Z,"",""),null}let Y=F9(J);if(J.length===0)return L1(Z7,Z,Y,""),null;J.sort();let G=H1({loader:"ts",target:"browser",define:h0()}),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):VO(w,Q,X);if(W.size===0)return null;let q=J.filter((V)=>W.has(V)),K=`${Z}\x00${q.join("\x00")}`,z=V9(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=z8.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=y8(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
+ `),O=JSON.stringify([...j]),L=U.join(`
12691
12709
 
12692
- `),B=`;(function(){
12710
+ `),F=`;(function(){
12693
12711
  window.__composables = window.__composables || {};
12694
12712
  var __c = window.__composables;
12695
12713
  var __stx = window.stx || {};
12696
- ${R1.filter((j)=>!W.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
12714
+ ${N1.filter((V)=>!B.has(V)&&new RegExp(`\\b${V}\\b`).test(L)).map((V)=>`var ${V} = __stx[${JSON.stringify(V)}];`).join(`
12697
12715
  `)}
12698
- ${z}
12699
- ${q}
12700
- var __names = ${K};
12716
+ ${L}
12717
+ ${H}
12718
+ var __names = ${O};
12701
12719
  for (var __i = 0; __i < __names.length; __i++) {
12702
12720
  var __n = __names[__i];
12703
12721
  if (!(__n in __c)) continue;
@@ -12710,7 +12728,7 @@ ${q}
12710
12728
  }
12711
12729
  window[__n] = __c[__n];
12712
12730
  }
12713
- })();`;return O1(Z7,X,J,B),B}function OO(){Z7.clear(),j6.clear()}var Z7,j6,jO;var kw=D(()=>{N1();P1();K6();J1();V0();Z7=new Map,j6=new Map,jO=["composables","functions"]});var Ew={};t(Ew,{processDeferDirectives:()=>RO});function LO(){return`stx-defer-${++Iw}`}function FO($){let X=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(X)return{trigger:X[1],value:X[2]};return{trigger:"immediate"}}function VO($,X,Z){let{trigger:J,value:Y}=FO(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 AO($,X){let{trigger:Z,triggerValue:J}=X,Y;switch(Z){case"visible":Y=`
12731
+ })();`;return L1(Z7,K,Y,F),F}function RO(){Z7.clear(),B6.clear()}var Z7,B6,_O;var Dw=D(()=>{T1();P1();z6();J1();A0();Z7=new Map,B6=new Map,_O=["composables","functions"]});var bw={};t(bw,{processDeferDirectives:()=>IO});function NO(){return`stx-defer-${++yw}`}function TO($){let X=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(X)return{trigger:X[1],value:X[2]};return{trigger:"immediate"}}function MO($,X,Z){let{trigger:J,value:Y}=TO(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 kO($,X){let{trigger:Z,triggerValue:J}=X,Y;switch(Z){case"visible":Y=`
12714
12732
  const observer = new IntersectionObserver((entries) => {
12715
12733
  if (entries[0].isIntersecting) {
12716
12734
  observer.disconnect();
@@ -12783,15 +12801,15 @@ else {
12783
12801
  ${Y}
12784
12802
  })();
12785
12803
  </script>
12786
- `}function RO($,X,Z){Iw=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(Y,G,Q)=>{let w=LO(),W=VO(Y,G,Q),q=W.placeholder?`<div data-defer-placeholder>${W.placeholder}</div>`:"",K=W.loading?`<div data-defer-loading style="display: none;">${W.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=W.error?`<div data-defer-error style="display: none;">${W.error}</div>`:"",U=`<div data-defer-content style="display: none;">${W.content}</div>`,B=AO(w,W);return`
12804
+ `}function IO($,X,Z){yw=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(Y,G,Q)=>{let w=NO(),W=MO(Y,G,Q),q=W.placeholder?`<div data-defer-placeholder>${W.placeholder}</div>`:"",K=W.loading?`<div data-defer-loading style="display: none;">${W.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=W.error?`<div data-defer-error style="display: none;">${W.error}</div>`:"",U=`<div data-defer-content style="display: none;">${W.content}</div>`,j=kO(w,W);return`
12787
12805
  <div id="${w}" class="stx-defer" data-defer-trigger="${W.trigger}">
12788
12806
  ${q}
12789
12807
  ${K}
12790
12808
  ${U}
12791
12809
  ${z}
12792
12810
  </div>
12793
- ${B}
12794
- `})}var Iw=0;var yw={};t(yw,{processTeleportDirectives:()=>kO,ensureTeleportTargets:()=>IO});function NO(){return`stx-teleport-${++Dw}`}function TO($){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 MO($,X){return`
12811
+ ${j}
12812
+ `})}var yw=0;var Cw={};t(Cw,{processTeleportDirectives:()=>bO,ensureTeleportTargets:()=>SO});function EO(){return`stx-teleport-${++Sw}`}function DO($){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 yO($,X){return`
12795
12813
  <script>
12796
12814
  (function() {
12797
12815
  const source = document.getElementById('${$}');
@@ -12837,12 +12855,12 @@ else {
12837
12855
  });
12838
12856
  })();
12839
12857
  </script>
12840
- `}function kO($,X,Z){Dw=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(Y,G,Q)=>{let w=NO(),{target:W,disabled:q}=TO(G),K=Q.trim();if(q)try{let U=!1;if(q==="true")U=!0;else if(q==="false")U=!1;else if(q in X)U=Boolean(X[q]);if(U)return`<div class="stx-teleport-inline" data-teleport-disabled>${K}</div>`}catch{}let z=MO(w,W);return`
12858
+ `}function bO($,X,Z){Sw=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(Y,G,Q)=>{let w=EO(),{target:W,disabled:q}=DO(G),K=Q.trim();if(q)try{let U=!1;if(q==="true")U=!0;else if(q==="false")U=!1;else if(q in X)U=Boolean(X[q]);if(U)return`<div class="stx-teleport-inline" data-teleport-disabled>${K}</div>`}catch{}let z=yO(w,W);return`
12841
12859
  <div id="${w}" class="stx-teleport-source" style="display: none;">
12842
12860
  <template>${K}</template>
12843
12861
  </div>
12844
12862
  ${z}
12845
- `})}function IO(){return`
12863
+ `})}function SO(){return`
12846
12864
  <script>
12847
12865
  (function() {
12848
12866
  // Common teleport targets
@@ -12859,7 +12877,7 @@ else {
12859
12877
  });
12860
12878
  })();
12861
12879
  </script>
12862
- `}var Dw=0;var Pw={};t(Pw,{processTransitionDirectives:()=>bO,processTransitionAttributes:()=>vO,performLeave:()=>yO,performEnter:()=>DO,generateTransitionRuntime:()=>PO,generateTransitionCSS:()=>CO});function bw($,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 EO($){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 Sw($,X){return new Promise((Z)=>{let J=X??EO($);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 Cw($){$.offsetHeight}async function DO($,X={}){let Z=X.name||"stx",J=bw(Z,X),Y=typeof X.duration==="object"?X.duration.enter:X.duration;if(X.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),Cw($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),X.onEnter)await new Promise((G)=>{X.onEnter($,G)});else await Sw($,Y);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),X.onAfterEnter?.($)}async function yO($,X={}){let Z=X.name||"stx",J=bw(Z,X),Y=typeof X.duration==="object"?X.duration.leave:X.duration;if(X.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),Cw($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),X.onLeave)await new Promise((G)=>{X.onLeave($,G)});else await Sw($,Y);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),X.onAfterLeave?.($)}function bO($,X={},Z){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(Y,G,Q)=>{let w=SO(G),W=w.name||"stx",q=w.duration||300,K=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
12880
+ `}var Sw=0;var fw={};t(fw,{processTransitionDirectives:()=>xO,processTransitionAttributes:()=>uO,performLeave:()=>vO,performEnter:()=>PO,generateTransitionRuntime:()=>hO,generateTransitionCSS:()=>gO});function Pw($,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 CO($){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 vw($,X){return new Promise((Z)=>{let J=X??CO($);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 xw($){$.offsetHeight}async function PO($,X={}){let Z=X.name||"stx",J=Pw(Z,X),Y=typeof X.duration==="object"?X.duration.enter:X.duration;if(X.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),xw($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),X.onEnter)await new Promise((G)=>{X.onEnter($,G)});else await vw($,Y);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),X.onAfterEnter?.($)}async function vO($,X={}){let Z=X.name||"stx",J=Pw(Z,X),Y=typeof X.duration==="object"?X.duration.leave:X.duration;if(X.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),xw($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),X.onLeave)await new Promise((G)=>{X.onLeave($,G)});else await vw($,Y);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),X.onAfterLeave?.($)}function xO($,X={},Z){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(Y,G,Q)=>{let w=fO(G),W=w.name||"stx",q=w.duration||300,K=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
12863
12881
  <div
12864
12882
  class="stx-transition-wrapper"
12865
12883
  data-transition="${W}"
@@ -12901,7 +12919,7 @@ else {
12901
12919
  });
12902
12920
  })();
12903
12921
  </script>
12904
- `})}function SO($){let X={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3]||J[4]||J[5];switch(Y){case"name":X.name=G;break;case"duration":X.duration=parseInt(G,10);break;case"mode":X.mode=G;break;case"easing":X.easing=G;break}}return X}function CO(){return`
12922
+ `})}function fO($){let X={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,J;while((J=Z.exec($))!==null){let Y=J[1],G=J[2]||J[3]||J[4]||J[5];switch(Y){case"name":X.name=G;break;case"duration":X.duration=parseInt(G,10);break;case"mode":X.mode=G;break;case"easing":X.easing=G;break}}return X}function gO(){return`
12905
12923
  /* STX Transition Presets */
12906
12924
 
12907
12925
  /* Fade */
@@ -13088,7 +13106,7 @@ else {
13088
13106
  opacity: 1;
13089
13107
  max-height: 1000px;
13090
13108
  }
13091
- `}function PO(){return`
13109
+ `}function hO(){return`
13092
13110
  // STX Transition Runtime
13093
13111
  (function() {
13094
13112
  if (typeof window === 'undefined') return;
@@ -13177,7 +13195,7 @@ else {
13177
13195
 
13178
13196
  console.log('[stx] Transition runtime initialized');
13179
13197
  })();
13180
- `}function vO($){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 xw={};t(xw,{withErrorBoundary:()=>vw,processErrorBoundaryDirectives:()=>gO,generateErrorBoundaryRuntime:()=>cO,generateErrorBoundaryCSS:()=>mO,createErrorBoundary:()=>dO});function fO(){return`eb-${++xO}-${Date.now().toString(36)}`}function gO($,X={},Z){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(Y,G,Q,w)=>{let W=fO(),q=hO(G||"");return uO(W,Q.trim(),w.trim(),q)})}function hO($){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 uO($,X,Z,J){let Y=J.logErrors!==!1;return`
13198
+ `}function uO($){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 hw={};t(hw,{withErrorBoundary:()=>gw,processErrorBoundaryDirectives:()=>cO,generateErrorBoundaryRuntime:()=>rO,generateErrorBoundaryCSS:()=>nO,createErrorBoundary:()=>iO});function mO(){return`eb-${++dO}-${Date.now().toString(36)}`}function cO($,X={},Z){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(Y,G,Q,w)=>{let W=mO(),q=lO(G||"");return pO(W,Q.trim(),w.trim(),q)})}function lO($){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 pO($,X,Z,J){let Y=J.logErrors!==!1;return`
13181
13199
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
13182
13200
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
13183
13201
  ${X}
@@ -13297,7 +13315,7 @@ else {
13297
13315
  };
13298
13316
  })();
13299
13317
  </script>
13300
- `}async function vw($,X,Z){try{return await $()}catch(J){if(Z)Z(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return X}}function dO($,X={}){let Z=X.onError?(J)=>X.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>vw(J,$,Z)}function mO(){return`
13318
+ `}async function gw($,X,Z){try{return await $()}catch(J){if(Z)Z(J instanceof Error?J:Error(String(J)));else console.error("[stx:errorBoundary] SSR Error:",J);return X}}function iO($,X={}){let Z=X.onError?(J)=>X.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>gw(J,$,Z)}function nO(){return`
13301
13319
  /* STX Error Boundary Styles */
13302
13320
  .stx-error-boundary {
13303
13321
  position: relative;
@@ -13341,7 +13359,7 @@ else {
13341
13359
  color: #fecaca;
13342
13360
  }
13343
13361
  }
13344
- `}function cO(){return`
13362
+ `}function rO(){return`
13345
13363
  // STX Error Boundary Runtime
13346
13364
  (function() {
13347
13365
  if (typeof window === 'undefined') return;
@@ -13406,7 +13424,7 @@ else {
13406
13424
 
13407
13425
  console.log('[stx] Error boundary runtime initialized');
13408
13426
  })();
13409
- `}var xO=0;var fw={};t(fw,{renderSSRSuspense:()=>sO,processSuspenseDirectives:()=>iO,generateSuspenseRuntime:()=>tO,generateSuspenseCSS:()=>aO,createSSRSuspense:()=>oO});function pO(){return`suspense-${++lO}-${Date.now().toString(36)}`}function iO($,X={},Z){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(Y,G,Q,w)=>{let W=pO(),q=nO(G||"");return rO(W,Q.trim(),w.trim(),q)})}function nO($){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 rO($,X,Z,J){let Y=J.timeout||30000,G=J.id||$;return`
13427
+ `}var dO=0;var uw={};t(uw,{renderSSRSuspense:()=>XL,processSuspenseDirectives:()=>aO,generateSuspenseRuntime:()=>JL,generateSuspenseCSS:()=>ZL,createSSRSuspense:()=>$L});function sO(){return`suspense-${++oO}-${Date.now().toString(36)}`}function aO($,X={},Z){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(Y,G,Q,w)=>{let W=sO(),q=tO(G||"");return eO(W,Q.trim(),w.trim(),q)})}function tO($){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 eO($,X,Z,J){let Y=J.timeout||30000,G=J.id||$;return`
13410
13428
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${G}" data-status="pending">
13411
13429
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
13412
13430
  ${Z}
@@ -13596,7 +13614,7 @@ else {
13596
13614
  }, 0);
13597
13615
  })();
13598
13616
  </script>
13599
- `}function oO($,X,Z){return{id:$,fallback:Z,content:X}}async function sO($){let X=$.map((J)=>`
13617
+ `}function $L($,X,Z){return{id:$,fallback:Z,content:X}}async function XL($){let X=$.map((J)=>`
13600
13618
  <div id="stx-ssr-suspense-${J.id}" class="stx-ssr-suspense">
13601
13619
  ${J.fallback}
13602
13620
  </div>
@@ -13621,7 +13639,7 @@ else {
13621
13639
  }
13622
13640
  })();
13623
13641
  </script>
13624
- `}}return{initial:X,streaming:Z()}}function aO(){return`
13642
+ `}}return{initial:X,streaming:Z()}}function ZL(){return`
13625
13643
  /* STX Suspense Styles */
13626
13644
  .stx-suspense {
13627
13645
  position: relative;
@@ -13677,7 +13695,7 @@ else {
13677
13695
  background-size: 200% 100%;
13678
13696
  }
13679
13697
  }
13680
- `}function tO(){return`
13698
+ `}function JL(){return`
13681
13699
  // STX Suspense Runtime
13682
13700
  (function() {
13683
13701
  if (typeof window === 'undefined') return;
@@ -13744,7 +13762,7 @@ else {
13744
13762
 
13745
13763
  console.log('[stx] Suspense runtime initialized');
13746
13764
  })();
13747
- `}var lO=0;var dw={};t(dw,{processAsyncDirectives:()=>$L,isAsyncComponent:()=>ZL,generateAsyncComponentRuntime:()=>YL,generateAsyncComponentCSS:()=>JL,defineAsyncComponent:()=>XL});function gw(){return`async-${++eO}-${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=gw(),z=hw(w);return uw(K,z,W.trim(),q.trim())}),G=G.replace(Y,(Q,w,W)=>{let q=gw(),K=hw(w);return uw(q,K,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function hw($){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 uw($,X,Z,J){let{component:Y,timeout:G,delay:Q,suspensible:w,retries:W}=X;return`
13765
+ `}var oO=0;var lw={};t(lw,{processAsyncDirectives:()=>GL,isAsyncComponent:()=>wL,generateAsyncComponentRuntime:()=>qL,generateAsyncComponentCSS:()=>WL,defineAsyncComponent:()=>QL});function dw(){return`async-${++YL}-${Date.now().toString(36)}`}function GL($,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=dw(),z=mw(w);return cw(K,z,W.trim(),q.trim())}),G=G.replace(Y,(Q,w,W)=>{let q=dw(),K=mw(w);return cw(q,K,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function mw($){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 cw($,X,Z,J){let{component:Y,timeout:G,delay:Q,suspensible:w,retries:W}=X;return`
13748
13766
  <div class="stx-async-component" data-async-id="${$}" data-component="${Y}" data-status="pending">
13749
13767
  <div class="stx-async-loading" data-async-loading="${$}">
13750
13768
  ${Z}
@@ -13971,7 +13989,7 @@ catch (error) {
13971
13989
  loadComponent();
13972
13990
  })();
13973
13991
  </script>
13974
- `}function XL($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function ZL($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function JL(){return`
13992
+ `}function QL($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function wL($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function WL(){return`
13975
13993
  /* STX Async Component Styles */
13976
13994
  .stx-async-component {
13977
13995
  position: relative;
@@ -14045,7 +14063,7 @@ catch (error) {
14045
14063
  background-size: 200% 100%;
14046
14064
  }
14047
14065
  }
14048
- `}function YL(){return`
14066
+ `}function qL(){return`
14049
14067
  // STX Async Component Runtime
14050
14068
  (function() {
14051
14069
  if (typeof window === 'undefined') return;
@@ -14099,7 +14117,7 @@ catch (error) {
14099
14117
 
14100
14118
  console.log('[stx] Async component runtime initialized');
14101
14119
  })();
14102
- `}var eO=0;var cw={};t(cw,{shouldCacheComponent:()=>KL,processKeepAliveDirectives:()=>QL,onDeactivated:()=>BL,onActivated:()=>jL,generateKeepAliveRuntime:()=>UL,generateKeepAliveCSS:()=>zL,createKeepAliveCache:()=>qL});function mw(){return`keep-alive-${++GL}-${Date.now().toString(36)}`}function QL($,X={},Z){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(Y,G,Q)=>{let w=mw(),W=wL(G||"");return WL(w,Q.trim(),W)})}function wL($){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 WL($,X,Z){let{max:J,include:Y,exclude:G}=Z,Q=Z.id||$;return`
14120
+ `}var YL=0;var iw={};t(iw,{shouldCacheComponent:()=>HL,processKeepAliveDirectives:()=>zL,onDeactivated:()=>FL,onActivated:()=>LL,generateKeepAliveRuntime:()=>OL,generateKeepAliveCSS:()=>_L,createKeepAliveCache:()=>BL});function pw(){return`keep-alive-${++KL}-${Date.now().toString(36)}`}function zL($,X={},Z){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(Y,G,Q)=>{let w=pw(),W=UL(G||"");return jL(w,Q.trim(),W)})}function UL($){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 jL($,X,Z){let{max:J,include:Y,exclude:G}=Z,Q=Z.id||$;return`
14103
14121
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${Q}">
14104
14122
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
14105
14123
  ${X}
@@ -14386,7 +14404,7 @@ else {
14386
14404
  });
14387
14405
  })();
14388
14406
  </script>
14389
- `}function qL($={}){return{id:$.id||mw(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Z)=>Z.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Z)=>Z.trim()):null}}function KL($,X){if(X.exclude&&X.exclude.includes($))return!1;if(X.include&&!X.include.includes($))return!1;return!0}function zL(){return`
14407
+ `}function BL($={}){return{id:$.id||pw(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Z)=>Z.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Z)=>Z.trim()):null}}function HL($,X){if(X.exclude&&X.exclude.includes($))return!1;if(X.include&&!X.include.includes($))return!1;return!0}function _L(){return`
14390
14408
  /* STX Keep-Alive Styles */
14391
14409
  .stx-keep-alive {
14392
14410
  position: relative;
@@ -14411,7 +14429,7 @@ else {
14411
14429
  .stx-keep-alive-content > [data-activated] {
14412
14430
  opacity: 1;
14413
14431
  }
14414
- `}function UL(){return`
14432
+ `}function OL(){return`
14415
14433
  // STX Keep-Alive Runtime
14416
14434
  (function() {
14417
14435
  if (typeof window === 'undefined') return;
@@ -14447,7 +14465,7 @@ else {
14447
14465
 
14448
14466
  console.log('[stx] Keep-alive runtime initialized');
14449
14467
  })();
14450
- `}function jL($){if(typeof document<"u")document.addEventListener("stx:activated",(X)=>{$(X.detail)})}function BL($){if(typeof document<"u")document.addEventListener("stx:deactivated",(X)=>{$(X.detail)})}var GL=0;var rw={};t(rw,{useVirtualList:()=>pw,processVirtualListDirectives:()=>H6,processVirtualGridDirectives:()=>nw,processInfiniteListDirectives:()=>iw,generateVirtualListCSS:()=>lw,default:()=>HL,createVirtualList:()=>B6});function B6($,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 B();let R=Math.max(0,Math.floor(K/Z)-Y),N=Math.ceil(J/Z),T=Math.min(q.length-1,R+N+Y*2);return{startIndex:R,endIndex:T}}function B(){let R=0,N=0,T=q.length-1;for(let M=0;M<q.length;M++){let k=z.get(M)||w;if(R+k>K){N=Math.max(0,M-Y);break}R+=k}R=0;for(let M=0;M<q.length;M++){let k=z.get(M)||w;if(R+=k,R>K+J){T=Math.min(q.length-1,M+Y);break}}return{startIndex:N,endIndex:T}}function j(){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 T=0;T<R;T++)N+=z.get(T)||w;return N}return R*Z}function O(){let{startIndex:R,endIndex:N}=U();return{startIndex:R,endIndex:N,scrollTop:K,totalHeight:j(),visibleItems:q.slice(R,N+1),itemHeights:new Map(z)}}function L(R,N="auto"){let T=H(R);_(T,N)}function _(R,N="auto"){K=Math.max(0,Math.min(R,j()-J))}function F(){U()}function V(R){q=[...R],z.clear(),F()}function A(){q=[],z.clear()}return{scrollToIndex:L,scrollToOffset:_,getState:O,refresh:F,setItems:V,destroy:A}}function H6($,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 _=Q.trim(),F=Function(`return ${_}`)();K={...K,...F}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(K.containerHeight/K.itemHeight),B=K.overscan||3,j=0,H=Math.min(q.length-1,U+B),O="";for(let _=j;_<=H&&_<q.length;_++){let F=q[_],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 LL($){if(typeof document<"u")document.addEventListener("stx:activated",(X)=>{$(X.detail)})}function FL($){if(typeof document<"u")document.addEventListener("stx:deactivated",(X)=>{$(X.detail)})}var KL=0;var aw={};t(aw,{useVirtualList:()=>rw,processVirtualListDirectives:()=>O6,processVirtualGridDirectives:()=>sw,processInfiniteListDirectives:()=>ow,generateVirtualListCSS:()=>nw,default:()=>VL,createVirtualList:()=>_6});function _6($,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),I=Math.min(q.length-1,R+N+Y*2);return{startIndex:R,endIndex:I}}function j(){let R=0,N=0,I=q.length-1;for(let T=0;T<q.length;T++){let k=z.get(T)||w;if(R+k>K){N=Math.max(0,T-Y);break}R+=k}R=0;for(let T=0;T<q.length;T++){let k=z.get(T)||w;if(R+=k,R>K+J){I=Math.min(q.length-1,T+Y);break}}return{startIndex:N,endIndex:I}}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 I=0;I<R;I++)N+=z.get(I)||w;return N}return R*Z}function O(){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 I=H(R);_(I,N)}function _(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:_,getState:O,refresh:F,setItems:V,destroy:A}}function O6($,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 _=Q.trim(),F=Function(`return ${_}`)();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),O="";for(let _=B;_<=H&&_<q.length;_++){let F=q[_],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+=`
14451
14469
  <div class="virtual-item ${K.itemClass||""}"
14452
14470
  style="position: absolute; top: ${_*K.itemHeight}px; height: ${K.itemHeight}px; width: 100%;"
14453
14471
  data-index="${_}">
@@ -14458,7 +14476,7 @@ else {
14458
14476
  style="position: relative; height: ${K.containerHeight}px; overflow-y: auto;"
14459
14477
  data-item-height="${K.itemHeight}"
14460
14478
  data-total-items="${q.length}"
14461
- data-overscan="${B}">
14479
+ data-overscan="${j}">
14462
14480
  <div class="virtual-list-viewport ${K.viewportClass||""}"
14463
14481
  style="position: relative; height: ${L}px; width: 100%;">
14464
14482
  ${O}
@@ -14472,7 +14490,7 @@ else {
14472
14490
  const viewport = container.querySelector('.virtual-list-viewport');
14473
14491
  const itemHeight = ${K.itemHeight};
14474
14492
  const totalItems = ${q.length};
14475
- const overscan = ${B};
14493
+ const overscan = ${j};
14476
14494
  const containerHeight = ${K.containerHeight};
14477
14495
  const items = ${JSON.stringify(q)};
14478
14496
  const template = ${JSON.stringify(w.trim())};
@@ -14524,7 +14542,7 @@ else {
14524
14542
  };
14525
14543
  })();
14526
14544
  </script>
14527
- `})}function lw(){return`
14545
+ `})}function nw(){return`
14528
14546
  .virtual-list-container {
14529
14547
  position: relative;
14530
14548
  overflow-y: auto;
@@ -14572,7 +14590,7 @@ else {
14572
14590
  0% { background-position: 200% 0; }
14573
14591
  100% { background-position: -200% 0; }
14574
14592
  }
14575
- `}function pw($,X){let Z=null,J=()=>{if(!Z)Z=B6($(),X);return Z};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${X.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Y)=>{let G=Y.target;if(Z)Z.scrollToOffset(G.scrollTop)}}),itemProps:(Y)=>({style:{position:"absolute",top:`${Y*X.itemHeight}px`,height:`${X.itemHeight}px`,width:"100%"},"data-index":Y}),scrollToIndex:(Y)=>{J().scrollToIndex(Y)}}}function iw($,X={},Z){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(Y,G,Q,w,W)=>{let q=G.trim(),K=X[q];if(!K||!Array.isArray(K))return`<!-- infiniteList: items "${q}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let j=Function(`return ${Q.trim()}`)();z={...z,...j}}catch{}let U=`ilist-${Math.random().toString(36).substring(2,9)}`,B=H6(`@virtualList(${q}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${w}@endvirtualList`,X);return B=B.replace("</script>",`
14593
+ `}function rw($,X){let Z=null,J=()=>{if(!Z)Z=_6($(),X);return Z};return{visibleItems:()=>{return J().getState().visibleItems},totalHeight:()=>{return J().getState().totalHeight},containerProps:()=>({style:{height:`${X.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(Y)=>{let G=Y.target;if(Z)Z.scrollToOffset(G.scrollTop)}}),itemProps:(Y)=>({style:{position:"absolute",top:`${Y*X.itemHeight}px`,height:`${X.itemHeight}px`,width:"100%"},"data-index":Y}),scrollToIndex:(Y)=>{J().scrollToIndex(Y)}}}function ow($,X={},Z){let J=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(J,(Y,G,Q,w,W)=>{let q=G.trim(),K=X[q];if(!K||!Array.isArray(K))return`<!-- infiniteList: items "${q}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let B=Function(`return ${Q.trim()}`)();z={...z,...B}}catch{}let U=`ilist-${Math.random().toString(36).substring(2,9)}`,j=O6(`@virtualList(${q}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${w}@endvirtualList`,X);return j=j.replace("</script>",`
14576
14594
  // Infinite scroll detection
14577
14595
  container.addEventListener('scroll', function() {
14578
14596
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -14585,22 +14603,22 @@ else {
14585
14603
  });
14586
14604
  </script>`),`
14587
14605
  <div id="${U}" class="infinite-list-wrapper">
14588
- ${B}
14606
+ ${j}
14589
14607
  <div class="infinite-list-loading" style="display: none;">
14590
14608
  ${W}
14591
14609
  </div>
14592
14610
  </div>
14593
- `})}function nw($,X={},Z){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(Y,G,Q,w)=>{let W=G.trim(),q=X[W];if(!q||!Array.isArray(q))return`<!-- virtualGrid: items "${W}" not found or not an array -->`;let K={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let F=Function(`return ${Q.trim()}`)();K={...K,...F}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(q.length/K.columns),B=U*(K.rowHeight+(K.gap||0)),j=Math.ceil(K.containerHeight/(K.rowHeight+(K.gap||0))),H=K.overscan||2,O=0,L=Math.min(U-1,j+H),_="";for(let F=O;F<=L;F++)for(let V=0;V<K.columns;V++){let A=F*K.columns+V;if(A>=q.length)break;let R=q[A],N=V*(100/K.columns),T=F*(K.rowHeight+(K.gap||0)),M=w.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(k,E)=>{if(typeof R==="object"&&R!==null)return String(R[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));_+=`
14611
+ `})}function sw($,X={},Z){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(Y,G,Q,w)=>{let W=G.trim(),q=X[W];if(!q||!Array.isArray(q))return`<!-- virtualGrid: items "${W}" not found or not an array -->`;let K={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let F=Function(`return ${Q.trim()}`)();K={...K,...F}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(q.length/K.columns),j=U*(K.rowHeight+(K.gap||0)),B=Math.ceil(K.containerHeight/(K.rowHeight+(K.gap||0))),H=K.overscan||2,O=0,L=Math.min(U-1,B+H),_="";for(let F=O;F<=L;F++)for(let V=0;V<K.columns;V++){let A=F*K.columns+V;if(A>=q.length)break;let R=q[A],N=V*(100/K.columns),I=F*(K.rowHeight+(K.gap||0)),T=w.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(k,E)=>{if(typeof R==="object"&&R!==null)return String(R[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));_+=`
14594
14612
  <div class="virtual-grid-item"
14595
- style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/K.columns}% - ${K.gap||0}px); height: ${K.rowHeight}px;"
14613
+ style="position: absolute; top: ${I}px; left: ${N}%; width: calc(${100/K.columns}% - ${K.gap||0}px); height: ${K.rowHeight}px;"
14596
14614
  data-index="${A}">
14597
- ${M}
14615
+ ${T}
14598
14616
  </div>`}return`
14599
14617
  <div id="${z}"
14600
14618
  class="virtual-grid-container"
14601
14619
  style="position: relative; height: ${K.containerHeight}px; overflow-y: auto;">
14602
14620
  <div class="virtual-grid-viewport"
14603
- style="position: relative; height: ${B}px; width: 100%;">
14621
+ style="position: relative; height: ${j}px; width: 100%;">
14604
14622
  ${_}
14605
14623
  </div>
14606
14624
  </div>
@@ -14660,7 +14678,7 @@ else {
14660
14678
  });
14661
14679
  })();
14662
14680
  </script>
14663
- `})}var HL;var ow=D(()=>{HL={createVirtualList:B6,processVirtualListDirectives:H6,processInfiniteListDirectives:iw,processVirtualGridDirectives:nw,generateVirtualListCSS:lw,useVirtualList:pw}});function sw(){return`<script data-stx-hydration-runtime>
14681
+ `})}var VL;var tw=D(()=>{VL={createVirtualList:_6,processVirtualListDirectives:O6,processInfiniteListDirectives:ow,processVirtualGridDirectives:sw,generateVirtualListCSS:nw,useVirtualList:rw}});function ew(){return`<script data-stx-hydration-runtime>
14664
14682
  (function() {
14665
14683
  'use strict';
14666
14684
 
@@ -14820,7 +14838,7 @@ else {
14820
14838
  stxIslands.initIslands();
14821
14839
  }
14822
14840
  })();
14823
- </script>`}function aw($){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 tw($,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 qW={};t(qW,{processStaticDirectives:()=>wW,processPartialHydrationDirectives:()=>$W,onHydrated:()=>QW,isHydrated:()=>GW,hydrateIsland:()=>ZW,hydrateByStrategy:()=>JW,hydrateAll:()=>YW,generatePartialHydrationCSS:()=>XW,generateIslandManifest:()=>WW,default:()=>NL,createIslandRegistry:()=>ew});function ew(){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 _L($){return`
14841
+ </script>`}function $W($){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 XW($,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 UW={};t(UW,{processStaticDirectives:()=>KW,processPartialHydrationDirectives:()=>JW,onHydrated:()=>qW,isHydrated:()=>WW,hydrateIsland:()=>GW,hydrateByStrategy:()=>QW,hydrateAll:()=>wW,generatePartialHydrationCSS:()=>YW,generateIslandManifest:()=>zW,default:()=>EL,createIslandRegistry:()=>ZW});function ZW(){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 AL($){return`
14824
14842
  <script data-hydrate="${$}">
14825
14843
  (function() {
14826
14844
  const island = document.querySelector('[data-island="${$}"]');
@@ -14831,7 +14849,7 @@ else {
14831
14849
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
14832
14850
  })();
14833
14851
  </script>
14834
- `}function OL($,X){let Z=X.timeout||2000,J=X.priority||"low";return`
14852
+ `}function RL($,X){let Z=X.timeout||2000,J=X.priority||"low";return`
14835
14853
  <script data-hydrate="${$}">
14836
14854
  (function() {
14837
14855
  const island = document.querySelector('[data-island="${$}"]');
@@ -14867,7 +14885,7 @@ else {
14867
14885
  }
14868
14886
  })();
14869
14887
  </script>
14870
- `}function LL($,X){let Z=X.rootMargin||"0px",J=X.threshold||0;return`
14888
+ `}function NL($,X){let Z=X.rootMargin||"0px",J=X.threshold||0;return`
14871
14889
  <script data-hydrate="${$}">
14872
14890
  (function() {
14873
14891
  const island = document.querySelector('[data-island="${$}"]');
@@ -14900,7 +14918,7 @@ else {
14900
14918
  }
14901
14919
  })();
14902
14920
  </script>
14903
- `}function FL($,X){let Z=X.media||"(min-width: 768px)";return`
14921
+ `}function TL($,X){let Z=X.media||"(min-width: 768px)";return`
14904
14922
  <script data-hydrate="${$}">
14905
14923
  (function() {
14906
14924
  const island = document.querySelector('[data-island="${$}"]');
@@ -14929,7 +14947,7 @@ else {
14929
14947
  }
14930
14948
  })();
14931
14949
  </script>
14932
- `}function VL($){return`
14950
+ `}function ML($){return`
14933
14951
  <script data-hydrate="${$}">
14934
14952
  (function() {
14935
14953
  const island = document.querySelector('[data-island="${$}"]');
@@ -14951,7 +14969,7 @@ else {
14951
14969
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
14952
14970
  })();
14953
14971
  </script>
14954
- `}function AL($,X){let Z=X.event||"stx:activate";return`
14972
+ `}function kL($,X){let Z=X.event||"stx:activate";return`
14955
14973
  <script data-hydrate="${$}">
14956
14974
  (function() {
14957
14975
  const island = document.querySelector('[data-island="${$}"]');
@@ -14972,19 +14990,19 @@ else {
14972
14990
  });
14973
14991
  })();
14974
14992
  </script>
14975
- `}function $W($,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=RL(J),J=J7(J,"hover",X),J=J7(J,"event",X),Y=G&&J!==$,Y)J+=`
14976
- `+sw();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((O)=>O.trim());for(let O of H){let[L,_]=O.split(":").map((F)=>F.trim());if(L&&_){let F=_.replace(/^['"]|['"]$/g,"");w[L]=F}}}catch{}let W=`island-${Math.random().toString(36).substring(2,9)}`,q=aw(Q.trim()),K=tw(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 B=Object.keys(K).length>0?`
14977
- <script type="application/json" data-island-props="${W}">${JSON.stringify(K)}</script>`:"",j="";switch(X){case"load":j=_L(W);break;case"idle":j=OL(W,w);break;case"visible":j=LL(W,w);break;case"media":j=FL(W,w);break;case"hover":j=VL(W);break;case"event":j=AL(W,w);break}return`
14993
+ `}function JW($,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=IL(J),J=J7(J,"hover",X),J=J7(J,"event",X),Y=G&&J!==$,Y)J+=`
14994
+ `+ew();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((O)=>O.trim());for(let O of H){let[L,_]=O.split(":").map((F)=>F.trim());if(L&&_){let F=_.replace(/^['"]|['"]$/g,"");w[L]=F}}}catch{}let W=`island-${Math.random().toString(36).substring(2,9)}`,q=$W(Q.trim()),K=XW(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
+ <script type="application/json" data-island-props="${W}">${JSON.stringify(K)}</script>`:"",B="";switch(X){case"load":B=AL(W);break;case"idle":B=RL(W,w);break;case"visible":B=NL(W,w);break;case"media":B=TL(W,w);break;case"hover":B=ML(W);break;case"event":B=kL(W,w);break}return`
14978
14996
  <div data-island="${W}"
14979
14997
  data-strategy="${X}"
14980
14998
  ${z.join(`
14981
14999
  `)}
14982
15000
  class="stx-island"
14983
15001
  style="contents;">
14984
- ${Q.trim()}${B}
15002
+ ${Q.trim()}${j}
14985
15003
  </div>
14986
- ${j}
14987
- `})}function RL($){let X=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(X,(Z,J)=>{let Y=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
15004
+ ${B}
15005
+ `})}function IL($){let X=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(X,(Z,J)=>{let Y=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
14988
15006
  <div data-island="${Y}"
14989
15007
  data-strategy="only"
14990
15008
  class="stx-island stx-client-only">
@@ -15003,7 +15021,7 @@ else {
15003
15021
  }
15004
15022
  })();
15005
15023
  </script>
15006
- `})}function XW(){return`
15024
+ `})}function YW(){return`
15007
15025
  /* Island base styles */
15008
15026
  .stx-island {
15009
15027
  display: contents;
@@ -15044,11 +15062,11 @@ else {
15044
15062
  .stx-island.hydrated {
15045
15063
  opacity: 1;
15046
15064
  }
15047
- `}function ZW($){if(typeof window>"u")return;let X=document.querySelector(`[data-island="${$}"]`);if(!X||X.classList.contains("hydrated"))return;X.classList.add("hydrated"),X.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function JW($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function YW(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((X)=>{X.classList.add("hydrated"),X.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function GW($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function QW($){return new Promise((X)=>{if(typeof window>"u"){X();return}let Z=document.querySelector(`[data-island="${$}"]`);if(!Z){X();return}if(Z.classList.contains("hydrated")){X();return}Z.addEventListener("stx:hydrated",()=>X(),{once:!0})})}function wW($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(X,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function WW($){let X=$.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
15065
+ `}function GW($){if(typeof window>"u")return;let X=document.querySelector(`[data-island="${$}"]`);if(!X||X.classList.contains("hydrated"))return;X.classList.add("hydrated"),X.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function QW($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function wW(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((X)=>{X.classList.add("hydrated"),X.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function WW($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function qW($){return new Promise((X)=>{if(typeof window>"u"){X();return}let Z=document.querySelector(`[data-island="${$}"]`);if(!Z){X();return}if(Z.classList.contains("hydrated")){X();return}Z.addEventListener("stx:hydrated",()=>X(),{once:!0})})}function KW($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(X,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function zW($){let X=$.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
15048
15066
  <script type="application/json" id="stx-island-manifest">
15049
15067
  ${JSON.stringify(X)}
15050
15068
  </script>
15051
- `}var NL;var KW=D(()=>{NL={processPartialHydrationDirectives:$W,processStaticDirectives:wW,generatePartialHydrationCSS:XW,generateIslandManifest:WW,createIslandRegistry:ew,hydrateIsland:ZW,hydrateByStrategy:JW,hydrateAll:YW,isHydrated:GW,onHydrated:QW}});var AW={};t(AW,{watchMultiple:()=>HW,watchEffect:()=>_W,watch:()=>BW,unref:()=>zW,toRefs:()=>UW,throttledComputed:()=>VW,stxWatchMultiple:()=>HW,stxWatchEffect:()=>_W,stxWatch:()=>BW,stxUnref:()=>zW,stxToRefs:()=>UW,stxThrottledComputed:()=>VW,stxShallowRef:()=>jW,stxRef:()=>Y7,stxIsRef:()=>o1,stxDebouncedComputed:()=>FW,stxComputed:()=>U8,shallowRef:()=>jW,ref:()=>Y7,processWatchDirectives:()=>LW,processComputedDirectives:()=>OW,isRef:()=>o1,default:()=>TL,debouncedComputed:()=>FW,computed:()=>U8});function Y7($){let X=$,Z=new Set,J={get value(){if(L1){let Y=z8.get(J);if(!Y)Y=new Set,z8.set(J,Y);Y.add(L1)}return X},set value(Y){if(!Object.is(X,Y)){X=Y,Z.forEach((Q)=>Q(Y));let G=z8.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 zW($){return o1($)?$.value:$}function UW($){let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=Y7($[Z]);return X}function jW($){return Y7($)}function U8($){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((B)=>B(U))}};function K(){w.clear();let U=L1;L1=q,T9.push(q);try{return Z()}finally{T9.pop(),L1=U}}let z={get value(){if(L1){let U=z8.get(z);if(!U)U=new Set,z8.set(z,U);U.add(L1)}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 BW($,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 j=K();if(w!==void 0&&Object.is(w,j)&&!Y)return;let H=()=>{if(X(j,w),w=Y?L5(j):j,Q)B()};if(G==="sync")H();else if(G==="post")queueMicrotask(H);else Promise.resolve().then(H)},U=null;if(o1($))U=$.subscribe(()=>z());else U=U8($).subscribe(()=>z());if(J)w=void 0,z();else w=K();let B=()=>{if(W=!1,U)U(),U=null};return B.pause=()=>{q=!0},B.resume=()=>{q=!1},B}function HW($,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 _W($,X={}){let{flush:Z="pre"}=X,J,Y=!0,G=!1,Q=()=>{if(!Y||G)return;if(J)J();let W=L1;L1=Q,T9.push(Q);try{J=$()}finally{T9.pop(),L1=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 OW($,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 LW($,X={},Z){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(Y,G,Q)=>{return`
15069
+ `}var EL;var jW=D(()=>{EL={processPartialHydrationDirectives:JW,processStaticDirectives:KW,generatePartialHydrationCSS:YW,generateIslandManifest:zW,createIslandRegistry:ZW,hydrateIsland:GW,hydrateByStrategy:QW,hydrateAll:wW,isHydrated:WW,onHydrated:qW}});var TW={};t(TW,{watchMultiple:()=>LW,watchEffect:()=>FW,watch:()=>OW,unref:()=>BW,toRefs:()=>HW,throttledComputed:()=>NW,stxWatchMultiple:()=>LW,stxWatchEffect:()=>FW,stxWatch:()=>OW,stxUnref:()=>BW,stxToRefs:()=>HW,stxThrottledComputed:()=>NW,stxShallowRef:()=>_W,stxRef:()=>Y7,stxIsRef:()=>o1,stxDebouncedComputed:()=>RW,stxComputed:()=>j8,shallowRef:()=>_W,ref:()=>Y7,processWatchDirectives:()=>AW,processComputedDirectives:()=>VW,isRef:()=>o1,default:()=>DL,debouncedComputed:()=>RW,computed:()=>j8});function Y7($){let X=$,Z=new Set,J={get value(){if(F1){let Y=U8.get(J);if(!Y)Y=new Set,U8.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=U8.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 BW($){return o1($)?$.value:$}function HW($){let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=Y7($[Z]);return X}function _W($){return Y7($)}function j8($){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,N9.push(q);try{return Z()}finally{N9.pop(),F1=U}}let z={get value(){if(F1){let U=U8.get(z);if(!U)U=new Set,U8.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 OW($,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=j8($).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 LW($,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 FW($,X={}){let{flush:Z="pre"}=X,J,Y=!0,G=!1,Q=()=>{if(!Y||G)return;if(J)J();let W=F1;F1=Q,N9.push(Q);try{J=$()}finally{N9.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 VW($,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 AW($,X={},Z){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(Y,G,Q)=>{return`
15052
15070
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
15053
15071
  (function() {
15054
15072
  // Watch implementation for ${G}
@@ -15060,9 +15078,9 @@ else {
15060
15078
  }
15061
15079
  })();
15062
15080
  </script>
15063
- `})}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 FW($,X=100){let Z=Y7($()),J=null,Y=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Z.value=$()},X)};return U8($).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 VW($,X=100){let Z=Y7($()),J=0,Y=()=>{let Q=Date.now();if(Q-J>=X)J=Q,Z.value=$()};return U8($).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 L1=null,T9,z8,TL;var RW=D(()=>{T9=[],z8=new WeakMap;TL={ref:Y7,computed:U8,watch:BW,watchMultiple:HW,watchEffect:_W,isRef:o1,unref:zW,toRefs:UW,shallowRef:jW,debouncedComputed:FW,throttledComputed:VW,processComputedDirectives:OW,processWatchDirectives:LW}});function j8($,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 ML($,X){let Z={};for(let J of X)Z[J]=$[J];return Z}function _6($,X){let Z=Object.keys($),J=j8(Z,(_)=>X?.[_]??$[_].getDefaultValue()),Y=j8(Z,()=>[]),G=j8(Z,()=>!1),Q=j8(Z,()=>!1),w=j8(Z,()=>!1),W=m1(!1);async function q(_){w[_]=!0;let F=await $[_].validate(J[_],J);return Y[_]=F,w[_]=!1,F.length===0}async function K(){W.set(!0);let _=await Promise.all(Z.map(q));return W.set(!1),_.every(Boolean)}function z(){for(let _ of Z)J[_]=X?.[_]??$[_].getDefaultValue(),Y[_]=[],G[_]=!1,Q[_]=!1}function U(_){for(let F of Z)if(F in _)J[F]=_[F],Q[F]=!0}function B(_,F){J[_]=F,Q[_]=!0}function j(_,F=!0){if(G[_]=F,F)q(_)}function H(_){return{value:J[_],errors:Y[_],touched:G[_],dirty:Q[_],valid:Y[_].length===0,validating:w[_]}}function O(_){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await K())await _(ML(J,Z))}}return{values:J,errors:Y,touched:G,dirty:Q,get isValid(){return Z.every((_)=>Y[_].length===0)},get isValidating(){return W()||Z.some((_)=>w[_])},get isDirty(){return Z.some((_)=>Q[_])},validate:K,validateField:q,reset:z,setValues:U,setFieldValue:B,setFieldTouched:j,getFieldState:H,handleSubmit:O}}var NW;var TW=D(()=>{Z$();NW=_6});var EW={};t(EW,{v:()=>kL,useForm:()=>_6,processHasErrorsDirective:()=>IW,processFormValidationDirectives:()=>IL,processErrorsDirective:()=>kW,processErrorDirective:()=>MW,defineForm:()=>NW,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 MW($,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(`
15064
- `)}catch{return""}})}function kW($,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(`
15065
- `)}catch{return""}})}function IW($,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 IL($,X,Z){let J=$;return J=MW(J,X,Z),J=kW(J,X,Z),J=IW(J,X,Z),J}var kL;var DW=D(()=>{TW();kL=new G7});var SW={};t(SW,{processXElementDirectives:()=>EL,hasXElementDirectives:()=>bW,generateXElementRuntime:()=>yW});function yW(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
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 RW($,X=100){let Z=Y7($()),J=null,Y=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Z.value=$()},X)};return j8($).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 NW($,X=100){let Z=Y7($()),J=0,Y=()=>{let Q=Date.now();if(Q-J>=X)J=Q,Z.value=$()};return j8($).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,N9,U8,DL;var MW=D(()=>{N9=[],U8=new WeakMap;DL={ref:Y7,computed:j8,watch:OW,watchMultiple:LW,watchEffect:FW,isRef:o1,unref:BW,toRefs:HW,shallowRef:_W,debouncedComputed:RW,throttledComputed:NW,processComputedDirectives:VW,processWatchDirectives:AW}});function B8($,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 yL($,X){let Z={};for(let J of X)Z[J]=$[J];return Z}function L6($,X){let Z=Object.keys($),J=B8(Z,(_)=>X?.[_]??$[_].getDefaultValue()),Y=B8(Z,()=>[]),G=B8(Z,()=>!1),Q=B8(Z,()=>!1),w=B8(Z,()=>!1),W=m1(!1);async function q(_){w[_]=!0;let F=await $[_].validate(J[_],J);return Y[_]=F,w[_]=!1,F.length===0}async function K(){W.set(!0);let _=await Promise.all(Z.map(q));return W.set(!1),_.every(Boolean)}function z(){for(let _ of Z)J[_]=X?.[_]??$[_].getDefaultValue(),Y[_]=[],G[_]=!1,Q[_]=!1}function U(_){for(let F of Z)if(F in _)J[F]=_[F],Q[F]=!0}function j(_,F){J[_]=F,Q[_]=!0}function B(_,F=!0){if(G[_]=F,F)q(_)}function H(_){return{value:J[_],errors:Y[_],touched:G[_],dirty:Q[_],valid:Y[_].length===0,validating:w[_]}}function O(_){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await K())await _(yL(J,Z))}}return{values:J,errors:Y,touched:G,dirty:Q,get isValid(){return Z.every((_)=>Y[_].length===0)},get isValidating(){return W()||Z.some((_)=>w[_])},get isDirty(){return Z.some((_)=>Q[_])},validate:K,validateField:q,reset:z,setValues:U,setFieldValue:j,setFieldTouched:B,getFieldState:H,handleSubmit:O}}var kW;var IW=D(()=>{J$();kW=L6});var bW={};t(bW,{v:()=>bL,useForm:()=>L6,processHasErrorsDirective:()=>yW,processFormValidationDirectives:()=>SL,processErrorsDirective:()=>DW,processErrorDirective:()=>EW,defineForm:()=>kW,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 EW($,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
+ `)}catch{return""}})}function DW($,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 yW($,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 SL($,X,Z){let J=$;return J=EW(J,X,Z),J=DW(J,X,Z),J=yW(J,X,Z),J}var bL;var SW=D(()=>{IW();bL=new G7});var vW={};t(vW,{processXElementDirectives:()=>CL,hasXElementDirectives:()=>PW,generateXElementRuntime:()=>CW});function CW(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
15066
15084
  (function() {
15067
15085
  'use strict';
15068
15086
 
@@ -15346,16 +15364,16 @@ else {
15346
15364
  // Expose for manual initialization
15347
15365
  window.XElement = XElement;
15348
15366
  })();
15349
- </script>`}function bW($){return/\bx-data(?:\s|=)/.test($)}function EL($){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(!bW(J))return J;let Y=Z[0]?.trim()||yW(),G=J.lastIndexOf("</body>");if(G!==-1)return J.slice(0,G)+Y+`
15367
+ </script>`}function PW($){return/\bx-data(?:\s|=)/.test($)}function CL($){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(!PW(J))return J;let Y=Z[0]?.trim()||CW(),G=J.lastIndexOf("</body>");if(G!==-1)return J.slice(0,G)+Y+`
15350
15368
  `+J.slice(G);return J+`
15351
- `+Y}var CW={};t(CW,{rewriteImagesWithSiblings:()=>bL});import y1 from"path";async function bL($,X){let Z=X.formats??yL;if(!X.publicDir)return $;let J=PL($),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(vL(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 SL(z.src,X.publicDir,Z);return{match:z,sources:U}}));for(let{match:z,sources:U}of W){if(U.length===0)continue;let j=`<picture>${U.map((H)=>`<source type="${H.mime}" srcset="${xL(H.url)}">`).join("")}${z.raw}</picture>`;Y.push({start:z.idx,end:z.idx+z.length,replacement:j})}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 SL($,X,Z){if(!CL($))return[];let J=y1.extname($).toLowerCase();if(!DL.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 B=y1.join(G,`${Q}${U.ext}`);if(!await Bun.file(B).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 CL($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function PL($){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 vL($,X){for(let[Z,J]of X)if($>=Z&&$<J)return!0;return!1}function xL($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var DL,yL;var PW=D(()=>{DL=new Set([".jpg",".jpeg",".png",".gif"]),yL=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var vW=()=>{};function O6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var xW=D(()=>{vW()});var fW={};t(fW,{injectPwaTags:()=>fL,generateThemeColorMeta:()=>uL,generateSwRegistrationScript:()=>gL,generatePwaTags:()=>M9,generateManifestLink:()=>hL});function M9($){let X=$.pwa;if(!X?.enabled)return"";let Z=X.manifest,J=X.icons?.outputDir?`/${X.icons.outputDir}`:"/pwa-icons",Y=O6($),G=`
15369
+ `+Y}var xW={};t(xW,{rewriteImagesWithSiblings:()=>xL});import y1 from"path";async function xL($,X){let Z=X.formats??vL;if(!X.publicDir)return $;let J=hL($),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(uL(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 fL(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="${dL(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 fL($,X,Z){if(!gL($))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 gL($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function hL($){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 uL($,X){for(let[Z,J]of X)if($>=Z&&$<J)return!0;return!1}function dL($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var PL,vL;var fW=D(()=>{PL=new Set([".jpg",".jpeg",".png",".gif"]),vL=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var gW=()=>{};function F6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var hW=D(()=>{gW()});var uW={};t(uW,{injectPwaTags:()=>mL,generateThemeColorMeta:()=>pL,generateSwRegistrationScript:()=>cL,generatePwaTags:()=>T9,generateManifestLink:()=>lL});function T9($){let X=$.pwa;if(!X?.enabled)return"";let Z=X.manifest,J=X.icons?.outputDir?`/${X.icons.outputDir}`:"/pwa-icons",Y=F6($),G=`
15352
15370
  <!-- stx PWA Meta Tags -->
15353
15371
  <link rel="manifest" href="/manifest.json">
15354
- <meta name="theme-color" content="${L6(Z?.themeColor||"#000000")}">
15372
+ <meta name="theme-color" content="${V6(Z?.themeColor||"#000000")}">
15355
15373
  <meta name="mobile-web-app-capable" content="yes">
15356
15374
  <meta name="apple-mobile-web-app-capable" content="yes">
15357
15375
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
15358
- <meta name="apple-mobile-web-app-title" content="${L6(Z?.shortName||Z?.name||"App")}">`;if(X.icons?.generateAppleIcons!==!1)G+=`
15376
+ <meta name="apple-mobile-web-app-title" content="${V6(Z?.shortName||Z?.name||"App")}">`;if(X.icons?.generateAppleIcons!==!1)G+=`
15359
15377
  <link rel="apple-touch-icon" href="${J}/apple-touch-icon.png">
15360
15378
  <link rel="apple-touch-icon" sizes="120x120" href="${J}/apple-touch-icon-120x120.png">
15361
15379
  <link rel="apple-touch-icon" sizes="152x152" href="${J}/apple-touch-icon-152x152.png">
@@ -15392,12 +15410,12 @@ if ('serviceWorker' in navigator) {
15392
15410
  });
15393
15411
  }
15394
15412
  </script>
15395
- <!-- End stx PWA -->`,G}function fL($,X){let Z=X.pwa;if(!Z?.enabled||Z.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Y=$.lastIndexOf("</body>");if(Y!==-1){let G=M9(X);return $.slice(0,Y)+G+`
15396
- `+$.slice(Y)}return $+M9(X)}let J=M9(X);return $.replace("</head>",`${J}
15397
- </head>`)}function gL($){if(!$.pwa?.enabled)return"";return`<script>
15413
+ <!-- End stx PWA -->`,G}function mL($,X){let Z=X.pwa;if(!Z?.enabled||Z.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Y=$.lastIndexOf("</body>");if(Y!==-1){let G=T9(X);return $.slice(0,Y)+G+`
15414
+ `+$.slice(Y)}return $+T9(X)}let J=T9(X);return $.replace("</head>",`${J}
15415
+ </head>`)}function cL($){if(!$.pwa?.enabled)return"";return`<script>
15398
15416
  if ('serviceWorker' in navigator) {
15399
15417
  window.addEventListener('load', function() {
15400
- navigator.serviceWorker.register('/${O6($)}')
15418
+ navigator.serviceWorker.register('/${F6($)}')
15401
15419
  .then(function(registration) {
15402
15420
  console.log('[PWA] Service Worker registered:', registration.scope);
15403
15421
  })
@@ -15406,54 +15424,54 @@ if ('serviceWorker' in navigator) {
15406
15424
  });
15407
15425
  });
15408
15426
  }
15409
- </script>`}function hL(){return'<link rel="manifest" href="/manifest.json">'}function uL($){return`<meta name="theme-color" content="${L6($)}">`}function L6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var gW=D(()=>{xW()});import dL from"fs";import f0 from"path";function hW($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mL($,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 lL(){return'<link rel="manifest" href="/manifest.json">'}function pL($){return`<meta name="theme-color" content="${V6($)}">`}function V6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var dW=D(()=>{hW()});import iL from"fs";import f0 from"path";function mW($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function nL($,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(`
15410
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===`
15411
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]===`
15412
- `)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 uW($){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 cL($){let X=Q7($,"data-stx-runtime");if(!X)return $;let Z=uW($);if(Z===-1||Z===X.start)return $;let J=$.slice(X.start,X.end),Y=$.slice(0,X.start)+$.slice(X.end),G=uW(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 cW($){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 rL($){let X=Q7($,"data-stx-runtime");if(!X)return $;let Z=cW($);if(Z===-1||Z===X.start)return $;let J=$.slice(X.start,X.end),Y=$.slice(0,X.start)+$.slice(X.end),G=cW(Y);if(G===-1)return J+`
15413
15431
  `+Y;return Y.slice(0,G)+J+`
15414
- `+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)h2(X);if(!X.__stxProcessingDepth)X.__stxProcessingDepth=0;if(X.__stxProcessingDepth++,!X.__onceStore)X.__onceStore=new Set;if((J.debug||!r7()&&!d$())&&Z&&Z.endsWith(".stx"))j3($,Z);try{return await qZ.timeAsync("template-processing",async()=>{let Q=await lL($,X,Z,J,Y);if(G)Q=Q6(Q);if(G&&J.autoShell&&J.buildMode!=="compile"){let w=J.app?.head||{},q=(X.__stx_runtime_head||null)??NX(),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 B=X.__sections?.title,j=q.title||z||B,H=!q.title&&(!!z||!!B),O=q.meta||[],L=new Set(O.map((N)=>e5(N)).filter(Boolean)),_={...w,...j&&{title:j},meta:[...(w.meta||[]).filter((N)=>!L.has(e5(N))),...O],link:[...w.link||[],...q.link||[]],script:[...w.script||[],...q.script||[]],headRaw:[w.headRaw,K].filter(Boolean).join(`
15415
- `),...q.htmlAttrs&&{htmlAttrs:Yw(w.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...q.bodyAttrs}}},F=J6(Q);if(Q=Ww(Q,_,{...H&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),F)Q=ww(Q,w),Q=Gw(Q,_.htmlAttrs);let V=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(V&&Q.includes("<head")){let N=V[1],T=R7(N);Q=Q.replace(/<head\b[^>]*>/i,(M)=>`${M}
15416
- <meta name="stx-layout" content="${hW(N)}">
15417
- <meta name="stx-layout-group" content="${hW(T)}">`)}let A=Q.match(/function (__stx_setup_\d+_\d+)\(/),R=A?c7(Q):null;if(A&&R&&!/\bdata-stx=/.test(R.tag)){Q=r8(Q,(T,M)=>`<body${M} 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=Qw(Q);let w=J.app?.colorMode;if(w)Q=eQ(Q,w);Q=Xw(Q),Q=cL(Q)}if(G)try{let{getStoreScript:w}=await X0("stx/store-loader",()=>Promise.resolve().then(() => (Lw(),Ow))),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)+`
15418
- `+K+Q.slice(z.end)}}catch{}if(G)try{let{getFrameworkComposableScript:w}=await X0("stx/framework-composables",()=>Promise.resolve().then(() => (Nw(),Rw))),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)+`
15419
- `+W+Q.slice(q.end)}}catch{}if(G)try{let{getComposableScript:w}=await X0("stx/composable-loader",()=>Promise.resolve().then(() => (kw(),Mw))),W=J.composablesDir,q=await w(W);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)+`
15420
- `+K+Q.slice(z.end)}}catch{}if(G)Q=$w(Q);if(G&&X.__stx_inject_css!==!1)Q=await t7(Q,void 0,J.buildMode==="serve");if(G)Q=BZ(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof p$)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}),m4.logDetailedError(W,{filePath:Z,template:$.substring(0,500)}),J.debug)throw W;return u4.createFallbackContent("Template Processing",W)}}async function lL($,X,Z,J,Y){let G=process.cwd(),Q={...J,partialsDir:J.partialsDir&&!f0.isAbsolute(J.partialsDir)?f0.resolve(G,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!f0.isAbsolute(J.componentsDir)?f0.resolve(G,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!f0.isAbsolute(J.layoutsDir)?f0.resolve(G,J.layoutsDir):J.layoutsDir},w=Q,W=$;await nL(Z,X),iL(X,w),W=await d5(()=>vQ(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,f7,(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=iQ(W),W=await Uw(W,Z,Y);let B={};W=r3(W,B);let j={...X.__sections||{}},H="",O=JG($9($)),L=/@nolayout\b/.test(W)||O===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let _=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(_)H=_[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(H=O,!/@section\s*\(/.test(W))W=`@section('content')
15432
+ `+Y.slice(G)}async function R0($,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=M1($);let G=!X.__stxProcessingDepth;if(G)d2(X);if(!X.__stxProcessingDepth)X.__stxProcessingDepth=0;if(X.__stxProcessingDepth++,!X.__onceStore)X.__onceStore=new Set;if((J.debug||!r7()&&!m$())&&Z&&Z.endsWith(".stx"))B3($,Z);try{return await zZ.timeAsync("template-processing",async()=>{let Q=await oL($,X,Z,J,Y);if(G)Q=w6(Q);if(G&&J.autoShell&&J.buildMode!=="compile"){let w=J.app?.head||{},q=(X.__stx_runtime_head||null)??RX(),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),O=q.meta||[],L=new Set(O.map((N)=>e5(N)).filter(Boolean)),_={...w,...B&&{title:B},meta:[...(w.meta||[]).filter((N)=>!L.has(e5(N))),...O],link:[...w.link||[],...q.link||[]],script:[...w.script||[],...q.script||[]],headRaw:[w.headRaw,K].filter(Boolean).join(`
15433
+ `),...q.htmlAttrs&&{htmlAttrs:ww(w.htmlAttrs,q.htmlAttrs)},...q.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...q.bodyAttrs}}},F=Y6(Q);if(Q=zw(Q,_,{...H&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),F)Q=Kw(Q,w),Q=Ww(Q,_.htmlAttrs);let V=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(V&&Q.includes("<head")){let N=V[1],I=R7(N);Q=Q.replace(/<head\b[^>]*>/i,(T)=>`${T}
15434
+ <meta name="stx-layout" content="${mW(N)}">
15435
+ <meta name="stx-layout-group" content="${mW(I)}">`)}let A=Q.match(/function (__stx_setup_\d+_\d+)\(/),R=A?c7(Q):null;if(A&&R&&!/\bdata-stx=/.test(R.tag)){Q=o8(Q,(I,T)=>`<body${T} 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=qw(Q);let w=J.app?.colorMode;if(w)Q=Zw(Q,w);Q=Yw(Q),Q=rL(Q)}if(G)try{let{getStoreScript:w}=await X0("stx/store-loader",()=>Promise.resolve().then(() => (Aw(),Vw))),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(() => (kw(),Mw))),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(() => (Dw(),Ew))),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=Jw(Q);if(G&&X.__stx_inject_css!==!1)Q=await t7(Q,void 0,J.buildMode==="serve");if(G)Q=_Z(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof i$)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}),d4.logDetailedError(W,{filePath:Z,template:$.substring(0,500)}),J.debug)throw W;return h4.createFallbackContent("Template Processing",W)}}async function oL($,X,Z,J,Y){let G=process.cwd(),Q={...J,partialsDir:J.partialsDir&&!f0.isAbsolute(J.partialsDir)?f0.resolve(G,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!f0.isAbsolute(J.componentsDir)?f0.resolve(G,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!f0.isAbsolute(J.layoutsDir)?f0.resolve(G,J.layoutsDir):J.layoutsDir},w=Q,W=$;await tL(Z,X),aL(X,w),W=await d5(()=>gQ(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,f7,(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=oQ(W),W=await Hw(W,Z,Y);let j={};W=o3(W,j);let B={...X.__sections||{}},H="",O=QG(e$($)),L=/@nolayout\b/.test(W)||O===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let _=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(_)H=_[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(H=O,!/@section\s*\(/.test(W))W=`@section('content')
15421
15439
  ${W.trim()}
15422
- @endsection`}if(!H&&!L&&w.defaultLayout){let F=Z6(W),V=/@section\s*\(/.test(W);if(!F||V){let A="",R=f0.dirname(Z),N=w.layoutsDir?f0.dirname(w.layoutsDir):process.cwd();for(let T=0;T<20;T++){let M=f0.join(R,"_layout.stx");if(await e(M)){A=M;break}let k=f0.dirname(R);if(k===R||k.length<N.length)break;R=k}if(A)H=A;else if(w.layoutsDir){let T=f0.isAbsolute(w.layoutsDir)?w.layoutsDir:f0.resolve(process.cwd(),w.layoutsDir),M=f0.join(T,`${w.defaultLayout}.stx`);if(await e(M))H=M}if(H&&!V)W=`@section('content')
15440
+ @endsection`}if(!H&&!L&&w.defaultLayout){let F=J6(W),V=/@section\s*\(/.test(W);if(!F||V){let A="",R=f0.dirname(Z),N=w.layoutsDir?f0.dirname(w.layoutsDir):process.cwd();for(let I=0;I<20;I++){let T=f0.join(R,"_layout.stx");if(await e(T)){A=T;break}let k=f0.dirname(R);if(k===R||k.length<N.length)break;R=k}if(A)H=A;else if(w.layoutsDir){let I=f0.isAbsolute(w.layoutsDir)?w.layoutsDir:f0.resolve(process.cwd(),w.layoutsDir),T=f0.join(I,`${w.defaultLayout}.stx`);if(await e(T))H=T}if(H&&!V)W=`@section('content')
15423
15441
  ${W.trim()}
15424
- @endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return j[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 j[V]=String(R??""),""}catch{return F}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))j[V]=A.replace("@parent",F5);else j[V]=A.trim();return""}),X.__sections=j,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return j[V]||A||""}),!("slot"in X)||X.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(W=o3(W,B),H){let F=[],V=U1(W),A=z1(V.output,b5,(R,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(W=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,N,T)=>{let M=N==="SCRIPT"?V.scripts[Number(T)]:A.tokens[Number(T)];if(M)F.push(M);return""}),F.length>0){let R=F.join(`
15425
- `);j.content=j.content?`${j.content}
15426
- ${R}`:R,X.__sections=j}}if(H)try{let F;if(f0.isAbsolute(H))F=H,Y.add(H);else F=await d5(()=>G4(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 M=[];try{let E=Q.layoutsDir;if(E){let I=f0.isAbsolute(E)?E:f0.resolve(process.cwd(),E);M=dL.readdirSync(I).filter((S)=>S.endsWith(".stx")).map((S)=>S.replace(/\.stx$/,"")).sort()}}catch{}let k=`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(k),{layoutPath:H,filePath:Z,available:M},"error"),console.error(`[stx] ${k}`),Q.debug)throw new U5(k,Z);return W}let V=await d5(()=>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 M={},k=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(S,b,y)=>{return M[b]=y.trim(),""});for(let[S,b]of Object.entries(M))if(j[S]&&j[S].includes(F5)){let y=j[S].indexOf(F5);j[S]=j[S].slice(0,y)+b+j[S].slice(y+F5.length)}else if(!j[S])j[S]=b;let E={...X,__sections:j},I=`@layout('${A[1]}')${k}`;return await A0(I,E,F,Q,Y)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=r3(R,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(M,k,E)=>{return T[k]=E.trim(),`@slot('${k}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(M,k,E)=>{if(j[k]){let I=j[k];if(I.includes(F5)){let S=T[k]||"",b=I.indexOf(F5);I=I.slice(0,b)+S+I.slice(b+F5.length)}return I}return E||""}),N=pL(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=o3(N,B),X.__originalFilePath=Z,W=await dW(N,X,F,Q,Y),W=`<!-- stx-layout: ${H} -->
15427
- ${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 dW(W,X,Z,Q,Y))}function pL($,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 iL($,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 nL($,X){await d5(()=>uQ($,X),void 0,(Z)=>{Q1.log(Z,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Z.message}`)})}async function rL($,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(() => (d7(),p8)));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 oL($,X,Z){try{let{interpolateScriptsInTemplate:J}=await X0("stx/expressions",()=>Promise.resolve().then(() => (B1(),QZ)));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 dW($,X,Z,J,Y){let G=$,Q=J;if(await rL(G,X,Z),G=await oL(G,X,Z),G=await DQ(G,X,Z),G=await yQ(G,X,Z),G=await RG(G,X,Z,Q),T1(G))G=eX(G,X),G=X4(G,X);G=$4(G);let{processStreamDirectives:w}=await X0("stx/streaming",()=>Promise.resolve().then(() => (U3(),z3)));G=w(G,X),G=l3(G,X,Z,Q),G=await aQ(G,X,Z,Q,Y),G=await j9(G,X,Z,Q,Y),G=Z2(G,X,Z,Q);let{processDeferDirectives:W}=await X0("stx/defer",()=>Promise.resolve().then(() => Ew));G=W(G,X,Z);let{processTeleportDirectives:q}=await X0("stx/teleport",()=>Promise.resolve().then(() => yw));G=q(G,X,Z);let{processTransitionDirectives:K,processTransitionAttributes:z}=await X0("stx/transitions",()=>Promise.resolve().then(() => Pw));G=K(G,X,Z),G=z(G);let{processErrorBoundaryDirectives:U}=await X0("stx/error-boundaries",()=>Promise.resolve().then(() => xw));G=U(G,X,Z);let{processSuspenseDirectives:B}=await X0("stx/suspense",()=>Promise.resolve().then(() => fw));G=B(G,X,Z);let{processAsyncDirectives:j}=await X0("stx/async-components",()=>Promise.resolve().then(() => dw));G=j(G,X,Z);let{processKeepAliveDirectives:H}=await X0("stx/keep-alive",()=>Promise.resolve().then(() => cw));G=H(G,X,Z);let{processVirtualListDirectives:O,processVirtualGridDirectives:L,processInfiniteListDirectives:_}=await X0("stx/virtual-scrolling",()=>Promise.resolve().then(() => (ow(),rw)));G=O(G,X,Z),G=L(G,X,Z),G=_(G,X,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await X0("stx/partial-hydration",()=>Promise.resolve().then(() => (KW(),qW)));G=F(G,X,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await X0("stx/computed",()=>Promise.resolve().then(() => (RW(),AW)));G=A(G,X,Z),G=R(G,X,Z);let{processFormValidationDirectives:N}=await X0("stx/forms-validation",()=>Promise.resolve().then(() => (DW(),EW)));G=N(G,X,Z);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:k,resetHead:E}=await X0("stx/head",()=>Promise.resolve().then(() => (x5(),MX)));if(!X.__stx_head_preset&&!X.__stx_runtime_head)E();let I=T(G);if(G=I.content,I.headContent)X.__stx_head_raw=`${X.__stx_head_raw||""}${I.headContent}
15428
- `;if(G=M(G,X),G=k(G,X),G=gQ(G),G=a4(G,X),G=VG(G),G=CQ(G),G=await n3(G,X,Z,Q,Y),G=await j9(G,X,Z,Q,Y),X.__stxProcessingDepth===1)G=d2(G,X);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=Q6(G),G=E1(G,X,Z),G=t4(G,X),G=e4(G,X),G=Y9(G,X),G=bG(G,X),G=SG(G,X),G=await WG(G,X,Z,Q),G=await FJ(G,X,Z),G=await fG(G,X,Z,Q),G=o6(G,X,Z,Q),G=EY(G,X,Z,Q),G=DY(G,X,Z),G=yY(G,X,Z,Q),G=OG(G,X,Z,Q),G=Y6(G,X),G=G6(G),G=Bw(G),!Q.skipEventDirectives)G=R2(G,X,Z);if(G=QG(G,X,Z),Q.debug){let r=/\bx-data\s*=/.test(G),$0=K$($);if(r&&$0)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
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",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=s3(W,j),H){let F=[],V=U1(W),A=z1(V.output,b5,(R,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(W=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,N,I)=>{let T=N==="SCRIPT"?V.scripts[Number(I)]:A.tokens[Number(I)];if(T)F.push(T);return""}),F.length>0){let R=F.join(`
15443
+ `);B.content=B.content?`${B.content}
15444
+ ${R}`:R,X.__sections=B}}if(H)try{let F;if(f0.isAbsolute(H))F=H,Y.add(H);else F=await d5(()=>Y4(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 T=[];try{let E=Q.layoutsDir;if(E){let M=f0.isAbsolute(E)?E:f0.resolve(process.cwd(),E);T=iL.readdirSync(M).filter((S)=>S.endsWith(".stx")).map((S)=>S.replace(/\.stx$/,"")).sort()}}catch{}let k=`Layout not found: ${H} (referenced from ${Z})`+(T.length>0?`. Available layouts: ${T.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if(Q1.log(Error(k),{layoutPath:H,filePath:Z,available:T},"error"),console.error(`[stx] ${k}`),Q.debug)throw new U5(k,Z);return W}let V=await d5(()=>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 T={},k=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(S,b,y)=>{return T[b]=y.trim(),""});for(let[S,b]of Object.entries(T))if(B[S]&&B[S].includes(F5)){let y=B[S].indexOf(F5);B[S]=B[S].slice(0,y)+b+B[S].slice(y+F5.length)}else if(!B[S])B[S]=b;let E={...X,__sections:B},M=`@layout('${A[1]}')${k}`;return await R0(M,E,F,Q,Y)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=o3(R,j),I={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,k,E)=>{return I[k]=E.trim(),`@slot('${k}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,k,E)=>{if(B[k]){let M=B[k];if(M.includes(F5)){let S=I[k]||"",b=M.indexOf(F5);M=M.slice(0,b)+S+M.slice(b+F5.length)}return M}return E||""}),N=sL(N,B),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),N=s3(N,j),X.__originalFilePath=Z,W=await lW(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 lW(W,X,Z,Q,Y))}function sL($,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 aL($,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 tL($,X){await d5(()=>cQ($,X),void 0,(Z)=>{Q1.log(Z,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Z.message}`)})}async function eL($,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(() => (d7(),i8)));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 $F($,X,Z){try{let{interpolateScriptsInTemplate:J}=await X0("stx/expressions",()=>Promise.resolve().then(() => (B1(),WZ)));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 lW($,X,Z,J,Y){let G=$,Q=J;if(await eL(G,X,Z),G=await $F(G,X,Z),G=await SQ(G,X,Z),G=await CQ(G,X,Z),G=await MG(G,X,Z,Q),M1(G))G=tX(G,X),G=$4(G,X);G=eX(G);let{processStreamDirectives:w}=await X0("stx/streaming",()=>Promise.resolve().then(() => (j3(),U3)));G=w(G,X),G=p3(G,X,Z,Q),G=await $w(G,X,Z,Q,Y),G=await U9(G,X,Z,Q,Y),G=Y2(G,X,Z,Q);let{processDeferDirectives:W}=await X0("stx/defer",()=>Promise.resolve().then(() => bw));G=W(G,X,Z);let{processTeleportDirectives:q}=await X0("stx/teleport",()=>Promise.resolve().then(() => Cw));G=q(G,X,Z);let{processTransitionDirectives:K,processTransitionAttributes:z}=await X0("stx/transitions",()=>Promise.resolve().then(() => fw));G=K(G,X,Z),G=z(G);let{processErrorBoundaryDirectives:U}=await X0("stx/error-boundaries",()=>Promise.resolve().then(() => hw));G=U(G,X,Z);let{processSuspenseDirectives:j}=await X0("stx/suspense",()=>Promise.resolve().then(() => uw));G=j(G,X,Z);let{processAsyncDirectives:B}=await X0("stx/async-components",()=>Promise.resolve().then(() => lw));G=B(G,X,Z);let{processKeepAliveDirectives:H}=await X0("stx/keep-alive",()=>Promise.resolve().then(() => iw));G=H(G,X,Z);let{processVirtualListDirectives:O,processVirtualGridDirectives:L,processInfiniteListDirectives:_}=await X0("stx/virtual-scrolling",()=>Promise.resolve().then(() => (tw(),aw)));G=O(G,X,Z),G=L(G,X,Z),G=_(G,X,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await X0("stx/partial-hydration",()=>Promise.resolve().then(() => (jW(),UW)));G=F(G,X,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await X0("stx/computed",()=>Promise.resolve().then(() => (MW(),TW)));G=A(G,X,Z),G=R(G,X,Z);let{processFormValidationDirectives:N}=await X0("stx/forms-validation",()=>Promise.resolve().then(() => (SW(),bW)));G=N(G,X,Z);let{processHeadDirective:I,processTitleDirective:T,processMetaDirective:k,resetHead:E}=await X0("stx/head",()=>Promise.resolve().then(() => (x5(),TX)));if(!X.__stx_head_preset&&!X.__stx_runtime_head)E();let M=I(G);if(G=M.content,M.headContent)X.__stx_head_raw=`${X.__stx_head_raw||""}${M.headContent}
15446
+ `;if(G=T(G,X),G=k(G,X),G=dQ(G),G=t4(G,X),G=NG(G),G=xQ(G),G=await r3(G,X,Z,Q,Y),G=await U9(G,X,Z,Q,Y),X.__stxProcessingDepth===1)G=c2(G,X);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=w6(G),G=E1(G,X,Z),G=e4(G,X),G=$3(G,X),G=J9(G,X),G=PG(G,X),G=vG(G,X),G=await zG(G,X,Z,Q),G=await AJ(G,X,Z),G=await uG(G,X,Z,Q),G=a6(G,X,Z,Q),G=yY(G,X,Z,Q),G=bY(G,X,Z),G=SY(G,X,Z,Q),G=VG(G,X,Z,Q),G=G6(G,X),G=Q6(G),G=Ow(G),!Q.skipEventDirectives)G=T2(G,X,Z);if(G=qG(G,X,Z),Q.debug){let l=/\bx-data\s*=/.test(G),$0=z$($);if(l&&$0)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
15429
15447
  Both work on the same page, but they manage separate scopes.
15430
- Prefer signals (state/derived/effect) for new components.`)}G=cQ(G,X),G=await f1(G,X,Z),G=Hw(G),G=_w(G),G=eY(G);let{processXElementDirectives:S}=await X0("stx/x-element",()=>Promise.resolve().then(() => SW));G=S(G);let b=X.__originalFilePath||Z,y=P7(X);if(G=await Z4(G,Q,b,y),G=IG(G,X),G=await xQ(G,X,Z,Q),Q.media?.image?.autoSiblings){let r=Q.publicDir||"public",{rewriteImagesWithSiblings:$0}=await X0("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (PW(),CW)));G=await $0(G,{publicDir:r})}if(Q.seo?.enabled)G=bY(G,X,Q);let P=(r,$0,z0=!0)=>{if(!$0)return r;let d0=$0.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),C0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(d0&&C0){if(z0)r=r.replace(C0[0],d0[0]);if($0=$0.replace(d0[0],"").trim(),!$0)return r}if(/<\/head>/i.test(r))return r.replace(/<\/head>/i,`${$0}
15431
- </head>`);if(/<head\b[^>]*>/i.test(r))return r.replace(/(<head\b[^>]*>)/i,`$1
15432
- ${$0}`);if(/<html\b[^>]*>/i.test(r))return r.replace(/(<html\b[^>]*>)/i,`$1
15448
+ Prefer signals (state/derived/effect) for new components.`)}G=iQ(G,X),G=await f1(G,X,Z),G=Lw(G),G=Fw(G),G=ZG(G);let{processXElementDirectives:S}=await X0("stx/x-element",()=>Promise.resolve().then(() => vW));G=S(G);let b=X.__originalFilePath||Z,y=P7(X);if(G=await X4(G,Q,b,y),G=yG(G,X),G=await hQ(G,X,Z,Q),Q.media?.image?.autoSiblings){let l=Q.publicDir||"public",{rewriteImagesWithSiblings:$0}=await X0("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (fW(),xW)));G=await $0(G,{publicDir:l})}if(Q.seo?.enabled)G=CY(G,X,Q);let P=(l,$0,z0=!0)=>{if(!$0)return l;let c0=$0.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($0=$0.replace(c0[0],"").trim(),!$0)return l}if(/<\/head>/i.test(l))return l.replace(/<\/head>/i,`${$0}
15449
+ </head>`);if(/<head\b[^>]*>/i.test(l))return l.replace(/(<head\b[^>]*>)/i,`$1
15450
+ ${$0}`);if(/<html\b[^>]*>/i.test(l))return l.replace(/(<html\b[^>]*>)/i,`$1
15433
15451
  <head>
15434
15452
  ${$0}
15435
- </head>`);return r},{renderHead:f,getHead:x}=await X0("stx/head",()=>Promise.resolve().then(() => (x5(),MX))),u=X.__stx_runtime_head??x();if(u.title||u.meta?.length||u.link?.length){let r=f(u);if(r)G=P(G,r)}if(I.headContent)G=P(G,I.headContent,!u.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=HG(G,Q.csp,X);if(Q.analytics?.enabled)G=XG(G,Q);if(Q.heatmap?.enabled)G=Q2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:r}=await X0("stx/pwa/inject",()=>Promise.resolve().then(() => (gW(),fW)));G=r(G,Q)}let R0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),N0=/\bSTX\.\w+/.test(G),S0=/window\.STX\s*=/.test(G);if(R0&&N0&&!S0){let $0=`<script data-stx-scoped data-stx-run="once">
15436
- ${oY()}
15453
+ </head>`);return l},{renderHead:v,getHead:f}=await X0("stx/head",()=>Promise.resolve().then(() => (x5(),TX))),c=X.__stx_runtime_head??f();if(c.title||c.meta?.length||c.link?.length){let l=v(c);if(l)G=P(G,l)}if(M.headContent)G=P(G,M.headContent,!c.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=LG(G,Q.csp,X);if(Q.analytics?.enabled)G=YG(G,Q);if(Q.heatmap?.enabled)G=W2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:l}=await X0("stx/pwa/inject",()=>Promise.resolve().then(() => (dW(),uW)));G=l(G,Q)}let G0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),S0=/\bSTX\.\w+/.test(G),N0=/window\.STX\s*=/.test(G);if(G0&&S0&&!N0){let $0=`<script data-stx-scoped data-stx-run="once">
15454
+ ${tY()}
15437
15455
  </script>`;if(G.includes("</head>")){let z0=G.indexOf("</head>"),C0=G.slice(0,z0).indexOf("<script");if(C0!==-1){let C=G.slice(0,C0),g=G.slice(C0);G=C+$0+`
15438
15456
  `+g}else G=G.replace("</head>",`${$0}
15439
15457
  </head>`)}else if(G.includes("<body"))G=G.replace(/<body([^>]*)>/,`<body$1>
15440
15458
  ${$0}`);else G=$0+`
15441
- `+G}{let{scanScriptTags:r}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (p7(),z$))),$0=[];for(let z0 of r(G)){if(!/\bserver\b/i.test(z0.attrs))continue;let d0=z0.start+z0.fullMatch.indexOf(">")+1,C0=mL(G,d0);if(C0===-1)continue;let C=C0+9;while(C<G.length&&/\s/.test(G[C]))C++;$0.push({start:z0.start,end:C})}for(let z0=$0.length-1;z0>=0;z0--){let{start:d0,end:C0}=$0[z0];G=G.substring(0,d0)+G.substring(C0)}}let O0=d8(G,Z);if(O0.hasScoped)G=O0.html;let c=X.__stx_event_bindings||[],W0=!1,i=[],n0=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:t0}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (p7(),z$)));for(let r of t0(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))i.push({match:r.fullMatch,attrs:r.attrs,content:r.body});for(let{match:r,attrs:$0,content:z0}of i){W0=!0;let d0=z0;W6(z0,Z,J.strict,X.__originalFilePath);let C0=await v7(z0,{eventBindings:c,attrs:$0,hasColonDirectives:n0,templateContent:$,filePath:Z,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:y});G=G.replace(r,()=>C0)}if(W0)X.__stx_event_bindings=[];if(!W0&&X.__stxProcessingDepth===1){let r=X.__stx_event_bindings||[];if(r.length>0){let $0=YX(r);if($0){let z0=G.lastIndexOf("</body>");G=z0===-1?G+$0:G.slice(0,z0)+$0+`
15442
- `+G.slice(z0)}X.__stx_event_bindings=[]}}if(!YJ(G)&&GJ(G))G=await G$(G,Q);if(G=QJ(G),Q.csp?.enabled&&Q.csp.useNonce&&typeof X.cspNonce==="string")G=_G(G,X.cspNonce);return G}var F5="<!--PARENT_CONTENT_PLACEHOLDER-->";var _$=D(()=>{e$();CX();x1();a9();sY();$G();ZG();$X();t9();GX();x7();wG();qG();e7();LG();AG();TG();EG();k1();x5();B1();CG();gG();EQ();SQ();p3();Q4();fQ();v5();hQ();n$();V0();dQ();lQ();nQ();tQ();AX();$6();qw();p7();m3();jw();w6();q6();y0();B3();HX();y7();Q$();Q$();w6();q6()});import M0 from"fs";import G0 from"path";import R6 from"fs";import Xq from"path";var E9="resources/assets",N6="assets";function T6($=process.cwd()){let X=Xq.resolve($,E9);return R6.existsSync(X)&&R6.statSync(X).isDirectory()?X:null}import A5 from"fs";import D9 from"path";var M6="_stx";function Zq($){return Bun.hash($).toString(16).slice(0,8)}function Jq($){let X=[],Z=(J)=>{for(let Y of A5.readdirSync(J,{withFileTypes:!0})){let G=D9.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 Yq=[{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 Gq($,X=`/${M6}`){let Z=[],J=new Set,Y=0,G=$;for(let Q of Yq)G=G.replace(Q.pattern,(w,W,q)=>{if(/\b(?:src|href)\s*=/.test(W)||!q.trim())return w;let K=`${Q.prefix}.${Zq(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 k6($){let X={pages:0,assets:0,bytesInlined:0},Z=D9.join($,M6),J=new Set;for(let Y of Jq($)){let G=A5.readFileSync(Y,"utf8"),{html:Q,assets:w,bytesInlined:W}=Gq(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(D9.join(Z,q.filename),q.contents),X.assets++}A5.writeFileSync(Y,Q),X.bytesInlined+=W,X.pages++}return X}n9();_$();import{createHash as sL}from"crypto";function aL($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var tL=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function eL($){return Bun.hash($).toString(16)}function mW($,X={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Z=new Map,J=$.replace(tL,(G,Q,w,W)=>{let q=W.trim();if(!q)return G;if(/\bdata-stx-src=/.test(w))return G;if(X.minify)q=aL(q);let K=eL(q);if(!Z.has(K))Z.set(K,q);let z=X.integrity?` data-stx-integrity="sha384-${sL("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 cW($){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)}N1();import B8 from"fs";import k9 from"path";var XF="layout-types.d.ts";function ZF($){let X=[],Z=(J,Y)=>{let G;try{G=B8.readdirSync(J,{withFileTypes:!0})}catch{return}for(let Q of G){if(Q.name.startsWith("."))continue;let w=k9.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 JF($){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(`
15459
+ `+G}{let{scanScriptTags:l}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (p7(),U$))),$0=[];for(let z0 of l(G)){if(!/\bserver\b/i.test(z0.attrs))continue;let c0=z0.start+z0.fullMatch.indexOf(">")+1,C0=nL(G,c0);if(C0===-1)continue;let C=C0+9;while(C<G.length&&/\s/.test(G[C]))C++;$0.push({start:z0.start,end:C})}for(let z0=$0.length-1;z0>=0;z0--){let{start:c0,end:C0}=$0[z0];G=G.substring(0,c0)+G.substring(C0)}}let m0=m8(G,Z);if(m0.hasScoped)G=m0.html;let u=X.__stx_event_bindings||[],H0=!1,r=[],L0=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:X1}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (p7(),U$)));for(let l of X1(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))r.push({match:l.fullMatch,attrs:l.attrs,content:l.body});for(let{match:l,attrs:$0,content:z0}of r){H0=!0;let c0=z0;q6(z0,Z,J.strict,X.__originalFilePath);let C0=await v7(z0,{eventBindings:u,attrs:$0,hasColonDirectives:L0,templateContent:$,filePath:Z,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:y});G=G.replace(l,()=>C0)}if(H0)X.__stx_event_bindings=[];if(!H0&&X.__stxProcessingDepth===1){let l=X.__stx_event_bindings||[];if(l.length>0){let $0=JX(l);if($0){let z0=G.lastIndexOf("</body>");G=z0===-1?G+$0:G.slice(0,z0)+$0+`
15460
+ `+G.slice(z0)}X.__stx_event_bindings=[]}}if(!QJ(G)&&wJ(G))G=await Q$(G,Q);if(G=WJ(G),Q.csp?.enabled&&Q.csp.useNonce&&typeof X.cspNonce==="string")G=FG(G,X.cspNonce);return G}var F5="<!--PARENT_CONTENT_PLACEHOLDER-->";var O$=D(()=>{e7();SX();x1();s9();eY();JG();GG();e9();a9();YX();x7();KG();UG();$8();AG();TG();IG();bG();k1();x5();B1();xG();dG();bQ();vQ();i3();G4();uQ();v5();mQ();r$();A0();lQ();nQ();sQ();Xw();VX();X6();Uw();p7();c3();_w();W6();K6();y0();H3();BX();y7();w$();w$();W6();K6()});import M0 from"fs";import Q0 from"path";import T6 from"fs";import Yq from"path";var I9="resources/assets",M6="assets";function k6($=process.cwd()){let X=Yq.resolve($,I9);return T6.existsSync(X)&&T6.statSync(X).isDirectory()?X:null}import A5 from"fs";import E9 from"path";var I6="_stx";function Gq($){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=E9.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 wq=[{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 Wq($,X=`/${I6}`){let Z=[],J=new Set,Y=0,G=$;for(let Q of wq)G=G.replace(Q.pattern,(w,W,q)=>{if(/\b(?:src|href)\s*=/.test(W)||!q.trim())return w;let K=`${Q.prefix}.${Gq(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 E6($){let X={pages:0,assets:0,bytesInlined:0},Z=E9.join($,I6),J=new Set;for(let Y of Qq($)){let G=A5.readFileSync(Y,"utf8"),{html:Q,assets:w,bytesInlined:W}=Wq(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(E9.join(Z,q.filename),q.contents),X.assets++}A5.writeFileSync(Y,Q),X.bytesInlined+=W,X.pages++}return X}i9();O$();import{createHash as XF}from"crypto";function ZF($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var JF=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function YF($){return Bun.hash($).toString(16)}function pW($,X={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Z=new Map,J=$.replace(JF,(G,Q,w,W)=>{let q=W.trim();if(!q)return G;if(/\bdata-stx-src=/.test(w))return G;if(X.minify)q=ZF(q);let K=YF(q);if(!Z.has(K))Z.set(K,q);let z=X.integrity?` data-stx-integrity="sha384-${XF("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 GF=new Set(["visible","idle"]);function iW($){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(GF.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)}T1();import H8 from"fs";import M9 from"path";var QF="layout-types.d.ts";function wF($){let X=[],Z=(J,Y)=>{let G;try{G=H8.readdirSync(J,{withFileTypes:!0})}catch{return}for(let Q of G){if(Q.name.startsWith("."))continue;let w=M9.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 WF($){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(`
15443
15461
  `);return X.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...$.map((Z)=>` '${Z}': true`)," }","}","","export {}",""),X.join(`
15444
- `)}function lW($,X){if(!$)return[];let Z=k9.isAbsolute($)?$:k9.resolve(process.cwd(),$),J=ZF(Z),Y=JF(J),G=k9.join(X,XF);try{if(B8.existsSync(G)&&B8.readFileSync(G,"utf8")===Y)return J;B8.mkdirSync(X,{recursive:!0}),B8.writeFileSync(G,Y)}catch{}return J}var YF=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function F6($){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 GF($){for(let X of YF){let Z=$[X];if(!Z)continue;let J=F6(Z);if(J)return{url:J,source:"env",via:X}}return null}function pW($){if(!$||typeof $!=="object")return null;let X=$,Z=X.site?.url??X.url??X.app?.url;return typeof Z==="string"?F6(Z):null}async function QF($){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=pW(G.default??G);if(Q)return Q}catch{}}return null}async function iW($={}){let X=$.cwd??process.cwd(),Z=$.env??process.env;if($.explicit){let Q=F6($.explicit);if(Q)return{url:Q,source:"option"}}let J=pW($.stxConfig);if(J)return{url:J,source:"stx.config",via:"site.url"};let Y=await QF(X);if(Y)return{url:Y,source:"site.config",via:"url"};let G=GF(Z);if(G)return G;return{url:"http://localhost",source:"fallback"}}function nW(){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(`
15445
- `)}n$();E7();e$();D5();S1();class rW{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}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 M0.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=M0.statSync($),J=`${$}:${Z.mtimeMs}`;for(let G of X)if(M0.existsSync(G)){let Q=M0.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 oW{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 M0.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 M0.promises.unlink(X)}async invalidatePattern($){let X=G0.join(this.cacheDir,"isr");if(!M0.existsSync(X))return;let Z=await M0.promises.readdir(X);for(let J of Z){let Y=J.replace(/_/g,"/").replace(".json","");if($.test(Y))await M0.promises.unlink(G0.join(X,J))}}async needsRevalidation($){let X=await this.get($);if(!X)return!0;return Date.now()>X.revalidateAfter}}async function wF($){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(`
15462
+ `)}function nW($,X){if(!$)return[];let Z=M9.isAbsolute($)?$:M9.resolve(process.cwd(),$),J=wF(Z),Y=WF(J),G=M9.join(X,QF);try{if(H8.existsSync(G)&&H8.readFileSync(G,"utf8")===Y)return J;H8.mkdirSync(X,{recursive:!0}),H8.writeFileSync(G,Y)}catch{}return J}var qF=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function A6($){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 KF($){for(let X of qF){let Z=$[X];if(!Z)continue;let J=A6(Z);if(J)return{url:J,source:"env",via:X}}return null}function rW($){if(!$||typeof $!=="object")return null;let X=$,Z=X.site?.url??X.url??X.app?.url;return typeof Z==="string"?A6(Z):null}async function zF($){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=rW(G.default??G);if(Q)return Q}catch{}}return null}async function oW($={}){let X=$.cwd??process.cwd(),Z=$.env??process.env;if($.explicit){let Q=A6($.explicit);if(Q)return{url:Q,source:"option"}}let J=rW($.stxConfig);if(J)return{url:J,source:"stx.config",via:"site.url"};let Y=await zF(X);if(Y)return{url:Y,source:"site.config",via:"url"};let G=KF(Z);if(G)return G;return{url:"http://localhost",source:"fallback"}}function sW(){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
+ `)}r$();E7();e7();D5();S1();class aW{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 M0.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=M0.statSync($),J=`${this.salt}|${$}:${Z.mtimeMs}`;for(let G of X)if(M0.existsSync(G)){let Q=M0.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 tW{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 M0.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 M0.promises.unlink(X)}async invalidatePattern($){let X=Q0.join(this.cacheDir,"isr");if(!M0.existsSync(X))return;let Z=await M0.promises.readdir(X);for(let J of Z){let Y=J.replace(/_/g,"/").replace(".json","");if($.test(Y))await M0.promises.unlink(Q0.join(X,J))}}async needsRevalidation($){let X=await this.get($);if(!X)return!0;return Date.now()>X.revalidateAfter}}async function UF($){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(`
15446
15464
  return (async function getStaticPaths() {
15447
15465
  ${Y[1]}
15448
15466
  })()
15449
- `)()}catch(X){return console.error(`Error extracting static paths from ${$}:`,X),null}}async function WF($){let X=[];if(!$.isDynamic)X.push({url:$.pattern,params:{}});else{let Z=await wF($.filePath);if(!Z||Z.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),X;for(let J of Z.paths){let Y=$.pattern;for(let[G,Q]of Object.entries(J.params))Y=Y.replace(`:${G}`,Q).replace(`:${G}*`,Q);X.push({url:Y,params:J.params,props:J.props,revalidate:J.revalidate})}}return X}async function qF($){let X=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let Z of X)if(await Bun.file(Z).exists())try{let J=await import(Z);if(typeof J.default==="function")return await J.default();else if(typeof J.default==="object")return J.default;else if(typeof J.getData==="function")return await J.getData();else{let{default:Y,...G}=J;return G}}catch(J){console.error(`Error loading data file ${Z}:`,J)}return null}async function KF($,X,Z){let J=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let Y=J[1];if(!Y.includes("getStaticProps"))return null;try{let G=Y.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!G)return null;return await Function("params",`
15467
+ `)()}catch(X){return console.error(`Error extracting static paths from ${$}:`,X),null}}async function jF($){let X=[];if(!$.isDynamic)X.push({url:$.pattern,params:{}});else{let Z=await UF($.filePath);if(!Z||Z.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),X;for(let J of Z.paths){let Y=$.pattern;for(let[G,Q]of Object.entries(J.params))Y=Y.replace(`:${G}`,Q).replace(`:${G}*`,Q);X.push({url:Y,params:J.params,props:J.props,revalidate:J.revalidate})}}return X}async function BF($){let X=[$.replace(/\.stx$/,".data.ts"),$.replace(/\.stx$/,".data.js"),$+".data.ts",$+".data.js"];for(let Z of X)if(await Bun.file(Z).exists())try{let J=await import(Z);if(typeof J.default==="function")return await J.default();else if(typeof J.default==="object")return J.default;else if(typeof J.getData==="function")return await J.getData();else{let{default:Y,...G}=J;return G}}catch(J){console.error(`Error loading data file ${Z}:`,J)}return null}async function HF($,X,Z){let J=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!J)return null;let Y=J[1];if(!Y.includes("getStaticProps"))return null;try{let G=Y.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!G)return null;return await Function("params",`
15450
15468
  return (async function getStaticProps() {
15451
15469
  ${G[1]}
15452
15470
  })()
15453
- `)(X)}catch(G){return console.error(`Error executing getStaticProps in ${Z}:`,G),null}}function zF($){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test($)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test($)}async function sW($,X,Z={},J,Y){let G=await Bun.file($.filePath).text(),Q=await qF($.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:(B)=>{K.push(`${G0.relative(process.cwd(),B.templatePath)}: ${B.message}
15454
- resolved against partialsDir: ${B.partialsDir}`)}};if(zF(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 B=`<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>",`${B}
15455
- </head>`);else U=`${B}
15456
- ${U}`}if(U=await sX(U,{router:J.router}),U=await t7(U),J.minify!==!1)return{html:UF(U),dependencies:Array.from(q),includeFailures:K};return{html:U,dependencies:Array.from(q),includeFailures:K}}function UF($){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 jF($){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 BF($,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 HF($,X){return`<?xml version="1.0" encoding="UTF-8"?>
15471
+ `)(X)}catch(G){return console.error(`Error executing getStaticProps in ${Z}:`,G),null}}function _F($){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test($)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test($)}async function eW($,X,Z={},J,Y){let G=await Bun.file($.filePath).text(),Q=await BF($.filePath),w=await HF(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(_F(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 R0(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
+ </head>`);else U=`${j}
15474
+ ${U}`}if(U=await oX(U,{router:J.router}),U=await t7(U),J.minify!==!1)return{html:OF(U),dependencies:Array.from(q),includeFailures:K};return{html:U,dependencies:Array.from(q),includeFailures:K}}function OF($){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 LF($){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 FF($,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 VF($,X){return`<?xml version="1.0" encoding="UTF-8"?>
15457
15475
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
15458
15476
  ${$.map((J)=>{let Y=new URL(J.loc,X).href,G=` <url>
15459
15477
  <loc>${q1(Y)}</loc>`;if(J.lastmod)G+=`
@@ -15462,7 +15480,7 @@ ${$.map((J)=>{let Y=new URL(J.loc,X).href,G=` <url>
15462
15480
  <priority>${J.priority}</priority>`;return G+=`
15463
15481
  </url>`,G}).join(`
15464
15482
  `)}
15465
- </urlset>`}function q1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function _F($,X){let Z=X.map((J)=>{let Y=" <item>";if(Y+=`
15483
+ </urlset>`}function q1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function AF($,X){let Z=X.map((J)=>{let Y=" <item>";if(Y+=`
15466
15484
  <title>${q1(J.title)}</title>`,Y+=`
15467
15485
  <link>${q1(J.link)}</link>`,J.description)Y+=`
15468
15486
  <description>${q1(J.description)}</description>`;if(J.pubDate)Y+=`
@@ -15483,15 +15501,15 @@ ${$.map((J)=>{let Y=new URL(J.loc,X).href,G=` <url>
15483
15501
  ${Z.join(`
15484
15502
  `)}
15485
15503
  </channel>
15486
- </rss>`}async function OF($={}){let X=Date.now();jX();let Z=await Y1(process.cwd()),J=Z.build||{},Y=await iW({explicit:$.domain||J.domain,stxConfig:Z});if(Y.source==="fallback"&&($.sitemap??J.sitemap??!0))console.warn(nW());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||V1(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,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&&M0.existsSync(G.outputDir))await M0.promises.rm(G.outputDir,{recursive:!0});await M0.promises.mkdir(G.outputDir,{recursive:!0});let U=new rW(G.cacheDir);if(G.cache)await U.load();try{let{generateCrosswindCSS:T}=await Promise.resolve().then(() => (e$(),rY));await T('<div class="bg-black"></div>')}catch{}_7();let B=Z?.routeMiddleware?.dir||"middleware";await L7(process.cwd(),B);let j=O7();if(j.length>0)console.log(`Loaded ${j.length} middleware: ${j.join(", ")}`);let H=Z?.routeMiddleware?.global||[];lW(Z?.layoutsDir,V1(process.cwd()));let O=T7(".",{pagesDir:G.pagesDir});console.log(`Found ${O.length} routes`);let L=[];for(let T of O){let M=await WF(T);for(let k of M)L.push({route:T,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??G.revalidate})}Q.totalPages=L.length,console.log(`Generating ${Q.totalPages} pages...`);let _=[],F=[];for(let T=0;T<L.length;T+=G.concurrency)F.push(L.slice(T,T+G.concurrency));for(let T of F)await Promise.all(T.map(async(M)=>{let{route:k,url:E,params:I,props:S,revalidate:b}=M;try{await G.hooks.onPageStart?.(E);let y=await Bun.file(k.filePath).text(),P=AF(y),f=P?.middleware?Array.isArray(P.middleware)?P.middleware:[P.middleware]:[],x=[...H,...f];if(x.length>0){let O0=F7(E,I,P||{}),c=V7(O0,null,void 0,{isServer:!0}),W0=await A7(x,c);if(W0.redirect){let i=typeof W0.redirect==="string"?W0.redirect:W0.redirect.path||W0.redirect,n0=RF(String(i),E),t0=NF(E,G);await M0.promises.mkdir(G0.dirname(t0),{recursive:!0}),await Bun.write(t0,n0),Q.successCount++,Q.pages.push({route:E,outputPath:t0,size:Buffer.byteLength(n0),cached:!1}),_.push({loc:E,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${E} \u2192 redirect to ${i}`);return}if(W0.abort){let i=typeof W0.abort==="string"?W0.abort:W0.abort?.error?.message||"aborted";console.warn(` \u21B3 ${E} \u2014 middleware aborted: ${i}`);return}}let p=y.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(p)try{if(!await Function("route",`
15487
- const validate = ${p[1]};
15504
+ </rss>`}async function RF($={}){let X=Date.now();UX();let Z=await Y1(process.cwd()),J=Z.build||{},Y=await oW({explicit:$.domain||J.domain,stxConfig:Z});if(Y.source==="fallback"&&($.sitemap??J.sitemap??!0))console.warn(sW());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&&M0.existsSync(G.outputDir))await M0.promises.rm(G.outputDir,{recursive:!0});await M0.promises.mkdir(G.outputDir,{recursive:!0});let U=G.cacheSalt;if(!U){let{resolveUserCrosswindConfig:T,fingerprintConfig:k}=await Promise.resolve().then(() => (e7(),r4));try{U=k(await T(process.cwd()))}catch{}}let j=new aW(G.cacheDir,U);if(G.cache)await j.load();try{let{generateCrosswindCSS:T}=await Promise.resolve().then(() => (e7(),r4));await T('<div class="bg-black"></div>')}catch{}_7();let B=Z?.routeMiddleware?.dir||"middleware";await L7(process.cwd(),B);let H=O7();if(H.length>0)console.log(`Loaded ${H.length} middleware: ${H.join(", ")}`);let O=Z?.routeMiddleware?.global||[];nW(Z?.layoutsDir,A1(process.cwd()));let L=T7(".",{pagesDir:G.pagesDir});console.log(`Found ${L.length} routes`);let _=[];for(let T of L){let k=await jF(T);for(let E of k)_.push({route:T,url:E.url,params:E.params,props:E.props,revalidate:E.revalidate??G.revalidate})}Q.totalPages=_.length,console.log(`Generating ${Q.totalPages} pages...`);let F=[],V=[];for(let T=0;T<_.length;T+=G.concurrency)V.push(_.slice(T,T+G.concurrency));for(let T of V)await Promise.all(T.map(async(k)=>{let{route:E,url:M,params:S,props:b,revalidate:y}=k;try{await G.hooks.onPageStart?.(M);let P=await Bun.file(E.filePath).text(),v=kF(P),f=v?.middleware?Array.isArray(v.middleware)?v.middleware:[v.middleware]:[],i=[...O,...f];if(i.length>0){let u=F7(M,S,v||{}),H0=V7(u,null,void 0,{isServer:!0}),r=await A7(i,H0);if(r.redirect){let L0=typeof r.redirect==="string"?r.redirect:r.redirect.path||r.redirect,X1=IF(String(L0),M),l=EF(M,G);await M0.promises.mkdir(Q0.dirname(l),{recursive:!0}),await Bun.write(l,X1),Q.successCount++,Q.pages.push({route:M,outputPath:l,size:Buffer.byteLength(X1),cached:!1}),F.push({loc:M,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${M} \u2192 redirect to ${L0}`);return}if(r.abort){let L0=typeof r.abort==="string"?r.abort:r.abort?.error?.message||"aborted";console.warn(` \u21B3 ${M} \u2014 middleware aborted: ${L0}`);return}}let c=P.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(c)try{if(!await Function("route",`
15505
+ const validate = ${c[1]};
15488
15506
  return validate(route);
15489
- `)({params:I})){console.warn(`Validation failed for ${E}, skipping...`);return}}catch{}let u=null,R0=!1;if(G.cache){if(u=U.get(E,k.filePath),u)R0=!0,Q.cachedCount++}if(!u){let O0=await sW(k,I,S,G,Z);if(u=O0.html,G.failOnIncludeError&&O0.includeFailures.length>0)throw Error(`${O0.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
15490
- ${O0.includeFailures.join(`
15507
+ `)({params:S})){console.warn(`Validation failed for ${M}, skipping...`);return}}catch{}let G0=null,S0=!1;if(G.cache){if(G0=j.get(M,E.filePath),G0)S0=!0,Q.cachedCount++}if(!G0){let u=await eW(E,S,b,G,Z);if(G0=u.html,G.failOnIncludeError&&u.includeFailures.length>0)throw Error(`${u.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
15508
+ ${u.includeFailures.join(`
15491
15509
  `)}
15492
- Set ssg.failOnIncludeError to false to build anyway.`);if(G.cache)U.set(E,k.filePath,O0.dependencies,u)}let N0;if(G.trailingSlash)N0=G0.join(G.outputDir,E,"index.html");else N0=E==="/"?G0.join(G.outputDir,"index.html"):G0.join(G.outputDir,`${E}.html`);if(G.chunkIslands){let{html:O0,chunks:c}=mW(u,{integrity:G.integrityIslands,minify:G.minify});if(c.length>0){let W0=G0.join(G.outputDir,"_stx","islands");await M0.promises.mkdir(W0,{recursive:!0});for(let i of c){let n0=G0.join(W0,`${i.hash}.js`);if(!await Bun.file(n0).exists())await Bun.write(n0,i.code);if(!w.has(i.hash)){w.add(i.hash);let t0=Buffer.byteLength(i.code,"utf8");W+=t0,q[i.hash]={bytes:t0,file:`/_stx/islands/${i.hash}.js`}}}if(K[E]=c.map((i)=>i.hash),u=O0,G.prefetchIslands)u=cW(u)}}if(await M0.promises.mkdir(G0.dirname(N0),{recursive:!0}),await Bun.write(N0,u),!BF(E,u,P,G.sitemapExclude))_.push({loc:E,lastmod:new Date().toISOString().split("T")[0],priority:E==="/"?1:0.8});let S0={route:E,outputPath:N0,size:Buffer.byteLength(u,"utf8"),cached:R0};if(b!==!1)S0.revalidateAt=Date.now()+b*1000;Q.pages.push(S0),Q.successCount++,await G.hooks.onPageEnd?.(E,u)}catch(y){Q.failedCount++,Q.errors.push({route:E,error:y}),await G.hooks.onError?.(y,E),console.error(`Error generating ${E}:`,y)}}));let V=UX();if(V.length>0){let T=V.map((M)=>`${M.filePath}: ${M.message}`).join(`
15510
+ Set ssg.failOnIncludeError to false to build anyway.`);if(G.cache)j.set(M,E.filePath,u.dependencies,G0)}let N0;if(G.trailingSlash)N0=Q0.join(G.outputDir,M,"index.html");else N0=M==="/"?Q0.join(G.outputDir,"index.html"):Q0.join(G.outputDir,`${M}.html`);if(G.chunkIslands){let{html:u,chunks:H0}=pW(G0,{integrity:G.integrityIslands,minify:G.minify});if(H0.length>0){let r=Q0.join(G.outputDir,"_stx","islands");await M0.promises.mkdir(r,{recursive:!0});for(let L0 of H0){let X1=Q0.join(r,`${L0.hash}.js`);if(!await Bun.file(X1).exists())await Bun.write(X1,L0.code);if(!w.has(L0.hash)){w.add(L0.hash);let l=Buffer.byteLength(L0.code,"utf8");W+=l,q[L0.hash]={bytes:l,file:`/_stx/islands/${L0.hash}.js`}}}if(K[M]=H0.map((L0)=>L0.hash),G0=u,G.prefetchIslands)G0=iW(G0)}}if(await M0.promises.mkdir(Q0.dirname(N0),{recursive:!0}),await Bun.write(N0,G0),!FF(M,G0,v,G.sitemapExclude))F.push({loc:M,lastmod:new Date().toISOString().split("T")[0],priority:M==="/"?1:0.8});let m0={route:M,outputPath:N0,size:Buffer.byteLength(G0,"utf8"),cached:S0};if(y!==!1)m0.revalidateAt=Date.now()+y*1000;Q.pages.push(m0),Q.successCount++,await G.hooks.onPageEnd?.(M,G0)}catch(P){Q.failedCount++,Q.errors.push({route:M,error:P}),await G.hooks.onError?.(P,M),console.error(`Error generating ${M}:`,P)}}));let A=zX();if(A.length>0){let T=A.map((k)=>`${k.filePath}: ${k.message}`).join(`
15493
15511
  `);throw Error(`Client script bundling failed:
15494
- ${T}`)}if(G.cache)await U.save();if(G.generate404){let T=G0.join(G.pagesDir,"404.stx");if(await Bun.file(T).exists()){let M=new Set,k={...Z,debug:!1,cache:!1},E=await A0(await Bun.file(T).text(),{},T,k,M);await Bun.write(G0.join(G.outputDir,"404.html"),E)}else await Bun.write(G0.join(G.outputDir,"404.html"),`<!DOCTYPE html>
15512
+ ${T}`)}if(G.cache)await j.save();if(G.generate404){let T=Q0.join(G.pagesDir,"404.stx");if(await Bun.file(T).exists()){let k=new Set,E={...Z,debug:!1,cache:!1},M=await R0(await Bun.file(T).text(),{},T,E,k);await Bun.write(Q0.join(G.outputDir,"404.html"),M)}else await Bun.write(Q0.join(G.outputDir,"404.html"),`<!DOCTYPE html>
15495
15513
  <html lang="en">
15496
15514
  <head>
15497
15515
  <meta charset="UTF-8">
@@ -15512,7 +15530,7 @@ ${T}`)}if(G.cache)await U.save();if(G.generate404){let T=G0.join(G.pagesDir,"404
15512
15530
  <a href="/">Go home</a>
15513
15531
  </div>
15514
15532
  </body>
15515
- </html>`)}for(let T of[500]){let M=G0.join(G.pagesDir,`${T}.stx`);if(await Bun.file(M).exists()){let k=new Set,E={...Z,debug:!1,cache:!1},I=await A0(await Bun.file(M).text(),{},M,E,k);await Bun.write(G0.join(G.outputDir,`${T}.html`),I)}}let A=G0.join(G.pagesDir,"error.stx");if(await Bun.file(A).exists()){let T=new Set,M={...Z,debug:!1,cache:!1},k=await A0(await Bun.file(A).text(),{},A,M,T);await Bun.write(G0.join(G.outputDir,"error.html"),k)}if(G.sitemap&&_.length>0){let T=HF(_,G.domain),M=G0.join(G.outputDir,"sitemap.xml");await Bun.write(M,T),Q.sitemapPath=M,console.log(`Generated sitemap.xml with ${_.length} URLs`)}if(G.robots!==!1){let T=typeof G.robots==="object"?G.robots:{},M=[...G.sitemapExclude.filter((E)=>typeof E==="string"),...T.disallow||[]],k=PY({rules:[{userAgent:T.userAgent||"*",allow:T.allow||["/"],...M.length>0?{disallow:M}:{}}],...T.sitemap!==!1&&Q.sitemapPath?{sitemap:new URL("/sitemap.xml",G.domain).href}:{}});await Bun.write(G0.join(G.outputDir,"robots.txt"),k),console.log("Generated robots.txt")}if(G.rss){let T=typeof G.rss==="object"?G.rss:{title:"Site Feed",description:"Latest updates",link:G.domain},M=[];if(T.getItems)M=await T.getItems();let k=_F(T,M),E=G0.join(G.outputDir,"rss.xml");await Bun.write(E,k),Q.rssPath=E,console.log(`Generated rss.xml with ${M.length} items`)}let R=k6(G.outputDir);if(R.assets>0)console.log(`Externalized ${R.assets} asset(s) from ${R.pages} page(s) (${(R.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(G.publicDir&&M0.existsSync(G.publicDir))await V6(G.publicDir,G.outputDir),console.log(`Copied public assets from ${G.publicDir}`);let N=T6();if(N)await V6(N,G0.join(G.outputDir,N6)),console.log(`Copied assets from ${E9}`)}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 T of[500]){let k=Q0.join(G.pagesDir,`${T}.stx`);if(await Bun.file(k).exists()){let E=new Set,M={...Z,debug:!1,cache:!1},S=await R0(await Bun.file(k).text(),{},k,M,E);await Bun.write(Q0.join(G.outputDir,`${T}.html`),S)}}let R=Q0.join(G.pagesDir,"error.stx");if(await Bun.file(R).exists()){let T=new Set,k={...Z,debug:!1,cache:!1},E=await R0(await Bun.file(R).text(),{},R,k,T);await Bun.write(Q0.join(G.outputDir,"error.html"),E)}if(G.sitemap&&F.length>0){let T=VF(F,G.domain),k=Q0.join(G.outputDir,"sitemap.xml");await Bun.write(k,T),Q.sitemapPath=k,console.log(`Generated sitemap.xml with ${F.length} URLs`)}if(G.robots!==!1){let T=typeof G.robots==="object"?G.robots:{},k=[...G.sitemapExclude.filter((M)=>typeof M==="string"),...T.disallow||[]],E=xY({rules:[{userAgent:T.userAgent||"*",allow:T.allow||["/"],...k.length>0?{disallow:k}:{}}],...T.sitemap!==!1&&Q.sitemapPath?{sitemap:new URL("/sitemap.xml",G.domain).href}:{}});await Bun.write(Q0.join(G.outputDir,"robots.txt"),E),console.log("Generated robots.txt")}if(G.rss){let T=typeof G.rss==="object"?G.rss:{title:"Site Feed",description:"Latest updates",link:G.domain},k=[];if(T.getItems)k=await T.getItems();let E=AF(T,k),M=Q0.join(G.outputDir,"rss.xml");await Bun.write(M,E),Q.rssPath=M,console.log(`Generated rss.xml with ${k.length} items`)}let N=E6(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)`);if(G.publicDir&&M0.existsSync(G.publicDir))await R6(G.publicDir,G.outputDir),console.log(`Copied public assets from ${G.publicDir}`);let I=k6();if(I)await R6(I,Q0.join(G.outputDir,M6)),console.log(`Copied assets from ${I9}`)}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?`
15516
15534
  Island chunks: ${Q.islandChunks.count} (${(Q.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
15517
15535
  Build complete!
15518
15536
  Total: ${Q.totalPages} pages
@@ -15520,8 +15538,8 @@ Build complete!
15520
15538
  Cached: ${Q.cachedCount}
15521
15539
  Failed: ${Q.failedCount}
15522
15540
  Time: ${Q.buildTime}ms${z}
15523
- `),Q}async function V6($,X){await M0.promises.mkdir(X,{recursive:!0});let Z=await M0.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 M0.promises.mkdir(G,{recursive:!0}),await V6(Y,G);else await M0.promises.copyFile(Y,G)}}function LF($={}){let X=$.cacheDir||V1(process.cwd(),"ssg-cache"),Z=new oW(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=T7(".",{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 sW(Q,W,{},$,q);await Z.set(Y,{html:K,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:jF(K)}),console.log(`Revalidated: ${Y}`)},async invalidate(Y){if(typeof Y==="string")await Z.invalidate(Y);else await Z.invalidatePattern(Y)}}}function FF($){return async()=>{return{paths:await $(),fallback:!1}}}function VF(){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(`
15524
- `)){let z=K.indexOf(":");if(z>0){let U=K.slice(0,z).trim(),B=K.slice(z+1).trim();if(B==="true")B=!0;else if(B==="false")B=!1;else if(/^\d+$/.test(B))B=parseInt(B,10);else if(/^\d+\.\d+$/.test(B))B=parseFloat(B);else if(B.startsWith("[")&&B.endsWith("]"))B=B.slice(1,-1).split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,""));J[U]=B}}}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 AF($){return $9($)}function RF($,X){return`<!DOCTYPE html>
15541
+ `),Q}async function R6($,X){await M0.promises.mkdir(X,{recursive:!0});let Z=await M0.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 M0.promises.mkdir(G,{recursive:!0}),await R6(Y,G);else await M0.promises.copyFile(Y,G)}}function NF($={}){let X=$.cacheDir||A1(process.cwd(),"ssg-cache"),Z=new tW(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=T7(".",{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 eW(Q,W,{},$,q);await Z.set(Y,{html:K,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:LF(K)}),console.log(`Revalidated: ${Y}`)},async invalidate(Y){if(typeof Y==="string")await Z.invalidate(Y);else await Z.invalidatePattern(Y)}}}function TF($){return async()=>{return{paths:await $(),fallback:!1}}}function MF(){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
+ `)){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 kF($){return e$($)}function IF($,X){return`<!DOCTYPE html>
15525
15543
  <html>
15526
15544
  <head>
15527
15545
  <meta charset="utf-8">
@@ -15533,4 +15551,4 @@ Build complete!
15533
15551
  <p>Redirecting to <a href="${$}">${$}</a>...</p>
15534
15552
  <script>window.location.replace('${$}')</script>
15535
15553
  </body>
15536
- </html>`}function NF($,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 Iy={generateStaticSite:OF,createISRHandler:LF,defineStaticPaths:FF,createMarkdownLoader:VF};export{BF as isExcludedFromSitemap,OF as generateStaticSite,FF as defineStaticPaths,Iy as default,zF as declaresPageAction,VF as createMarkdownLoader,LF as createISRHandler};
15554
+ </html>`}function EF($,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 Sy={generateStaticSite:RF,createISRHandler:NF,defineStaticPaths:TF,createMarkdownLoader:MF};export{FF as isExcludedFromSitemap,RF as generateStaticSite,TF as defineStaticPaths,Sy as default,_F as declaresPageAction,MF as createMarkdownLoader,NF as createISRHandler};