@stacksjs/stx 0.2.180 → 0.2.181

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 pq=Object.defineProperty;var iq=($)=>$;function nq($,X){this[$]=iq.bind(null,X)}var a=($,X)=>{for(var Z in X)pq($,Z,{get:X[Z],enumerable:!0,configurable:!0,set:nq.bind(X,Z)})};var y=($,X)=>()=>($&&(X=$($=0)),X);var U0=import.meta.require;function M9($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>X7.includes(Z))}function Z7($){return M9($.replace(/^\//,""))}var X7;var j8=y(()=>{X7=["components","layouts","partials","emails"]});import O5 from"fs";import J7 from"path";function Y7($,X){let Z=$.filter((Q)=>!Z7(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 W of Q.params){let K=Q.pattern.includes(`:${W}?`)?"?":"";w.push(`${W}${K}: string`)}let q=w.join("; ");J.push(` '${Q.pattern}': { ${q} }`)}J.push(" }","}","","export {}","")}let Y=J.join(`
3
- `),G=J7.join(X,"route-types.d.ts");try{if(O5.existsSync(G)&&O5.readFileSync(G,"utf8")===Y)return;O5.mkdirSync(X,{recursive:!0}),O5.writeFileSync(G,Y)}catch{}}function G7($,X,Z){let J=process.cwd(),Y=J7.relative(J,Z),G=$.filter((w)=>!Z7(w.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${Y||"pages"}/`,"","export const routes = ["];for(let w of G){let q=J7.relative(J,w.filePath).replace(/\\/g,"/"),W=JSON.stringify(w.params),K=w.layout?`, layout: '${J7.relative(J,w.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${w.pattern}', filePath: '${q}', isDynamic: ${w.isDynamic}, params: ${W}${K} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),O5.mkdirSync(X,{recursive:!0}),O5.writeFileSync(J7.join(X,"routes.ts"),Q.join(`
4
- `))}var k9=y(()=>{j8()});import R6 from"path";function B8($,X){let J=R6.relative(X,$).replace(/\.(stx|md)$/,"");if(J=J.split(R6.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 Q7($){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 _8($,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 N6($){let X=$.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return Q7(X)}var I9=()=>{};import eq from"fs";import E9 from"path";function H8($,X){let Z=[],J=E9.dirname($);while(J.startsWith(X)||J===X){let Y=E9.join(J,"_layout.stx");if(eq.existsSync(Y))Z.unshift(Y);if(J===X)break;J=E9.dirname(J)}return Z}var D9=()=>{};import y9 from"fs";import L5 from"path";function T6($,X){let Z=[];if(!y9.existsSync($))return Z;let J=y9.readdirSync($,{withFileTypes:!0});for(let Y of J){let G=L5.join($,Y.name);if(Y.isDirectory()){if(Y.name.startsWith("."))continue;if(X7.includes(Y.name))continue;Z.push(...T6(G,X))}else if(Y.isFile()){let Q=L5.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 F5{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)=>L5.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=T6(Q,J);for(let q of w){let W=B8(q,Q);if(Y.has(W))continue;Y.add(W);let{regex:K,params:z}=Q7(W),U=X.layouts!==!1?H8(q,Q):[];this.routes.push({pattern:W,regex:K,params:z,filePath:q,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 q=Q.pattern.split("/").length,W=w.pattern.split("/").length;if(q!==W)return W-q;return Q.pattern.localeCompare(w.pattern)});let G=L5.resolve($,X.stateDir||process.env.STX_DIR?.trim()||".stx");Y7(this.routes,G),G7(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 M6($,X){return new F5($,X)}function b9($,X){let Z=[`${X}.stx`,"error.stx"];for(let J of Z){let Y=L5.join($,J);if(y9.existsSync(Y))return Y}return null}function S9($,X){return $.map((Z)=>{let J=L5.relative(X,Z.filePath),Y=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${J}${Y}`})}var k6=y(()=>{k9();I9();D9();j8()});function C9($){O8=$.replace(/\/$/,"")}function P9($,X,Z={}){V5[$]={path:X,name:$,params:Z}}function v9($){for(let[X,Z]of Object.entries($))if(typeof Z==="string")V5[X]={path:Z,name:X};else V5[X]={...Z,name:X}}function w7($,X={},Z=!1){let J=V5[$];if(!J)return console.warn(`Route [${$}] not defined.`),"#undefined-route";let Y={...J.params,...X},G=J.path;G=G.replace(/:(\w+)/g,(w,q)=>{let W=Y[q];if(W===void 0)return console.warn(`Missing parameter [${q}] for route [${$}].`),`:${q}`;return delete Y[q],encodeURIComponent(String(W))});let Q=Object.entries(Y);if(Q.length>0){let w=Q.map(([q,W])=>`${encodeURIComponent(q)}=${encodeURIComponent(String(W))}`).join("&");G+=(G.includes("?")?"&":"?")+w}return Z&&O8?`${O8}${G}`:G}function x9(){for(let $ of Object.keys(V5))delete V5[$];O8=""}var V5,O8="";var I6=y(()=>{V5={}});import E6 from"fs";import D6 from"path";function g9($,X={}){return{type:"redirect",path:$,options:{replace:X.replace??!1,external:X.external??!1,redirectCode:X.redirectCode??302}}}function h9($){return{type:"abort",error:typeof $==="string"?{statusCode:500,message:$}:$}}function u9($,X={}){return{handler:$,mode:X.mode??"universal"}}function f9($){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 L8($,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 F8($,X){let Z=$.headers.get("cookie")||"",J=f9(Z);return{get(Y){return J[Y]},set(Y,G,Q={}){J[Y]=G,X.append("Set-Cookie",L8(Y,G,Q))},delete(Y){delete J[Y],X.append("Set-Cookie",L8(Y,"",{expires:new Date(0),path:"/"}))},getAll(){return{...J}}}}function V8(){return{get($){if(typeof document>"u")return;return f9(document.cookie)[$]},set($,X,Z={}){if(typeof document>"u")return;document.cookie=L8($,X,Z)},delete($){if(typeof document>"u")return;document.cookie=L8($,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return f9(document.cookie)}}}function A8(){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 q7($,X){W7.set($,X)}function R8($){return W7.get($)}function d9($){return W7.has($)}function K7(){W7.clear()}function z7(){return Array.from(W7.keys())}async function U7($,X="middleware"){let Z=D6.resolve($,X);if(!E6.existsSync(Z))return;let J=E6.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=D6.join(Z,Y);try{let q=(await import(Q)).default;if(q&&typeof q.handler==="function")q7(G,q);else if(typeof q==="function")q7(G,{handler:q,mode:"universal"})}catch(w){console.warn(`Failed to load middleware '${G}' from ${Q}:`,w)}}}function $W($){let X={};if(!$)return X;let Z=new URLSearchParams($);for(let[J,Y]of Z)X[J]=Y;return X}function j7($,X,Z,J=""){return{path:$,params:X,query:$W(J),fullPath:J?`${$}?${J}`:$,meta:Z}}function B7($,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?F8(Z,Q):V8(),storage:A8(),state:{},request:Z,responseHeaders:Q}}async function _7($,X){let Z=Array.isArray($)?$:[$],J=X.isServer;for(let Y of Z){let G=R8(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 W7;var y6=y(()=>{W7=new Map});function H7($){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 b6($){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]||H7(Y)}}function XW($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function O7(){if(N8)return N8;return N8=XW(`
2
+ var oq=Object.defineProperty;var sq=($)=>$;function aq($,X){this[$]=sq.bind(null,X)}var t=($,X)=>{for(var Z in X)oq($,Z,{get:X[Z],enumerable:!0,configurable:!0,set:aq.bind(X,Z)})};var D=($,X)=>()=>($&&(X=$($=0)),X);var B0=import.meta.require;function D9($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>G7.includes(Z))}function Q7($){return D9($.replace(/^\//,""))}var G7;var O8=D(()=>{G7=["components","layouts","partials","emails"]});import V5 from"fs";import w7 from"path";function q7($,X){let Z=$.filter((Q)=>!Q7(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 W of Q.params){let K=Q.pattern.includes(`:${W}?`)?"?":"";w.push(`${W}${K}: string`)}let q=w.join("; ");J.push(` '${Q.pattern}': { ${q} }`)}J.push(" }","}","","export {}","")}let Y=J.join(`
3
+ `),G=w7.join(X,"route-types.d.ts");try{if(V5.existsSync(G)&&V5.readFileSync(G,"utf8")===Y)return;V5.mkdirSync(X,{recursive:!0}),V5.writeFileSync(G,Y)}catch{}}function W7($,X,Z){let J=process.cwd(),Y=w7.relative(J,Z),G=$.filter((w)=>!Q7(w.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${Y||"pages"}/`,"","export const routes = ["];for(let w of G){let q=w7.relative(J,w.filePath).replace(/\\/g,"/"),W=JSON.stringify(w.params),K=w.layout?`, layout: '${w7.relative(J,w.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${w.pattern}', filePath: '${q}', isDynamic: ${w.isDynamic}, params: ${W}${K} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),V5.mkdirSync(X,{recursive:!0}),V5.writeFileSync(w7.join(X,"routes.ts"),Q.join(`
4
+ `))}var y9=D(()=>{O8()});import k6 from"path";function L8($,X){let J=k6.relative(X,$).replace(/\.(stx|md)$/,"");if(J=J.split(k6.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 K7($){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 F8($,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 I6($){let X=$.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return K7(X)}var b9=()=>{};import JW from"fs";import S9 from"path";function V8($,X){let Z=[],J=S9.dirname($);while(J.startsWith(X)||J===X){let Y=S9.join(J,"_layout.stx");if(JW.existsSync(Y))Z.unshift(Y);if(J===X)break;J=S9.dirname(J)}return Z}var C9=()=>{};import P9 from"fs";import A5 from"path";function E6($,X){let Z=[];if(!P9.existsSync($))return Z;let J=P9.readdirSync($,{withFileTypes:!0});for(let Y of J){let G=A5.join($,Y.name);if(Y.isDirectory()){if(Y.name.startsWith("."))continue;if(G7.includes(Y.name))continue;Z.push(...E6(G,X))}else if(Y.isFile()){let Q=A5.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 R5{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)=>A5.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=E6(Q,J);for(let q of w){let W=L8(q,Q);if(Y.has(W))continue;Y.add(W);let{regex:K,params:z}=K7(W),U=X.layouts!==!1?V8(q,Q):[];this.routes.push({pattern:W,regex:K,params:z,filePath:q,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 q=Q.pattern.split("/").length,W=w.pattern.split("/").length;if(q!==W)return W-q;return Q.pattern.localeCompare(w.pattern)});let G=A5.resolve($,X.stateDir||process.env.STX_DIR?.trim()||".stx");q7(this.routes,G),W7(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 D6($,X){return new R5($,X)}function v9($,X){let Z=[`${X}.stx`,"error.stx"];for(let J of Z){let Y=A5.join($,J);if(P9.existsSync(Y))return Y}return null}function x9($,X){return $.map((Z)=>{let J=A5.relative(X,Z.filePath),Y=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${J}${Y}`})}var y6=D(()=>{y9();b9();C9();O8()});function f9($){A8=$.replace(/\/$/,"")}function g9($,X,Z={}){N5[$]={path:X,name:$,params:Z}}function h9($){for(let[X,Z]of Object.entries($))if(typeof Z==="string")N5[X]={path:Z,name:X};else N5[X]={...Z,name:X}}function z7($,X={},Z=!1){let J=N5[$];if(!J)return console.warn(`Route [${$}] not defined.`),"#undefined-route";let Y={...J.params,...X},G=J.path;G=G.replace(/:(\w+)/g,(w,q)=>{let W=Y[q];if(W===void 0)return console.warn(`Missing parameter [${q}] for route [${$}].`),`:${q}`;return delete Y[q],encodeURIComponent(String(W))});let Q=Object.entries(Y);if(Q.length>0){let w=Q.map(([q,W])=>`${encodeURIComponent(q)}=${encodeURIComponent(String(W))}`).join("&");G+=(G.includes("?")?"&":"?")+w}return Z&&A8?`${A8}${G}`:G}function u9(){for(let $ of Object.keys(N5))delete N5[$];A8=""}var N5,A8="";var b6=D(()=>{N5={}});import S6 from"fs";import C6 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 R8($,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 N8($,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",R8(Y,G,Q))},delete(Y){delete J[Y],X.append("Set-Cookie",R8(Y,"",{expires:new Date(0),path:"/"}))},getAll(){return{...J}}}}function T8(){return{get($){if(typeof document>"u")return;return d9(document.cookie)[$]},set($,X,Z={}){if(typeof document>"u")return;document.cookie=R8($,X,Z)},delete($){if(typeof document>"u")return;document.cookie=R8($,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return d9(document.cookie)}}}function M8(){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 U7($,X){j7.set($,X)}function k8($){return j7.get($)}function p9($){return j7.has($)}function B7(){j7.clear()}function _7(){return Array.from(j7.keys())}async function H7($,X="middleware"){let Z=C6.resolve($,X);if(!S6.existsSync(Z))return;let J=S6.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=C6.join(Z,Y);try{let q=(await import(Q)).default;if(q&&typeof q.handler==="function")U7(G,q);else if(typeof q==="function")U7(G,{handler:q,mode:"universal"})}catch(w){console.warn(`Failed to load middleware '${G}' from ${Q}:`,w)}}}function YW($){let X={};if(!$)return X;let Z=new URLSearchParams($);for(let[J,Y]of Z)X[J]=Y;return X}function O7($,X,Z,J=""){return{path:$,params:X,query:YW(J),fullPath:J?`${$}?${J}`:$,meta:Z}}function L7($,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?N8(Z,Q):T8(),storage:M8(),state:{},request:Z,responseHeaders:Q}}async function F7($,X){let Z=Array.isArray($)?$:[$],J=X.isServer;for(let Y of Z){let G=k8(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 j7;var P6=D(()=>{j7=new Map});function V7($){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 v6($){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]||V7(Y)}}function GW($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function A7(){if(I8)return I8;return I8=GW(`
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
- `),N8}var N8;var S6={};a(S6,{setAppUrl:()=>C9,runMiddleware:()=>_7,route:()=>w7,resolveLayoutChain:()=>H8,resetRoutes:()=>x9,registerMiddleware:()=>q7,patternToRegex:()=>Q7,navigateTo:()=>g9,matchRoute:()=>_8,loadMiddlewareFromDirectory:()=>U7,isNonPageRoutePattern:()=>Z7,isNonPageRoutePath:()=>M9,hasMiddleware:()=>d9,getRouterScript:()=>O7,getMiddlewareNames:()=>z7,getMiddleware:()=>R8,generateRouteTypes:()=>Y7,generateRouteManifest:()=>G7,formatRoutes:()=>S9,findErrorPage:()=>b9,filePathToPattern:()=>B8,extractLayoutMetadata:()=>b6,deriveLayoutGroup:()=>H7,defineRoutes:()=>v9,defineRoute:()=>P9,defineMiddleware:()=>u9,createStorageManager:()=>A8,createServerCookieManager:()=>F8,createRouter:()=>M6,createRouteLocation:()=>j7,createMiddlewareContext:()=>B7,createClientCookieManager:()=>V8,clearMiddleware:()=>K7,bracketPathToRegex:()=>N6,abortNavigation:()=>h9,Router:()=>F5,NON_PAGE_DIRS:()=>X7});var I1=y(()=>{k6();I9();I6();y6();D9();k9();j8()});function L7($,X={}){return new F5($,X).routes}var m9=y(()=>{I1();I1()});function c9($){return`--stx-${$}`}function l9($,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 P6($){let X={};for(let[Z,J]of Object.entries(C6)){let Y=l9($,J.light);if(Y===void 0)continue;X[Z]=`var(${c9(Z)}, ${Y})`}return X}function v6($){let X=[],Z=[];for(let[J,Y]of Object.entries(C6)){let G=l9($,Y.light),Q=l9($,Y.dark);if(G===void 0)continue;if(X.push(` ${c9(J)}: ${G};`),Q!==void 0)Z.push(` ${c9(J)}: ${Q};`)}if(X.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...X,"}",".dark {",...Z,"}",""].join(`
1655
- `)}var C6;var x6=y(()=>{C6={fg:{light:"gray-900",dark:"gray-100",description:"Primary text"},"fg-strong":{light:"gray-700",dark:"gray-300",description:"Labels, secondary headings"},"fg-muted":{light:"gray-600",dark:"gray-400",description:"Supporting text"},"fg-soft":{light:"gray-500",dark:"gray-400",description:"De-emphasised text"},"fg-subtle":{light:"gray-400",dark:"gray-500",description:"Placeholders, disabled text"},surface:{light:"gray-50",dark:"gray-800",description:"Page and panel background"},"surface-raised":{light:"gray-100",dark:"gray-700",description:"Cards, popovers"},"surface-sunken":{light:"gray-200",dark:"gray-700",description:"Wells, track backgrounds"},line:{light:"gray-200",dark:"gray-700",description:"Default border, divider"},"line-strong":{light:"gray-300",dark:"gray-600",description:"Input border, focus ring track"},accent:{light:"indigo-600",dark:"indigo-400",description:"Primary action, selected state"},info:{light:"blue-600",dark:"blue-400",description:"Informational emphasis, links"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-500",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"indigo-600",dark:"indigo-500",description:"Primary button fill"},"info-solid":{light:"blue-600",dark:"blue-500",description:"Informational fill"},"danger-solid":{light:"red-600",dark:"red-500",description:"Destructive button fill"},"success-solid":{light:"green-600",dark:"green-500",description:"Confirmation fill"}}});function f6($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function p9($,X){let Z={...$};for(let[J,Y]of Object.entries(X))Z[J]=f6(Y)&&f6(Z[J])?p9(Z[J],Y):Y;return Z}function g6($={},X={}){let Z=$.theme||{},J=X.theme||{},{extend:Y,...G}=J,{extend:Q,...w}=Z,q=w.colors||{};w.colors={...q,...P6(q)};let W=p9(w,G),K=p9(Q||{},Y||{});if(Object.keys(K).length>0)W.extend=K;let z=[...$.safelist||[],...X.safelist||[]],U={...$.shortcuts||{},...X.shortcuts||{}},B=[...$.preflights||[],...X.preflights||[]];return{config:{...$,...X,theme:W,safelist:z,shortcuts:U,...B.length>0?{preflights:B}:{},content:[],output:""},safelist:z,shortcuts:U,includePreflight:X.preflight!==!1,minify:X.minify===!0,tokenCSS:v6(q)}}var h6=y(()=>{x6()});import F7 from"path";function d6($){u6=$?.trim()||null}function V7(){return process.env[ZW]?.trim()||u6||A5}function H1($=process.cwd(),...X){let Z=V7();return F7.isAbsolute(Z)?F7.join(Z,...X):F7.join($,Z,...X)}function A7($){if(!$||F7.isAbsolute($))return $;let X=$.replace(/\\/g,"/");if(X!==A5&&!X.startsWith(`${A5}/`))return $;let Z=X.slice(A5.length+1);return Z?F7.join(V7(),Z):V7()}var A5=".stx",ZW="STX_DIR",u6=null;var R7=()=>{};var O0;var m6=y(()=>{O0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});var c6=()=>{};function l6($,X,Z,J){let Y=$;Y=Y.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,w,q)=>{let K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[w]||"Make this element accessible";return`<!-- a11y-hint: ${q||K} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return 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,q)=>{return`<span id="${`desc-${w}`}" class="sr-only">${q}</span>`}),Y}var p6,i6;var i9=y(()=>{c6();p6={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},i6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function JW($,X={}){let{duration:Z,delay:J,ease:Y,direction:G,custom:Q}={...O1,...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
+ `),I8}var I8;var x6={};t(x6,{setAppUrl:()=>f9,runMiddleware:()=>F7,route:()=>z7,resolveLayoutChain:()=>V8,resetRoutes:()=>u9,registerMiddleware:()=>U7,patternToRegex:()=>K7,navigateTo:()=>m9,matchRoute:()=>F8,loadMiddlewareFromDirectory:()=>H7,isNonPageRoutePattern:()=>Q7,isNonPageRoutePath:()=>D9,hasMiddleware:()=>p9,getRouterScript:()=>A7,getMiddlewareNames:()=>_7,getMiddleware:()=>k8,generateRouteTypes:()=>q7,generateRouteManifest:()=>W7,formatRoutes:()=>x9,findErrorPage:()=>v9,filePathToPattern:()=>L8,extractLayoutMetadata:()=>v6,deriveLayoutGroup:()=>V7,defineRoutes:()=>h9,defineRoute:()=>g9,defineMiddleware:()=>l9,createStorageManager:()=>M8,createServerCookieManager:()=>N8,createRouter:()=>D6,createRouteLocation:()=>O7,createMiddlewareContext:()=>L7,createClientCookieManager:()=>T8,clearMiddleware:()=>B7,bracketPathToRegex:()=>I6,abortNavigation:()=>c9,Router:()=>R5,NON_PAGE_DIRS:()=>G7});var b1=D(()=>{y6();b9();b6();P6();C9();y9();O8()});function R7($,X={}){return new R5($,X).routes}var i9=D(()=>{b1();b1()});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 g6($){let X={};for(let[Z,J]of Object.entries(f6)){let Y=r9($,J.light);if(Y===void 0)continue;X[Z]=`var(${n9(Z)}, ${Y})`}return X}function h6($){let X=[],Z=[];for(let[J,Y]of Object.entries(f6)){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 f6;var u6=D(()=>{f6={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 d6($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function o9($,X){let Z={...$};for(let[J,Y]of Object.entries(X))Z[J]=d6(Y)&&d6(Z[J])?o9(Z[J],Y):Y;return Z}function m6($={},X={}){let Z=$.theme||{},J=X.theme||{},{extend:Y,...G}=J,{extend:Q,...w}=Z,q=w.colors||{};w.colors={...q,...g6(q)};let W=o9(w,G),K=o9(Q||{},Y||{});if(Object.keys(K).length>0)W.extend=K;let z=[...$.safelist||[],...X.safelist||[]],U={...$.shortcuts||{},...X.shortcuts||{}},B=[...$.preflights||[],...X.preflights||[]];return{config:{...$,...X,theme:W,safelist:z,shortcuts:U,...B.length>0?{preflights:B}:{},content:[],output:""},safelist:z,shortcuts:U,includePreflight:X.preflight!==!1,minify:X.minify===!0,tokenCSS:h6(q)}}var c6=D(()=>{u6()});import N7 from"path";function p6($){l6=$?.trim()||null}function T7(){return process.env[QW]?.trim()||l6||T5}function F1($=process.cwd(),...X){let Z=T7();return N7.isAbsolute(Z)?N7.join(Z,...X):N7.join($,Z,...X)}function M7($){if(!$||N7.isAbsolute($))return $;let X=$.replace(/\\/g,"/");if(X!==T5&&!X.startsWith(`${T5}/`))return $;let Z=X.slice(T5.length+1);return Z?N7.join(T7(),Z):T7()}var T5=".stx",QW="STX_DIR",l6=null;var k7=()=>{};var F0;var i6=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 n6=()=>{};function r6($,X,Z,J){let Y=$;Y=Y.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,w,q)=>{let K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[w]||"Make this element accessible";return`<!-- a11y-hint: ${q||K} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return 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,q)=>{return`<span id="${`desc-${w}`}" class="sr-only">${q}</span>`}),Y}var o6,s6;var s9=D(()=>{n6();o6={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},s6={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function wW($,X={}){let{duration:Z,delay:J,ease:Y,direction:G,custom:Q}={...V1,...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 YW(){return`
1665
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function qW(){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 GW($){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 QW($=0.1,X="0px"){return`
1693
+ `}function WW($){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 KW($=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 wW(){return`
1736
+ `}function zW(){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 qW($,X,Z={}){let{staggerDelay:J=50,sequence:Y=!1}=Z;return`
1851
+ `}function UW($,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 a6($,X,Z,J){let Y=$;if(J.animation?.enabled===!1)return Y;let G=Z.includes("test")&&Z.includes("animation");if(!GW(Y)&&!G)return Y;if(!Y.includes('<style id="stx-animation-base">')){let w=wW();Y=Y.replace("</head>",`${w}
1889
- </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let q=QW(),W=Y.lastIndexOf("</body>");if(W!==-1)Y=Y.slice(0,W)+q+`
1890
- `+Y.slice(W)}}return Y}var O1,n6,r6,o6,s6;var n9=y(()=>{O1={duration:300,delay:0,ease:"ease",direction:"both"};n6={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)||O1.duration:O1.duration,Q=X.length>2?X[2]||O1.ease:O1.ease,w=X.length>3?Number.parseInt(X[3],10)||O1.delay:O1.delay,q=X.length>4?X[4]||O1.direction:O1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,K=JW(Y,{duration:G,delay:w,ease:Q,direction:q}),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="${W}" class="${z} ${U} ${q==="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"},r6={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,q=X.length>4?Number.parseInt(X[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,K=`--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,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="${W}" class="${z}" style="${K}" data-threshold="${w}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},o6={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((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),Q=Z.staggerDelay||50,w=Z.sequence||!0,q=qW(Y,G,{staggerDelay:Q,sequence:w});return`${$}
1892
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},s6={name:"motion",handler:($,X,Z,J)=>{let Y=X.length>0?X[0].toLowerCase()==="true":!0,G=YW();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});var t6=y(()=>{I1();r9()});async function WW($,X,Z,J){let Y=X[0]?.replace(/['"]/g,"")||"main",G=O7();if(Y!=="main")G=G.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${G}</script>`}var e6;var r9=y(()=>{t6();e6={name:"stxRouter",handler:WW,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function $2($){let X=$.heatmap;if(!X?.enabled)return"";let Z={...KW,...X};return`
1888
+ `}function X2($,X,Z,J){let Y=$;if(J.animation?.enabled===!1)return Y;let G=Z.includes("test")&&Z.includes("animation");if(!WW(Y)&&!G)return Y;if(!Y.includes('<style id="stx-animation-base">')){let w=zW();Y=Y.replace("</head>",`${w}
1889
+ </head>`)}if(Y.includes("stx-observe")){if(!Y.includes("Intersection Observer for scroll animations")){let q=KW(),W=Y.lastIndexOf("</body>");if(W!==-1)Y=Y.slice(0,W)+q+`
1890
+ `+Y.slice(W)}}return Y}var V1,a6,t6,e6,$2;var a9=D(()=>{V1={duration:300,delay:0,ease:"ease",direction:"both"};a6={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)||V1.duration:V1.duration,Q=X.length>2?X[2]||V1.ease:V1.ease,w=X.length>3?Number.parseInt(X[3],10)||V1.delay:V1.delay,q=X.length>4?X[4]||V1.direction:V1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,K=wW(Y,{duration:G,delay:w,ease:Q,direction:q}),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="${W}" class="${z} ${U} ${q==="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"},t6={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,q=X.length>4?Number.parseInt(X[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,K=`--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,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="${W}" class="${z}" style="${K}" data-threshold="${w}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},e6={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((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),Q=Z.staggerDelay||50,w=Z.sequence||!0,q=UW(Y,G,{staggerDelay:Q,sequence:w});return`${$}
1892
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},$2={name:"motion",handler:($,X,Z,J)=>{let Y=X.length>0?X[0].toLowerCase()==="true":!0,G=qW();return`<div data-animate="${Y?"auto":"true"}">${$}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});var Z2=D(()=>{b1();t9()});async function jW($,X,Z,J){let Y=X[0]?.replace(/['"]/g,"")||"main",G=A7();if(Y!=="main")G=G.replace("container:'main'",`container:'${Y}'`);return`<script data-stx-router>${G}</script>`}var J2;var t9=D(()=>{Z2();J2={name:"stxRouter",handler:jW,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function Y2($){let X=$.heatmap;if(!X?.enabled)return"";let Z={...BW,...X};return`
1893
1893
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1894
1894
  <script>
1895
1895
  (function() {
@@ -2272,10 +2272,10 @@ else {
2272
2272
  };
2273
2273
  })();
2274
2274
  </script>
2275
- `}function X2($,X){let Z=$2(X);if(!Z)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+$.slice(J);return $+Z}function zW($){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 KW,Z2;var o9=y(()=>{KW={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};Z2={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=zW(X.join(" "));Y.heatmap={...Y.heatmap,...G,enabled:!0}}return $2(Y)}}});function E1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function J2($){let X=$.trim().toLowerCase();return!X.startsWith("javascript:")&&!X.startsWith("vbscript:")&&!X.startsWith("data:text/html")}function Y2($){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 q=w.indexOf(":");if(q===-1)continue;let W=w.slice(0,q).trim(),K=w.slice(q+1).trim();if(typeof K==="string"){if(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'"))K=K.slice(1,-1);else if(K.startsWith("[")&&K.endsWith("]"))try{K=JSON.parse(K)}catch{}else if(K==="true")K=!0;else if(K==="false")K=!1;else if(/^-?\d+(?:\.\d+)?$/.test(K))K=Number(K)}G[W]=K}return{data:G,content:Y.trim()}}function N7($,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-${E1(z)}"`:"";return G.push(`<pre><code${j}>${E1(U.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),Y=Y.replace(/`([^`]*)`/g,(K,z)=>`<code>${E1(z)}</code>`),Y=Y.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Y=Y.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Y=Y.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Y=Y.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Y=Y.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Y=Y.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Y=Y.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Y=Y.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Y=Y.replace(/__(.+?)__/g,"<strong>$1</strong>"),Y=Y.replace(/\*(.+?)\*/g,"<em>$1</em>"),Y=Y.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)Y=Y.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Y=Y.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(K,z,U)=>{return`<img src="${J2(U)?E1(U):""}" alt="${E1(z)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,z,U)=>{return`<a href="${J2(U)?E1(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((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${E1(H)}</th>`).join("")}</tr>`,_=U.trim().split(`
2278
- `).map((H)=>{return`<tr>${H.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${E1(O)}</td>`).join("")}</tr>`}).join(`
2275
+ `}function G2($,X){let Z=Y2(X);if(!Z)return $;let J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+Z+$.slice(J);return $+Z}function _W($){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 BW,Q2;var e9=D(()=>{BW={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=_W(X.join(" "));Y.heatmap={...Y.heatmap,...G,enabled:!0}}return Y2(Y)}}});function S1($){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 q=w.indexOf(":");if(q===-1)continue;let W=w.slice(0,q).trim(),K=w.slice(q+1).trim();if(typeof K==="string"){if(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'"))K=K.slice(1,-1);else if(K.startsWith("[")&&K.endsWith("]"))try{K=JSON.parse(K)}catch{}else if(K==="true")K=!0;else if(K==="false")K=!1;else if(/^-?\d+(?:\.\d+)?$/.test(K))K=Number(K)}G[W]=K}return{data:G,content:Y.trim()}}function I7($,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-${S1(z)}"`:"";return G.push(`<pre><code${j}>${S1(U.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),Y=Y.replace(/`([^`]*)`/g,(K,z)=>`<code>${S1(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)?S1(U):""}" alt="${S1(z)}" />`}),Y=Y.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,z,U)=>{return`<a href="${w2(U)?S1(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((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${S1(H)}</th>`).join("")}</tr>`,_=U.trim().split(`
2278
+ `).map((H)=>{return`<tr>${H.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${S1(O)}</td>`).join("")}</tr>`}).join(`
2279
2279
  `);return`<table>
2280
2280
  <thead>
2281
2281
  ${j}
@@ -2290,7 +2290,7 @@ ${_}
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 R5($="const",X=[],Z){let J=X.length?L1.filter((Y)=>!X.includes(Y)):L1;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 s9($){if(!$)return!1;return jW.some((X)=>new RegExp(`\\b${X}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function a9($){if(!$)return!1;let X=z2($);if(BW.some((Z)=>Z.test(X)))return!0;return s9(X)}function Q2($){if(!$)return!1;return _W.test(z2($))||a9($)}function w2($){return HW.includes($.toLowerCase())}function K2(){return`{${q2.map(($)=>`'${$}':1`).join(",")}}`}function z2($){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 L1,G2,UW,jW,BW,_W,HW,q2,OW,W2;var $1=y(()=>{L1=["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"],G2=["onMount","onDestroy"];UW=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],jW=L1.filter(($)=>!UW.includes($));BW=[/@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/],_W=/\s@[a-z][\w.:-]*\s*=/i;HW=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];q2=["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"],OW=["x-init","x-transition","x-effect","x-on"],W2=[...q2,...OW]});function B2($){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(LW.has(J))X.systemKeys.push(J);else if(J in _2)X.mouse=J;else if(J in j2||/^[a-z]$/.test(J))X.keys.push(j2[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 H2($){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,q=Y.index,W=q+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]=B,L=_.split("."),O=L[0];if(!U2.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:H,modifiers:B2(L.slice(1)),elementId:K})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(w))!==null){let[,_,H]=B,L=_.split("."),O=L[0];if(!U2.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:H,modifiers:B2(L.slice(1)),elementId:K})}if(z.length>0)X.push({originalTag:G,elementId:K,events:z,startIndex:q,endIndex:W})}return X}function FW($){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=_2[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 VW($,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 t9($){let X=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(X))return $;return`if (typeof ${X} === 'function' && !${X}._isSignal) ${X}($event);`}function AW($){let{modifiers:X}=$,Z=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=FW($),Y=VW(t9($.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 M5($="const",X=[],Z){let J=X.length?A1.filter((Y)=>!X.includes(Y)):A1;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 OW.some((X)=>new RegExp(`\\b${X}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function XX($){if(!$)return!1;let X=_2($);if(LW.some((Z)=>Z.test(X)))return!0;return $X(X)}function K2($){if(!$)return!1;return FW.test(_2($))||XX($)}function z2($){return VW.includes($.toLowerCase())}function B2(){return`{${U2.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 A1,W2,HW,OW,LW,FW,VW,U2,AW,j2;var Z1=D(()=>{A1=["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"],W2=["onMount","onDestroy"];HW=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],OW=A1.filter(($)=>!HW.includes($));LW=[/@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/],FW=/\s@[a-z][\w.:-]*\s*=/i;VW=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];U2=["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"],AW=["x-init","x-transition","x-effect","x-on"],j2=[...U2,...AW]});function L2($){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(RW.has(J))X.systemKeys.push(J);else if(J in F2)X.mouse=J;else if(J in O2||/^[a-z]$/.test(J))X.keys.push(O2[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 V2($){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,q=Y.index,W=q+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]=B,L=_.split("."),O=L[0];if(!H2.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:H,modifiers:L2(L.slice(1)),elementId:K})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(w))!==null){let[,_,H]=B,L=_.split("."),O=L[0];if(!H2.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:H,modifiers:L2(L.slice(1)),elementId:K})}if(z.length>0)X.push({originalTag:G,elementId:K,events:z,startIndex:q,endIndex:W})}return X}function NW($){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=F2[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 TW($,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 MW($){let{modifiers:X}=$,Z=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),J=NW($),Y=TW(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 e9($){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(AW).join(`
2402
+ ${$.map(MW).join(`
2403
2403
  `)}
2404
2404
  })();
2405
- </script>`}function RW($){let X=H2($);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 q of G.events)q.elementId=w[1]}for(let w of G.events){let q=w.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),K=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(W,""),Q=Q.replace(K,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),J.push(...G.events)}return{template:Z,bindings:J}}function O2($,X,Z){if(a9($))return $;if(X.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:w,bindings:q}=RW($),W=X.__stx_event_bindings||[];return X.__stx_event_bindings=[...W,...q],w}let J=H2($);if(J.length===0)return $;let Y=$;for(let w=J.length-1;w>=0;w--){let q=J[w],W=q.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let K=W.match(/id=["']([^"']+)["']/);if(K)for(let z of q.events)z.elementId=K[1]}for(let K of q.events){let z=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");W=W.replace(U,""),W=W.replace(B,"")}Y=Y.slice(0,q.startIndex)+W+Y.slice(q.endIndex)}let G=e9(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 U2,j2,LW,_2;var $X=y(()=>{$1();U2=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"]),j2={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"},LW=new Set(["ctrl","alt","shift","meta"]),_2={left:0,middle:1,right:2}});function p0($){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 kW($){let X=V2($);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 q of G.events)q.elementId=w[1]}for(let w of G.events){let q=w.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),K=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(W,""),Q=Q.replace(K,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),J.push(...G.events)}return{template:Z,bindings:J}}function A2($,X,Z){if(XX($))return $;if(X.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:w,bindings:q}=kW($),W=X.__stx_event_bindings||[];return X.__stx_event_bindings=[...W,...q],w}let J=V2($);if(J.length===0)return $;let Y=$;for(let w=J.length-1;w>=0;w--){let q=J[w],W=q.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let K=W.match(/id=["']([^"']+)["']/);if(K)for(let z of q.events)z.elementId=K[1]}for(let K of q.events){let z=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");W=W.replace(U,""),W=W.replace(B,"")}Y=Y.slice(0,q.startIndex)+W+Y.slice(q.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 H2,O2,RW,F2;var YX=D(()=>{Z1();H2=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"]),O2={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"},RW=new Set(["ctrl","alt","shift","meta"]),F2={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 T8($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function NW($,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 TW($,X){let Z=X+1;while(Z<$.length){if($[Z]==="\\"){Z+=2;continue}if($[Z]==="`")return Z+1;if($[Z]==="$"&&$[Z+1]==="{"){if(Z=M8($,Z+2),Z<$.length)Z++;continue}Z++}return $.length}function M8($,X){let Z=1,J=X;while(J<$.length){let Y=$[J];if(Y==="\\"){J+=2;continue}if(Y==='"'||Y==="'"){J=NW($,J);continue}if(Y==="`"){J=TW($,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 s0($){let X="",Z=0;while(Z<$.length){let J=$.slice(Z,Z+2);if(J==="//"){while(Z<$.length&&$[Z]!==`
2408
+ `}),$}function E8($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function IW($,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 EW($,X){let Z=X+1;while(Z<$.length){if($[Z]==="\\"){Z+=2;continue}if($[Z]==="`")return Z+1;if($[Z]==="$"&&$[Z+1]==="{"){if(Z=D8($,Z+2),Z<$.length)Z++;continue}Z++}return $.length}function D8($,X){let Z=1,J=X;while(J<$.length){let Y=$[J];if(Y==="\\"){J+=2;continue}if(Y==='"'||Y==="'"){J=IW($,J);continue}if(Y==="`"){J=EW($,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=M8($,G);if(X+=" ",X+=s0($.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=D8($,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 MW(){let $=globalThis;return $[L2]??=new Map,$[L2]}function t($,X){let Z=MW(),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 L2;var T7=y(()=>{L2=Symbol.for("stx.lazy-module-promises")});function N5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(kW,"<\\/$1")}var kW;var XX=y(()=>{kW=/<\/(script)/gi});import IW from"process";function u0($="STX_PUBLIC_"){let X={},Z={};for(let[J,Y]of Object.entries(IW.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 D1=()=>{};function EW($){if(!$||typeof $!=="object")return!1;let X=$;return typeof X.message==="string"&&(X.name==="BuildMessage"||X.name==="ResolveMessage"||("position"in X))}function DW($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function k8($,X){let Z=[];for(let J of DW($)){if(EW(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 F2($,X){return k8($,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 DW(){let $=globalThis;return $[R2]??=new Map,$[R2]}function $0($,X){let Z=DW(),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 R2;var E7=D(()=>{R2=Symbol.for("stx.lazy-module-promises")});function k5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(yW,"<\\/$1")}var yW;var GX=D(()=>{yW=/<\/(script)/gi});import bW from"process";function l0($="STX_PUBLIC_"){let X={},Z={};for(let[J,Y]of Object.entries(bW.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 C1=()=>{};function SW($){if(!$||typeof $!=="object")return!1;let X=$;return typeof X.message==="string"&&(X.name==="BuildMessage"||X.name==="ResolveMessage"||("position"in X))}function CW($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function y8($,X){let Z=[];for(let J of CW($)){if(SW(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 N2($,X){return y8($,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 M7={};a(M7,{shouldLogBundlerDiagnostics:()=>N2,setBundlerFallbackMode:()=>bW,resolveBundlerFallback:()=>GX,recordBundleFailure:()=>JX,queueClientBundleBuild:()=>T2,hasUserImports:()=>SW,getBundleFailures:()=>wX,clearBundleFailures:()=>qX,bundleClientScript:()=>PW});import L0 from"path";import d0 from"fs";function N2($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function p1(...$){if(N2())console.log("[stx:bundler]",...$)}function JX($,X,Z){QX.push({filePath:$||"<inline>",message:X,details:Z})}function wX(){return QX.slice()}function qX(){QX.length=0}function bW($){YX=$}function GX(){if(YX)return YX;try{let $=k7.strict;return typeof $==="object"&&$!==null?$.bundlerFallback??"warn":"warn"}catch{return"warn"}}function SW($){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(!V2.some((Q)=>Q.test(Y)))return p1("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(!V2.some((Q)=>Q.test(Y)))return p1("detected side-effect import:",Y),!0}return!1}function CW($,X,Z,J){let Y=(G,Q)=>{let w=G===Z?X:L0.dirname(G),q=L0.resolve(w,Q),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,L0.join(q,"index.ts"),L0.join(q,"index.tsx"),L0.join(q,"index.js"),L0.join(q,"index.mjs")];for(let K of W)try{if(d0.existsSync(K)&&d0.statSync(K,{throwIfNoEntry:!1})?.isFile())return K}catch{}return q};return{name:"stx-client-bundle",setup(G){G.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^\//},(Q)=>{if(d0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let w=Y(Q.importer,Q.path);return J.add(w),{path:w}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let w=L0.resolve($,Q.path.slice(2)),q=[w,`${w}.ts`,`${w}.tsx`,`${w}.js`,`${w}.mjs`,`${w}.jsx`,L0.join(w,"index.ts"),L0.join(w,"index.tsx"),L0.join(w,"index.js"),L0.join(w,"index.mjs")];for(let W of q)if(d0.existsSync(W)&&d0.statSync(W,{throwIfNoEntry:!1})?.isFile())return p1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",W),J.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${Q.path[0]}/ import:`,Q.path),{path:w}}),G.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Q)=>{let w=L0.extname(Q.path).toLowerCase(),q=w===".json"?"json":w===".tsx"?"tsx":w===".jsx"?"jsx":w===".ts"||w===".mts"||w===".cts"?"ts":"js";if(Q.path!==Z)J.add(Q.path);return{contents:d0.readFileSync(Q.path,"utf8"),loader:q}})}}}function T2($){let X=globalThis,J=(X[A2]??Promise.resolve()).then($,$);return X[A2]=J.then(()=>{return},()=>{return}),J}async function PW($,X,Z={}){let J=Z.projectRoot||process.cwd(),Y=Z.minify??!1,G=Z.cacheDir||H1(J,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${yW}\x00${$}\x00${X}`);let w=Q.digest("hex").slice(0,12),q=L0.join(G,`${w}.js`),W=L0.join(G,`${w}.deps.json`),K=Bun.file(q);if(await K.exists()){let B=Bun.file(W),j=!0;if(await B.exists())try{let _=JSON.parse(await B.text());if(_.metadataVersion!==R2||!Array.isArray(_.files))j=!1;for(let H of Array.isArray(_.files)?_.files:[])try{if(d0.statSync(H.path).mtimeMs!==H.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return p1("cache hit:",w),await K.text();p1("cache invalidated by dep change:",w)}let z=ZX.get(w);if(z)return await z;let U=T2(()=>vW($,X,{projectRoot:J,minify:Y,cacheDir:G,hash:w,cachePath:q,depsPath:W}));ZX.set(w,U);try{return await U}finally{ZX.delete(w)}}async function vW($,X,Z){let{projectRoot:J,minify:Y,cacheDir:G,hash:Q,cachePath:w,depsPath:q}=Z,W=H1(J,"bundle-tmp"),K=L0.join(W,`${Q}.ts`),z=L0.join(W,"out",Q);d0.mkdirSync(W,{recursive:!0}),d0.mkdirSync(z,{recursive:!0});let U=L0.dirname(X),B=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,H;while((H=j.exec($))!==null){if(H[1])continue;if(H[2])H[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)B.push(V)});else if(H[3])B.push(H[3])}while((H=_.exec($))!==null){if(H[1])continue;B.push(H[2])}let L=B.length>0?`
2419
- export { ${B.join(", ")} }`:"";await Bun.write(K,$+L),p1("bundling:",Q,"from:",L0.basename(X));let O=new Set;try{let F=await Bun.build({entrypoints:[K],outdir:z,target:"browser",format:"esm",minify:Y,plugins:[CW(J,U,K,O)],define:{"process.env.NODE_ENV":Y?'"production"':'"development"',...u0()},root:J});if(!F.success){let S=F.logs.filter((E)=>E.level==="error").map((E)=>E.message).join(", ")||`Unable to bundle ${L0.basename(X)}`,b=k8(F.logs,X||void 0);if(console.warn("[stx:bundler] build failed:",S),JX(X||"",S,b),GX()==="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 E=S.trim();if(/^[A-Za-z_$][\w$]*$/.test(E))A.push([E,E])}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}`,M=A.map(([I,S])=>`${JSON.stringify(I)}: ${S}`).join(", "),k=A.map(([I])=>`var ${I} = undefined;`).join(`
2420
- `),T=A.map(([I])=>`${I} = ${N}[${JSON.stringify(I)}];`).join(`
2418
+ `)}var D7={};t(D7,{shouldLogBundlerDiagnostics:()=>I2,setBundlerFallbackMode:()=>vW,resolveBundlerFallback:()=>WX,recordBundleFailure:()=>wX,queueClientBundleBuild:()=>E2,hasUserImports:()=>xW,getBundleFailures:()=>zX,clearBundleFailures:()=>UX,bundleClientScript:()=>gW});import V0 from"path";import p0 from"fs";function I2($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function a1(...$){if(I2())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 vW($){qX=$}function WX(){if(qX)return qX;try{let $=y7.strict;return typeof $==="object"&&$!==null?$.bundlerFallback??"warn":"warn"}catch{return"warn"}}function xW($){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(!T2.some((Q)=>Q.test(Y)))return a1("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(!T2.some((Q)=>Q.test(Y)))return a1("detected side-effect import:",Y),!0}return!1}function fW($,X,Z,J){let Y=(G,Q)=>{let w=G===Z?X:V0.dirname(G),q=V0.resolve(w,Q),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,V0.join(q,"index.ts"),V0.join(q,"index.tsx"),V0.join(q,"index.js"),V0.join(q,"index.mjs")];for(let K of W)try{if(p0.existsSync(K)&&p0.statSync(K,{throwIfNoEntry:!1})?.isFile())return K}catch{}return q};return{name:"stx-client-bundle",setup(G){G.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^\//},(Q)=>{if(p0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let w=Y(Q.importer,Q.path);return J.add(w),{path:w}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let w=V0.resolve($,Q.path.slice(2)),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 W of q)if(p0.existsSync(W)&&p0.statSync(W,{throwIfNoEntry:!1})?.isFile())return a1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",W),J.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${Q.path[0]}/ import:`,Q.path),{path:w}}),G.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Q)=>{let w=V0.extname(Q.path).toLowerCase(),q=w===".json"?"json":w===".tsx"?"tsx":w===".jsx"?"jsx":w===".ts"||w===".mts"||w===".cts"?"ts":"js";if(Q.path!==Z)J.add(Q.path);return{contents:p0.readFileSync(Q.path,"utf8"),loader:q}})}}}function E2($){let X=globalThis,J=(X[M2]??Promise.resolve()).then($,$);return X[M2]=J.then(()=>{return},()=>{return}),J}async function gW($,X,Z={}){let J=Z.projectRoot||process.cwd(),Y=Z.minify??!1,G=Z.cacheDir||F1(J,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${PW}\x00${$}\x00${X}`);let w=Q.digest("hex").slice(0,12),q=V0.join(G,`${w}.js`),W=V0.join(G,`${w}.deps.json`),K=Bun.file(q);if(await K.exists()){let B=Bun.file(W),j=!0;if(await B.exists())try{let _=JSON.parse(await B.text());if(_.metadataVersion!==k2||!Array.isArray(_.files))j=!1;for(let H of Array.isArray(_.files)?_.files:[])try{if(p0.statSync(H.path).mtimeMs!==H.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return a1("cache hit:",w),await K.text();a1("cache invalidated by dep change:",w)}let z=QX.get(w);if(z)return await z;let U=E2(()=>hW($,X,{projectRoot:J,minify:Y,cacheDir:G,hash:w,cachePath:q,depsPath:W}));QX.set(w,U);try{return await U}finally{QX.delete(w)}}async function hW($,X,Z){let{projectRoot:J,minify:Y,cacheDir:G,hash:Q,cachePath:w,depsPath:q}=Z,W=F1(J,"bundle-tmp"),K=V0.join(W,`${Q}.ts`),z=V0.join(W,"out",Q);p0.mkdirSync(W,{recursive:!0}),p0.mkdirSync(z,{recursive:!0});let U=V0.dirname(X),B=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,H;while((H=j.exec($))!==null){if(H[1])continue;if(H[2])H[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)B.push(V)});else if(H[3])B.push(H[3])}while((H=_.exec($))!==null){if(H[1])continue;B.push(H[2])}let L=B.length>0?`
2419
+ export { ${B.join(", ")} }`:"";await Bun.write(K,$+L),a1("bundling:",Q,"from:",V0.basename(X));let O=new Set;try{let F=await Bun.build({entrypoints:[K],outdir:z,target:"browser",format:"esm",minify:Y,plugins:[fW(J,U,K,O)],define:{"process.env.NODE_ENV":Y?'"production"':'"development"',...l0()},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=y8(F.logs,X||void 0);if(console.warn("[stx:bundler] build failed:",S),wX(X||"",S,b),WX()==="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(", "),k=A.map(([I])=>`var ${I} = undefined;`).join(`
2420
+ `),M=A.map(([I])=>`${I} = ${N}[${JSON.stringify(I)}];`).join(`
2421
2421
  `);if(V=`${R.join(`
2422
2422
  `)}
2423
2423
  ${k}
2424
2424
  var ${N} = (function() {
2425
2425
  ${V}
2426
- return { ${M} };
2426
+ return { ${T} };
2427
2427
  })();
2428
- ${T}`.trim(),p1("bundled:",Q,"output:",V.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${L0.basename(X)} (${Q}); serving the unbundled source and not caching this result`),$;d0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let D=Array.from(O).map((I)=>{try{return{path:I,mtimeMs:d0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(q,JSON.stringify({metadataVersion:R2,files:D})),V}catch(F){let V=k8(F,X||void 0),A=F2(F,X||void 0);if(console.warn(`[stx:bundler] error: ${A}`),JX(X||"",A,V),GX()==="error")throw F;return $}finally{try{d0.rmSync(K,{force:!0}),d0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var yW=5,R2=1,QX,YX,V2,ZX,A2;var T5=y(()=>{D1();R7();F1();QX=[];V2=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];ZX=new Map,A2=Symbol.for("stx.client-bundle-build-queue")});var S2={};a(S2,{stripCommentsAndLiterals:()=>s0,renderVendorStyleTags:()=>E8,processClientScript:()=>D7,injectBrowserCoreAutoImports:()=>M5,generateServerDataBridge:()=>D8,generateBrowserAutoImportDestructuring:()=>lW,generateAutoImportDestructuring:()=>WX,findInterpolationEnd:()=>M8,extractBridgeData:()=>E7,extractAndStripCssImports:()=>I8,STX_AUTO_IMPORTS:()=>E2});import i1 from"path";import I7 from"fs";function fW($){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 gW($,X){let Z=X;while(!0){let J=i1.join(Z,"node_modules",$,"package.json");if(I7.existsSync(J))return i1.dirname(J);let Y=i1.dirname(Z);if(Y===Z)return null;Z=Y}}function hW($,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 uW($,X){let Z=fW($);if(!Z||!Z.subpath)return null;let J=gW(Z.pkg,X);if(!J)return null;let Y;try{Y=JSON.parse(I7.readFileSync(i1.join(J,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=hW(Y.exports,G);if(!Q)return null;let w=i1.resolve(J,Q);return I7.existsSync(w)?w:null}function I8($,X){let Z=X.filePath?i1.dirname(X.filePath):X.projectRoot||process.cwd(),J=X.projectRoot||process.cwd(),Y=new Set,G=[];return{code:$.replace(xW,(w,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:i1.resolve(Z,q),!I7.existsSync(W))throw Error(`file not found: ${W}`)}else{let K=null;try{K=Bun.resolveSync(q,J)}catch{K=uW(q,J)}if(!K)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=K}}catch(K){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${X.filePath||"<unknown>"}): ${K?.message||K}`),""}if(Y.has(W))return"";Y.add(W);try{let K=I7.readFileSync(W,"utf8");G.push({source:q,resolvedPath:W,contents:K})}catch(K){console.warn(`[stx:vendor-css] could not read ${W}: ${K?.message||K}`)}return""}),styles:G}}function dW($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function E8($){if($.length===0)return"";return`${$.map((X)=>{return`<style data-stx-vendor="${dW(X.source)}" data-stx-layer="vendor">
2428
+ ${M}`.trim(),a1("bundled:",Q,"output:",V.length,"bytes"),B.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(O).map((I)=>{try{return{path:I,mtimeMs:p0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(q,JSON.stringify({metadataVersion:k2,files:E})),V}catch(F){let V=y8(F,X||void 0),A=N2(F,X||void 0);if(console.warn(`[stx:bundler] error: ${A}`),wX(X||"",A,V),WX()==="error")throw F;return $}finally{try{p0.rmSync(K,{force:!0}),p0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var PW=5,k2=1,KX,qX,T2,QX,M2;var I5=D(()=>{C1();k7();R1();KX=[];T2=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];QX=new Map,M2=Symbol.for("stx.client-bundle-build-queue")});var x2={};t(x2,{stripCommentsAndLiterals:()=>t0,renderVendorStyleTags:()=>S8,processClientScript:()=>C7,injectBrowserCoreAutoImports:()=>E5,generateServerDataBridge:()=>C8,generateBrowserAutoImportDestructuring:()=>rW,generateAutoImportDestructuring:()=>jX,findInterpolationEnd:()=>D8,extractBridgeData:()=>S7,extractAndStripCssImports:()=>b8,STX_AUTO_IMPORTS:()=>S2});import t1 from"path";import b7 from"fs";function dW($){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 mW($,X){let Z=X;while(!0){let J=t1.join(Z,"node_modules",$,"package.json");if(b7.existsSync(J))return t1.dirname(J);let Y=t1.dirname(Z);if(Y===Z)return null;Z=Y}}function cW($,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 lW($,X){let Z=dW($);if(!Z||!Z.subpath)return null;let J=mW(Z.pkg,X);if(!J)return null;let Y;try{Y=JSON.parse(b7.readFileSync(t1.join(J,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=cW(Y.exports,G);if(!Q)return null;let w=t1.resolve(J,Q);return b7.existsSync(w)?w:null}function b8($,X){let Z=X.filePath?t1.dirname(X.filePath):X.projectRoot||process.cwd(),J=X.projectRoot||process.cwd(),Y=new Set,G=[];return{code:$.replace(uW,(w,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:t1.resolve(Z,q),!b7.existsSync(W))throw Error(`file not found: ${W}`)}else{let K=null;try{K=Bun.resolveSync(q,J)}catch{K=lW(q,J)}if(!K)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=K}}catch(K){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${X.filePath||"<unknown>"}): ${K?.message||K}`),""}if(Y.has(W))return"";Y.add(W);try{let K=b7.readFileSync(W,"utf8");G.push({source:q,resolvedPath:W,contents:K})}catch(K){console.warn(`[stx:vendor-css] could not read ${W}: ${K?.message||K}`)}return""}),styles:G}}function pW($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function S8($){if($.length===0)return"";return`${$.map((X)=>{return`<style data-stx-vendor="${pW(X.source)}" data-stx-layer="vendor">
2429
2429
  @layer vendor {
2430
2430
  ${X.contents}
2431
2431
  }
2432
2432
  </style>`}).join(`
2433
2433
  `)}
2434
- `}function M5($){let X=s0($),Z=new Set;for(let w of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of w[1].split(",")){let W=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)Z.add(W)}let 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 q of w[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)J.add(W)}let Y=D2.filter((w)=>{if(Z.has(w)||J.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test(X)}),G=y2(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 E5($){let X=t0($),Z=new Set;for(let w of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of w[1].split(",")){let W=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)Z.add(W)}let 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 q of w[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)J.add(W)}let Y=C2.filter((w)=>{if(Z.has(w)||J.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test(X)}),G=P2(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 y2($){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(!mW.has(J[1]))X.add(J[1]);return Array.from(X)}function cW($){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 b2($){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 W=Q[1],K=Q[2];if(Q[0].includes("import type"))continue;let z=[];for(let B of W.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let _=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let H=_[1],L=_[2]||H;if(Y.add(H),Y.add(L),K==="stx"||K==="@stacksjs/stx")X.add(H);else Z.add(H);if(L!==H)z.push(`${L} = ${H}`)}let U=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(Q[0],U)}let w=cW(J);for(let W of E2){if(Y.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(J))X.add(W)}for(let W of D2){if(Y.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(J))Z.add(W)}let q=y2(J);for(let W of q)if(!Y.has(W)&&!w.has(W))Z.add(W);return{code:J,stxImports:Array.from(X),browserImports:Array.from(Z)}}function WX($,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 P2($){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(!iW.has(J[1]))X.add(J[1]);return Array.from(X)}function nW($){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 v2($){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 W=Q[1],K=Q[2];if(Q[0].includes("import type"))continue;let z=[];for(let B of W.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let _=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let H=_[1],L=_[2]||H;if(Y.add(H),Y.add(L),K==="stx"||K==="@stacksjs/stx")X.add(H);else Z.add(H);if(L!==H)z.push(`${L} = ${H}`)}let U=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";J=J.replace(Q[0],U)}let w=nW(J);for(let W of S2){if(Y.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(J))X.add(W)}for(let W of C2){if(Y.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(J))Z.add(W)}let q=P2(J);for(let W of q)if(!Y.has(W)&&!w.has(W))Z.add(W);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
- ${pW($,X)}`;return""}function lW($,X=[]){let{browserImports:Z}=b2($),J=new Set(X);return WX([],Z.filter((Y)=>!J.has(Y)))}function pW($,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
+ ${oW($,X)}`;return""}function rW($,X=[]){let{browserImports:Z}=v2($),J=new Set(X);return jX([],Z.filter((Y)=>!J.has(Y)))}function oW($,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,10 +2445,10 @@ ${pW($,X)}`;return""}function lW($,X=[]){let{browserImports:Z}=b2($),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 E7($){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 M2($,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 iW($,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(M2(Z[1],!0).has(X))return!0;for(let Z of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(M2(Z[1],!1).has(X))return!0;return!1}function nW($,X){return new RegExp(`(?<![.#\\w$])${X}(?![\\w$])`).test($)}function oW($,X){let Z=rW.test($),J=X.length>32768;if(!Z&&!J)return;if(k2.has($))return;if(k2.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 D8($,X){if(!X)return"";let Z=s0($),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&&!nW(Z,G))continue;if(iW($,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;oW(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 S7($){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 D2($,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 sW($,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(D2(Z[1],!0).has(X))return!0;for(let Z of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(D2(Z[1],!1).has(X))return!0;return!1}function aW($,X){return new RegExp(`(?<![.#\\w$])${X}(?![\\w$])`).test($)}function eW($,X){let Z=tW.test($),J=X.length>32768;if(!Z&&!J)return;if(y2.has($))return;if(y2.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 C8($,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&&!aW(Z,G))continue;if(sW($,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;eW(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 aW($){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=sW[$.mouse];X.push(`if ($event.button !== ${Z}) return`)}if($.prevent)X.push("$event.preventDefault()");if($.stop)X.push("$event.stopPropagation()");return X.join("; ")}function tW($,X){let{elementId:Z,event:J,modifiers:Y}=$,G=t9($.handler),Q=aW(Y),w=[];if(Y.once)w.push("once: true");if(Y.capture)w.push("capture: true");if(Y.passive)w.push("passive: true");let q=w.length>0?`, { ${w.join(", ")} }`:"",W="";if(Q)W+=`${Q}; `;let K=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
2451
+ `}function XK($){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=$K[$.mouse];X.push(`if ($event.button !== ${Z}) return`)}if($.prevent)X.push("$event.preventDefault()");if($.stop)X.push("$event.stopPropagation()");return X.join("; ")}function ZK($,X){let{elementId:Z,event:J,modifiers:Y}=$,G=ZX($.handler),Q=XK(Y),w=[];if(Y.once)w.push("once: true");if(Y.capture)w.push("capture: true");if(Y.passive)w.push("passive: true");let q=w.length>0?`, { ${w.join(", ")} }`:"",W="";if(Q)W+=`${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
2453
  };`;function U(B){if(/\$emit\s*\(/.test(B))return`${z}
2454
2454
  ${B}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -2491,25 +2491,25 @@ else {
2491
2491
  else {
2492
2492
  ${G}
2493
2493
  }
2494
- }${q})`}function eW($){if($.length===0)return"";return`
2494
+ }${q})`}function JK($){if($.length===0)return"";return`
2495
2495
  // STX: auto-generated event bindings
2496
- ${$.map((Z,J)=>tW(Z,J)).join(`
2497
- `)}`}function I2($){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 q=w;if(Q++,q==="`"){let W=0;while(Q<G){if(J[Q]==="\\"){Q+=2;continue}if(J[Q]==="`"&&W===0){Q++;break}if(J[Q]==="$"&&J[Q+1]==="{"){W++,Q+=2;continue}if(J[Q]==="}"&&W>0){W--,Q++;continue}Q++}}else while(Q<G){if(J[Q]==="\\"){Q+=2;continue}if(J[Q]===q){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 q=J.slice(Q),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let U=W[1];if(!U.startsWith("_")&&!Z.has(U))X.push(U),Z.add(U);Q+=W[0].length;continue}let K=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[1].split(",").forEach((U)=>{let B=U.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Z.has(_))X.push(_),Z.add(_)}),Q+=K[0].length;continue}let z=q.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 XK($){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(!$K.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 q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=q.exec($))!==null)J(G[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=W.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 D7($,X={}){let Z=$,J="",Y=!1,G=[],Q=I8(Z,{filePath:X.filePath,projectRoot:X.projectRoot});Z=Q.code;let w=E8(Q.styles),q=M5(Z);Z=q.code,G=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:K}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (T5(),M7)));if(W(Z))Z=await K(Z,X.filePath||"",{projectRoot:X.projectRoot,minify:X.production}),Y=!0;if(X.autoImports!==!1){let O=b2(Z);Z=O.code,J=WX(O.stxImports,O.browserImports.filter((F)=>!G.includes(F)))}if(J=`${D8(Z,X.serverData)}${J}`,Z=p0(Z),!Y&&n1(X.attrs||""))Z=r1(Z);let z=eW(X.eventBindings||[]),U=(X.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(U)){let O=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${w}<script ${F}>
2499
- ${N5(`${J}${Z}
2496
+ ${$.map((Z,J)=>ZK(Z,J)).join(`
2497
+ `)}`}function b2($){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 q=w;if(Q++,q==="`"){let W=0;while(Q<G){if(J[Q]==="\\"){Q+=2;continue}if(J[Q]==="`"&&W===0){Q++;break}if(J[Q]==="$"&&J[Q+1]==="{"){W++,Q+=2;continue}if(J[Q]==="}"&&W>0){W--,Q++;continue}Q++}}else while(Q<G){if(J[Q]==="\\"){Q+=2;continue}if(J[Q]===q){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 q=J.slice(Q),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let U=W[1];if(!U.startsWith("_")&&!Z.has(U))X.push(U),Z.add(U);Q+=W[0].length;continue}let K=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(K){K[1].split(",").forEach((U)=>{let B=U.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Z.has(_))X.push(_),Z.add(_)}),Q+=K[0].length;continue}let z=q.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 GK($){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(!YK.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 q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=q.exec($))!==null)J(G[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=W.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 C7($,X={}){let Z=$,J="",Y=!1,G=[],Q=b8(Z,{filePath:X.filePath,projectRoot:X.projectRoot});Z=Q.code;let w=S8(Q.styles),q=E5(Z);Z=q.code,G=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:K}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (I5(),D7)));if(W(Z))Z=await K(Z,X.filePath||"",{projectRoot:X.projectRoot,minify:X.production}),Y=!0;if(X.autoImports!==!1){let O=v2(Z);Z=O.code,J=jX(O.stxImports,O.browserImports.filter((F)=>!G.includes(F)))}if(J=`${C8(Z,X.serverData)}${J}`,Z=r0(Z),!Y&&e1(X.attrs||""))Z=$5(Z);let z=JK(X.eventBindings||[]),U=(X.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(U)){let O=U.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${w}<script ${F}>
2499
+ ${k5(`${J}${Z}
2500
2500
  ${z}`)}
2501
- </script>`}let j=s9($),_=/function __stx_setup_/.test(Z),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function L(O){let F=O.length>0?`
2501
+ </script>`}let j=$X($),_=/function __stx_setup_/.test(Z),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function L(O){let F=O.length>0?`
2502
2502
  return { ${O.join(", ")} };`:"";return`${w}<script data-stx-scoped data-stx-run="always">
2503
2503
  window.stx.mount(function() {
2504
2504
  'use strict';
2505
- ${N5(`${J}${Z}
2505
+ ${k5(`${J}${Z}
2506
2506
  ${z}${F}`)}
2507
- })</script>`}if(!H&&!_){if(j)return L(I2($));if(X.templateContent){let O=I2($);if(O.length>0){let F=XK(X.templateContent);if(O.some((A)=>F.has(A)))return L(O)}}}return`${w}<script data-stx-scoped data-stx-run="always">
2507
+ })</script>`}if(!H&&!_){if(j)return L(b2($));if(X.templateContent){let O=b2($);if(O.length>0){let F=GK(X.templateContent);if(O.some((A)=>F.has(A)))return L(O)}}}return`${w}<script data-stx-scoped data-stx-run="always">
2508
2508
  ;(function() {
2509
2509
  'use strict';
2510
- ${N5(`${J}${Z}
2510
+ ${k5(`${J}${Z}
2511
2511
  ${z}`)}
2512
- })()</script>`}var xW,E2,D2,mW,rW,k2,sW,$K;var y7=y(()=>{$X();y0();T7();$1();XX();xW=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;E2=L1,D2=["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"];mW=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"]);rW=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,k2=new Set;sW={left:0,middle:1,right:2};$K=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 ZK}from"crypto";function C2($){let X=$[y8];return X instanceof Map?X:null}function P2($){$[y8]=new Map}function v2($,X){let Z=C2($);if(!Z)return null;let J=ZK("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 x2($,X){let Z=C2(X);if(!Z?.size)return $;let J=$;for(let[q,W]of Z){if(W.instances!==1)continue;let K=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(K,(z,U)=>`(${W.body})(${U});`)}let Y=[...Z].filter(([,q])=>q.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 uW,S2,C2,iW,tW,y2,$K,YK;var P7=D(()=>{YX();A0();E7();Z1();GX();uW=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;S2=A1,C2=["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"];iW=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"]);tW=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,y2=new Set;$K={left:0,middle:1,right:2};YK=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 f2($){let X=$[P8];return X instanceof Map?X:null}function g2($){$[P8]=new Map}function h2($,X){let Z=f2($);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 u2($,X){let Z=f2(X);if(!Z?.size)return $;let J=$;for(let[q,W]of Z){if(W.instances!==1)continue;let K=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");J=J.replace(K,(z,U)=>`(${W.body})(${U});`)}let Y=[...Z].filter(([,q])=>q.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(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${W.body}; }
@@ -2518,7 +2518,7 @@ ${Y.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = 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 y8="__stx_component_client_factories";var KX=()=>{};function QK($){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 wK($,X){let Z=/[$A-Z_a-z][$\w]*/g,J;while((J=Z.exec($))!==null){let Y=J[0],G=$[J.index-1];if(YK.has(Y))throw Error(`Potentially unsafe expression (matched /\\b${Y}\\b/; identifier ${Y}): ${X}`);if(G==="."&&u2.has(Y))throw Error(`Potentially unsafe expression (matched /.${Y}/; property ${Y}): ${X}`)}}function qK($){let X=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=X.exec($))!==null){let J=Z[2];if(!u2.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 b8($){let X=$.trim(),Z=QK(X);wK(Z,X),qK(X);for(let J of h2)if(J.test(Z))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${X}`);if(!g2.allowBracketNotation&&GK.test(X))throw Error(`Bracket notation with strings not allowed: ${X}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return X}function WK($){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("__")||h2.some((Y)=>Y.test(Z)))continue;if(J&&typeof J==="object"&&!Array.isArray(J))X[Z]=zX(J);else X[Z]=J}return X}function zX($,X=0){if(X>=g2.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((J)=>zX(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]=zX(Y,X+1);else Z[J]=Y}return Z}function G0($,X){try{let Z=WK(X),J=Object.keys(Z),Y=Object.values(Z);return W0($,J)(...Y)}catch{return}}function q0($){try{return b8($),!0}catch{return!1}}function k0($,X){try{let Z=G0($,X);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function W0($,X){let Z=b8($),J=/^[A-Za-z_$][\w$]*$/,Y=[],G=[];for(let W=0;W<X.length;W++){let K=X[W];if(!J.test(K))continue;if(d2.has(K))continue;Y.push(W),G.push(K)}let Q=(W)=>Function(...G,...W,`
2521
+ ${J.slice(w)}`}var P8="__stx_component_client_factories";var BX=()=>{};function KK($){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 zK($,X){let Z=/[$A-Z_a-z][$\w]*/g,J;while((J=Z.exec($))!==null){let Y=J[0],G=$[J.index-1];if(qK.has(Y))throw Error(`Potentially unsafe expression (matched /\\b${Y}\\b/; identifier ${Y}): ${X}`);if(G==="."&&l2.has(Y))throw Error(`Potentially unsafe expression (matched /.${Y}/; property ${Y}): ${X}`)}}function UK($){let X=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=X.exec($))!==null){let J=Z[2];if(!l2.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 v8($){let X=$.trim(),Z=KK(X);zK(Z,X),UK(X);for(let J of c2)if(J.test(Z))throw Error(`Potentially unsafe expression (matched /${J.source}/): ${X}`);if(!m2.allowBracketNotation&&WK.test(X))throw Error(`Bracket notation with strings not allowed: ${X}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return X}function jK($){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("__")||c2.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>=m2.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 w0($,X){try{let Z=jK(X),J=Object.keys(Z),Y=Object.values(Z);return K0($,J)(...Y)}catch{return}}function W0($){try{return v8($),!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=v8($),J=/^[A-Za-z_$][\w$]*$/,Y=[],G=[];for(let W=0;W<X.length;W++){let K=X[W];if(!J.test(K))continue;if(p2.has(K))continue;Y.push(W),G.push(K)}let Q=(W)=>Function(...G,...W,`
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 f2(w,G,Q);return f2((...W)=>{let K=Array(Y.length);for(let z=0;z<Y.length;z++)K[z]=W[Y[z]];return w(...K)},G,Q,(W)=>{w=Q(W)})}function f2($,X,Z,J){let G=/^(\w+) is not defined$/,Q=$,w=[],q=new Set(X);return(...W)=>{for(let K=0;K<=8;K++)try{return Q(...W)}catch(z){let U=z instanceof Error?z.message:"",B=G.exec(U);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(q.has(j)||d2.has(j))return;q.add(j),w.push(j),Q=Z(w),J?.(w)}return}}function S8($){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,g2,h2,YK,u2,GK,d2;var I0=y(()=>{JK={maxSanitizeDepth:10,allowBracketNotation:!1},g2={...JK},h2=[/\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/],YK=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"]),u2=new Set(["__proto__","constructor","prototype"]),GK=/[\w)\]]\s*\[\s*['"]/;d2=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 C8($,X){let Z=KK++,J=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return zK.set(J,{type:$,expression:X}),J}var KK=0,zK;var m2=y(()=>{zK=new Map});function n2($,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 y1($,X){return n2($,X,c2,l2)}function k5($,X){return n2($,X,p2,i2)}function b7($,X){if(!$.startsWith("<!--",X))return-1;let Z=$.indexOf("-->",X+4);if(Z===-1)return-1;return Z+3}function UK($,X){if($.startsWith("<!--",X)){let Z=b7($,X);return Z===-1?$.length:Z}for(let[Z,J]of[[c2,l2],[p2,i2]]){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 P8($,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 q=X($,J);if(q>J){Z.push({start:J,end:q,token:$.slice(J,q)}),J=q;continue}let W=UK($,J);if(W>J){J=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))G=!0;J++}return Z}function q1($,X,Z){let J=P8($,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 q=J[w];G+=$.slice(Q,q.start),G+=Z(q.token,w),Q=q.end}return G+=$.slice(Q),{output:G,tokens:Y}}function b1($){let{output:X,tokens:Z}=q1($,y1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:X,scripts:Z}}function S7($,X){if(X.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,J)=>X[+J]??"")}var c2,l2,p2,i2;var o1=y(()=>{c2=/<script\b[^>]*>/iy,l2=/<\/script\s*>/ig,p2=/<style\b[^>]*>/iy,i2=/<\/style\s*>/ig});var $Z={};a($Z,{usesSignalsInScript:()=>V1,unescapeHtml:()=>AK,registerFilters:()=>BK,registerFilter:()=>s2,processExpressions:()=>S1,interpolateScriptsInTemplate:()=>OK,interpolateScriptExpressions:()=>v8,interpolateScriptAttributes:()=>t2,getAllFilters:()=>a2,evaluateExpression:()=>m0,escapeHtml:()=>X1,defaultFilters:()=>P7,clearCustomFilters:()=>_K,applyFilters:()=>e2});function jK($){let X=r2.get($);if(!X){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");X=new RegExp(`:${Z}(?!\\w)`,"g"),r2.set($,X)}return X.lastIndex=0,X}function s2($,X){if($ in P7)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);C7[$]=X}function BK($){for(let[X,Z]of Object.entries($))s2(X,Z)}function a2(){return{...P7,...C7}}function _K(){for(let $ of Object.keys(C7))delete C7[$]}function X1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function V1($){let{scripts:X}=b1($);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 o2($,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 W=0;W<J.length;W++){let K=J[W];if(!G&&K==="`"){G=!0,Q=0;continue}if(G){if(K==="`"&&Q===0){G=!1;continue}if(K==="$"&&J[W+1]==="{"){Q++,W++,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,q;while((q=w.exec(J))!==null){let W=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(W)&&!(W in X))return!1}}return!0}function HK($,X){let Z=X.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let J=s0($);for(let Y of Z)if(new RegExp(`(?<![.#\\w$])${Y}(?![\\w$])`).test(J))return!0;return!1}function v8($,X){let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let G=m0(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=m0(Y,X);if(Q===void 0)return J;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return J}}),Z}function t2($,X){if(!$.includes("{"))return $;let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(J,Y)=>{try{let G=m0(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=m0(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 OK($,X,Z={}){let{output:J,scripts:Y}=b1($),G=Y.map((Q)=>{let w=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=Q.match(/^<script\b[^>]*>/i),W=Q.search(/<\/script\s*>$/i);if(!w||!q||W===-1)return Q;let K=w[1],z=w[2];if(/\bdata-raw\b/.test(K))return Q;if(Z.skipServer&&/\bserver\b/.test(K))return Q;let B=`<script${t2(K,X)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return B+z+Q.slice(W);return B+v8(z,X)+Q.slice(W)});return S7(J,G)}function S1($,X,Z){let J=$,Y=(z,U)=>{let B=k5(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 _=B.length,{output:H,tokens:L}=q1(z,U,(O,F)=>j(_+F));return B.push(...L),H},Q=[];J=G(J,Y,Q,(z)=>`<!--__STX_STYLE_${z}__-->`);let w=[];J=G(J,y1,w,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let q=X?.__stx_signals_gate===!0||V1($),W=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=m0(U,X);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return B0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${_}`,Z,$,B,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,U,B)=>{try{let j=m0(U,X);if(j===void 0&&X.__stx_buildMode==="compile")return C8("raw",U.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(X.__stx_buildMode==="compile")return C8("raw",U.trim());let _=j instanceof Error?j.message:String(j);return B0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${_}`,Z,$,B,z)}}),J=G(J,y1,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 _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,O=j.match(H)?.[1],F=O&&((O in X)||_.includes(O)),V=Boolean(O&&W.has(O)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=j.match(A),N=R&&!_.includes(R[1])&&!(R[1]in X);if(/^__[A-Z_]+__$/.test(j))return"";try{let M=m0(U,X);if(V)return z;if(q&&!o2(j,X))return z;if(X.__stx_buildMode==="compile"&&!q&&(M===void 0||HK(j,X)))return C8("expr",j);return M!==void 0&&M!==null?X1(String(M)):""}catch(M){if(V)return z;if(q&&!o2(j,X))return z;if(N)return z;let k=M instanceof Error?M.message:String(M);return B0("Expression",`Error evaluating: {{ ${j} }}: ${k}`,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 e2($,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=C7[Q]||P7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(a2()).join(", ")}`);let q=[];if(Y.startsWith(":")){let W=Y.match(/^:([^|\s]+)/);if(W){let K=W[1].trim();try{let z=Number(K);q=[Number.isNaN(z)?K:z]}catch{q=[K]}Y=Y.substring(W[0].length).trim()}}else if(Y.startsWith("(")){let W=1,K=1;while(W>0&&K<Y.length){if(Y[K]==="(")W++;if(Y[K]===")")W--;K++}if(W===0){let z=Y.substring(1,K-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[m0(`(${z})`,Z,!0)];else{let U=[],B="",j=null,_=0,H=0,L=0,O=!1;for(let F=0;F<z.length;F++){let V=z[F];if(O){B+=V,O=!1;continue}if(V==="\\"){B+=V,O=!0;continue}if(j){if(B+=V,V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V,B+=V;continue}if(V==="(")_++;else if(V===")")_--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")L++;else if(V==="}")L--;if(V===","&&_===0&&H===0&&L===0){U.push(B),B="";continue}B+=V}if(B)U.push(B);q=U.map((F)=>{let V=F.trim();return m0(V,Z,!0)})}}catch{q=[z]}Y=Y.substring(K).trim()}}try{J=w(J,Z,...q)}catch(W){let K=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${Q}': ${K}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function LK($){let X=!1,Z="",J=0,Y=0,G=0,Q=!1;for(let w=0;w<$.length;w++){let q=$[w],W=$[w+1];if(X&&Q){Q=!1;continue}if(X&&q==="\\"){Q=!0;continue}if(Q=!1,(q==='"'||q==="'"||q==="`")&&!Q){if(!X)X=!0,Z=q;else if(q===Z)X=!1,Z="";continue}if(X&&Z==="`"&&q==="$"&&W==="{"){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(q==="(")J++;else if(q===")")J--;else if(q==="[")Y++;else if(q==="]")Y--;else if(q==="{")G++;else if(q==="}")G--;if(q==="|"&&J===0&&Y===0&&G===0){if(W==="|"){w++;continue}if(W==="="){w++;continue}return w}}return-1}function m0($,X,Z=!1){try{let J=$.trim(),Y=LK(J);if(Y>0){let G=J.substring(0,Y).trim(),Q=J.substring(Y+1).trim(),w=m0(G,X,!0);return e2(w,Q,X)}if(!q0(J)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${J}`);return G0(J,X)}try{let G=Object.keys(X),Q=Object.values(X);return W0(J,G)(...Q)}catch{return G0(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=FK(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 FK($,X){let Z=null;for(let Y of X){if(Y===$)continue;let G=VK($,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 VK($,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 q=Z[w-1]===J[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,Y[w]+1,Y[w-1]+q)}for(let w=0;w<=Z.length;w++)Y[w]=G[w]}return Y[Z.length]}function AK($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var C7,r2,P7;var W1=y(()=>{I0();y0();m2();o1();C7={},r2=new Map;P7={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 X1(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 q of G){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return Y?$:"";let w=String(Q);return Object.entries(Z).forEach(([q,W])=>{w=w.replace(jK(q),String(W))}),w},t:($,X,Z={})=>{return P7.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 s1{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 E5($,X){if(X?.includes("g"))return new RegExp($,X);let Z=`${$}:${X||""}`;if(!I5.has(Z)){if(I5.size>=RK){let J=I5.keys().next().value;if(J)I5.delete(J)}I5.set(Z,new RegExp($,X))}return I5.get(Z)}class XZ{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(q)=>{try{let W=`${Z}:${q}`,K=Y.get(W);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 d2(w,G,Q);return d2((...W)=>{let K=Array(Y.length);for(let z=0;z<Y.length;z++)K[z]=W[Y[z]];return w(...K)},G,Q,(W)=>{w=Q(W)})}function d2($,X,Z,J){let G=/^(\w+) is not defined$/,Q=$,w=[],q=new Set(X);return(...W)=>{for(let K=0;K<=8;K++)try{return Q(...W)}catch(z){let U=z instanceof Error?z.message:"",B=G.exec(U);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(q.has(j)||p2.has(j))return;q.add(j),w.push(j),Q=Z(w),J?.(w)}return}}function x8($){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 wK,m2,c2,qK,l2,WK,p2;var y0=D(()=>{wK={maxSanitizeDepth:10,allowBracketNotation:!1},m2={...wK},c2=[/\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/],qK=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"]),l2=new Set(["__proto__","constructor","prototype"]),WK=/[\w)\]]\s*\[\s*['"]/;p2=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 f8($,X){let Z=BK++,J=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return _K.set(J,{type:$,expression:X}),J}var BK=0,_K;var i2=D(()=>{_K=new Map});function a2($,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 P1($,X){return a2($,X,n2,r2)}function D5($,X){return a2($,X,o2,s2)}function v7($,X){if(!$.startsWith("<!--",X))return-1;let Z=$.indexOf("-->",X+4);if(Z===-1)return-1;return Z+3}function HK($,X){if($.startsWith("<!--",X)){let Z=v7($,X);return Z===-1?$.length:Z}for(let[Z,J]of[[n2,r2],[o2,s2]]){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 g8($,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 q=X($,J);if(q>J){Z.push({start:J,end:q,token:$.slice(J,q)}),J=q;continue}let W=HK($,J);if(W>J){J=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))G=!0;J++}return Z}function z1($,X,Z){let J=g8($,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 q=J[w];G+=$.slice(Q,q.start),G+=Z(q.token,w),Q=q.end}return G+=$.slice(Q),{output:G,tokens:Y}}function U1($){let{output:X,tokens:Z}=z1($,P1,(J,Y)=>`\x00STX_SCRIPT_${Y}\x00`);return{output:X,scripts:Z}}function y5($,X){if(X.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,J)=>X[+J]??"")}var n2,r2,o2,s2;var v1=D(()=>{n2=/<script\b[^>]*>/iy,r2=/<\/script\s*>/ig,o2=/<style\b[^>]*>/iy,s2=/<\/style\s*>/ig});var YZ={};t(YZ,{usesSignalsInScript:()=>N1,unescapeHtml:()=>MK,registerFilters:()=>LK,registerFilter:()=>$Z,processExpressions:()=>x1,interpolateScriptsInTemplate:()=>AK,interpolateScriptExpressions:()=>h8,interpolateScriptAttributes:()=>ZZ,getAllFilters:()=>XZ,evaluateExpression:()=>i0,escapeHtml:()=>J1,defaultFilters:()=>f7,clearCustomFilters:()=>FK,applyFilters:()=>JZ});function OK($){let X=t2.get($);if(!X){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");X=new RegExp(`:${Z}(?!\\w)`,"g"),t2.set($,X)}return X.lastIndex=0,X}function $Z($,X){if($ in f7)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);x7[$]=X}function LK($){for(let[X,Z]of Object.entries($))$Z(X,Z)}function XZ(){return{...f7,...x7}}function FK(){for(let $ of Object.keys(x7))delete x7[$]}function J1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function N1($){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 e2($,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 W=0;W<J.length;W++){let K=J[W];if(!G&&K==="`"){G=!0,Q=0;continue}if(G){if(K==="`"&&Q===0){G=!1;continue}if(K==="$"&&J[W+1]==="{"){Q++,W++,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,q;while((q=w.exec(J))!==null){let W=q[1];if(!J.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(W)&&!(W in X))return!1}}return!0}function VK($,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 h8($,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 ZZ($,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 AK($,X,Z={}){let{output:J,scripts:Y}=U1($),G=Y.map((Q)=>{let w=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=Q.match(/^<script\b[^>]*>/i),W=Q.search(/<\/script\s*>$/i);if(!w||!q||W===-1)return Q;let K=w[1],z=w[2];if(/\bdata-raw\b/.test(K))return Q;if(Z.skipServer&&/\bserver\b/.test(K))return Q;let B=`<script${ZZ(K,X)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return B+z+Q.slice(W);return B+h8(z,X)+Q.slice(W)});return y5(J,G)}function x1($,X,Z){let J=$,Y=(z,U)=>{let B=D5(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 _=B.length,{output:H,tokens:L}=z1(z,U,(O,F)=>j(_+F));return B.push(...L),H},Q=[];J=G(J,Y,Q,(z)=>`<!--__STX_STYLE_${z}__-->`);let w=[];J=G(J,P1,w,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let q=X?.__stx_signals_gate===!0||N1($),W=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=i0(U,X);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return O0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${_}`,Z,$,B,z)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(z,U,B)=>{try{let j=i0(U,X);if(j===void 0&&X.__stx_buildMode==="compile")return f8("raw",U.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(X.__stx_buildMode==="compile")return f8("raw",U.trim());let _=j instanceof Error?j.message:String(j);return O0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${_}`,Z,$,B,z)}}),J=G(J,P1,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 _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,O=j.match(H)?.[1],F=O&&((O in X)||_.includes(O)),V=Boolean(O&&W.has(O)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=j.match(A),N=R&&!_.includes(R[1])&&!(R[1]in X);if(/^__[A-Z_]+__$/.test(j))return"";try{let T=i0(U,X);if(V)return z;if(q&&!e2(j,X))return z;if(X.__stx_buildMode==="compile"&&!q&&(T===void 0||VK(j,X)))return f8("expr",j);return T!==void 0&&T!==null?J1(String(T)):""}catch(T){if(V)return z;if(q&&!e2(j,X))return z;if(N)return z;let k=T instanceof Error?T.message:String(T);return O0("Expression",`Error evaluating: {{ ${j} }}: ${k}`,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 JZ($,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=x7[Q]||f7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(XZ()).join(", ")}`);let q=[];if(Y.startsWith(":")){let W=Y.match(/^:([^|\s]+)/);if(W){let K=W[1].trim();try{let z=Number(K);q=[Number.isNaN(z)?K:z]}catch{q=[K]}Y=Y.substring(W[0].length).trim()}}else if(Y.startsWith("(")){let W=1,K=1;while(W>0&&K<Y.length){if(Y[K]==="(")W++;if(Y[K]===")")W--;K++}if(W===0){let z=Y.substring(1,K-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[i0(`(${z})`,Z,!0)];else{let U=[],B="",j=null,_=0,H=0,L=0,O=!1;for(let F=0;F<z.length;F++){let V=z[F];if(O){B+=V,O=!1;continue}if(V==="\\"){B+=V,O=!0;continue}if(j){if(B+=V,V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V,B+=V;continue}if(V==="(")_++;else if(V===")")_--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")L++;else if(V==="}")L--;if(V===","&&_===0&&H===0&&L===0){U.push(B),B="";continue}B+=V}if(B)U.push(B);q=U.map((F)=>{let V=F.trim();return i0(V,Z,!0)})}}catch{q=[z]}Y=Y.substring(K).trim()}}try{J=w(J,Z,...q)}catch(W){let K=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${Q}': ${K}`)}if(Y.startsWith("|"))Y=Y.substring(1).trim();else break}return J}function RK($){let X=!1,Z="",J=0,Y=0,G=0,Q=!1;for(let w=0;w<$.length;w++){let q=$[w],W=$[w+1];if(X&&Q){Q=!1;continue}if(X&&q==="\\"){Q=!0;continue}if(Q=!1,(q==='"'||q==="'"||q==="`")&&!Q){if(!X)X=!0,Z=q;else if(q===Z)X=!1,Z="";continue}if(X&&Z==="`"&&q==="$"&&W==="{"){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(q==="(")J++;else if(q===")")J--;else if(q==="[")Y++;else if(q==="]")Y--;else if(q==="{")G++;else if(q==="}")G--;if(q==="|"&&J===0&&Y===0&&G===0){if(W==="|"){w++;continue}if(W==="="){w++;continue}return w}}return-1}function i0($,X,Z=!1){try{let J=$.trim(),Y=RK(J);if(Y>0){let G=J.substring(0,Y).trim(),Q=J.substring(Y+1).trim(),w=i0(G,X,!0);return JZ(w,Q,X)}if(!W0(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=NK(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 NK($,X){let Z=null;for(let Y of X){if(Y===$)continue;let G=TK($,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 TK($,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 q=Z[w-1]===J[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,Y[w]+1,Y[w-1]+q)}for(let w=0;w<=Z.length;w++)Y[w]=G[w]}return Y[Z.length]}function MK($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var x7,t2,f7;var j1=D(()=>{y0();A0();i2();v1();x7={},t2=new Map;f7={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 J1(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 q of G){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return Y?$:"";let w=String(Q);return Object.entries(Z).forEach(([q,W])=>{w=w.replace(OK(q),String(W))}),w},t:($,X,Z={})=>{return f7.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 X5{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 S5($,X){if(X?.includes("g"))return new RegExp($,X);let Z=`${$}:${X||""}`;if(!b5.has(Z)){if(b5.size>=kK){let J=b5.keys().next().value;if(J)b5.delete(J)}b5.set(Z,new RegExp($,X))}return b5.get(Z)}class GZ{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(q)=>{try{let W=`${Z}:${q}`,K=Y.get(W);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 ${q};
@@ -2540,34 +2540,34 @@ catch (e) {
2540
2540
  }
2541
2541
  throw e;
2542
2542
  }
2543
- `),Y.set(W,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 ZZ{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 q of this.violationHandlers)try{q(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 NK(){if(!UX)UX=new ZZ;return UX}var I5,RK=500,JA,UX=null,JZ;var D5=y(()=>{I5=new Map;JA=new XZ;JZ=new Proxy({},{get($,X){return NK()[X]}})});function YZ($,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 GZ($,X,Z={}){let{prefix:J="",preserveHost:Y=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!$.trim())return"";let w=jX($),q=[],W=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}`;W.set(U,B)}}for(let K of w){let z=QZ(K,X,J,Y,W,Q);q.push(z)}return q.join(`
2543
+ `),Y.set(W,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 QZ{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 q of this.violationHandlers)try{q(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 IK(){if(!HX)HX=new QZ;return HX}var b5,kK=500,QA,HX=null,wZ;var C5=D(()=>{b5=new Map;QA=new GZ;wZ=new Proxy({},{get($,X){return IK()[X]}})});function qZ($,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 WZ($,X,Z={}){let{prefix:J="",preserveHost:Y=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!$.trim())return"";let w=OX($),q=[],W=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}`;W.set(U,B)}}for(let K of w){let z=KZ(K,X,J,Y,W,Q);q.push(z)}return q.join(`
2544
2544
 
2545
- `)}function jX($){let X=[],Z=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Y="",G=!1,Q="";for(let w=0;w<Z.length;w++){let q=Z[w];if(q==="@"&&J===0)G=!0;if(q==="{")J++;else if(q==="}"){if(J--,J===0){if(G){Q+=q;let W=Q.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,K,z,U]=W;if(K==="keyframes")X.push({selector:`@keyframes ${z.trim()}`,declarations:U.trim()});else if(K==="media"||K==="supports"||K==="container"){let B=jX(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+=q;let W=Y.match(/([^{]+)\{([^}]*)\}/);if(W)X.push({selector:W[1].trim(),declarations:W[2].trim()});Y=""}continue}}if(G)Q+=q;else Y+=q}return X}function QZ($,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=jX(`x { ${w} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((U)=>QZ(U,X,Z,J,Y,G)).join(`
2545
+ `)}function OX($){let X=[],Z=$.replace(/\/\*[\s\S]*?\*\//g,""),J=0,Y="",G=!1,Q="";for(let w=0;w<Z.length;w++){let q=Z[w];if(q==="@"&&J===0)G=!0;if(q==="{")J++;else if(q==="}"){if(J--,J===0){if(G){Q+=q;let W=Q.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,K,z,U]=W;if(K==="keyframes")X.push({selector:`@keyframes ${z.trim()}`,declarations:U.trim()});else if(K==="media"||K==="supports"||K==="container"){let B=OX(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+=q;let W=Y.match(/([^{]+)\{([^}]*)\}/);if(W)X.push({selector:W[1].trim(),declarations:W[2].trim()});Y=""}continue}}if(G)Q+=q;else Y+=q}return X}function KZ($,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=OX(`x { ${w} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((U)=>KZ(U,X,Z,J,Y,G)).join(`
2547
2547
  `);return`${Q} {
2548
2548
  ${z}
2549
- }`}return`${Q} { ${w} }`}let q=TK(Q,X,Z,J),W=w;for(let[K,z]of Y)W=W.replace(new RegExp(`\\b${K}\\b`,"g"),z);if(G)W=W.replace(/--([a-z-]+)/gi,`--${X}-$1`);return`${q} { ${W} }`}function TK($,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 W=Q.replace(/:host(\([^)]*\))?/,`.${X}$1`);G.push(W)}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 q=MK(Q,X);if(q)G.push(Z?`${Z} ${q}`:q)}return G.join(", ")}function MK($,X){let Z=0,J=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Z++;else if(W==="]"||W===")")Z--;else if(Z===0&&(W===" "||W===">"||W==="+"||W==="~")){J=q;break}}let Y=$.slice(0,J),G=$.slice(J);if(!Y)return"";let Q=Y.length,w=0;for(let q=0;q<Y.length;q++){let W=Y[q];if(W==="["||W==="(")w++;else if(W==="]"||W===")")w--;else if(Z===0&&w===0&&W===":"){Q=q;break}}return`${Y.slice(0,Q)}.${X}${Y.slice(Q)}${G}`}function qZ($){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 x8($,X){if(!kK.test($))return{html:$,hasScoped:!1};let Z=YZ(X),J=`data-v-${Z}`,Y=$,G=new RegExp(`<style\\s+([^>]*${BX}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(Y=Y.replace(G,(w,q,W)=>{Q=!0;let K=IK(W,J),z=q.replace(new RegExp(BX,"gi"),"").trim(),U=z?` ${z}`:"";return`<style data-stx-scoped="${Z}"${U}>${K}</style>`}),!Q)return{html:$,hasScoped:!1};return Y=DK(Y,J),{html:Y,hasScoped:!0}}function IK($,X){return GZ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${X}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${X}]`)}function DK($,X){let Z=q1($,(Y,G)=>{let Q=y1(Y,G);return Q>G?Q:k5(Y,G)},(Y,G)=>EK(G)),J=yK(Z.output,X);return wZ.lastIndex=0,J.replace(wZ,(Y,G)=>Z.tokens[Number(G)])}function yK($,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 BX,kK,EK=($)=>`\x00stx-scope-mask-${$}\x00`,wZ;var _X=y(()=>{o1();BX=String.raw`(?<![\w-])scoped(?![\w-])`,kK=new RegExp(`<style\\s+[^>]*${BX}`,"i");wZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function SK($){let X=$.replace(/^<template\b/i,"").replace(/>$/,"");return bK.test(X)}function f8($){v7.lastIndex=0;let X;while((X=v7.exec($))!==null){if(X[0].startsWith("</")||SK(X[0]))continue;let Z=X.index,J=v7.lastIndex,Y=1,G;while((G=v7.exec($))!==null)if(G[0].startsWith("</")){if(Y--,Y===0){let Q=G.index;return{start:Z,openEnd:J,closeStart:Q,end:v7.lastIndex,content:$.slice(J,Q)}}}else Y++;return null}return null}var v7,bK;var HX=y(()=>{v7=/<\/?template\b[^>]*>/gi,bK=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var WZ=()=>{};function b0($,X,Z,J=0){let Y=0,G=J,Q=null,w=0,q=!1;while(G<$.length){let W=$[G];if(Q&&q){q=!1,G++;continue}if(Q&&W==="\\"){q=!0,G++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!Q){Q=W,G++;continue}if(W===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&W==="$"&&$[G+1]==="{"){w++,G+=2;continue}if(w>0&&W==="}"){w--,G++;continue}if(W==="`"&&Q==="`"&&w===0){Q=null,G++;continue}if(Q){G++;continue}if(W===X)Y++;else if(W===Z){if(Y--,Y===0)return G}G++}return-1}var FX={};a(FX,{useTitle:()=>fK,useSeoMeta:()=>KZ,usePageTitle:()=>fK,useHead:()=>LX,seoMetaToHeadConfig:()=>h8,resetHead:()=>vK,renderHtmlAttrs:()=>hK,renderHead:()=>gK,renderBodyAttrs:()=>uK,processTitleDirective:()=>cK,processMetaDirective:()=>lK,processHeadDirective:()=>mK,mergeHeadConfigs:()=>y5,getPageMeta:()=>PK,getHead:()=>OX,definePageMeta:()=>xK,applyHead:()=>dK});function OX(){return C1}function PK(){return g8}function vK(){C1={},CK.length=0,g8={}}function LX($){C1=y5(C1,$)}function y5($,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 KZ($){LX(h8($))}function h8($){let X=[];if($.description)X.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;X.push({name:"keywords",content:q})}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 q of $.articleTags)X.push({property:"article:tag",content:q});let w=[];if($.canonical)w.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:X,link:w}}function xK($){if(g8={...g8,...$},$.title||$.description)KZ({title:$.title,description:$.description})}function fK($){let X=typeof $==="function"?$():$;LX({title:X})}function gK($=C1){let X=[];if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);X.push(`<title>${a1(Z)}</title>`)}if($.base){let Z=Object.entries($.base).map(([J,Y])=>`${J}="${a1(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}="${a1(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}="${a1(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}="${a1(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 hK($=C1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([X,Z])=>`${X}="${a1(Z)}"`).join(" ")}function uK($=C1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([X,Z])=>`${X}="${a1(Z)}"`).join(" ")}function a1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function dK($=C1){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 mK($){let X="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,Y)=>{return X+=Y.trim()+`
2551
- `,""}),headContent:X.trim()}}function cK($,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=y5(w,{title:Q}),""})}function lK($,X){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,J,Y,G,Q,w)=>{let q=G?Q:w,W=G?q:X[(q||"").trim()]??q,z=Y.includes(":")?{property:Y,content:W}:{name:Y,content:W},U=X.__stx_runtime_head??{};return X.__stx_runtime_head=y5(U,{meta:[z]}),""})}var C1,CK,g8;var x7=y(()=>{C1={},CK=[],g8={}});var u8={};a(u8,{stripTypeScript:()=>OZ,splitDeclaration:()=>NZ,isModuleResolutionFailure:()=>LZ,isMissingBindingFailure:()=>FZ,isCompleteImport:()=>VZ,hasVariables:()=>IZ,extractVariables:()=>t1,extractScriptFromTemplate:()=>kZ,convertToCommonJS:()=>RX,STX_ENGINE_BINDING_NAMES:()=>AX});import P1 from"path";import b5 from"process";function iK($){let X=[],Z=0,J=$.split(`
2552
- `);for(let Y of J){let G=Z,Q=null,w=!1;for(let q=0;q<Y.length;q++){let W=Y[q];if(w){w=!1;continue}if(W==="\\"){w=!0;continue}if(Q){if(W===Q)Q=null;continue}if(W==="'"||W==='"'||W==="`"){Q=W;continue}if(W==="/"&&q+1<Y.length&&Y[q+1]==="/")break;if(W==="{")Z++;else if(W==="}")Z--}if(G===0){let q=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)X.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let W=Y.match(/(?:const|let|var)\s+(\w+)/);if(W)X.push(W[1])}else{let W=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[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 OZ($){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,q=null;for(let W=0;W<J.length;W++){let K=J[W];if(q){if(G+=K,K===q)q=null;continue}if(K==='"'||K==="'"||K==="`"){q=K,G+=K;continue}if(K==="<")Q++;else if(K===">"&&Q>0)Q--;else if(K==="(")w++;else if(K===")")w--;if(K===","&&Q===0&&w===0){Y.push(G),G="";continue}G+=K}if(G)Y.push(G);return Y.map((W)=>{let K=W.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 W;let H=U.substring(0,B).trim().replace(/\?$/,""),L=U.substring(B+1),O=-1,F=0;for(let A=0;A<L.length;A++)if(L[A]==="<")F++;else if(L[A]===">")F--;else if(L[A]==="="&&F===0){O=A;break}let V=z?"...":"";if(O!==-1)return`${V}${H} = ${L.substring(O+1).trim()}`;return`${V}${H}`}).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,q=Q+1,W=0,K=null;while(q<X.length&&w>0){let B=X[q];if(K){if(B===K)K=null;q++;continue}if(B==='"'||B==="'"||B==="`"){K=B,q++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")w++;else if(B===")")w--}if(w>0)q++}if(w!==0)continue;let z=X.substring(Q+1,q);if(!z.includes(":"))continue;let U=Z(z);G.push({start:Q+1,end:q,replacement:U})}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];X=X.substring(0,w)+W+X.substring(q)}}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,...q]=Q.split("="),W=w.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).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
-
2554
- `),X}function LZ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function FZ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function t1($,X,Z,J={}){if(!$.trim())return;let Y;try{let P=new Bun.Transpiler({loader:"ts",target:"browser",define:u0()}),C=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");C=C.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Y=P.transformSync(C)}catch{Y=OZ($)}let G={exports:{}},Q=G.exports,w=b5.cwd(),q={},W=[...Y.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((P)=>P[1]).filter((P)=>!P.startsWith("node:")&&!P.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(P));for(let P of W)try{let C=P1.resolve(w,"node_modules",P),g=P1.join(C,"package.json"),c=JSON.parse(U0("fs").readFileSync(g,"utf8")),d=c.main||"index.js";if(c.exports){let w0=typeof c.exports==="string"?c.exports:c.exports["."];if(typeof w0==="string")d=w0;else if(w0?.bun)d=w0.bun;else if(w0?.import)d=w0.import;else if(w0?.default)d=w0.default}q[P]=await import(P1.resolve(C,d))}catch{}let K=(P)=>{if(q[P])return q[P];return U0(P)},z=X.props||{},U=(P)=>{if(!P)return z;let C={};for(let[g,c]of Object.entries(P)){let d=z[g];if(d!==void 0)C[g]=d;else if(typeof c==="function")C[g]=c();else C[g]=c}return C};for(let[P,C]of Object.entries(z))Object.defineProperty(U,P,{value:C,enumerable:!0,configurable:!0,writable:!0});for(let P of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,P))continue;try{Object.defineProperty(U,P,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(P)=>{if(!P)return z;let C={...z};for(let[g,c]of Object.entries(P)){let d=c&&typeof c==="object"&&!Array.isArray(c)?c:{type:c};if(C[g]===void 0&&d.default!==void 0)C[g]=typeof d.default==="function"?d.default():d.default}return C},j=()=>X.slots||{},_=(P,C)=>{let g={...P};for(let[c,d]of Object.entries(C))if(g[c]===void 0)if(typeof d==="function")g[c]=d();else g[c]=d;return g},H=(P)=>{let C=()=>P;return C.set=(g)=>{},C.update=(g)=>{},C},L=(P)=>{let C,g=!1;return()=>{if(!g)try{C=P(),g=!0}catch{C=void 0}return C}},O=(P)=>{},F=(P)=>P(),V=(P)=>{},A=(P)=>{};function R(P){let C=P||{};if(C.title!==void 0||C.description!==void 0)D({title:C.title,description:C.description})}function N(P){if(!P||typeof P!=="object")return;let C=X.__stxClientPayload??{};Object.assign(C,P),X.__stxClientPayload=C}let M=()=>{let P=X.__stxServeContext,C=X.__stxServeSearch??P?.search??"",g=P?.path??"",c=Object.fromEntries(new URLSearchParams(C)),d=X.query,w0=Object.keys(c).length>0?c:d??{},N0=C||(Object.keys(w0).length>0?`?${new URLSearchParams(w0).toString()}`:"");return{params:X.params??{},query:w0,path:g,name:"",fullPath:g+N0,hash:"",matched:[]}},k=()=>({push:(P)=>{},replace:(P)=>{},back:()=>{},forward:()=>{},go:(P)=>{}}),T=(P)=>{let C=X.__stx_runtime_head||{};X.__stx_runtime_head=y5(C,P||{})},D=(P)=>{T(h8(P||{}))},I=(P)=>({value:P}),S=(P)=>P,b=(P)=>({value:typeof P==="function"?P():P}),E=(P,C)=>{},v=(P)=>{},x=(P)=>{},f=(P)=>P?P():Promise.resolve(),h=(P)=>(C,...g)=>{},p=(P)=>{},H0=(P,C)=>{},M0=(P,C)=>C,j0=()=>({value:"light"}),Z0=()=>H(!1),l=(P)=>H(!1),J0=()=>H(!1),D0=()=>l("(prefers-color-scheme: dark)"),v0=()=>l("(prefers-color-scheme: light)"),j5=()=>l("(prefers-reduced-motion: reduce)"),r=()=>l("(prefers-contrast: more)"),e={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},K0=new Proxy(e,{get(P,C){if(C in P)return P[C];return},set(P,C,g){return P[C]=g,!0}}),x0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},V0=console;try{let P=RX(Y,Z),C=new Set(Object.keys(z)),g=(o)=>/^[a-z_$][\w$]*$/i.test(o),c=Object.keys(X).filter((o)=>!C.has(o)&&o!=="props"&&g(o)),d=c.map((o)=>X[o]);if(!c.includes("__stxServeContext"))c.push("__stxServeContext"),d.push(void 0);let w0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),N0=[],B1=[];for(let[o,l0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(o))continue;if(w0.has(o))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${o}\\b`).test(P))continue;N0.push(o),B1.push(l0)}let h0=iK(P).map((o)=>`module.exports.${o} = typeof ${o} !== 'undefined' ? ${o} : module.exports.${o};`).join(`
2555
- `),e0=X.params??{},l1=[],k1=[];for(let o=0;o<c.length;o++){if(c[o]==="params")continue;l1.push(c[o]),k1.push(d[o])}let z0=await Function(...AX,...N0,...l1,`return (async () => {
2556
- ${P}
2557
- ${h0}
2549
+ }`}return`${Q} { ${w} }`}let q=EK(Q,X,Z,J),W=w;for(let[K,z]of Y)W=W.replace(new RegExp(`\\b${K}\\b`,"g"),z);if(G)W=W.replace(/--([a-z-]+)/gi,`--${X}-$1`);return`${q} { ${W} }`}function EK($,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 W=Q.replace(/:host(\([^)]*\))?/,`.${X}$1`);G.push(W)}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 q=DK(Q,X);if(q)G.push(Z?`${Z} ${q}`:q)}return G.join(", ")}function DK($,X){let Z=0,J=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Z++;else if(W==="]"||W===")")Z--;else if(Z===0&&(W===" "||W===">"||W==="+"||W==="~")){J=q;break}}let Y=$.slice(0,J),G=$.slice(J);if(!Y)return"";let Q=Y.length,w=0;for(let q=0;q<Y.length;q++){let W=Y[q];if(W==="["||W==="(")w++;else if(W==="]"||W===")")w--;else if(Z===0&&w===0&&W===":"){Q=q;break}}return`${Y.slice(0,Q)}.${X}${Y.slice(Q)}${G}`}function UZ($){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 u8($,X){if(!yK.test($))return{html:$,hasScoped:!1};let Z=qZ(X),J=`data-v-${Z}`,Y=$,G=new RegExp(`<style\\s+([^>]*${LX}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(Y=Y.replace(G,(w,q,W)=>{Q=!0;let K=bK(W,J),z=q.replace(new RegExp(LX,"gi"),"").trim(),U=z?` ${z}`:"";return`<style data-stx-scoped="${Z}"${U}>${K}</style>`}),!Q)return{html:$,hasScoped:!1};return Y=CK(Y,J),{html:Y,hasScoped:!0}}function bK($,X){return WZ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${X}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${X}]`)}function CK($,X){let Z=z1($,(Y,G)=>{let Q=P1(Y,G);return Q>G?Q:D5(Y,G)},(Y,G)=>SK(G)),J=PK(Z.output,X);return zZ.lastIndex=0,J.replace(zZ,(Y,G)=>Z.tokens[Number(G)])}function PK($,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 LX,yK,SK=($)=>`\x00stx-scope-mask-${$}\x00`,zZ;var FX=D(()=>{v1();LX=String.raw`(?<![\w-])scoped(?![\w-])`,yK=new RegExp(`<style\\s+[^>]*${LX}`,"i");zZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function xK($){let X=$.replace(/^<template\b/i,"").replace(/>$/,"");return vK.test(X)}function d8($){g7.lastIndex=0;let X;while((X=g7.exec($))!==null){if(X[0].startsWith("</")||xK(X[0]))continue;let Z=X.index,J=g7.lastIndex,Y=1,G;while((G=g7.exec($))!==null)if(G[0].startsWith("</")){if(Y--,Y===0){let Q=G.index;return{start:Z,openEnd:J,closeStart:Q,end:g7.lastIndex,content:$.slice(J,Q)}}}else Y++;return null}return null}var g7,vK;var VX=D(()=>{g7=/<\/?template\b[^>]*>/gi,vK=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var jZ=()=>{};function P0($,X,Z,J=0){let Y=0,G=J,Q=null,w=0,q=!1;while(G<$.length){let W=$[G];if(Q&&q){q=!1,G++;continue}if(Q&&W==="\\"){q=!0,G++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!Q){Q=W,G++;continue}if(W===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&W==="$"&&$[G+1]==="{"){w++,G+=2;continue}if(w>0&&W==="}"){w--,G++;continue}if(W==="`"&&Q==="`"&&w===0){Q=null,G++;continue}if(Q){G++;continue}if(W===X)Y++;else if(W===Z){if(Y--,Y===0)return G}G++}return-1}var NX={};t(NX,{useTitle:()=>dK,useSeoMeta:()=>BZ,usePageTitle:()=>dK,useHead:()=>RX,seoMetaToHeadConfig:()=>c8,resetHead:()=>hK,renderHtmlAttrs:()=>cK,renderHead:()=>mK,renderBodyAttrs:()=>lK,processTitleDirective:()=>nK,processMetaDirective:()=>rK,processHeadDirective:()=>iK,mergeHeadConfigs:()=>P5,getPageMeta:()=>gK,getHead:()=>AX,definePageMeta:()=>uK,applyHead:()=>pK});function AX(){return f1}function gK(){return m8}function hK(){f1={},fK.length=0,m8={}}function RX($){f1=P5(f1,$)}function P5($,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 BZ($){RX(c8($))}function c8($){let X=[];if($.description)X.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;X.push({name:"keywords",content:q})}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 q of $.articleTags)X.push({property:"article:tag",content:q});let w=[];if($.canonical)w.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:X,link:w}}function uK($){if(m8={...m8,...$},$.title||$.description)BZ({title:$.title,description:$.description})}function dK($){let X=typeof $==="function"?$():$;RX({title:X})}function mK($=f1){let X=[];if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);X.push(`<title>${Z5(Z)}</title>`)}if($.base){let Z=Object.entries($.base).map(([J,Y])=>`${J}="${Z5(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}="${Z5(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}="${Z5(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}="${Z5(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 cK($=f1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([X,Z])=>`${X}="${Z5(Z)}"`).join(" ")}function lK($=f1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([X,Z])=>`${X}="${Z5(Z)}"`).join(" ")}function Z5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function pK($=f1){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 iK($){let X="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(J,Y)=>{return X+=Y.trim()+`
2551
+ `,""}),headContent:X.trim()}}function nK($,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=P5(w,{title:Q}),""})}function rK($,X){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,J,Y,G,Q,w)=>{let q=G?Q:w,W=G?q:X[(q||"").trim()]??q,z=Y.includes(":")?{property:Y,content:W}:{name:Y,content:W},U=X.__stx_runtime_head??{};return X.__stx_runtime_head=P5(U,{meta:[z]}),""})}var f1,fK,m8;var h7=D(()=>{f1={},fK=[],m8={}});var l8={};t(l8,{stripTypeScript:()=>AZ,splitDeclaration:()=>IZ,isModuleResolutionFailure:()=>RZ,isMissingBindingFailure:()=>NZ,isCompleteImport:()=>TZ,hasVariables:()=>bZ,extractVariables:()=>J5,extractScriptFromTemplate:()=>yZ,convertToCommonJS:()=>kX,STX_ENGINE_BINDING_NAMES:()=>MX});import g1 from"path";import v5 from"process";function sK($){let X=[],Z=0,J=$.split(`
2552
+ `);for(let Y of J){let G=Z,Q=null,w=!1;for(let q=0;q<Y.length;q++){let W=Y[q];if(w){w=!1;continue}if(W==="\\"){w=!0;continue}if(Q){if(W===Q)Q=null;continue}if(W==="'"||W==='"'||W==="`"){Q=W;continue}if(W==="/"&&q+1<Y.length&&Y[q+1]==="/")break;if(W==="{")Z++;else if(W==="}")Z--}if(G===0){let q=Y.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)X.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Y)){let W=Y.match(/(?:const|let|var)\s+(\w+)/);if(W)X.push(W[1])}else{let W=Y.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[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 AZ($){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,q=null;for(let W=0;W<J.length;W++){let K=J[W];if(q){if(G+=K,K===q)q=null;continue}if(K==='"'||K==="'"||K==="`"){q=K,G+=K;continue}if(K==="<")Q++;else if(K===">"&&Q>0)Q--;else if(K==="(")w++;else if(K===")")w--;if(K===","&&Q===0&&w===0){Y.push(G),G="";continue}G+=K}if(G)Y.push(G);return Y.map((W)=>{let K=W.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 W;let H=U.substring(0,B).trim().replace(/\?$/,""),L=U.substring(B+1),O=-1,F=0;for(let A=0;A<L.length;A++)if(L[A]==="<")F++;else if(L[A]===">")F--;else if(L[A]==="="&&F===0){O=A;break}let V=z?"...":"";if(O!==-1)return`${V}${H} = ${L.substring(O+1).trim()}`;return`${V}${H}`}).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,q=Q+1,W=0,K=null;while(q<X.length&&w>0){let B=X[q];if(K){if(B===K)K=null;q++;continue}if(B==='"'||B==="'"||B==="`"){K=B,q++;continue}if(B==="<")W++;else if(B===">"&&W>0)W--;else if(W===0){if(B==="(")w++;else if(B===")")w--}if(w>0)q++}if(w!==0)continue;let z=X.substring(Q+1,q);if(!z.includes(":"))continue;let U=Z(z);G.push({start:Q+1,end:q,replacement:U})}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];X=X.substring(0,w)+W+X.substring(q)}}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,...q]=Q.split("="),W=w.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).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
+
2554
+ `),X}function RZ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function NZ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function J5($,X,Z,J={}){if(!$.trim())return;let Y;try{let C=T1({loader:"ts",target:"browser",define:l0()}),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=AZ($)}let G={exports:{}},Q=G.exports,w=v5.cwd(),q={},W=[...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 W)try{let g=g1.resolve(w,"node_modules",C),s=g1.join(g,"package.json"),p=JSON.parse(B0("fs").readFileSync(s,"utf8")),v=p.main||"index.js";if(p.exports){let c=typeof p.exports==="string"?p.exports:p.exports["."];if(typeof c==="string")v=c;else if(c?.bun)v=c.bun;else if(c?.import)v=c.import;else if(c?.default)v=c.default}q[C]=await import(g1.resolve(g,v))}catch{}let K=(C)=>{if(q[C])return q[C];return B0(C)},z=X.props||{},U=(C)=>{if(!C)return z;let g={};for(let[s,p]of Object.entries(C)){let v=z[s];if(v!==void 0)g[s]=v;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 B=(C)=>{if(!C)return z;let g={...z};for(let[s,p]of Object.entries(C)){let v=p&&typeof p==="object"&&!Array.isArray(p)?p:{type:p};if(g[s]===void 0&&v.default!==void 0)g[s]=typeof v.default==="function"?v.default():v.default}return g},j=()=>X.slots||{},_=(C,g)=>{let s={...C};for(let[p,v]of Object.entries(g))if(s[p]===void 0)if(typeof v==="function")s[p]=v();else s[p]=v;return s},H=(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}},O=(C)=>{},F=(C)=>C(),V=(C)=>{},A=(C)=>{};function R(C){let g=C||{};if(g.title!==void 0||g.description!==void 0)E({title:g.title,description:g.description})}function N(C){if(!C||typeof C!=="object")return;let g=X.__stxClientPayload??{};Object.assign(g,C),X.__stxClientPayload=g}let T=()=>{let C=X.__stxServeContext,g=X.__stxServeSearch??C?.search??"",s=C?.path??"",p=Object.fromEntries(new URLSearchParams(g)),v=X.query,c=Object.keys(p).length>0?p:v??{},j0=g||(Object.keys(c).length>0?`?${new URLSearchParams(c).toString()}`:"");return{params:X.params??{},query:c,path:s,name:"",fullPath:s+j0,hash:"",matched:[]}},k=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),M=(C)=>{let g=X.__stx_runtime_head||{};X.__stx_runtime_head=P5(g,C||{})},E=(C)=>{M(c8(C||{}))},I=(C)=>({value:C}),S=(C)=>C,b=(C)=>({value:typeof C==="function"?C():C}),y=(C,g)=>{},P=(C)=>{},x=(C)=>{},f=(C)=>C?C():Promise.resolve(),u=(C)=>(g,...s)=>{},l=(C)=>{},H0=(C,g)=>{},S0=(C,g)=>g,z0=()=>({value:"light"}),k0=()=>H(!1),d=(C)=>H(!1),Y0=()=>H(!1),Q0=()=>d("(prefers-color-scheme: dark)"),d0=()=>d("(prefers-color-scheme: light)"),Y7=()=>d("(prefers-reduced-motion: reduce)"),r=()=>d("(prefers-contrast: more)"),e={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},U0=new Proxy(e,{get(C,g){if(g in C)return C[g];return},set(C,g,s){return C[g]=s,!0}}),m0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},C0=console;try{let C=kX(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)&&a!=="props"&&s(a)),v=p.map((a)=>X[a]);if(!p.includes("__stxServeContext"))p.push("__stxServeContext"),v.push(void 0);let c=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),j0=[],X0=[];for(let[a,X1]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(c.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(C))continue;j0.push(a),X0.push(X1)}let E0=sK(C).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
2555
+ `),y1=X.params??{},c0=[],g0=[];for(let a=0;a<p.length;a++){if(p[a]==="params")continue;c0.push(p[a]),g0.push(v[a])}let r1=await Function(...MX,...j0,...c0,`return (async () => {
2556
+ ${C}
2557
+ ${E0}
2558
2558
  return module.exports
2559
- })()`)(G,Q,K,z,U,B,_,N,H,L,O,F,V,A,R,M,k,T,D,I,S,b,E,v,x,f,h,p,j,H0,M0,j0,Z0,l,J0,D0,v0,j5,r,K0,x0,V0,e.confirm,e.alert,e.fetch,e0,...B1,...k1);if(J.preserveExisting){for(let[o,l0]of Object.entries(z0))if(!(o in X)||X[o]===void 0)X[o]=l0}else Object.assign(X,z0);for(let[o,l0]of Object.entries(z))if(!(o in X))X[o]=l0}catch(P){let C=P instanceof Error?P.message:String(P);if(LZ(C))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${C}`);else if(FZ(C))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: ${C}`);else if(b5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${C}`);try{await tK(Y,X,Z)}catch(g){if(b5.env.STX_DEBUG){let c=g instanceof Error?g.message:String(g);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${c}`)}}}}function VZ($){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 RX($,X){let Z=X?P1.dirname(X):b5.cwd(),J=b5.cwd(),Y=$.split(`
2559
+ })()`)(G,Q,K,z,U,B,_,N,H,L,O,F,V,A,R,T,k,M,E,I,S,b,y,P,x,f,u,l,j,H0,S0,z0,k0,d,Y0,Q0,d0,Y7,r,U0,m0,C0,e.confirm,e.alert,e.fetch,y1,...X0,...g0);if(J.preserveExisting){for(let[a,X1]of Object.entries(r1))if(!(a in X)||X[a]===void 0)X[a]=X1}else Object.assign(X,r1);for(let[a,X1]of Object.entries(z))if(!(a in X))X[a]=X1}catch(C){let g=C instanceof Error?C.message:String(C);if(RZ(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(NZ(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(v5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${g}`);try{await Zz(Y,X,Z)}catch(s){if(v5.env.STX_DEBUG){let p=s instanceof Error?s.message:String(s);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${p}`)}}}}function TZ($){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 kX($,X){let Z=X?g1.dirname(X):v5.cwd(),J=v5.cwd(),Y=$.split(`
2560
2560
  `),G=[],Q=0;while(Q<Y.length){let w=Y[Q].trim();if(w.startsWith("interface ")||w.startsWith("export interface ")||w.startsWith("type ")||w.startsWith("export type ")){if(w.includes("{")&&!w.includes("}")){let q=0;for(;Q<Y.length;Q++){for(let W of Y[Q])if(W==="{")q++;else if(W==="}")q--;if(q<=0)break}}Q++;continue}if(w.startsWith("definePageMeta(")){let q=0,W=!1,K=Q;for(let B=Q;B<Y.length&&!W;B++){let j=null,_=!1,H=Y[B];for(let L=0;L<H.length;L++){let O=H[L];if(_){_=!1;continue}if(O==="\\"){_=!0;continue}if(j){if(O===j)j=null;continue}if(O==='"'||O==="'"||O==="`"){j=O;continue}if(O==="(")q++;else if(O===")"){if(q--,q===0){Q=B+1,W=!0;break}}}}if(!W)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 q=w,W=0;while(!VZ(q)&&Q+W+1<Y.length)W++,q=`${q} ${Y[Q+W].trim()}`;Q+=W;let K=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=q.match(/^import\s+['"](.+?)['"]/),B=q,j=(_)=>{if(_.startsWith("."))return P1.resolve(Z,_);if(_.startsWith("~/")||_.startsWith("@/"))return P1.resolve(J,_.slice(2));return _};if(K){let[,_,H]=K,L=j(H);G.push(`const ${_} = (await import('${L}')).default`),G.push(`module.exports.${_} = ${_};`)}else if(z){let[,_,H]=z,L=j(H),O=[],F=[],V=pK.has(H);for(let A of _.split(",")){let R=A.trim();if(!R)continue;let N=R.split(/\s+as\s+/);if(N.length===2){let[M,k]=[N[0].trim(),N[1].trim()];if(V&&zZ.has(M)){G.push(`const ${k} = ${M};`),F.push(k);continue}O.push(`${M}: ${k}`),F.push(k)}else{if(V&&zZ.has(R)){F.push(R);continue}O.push(R),F.push(R)}}if(O.length>0)G.push(`const { ${O.join(", ")} } = await import('${L}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(U){let _=j(U[1]);G.push(`await import('${_}')`)}else G.push(B);Q++;continue}if(nK.test(w))G.push(Y[Q]),Q++;else if(w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var ")){let q=jZ(Y,Q),{type:W,name:K,value:z}=q;G.push(`${W} ${K} = ${z};`),G.push(`module.exports.${K} = ${K};`),Q=q.nextIndex}else if(w.startsWith("export function ")||w.startsWith("export async function ")){let q=VX(Y,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("const ")||w.startsWith("let ")||w.startsWith("var ")){let q=jZ(Y,Q),{type:W,name:K,value:z}=q;G.push(`${W} ${K} = ${z};`),G.push(`module.exports.${K} = ${K};`),Q=q.nextIndex}else if(w.startsWith("function ")||w.startsWith("async function ")){let q=VX(Y,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("export default function ")||w.startsWith("export default async function ")){let q=Y[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...Y];W[Q]=q;let K=VX(W,Q);if(G.push(K.functionCode),K.name)G.push(`module.exports.default = ${K.name};`);Q=K.nextIndex}else if(w.startsWith("export default ")){let q=w.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${q};`),Q++}else if(w.startsWith("class ")||w.startsWith("export class ")){let q=w.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],K=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.${W} = ${W};`),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 rK(G.join(`
2563
- `),Z,J)}function rK($,X,Z){let J=$.length,Y="",G=0,Q=null,w=!1,q=!1,W=0;while(G<J){let K=$[G],z=$[G+1];if(w){if(Y+=K,K===`
2564
- `)w=!1;G++;continue}if(q){if(Y+=K,K==="*"&&z==="/"){Y+=z,G+=2,q=!1;continue}G++;continue}if(!Q&&K==="/"&&z==="/"){w=!0,Y+=K,G++;continue}if(!Q&&K==="/"&&z==="*"){q=!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==="{"){W++,Y+=z,G+=2;continue}if(K==="`"){Q=null,G++;continue}}G++;continue}if(W>0){if(K==="{")W++;else if(K==="}")W--}if(K==='"'||K==="'"||K==="`"){Q=K,Y+=K,G++;continue}if(K==="a"&&$.startsWith("await",G)){let U=oK($,G);if(U){let{quote:B,path:j,end:_}=U;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let H=j.startsWith(".")?P1.resolve(X,j):P1.resolve(Z,j.slice(2));Y+=`await import(${B}${H}${B})`,G=_;continue}}}Y+=K,G++}return Y}function oK($,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 AZ($,X){let Z=$[X];if(Z!=="{"&&Z!=="[")return null;let Y=b0($,Z,Z==="{"?"}":"]",X);if(Y===-1)return null;return{pattern:$.slice(X,Y+1),endPos:Y+1}}function RZ($){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?AZ(Z,J):null;if(w){X.push(...RZ(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 NZ($){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],q=$[Z-1];if(w!=="="&&w!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")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 UZ($,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 jZ($,X){let Z=$[X].trim(),J=NZ(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],_=j==="{"?"}":"]",H=UZ(z,j,_,0),L=z;for(let O=X+1;O<$.length&&H>0;O++)L+=` ${$[O].trim()}`,U=O,H=UZ($[O],j,_,H);if(H>0)L=z,U=X;z=L}let B=AZ(z,0);if(B){let j=K[1],_=B.pattern,H=z.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),O=L,F=Math.max(U,X);if(BZ(L)){let N=_Z($,F,L);O=N.value,F=N.nextIndex}else F=F+1;O=O.trim().replace(/;$/,"");let V=RZ(_),A=`__stx_src_${X}`,R=V.map((N)=>`module.exports.${N} = ${N};`).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 q=w,W=0;while(!TZ(q)&&Q+W+1<Y.length)W++,q=`${q} ${Y[Q+W].trim()}`;Q+=W;let K=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=q.match(/^import\s+['"](.+?)['"]/),B=q,j=(_)=>{if(_.startsWith("."))return g1.resolve(Z,_);if(_.startsWith("~/")||_.startsWith("@/"))return g1.resolve(J,_.slice(2));return _};if(K){let[,_,H]=K,L=j(H);G.push(`const ${_} = (await import('${L}')).default`),G.push(`module.exports.${_} = ${_};`)}else if(z){let[,_,H]=z,L=j(H),O=[],F=[],V=oK.has(H);for(let A of _.split(",")){let R=A.trim();if(!R)continue;let N=R.split(/\s+as\s+/);if(N.length===2){let[T,k]=[N[0].trim(),N[1].trim()];if(V&&_Z.has(T)){G.push(`const ${k} = ${T};`),F.push(k);continue}O.push(`${T}: ${k}`),F.push(k)}else{if(V&&_Z.has(R)){F.push(R);continue}O.push(R),F.push(R)}}if(O.length>0)G.push(`const { ${O.join(", ")} } = await import('${L}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(U){let _=j(U[1]);G.push(`await import('${_}')`)}else G.push(B);Q++;continue}if(aK.test(w))G.push(Y[Q]),Q++;else if(w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var ")){let q=OZ(Y,Q),{type:W,name:K,value:z}=q;G.push(`${W} ${K} = ${z};`),G.push(`module.exports.${K} = ${K};`),Q=q.nextIndex}else if(w.startsWith("export function ")||w.startsWith("export async function ")){let q=TX(Y,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("const ")||w.startsWith("let ")||w.startsWith("var ")){let q=OZ(Y,Q),{type:W,name:K,value:z}=q;G.push(`${W} ${K} = ${z};`),G.push(`module.exports.${K} = ${K};`),Q=q.nextIndex}else if(w.startsWith("function ")||w.startsWith("async function ")){let q=TX(Y,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("export default function ")||w.startsWith("export default async function ")){let q=Y[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...Y];W[Q]=q;let K=TX(W,Q);if(G.push(K.functionCode),K.name)G.push(`module.exports.default = ${K.name};`);Q=K.nextIndex}else if(w.startsWith("export default ")){let q=w.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${q};`),Q++}else if(w.startsWith("class ")||w.startsWith("export class ")){let q=w.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],K=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.${W} = ${W};`),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 tK(G.join(`
2563
+ `),Z,J)}function tK($,X,Z){let J=$.length,Y="",G=0,Q=null,w=!1,q=!1,W=0;while(G<J){let K=$[G],z=$[G+1];if(w){if(Y+=K,K===`
2564
+ `)w=!1;G++;continue}if(q){if(Y+=K,K==="*"&&z==="/"){Y+=z,G+=2,q=!1;continue}G++;continue}if(!Q&&K==="/"&&z==="/"){w=!0,Y+=K,G++;continue}if(!Q&&K==="/"&&z==="*"){q=!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==="{"){W++,Y+=z,G+=2;continue}if(K==="`"){Q=null,G++;continue}}G++;continue}if(W>0){if(K==="{")W++;else if(K==="}")W--}if(K==='"'||K==="'"||K==="`"){Q=K,Y+=K,G++;continue}if(K==="a"&&$.startsWith("await",G)){let U=eK($,G);if(U){let{quote:B,path:j,end:_}=U;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let H=j.startsWith(".")?g1.resolve(X,j):g1.resolve(Z,j.slice(2));Y+=`await import(${B}${H}${B})`,G=_;continue}}}Y+=K,G++}return Y}function eK($,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 MZ($,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 kZ($){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?MZ(Z,J):null;if(w){X.push(...kZ(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 IZ($){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],q=$[Z-1];if(w!=="="&&w!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")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 HZ($,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 OZ($,X){let Z=$[X].trim(),J=IZ(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],_=j==="{"?"}":"]",H=HZ(z,j,_,0),L=z;for(let O=X+1;O<$.length&&H>0;O++)L+=` ${$[O].trim()}`,U=O,H=HZ($[O],j,_,H);if(H>0)L=z,U=X;z=L}let B=MZ(z,0);if(B){let j=K[1],_=B.pattern,H=z.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),O=L,F=Math.max(U,X);if(LZ(L)){let N=FZ($,F,L);O=N.value,F=N.nextIndex}else F=F+1;O=O.trim().replace(/;$/,"");let V=kZ(_),A=`__stx_src_${X}`,R=V.map((N)=>`module.exports.${N} = ${N};`).join(`
2565
2565
  `);return{type:j,name:A,value:`${O}; ${j} ${_} = ${A};
2566
- ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,w]=Y,q=w,W=X;if(BZ(w)){let K=_Z($,X,w);q=K.value,W=K.nextIndex}else W=X+1;while(W<$.length){let K=$[W].trim();if(K.startsWith(".")||K.startsWith("?."))q+=`
2567
- ${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:G,name:Q,value:q,nextIndex:W}}function VX($,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(sK(Z)){let w=aK($,X,G);G=w.functionCode,Q=w.nextIndex}else Q=X+1;return{name:Y,functionCode:G,nextIndex:Q}}function BZ($){let X=$.trim();if(X.startsWith("{"))return b0(X,"{","}",0)===-1;if(X.startsWith("["))return b0(X,"[","]",0)===-1;return!TZ(X)}function TZ($){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 MZ($){let X=$.indexOf("(");if(X===-1)return $.indexOf("{");let Z=b0($,"(",")",X);if(Z===-1)return-1;return $.indexOf("{",Z)}function sK($){let X=MZ($);if(X===-1)return!0;return b0($,"{","}",X)===-1}function _Z($,X,Z){let J=Z,Y=X+1;while(Y<$.length&&!TZ(J)){let G=$[Y];J+=`
2566
+ ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,w]=Y,q=w,W=X;if(LZ(w)){let K=FZ($,X,w);q=K.value,W=K.nextIndex}else W=X+1;while(W<$.length){let K=$[W].trim();if(K.startsWith(".")||K.startsWith("?."))q+=`
2567
+ ${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:G,name:Q,value:q,nextIndex:W}}function TX($,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($z(Z)){let w=Xz($,X,G);G=w.functionCode,Q=w.nextIndex}else Q=X+1;return{name:Y,functionCode:G,nextIndex:Q}}function LZ($){let X=$.trim();if(X.startsWith("{"))return P0(X,"{","}",0)===-1;if(X.startsWith("["))return P0(X,"[","]",0)===-1;return!EZ(X)}function EZ($){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 DZ($){let X=$.indexOf("(");if(X===-1)return $.indexOf("{");let Z=P0($,"(",")",X);if(Z===-1)return-1;return $.indexOf("{",Z)}function $z($){let X=DZ($);if(X===-1)return!0;return P0($,"{","}",X)===-1}function FZ($,X,Z){let J=Z,Y=X+1;while(Y<$.length&&!EZ(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 aK($,X,Z){let J=Z,Y=X+1;while(Y<$.length){let G=MZ(J);if(G!==-1){if(b0(J,"{","}",G)!==-1)break}let Q=$[Y];J+=`
2570
- ${Q}`,Y++}return{functionCode:J,nextIndex:Y}}function HZ($,X){let Z=G0($,X)??G0(`(${$})`,X);if(Z!==void 0)return Z;if(!/\bprocess\b/.test($))return;let J={...X,process:Object.freeze({env:{...b5.env}})};try{return Function(...Object.keys(J),`'use strict'; return (${$});`)(...Object.values(J))}catch{try{return Function(...Object.keys(J),`'use strict'; return ${$};`)(...Object.values(J))}catch{return}}}async function tK($,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 q=w.trim().replace(/;$/,""),W=HZ(q,X);if(W!==void 0)X[Q]=W}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}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 q=w.trim().replace(/;$/,""),W=HZ(q,X);if(W!==void 0)X[Q]=W}catch{}}}function kZ($){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 IZ($){let X=$.trim();if(!X)return!1;return/(?:const|let|var|function)\s+\w+/.test(X)}var AX,zZ,pK,nK;var f7=y(()=>{x7();D1();I0();AX=["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"],zZ=new Set(AX),pK=new Set(["stx","@stacksjs/stx"]);nK=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var NX={};a(NX,{renderSlot:()=>DZ,processSlots:()=>bZ,parseSlots:()=>EZ,parseSlotElement:()=>Jz,extractSlotContent:()=>Qz,applySlots:()=>wz});function eK($,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 Xz($,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=Xz($,G+1);if(Q===-1)break;let w=$.slice(G,Q),q=w.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){Y=Q;continue}let W=q[1]==="/",K=q[2].toLowerCase();if(W){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=eK($,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)&&!$z.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 EZ($){let X={default:"",named:new Map},Z=$,J=Zz($);for(let q of J)X.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});J.sort((q,W)=>W.start-q.start);for(let q of J)Z=Z.slice(0,q.start)+Z.slice(q.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[q,W,K,z,U,B]=Q,j=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(j+_).trim(),L=`<${W}${H?" "+H:""}>${B}</${W}>`;Y.push({start:Q.index,end:Q.index+q.length,slotName:z,element:L})}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=w.exec(Z))!==null){let[q,W,K,z,U]=Q,B=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(B+j).trim(),H=`<${W}${_?" "+_:""} />`;Y.push({start:Q.index,end:Q.index+q.length,slotName:z,element:H})}Y.sort((q,W)=>W.start-q.start);for(let q of Y){let W=X.named.get(q.slotName);if(W)W.content+=q.element;else X.named.set(q.slotName,{name:q.slotName,content:q.element});Z=Z.slice(0,q.start)+Z.slice(q.end)}return X.default=Z.trim(),X}function Jz($){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 DZ($,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((q)=>q.trim()).filter(Boolean);for(let q of w){let[W,K]=q.split(":").map((U)=>U.trim()),z=K||W;if(X[W]!==void 0)Q[z]=X[W]}}else Q[G]=X;Y=Yz(Y,Q)}return Y}function Yz($,X){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,J)=>{try{let Y=J.trim(),G=yZ(Y,X);return X1(String(G??""))}catch{return`{{ ${J} }}`}})}function yZ($,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 W0($,Object.keys(X))(...Object.values(X))}catch{return}}async function bZ($,X,Z){let J=$;J=await Gz(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,w,q,W)=>{let K=X.named.get(w),z=W?.trim()||"",U=q||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=j.exec(U))!==null){let H=_[1],L=_[2];B[H]=yZ(L,Z)}return await DZ(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 q=w?.trim()||"";return X.default||q}),J}async function Gz($,X,Z){let J=[],Y=[];$.replace(X,(w,...q)=>{let W=q[q.length-2];return Y.push({match:w,index:W}),J.push(Z(w,...q.slice(0,-2))),w});let G=await Promise.all(J),Q=$;for(let w=Y.length-1;w>=0;w--){let{match:q,index:W}=Y[w];Q=Q.slice(0,W)+G[w]+Q.slice(W+q.length)}return Q}function Qz($){let X=EZ($);return{defaultSlot:X.default,namedSlots:X.named}}async function wz($,X,Z,J){return await bZ($,{default:X,named:Z},J)}var $z;var TX=y(()=>{W1();I0();$z=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function v1($,X){let Z=qz($,X);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function qz($,X){let Z=X;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let J=b0($,"(",")",Z);if(J===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:$.slice(Z+1,J),endPos:J+1}}function Wz($,X){let Z=$.lastIndexOf("<",X);if(Z===-1)return!1;return Z>$.lastIndexOf(">",X)}function e1($,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 q=Q.exec($),W=w.exec($),K=q?q.index:1/0,z=W?W.index:1/0;if(K<z)Y++,G=K+q[0].length;else if(z<1/0){if(Y--,Y===0)return z;G=z+W[0].length}else break}return-1}function SZ($,X){let Z=$.slice(X).match(/^@if\s*/);if(!Z)return null;let J=X+Z[0].length,Y=v1($,J);if(!Y)return null;let G=Y.endPos,Q=e1($,"if","endif",G);if(Q===-1)return null;let w=$.slice(G,Q),q=[],W=0,K="if",z=Y.expression,U=0,B=0;while(W<w.length){let j=w.indexOf("@",W);if(j===-1)break;W=j;let _=w.substring(j);if(Wz(w,j)){W++;continue}if(/^@if\s*\(/.test(_)){B++,W++;continue}if(/^@endif(?![a-z])/.test(_)){B--,W+=6;continue}if(B===0){let H=_.match(/^@elseif\s*/);if(H){q.push({type:K,condition:z,content:w.substring(U,W),start:G+U,end:G+W});let L=W+H[0].length,O=v1(w,L);if(!O){W++;continue}K="elseif",z=O.expression,W=O.endPos,U=W;continue}else if(/^@else(?![a-z])/.test(_)){q.push({type:K,condition:z,content:w.substring(U,W),start:G+U,end:G+W}),K="else",z=void 0,W+=5,U=W;continue}}W++}return q.push({type:K,condition:z,content:w.slice(U),start:G+U,end:G+w.length}),{fullMatch:$.slice(X,Q+6),branches:q,start:X,end:Q+6}}function g7($){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=SZ($,J.index);if(G)X.push(G),Z.lastIndex=G.end;J=Z.exec($)}return X}function d8($,X,Z){let J=[],Y=new RegExp(`@${X}\\s*\\(`,"g"),G=Y.exec($);while(G!==null){if(J.some((_)=>G.index>_.start&&G.index<_.end)){G=Y.exec($);continue}let w=G.index,q=w+G[0].length-1,W=b0($,"(",")",q);if(W===-1){G=Y.exec($);continue}let K=$.slice(q+1,W),z=W+1,U=e1($,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 MX($,X){let Z=$.slice(X).match(/^@switch\s*/);if(!Z)return null;let J=X+Z[0].length,Y=v1($,J);if(!Y)return null;let G=Y.endPos,Q=e1($,"switch","endswitch",G);if(Q===-1)return null;let w=$.slice(G,Q),q=[],W=0,K=null,z=0;while(W<w.length){let U=w.slice(W),B=U.match(/^@switch\s*\(/),j=U.match(/^@endswitch(?![a-z])/);if(B){if(z++,K)K.content+=B[0];W+=B[0].length;continue}if(j){if(z--,K)K.content+=j[0];W+=j[0].length;continue}if(z>0){if(K)K.content+=w[W];W++;continue}let _=U.match(/^@case\s*/),H=U.match(/^@default(?![a-z])/),L=U.match(/^@break(?![a-z])/);if(_&&U.startsWith("@case")){if(K)q.push(K);let O=W+_[0].length,F=v1(w,O);if(!F){W++;continue}K={type:"case",value:F.expression,content:""},W=F.endPos}else if(H&&U.startsWith("@default")){if(K)q.push(K);K={type:"default",content:""},W+=H[0].length}else if(L&&U.startsWith("@break"))W+=L[0].length;else{if(K)K.content+=w[W];W++}}if(K)q.push(K);return{fullMatch:$.slice(X,Q+10),expression:Y.expression,cases:q,start:X,end:Q+10}}var CZ=()=>{};var PZ=()=>{};var m8=y(()=>{CZ();PZ()});async function xZ($){let X=$;if(!X)try{X=(await Z1())?.pagesDir||"pages"}catch{X="pages"}let Z=X,J=vZ.get(Z);if(J)return J;let Y=[];try{Y=L7(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{Y=[]}return vZ.set(Z,Y),Y}var vZ;var fZ=y(()=>{m9();F1();vZ=new Map});function jz($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function gZ($){return jz(JSON.stringify($))}function h7($){let X=0,Z,J=kX.map(()=>{return});while(X<$.length){if(Z===void 0||Z!==null&&Z.index<X)hZ.lastIndex=X,Z=hZ.exec($);if(!Z)return null;let Y=Z.index,G=-1,Q=null;for(let q=0;q<kX.length;q++){let W=kX[q],K=J[q];if(K===void 0||K!==null&&K.index<X)W.open.lastIndex=X,K=W.open.exec($),J[q]=K;if(!K)continue;if(K.index<Y&&(G===-1||K.index<G))G=K.index,Q=W.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 c8($,X){let Z=h7($);if(!Z)return $;return $.slice(0,Z.index)+X(Z.tag,Z.attrs)+$.slice(Z.index+Z.tag.length)}var kX,hZ;var IX=y(()=>{kX=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],hZ=/<body\b([^>]*)>/gi});function EX(){return`
2569
+ ${$[Y]}`,Y++;else break}return{value:J,nextIndex:Y}}function Xz($,X,Z){let J=Z,Y=X+1;while(Y<$.length){let G=DZ(J);if(G!==-1){if(P0(J,"{","}",G)!==-1)break}let Q=$[Y];J+=`
2570
+ ${Q}`,Y++}return{functionCode:J,nextIndex:Y}}function VZ($,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:{...v5.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 Zz($,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 q=w.trim().replace(/;$/,""),W=VZ(q,X);if(W!==void 0)X[Q]=W}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}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 q=w.trim().replace(/;$/,""),W=VZ(q,X);if(W!==void 0)X[Q]=W}catch{}}}function yZ($){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 bZ($){let X=$.trim();if(!X)return!1;return/(?:const|let|var|function)\s+\w+/.test(X)}var MX,_Z,oK,aK;var u7=D(()=>{A0();h7();C1();y0();MX=["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"],_Z=new Set(MX),oK=new Set(["stx","@stacksjs/stx"]);aK=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var IX={};t(IX,{renderSlot:()=>CZ,processSlots:()=>vZ,parseSlots:()=>SZ,parseSlotElement:()=>wz,extractSlotContent:()=>Kz,applySlots:()=>zz});function Jz($,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 Gz($,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 Qz($){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=Gz($,G+1);if(Q===-1)break;let w=$.slice(G,Q),q=w.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){Y=Q;continue}let W=q[1]==="/",K=q[2].toLowerCase();if(W){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=Jz($,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)&&!Yz.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 SZ($){let X={default:"",named:new Map},Z=$,J=Qz($);for(let q of J)X.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});J.sort((q,W)=>W.start-q.start);for(let q of J)Z=Z.slice(0,q.start)+Z.slice(q.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[q,W,K,z,U,B]=Q,j=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(j+_).trim(),L=`<${W}${H?" "+H:""}>${B}</${W}>`;Y.push({start:Q.index,end:Q.index+q.length,slotName:z,element:L})}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=w.exec(Z))!==null){let[q,W,K,z,U]=Q,B=K.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(B+j).trim(),H=`<${W}${_?" "+_:""} />`;Y.push({start:Q.index,end:Q.index+q.length,slotName:z,element:H})}Y.sort((q,W)=>W.start-q.start);for(let q of Y){let W=X.named.get(q.slotName);if(W)W.content+=q.element;else X.named.set(q.slotName,{name:q.slotName,content:q.element});Z=Z.slice(0,q.start)+Z.slice(q.end)}return X.default=Z.trim(),X}function wz($){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 CZ($,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((q)=>q.trim()).filter(Boolean);for(let q of w){let[W,K]=q.split(":").map((U)=>U.trim()),z=K||W;if(X[W]!==void 0)Q[z]=X[W]}}else Q[G]=X;Y=qz(Y,Q)}return Y}function qz($,X){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,J)=>{try{let Y=J.trim(),G=PZ(Y,X);return J1(String(G??""))}catch{return`{{ ${J} }}`}})}function PZ($,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(!W0($))return;return K0($,Object.keys(X))(...Object.values(X))}catch{return}}async function vZ($,X,Z){let J=$;J=await Wz(J,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,w,q,W)=>{let K=X.named.get(w),z=W?.trim()||"",U=q||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=j.exec(U))!==null){let H=_[1],L=_[2];B[H]=PZ(L,Z)}return await CZ(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 q=w?.trim()||"";return X.default||q}),J}async function Wz($,X,Z){let J=[],Y=[];$.replace(X,(w,...q)=>{let W=q[q.length-2];return Y.push({match:w,index:W}),J.push(Z(w,...q.slice(0,-2))),w});let G=await Promise.all(J),Q=$;for(let w=Y.length-1;w>=0;w--){let{match:q,index:W}=Y[w];Q=Q.slice(0,W)+G[w]+Q.slice(W+q.length)}return Q}function Kz($){let X=SZ($);return{defaultSlot:X.default,namedSlots:X.named}}async function zz($,X,Z,J){return await vZ($,{default:X,named:Z},J)}var Yz;var EX=D(()=>{j1();y0();Yz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function h1($,X){let Z=Uz($,X);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function Uz($,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 jz($,X){let Z=$.lastIndexOf("<",X);if(Z===-1)return!1;return Z>$.lastIndexOf(">",X)}function Y5($,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 q=Q.exec($),W=w.exec($),K=q?q.index:1/0,z=W?W.index:1/0;if(K<z)Y++,G=K+q[0].length;else if(z<1/0){if(Y--,Y===0)return z;G=z+W[0].length}else break}return-1}function xZ($,X){let Z=$.slice(X).match(/^@if\s*/);if(!Z)return null;let J=X+Z[0].length,Y=h1($,J);if(!Y)return null;let G=Y.endPos,Q=Y5($,"if","endif",G);if(Q===-1)return null;let w=$.slice(G,Q),q=[],W=0,K="if",z=Y.expression,U=0,B=0;while(W<w.length){let j=w.indexOf("@",W);if(j===-1)break;W=j;let _=w.substring(j);if(jz(w,j)){W++;continue}if(/^@if\s*\(/.test(_)){B++,W++;continue}if(/^@endif(?![a-z])/.test(_)){B--,W+=6;continue}if(B===0){let H=_.match(/^@elseif\s*/);if(H){q.push({type:K,condition:z,content:w.substring(U,W),start:G+U,end:G+W});let L=W+H[0].length,O=h1(w,L);if(!O){W++;continue}K="elseif",z=O.expression,W=O.endPos,U=W;continue}else if(/^@else(?![a-z])/.test(_)){q.push({type:K,condition:z,content:w.substring(U,W),start:G+U,end:G+W}),K="else",z=void 0,W+=5,U=W;continue}}W++}return q.push({type:K,condition:z,content:w.slice(U),start:G+U,end:G+w.length}),{fullMatch:$.slice(X,Q+6),branches:q,start:X,end:Q+6}}function d7($){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=xZ($,J.index);if(G)X.push(G),Z.lastIndex=G.end;J=Z.exec($)}return X}function p8($,X,Z){let J=[],Y=new RegExp(`@${X}\\s*\\(`,"g"),G=Y.exec($);while(G!==null){if(J.some((_)=>G.index>_.start&&G.index<_.end)){G=Y.exec($);continue}let w=G.index,q=w+G[0].length-1,W=P0($,"(",")",q);if(W===-1){G=Y.exec($);continue}let K=$.slice(q+1,W),z=W+1,U=Y5($,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 DX($,X){let Z=$.slice(X).match(/^@switch\s*/);if(!Z)return null;let J=X+Z[0].length,Y=h1($,J);if(!Y)return null;let G=Y.endPos,Q=Y5($,"switch","endswitch",G);if(Q===-1)return null;let w=$.slice(G,Q),q=[],W=0,K=null,z=0;while(W<w.length){let U=w.slice(W),B=U.match(/^@switch\s*\(/),j=U.match(/^@endswitch(?![a-z])/);if(B){if(z++,K)K.content+=B[0];W+=B[0].length;continue}if(j){if(z--,K)K.content+=j[0];W+=j[0].length;continue}if(z>0){if(K)K.content+=w[W];W++;continue}let _=U.match(/^@case\s*/),H=U.match(/^@default(?![a-z])/),L=U.match(/^@break(?![a-z])/);if(_&&U.startsWith("@case")){if(K)q.push(K);let O=W+_[0].length,F=h1(w,O);if(!F){W++;continue}K={type:"case",value:F.expression,content:""},W=F.endPos}else if(H&&U.startsWith("@default")){if(K)q.push(K);K={type:"default",content:""},W+=H[0].length}else if(L&&U.startsWith("@break"))W+=L[0].length;else{if(K)K.content+=w[W];W++}}if(K)q.push(K);return{fullMatch:$.slice(X,Q+10),expression:Y.expression,cases:q,start:X,end:Q+10}}var fZ=()=>{};var gZ=()=>{};var i8=D(()=>{fZ();gZ()});async function uZ($){let X=$;if(!X)try{X=(await Y1())?.pagesDir||"pages"}catch{X="pages"}let Z=X,J=hZ.get(Z);if(J)return J;let Y=[];try{Y=R7(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{Y=[]}return hZ.set(Z,Y),Y}var hZ;var dZ=D(()=>{i9();R1();hZ=new Map});function Oz($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function mZ($){return Oz(JSON.stringify($))}function m7($){let X=0,Z,J=yX.map(()=>{return});while(X<$.length){if(Z===void 0||Z!==null&&Z.index<X)cZ.lastIndex=X,Z=cZ.exec($);if(!Z)return null;let Y=Z.index,G=-1,Q=null;for(let q=0;q<yX.length;q++){let W=yX[q],K=J[q];if(K===void 0||K!==null&&K.index<X)W.open.lastIndex=X,K=W.open.exec($),J[q]=K;if(!K)continue;if(K.index<Y&&(G===-1||K.index<G))G=K.index,Q=W.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 n8($,X){let Z=m7($);if(!Z)return $;return $.slice(0,Z.index)+X(Z.tag,Z.attrs)+$.slice(Z.index+Z.tag.length)}var yX,cZ;var bX=D(()=>{yX=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],cZ=/<body\b([^>]*)>/gi});function SX(){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 yX(){return $5}function bX($){let X=$5;return uZ.push($),$5=$,X}function SX($){uZ.pop(),$5=$}function CX(){return l8>0}function PX($){DX.add($)}function dZ($){l8++;try{$()}finally{if(l8--,l8===0){let X=[...DX];DX.clear();for(let Z of X)Z()}}}function mZ($){let X=$5;$5=null;try{return $()}finally{$5=X}}var $5=null,uZ,l8=0,DX;var cZ=y(()=>{uZ=[],DX=new Set});function x1($){let X=$,Z=new Set,J=new Set,Y=()=>{let G=yX();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)),CX())J.forEach((w)=>PX(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 i8($){let X,Z=!0,J=new Set,Y=()=>{if(!Z)if(Z=!0,CX())J.forEach((Q)=>PX(Q));else J.forEach((Q)=>Q())},G=()=>{let Q=yX();if(Q)J.add(Q);if(Z){let w=bX(Y);try{X=$()}finally{SX(w)}Z=!1}return X};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function n8($,X={}){let Z,J=!1,Y=()=>{if(J)return;if(Z)Z(),Z=void 0;let G=bX(Y);try{let Q=$();Z=typeof Q==="function"?Q:void 0}finally{SX(G)}};if(X.immediate!==!1)Y();return()=>{if(J=!0,Z)Z()}}function xX($){dZ($)}function fX($){vX.push($)}function gX($){p8.push($)}function Bz(){lZ(vX,"onMount",p8)}function _z(){lZ(p8,"onDestroy")}function lZ($,X,Z){let J=$.splice(0,$.length);for(let Y of J)try{let G=Y();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${X} callback threw:`,G)}}function Hz(){return{mount:vX.length,destroy:p8.length}}function r8($){return typeof $==="function"&&$._isSignal===!0}function o8($){return typeof $==="function"&&$._isDerived===!0}function hX($){if(r8($)||o8($))return $();return $}function s8($){return mZ($)}function Oz($,X){let Z=typeof $==="function"?$:()=>$,J=x1([]),Y=i8(()=>J().reduce((w,q)=>X(w,q.action),Z())),G=!1;return n8(()=>{if(Z(),!G){G=!0;return}if(s8(()=>J().length))J.set([])}),[Y,(w,q)=>{let W={action:w};J.set([...J(),W]);let K=()=>{let z=J().filter((U)=>U!==W);if(z.length!==J().length)J.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(K,K);return K}]}var vX,p8;var a8=y(()=>{cZ();vX=[],p8=[]});var iZ={};a(iZ,{useOptimistic:()=>Oz,untrack:()=>hX,state:()=>x1,runMountCallbacks:()=>Bz,runDestroyCallbacks:()=>_z,pendingLifecycleCounts:()=>Hz,peek:()=>s8,onMount:()=>fX,onDestroy:()=>gX,isSignal:()=>r8,isDerived:()=>o8,generateSignalsRuntimeDev:()=>uX,generateSignalsRuntime:()=>pZ,effect:()=>n8,derived:()=>i8,default:()=>Fz,batch:()=>xX});function pZ(){let $=Lz(uX());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 Lz($){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 q=w;Q++;while(Q<$.length&&$[Q]!==q){if($[Q]==="\\")Q++;Q++}Q++;continue}if(w==="(")G++;else if(w===")")G--;Q++}X.push("0"),Z=Q}return X.join("")}function uX(){return`
2673
+ `}function PX(){return G5}function vX($){let X=G5;return lZ.push($),G5=$,X}function xX($){lZ.pop(),G5=$}function fX(){return r8>0}function gX($){CX.add($)}function pZ($){r8++;try{$()}finally{if(r8--,r8===0){let X=[...CX];CX.clear();for(let Z of X)Z()}}}function iZ($){let X=G5;G5=null;try{return $()}finally{G5=X}}var G5=null,lZ,r8=0,CX;var nZ=D(()=>{lZ=[],CX=new Set});function u1($){let X=$,Z=new Set,J=new Set,Y=()=>{let G=PX();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)),fX())J.forEach((w)=>gX(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 s8($){let X,Z=!0,J=new Set,Y=()=>{if(!Z)if(Z=!0,fX())J.forEach((Q)=>gX(Q));else J.forEach((Q)=>Q())},G=()=>{let Q=PX();if(Q)J.add(Q);if(Z){let w=vX(Y);try{X=$()}finally{xX(w)}Z=!1}return X};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function a8($,X={}){let Z,J=!1,Y=()=>{if(J)return;if(Z)Z(),Z=void 0;let G=vX(Y);try{let Q=$();Z=typeof Q==="function"?Q:void 0}finally{xX(G)}};if(X.immediate!==!1)Y();return()=>{if(J=!0,Z)Z()}}function uX($){pZ($)}function dX($){hX.push($)}function mX($){o8.push($)}function Lz(){rZ(hX,"onMount",o8)}function Fz(){rZ(o8,"onDestroy")}function rZ($,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 Vz(){return{mount:hX.length,destroy:o8.length}}function t8($){return typeof $==="function"&&$._isSignal===!0}function e8($){return typeof $==="function"&&$._isDerived===!0}function cX($){if(t8($)||e8($))return $();return $}function $$($){return iZ($)}function Az($,X){let Z=typeof $==="function"?$:()=>$,J=u1([]),Y=s8(()=>J().reduce((w,q)=>X(w,q.action),Z())),G=!1;return a8(()=>{if(Z(),!G){G=!0;return}if($$(()=>J().length))J.set([])}),[Y,(w,q)=>{let W={action:w};J.set([...J(),W]);let K=()=>{let z=J().filter((U)=>U!==W);if(z.length!==J().length)J.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(K,K);return K}]}var hX,o8;var X$=D(()=>{nZ();hX=[],o8=[]});var sZ={};t(sZ,{useOptimistic:()=>Az,untrack:()=>cX,state:()=>u1,runMountCallbacks:()=>Lz,runDestroyCallbacks:()=>Fz,pendingLifecycleCounts:()=>Vz,peek:()=>$$,onMount:()=>dX,onDestroy:()=>mX,isSignal:()=>t8,isDerived:()=>e8,generateSignalsRuntimeDev:()=>lX,generateSignalsRuntime:()=>oZ,effect:()=>a8,derived:()=>s8,default:()=>Nz,batch:()=>uX});function oZ(){let $=Rz(lX());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 Rz($){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 q=w;Q++;while(Q<$.length&&$[Q]!==q){if($[Q]==="\\")Q++;Q++}Q++;continue}if(w==="(")G++;else if(w===")")G--;Q++}X.push("0"),Z=Q}return X.join("")}function lX(){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 = ${K2()};
5279
+ var X_HANDLED = ${B2()};
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])) {
@@ -10636,42 +10636,42 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
10636
10636
  }
10637
10637
  }
10638
10638
  })();
10639
- `}var Fz;var nZ=y(()=>{a8();$1();a8();Fz={state:x1,derived:i8,effect:n8,batch:xX,onMount:fX,onDestroy:gX,isSignal:r8,isDerived:o8,untrack:hX,peek:s8,generateSignalsRuntime:pZ,generateSignalsRuntimeDev:uX}});var dX={};a(dX,{templateCache:()=>rZ,readFileCached:()=>Vz,invalidateFileCacheByDir:()=>Rz,invalidateFileCache:()=>Az,hashFilePath:()=>u7,getCachedSignalsRuntime:()=>Mz,getCachedRouterScript:()=>kz,clearDevCaches:()=>Iz,checkCache:()=>Ez,cacheTemplate:()=>Dz,__setSignalsGeneratorsForTest:()=>Tz});import f1 from"fs";import S5 from"path";async function Vz($){let Z;for(let J=0;J<3;J++)try{let G=(await f1.promises.stat($)).mtime.getTime(),Q=X5.get($);if(Q&&Q.mtime===G)return Q.content;let w=await Bun.file($).text(),W=(await f1.promises.stat($)).mtime.getTime();if(W!==G)continue;return X5.set($,{content:w,mtime:W}),w}catch(Y){Z=Y;break}throw X5.delete($),Error(`File not found: ${$}${Z?` (${Z.message})`:""}`)}function Az($){X5.delete($)}function Rz($){for(let X of X5.keys())if(X.startsWith($))X5.delete(X)}function Tz($){oZ=$}async function Mz($=!1){let X=oZ??await Promise.resolve().then(() => (nZ(),iZ));if($)return X.generateSignalsRuntimeDev();if(t8===null)t8=X.generateSignalsRuntime();return t8}async function kz(){if(e8===null){let{getRouterScript:$}=await Promise.resolve().then(() => (I1(),S6));e8=$()}return e8}function Iz(){X5.clear(),aZ(),t8=null,Nz=null,e8=null}function sZ($){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 Ez($,X){try{if(!X.cachePath)return null;let Z=S5.resolve(X.cachePath),J=S5.join(Z,`${u7($)}.html`),Y=S5.join(Z,`${u7($)}.meta.json`);if(!await n(J)||!await n(Y))return null;let G=await Bun.file(Y).text(),Q=JSON.parse(G);if(Q.cacheVersion!==X.cacheVersion)return null;if(Q.optionsSignature!==sZ(X))return null;if((await f1.promises.stat($)).mtime.getTime()>Q.mtime)return null;for(let q of Q.dependencies)if(await n(q)){if((await f1.promises.stat(q)).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=S5.resolve(J.cachePath);await f1.promises.mkdir(Y,{recursive:!0});let G=S5.join(Y,`${u7($)}.html`),Q=S5.join(Y,`${u7($)}.meta.json`),w=await f1.promises.stat($);await Bun.write(G,X);let q={sourcePath:$,mtime:w.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:J.cacheVersion,optionsSignature:sZ(J),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(q,null,2)),rZ.set($,{output:X,mtime:w.mtime.getTime(),dependencies:Z})}catch(Y){console.warn(`Failed to cache template ${$}:`,Y)}}function u7($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,yz)}var rZ,X5,t8=null,Nz=null,oZ=null,e8=null,yz=16;var mX=y(()=>{y0();rZ=new Map,X5=new Map});function tZ($){return $.includes("data-stx-runtime")}function eZ($){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 cX($,X){let Z=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(Z!==-1&&(J===-1||Z>J))return $.slice(0,Z)+X+`
10639
+ `}var Nz;var aZ=D(()=>{X$();Z1();X$();Nz={state:u1,derived:s8,effect:a8,batch:uX,onMount:dX,onDestroy:mX,isSignal:t8,isDerived:e8,untrack:cX,peek:$$,generateSignalsRuntime:oZ,generateSignalsRuntimeDev:lX}});var pX={};t(pX,{templateCache:()=>tZ,readFileCached:()=>Tz,invalidateFileCacheByDir:()=>kz,invalidateFileCache:()=>Mz,hashFilePath:()=>c7,getCachedSignalsRuntime:()=>Dz,getCachedRouterScript:()=>yz,clearDevCaches:()=>bz,checkCache:()=>Sz,cacheTemplate:()=>Cz,__setSignalsGeneratorsForTest:()=>Ez});import d1 from"fs";import x5 from"path";async function Tz($){let Z;for(let J=0;J<3;J++)try{let G=(await d1.promises.stat($)).mtime.getTime(),Q=Q5.get($);if(Q&&Q.mtime===G)return Q.content;let w=await Bun.file($).text(),W=(await d1.promises.stat($)).mtime.getTime();if(W!==G)continue;return Q5.set($,{content:w,mtime:W}),w}catch(Y){Z=Y;break}throw Q5.delete($),Error(`File not found: ${$}${Z?` (${Z.message})`:""}`)}function Mz($){Q5.delete($)}function kz($){for(let X of Q5.keys())if(X.startsWith($))Q5.delete(X)}function Ez($){eZ=$}async function Dz($=!1){let X=eZ??await Promise.resolve().then(() => (aZ(),sZ));if($)return X.generateSignalsRuntimeDev();if(Z$===null)Z$=X.generateSignalsRuntime();return Z$}async function yz(){if(J$===null){let{getRouterScript:$}=await Promise.resolve().then(() => (b1(),x6));J$=$()}return J$}function bz(){Q5.clear(),XJ(),Z$=null,Iz=null,J$=null}function $J($){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 Sz($,X){try{if(!X.cachePath)return null;let Z=x5.resolve(X.cachePath),J=x5.join(Z,`${c7($)}.html`),Y=x5.join(Z,`${c7($)}.meta.json`);if(!await n(J)||!await n(Y))return null;let G=await Bun.file(Y).text(),Q=JSON.parse(G);if(Q.cacheVersion!==X.cacheVersion)return null;if(Q.optionsSignature!==$J(X))return null;if((await d1.promises.stat($)).mtime.getTime()>Q.mtime)return null;for(let q of Q.dependencies)if(await n(q)){if((await d1.promises.stat(q)).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 Cz($,X,Z,J){try{if(!J.cachePath)return;let Y=x5.resolve(J.cachePath);await d1.promises.mkdir(Y,{recursive:!0});let G=x5.join(Y,`${c7($)}.html`),Q=x5.join(Y,`${c7($)}.meta.json`),w=await d1.promises.stat($);await Bun.write(G,X);let q={sourcePath:$,mtime:w.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:J.cacheVersion,optionsSignature:$J(J),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(q,null,2)),tZ.set($,{output:X,mtime:w.mtime.getTime(),dependencies:Z})}catch(Y){console.warn(`Failed to cache template ${$}:`,Y)}}function c7($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Pz)}var tZ,Q5,Z$=null,Iz=null,eZ=null,J$=null,Pz=16;var iX=D(()=>{A0();tZ=new Map,Q5=new Map});function ZJ($){return $.includes("data-stx-runtime")}function JJ($){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 nX($,X){let Z=$.indexOf("<script"),J=$.search(/<!doctype\b/i);if(Z!==-1&&(J===-1||Z>J))return $.slice(0,Z)+X+`
10640
10640
  `+$.slice(Z);let Y=/<head\b[^>]*>/i.exec($);if(Y){let Q=Y.index+Y[0].length;return`${$.slice(0,Q)}
10641
10641
  ${X}${$.slice(Q)}`}if($.includes("</head>")){let Q=$.indexOf("</head>");return $.slice(0,Q)+X+`
10642
- `+$.slice(Q)}if(h7($))return c8($,(Q)=>`${Q}
10642
+ `+$.slice(Q)}if(m7($))return n8($,(Q)=>`${Q}
10643
10643
  ${X}`);return`${X}
10644
- ${$}`}async function $$($,X){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(X.buildMode==="serve")return cX($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(X.buildMode==="compile")return cX($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (mX(),dX)),J=await Z(X.debug);return cX($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function bz($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function $J($){if($.includes("data-stx-tooltip-runtime")||!bz($))return $;let X=`<script data-stx-scoped data-stx-tooltip-runtime>${EX()}</script>`,Z=$.lastIndexOf("</body>");if(Z===-1)return`${$}
10644
+ ${$}`}async function Y$($,X){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(X.buildMode==="serve")return nX($,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if(X.buildMode==="compile")return nX($,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (iX(),pX)),J=await Z(X.debug);return nX($,`<script data-stx-scoped data-stx-runtime>${J}</script>`)}function vz($){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test($)}function YJ($){if($.includes("data-stx-tooltip-runtime")||!vz($))return $;let X=`<script data-stx-scoped data-stx-tooltip-runtime>${SX()}</script>`,Z=$.lastIndexOf("</body>");if(Z===-1)return`${$}
10645
10645
  ${X}`;return`${$.slice(0,Z)}${X}
10646
- ${$.slice(Z)}`}async function lX($,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 q=await xZ(X?.pagesDir);if(q.length>0)w.ownedRoutes=q}catch{}if(Object.keys(w).length>0)J=`<script>window.__stxRouterConfig=${gZ(w)};</script>
10647
- `}let{getCachedRouterScript:Y}=await Promise.resolve().then(() => (mX(),dX)),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 X$=y(()=>{fZ();IX()});var Q$={};a(Q$,{scanScriptTags:()=>QJ,rewriteStxImportSpecifiers:()=>KJ,processSignals:()=>sX,processScriptSetup:()=>qJ,preEvalLiteralReactiveIfs:()=>rX,parseLoopExpression:()=>iX,hasSignalsSyntax:()=>G$,findMarkupIndexOutsideScripts:()=>J$,extractExports:()=>WJ,convertSignalLoopsToAttributes:()=>oX,convertSignalDirectivesToAttributes:()=>nX});function QJ($,X={}){let Z=[];for(let J of P8($,y1)){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,q=J.token.length-G[0].length;Z.push({fullMatch:J.token,attrs:Q,body:J.token.slice(w,q),start:J.start,end:J.end})}return Z}function iX($){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}=XJ(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}=XJ(Y);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:w}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function XJ($){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 G$($){return Q2($)}function Cz($){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 Pz($){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 vz($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let X=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${pX})>`,"iy"),Z=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=P8($,(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),q=iX(w?.[1]??w?.[2]??""),W=[q.itemVar,q.indexVar].filter(Boolean);if(W.length===0)continue;let K=Q[1],U=/\/\s*>$/.test(G.token)||Y$.has(K.toLowerCase())?G.end:wJ($,G.start,K,G.end);if(U!==-1)Y.push({start:G.start,end:U,vars:new Set(W)})}return Y}function xz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function JJ($,X,Z,J){if(!$)return!1;let Y=xz($),G=!1,Q=!1,w=!1,q=/([a-zA-Z_$][\w$]*)/g,W;while((W=q.exec(Y))!==null){let B=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(ZJ.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(ZJ.has(B)||Z&&B in Z)continue;w=!0}return(G||w)&&!Q}function Z$($,X,Z){let J=Z===void 0?` ${X}`:` ${X}="${Z.replace(/"/g,"&quot;")}"`,Y=$.trim(),G=Y.match(GJ);if(G&&fz(G[3],G[1])){let[,Q,w,q]=G;return`<${Q}${w}${J}>${q}</${Q}>`}return`<template${J}>${Y}</template>`}function fz($,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 nX($,X){let Z=Pz($);function J(Y){let G=Y,Q=vz(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},q=/@if\s*\(/g,W,K=[];while((W=q.exec(G))!==null){let z=W.index,U=z+W[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 _=G.substring(U,j-1).trim(),H=j,L=1,O=H,F=/@(if\s*\(|endif)/g;F.lastIndex=H;let V;while((V=F.exec(G))!==null)if(V[1].startsWith("if"))L++;else if(V[1]==="endif"){if(L--,L===0){O=V.index+V[0].length;break}}if(L!==0)continue;let A=G.substring(H,O-6).trim(),R;if(Cz(A)){let N=g7(G.substring(z,O));if(N.length===0)continue;let M=N[0].branches.filter((I)=>I.type!=="else"),k=w(z);if(!(M.length>0&&M.every((I)=>JJ(I.condition,Z,X,k))))continue;R=N[0].branches.map((I)=>{let S=J(I.content);if(I.type==="elseif")return Z$(S,"@else-if",I.condition??"");if(I.type==="else")return Z$(S,"@else");return Z$(S,"@if",I.condition??"")}).join(`
10649
- `)}else{if(!JJ(_,Z,X,w(z)))continue;R=Z$(J(A),"@if",_)}K.push({start:z,end:O,replacement:R}),q.lastIndex=O}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 gz($){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 wJ($,X,Z,J){if(Y$.has(Z.toLowerCase()))return J;let Y=Z.toLowerCase(),G=$.toLowerCase(),Q=$.length,w=1,q=J;while(q<Q){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let B=$.indexOf("-->",q+4);if(B===-1)return-1;q=B+3;continue}let K=/^<(script|style)\b/i.exec($.slice(q,q+8));if(K){let B=$.indexOf(">",q);if(B===-1)return-1;if($[B-1]==="/"){q=B+1;continue}let j=G.indexOf(`</${K[1].toLowerCase()}`,q);if(j===-1)return-1;let _=$.indexOf(">",j);if(_===-1)return-1;q=_+1;continue}if($[q+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!B){q++;continue}if(B[1].toLowerCase()===Y){if(w--,q+=B[0].length,w===0)return q;continue}q+=B[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let U=$.indexOf(">",q);if(U===-1)return-1;if(z[1].toLowerCase()===Y){let B=$.slice(q,U+1);if(!(/\/\s*>$/.test(B)||Y$.has(Y)))w++}q=U+1}return-1}function uz($,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 hz.test(G)}function rX($){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,L]=w,O=gz(_);if(O===void 0)continue;let F=w.index,V=F+z.length,N=!!L||/\/\s*>$/.test(z)||Y$.has(U.toLowerCase())?V:wJ($,F,U,V);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&uz($,N)){G.lastIndex=V;continue}if(O===!0){let k=`<${U}${B}${H}${L}>`;Q.push({start:F,end:V,replacement:k});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 q=[],W=-1;for(let z of Q){if(z.start<W)continue;q.push(z),W=z.end}let K=$;for(let z=q.length-1;z>=0;z--){let{start:U,end:B,replacement:j}=q[z];K=K.substring(0,U)+j+K.substring(B)}return K}function oX($,X){let Z=$,J=/@(for|foreach)\s*\(/g,Y,G=[],Q=[];while((Y=J.exec(Z))!==null){let w=Y[1],q=Y.index,W=q+Y[0].length,K=1,z=W;while(z<Z.length&&K>0){if(Z[z]==="(")K++;else if(Z[z]===")")K--;z++}if(K!==0)continue;let U=Z.substring(W,z-1).trim(),B=z,j=iX(U),_=w==="for"?"@endfor":"@endforeach",H=1,L=B,O=w==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${w}\\s*\\(|end${w})`,"g");O.lastIndex=B;let F;while((F=O.exec(Z))!==null)if(F[1].startsWith(w))H++;else if(H--,H===0){L=F.index+F[0].length;break}if(H!==0)continue;let V=()=>{let M=[j.itemVar,j.indexVar].filter(Boolean);if(M.length)Q.push({start:q,end:L,vars:M})};if(j.iterable){let M=j.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M)){V();continue}let k=M.split(/[.[(]/)[0].trim(),T=X?k in X:!1,D=Q.some((I)=>q>I.start&&q<I.end&&I.vars.includes(k));if(k&&(T||D)){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-_.length).trim(),R=A.match(GJ),N;if(R){let[,M,k,T]=R;N=`<${M}${k} @for="${U}">${T}</${M}>`}else N=`<template @for="${U}">${A}</template>`;G.push({start:q,end:L,replacement:N})}for(let w=G.length-1;w>=0;w--){let{start:q,end:W,replacement:K}=G[w];Z=Z.substring(0,q)+K+Z.substring(W)}return Z}function dz($){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]!==`
10646
+ ${$.slice(Z)}`}async function rX($,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 q=await uZ(X?.pagesDir);if(q.length>0)w.ownedRoutes=q}catch{}if(Object.keys(w).length>0)J=`<script>window.__stxRouterConfig=${mZ(w)};</script>
10647
+ `}let{getCachedRouterScript:Y}=await Promise.resolve().then(() => (iX(),pX)),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 G$=D(()=>{dZ();bX()});var K$={};t(K$,{scanScriptTags:()=>KJ,rewriteStxImportSpecifiers:()=>BJ,processSignals:()=>$4,processScriptSetup:()=>UJ,preEvalLiteralReactiveIfs:()=>tX,parseLoopExpression:()=>sX,hasSignalsSyntax:()=>W$,findMarkupIndexOutsideScripts:()=>w$,extractExports:()=>jJ,convertSignalLoopsToAttributes:()=>eX,convertSignalDirectivesToAttributes:()=>aX});function KJ($,X={}){let Z=[];for(let J of g8($,P1)){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,q=J.token.length-G[0].length;Z.push({fullMatch:J.token,attrs:Q,body:J.token.slice(w,q),start:J.start,end:J.end})}return Z}function sX($){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}=GJ(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}=GJ(Y);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:w}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function GJ($){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 W$($){return K2($)}function fz($){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 gz($){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 hz($){if(!/[:@]for\s*=/.test($)&&!/\bx-for\s*=/.test($))return[];let X=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${oX})>`,"iy"),Z=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,J=g8($,(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),q=sX(w?.[1]??w?.[2]??""),W=[q.itemVar,q.indexVar].filter(Boolean);if(W.length===0)continue;let K=Q[1],U=/\/\s*>$/.test(G.token)||q$.has(K.toLowerCase())?G.end:zJ($,G.start,K,G.end);if(U!==-1)Y.push({start:G.start,end:U,vars:new Set(W)})}return Y}function uz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function wJ($,X,Z,J){if(!$)return!1;let Y=uz($),G=!1,Q=!1,w=!1,q=/([a-zA-Z_$][\w$]*)/g,W;while((W=q.exec(Y))!==null){let B=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(QJ.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(QJ.has(B)||Z&&B in Z)continue;w=!0}return(G||w)&&!Q}function Q$($,X,Z){let J=Z===void 0?` ${X}`:` ${X}="${Z.replace(/"/g,"&quot;")}"`,Y=$.trim(),G=Y.match(WJ);if(G&&dz(G[3],G[1])){let[,Q,w,q]=G;return`<${Q}${w}${J}>${q}</${Q}>`}return`<template${J}>${Y}</template>`}function dz($,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 aX($,X){let Z=gz($);function J(Y){let G=Y,Q=hz(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},q=/@if\s*\(/g,W,K=[];while((W=q.exec(G))!==null){let z=W.index,U=z+W[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 _=G.substring(U,j-1).trim(),H=j,L=1,O=H,F=/@(if\s*\(|endif)/g;F.lastIndex=H;let V;while((V=F.exec(G))!==null)if(V[1].startsWith("if"))L++;else if(V[1]==="endif"){if(L--,L===0){O=V.index+V[0].length;break}}if(L!==0)continue;let A=G.substring(H,O-6).trim(),R;if(fz(A)){let N=d7(G.substring(z,O));if(N.length===0)continue;let T=N[0].branches.filter((I)=>I.type!=="else"),k=w(z);if(!(T.length>0&&T.every((I)=>wJ(I.condition,Z,X,k))))continue;R=N[0].branches.map((I)=>{let S=J(I.content);if(I.type==="elseif")return Q$(S,"@else-if",I.condition??"");if(I.type==="else")return Q$(S,"@else");return Q$(S,"@if",I.condition??"")}).join(`
10649
+ `)}else{if(!wJ(_,Z,X,w(z)))continue;R=Q$(J(A),"@if",_)}K.push({start:z,end:O,replacement:R}),q.lastIndex=O}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 mz($){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 zJ($,X,Z,J){if(q$.has(Z.toLowerCase()))return J;let Y=Z.toLowerCase(),G=$.toLowerCase(),Q=$.length,w=1,q=J;while(q<Q){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let B=$.indexOf("-->",q+4);if(B===-1)return-1;q=B+3;continue}let K=/^<(script|style)\b/i.exec($.slice(q,q+8));if(K){let B=$.indexOf(">",q);if(B===-1)return-1;if($[B-1]==="/"){q=B+1;continue}let j=G.indexOf(`</${K[1].toLowerCase()}`,q);if(j===-1)return-1;let _=$.indexOf(">",j);if(_===-1)return-1;q=_+1;continue}if($[q+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!B){q++;continue}if(B[1].toLowerCase()===Y){if(w--,q+=B[0].length,w===0)return q;continue}q+=B[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let U=$.indexOf(">",q);if(U===-1)return-1;if(z[1].toLowerCase()===Y){let B=$.slice(q,U+1);if(!(/\/\s*>$/.test(B)||q$.has(Y)))w++}q=U+1}return-1}function lz($,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 cz.test(G)}function tX($){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,L]=w,O=mz(_);if(O===void 0)continue;let F=w.index,V=F+z.length,N=!!L||/\/\s*>$/.test(z)||q$.has(U.toLowerCase())?V:zJ($,F,U,V);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&lz($,N)){G.lastIndex=V;continue}if(O===!0){let k=`<${U}${B}${H}${L}>`;Q.push({start:F,end:V,replacement:k});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 q=[],W=-1;for(let z of Q){if(z.start<W)continue;q.push(z),W=z.end}let K=$;for(let z=q.length-1;z>=0;z--){let{start:U,end:B,replacement:j}=q[z];K=K.substring(0,U)+j+K.substring(B)}return K}function eX($,X){let Z=$,J=/@(for|foreach)\s*\(/g,Y,G=[],Q=[];while((Y=J.exec(Z))!==null){let w=Y[1],q=Y.index,W=q+Y[0].length,K=1,z=W;while(z<Z.length&&K>0){if(Z[z]==="(")K++;else if(Z[z]===")")K--;z++}if(K!==0)continue;let U=Z.substring(W,z-1).trim(),B=z,j=sX(U),_=w==="for"?"@endfor":"@endforeach",H=1,L=B,O=w==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${w}\\s*\\(|end${w})`,"g");O.lastIndex=B;let F;while((F=O.exec(Z))!==null)if(F[1].startsWith(w))H++;else if(H--,H===0){L=F.index+F[0].length;break}if(H!==0)continue;let V=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)Q.push({start:q,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 k=T.split(/[.[(]/)[0].trim(),M=X?k in X:!1,E=Q.some((I)=>q>I.start&&q<I.end&&I.vars.includes(k));if(k&&(M||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-_.length).trim(),R=A.match(WJ),N;if(R){let[,T,k,M]=R;N=`<${T}${k} @for="${U}">${M}</${T}>`}else N=`<template @for="${U}">${A}</template>`;G.push({start:q,end:L,replacement:N})}for(let w=G.length-1;w>=0;w--){let{start:q,end:W,replacement:K}=G[w];Z=Z.substring(0,q)+K+Z.substring(W)}return Z}function pz($){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
10650
  `)K++;return K},q=()=>{let K=J+2;while(K<G-1){if($[K]==="*"&&$[K+1]==="/")return K+2;K++}return G},W=(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=q();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],_=W(J+B[0].length);if(X.has(j)){Z.push(`/* stx: deduped const ${j} */`),J=_;continue}X.add(j),Z.push($.slice(J,_)),J=_;continue}}}Z.push(K),J++}return Z.join("")}async function qJ($,X,Z){let J=QJ($,{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 H of J){let L=H.body;if(n1(H.attrs))L=r1(L);if(Y.test(L))G.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(G.length===0)return{output:$,setupCode:null};let Q=`__stx_setup_${Date.now()}_${Sz++}`,{hasUserImports:w,bundleClientScript:q}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (T5(),M7))),W=[];for(let H=0;H<G.length;H++){let L=G[H].content;if(L=M5(L).code,w(L))L=await q(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)=>KJ(V));let O=p0(L);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
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=q();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],_=W(J+B[0].length);if(X.has(j)){Z.push(`/* stx: deduped const ${j} */`),J=_;continue}X.add(j),Z.push($.slice(J,_)),J=_;continue}}}Z.push(K),J++}return Z.join("")}async function UJ($,X,Z){let J=KJ($,{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 H of J){let L=H.body;if(e1(H.attrs))L=$5(L);if(Y.test(L))G.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(G.length===0)return{output:$,setupCode:null};let Q=`__stx_setup_${Date.now()}_${xz++}`,{hasUserImports:w,bundleClientScript:q}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (I5(),D7))),W=[];for(let H=0;H<G.length;H++){let L=G[H].content;if(L=E5(L).code,w(L))L=await q(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)=>BJ(V));let O=r0(L);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
10652
10652
  ${O}`)}let K=W.join(`
10653
10653
 
10654
- `);K=dz(K);let z=WJ(K),U=z.split(",").map((H)=>H.trim()).filter(Boolean),B=D8(K,Z),j=`
10654
+ `);K=pz(K);let z=jJ(K),U=z.split(",").map((H)=>H.trim()).filter(Boolean),B=C8(K,Z),j=`
10655
10655
  <script data-stx-scoped>
10656
10656
  function ${Q}() {
10657
- ${R5("const",U)}
10658
- ${N5(`${B}${K}`)}
10657
+ ${M5("const",U)}
10658
+ ${k5(`${B}${K}`)}
10659
10659
  return { ${z} };
10660
10660
  }
10661
10661
  window.__stx_latestSetup=${Q};
10662
10662
  if(window.stx)window.stx._latestSetup=${Q};
10663
- </script>`,_=$;for(let H of G)_=_.split(H.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${pX})>`),`<body$1 data-stx="${Q}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${pX})>`,"gi"),(O,F,V)=>{if(L||H.includes(F.toLowerCase()))return O;return L=!0,`<${F}${V} data-stx="${Q}">`})}return{output:_,setupCode:j}}function WJ($){let X=$,Z=[],J=new Set,Y=0,G=0,Q=X.length,w="",q=()=>{G++;let j=!1;while(G<Q){let _=X[G];if(_==="\\"){G+=2;continue}if(_==="["&&!j){j=!0,G++;continue}if(_==="]"&&j){j=!1,G++;continue}if(_==="/"&&!j){G++;while(G<Q&&/[gimsuyd]/.test(X[G]))G++;return}if(_===`
10663
+ </script>`,_=$;for(let H of G)_=_.split(H.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${oX})>`),`<body$1 data-stx="${Q}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${oX})>`,"gi"),(O,F,V)=>{if(L||H.includes(F.toLowerCase()))return O;return L=!0,`<${F}${V} data-stx="${Q}">`})}return{output:_,setupCode:j}}function jJ($){let X=$,Z=[],J=new Set,Y=0,G=0,Q=X.length,w="",q=()=>{G++;let j=!1;while(G<Q){let _=X[G];if(_==="\\"){G+=2;continue}if(_==="["&&!j){j=!0,G++;continue}if(_==="]"&&j){j=!1,G++;continue}if(_==="/"&&!j){G++;while(G<Q&&/[gimsuyd]/.test(X[G]))G++;return}if(_===`
10664
10664
  `)return;G++}},W=()=>{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 _=X.slice(G).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[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 H=X.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((F)=>{let V=F.trim().replace(/^\.\.\./,"");if(!V)return;let A=V.split(/[\s=]/)[0];if(A&&!J.has(A))Z.push(A),J.add(A)});return}let L=X.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!J.has(F))Z.push(F),J.add(F);return}let O=X.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!J.has(F))Z.push(F),J.add(F)}};while(G<Q){if(U())continue;if(X[G]==="'"||X[G]==='"'){K(X[G]),w=X[G-1];continue}if(X[G]==="`"){z(),w="`";continue}if(X[G]==="/"&&X[G+1]!=="/"&&X[G+1]!=="*"&&W()){q(),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 sX($,X,Z,J){if(!G$($))return $;let Y=$;if(X.skipSignalsRuntime)return Y;let{output:G,setupCode:Q}=await qJ(Y,Z,J);if(Y=G,Y=await $$(Y,X),Q){let K=J$(Y,/<\/head>/i),z=K===-1?J$(Y,/<body[^>]*>/i):-1;if(K!==-1)Y=`${Y.slice(0,K)}${Q}
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 _=X.slice(G).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[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 H=X.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((F)=>{let V=F.trim().replace(/^\.\.\./,"");if(!V)return;let A=V.split(/[\s=]/)[0];if(A&&!J.has(A))Z.push(A),J.add(A)});return}let L=X.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!J.has(F))Z.push(F),J.add(F);return}let O=X.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!J.has(F))Z.push(F),J.add(F)}};while(G<Q){if(U())continue;if(X[G]==="'"||X[G]==='"'){K(X[G]),w=X[G-1];continue}if(X[G]==="`"){z(),w="`";continue}if(X[G]==="/"&&X[G+1]!=="/"&&X[G+1]!=="*"&&W()){q(),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 $4($,X,Z,J){if(!W$($))return $;let Y=$;if(X.skipSignalsRuntime)return Y;let{output:G,setupCode:Q}=await UJ(Y,Z,J);if(Y=G,Y=await Y$(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
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
10667
  ${Q}${Y.slice(B)}`}else Y=`${Y}
10668
- ${Q}`}let q=Y.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!Q&&!W&&q&&!/data-stx-auto/.test(q[1])){let K=/<body[^>]*>/i,z=J$(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 J$($,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 q=Q+w.index;if(!J.some(([K,z])=>q>=K&&q<z))return q;Q=q+Math.max(w[0].length,1)}return-1}function KJ($){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 YJ;return`var ${X.join(", ")}; ${YJ}`}var Sz=0,pX=`(?:"[^"]*"|'[^']*'|[^>"'])*`,GJ,ZJ,Y$,hz,YJ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var d7=y(()=>{y7();m8();$1();XX();y0();X$();o1();T7();GJ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;ZJ=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"]);Y$=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);hz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import mz from"fs";import u from"path";function lz($){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 zJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pz($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function n1($){return!pz($)}function iz($){let X;try{X=JSON.stringify($)}catch{return new Bun.Transpiler($)}let Z=w$.get(X);if(Z)return Z;if(w$.size>=16)w$.clear();let J=new Bun.Transpiler($);return w$.set(X,J),J}function r1($){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=iz({loader:"ts",target:"browser",define:u0()}).transformSync(X);for(let G=0;G<Z.length;G++)Y=Y.replace(`"__STX_EXPR_${G}__"`,Z[G]),Y=Y.replace(`'__STX_EXPR_${G}__'`,Z[G]);return Y}catch(X){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",X);return $}}function nz($){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++}},q=()=>{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},W=()=>{if(J!==0)return;let K=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let j=K[2].split(",").map((_)=>{let H=_.trim().split(":");return H[H.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Z.has(_))X.push(_),Z.add(_);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(q())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])))W();Y++}return X}function rz($){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 oz($){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 sz($,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 q=$[J];if(q==="}")G++;else if(q==="{"){if(G--,G===0){Q=J;break}}}if(Q===-1)return;let w=$.slice(Q+1,Y);for(let q of rz(w)){let W=q.trim();if(!W||W.startsWith("..."))continue;let K=oz(W);if(K===-1)continue;let z=W.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(X[z]!==void 0)continue;let U=W.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((_)=>X[_]))}catch{}}}catch{}}async function K$($,X,Z,J,Y){let G=$.endsWith(".stx")?$.slice(0,-4):$,Q=(H)=>H.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""),w=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Z.__importedComponents;if(q){for(let H of[G,G.toLowerCase(),Q(G),w(G)])if(q.has(H))return!0}let W=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${w(G)}.stx`])],K=typeof Y.root==="string"?u.resolve(Y.root):void 0,z=K??u.dirname(J),U=[],B=(H)=>{if(H&&!U.includes(H))U.push(H)},j=Z.__originalFilePath;if(j)B(u.join(u.dirname(j),"components"));B(X),B(Y._rootComponentsDir),B(u.join(u.dirname(J),"components")),B(Y.componentsDir);let _=Y._pluginComponentDirs;if(Array.isArray(_))for(let H of _)B(typeof H==="string"?H:null);if(K)B(u.resolve(K,"resources/views/components")),B(u.resolve(K,"resources/components")),B(u.resolve(K,"src/components")),B(u.resolve(K,"components"));if(G.startsWith("./")||G.startsWith("../"))return n(u.resolve(u.dirname(J),`${G}.stx`));for(let H of U){let L=u.isAbsolute(H)?H:u.resolve(z,H);for(let O of W)if(await n(u.join(L,O)))return!0}return!1}function az($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function tz($){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 ez($){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 Z5($,X,Z,J,Y,G,Q,w=new Set,q){let{extractVariables:W}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (f7(),u8))),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"&&az(U)?U:"";try{let j=(C)=>C.split("-").map((g)=>g.charAt(0).toUpperCase()+g.slice(1)).join(""),_=(C)=>C.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=$.endsWith(".stx")?$.slice(0,-4):$,L=null,O=Y.__importedComponents;if(O){let C=[H,H.toLowerCase(),j(H),_(H)];for(let g of C)if(O.has(g)){L=O.get(g);break}}let F=[];if(!L){let C=[`${H}.stx`,`${j(H)}.stx`,`${_(H)}.stx`],g=[...new Set(C)],c=Y.__originalFilePath,d=[];if(c){let z0=u.join(u.dirname(c),"components");d.push(z0)}if(J)d.push(J);let w0=Q._rootComponentsDir;if(typeof w0==="string"&&!d.includes(w0))d.push(w0);let N0=u.join(u.dirname(G),"components");if(!d.includes(N0))d.push(N0);if(Q.componentsDir&&Q.componentsDir!==J&&!d.includes(Q.componentsDir))d.push(Q.componentsDir);let B1=Q._pluginComponentDirs;if(Array.isArray(B1)){for(let z0 of B1)if(typeof z0==="string"&&!d.includes(z0))d.push(z0)}let o0=typeof Q.root==="string"?u.resolve(Q.root):void 0,h0=o0??u.dirname(G),e0=[];if(o0)e0.push(u.resolve(o0,"resources/views/components")),e0.push(u.resolve(o0,"resources/components")),e0.push(u.resolve(o0,"src/components")),e0.push(u.resolve(o0,"components"));e0.push(u.resolve(import.meta.dir,"components"));for(let z0 of e0)if(!d.includes(z0))d.push(z0);let l1=[...new Set(d.map((z0)=>{if(!z0)return z0;return u.isAbsolute(z0)?z0:u.resolve(h0,z0)}))];d.length=0,d.push(...l1);let k1=`${H}\x00${G}\x00${l1.join("\x00")}`,B5=W$.get(k1);if(B5)if(await n(B5))L=B5;else W$.delete(k1);if(!L&&(H.startsWith("./")||H.startsWith("../")))L=u.resolve(u.dirname(G),`${H}.stx`),F.push(L);else if(!L)for(let z0 of d){if(!z0)continue;for(let o of g){let l0=u.join(z0,o);if(F.push(l0),await n(l0)){L=l0;break}}if(L)break;if(!L)try{let o=await import("fs");if(!o.statSync(z0,{throwIfNoEntry:!1})?.isDirectory())continue;let $7=8,_5=[{path:z0,depth:0}];while(_5.length>0&&!L){let _1=_5.pop();if(_1.depth>=$7)continue;let z8;try{z8=o.readdirSync(_1.path,{withFileTypes:!0})}catch{continue}for(let U8 of z8){if(!U8.isDirectory())continue;if(U8.name==="node_modules"||U8.name.startsWith("."))continue;let H6=u.join(_1.path,U8.name);for(let lq of g){let R9=u.join(H6,lq);if(F.push(R9),await n(R9)){L=R9;break}}if(L)break;_5.push({path:H6,depth:_1.depth+1})}}}catch{}if(L)break}if(L)W$.set(k1,L)}if(!L||!await n(L)){let C=F.length>0?`
10668
+ ${Q}`}let q=Y.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!Q&&!W&&q&&!/data-stx-auto/.test(q[1])){let K=/<body[^>]*>/i,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 q=Q+w.index;if(!J.some(([K,z])=>q>=K&&q<z))return q;Q=q+Math.max(w[0].length,1)}return-1}function BJ($){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 qJ;return`var ${X.join(", ")}; ${qJ}`}var xz=0,oX=`(?:"[^"]*"|'[^']*'|[^>"'])*`,WJ,QJ,q$,cz,qJ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var l7=D(()=>{P7();i8();Z1();GX();A0();G$();v1();E7();WJ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;QJ=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"]);cz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import iz from"fs";import h from"path";function rz($){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 _J($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function oz($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function e1($){return!oz($)}function T1($){let X;try{X=JSON.stringify($)}catch{return new Bun.Transpiler($)}let Z=z$.get(X);if(Z)return Z;if(z$.size>=16)z$.clear();let J=new Bun.Transpiler($);return z$.set(X,J),J}function $5($){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=T1({loader:"ts",target:"browser",define:l0()}).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 sz($){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++}},q=()=>{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},W=()=>{if(J!==0)return;let K=$.slice(Y).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(K){let j=K[2].split(",").map((_)=>{let H=_.trim().split(":");return H[H.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Z.has(_))X.push(_),Z.add(_);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(q())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])))W();Y++}return X}function az($){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 tz($){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 ez($,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 q=$[J];if(q==="}")G++;else if(q==="{"){if(G--,G===0){Q=J;break}}}if(Q===-1)return;let w=$.slice(Q+1,Y);for(let q of az(w)){let W=q.trim();if(!W||W.startsWith("..."))continue;let K=tz(W);if(K===-1)continue;let z=W.slice(0,K).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(X[z]!==void 0)continue;let U=W.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((_)=>X[_]))}catch{}}}catch{}}async function B$($,X,Z,J,Y){let G=$.endsWith(".stx")?$.slice(0,-4):$,Q=(H)=>H.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""),w=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Z.__importedComponents;if(q){for(let H of[G,G.toLowerCase(),Q(G),w(G)])if(q.has(H))return!0}let W=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${w(G)}.stx`])],K=typeof Y.root==="string"?h.resolve(Y.root):void 0,z=K??h.dirname(J),U=[],B=(H)=>{if(H&&!U.includes(H))U.push(H)},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 _=Y._pluginComponentDirs;if(Array.isArray(_))for(let H of _)B(typeof H==="string"?H: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 n(h.resolve(h.dirname(J),`${G}.stx`));for(let H of U){let L=h.isAbsolute(H)?H:h.resolve(z,H);for(let O of W)if(await n(h.join(L,O)))return!0}return!1}function $U($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function XU($){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 ZU($){let X=new Set,Z=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let J of $){let Y;while((Y=Z.exec(J))!==null)X.add(Y[1]);Z.lastIndex=0}return[...X]}async function w5($,X,Z,J,Y,G,Q,w=new Set,q){let{extractVariables:W}=await $0("stx/variable-extractor",()=>Promise.resolve().then(() => (u7(),l8))),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"&&$U(U)?U:"";try{let j=(v)=>v.split("-").map((c)=>c.charAt(0).toUpperCase()+c.slice(1)).join(""),_=(v)=>v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=$.endsWith(".stx")?$.slice(0,-4):$,L=null,O=Y.__importedComponents;if(O){let v=[H,H.toLowerCase(),j(H),_(H)];for(let c of v)if(O.has(c)){L=O.get(c);break}}let F=[];if(!L){let v=[`${H}.stx`,`${j(H)}.stx`,`${_(H)}.stx`],c=[...new Set(v)],j0=Y.__originalFilePath,X0=[];if(j0){let _0=h.join(h.dirname(j0),"components");X0.push(_0)}if(J)X0.push(J);let I0=Q._rootComponentsDir;if(typeof I0==="string"&&!X0.includes(I0))X0.push(I0);let E0=h.join(h.dirname(G),"components");if(!X0.includes(E0))X0.push(E0);if(Q.componentsDir&&Q.componentsDir!==J&&!X0.includes(Q.componentsDir))X0.push(Q.componentsDir);let y1=Q._pluginComponentDirs;if(Array.isArray(y1)){for(let _0 of y1)if(typeof _0==="string"&&!X0.includes(_0))X0.push(_0)}let c0=typeof Q.root==="string"?h.resolve(Q.root):void 0,g0=c0??h.dirname(G),K1=[];if(c0)K1.push(h.resolve(c0,"resources/views/components")),K1.push(h.resolve(c0,"resources/components")),K1.push(h.resolve(c0,"src/components")),K1.push(h.resolve(c0,"components"));K1.push(h.resolve(import.meta.dir,"components"));for(let _0 of K1)if(!X0.includes(_0))X0.push(_0);let r1=[...new Set(X0.map((_0)=>{if(!_0)return _0;return h.isAbsolute(_0)?_0:h.resolve(g0,_0)}))];X0.length=0,X0.push(...r1);let a=`${H}\x00${G}\x00${r1.join("\x00")}`,X1=j$.get(a);if(X1)if(await n(X1))L=X1;else j$.delete(a);if(!L&&(H.startsWith("./")||H.startsWith("../")))L=h.resolve(h.dirname(G),`${H}.stx`),F.push(L);else if(!L)for(let _0 of X0){if(!_0)continue;for(let o1 of c){let s1=h.join(_0,o1);if(F.push(s1),await n(s1)){L=s1;break}}if(L)break;if(!L)try{let o1=await import("fs");if(!o1.statSync(_0,{throwIfNoEntry:!1})?.isDirectory())continue;let B8=8,L5=[{path:_0,depth:0}];while(L5.length>0&&!L){let L1=L5.pop();if(L1.depth>=B8)continue;let _8;try{_8=o1.readdirSync(L1.path,{withFileTypes:!0})}catch{continue}for(let H8 of _8){if(!H8.isDirectory())continue;if(H8.name==="node_modules"||H8.name.startsWith("."))continue;let V6=h.join(L1.path,H8.name);for(let rq of c){let k9=h.join(V6,rq);if(F.push(k9),await n(k9)){L=k9;break}}if(L)break;L5.push({path:V6,depth:L1.depth+1})}}}catch{}if(L)break}if(L)j$.set(a,L)}if(!L||!await n(L)){let v=F.length>0?`
10670
10670
  Searched paths:
10671
- ${F.map((g)=>` - ${g}`).join(`
10672
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${C}`}q.add(L);let V;if(q$.has(L))V=q$.get(L);else try{V=await Bun.file(L).text(),q$.set(L,V)}catch(C){return`[Error loading component: ${C instanceof Error?C.message:String(C)}]`}let A=new Set(["__originalFilePath","__importedComponents",y8,"__stx_client_signal_names"]),R={};for(let[C,g]of Object.entries(Y))if(!C.startsWith("__")||A.has(C))R[C]=g;let{extractSlotContent:N}=await t("stx/slots",()=>Promise.resolve().then(() => (TX(),NX))),M=N(Z),k={};if(M.defaultSlot?.trim())k.default=M.defaultSlot;for(let[C,g]of M.namedSlots)k[C]=g.content;let T={...R,...X,props:X,slot:Z,$slots:k,__processedComponents:z,__sections:{},__stx_signals_gate:V1(V)||tz(Z)};sz(V,T);let D=V,I=f8(D);if(I)D=I.content.trim();let S=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...V.matchAll(S)],E=[],v=b.some((C)=>/\bserver\b/.test(C[1]||"")&&/\bcache\b/.test(C[1]||""))&&b.every((C)=>/\bserver\b/.test(C[1]||"")),x=null,f=null;if(v){let C=lz({props:X,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(C!==null){x=`${L}\x00${C}`;let g=aX.get(x);if(g){for(let c of g.dependencies)q.add(c);return g.output}f=new Set(q)}}for(let C of b){let g=C[1]||"",c=C[2]||"",d=g.includes("server");if(n1(g)&&c.trim())c=r1(c);if(d&&c)try{await W(c,T,L)}catch(N0){}if(!d){let N0=c.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),B1=N0.includes("{{")&&N0.includes("}}"),o0=N0.includes("{!!")&&N0.includes("!!}");if(B1||o0)N0=v8(N0,T);let h0=g.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");E.push(`<script${h0}>${N0}</script>`)}}let h=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),p=h?h[1]:"",H0=h?h[2]:"",M0="",j0=p&&/\bscoped\b/i.test(p);if(h)M0=`<style${p}>${H0}</style>`;let Z0=D;if(Z0=Z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),h)Z0=Z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let C=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,g=[];if(Z0=Z0.replace(C,(c,d)=>{let w0=d.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(w0)g.push(`<style${w0[1]}>${w0[2]}</style>`);return""}),Z0=Z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),g.length>0)M0=`${M0}${g.join(`
10673
- `)}`}if(Z&&Z0.includes("{{ text || slot }}"))Z0=Z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:l}=await t("stx/slots",()=>Promise.resolve().then(() => (TX(),NX))),{defaultSlot:J0,namedSlots:D0}=M;Z0=await l(Z0,J0,D0,T);let v0=E.some((C)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(C)),j5=ez(E),r=Array.isArray(T.__stx_client_signal_names)?T.__stx_client_signal_names:[];if(j5.length>0||r.length>0)T.__stx_client_signal_names=[...new Set([...r,...j5])];let e={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:u.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:v0||E.length===0,defaultLayout:void 0};T.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let K0=await F0(Z0,T,L,e,q),x0=new Set(Array.isArray(Y.__stx_preserved_client_expressions)?Y.__stx_preserved_client_expressions:[]);for(let C of K0.matchAll(/\{\{([\s\S]*?)\}\}/g))x0.add(C[1].trim());if(x0.size>0)Y.__stx_preserved_client_expressions=[...x0];let V0=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++cz}_${Math.random().toString(36).slice(2,8)}`,P=K0;if(v0){let C="";if(Object.keys(X).length>0)try{C=` data-stx-props="${zJ(JSON.stringify(X))}"`}catch{}let g=B?` stx-hydrate="${zJ(B)}"`:"";P=`<div data-stx-scope="${V0}"${C}${g}>${K0}</div>`;let c=await Promise.all(E.map(async(d)=>{let w0=d.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!w0)return d;let[,N0,B1]=w0,o0=I8(B1,{filePath:L,projectRoot:process.cwd()}),h0=o0.code,e0=E8(o0.styles);h0=M5(h0).code;let{hasUserImports:l1,bundleClientScript:k1}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (T5(),M7)));if(l1(h0))h0=await k1(h0,L,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:B5}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (d7(),Q$)));h0=h0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(_1,z8)=>B5(z8));let z0=p0(h0),o=nz(z0),l0=`function(__scopeId) {
10674
- ${R5("const",[...G2,...o],z0)}
10671
+ ${F.map((c)=>` - ${c}`).join(`
10672
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${v}`}q.add(L);let V;if(U$.has(L))V=U$.get(L);else try{V=await Bun.file(L).text(),U$.set(L,V)}catch(v){return`[Error loading component: ${v instanceof Error?v.message:String(v)}]`}let A=new Set(["__originalFilePath","__importedComponents",P8,"__stx_client_signal_names"]),R={};for(let[v,c]of Object.entries(Y))if(!v.startsWith("__")||A.has(v))R[v]=c;let N=U1(Z),T=[],k=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(v,c)=>{let j0=N.scripts[Number(c)]||"",X0=j0.match(/^<script\b([^>]*)>/i)?.[1]||"",I0=X0.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),E0=!I0||["module","text/javascript","application/javascript"].includes(I0);if(!/\bserver\b/i.test(X0)&&E0)return T.push(j0),"";return j0}),{extractSlotContent:M}=await $0("stx/slots",()=>Promise.resolve().then(() => (EX(),IX))),E=M(k),I={};if(E.defaultSlot?.trim())I.default=E.defaultSlot;for(let[v,c]of E.namedSlots)I[v]=c.content;let S={...R,...X,props:X,slot:k,$slots:I,__processedComponents:z,__sections:{},__stx_signals_gate:N1(V)||XU(Z)};ez(V,S);let b=V,y=d8(b);if(y)b=y.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x=[...V.matchAll(P)],f=[],u=x.some((v)=>/\bserver\b/.test(v[1]||"")&&/\bcache\b/.test(v[1]||""))&&x.every((v)=>/\bserver\b/.test(v[1]||"")),l=null,H0=null;if(u){let v=rz({props:X,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(v!==null){l=`${L}\x00${v}`;let c=X4.get(l);if(c){for(let j0 of c.dependencies)q.add(j0);return c.output}H0=new Set(q)}}for(let v of x){let c=v[1]||"",j0=v[2]||"",X0=c.includes("server");if(e1(c)&&j0.trim())j0=$5(j0);if(X0&&j0)try{await W(j0,S,L)}catch(E0){}if(!X0){let E0=j0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),y1=E0.includes("{{")&&E0.includes("}}"),c0=E0.includes("{!!")&&E0.includes("!!}");if(y1||c0)E0=h8(E0,S);let g0=c.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),z0=S0?S0[1]:"",k0=S0?S0[2]:"",d="",Y0=z0&&/\bscoped\b/i.test(z0);if(S0)d=`<style${z0}>${k0}</style>`;let Q0=b;if(Q0=Q0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),S0)Q0=Q0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let v=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,c=[];if(Q0=Q0.replace(v,(j0,X0)=>{let I0=X0.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(I0)c.push(`<style${I0[1]}>${I0[2]}</style>`);return""}),Q0=Q0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),c.length>0)d=`${d}${c.join(`
10673
+ `)}`}if(Z&&Q0.includes("{{ text || slot }}"))Q0=Q0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:d0}=await $0("stx/slots",()=>Promise.resolve().then(() => (EX(),IX))),{defaultSlot:Y7,namedSlots:r}=E;Q0=await d0(Q0,Y7,r,S);let e=f.some((v)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(v)),U0=ZU(f),m0=Array.isArray(S.__stx_client_signal_names)?S.__stx_client_signal_names:[];if(U0.length>0||m0.length>0)S.__stx_client_signal_names=[...new Set([...m0,...U0])];let C0={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:h.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:e||f.length===0,defaultLayout:void 0};S.__stxProcessingDepth=(Y.__stxProcessingDepth||0)+1;let C=await R0(Q0,S,L,C0,q),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_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++nz}_${Math.random().toString(36).slice(2,8)}`,p=C;if(e){let v="";if(Object.keys(X).length>0)try{v=` data-stx-props="${_J(JSON.stringify(X))}"`}catch{}let c=B?` stx-hydrate="${_J(B)}"`:"";p=`<div data-stx-scope="${s}"${v}${c}>${C}</div>`;let j0=await Promise.all(f.map(async(X0)=>{let I0=X0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!I0)return X0;let[,E0,y1]=I0,c0=b8(y1,{filePath:L,projectRoot:process.cwd()}),g0=c0.code,K1=S8(c0.styles);g0=E5(g0).code;let{hasUserImports:r1,bundleClientScript:a}=await $0("stx/client-script-bundler",()=>Promise.resolve().then(() => (I5(),D7)));if(r1(g0))g0=await a(g0,L,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:X1}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (l7(),K$)));g0=g0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(L1,_8)=>X1(_8));let _0=r0(g0),o1=sz(_0),s1=`function(__scopeId) {
10674
+ ${M5("const",[...W2,...o1],_0)}
10675
10675
  const __scope = window.stx._scopes = window.stx._scopes || {};
10676
10676
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
10677
10677
  __scopeVars.$refs = __scopeVars.$refs || {};
@@ -10685,12 +10685,12 @@ ${F.map((g)=>` - ${g}`).join(`
10685
10685
  const onDestroy = (fn) => __scopeVars.__destroyCallbacks.push(fn);
10686
10686
 
10687
10687
  try {
10688
- ${z0}
10688
+ ${_0}
10689
10689
 
10690
10690
  // Register all defined signals and functions in this scope
10691
10691
  const __localVars = {};
10692
10692
  try {
10693
- ${o.map((_1)=>`if (typeof ${_1} !== 'undefined') __localVars['${_1}'] = ${_1};`).join(`
10693
+ ${o1.map((L1)=>`if (typeof ${L1} !== 'undefined') __localVars['${L1}'] = ${L1};`).join(`
10694
10694
  `)}
10695
10695
  }
10696
10696
  catch (e) {}
@@ -10699,29 +10699,31 @@ catch (e) {}
10699
10699
  finally {
10700
10700
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
10701
10701
  }
10702
- }`,$7=B?null:v2(Y,l0),_5=$7?`window.__stxComponentFactories[${JSON.stringify($7)}](${JSON.stringify(V0)});`:`(${l0})(${JSON.stringify(V0)});`;if(B)return`${e0}<script type="stx/island" data-stx-island="${V0}" data-stx-scoped${N0}>${_5}</script>`;return`${e0}<script data-stx-scoped data-stx-run="always"${N0}>${_5}</script>`}));if(P=P+`
10703
- `+c.join(`
10704
- `),M0)P+=`
10705
- `+M0}else{if(M0)P+=`
10706
- `+M0;if(E.length>0){let C=T.__stx_event_bindings||[],g=E7(T),c=await Promise.all(E.map(async(d)=>{let w0=d.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!w0)return d;return await D7(w0[1],{eventBindings:C,templateContent:P,filePath:L,projectRoot:process.cwd(),serverData:g})}));P+=`
10707
- `+c.join(`
10708
- `),T.__stx_event_bindings=[]}}if(j0){let C=x8(P,L);if(C.hasScoped)P=C.html}if(x&&f)aX.set(x,{output:P,dependencies:[...q].filter((C)=>!f.has(C))});return P}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{K.delete($)}}async function n($){return Bun.file($).exists()}function tX($,X){let Z=u.resolve(X),J=u.resolve($),Y=Z.endsWith(u.sep)?Z:Z+u.sep;if(J===Z||J.startsWith(Y))return J;return null}async function eX($,X,Z,J){let Y=await $U($,X,Z,J);if(Y===null)return null;let G=tX(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 q=u.isAbsolute(w)?w:u.resolve(process.cwd(),w);if(tX(Y,q))return u.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${X})`),null}async function $U($,X,Z,J){if(Z.debug)console.log(`Resolving template path: ${$} from ${X}`);let Y=u.dirname(X),G=process.cwd();if($.startsWith("/")){let U=u.join(G,$),B=tX(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 n(B)&&J)J.add(B);return B}let Q=u.join(Y,$);if(await n(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 n(B)){if(Z.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}let w="",q=u.resolve(Y),W=process.cwd();for(let U=0;U<10;U++){let B=u.join(q,"layouts"),j=!1;try{j=mz.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){w=B;break}let _=u.dirname(q);if(_===q||_.length<W.length)break;q=_}if(w){let U=$.startsWith("layouts/")?$.slice(8):$,B=u.join(w,U);if(await n(B)){if(Z.debug)console.log(`Found in current layouts dir: ${B}`);if(J)J.add(B);return B}if(!U.endsWith(".stx")){let j=`${B}.stx`;if(await n(j)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Z.layoutsDir){let U=u.isAbsolute(Z.layoutsDir)?Z.layoutsDir:u.resolve(process.cwd(),Z.layoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=u.join(U,B);if(await n(j)){if(Z.debug)console.log(`Found in options.layoutsDir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await n(_)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(J)J.add(_);return _}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let U=$.split("layouts/"),B=u.join(Z.partialsDir||Y,"layouts",U[1]);if(await n(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 n(j)){if(Z.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(Z.partialsDir){if(w=u.join(Z.partialsDir,"layouts"),await n(w)){let U=u.join(w,$);if(await n(U)){if(Z.debug)console.log(`Found in partials layouts dir: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let B=`${U}.stx`;if(await n(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||u.join(process.cwd(),"views"),z=u.join(K,$);if(await n(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 n(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=u.join(u.dirname(Y),"layouts",$);if(await n(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 n(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 UJ($,X,Z){let J=0,Y="",G="";try{if(typeof X==="number"&&X>=0){let Q=$.split(`
10702
+ }`,B8=B?null:h2(Y,s1),L5=B8?`window.__stxComponentFactories[${JSON.stringify(B8)}](${JSON.stringify(s)});`:`(${s1})(${JSON.stringify(s)});`;if(B)return`${K1}<script type="stx/island" data-stx-island="${s}" data-stx-scoped${E0}>${L5}</script>`;return`${K1}<script data-stx-scoped data-stx-run="always"${E0}>${L5}</script>`}));if(p=p+`
10703
+ `+j0.join(`
10704
+ `),d)p+=`
10705
+ `+d}else{if(d)p+=`
10706
+ `+d;if(f.length>0){let v=S.__stx_event_bindings||[],c=S7(S),j0=await Promise.all(f.map(async(X0)=>{let I0=X0.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!I0)return X0;return await C7(I0[1],{eventBindings:v,templateContent:p,filePath:L,projectRoot:process.cwd(),serverData:c})}));p+=`
10707
+ `+j0.join(`
10708
+ `),S.__stx_event_bindings=[]}}if(Y0){let v=u8(p,L);if(v.hasScoped)p=v.html}if(l&&H0)X4.set(l,{output:p,dependencies:[...q].filter((v)=>!H0.has(v))});return T.length>0?`${p}
10709
+ ${T.join(`
10710
+ `)}`:p}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{K.delete($)}}async function n($){return Bun.file($).exists()}function Z4($,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 J4($,X,Z,J){let Y=await JU($,X,Z,J);if(Y===null)return null;let G=Z4(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 q=h.isAbsolute(w)?w:h.resolve(process.cwd(),w);if(Z4(Y,q))return h.resolve(Y)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Y} (template: ${$}, from: ${X})`),null}async function JU($,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=Z4(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 n(B)&&J)J.add(B);return B}let Q=h.join(Y,$);if(await n(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 n(B)){if(Z.debug)console.log(`Found direct path with extension: ${B}`);if(J)J.add(B);return B}}let w="",q=h.resolve(Y),W=process.cwd();for(let U=0;U<10;U++){let B=h.join(q,"layouts"),j=!1;try{j=iz.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){w=B;break}let _=h.dirname(q);if(_===q||_.length<W.length)break;q=_}if(w){let U=$.startsWith("layouts/")?$.slice(8):$,B=h.join(w,U);if(await n(B)){if(Z.debug)console.log(`Found in current layouts dir: ${B}`);if(J)J.add(B);return B}if(!U.endsWith(".stx")){let j=`${B}.stx`;if(await n(j)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(J)J.add(j);return j}}}if(Z.layoutsDir){let U=h.isAbsolute(Z.layoutsDir)?Z.layoutsDir:h.resolve(process.cwd(),Z.layoutsDir),B=$.startsWith("layouts/")?$.slice(8):$,j=h.join(U,B);if(await n(j)){if(Z.debug)console.log(`Found in options.layoutsDir: ${j}`);if(J)J.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await n(_)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(J)J.add(_);return _}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let U=$.split("layouts/"),B=h.join(Z.partialsDir||Y,"layouts",U[1]);if(await n(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 n(j)){if(Z.debug)console.log(`Found in layouts path with extension: ${j}`);if(J)J.add(j);return j}}}if(Z.partialsDir){if(w=h.join(Z.partialsDir,"layouts"),await n(w)){let U=h.join(w,$);if(await n(U)){if(Z.debug)console.log(`Found in partials layouts dir: ${U}`);if(J)J.add(U);return U}if(!$.endsWith(".stx")){let B=`${U}.stx`;if(await n(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 n(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 n(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 n(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 n(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 HJ($,X,Z){let J=0,Y="",G="";try{if(typeof X==="number"&&X>=0){let Q=$.split(`
10709
10711
  `),w=0;for(let q=0;q<Q.length;q++)if(w+=Q[q].length+1,w>=X){J=q+1,Y=Q[q].trim();let W=Math.max(0,q-2),K=Math.min(Q.length,q+3);G=Q.slice(W,K).map((z,U)=>{let B=W+U+1;return`${B===J?"> ":" "}${B}: ${z}`}).join(`
10710
- `);break}}else if(Z){let Q=$.indexOf(Z);if(Q>=0)return UJ($,Q)}}catch{}return{lineNumber:J,lineContent:Y,context:G}}function B0($,X,Z,J,Y,G){let{lineNumber:Q,context:w}=UJ(J,Y,G),q=Z.split("/").pop(),W=0;if(typeof Y==="number"&&Y>=0&&J){let z=J.lastIndexOf(`
10712
+ `);break}}else if(Z){let Q=$.indexOf(Z);if(Q>=0)return HJ($,Q)}}catch{}return{lineNumber:J,lineContent:Y,context:G}}function O0($,X,Z,J,Y,G){let{lineNumber:Q,context:w}=HJ(J,Y,G),q=Z.split("/").pop(),W=0;if(typeof Y==="number"&&Y>=0&&J){let z=J.lastIndexOf(`
10711
10713
  `,Math.max(0,Y-1));W=Y-(z+1)+1}let K="";if(Q>0)K+=`
10712
10714
  ${Z}:${Q}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${X}
10713
10715
  `;if(K+=`
10714
- ${$0.bold}${$0.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${$0.reset}
10715
- `,K+=`${$0.bold}${$0.red}\u2502${$0.reset} ${$0.bold}${$0.bgRed} ERROR ${$0.reset} ${$0.red}${$} Error${$0.reset}${" ".repeat(Math.max(0,43-$.length))}${$0.bold}${$0.red}\u2502${$0.reset}
10716
- `,K+=`${$0.bold}${$0.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${$0.reset}
10716
+ ${Z0.bold}${Z0.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${Z0.reset}
10717
+ `,K+=`${Z0.bold}${Z0.red}\u2502${Z0.reset} ${Z0.bold}${Z0.bgRed} ERROR ${Z0.reset} ${Z0.red}${$} Error${Z0.reset}${" ".repeat(Math.max(0,43-$.length))}${Z0.bold}${Z0.red}\u2502${Z0.reset}
10718
+ `,K+=`${Z0.bold}${Z0.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${Z0.reset}
10717
10719
  `,K+=`
10718
- ${$0.cyan}${$0.bold}File:${$0.reset} ${$0.dim}${q}${$0.reset}`,Q>0)K+=` ${$0.gray}(line ${Q}${W>0?`, col ${W}`:""})${$0.reset}`;if(K+=`
10719
- ${$0.yellow}${$0.bold}Message:${$0.reset} ${X}
10720
+ ${Z0.cyan}${Z0.bold}File:${Z0.reset} ${Z0.dim}${q}${Z0.reset}`,Q>0)K+=` ${Z0.gray}(line ${Q}${W>0?`, col ${W}`:""})${Z0.reset}`;if(K+=`
10721
+ ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${X}
10720
10722
  `,w)K+=`
10721
- ${$0.blue}${$0.bold}Context:${$0.reset}
10722
- ${$0.dim}${w}${$0.reset}
10723
- `;return K}function aZ(){q$.clear(),W$.clear(),aX.clear()}var q$,W$,aX,cz=0,w$,$0;var y0=y(()=>{y7();KX();W1();$1();D5();z$();D1();_X();HX();T7();WZ();f7();q$=new s1(500),W$=new s1(1000),aX=new s1(2000);w$=new Map;$0={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 jJ($,X,Z=""){let J=$,Y=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec($))!==null){let w=Q.index,q=Q[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",K=w+Q[0].length,z=1,U=K,B=-1;while(z>0&&U<$.length){let H=$.indexOf("@markdown",U),L=$.indexOf("@endmarkdown",U);if(L===-1)break;if(H!==-1&&H<L&&H!==w){let O=$[H+9];if(O==="("||O===`
10724
- `||O==="\r"||O===" "||O===void 0)z++;U=H+9}else{if(z--,z===0){B=L;break}U=L+12}}if(B===-1)continue;let j=$.slice(K,B),_=$.slice(w,B+12);Y.push({fullMatch:_,options:W,content:j,index:w}),G.lastIndex=B+12}for(let{fullMatch:w,options:q,content:W,index:K}of Y)try{let z={};if(q)q.split(",").forEach((j)=>{let _=j.trim();if(_)z[_]=!0});let U={gfm:z.gfm??!0,breaks:z.breaks??!1},B=N7(W.trim(),U);J=J.split(w).join(B)}catch(z){let U=z instanceof Error?z.message:String(z),B=B0("Markdown Directive",`Error processing markdown: ${U}`,Z,$,K,w);J=J.split(w).join(B)}return J}async function BJ($,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}),N7($.trim(),Y)}var $4=y(()=>{y0()});function JU($){if(XU.set($.name,$),$.client)ZU.set($.name,$.client)}function U$($){return JU($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Z,J,Y,G)=>{let Q=YU(J,$.defaults);if($.validate){let q=$.validate(Q);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let w=Z;if($.transform)w=await $.transform(Z,Q,Y,G);if($.clientScript){let q=$.clientScript(Q);w+=`<script>${q}</script>`}if($.css){let q=$.css(Q);w+=`<style>${q}</style>`}return w}}}function YU($,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(),q=J.slice(Q+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Z[w]=q}else{let w=Object.keys(Z).filter((q)=>!X||!(q in X)).length;Z[w===0?"value":`arg${w}`]=J}}return Z}var XU,ZU;var X4=y(()=>{XU=new Map,ZU=new Map});function Z4($,X=C5,Z={},J){return X.sort((Y,G)=>Y-G).map((Y)=>{return`${c7($,{...Z,w:Y,fm:J})} ${Y}w`}).join(", ")}function _J($,X,Z=GU,J={},Y){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round(X*G);return`${c7($,{...J,w:Q,dpr:G,fm:Y})} ${G}x`}).join(", ")}function J4($,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 c7($,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 Y4($){return QU[$]||"application/octet-stream"}var C5,GU,m7,QU;var G4=y(()=>{C5=[320,480,640,768,1024,1280,1536,1920,2560],GU=[1,1.5,2,3],m7=["avif","webp","jpeg"],QU={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function qU(){try{return await import("ts-images")}catch{return null}}async function WU($,X={}){let Z={...wU,...X},J=await qU();if(J)try{return await KU($,Z,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return zU($,Z)}async function KU($,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 zU($,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 HJ($,X,Z={}){let J=Z.transitionDuration||300,Y=Z.easing||"ease-out";return`
10723
+ ${Z0.blue}${Z0.bold}Context:${Z0.reset}
10724
+ ${Z0.dim}${w}${Z0.reset}
10725
+ `;return K}function XJ(){U$.clear(),j$.clear(),X4.clear()}var U$,j$,X4,nz=0,z$,Z0;var A0=D(()=>{P7();BX();j1();Z1();C5();_$();C1();FX();VX();E7();v1();jZ();u7();U$=new X5(500),j$=new X5(1000),X4=new X5(2000);z$=new Map;Z0={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function OJ($,X,Z=""){let J=$,Y=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec($))!==null){let w=Q.index,q=Q[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",K=w+Q[0].length,z=1,U=K,B=-1;while(z>0&&U<$.length){let H=$.indexOf("@markdown",U),L=$.indexOf("@endmarkdown",U);if(L===-1)break;if(H!==-1&&H<L&&H!==w){let O=$[H+9];if(O==="("||O===`
10726
+ `||O==="\r"||O===" "||O===void 0)z++;U=H+9}else{if(z--,z===0){B=L;break}U=L+12}}if(B===-1)continue;let j=$.slice(K,B),_=$.slice(w,B+12);Y.push({fullMatch:_,options:W,content:j,index:w}),G.lastIndex=B+12}for(let{fullMatch:w,options:q,content:W,index:K}of Y)try{let z={};if(q)q.split(",").forEach((j)=>{let _=j.trim();if(_)z[_]=!0});let U={gfm:z.gfm??!0,breaks:z.breaks??!1},B=I7(W.trim(),U);J=J.split(w).join(B)}catch(z){let U=z instanceof Error?z.message:String(z),B=O0("Markdown Directive",`Error processing markdown: ${U}`,Z,$,K,w);J=J.split(w).join(B)}return J}async function LJ($,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}),I7($.trim(),Y)}var Y4=D(()=>{A0()});function QU($){if(YU.set($.name,$),$.client)GU.set($.name,$.client)}function H$($){return QU($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Z,J,Y,G)=>{let Q=wU(J,$.defaults);if($.validate){let q=$.validate(Q);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let w=Z;if($.transform)w=await $.transform(Z,Q,Y,G);if($.clientScript){let q=$.clientScript(Q);w+=`<script>${q}</script>`}if($.css){let q=$.css(Q);w+=`<style>${q}</style>`}return w}}}function wU($,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(),q=J.slice(Q+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Z[w]=q}else{let w=Object.keys(Z).filter((q)=>!X||!(q in X)).length;Z[w===0?"value":`arg${w}`]=J}}return Z}var YU,GU;var G4=D(()=>{YU=new Map,GU=new Map});function Q4($,X=f5,Z={},J){return X.sort((Y,G)=>Y-G).map((Y)=>{return`${i7($,{...Z,w:Y,fm:J})} ${Y}w`}).join(", ")}function FJ($,X,Z=qU,J={},Y){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round(X*G);return`${i7($,{...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 i7($,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 WU[$]||"application/octet-stream"}var f5,qU,p7,WU;var W4=D(()=>{f5=[320,480,640,768,1024,1280,1536,1920,2560],qU=[1,1.5,2,3],p7=["avif","webp","jpeg"],WU={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function zU(){try{return await import("ts-images")}catch{return null}}async function UU($,X={}){let Z={...KU,...X},J=await zU();if(J)try{return await jU($,Z,J)}catch(Y){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Y}`)}return BU($,Z)}async function jU($,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 BU($,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 VJ($,X,Z={}){let J=Z.transitionDuration||300,Y=Z.easing||"ease-out";return`
10725
10727
  #${$} {
10726
10728
  --stx-img-transition-duration: ${J}ms;
10727
10729
  --stx-img-transition-easing: ${Y};
@@ -10738,7 +10740,7 @@ ${$0.dim}${w}${$0.reset}
10738
10740
  #${$}.stx-img-loaded img {
10739
10741
  opacity: 1;
10740
10742
  }
10741
- `.trim()}async function OJ($,X={}){let Z=`${$}:${JSON.stringify(X)}`;if(Q4.has(Z))return Q4.get(Z);let J=await WU($,X);return Q4.set(Z,J),J}var wU,w4,Q4;var LJ=y(()=>{wU={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},w4=`
10743
+ `.trim()}async function AJ($,X={}){let Z=`${$}:${JSON.stringify(X)}`;if(K4.has(Z))return K4.get(Z);let J=await UU($,X);return K4.set(Z,J),J}var KU,z4,K4;var RJ=D(()=>{KU={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},z4=`
10742
10744
  .stx-img-placeholder {
10743
10745
  position: relative;
10744
10746
  overflow: hidden;
@@ -10767,20 +10769,20 @@ ${$0.dim}${w}${$0.reset}
10767
10769
  filter: blur(0);
10768
10770
  transform: scale(1);
10769
10771
  }
10770
- `.trim();Q4=new Map});import{createHash as VJ}from"crypto";import{readFile as UU,stat as AJ}from"fs/promises";async function f0($){try{let X=await UU($);return VJ("sha256").update(X).digest("hex").slice(0,16)}catch{return""}}function FJ($){return VJ("sha256").update($).digest("hex").slice(0,16)}function j$($,X){let Z=JSON.stringify(X,Object.keys(X).sort());return`${FJ($)}-${FJ(Z)}`}async function q4($){try{return(await AJ($)).mtimeMs}catch{return 0}}async function S0($){try{return await AJ($),!0}catch{return!1}}var J5=()=>{};import{mkdir as jU,readFile as BU,writeFile as _U,readdir as cR,rm as HU,stat as lR}from"fs/promises";import{join as NJ,dirname as OU}from"path";async function LU($){try{await jU($,{recursive:!0})}catch{}}function TJ($,X,Z){return NJ($,Z,`${X}.json`)}async function RJ($,X,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await q4(X)!==$.srcMtime)return!1;return!0}async function B$($,X,Z,J=W4){if(!J.enabled)return null;let Y=j$($,X),G=P5.get(Y);if(G){if(await RJ(G,$,J.maxAge))return G.lastAccessedAt=Date.now(),G.data;P5.delete(Y)}let Q=TJ(J.directory,Y,Z);if(await S0(Q))try{let w=await BU(Q,"utf-8"),q=JSON.parse(w);if(await RJ(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),P5.set(Y,q),q.data}catch{}return null}async function _$($,X,Z,J,Y=W4){if(!Y.enabled)return;let G=j$($,X),Q=await f0($),w=await q4($),q={key:G,src:$,srcHash:Q,srcMtime:w,optionsHash:j$("",X),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};P5.set(G,q);let W=TJ(Y.directory,G,J);try{await LU(OU(W)),await _U(W,JSON.stringify(q,null,2))}catch(K){console.warn(`[stx-media] Failed to write cache: ${K}`)}}async function H$($,X=W4){if($==="all")P5.clear();else P5.clear();let Z=$==="all"?["image","video"]:[$];for(let J of Z){let Y=NJ(X.directory,J);try{await HU(Y,{recursive:!0,force:!0})}catch{}}}var P5,W4;var K4=y(()=>{J5();P5=new Map,W4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class L${config;constructor($={}){this.config={...FU,...$}}async get($,X){return B$($,X,"image",this.config)}async set($,X,Z){return _$($,X,Z,"image",this.config)}async clear(){return H$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function z4($){if(!O$)O$=new L$($);else if($)O$.updateConfig($);return O$}async function F$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return z4(J).get($,X)}async function V$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return z4(Y).set($,X,Z)}async function MJ(){return z4().clear()}var FU,O$=null;var U4=y(()=>{K4();FU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as VU,basename as AU,extname as RU,join as NU}from"path";import{mkdir as TU}from"fs/promises";async function j4(){try{return await import("ts-images")}catch{return null}}function kJ($){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 MU($,X){let Z=X?kJ(X):kJ("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 IJ($,X,Z){let J=await j4();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Y=await F$($,X,Z);if(Y)return Y;try{let G=VU($);if(!await S0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let Q=MU(Z,X.preset),w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await TU(w,{recursive:!0});let W=await f0(G),K=AU($,RU($)),z=X.outputFormat?[X.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],U={src:$,processed:!0,variants:[],hash:W},B=null;if(X.transformations&&X.transformations.length>0)B=await B4(G,X.transformations,J);for(let j of z){let _=Q[j]||{},H=`${K}-${W}.${j}`,L=NU(w,H);try{let O=await J.optimizeImage({input:B||G,output:L,format:j,quality:_.quality,progressive:_.progressive});if(O){if(U.variants.push({path:L,url:`${q}/${H}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!U.originalWidth&&O.width)U.originalWidth=O.width,U.originalHeight=O.height}}catch(O){U.errors=U.errors||[],U.errors.push(`Failed to optimize ${j}: ${O}`)}}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 V$($,X,U,Z),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function EJ($,X,Z,J){let Y=await j4();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 B4($,X,Z){let J=Z||await j4();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 DJ=y(()=>{J5();U4()});import{resolve as kU,basename as IU,extname as EU,join as DU}from"path";import{mkdir as yU}from"fs/promises";async function bU(){try{return await import("ts-images")}catch{return null}}async function yJ($,X,Z){let J=await bU();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Y=kU($);if(!await S0(Y))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let G=X.responsiveWidths||Z.breakpoints||SU,Q=X.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await yU(w,{recursive:!0});let W=await f0(Y),K=IU($,EU($)),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 _=[];for(let H of G){let L=`${K}-${H}w-${W}.${j}`,O=DU(w,L),F=`${q}/${L}`;try{let V=z[j]?.quality||80;if(await S0(O)){U.byFormat[j].push({path:O,url:F,width:H,height:0,format:j,size:0}),_.push(`${F} ${H}w`);continue}let A=await J.processImage({input:Y,output:O,format:j,quality:V,resize:{width:H}});if(A)U.byFormat[j].push({path:O,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),_.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${j} at ${H}w: ${V}`)}}U.srcsets[j]=_.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||CU(G),U}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function CU($){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 bJ($,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 SU;var SJ=y(()=>{J5();SU=[320,480,640,768,1024,1280,1536,1920]});var CJ={};a(CJ,{setCachedImageResult:()=>V$,processImage:()=>IJ,optimizeImage:()=>EJ,getCachedImageResult:()=>F$,generateSrcset:()=>bJ,generateResponsiveVariants:()=>yJ,clearImageCache:()=>MJ,applyTransformations:()=>B4,ImageProcessorCache:()=>L$});var PJ=y(()=>{DJ();SJ();U4()});async function PU(){try{return await Promise.resolve().then(() => (PJ(),CJ))}catch($){if(!vJ)console.warn("[stx-media] Image processor not available, some features disabled:",$),vJ=!0;return null}}async function A$($,X={}){let Z=X,J=$;if(J.process&&!J.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return gU(J,Z)}if(Z.processedResult?.processed)return L4($,Z.processedResult,X);if(Z.responsiveVariants)return hJ($,Z.responsiveVariants,X);let{src:Y,alt:G,width:Q,height:w,sizes:q,widths:W=C5,dpr:K,formats:z=m7,quality:U=_4,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:H=!0,priority:L=!1,loading:O=L?"eager":N$,decoding:F=R$,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:M}=$,k=$.class,T=$.style,D=$.id,I=$.data||{},{isDev:S=!1,baseUrl:b=""}=X;if(S&&!X.optimize)return fU($);let E,v,x=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!L)try{E=await OJ(Y,{strategy:j,..._}),v=HJ(x,E,_)}catch{}let f=K!==void 0&&Q!==void 0,h;if(f)h=xU($,x,E,X);else h=await vU($,x,E,X);let p;if(L){let j0=z.includes("webp")?"webp":z[0],Z0=Z4(Y,W,{...B,q:U},j0),l=typeof q==="object"?J4(q):q||"100vw";p=`<link rel="preload" as="image" imagesrcset="${Z0}" imagesizes="${l}" />`}let H0=[];if(!xJ&&j!=="none")H0.push(w4),xJ=!0;if(v)H0.push(v);let M0=H?gJ(x):void 0;return{html:h,preloadLink:p,css:H0.length>0?H0.join(`
10771
- `):void 0,script:M0}}async function vU($,X,Z,J){let{src:Y,alt:G,width:Q,height:w,sizes:q,widths:W=C5,formats:K=m7,quality:z=_4,params:U={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":N$,decoding:H=R$,fetchpriority:L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A}=$,R=$.class,N=$.style,M=$.data||{},k=typeof q==="object"?J4(q):q||"100vw",T=[];for(let S of K){let b=Z4(Y,W,{...U,q:z},S),E=Y4(S);if(B&&!j)T.push(` <source type="${E}" data-srcset="${b}" data-sizes="${k}" />`);else T.push(` <source type="${E}" srcset="${b}" sizes="${k}" />`)}let D=H4({src:c7(Y,{...U,q:z}),alt:G,width:Q,height:w,loading:j?void 0:_,decoding:H,fetchpriority:j?"high":L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A,className:fJ(R,Z),style:O4(N,O,F,Z),lazy:B&&!j,data:M}),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}">
10772
+ `.trim();K4=new Map});import{createHash as TJ}from"crypto";import{readFile as _U,stat as MJ}from"fs/promises";async function h0($){try{let X=await _U($);return TJ("sha256").update(X).digest("hex").slice(0,16)}catch{return""}}function NJ($){return TJ("sha256").update($).digest("hex").slice(0,16)}function O$($,X){let Z=JSON.stringify(X,Object.keys(X).sort());return`${NJ($)}-${NJ(Z)}`}async function U4($){try{return(await MJ($)).mtimeMs}catch{return 0}}async function v0($){try{return await MJ($),!0}catch{return!1}}var q5=()=>{};import{mkdir as HU,readFile as OU,writeFile as LU,readdir as rR,rm as FU,stat as oR}from"fs/promises";import{join as IJ,dirname as VU}from"path";async function AU($){try{await HU($,{recursive:!0})}catch{}}function EJ($,X,Z){return IJ($,Z,`${X}.json`)}async function kJ($,X,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await U4(X)!==$.srcMtime)return!1;return!0}async function L$($,X,Z,J=j4){if(!J.enabled)return null;let Y=O$($,X),G=g5.get(Y);if(G){if(await kJ(G,$,J.maxAge))return G.lastAccessedAt=Date.now(),G.data;g5.delete(Y)}let Q=EJ(J.directory,Y,Z);if(await v0(Q))try{let w=await OU(Q,"utf-8"),q=JSON.parse(w);if(await kJ(q,$,J.maxAge))return q.lastAccessedAt=Date.now(),g5.set(Y,q),q.data}catch{}return null}async function F$($,X,Z,J,Y=j4){if(!Y.enabled)return;let G=O$($,X),Q=await h0($),w=await U4($),q={key:G,src:$,srcHash:Q,srcMtime:w,optionsHash:O$("",X),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};g5.set(G,q);let W=EJ(Y.directory,G,J);try{await AU(VU(W)),await LU(W,JSON.stringify(q,null,2))}catch(K){console.warn(`[stx-media] Failed to write cache: ${K}`)}}async function V$($,X=j4){if($==="all")g5.clear();else g5.clear();let Z=$==="all"?["image","video"]:[$];for(let J of Z){let Y=IJ(X.directory,J);try{await FU(Y,{recursive:!0,force:!0})}catch{}}}var g5,j4;var B4=D(()=>{q5();g5=new Map,j4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class R${config;constructor($={}){this.config={...RU,...$}}async get($,X){return L$($,X,"image",this.config)}async set($,X,Z){return F$($,X,Z,"image",this.config)}async clear(){return V$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function _4($){if(!A$)A$=new R$($);else if($)A$.updateConfig($);return A$}async function N$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return _4(J).get($,X)}async function T$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return _4(Y).set($,X,Z)}async function DJ(){return _4().clear()}var RU,A$=null;var H4=D(()=>{B4();RU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as NU,basename as TU,extname as MU,join as kU}from"path";import{mkdir as IU}from"fs/promises";async function O4(){try{return await import("ts-images")}catch{return null}}function yJ($){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 EU($,X){let Z=X?yJ(X):yJ("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 bJ($,X,Z){let J=await O4();if(!J)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Y=await N$($,X,Z);if(Y)return Y;try{let G=NU($);if(!await v0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let Q=EU(Z,X.preset),w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await IU(w,{recursive:!0});let W=await h0(G),K=TU($,MU($)),z=X.outputFormat?[X.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],U={src:$,processed:!0,variants:[],hash:W},B=null;if(X.transformations&&X.transformations.length>0)B=await L4(G,X.transformations,J);for(let j of z){let _=Q[j]||{},H=`${K}-${W}.${j}`,L=kU(w,H);try{let O=await J.optimizeImage({input:B||G,output:L,format:j,quality:_.quality,progressive:_.progressive});if(O){if(U.variants.push({path:L,url:`${q}/${H}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!U.originalWidth&&O.width)U.originalWidth=O.width,U.originalHeight=O.height}}catch(O){U.errors=U.errors||[],U.errors.push(`Failed to optimize ${j}: ${O}`)}}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 T$($,X,U,Z),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function SJ($,X,Z,J){let Y=await O4();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 L4($,X,Z){let J=Z||await O4();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 CJ=D(()=>{q5();H4()});import{resolve as DU,basename as yU,extname as bU,join as SU}from"path";import{mkdir as CU}from"fs/promises";async function PU(){try{return await import("ts-images")}catch{return null}}async function PJ($,X,Z){let J=await PU();if(!J)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Y=DU($);if(!await v0(Y))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let G=X.responsiveWidths||Z.breakpoints||vU,Q=X.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await CU(w,{recursive:!0});let W=await h0(Y),K=yU($,bU($)),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 _=[];for(let H of G){let L=`${K}-${H}w-${W}.${j}`,O=SU(w,L),F=`${q}/${L}`;try{let V=z[j]?.quality||80;if(await v0(O)){U.byFormat[j].push({path:O,url:F,width:H,height:0,format:j,size:0}),_.push(`${F} ${H}w`);continue}let A=await J.processImage({input:Y,output:O,format:j,quality:V,resize:{width:H}});if(A)U.byFormat[j].push({path:O,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),_.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${j} at ${H}w: ${V}`)}}U.srcsets[j]=_.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||xU(G),U}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function xU($){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 vJ($,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 vU;var xJ=D(()=>{q5();vU=[320,480,640,768,1024,1280,1536,1920]});var fJ={};t(fJ,{setCachedImageResult:()=>T$,processImage:()=>bJ,optimizeImage:()=>SJ,getCachedImageResult:()=>N$,generateSrcset:()=>vJ,generateResponsiveVariants:()=>PJ,clearImageCache:()=>DJ,applyTransformations:()=>L4,ImageProcessorCache:()=>R$});var gJ=D(()=>{CJ();xJ();H4()});async function fU(){try{return await Promise.resolve().then(() => (gJ(),fJ))}catch($){if(!hJ)console.warn("[stx-media] Image processor not available, some features disabled:",$),hJ=!0;return null}}async function M$($,X={}){let Z=X,J=$;if(J.process&&!J.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return dU(J,Z)}if(Z.processedResult?.processed)return R4($,Z.processedResult,X);if(Z.responsiveVariants)return cJ($,Z.responsiveVariants,X);let{src:Y,alt:G,width:Q,height:w,sizes:q,widths:W=f5,dpr:K,formats:z=p7,quality:U=F4,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:H=!0,priority:L=!1,loading:O=L?"eager":I$,decoding:F=k$,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:T}=$,k=$.class,M=$.style,E=$.id,I=$.data||{},{isDev:S=!1,baseUrl:b=""}=X;if(S&&!X.optimize)return uU($);let y,P,x=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!L)try{y=await AJ(Y,{strategy:j,..._}),P=VJ(x,y,_)}catch{}let f=K!==void 0&&Q!==void 0,u;if(f)u=hU($,x,y,X);else u=await gU($,x,y,X);let l;if(L){let z0=z.includes("webp")?"webp":z[0],k0=Q4(Y,W,{...B,q:U},z0),d=typeof q==="object"?w4(q):q||"100vw";l=`<link rel="preload" as="image" imagesrcset="${k0}" imagesizes="${d}" />`}let H0=[];if(!uJ&&j!=="none")H0.push(z4),uJ=!0;if(P)H0.push(P);let S0=H?mJ(x):void 0;return{html:u,preloadLink:l,css:H0.length>0?H0.join(`
10773
+ `):void 0,script:S0}}async function gU($,X,Z,J){let{src:Y,alt:G,width:Q,height:w,sizes:q,widths:W=f5,formats:K=p7,quality:z=F4,params:U={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":I$,decoding:H=k$,fetchpriority:L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A}=$,R=$.class,N=$.style,T=$.data||{},k=typeof q==="object"?w4(q):q||"100vw",M=[];for(let S of K){let b=Q4(Y,W,{...U,q:z},S),y=q4(S);if(B&&!j)M.push(` <source type="${y}" data-srcset="${b}" data-sizes="${k}" />`);else M.push(` <source type="${y}" srcset="${b}" sizes="${k}" />`)}let E=V4({src:i7(Y,{...U,q:z}),alt:G,width:Q,height:w,loading:j?void 0:_,decoding:H,fetchpriority:j?"high":L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A,className:dJ(R,Z),style:A4(N,O,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}">
10772
10774
  <picture>
10773
- ${T.join(`
10775
+ ${M.join(`
10774
10776
  `)}
10775
- <img ${D} />
10777
+ <img ${E} />
10776
10778
  </picture>
10777
10779
  </div>`}else I=`<picture${X?` id="${X}"`:""}>
10778
- ${T.join(`
10780
+ ${M.join(`
10779
10781
  `)}
10780
- <img ${D} />
10781
- </picture>`;return I}function xU($,X,Z,J){let{src:Y,alt:G,width:Q,height:w,dpr:q=[1,2,3],quality:W=_4,params:K={},lazy:z=!0,priority:U=!1,loading:B=U?"eager":N$,decoding:j=R$,fetchpriority:_,objectFit:H,objectPosition:L,crossorigin:O,referrerpolicy:F}=$,V=$.class,A=$.style,R=$.data||{},N=typeof Q==="number"?Q:Number.parseInt(String(Q),10),M=_J(Y,N,q,{...K,q:W}),k=H4({src:c7(Y,{...K,w:N,q:W}),alt:G,width:Q,height:w,loading:U?void 0:B,decoding:j,fetchpriority:U?"high":_,objectFit:H,objectPosition:L,crossorigin:O,referrerpolicy:F,className:fJ(V,Z),style:O4(A,H,L,Z),lazy:z&&!U,data:R}),T=z&&!U?`data-srcset="${M}"`:`srcset="${M}"`;if(Z){let D=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${X}" class="stx-img-placeholder" style="${D}">
10782
- <img ${k} ${T} />
10783
- </div>`}return`<img ${X?`id="${X}" `:""}${k} ${T} />`}function fU($){let{src:X,alt:Z,width:J,height:Y,loading:G=N$,decoding:Q=R$,fetchpriority:w,objectFit:q,objectPosition:W,crossorigin:K,referrerpolicy:z,priority:U=!1}=$,B=$.class,j=$.style,_=$.id,H=$.data||{};return{html:`<img ${H4({src:X,alt:Z,width:J,height:Y,loading:U?"eager":G,decoding:Q,fetchpriority:U?"high":w,objectFit:q,objectPosition:W,crossorigin:K,referrerpolicy:z,className:B,style:O4(j,q,W),id:_,data:H})} />`}}function H4($){let X=[];if($.lazy)X.push(`data-src="${J1($.src)}"`),X.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else X.push(`src="${J1($.src)}"`);if(X.push(`alt="${J1($.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="${J1($.className)}"`);if($.style)X.push(`style="${J1($.style)}"`);if($.id)X.push(`id="${J1($.id)}"`);if($.data)for(let[Z,J]of Object.entries($.data))X.push(`data-${Z}="${J1(J)}"`);if($.lazy)X.push("data-stx-lazy");return X.join(" ")}function fJ($,X){let Z=[];if($)Z.push($);if(X)Z.push("stx-img-blur");return Z.join(" ")||""}function O4($,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 J1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function gJ($){return`
10782
+ <img ${E} />
10783
+ </picture>`;return I}function hU($,X,Z,J){let{src:Y,alt:G,width:Q,height:w,dpr:q=[1,2,3],quality:W=F4,params:K={},lazy:z=!0,priority:U=!1,loading:B=U?"eager":I$,decoding:j=k$,fetchpriority:_,objectFit:H,objectPosition:L,crossorigin:O,referrerpolicy:F}=$,V=$.class,A=$.style,R=$.data||{},N=typeof Q==="number"?Q:Number.parseInt(String(Q),10),T=FJ(Y,N,q,{...K,q:W}),k=V4({src:i7(Y,{...K,w:N,q:W}),alt:G,width:Q,height:w,loading:U?void 0:B,decoding:j,fetchpriority:U?"high":_,objectFit:H,objectPosition:L,crossorigin:O,referrerpolicy:F,className:dJ(V,Z),style:A4(A,H,L,Z),lazy:z&&!U,data:R}),M=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 ${k} ${M} />
10785
+ </div>`}return`<img ${X?`id="${X}" `:""}${k} ${M} />`}function uU($){let{src:X,alt:Z,width:J,height:Y,loading:G=I$,decoding:Q=k$,fetchpriority:w,objectFit:q,objectPosition:W,crossorigin:K,referrerpolicy:z,priority:U=!1}=$,B=$.class,j=$.style,_=$.id,H=$.data||{};return{html:`<img ${V4({src:X,alt:Z,width:J,height:Y,loading:U?"eager":G,decoding:Q,fetchpriority:U?"high":w,objectFit:q,objectPosition:W,crossorigin:K,referrerpolicy:z,className:B,style:A4(j,q,W),id:_,data:H})} />`}}function V4($){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 dJ($,X){let Z=[];if($)Z.push($);if(X)Z.push("stx-img-blur");return Z.join(" ")||""}function A4($,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 mJ($){return`
10784
10786
  (function() {
10785
10787
  const container = document.getElementById('${$}');
10786
10788
  if (!container) return;
@@ -10817,7 +10819,7 @@ ${T.join(`
10817
10819
 
10818
10820
  observer.observe(container);
10819
10821
  })();
10820
- `.trim()}async function gU($,X){let Z=await PU();if(!Z)return A$({...$,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 hJ($,G,X)}else{let G=await Z.processImage($.src,$,J);if(G.processed)return L4($,G,X)}return A$({...$,process:!1},X)}async function L4($,X,Z){let{alt:J,width:Y,height:G,lazy:Q=!0,priority:w=!1,objectFit:q,objectPosition:W,crossorigin:K,referrerpolicy:z}=$,U=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},H=X.variants||[],L=H.find((v)=>v.format==="jpeg")||H.find((v)=>v.format==="webp")||H[0],O=L?.url||$.src,F=H.filter((v)=>v.format===(L?.format||"jpeg")).map((v)=>`${v.url} ${v.width}w`).join(", "),V=new Map;for(let v of H){if(!V.has(v.format))V.set(v.format,[]);V.get(v.format).push(v)}let A=[],R=["avif","webp","jpeg","png"];for(let v of R){let x=V.get(v);if(x&&x.length>0){let f=x.map((p)=>`${p.url} ${p.width}w`).join(", "),h=Y4(v);if(Q&&!w)A.push(` <source type="${h}" data-srcset="${f}" />`);else A.push(` <source type="${h}" srcset="${f}" />`)}}let N=[];if(Q&&!w){if(N.push(`data-src="${J1(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${J1(O)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${J1(J)}"`);let M=Y||X.originalWidth,k=G||X.originalHeight;if(M)N.push(`width="${M}"`);if(k)N.push(`height="${k}"`);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 T=[];if(q)T.push(`object-fit: ${q}`);if(W)T.push(`object-position: ${W}`);if(X.placeholder&&Q)T.push("opacity: 0; transition: opacity 300ms ease-out");if(B)T.push(B);if(T.length>0)N.push(`style="${T.join("; ")}"`);let D=[];if(U)D.push(U);if(X.placeholder)D.push("stx-img-blur");if(D.length>0)N.push(`class="${D.join(" ")}"`);if(Q&&!w)N.push("data-stx-lazy");for(let[v,x]of Object.entries(_))N.push(`data-${v}="${J1(x)}"`);let I;if(X.placeholder||X.dominantColor&&$.useDominantColor){let v=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="${v}">
10822
+ `.trim()}async function dU($,X){let Z=await fU();if(!Z)return M$({...$,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 cJ($,G,X)}else{let G=await Z.processImage($.src,$,J);if(G.processed)return R4($,G,X)}return M$({...$,process:!1},X)}async function R4($,X,Z){let{alt:J,width:Y,height:G,lazy:Q=!0,priority:w=!1,objectFit:q,objectPosition:W,crossorigin:K,referrerpolicy:z}=$,U=$.class,B=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},H=X.variants||[],L=H.find((P)=>P.format==="jpeg")||H.find((P)=>P.format==="webp")||H[0],O=L?.url||$.src,F=H.filter((P)=>P.format===(L?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of H){if(!V.has(P.format))V.set(P.format,[]);V.get(P.format).push(P)}let A=[],R=["avif","webp","jpeg","png"];for(let P of R){let x=V.get(P);if(x&&x.length>0){let f=x.map((l)=>`${l.url} ${l.width}w`).join(", "),u=q4(P);if(Q&&!w)A.push(` <source type="${u}" data-srcset="${f}" />`);else A.push(` <source type="${u}" srcset="${f}" />`)}}let N=[];if(Q&&!w){if(N.push(`data-src="${G1(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${G1(O)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${G1(J)}"`);let T=Y||X.originalWidth,k=G||X.originalHeight;if(T)N.push(`width="${T}"`);if(k)N.push(`height="${k}"`);if(!w)N.push(`loading="${Q?"lazy":"eager"}"`);if(N.push('decoding="async"'),w)N.push('fetchpriority="high"');if(K)N.push(`crossorigin="${K}"`);if(z)N.push(`referrerpolicy="${z}"`);let M=[];if(q)M.push(`object-fit: ${q}`);if(W)M.push(`object-position: ${W}`);if(X.placeholder&&Q)M.push("opacity: 0; transition: opacity 300ms ease-out");if(B)M.push(B);if(M.length>0)N.push(`style="${M.join("; ")}"`);let E=[];if(U)E.push(U);if(X.placeholder)E.push("stx-img-blur");if(E.length>0)N.push(`class="${E.join(" ")}"`);if(Q&&!w)N.push("data-stx-lazy");for(let[P,x]of Object.entries(_))N.push(`data-${P}="${G1(x)}"`);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}">
10821
10823
  <picture>
10822
10824
  ${A.join(`
10823
10825
  `)}
@@ -10827,12 +10829,12 @@ ${A.join(`
10827
10829
  ${A.join(`
10828
10830
  `)}
10829
10831
  <img ${N.join(" ")} />
10830
- </picture>`;let S=[];if(X.placeholder)S.push(w4);let b=Q?gJ(j):void 0,E;if(w&&F)E=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:I,preloadLink:E,css:S.length>0?S.join(`
10831
- `):void 0,script:b}}async function hJ($,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 L4($,J,Z)}var vJ=!1,_4=80,R$="async",N$="lazy",xJ=!1;var uJ=y(()=>{G4();LJ()});function hU(){return U$({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}=uU($,X,Z);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let w={src:Y,alt:G||"",widths:Q.widths||C5,formats:Q.formats||m7,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},q=Z.__isDev||!1,W=await A$(w,{isDev:q}),K=W.html;if(W.preloadLink)K=W.preloadLink+`
10832
+ </picture>`;let S=[];if(X.placeholder)S.push(z4);let b=Q?mJ(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 cJ($,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 R4($,J,Z)}var hJ=!1,F4=80,k$="async",I$="lazy",uJ=!1;var lJ=D(()=>{W4();RJ()});function mU(){return H$({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}=cU($,X,Z);if(!Y)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let w={src:Y,alt:G||"",widths:Q.widths||f5,formats:Q.formats||p7,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},q=Z.__isDev||!1,W=await M$(w,{isDev:q}),K=W.html;if(W.preloadLink)K=W.preloadLink+`
10832
10834
  `+K;if(W.css)K+=`
10833
10835
  <style>${W.css}</style>`;if(W.script)K+=`
10834
- <script>${W.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function uU($,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=dU(J),G=F4(Y[0],Z)||"",Q=F4(Y[1],Z)||"",w={};if(Y[2]){let q=F4(Y[2],Z);if(typeof q==="object"&&q!==null)w=q;else if(typeof Y[2]==="string")try{w=JSON.parse(Y[2])}catch{}}return{src:G,alt:Q,options:w}}function dU($){let X=[],Z="",J=!1,Y="",G=0,Q=0;for(let w=0;w<$.length;w++){let q=$[w],W=w>0?$[w-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!J)J=!0,Y=q;else if(q===Y)J=!1,Y="";else Z+=q;continue}if(!J){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){X.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())X.push(Z.trim());return X}function F4($,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 dJ;var mJ=y(()=>{X4();uJ();G4();dJ=hU()});class M${config;constructor($={}){this.config={...mU,...$}}async get($,X){return B$($,X,"video",this.config)}async set($,X,Z){return _$($,X,Z,"video",this.config)}async clear(){return H$("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function V4($){if(!T$)T$=new M$($);else if($)T$.updateConfig($);return T$}async function k$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return V4(J).get($,X)}async function I$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return V4(Y).set($,X,Z)}async function cJ(){return V4().clear()}var mU,T$=null;var A4=y(()=>{K4();mU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as R4,basename as N4,extname as T4,join as E$}from"path";import{mkdir as M4}from"fs/promises";async function k4(){try{return await import("ts-videos")}catch{return null}}async function D$($,X,Z,J){let Y=await k4();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=R4($);if(!await S0(G))return null;await M4(Z,{recursive:!0});let Q=await f0(G),w=N4($,T4($)),q=X.format||"webp",W=X.timestamp||0,K=`${w}-poster-${Q}.${q}`,z=E$(Z,K),U=await Y.extractThumbnails(G,{timestamps:[W],width:X.width||1280,height:X.height,format:q,quality:X.quality||85,outputDir:Z,outputPattern:K.replace(`.${q}`,"")});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:W,size:B.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function y$($,X,Z,J){let Y=await k4();if(!Y)return[];try{let G=R4($);if(!await S0(G))return[];await M4(Z,{recursive:!0});let Q=await f0(G),w=N4($,T4($)),q=X.format||"webp",z=(await new Y.Input(G).getInfo()).duration||60,U=X.count||10,B=X.interval||z/U,j=[];for(let H=0;H<U&&H*B<z;H++)j.push(H*B);let _=await Y.extractThumbnails(G,{timestamps:j,width:X.width||320,format:q,quality:X.quality||80,outputDir:Z,outputPattern:`${w}-thumb-${Q}`});if(_&&_.length>0)return _.map((H,L)=>({path:H.path||E$(Z,`${w}-thumb-${Q}-${L}.${q}`),url:`${J}/${w}-thumb-${Q}-${L}.${q}`,width:H.width||X.width||320,height:H.height||180,timestamp:j[L],size:H.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function lJ($,X,Z,J){let Y=await k4();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=R4($);if(!await S0(G))return null;await M4(Z,{recursive:!0});let Q=await f0(G),w=N4($,T4($)),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,_=X.format||"jpeg",H=Math.ceil(K/U),L=Math.ceil(H/z),O=`${w}-sprite-${Q}.${_}`,F=E$(Z,O),V=[];for(let R=0;R<H;R++)V.push(R*U);let A=await Y.extractThumbnails(G,{timestamps:V,width:B,height:j,format:_,quality:X.quality||70,outputDir:E$(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=z*B,M=L*j,k=await R.createSprite({images:A.map((T)=>T.path),columns:z,padding:0,outputPath:F,format:_,quality:X.quality||70});return{url:`${J}/${O}`,path:F,columns:z,rows:L,thumbnailWidth:B,thumbnailHeight:j,interval:U,totalFrames:H}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(G){return console.warn(`[stx-media] Failed to generate sprite sheet: ${G}`),null}}var I4=y(()=>{J5()});import{resolve as iJ,basename as nJ,extname as rJ,join as Y5}from"path";import{mkdir as b$,writeFile as oJ}from"fs/promises";async function sJ(){try{return await import("ts-videos")}catch{return null}}async function S$($,X,Z,J,Y){let G=await sJ();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=iJ($);if(!await S0(Q))return null;let w=await f0(Q),q=nJ($,rJ($)),W=Y5(Z,`${q}-${w}-hls`);await b$(W,{recursive:!0});let K=X.length>0?X:aJ,z=Y?.segmentDuration||6,j=(await new G.Input(Q).getInfo()).duration||0,_=[],H=0;for(let F of K){let V=Y5(W,F.label);await b$(V,{recursive:!0});let A=`${F.label}.m3u8`,R=Y5(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)_.push({quality:F,url:`${J}/${q}-${w}-hls/${F.label}/${A}`,path:R}),H+=N.segmentCount||Math.ceil(j/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${N}`)}}if(_.length===0)return null;let L=Y5(W,"master.m3u8"),O=cU(_,J,q,w);return await oJ(L,O),{manifestUrl:`${J}/${q}-${w}-hls/master.m3u8`,manifestPath:L,playlists:_,segmentCount:H,duration:j}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function cU($,X,Z,J){let Y=["#EXTM3U","#EXT-X-VERSION:3"];for(let G of $){let{quality:Q}=G,w=Q.bitrate+(Q.audioBitrate||128000),q=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;Y.push(`#EXT-X-STREAM-INF:BANDWIDTH=${w},RESOLUTION=${q},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return Y.join(`
10835
- `)}async function C$($,X,Z,J,Y){let G=await sJ();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=iJ($);if(!await S0(Q))return null;let w=await f0(Q),q=nJ($,rJ($)),W=Y5(Z,`${q}-${w}-dash`);await b$(W,{recursive:!0});let K=X.length>0?X:aJ,z=Y?.segmentDuration||4,U=Y?.minBufferTime||2,_=(await new G.Input(Q).getInfo()).duration||0,H=[],L=[];for(let A of K){let R=Y5(W,A.label);await b$(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(H.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${q}-${w}-dash/${A.label}/video`}),A.audioBitrate)L.push({bandwidth:A.audioBitrate,url:`${J}/${q}-${w}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(H.length===0)return null;let O=Y5(W,"manifest.mpd"),F=lU(H,L,_,z,U);await oJ(O,F);let V=[{type:"video",representations:H}];if(L.length>0)V.push({type:"audio",representations:L});return{manifestUrl:`${J}/${q}-${w}-dash/manifest.mpd`,manifestPath:O,adaptationSets:V,duration:_}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function lU($,X,Z,J,Y){let G=pJ(Z),Q=pJ(Y),w=`<?xml version="1.0" encoding="UTF-8"?>
10836
+ <script>${W.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function cU($,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=lU(J),G=N4(Y[0],Z)||"",Q=N4(Y[1],Z)||"",w={};if(Y[2]){let q=N4(Y[2],Z);if(typeof q==="object"&&q!==null)w=q;else if(typeof Y[2]==="string")try{w=JSON.parse(Y[2])}catch{}}return{src:G,alt:Q,options:w}}function lU($){let X=[],Z="",J=!1,Y="",G=0,Q=0;for(let w=0;w<$.length;w++){let q=$[w],W=w>0?$[w-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!J)J=!0,Y=q;else if(q===Y)J=!1,Y="";else Z+=q;continue}if(!J){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){X.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())X.push(Z.trim());return X}function N4($,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 pJ;var iJ=D(()=>{G4();lJ();W4();pJ=mU()});class D${config;constructor($={}){this.config={...pU,...$}}async get($,X){return L$($,X,"video",this.config)}async set($,X,Z){return F$($,X,Z,"video",this.config)}async clear(){return V$("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function T4($){if(!E$)E$=new D$($);else if($)E$.updateConfig($);return E$}async function y$($,X,Z){let J=Z?{directory:`${Z.outputDir}/../.cache`}:{};return T4(J).get($,X)}async function b$($,X,Z,J){let Y=J?{directory:`${J.outputDir}/../.cache`}:{};return T4(Y).set($,X,Z)}async function nJ(){return T4().clear()}var pU,E$=null;var M4=D(()=>{B4();pU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as k4,basename as I4,extname as E4,join as S$}from"path";import{mkdir as D4}from"fs/promises";async function y4(){try{return await import("ts-videos")}catch{return null}}async function C$($,X,Z,J){let Y=await y4();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=k4($);if(!await v0(G))return null;await D4(Z,{recursive:!0});let Q=await h0(G),w=I4($,E4($)),q=X.format||"webp",W=X.timestamp||0,K=`${w}-poster-${Q}.${q}`,z=S$(Z,K),U=await Y.extractThumbnails(G,{timestamps:[W],width:X.width||1280,height:X.height,format:q,quality:X.quality||85,outputDir:Z,outputPattern:K.replace(`.${q}`,"")});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:W,size:B.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function P$($,X,Z,J){let Y=await y4();if(!Y)return[];try{let G=k4($);if(!await v0(G))return[];await D4(Z,{recursive:!0});let Q=await h0(G),w=I4($,E4($)),q=X.format||"webp",z=(await new Y.Input(G).getInfo()).duration||60,U=X.count||10,B=X.interval||z/U,j=[];for(let H=0;H<U&&H*B<z;H++)j.push(H*B);let _=await Y.extractThumbnails(G,{timestamps:j,width:X.width||320,format:q,quality:X.quality||80,outputDir:Z,outputPattern:`${w}-thumb-${Q}`});if(_&&_.length>0)return _.map((H,L)=>({path:H.path||S$(Z,`${w}-thumb-${Q}-${L}.${q}`),url:`${J}/${w}-thumb-${Q}-${L}.${q}`,width:H.width||X.width||320,height:H.height||180,timestamp:j[L],size:H.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function rJ($,X,Z,J){let Y=await y4();if(!Y)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=k4($);if(!await v0(G))return null;await D4(Z,{recursive:!0});let Q=await h0(G),w=I4($,E4($)),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,_=X.format||"jpeg",H=Math.ceil(K/U),L=Math.ceil(H/z),O=`${w}-sprite-${Q}.${_}`,F=S$(Z,O),V=[];for(let R=0;R<H;R++)V.push(R*U);let A=await Y.extractThumbnails(G,{timestamps:V,width:B,height:j,format:_,quality:X.quality||70,outputDir:S$(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=z*B,T=L*j,k=await R.createSprite({images:A.map((M)=>M.path),columns:z,padding:0,outputPath:F,format:_,quality:X.quality||70});return{url:`${J}/${O}`,path:F,columns:z,rows:L,thumbnailWidth:B,thumbnailHeight:j,interval:U,totalFrames:H}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(G){return console.warn(`[stx-media] Failed to generate sprite sheet: ${G}`),null}}var b4=D(()=>{q5()});import{resolve as sJ,basename as aJ,extname as tJ,join as W5}from"path";import{mkdir as v$,writeFile as eJ}from"fs/promises";async function $Y(){try{return await import("ts-videos")}catch{return null}}async function x$($,X,Z,J,Y){let G=await $Y();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=sJ($);if(!await v0(Q))return null;let w=await h0(Q),q=aJ($,tJ($)),W=W5(Z,`${q}-${w}-hls`);await v$(W,{recursive:!0});let K=X.length>0?X:XY,z=Y?.segmentDuration||6,j=(await new G.Input(Q).getInfo()).duration||0,_=[],H=0;for(let F of K){let V=W5(W,F.label);await v$(V,{recursive:!0});let A=`${F.label}.m3u8`,R=W5(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)_.push({quality:F,url:`${J}/${q}-${w}-hls/${F.label}/${A}`,path:R}),H+=N.segmentCount||Math.ceil(j/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${N}`)}}if(_.length===0)return null;let L=W5(W,"master.m3u8"),O=iU(_,J,q,w);return await eJ(L,O),{manifestUrl:`${J}/${q}-${w}-hls/master.m3u8`,manifestPath:L,playlists:_,segmentCount:H,duration:j}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function iU($,X,Z,J){let Y=["#EXTM3U","#EXT-X-VERSION:3"];for(let G of $){let{quality:Q}=G,w=Q.bitrate+(Q.audioBitrate||128000),q=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;Y.push(`#EXT-X-STREAM-INF:BANDWIDTH=${w},RESOLUTION=${q},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return Y.join(`
10837
+ `)}async function f$($,X,Z,J,Y){let G=await $Y();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=sJ($);if(!await v0(Q))return null;let w=await h0(Q),q=aJ($,tJ($)),W=W5(Z,`${q}-${w}-dash`);await v$(W,{recursive:!0});let K=X.length>0?X:XY,z=Y?.segmentDuration||4,U=Y?.minBufferTime||2,_=(await new G.Input(Q).getInfo()).duration||0,H=[],L=[];for(let A of K){let R=W5(W,A.label);await v$(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(H.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${J}/${q}-${w}-dash/${A.label}/video`}),A.audioBitrate)L.push({bandwidth:A.audioBitrate,url:`${J}/${q}-${w}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(H.length===0)return null;let O=W5(W,"manifest.mpd"),F=nU(H,L,_,z,U);await eJ(O,F);let V=[{type:"video",representations:H}];if(L.length>0)V.push({type:"audio",representations:L});return{manifestUrl:`${J}/${q}-${w}-dash/manifest.mpd`,manifestPath:O,adaptationSets:V,duration:_}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function nU($,X,Z,J,Y){let G=oJ(Z),Q=oJ(Y),w=`<?xml version="1.0" encoding="UTF-8"?>
10836
10838
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
10837
10839
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10838
10840
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -10858,13 +10860,13 @@ ${A.join(`
10858
10860
  </Representation>
10859
10861
  `}w+=` </AdaptationSet>
10860
10862
  `}return w+=` </Period>
10861
- </MPD>`,w}function pJ($){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 aJ;var E4=y(()=>{J5();aJ=[{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 tJ,basename as pU,extname as iU,join as nU}from"path";import{mkdir as rU}from"fs/promises";async function eJ(){try{return await import("ts-videos")}catch{return null}}function oU($){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 sU($){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 D4($){let X=await eJ();if(!X)return null;try{let Z=tJ($),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 $Y($,X,Z,J){let Y=await eJ();if(!Y)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let G=await k$($,X,Z);if(G)return G;try{let Q=tJ($);if(!await S0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let w=Z.outputDir||"dist/videos",q=Z.baseUrl||"/videos";await rU(w,{recursive:!0});let W=await f0(Q),K=pU($,iU($)),z={src:$,processed:!0,hash:W};J?.({percentage:5,stage:"analyzing"}),z.metadata=await D4(Q)||void 0;let U={};if(X.quality)U.bitrate=oU(X.quality);if(X.platform)Object.assign(U,sU(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}-${W}.mp4`,j=nU(w,B);try{let _=await aU(Q,j,U,Y,(H)=>J?.({percentage:10+H*0.5,stage:"transcoding"}));if(_)z.transcoded={path:j,url:`${q}/${B}`,duration:_.duration,size:_.size,video:{codec:U.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:U.audioCodec||"aac",bitrate:U.audioBitrate||128000,sampleRate:U.sampleRate||48000,channels:U.channels||2}:void 0}}catch(_){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${_}`)}}if(X.generatePoster){J?.({percentage:65,stage:"generating-poster"});let B=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},j=await D$(Q,B,w,q);if(j)z.poster=j}if(Z.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let B=await y$(Q,Z.thumbnails,w,q);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 S$(Q,B.qualities||Z.streaming?.defaultQualities||[],w,q);if(j)z.streaming={...z.streaming,hls:j}}if(B.format==="dash"){let j=await C$(Q,B.qualities||Z.streaming?.defaultQualities||[],w,q);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 I$($,X,z,Z),z}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function aU($,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 XY=y(()=>{J5();A4();I4();E4()});var ZY={};a(ZY,{setCachedVideoResult:()=>I$,processVideo:()=>$Y,getCachedVideoResult:()=>k$,generateThumbnails:()=>y$,generateSpriteSheet:()=>lJ,generatePoster:()=>D$,generateHLSManifest:()=>S$,generateDASHManifest:()=>C$,clearVideoCache:()=>cJ,analyzeVideo:()=>D4,VideoProcessorCache:()=>M$});var JY=y(()=>{XY();I4();E4();A4()});async function GY(){try{return await Promise.resolve().then(() => (JY(),ZY))}catch($){if(!YY)console.warn("[stx-media] Video processor not available, some features disabled:",$),YY=!0;return null}}async function P$($,X={}){let Z=X,J=$;if(J.process&&!J.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return Jj(J,Z)}if(Z.processedResult?.processed)return WY($,Z.processedResult,X);let Y;if(J.generatePoster&&J.src&&!$.poster)Y=await Yj(J,Z);let{src:G,sources:Q=[],poster:w,posterPlaceholder:q,controls:W=QY,autoplay:K=!1,muted:z=!1,loop:U=!1,preload:B=wY,playsinline:j=!0,lazy:_=!0,player:H="native",type:L,width:O,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=$,N=Y||w,M=$.class,k=$.style,T=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(H==="ts-video")return $j($,X);if(L&&L!=="video")return eU(G||"",L,$);let D=Q.length>0?Q:G?[{src:G,type:qY(G)}]:[],I=[`id="${T}"`];if(W)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(_){if(I.push(`data-preload="${B}"`),I.push('preload="none"'),N)I.push(`data-poster="${E0(N)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),N)I.push(`poster="${E0(N)}"`);if(O)I.push(`width="${O}"`);if(F)I.push(`height="${F}"`);if(M)I.push(`class="${E0(M)}"`);if(k)I.push(`style="${E0(k)}"`);let S=D.map((v)=>{return` <source ${_?`data-src="${E0(v.src)}"`:`src="${E0(v.src)}"`} type="${v.type}"${v.media?` media="${v.media}"`:""} />`}).join(`
10863
+ </MPD>`,w}function oJ($){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 XY;var S4=D(()=>{q5();XY=[{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 ZY,basename as rU,extname as oU,join as sU}from"path";import{mkdir as aU}from"fs/promises";async function JY(){try{return await import("ts-videos")}catch{return null}}function tU($){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 eU($){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 C4($){let X=await JY();if(!X)return null;try{let Z=ZY($),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 YY($,X,Z,J){let Y=await JY();if(!Y)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let G=await y$($,X,Z);if(G)return G;try{let Q=ZY($);if(!await v0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let w=Z.outputDir||"dist/videos",q=Z.baseUrl||"/videos";await aU(w,{recursive:!0});let W=await h0(Q),K=rU($,oU($)),z={src:$,processed:!0,hash:W};J?.({percentage:5,stage:"analyzing"}),z.metadata=await C4(Q)||void 0;let U={};if(X.quality)U.bitrate=tU(X.quality);if(X.platform)Object.assign(U,eU(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}-${W}.mp4`,j=sU(w,B);try{let _=await $j(Q,j,U,Y,(H)=>J?.({percentage:10+H*0.5,stage:"transcoding"}));if(_)z.transcoded={path:j,url:`${q}/${B}`,duration:_.duration,size:_.size,video:{codec:U.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:U.audioCodec||"aac",bitrate:U.audioBitrate||128000,sampleRate:U.sampleRate||48000,channels:U.channels||2}:void 0}}catch(_){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${_}`)}}if(X.generatePoster){J?.({percentage:65,stage:"generating-poster"});let B=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},j=await C$(Q,B,w,q);if(j)z.poster=j}if(Z.thumbnails?.enabled){J?.({percentage:70,stage:"generating-thumbnails"});let B=await P$(Q,Z.thumbnails,w,q);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 x$(Q,B.qualities||Z.streaming?.defaultQualities||[],w,q);if(j)z.streaming={...z.streaming,hls:j}}if(B.format==="dash"){let j=await f$(Q,B.qualities||Z.streaming?.defaultQualities||[],w,q);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 b$($,X,z,Z),z}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function $j($,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 GY=D(()=>{q5();M4();b4();S4()});var QY={};t(QY,{setCachedVideoResult:()=>b$,processVideo:()=>YY,getCachedVideoResult:()=>y$,generateThumbnails:()=>P$,generateSpriteSheet:()=>rJ,generatePoster:()=>C$,generateHLSManifest:()=>x$,generateDASHManifest:()=>f$,clearVideoCache:()=>nJ,analyzeVideo:()=>C4,VideoProcessorCache:()=>D$});var wY=D(()=>{GY();b4();S4();M4()});async function WY(){try{return await Promise.resolve().then(() => (wY(),QY))}catch($){if(!qY)console.warn("[stx-media] Video processor not available, some features disabled:",$),qY=!0;return null}}async function g$($,X={}){let Z=X,J=$;if(J.process&&!J.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return Qj(J,Z)}if(Z.processedResult?.processed)return jY($,Z.processedResult,X);let Y;if(J.generatePoster&&J.src&&!$.poster)Y=await wj(J,Z);let{src:G,sources:Q=[],poster:w,posterPlaceholder:q,controls:W=KY,autoplay:K=!1,muted:z=!1,loop:U=!1,preload:B=zY,playsinline:j=!0,lazy:_=!0,player:H="native",type:L,width:O,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=$,N=Y||w,T=$.class,k=$.style,M=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(H==="ts-video")return Jj($,X);if(L&&L!=="video")return Zj(G||"",L,$);let E=Q.length>0?Q:G?[{src:G,type:UY(G)}]:[],I=[`id="${M}"`];if(W)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(_){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(O)I.push(`width="${O}"`);if(F)I.push(`height="${F}"`);if(T)I.push(`class="${b0(T)}"`);if(k)I.push(`style="${b0(k)}"`);let S=E.map((P)=>{return` <source ${_?`data-src="${b0(P.src)}"`:`src="${b0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
10862
10864
  `),b=`<video ${I.join(" ")}>
10863
10865
  ${S}
10864
10866
  Your browser does not support the video tag.
10865
- </video>`,E;if(_)E=`
10867
+ </video>`,y;if(_)y=`
10866
10868
  (function() {
10867
- var video = document.getElementById('${T}');
10869
+ var video = document.getElementById('${M}');
10868
10870
  if (!video) return;
10869
10871
 
10870
10872
  var observer = new IntersectionObserver(function(entries) {
@@ -10897,12 +10899,12 @@ ${S}
10897
10899
 
10898
10900
  observer.observe(video);
10899
10901
  })();
10900
- `.trim();return{html:b,script:E}}function eU($,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)}`,q,W=null;switch(X){case"youtube":W=Xj($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=Zj($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let K=[`id="${w}"`,`src="${E0(q)}"`,`width="${J}"`,`height="${Y}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)K.push(`class="${E0(G)}"`);if(Q)K.push(`style="${E0(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;">
10902
+ `.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)}`,q,W=null;switch(X){case"youtube":W=Yj($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=Gj($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let K=[`id="${w}"`,`src="${b0(q)}"`,`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;">
10901
10903
  <iframe ${K.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
10902
- </div>`}}function $j($,X={}){let{src:Z,sources:J=[],poster:Y,controls:G=!0,autoplay:Q=!1,muted:w=!1,loop:q=!1,preload:W="metadata",playsinline:K=!0,lazy:z=!0,width:U,height:B}=$,j=$.class,_=$.style,H=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:J.length>0?J:Z,autoplay:Q,loop:q,muted:w,playsinline:K,preload:W,poster:Y,controls:G,title:$.title},O=["position: relative",U?`width: ${typeof U==="number"?U+"px":U}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",_||""].filter(Boolean).join("; "),F=`
10904
+ </div>`}}function Jj($,X={}){let{src:Z,sources:J=[],poster:Y,controls:G=!0,autoplay:Q=!1,muted:w=!1,loop:q=!1,preload:W="metadata",playsinline:K=!0,lazy:z=!0,width:U,height:B}=$,j=$.class,_=$.style,H=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:J.length>0?J:Z,autoplay:Q,loop:q,muted:w,playsinline:K,preload:W,poster:Y,controls:G,title:$.title},O=["position: relative",U?`width: ${typeof U==="number"?U+"px":U}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",_||""].filter(Boolean).join("; "),F=`
10903
10905
  <div
10904
10906
  id="${H}"
10905
- class="ts-video-player${j?" "+E0(j):""}"
10907
+ class="ts-video-player${j?" "+b0(j):""}"
10906
10908
  style="${O}"
10907
10909
  data-ts-video-player
10908
10910
  data-config='${JSON.stringify(L)}'
@@ -10910,7 +10912,7 @@ ${S}
10910
10912
  >
10911
10913
  <div class="ts-video-player__container">
10912
10914
  ${Y?`
10913
- <div class="ts-video-player__placeholder" style="background-image: url('${E0(Y)}');">
10915
+ <div class="ts-video-player__placeholder" style="background-image: url('${b0(Y)}');">
10914
10916
  <button class="ts-video-player__play-button" aria-label="Play video">
10915
10917
  <svg viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
10916
10918
  <path d="M8 5v14l11-7z"/>
@@ -10936,7 +10938,7 @@ ${S}
10936
10938
 
10937
10939
  // Load ts-video-player from CDN
10938
10940
  var script = document.createElement('script');
10939
- script.src = '${tU}';
10941
+ script.src = '${Xj}';
10940
10942
  script.onload = initPlayer;
10941
10943
  script.onerror = function() {
10942
10944
  console.error('[stx] Failed to load ts-video-player');
@@ -11066,11 +11068,11 @@ else {
11066
11068
  .ts-video-player__play-button svg {
11067
11069
  margin-left: 4px;
11068
11070
  }
11069
- `.trim();return{html:F,script:V,css:A}}function qY($){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 Xj($){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 E0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function Jj($,X){let Z=await GY();if(!Z)return P$({...$,process:!1},X);let J=X.tsVideosConfig,Y=await Z.processVideo($.src,$,J,$.onProcessProgress);if(Y.processed)return WY($,Y,X);return P$({...$,process:!1},X)}async function Yj($,X){let Z=await GY();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 WY($,X,Z){let{controls:J=QY,autoplay:Y=!1,muted:G=!1,loop:Q=!1,preload:w=wY,playsinline:q=!0,lazy:W=!0,width:K,height:z,crossorigin:U,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,_=$.class,H=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,F=qY(O);if(X.transcoded)O=X.transcoded.url,F="video/mp4";let V=X.streaming?.hls||X.streaming?.dash;if(V){if(X.streaming?.hls)O=X.streaming.hls.manifestUrl,F="application/x-mpegURL";else if(X.streaming?.dash)O=X.streaming.dash.manifestUrl,F="application/dash+xml"}let A=X.poster?.url||$.poster,R=[`id="${L}"`];if(J)R.push("controls");if(Y)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(q)R.push("playsinline");if(B)R.push("disablepictureinpicture");if(j)R.push("disableremoteplayback");if(U)R.push(`crossorigin="${U}"`);if(W){if(R.push(`data-preload="${w}"`),R.push('preload="none"'),A)R.push(`data-poster="${E0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${w}"`),A)R.push(`poster="${E0(A)}"`);let N=K||X.metadata?.width,M=z||X.metadata?.height;if(N)R.push(`width="${N}"`);if(M)R.push(`height="${M}"`);if(_)R.push(`class="${E0(_)}"`);if(H)R.push(`style="${E0(H)}"`);let T=` <source ${W?`data-src="${E0(O)}"`:`src="${E0(O)}"`} type="${F}" />`,D=`<video ${R.join(" ")}>
11070
- ${T}
11071
+ `.trim();return{html:F,script:V,css:A}}function UY($){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 Yj($){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 Gj($){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 Qj($,X){let Z=await WY();if(!Z)return g$({...$,process:!1},X);let J=X.tsVideosConfig,Y=await Z.processVideo($.src,$,J,$.onProcessProgress);if(Y.processed)return jY($,Y,X);return g$({...$,process:!1},X)}async function wj($,X){let Z=await WY();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 jY($,X,Z){let{controls:J=KY,autoplay:Y=!1,muted:G=!1,loop:Q=!1,preload:w=zY,playsinline:q=!0,lazy:W=!0,width:K,height:z,crossorigin:U,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=$,_=$.class,H=$.style,L=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,F=UY(O);if(X.transcoded)O=X.transcoded.url,F="video/mp4";let V=X.streaming?.hls||X.streaming?.dash;if(V){if(X.streaming?.hls)O=X.streaming.hls.manifestUrl,F="application/x-mpegURL";else if(X.streaming?.dash)O=X.streaming.dash.manifestUrl,F="application/dash+xml"}let A=X.poster?.url||$.poster,R=[`id="${L}"`];if(J)R.push("controls");if(Y)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(q)R.push("playsinline");if(B)R.push("disablepictureinpicture");if(j)R.push("disableremoteplayback");if(U)R.push(`crossorigin="${U}"`);if(W){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(_)R.push(`class="${b0(_)}"`);if(H)R.push(`style="${b0(H)}"`);let M=` <source ${W?`data-src="${b0(O)}"`:`src="${b0(O)}"`} type="${F}" />`,E=`<video ${R.join(" ")}>
11072
+ ${M}
11071
11073
  Your browser does not support the video tag.
11072
- </video>`;if(X.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${E0(X.spriteSheet.url)}" data-sprite-cols="${X.spriteSheet.columns}" data-sprite-interval="${X.spriteSheet.interval}">
11073
- ${D}
11074
+ </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
+ ${E}
11074
11076
  </div>`;let I;if(W)I=`
11075
11077
  (function() {
11076
11078
  var video = document.getElementById('${L}');
@@ -11115,9 +11117,9 @@ ${D}
11115
11117
  width: 100%;
11116
11118
  height: auto;
11117
11119
  }
11118
- `.trim();return{html:D,script:I,css:S}}var YY=!1,QY=!0,wY="metadata",tU="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var KY=y(()=>{b4()});function zY(){return U$({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}=Gj($,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},q={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},W=await P$(Q,q),K=W.html;if(W.css)K+=`
11120
+ `.trim();return{html:E,script:I,css:S}}var qY=!1,KY=!0,zY="metadata",Xj="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var BY=D(()=>{v4()});function _Y(){return H$({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}=qj($,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},q={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},W=await g$(Q,q),K=W.html;if(W.css)K+=`
11119
11121
  <style>${W.css}</style>`;if(W.script)K+=`
11120
- <script>${W.script}</script>`;return K},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Gj($,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=Qj(J),G=UY(Y[0],Z)||"",Q={};if(Y[1]){let w=UY(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 Qj($){let X=[],Z="",J=!1,Y="",G=0,Q=0;for(let w=0;w<$.length;w++){let q=$[w],W=w>0?$[w-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!J)J=!0,Y=q;else if(q===Y)J=!1,Y="";else Z+=q;continue}if(!J){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){X.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())X.push(Z.trim());return X}function UY($,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 y4;var b4=y(()=>{X4();KY();y4=zY()});function wj($,X){let Z=X.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
11122
+ <script>${W.script}</script>`;return K},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function qj($,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=Wj(J),G=HY(Y[0],Z)||"",Q={};if(Y[1]){let w=HY(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 Wj($){let X=[],Z="",J=!1,Y="",G=0,Q=0;for(let w=0;w<$.length;w++){let q=$[w],W=w>0?$[w-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!J)J=!0,Y=q;else if(q===Y)J=!1,Y="";else Z+=q;continue}if(!J){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){X.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())X.push(Z.trim());return X}function HY($,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 P4;var v4=D(()=>{G4();BY();P4=_Y()});function Kj($,X){let Z=X.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
11121
11123
  ${$}
11122
11124
  </div>
11123
11125
  <script>
@@ -11162,7 +11164,7 @@ ${D}
11162
11164
  }
11163
11165
  }
11164
11166
  })();
11165
- </script>`}function qj($,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=`
11167
+ </script>`}function zj($,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=`
11166
11168
  <div class="stx-pwa-update-banner" style="
11167
11169
  position: fixed;
11168
11170
  bottom: 0;
@@ -11273,7 +11275,7 @@ else {
11273
11275
  // Also listen for custom event
11274
11276
  window.addEventListener('pwa-update-available', showUpdate);
11275
11277
  })();
11276
- </script>`}function Wj($,X){let Z=$.trim().length>0,J=`
11278
+ </script>`}function Uj($,X){let Z=$.trim().length>0,J=`
11277
11279
  <div class="stx-offline-indicator" style="
11278
11280
  position: fixed;
11279
11281
  top: 16px;
@@ -11334,7 +11336,7 @@ else {
11334
11336
  window.addEventListener('offline', updateStatus);
11335
11337
  updateStatus();
11336
11338
  })();
11337
- </script>`}function Kj($,X){let Z=X.pwa?.push,J=Z?.vapidPublicKey||"",Y=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
11339
+ </script>`}function jj($,X){let Z=X.pwa?.push,J=Z?.vapidPublicKey||"",Y=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
11338
11340
  ${$}
11339
11341
  </div>
11340
11342
  <script>
@@ -11416,33 +11418,33 @@ catch (error) {
11416
11418
  init();
11417
11419
  }
11418
11420
  })();
11419
- </script>`}var zj,Uj,jj,Bj,jY;var BY=y(()=>{zj={name:"pwa.installButton",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return wj($,Y)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Uj={name:"pwa.updatePrompt",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return qj($,Y)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},jj={name:"pwa.offlineIndicator",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Wj($,Y)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Bj={name:"pwa.pushSubscribe",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Kj($,Y)},hasEndTag:!0,description:"Renders a push notification subscription button"},jY=[zj,Uj,jj,Bj]});function S4($){for(let[X,Z]of Object.entries(s))if(Z===$)return X;return}var s;var v$=y(()=>{s={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function l7(){return!1}function p7(){return!l7()||process.env.STX_DEBUG==="true"}function x$(){return!1}import _j from"path";function f$(){return{...C4}}function g$($){if(!C4.showRelativePaths||!$)return $;let X=C4.baseDir||process.cwd();try{let Z=_j.relative(X,$);return Z.startsWith("..")?$:Z}catch{return $}}var Hj,C4,h$,G5,u$;var d$=y(()=>{v$();Hj={showRelativePaths:!1,enableAutoRecovery:p7(),logRecoveryWarnings:!0},C4={...Hj};h$=class h$ extends Error{code;filePath;line;column;context;numericCode;constructor($,X,Z,J,Y,G,Q){super($);this.code=X;this.filePath=Z;this.line=J;this.column=Y;this.context=G;if(this.name="StxError",this.numericCode=Q||s.EVALUATION_ERROR,this.filePath)this.filePath=g$(this.filePath)}};G5=class G5 extends h${constructor($,X,Z,J,Y,G){super($,"stx_RUNTIME_ERROR",X,Z,J,Y,G||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};u$=class u$ extends h${isFatal=!0;constructor($,X,Z,J,Y,G){super($,"stx_VALIDATION_ERROR",X,Z,J,Y,G||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function HY($){let{type:X,message:Z,code:J,filePath:Y,line:G,column:Q,template:w,offset:q,snippet:W,suggestion:K,format:z="text"}=$,U=G,B=Q;if(!U&&w&&q!==void 0){let O=Rj(w,q);U=O.line,B=O.column}let j=Y?g$(Y):void 0,_=J?S4(J):void 0,H={type:X,code:J,codeName:_,message:Z,filePath:j,line:U,column:B,snippet:W,suggestion:K,timestamp:new Date().toISOString()},L;switch(z){case"html":L=Lj(H);break;case"json":L=JSON.stringify(H,null,2);break;case"console":L=Fj(H,w,q);break;case"text":default:L=Oj(H,w,q);break}return{formatted:L,data:H}}function Oj($,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(`
11420
- ${$.message}`),X&&$.line){let G=Vj(X,$.line,2);if(G)J.push(`
11421
+ </script>`}var Bj,_j,Hj,Oj,OY;var LY=D(()=>{Bj={name:"pwa.installButton",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Kj($,Y)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},_j={name:"pwa.updatePrompt",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return zj($,Y)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Hj={name:"pwa.offlineIndicator",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return Uj($,Y)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Oj={name:"pwa.pushSubscribe",handler:($,X,Z,J)=>{let Y=Z.__stx_options||{};return jj($,Y)},hasEndTag:!0,description:"Renders a push notification subscription button"},OY=[Bj,_j,Hj,Oj]});function x4($){for(let[X,Z]of Object.entries(o))if(Z===$)return X;return}var o;var h$=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 n7(){return!1}function r7(){return!n7()||process.env.STX_DEBUG==="true"}function u$(){return!1}import Lj from"path";function d$(){return{...f4}}function m$($){if(!f4.showRelativePaths||!$)return $;let X=f4.baseDir||process.cwd();try{let Z=Lj.relative(X,$);return Z.startsWith("..")?$:Z}catch{return $}}var Fj,f4,c$,K5,l$;var p$=D(()=>{h$();Fj={showRelativePaths:!1,enableAutoRecovery:r7(),logRecoveryWarnings:!0},f4={...Fj};c$=class c$ 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=m$(this.filePath)}};K5=class K5 extends c${constructor($,X,Z,J,Y,G){super($,"stx_RUNTIME_ERROR",X,Z,J,Y,G||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};l$=class l$ extends c${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 VY($){let{type:X,message:Z,code:J,filePath:Y,line:G,column:Q,template:w,offset:q,snippet:W,suggestion:K,format:z="text"}=$,U=G,B=Q;if(!U&&w&&q!==void 0){let O=Mj(w,q);U=O.line,B=O.column}let j=Y?m$(Y):void 0,_=J?x4(J):void 0,H={type:X,code:J,codeName:_,message:Z,filePath:j,line:U,column:B,snippet:W,suggestion:K,timestamp:new Date().toISOString()},L;switch(z){case"html":L=Aj(H);break;case"json":L=JSON.stringify(H,null,2);break;case"console":L=Rj(H,w,q);break;case"text":default:L=Vj(H,w,q);break}return{formatted:L,data:H}}function Vj($,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=Nj(X,$.line,2);if(G)J.push(`
11421
11423
  ${G}`)}if($.snippet)J.push(`
11422
11424
  Snippet: ${$.snippet}`);if($.suggestion)J.push(`
11423
- Suggestion: ${$.suggestion}`);return J.join(" ")}function Lj($){let X=$.code?` [${$.code}]`:"",Z=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${X}]${Z}: ${_Y($.message)}`;if($.suggestion)J+=` | Suggestion: ${_Y($.suggestion)}`;return J+=" -->",J}function Fj($,X,Z){let W=[],K=$.code?` [${$.codeName||$.code}]`:"";if(W.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`}W.push(`
11425
+ Suggestion: ${$.suggestion}`);return J.join(" ")}function Aj($){let X=$.code?` [${$.code}]`:"",Z=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",J=`<!-- [${$.type} Error${X}]${Z}: ${FY($.message)}`;if($.suggestion)J+=` | Suggestion: ${FY($.suggestion)}`;return J+=" -->",J}function Rj($,X,Z){let W=[],K=$.code?` [${$.codeName||$.code}]`:"";if(W.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`}W.push(`
11424
11426
  \x1B[90mat\x1B[0m ${z}`)}if(W.push(`
11425
11427
 
11426
- ${$.message}`),X&&$.line){let z=Aj(X,$.line,2);if(z)W.push(`
11428
+ ${$.message}`),X&&$.line){let z=Tj(X,$.line,2);if(z)W.push(`
11427
11429
 
11428
11430
  \x1B[90mContext:\x1B[0m
11429
11431
  ${z}`)}if($.suggestion)W.push(`
11430
11432
 
11431
11433
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
11432
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function Vj($,X,Z){let J=$.split(`
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"}`),W.join("")}function Nj($,X,Z){let J=$.split(`
11433
11435
  `),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 q=(w+1).toString().padStart(4),W=w===X-1?">":" ";Q.push(`${W}${q} | ${J[w]}`)}return Q.join(`
11434
- `)}function Aj($,X,Z){let J=$.split(`
11436
+ `)}function Tj($,X,Z){let J=$.split(`
11435
11437
  `),Y=Math.max(0,X-Z-1),G=Math.min(J.length-1,X+Z-1),Q="\x1B[90m",w="\x1B[31m",q="\x1B[0m",W=[];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`;W.push(`${B}\x1B[90m${z}\x1B[0m | ${j}`)}return W.join(`
11436
- `)}function _Y($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Rj($,X){let J=$.substring(0,X).split(`
11437
- `);return{line:J.length,column:J[J.length-1].length}}function X0($,X,Z){return HY({type:$,message:X,code:Z,format:"html"}).formatted}async function v5($,X,Z){try{return await $()}catch(J){if(Z&&J instanceof Error)Z(J);return X}}var OY=y(()=>{v$();d$()});class v4{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(`
11438
+ `)}function FY($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Mj($,X){let J=$.substring(0,X).split(`
11439
+ `);return{line:J.length,column:J[J.length-1].length}}function J0($,X,Z){return VY({type:$,message:X,code:Z,format:"html"}).formatted}async function h5($,X,Z){try{return await $()}catch(J){if(Z&&J instanceof Error)Z(J);return X}}var AY=D(()=>{h$();p$()});class h4{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(`
11438
11440
  `).slice(1).join(`
11439
11441
  `)}`);if($.context)X.push(` Context: ${JSON.stringify($.context)}`);return X.join(`
11440
11442
  `)}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($)}
11441
11443
  `;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(`
11442
11444
 
11443
- `),"utf-8")}}async flush(){await this.writeQueue}}var P4,Y1,x4;var LY=y(()=>{d$();P4={isEnabled(){return f$().enableAutoRecovery},fixCommonSyntaxErrors($){let X=f$();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 q=(Z.match(new RegExp(`@${w}\\b`,"g"))||[]).length,W=(Z.match(new RegExp(`@end${w}\\b`,"g"))||[]).length;if(q>W){let K=q-W;for(let z=0;z<K;z++)Z+=`
11444
- @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(p7())return`<!-- ${$} failed: ${X.message} -->`;return"<!-- stx rendering error -->"}};Y1=new v4,x4={isDevelopment(){return p7()},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(`
11445
- `)}}});var FY=()=>{};var VY=y(()=>{v$();OY();LY();FY();d$()});var A1=y(()=>{VY()});function AY($,X,Z,J){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,q,W)=>{if(!W&&q.includes(":")){let K=q.split(":"),z=q,U=K.length>1?K[1]:"";if(U&&X[U])W=X[U];else if(z.startsWith("og:")&&X.openGraph&&X.openGraph[K[1]])W=X.openGraph[K[1]];else W="";return W?`<meta property="${i(z)}" content="${i(W)}">`:""}return W?`<meta name="${i(q)}" content="${i(W)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(Y))!==null){let w=Q.index,q=w+Q[0].length-1,W=1,K=q+1;while(K<Y.length&&W>0){if(Y[K]==="(")W++;else if(Y[K]===")"){if(W--,W===0)break}K++}if(W!==0)break;let z=Y.substring(q+1,K).trim(),U=K+1,B=(()=>{try{let j=k0(z,X);if(!j)return"";let _="<meta";if(j.name)_+=` name="${i(String(j.name))}"`;if(j.property)_+=` property="${i(String(j.property))}"`;if(j.httpEquiv)_+=` http-equiv="${i(String(j.httpEquiv))}"`;if(j.content)_+=` content="${i(String(j.content))}"`;return _+=">",_}catch(j){let _=j instanceof Error?j.message:String(j);return X0("MetaTag",_,s.EVALUATION_ERROR)}})();Y=Y.substring(0,w)+B+Y.substring(U),G.lastIndex=0}return Y}function RY($,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,q=1,W=w+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let K=J.substring(w+1,W).trim(),z=W+1,U=(()=>{try{let B=k0(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 X0("StructuredData",j,s.EVALUATION_ERROR)}})();J=J.substring(0,Q)+U+J.substring(z),Y.lastIndex=0}return J}function NY($,X,Z,J){let Y=$,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(Y))!==null){let w=Y.indexOf("{",Q.index+4),q=1,W=w+1,K=null,z=!1;while(W<Y.length&&q>0){let L=Y[W];if(z){z=!1,W++;continue}if(L==="\\"&&K){z=!0,W++;continue}if(K){if(L===K)K=null;W++;continue}if(L==='"'||L==="'"||L==="`"){K=L,W++;continue}if(L==="{")q++;else if(L==="}")q--;W++}if(q!==0)break;let U=Y.substring(W).match(/^\s*\)/);if(!U)break;let B=W+U[0].length,j=Y.substring(w,W),_=Y.substring(Q.index,B),H=((L)=>{try{let O=k0(L,X);if(!O)return"";let F="";if(O.title)F+=`<title>${i(O.title)}</title>
11445
+ `),"utf-8")}}async flush(){await this.writeQueue}}var g4,Q1,u4;var RY=D(()=>{p$();g4={isEnabled(){return d$().enableAutoRecovery},fixCommonSyntaxErrors($){let X=d$();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 q=(Z.match(new RegExp(`@${w}\\b`,"g"))||[]).length,W=(Z.match(new RegExp(`@end${w}\\b`,"g"))||[]).length;if(q>W){let K=q-W;for(let 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(r7())return`<!-- ${$} failed: ${X.message} -->`;return"<!-- stx rendering error -->"}};Q1=new h4,u4={isDevelopment(){return r7()},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 NY=()=>{};var TY=D(()=>{h$();AY();RY();NY();p$()});var M1=D(()=>{TY()});function MY($,X,Z,J){let Y=$;Y=Y.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(w,q,W)=>{if(!W&&q.includes(":")){let K=q.split(":"),z=q,U=K.length>1?K[1]:"";if(U&&X[U])W=X[U];else if(z.startsWith("og:")&&X.openGraph&&X.openGraph[K[1]])W=X.openGraph[K[1]];else W="";return W?`<meta property="${i(z)}" content="${i(W)}">`:""}return W?`<meta name="${i(q)}" content="${i(W)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(Y))!==null){let w=Q.index,q=w+Q[0].length-1,W=1,K=q+1;while(K<Y.length&&W>0){if(Y[K]==="(")W++;else if(Y[K]===")"){if(W--,W===0)break}K++}if(W!==0)break;let z=Y.substring(q+1,K).trim(),U=K+1,B=(()=>{try{let j=D0(z,X);if(!j)return"";let _="<meta";if(j.name)_+=` name="${i(String(j.name))}"`;if(j.property)_+=` property="${i(String(j.property))}"`;if(j.httpEquiv)_+=` http-equiv="${i(String(j.httpEquiv))}"`;if(j.content)_+=` content="${i(String(j.content))}"`;return _+=">",_}catch(j){let _=j instanceof Error?j.message:String(j);return J0("MetaTag",_,o.EVALUATION_ERROR)}})();Y=Y.substring(0,w)+B+Y.substring(U),G.lastIndex=0}return Y}function kY($,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,q=1,W=w+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let K=J.substring(w+1,W).trim(),z=W+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 J0("StructuredData",j,o.EVALUATION_ERROR)}})();J=J.substring(0,Q)+U+J.substring(z),Y.lastIndex=0}return J}function IY($,X,Z,J){let Y=$,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(Y))!==null){let w=Y.indexOf("{",Q.index+4),q=1,W=w+1,K=null,z=!1;while(W<Y.length&&q>0){let L=Y[W];if(z){z=!1,W++;continue}if(L==="\\"&&K){z=!0,W++;continue}if(K){if(L===K)K=null;W++;continue}if(L==='"'||L==="'"||L==="`"){K=L,W++;continue}if(L==="{")q++;else if(L==="}")q--;W++}if(q!==0)break;let U=Y.substring(W).match(/^\s*\)/);if(!U)break;let B=W+U[0].length,j=Y.substring(w,W),_=Y.substring(Q.index,B),H=((L)=>{try{let O=D0(L,X);if(!O)return"";let F="";if(O.title)F+=`<title>${i(O.title)}</title>
11446
11448
  `,F+=`<meta name="title" content="${i(O.title)}">
11447
11449
  `;if(O.description)F+=`<meta name="description" content="${i(O.description)}">
11448
11450
  `;if(O.keywords){let V=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;F+=`<meta name="keywords" content="${i(V)}">
@@ -11464,7 +11466,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
11464
11466
  `}if(V.site)F+=`<meta name="twitter:site" content="${i(V.site)}">
11465
11467
  `;if(V.creator)F+=`<meta name="twitter:creator" content="${i(V.creator)}">
11466
11468
  `}if(O.structuredData){let V=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${V}</script>
11467
- `}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return X0("SEO",`Error processing @seo directive: ${F}`,s.EVALUATION_ERROR)}})(j);Y=Y.substring(0,Q.index)+H+Y.substring(B),G.lastIndex=Q.index+H.length}return Y}function TY($,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 q="";if(X.image)q=X.image;else if(X.meta&&X.meta.image)q=X.meta.image;else if(X.openGraph&&X.openGraph.image)q=X.openGraph.image;else if(Z.seo?.defaultImage)q=Z.seo.defaultImage;else if(Z.defaultImage)q=Z.defaultImage;let W=`
11469
+ `}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return J0("SEO",`Error processing @seo directive: ${F}`,o.EVALUATION_ERROR)}})(j);Y=Y.substring(0,Q.index)+H+Y.substring(B),G.lastIndex=Q.index+H.length}return Y}function EY($,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 q="";if(X.image)q=X.image;else if(X.meta&&X.meta.image)q=X.meta.image;else if(X.openGraph&&X.openGraph.image)q=X.openGraph.image;else if(Z.seo?.defaultImage)q=Z.seo.defaultImage;else if(Z.defaultImage)q=Z.defaultImage;let W=`
11468
11470
  <!-- stx SEO Tags -->
11469
11471
  <meta name="title" content="${i(Q)}">
11470
11472
  <meta name="description" content="${i(w)}">
@@ -11480,8 +11482,8 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
11480
11482
  `;let K=$;if(!G)K=K.replace(/<head[^>]*>/,`$&
11481
11483
  <title>${i(Q)}</title>`);return K.replace(/<head[^>]*>/,`$&
11482
11484
  ${W}
11483
- `)}function i($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function IY($){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(`
11484
- `).trim()}var MY,kY;var m$=y(()=>{A1();I0();MY={name:"meta",handler:($,X,Z,J)=>{if(X.length<1)return X0("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let Y=X[0].replace(/['"]/g,""),G=X.length>1?X[1].replace(/['"]/g,""):"";return`<meta name="${i(Y)}" content="${i(G)}">`},hasEndTag:!1},kY={name:"structuredData",handler:($,X,Z,J)=>{if($.trim()==="")return X0("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let Y=JSON.parse($);if(!Y["@context"])Y["@context"]="https://schema.org";if(!Y["@type"])return X0("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Y)}</script>`}catch(Y){let G=Y instanceof Error?Y.message:String(Y);return X0("StructuredData",G,s.EVALUATION_ERROR)}},hasEndTag:!0}});import i7 from"path";function Nj($,X){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),J=Z?Z[1].trim():"",Y=X,G=[],Q=!0;if(J){let z=J.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let U=z[1],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((H)=>H.trim().replace(/['"`]/g,"")).filter((H)=>H.length>0);let _=U.match(/shadowDOM\s*:\s*(true|false)/);if(_)Q=_[1]==="true"}catch{}}let w=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=w?w[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),K=W?W[1].trim():"";return{tag:Y,props:G,template:q,styles:K,script:J,shadowDOM:Q}}function Tj($){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,"\\${"),q=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Z.map((z)=>`'${z}'`).join(", "),K=Z.map((z)=>`
11485
+ `)}function i($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function bY($){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 DY,yY;var i$=D(()=>{M1();y0();DY={name:"meta",handler:($,X,Z,J)=>{if(X.length<1)return J0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let Y=X[0].replace(/['"]/g,""),G=X.length>1?X[1].replace(/['"]/g,""):"";return`<meta name="${i(Y)}" content="${i(G)}">`},hasEndTag:!1},yY={name:"structuredData",handler:($,X,Z,J)=>{if($.trim()==="")return J0("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 J0("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 J0("StructuredData",G,o.EVALUATION_ERROR)}},hasEndTag:!0}});import o7 from"path";function kj($,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((H)=>H.trim().replace(/['"`]/g,"")).filter((H)=>H.length>0);let _=U.match(/shadowDOM\s*:\s*(true|false)/);if(_)Q=_[1]==="true"}catch{}}let w=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=w?w[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),K=W?W[1].trim():"";return{tag:Y,props:G,template:q,styles:K,script:J,shadowDOM:Q}}function Ij($){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,"\\${"),q=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Z.map((z)=>`'${z}'`).join(", "),K=Z.map((z)=>`
11485
11487
  get ${z}() {
11486
11488
  return this.getAttribute('${z}') || '';
11487
11489
  }
@@ -11532,16 +11534,16 @@ ${K}
11532
11534
  }
11533
11535
 
11534
11536
  customElements.define('${X}', ${Q});
11535
- `}async function EY($,X,Z,J){if(X.length<1)return X0("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let Y=X[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",w=[i7.join(i7.dirname(J),Q,`${Y}.stx`),i7.join(process.cwd(),Q,`${Y}.stx`),i7.join(i7.dirname(J),`${Y}.stx`)],q=null;for(let z of w)if(await n(z)){q=await Bun.file(z).text();break}if(!q)return X0("WebComponent",`Component file not found: ${Y}.stx`,s.FILE_NOT_FOUND);let W=Nj(q,Y);return`<script type="module">
11536
- ${Tj(W)}
11537
- </script>`}var DY=y(()=>{A1();y0()});var yY={};a(yY,{timingPlugin:()=>Dj,pluginManager:()=>Mj,definePlugin:()=>c$,debugPlugin:()=>Ej,createVariablesPlugin:()=>yj,createFilterPlugin:()=>Ij,createDirectivePlugin:()=>kj,PluginManager:()=>f4});function c$($){return $}class f4{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 kj($,X,Z={}){return{name:$,...Z,registerDirectives:()=>X}}function Ij($,X,Z={}){return{name:$,...Z,registerFilters:()=>X}}function yj($){return c$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(X){return{context:{...X.context,...$}}}})}var Mj,Ej,Dj;var bY=y(()=>{Mj=new f4;Ej=c$({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)}}),Dj=c$({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 vY={};a(vY,{validateConfig:()=>fj,resolveStxDirectories:()=>PY,loadStxConfig:()=>Z1,defineStxConfig:()=>xj,defaultConfig:()=>Q5,config:()=>k7});import l$ from"fs";import i0 from"path";import{loadConfigWithResult as bj}from"bunfig";function Sj($,X,Z){let J=X||"pages";if($)return{root:$,pagesDir:J};let Y=Z||process.cwd(),G=i0.join(Y,"resources","views"),Q=i0.join(Y,"resources","layouts");if(l$.existsSync(G)&&l$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=i0.join(Y,"resources","views","pages");if(l$.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 PY($,X){let Z=!$.root,J=Sj($.root,$.pagesDir,X);if($.root=J.root,$.pagesDir=J.pagesDir,Z&&J.root!=="."){let Y=`${X}::${J.root}`;if(!SY.has(Y))SY.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(i0.isAbsolute(Q)||Cj(Q,Y))continue;$[G]=i0.join(Y,Q)}}return $}function Pj($,X){let Z=["componentsDir","layoutsDir","partialsDir"];for(let J of Z){let Y=$[J];if(typeof Y!=="string"||!Y)continue;let G=i0.isAbsolute(Y)?Y:i0.join(X,Y);if(l$.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 vj($){if(d6($.stateDir),$.stateDir=V7(),$.cachePath=A7($.cachePath),$.build)$.build.cacheDir=A7($.build.cacheDir);if($.media?.cache)$.media.cache.directory=A7($.media.cache.directory);if($.story)$.story.outDir=A7($.story.outDir)}async function Z1($){if(!$){if(x5)return x5;if(p$)return p$}let X=$?i0.resolve($):process.cwd(),Z=CY.get(X);if(Z)return Z;let J=(async()=>{let G=(await bj({name:"stx",alias:"ui",cwd:X,defaultConfig:Q5,verbose:!1})).config;if(vj(G),PY(G,X),Pj(G,X),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (bY(),yY)),w=[],q=[];for(let W of G.plugins){let K=typeof W==="string"?W:W[0],z=typeof W==="string"?{}:W[1]||{};try{let U,B;try{U=await import(K),B=i0.dirname(U0.resolve(K))}catch{let _=i0.resolve(process.cwd(),K);U=await import(_),B=i0.dirname(_)}let j=U.default||U;if(Q.register(j,G),j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let H of _)w.push(i0.resolve(B,H))}if(j.pages){let _=i0.resolve(B,j.pages),H=z.path||"/";q.push({dir:_,prefix:H})}if(j.setup){let _={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,L)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=L},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:B,config:G};await j.setup(z,_)}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=q}return G})();if(CY.set(X,J),!$)p$=J,J.then((Y)=>{x5=Y}).catch(()=>{});return J}function xj($){return $}function fj($){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 Q5,SY,x5=null,CY,p$=null,k7;var F1=y(()=>{i9();n9();r9();o9();$4();mJ();b4();BY();m$();R7();DY();Q5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:A5,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:BJ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:EY,hasEndTag:!1,description:"Include a web component in the template"},p6,i6,MY,kY,n6,o6,s6,r6,e6,Z2,dJ,y4,...jY],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}};SY=new Set;CY=new Map;k7=new Proxy(Q5,{get($,X){if(x5&&X in x5)return x5[X];if(!p$)Z1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[X]}})});var dY={};a(dY,{resetCssCache:()=>pj,resetCrosswindCache:()=>ij,rebuildCrosswindCSS:()=>nj,loadCrosswindConfig:()=>d4,loadCrosswind:()=>u4,injectCrosswindCSS:()=>r7,getCrosswindServeAsset:()=>uj,getCachedCSS:()=>rj,generateCrosswindCSS:()=>uY,extractClassNames:()=>hY,buildCrosswindCSS:()=>gY});import Q0 from"path";import{hasLocalConfig as gj}from"bunfig";function n$($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function g4($,X){if(R1.has($))R1.delete($);else if(R1.size>=fY)R1.delete(R1.keys().next().value);R1.set($,X)}function hj($){let X=n$($);if(G1.has(X))G1.delete(X);else if(G1.size>=fY)G1.delete(G1.keys().next().value);return G1.set(X,$),X}function uj($){let X=G1.get($);if(X===void 0)return;return G1.delete($),G1.set($,X),X}async function dj($){if(!g1)return null;try{let X=Bun.file(Q0.join(g1,`cw-${n$($)}.css`));if(!await X.exists())return null;return await X.text()}catch{return null}}async function mj($,X){if(!g1)return;try{if(!fs.existsSync(g1))fs.mkdirSync(g1,{recursive:!0});await Bun.write(Q0.join(g1,`cw-${n$($)}.css`),X)}catch{}}async function xY($){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 cj(){let $=[],X=process.cwd();while(X!==Q0.dirname(X))$.push(Q0.join(X,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(Q0.join(X,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(Q0.join(X,"pantry","@cwcss","crosswind","dist","index.js")),$.push(Q0.join(X,"pantry","@cwcss","crosswind","src","index.ts")),$.push(Q0.join(X,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(Q0.join(X,"pantry","@stacksjs","crosswind","dist","index.js")),X=Q0.dirname(X);return $}function lj(){let $=[],X=process.env.HOME||process.env.USERPROFILE||"";if(X){let Z=[Q0.join(X,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),Q0.join(X,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),Q0.join(X,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),Q0.join(X,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),Q0.join(X,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),Q0.join(X,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Z)}return $.push(Q0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(Q0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function u4(){if(h4)return K1;h4=!0;try{let $=async(Y)=>{for(let G of Y){if(!await Bun.file(G).exists())continue;let Q=await xY(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded from ${Q0.dirname(Q0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let Y=Q0.resolve(process.env.CROSSWIND_SRC),G=await $([Y]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Y}`);return K1=G,K1}let X=await $(cj());if(X)return K1=X,K1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of Z){let G=await xY(Y);if(G){if(K1=G,!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} CSS engine loaded`);return K1}}let J=await $(lj());if(J)return K1=J,K1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${O0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${O0.reset}`),console.warn(`${O0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${O0.reset}`),null}}function pj(){R1.clear(),G1.clear()}function ij(){K1=null,h4=!1,Q1=null,n7="",R1.clear(),G1.clear(),i$=null}async function d4($){try{if(!gj({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=Q0.relative($,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from ${J||Z.path}`);return Z.config}catch(X){if(X instanceof Error&&X.name==="ConfigNotFoundError")return null;return console.warn(`${O0.yellow}[Crosswind]${O0.reset} Failed to load crosswind config:`,X instanceof Error?X.message:X),null}}async function gY($){if(f5)return n7;f5=!0;try{let X=await u4();if(!X||!X.build)return f5=!1,"";if(!Q1)Q1=await d4($);if(!Q1)return f5=!1,"";let Z=X.defaultConfig?.theme||{},J=Q1.theme||{},Y={...X.defaultConfig,...Q1,theme:{...Z,...J,extend:{...Z.extend||{},...J.extend||{}}}},G=performance.now(),Q=await X.build(Y),w=performance.now()-G;if(n7=Q.css,console.log(`${O0.cyan}[Crosswind]${O0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),Y.output){let q=Q0.isAbsolute(Y.output)?Y.output:Q0.join($,Y.output),W=Q0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,Q.css)}return f5=!1,Q.css}catch(X){return console.error(`${O0.red}[Crosswind]${O0.reset} Build error:`,X),f5=!1,n7}}async function nj($){Q1=null,await gY($)}function rj(){return n7}function hY($){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 q of w.slice(1,-1).split(/\s+/))if(q.trim())X.add(q.trim())}G=Y.exec($)}return X}async function uY($,X){try{let Z=await u4();if(!Z)return"";let J=typeof Z.extractClasses==="function"?Z.extractClasses($):hY($);if(J.size===0)return"";let Y=X?Q0.resolve(X):process.cwd();if(!g1)g1=H1(Y,"cache");let G=[...J].sort().join(" "),Q=`${i$||"default"}::${G}`,w=R1.get(Q);if(w!==void 0)return g4(Q,w),w;let q=await dj(Q);if(q!==null)return g4(Q,q),q;if(!Q1){let A=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (F1(),vY)),N=await R(Y);if(N.css)if(typeof N.css==="string"){let M=Q0.isAbsolute(N.css)?N.css:Q0.resolve(Y,N.css);if(await Bun.file(M).exists()){let k=await import(M);A=k.default||k,console.log(`${O0.green}[Crosswind]${O0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(A={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let M=Q0.isAbsolute(N.css.config)?N.css.config:Q0.resolve(Y,N.css.config);if(await Bun.file(M).exists()){let k=await import(M);A={...k.default||k,...A}}}console.log(`${O0.green}[Crosswind]${O0.reset} Using inline CSS config from stx.config.ts`)}}catch{}Q1=A||await d4(Y);try{i$=n$(JSON.stringify(Q1??{}))}catch{i$="unhashable"}}let W=Z.defaultConfig||Z.config,K=Q1||{},z=g6(W,K),{safelist:U,includePreflight:B,minify:j,tokenCSS:_}=z,H=z.config,L=new Z.CSSGenerator(H);for(let A of U)L.generate(A);for(let A of J)L.generate(A);let O=L.toCSS(B,j),F=H.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 M of N)L.generate(M)}O=L.toCSS(B,j);let V=O.split(`
11538
- `);for(let[A,R]of Object.entries(F)){if(!J.has(A)&&!U.includes(A))continue;let N=R.split(/\s+/).filter(Boolean),M=[],k=[];for(let T of N){let D=T.startsWith("dark:"),b=`.${(D?T.slice(5):T).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let E=0;E<V.length;E++){let v=V[E].trim();if(v===`${b} {`||v.startsWith(`${b} {`)){let x=E,f="";while(x<V.length){if(f+=V[x],V[x].includes("}"))break;x++}let h=f.match(/\{([^}]+)\}/);if(h)if(D)k.push(h[1].trim());else M.push(h[1].trim());break}}}if(M.length)O+=`
11539
- .${A} { ${M.join(" ")} }`;if(k.length)O+=`
11540
- @media (prefers-color-scheme: dark) { .dark .${A} { ${k.join(" ")} } }`}return O=_+O,g4(Q,O),mj(Q,O),O}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function r7($,X,Z=!1){let J=await uY($,X);if(!J)return $;let Y=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${hj(J)}.css">`:`<style data-crosswind="generated">
11537
+ `}async function SY($,X,Z,J){if(X.length<1)return J0("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=[o7.join(o7.dirname(J),Q,`${Y}.stx`),o7.join(process.cwd(),Q,`${Y}.stx`),o7.join(o7.dirname(J),`${Y}.stx`)],q=null;for(let z of w)if(await n(z)){q=await Bun.file(z).text();break}if(!q)return J0("WebComponent",`Component file not found: ${Y}.stx`,o.FILE_NOT_FOUND);let W=kj(q,Y);return`<script type="module">
11538
+ ${Ij(W)}
11539
+ </script>`}var CY=D(()=>{M1();A0()});var PY={};t(PY,{timingPlugin:()=>Sj,pluginManager:()=>Ej,definePlugin:()=>n$,debugPlugin:()=>bj,createVariablesPlugin:()=>Cj,createFilterPlugin:()=>yj,createDirectivePlugin:()=>Dj,PluginManager:()=>d4});function n$($){return $}class d4{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 Dj($,X,Z={}){return{name:$,...Z,registerDirectives:()=>X}}function yj($,X,Z={}){return{name:$,...Z,registerFilters:()=>X}}function Cj($){return n$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(X){return{context:{...X.context,...$}}}})}var Ej,bj,Sj;var vY=D(()=>{Ej=new d4;bj=n$({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)}}),Sj=n$({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 hY={};t(hY,{validateConfig:()=>uj,resolveStxDirectories:()=>gY,loadStxConfig:()=>Y1,defineStxConfig:()=>hj,defaultConfig:()=>z5,config:()=>y7});import r$ from"fs";import o0 from"path";import{loadConfigWithResult as Pj}from"bunfig";function vj($,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(r$.existsSync(G)&&r$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=o0.join(Y,"resources","views","pages");if(r$.existsSync(w))return{root:"resources/views",pagesDir:J};return{root:".",pagesDir:J}}function xj($,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 gY($,X){let Z=!$.root,J=vj($.root,$.pagesDir,X);if($.root=J.root,$.pagesDir=J.pagesDir,Z&&J.root!=="."){let Y=`${X}::${J.root}`;if(!xY.has(Y))xY.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)||xj(Q,Y))continue;$[G]=o0.join(Y,Q)}}return $}function fj($,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(r$.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 gj($){if(p6($.stateDir),$.stateDir=T7(),$.cachePath=M7($.cachePath),$.build)$.build.cacheDir=M7($.build.cacheDir);if($.media?.cache)$.media.cache.directory=M7($.media.cache.directory);if($.story)$.story.outDir=M7($.story.outDir)}async function Y1($){if(!$){if(u5)return u5;if(o$)return o$}let X=$?o0.resolve($):process.cwd(),Z=fY.get(X);if(Z)return Z;let J=(async()=>{let G=(await Pj({name:"stx",alias:"ui",cwd:X,defaultConfig:z5,verbose:!1})).config;if(gj(G),gY(G,X),fj(G,X),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (vY(),PY)),w=[],q=[];for(let W of G.plugins){let K=typeof W==="string"?W:W[0],z=typeof W==="string"?{}:W[1]||{};try{let U,B;try{U=await import(K),B=o0.dirname(B0.resolve(K))}catch{let _=o0.resolve(process.cwd(),K);U=await import(_),B=o0.dirname(_)}let j=U.default||U;if(Q.register(j,G),j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let H of _)w.push(o0.resolve(B,H))}if(j.pages){let _=o0.resolve(B,j.pages),H=z.path||"/";q.push({dir:_,prefix:H})}if(j.setup){let _={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,L)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=L},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:B,config:G};await j.setup(z,_)}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=q}return G})();if(fY.set(X,J),!$)o$=J,J.then((Y)=>{u5=Y}).catch(()=>{});return J}function hj($){return $}function uj($){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 z5,xY,u5=null,fY,o$=null,y7;var R1=D(()=>{s9();a9();t9();e9();Y4();iJ();v4();LY();i$();k7();CY();z5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:T5,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:LJ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:SY,hasEndTag:!1,description:"Include a web component in the template"},o6,s6,DY,yY,a6,e6,$2,t6,J2,Q2,pJ,P4,...OY],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}};xY=new Set;fY=new Map;y7=new Proxy(z5,{get($,X){if(u5&&X in u5)return u5[X];if(!o$)Y1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[X]}})});var pY={};t(pY,{resetCssCache:()=>rj,resetCrosswindCache:()=>oj,rebuildCrosswindCSS:()=>sj,loadCrosswindConfig:()=>p4,loadCrosswind:()=>l4,injectCrosswindCSS:()=>a7,getCrosswindServeAsset:()=>cj,getCachedCSS:()=>aj,generateCrosswindCSS:()=>lY,extractClassNames:()=>cY,buildCrosswindCSS:()=>mY});import q0 from"path";import{hasLocalConfig as dj}from"bunfig";function a$($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function m4($,X){if(k1.has($))k1.delete($);else if(k1.size>=dY)k1.delete(k1.keys().next().value);k1.set($,X)}function mj($){let X=a$($);if(w1.has(X))w1.delete(X);else if(w1.size>=dY)w1.delete(w1.keys().next().value);return w1.set(X,$),X}function cj($){let X=w1.get($);if(X===void 0)return;return w1.delete($),w1.set($,X),X}async function lj($){if(!m1)return null;try{let X=Bun.file(q0.join(m1,`cw-${a$($)}.css`));if(!await X.exists())return null;return await X.text()}catch{return null}}async function pj($,X){if(!m1)return;try{if(!fs.existsSync(m1))fs.mkdirSync(m1,{recursive:!0});await Bun.write(q0.join(m1,`cw-${a$($)}.css`),X)}catch{}}async function uY($){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 ij(){let $=[],X=process.cwd();while(X!==q0.dirname(X))$.push(q0.join(X,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(q0.join(X,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(q0.join(X,"pantry","@cwcss","crosswind","dist","index.js")),$.push(q0.join(X,"pantry","@cwcss","crosswind","src","index.ts")),$.push(q0.join(X,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(q0.join(X,"pantry","@stacksjs","crosswind","dist","index.js")),X=q0.dirname(X);return $}function nj(){let $=[],X=process.env.HOME||process.env.USERPROFILE||"";if(X){let Z=[q0.join(X,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),q0.join(X,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),q0.join(X,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),q0.join(X,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),q0.join(X,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),q0.join(X,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Z)}return $.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function l4(){if(c4)return B1;c4=!0;try{let $=async(Y)=>{for(let G of Y){if(!await Bun.file(G).exists())continue;let Q=await uY(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${F0.green}[Crosswind]${F0.reset} CSS engine loaded from ${q0.dirname(q0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let Y=q0.resolve(process.env.CROSSWIND_SRC),G=await $([Y]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Y}`);return B1=G,B1}let X=await $(ij());if(X)return B1=X,B1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of Z){let G=await uY(Y);if(G){if(B1=G,!process.env.STACKS_DEV_QUIET)console.log(`${F0.green}[Crosswind]${F0.reset} CSS engine loaded`);return B1}}let J=await $(nj());if(J)return B1=J,B1;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 rj(){k1.clear(),w1.clear()}function oj(){B1=null,c4=!1,q1=null,s7="",k1.clear(),w1.clear(),s$=null}async function p4($){try{if(!dj({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=q0.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 mY($){if(d5)return s7;d5=!0;try{let X=await l4();if(!X||!X.build)return d5=!1,"";if(!q1)q1=await p4($);if(!q1)return d5=!1,"";let Z=X.defaultConfig?.theme||{},J=q1.theme||{},Y={...X.defaultConfig,...q1,theme:{...Z,...J,extend:{...Z.extend||{},...J.extend||{}}}},G=performance.now(),Q=await X.build(Y),w=performance.now()-G;if(s7=Q.css,console.log(`${F0.cyan}[Crosswind]${F0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),Y.output){let q=q0.isAbsolute(Y.output)?Y.output:q0.join($,Y.output),W=q0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,Q.css)}return d5=!1,Q.css}catch(X){return console.error(`${F0.red}[Crosswind]${F0.reset} Build error:`,X),d5=!1,s7}}async function sj($){q1=null,await mY($)}function aj(){return s7}function cY($){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 q of w.slice(1,-1).split(/\s+/))if(q.trim())X.add(q.trim())}G=Y.exec($)}return X}async function lY($,X){try{let Z=await l4();if(!Z)return"";let J=typeof Z.extractClasses==="function"?Z.extractClasses($):cY($);if(J.size===0)return"";let Y=X?q0.resolve(X):process.cwd();if(!m1)m1=F1(Y,"cache");let G=[...J].sort().join(" "),Q=`${s$||"default"}::${G}`,w=k1.get(Q);if(w!==void 0)return m4(Q,w),w;let q=await lj(Q);if(q!==null)return m4(Q,q),q;if(!q1){let A=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (R1(),hY)),N=await R(Y);if(N.css)if(typeof N.css==="string"){let T=q0.isAbsolute(N.css)?N.css:q0.resolve(Y,N.css);if(await Bun.file(T).exists()){let k=await import(T);A=k.default||k,console.log(`${F0.green}[Crosswind]${F0.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=q0.isAbsolute(N.css.config)?N.css.config:q0.resolve(Y,N.css.config);if(await Bun.file(T).exists()){let k=await import(T);A={...k.default||k,...A}}}console.log(`${F0.green}[Crosswind]${F0.reset} Using inline CSS config from stx.config.ts`)}}catch{}q1=A||await p4(Y);try{s$=a$(JSON.stringify(q1??{}))}catch{s$="unhashable"}}let W=Z.defaultConfig||Z.config,K=q1||{},z=m6(W,K),{safelist:U,includePreflight:B,minify:j,tokenCSS:_}=z,H=z.config,L=new Z.CSSGenerator(H);for(let A of U)L.generate(A);for(let A of J)L.generate(A);let O=L.toCSS(B,j),F=H.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)}O=L.toCSS(B,j);let V=O.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=[],k=[];for(let M of N){let E=M.startsWith("dark:"),b=`.${(E?M.slice(5):M).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<V.length;y++){let P=V[y].trim();if(P===`${b} {`||P.startsWith(`${b} {`)){let x=y,f="";while(x<V.length){if(f+=V[x],V[x].includes("}"))break;x++}let u=f.match(/\{([^}]+)\}/);if(u)if(E)k.push(u[1].trim());else T.push(u[1].trim());break}}}if(T.length)O+=`
11541
+ .${A} { ${T.join(" ")} }`;if(k.length)O+=`
11542
+ @media (prefers-color-scheme: dark) { .dark .${A} { ${k.join(" ")} } }`}return O=_+O,m4(Q,O),pj(Q,O),O}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function a7($,X,Z=!1){let J=await lY($,X);if(!J)return $;let Y=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${mj(J)}.css">`:`<style data-crosswind="generated">
11541
11543
  ${J}
11542
11544
  </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}
11543
11545
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
11544
- ${Y}`);return Y+$}var K1=null,h4=!1,Q1=null,n7="",f5=!1,fY=256,R1,G1,g1=null,i$=null;var r$=y(()=>{h6();R7();m6();R1=new Map,G1=new Map});function mY(){return`
11546
+ ${Y}`);return Y+$}var B1=null,c4=!1,q1=null,s7="",d5=!1,dY=256,k1,w1,m1=null,s$=null;var t$=D(()=>{c6();k7();i6();k1=new Map,w1=new Map});function iY(){return`
11545
11547
  // STX Lifecycle Runtime
11546
11548
  (function() {
11547
11549
  if (typeof window === 'undefined') return;
@@ -11886,7 +11888,7 @@ else {
11886
11888
 
11887
11889
  console.log('[stx] Lifecycle runtime initialized');
11888
11890
  })();
11889
- `}function m4($){return Symbol($)}var YM,GM,QM;var cY=y(()=>{YM=m4("theme"),GM=m4("router"),QM=m4("i18n")});import*as pY from"crypto";function lY($){let X=/\$(\w+)\./g,Z=[],J;while((J=X.exec($))!==null)if(!Z.includes(J[1]))Z.push(J[1]);return Z}function oj(){return`stx-${pY.randomBytes(4).toString("hex")}`}function sj($){return/\$\w+\./.test($)}function aj($){let X=[],Z=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(J,(G,Q,w,q)=>{if(["script","style","template"].includes(Q.toLowerCase()))return G;let W=[],K=!1,z=w,U=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...w.matchAll(U)];for(let H of B){let L=H[0],O=H[1],F=H[2];if(sj(F)){K=!0;let V=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let A=V[1];if(W.push({attr:O,expr:A,fullMatch:L,originalAttr:O}),lY(A).forEach((N)=>Z.add(N)),O==="text")z=z.replace(L,"");else if(O==="class")z=z.replace(L,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(L,"");else z=z.replace(L,`${O}=""`)}}}if(!K)return G;let j=z.match(/\bid\s*=\s*"([^"]+)"/),_;if(j)_=j[1];else _=oj(),z=` id="${_}"${z}`;for(let H of W)X.push({elementId:_,attribute:H.attr,expression:H.expr,stores:lY(H.expr)});return`<${Q}${z}${q}`}),{html:Y,bindings:X,stores:Z}}function tj($,X){if($.length===0)return"";let Z=Array.from(X),J=`
11891
+ `}function i4($){return Symbol($)}var WM,KM,zM;var nY=D(()=>{WM=i4("theme"),KM=i4("router"),zM=i4("i18n")});import*as oY from"crypto";function rY($){let X=/\$(\w+)\./g,Z=[],J;while((J=X.exec($))!==null)if(!Z.includes(J[1]))Z.push(J[1]);return Z}function tj(){return`stx-${oY.randomBytes(4).toString("hex")}`}function ej($){return/\$\w+\./.test($)}function $B($){let X=[],Z=new Set,J=/<(\w+)([^>]*?)(\s*\/?>)/g,Y=$;return Y=Y.replace(J,(G,Q,w,q)=>{if(["script","style","template"].includes(Q.toLowerCase()))return G;let W=[],K=!1,z=w,U=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...w.matchAll(U)];for(let H of B){let L=H[0],O=H[1],F=H[2];if(ej(F)){K=!0;let V=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let A=V[1];if(W.push({attr:O,expr:A,fullMatch:L,originalAttr:O}),rY(A).forEach((N)=>Z.add(N)),O==="text")z=z.replace(L,"");else if(O==="class")z=z.replace(L,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(L,"");else z=z.replace(L,`${O}=""`)}}}if(!K)return G;let j=z.match(/\bid\s*=\s*"([^"]+)"/),_;if(j)_=j[1];else _=tj(),z=` id="${_}"${z}`;for(let H of W)X.push({elementId:_,attribute:H.attr,expression:H.expr,stores:rY(H.expr)});return`<${Q}${z}${q}`}),{html:Y,bindings:X,stores:Z}}function XB($,X){if($.length===0)return"";let Z=Array.from(X),J=`
11890
11892
  <script>
11891
11893
  (function() {
11892
11894
  'use strict';
@@ -12044,10 +12046,10 @@ else {
12044
12046
  }
12045
12047
  })();
12046
12048
  </script>
12047
- `,J}function iY($){let{html:X,bindings:Z,stores:J}=aj($);if(Z.length===0)return $;let Y=tj(Z,J),G=X.lastIndexOf("</body>");if(G!==-1)return X.slice(0,G)+Y+X.slice(G);return X+Y}var nY=()=>{};function ej($){let X=$.analytics;if(!X?.enabled)return"";switch(X.driver){case"fathom":return $B(X);case"google-analytics":return XB(X);case"plausible":return ZB(X);case"self-hosted":return JB(X);case"custom":return YB(X);default:return""}}function $B($){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="${n0(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="${n0(X.canonical)}"`);if(X.auto===!1)Y.push('data-auto="false"');return`
12049
+ `,J}function sY($){let{html:X,bindings:Z,stores:J}=$B($);if(Z.length===0)return $;let Y=XB(Z,J),G=X.lastIndexOf("</body>");if(G!==-1)return X.slice(0,G)+Y+X.slice(G);return X+Y}var aY=()=>{};function ZB($){let X=$.analytics;if(!X?.enabled)return"";switch(X.driver){case"fathom":return JB(X);case"google-analytics":return YB(X);case"plausible":return GB(X);case"self-hosted":return QB(X);case"custom":return wB(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`
12048
12050
  <!-- Fathom Analytics -->
12049
- <script src="${n0(Z)}" ${Y.join(" ")}${J}></script>
12050
- `}function XB($){let X=$.googleAnalytics;if(!X?.measurementId)return"";let Z=n0(X.measurementId),J=X.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
12051
+ <script src="${s0(Z)}" ${Y.join(" ")}${J}></script>
12052
+ `}function YB($){let X=$.googleAnalytics;if(!X?.measurementId)return"";let Z=s0(X.measurementId),J=X.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
12051
12053
  <!-- Google Analytics -->
12052
12054
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Z}"></script>
12053
12055
  <script>
@@ -12057,10 +12059,10 @@ else {
12057
12059
  gtag('config', '${Z}');
12058
12060
  ${J}
12059
12061
  </script>
12060
- `}function ZB($){let X=$.plausible;if(!X?.domain)return"";let Z=X.scriptUrl||"https://plausible.io/js/script.js",J=[`data-domain="${n0(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`
12062
+ `}function GB($){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`
12061
12063
  <!-- Plausible Analytics -->
12062
- <script defer data-domain="${n0(X.domain)}" src="${n0(Y)}"></script>
12063
- `}function JB($){let X=$.selfHosted;if(!X?.siteId||!X?.apiEndpoint)return"";let Z=n0(X.siteId),J=n0(X.apiEndpoint),Y=X.honorDnt?'if(n.doNotTrack==="1")return;':"",G=X.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=X.trackOutboundLinks?`
12064
+ <script defer data-domain="${s0(X.domain)}" src="${s0(Y)}"></script>
12065
+ `}function QB($){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?`
12064
12066
  d.addEventListener('click',function(e){
12065
12067
  var a=e.target.closest('a');
12066
12068
  if(a&&a.hostname!==location.hostname){
@@ -12093,15 +12095,15 @@ else {
12093
12095
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
12094
12096
  })();
12095
12097
  </script>
12096
- `}function YB($){let X=$.custom;if(!X)return"";if(X.inlineScript)return`
12098
+ `}function wB($){let X=$.custom;if(!X)return"";if(X.inlineScript)return`
12097
12099
  <!-- Custom Analytics -->
12098
12100
  <script>
12099
12101
  ${X.inlineScript}
12100
12102
  </script>
12101
- `;if(!X.scriptUrl)return"";let Z=[];if(X.scriptId)Z.push(`id="${n0(X.scriptId)}"`);if(X.attributes)for(let[Y,G]of Object.entries(X.attributes))Z.push(`${n0(Y)}="${n0(G)}"`);return`
12103
+ `;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`
12102
12104
  <!-- Custom Analytics -->
12103
- <script${Z.length>0?` ${Z.join(" ")}`:""} src="${n0(X.scriptUrl)}" defer></script>
12104
- `}function rY($,X){let Z=ej(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 n0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var oY=()=>{};function o$($){let X=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!X)return null;try{return Function(`return ${X[1]}`)()}catch{return null}}function sY($){let X=$?.layout;if(X===!1)return!1;return typeof X==="string"&&X.trim()?X.trim():void 0}function aY($,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 wB($){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,q=aY(Q,"x-data");if(!q)continue;let W=`__stx_scope_${GB++}`,K=aY(Q,"x-init"),z=qB($,G,w+Y.length),U=$.slice(w,z.endIndex),B=WB(U);X.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:K,bindings:[],refs:B})}return X}function qB($,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 q=G.exec($),W=Q.exec($),K=w.exec($);if(K&&K.index<(q?.index??1/0)){Y=K.index+K[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)J++,Y=q.index+q[0].length;else{if(J--,J===0)return{endIndex:W.index+W[0].length};Y=W.index+W[0].length}}return{endIndex:$.length}}function WB($){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=KB(G);X.set(Q,w)}return X}function KB($){let X=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(X)return X[1];return`__stx_el_${QB++}`}function zB(){return`
12105
+ <script${Z.length>0?` ${Z.join(" ")}`:""} src="${s0(X.scriptUrl)}" defer></script>
12106
+ `}function tY($,X){let Z=ZB(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 eY=()=>{};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 $G($){let X=$?.layout;if(X===!1)return!1;return typeof X==="string"&&X.trim()?X.trim():void 0}function XG($,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 KB($){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,q=XG(Q,"x-data");if(!q)continue;let W=`__stx_scope_${qB++}`,K=XG(Q,"x-init"),z=zB($,G,w+Y.length),U=$.slice(w,z.endIndex),B=UB(U);X.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:K,bindings:[],refs:B})}return X}function zB($,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 q=G.exec($),W=Q.exec($),K=w.exec($);if(K&&K.index<(q?.index??1/0)){Y=K.index+K[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)J++,Y=q.index+q[0].length;else{if(J--,J===0)return{endIndex:W.index+W[0].length};Y=W.index+W[0].length}}return{endIndex:$.length}}function UB($){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=jB(G);X.set(Q,w)}return X}function jB($){let X=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(X)return X[1];return`__stx_el_${WB++}`}function BB(){return`
12105
12107
  // STX Reactive Runtime - x-cloak and transition CSS
12106
12108
  (function() {
12107
12109
  var style = document.createElement('style');
@@ -12308,7 +12310,7 @@ window.__stx_reactive = (function() {
12308
12310
 
12309
12311
  return { initScope: initScope, reactive: reactive };
12310
12312
  })();
12311
- `}function tY($,X){let Z=$.replace(/\{!!([\s\S]*?)!!\}/g,(w,q)=>{try{let W=m0(q,X,!0);if(W===void 0)return w;return String(W)}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 q=Z.indexOf("}}",Y+2);if(q!==-1){let W=Z.slice(Y,q+2);J+=Q(Z.slice(Y+2,q),W,G),Y=q+2;continue}}if(G){if(w===G)G=null}else if(w==="'"||w==='"'||w==="`")G=w;J+=w,Y++}return J;function Q(w,q,W){let K;try{K=m0(w,X,!0)}catch{return q}if(K===void 0)return q;if(W){let z=String(K).replace(/\\/g,"\\\\").replace(new RegExp(W==="`"?"`":W,"g"),`\\${W}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return W==="`"?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 UB($,X){if($.length===0)return"";let Z=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),G=tY(J.stateExpr,X),Q=J.initExpr?tY(J.initExpr,X):null,w=JSON.stringify(G),q=Q?JSON.stringify(Q):"null";return`
12313
+ `}function ZG($,X){let Z=$.replace(/\{!!([\s\S]*?)!!\}/g,(w,q)=>{try{let W=i0(q,X,!0);if(W===void 0)return w;return String(W)}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 q=Z.indexOf("}}",Y+2);if(q!==-1){let W=Z.slice(Y,q+2);J+=Q(Z.slice(Y+2,q),W,G),Y=q+2;continue}}if(G){if(w===G)G=null}else if(w==="'"||w==='"'||w==="`")G=w;J+=w,Y++}return J;function Q(w,q,W){let K;try{K=i0(w,X,!0)}catch{return q}if(K===void 0)return q;if(W){let z=String(K).replace(/\\/g,"\\\\").replace(new RegExp(W==="`"?"`":W,"g"),`\\${W}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return W==="`"?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 _B($,X){if($.length===0)return"";let Z=$.map((J)=>{let Y=JSON.stringify(Object.fromEntries(J.refs)),G=ZG(J.stateExpr,X),Q=J.initExpr?ZG(J.initExpr,X):null,w=JSON.stringify(G),q=Q?JSON.stringify(Q):"null";return`
12312
12314
  (function() {
12313
12315
  var scopeEl = document.querySelector('${J.selector}');
12314
12316
  if (!scopeEl) return;
@@ -12317,16 +12319,16 @@ window.__stx_reactive = (function() {
12317
12319
  })();`}).join(`
12318
12320
  `);return`
12319
12321
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
12320
- ${zB()}
12322
+ ${BB()}
12321
12323
  ${Z}
12322
- </script>`}function eY($,X,Z){if(!BB($))return $;let J=wB($);if(J.length===0)return $;let Y=jB($,J),G=UB(J,X),Q=Y.lastIndexOf("</body>");if(Q!==-1)Y=Y.slice(0,Q)+G+`
12323
- `+Y.slice(Q);else Y+=G;return Y}function jB($,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 q=/data-stx-scope="([^"]*)"/.exec(Q);if(q)return w.id=q[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 BB($){return/x-data\s*=\s*["']/.test($)}var GB=0,QB=0;var $G=y(()=>{W1()});import _B from"fs";import c4 from"path";import{createHighlighter as HB}from"ts-syntax-highlighter";async function OB($,X={}){try{if(!await n($))throw Error(`Markdown file not found: ${$}`);let J=(await _B.promises.stat($)).mtime.getTime();if(X.cache&&l4.has($)){let z=l4.get($);if(z.updatedAt>=J)return{content:z.content,data:z.data}}let Y=await Bun.file($).text(),{data:G,content:Q}=Y2(Y),w=X.markdown||k7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=N7(Q,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)W=await LB(W,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:W,data:G||{}};if(X.cache)l4.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:B0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function LB($,X,Z){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!s$)try{s$=await HB({theme:X||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),$}let Y=async(w,q,W,K)=>{let z=K.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=W||(Z?"text":"");if(!U)return w;try{if(!s$.getSupportedLanguages().includes(U))return w;return(await s$.highlight(z,U,{theme:X})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return w},G=$,Q=$.matchAll(J);for(let w of Q){let[q,W,K,z]=w,U=await Y(q,W,K,z);G=G.replace(q,U)}return G}async function XG($,X,Z="",J={}){return await FB($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,w,q,W)=>{try{let K=w;if(!c4.isAbsolute(w))K=c4.resolve(c4.dirname(Z),w);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),M=R.startsWith("'")&&R.endsWith("'");if(N||M)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 OB(K,J),j={...X,...B,...z},_=U,H=/\{\{([^}]+)\}\}/g;return _=_.replace(H,(L,O)=>{let F=O.trim();return j[F]!==void 0?String(j[F]):L}),_}catch(K){let z=K instanceof Error?K.message:String(K);return B0("Markdown File",`Error including markdown file: ${z}`,Z,$,W,Q)}})}async function FB($,X,Z){let J=[],Y;while((Y=X.exec($))!==null){let w=Y[0],q=Y.index,W=Y;J.push(Z(...W).then((K)=>({match:w,replacement:K,index:q})))}let G=await Promise.all(J);G.sort((w,q)=>q.index-w.index);let Q=$;for(let{match:w,replacement:q}of G)Q=Q.replace(w,()=>q);return Q}var l4,s$=null;var ZG=y(()=>{F1();y0();l4=new Map});function h1($,X){try{let Z=$.trim();if(q0(Z))return W0(Z,Object.keys(X))(...Object.values(X));else return G0(Z,X)}catch{return!1}}var JG=y(()=>{I0()});function VB($,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=MX(J,Q);if(!w)break;try{let q;if(q0(w.expression))q=W0(w.expression,Object.keys(X))(...Object.values(X));else q=G0(w.expression,X);let W="",K=!1;for(let z of w.cases)if(z.type==="default"){if(!K)W=z.content.trim()}else try{let U;if(z.value&&q0(z.value))U=W0(z.value,Object.keys(X))(...Object.values(X));else if(z.value)U=G0(z.value,X);if(q===U){W=z.content.trim(),K=!0;break}}catch{continue}J=J.substring(0,Q)+W+J.substring(w.end),Y=!0}catch(q){let W=q instanceof Error?q.message:String(q),K=X0("Switch",`Error evaluating @switch expression: ${W}`,s.EVALUATION_ERROR);J=J.substring(0,Q)+K+J.substring(w.end);break}}return J}function AB($){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 RB($,X){if(X.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,J)=>X[Number(J)]??Z)}function N1($,X,Z){let{masked:J,scripts:Y}=AB($);return RB(NB(J,X,Z),Y)}function NB($,X,Z){let J=$;J=VB(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,q=v1(J,w+7);if(!q)break;let W=q.endPos,K=e1(J,"unless","endunless",W);if(K===-1){console.warn(`[stx] @unless directive at position ${w} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=J.slice(W,K),U=q.expression,B=-1;{let _=0,H=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],V;while((V=H.exec(z))!==null)F.push({pos:V.index,type:"open"});while((V=L.exec(z))!==null)F.push({pos:V.index,type:"close"});while((V=O.exec(z))!==null)F.push({pos:V.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")_++;else if(A.type==="close")_--;else if(A.type==="else"&&_===0){B=A.pos;break}}let j;if(B!==-1){let _=z.slice(0,B),H=z.slice(B+5);j=`@if (${U})${H}@else ${_}@endif`}else j=`@if (!(${U}))${z}@endif`;J=J.substring(0,w)+j+J.substring(K+10),G=!0}}J=i4(J,X,Z),J=n4(J,X,Z),J=p4(J,X);let Y=()=>{let G=g7(J);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let w=G[Q];try{let q="",W=!1;for(let K of w.branches){if(W)break;if(K.type==="else")q=K.content,W=!0;else try{let z;if(K.condition&&q0(K.condition))z=W0(K.condition,Object.keys(X))(...Object.values(X));else if(K.condition)z=G0(K.condition,X);if(z)q=K.content,W=!0}catch(z){q=X0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,s.EVALUATION_ERROR),W=!0}}J=J.substring(0,w.start)+q+J.substring(w.end)}catch(q){let W=q instanceof Error?q.message:String(q),K=X0("If",`Error processing @if block: ${W}`,s.EVALUATION_ERROR);J=J.substring(0,w.start)+K+J.substring(w.end)}}return!0};while(!0){let G=J;if(!Y())break;if(J===G)break}return J}function YG($){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 p4($,X){let Z=$;function J(w,q,W,K){let z=1,U=K,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(U<w.length&&z>0){B.lastIndex=U,j.lastIndex=U;let _=B.exec(w),H=j.exec(w),L=_?_.index:1/0,O=H?H.index:1/0;if(L<O)z++,U=L+_[0].length;else if(O<1/0){if(z--,z===0)return O;U=O+H[0].length}else break}return-1}function Y(w,q,W){let K=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=z.exec(w))!==null)j.push({pos:_.index,type:"open"});while((_=U.exec(w))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(w))!==null)j.push({pos:_.index,type:"else"});j.sort((H,L)=>H.pos-L.pos);for(let H of j)if(H.type==="open")K++;else if(H.type==="close")K--;else if(H.type==="else"&&K===0)return H.pos;return-1}{let w=!0;while(w){w=!1;let q=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,K,z,U=Z.slice(W+5),B=YG(U);if(B)K=B.value,z=W+5+B.consumed;else z=W+5;let j=J(Z,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=Z.slice(z,j),H=Y(_,"auth","endauth"),L;if(!X.auth)L=!1;else L=K?h1(`auth?.check && auth?.user?.[${K}]`,X):h1("auth?.check",X);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,W)+O+Z.substring(j+8),w=!0}}{let w=!0;while(w){w=!1;let q=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,K,z,U=Z.slice(W+6),B=YG(U);if(B)K=B.value,z=W+6+B.consumed;else z=W+6;let j=J(Z,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=Z.slice(z,j),H=Y(_,"guest","endguest"),L;if(!X.auth)L=!0;else L=K?h1(`!auth?.check || !auth?.user?.[${K}]`,X):h1("!auth?.check",X);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,W)+O+Z.substring(j+9),w=!0}}function G(w,q,W){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(q)K.push(q);if(W){let z=h1(W,X);K.push(z)}return X.permissions.check(...K)}catch{return!1}return!1}function Q(w){let q=w.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let w of["can","cannot"]){let q=`end${w}`,W=w==="can"?"elsecan":"elsecannot",K=!0;while(K){K=!1;let 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 _=U+`@${w}`.length+j.paramsEnd,H=J(Z,w,q,_);if(H===-1){console.warn(`[stx] @${w} directive at position ${U} has no matching @${q} \u2014 the block was skipped.`);break}let L=Z.slice(_,H),O=[],F=0,V=new RegExp(`@${w}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),R=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,M=[],k;while((k=V.exec(L))!==null)M.push({pos:k.index,type:"open"});while((k=A.exec(L))!==null)M.push({pos:k.index,type:"close"});while((k=R.exec(L))!==null)M.push({pos:k.index,type:"elseDirective"});while((k=N.exec(L))!==null)M.push({pos:k.index,type:"else"});M.sort((E,v)=>E.pos-v.pos);for(let E of M){if(E.type==="open"){F++;continue}if(E.type==="close"){F--;continue}if(F===0)O.push(E)}let T=[],D=0;for(let E=0;E<O.length;E++){let v=O[E];if(T.push({content:L.slice(D,v.pos),ability:void 0}),v.type==="elseDirective"){let x=L.slice(v.pos+`@${W}`.length),f=Q(x);if(f){T[T.length-1]={content:L.slice(D,v.pos)},D=v.pos+`@${W}`.length+f.paramsEnd,T.push({content:"",ability:f.ability,type:f.type,id:f.id}),T.pop();let h=O[E+1],p=h?h.pos:L.length;T.push({content:L.slice(D,p),ability:f.ability,type:f.type,id:f.id}),D=p}}else D=v.pos+5}if(D<L.length){let E=T[T.length-1];if(O.length>0&&O[O.length-1].type==="else")T.push({content:L.slice(D),isFinalElse:!0});else if(T.length===0)T.push({content:L.slice(D)})}let I=G(j.ability,j.type,j.id),S=w==="can"?I:!I,b="";if(S)b=T[0]?.content||"";else{let E=!1;for(let v=1;v<T.length;v++){let x=T[v];if(x.isFinalElse){b=x.content,E=!0;break}if(x.ability){let f=G(x.ability,x.type,x.id);if(w==="can"?f:!f){b=x.content,E=!0;break}}}if(!E&&T.length>0){let v=T[T.length-1];if(v.isFinalElse)b=v.content}}Z=Z.substring(0,U)+b+Z.substring(H+`@${q}`.length),K=!0}}return Z}function i4($,X,Z){let J=$;function Y(G,Q,w,q,W){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=v1(G,B+`@${Q}`.length);if(!j)break;let _=j.endPos,H=e1(G,Q,w,_);if(H===-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=q(O.trim()),N;if(F!==-1){let M=L.slice(0,F),k=L.slice(F+5);N=R?M:k}else N=R?L:"";G=G.substring(0,B)+N+G.substring(H+`@${w}`.length),K=!0}catch(R){let N=R instanceof Error?R.message:String(R),M=X0(W,`Error processing @${Q} directive: ${N}`,s.EVALUATION_ERROR);G=G.substring(0,B)+M+G.substring(H+`@${w}`.length);break}}return G}return J=Y(J,"isset","endisset",(G)=>{let Q=h1(G,X);return Q!==void 0&&Q!==null},"Isset"),J=Y(J,"empty","endempty",(G)=>{let Q=h1(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 n4($,X,Z){let J=$,Y="development";function G(Q,w,q,W){let K=new RegExp(`@${w}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),U=new RegExp(`^@${w}(?![a-z])`),B=new RegExp(`^@${q}(?![a-z])`),j=Q,_=!0;while(_){_=!1,K.lastIndex=0;let H=K.exec(j);if(!H)break;let L=H.index,O=L+H[0].length;if(w==="env"){let I=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;O+=I[0].length,W=Y===I[2]}let F=1,V=O,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,E=S?S.index:1/0;if(b<E)F++,V=b+I[0].length;else if(E<1/0){if(F--,F===0){A=E;break}V=E+S[0].length}else break}if(A===-1){console.warn(`[stx] @${w} directive at position ${L} has no matching @${q} \u2014 the block was skipped.`);break}let R=j.substring(O,A),N=-1,M=0,k=0;while(k<R.length){let I=R.indexOf("@",k);if(I===-1)break;let S=R.substring(I);if(U.test(S)){M++,k=I+1;continue}if(B.test(S)){M--,k=I+1;continue}if(M===0&&/^@else(?![a-z])/.test(S)){N=I;break}k=I+1}let T;if(N!==-1){let I=R.slice(0,N),S=R.slice(N+5);T=W?I:S}else T=W?R:"";let D=`@${q}`.length;j=j.substring(0,L)+T+j.substring(A+D),_=!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 o7=y(()=>{JG();A1();m8();I0()});function QG($=16){let X=new Uint8Array($);return crypto.getRandomValues(X),btoa(String.fromCharCode(...X))}function a$($,X){if(!$)return X?.nonceGenerator?.()??QG();let Z=GG.get($);if(!Z)Z=X?.nonceGenerator?.()??QG(),GG.set($,Z);return Z}function TB($,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 wG($,X){return`<meta http-equiv="Content-Security-Policy" content="${TB($,X).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function qG($,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?a$(Z,X):void 0,Y=wG(X.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
12324
- ${Y}`)}function WG($,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 KG($,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?a$(X,G):void 0;return wG(G.directives,Q)}),Y=Y.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return a$(X,G)}),G?.enabled&&G.useNonce)X.cspNonce=a$(X,G);return Y}var GG;var zG=y(()=>{GG=new WeakMap});import MB from"crypto";function IB($=kB){let X=MB.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return r4=X,X}function EB(){if(!r4)IB();return r4}function DB($=UG){let X=EB();return`<input type="hidden" name="${$}" value="${X}">`}function jG($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(X,Z,J)=>{return DB(J||UG)})}var kB=40,UG="_token",r4=null;var BG=()=>{};async function _G($,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 yB(Y,G,X,Z,J);else Y=await bB(Y,G,X,Z,J)}return Y}async function yB($,X,Z,J,Y){let{name:G,handler:Q}=X,w=`@${G}`,q=`@end${G}`,W=$,K=E5(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],U=K.exec(W);while(U!==null){let[B,j="",_=""]=U,H=U.index||0;try{let L=j?HG(j):[],O=_.trim(),F=await Q(O,L,Z,J);z.push({original:B,processed:F,startIndex:H})}catch(L){let O=L instanceof Error?L.message:String(L);if(Y.debug)console.error(`Error processing custom directive @${G}:`,L);z.push({original:B,processed:X0("CustomDirective",`Error in @${G}${j?`(${j})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:H})}U=K.exec(W)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:_}=z[B];W=W.replace(j,_)}return W}async function bB($,X,Z,J,Y){let{name:G,handler:Q}=X,w=$,q=E5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],K=q.exec(w);while(K!==null){let[B,j=""]=K,_=K.index||0;try{let H=HG(j),L=await Q("",H,Z,J);W.push({original:B,processed:L,startIndex:_})}catch(H){let L=H instanceof Error?H.message:String(H);if(Y.debug)console.error(`Error processing custom directive @${G}:`,H);W.push({original:B,processed:X0("CustomDirective",`Error in @${G}(${j}): ${L}`,s.EVALUATION_ERROR),startIndex:_})}K=q.exec(w)}let z=E5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),U=z.exec(w);while(U!==null){let[B]=U,j=U.index||0;try{let _=await Q("",[],Z,J);W.push({original:B,processed:_,startIndex:j})}catch(_){let H=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${G}:`,_);W.push({original:B,processed:X0("CustomDirective",`Error in @${G}: ${H}`,s.EVALUATION_ERROR),startIndex:j})}U=z.exec(w)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:_}=W[B];w=w.replace(j,_)}return w}function HG($){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 OG=y(()=>{A1();D5()});function w5($,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(w5(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(w5(Z.key,"appearance.key"),w5(Z.attribute,"appearance.attribute"),w5(Z.default,"appearance.default"),w5(J.key,"colorMode.key"),w5(J.attribute,"colorMode.attribute"),w5(J.default,"colorMode.default"),!FG.test(Z.key)||!FG.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!LG.test(Z.attribute)||!LG.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(!SB.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 PB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function vB($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${PB($)};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 xB($,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 VG($,X){let Z=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,Q=xB(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=Z.slice(G+1,Q).trim(),q=G0(`(${w})`,X),W=vB(CB(q));Z=Z.slice(0,Y.index)+W+Z.slice(Q+1),J.lastIndex=Y.index+W.length}return Z}var LG,FG,SB;var AG=y(()=>{I0();LG=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,FG=/^[A-Za-z_$][\w$]*$/,SB=new Set(["light","dark","system"])});import fB from"crypto";function A0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function t$($,X,Z,J){let Y=$||X;return Z?`${Y} ${J}`:Y}function a0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function g5($,X){if(/\bid\s*=/i.test($))return"";return` id="${A0(X)}"`}function o4($,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="${A0(`${a0($)}-error`)}"`;return J}function gB(){return fB.randomUUID()}function e$($,X){let Z=$;return Z=Z.replace(/@csrf/g,()=>{if(!X.csrf||typeof X.csrf!=="object"){let J=gB();X.csrf={token:J}}if(X.csrf.field)return X.csrf.field;if(X.csrf.token)return`<input type="hidden" name="_token" value="${A0(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="${A0(G)}">`;return J}),Z}function TG($,X,Z=NG){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,G,Q,w,q,W="")=>{let K=G||Q||"POST",z=w||q||"",U=u1(W),B=K.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${A0(j)}" action="${A0(z)}"${U?` ${U}`:""}>`;if(_+=`
12325
- ${e$("@csrf",X)}`,!["GET","POST"].includes(B))_+=`
12326
- ${e$(`@method('${B}')`,X)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,G,Q,w,q,W="")=>{let K=G||Q||"",z=w||q||"",U=u1(W),B=s7(K,X),j=B!==void 0&&B!==null?B:z||"",_=U.match(/type=['"]([^'"]+)['"]/i),H=_?_[1]:"text",L=a7(K,X),O=U.match(/class=['"]([^'"]+)['"]/i),F=t$(O?O[1]:"",Z.input,L,Z.inputError),V=U.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${A0(H)}" name="${A0(K)}"${g5(U,a0(K))} value="${A0(j)}" class="${F}"${o4(K,L,U)}${V?` ${V}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,G,Q="",w="")=>{let q=u1(Q),W=s7(G,X)||w.trim(),K=a7(G,X),z=q.match(/class=['"]([^'"]+)['"]/i),U=t$(z?z[1]:"",Z.input,K,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${A0(G)}"${g5(q,a0(G))} class="${U}"${o4(G,K,q)}${B?` ${B}`:""}>${A0(W)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,G,Q="",w)=>{let q=u1(Q),W=s7(G,X),K=a7(G,X),z=q.match(/class=['"]([^'"]+)['"]/i),U=t$(z?z[1]:"",Z.input,K,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,""),j=w;if(W!==void 0)j=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,H,L)=>{if((Array.isArray(W)?W.some((F)=>String(F)===L):String(W)===L)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return _});return`<select name="${A0(G)}"${g5(q,a0(G))} class="${U}"${o4(G,K,q)}${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q,w="")=>{let q=Q===void 0?"1":Q,W=Q===void 0?a0(G):`${a0(G)}-${a0(q)}`,K=u1(w),z=s7(G,X),U=z!==void 0&&(Array.isArray(z)?z.some((H)=>String(H)===q):z===!0||String(z)===q),B=K.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:Z.checkInput,_=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${A0(G)}"${g5(K,W)} value="${A0(q)}" class="${j}"${U?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q,w="")=>{let q=u1(w),W=s7(G,X),K=W!==void 0&&W===Q,z=q.match(/class=['"]([^'"]+)['"]/i),U=z?z[1]:Z.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${A0(G)}"${g5(q,`${a0(G)}-${a0(Q)}`)} value="${A0(Q)}" class="${U}"${K?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q="")=>{let w=u1(Q),q=w.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",K=w.includes("multiple"),z=a7(G,X),U=w.match(/class=['"]([^'"]+)['"]/i),B=t$(U?U[1]:"",Z.input,z,Z.inputError),j=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${A0(G)}"${g5(w,a0(G))}`,`class="${B}"`];if(W)_.push(`accept="${A0(W)}"`);if(K)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,G,Q="",w)=>{let q=u1(Q),W=q.match(/class=['"]([^'"]+)['"]/i),K=W?W[1]:Z.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${A0(a0(G))}" class="${K}"${z?` ${z}`:""}>${w}</label>`}),J}function MG($,X,Z=NG){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,G)=>{try{if(a7(Y,X)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(w,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return RG(Y,X);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof X.errors?.first==="function")return X.errors.first(Y);return RG(Y,X)}let W=q.trim();if(q0(W)){let K=G0(W,X);return K!==void 0?String(K):W}return W}catch{return q}});return`<div id="${A0(`${a0(Y)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),J}})}function a7($,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 RG($,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 s7($,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 u1($){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 NG;var kG=y(()=>{I0();NG={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import t4 from"path";async function hB(){if(t7!==void 0)return t7;try{t7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{t7=null}return t7}function uB($,X=0){if(X<=0)return!1;return Date.now()-$.loadedAt>X}async function dB($,X){if({...X3,...X.i18n}.cache&&e4[$]){let Y=e4[$],G=X.i18n?.cacheMaxAge??0;if(!uB(Y,G))return Y.translations}if(e7[$]?.state==="loading")return e7[$].promise;s4[$]="loading";let J=$3($,X).then((Y)=>{return s4[$]="loaded",delete e7[$],Y}).catch((Y)=>{throw s4[$]="error",e7[$]={promise:J,state:"error",error:Y instanceof Error?Y:Error(String(Y))},Y});return e7[$]={promise:J,state:"loading"},J}async function $3($,X){let Z={...X3,...X.i18n},J=t4.isAbsolute(Z.translationsDir)?Z.translationsDir:t4.resolve(X.root||process.cwd(),Z.translationsDir);try{let Y=await hB(),G=Y?await Y($,{translationsDir:J,defaultLocale:Z.defaultLocale,sources:iB(Z.format)}):await mB($,Z,J);if(G===void 0){if($!==Z.defaultLocale)return $3(Z.defaultLocale,X);return{}}let Q=G;if(Z.cache)e4[$]={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 $3(Z.defaultLocale,X);return{}}}async function mB($,X,Z){let J=t4.join(Z,`${$}${cB(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 lB(G);if(X.format==="json")return JSON.parse(G);throw Y}catch{return}}}function cB($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function lB($){let X={},Z=$.split(`
12327
- `),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,q=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,K]=q,z=W.trim(),U=K.trim();if(U==="")w[z]={},J.push({obj:w[z],indent:Q});else w[z]=pB(U)}}return X}function pB($){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 iB($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function nB($,X){return dB($,X)}function rB($,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 oB($,X={}){return DG($,X)}function DG($,X){let Z="",J=0;while(J<$.length)if($[J]==="{"){let Y=sB($,J);if(Y===-1){Z+=$[J],J++;continue}let G=$.slice(J+1,Y);Z+=aB(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 sB($,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 aB($,X){let Z=tB($);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 eB(Y,Z.slice(2).join(","),X);case"select":return X_(Y,Z.slice(2).join(","));case"selectordinal":return Z_(Y,Z.slice(2).join(","));case"number":return Y_(Y,Z[2]?.trim());case"date":return G_(Y,Z[2]?.trim());case"time":return Q_(Y,Z[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function tB($){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 eB($,X,Z){let J=Number($)||0,Y=Z3(X),G=`=${J}`;if(Y[G])return a4(Y[G],J,Z);let Q=$_(J);if(Y[Q])return a4(Y[Q],J,Z);if(Y.other)return a4(Y.other,J,Z);return String(J)}function a4($,X,Z){let J=$.replace(/#/g,String(X));return DG(J,Z)}function $_($){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 X_($,X){let Z=String($||""),J=Z3(X);if(J[Z])return J[Z];return J.other||String($)}function Z_($,X){let Z=Number($)||0,J=Z3(X),Y=J_(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 J_($){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 Z3($){let X={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,J=Z.exec($);while(J!==null)X[J[1]]=J[2],J=Z.exec($);return X}function Y_($,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 G_($,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 Q_($,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 w_($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function IG($,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(w_(Q))return oB(Q,J);if(Q.includes("|")&&"count"in J){let w=Number(J.count),q=Q.split("|");Q=rB(q,w)}for(let[w,q]of Object.entries(J)){let W=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${W}`,"g"),String(q))}return Q}async function yG($,X,Z,J){let Y=$,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...X3,...J.i18n},w=await nB(Q.locale,J);X.__translations=w,X.__locale=Q.locale,X.__i18nConfig=Q,Y=await EG(Y,G,async(K,z,U,B,j)=>{try{let _={};if(U)try{let L=[()=>JSON.parse(U),()=>{let O=`{"data":${U}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return k0(U,X)}];for(let O of L)try{if(_=O(),Object.keys(_).length>0)break}catch{}}catch(L){if(J.debug)console.error("Error parsing parameters for @translate directive:",L)}return IG(z,w,Q.fallbackToKey,_)||B.trim()}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return X0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR)}});let q=/@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(q)];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 EG(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(K,z,U,B)=>{try{let j={};if(U)try{let _=[()=>JSON.parse(U),()=>{let H=`{"data":${U}}`,L=JSON.parse(H);return typeof L.data==="object"?L.data:{}},()=>{return k0(U,X)}];for(let H of _)try{if(j=H(),Object.keys(j).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return IG(z,w,Q.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return X0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,s.EVALUATION_ERROR)}}),Y}async function EG($,X,Z){let J=[];return $.replace(X,(G,...Q)=>{let w=Z(G,...Q).then((q)=>({match:G,replacement:q}));return J.push(w),G}),(await Promise.all(J)).reduce((G,{match:Q,replacement:w})=>G.replace(Q,w),$)}var t7,X3,e4,e7,s4;var bG=y(()=>{A1();I0();X3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},e4={},e7={},s4={}});var G3={};a(G3,{streamingSuspenseDirective:()=>PG,streamToResponse:()=>F_,streamTemplateSimple:()=>__,streamTemplate:()=>W_,renderStreamingPage:()=>z_,registerStreamingDirectives:()=>O_,processStreamDirectives:()=>j_,processSectionDirectives:()=>L_,islandDirective:()=>vG,generateHydrationRuntime:()=>V_,extractStreamBoundaries:()=>B_,createStreamRenderer:()=>H_,buildSuspenseResolveScript:()=>Y3,SUSPENSE_RESOLVER_RUNTIME:()=>CG});import $9 from"path";function q_($){let X=[],Z=0,J;SG.lastIndex=0;while((J=SG.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 W_($,X={},Z={}){let J={...Q5,...Z,streaming:{...J3,...Z.streaming}},Y=J.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file($).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K={...X,__filename:$,__dirname:$9.dirname($)};if(q.trim())await t1(q,K,$);let z=q_(W),U=new Set;if(!z.some((j)=>j.type==="suspense")){let j=J.streaming?.strategy||"auto",_=new RegExp(q5.source,"g");if(!(j!=="manual"&&_.test(W))){let L=await F0(W,K,$,J,U);for(let O=0;O<L.length;O+=Y)G.enqueue(L.slice(O,O+Y)),await new Promise((F)=>setTimeout(F,0))}else{let L=[],O=new RegExp(q5.source,"g"),F;while((F=O.exec(W))!==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=W.slice(V,A.start);if(N.trim()){let M=await F0(N,K,$,J,U);G.enqueue(M),await new Promise((k)=>setTimeout(k,0))}}let R=await F0(A.content,K,$,J,U);G.enqueue(R),await new Promise((N)=>setTimeout(N,0)),V=A.end}if(V<W.length){let A=W.slice(V);if(A.trim()){let R=await F0(A,K,$,J,U);G.enqueue(R)}}}}else{let j=new Map;for(let H of z)if(H.type==="shell"||H.type==="content"){let L=await F0(H.content,K,$,J,U);G.enqueue(L)}else if(H.type==="suspense"&&H.name){let L=`stx-suspense-${H.name}`;G.enqueue(`<div id="${L}" data-suspense="${H.name}" style="display:contents;">
12324
+ </script>`}function JG($,X,Z){if(!OB($))return $;let J=KB($);if(J.length===0)return $;let Y=HB($,J),G=_B(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 HB($,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 q=/data-stx-scope="([^"]*)"/.exec(Q);if(q)return w.id=q[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 OB($){return/x-data\s*=\s*["']/.test($)}var qB=0,WB=0;var YG=D(()=>{j1()});import LB from"fs";import n4 from"path";import{createHighlighter as FB}from"ts-syntax-highlighter";async function VB($,X={}){try{if(!await n($))throw Error(`Markdown file not found: ${$}`);let J=(await LB.promises.stat($)).mtime.getTime();if(X.cache&&r4.has($)){let z=r4.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||y7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=I7(Q,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)W=await AB(W,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:W,data:G||{}};if(X.cache)r4.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:O0("Markdown File",`Error reading/parsing markdown file: ${J}`,$,"",0,""),data:{}}}}async function AB($,X,Z){let J=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!$9)try{$9=await FB({theme:X||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),$}let Y=async(w,q,W,K)=>{let z=K.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),U=W||(Z?"text":"");if(!U)return w;try{if(!$9.getSupportedLanguages().includes(U))return w;return(await $9.highlight(z,U,{theme:X})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return w},G=$,Q=$.matchAll(J);for(let w of Q){let[q,W,K,z]=w,U=await Y(q,W,K,z);G=G.replace(q,U)}return G}async function GG($,X,Z="",J={}){return await RB($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,w,q,W)=>{try{let K=w;if(!n4.isAbsolute(w))K=n4.resolve(n4.dirname(Z),w);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(J.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),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 VB(K,J),j={...X,...B,...z},_=U,H=/\{\{([^}]+)\}\}/g;return _=_.replace(H,(L,O)=>{let F=O.trim();return j[F]!==void 0?String(j[F]):L}),_}catch(K){let z=K instanceof Error?K.message:String(K);return O0("Markdown File",`Error including markdown file: ${z}`,Z,$,W,Q)}})}async function RB($,X,Z){let J=[],Y;while((Y=X.exec($))!==null){let w=Y[0],q=Y.index,W=Y;J.push(Z(...W).then((K)=>({match:w,replacement:K,index:q})))}let G=await Promise.all(J);G.sort((w,q)=>q.index-w.index);let Q=$;for(let{match:w,replacement:q}of G)Q=Q.replace(w,()=>q);return Q}var r4,$9=null;var QG=D(()=>{R1();A0();r4=new Map});function c1($,X){try{let Z=$.trim();if(W0(Z))return K0(Z,Object.keys(X))(...Object.values(X));else return w0(Z,X)}catch{return!1}}var wG=D(()=>{y0()});function NB($,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=DX(J,Q);if(!w)break;try{let q;if(W0(w.expression))q=K0(w.expression,Object.keys(X))(...Object.values(X));else q=w0(w.expression,X);let W="",K=!1;for(let z of w.cases)if(z.type==="default"){if(!K)W=z.content.trim()}else try{let U;if(z.value&&W0(z.value))U=K0(z.value,Object.keys(X))(...Object.values(X));else if(z.value)U=w0(z.value,X);if(q===U){W=z.content.trim(),K=!0;break}}catch{continue}J=J.substring(0,Q)+W+J.substring(w.end),Y=!0}catch(q){let W=q instanceof Error?q.message:String(q),K=J0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);J=J.substring(0,Q)+K+J.substring(w.end);break}}return J}function TB($){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 MB($,X){if(X.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,J)=>X[Number(J)]??Z)}function I1($,X,Z){let{masked:J,scripts:Y}=TB($);return MB(kB(J,X,Z),Y)}function kB($,X,Z){let J=$;J=NB(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,q=h1(J,w+7);if(!q)break;let W=q.endPos,K=Y5(J,"unless","endunless",W);if(K===-1){console.warn(`[stx] @unless directive at position ${w} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=J.slice(W,K),U=q.expression,B=-1;{let _=0,H=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],V;while((V=H.exec(z))!==null)F.push({pos:V.index,type:"open"});while((V=L.exec(z))!==null)F.push({pos:V.index,type:"close"});while((V=O.exec(z))!==null)F.push({pos:V.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")_++;else if(A.type==="close")_--;else if(A.type==="else"&&_===0){B=A.pos;break}}let j;if(B!==-1){let _=z.slice(0,B),H=z.slice(B+5);j=`@if (${U})${H}@else ${_}@endif`}else j=`@if (!(${U}))${z}@endif`;J=J.substring(0,w)+j+J.substring(K+10),G=!0}}J=s4(J,X,Z),J=a4(J,X,Z),J=o4(J,X);let Y=()=>{let G=d7(J);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let w=G[Q];try{let q="",W=!1;for(let K of w.branches){if(W)break;if(K.type==="else")q=K.content,W=!0;else try{let z;if(K.condition&&W0(K.condition))z=K0(K.condition,Object.keys(X))(...Object.values(X));else if(K.condition)z=w0(K.condition,X);if(z)q=K.content,W=!0}catch(z){q=J0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),W=!0}}J=J.substring(0,w.start)+q+J.substring(w.end)}catch(q){let W=q instanceof Error?q.message:String(q),K=J0("If",`Error processing @if block: ${W}`,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 qG($){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 o4($,X){let Z=$;function J(w,q,W,K){let z=1,U=K,B=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(U<w.length&&z>0){B.lastIndex=U,j.lastIndex=U;let _=B.exec(w),H=j.exec(w),L=_?_.index:1/0,O=H?H.index:1/0;if(L<O)z++,U=L+_[0].length;else if(O<1/0){if(z--,z===0)return O;U=O+H[0].length}else break}return-1}function Y(w,q,W){let K=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),U=new RegExp(`@${W}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=z.exec(w))!==null)j.push({pos:_.index,type:"open"});while((_=U.exec(w))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(w))!==null)j.push({pos:_.index,type:"else"});j.sort((H,L)=>H.pos-L.pos);for(let H of j)if(H.type==="open")K++;else if(H.type==="close")K--;else if(H.type==="else"&&K===0)return H.pos;return-1}{let w=!0;while(w){w=!1;let q=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,K,z,U=Z.slice(W+5),B=qG(U);if(B)K=B.value,z=W+5+B.consumed;else z=W+5;let j=J(Z,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=Z.slice(z,j),H=Y(_,"auth","endauth"),L;if(!X.auth)L=!1;else L=K?c1(`auth?.check && auth?.user?.[${K}]`,X):c1("auth?.check",X);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,W)+O+Z.substring(j+8),w=!0}}{let w=!0;while(w){w=!1;let q=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,K,z,U=Z.slice(W+6),B=qG(U);if(B)K=B.value,z=W+6+B.consumed;else z=W+6;let j=J(Z,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=Z.slice(z,j),H=Y(_,"guest","endguest"),L;if(!X.auth)L=!0;else L=K?c1(`!auth?.check || !auth?.user?.[${K}]`,X):c1("!auth?.check",X);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,W)+O+Z.substring(j+9),w=!0}}function G(w,q,W){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(q)K.push(q);if(W){let z=c1(W,X);K.push(z)}return X.permissions.check(...K)}catch{return!1}return!1}function Q(w){let q=w.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let w of["can","cannot"]){let q=`end${w}`,W=w==="can"?"elsecan":"elsecannot",K=!0;while(K){K=!1;let 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 _=U+`@${w}`.length+j.paramsEnd,H=J(Z,w,q,_);if(H===-1){console.warn(`[stx] @${w} directive at position ${U} has no matching @${q} \u2014 the block was skipped.`);break}let L=Z.slice(_,H),O=[],F=0,V=new RegExp(`@${w}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),R=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],k;while((k=V.exec(L))!==null)T.push({pos:k.index,type:"open"});while((k=A.exec(L))!==null)T.push({pos:k.index,type:"close"});while((k=R.exec(L))!==null)T.push({pos:k.index,type:"elseDirective"});while((k=N.exec(L))!==null)T.push({pos:k.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)O.push(y)}let M=[],E=0;for(let y=0;y<O.length;y++){let P=O[y];if(M.push({content:L.slice(E,P.pos),ability:void 0}),P.type==="elseDirective"){let x=L.slice(P.pos+`@${W}`.length),f=Q(x);if(f){M[M.length-1]={content:L.slice(E,P.pos)},E=P.pos+`@${W}`.length+f.paramsEnd,M.push({content:"",ability:f.ability,type:f.type,id:f.id}),M.pop();let u=O[y+1],l=u?u.pos:L.length;M.push({content:L.slice(E,l),ability:f.ability,type:f.type,id:f.id}),E=l}}else E=P.pos+5}if(E<L.length){let y=M[M.length-1];if(O.length>0&&O[O.length-1].type==="else")M.push({content:L.slice(E),isFinalElse:!0});else if(M.length===0)M.push({content:L.slice(E)})}let I=G(j.ability,j.type,j.id),S=w==="can"?I:!I,b="";if(S)b=M[0]?.content||"";else{let y=!1;for(let P=1;P<M.length;P++){let x=M[P];if(x.isFinalElse){b=x.content,y=!0;break}if(x.ability){let f=G(x.ability,x.type,x.id);if(w==="can"?f:!f){b=x.content,y=!0;break}}}if(!y&&M.length>0){let P=M[M.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,U)+b+Z.substring(H+`@${q}`.length),K=!0}}return Z}function s4($,X,Z){let J=$;function Y(G,Q,w,q,W){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=h1(G,B+`@${Q}`.length);if(!j)break;let _=j.endPos,H=Y5(G,Q,w,_);if(H===-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=q(O.trim()),N;if(F!==-1){let T=L.slice(0,F),k=L.slice(F+5);N=R?T:k}else N=R?L:"";G=G.substring(0,B)+N+G.substring(H+`@${w}`.length),K=!0}catch(R){let N=R instanceof Error?R.message:String(R),T=J0(W,`Error processing @${Q} directive: ${N}`,o.EVALUATION_ERROR);G=G.substring(0,B)+T+G.substring(H+`@${w}`.length);break}}return G}return J=Y(J,"isset","endisset",(G)=>{let Q=c1(G,X);return Q!==void 0&&Q!==null},"Isset"),J=Y(J,"empty","endempty",(G)=>{let Q=c1(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 a4($,X,Z){let J=$,Y="development";function G(Q,w,q,W){let K=new RegExp(`@${w}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),U=new RegExp(`^@${w}(?![a-z])`),B=new RegExp(`^@${q}(?![a-z])`),j=Q,_=!0;while(_){_=!1,K.lastIndex=0;let H=K.exec(j);if(!H)break;let L=H.index,O=L+H[0].length;if(w==="env"){let I=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;O+=I[0].length,W=Y===I[2]}let F=1,V=O,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 @${q} \u2014 the block was skipped.`);break}let R=j.substring(O,A),N=-1,T=0,k=0;while(k<R.length){let I=R.indexOf("@",k);if(I===-1)break;let S=R.substring(I);if(U.test(S)){T++,k=I+1;continue}if(B.test(S)){T--,k=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(S)){N=I;break}k=I+1}let M;if(N!==-1){let I=R.slice(0,N),S=R.slice(N+5);M=W?I:S}else M=W?R:"";let E=`@${q}`.length;j=j.substring(0,L)+M+j.substring(A+E),_=!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 t7=D(()=>{wG();M1();i8();y0()});function KG($=16){let X=new Uint8Array($);return crypto.getRandomValues(X),btoa(String.fromCharCode(...X))}function X9($,X){if(!$)return X?.nonceGenerator?.()??KG();let Z=WG.get($);if(!Z)Z=X?.nonceGenerator?.()??KG(),WG.set($,Z);return Z}function IB($,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 zG($,X){return`<meta http-equiv="Content-Security-Policy" content="${IB($,X).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function UG($,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=zG(X.directives,J);return $.replace(/<head([^>]*)>/,`<head$1>
12326
+ ${Y}`)}function jG($,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 BG($,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 zG(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 WG;var _G=D(()=>{WG=new WeakMap});import EB from"crypto";function yB($=DB){let X=EB.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return t4=X,X}function bB(){if(!t4)yB();return t4}function SB($=HG){let X=bB();return`<input type="hidden" name="${$}" value="${X}">`}function OG($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(X,Z,J)=>{return SB(J||HG)})}var DB=40,HG="_token",t4=null;var LG=()=>{};async function FG($,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 PB(Y,G,X,Z,J)}return Y}async function CB($,X,Z,J,Y){let{name:G,handler:Q}=X,w=`@${G}`,q=`@end${G}`,W=$,K=S5(`${w}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],U=K.exec(W);while(U!==null){let[B,j="",_=""]=U,H=U.index||0;try{let L=j?VG(j):[],O=_.trim(),F=await Q(O,L,Z,J);z.push({original:B,processed:F,startIndex:H})}catch(L){let O=L instanceof Error?L.message:String(L);if(Y.debug)console.error(`Error processing custom directive @${G}:`,L);z.push({original:B,processed:J0("CustomDirective",`Error in @${G}${j?`(${j})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:H})}U=K.exec(W)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:_}=z[B];W=W.replace(j,_)}return W}async function PB($,X,Z,J,Y){let{name:G,handler:Q}=X,w=$,q=S5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],K=q.exec(w);while(K!==null){let[B,j=""]=K,_=K.index||0;try{let H=VG(j),L=await Q("",H,Z,J);W.push({original:B,processed:L,startIndex:_})}catch(H){let L=H instanceof Error?H.message:String(H);if(Y.debug)console.error(`Error processing custom directive @${G}:`,H);W.push({original:B,processed:J0("CustomDirective",`Error in @${G}(${j}): ${L}`,o.EVALUATION_ERROR),startIndex:_})}K=q.exec(w)}let z=S5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),U=z.exec(w);while(U!==null){let[B]=U,j=U.index||0;try{let _=await Q("",[],Z,J);W.push({original:B,processed:_,startIndex:j})}catch(_){let H=_ instanceof Error?_.message:String(_);if(Y.debug)console.error(`Error processing custom directive @${G}:`,_);W.push({original:B,processed:J0("CustomDirective",`Error in @${G}: ${H}`,o.EVALUATION_ERROR),startIndex:j})}U=z.exec(w)}for(let B=W.length-1;B>=0;B--){let{original:j,processed:_}=W[B];w=w.replace(j,_)}return w}function VG($){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 AG=D(()=>{M1();C5()});function U5($,X){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${X} must be a non-empty string`)}function xB($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let X=$,Z=X.appearance,J=X.colorMode;if(U5(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(U5(Z.key,"appearance.key"),U5(Z.attribute,"appearance.attribute"),U5(Z.default,"appearance.default"),U5(J.key,"colorMode.key"),U5(J.attribute,"colorMode.attribute"),U5(J.default,"colorMode.default"),!NG.test(Z.key)||!NG.test(J.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!RG.test(Z.attribute)||!RG.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(!vB.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 fB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function gB($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${fB($)};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 hB($,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 TG($,X){let Z=$,J=/@appearanceBootstrap\s*\(/g,Y;while((Y=J.exec(Z))!==null){let G=Y.index+Y[0].length-1,Q=hB(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=Z.slice(G+1,Q).trim(),q=w0(`(${w})`,X),W=gB(xB(q));Z=Z.slice(0,Y.index)+W+Z.slice(Q+1),J.lastIndex=Y.index+W.length}return Z}var RG,NG,vB;var MG=D(()=>{y0();RG=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,NG=/^[A-Za-z_$][\w$]*$/,vB=new Set(["light","dark","system"])});import uB from"crypto";function N0($){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 m5($,X){if(/\bid\s*=/i.test($))return"";return` id="${N0(X)}"`}function e4($,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="${N0(`${e0($)}-error`)}"`;return J}function dB(){return uB.randomUUID()}function J9($,X){let Z=$;return Z=Z.replace(/@csrf/g,()=>{if(!X.csrf||typeof X.csrf!=="object"){let J=dB();X.csrf={token:J}}if(X.csrf.field)return X.csrf.field;if(X.csrf.token)return`<input type="hidden" name="_token" value="${N0(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="${N0(G)}">`;return J}),Z}function EG($,X,Z=IG){let J=$;return J=J.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Y,G,Q,w,q,W="")=>{let K=G||Q||"POST",z=w||q||"",U=l1(W),B=K.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${N0(j)}" action="${N0(z)}"${U?` ${U}`:""}>`;if(_+=`
12327
+ ${J9("@csrf",X)}`,!["GET","POST"].includes(B))_+=`
12328
+ ${J9(`@method('${B}')`,X)}`;return _}),J=J.replace(/@endform/g,"</form>"),J=J.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Y,G,Q,w,q,W="")=>{let K=G||Q||"",z=w||q||"",U=l1(W),B=e7(K,X),j=B!==void 0&&B!==null?B:z||"",_=U.match(/type=['"]([^'"]+)['"]/i),H=_?_[1]:"text",L=$8(K,X),O=U.match(/class=['"]([^'"]+)['"]/i),F=Z9(O?O[1]:"",Z.input,L,Z.inputError),V=U.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${N0(H)}" name="${N0(K)}"${m5(U,e0(K))} value="${N0(j)}" class="${F}"${e4(K,L,U)}${V?` ${V}`:""}>`}),J=J.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Y,G,Q="",w="")=>{let q=l1(Q),W=e7(G,X)||w.trim(),K=$8(G,X),z=q.match(/class=['"]([^'"]+)['"]/i),U=Z9(z?z[1]:"",Z.input,K,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${N0(G)}"${m5(q,e0(G))} class="${U}"${e4(G,K,q)}${B?` ${B}`:""}>${N0(W)}</textarea>`}),J=J.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Y,G,Q="",w)=>{let q=l1(Q),W=e7(G,X),K=$8(G,X),z=q.match(/class=['"]([^'"]+)['"]/i),U=Z9(z?z[1]:"",Z.input,K,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,""),j=w;if(W!==void 0)j=w.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,H,L)=>{if((Array.isArray(W)?W.some((F)=>String(F)===L):String(W)===L)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return _});return`<select name="${N0(G)}"${m5(q,e0(G))} class="${U}"${e4(G,K,q)}${B?` ${B}`:""}>${j}</select>`}),J=J.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q,w="")=>{let q=Q===void 0?"1":Q,W=Q===void 0?e0(G):`${e0(G)}-${e0(q)}`,K=l1(w),z=e7(G,X),U=z!==void 0&&(Array.isArray(z)?z.some((H)=>String(H)===q):z===!0||String(z)===q),B=K.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:Z.checkInput,_=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${N0(G)}"${m5(K,W)} value="${N0(q)}" class="${j}"${U?" checked":""}${_?` ${_}`:""}>`}),J=J.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q,w="")=>{let q=l1(w),W=e7(G,X),K=W!==void 0&&W===Q,z=q.match(/class=['"]([^'"]+)['"]/i),U=z?z[1]:Z.checkInput,B=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${N0(G)}"${m5(q,`${e0(G)}-${e0(Q)}`)} value="${N0(Q)}" class="${U}"${K?" checked":""}${B?` ${B}`:""}>`}),J=J.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Y,G,Q="")=>{let w=l1(Q),q=w.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",K=w.includes("multiple"),z=$8(G,X),U=w.match(/class=['"]([^'"]+)['"]/i),B=Z9(U?U[1]:"",Z.input,z,Z.inputError),j=w.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${N0(G)}"${m5(w,e0(G))}`,`class="${B}"`];if(W)_.push(`accept="${N0(W)}"`);if(K)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),J=J.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Y,G,Q="",w)=>{let q=l1(Q),W=q.match(/class=['"]([^'"]+)['"]/i),K=W?W[1]:Z.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${N0(e0(G))}" class="${K}"${z?` ${z}`:""}>${w}</label>`}),J}function DG($,X,Z=IG){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(J,Y,G)=>{try{if($8(Y,X)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(w,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return kG(Y,X);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof X.errors?.first==="function")return X.errors.first(Y);return kG(Y,X)}let W=q.trim();if(W0(W)){let K=w0(W,X);return K!==void 0?String(K):W}return W}catch{return q}});return`<div id="${N0(`${e0(Y)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),J}})}function $8($,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 kG($,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 e7($,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 l1($){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 IG;var yG=D(()=>{y0();IG={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import Z3 from"path";async function mB(){if(X8!==void 0)return X8;try{X8=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{X8=null}return X8}function cB($,X=0){if(X<=0)return!1;return Date.now()-$.loadedAt>X}async function lB($,X){if({...G3,...X.i18n}.cache&&J3[$]){let Y=J3[$],G=X.i18n?.cacheMaxAge??0;if(!cB(Y,G))return Y.translations}if(Z8[$]?.state==="loading")return Z8[$].promise;$3[$]="loading";let J=Y3($,X).then((Y)=>{return $3[$]="loaded",delete Z8[$],Y}).catch((Y)=>{throw $3[$]="error",Z8[$]={promise:J,state:"error",error:Y instanceof Error?Y:Error(String(Y))},Y});return Z8[$]={promise:J,state:"loading"},J}async function Y3($,X){let Z={...G3,...X.i18n},J=Z3.isAbsolute(Z.translationsDir)?Z.translationsDir:Z3.resolve(X.root||process.cwd(),Z.translationsDir);try{let Y=await mB(),G=Y?await Y($,{translationsDir:J,defaultLocale:Z.defaultLocale,sources:oB(Z.format)}):await pB($,Z,J);if(G===void 0){if($!==Z.defaultLocale)return Y3(Z.defaultLocale,X);return{}}let Q=G;if(Z.cache)J3[$]={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 Y3(Z.defaultLocale,X);return{}}}async function pB($,X,Z){let J=Z3.join(Z,`${$}${iB(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 nB(G);if(X.format==="json")return JSON.parse(G);throw Y}catch{return}}}function iB($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function nB($){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,q=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,K]=q,z=W.trim(),U=K.trim();if(U==="")w[z]={},J.push({obj:w[z],indent:Q});else w[z]=rB(U)}}return X}function rB($){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 oB($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function sB($,X){return lB($,X)}function aB($,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 tB($,X={}){return CG($,X)}function CG($,X){let Z="",J=0;while(J<$.length)if($[J]==="{"){let Y=eB($,J);if(Y===-1){Z+=$[J],J++;continue}let G=$.slice(J+1,Y);Z+=$_(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 eB($,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 $_($,X){let Z=X_($);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 Z_(Y,Z.slice(2).join(","),X);case"select":return Y_(Y,Z.slice(2).join(","));case"selectordinal":return G_(Y,Z.slice(2).join(","));case"number":return w_(Y,Z[2]?.trim());case"date":return q_(Y,Z[2]?.trim());case"time":return W_(Y,Z[2]?.trim());default:return Y!==void 0?String(Y):`{${$}}`}}function X_($){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 Z_($,X,Z){let J=Number($)||0,Y=Q3(X),G=`=${J}`;if(Y[G])return X3(Y[G],J,Z);let Q=J_(J);if(Y[Q])return X3(Y[Q],J,Z);if(Y.other)return X3(Y.other,J,Z);return String(J)}function X3($,X,Z){let J=$.replace(/#/g,String(X));return CG(J,Z)}function J_($){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 Y_($,X){let Z=String($||""),J=Q3(X);if(J[Z])return J[Z];return J.other||String($)}function G_($,X){let Z=Number($)||0,J=Q3(X),Y=Q_(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 Q_($){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 w_($,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 q_($,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 W_($,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 K_($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function bG($,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(K_(Q))return tB(Q,J);if(Q.includes("|")&&"count"in J){let w=Number(J.count),q=Q.split("|");Q=aB(q,w)}for(let[w,q]of Object.entries(J)){let W=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${W}`,"g"),String(q))}return Q}async function PG($,X,Z,J){let Y=$,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...G3,...J.i18n},w=await sB(Q.locale,J);X.__translations=w,X.__locale=Q.locale,X.__i18nConfig=Q,Y=await SG(Y,G,async(K,z,U,B,j)=>{try{let _={};if(U)try{let L=[()=>JSON.parse(U),()=>{let O=`{"data":${U}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return D0(U,X)}];for(let O of L)try{if(_=O(),Object.keys(_).length>0)break}catch{}}catch(L){if(J.debug)console.error("Error parsing parameters for @translate directive:",L)}return bG(z,w,Q.fallbackToKey,_)||B.trim()}catch(_){if(J.debug)console.error("Error processing @translate directive:",_);return J0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}});let q=/@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(q)];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 SG(Y,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(K,z,U,B)=>{try{let j={};if(U)try{let _=[()=>JSON.parse(U),()=>{let H=`{"data":${U}}`,L=JSON.parse(H);return typeof L.data==="object"?L.data:{}},()=>{return D0(U,X)}];for(let H of _)try{if(j=H(),Object.keys(j).length>0)break}catch{}}catch(_){if(J.debug)console.error("Error parsing parameters for @translate directive:",_)}return bG(z,w,Q.fallbackToKey,j)}catch(j){if(J.debug)console.error("Error processing @translate directive:",j);return J0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),Y}async function SG($,X,Z){let J=[];return $.replace(X,(G,...Q)=>{let w=Z(G,...Q).then((q)=>({match:G,replacement:q}));return J.push(w),G}),(await Promise.all(J)).reduce((G,{match:Q,replacement:w})=>G.replace(Q,w),$)}var X8,G3,J3,Z8,$3;var vG=D(()=>{M1();y0();G3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},J3={},Z8={},$3={}});var W3={};t(W3,{streamingSuspenseDirective:()=>gG,streamToResponse:()=>R_,streamTemplateSimple:()=>L_,streamTemplate:()=>U_,renderStreamingPage:()=>B_,registerStreamingDirectives:()=>V_,processStreamDirectives:()=>H_,processSectionDirectives:()=>A_,islandDirective:()=>hG,generateHydrationRuntime:()=>N_,extractStreamBoundaries:()=>O_,createStreamRenderer:()=>F_,buildSuspenseResolveScript:()=>q3,SUSPENSE_RESOLVER_RUNTIME:()=>fG});import Y9 from"path";function z_($){let X=[],Z=0,J;xG.lastIndex=0;while((J=xG.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 U_($,X={},Z={}){let J={...z5,...Z,streaming:{...w3,...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),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K={...X,__filename:$,__dirname:Y9.dirname($)};if(q.trim())await J5(q,K,$);let z=z_(W),U=new Set;if(!z.some((j)=>j.type==="suspense")){let j=J.streaming?.strategy||"auto",_=new RegExp(j5.source,"g");if(!(j!=="manual"&&_.test(W))){let L=await R0(W,K,$,J,U);for(let O=0;O<L.length;O+=Y)G.enqueue(L.slice(O,O+Y)),await new Promise((F)=>setTimeout(F,0))}else{let L=[],O=new RegExp(j5.source,"g"),F;while((F=O.exec(W))!==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=W.slice(V,A.start);if(N.trim()){let T=await R0(N,K,$,J,U);G.enqueue(T),await new Promise((k)=>setTimeout(k,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<W.length){let A=W.slice(V);if(A.trim()){let R=await R0(A,K,$,J,U);G.enqueue(R)}}}}else{let j=new Map;for(let H of z)if(H.type==="shell"||H.type==="content"){let L=await R0(H.content,K,$,J,U);G.enqueue(L)}else if(H.type==="suspense"&&H.name){let L=`stx-suspense-${H.name}`;G.enqueue(`<div id="${L}" data-suspense="${H.name}" style="display:contents;">
12328
12330
  <template data-suspense-fallback>Loading...</template>
12329
- </div>`),j.set(H.name,F0(H.content,K,$,J,U))}G.enqueue(`
12331
+ </div>`),j.set(H.name,R0(H.content,K,$,J,U))}G.enqueue(`
12330
12332
  <script>
12331
12333
  (function() {
12332
12334
  window.__stxSuspense = window.__stxSuspense || {
@@ -12342,13 +12344,13 @@ ${Y}`)}function WG($,X){let Z=$;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*
12342
12344
  }
12343
12345
  };
12344
12346
  })();
12345
- </script>`);let _=Array.from(j.entries()).map(async([H,L])=>{G.enqueue(await Y3(H,L))});await Promise.all(_)}G.close()}catch(Q){G.error(Q)}}})}async function Y3($,X){try{let J=(await X).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
12347
+ </script>`);let _=Array.from(j.entries()).map(async([H,L])=>{G.enqueue(await q3(H,L))});await Promise.all(_)}G.close()}catch(Q){G.error(Q)}}})}async function q3($,X){try{let J=(await X).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
12346
12348
  <script>
12347
12349
  window.__stxSuspense.resolve('${$}', \`${J}\`);
12348
12350
  </script>`}catch(Z){let J=Z instanceof Error?Z.message:String(Z);return`
12349
12351
  <script>
12350
- window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${X1(J)}</div>');
12351
- </script>`}}function K_($,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 z_($,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=K_(G.render(),J,G.id);Y.enqueue(await Y3(G.id,Q))}));Y.close()}catch(G){Y.error(G)}}})}function j_($,X){return $.replace(U_,(Z,J,Y)=>{let G=J.trim(),Q=Y.split(/@fallback/i),w=Q[0].trim(),q=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!X.__streamTemplates)X.__streamTemplates={};return X.__streamTemplates[G]=w,`<div data-suspense="${G}">${q}</div>`})}function B_($){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 __($,X={},Z={}){let J={...Q5,...Z,streaming:{...J3,...Z.streaming}},Y=J.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file($).text(),w=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K={...X,__filename:$,__dirname:$9.dirname($)};if(q.trim())await t1(q,K,$);let z=new Set,U=J.streaming?.strategy||"auto",B=new RegExp(q5.source,"g");if(!(U!=="manual"&&B.test(W))){let _=await F0(W,K,$,J,z);for(let H=0;H<_.length;H+=Y)G.enqueue(_.slice(H,H+Y))}else{let _=[],H=new RegExp(q5.source,"g"),L;while((L=H.exec(W))!==null)_.push({name:L[1],content:L[2],start:L.index,end:L.index+L[0].length});let O=0;for(let F of _){if(F.start>O){let A=W.slice(O,F.start);if(A.trim()){let R=await F0(A,K,$,J,z);G.enqueue(R)}}let V=await F0(F.content,K,$,J,z);G.enqueue(V),O=F.end}if(O<W.length){let F=W.slice(O);if(F.trim()){let V=await F0(F,K,$,J,z);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function H_($,X={}){let Z={...Q5,...X,streaming:{...J3,...X.streaming}},J=await Bun.file($).text(),Y=J.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=Y?Y[1]:"",Q=J.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=Q,q={},W;q5.lastIndex=0;while((W=q5.exec(Q))!==null){let U=W[1],B=W[2];q[U]=B}let K=Q.replace(q5,"");return{renderShell:async(U={})=>{let B={...U,__filename:$,__dirname:$9.dirname($)};return await t1(G,B,$),F0(K,B,$,Z,new Set)},renderSection:async(U,B={})=>{try{if(!q[U])return`<div class="error-message">Section "${X1(U)}" not found in template "${X1($)}"</div>`;let j={...B,__filename:$,__dirname:$9.dirname($)};await t1(G,j,$);let _=new Set;return await F0(q[U],j,$,Z,_)}catch(j){let _=j instanceof Error?j.message:String(j);return B0("Expression",_,$,q[U]||"",0,q[U]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return w}}}function O_($={}){let X=[];if($.streaming?.enabled)X.push(PG);if($.hydration?.enabled)X.push(vG);return X}async function L_($,X,Z,J={}){return $}function F_($,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 V_($={mode:"full"}){let{mode:X,components:Z={},dynamicImports:J=!0}=$,Y=Object.entries(Z).map(([G,Q])=>`'${G}': ${J?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
12352
+ window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${J1(J)}</div>');
12353
+ </script>`}}function j_($,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 B_($,X=[],Z={}){let J=Z.timeoutMs??0;return new ReadableStream({async start(Y){try{if(Y.enqueue($),X.length>0)Y.enqueue(fG),await Promise.all(X.map(async(G)=>{let Q=j_(G.render(),J,G.id);Y.enqueue(await q3(G.id,Q))}));Y.close()}catch(G){Y.error(G)}}})}function H_($,X){return $.replace(__,(Z,J,Y)=>{let G=J.trim(),Q=Y.split(/@fallback/i),w=Q[0].trim(),q=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!X.__streamTemplates)X.__streamTemplates={};return X.__streamTemplates[G]=w,`<div data-suspense="${G}">${q}</div>`})}function O_($){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 L_($,X={},Z={}){let J={...z5,...Z,streaming:{...w3,...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),q=w?w[1]:"",W=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K={...X,__filename:$,__dirname:Y9.dirname($)};if(q.trim())await J5(q,K,$);let z=new Set,U=J.streaming?.strategy||"auto",B=new RegExp(j5.source,"g");if(!(U!=="manual"&&B.test(W))){let _=await R0(W,K,$,J,z);for(let H=0;H<_.length;H+=Y)G.enqueue(_.slice(H,H+Y))}else{let _=[],H=new RegExp(j5.source,"g"),L;while((L=H.exec(W))!==null)_.push({name:L[1],content:L[2],start:L.index,end:L.index+L[0].length});let O=0;for(let F of _){if(F.start>O){let A=W.slice(O,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),O=F.end}if(O<W.length){let F=W.slice(O);if(F.trim()){let V=await R0(F,K,$,J,z);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function F_($,X={}){let Z={...z5,...X,streaming:{...w3,...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,q={},W;j5.lastIndex=0;while((W=j5.exec(Q))!==null){let U=W[1],B=W[2];q[U]=B}let K=Q.replace(j5,"");return{renderShell:async(U={})=>{let B={...U,__filename:$,__dirname:Y9.dirname($)};return await J5(G,B,$),R0(K,B,$,Z,new Set)},renderSection:async(U,B={})=>{try{if(!q[U])return`<div class="error-message">Section "${J1(U)}" not found in template "${J1($)}"</div>`;let j={...B,__filename:$,__dirname:Y9.dirname($)};await J5(G,j,$);let _=new Set;return await R0(q[U],j,$,Z,_)}catch(j){let _=j instanceof Error?j.message:String(j);return O0("Expression",_,$,q[U]||"",0,q[U]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return w}}}function V_($={}){let X=[];if($.streaming?.enabled)X.push(gG);if($.hydration?.enabled)X.push(hG);return X}async function A_($,X,Z,J={}){return $}function R_($,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 N_($={mode:"full"}){let{mode:X,components:Z={},dynamicImports:J=!0}=$,Y=Object.entries(Z).map(([G,Q])=>`'${G}': ${J?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
12352
12354
  `);if(X==="loader")return`
12353
12355
  (function() {
12354
12356
  window.__stx = window.__stx || {};
@@ -12490,7 +12492,7 @@ else {
12490
12492
  else {
12491
12493
  stx.hydrate();
12492
12494
  }
12493
- })();`}var J3,q5,SG,CG=`
12495
+ })();`}var w3,j5,xG,fG=`
12494
12496
  <script>
12495
12497
  (function(){
12496
12498
  window.__stxSuspense = window.__stxSuspense || {
@@ -12510,25 +12512,25 @@ else {
12510
12512
  }
12511
12513
  };
12512
12514
  })();
12513
- </script>`,U_,PG,vG;var Q3=y(()=>{F1();W1();z$();y0();J3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},q5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,SG=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;U_=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;PG={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} -->`}},vG={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),q=w?w[1].trim():"",W=w?$.replace(w[0],""):$;return`<div data-island="${Y}" data-island-id="${Q}" data-priority="${G}">
12515
+ </script>`,__,gG,hG;var K3=D(()=>{R1();j1();_$();A0();w3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},j5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,xG=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;__=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;gG={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} -->`}},hG={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),q=w?w[1].trim():"",W=w?$.replace(w[0],""):$;return`<div data-island="${Y}" data-island-id="${Q}" data-priority="${G}">
12514
12516
  ${W}
12515
12517
  <script type="application/json" data-island-props="${Q}">
12516
12518
  ${q?`{${q}}`:"{}"}
12517
12519
  </script>
12518
- </div>`}}});var gG={};a(gG,{warnUnbalancedTags:()=>w3,findUnbalancedTags:()=>fG});function h5($){return $.replace(/[^\n]/g," ")}function fG($){let X=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,h5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,h5).replace(/<!--[\s\S]*?-->/g,h5).replace(/\{\{\{[\s\S]*?\}\}\}/g,h5).replace(/\{\{[\s\S]*?\}\}/g,h5).replace(/\{!![\s\S]*?!!\}/g,h5),Z=new Map,J=new Map,Y=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=Y.exec(X))!==null){let w=G[1]==="/",q=G[2],W=G[3]==="/";if(A_.has(q.toLowerCase()))continue;if(W)continue;if(w)J.set(q,(J.get(q)??0)+1);else{let K=Z.get(q);if(K)K.count++;else{let z=X.slice(0,G.index).split(`
12519
- `).length;Z.set(q,{count:1,firstLine:z})}}}let Q=[];for(let w of new Set([...Z.keys(),...J.keys()])){if(R_.has(w.toLowerCase()))continue;let q=Z.get(w)?.count??0,W=J.get(w)??0;if(q!==W)Q.push({tag:w,opened:q,closed:W,firstOpenLine:Z.get(w)?.firstLine??0})}return Q}function w3($,X){let Z;try{Z=fG($)}catch{return}if(Z.length===0)return;let J=`${X}:${$.length}`;if(xG.has(J))return;xG.add(J);let Y=X?X.split(/[/\\]/).pop()||X:"template";for(let{tag:G,opened:Q,closed:w,firstOpenLine:q}of Z)if(Q>w){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Y}: <${G}> ${Q} opened, ${w} closed \u2014 an unclosed <${G}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Y}: <${G}> ${Q} opened, ${w} closed \u2014 ${w-Q} stray </${G}>.`)}var A_,R_,xG;var q3=y(()=>{A_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),R_=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);xG=new Set});import t0 from"path";import W3 from"fs";function hG($){return $.split("-").map((X)=>X.charAt(0).toUpperCase()+X.slice(1)).join("")}function uG($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class dG{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(),hG(Y),uG(Y)];for(let j of B)if(G.has(j))return G.get(j)}let Q=[...new Set([`${Y}.stx`,`${hG(Y)}.stx`,`${uG(Y)}.stx`])];if(Y.startsWith("./")||Y.startsWith("../")){let B=t0.resolve(t0.dirname(X),`${Y}.stx`);if(await n(B))return B;return null}let w=[],q=Z.componentsDir||"",W=J?.__originalFilePath;if(W)w.push(t0.join(t0.dirname(W),"components"));if(q)w.push(q);let K=t0.join(t0.dirname(X),"components");if(!w.includes(K))w.push(K);let z=process.cwd(),U=[t0.resolve(z,"src/components"),t0.resolve(z,"components"),t0.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 _=t0.join(B,j);if(await n(_))return _}try{if(!W3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let _=W3.readdirSync(B,{withFileTypes:!0});for(let H of _)if(H.isDirectory()){let L=t0.join(B,H.name);for(let O of Q){let F=t0.join(L,O);if(await n(F))return F}}}catch{}}return null}}var c0;var K3=y(()=>{y0();c0=new dG});function T0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function z3($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var W5="\x00stx-boolean-attribute";function u5($,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(T0(G));continue}if(Y===W5){Z.push(T0(G));continue}Z.push(`${T0(G)}="${T0(z3(String(Y)))}"`)}return Z}function d5($,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(T0(G));continue}if(typeof Y==="object")continue;Z.push(`${T0(G)}="${T0(z3(String(Y)))}"`)}return Z}var X9=()=>{};function $8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function N_($){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 U3;var j3=y(()=>{X9();U3={name:"StxLink",aliases:["stx-link"],render($,X,Z){let J=N_($),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,q=[];if(J.reactive)q.push(`:href="${$8(J.value)}"`);else q.push(`href="${$8(J.value)}"`);if(Y)q.push(`class="${$8(Y)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${$8(G)}"`),q.push(`data-stx-exact-active-class="${$8(Q)}"`),w)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...u5($,W)),q.push(...d5($,W)),`<a ${q.join(" ")}>${X}</a>`}}});function C0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function g0($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function _3($,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 mG($){if($.includes("(")||$.includes(","))return $;let X=$.trim().split(/\s+/),Z=[];for(let J of X)if(J.includes(":")){let[Y,G]=J.split(":"),Q=T_[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 H3($,X,Z,J){return X.map((Y)=>`${X8($,Y,void 0,Z,J)} ${Y}w`).join(", ")}function M_($,X,Z,J,Y){return X.map((G)=>{let Q=Z?Z*G:void 0;return`${X8($,Q,void 0,J,Y)} ${G}x`}).join(", ")}function X8($,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 k_($,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 T_,B3,O3;var L3=y(()=>{X9();T_={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},B3=[320,640,768,1024,1280,1536,1920];O3={name:"StxImage",aliases:["stx-image","stx-img"],render($,X,Z){let J=g0($,"src")||"",Y=g0($,"alt")||"",G=g0($,"width"),Q=g0($,"height"),w=g0($,"sizes"),q=g0($,"srcset"),W=g0($,"densities"),K=g0($,"format"),z=g0($,"placeholder"),U=g0($,"placeholderColor")||"#e5e7eb",B=g0($,"provider"),j=g0($,"class")||g0($,"className")||"",_=g0($,"style")||"",H=g0($,"quality"),L=_3($,"lazy",!0),O=_3($,"preload",!1),F=_3($,"picture",!1)||!!K,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=q||"",N="";if(!R&&w)R=H3(J,B3,B,K),N=mG(w);else if(!R&&W){let b=W.split(/\s+/).map((E)=>Number.parseFloat(E.replace("x","")));R=M_(J,b,V,B,K)}else if(w)N=mG(w);let M=[];if(_)M.push(_);if(V&&A)M.push(`aspect-ratio:${V}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let b=k_(V||16,A||9,U);M.push(`background-image:url(${b})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")M.push(`background-image:url(${C0(z)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let k=X8(J,V,A,B,K),T=[];if(T.push(`src="${C0(k)}"`),T.push(`alt="${C0(Y)}"`),G)T.push(`width="${C0(G)}"`);if(Q)T.push(`height="${C0(Q)}"`);if(L)T.push('loading="lazy"');if(T.push('decoding="async"'),j)T.push(`class="${C0(j)}"`);if(M.length>0)T.push(`style="${C0(M.join(";"))}"`);if(R)T.push(`srcset="${C0(R)}"`);if(N)T.push(`sizes="${C0(N)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);T.push(...u5($,D)),T.push(...d5($,D));let I=`<img ${T.join(" ")} />`,S="";if(O){let E=K==="webp"?"image/webp":K==="avif"?"image/avif":"";S=`<link rel="preload" as="image" href="${C0(k)}"${E?` type="${E}"`:""}${R?` imagesrcset="${C0(R)}"`:""}${N?` imagesizes="${C0(N)}"`:""} />
12520
- `}if(F){let b=[];if(K==="avif"||K==="auto"){let E=X8(J,V,A,B,"avif"),v=R?H3(J,B3,B,"avif"):`${E}`;b.push(`<source type="image/avif" srcset="${C0(v)}"${N?` sizes="${C0(N)}"`:""} />`)}if(K==="webp"||K==="auto"){let E=X8(J,V,A,B,"webp"),v=R?H3(J,B3,B,"webp"):`${E}`;b.push(`<source type="image/webp" srcset="${C0(v)}"${N?` sizes="${C0(N)}"`:""} />`)}return`${S}<picture>
12520
+ </div>`}}});var mG={};t(mG,{warnUnbalancedTags:()=>z3,findUnbalancedTags:()=>dG});function c5($){return $.replace(/[^\n]/g," ")}function dG($){let X=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,c5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,c5).replace(/<!--[\s\S]*?-->/g,c5).replace(/\{\{\{[\s\S]*?\}\}\}/g,c5).replace(/\{\{[\s\S]*?\}\}/g,c5).replace(/\{!![\s\S]*?!!\}/g,c5),Z=new Map,J=new Map,Y=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=Y.exec(X))!==null){let w=G[1]==="/",q=G[2],W=G[3]==="/";if(T_.has(q.toLowerCase()))continue;if(W)continue;if(w)J.set(q,(J.get(q)??0)+1);else{let K=Z.get(q);if(K)K.count++;else{let z=X.slice(0,G.index).split(`
12521
+ `).length;Z.set(q,{count:1,firstLine:z})}}}let Q=[];for(let w of new Set([...Z.keys(),...J.keys()])){if(M_.has(w.toLowerCase()))continue;let q=Z.get(w)?.count??0,W=J.get(w)??0;if(q!==W)Q.push({tag:w,opened:q,closed:W,firstOpenLine:Z.get(w)?.firstLine??0})}return Q}function z3($,X){let Z;try{Z=dG($)}catch{return}if(Z.length===0)return;let J=`${X}:${$.length}`;if(uG.has(J))return;uG.add(J);let Y=X?X.split(/[/\\]/).pop()||X:"template";for(let{tag:G,opened:Q,closed:w,firstOpenLine:q}of Z)if(Q>w){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Y}: <${G}> ${Q} opened, ${w} closed \u2014 an unclosed <${G}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Y}: <${G}> ${Q} opened, ${w} closed \u2014 ${w-Q} stray </${G}>.`)}var T_,M_,uG;var U3=D(()=>{T_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),M_=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);uG=new Set});import $1 from"path";import j3 from"fs";function cG($){return $.split("-").map((X)=>X.charAt(0).toUpperCase()+X.slice(1)).join("")}function lG($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class pG{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(),cG(Y),lG(Y)];for(let j of B)if(G.has(j))return G.get(j)}let Q=[...new Set([`${Y}.stx`,`${cG(Y)}.stx`,`${lG(Y)}.stx`])];if(Y.startsWith("./")||Y.startsWith("../")){let B=$1.resolve($1.dirname(X),`${Y}.stx`);if(await n(B))return B;return null}let w=[],q=Z.componentsDir||"",W=J?.__originalFilePath;if(W)w.push($1.join($1.dirname(W),"components"));if(q)w.push(q);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 B of U)if(!w.includes(B))w.push(B);for(let B of w){if(!B)continue;for(let j of Q){let _=$1.join(B,j);if(await n(_))return _}try{if(!j3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let _=j3.readdirSync(B,{withFileTypes:!0});for(let H of _)if(H.isDirectory()){let L=$1.join(B,H.name);for(let O of Q){let F=$1.join(L,O);if(await n(F))return F}}}catch{}}return null}}var n0;var B3=D(()=>{A0();n0=new pG});function M0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _3($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var B5="\x00stx-boolean-attribute";function l5($,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(M0(G));continue}if(Y===B5){Z.push(M0(G));continue}Z.push(`${M0(G)}="${M0(_3(String(Y)))}"`)}return Z}function p5($,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(M0(G));continue}if(typeof Y==="object")continue;Z.push(`${M0(G)}="${M0(_3(String(Y)))}"`)}return Z}var G9=()=>{};function J8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function k_($){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 H3;var O3=D(()=>{G9();H3={name:"StxLink",aliases:["stx-link"],render($,X,Z){let J=k_($),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,q=[];if(J.reactive)q.push(`:href="${J8(J.value)}"`);else q.push(`href="${J8(J.value)}"`);if(Y)q.push(`class="${J8(Y)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${J8(G)}"`),q.push(`data-stx-exact-active-class="${J8(Q)}"`),w)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...l5($,W)),q.push(...p5($,W)),`<a ${q.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 F3($,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 iG($){if($.includes("(")||$.includes(","))return $;let X=$.trim().split(/\s+/),Z=[];for(let J of X)if(J.includes(":")){let[Y,G]=J.split(":"),Q=I_[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 V3($,X,Z,J){return X.map((Y)=>`${Y8($,Y,void 0,Z,J)} ${Y}w`).join(", ")}function E_($,X,Z,J,Y){return X.map((G)=>{let Q=Z?Z*G:void 0;return`${Y8($,Q,void 0,J,Y)} ${G}x`}).join(", ")}function Y8($,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 D_($,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 I_,L3,A3;var R3=D(()=>{G9();I_={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},L3=[320,640,768,1024,1280,1536,1920];A3={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"),q=u0($,"srcset"),W=u0($,"densities"),K=u0($,"format"),z=u0($,"placeholder"),U=u0($,"placeholderColor")||"#e5e7eb",B=u0($,"provider"),j=u0($,"class")||u0($,"className")||"",_=u0($,"style")||"",H=u0($,"quality"),L=F3($,"lazy",!0),O=F3($,"preload",!1),F=F3($,"picture",!1)||!!K,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=q||"",N="";if(!R&&w)R=V3(J,L3,B,K),N=iG(w);else if(!R&&W){let b=W.split(/\s+/).map((y)=>Number.parseFloat(y.replace("x","")));R=E_(J,b,V,B,K)}else if(w)N=iG(w);let T=[];if(_)T.push(_);if(V&&A)T.push(`aspect-ratio:${V}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let b=D_(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 k=Y8(J,V,A,B,K),M=[];if(M.push(`src="${x0(k)}"`),M.push(`alt="${x0(Y)}"`),G)M.push(`width="${x0(G)}"`);if(Q)M.push(`height="${x0(Q)}"`);if(L)M.push('loading="lazy"');if(M.push('decoding="async"'),j)M.push(`class="${x0(j)}"`);if(T.length>0)M.push(`style="${x0(T.join(";"))}"`);if(R)M.push(`srcset="${x0(R)}"`);if(N)M.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"]);M.push(...l5($,E)),M.push(...p5($,E));let I=`<img ${M.join(" ")} />`,S="";if(O){let y=K==="webp"?"image/webp":K==="avif"?"image/avif":"";S=`<link rel="preload" as="image" href="${x0(k)}"${y?` type="${y}"`:""}${R?` imagesrcset="${x0(R)}"`:""}${N?` imagesizes="${x0(N)}"`:""} />
12522
+ `}if(F){let b=[];if(K==="avif"||K==="auto"){let y=Y8(J,V,A,B,"avif"),P=R?V3(J,L3,B,"avif"):`${y}`;b.push(`<source type="image/avif" srcset="${x0(P)}"${N?` sizes="${x0(N)}"`:""} />`)}if(K==="webp"||K==="auto"){let y=Y8(J,V,A,B,"webp"),P=R?V3(J,L3,B,"webp"):`${y}`;b.push(`<source type="image/webp" srcset="${x0(P)}"${N?` sizes="${x0(N)}"`:""} />`)}return`${S}<picture>
12521
12523
  ${b.join(`
12522
12524
  `)}
12523
12525
  ${I}
12524
- </picture>`}return`${S}${I}`}}});function Z8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function m5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var cG="/images/safe-image-default.svg",I_,F3;var V3=y(()=>{X9();I_=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${cG}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,F3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,X,Z){let J=m5($,"src")||"",Y=m5($,"alt")||"",G=m5($,"fallback")||cG,Q=m5($,"class")||m5($,"className")||"",w=m5($,"fallbackClassName")||"",q=[];if(q.push(`src="${Z8(J)}"`),q.push(`alt="${Z8(Y)}"`),Q)q.push(`class="${Z8(Q)}"`);if(q.push(`data-fallback="${Z8(G)}"`),w)q.push(`data-fallback-class="${Z8(w)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...u5($,W)),q.push(...d5($,W));let K=`<img ${q.join(" ")} />`,z=Z.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${I_}${K}`;return K}}});function A3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function J8($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function Z9($,X,Z){let J=J8($,X);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return Z}var R3;var N3=y(()=>{R3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,X,Z){let J=A3(J8($,"color")||"#6366f1"),Y=A3(J8($,"initialColor")||J8($,"initial-color")||""),G=A3(J8($,"height")||"3px"),Q=Z9($,"duration",2000),w=Z9($,"throttle",200),q=Z9($,"zIndex",999999)||Z9($,"z-index",999999),W=Y?`linear-gradient(to right, ${Y}, ${J})`:J;return`
12526
+ </picture>`}return`${S}${I}`}}});function G8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function i5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var nG="/images/safe-image-default.svg",y_,N3;var T3=D(()=>{G9();y_=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${nG}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,N3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,X,Z){let J=i5($,"src")||"",Y=i5($,"alt")||"",G=i5($,"fallback")||nG,Q=i5($,"class")||i5($,"className")||"",w=i5($,"fallbackClassName")||"",q=[];if(q.push(`src="${G8(J)}"`),q.push(`alt="${G8(Y)}"`),Q)q.push(`class="${G8(Q)}"`);if(q.push(`data-fallback="${G8(G)}"`),w)q.push(`data-fallback-class="${G8(w)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...l5($,W)),q.push(...p5($,W));let K=`<img ${q.join(" ")} />`,z=Z.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${y_}${K}`;return K}}});function M3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function Q8($,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=Q8($,X);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return Z}var k3;var I3=D(()=>{k3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,X,Z){let J=M3(Q8($,"color")||"#6366f1"),Y=M3(Q8($,"initialColor")||Q8($,"initial-color")||""),G=M3(Q8($,"height")||"3px"),Q=Q9($,"duration",2000),w=Q9($,"throttle",200),q=Q9($,"zIndex",999999)||Q9($,"z-index",999999),W=Y?`linear-gradient(to right, ${Y}, ${J})`:J;return`
12525
12527
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${G};background:${W};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
12526
12528
  <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>
12527
12529
  </div>
12528
12530
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
12529
12531
  <script>
12530
12532
  (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()})})();
12531
- </script>`}}});function pG($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function E_($,X,Z){let J=pG($,X);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return Z}var lG,T3;var M3=y(()=>{lG={"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%)"},T3={name:"StxToast",aliases:["stx-toast"],render($,X,Z){let J=T0(pG($,"position")||"top-right"),Y=E_($,"max",5),G=lG[J]||lG["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>
12533
+ </script>`}}});function oG($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function b_($,X,Z){let J=oG($,X);if(J!==void 0){let Y=Number.parseInt(J,10);if(!Number.isNaN(Y))return Y}return Z}var rG,E3;var D3=D(()=>{rG={"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%)"},E3={name:"StxToast",aliases:["stx-toast"],render($,X,Z){let J=M0(oG($,"position")||"top-right"),Y=b_($,"max",5),G=rG[J]||rG["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>
12532
12534
  <style>
12533
12535
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
12534
12536
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -12536,7 +12538,7 @@ ${I}
12536
12538
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
12537
12539
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
12538
12540
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
12539
- </style>`}}});function J9($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var iG,k3;var I3=y(()=>{iG={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)"},k3={name:"StxModal",aliases:["stx-modal"],render($,X,Z){let J=J9($,"id");if(!J)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Y=T0(J),G=J9($,"size")||"md",Q=J9($,"closeOnBackdrop")!=="false",w=J9($,"closeOnEscape")!=="false",q=iG[G]||iG.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">
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 sG,y3;var b3=D(()=>{sG={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)"},y3={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=M0(J),G=w9($,"size")||"md",Q=w9($,"closeOnBackdrop")!=="false",w=w9($,"closeOnEscape")!=="false",q=sG[G]||sG.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">
12540
12542
  <div class="stx-modal-panel" style="${q};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
12541
12543
  <div style="padding:1.5rem">${X}</div>
12542
12544
  </div>
@@ -12545,7 +12547,7 @@ ${I}
12545
12547
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
12546
12548
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
12547
12549
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
12548
- </style>`}}});function c5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var nG,E3;var D3=y(()=>{nG={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},E3={name:"StxDrawer",aliases:["stx-drawer"],render($,X,Z){let J=c5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=T0(J),G=c5($,"side")||"right",Q=c5($,"size")||"md",w=c5($,"closeOnBackdrop")!=="false",q=c5($,"closeOnEscape")!=="false",W=c5($,"overlay")!=="false",K=nG[Q]||nG.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="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
12550
+ </style>`}}});function n5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var aG,S3;var C3=D(()=>{aG={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},S3={name:"StxDrawer",aliases:["stx-drawer"],render($,X,Z){let J=n5($,"id");if(!J)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Y=M0(J),G=n5($,"side")||"right",Q=n5($,"size")||"md",w=n5($,"closeOnBackdrop")!=="false",q=n5($,"closeOnEscape")!=="false",W=n5($,"overlay")!=="false",K=aG[Q]||aG.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="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
12549
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">
12550
12552
  <div style="padding:1.5rem">${X}</div>
12551
12553
  </div>
@@ -12554,18 +12556,18 @@ ${I}
12554
12556
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
12555
12557
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
12556
12558
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
12557
- </style>`}}});import{existsSync as D_,readFileSync as y_}from"fs";function b_($){if(rG.has($))return;rG.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function S_($){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(D_(Z))return Z;for(let Z of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return U0.resolve(Z)}catch{}return null}function C_($){if(Y9.has($))return Y9.get($);let X=S_($);if(!X)return b_($),null;try{let Z=JSON.parse(y_(X,"utf8"));return Y9.set($,Z.icons),Z.icons}catch{return null}}function l5($,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 Y9,rG,y3;var b3=y(()=>{Y9=new Map,rG=new Set;y3={name:"Icon",aliases:["icon","stx-icon"],render($,X,Z){let J=l5($,"name")??l5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",G=J;if(J.includes(":")){let O=J.split(":");Y=O[0],G=O[1]}let Q=T0(l5($,"size")||"24"),w=T0(l5($,"color")||"currentColor"),q=T0(l5($,"class")||""),W=T0(l5($,"style")||""),K=Y9.get(Y)??C_(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}`,_=z.body;if(w!=="currentColor")_=_.replace(/currentColor/g,w);let H=q?` class="${q}"`:"",L=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${j}" fill="none"${H}${L}>${_}</svg>`}}});function oG($,...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 sG($,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 S3;var C3=y(()=>{S3={name:"Suspense",aliases:["suspense"],render($,X,Z){let J=sG(X,"fallback"),Y=J.rest,G=sG(Y,"error"),Q=G.rest,w=J.region??oG($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=G.region??oG($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${w}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function G9($,...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 P3;var v3=y(()=>{P3={name:"TransitionGroup",aliases:["transition-group"],render($,X,Z){let J=(G9($,"name")||"v").replace(/["'<>]/g,""),Y=(G9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=G9($,"class"),Q=G9($,"id"),w=[`data-stx-transition-group="${J}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${Y} ${w}>${X}</${Y}>`}}});function aG(){c0.registerBuiltin(U3),c0.registerBuiltin(O3),c0.registerBuiltin(F3),c0.registerBuiltin(R3),c0.registerBuiltin(T3),c0.registerBuiltin(k3),c0.registerBuiltin(E3),c0.registerBuiltin(y3),c0.registerBuiltin(S3),c0.registerBuiltin(P3)}var tG=y(()=>{j3();L3();V3();N3();M3();I3();D3();b3();C3();v3();K3();j3();L3();V3();N3();M3();I3();D3();b3();C3();v3()});function Q9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function eG($,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 q=w[1];if(Z&&Z.has(q.toLowerCase())){let _=G+1+q.length;while(_<$.length&&$[_]!==">")_++;Y=_+1;continue}let W=G+1+q.length,K=null,z=W,U=-1,B=!1;while(W<$.length){let _=$[W];if(K){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===K)K=null;W++;continue}if(_==='"'||_==="'"){K=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){U=W+2,B=!0;break}if(_===">"){U=W+1;break}W++}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:q,attributes:j,content:"",startIndex:G,endIndex:U,isSelfClosing:!0}),Y=U;else{let _=`<${q}`,H=`</${q}>`,L=1,O=U,F=-1;while(L>0&&O<$.length){let R=$.indexOf(_,O),N=$.indexOf(H,O);if(N===-1)break;if(R!==-1&&R<N){let M=$[R+_.length];if(M===" "||M===">"||M==="/"||M===`
12558
- `||M==="\t")L++;O=R+_.length}else{if(L--,L===0){F=N;break}O=N+H.length}}if(F===-1){Y=U;continue}let V=$.slice(U,F),A=F+H.length;J.push({fullMatch:$.slice(G,A),tagName:q,attributes:j,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),Y=A}}return J}function $Q($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function XQ($,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 ZQ=y(()=>{I0();y0();o1()});var WQ={};a(WQ,{processESImports:()=>wQ,processComponents:()=>q9});import w9 from"fs";import r0 from"path";function v_($,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=(W)=>{if(Y.size===0)return!1;let K=s0(W),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(W2),w=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(K,z)=>z.toUpperCase())},q=(W,K)=>{let z=w(W);if(J.static[z]=K,z!==W)J.staticNames[z]=W};for(let[W,K]of Object.entries($)){let z=W.startsWith("x-")&&!Q.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(z.startsWith("@")){J.events[z]=K;continue}if(z.startsWith("__stx_")){let U=w(z.slice(6));J.serverDynamic[U]=XQ(K,Z);continue}if(z.startsWith(":")){let U=w(z.slice(1)),B=K===W5?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),H=W0(B,j)(...Object.values(X));if(H===void 0){let L=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(L.some((V)=>!O.has(V)&&!j.includes(V))){J.clientReactive[U]=B;continue}}if(J.serverDynamic[U]=H,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 _=W0(B,Object.keys(X))(...Object.values(X));q(z,_!=null?String(_):"")}else{if(Z.debug)console.error(`Unsafe expression in ${z}: ${B}`);q(z,K)}}catch(B){if(Z.debug)console.error(`Error evaluating expression for ${z}:`,B);q(z,K)}else{let B=K,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(K))!==null)try{let H=_[1];if(!q0(H)){if(Z.debug)console.error(`Unsafe expression in ${z}: ${H}`);continue}let O=W0(H,Object.keys(X))(...Object.values(X));B=B.replace(_[0],String(O??""))}catch(H){if(Z.debug)console.error(`Error evaluating expression in ${z}:`,H)}q(z,B)}continue}q(z,K===W5?"true":$Q(K))}return J}function f_($,X,Z){if(!$.includes("@"))return $;if(!x_.some(([Y,G])=>Y.test($)&&$.includes(G)))return $;try{return N1($,X,Z)}catch{return $}}function g_($){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]=W5}return X}function YQ($){return Object.entries($).map(([X,Z])=>Z===W5?X:`${X}="${h_(Z)}"`).join(" ")}function h_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function u_($){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(c0.isBuiltin(Y))X.add(Y)}return[...X].sort()}function d_($){let X=GQ.get($);if(X)return X;let Z=new Map,J=[r0.join($,"src"),r0.join($,"dist"),$];function Y(G,Q){if(Q>6)return;let w;try{w=w9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of w){let W=r0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Y(W,Q+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let K=q.name.slice(0,-4);if(!Z.has(K))Z.set(K,W);let z=K.toLowerCase();if(!Z.has(z))Z.set(z,W);let U=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(U))Z.set(U,W)}}}for(let G of J)if(Y(G,0),Z.size>0)break;return GQ.set($,Z),Z}function m_($,X){if($.startsWith(".")||$.startsWith("/"))return null;let Z=X;while(!0){let J=r0.join(Z,"node_modules",$);try{if(w9.statSync(J).isDirectory())return J}catch{}let Y=r0.dirname(Z);if(Y===Z)return null;Z=Y}}async function wQ($,X,Z,J,Y){if(!$.includes("import"))return $;if(!X.__importedComponents)X.__importedComponents=new Map;let G=X.__importedComponents,Q=r0.dirname(Z),w=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return w=w.replace(q,(W,K,z)=>{let U=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,_=[];while((j=U.exec(z))!==null){let[H,L,O,F]=j,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let M=r0.resolve(Q,F);if(M.endsWith(".stx"))A=M;else{let k=`${M}.stx`;try{if(w9.statSync(k).isFile())A=k}catch{try{if(w9.statSync(M).isDirectory())V=M}catch{}}}}else V=m_(F,Q);if(!V&&!A)continue;let R=!1,N=(M,k)=>{G.set(M,k),G.set(M.toLowerCase(),k);let T=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(T,k),Y.add(k)};if(O&&A)N(O,A),R=!0;else if(L){let M=L.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let D=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:T,local:T}}),k=V?d_(V):null;for(let{source:T,local:D}of M){let I=null;if(A)I=A;else if(k)I=k.get(T)??k.get(T.toLowerCase())??k.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(D,I),R=!0}}if(R)_.push({start:j.index,end:j.index+H.length})}if(_.length===0)return W;for(let H=_.length-1;H>=0;H--)B=B.slice(0,_[H].start)+B.slice(_[H].end);return`<script${K}>${B}</script>`}),w}async function c_($,X,Z,J,Y){let G=$;if(!X.__importedComponents)X.__importedComponents=new Map;let Q=X.__importedComponents,w=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=w.exec(G))!==null){let[W,K]=q,z=K.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of z){let B=U.split("/"),_=B[B.length-1].replace(/\.stx$/,""),H=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),L=null,O=[r0.resolve(r0.dirname(Z),`${U}.stx`),r0.resolve(r0.dirname(Z),U),r0.resolve(J.componentsDir||"components",`${U}.stx`),r0.resolve(J.componentsDir||"components",U),U.endsWith(".stx")?U:`${U}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){L=F;break}}catch{}if(L){Q.set(H,L),Q.set(_,L),Q.set(_.toLowerCase(),L);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,L),Y.add(L),J.debug)console.log(`Imported component: ${H} -> ${L}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${U}`)}G=G.replace(W,""),w.lastIndex=0}return G}async function l_($,X,Z,J,Y){let G=$,Q=J.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let w=X.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(G))!==null){let K=W.index,z=K+W[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),_=B+1,H=j.match(/^\s*['"]([^'"]+)['"]/);if(!H){q.lastIndex=0;continue}let L=H[1],O,F=j.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)O=F.slice(V[0].length).trim();let A={};if(O)try{A=k0(O,X)}catch(D){let I=D instanceof Error?D.message:String(D);G=G.replace(G.substring(K,_),`[Error parsing component props: ${I}]`);continue}let R="",N=_,k=G.substring(_).match(/^([\s\S]*?)@endcomponent/);if(k)R=k[1].trim(),N=_+k[0].length;let T=await Z5(L,A,R,Q,X,Z,J,w,Y);G=G.substring(0,K)+T+G.substring(N),q.lastIndex=0}return G}async function p_($,X,Z,J,Y){if(!$)return $;let G=$,Q=J.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let w=X.__processedComponents,q=b1(G);return G=q.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,P_),G=S7(G,q.scripts),G;async function U(B,j,_,H){if(!B)return B;let L=B,O=eG(L,j,H);for(let F=O.length-1;F>=0;F--){let V=O[F],A=_?Q9(V.tagName):V.tagName,R=g_(f_(V.attributes,X,Z)),N=v_(R,X,J),M=c0.getBuiltin(V.tagName),k=M?await K$(A,Q,X,Z,J):!1;if(M&&!k){let S={context:X,filePath:Z,options:J,dependencies:Y},b=M.render(N,V.content,S);if(Object.keys(N.clientReactive).length>0)b=QQ(b,N.clientReactive);if(Object.keys(N.events).length>0){let E=YQ(N.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${E}`)}L=L.substring(0,V.startIndex)+b+L.substring(V.endIndex);continue}if(!_&&V.tagName.includes("-")&&!await K$(A,Q,X,Z,J))continue;let T={};for(let[S,b]of Object.entries(N.static))T[S]=b;for(let[S,b]of Object.entries(N.serverDynamic))T[S]=b;let I=await Z5(A,T,V.content,Q,X,Z,J,w,Y);if(Object.keys(N.clientReactive).length>0)I=QQ(I,N.clientReactive);if(Object.keys(N.events).length>0){let S=qQ(I);if(S){let b=YQ(N.events),E=Object.keys(N.events).map((v)=>v.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,S.insertPos)+` data-stx-parent-events="${E}" ${b}`+I.substring(S.insertPos)}}L=L.substring(0,V.startIndex)+I+L.substring(V.endIndex)}return L}}function QQ($,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])=>Q9(K)).join(" "),Q=$,w=Y.length>0?qQ(Q):null;if(w){let K=Y.map(([U,B])=>`:${Q9(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 q=X.if;if(q)Q=`<template :if="${q.replace(/"/g,"&quot;")}">${Q}</template>`;let W=X.for;if(W)Q=`<template :for="${W.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function qQ($){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()}>`,q=$.toLowerCase().indexOf(w,Z+G[0].length);if(q===-1)return null;Z=q+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 q9($,X,Z,J,Y){if(!JQ)aG(),JQ=!0;let G=await wQ($,X,Z,J,Y);G=await c_(G,X,Z,J,Y),G=await l_(G,X,Z,J,Y);let Q=[];for(let w=0;w<3;w++){let q=q1(G,b7,(K,z)=>`\x00STX_COMPONENT_COMMENT_${Q.length+z}\x00`);Q.push(...q.tokens);let W=G;if(G=await p_(q.output,X,Z,J,Y),G===W)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,q)=>Q[Number(q)]??"");if(J.debug){let w=u_(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,P_,x_,GQ;var x3=y(()=>{K3();o7();tG();ZQ();o1();y0();I0();$1();P_=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"]);x_=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];GQ=new Map});var HQ={};a(HQ,{processLoops:()=>g3,parseLoopBinding:()=>f3});function r_($,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("("),q=b0($,"(",")",w);if(q===-1)continue;let W=$.slice(Q,q).trim();if(!W)continue;if(!Object.keys(X).some((U)=>new RegExp(`(?:^|[^\\w$.])${U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let z;try{let U=k0(W,X);if(!U||typeof U!=="object")continue;z=JSON.stringify(U)}catch{continue}J+=$.slice(Y,Q)+z,Y=q,Z.lastIndex=q}return Y===0?$:J+$.slice(Y)}function o_($,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,q=1,W=w+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let K=J.substring(w+1,W),z=W+1,U=K.match(/^\s*['"]([^'"]+)['"]/);if(!U)continue;let B=U[1],j=K.slice(U[0].length),_=j.match(/^\s*,\s*/);if(!_)continue;let H=j.slice(_[0].length).trim();if(!H)continue;try{let L=k0(H,X),O=JSON.stringify(L),F=`@component('${B}', ${O})`;G.push({start:Q,end:z,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];J=J.substring(0,w)+W+J.substring(q)}return J}function W9($,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,q=1,W=w+1,K=null,z=!1;while(W<J.length&&q>0){let j=J[W];if(z){z=!1,W++;continue}if(j==="\\"&&K){z=!0,W++;continue}if(K){if(j===K)K=null;W++;continue}if(j==='"'||j==="'"||j==="`"){K=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=J.substring(w+1,W),B=Z(U);J=J.substring(0,Q)+B+J.substring(W+1)}return J}function s_($,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);b8(G);let W=W0(G,Q)(...w),K=JSON.stringify(W),z=Buffer.from(K,"utf8").toString("base64");return`__stx_${Y}="${z}"`}catch(Q){return J}}),Z}function a_($,X){let Z=$;return Z=W9(Z,"@break",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(G0(G,X));return Q?K9:""}catch{return""}}),Z=W9(Z,"@continue",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(G0(G,X));return Q?z9:""}catch{return""}}),Z}function t_($){let X=$;return X=X.replace(/@break(?!\()/g,K9),X=X.replace(/@continue(?!\()/g,z9),X}function KQ($){let X=$.includes(K9),Z=X?$.substring(0,$.indexOf(K9)):$;return{hasBreak:X,content:Z}}function zQ($){let X=$.includes(z9),Z=X?$.substring(0,$.indexOf(z9)):$;return{hasContinue:X,content:Z}}function jQ($){let X=$;return X=W9(X,"@break",(Z)=>{let J=Z.trim();if(!S8(J))return"";return`\`; if (${J}) { break; } result += \``}),X=W9(X,"@continue",(Z)=>{let J=Z.trim();if(!S8(J))return"";return`\`; if (${J}) { continue; } result += \``}),X=X.replace(/@break(?!\()/g,"`; break; result += `"),X=X.replace(/@continue(?!\()/g,"`; continue; result += `"),X}function e_($){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=[],q=0;for(let K of J)q+=K.delta,w.push({pos:K.pos,depth:q});function W(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(W(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 _=$.substring(z+1,j),H=f3(_);if(!H)continue;let{arrayExpr:L,itemVar:O}=H,F=j+1,V=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,M=-1;while(V>0&&A<$.length){R.lastIndex=A,N.lastIndex=A;let b=R.exec($),E=N.exec($);if(!E)break;if(b&&b.index<E.index)V++,A=b.index+b[0].length;else{if(V--,V===0){M=E.index;break}A=E.index+11}}if(M===-1)continue;let k=$.substring(F,M),T=M+11,D=-1,I=0,S=0;while(S<k.length){let b=k.indexOf("@",S);if(b===-1)break;let E=k.substring(b);if(/^@forelse\s*\(/.test(E))I++,S=b+1;else if(E.startsWith("@endforelse"))I--,S=b+11;else if(I===0&&E.startsWith("@empty")){if(k.length<=b+6||!/[a-z]/i.test(k[b+6])){D=b;break}S=b+1}else S=b+1}if(D===-1)continue;return{start:K,end:T,arrayExpr:L,itemVar:O,foreachContent:k.substring(0,D),emptyContent:k.substring(D+6)}}return null}function UQ($,X){let Z=$;while(!0){let J=e_(Z);if(!J)break;let{start:Y,end:G,arrayExpr:Q,itemVar:w,foreachContent:q,emptyContent:W}=J;try{let K;if(q0(Q))K=W0(Q,Object.keys(X))(...Object.values(X));else K=G0(Q,X);let z;if(!Array.isArray(K)||K.length===0)z=W;else z=`@foreach (${Q} as ${w})${q}@endforeach`;Z=Z.substring(0,Y)+z+Z.substring(G)}catch(K){let z=K instanceof Error?K.message:String(K),U=X0("Forelse",`Error in @forelse(${Q} as ${w}): ${z}`,s.EVALUATION_ERROR);Z=Z.substring(0,Y)+U+Z.substring(G)}}return Z}function f3($){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 g3($,X,Z,J){let Y=$;Y=UQ(Y,X);function G(q){let W=/@foreach\s*\(/g,K;while((K=W.exec(q))!==null){let z=K.index,U=K.index+K[0].length-1,B=1,j=U+1,_=-1;while(j<q.length&&B>0){if(q[j]==="(")B++;else if(q[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let H=q.substring(U+1,_),L=f3(H);if(!L)continue;let O=z,{arrayExpr:F,itemVar:V}=L,A=_+1,R=1,N=A,M=/@foreach\s*\(/g,k=/@endforeach/g;while(R>0&&N<q.length){M.lastIndex=N,k.lastIndex=N;let T=M.exec(q),D=k.exec(q);if(!D)break;if(T&&T.index<D.index)R++,N=T.index+T[0].length;else{if(R--,R===0){let I=q.substring(A,D.index),S=D.index+11;return{start:O,end:S,arrayExpr:F,itemVar:V,content:I}}N=D.index+11}}}return null}function Q(q,W){let K=q;while(!0){let z=G(K);if(!z)break;let{start:U,end:B,arrayExpr:j,itemVar:_,content:H}=z;try{let L=j.trim(),O;if(q0(L))O=W0(L,Object.keys(W))(...Object.values(W));else O=G0(L,W);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),F=!0;else{console.warn(`[stx] @foreach(${L}) in ${Z}: ${L} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let D=X0("Foreach",`Error in @foreach: ${L} is not iterable`,s.TYPE_ERROR);K=K.substring(0,U)+D+K.substring(B);continue}let V=J?.loops?.useAltLoopVariable??n_,A=_.trim(),R=null,N,M=!1;if(A.includes("=>")){let D=A.split("=>").map((I)=>I.trim());if(D.length===2&&D[0]&&D[1])R=D[0],N=D[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((I)=>I.trim());if(D.length===2&&D[0]&&D[1])N=D[0],R=D[1],M=!0;else N=A}else N=A;let k="",T=O;for(let D=0;D<T.length;D++){let I=T[D],S={index:D,iteration:D+1,first:D===0,last:D===T.length-1,count:T.length},b={...W,loop:S,$loop:S};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((h)=>h.trim());if(Array.isArray(I))f.forEach((h,p)=>{if(h)b[h]=I[p]});else b[N]=I}else b[N]=I;if(R)if(!M&&F&&Array.isArray(I)&&I.length===2)b[R]=I[0],b[N]=I[1];else b[R]=D;let E=a_(H,b),v=zQ(E);if(v.hasContinue){k+=v.content;continue}let x=KQ(E);if(x.hasBreak){k+=x.content;break}if(E=UQ(E,b),E=Q(E,b),E=N1(E,b,Z),E=t_(E),x=KQ(E),x.hasBreak){k+=x.content;break}if(v=zQ(E),v.hasContinue){k+=v.content;continue}E=S1(E,b,Z),E=s_(E,b),E=o_(E,b),E=r_(E,b),k+=E}K=K.substring(0,U)+k+K.substring(B)}catch(L){let O=X0("Foreach",`Error in @foreach(${j.trim()} as ${_.trim()}): ${L instanceof Error?L.message:String(L)}`,s.EVALUATION_ERROR);K=K.substring(0,U)+O+K.substring(B)}}return K}Y=Q(Y,X),Y=_Q(Y,X,Z,J);let w=J?.loops?.maxWhileIterations??i_;return Y=ZH(Y,X,w),Y}function BQ($){return S8($)}function _Q($,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,q=w+Q[0].length-1,W=b0(Y,"(",")",q);if(W===-1)break;let K=Y.slice(q+1,W),z=W+1,U=d8(Y.slice(w),"for","endfor");if(U.length===0)break;let B=U[0].content,j=w+U[0].end;if(!BQ(K)){let _=X0("For",`Unsafe expression in @for: ${K}`,s.UNSAFE_EXPRESSION);Y=Y.substring(0,w)+_+Y.substring(j),G=!0;continue}try{let _=$H(K),H=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&H){let R=XH({forExpr:K,content:B,iterVarNames:_,context:X,filePath:Z,options:J});Y=Y.substring(0,w)+R+Y.substring(j),G=!0;continue}let L=Object.keys(X),O=Object.values(X),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=jQ(F);let A=Function(...L,`
12559
+ </style>`}}});import{existsSync as S_,readFileSync as C_}from"fs";function P_($){if(tG.has($))return;tG.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function v_($){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(S_(Z))return Z;for(let Z of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return B0.resolve(Z)}catch{}return null}function x_($){if(q9.has($))return q9.get($);let X=v_($);if(!X)return P_($),null;try{let Z=JSON.parse(C_(X,"utf8"));return q9.set($,Z.icons),Z.icons}catch{return null}}function r5($,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,tG,P3;var v3=D(()=>{q9=new Map,tG=new Set;P3={name:"Icon",aliases:["icon","stx-icon"],render($,X,Z){let J=r5($,"name")??r5($,"icon");if(!J)return"<!-- Icon: missing name/icon prop -->";let Y="lucide",G=J;if(J.includes(":")){let O=J.split(":");Y=O[0],G=O[1]}let Q=M0(r5($,"size")||"24"),w=M0(r5($,"color")||"currentColor"),q=M0(r5($,"class")||""),W=M0(r5($,"style")||""),K=q9.get(Y)??x_(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}`,_=z.body;if(w!=="currentColor")_=_.replace(/currentColor/g,w);let H=q?` class="${q}"`:"",L=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${j}" fill="none"${H}${L}>${_}</svg>`}}});function eG($,...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 $Q($,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 x3;var f3=D(()=>{x3={name:"Suspense",aliases:["suspense"],render($,X,Z){let J=$Q(X,"fallback"),Y=J.rest,G=$Q(Y,"error"),Q=G.rest,w=J.region??eG($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=G.region??eG($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${w}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function W9($,...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 g3;var h3=D(()=>{g3={name:"TransitionGroup",aliases:["transition-group"],render($,X,Z){let J=(W9($,"name")||"v").replace(/["'<>]/g,""),Y=(W9($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=W9($,"class"),Q=W9($,"id"),w=[`data-stx-transition-group="${J}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${Y} ${w}>${X}</${Y}>`}}});function XQ(){n0.registerBuiltin(H3),n0.registerBuiltin(A3),n0.registerBuiltin(N3),n0.registerBuiltin(k3),n0.registerBuiltin(E3),n0.registerBuiltin(y3),n0.registerBuiltin(S3),n0.registerBuiltin(P3),n0.registerBuiltin(x3),n0.registerBuiltin(g3)}var ZQ=D(()=>{O3();R3();T3();I3();D3();b3();C3();v3();f3();h3();B3();O3();R3();T3();I3();D3();b3();C3();v3();f3();h3()});function K9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function JQ($,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 q=w[1];if(Z&&Z.has(q.toLowerCase())){let _=G+1+q.length;while(_<$.length&&$[_]!==">")_++;Y=_+1;continue}let W=G+1+q.length,K=null,z=W,U=-1,B=!1;while(W<$.length){let _=$[W];if(K){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===K)K=null;W++;continue}if(_==='"'||_==="'"){K=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){U=W+2,B=!0;break}if(_===">"){U=W+1;break}W++}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:q,attributes:j,content:"",startIndex:G,endIndex:U,isSelfClosing:!0}),Y=U;else{let _=`<${q}`,H=`</${q}>`,L=1,O=U,F=-1;while(L>0&&O<$.length){let R=$.indexOf(_,O),N=$.indexOf(H,O);if(N===-1)break;if(R!==-1&&R<N){let T=$[R+_.length];if(T===" "||T===">"||T==="/"||T===`
12560
+ `||T==="\t")L++;O=R+_.length}else{if(L--,L===0){F=N;break}O=N+H.length}}if(F===-1){Y=U;continue}let V=$.slice(U,F),A=F+H.length;J.push({fullMatch:$.slice(G,A),tagName:q,attributes:j,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),Y=A}}return J}function YQ($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function GQ($,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();A0();v1()});var jQ={};t(jQ,{processESImports:()=>zQ,processComponents:()=>U9});import z9 from"fs";import a0 from"path";function g_($,X,Z){let J={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},Y=new Set(Array.isArray(X.__stx_client_signal_names)?X.__stx_client_signal_names:[]),G=(W)=>{if(Y.size===0)return!1;let K=t0(W),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(j2),w=(W)=>{if(!W.includes("-")||W.startsWith("@")||W.startsWith(":")||W.startsWith("x-")||W.startsWith("__"))return W;if(W.startsWith("aria-")||W.startsWith("data-"))return W;return W.replace(/-([a-z0-9])/g,(K,z)=>z.toUpperCase())},q=(W,K)=>{let z=w(W);if(J.static[z]=K,z!==W)J.staticNames[z]=W};for(let[W,K]of Object.entries($)){let z=W.startsWith("x-")&&!Q.has(W)&&!W.startsWith("x-bind:")&&!W.startsWith("x-on:")?`:${W.slice(2)}`:W;if(z.startsWith("@")){J.events[z]=K;continue}if(z.startsWith("__stx_")){let U=w(z.slice(6));J.serverDynamic[U]=GQ(K,Z);continue}if(z.startsWith(":")){let U=w(z.slice(1)),B=K===B5?U:K;if(U==="if"||U==="for"||U==="show"){J.clientReactive[U]=B;continue}if(G(B)){J.clientReactive[U]=B;continue}try{if(!W0(B)){if(Z.debug)console.error(`Unsafe expression in :${U} binding: ${B}`);J.clientReactive[U]=B;continue}let j=Object.keys(X),H=K0(B,j)(...Object.values(X));if(H===void 0){let L=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(L.some((V)=>!O.has(V)&&!j.includes(V))){J.clientReactive[U]=B;continue}}if(J.serverDynamic[U]=H,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(W0(B)){let _=K0(B,Object.keys(X))(...Object.values(X));q(z,_!=null?String(_):"")}else{if(Z.debug)console.error(`Unsafe expression in ${z}: ${B}`);q(z,K)}}catch(B){if(Z.debug)console.error(`Error evaluating expression for ${z}:`,B);q(z,K)}else{let B=K,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(K))!==null)try{let H=_[1];if(!W0(H)){if(Z.debug)console.error(`Unsafe expression in ${z}: ${H}`);continue}let O=K0(H,Object.keys(X))(...Object.values(X));B=B.replace(_[0],String(O??""))}catch(H){if(Z.debug)console.error(`Error evaluating expression in ${z}:`,H)}q(z,B)}continue}q(z,K===B5?"true":YQ(K))}return J}function u_($,X,Z){if(!$.includes("@"))return $;if(!h_.some(([Y,G])=>Y.test($)&&$.includes(G)))return $;try{return I1($,X,Z)}catch{return $}}function d_($){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]=B5}return X}function qQ($){return Object.entries($).map(([X,Z])=>Z===B5?X:`${X}="${m_(Z)}"`).join(" ")}function m_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function c_($){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 l_($){let X=WQ.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 q of w){let W=a0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Y(W,Q+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let K=q.name.slice(0,-4);if(!Z.has(K))Z.set(K,W);let z=K.toLowerCase();if(!Z.has(z))Z.set(z,W);let U=K.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(U))Z.set(U,W)}}}for(let G of J)if(Y(G,0),Z.size>0)break;return WQ.set($,Z),Z}function p_($,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 zQ($,X,Z,J,Y){if(!$.includes("import"))return $;if(!X.__importedComponents)X.__importedComponents=new Map;let G=X.__importedComponents,Q=a0.dirname(Z),w=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return w=w.replace(q,(W,K,z)=>{let U=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,_=[];while((j=U.exec(z))!==null){let[H,L,O,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 k=`${T}.stx`;try{if(z9.statSync(k).isFile())A=k}catch{try{if(z9.statSync(T).isDirectory())V=T}catch{}}}}else V=p_(F,Q);if(!V&&!A)continue;let R=!1,N=(T,k)=>{G.set(T,k),G.set(T.toLowerCase(),k);let M=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(M,k),Y.add(k)};if(O&&A)N(O,A),R=!0;else if(L){let T=L.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let E=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:M,local:M}}),k=V?l_(V):null;for(let{source:M,local:E}of T){let I=null;if(A)I=A;else if(k)I=k.get(M)??k.get(M.toLowerCase())??k.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(E,I),R=!0}}if(R)_.push({start:j.index,end:j.index+H.length})}if(_.length===0)return W;for(let H=_.length-1;H>=0;H--)B=B.slice(0,_[H].start)+B.slice(_[H].end);return`<script${K}>${B}</script>`}),w}async function i_($,X,Z,J,Y){let G=$;if(!X.__importedComponents)X.__importedComponents=new Map;let Q=X.__importedComponents,w=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=w.exec(G))!==null){let[W,K]=q,z=K.split(",").map((U)=>U.trim().replace(/^['"]|['"]$/g,"")).filter((U)=>U.length>0);for(let U of z){let B=U.split("/"),_=B[B.length-1].replace(/\.stx$/,""),H=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),L=null,O=[a0.resolve(a0.dirname(Z),`${U}.stx`),a0.resolve(a0.dirname(Z),U),a0.resolve(J.componentsDir||"components",`${U}.stx`),a0.resolve(J.componentsDir||"components",U),U.endsWith(".stx")?U:`${U}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){L=F;break}}catch{}if(L){Q.set(H,L),Q.set(_,L),Q.set(_.toLowerCase(),L);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,L),Y.add(L),J.debug)console.log(`Imported component: ${H} -> ${L}`)}else if(J.debug)console.warn(`Could not resolve imported component: ${U}`)}G=G.replace(W,""),w.lastIndex=0}return G}async function n_($,X,Z,J,Y){let G=$,Q=J.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let w=X.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(G))!==null){let K=W.index,z=K+W[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),_=B+1,H=j.match(/^\s*['"]([^'"]+)['"]/);if(!H){q.lastIndex=0;continue}let L=H[1],O,F=j.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)O=F.slice(V[0].length).trim();let A={};if(O)try{A=D0(O,X)}catch(E){let I=E instanceof Error?E.message:String(E);G=G.replace(G.substring(K,_),`[Error parsing component props: ${I}]`);continue}let R="",N=_,k=G.substring(_).match(/^([\s\S]*?)@endcomponent/);if(k)R=k[1].trim(),N=_+k[0].length;let M=await w5(L,A,R,Q,X,Z,J,w,Y);G=G.substring(0,K)+M+G.substring(N),q.lastIndex=0}return G}async function r_($,X,Z,J,Y){if(!$)return $;let G=$,Q=J.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let w=X.__processedComponents,q=U1(G);return G=q.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,f_),G=y5(G,q.scripts),G;async function U(B,j,_,H){if(!B)return B;let L=B,O=JQ(L,j,H);for(let F=O.length-1;F>=0;F--){let V=O[F],A=_?K9(V.tagName):V.tagName,R=d_(u_(V.attributes,X,Z)),N=g_(R,X,J),T=n0.getBuiltin(V.tagName),k=T?await B$(A,Q,X,Z,J):!1;if(T&&!k){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=KQ(b,N.clientReactive);if(Object.keys(N.events).length>0){let y=qQ(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(!_&&V.tagName.includes("-")&&!await B$(A,Q,X,Z,J))continue;let M={};for(let[S,b]of Object.entries(N.static))M[S]=b;for(let[S,b]of Object.entries(N.serverDynamic))M[S]=b;let I=await w5(A,M,y5(V.content,q.scripts),Q,X,Z,J,w,Y);if(Object.keys(N.clientReactive).length>0)I=KQ(I,N.clientReactive);if(Object.keys(N.events).length>0){let S=UQ(I);if(S){let b=qQ(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 KQ($,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?UQ(Q):null;if(w){let K=Y.map(([U,B])=>`:${K9(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 q=X.if;if(q)Q=`<template :if="${q.replace(/"/g,"&quot;")}">${Q}</template>`;let W=X.for;if(W)Q=`<template :for="${W.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function UQ($){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()}>`,q=$.toLowerCase().indexOf(w,Z+G[0].length);if(q===-1)return null;Z=q+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(!wQ)XQ(),wQ=!0;let G=await zQ($,X,Z,J,Y);G=await i_(G,X,Z,J,Y),G=await n_(G,X,Z,J,Y);let Q=[];for(let w=0;w<3;w++){let q=z1(G,v7,(K,z)=>`\x00STX_COMPONENT_COMMENT_${Q.length+z}\x00`);Q.push(...q.tokens);let W=G;if(G=await r_(q.output,X,Z,J,Y),G===W)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,q)=>Q[Number(q)]??"");if(J.debug){let w=c_(G);if(w.length>0)console.warn(`[stx] ${Z}: unresolved component tag(s) after render passes: ${w.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return G}var wQ=!1,f_,h_,WQ;var u3=D(()=>{B3();t7();ZQ();QQ();v1();A0();y0();Z1();f_=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"]);h_=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];WQ=new Map});var VQ={};t(VQ,{processLoops:()=>m3,parseLoopBinding:()=>d3});function a_($,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("("),q=P0($,"(",")",w);if(q===-1)continue;let W=$.slice(Q,q).trim();if(!W)continue;if(!Object.keys(X).some((U)=>new RegExp(`(?:^|[^\\w$.])${U.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let z;try{let U=D0(W,X);if(!U||typeof U!=="object")continue;z=JSON.stringify(U)}catch{continue}J+=$.slice(Y,Q)+z,Y=q,Z.lastIndex=q}return Y===0?$:J+$.slice(Y)}function t_($,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,q=1,W=w+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let K=J.substring(w+1,W),z=W+1,U=K.match(/^\s*['"]([^'"]+)['"]/);if(!U)continue;let B=U[1],j=K.slice(U[0].length),_=j.match(/^\s*,\s*/);if(!_)continue;let H=j.slice(_[0].length).trim();if(!H)continue;try{let L=D0(H,X),O=JSON.stringify(L),F=`@component('${B}', ${O})`;G.push({start:Q,end:z,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:w,end:q,replacement:W}=G[Q];J=J.substring(0,w)+W+J.substring(q)}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,q=1,W=w+1,K=null,z=!1;while(W<J.length&&q>0){let j=J[W];if(z){z=!1,W++;continue}if(j==="\\"&&K){z=!0,W++;continue}if(K){if(j===K)K=null;W++;continue}if(j==='"'||j==="'"||j==="`"){K=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let U=J.substring(w+1,W),B=Z(U);J=J.substring(0,Q)+B+J.substring(W+1)}return J}function e_($,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);v8(G);let W=K0(G,Q)(...w),K=JSON.stringify(W),z=Buffer.from(K,"utf8").toString("base64");return`__stx_${Y}="${z}"`}catch(Q){return J}}),Z}function $H($,X){let Z=$;return Z=j9(Z,"@break",(J)=>{try{let G=`!!(${J.trim()})`,Q;if(W0(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(W0(G)){let w=K0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(w0(G,X));return Q?_9:""}catch{return""}}),Z}function XH($){let X=$;return X=X.replace(/@break(?!\()/g,B9),X=X.replace(/@continue(?!\()/g,_9),X}function BQ($){let X=$.includes(B9),Z=X?$.substring(0,$.indexOf(B9)):$;return{hasBreak:X,content:Z}}function _Q($){let X=$.includes(_9),Z=X?$.substring(0,$.indexOf(_9)):$;return{hasContinue:X,content:Z}}function OQ($){let X=$;return X=j9(X,"@break",(Z)=>{let J=Z.trim();if(!x8(J))return"";return`\`; if (${J}) { break; } result += \``}),X=j9(X,"@continue",(Z)=>{let J=Z.trim();if(!x8(J))return"";return`\`; if (${J}) { continue; } result += \``}),X=X.replace(/@break(?!\()/g,"`; break; result += `"),X=X.replace(/@continue(?!\()/g,"`; continue; result += `"),X}function ZH($){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=[],q=0;for(let K of J)q+=K.delta,w.push({pos:K.pos,depth:q});function W(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(W(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 _=$.substring(z+1,j),H=d3(_);if(!H)continue;let{arrayExpr:L,itemVar:O}=H,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 k=$.substring(F,T),M=T+11,E=-1,I=0,S=0;while(S<k.length){let b=k.indexOf("@",S);if(b===-1)break;let y=k.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(k.length<=b+6||!/[a-z]/i.test(k[b+6])){E=b;break}S=b+1}else S=b+1}if(E===-1)continue;return{start:K,end:M,arrayExpr:L,itemVar:O,foreachContent:k.substring(0,E),emptyContent:k.substring(E+6)}}return null}function HQ($,X){let Z=$;while(!0){let J=ZH(Z);if(!J)break;let{start:Y,end:G,arrayExpr:Q,itemVar:w,foreachContent:q,emptyContent:W}=J;try{let K;if(W0(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=W;else z=`@foreach (${Q} as ${w})${q}@endforeach`;Z=Z.substring(0,Y)+z+Z.substring(G)}catch(K){let z=K instanceof Error?K.message:String(K),U=J0("Forelse",`Error in @forelse(${Q} as ${w}): ${z}`,o.EVALUATION_ERROR);Z=Z.substring(0,Y)+U+Z.substring(G)}}return Z}function d3($){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 m3($,X,Z,J){let Y=$;Y=HQ(Y,X);function G(q){let W=/@foreach\s*\(/g,K;while((K=W.exec(q))!==null){let z=K.index,U=K.index+K[0].length-1,B=1,j=U+1,_=-1;while(j<q.length&&B>0){if(q[j]==="(")B++;else if(q[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let H=q.substring(U+1,_),L=d3(H);if(!L)continue;let O=z,{arrayExpr:F,itemVar:V}=L,A=_+1,R=1,N=A,T=/@foreach\s*\(/g,k=/@endforeach/g;while(R>0&&N<q.length){T.lastIndex=N,k.lastIndex=N;let M=T.exec(q),E=k.exec(q);if(!E)break;if(M&&M.index<E.index)R++,N=M.index+M[0].length;else{if(R--,R===0){let I=q.substring(A,E.index),S=E.index+11;return{start:O,end:S,arrayExpr:F,itemVar:V,content:I}}N=E.index+11}}}return null}function Q(q,W){let K=q;while(!0){let z=G(K);if(!z)break;let{start:U,end:B,arrayExpr:j,itemVar:_,content:H}=z;try{let L=j.trim(),O;if(W0(L))O=K0(L,Object.keys(W))(...Object.values(W));else O=w0(L,W);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),F=!0;else{console.warn(`[stx] @foreach(${L}) in ${Z}: ${L} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let E=J0("Foreach",`Error in @foreach: ${L} is not iterable`,o.TYPE_ERROR);K=K.substring(0,U)+E+K.substring(B);continue}let V=J?.loops?.useAltLoopVariable??s_,A=_.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 k="",M=O;for(let E=0;E<M.length;E++){let I=M[E],S={index:E,iteration:E+1,first:E===0,last:E===M.length-1,count:M.length},b={...W,loop:S,$loop:S};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((u)=>u.trim());if(Array.isArray(I))f.forEach((u,l)=>{if(u)b[u]=I[l]});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=$H(H,b),P=_Q(y);if(P.hasContinue){k+=P.content;continue}let x=BQ(y);if(x.hasBreak){k+=x.content;break}if(y=HQ(y,b),y=Q(y,b),y=I1(y,b,Z),y=XH(y),x=BQ(y),x.hasBreak){k+=x.content;break}if(P=_Q(y),P.hasContinue){k+=P.content;continue}y=x1(y,b,Z),y=e_(y,b),y=t_(y,b),y=a_(y,b),k+=y}K=K.substring(0,U)+k+K.substring(B)}catch(L){let O=J0("Foreach",`Error in @foreach(${j.trim()} as ${_.trim()}): ${L instanceof Error?L.message:String(L)}`,o.EVALUATION_ERROR);K=K.substring(0,U)+O+K.substring(B)}}return K}Y=Q(Y,X),Y=FQ(Y,X,Z,J);let w=J?.loops?.maxWhileIterations??o_;return Y=GH(Y,X,w),Y}function LQ($){return x8($)}function FQ($,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,q=w+Q[0].length-1,W=P0(Y,"(",")",q);if(W===-1)break;let K=Y.slice(q+1,W),z=W+1,U=p8(Y.slice(w),"for","endfor");if(U.length===0)break;let B=U[0].content,j=w+U[0].end;if(!LQ(K)){let _=J0("For",`Unsafe expression in @for: ${K}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,w)+_+Y.substring(j),G=!0;continue}try{let _=JH(K),H=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&H){let R=YH({forExpr:K,content:B,iterVarNames:_,context:X,filePath:Z,options:J});Y=Y.substring(0,w)+R+Y.substring(j),G=!0;continue}let L=Object.keys(X),O=Object.values(X),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=OQ(F);let A=Function(...L,`
12559
12561
  let result = '';
12560
12562
  for (${K}) {
12561
12563
  result += \`${F}\`;
12562
12564
  }
12563
12565
  return result;
12564
- `)(...O);Y=Y.substring(0,w)+A+Y.substring(j),G=!0}catch(_){let H=X0("For",`Error in @for(${K}): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR);Y=Y.substring(0,w)+H+Y.substring(j),G=!0}}return Y}function $H($){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 q=w.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&G.startsWith("{")){let U=q.slice(W+1).trim(),B=U.indexOf("=");return(B>=0?U.slice(0,B):U).trim()}let K=q.indexOf("="),z=(K>=0?q.slice(0,K):q).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 XH($){let{forExpr:X,content:Z,iterVarNames:J,context:Y,filePath:G,options:Q}=$,w=Object.keys(Y),q=Object.values(Y),W=Function(...w,"__pushIter",`
12566
+ `)(...O);Y=Y.substring(0,w)+A+Y.substring(j),G=!0}catch(_){let H=J0("For",`Error in @for(${K}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);Y=Y.substring(0,w)+H+Y.substring(j),G=!0}}return Y}function JH($){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 q=w.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&G.startsWith("{")){let U=q.slice(W+1).trim(),B=U.indexOf("=");return(B>=0?U.slice(0,B):U).trim()}let K=q.indexOf("="),z=(K>=0?q.slice(0,K):q).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 YH($){let{forExpr:X,content:Z,iterVarNames:J,context:Y,filePath:G,options:Q}=$,w=Object.keys(Y),q=Object.values(Y),W=Function(...w,"__pushIter",`
12565
12567
  for (${X}) {
12566
12568
  __pushIter([${J.join(", ")}])
12567
12569
  }
12568
- `),K=[];W(...q,(B)=>{K.push(B)});let z=G??"inline.stx",U="";for(let B of K){let j={...Y};J.forEach((H,L)=>{j[H]=B[L]});let _=_Q(Z,j,G,Q);_=N1(_,j,z),_=S1(_,j,z),U+=_}return U}function ZH($,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,q=b0(J,"(",")",w);if(q===-1)break;let W=J.slice(w+1,q),K=d8(J.slice(Q),"while","endwhile");if(K.length===0)break;let z=K[0].content,U=Q+K[0].end;if(!BQ(W)){let B=X0("While",`Unsafe expression in @while: ${W}`,s.UNSAFE_EXPRESSION);J=J.substring(0,Q)+B+J.substring(U),Y=!0;continue}try{let B=Object.keys(X),j=Object.values(X),_=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});_=jQ(_);let L=Function(...B,`
12570
+ `),K=[];W(...q,(B)=>{K.push(B)});let z=G??"inline.stx",U="";for(let B of K){let j={...Y};J.forEach((H,L)=>{j[H]=B[L]});let _=FQ(Z,j,G,Q);_=I1(_,j,z),_=x1(_,j,z),U+=_}return U}function GH($,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,q=P0(J,"(",")",w);if(q===-1)break;let W=J.slice(w+1,q),K=p8(J.slice(Q),"while","endwhile");if(K.length===0)break;let z=K[0].content,U=Q+K[0].end;if(!LQ(W)){let B=J0("While",`Unsafe expression in @while: ${W}`,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),_=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});_=OQ(_);let L=Function(...B,`
12569
12571
  let result = '';
12570
12572
  let maxIterations = ${Z}; // Configurable safety limit
12571
12573
  let counter = 0;
@@ -12577,21 +12579,21 @@ ${I}
12577
12579
  result += '<!-- [While Error [1104]]: Maximum iterations (${Z}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
12578
12580
  }
12579
12581
  return result;
12580
- `)(...j);J=J.substring(0,Q)+L+J.substring(U),Y=!0}catch(B){let j=X0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR);J=J.substring(0,Q)+j+J.substring(U),Y=!0}}return J}var i_=1000,n_=!1,K9="<!--__STX_BREAK__-->",z9="<!--__STX_CONTINUE__-->";var h3=y(()=>{o7();A1();W1();m8();I0()});import _0 from"path";function u3($,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 JH($,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,q=1,W=w+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")")q--;W++}if(q!==0)break;let K=J.substring(w+1,W-1),z=`${Z}(${K})`;J=J.substring(0,Q)+z+J.substring(W),Y.lastIndex=Q+z.length,G=Y.exec(J)}return J}function YH($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function LQ($){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++}},q=()=>{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]==="`")q();else G++;continue}G++}},W=()=>{if(X[G]==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
12581
- `)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(W())continue;if(X[G]==="'"||X[G]==='"'){w(X[G]);continue}if(X[G]==="`"){q();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 FQ($,X=""){let Z=LQ($).split(",").map((J)=>J.trim()).filter(Boolean);return`
12582
+ `)(...j);J=J.substring(0,Q)+L+J.substring(U),Y=!0}catch(B){let j=J0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR);J=J.substring(0,Q)+j+J.substring(U),Y=!0}}return J}var o_=1000,s_=!1,B9="<!--__STX_BREAK__-->",_9="<!--__STX_CONTINUE__-->";var c3=D(()=>{t7();M1();j1();i8();y0()});import L0 from"path";function l3($,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 QH($,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,q=1,W=w+1;while(W<J.length&&q>0){if(J[W]==="(")q++;else if(J[W]===")")q--;W++}if(q!==0)break;let K=J.substring(w+1,W-1),z=`${Z}(${K})`;J=J.substring(0,Q)+z+J.substring(W),Y.lastIndex=Q+z.length,G=Y.exec(J)}return J}function wH($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function RQ($){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++}},q=()=>{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]==="`")q();else G++;continue}G++}},W=()=>{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(W())continue;if(X[G]==="'"||X[G]==='"'){w(X[G]);continue}if(X[G]==="`"){q();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 NQ($,X=""){let Z=RQ($).split(",").map((J)=>J.trim()).filter(Boolean);return`
12582
12584
  (function() {
12583
- ${R5("var",Z)}
12585
+ ${M5("var",Z)}
12584
12586
  var __destroyHooks = [];
12585
12587
  var __origOnDestroy = onDestroy;
12586
12588
  onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
12587
12589
 
12588
12590
  ${$}
12589
12591
  ${X}})();
12590
- `}function VQ($,X){return`
12592
+ `}function TQ($,X){return`
12591
12593
  // Register scope variables for STX runtime
12592
12594
  if (!window.stx._scopes) window.stx._scopes = {};
12593
12595
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
12594
- ${LQ($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeRegistration[${JSON.stringify(G)}] = ${G}; } catch (e) { /* not actually top-level */ }`).join(`
12596
+ ${RQ($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeRegistration[${JSON.stringify(G)}] = ${G}; } catch (e) { /* not actually top-level */ }`).join(`
12595
12597
  `)}
12596
12598
  // #1767: when the bundler renamed a component const that collided with an
12597
12599
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -12599,7 +12601,7 @@ ${LQ($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
12599
12601
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
12600
12602
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
12601
12603
  window.stx._scopes['${X}'] = __scopeRegistration;
12602
- `}function GH($,X){let Z=VQ($,X),J=`
12604
+ `}function qH($,X){let Z=TQ($,X),J=`
12603
12605
  (function() {
12604
12606
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${X}"]') : null;
12605
12607
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -12608,55 +12610,55 @@ ${LQ($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
12608
12610
  } finally {
12609
12611
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
12610
12612
  }
12611
- })();`;return J+FQ($,Z)+`
12613
+ })();`;return J+NQ($,Z)+`
12612
12614
  } finally {
12613
12615
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
12614
12616
  }
12615
- })();`}function QH($,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 qH($){if($.__onceStore instanceof Set)return $.__onceStore;return wH}async function d3($,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=JH($,"@partial","@include"),q=qH(X);w=w.replace(/@once([\s\S]*?)@endonce/g,(_,H,L)=>{let O=H.trim(),F=`${Z}:${O}`;if(q.has(F))return"";return q.add(F),H});{let _=/@includeIf\s*\(/g,H;while((H=_.exec(w))!==null){let L=H.index,O=L+H[0].length-1,F=1,V=O+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")")F--;V++}if(F!==0)break;let A=w.substring(O+1,V-1),R=A.match(/^\s*['"]([^'"]+)['"]/);if(!R){_.lastIndex=V;continue}let N=R[1],M=W(N,Q,Z),k="";if(M&&await Bun.file(M).exists())Y.add(M),k=`@include(${A})`;w=w.substring(0,L)+k+w.substring(V),_.lastIndex=0}}for(let[_,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=L.exec(w))!==null){let F=O.index,V=F+O[0].length-1,A=1,R=V+1;while(R<w.length&&A>0){if(w[R]==="(")A++;else if(w[R]===")")A--;R++}if(A!==0)break;let N=w.substring(V+1,R-1),M=u3(N,0);if(M===-1){L.lastIndex=R;continue}let k=N.substring(0,M).trim(),T=N.substring(M+1).trim(),D=T.match(/^\s*['"]([^'"]+)['"]/);if(!D){L.lastIndex=R;continue}let I=D[1],S=T.substring(D[0].length),b,E=u3(S,0);if(E!==-1)b=S.substring(E+1).trim();try{let v=`Boolean(${k})`,x;if(q0(v)){let p=W0(v,Object.keys(X));x=Boolean(p(...Object.values(X)))}else x=Boolean(G0(v,X));let f=H?!x:x,h="";if(f){let p=W(I,Q,Z);if(p&&await Bun.file(p).exists())Y.add(p);h=`@include('${I}'${b?`, ${b}`:""})`}w=w.substring(0,F)+h+w.substring(R),L.lastIndex=0}catch(v){let x=v instanceof Error?v.message:String(v),f=B0("Include",`Error evaluating ${_} condition: ${x}`,Z,$,F);w=w.substring(0,F)+f+w.substring(R),L.lastIndex=0}}}{let _=/@each\s*\(/g,H;while((H=_.exec(w))!==null){let L=H.index,O=L+H[0].length-1,F=1,V=O+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=w.substring(O+1,V),R=w.substring(L,V+1),N=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,w=w.replace(R,"");continue}let[,M,k,T,D]=N;try{let I,S=k.trim();if(q0(S))I=W0(S,Object.keys(X))(...Object.values(X));else I=G0(S,X);let b="";if(Array.isArray(I)&&I.length>0)for(let E of I){let v={...X,[T]:E},x=await U(M,v,$,L);b+=x}else if(D)b=await U(D,{},$,L);w=w.substring(0,L)+b+w.substring(V+1),_.lastIndex=0}catch(I){let S=I instanceof Error?I.message:String(I);w=w.substring(0,L)+B0("Each",`Error in @each: ${S}`,Z,$,L)+w.substring(V+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,H;while((H=_.exec(w))!==null){let L=H.index,O=L+H[0].length-1,F=1,V=O+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=w.substring(O+1,V),R=w.substring(L,V+1),N=A.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,w=w.replace(R,"");continue}let M=N[1],k=A.slice(N[0].length),T,D=k.match(/^\s*,\s*\{/);if(D){k=k.slice(D[0].length-1);let b=1,E=1;while(E<k.length&&b>0){if(k[E]==="{")b++;else if(k[E]==="}"){if(b--,b===0)break}E++}T=k.substring(0,E+1),k=k.slice(E+1)}let I,S=k.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(S)I=S[1];try{let b=JSON.parse(M.replace(/'/g,'"')),E={};if(T)try{E=k0(T,X)}catch(x){let f=x instanceof Error?x.message:String(x);if(J.debug){let h=B0("Include",`Error parsing includeFirst variables: ${f}`,Z,$,L,R);w=w.replace(R,()=>h)}else w=w.replace(R,()=>I||"");continue}let v=!1;for(let x of b){let f=W(x,Q,Z);if(!f)continue;if(await n(f)){let h=await U(x,E,$,L);w=w.replace(R,()=>h),v=!0;break}}if(!v)if(I!==void 0)w=w.replace(R,()=>I);else if(J.debug){let x=B0("Include",`None of the includeFirst paths exist: ${M}`,Z,$,L,R);w=w.replace(R,()=>x)}else w=w.replace(R,"")}catch(b){let E=b instanceof Error?b.message:String(b),v=B0("Include",`Error processing @includeFirst: ${E}`,Z,$,L,R);w=w.replace(R,()=>v)}_.lastIndex=0}}function W(_,H,L){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let F=_0.resolve(H),V=_0.resolve(_0.dirname(L)),A;if(!O.startsWith("./")&&!O.startsWith("../"))A=_0.resolve(H,O);else A=_0.resolve(V,O);let R=_0.normalize(A),N=R.startsWith(F+_0.sep)||R===F,M=R.startsWith(V+_0.sep)||R===V,k=!1,T=_0.dirname(V);if(R.startsWith(T+_0.sep)){if(!_0.relative(T,R).split(_0.sep).some((b)=>b.startsWith(".")&&b!=="."&&b!==".."))k=!0}if(!N&&!M&&!k)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${F}, ${V}`),null;return R}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let K=_0.resolve(Z);G.add(K);function z(_,H,L,O){return J.onIncludeError?.({includePath:_,templatePath:Z,message:H,partialsDir:Q}),B0("Include",H,Z,L,O)}async function U(_,H={},L,O){let F=W(_,Q,Z);if(!F)return z(_,`Could not resolve path for include: ${_}`,L,O);let V=_0.resolve(F);if(G.has(V)){let A=[...G,V].map((R)=>_0.basename(R)).join(" -> ");return z(_,`Circular include detected: ${A}`,L,O)}try{Y.add(F);let A;if(!A)try{A=await Bun.file(F).text()}catch(f){let h=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${h}`,L,O)}if(A)A=A.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(A&&A.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (Q3(),G3));A=f(A,X)}if(A&&(J.debug||!l7()&&!x$()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (q3(),gG));f(A,F)}catch{}let R=A;try{let{processESImports:f}=await Promise.resolve().then(() => (x3(),WQ));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=f8(R);if(N)R=N.content.trim();let k=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),T="";if(k)T=`<style${k[1]}>${k[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let D={...X};D.__stx_signals_gate=V1(A);for(let[f,h]of Object.entries(H))D[f]=h;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...A.matchAll(I)],b="",E=null;for(let f of S){let h=f[1]||"",p=f[2]||"",H0=h.includes("server"),M0=n1(h),j0="";try{let{extractAndStripCssImports:l,renderVendorStyleTags:J0}=await Promise.resolve().then(() => (y7(),S2)),D0=l(p,{filePath:F,projectRoot:process.cwd()});p=D0.code,j0=J0(D0.styles)}catch(l){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,l instanceof Error?l.message:l)}if(M0&&p.trim())p=r1(p);if(!H0)try{let{hasUserImports:l,bundleClientScript:J0}=await Promise.resolve().then(() => (T5(),M7));if(l(p))p=await J0(p,F,{projectRoot:process.cwd()})}catch(l){if(J.debug)console.warn(`[stx] bundler skipped for ${F}:`,l instanceof Error?l.message:l)}let Z0=YH(p);if(Z0&&!H0){E=`stx_scope_${_0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++OQ}`;let l=p0(p),J0=GH(l,E);b+=`${j0}<script data-stx-scoped data-stx-run="always">${J0}</script>
12616
- `;continue}if(H0)try{let{extractVariables:l}=await Promise.resolve().then(() => (f7(),u8));await l(p,D,F)}catch(l){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,l)}if(!H0&&!Z0){let l=h.replace(/\bclient\b/i,"").trim();E=`stx_scope_${_0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++OQ}`;let J0=p0(p),D0=VQ(J0,E),v0=FQ(J0,D0);b+=`${j0}<script data-stx-scoped data-stx-run="always"${l?` ${l}`:""}>${v0}</script>
12617
- `}}if(E){let f=QH(R,E);if(R=f.html,f.mergedIntoExisting)b=b.replace(`window.stx._scopes['${E}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),E=f.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await d3(R,D,F,J,Y,G);let{processLoops:v}=await Promise.resolve().then(() => (h3(),HQ)),x=v(R,D,F);if(x=N1(x,D,F),x=S1(x,D,F),T)x+=`
12618
- `+T;if(b)x+=`
12619
- `+b;return x}catch(A){let R=A instanceof Error?A.message:String(A);return z(_,`Error processing include ${_}: ${R}`,L,O)}}let B=/@include\s*\(/g,j;while((j=B.exec(w))!==null){let _=j.index,H=_+j[0].length-1,L=1,O=H+1;while(O<w.length&&L>0){if(w[O]==="(")L++;else if(w[O]===")")L--;O++}if(L!==0)break;let F=w.substring(_,O),V=w.substring(H+1,O-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){B.lastIndex=O;continue}let R=A[1],N,M=V.substring(A[0].length),k=u3(M,0);if(k!==-1)N=M.substring(k+1).trim();let T={};if(N)try{T=k0(N,X)}catch(I){let S=I instanceof Error?I.message:String(I);w=w.replace(F,B0("Include",`Error parsing include variables for ${R}: ${S}`,Z,$,_)),B.lastIndex=0;continue}let D=await U(R,T,$,_);w=w.substring(0,_)+D+w.substring(O),B.lastIndex=0}return w}function m3($,X){let Z=$;function J(Y,G,Q,w){let q=Y,W=!0;while(W){W=!1;let K=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),z=q.match(K);if(!z||z.index===void 0)break;let U=z.index,B=z[1],j=U+z[0].length,_=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),L=1,O=j,F=-1;while(L>0&&O<q.length){let A=q.slice(O),R=A.match(_),N=A.match(H),M=R?O+R.index:1/0,k=N?O+N.index:1/0;if(M<k)L++,O=M+(R[0].length||1);else if(k<1/0){if(L--,L===0){F=k;break}O=k+Q.length+1}else break}if(F===-1)break;let V=q.slice(j,F);if(!X[B])X[B]=[];if(w)X[B].unshift(V);else X[B].push(V);q=q.substring(0,U)+q.substring(F+`@${Q}`.length),W=!0}return q}return Z=J(Z,"push","endpush",!1),Z=J(Z,"prepend","endprepend",!0),Z}function c3($,X){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,J)=>{if(!X[J]||X[J].length===0)return"";return X[J].join(`
12620
- `)})}var OQ=0,NI,wH;var AQ=y(()=>{HX();o7();W1();$1();D5();I0();y0();NI=new s1(500),wH=new Set});import*as l3 from"path";async function RQ($,X,Z=""){if(l3.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 TQ($,X,Z,"@js","@endjs")}async function NQ($,X,Z=""){if(l3.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 TQ($,X,Z,"@ts","@endts")}async function TQ($,X,Z,J,Y){let G=$,Q=E5(`${J}([\\s\\S]*?)${Y}`,"g"),w=[],q;while((q=Q.exec($))!==null)w.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:K,index:z}of w)try{let U={...X,global:X},B=Object.keys(U),j=Object.values(U),_=K.trim();if(J==="@ts")_=_.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=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=L.length>0?`return { ${L.join(", ")} };`:"return {};",F=`
12617
+ })();`}function WH($,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 zH($){if($.__onceStore instanceof Set)return $.__onceStore;return KH}async function p3($,X,Z,J,Y,G=new Set){let Q=J.partialsDir||L0.join(L0.dirname(Z),"partials");if(Q&&!L0.isAbsolute(Q))Q=L0.resolve(process.cwd(),Q);let w=QH($,"@partial","@include"),q=zH(X);w=w.replace(/@once([\s\S]*?)@endonce/g,(_,H,L)=>{let O=H.trim(),F=`${Z}:${O}`;if(q.has(F))return"";return q.add(F),H});{let _=/@includeIf\s*\(/g,H;while((H=_.exec(w))!==null){let L=H.index,O=L+H[0].length-1,F=1,V=O+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")")F--;V++}if(F!==0)break;let A=w.substring(O+1,V-1),R=A.match(/^\s*['"]([^'"]+)['"]/);if(!R){_.lastIndex=V;continue}let N=R[1],T=W(N,Q,Z),k="";if(T&&await Bun.file(T).exists())Y.add(T),k=`@include(${A})`;w=w.substring(0,L)+k+w.substring(V),_.lastIndex=0}}for(let[_,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=L.exec(w))!==null){let F=O.index,V=F+O[0].length-1,A=1,R=V+1;while(R<w.length&&A>0){if(w[R]==="(")A++;else if(w[R]===")")A--;R++}if(A!==0)break;let N=w.substring(V+1,R-1),T=l3(N,0);if(T===-1){L.lastIndex=R;continue}let k=N.substring(0,T).trim(),M=N.substring(T+1).trim(),E=M.match(/^\s*['"]([^'"]+)['"]/);if(!E){L.lastIndex=R;continue}let I=E[1],S=M.substring(E[0].length),b,y=l3(S,0);if(y!==-1)b=S.substring(y+1).trim();try{let P=`Boolean(${k})`,x;if(W0(P)){let l=K0(P,Object.keys(X));x=Boolean(l(...Object.values(X)))}else x=Boolean(w0(P,X));let f=H?!x:x,u="";if(f){let l=W(I,Q,Z);if(l&&await Bun.file(l).exists())Y.add(l);u=`@include('${I}'${b?`, ${b}`:""})`}w=w.substring(0,F)+u+w.substring(R),L.lastIndex=0}catch(P){let x=P instanceof Error?P.message:String(P),f=O0("Include",`Error evaluating ${_} condition: ${x}`,Z,$,F);w=w.substring(0,F)+f+w.substring(R),L.lastIndex=0}}}{let _=/@each\s*\(/g,H;while((H=_.exec(w))!==null){let L=H.index,O=L+H[0].length-1,F=1,V=O+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=w.substring(O+1,V),R=w.substring(L,V+1),N=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,w=w.replace(R,"");continue}let[,T,k,M,E]=N;try{let I,S=k.trim();if(W0(S))I=K0(S,Object.keys(X))(...Object.values(X));else I=w0(S,X);let b="";if(Array.isArray(I)&&I.length>0)for(let y of I){let P={...X,[M]:y},x=await U(T,P,$,L);b+=x}else if(E)b=await U(E,{},$,L);w=w.substring(0,L)+b+w.substring(V+1),_.lastIndex=0}catch(I){let S=I instanceof Error?I.message:String(I);w=w.substring(0,L)+O0("Each",`Error in @each: ${S}`,Z,$,L)+w.substring(V+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,H;while((H=_.exec(w))!==null){let L=H.index,O=L+H[0].length-1,F=1,V=O+1;while(V<w.length&&F>0){if(w[V]==="(")F++;else if(w[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=w.substring(O+1,V),R=w.substring(L,V+1),N=A.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,w=w.replace(R,"");continue}let T=N[1],k=A.slice(N[0].length),M,E=k.match(/^\s*,\s*\{/);if(E){k=k.slice(E[0].length-1);let b=1,y=1;while(y<k.length&&b>0){if(k[y]==="{")b++;else if(k[y]==="}"){if(b--,b===0)break}y++}M=k.substring(0,y+1),k=k.slice(y+1)}let I,S=k.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(S)I=S[1];try{let b=JSON.parse(T.replace(/'/g,'"')),y={};if(M)try{y=D0(M,X)}catch(x){let f=x instanceof Error?x.message:String(x);if(J.debug){let u=O0("Include",`Error parsing includeFirst variables: ${f}`,Z,$,L,R);w=w.replace(R,()=>u)}else w=w.replace(R,()=>I||"");continue}let P=!1;for(let x of b){let f=W(x,Q,Z);if(!f)continue;if(await n(f)){let u=await U(x,y,$,L);w=w.replace(R,()=>u),P=!0;break}}if(!P)if(I!==void 0)w=w.replace(R,()=>I);else if(J.debug){let x=O0("Include",`None of the includeFirst paths exist: ${T}`,Z,$,L,R);w=w.replace(R,()=>x)}else w=w.replace(R,"")}catch(b){let y=b instanceof Error?b.message:String(b),P=O0("Include",`Error processing @includeFirst: ${y}`,Z,$,L,R);w=w.replace(R,()=>P)}_.lastIndex=0}}function W(_,H,L){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let F=L0.resolve(H),V=L0.resolve(L0.dirname(L)),A;if(!O.startsWith("./")&&!O.startsWith("../"))A=L0.resolve(H,O);else A=L0.resolve(V,O);let R=L0.normalize(A),N=R.startsWith(F+L0.sep)||R===F,T=R.startsWith(V+L0.sep)||R===V,k=!1,M=L0.dirname(V);if(R.startsWith(M+L0.sep)){if(!L0.relative(M,R).split(L0.sep).some((b)=>b.startsWith(".")&&b!=="."&&b!==".."))k=!0}if(!N&&!T&&!k)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${F}, ${V}`),null;return R}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let K=L0.resolve(Z);G.add(K);function z(_,H,L,O){return J.onIncludeError?.({includePath:_,templatePath:Z,message:H,partialsDir:Q}),O0("Include",H,Z,L,O)}async function U(_,H={},L,O){let F=W(_,Q,Z);if(!F)return z(_,`Could not resolve path for include: ${_}`,L,O);let V=L0.resolve(F);if(G.has(V)){let A=[...G,V].map((R)=>L0.basename(R)).join(" -> ");return z(_,`Circular include detected: ${A}`,L,O)}try{Y.add(F);let A;if(!A)try{A=await Bun.file(F).text()}catch(f){let u=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${u}`,L,O)}if(A)A=A.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(A&&A.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (K3(),W3));A=f(A,X)}if(A&&(J.debug||!n7()&&!u$()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (U3(),mG));f(A,F)}catch{}let R=A;try{let{processESImports:f}=await Promise.resolve().then(() => (u3(),jQ));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=d8(R);if(N)R=N.content.trim();let k=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(k)M=`<style${k[1]}>${k[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=N1(A);for(let[f,u]of Object.entries(H))E[f]=u;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...A.matchAll(I)],b="",y=null;for(let f of S){let u=f[1]||"",l=f[2]||"",H0=u.includes("server"),S0=e1(u),z0="";try{let{extractAndStripCssImports:d,renderVendorStyleTags:Y0}=await Promise.resolve().then(() => (P7(),x2)),Q0=d(l,{filePath:F,projectRoot:process.cwd()});l=Q0.code,z0=Y0(Q0.styles)}catch(d){if(J.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,d instanceof Error?d.message:d)}if(S0&&l.trim())l=$5(l);if(!H0)try{let{hasUserImports:d,bundleClientScript:Y0}=await Promise.resolve().then(() => (I5(),D7));if(d(l))l=await Y0(l,F,{projectRoot:process.cwd()})}catch(d){if(J.debug)console.warn(`[stx] bundler skipped for ${F}:`,d instanceof Error?d.message:d)}let k0=wH(l);if(k0&&!H0){y=`stx_scope_${L0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++AQ}`;let d=r0(l),Y0=qH(d,y);b+=`${z0}<script data-stx-scoped data-stx-run="always">${Y0}</script>
12618
+ `;continue}if(H0)try{let{extractVariables:d}=await Promise.resolve().then(() => (u7(),l8));await d(l,E,F)}catch(d){if(J.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,d)}if(!H0&&!k0){let d=u.replace(/\bclient\b/i,"").trim();y=`stx_scope_${L0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++AQ}`;let Y0=r0(l),Q0=TQ(Y0,y),d0=NQ(Y0,Q0);b+=`${z0}<script data-stx-scoped data-stx-run="always"${d?` ${d}`:""}>${d0}</script>
12619
+ `}}if(y){let f=WH(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 p3(R,E,F,J,Y,G);let{processLoops:P}=await Promise.resolve().then(() => (c3(),VQ)),x=P(R,E,F);if(x=I1(x,E,F),x=x1(x,E,F),M)x+=`
12620
+ `+M;if(b)x+=`
12621
+ `+b;return x}catch(A){let R=A instanceof Error?A.message:String(A);return z(_,`Error processing include ${_}: ${R}`,L,O)}}let B=/@include\s*\(/g,j;while((j=B.exec(w))!==null){let _=j.index,H=_+j[0].length-1,L=1,O=H+1;while(O<w.length&&L>0){if(w[O]==="(")L++;else if(w[O]===")")L--;O++}if(L!==0)break;let F=w.substring(_,O),V=w.substring(H+1,O-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){B.lastIndex=O;continue}let R=A[1],N,T=V.substring(A[0].length),k=l3(T,0);if(k!==-1)N=T.substring(k+1).trim();let M={};if(N)try{M=D0(N,X)}catch(I){let S=I instanceof Error?I.message:String(I);w=w.replace(F,O0("Include",`Error parsing include variables for ${R}: ${S}`,Z,$,_)),B.lastIndex=0;continue}let E=await U(R,M,$,_);w=w.substring(0,_)+E+w.substring(O),B.lastIndex=0}return w}function i3($,X){let Z=$;function J(Y,G,Q,w){let q=Y,W=!0;while(W){W=!1;let K=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),z=q.match(K);if(!z||z.index===void 0)break;let U=z.index,B=z[1],j=U+z[0].length,_=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),L=1,O=j,F=-1;while(L>0&&O<q.length){let A=q.slice(O),R=A.match(_),N=A.match(H),T=R?O+R.index:1/0,k=N?O+N.index:1/0;if(T<k)L++,O=T+(R[0].length||1);else if(k<1/0){if(L--,L===0){F=k;break}O=k+Q.length+1}else break}if(F===-1)break;let V=q.slice(j,F);if(!X[B])X[B]=[];if(w)X[B].unshift(V);else X[B].push(V);q=q.substring(0,U)+q.substring(F+`@${Q}`.length),W=!0}return q}return Z=J(Z,"push","endpush",!1),Z=J(Z,"prepend","endprepend",!0),Z}function n3($,X){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,J)=>{if(!X[J]||X[J].length===0)return"";return X[J].join(`
12622
+ `)})}var AQ=0,EI,KH;var MQ=D(()=>{VX();t7();j1();Z1();C5();y0();A0();EI=new X5(500),KH=new Set});import*as r3 from"path";async function kQ($,X,Z=""){if(r3.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 EQ($,X,Z,"@js","@endjs")}async function IQ($,X,Z=""){if(r3.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 EQ($,X,Z,"@ts","@endts")}async function EQ($,X,Z,J,Y){let G=$,Q=S5(`${J}([\\s\\S]*?)${Y}`,"g"),w=[],q;while((q=Q.exec($))!==null)w.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:K,index:z}of w)try{let U={...X,global:X},B=Object.keys(U),j=Object.values(U),_=K.trim();if(J==="@ts")_=_.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=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=L.length>0?`return { ${L.join(", ")} };`:"return {};",F=`
12621
12623
  ${_}
12622
12624
  ${O}
12623
- `,A=Function(...B,F)(...j);if(A&&typeof A==="object")Object.assign(X,A);G=G.replace(W,"")}catch(U){console.error(`Error executing ${J} code block in ${Z}:`,U);let B=U instanceof Error?U.message:String(U),j=B0(`${J} Directive`,`Error executing code: ${B}`,Z,$,z,W);console.error(j),G=G.replace(W,"")}return G}var MQ=y(()=>{D5();y0()});function WH($,X="_method"){let Z=$.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${X}" value="${Z}">`}function kQ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(X,Z,J,Y,G)=>{return WH(J,G||"_method")})}async function IQ($,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 q=await w.handler(G,X,Z,J);if(typeof q==="string")G=q;else if(J.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(q){if(J.debug)console.error(`Error in middleware ${w.name}:`,q);if(J.debug){let W=B0("Middleware",`Error in middleware '${w.name}': ${q instanceof Error?q.message:String(q)}`,Z,$);G=G.replace(/<body[^>]*>/,`$&
12624
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${X1(W)}</div>
12625
- `)}}}return G}async function EQ($,X,Z,J){return IQ($,X,Z,J,"before")}async function DQ($,X,Z,J){return IQ($,X,Z,J,"after")}var yQ=y(()=>{W1();y0()});function bQ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(X,Z,J,Y,G)=>{try{let Q=Y?k0(Y,{}):{};return w7(J,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var SQ=y(()=>{I1();I1();I0()});async function CQ($,X){let Z=$.split("/").pop()?.split(".")[0]||"";if(Y8.exact[$])for(let J of Y8.exact[$])await Promise.resolve(J(X,$));if(Y8.exact[Z])for(let J of Y8.exact[Z])await Promise.resolve(J(X,$));for(let{pattern:J,callback:Y}of Y8.patterns)if(J.test($)||J.test(Z))await Promise.resolve(Y(X,$))}var Y8;var PQ=y(()=>{Y8={patterns:[],exact:{}}});function UH($){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("/>")||zH.has(w)){X.push([G,Q]);continue}let q=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`<\\/?${q}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");W.lastIndex=Q;let K=1,z=Q,U;while((U=W.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 vQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((X)=>vQ(X)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,X])=>X).map(([X])=>X).join(" ");return $?String($):""}function xQ($,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(...UH($));function Q(W){return Y.some(([K,z])=>W>=K&&W<z)}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,q=[];while((G=w.exec(Z))!==null){if(Q(G.index))continue;let W=G[0],K=G[2];if(!K||!K.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,U,B=K,j=!1;while((U=z.exec(K))!==null){let _=U[1],H=U[2];if(w2(_))continue;if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let L=Object.keys(X),O=Object.values(X),F=H.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 (${H})`)(...O);if(_==="class"){let R=vQ(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(KH.has(_)){if(A)B=B.replace(U[0],` ${_}`);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],` ${_}="${R}"`)}j=!0}catch{continue}}if(j){let _=W.endsWith("/>")?" /":"",L=`<${G[1]}${B}${_}>`;q.push({start:G.index,end:G.index+W.length,replacement:L})}}for(let W=q.length-1;W>=0;W--){let{start:K,end:z,replacement:U}=q[W];Z=Z.slice(0,K)+U+Z.slice(z)}return Z}var KH,zH;var fQ=y(()=>{$1();KH=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),zH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function K5($,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()&&jH.has(J[1]),G=Y?J[2].replace(/\/\s*$/,""):J[2];return{full:J[0],tag:J[1],attrs:G,selfClosing:Y,start:J.index,end:J.index+J[0].length}}function _H($,X,Z){let J=1,Y=Z,G=new RegExp(`<${X}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${X}\\s*>`,"gi");while(J>0&&Y<$.length){G.lastIndex=Y,Q.lastIndex=Y;let w=G.exec($),q=Q.exec($);if(!q)return-1;if(w&&w.index<q.index)J++,Y=w.index+w[0].length;else{if(J--,J===0)return q.index+q[0].length;Y=q.index+q[0].length}}return-1}function z1($,X){if(X.selfClosing)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};let Z=_H($,X.tag,X.end);if(Z===-1)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};return{outerStart:X.start,outerEnd:Z,innerHTML:$.slice(X.end,Z-`</${X.tag}>`.length)}}function gQ($,X){return new RegExp(`(?:^|\\s)${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${X}=`)||$.includes(` ${X} `)||$.trimEnd().endsWith(` ${X}`)}function p5($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Z}="([^"]*)"`,"s"))||$.match(new RegExp(`${Z}='([^']*)'`,"s"));return J?J[1]:null}function d1($,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 m1($,X,Z){let J=X.selfClosing?" /":"",Y=`<${X.tag}${Z}${J}>`;return $.slice(0,X.start)+Y+$.slice(X.end)}function HH($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function OH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=p5(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(),q;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),L=H[0],O=H[1];q=`${w} as ${O} => ${L}`}else q=`${w} as ${Q}`;let W=d1(J.attrs,"v-for"),K=d1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=z1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=m1(U,{...J,start:0,end:J.end-J.start},K),j=`@foreach(${q})
12625
+ `,A=Function(...B,F)(...j);if(A&&typeof A==="object")Object.assign(X,A);G=G.replace(W,"")}catch(U){console.error(`Error executing ${J} code block in ${Z}:`,U);let B=U instanceof Error?U.message:String(U),j=O0(`${J} Directive`,`Error executing code: ${B}`,Z,$,z,W);console.error(j),G=G.replace(W,"")}return G}var DQ=D(()=>{C5();A0()});function UH($,X="_method"){let Z=$.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${X}" value="${Z}">`}function yQ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(X,Z,J,Y,G)=>{return UH(J,G||"_method")})}async function bQ($,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 q=await w.handler(G,X,Z,J);if(typeof q==="string")G=q;else if(J.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(q){if(J.debug)console.error(`Error in middleware ${w.name}:`,q);if(J.debug){let W=O0("Middleware",`Error in middleware '${w.name}': ${q instanceof Error?q.message:String(q)}`,Z,$);G=G.replace(/<body[^>]*>/,`$&
12626
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${J1(W)}</div>
12627
+ `)}}}return G}async function SQ($,X,Z,J){return bQ($,X,Z,J,"before")}async function CQ($,X,Z,J){return bQ($,X,Z,J,"after")}var PQ=D(()=>{j1();A0()});function vQ($){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 z7(J,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var xQ=D(()=>{b1();b1();y0()});async function fQ($,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 gQ=D(()=>{w8={patterns:[],exact:{}}});function _H($){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("/>")||BH.has(w)){X.push([G,Q]);continue}let q=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`<\\/?${q}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");W.lastIndex=Q;let K=1,z=Q,U;while((U=W.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 hQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((X)=>hQ(X)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,X])=>X).map(([X])=>X).join(" ");return $?String($):""}function uQ($,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(..._H($));function Q(W){return Y.some(([K,z])=>W>=K&&W<z)}let w=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,q=[];while((G=w.exec(Z))!==null){if(Q(G.index))continue;let W=G[0],K=G[2];if(!K||!K.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,U,B=K,j=!1;while((U=z.exec(K))!==null){let _=U[1],H=U[2];if(z2(_))continue;if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let L=Object.keys(X),O=Object.values(X),F=H.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 (${H})`)(...O);if(_==="class"){let R=hQ(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(jH.has(_)){if(A)B=B.replace(U[0],` ${_}`);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],` ${_}="${R}"`)}j=!0}catch{continue}}if(j){let _=W.endsWith("/>")?" /":"",L=`<${G[1]}${B}${_}>`;q.push({start:G.index,end:G.index+W.length,replacement:L})}}for(let W=q.length-1;W>=0;W--){let{start:K,end:z,replacement:U}=q[W];Z=Z.slice(0,K)+U+Z.slice(z)}return Z}var jH,BH;var dQ=D(()=>{Z1();jH=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),BH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function _5($,X){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=X;let J=Z.exec($);if(!J)return null;let Y=/\/\s*>$/.test(J[0])||J[1]===J[1].toLowerCase()&&HH.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 LH($,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($),q=Q.exec($);if(!q)return-1;if(w&&w.index<q.index)J++,Y=w.index+w[0].length;else{if(J--,J===0)return q.index+q[0].length;Y=q.index+q[0].length}}return-1}function _1($,X){if(X.selfClosing)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};let Z=LH($,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 mQ($,X){return new RegExp(`(?:^|\\s)${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${X}=`)||$.includes(` ${X} `)||$.trimEnd().endsWith(` ${X}`)}function o5($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),J=$.match(new RegExp(`${Z}="([^"]*)"`,"s"))||$.match(new RegExp(`${Z}='([^']*)'`,"s"));return J?J[1]:null}function p1($,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 i1($,X,Z){let J=X.selfClosing?" /":"",Y=`<${X.tag}${Z}${J}>`;return $.slice(0,X.start)+Y+$.slice(X.end)}function FH($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function VH($){let X=$,Z=0;while(Z<X.length){let J=_5(X,Z);if(!J)break;let Y=o5(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(),q;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),L=H[0],O=H[1];q=`${w} as ${O} => ${L}`}else q=`${w} as ${Q}`;let W=p1(J.attrs,"v-for"),K=p1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=_1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=i1(U,{...J,start:0,end:J.end-J.start},K),j=`@foreach(${q})
12626
12628
  `,_=`${j}${B}
12627
- @endforeach`;X=X.slice(0,z.outerStart)+_+X.slice(z.outerEnd),Z=z.outerStart+j.length}return X}function LH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=p5(J.attrs,"v-if");if(Y===null){Z=J.end;continue}let G=[],Q=z1(X,J),w=d1(J.attrs,"v-if"),q=m1(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:q,parsedTag:J});let W=Q.outerEnd,K=!0;while(K){let _=X.slice(W).match(/^\s*/),H=_?_[0].length:0,L=K5(X,W+H);if(!L){K=!1;break}let O=p5(L.attrs,"v-else-if"),F=gQ(L.attrs,"v-else");if(O!==null){let V=z1(X,L),A=d1(L.attrs,"v-else-if"),R=m1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else-if",expr:O,outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:L}),W=V.outerEnd}else if(F){let V=z1(X,L),A=d1(L.attrs,"v-else"),R=m1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else",outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:L}),K=!1}else K=!1}let z=[];for(let _ of G)if(_.type==="if")z.push(`@if(${_.expr})
12629
+ @endforeach`;X=X.slice(0,z.outerStart)+_+X.slice(z.outerEnd),Z=z.outerStart+j.length}return X}function AH($){let X=$,Z=0;while(Z<X.length){let J=_5(X,Z);if(!J)break;let Y=o5(J.attrs,"v-if");if(Y===null){Z=J.end;continue}let G=[],Q=_1(X,J),w=p1(J.attrs,"v-if"),q=i1(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:q,parsedTag:J});let W=Q.outerEnd,K=!0;while(K){let _=X.slice(W).match(/^\s*/),H=_?_[0].length:0,L=_5(X,W+H);if(!L){K=!1;break}let O=o5(L.attrs,"v-else-if"),F=mQ(L.attrs,"v-else");if(O!==null){let V=_1(X,L),A=p1(L.attrs,"v-else-if"),R=i1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else-if",expr:O,outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:L}),W=V.outerEnd}else if(F){let V=_1(X,L),A=p1(L.attrs,"v-else"),R=i1(X.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else",outerStart:W,outerEnd:V.outerEnd,element:R,parsedTag:L}),K=!1}else K=!1}let z=[];for(let _ of G)if(_.type==="if")z.push(`@if(${_.expr})
12628
12630
  ${_.element}`);else if(_.type==="else-if")z.push(`@elseif(${_.expr})
12629
12631
  ${_.element}`);else z.push(`@else
12630
12632
  ${_.element}`);z.push("@endif");let U=z.join(`
12631
- `),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 FH($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function VH($){let X=$,Z=0;while(Z<X.length){let J=K5(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=z1(X,J),z=X.slice(K.outerStart,K.outerEnd),U=m1(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 q=p5(J.attrs,"v-model");if(q===null){Z=J.end;continue}if(BH.has(J.tag)){let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=z1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=m1(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="${q}" @update:modelValue="${q} = $event"`;let z=z1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=m1(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 AH($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function RH($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function NH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=p5(J.attrs,"v-html");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=z1(X,J),Q=d1(J.attrs,"v-html"),w=J.selfClosing?" /":"",q=`<${J.tag}${Q}${w}>{!! ${Y} !!}</${J.tag}>`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function TH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;let Y=p5(J.attrs,"v-text");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=z1(X,J),Q=d1(J.attrs,"v-text"),w=J.selfClosing?" /":"",q=`<${J.tag}${Q}${w}>{{ ${Y} }}</${J.tag}>`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function MH($){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 kH($){let X=$,Z=0;while(Z<X.length){let J=K5(X,Z);if(!J)break;if(!gQ(J.attrs,"v-once")){Z=J.end;continue}let Y=d1(J.attrs,"v-once"),G=z1(X,J),Q=X.slice(G.outerStart,G.outerEnd),q=`@once
12632
- ${m1(Q,{...J,start:0,end:J.end-J.start},Y)}
12633
- @endonce`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function IH($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function EH($){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 hQ($){if(!HH($))return $;let X=$;return X=OH(X),X=LH(X),X=kH(X),X=AH(X),X=RH(X),X=VH(X),X=FH(X),X=EH(X),X=NH(X),X=TH(X),X=MH(X),X=IH(X),X}var jH,BH;var uQ=y(()=>{jH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),BH=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 U9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function dQ($,X){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),J=Z?Z[1]:$,Y=G0(J,X);if(Y&&typeof Y==="string")return Y;let G=J.trim();return p3.has(G)?G:null}function mQ($){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return X?X[1]:$}function cQ($,X,Z){let J=X.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(DH.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${Z}</${$}>`}async function lQ($,X,Z,J,Y){let G=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=w.length-1;W>=0;W--){let K=w[W];try{let z=dQ(K.expr,X);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${U9(mQ(K.expr))}" -->`;G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length);continue}if(p3.has(z)){let O=cQ(z,K.attrs,K.slotContent);G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length);continue}let U=K.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=j.exec(U))!==null){let O=_[1]||_[2],F=_[3];if(_[1])try{B[O]=G0(F,X)}catch{B[O]=F}else B[O]=F}let H=J.componentsDir||"components",L=await Z5(z,B,K.slotContent,H,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: ${U9(U)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G=await yH(G,X,Z,J,Y),G}async function yH($,X,Z,J,Y){let G=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=w.length-1;W>=0;W--){let K=w[W];try{let z=dQ(K.expr,X);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${U9(mQ(K.expr))}" -->`;G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length);continue}if(p3.has(z)){let j=cQ(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 Z5(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: ${U9(U)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G}var p3,DH;var pQ=y(()=>{y0();I0();p3=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"]),DH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function vH($){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(!bH.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"||!PH.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"||!CH.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(G!==null&&!SH.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 xH($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function n3($={}){let X=vH($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${xH(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 iQ($,X={}){if($.includes("data-stx-color-mode-boot"))return $;let Z=i3($);if(Z===null)return $;let J=n3(X);return`${$.slice(0,Z)}
12634
- ${J}${$.slice(Z)}`}function i3($){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 hH($){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=gH.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)+`
12635
- ${G[0]}`+Q+$.slice(Z+Y.length)}function nQ($){return uH(hH($))}function uH($){let X=fH.exec($);if(!X)return $;let Z=i3($);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=i3(J);if(Y===null)return $;return`${J.slice(0,Y)}
12636
- ${X[0]}${J.slice(Y)}`}var bH,SH,CH,PH,fH,gH;var r3=y(()=>{bH=new Set(["light","dark","auto","system"]),SH=new Set(["auto","system"]),CH=/^[a-z][\w:-]*$/i,PH=/^[\w-]+$/;fH=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),gH=/<meta\b[^>]*\bcharset\b[^>]*>/i});function dH(){if(o3===null)o3=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return o3}function rQ($,X=dH()){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)}
12637
- <meta name="stx-build" content="${X}">${$.slice(J)}`}var o3=null;function T1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function mH($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function s3($){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 i5($,X){return Object.entries($).filter(([Z])=>!X?.(Z)).map(([Z,J])=>`${Z}="${T1(String(J))}"`).join(" ")}function cH($={},X="en"){let Z=[],J=[],Y="",G=X;for(let[w,q]of Object.entries($||{})){if(q==null)continue;let W=w.trim();if(!sQ.test(W))continue;let K=W.toLowerCase();if(K==="lang"){G=String(q);continue}if(K==="class"){Y=String(q).trim();continue}Z.push(` ${W}="${T1(String(q))}"`),J.push(W)}let Q=` lang="${T1(G)}"`;if(Y)Q+=` class="${T1(Y)}"`;if(Q+=Z.join(""),Y)Q+=` ${B9}="${T1(Y)}"`;if(J.length)Q+=` ${j9}="${T1(J.join(" "))}"`;return Q}function aQ($={},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 tQ($,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=[],q=[];for(let[K,z]of Object.entries(X)){if(z==null)continue;let U=K.trim();if(!sQ.test(U))continue;let B=U.toLowerCase();if(B==="class"){let j=(J.class||"").split(/\s+/).filter(Boolean);for(let _ of String(z).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),w.push(_);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")q.push(U)}if(w.length){if(!(B9 in J))Y.push(B9);J[B9]=w.join(" ")}if(q.length){if(!(j9 in J))Y.push(j9);J[j9]=q.join(" ")}let W=Y.map((K)=>` ${K}="${T1(J[K])}"`).join("");return $.replace(Z[0],()=>`<html${W}>`)}function eQ($){if($.includes("data-stx-cloak"))return $;let X=$.lastIndexOf("</head>");if(X===-1)return $;return`${$.slice(0,X)}${oQ}
12638
- ${$.slice(X)}`}function lH($){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 q=G.match(/^<link\b[^>]*>/i);if(q){X.push(q[0]),Z+=q[0].length;continue}let W=G.match(/^<meta\b[^>]*>/i);if(W){X.push(W[0]),Z+=W[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 q=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&X.includes(q[0])){Y+=q[0].length;continue}J+=$[Y],Y++}return J+=$.slice(Z),{body:J,hoisted:X}}function pH($,X={},Z={}){let{title:J="stx App",lang:Y="en",meta:G=[],link:Q=[],script:w=[],headRaw:q="",htmlAttrs:W={},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(s3).filter(Boolean)),H=[...B.filter((T)=>!j.has(s3(T))),...G].map((T)=>{return` <meta ${i5(T)}>`}).join(`
12639
- `),L=Q.map((T)=>{return` <link ${i5(T)}>`}).join(`
12640
- `),O=w.map((T)=>{if(T.src)return` <script ${i5(T,(D)=>D==="content")}></script>`;if(T.content)return` <script>${T.content}</script>`;return""}).filter(Boolean).join(`
12641
- `),F=cH(W,Y),V=Object.entries(z).map(([T,D])=>` ${T}="${T1(String(D))}"`).join(""),A=K?` class="${T1(K)}"`:"",{body:R,hoisted:N}=lH($),M=[H,Z.colorMode?` ${n3(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?U:mH(U)}</title>`,` ${oQ}`,L,O,q?` ${q}`:"",...(Z.styles||[]).map((T)=>` ${T}`),...N.map((T)=>` ${T}`),...(Z.headScripts||[]).map((T)=>` ${T}`),Z.headStack||""].filter(Boolean),k=[R,...(Z.bodyScripts||[]).map((T)=>T),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
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 RH($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function NH($){let X=$,Z=0;while(Z<X.length){let J=_5(X,Z);if(!J)break;let Y=J.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,w=Y.match(Q);while(w){G=!0;let K=w[1],z=w[2],U=w[3];Y=Y.replace(w[0],""),Y+=` :${K}="${U}" @update:${K}="${U} = $event"`,w=Y.match(Q)}if(G){let K=_1(X,J),z=X.slice(K.outerStart,K.outerEnd),U=i1(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 q=o5(J.attrs,"v-model");if(q===null){Z=J.end;continue}if(OH.has(J.tag)){let K=J.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=_1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=i1(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="${q}" @update:modelValue="${q} = $event"`;let z=_1(X,J),U=X.slice(z.outerStart,z.outerEnd),B=i1(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 TH($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function MH($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function kH($){let X=$,Z=0;while(Z<X.length){let J=_5(X,Z);if(!J)break;let Y=o5(J.attrs,"v-html");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=_1(X,J),Q=p1(J.attrs,"v-html"),w=J.selfClosing?" /":"",q=`<${J.tag}${Q}${w}>{!! ${Y} !!}</${J.tag}>`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function IH($){let X=$,Z=0;while(Z<X.length){let J=_5(X,Z);if(!J)break;let Y=o5(J.attrs,"v-text");if(Y===null){Z=J.end;continue}if(J.selfClosing){Z=J.end;continue}let G=_1(X,J),Q=p1(J.attrs,"v-text"),w=J.selfClosing?" /":"",q=`<${J.tag}${Q}${w}>{{ ${Y} }}</${J.tag}>`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function EH($){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 DH($){let X=$,Z=0;while(Z<X.length){let J=_5(X,Z);if(!J)break;if(!mQ(J.attrs,"v-once")){Z=J.end;continue}let Y=p1(J.attrs,"v-once"),G=_1(X,J),Q=X.slice(G.outerStart,G.outerEnd),q=`@once
12634
+ ${i1(Q,{...J,start:0,end:J.end-J.start},Y)}
12635
+ @endonce`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function yH($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function bH($){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 cQ($){if(!FH($))return $;let X=$;return X=VH(X),X=AH(X),X=DH(X),X=TH(X),X=MH(X),X=NH(X),X=RH(X),X=bH(X),X=kH(X),X=IH(X),X=EH(X),X=yH(X),X}var HH,OH;var lQ=D(()=>{HH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),OH=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 H9($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pQ($,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 o3.has(G)?G:null}function iQ($){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return X?X[1]:$}function nQ($,X,Z){let J=X.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),Y=J?`<${$} ${J}>`:`<${$}>`;if(SH.has($))return J?`<${$} ${J}>`:`<${$}>`;return`${Y}${Z}</${$}>`}async function rQ($,X,Z,J,Y){let G=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=w.length-1;W>=0;W--){let K=w[W];try{let z=pQ(K.expr,X);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${H9(iQ(K.expr))}" -->`;G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length);continue}if(o3.has(z)){let O=nQ(z,K.attrs,K.slotContent);G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length);continue}let U=K.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=j.exec(U))!==null){let O=_[1]||_[2],F=_[3];if(_[1])try{B[O]=w0(F,X)}catch{B[O]=F}else B[O]=F}let H=J.componentsDir||"components",L=await w5(z,B,K.slotContent,H,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: ${H9(U)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G=await CH(G,X,Z,J,Y),G}async function CH($,X,Z,J,Y){let G=$,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,w=[],q;while((q=Q.exec(G))!==null)w.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=w.length-1;W>=0;W--){let K=w[W];try{let z=pQ(K.expr,X);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${H9(iQ(K.expr))}" -->`;G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length);continue}if(o3.has(z)){let j=nQ(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 w5(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: ${H9(U)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G}var o3,SH;var oQ=D(()=>{A0();y0();o3=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"]),SH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function gH($){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(!PH.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"||!fH.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"||!xH.test(Y)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(Y)}`);if(G!==null&&!vH.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 hH($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function a3($={}){let X=gH($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${hH(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 sQ($,X={}){if($.includes("data-stx-color-mode-boot"))return $;let Z=s3($);if(Z===null)return $;let J=a3(X);return`${$.slice(0,Z)}
12636
+ ${J}${$.slice(Z)}`}function s3($){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 mH($){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=dH.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 aQ($){return cH(mH($))}function cH($){let X=uH.exec($);if(!X)return $;let Z=s3($);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=s3(J);if(Y===null)return $;return`${J.slice(0,Y)}
12638
+ ${X[0]}${J.slice(Y)}`}var PH,vH,xH,fH,uH,dH;var t3=D(()=>{PH=new Set(["light","dark","auto","system"]),vH=new Set(["auto","system"]),xH=/^[a-z][\w:-]*$/i,fH=/^[\w-]+$/;uH=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),dH=/<meta\b[^>]*\bcharset\b[^>]*>/i});function lH(){if(e3===null)e3=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return e3}function tQ($,X=lH()){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 e3=null;function E1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pH($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $6($){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 s5($,X){return Object.entries($).filter(([Z])=>!X?.(Z)).map(([Z,J])=>`${Z}="${E1(String(J))}"`).join(" ")}function iH($={},X="en"){let Z=[],J=[],Y="",G=X;for(let[w,q]of Object.entries($||{})){if(q==null)continue;let W=w.trim();if(!$w.test(W))continue;let K=W.toLowerCase();if(K==="lang"){G=String(q);continue}if(K==="class"){Y=String(q).trim();continue}Z.push(` ${W}="${E1(String(q))}"`),J.push(W)}let Q=` lang="${E1(G)}"`;if(Y)Q+=` class="${E1(Y)}"`;if(Q+=Z.join(""),Y)Q+=` ${L9}="${E1(Y)}"`;if(J.length)Q+=` ${O9}="${E1(J.join(" "))}"`;return Q}function Xw($={},X={}){let Z={...$,...X};if($.class&&X.class){let J=$.class.split(/\s+/).filter(Boolean);for(let Y of X.class.split(/\s+/).filter(Boolean))if(!J.includes(Y))J.push(Y);Z.class=J.join(" ")}return Z}function Zw($,X={}){if(!X||Object.keys(X).length===0)return $;let Z=$.match(/<html\b([^>]*)>/i);if(!Z)return $;let J={},Y=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let K=Q[1];if(!(K in J))Y.push(K);J[K]=Q[2]??Q[3]??Q[4]??""}let w=[],q=[];for(let[K,z]of Object.entries(X)){if(z==null)continue;let U=K.trim();if(!$w.test(U))continue;let B=U.toLowerCase();if(B==="class"){let j=(J.class||"").split(/\s+/).filter(Boolean);for(let _ of String(z).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),w.push(_);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")q.push(U)}if(w.length){if(!(L9 in J))Y.push(L9);J[L9]=w.join(" ")}if(q.length){if(!(O9 in J))Y.push(O9);J[O9]=q.join(" ")}let W=Y.map((K)=>` ${K}="${E1(J[K])}"`).join("");return $.replace(Z[0],()=>`<html${W}>`)}function Jw($){if($.includes("data-stx-cloak"))return $;let X=$.lastIndexOf("</head>");if(X===-1)return $;return`${$.slice(0,X)}${eQ}
12640
+ ${$.slice(X)}`}function nH($){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 q=G.match(/^<link\b[^>]*>/i);if(q){X.push(q[0]),Z+=q[0].length;continue}let W=G.match(/^<meta\b[^>]*>/i);if(W){X.push(W[0]),Z+=W[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 q=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&X.includes(q[0])){Y+=q[0].length;continue}J+=$[Y],Y++}return J+=$.slice(Z),{body:J,hoisted:X}}function rH($,X={},Z={}){let{title:J="stx App",lang:Y="en",meta:G=[],link:Q=[],script:w=[],headRaw:q="",htmlAttrs:W={},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($6).filter(Boolean)),H=[...B.filter((M)=>!j.has($6(M))),...G].map((M)=>{return` <meta ${s5(M)}>`}).join(`
12641
+ `),L=Q.map((M)=>{return` <link ${s5(M)}>`}).join(`
12642
+ `),O=w.map((M)=>{if(M.src)return` <script ${s5(M,(E)=>E==="content")}></script>`;if(M.content)return` <script>${M.content}</script>`;return""}).filter(Boolean).join(`
12643
+ `),F=iH(W,Y),V=Object.entries(z).map(([M,E])=>` ${M}="${E1(String(E))}"`).join(""),A=K?` class="${E1(K)}"`:"",{body:R,hoisted:N}=nH($),T=[H,Z.colorMode?` ${a3(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?U:pH(U)}</title>`,` ${eQ}`,L,O,q?` ${q}`:"",...(Z.styles||[]).map((M)=>` ${M}`),...N.map((M)=>` ${M}`),...(Z.headScripts||[]).map((M)=>` ${M}`),Z.headStack||""].filter(Boolean),k=[R,...(Z.bodyScripts||[]).map((M)=>M),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
12642
12644
  <html${F}>
12643
12645
  <head>
12644
- ${M.join(`
12646
+ ${T.join(`
12645
12647
  `)}
12646
12648
  </head>
12647
12649
  <body${A}${V}>
12648
12650
  ${k.join(`
12649
12651
  `)}
12650
12652
  </body>
12651
- </html>`}function a3($){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 t3($){return a3($)}function $w($,X={}){let Z=$.lastIndexOf("</head>");if(Z===-1)return $;let{meta:J=[],link:Y=[],script:G=[],headRaw:Q=""}=X,w=$.slice(0,Z),q=[];for(let W of J){let K=s3(W);if(K&&w.includes(K))continue;q.push(` <meta ${i5(W)}>`)}for(let W of Y){if(W.href&&w.includes(`href="${W.href}"`))continue;q.push(` <link ${i5(W)}>`)}for(let W of G)if(W.src){if(w.includes(`src="${W.src}"`))continue;q.push(` <script ${i5(W,(K)=>K==="content")}></script>`)}else if(W.content){if(w.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(Q&&!w.includes(Q))q.push(` ${Q}`);if(q.length===0)return $;return`${$.slice(0,Z)}${q.join(`
12653
+ </html>`}function X6($){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 Z6($){return X6($)}function Yw($,X={}){let Z=$.lastIndexOf("</head>");if(Z===-1)return $;let{meta:J=[],link:Y=[],script:G=[],headRaw:Q=""}=X,w=$.slice(0,Z),q=[];for(let W of J){let K=$6(W);if(K&&w.includes(K))continue;q.push(` <meta ${s5(W)}>`)}for(let W of Y){if(W.href&&w.includes(`href="${W.href}"`))continue;q.push(` <link ${s5(W)}>`)}for(let W of G)if(W.src){if(w.includes(`src="${W.src}"`))continue;q.push(` <script ${s5(W,(K)=>K==="content")}></script>`)}else if(W.content){if(w.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(Q&&!w.includes(Q))q.push(` ${Q}`);if(q.length===0)return $;return`${$.slice(0,Z)}${q.join(`
12652
12654
  `)}
12653
- ${$.slice(Z)}`}function Xw($,X={},Z={}){if(t3($))return $;return pH($,X,Z)}var oQ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",j9="data-stx-html-attrs",B9="data-stx-html-class",sQ;var Zw=y(()=>{r3();sQ=/^[A-Za-z_:][\w:.-]*$/});import n5 from"path";function Jw($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function Yw($,X,Z){try{let J;if($.startsWith("/")){let Y=X;for(let G=0;G<5;G++){let Q=n5.join(Y,$);if(await Bun.file(Q).exists())return Q;Y=n5.dirname(Y)}J=n5.join(X,$)}else if($.startsWith("./")||$.startsWith("../"))J=n5.resolve(X,$);else J=n5.resolve(X,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function Gw($,X,Z){let J=$,Y=n5.dirname(X),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(J))!==null){let[W,K,z,U]=Q;if(Jw(z))continue;let B=await Yw(z,Y,X);if(B)try{let j=await Bun.file(B).text();if(Z.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let H=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:u0()});if(H.outputs.length>0)j=await H.outputs[0].text()}let _=`<script>
12655
+ ${$.slice(Z)}`}function Gw($,X={},Z={}){if(Z6($))return $;return rH($,X,Z)}var eQ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",O9="data-stx-html-attrs",L9="data-stx-html-class",$w;var Qw=D(()=>{t3();$w=/^[A-Za-z_:][\w:.-]*$/});import a5 from"path";function ww($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function qw($,X,Z){try{let J;if($.startsWith("/")){let Y=X;for(let G=0;G<5;G++){let Q=a5.join(Y,$);if(await Bun.file(Q).exists())return Q;Y=a5.dirname(Y)}J=a5.join(X,$)}else if($.startsWith("./")||$.startsWith("../"))J=a5.resolve(X,$);else J=a5.resolve(X,$);if(await Bun.file(J).exists())return J;return null}catch{return null}}async function Ww($,X,Z){let J=$,Y=a5.dirname(X),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(J))!==null){let[W,K,z,U]=Q;if(ww(z))continue;let B=await qw(z,Y,X);if(B)try{let j=await Bun.file(B).text();if(Z.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let H=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:l0()});if(H.outputs.length>0)j=await H.outputs[0].text()}let _=`<script>
12654
12656
  // Source: ${z}
12655
12657
  ${j}
12656
- </script>`;J=J.replace(W,_),G.lastIndex=0}catch(j){}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=w.exec(J))!==null){let[W,K,z,U]=q,B=K+U;if(Jw(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let _=await Yw(z,Y,X);if(_)try{let H=await Bun.file(_).text();Z.add(_);let L=`<style>
12658
+ </script>`;J=J.replace(W,_),G.lastIndex=0}catch(j){}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=w.exec(J))!==null){let[W,K,z,U]=q,B=K+U;if(ww(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let _=await qw(z,Y,X);if(_)try{let H=await Bun.file(_).text();Z.add(_);let L=`<style>
12657
12659
  /* Source: ${z} */
12658
12660
  ${H}
12659
- </style>`;J=J.replace(W,L),w.lastIndex=0}catch(H){}}}return J}var Qw=y(()=>{D1()});function e3($,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,q=Q+1,W=null,K=!1;while(q<Z.length&&w>0){let F=Z[q];if(K){K=!1,q++;continue}if(F==="\\"&&W){K=!0,q++;continue}if(W){if(F===W)W=null;q++;continue}if(F==='"'||F==="'"||F==="`"){W=F,q++;continue}if(F==="(")w++;else if(F===")"){if(w--,w===0)break}q++}if(w!==0)break;let z=Z.substring(Q+1,q).trim(),U=Z.substring(G,q+1),B=-1,j=0,_=null,H=!1;for(let F=0;F<z.length;F++){let V=z[F];if(H){H=!1;continue}if(V==="\\"&&_){H=!0;continue}if(_){if(V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=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,O=B>=0?z.substring(B+1).trim():void 0;try{let F=L.trim(),V;if(q0(F))V=W0(F,Object.keys(X))(...Object.values(X));else V=void 0;let A;if(O==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(q+1),J.lastIndex=G+R.length}catch(F){Y1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),J.lastIndex=G+U.length}}return Z}function $6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function ww($){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,q=Q;while(q<X.length&&w>0){if(X[q]==="(")w++;else if(X[q]===")")w--;q++}if(w!==0)continue;let W=X.slice(Q,q-1).trim(),K=q,z=X.slice(K),U=z.indexOf("@endmemo");if(U===-1)continue;let B=z.slice(0,U),j=K+U+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=_?_[0].length:0,L=B.slice(H),O=B.match(/(\s*)$/),F=O?O[0].length:0,V=L.slice(0,L.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,M,k="",T]=A,D=`<${M}${k} data-stx-memo="${W}"${T}>`;R=B.slice(0,H)+D+V.slice(N.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${W}">${V}</div>${B.slice(H+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 X6($){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 qw($){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,q=!1,W=!1,K=-1;while(w<$.length){let _=$[w];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){K=w;break}w++}if(K===-1)continue;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 Ww($){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}>`,_=$.toLowerCase().indexOf(j,G);if(_!==-1)X.lastIndex=_+j.length;continue}let w=G+Y[0].length,q=!1,W=!1,K=-1;while(w<$.length){let j=$[w];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){K=w;break}w++}if(K===-1)continue;let z=$.slice(G+Y[0].length,K);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!iH.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 iH;var Z6=y(()=>{A1();I0();iH=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function J6($,X,Z,J){let Y=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=Y.allowPatterns??[],Q=[],w=s0($.replace(/\{\{--[\s\S]*?--\}\}/g,(q)=>q.replace(/[^\n]/g," ")));for(let{pattern:q,message:W,suggestion:K}of nH){if(G.some((U)=>/\w/.test(U)&&W.includes(U)))continue;q.lastIndex=0;let z=w.match(q);if(z&&z.length>0){let U=w.split(`
12661
+ </style>`;J=J.replace(W,L),w.lastIndex=0}catch(H){}}}return J}var Kw=D(()=>{C1()});function J6($,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,q=Q+1,W=null,K=!1;while(q<Z.length&&w>0){let F=Z[q];if(K){K=!1,q++;continue}if(F==="\\"&&W){K=!0,q++;continue}if(W){if(F===W)W=null;q++;continue}if(F==='"'||F==="'"||F==="`"){W=F,q++;continue}if(F==="(")w++;else if(F===")"){if(w--,w===0)break}q++}if(w!==0)break;let z=Z.substring(Q+1,q).trim(),U=Z.substring(G,q+1),B=-1,j=0,_=null,H=!1;for(let F=0;F<z.length;F++){let V=z[F];if(H){H=!1;continue}if(V==="\\"&&_){H=!0;continue}if(_){if(V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=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,O=B>=0?z.substring(B+1).trim():void 0;try{let F=L.trim(),V;if(W0(F))V=K0(F,Object.keys(X))(...Object.values(X));else V=void 0;let A;if(O==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(q+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 Y6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function zw($){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,q=Q;while(q<X.length&&w>0){if(X[q]==="(")w++;else if(X[q]===")")w--;q++}if(w!==0)continue;let W=X.slice(Q,q-1).trim(),K=q,z=X.slice(K),U=z.indexOf("@endmemo");if(U===-1)continue;let B=z.slice(0,U),j=K+U+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=_?_[0].length:0,L=B.slice(H),O=B.match(/(\s*)$/),F=O?O[0].length:0,V=L.slice(0,L.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,T,k="",M]=A,E=`<${T}${k} data-stx-memo="${W}"${M}>`;R=B.slice(0,H)+E+V.slice(N.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${W}">${V}</div>${B.slice(H+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 G6($){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 Uw($){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,q=!1,W=!1,K=-1;while(w<$.length){let _=$[w];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){K=w;break}w++}if(K===-1)continue;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 jw($){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}>`,_=$.toLowerCase().indexOf(j,G);if(_!==-1)X.lastIndex=_+j.length;continue}let w=G+Y[0].length,q=!1,W=!1,K=-1;while(w<$.length){let j=$[w];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){K=w;break}w++}if(K===-1)continue;let z=$.slice(G+Y[0].length,K);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!oH.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 oH;var Q6=D(()=>{M1();y0();oH=/(?:^|\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=t0($.replace(/\{\{--[\s\S]*?--\}\}/g,(q)=>q.replace(/[^\n]/g," ")));for(let{pattern:q,message:W,suggestion:K}of sH){if(G.some((U)=>/\w/.test(U)&&W.includes(U)))continue;q.lastIndex=0;let z=w.match(q);if(z&&z.length>0){let U=w.split(`
12660
12662
  `),B=$.split(`
12661
12663
  `),j=[];U.forEach((O,F)=>{if(q.lastIndex=0,q.test(O))j.push(F+1)});let _=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",H=j.slice(0,3).map((O)=>` ${O} | ${(B[O-1]??"").trim().slice(0,100)}`).join(`
12662
12664
  `),L=H?`
@@ -12664,17 +12666,17 @@ ${H}`:"";Q.push(` \u2717 ${W}${_}
12664
12666
  \u2192 ${K}${L}`)}}if(Q.length>0&&Y.enabled){let q=(z)=>{let U=`${process.cwd()}/`;return z.startsWith(U)?z.slice(U.length):z},K=`[STX] DOM API violation in ${J&&J!==X?`${q(J)} (composed into ${q(X)})`:q(X)}:
12665
12667
  ${Q.join(`
12666
12668
  `)}
12667
- Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var nH;var Y6=y(()=>{nH=[{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 rH from"fs";function _9($){return[...$].sort().map((X)=>{try{let Z=rH.statSync(X);return`${X}:${Z.size}:${Z.mtimeMs}`}catch{return`${X}:missing`}}).join(`
12668
- `)}function H9($,X,Z){let J=$.get(X);return J!==void 0&&J.signature===Z?J.value:void 0}function U1($,X,Z,J){return $.set(X,{signature:Z,value:J}),J}var G6=()=>{};var Kw={};a(Kw,{getStoreScript:()=>sH,clearStoreCache:()=>aH});import O9 from"path";function oH($,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 sH($){let X;if($)X=O9.resolve($);else{let j=await Z1();X=O9.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 _=O9.basename(j,".ts");if(["index","types"].includes(_))continue;if(j.includes(".d.ts"))continue;J.push(j)}}catch{return U1(r5,X,"",""),null}let Y=_9(J),G=H9(r5,X,Y);if(G!==void 0)return G||null;if(J.length===0)return U1(r5,X,Y,""),null;let Q=[];for(let j of J){let _=await Bun.file(j).text();Q.push({file:j,hasUseStore:/useStore\s*\(/.test(_)})}Q.sort((j,_)=>{if(j.hasUseStore===_.hasUseStore)return 0;return j.hasUseStore?1:-1});let w=Q.map((j)=>j.file),q=[],W=new Set,K=new Bun.Transpiler({loader:"ts",target:"browser",define:u0()});for(let j of w)try{let _=await Bun.file(j).text(),H=O9.basename(j,".ts");oH(_,W),_=p0(_),_=T8(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=K.transformSync(_),q.push(`// Store: ${H}
12669
- ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${j}:`,_)}if(q.length===0)return U1(r5,X,Y,""),null;let z=q.join(`
12669
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(Y.failOnViolation)throw Error(K);else console.warn(K)}}var sH;var q6=D(()=>{sH=[{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 aH from"fs";function F9($){return[...$].sort().map((X)=>{try{let Z=aH.statSync(X);return`${X}:${Z.size}:${Z.mtimeMs}`}catch{return`${X}:missing`}}).join(`
12670
+ `)}function V9($,X,Z){let J=$.get(X);return J!==void 0&&J.signature===Z?J.value:void 0}function H1($,X,Z,J){return $.set(X,{signature:Z,value:J}),J}var W6=()=>{};var Bw={};t(Bw,{getStoreScript:()=>eH,clearStoreCache:()=>$O});import A9 from"path";function tH($,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 eH($){let X;if($)X=A9.resolve($);else{let j=await Y1();X=A9.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 _=A9.basename(j,".ts");if(["index","types"].includes(_))continue;if(j.includes(".d.ts"))continue;J.push(j)}}catch{return H1(t5,X,"",""),null}let Y=F9(J),G=V9(t5,X,Y);if(G!==void 0)return G||null;if(J.length===0)return H1(t5,X,Y,""),null;let Q=[];for(let j of J){let _=await Bun.file(j).text();Q.push({file:j,hasUseStore:/useStore\s*\(/.test(_)})}Q.sort((j,_)=>{if(j.hasUseStore===_.hasUseStore)return 0;return j.hasUseStore?1:-1});let w=Q.map((j)=>j.file),q=[],W=new Set,K=T1({loader:"ts",target:"browser",define:l0()});for(let j of w)try{let _=await Bun.file(j).text(),H=A9.basename(j,".ts");tH(_,W),_=r0(_),_=E8(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=K.transformSync(_),q.push(`// Store: ${H}
12671
+ ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${j}:`,_)}if(q.length===0)return H1(t5,X,Y,""),null;let z=q.join(`
12670
12672
 
12671
12673
  `),B=`;(function(){
12672
12674
  var __stx = window.stx || {};
12673
- ${L1.filter((j)=>!W.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
12675
+ ${A1.filter((j)=>!W.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
12674
12676
  `)}
12675
12677
  ${z}
12676
- })();`;return U1(r5,X,Y,B),B}function aH(){r5.clear()}var r5;var zw=y(()=>{F1();D1();$1();G6();r5=new Map});var Q6,KE;var Uw=y(()=>{Q6=["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"],KE=new Set(Q6)});var _w={};a(_w,{selectComposableFiles:()=>jw,referencedFrameworkComposables:()=>Bw,getFrameworkComposableScript:()=>XO,clearFrameworkComposableCache:()=>eH,__setRuntimeOwnedForTest:()=>ZO});import L9 from"path";function eH(){G8.clear()}function jw($){let X=new Map;for(let Z of $){let J=L9.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 $O($,X){let Z=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test($)}function Bw($){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 tH){if(w6.has(J))continue;let Y=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${Y}\\s*\\(`).test(X))Z.push(J)}return Z.sort()}async function XO($,X){let Z=Bw($);if(Z.length===0)return null;let J=X??L9.join(import.meta.dir,"composables"),Y=`${J}\x00${Z.join(",")}`,G=G8.get(Y);if(G!==void 0)return G||null;let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:u0()}),w=new Set(Z),q=[],W=new Set,K=[];try{let j=new Bun.Glob("*.{ts,js}");for await(let _ of j.scan({cwd:J,absolute:!0}))K.push(_)}catch{return G8.set(Y,""),null}K=jw(K);for(let j of K){let _;try{_=await Bun.file(j).text()}catch{continue}let H=[];try{H=Q.scan(_).exports.filter((L)=>L!=="default")}catch{continue}if(!H.some((L)=>w.has(L)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${L9.basename(j).replace(/\.[jt]s$/,"")}
12677
- ${Q.transformSync(_).trim()}`);for(let L of H)W.add(L)}catch(L){console.warn(`[stx] framework composable ${L9.basename(j)} could not be bundled:`,L)}}let z=Z.filter((j)=>!W.has(j)&&!$O($,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(q.length===0)return G8.set(Y,""),null;let U=[...W].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(`
12678
+ })();`;return H1(t5,X,Y,B),B}function $O(){t5.clear()}var t5;var _w=D(()=>{R1();C1();Z1();W6();A0();t5=new Map});var K6,HE;var Hw=D(()=>{K6=["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"],HE=new Set(K6)});var Fw={};t(Fw,{selectComposableFiles:()=>Ow,referencedFrameworkComposables:()=>Lw,getFrameworkComposableScript:()=>YO,clearFrameworkComposableCache:()=>ZO,__setRuntimeOwnedForTest:()=>GO});import R9 from"path";function ZO(){q8.clear()}function Ow($){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 Lw($){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 XO){if(z6.has(J))continue;let Y=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${Y}\\s*\\(`).test(X))Z.push(J)}return Z.sort()}async function YO($,X){let Z=Lw($);if(Z.length===0)return null;let J=X??R9.join(import.meta.dir,"composables"),Y=`${J}\x00${Z.join(",")}`,G=q8.get(Y);if(G!==void 0)return G||null;let Q=T1({loader:"ts",target:"browser",define:l0()}),w=new Set(Z),q=[],W=new Set,K=[];try{let j=new Bun.Glob("*.{ts,js}");for await(let _ of j.scan({cwd:J,absolute:!0}))K.push(_)}catch{return q8.set(Y,""),null}K=Ow(K);for(let j of K){let _;try{_=await Bun.file(j).text()}catch{continue}let H=[];try{H=Q.scan(_).exports.filter((L)=>L!=="default")}catch{continue}if(!H.some((L)=>w.has(L)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${R9.basename(j).replace(/\.[jt]s$/,"")}
12679
+ ${Q.transformSync(_).trim()}`);for(let L of H)W.add(L)}catch(L){console.warn(`[stx] framework composable ${R9.basename(j)} could not be bundled:`,L)}}let z=Z.filter((j)=>!W.has(j)&&!JO($,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(q.length===0)return q8.set(Y,""),null;let U=[...W].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(`
12678
12680
  `),B=`<script data-stx-framework-composables>
12679
12681
  ;(function(){
12680
12682
  var __s = window.stx = window.stx || {};
@@ -12683,15 +12685,15 @@ ${q.join(`
12683
12685
  `)}
12684
12686
  ${U}
12685
12687
  })();
12686
- </script>`;return G8.set(Y,B),B}function ZO($){w6.clear();for(let X of $)w6.add(X)}var G8,w6,tH;var Hw=y(()=>{D1();Uw();G8=new Map,w6=new Set,tH=new Set(Q6)});var Lw={};a(Lw,{getComposableScript:()=>QO,clearComposableCache:()=>wO});import Q8 from"path";function Ow($){let X=Q8.basename($,".ts");return X==="index"||X==="types"||$.endsWith(".d.ts")}async function YO($){if($)return Q8.resolve($);let X=`<default>:${process.cwd()}`,Z=q6.get(X);if(Z!==void 0)return Z;let J=await GO();if(J!==null)q6.set(X,J);return J}async function GO(){let $=await Z1(),X=$.root||process.cwd(),Z=$.composablesDir;if(Z)return Q8.resolve(X,Z);for(let J of JO){let Y=Q8.resolve(X,J);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:Y,absolute:!0}))if(!Ow(Q))return Y}catch{}}return null}async function QO($){let X=await YO($);if(!X)return null;let Z=[];try{let j=new Bun.Glob("**/*.ts");for await(let _ of j.scan({cwd:X,absolute:!0})){if(Ow(_))continue;Z.push(_)}}catch{return U1(o5,X,"",""),null}let J=_9(Z),Y=H9(o5,X,J);if(Y!==void 0)return Y||null;if(Z.length===0)return U1(o5,X,J,""),null;Z.sort();let G=new Bun.Transpiler({loader:"ts",target:"browser",define:u0()}),Q=[],w=new Set,q=new Set;for(let j of Z)try{let _=await Bun.file(j).text(),H=Q8.basename(j,".ts");for(let L of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])q.add(L[1]);try{for(let L of G.scan(_).exports)if(L!=="default")w.add(L)}catch{}_=p0(_),_=T8(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=G.transformSync(_),Q.push(`// Composable: ${H}
12687
- ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${j}:`,_)}if(Q.length===0||w.size===0)return U1(o5,X,J,""),null;let W=[...w].map((j)=>` try { __c[${JSON.stringify(j)}] = ${j}; } catch (e) {}`).join(`
12688
+ </script>`;return q8.set(Y,B),B}function GO($){z6.clear();for(let X of $)z6.add(X)}var q8,z6,XO;var Vw=D(()=>{C1();Hw();A0();q8=new Map,z6=new Set,XO=new Set(K6)});var Rw={};t(Rw,{getComposableScript:()=>WO,clearComposableCache:()=>KO});import W8 from"path";function Aw($){let X=W8.basename($,".ts");return X==="index"||X==="types"||$.endsWith(".d.ts")}async function wO($){if($)return W8.resolve($);let X=`<default>:${process.cwd()}`,Z=U6.get(X);if(Z!==void 0)return Z;let J=await qO();if(J!==null)U6.set(X,J);return J}async function qO(){let $=await Y1(),X=$.root||process.cwd(),Z=$.composablesDir;if(Z)return W8.resolve(X,Z);for(let J of QO){let Y=W8.resolve(X,J);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:Y,absolute:!0}))if(!Aw(Q))return Y}catch{}}return null}async function WO($){let X=await wO($);if(!X)return null;let Z=[];try{let j=new Bun.Glob("**/*.ts");for await(let _ of j.scan({cwd:X,absolute:!0})){if(Aw(_))continue;Z.push(_)}}catch{return H1(e5,X,"",""),null}let J=F9(Z),Y=V9(e5,X,J);if(Y!==void 0)return Y||null;if(Z.length===0)return H1(e5,X,J,""),null;Z.sort();let G=T1({loader:"ts",target:"browser",define:l0()}),Q=[],w=new Set,q=new Set;for(let j of Z)try{let _=await Bun.file(j).text(),H=W8.basename(j,".ts");for(let L of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])q.add(L[1]);try{for(let L of G.scan(_).exports)if(L!=="default")w.add(L)}catch{}_=r0(_),_=E8(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=G.transformSync(_),Q.push(`// Composable: ${H}
12689
+ ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${j}:`,_)}if(Q.length===0||w.size===0)return H1(e5,X,J,""),null;let W=[...w].map((j)=>` try { __c[${JSON.stringify(j)}] = ${j}; } catch (e) {}`).join(`
12688
12690
  `),K=JSON.stringify([...w]),z=Q.join(`
12689
12691
 
12690
12692
  `),B=`;(function(){
12691
12693
  window.__composables = window.__composables || {};
12692
12694
  var __c = window.__composables;
12693
12695
  var __stx = window.stx || {};
12694
- ${L1.filter((j)=>!q.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
12696
+ ${A1.filter((j)=>!q.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
12695
12697
  `)}
12696
12698
  ${z}
12697
12699
  ${W}
@@ -12708,7 +12710,7 @@ ${W}
12708
12710
  }
12709
12711
  window[__n] = __c[__n];
12710
12712
  }
12711
- })();`;return U1(o5,X,J,B),B}function wO(){o5.clear(),q6.clear()}var o5,q6,JO;var Fw=y(()=>{F1();D1();G6();$1();o5=new Map,q6=new Map,JO=["composables","functions"]});var Aw={};a(Aw,{processDeferDirectives:()=>UO});function qO(){return`stx-defer-${++Vw}`}function WO($){let X=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(X)return{trigger:X[1],value:X[2]};return{trigger:"immediate"}}function KO($,X,Z){let{trigger:J,value:Y}=WO(X),G=Z,Q,w,q,W=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)Q=W[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let K=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(K)w=K[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=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:q}}function zO($,X){let{trigger:Z,triggerValue:J}=X,Y;switch(Z){case"visible":Y=`
12713
+ })();`;return H1(e5,X,J,B),B}function KO(){e5.clear(),U6.clear()}var e5,U6,QO;var Nw=D(()=>{R1();C1();W6();Z1();A0();e5=new Map,U6=new Map,QO=["composables","functions"]});var Mw={};t(Mw,{processDeferDirectives:()=>_O});function zO(){return`stx-defer-${++Tw}`}function UO($){let X=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(X)return{trigger:X[1],value:X[2]};return{trigger:"immediate"}}function jO($,X,Z){let{trigger:J,value:Y}=UO(X),G=Z,Q,w,q,W=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)Q=W[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let K=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(K)w=K[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=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:q}}function BO($,X){let{trigger:Z,triggerValue:J}=X,Y;switch(Z){case"visible":Y=`
12712
12714
  const observer = new IntersectionObserver((entries) => {
12713
12715
  if (entries[0].isIntersecting) {
12714
12716
  observer.disconnect();
@@ -12781,7 +12783,7 @@ else {
12781
12783
  ${Y}
12782
12784
  })();
12783
12785
  </script>
12784
- `}function UO($,X,Z){Vw=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(Y,G,Q)=>{let w=qO(),q=KO(Y,G,Q),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",K=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",U=`<div data-defer-content style="display: none;">${q.content}</div>`,B=zO(w,q);return`
12786
+ `}function _O($,X,Z){Tw=0;let J=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(J,(Y,G,Q)=>{let w=zO(),q=jO(Y,G,Q),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",K=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",U=`<div data-defer-content style="display: none;">${q.content}</div>`,B=BO(w,q);return`
12785
12787
  <div id="${w}" class="stx-defer" data-defer-trigger="${q.trigger}">
12786
12788
  ${W}
12787
12789
  ${K}
@@ -12789,7 +12791,7 @@ else {
12789
12791
  ${z}
12790
12792
  </div>
12791
12793
  ${B}
12792
- `})}var Vw=0;var Nw={};a(Nw,{processTeleportDirectives:()=>HO,ensureTeleportTargets:()=>OO});function jO(){return`stx-teleport-${++Rw}`}function BO($){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 _O($,X){return`
12794
+ `})}var Tw=0;var Iw={};t(Iw,{processTeleportDirectives:()=>FO,ensureTeleportTargets:()=>VO});function HO(){return`stx-teleport-${++kw}`}function OO($){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 LO($,X){return`
12793
12795
  <script>
12794
12796
  (function() {
12795
12797
  const source = document.getElementById('${$}');
@@ -12835,12 +12837,12 @@ else {
12835
12837
  });
12836
12838
  })();
12837
12839
  </script>
12838
- `}function HO($,X,Z){Rw=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(Y,G,Q)=>{let w=jO(),{target:q,disabled:W}=BO(G),K=Q.trim();if(W)try{let U=!1;if(W==="true")U=!0;else if(W==="false")U=!1;else if(W in X)U=Boolean(X[W]);if(U)return`<div class="stx-teleport-inline" data-teleport-disabled>${K}</div>`}catch{}let z=_O(w,q);return`
12840
+ `}function FO($,X,Z){kw=0;let J=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(J,(Y,G,Q)=>{let w=HO(),{target:q,disabled:W}=OO(G),K=Q.trim();if(W)try{let U=!1;if(W==="true")U=!0;else if(W==="false")U=!1;else if(W in X)U=Boolean(X[W]);if(U)return`<div class="stx-teleport-inline" data-teleport-disabled>${K}</div>`}catch{}let z=LO(w,q);return`
12839
12841
  <div id="${w}" class="stx-teleport-source" style="display: none;">
12840
12842
  <template>${K}</template>
12841
12843
  </div>
12842
12844
  ${z}
12843
- `})}function OO(){return`
12845
+ `})}function VO(){return`
12844
12846
  <script>
12845
12847
  (function() {
12846
12848
  // Common teleport targets
@@ -12857,7 +12859,7 @@ else {
12857
12859
  });
12858
12860
  })();
12859
12861
  </script>
12860
- `}var Rw=0;var Iw={};a(Iw,{processTransitionDirectives:()=>AO,processTransitionAttributes:()=>MO,performLeave:()=>VO,performEnter:()=>FO,generateTransitionRuntime:()=>TO,generateTransitionCSS:()=>NO});function Tw($,X={}){return{enterFrom:X.enterClass||`${$}-enter-from`,enterActive:X.enterActiveClass||`${$}-enter-active`,enterTo:X.enterToClass||`${$}-enter-to`,leaveFrom:X.leaveClass||`${$}-leave-from`,leaveActive:X.leaveActiveClass||`${$}-leave-active`,leaveTo:X.leaveToClass||`${$}-leave-to`}}function LO($){let X=getComputedStyle($),Z=X.transitionDuration||"0s",J=X.animationDuration||"0s",Y=(G)=>{let Q=G.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let w=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?w:w*1000};return Math.max(Y(Z),Y(J))}function Mw($,X){return new Promise((Z)=>{let J=X??LO($);if(J===0){Z();return}let Y=!1,G=()=>{if(Y)return;Y=!0,$.removeEventListener("transitionend",Q),$.removeEventListener("animationend",Q),Z()},Q=(w)=>{if(w.target===$)G()};$.addEventListener("transitionend",Q),$.addEventListener("animationend",Q),setTimeout(G,J+50)})}function kw($){$.offsetHeight}async function FO($,X={}){let Z=X.name||"stx",J=Tw(Z,X),Y=typeof X.duration==="object"?X.duration.enter:X.duration;if(X.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),kw($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),X.onEnter)await new Promise((G)=>{X.onEnter($,G)});else await Mw($,Y);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),X.onAfterEnter?.($)}async function VO($,X={}){let Z=X.name||"stx",J=Tw(Z,X),Y=typeof X.duration==="object"?X.duration.leave:X.duration;if(X.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),kw($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),X.onLeave)await new Promise((G)=>{X.onLeave($,G)});else await Mw($,Y);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),X.onAfterLeave?.($)}function AO($,X={},Z){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(Y,G,Q)=>{let w=RO(G),q=w.name||"stx",W=w.duration||300,K=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
12862
+ `}var kw=0;var bw={};t(bw,{processTransitionDirectives:()=>TO,processTransitionAttributes:()=>EO,performLeave:()=>NO,performEnter:()=>RO,generateTransitionRuntime:()=>IO,generateTransitionCSS:()=>kO});function Ew($,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 AO($){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 Dw($,X){return new Promise((Z)=>{let J=X??AO($);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 yw($){$.offsetHeight}async function RO($,X={}){let Z=X.name||"stx",J=Ew(Z,X),Y=typeof X.duration==="object"?X.duration.enter:X.duration;if(X.onBeforeEnter?.($),$.classList.add(J.enterFrom),$.classList.add(J.enterActive),yw($),$.classList.remove(J.enterFrom),$.classList.add(J.enterTo),X.onEnter)await new Promise((G)=>{X.onEnter($,G)});else await Dw($,Y);$.classList.remove(J.enterActive),$.classList.remove(J.enterTo),X.onAfterEnter?.($)}async function NO($,X={}){let Z=X.name||"stx",J=Ew(Z,X),Y=typeof X.duration==="object"?X.duration.leave:X.duration;if(X.onBeforeLeave?.($),$.classList.add(J.leaveFrom),$.classList.add(J.leaveActive),yw($),$.classList.remove(J.leaveFrom),$.classList.add(J.leaveTo),X.onLeave)await new Promise((G)=>{X.onLeave($,G)});else await Dw($,Y);$.classList.remove(J.leaveActive),$.classList.remove(J.leaveTo),X.onAfterLeave?.($)}function TO($,X={},Z){let J=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(J,(Y,G,Q)=>{let w=MO(G),q=w.name||"stx",W=w.duration||300,K=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
12861
12863
  <div
12862
12864
  class="stx-transition-wrapper"
12863
12865
  data-transition="${q}"
@@ -12899,7 +12901,7 @@ else {
12899
12901
  });
12900
12902
  })();
12901
12903
  </script>
12902
- `})}function RO($){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 NO(){return`
12904
+ `})}function MO($){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 kO(){return`
12903
12905
  /* STX Transition Presets */
12904
12906
 
12905
12907
  /* Fade */
@@ -13086,7 +13088,7 @@ else {
13086
13088
  opacity: 1;
13087
13089
  max-height: 1000px;
13088
13090
  }
13089
- `}function TO(){return`
13091
+ `}function IO(){return`
13090
13092
  // STX Transition Runtime
13091
13093
  (function() {
13092
13094
  if (typeof window === 'undefined') return;
@@ -13175,7 +13177,7 @@ else {
13175
13177
 
13176
13178
  console.log('[stx] Transition runtime initialized');
13177
13179
  })();
13178
- `}function MO($){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 Dw={};a(Dw,{withErrorBoundary:()=>Ew,processErrorBoundaryDirectives:()=>EO,generateErrorBoundaryRuntime:()=>CO,generateErrorBoundaryCSS:()=>SO,createErrorBoundary:()=>bO});function IO(){return`eb-${++kO}-${Date.now().toString(36)}`}function EO($,X={},Z){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(Y,G,Q,w)=>{let q=IO(),W=DO(G||"");return yO(q,Q.trim(),w.trim(),W)})}function DO($){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 yO($,X,Z,J){let Y=J.logErrors!==!1;return`
13180
+ `}function EO($){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 Cw={};t(Cw,{withErrorBoundary:()=>Sw,processErrorBoundaryDirectives:()=>bO,generateErrorBoundaryRuntime:()=>xO,generateErrorBoundaryCSS:()=>vO,createErrorBoundary:()=>PO});function yO(){return`eb-${++DO}-${Date.now().toString(36)}`}function bO($,X={},Z){let J=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(J,(Y,G,Q,w)=>{let q=yO(),W=SO(G||"");return CO(q,Q.trim(),w.trim(),W)})}function SO($){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 CO($,X,Z,J){let Y=J.logErrors!==!1;return`
13179
13181
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
13180
13182
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
13181
13183
  ${X}
@@ -13295,7 +13297,7 @@ else {
13295
13297
  };
13296
13298
  })();
13297
13299
  </script>
13298
- `}async function Ew($,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 bO($,X={}){let Z=X.onError?(J)=>X.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>Ew(J,$,Z)}function SO(){return`
13300
+ `}async function Sw($,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 PO($,X={}){let Z=X.onError?(J)=>X.onError(J,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(J)=>Sw(J,$,Z)}function vO(){return`
13299
13301
  /* STX Error Boundary Styles */
13300
13302
  .stx-error-boundary {
13301
13303
  position: relative;
@@ -13339,7 +13341,7 @@ else {
13339
13341
  color: #fecaca;
13340
13342
  }
13341
13343
  }
13342
- `}function CO(){return`
13344
+ `}function xO(){return`
13343
13345
  // STX Error Boundary Runtime
13344
13346
  (function() {
13345
13347
  if (typeof window === 'undefined') return;
@@ -13404,7 +13406,7 @@ else {
13404
13406
 
13405
13407
  console.log('[stx] Error boundary runtime initialized');
13406
13408
  })();
13407
- `}var kO=0;var yw={};a(yw,{renderSSRSuspense:()=>uO,processSuspenseDirectives:()=>xO,generateSuspenseRuntime:()=>mO,generateSuspenseCSS:()=>dO,createSSRSuspense:()=>hO});function vO(){return`suspense-${++PO}-${Date.now().toString(36)}`}function xO($,X={},Z){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(Y,G,Q,w)=>{let q=vO(),W=fO(G||"");return gO(q,Q.trim(),w.trim(),W)})}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],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 gO($,X,Z,J){let Y=J.timeout||30000,G=J.id||$;return`
13409
+ `}var DO=0;var Pw={};t(Pw,{renderSSRSuspense:()=>cO,processSuspenseDirectives:()=>hO,generateSuspenseRuntime:()=>pO,generateSuspenseCSS:()=>lO,createSSRSuspense:()=>mO});function gO(){return`suspense-${++fO}-${Date.now().toString(36)}`}function hO($,X={},Z){let J=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(J,(Y,G,Q,w)=>{let q=gO(),W=uO(G||"");return dO(q,Q.trim(),w.trim(),W)})}function uO($){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 dO($,X,Z,J){let Y=J.timeout||30000,G=J.id||$;return`
13408
13410
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${G}" data-status="pending">
13409
13411
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
13410
13412
  ${Z}
@@ -13594,7 +13596,7 @@ else {
13594
13596
  }, 0);
13595
13597
  })();
13596
13598
  </script>
13597
- `}function hO($,X,Z){return{id:$,fallback:Z,content:X}}async function uO($){let X=$.map((J)=>`
13599
+ `}function mO($,X,Z){return{id:$,fallback:Z,content:X}}async function cO($){let X=$.map((J)=>`
13598
13600
  <div id="stx-ssr-suspense-${J.id}" class="stx-ssr-suspense">
13599
13601
  ${J.fallback}
13600
13602
  </div>
@@ -13619,7 +13621,7 @@ else {
13619
13621
  }
13620
13622
  })();
13621
13623
  </script>
13622
- `}}return{initial:X,streaming:Z()}}function dO(){return`
13624
+ `}}return{initial:X,streaming:Z()}}function lO(){return`
13623
13625
  /* STX Suspense Styles */
13624
13626
  .stx-suspense {
13625
13627
  position: relative;
@@ -13675,7 +13677,7 @@ else {
13675
13677
  background-size: 200% 100%;
13676
13678
  }
13677
13679
  }
13678
- `}function mO(){return`
13680
+ `}function pO(){return`
13679
13681
  // STX Suspense Runtime
13680
13682
  (function() {
13681
13683
  if (typeof window === 'undefined') return;
@@ -13742,7 +13744,7 @@ else {
13742
13744
 
13743
13745
  console.log('[stx] Suspense runtime initialized');
13744
13746
  })();
13745
- `}var PO=0;var Pw={};a(Pw,{processAsyncDirectives:()=>lO,isAsyncComponent:()=>iO,generateAsyncComponentRuntime:()=>rO,generateAsyncComponentCSS:()=>nO,defineAsyncComponent:()=>pO});function bw(){return`async-${++cO}-${Date.now().toString(36)}`}function lO($,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,q,W)=>{let K=bw(),z=Sw(w);return Cw(K,z,q.trim(),W.trim())}),G=G.replace(Y,(Q,w,q)=>{let W=bw(),K=Sw(w);return Cw(W,K,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function Sw($){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:q}=X;return`
13747
+ `}var fO=0;var gw={};t(gw,{processAsyncDirectives:()=>nO,isAsyncComponent:()=>oO,generateAsyncComponentRuntime:()=>aO,generateAsyncComponentCSS:()=>sO,defineAsyncComponent:()=>rO});function vw(){return`async-${++iO}-${Date.now().toString(36)}`}function nO($,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,q,W)=>{let K=vw(),z=xw(w);return fw(K,z,q.trim(),W.trim())}),G=G.replace(Y,(Q,w,q)=>{let W=vw(),K=xw(w);return fw(W,K,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function xw($){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 fw($,X,Z,J){let{component:Y,timeout:G,delay:Q,suspensible:w,retries:q}=X;return`
13746
13748
  <div class="stx-async-component" data-async-id="${$}" data-component="${Y}" data-status="pending">
13747
13749
  <div class="stx-async-loading" data-async-loading="${$}">
13748
13750
  ${Z}
@@ -13969,7 +13971,7 @@ catch (error) {
13969
13971
  loadComponent();
13970
13972
  })();
13971
13973
  </script>
13972
- `}function pO($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function iO($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function nO(){return`
13974
+ `}function rO($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function oO($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function sO(){return`
13973
13975
  /* STX Async Component Styles */
13974
13976
  .stx-async-component {
13975
13977
  position: relative;
@@ -14043,7 +14045,7 @@ catch (error) {
14043
14045
  background-size: 200% 100%;
14044
14046
  }
14045
14047
  }
14046
- `}function rO(){return`
14048
+ `}function aO(){return`
14047
14049
  // STX Async Component Runtime
14048
14050
  (function() {
14049
14051
  if (typeof window === 'undefined') return;
@@ -14097,7 +14099,7 @@ catch (error) {
14097
14099
 
14098
14100
  console.log('[stx] Async component runtime initialized');
14099
14101
  })();
14100
- `}var cO=0;var xw={};a(xw,{shouldCacheComponent:()=>$L,processKeepAliveDirectives:()=>sO,onDeactivated:()=>YL,onActivated:()=>JL,generateKeepAliveRuntime:()=>ZL,generateKeepAliveCSS:()=>XL,createKeepAliveCache:()=>eO});function vw(){return`keep-alive-${++oO}-${Date.now().toString(36)}`}function sO($,X={},Z){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(Y,G,Q)=>{let w=vw(),q=aO(G||"");return tO(w,Q.trim(),q)})}function aO($){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 tO($,X,Z){let{max:J,include:Y,exclude:G}=Z,Q=Z.id||$;return`
14102
+ `}var iO=0;var uw={};t(uw,{shouldCacheComponent:()=>JL,processKeepAliveDirectives:()=>eO,onDeactivated:()=>wL,onActivated:()=>QL,generateKeepAliveRuntime:()=>GL,generateKeepAliveCSS:()=>YL,createKeepAliveCache:()=>ZL});function hw(){return`keep-alive-${++tO}-${Date.now().toString(36)}`}function eO($,X={},Z){let J=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(J,(Y,G,Q)=>{let w=hw(),q=$L(G||"");return XL(w,Q.trim(),q)})}function $L($){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 XL($,X,Z){let{max:J,include:Y,exclude:G}=Z,Q=Z.id||$;return`
14101
14103
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${Q}">
14102
14104
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
14103
14105
  ${X}
@@ -14384,7 +14386,7 @@ else {
14384
14386
  });
14385
14387
  })();
14386
14388
  </script>
14387
- `}function eO($={}){return{id:$.id||vw(),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 $L($,X){if(X.exclude&&X.exclude.includes($))return!1;if(X.include&&!X.include.includes($))return!1;return!0}function XL(){return`
14389
+ `}function ZL($={}){return{id:$.id||hw(),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 JL($,X){if(X.exclude&&X.exclude.includes($))return!1;if(X.include&&!X.include.includes($))return!1;return!0}function YL(){return`
14388
14390
  /* STX Keep-Alive Styles */
14389
14391
  .stx-keep-alive {
14390
14392
  position: relative;
@@ -14409,7 +14411,7 @@ else {
14409
14411
  .stx-keep-alive-content > [data-activated] {
14410
14412
  opacity: 1;
14411
14413
  }
14412
- `}function ZL(){return`
14414
+ `}function GL(){return`
14413
14415
  // STX Keep-Alive Runtime
14414
14416
  (function() {
14415
14417
  if (typeof window === 'undefined') return;
@@ -14445,7 +14447,7 @@ else {
14445
14447
 
14446
14448
  console.log('[stx] Keep-alive runtime initialized');
14447
14449
  })();
14448
- `}function JL($){if(typeof document<"u")document.addEventListener("stx:activated",(X)=>{$(X.detail)})}function YL($){if(typeof document<"u")document.addEventListener("stx:deactivated",(X)=>{$(X.detail)})}var oO=0;var dw={};a(dw,{useVirtualList:()=>gw,processVirtualListDirectives:()=>K6,processVirtualGridDirectives:()=>uw,processInfiniteListDirectives:()=>hw,generateVirtualListCSS:()=>fw,default:()=>GL,createVirtualList:()=>W6});function W6($,X){let{itemHeight:Z,containerHeight:J,overscan:Y=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:w=Z,direction:q="vertical"}=X,W=[...$],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),M=Math.min(W.length-1,R+N+Y*2);return{startIndex:R,endIndex:M}}function B(){let R=0,N=0,M=W.length-1;for(let k=0;k<W.length;k++){let T=z.get(k)||w;if(R+T>K){N=Math.max(0,k-Y);break}R+=T}R=0;for(let k=0;k<W.length;k++){let T=z.get(k)||w;if(R+=T,R>K+J){M=Math.min(W.length-1,k+Y);break}}return{startIndex:N,endIndex:M}}function j(){if(Q){let R=0;for(let N=0;N<W.length;N++)R+=z.get(N)||w;return R}return W.length*Z}function _(R){if(Q){let N=0;for(let M=0;M<R;M++)N+=z.get(M)||w;return N}return R*Z}function H(){let{startIndex:R,endIndex:N}=U();return{startIndex:R,endIndex:N,scrollTop:K,totalHeight:j(),visibleItems:W.slice(R,N+1),itemHeights:new Map(z)}}function L(R,N="auto"){let M=_(R);O(M,N)}function O(R,N="auto"){K=Math.max(0,Math.min(R,j()-J))}function F(){U()}function V(R){W=[...R],z.clear(),F()}function A(){W=[],z.clear()}return{scrollToIndex:L,scrollToOffset:O,getState:H,refresh:F,setItems:V,destroy:A}}function K6($,X={},Z){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(Y,G,Q,w)=>{let q=G.trim(),W=X[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let K={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let O=Q.trim(),F=Function(`return ${O}`)();K={...K,...F}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(K.containerHeight/K.itemHeight),B=K.overscan||3,j=0,_=Math.min(W.length-1,U+B),H="";for(let O=j;O<=_&&O<W.length;O++){let F=W[O],V=w.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));H+=`
14450
+ `}function QL($){if(typeof document<"u")document.addEventListener("stx:activated",(X)=>{$(X.detail)})}function wL($){if(typeof document<"u")document.addEventListener("stx:deactivated",(X)=>{$(X.detail)})}var tO=0;var pw={};t(pw,{useVirtualList:()=>mw,processVirtualListDirectives:()=>B6,processVirtualGridDirectives:()=>lw,processInfiniteListDirectives:()=>cw,generateVirtualListCSS:()=>dw,default:()=>qL,createVirtualList:()=>j6});function j6($,X){let{itemHeight:Z,containerHeight:J,overscan:Y=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:w=Z,direction:q="vertical"}=X,W=[...$],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(W.length-1,R+N+Y*2);return{startIndex:R,endIndex:T}}function B(){let R=0,N=0,T=W.length-1;for(let k=0;k<W.length;k++){let M=z.get(k)||w;if(R+M>K){N=Math.max(0,k-Y);break}R+=M}R=0;for(let k=0;k<W.length;k++){let M=z.get(k)||w;if(R+=M,R>K+J){T=Math.min(W.length-1,k+Y);break}}return{startIndex:N,endIndex:T}}function j(){if(Q){let R=0;for(let N=0;N<W.length;N++)R+=z.get(N)||w;return R}return W.length*Z}function _(R){if(Q){let N=0;for(let T=0;T<R;T++)N+=z.get(T)||w;return N}return R*Z}function H(){let{startIndex:R,endIndex:N}=U();return{startIndex:R,endIndex:N,scrollTop:K,totalHeight:j(),visibleItems:W.slice(R,N+1),itemHeights:new Map(z)}}function L(R,N="auto"){let T=_(R);O(T,N)}function O(R,N="auto"){K=Math.max(0,Math.min(R,j()-J))}function F(){U()}function V(R){W=[...R],z.clear(),F()}function A(){W=[],z.clear()}return{scrollToIndex:L,scrollToOffset:O,getState:H,refresh:F,setItems:V,destroy:A}}function B6($,X={},Z){let J=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(J,(Y,G,Q,w)=>{let q=G.trim(),W=X[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let K={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let O=Q.trim(),F=Function(`return ${O}`)();K={...K,...F}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(K.containerHeight/K.itemHeight),B=K.overscan||3,j=0,_=Math.min(W.length-1,U+B),H="";for(let O=j;O<=_&&O<W.length;O++){let F=W[O],V=w.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));H+=`
14449
14451
  <div class="virtual-item ${K.itemClass||""}"
14450
14452
  style="position: absolute; top: ${O*K.itemHeight}px; height: ${K.itemHeight}px; width: 100%;"
14451
14453
  data-index="${O}">
@@ -14522,7 +14524,7 @@ else {
14522
14524
  };
14523
14525
  })();
14524
14526
  </script>
14525
- `})}function fw(){return`
14527
+ `})}function dw(){return`
14526
14528
  .virtual-list-container {
14527
14529
  position: relative;
14528
14530
  overflow-y: auto;
@@ -14570,7 +14572,7 @@ else {
14570
14572
  0% { background-position: 200% 0; }
14571
14573
  100% { background-position: -200% 0; }
14572
14574
  }
14573
- `}function gw($,X){let Z=null,J=()=>{if(!Z)Z=W6($(),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 hw($,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,q)=>{let W=G.trim(),K=X[W];if(!K||!Array.isArray(K))return`<!-- infiniteList: items "${W}" 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=K6(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${w}@endvirtualList`,X);return B=B.replace("</script>",`
14575
+ `}function mw($,X){let Z=null,J=()=>{if(!Z)Z=j6($(),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 cw($,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,q)=>{let W=G.trim(),K=X[W];if(!K||!Array.isArray(K))return`<!-- infiniteList: items "${W}" 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=B6(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${w}@endvirtualList`,X);return B=B.replace("</script>",`
14574
14576
  // Infinite scroll detection
14575
14577
  container.addEventListener('scroll', function() {
14576
14578
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -14588,9 +14590,9 @@ else {
14588
14590
  ${q}
14589
14591
  </div>
14590
14592
  </div>
14591
- `})}function uw($,X={},Z){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(Y,G,Q,w)=>{let q=G.trim(),W=X[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let K={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let F=Function(`return ${Q.trim()}`)();K={...K,...F}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(W.length/K.columns),B=U*(K.rowHeight+(K.gap||0)),j=Math.ceil(K.containerHeight/(K.rowHeight+(K.gap||0))),_=K.overscan||2,H=0,L=Math.min(U-1,j+_),O="";for(let F=H;F<=L;F++)for(let V=0;V<K.columns;V++){let A=F*K.columns+V;if(A>=W.length)break;let R=W[A],N=V*(100/K.columns),M=F*(K.rowHeight+(K.gap||0)),k=w.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(T,D)=>{if(typeof R==="object"&&R!==null)return String(R[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
14593
+ `})}function lw($,X={},Z){let J=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(J,(Y,G,Q,w)=>{let q=G.trim(),W=X[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let K={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let F=Function(`return ${Q.trim()}`)();K={...K,...F}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,U=Math.ceil(W.length/K.columns),B=U*(K.rowHeight+(K.gap||0)),j=Math.ceil(K.containerHeight/(K.rowHeight+(K.gap||0))),_=K.overscan||2,H=0,L=Math.min(U-1,j+_),O="";for(let F=H;F<=L;F++)for(let V=0;V<K.columns;V++){let A=F*K.columns+V;if(A>=W.length)break;let R=W[A],N=V*(100/K.columns),T=F*(K.rowHeight+(K.gap||0)),k=w.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,E)=>{if(typeof R==="object"&&R!==null)return String(R[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
14592
14594
  <div class="virtual-grid-item"
14593
- style="position: absolute; top: ${M}px; left: ${N}%; width: calc(${100/K.columns}% - ${K.gap||0}px); height: ${K.rowHeight}px;"
14595
+ style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/K.columns}% - ${K.gap||0}px); height: ${K.rowHeight}px;"
14594
14596
  data-index="${A}">
14595
14597
  ${k}
14596
14598
  </div>`}return`
@@ -14658,7 +14660,7 @@ else {
14658
14660
  });
14659
14661
  })();
14660
14662
  </script>
14661
- `})}var GL;var mw=y(()=>{GL={createVirtualList:W6,processVirtualListDirectives:K6,processInfiniteListDirectives:hw,processVirtualGridDirectives:uw,generateVirtualListCSS:fw,useVirtualList:gw}});function cw(){return`<script data-stx-hydration-runtime>
14663
+ `})}var qL;var iw=D(()=>{qL={createVirtualList:j6,processVirtualListDirectives:B6,processInfiniteListDirectives:cw,processVirtualGridDirectives:lw,generateVirtualListCSS:dw,useVirtualList:mw}});function nw(){return`<script data-stx-hydration-runtime>
14662
14664
  (function() {
14663
14665
  'use strict';
14664
14666
 
@@ -14818,7 +14820,7 @@ else {
14818
14820
  stxIslands.initIslands();
14819
14821
  }
14820
14822
  })();
14821
- </script>`}function lw($){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 pw($,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 Zq={};a(Zq,{processStaticDirectives:()=>$q,processPartialHydrationDirectives:()=>nw,onHydrated:()=>ew,isHydrated:()=>tw,hydrateIsland:()=>ow,hydrateByStrategy:()=>sw,hydrateAll:()=>aw,generatePartialHydrationCSS:()=>rw,generateIslandManifest:()=>Xq,default:()=>jL,createIslandRegistry:()=>iw});function iw(){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 QL($){return`
14823
+ </script>`}function rw($){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 ow($,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 Qq={};t(Qq,{processStaticDirectives:()=>Yq,processPartialHydrationDirectives:()=>aw,onHydrated:()=>Jq,isHydrated:()=>Zq,hydrateIsland:()=>ew,hydrateByStrategy:()=>$q,hydrateAll:()=>Xq,generatePartialHydrationCSS:()=>tw,generateIslandManifest:()=>Gq,default:()=>HL,createIslandRegistry:()=>sw});function sw(){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 WL($){return`
14822
14824
  <script data-hydrate="${$}">
14823
14825
  (function() {
14824
14826
  const island = document.querySelector('[data-island="${$}"]');
@@ -14829,7 +14831,7 @@ else {
14829
14831
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
14830
14832
  })();
14831
14833
  </script>
14832
- `}function wL($,X){let Z=X.timeout||2000,J=X.priority||"low";return`
14834
+ `}function KL($,X){let Z=X.timeout||2000,J=X.priority||"low";return`
14833
14835
  <script data-hydrate="${$}">
14834
14836
  (function() {
14835
14837
  const island = document.querySelector('[data-island="${$}"]');
@@ -14865,7 +14867,7 @@ else {
14865
14867
  }
14866
14868
  })();
14867
14869
  </script>
14868
- `}function qL($,X){let Z=X.rootMargin||"0px",J=X.threshold||0;return`
14870
+ `}function zL($,X){let Z=X.rootMargin||"0px",J=X.threshold||0;return`
14869
14871
  <script data-hydrate="${$}">
14870
14872
  (function() {
14871
14873
  const island = document.querySelector('[data-island="${$}"]');
@@ -14898,7 +14900,7 @@ else {
14898
14900
  }
14899
14901
  })();
14900
14902
  </script>
14901
- `}function WL($,X){let Z=X.media||"(min-width: 768px)";return`
14903
+ `}function UL($,X){let Z=X.media||"(min-width: 768px)";return`
14902
14904
  <script data-hydrate="${$}">
14903
14905
  (function() {
14904
14906
  const island = document.querySelector('[data-island="${$}"]');
@@ -14927,7 +14929,7 @@ else {
14927
14929
  }
14928
14930
  })();
14929
14931
  </script>
14930
- `}function KL($){return`
14932
+ `}function jL($){return`
14931
14933
  <script data-hydrate="${$}">
14932
14934
  (function() {
14933
14935
  const island = document.querySelector('[data-island="${$}"]');
@@ -14949,7 +14951,7 @@ else {
14949
14951
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
14950
14952
  })();
14951
14953
  </script>
14952
- `}function zL($,X){let Z=X.event||"stx:activate";return`
14954
+ `}function BL($,X){let Z=X.event||"stx:activate";return`
14953
14955
  <script data-hydrate="${$}">
14954
14956
  (function() {
14955
14957
  const island = document.querySelector('[data-island="${$}"]');
@@ -14970,9 +14972,9 @@ else {
14970
14972
  });
14971
14973
  })();
14972
14974
  </script>
14973
- `}function nw($,X={},Z){let J=$,Y=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=s5(J,"load",X),J=s5(J,"idle",X),J=s5(J,"visible",X),J=s5(J,"media",X),J=UL(J),J=s5(J,"hover",X),J=s5(J,"event",X),Y=G&&J!==$,Y)J+=`
14974
- `+cw();return J}function s5($,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 _=G.split(",").map((H)=>H.trim());for(let H of _){let[L,O]=H.split(":").map((F)=>F.trim());if(L&&O){let F=O.replace(/^['"]|['"]$/g,"");w[L]=F}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=lw(Q.trim()),K=pw(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(W)z.push(`data-component="${W}"`);let B=Object.keys(K).length>0?`
14975
- <script type="application/json" data-island-props="${q}">${JSON.stringify(K)}</script>`:"",j="";switch(X){case"load":j=QL(q);break;case"idle":j=wL(q,w);break;case"visible":j=qL(q,w);break;case"media":j=WL(q,w);break;case"hover":j=KL(q);break;case"event":j=zL(q,w);break}return`
14975
+ `}function aw($,X={},Z){let J=$,Y=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(J=$7(J,"load",X),J=$7(J,"idle",X),J=$7(J,"visible",X),J=$7(J,"media",X),J=_L(J),J=$7(J,"hover",X),J=$7(J,"event",X),Y=G&&J!==$,Y)J+=`
14976
+ `+nw();return J}function $7($,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 _=G.split(",").map((H)=>H.trim());for(let H of _){let[L,O]=H.split(":").map((F)=>F.trim());if(L&&O){let F=O.replace(/^['"]|['"]$/g,"");w[L]=F}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=rw(Q.trim()),K=ow(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(W)z.push(`data-component="${W}"`);let B=Object.keys(K).length>0?`
14977
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(K)}</script>`:"",j="";switch(X){case"load":j=WL(q);break;case"idle":j=KL(q,w);break;case"visible":j=zL(q,w);break;case"media":j=UL(q,w);break;case"hover":j=jL(q);break;case"event":j=BL(q,w);break}return`
14976
14978
  <div data-island="${q}"
14977
14979
  data-strategy="${X}"
14978
14980
  ${z.join(`
@@ -14982,7 +14984,7 @@ else {
14982
14984
  ${Q.trim()}${B}
14983
14985
  </div>
14984
14986
  ${j}
14985
- `})}function UL($){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`
14987
+ `})}function _L($){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`
14986
14988
  <div data-island="${Y}"
14987
14989
  data-strategy="only"
14988
14990
  class="stx-island stx-client-only">
@@ -15001,7 +15003,7 @@ else {
15001
15003
  }
15002
15004
  })();
15003
15005
  </script>
15004
- `})}function rw(){return`
15006
+ `})}function tw(){return`
15005
15007
  /* Island base styles */
15006
15008
  .stx-island {
15007
15009
  display: contents;
@@ -15042,11 +15044,11 @@ else {
15042
15044
  .stx-island.hydrated {
15043
15045
  opacity: 1;
15044
15046
  }
15045
- `}function ow($){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 sw($){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 aw(){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 tw($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function ew($){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 $q($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(X,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function Xq($){let X=$.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
15047
+ `}function ew($){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 $q($){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 Xq(){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 Zq($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function Jq($){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 Yq($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(X,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function Gq($){let X=$.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
15046
15048
  <script type="application/json" id="stx-island-manifest">
15047
15049
  ${JSON.stringify(X)}
15048
15050
  </script>
15049
- `}var jL;var Jq=y(()=>{jL={processPartialHydrationDirectives:nw,processStaticDirectives:$q,generatePartialHydrationCSS:rw,generateIslandManifest:Xq,createIslandRegistry:iw,hydrateIsland:ow,hydrateByStrategy:sw,hydrateAll:aw,isHydrated:tw,onHydrated:ew}});var Bq={};a(Bq,{watchMultiple:()=>qq,watchEffect:()=>Wq,watch:()=>wq,unref:()=>Yq,toRefs:()=>Gq,throttledComputed:()=>jq,stxWatchMultiple:()=>qq,stxWatchEffect:()=>Wq,stxWatch:()=>wq,stxUnref:()=>Yq,stxToRefs:()=>Gq,stxThrottledComputed:()=>jq,stxShallowRef:()=>Qq,stxRef:()=>a5,stxIsRef:()=>c1,stxDebouncedComputed:()=>Uq,stxComputed:()=>q8,shallowRef:()=>Qq,ref:()=>a5,processWatchDirectives:()=>zq,processComputedDirectives:()=>Kq,isRef:()=>c1,default:()=>BL,debouncedComputed:()=>Uq,computed:()=>q8});function a5($){let X=$,Z=new Set,J={get value(){if(j1){let Y=w8.get(J);if(!Y)Y=new Set,w8.set(J,Y);Y.add(j1)}return X},set value(Y){if(!Object.is(X,Y)){X=Y,Z.forEach((Q)=>Q(Y));let G=w8.get(J);if(G)G.forEach((Q)=>Q())}},subscribe(Y){return Z.add(Y),()=>Z.delete(Y)},peek(){return X}};return J}function c1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function Yq($){return c1($)?$.value:$}function Gq($){let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=a5($[Z]);return X}function Qq($){return a5($)}function q8($){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,q=new Set,W=()=>{if(Q=!0,q.size>0){let U=z.value;q.forEach((B)=>B(U))}};function K(){w.clear();let U=j1;j1=W,F9.push(W);try{return Z()}finally{F9.pop(),j1=U}}let z={get value(){if(j1){let U=w8.get(z);if(!U)U=new Set,w8.set(z,U);U.add(j1)}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 q.add(U),()=>q.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 wq($,X,Z={}){let{immediate:J=!1,deep:Y=!1,flush:G="pre",once:Q=!1}=Z,w,q=!0,W=!1,K=()=>{if(c1($))return Y?z5($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=K();if(w!==void 0&&Object.is(w,j)&&!Y)return;let _=()=>{if(X(j,w),w=Y?z5(j):j,Q)B()};if(G==="sync")_();else if(G==="post")queueMicrotask(_);else Promise.resolve().then(_)},U=null;if(c1($))U=$.subscribe(()=>z());else U=q8($).subscribe(()=>z());if(J)w=void 0,z();else w=K();let B=()=>{if(q=!1,U)U(),U=null};return B.pause=()=>{W=!0},B.resume=()=>{W=!1},B}function qq($,X,Z={}){let{immediate:J=!1,once:Y=!1}=Z,G=$.map((z)=>c1(z)?z.value:void 0),Q=!0,w=!1,q=()=>{if(!Q||w)return;let z=$.map((U)=>c1(U)?U.value:void 0);if(X(z,G),G=[...z],Y)K()},W=$.map((z)=>{if(c1(z))return z.subscribe(()=>q());return()=>{}});if(J)q();let K=()=>{Q=!1,W.forEach((z)=>z())};return K.pause=()=>{w=!0},K.resume=()=>{w=!1},K}function Wq($,X={}){let{flush:Z="pre"}=X,J,Y=!0,G=!1,Q=()=>{if(!Y||G)return;if(J)J();let q=j1;j1=Q,F9.push(Q);try{J=$()}finally{F9.pop(),j1=q}};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 Kq($,X={},Z){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(Y,G,Q)=>{try{let q=Function(...Object.keys(X),`return ${Q}`)(...Object.values(X));return X[G]=q,`<!-- computed: ${G} = ${q} -->`}catch(w){return`<!-- computed error: ${G} - ${w} -->`}})}function zq($,X={},Z){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(Y,G,Q)=>{return`
15051
+ `}var HL;var wq=D(()=>{HL={processPartialHydrationDirectives:aw,processStaticDirectives:Yq,generatePartialHydrationCSS:tw,generateIslandManifest:Gq,createIslandRegistry:sw,hydrateIsland:ew,hydrateByStrategy:$q,hydrateAll:Xq,isHydrated:Zq,onHydrated:Jq}});var Lq={};t(Lq,{watchMultiple:()=>Uq,watchEffect:()=>jq,watch:()=>zq,unref:()=>qq,toRefs:()=>Wq,throttledComputed:()=>Oq,stxWatchMultiple:()=>Uq,stxWatchEffect:()=>jq,stxWatch:()=>zq,stxUnref:()=>qq,stxToRefs:()=>Wq,stxThrottledComputed:()=>Oq,stxShallowRef:()=>Kq,stxRef:()=>X7,stxIsRef:()=>n1,stxDebouncedComputed:()=>Hq,stxComputed:()=>z8,shallowRef:()=>Kq,ref:()=>X7,processWatchDirectives:()=>_q,processComputedDirectives:()=>Bq,isRef:()=>n1,default:()=>OL,debouncedComputed:()=>Hq,computed:()=>z8});function X7($){let X=$,Z=new Set,J={get value(){if(O1){let Y=K8.get(J);if(!Y)Y=new Set,K8.set(J,Y);Y.add(O1)}return X},set value(Y){if(!Object.is(X,Y)){X=Y,Z.forEach((Q)=>Q(Y));let G=K8.get(J);if(G)G.forEach((Q)=>Q())}},subscribe(Y){return Z.add(Y),()=>Z.delete(Y)},peek(){return X}};return J}function n1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function qq($){return n1($)?$.value:$}function Wq($){let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=X7($[Z]);return X}function Kq($){return X7($)}function z8($){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,q=new Set,W=()=>{if(Q=!0,q.size>0){let U=z.value;q.forEach((B)=>B(U))}};function K(){w.clear();let U=O1;O1=W,N9.push(W);try{return Z()}finally{N9.pop(),O1=U}}let z={get value(){if(O1){let U=K8.get(z);if(!U)U=new Set,K8.set(z,U);U.add(O1)}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 q.add(U),()=>q.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 zq($,X,Z={}){let{immediate:J=!1,deep:Y=!1,flush:G="pre",once:Q=!1}=Z,w,q=!0,W=!1,K=()=>{if(n1($))return Y?H5($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=K();if(w!==void 0&&Object.is(w,j)&&!Y)return;let _=()=>{if(X(j,w),w=Y?H5(j):j,Q)B()};if(G==="sync")_();else if(G==="post")queueMicrotask(_);else Promise.resolve().then(_)},U=null;if(n1($))U=$.subscribe(()=>z());else U=z8($).subscribe(()=>z());if(J)w=void 0,z();else w=K();let B=()=>{if(q=!1,U)U(),U=null};return B.pause=()=>{W=!0},B.resume=()=>{W=!1},B}function Uq($,X,Z={}){let{immediate:J=!1,once:Y=!1}=Z,G=$.map((z)=>n1(z)?z.value:void 0),Q=!0,w=!1,q=()=>{if(!Q||w)return;let z=$.map((U)=>n1(U)?U.value:void 0);if(X(z,G),G=[...z],Y)K()},W=$.map((z)=>{if(n1(z))return z.subscribe(()=>q());return()=>{}});if(J)q();let K=()=>{Q=!1,W.forEach((z)=>z())};return K.pause=()=>{w=!0},K.resume=()=>{w=!1},K}function jq($,X={}){let{flush:Z="pre"}=X,J,Y=!0,G=!1,Q=()=>{if(!Y||G)return;if(J)J();let q=O1;O1=Q,N9.push(Q);try{J=$()}finally{N9.pop(),O1=q}};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 Bq($,X={},Z){let J=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(J,(Y,G,Q)=>{try{let q=Function(...Object.keys(X),`return ${Q}`)(...Object.values(X));return X[G]=q,`<!-- computed: ${G} = ${q} -->`}catch(w){return`<!-- computed error: ${G} - ${w} -->`}})}function _q($,X={},Z){let J=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(J,(Y,G,Q)=>{return`
15050
15052
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
15051
15053
  (function() {
15052
15054
  // Watch implementation for ${G}
@@ -15058,9 +15060,9 @@ else {
15058
15060
  }
15059
15061
  })();
15060
15062
  </script>
15061
- `})}function z5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>z5(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((J,Y)=>Z.set(z5(Y),z5(J))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((J)=>Z.add(z5(J))),Z}let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=z5($[Z]);return X}function Uq($,X=100){let Z=a5($()),J=null,Y=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Z.value=$()},X)};return q8($).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 jq($,X=100){let Z=a5($()),J=0,Y=()=>{let Q=Date.now();if(Q-J>=X)J=Q,Z.value=$()};return q8($).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 j1=null,F9,w8,BL;var _q=y(()=>{F9=[],w8=new WeakMap;BL={ref:a5,computed:q8,watch:wq,watchMultiple:qq,watchEffect:Wq,isRef:c1,unref:Yq,toRefs:Gq,shallowRef:Qq,debouncedComputed:Uq,throttledComputed:jq,processComputedDirectives:Kq,processWatchDirectives:zq}});function W8($,X){let Z={};for(let J of $)Z[J]=x1(X(J));return new Proxy({},{get:(J,Y)=>Z[Y]?.(),set:(J,Y,G)=>{if(Z[Y])Z[Y].set(G);else Z[Y]=x1(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 _L($,X){let Z={};for(let J of X)Z[J]=$[J];return Z}function z6($,X){let Z=Object.keys($),J=W8(Z,(O)=>X?.[O]??$[O].getDefaultValue()),Y=W8(Z,()=>[]),G=W8(Z,()=>!1),Q=W8(Z,()=>!1),w=W8(Z,()=>!1),q=x1(!1);async function W(O){w[O]=!0;let F=await $[O].validate(J[O],J);return Y[O]=F,w[O]=!1,F.length===0}async function K(){q.set(!0);let O=await Promise.all(Z.map(W));return q.set(!1),O.every(Boolean)}function z(){for(let O of Z)J[O]=X?.[O]??$[O].getDefaultValue(),Y[O]=[],G[O]=!1,Q[O]=!1}function U(O){for(let F of Z)if(F in O)J[F]=O[F],Q[F]=!0}function B(O,F){J[O]=F,Q[O]=!0}function j(O,F=!0){if(G[O]=F,F)W(O)}function _(O){return{value:J[O],errors:Y[O],touched:G[O],dirty:Q[O],valid:Y[O].length===0,validating:w[O]}}function H(O){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await K())await O(_L(J,Z))}}return{values:J,errors:Y,touched:G,dirty:Q,get isValid(){return Z.every((O)=>Y[O].length===0)},get isValidating(){return q()||Z.some((O)=>w[O])},get isDirty(){return Z.some((O)=>Q[O])},validate:K,validateField:W,reset:z,setValues:U,setFieldValue:B,setFieldTouched:j,getFieldState:_,handleSubmit:H}}var Hq;var Oq=y(()=>{a8();Hq=z6});var Aq={};a(Aq,{v:()=>HL,useForm:()=>z6,processHasErrorsDirective:()=>Vq,processFormValidationDirectives:()=>OL,processErrorsDirective:()=>Fq,processErrorDirective:()=>Lq,defineForm:()=>Hq,Validator:()=>t5});class t5{rules=[];defaultValue="";addRule($){let X=new t5;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 t5;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 t5;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 Lq($,X,Z){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((K)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,K)}).join(`
15062
- `)}catch{return""}})}function Fq($,X,Z){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((K)=>Q.replace(/\{\{\s*message\s*\}\}/g,K)).join(`
15063
- `)}catch{return""}})}function Vq($,X,Z){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return Q}catch{return""}})}function OL($,X,Z){let J=$;return J=Lq(J,X,Z),J=Fq(J,X,Z),J=Vq(J,X,Z),J}var HL;var Rq=y(()=>{Oq();HL=new t5});var Mq={};a(Mq,{processXElementDirectives:()=>LL,hasXElementDirectives:()=>Tq,generateXElementRuntime:()=>Nq});function Nq(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
15063
+ `})}function H5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>H5(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((J,Y)=>Z.set(H5(Y),H5(J))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((J)=>Z.add(H5(J))),Z}let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=H5($[Z]);return X}function Hq($,X=100){let Z=X7($()),J=null,Y=()=>{if(J)clearTimeout(J);J=setTimeout(()=>{Z.value=$()},X)};return z8($).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 Oq($,X=100){let Z=X7($()),J=0,Y=()=>{let Q=Date.now();if(Q-J>=X)J=Q,Z.value=$()};return z8($).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 O1=null,N9,K8,OL;var Fq=D(()=>{N9=[],K8=new WeakMap;OL={ref:X7,computed:z8,watch:zq,watchMultiple:Uq,watchEffect:jq,isRef:n1,unref:qq,toRefs:Wq,shallowRef:Kq,debouncedComputed:Hq,throttledComputed:Oq,processComputedDirectives:Bq,processWatchDirectives:_q}});function U8($,X){let Z={};for(let J of $)Z[J]=u1(X(J));return new Proxy({},{get:(J,Y)=>Z[Y]?.(),set:(J,Y,G)=>{if(Z[Y])Z[Y].set(G);else Z[Y]=u1(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 LL($,X){let Z={};for(let J of X)Z[J]=$[J];return Z}function _6($,X){let Z=Object.keys($),J=U8(Z,(O)=>X?.[O]??$[O].getDefaultValue()),Y=U8(Z,()=>[]),G=U8(Z,()=>!1),Q=U8(Z,()=>!1),w=U8(Z,()=>!1),q=u1(!1);async function W(O){w[O]=!0;let F=await $[O].validate(J[O],J);return Y[O]=F,w[O]=!1,F.length===0}async function K(){q.set(!0);let O=await Promise.all(Z.map(W));return q.set(!1),O.every(Boolean)}function z(){for(let O of Z)J[O]=X?.[O]??$[O].getDefaultValue(),Y[O]=[],G[O]=!1,Q[O]=!1}function U(O){for(let F of Z)if(F in O)J[F]=O[F],Q[F]=!0}function B(O,F){J[O]=F,Q[O]=!0}function j(O,F=!0){if(G[O]=F,F)W(O)}function _(O){return{value:J[O],errors:Y[O],touched:G[O],dirty:Q[O],valid:Y[O].length===0,validating:w[O]}}function H(O){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await K())await O(LL(J,Z))}}return{values:J,errors:Y,touched:G,dirty:Q,get isValid(){return Z.every((O)=>Y[O].length===0)},get isValidating(){return q()||Z.some((O)=>w[O])},get isDirty(){return Z.some((O)=>Q[O])},validate:K,validateField:W,reset:z,setValues:U,setFieldValue:B,setFieldTouched:j,getFieldState:_,handleSubmit:H}}var Vq;var Aq=D(()=>{X$();Vq=_6});var Mq={};t(Mq,{v:()=>FL,useForm:()=>_6,processHasErrorsDirective:()=>Tq,processFormValidationDirectives:()=>VL,processErrorsDirective:()=>Nq,processErrorDirective:()=>Rq,defineForm:()=>Vq,Validator:()=>Z7});class Z7{rules=[];defaultValue="";addRule($){let X=new Z7;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 Z7;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 Z7;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 Rq($,X,Z){let J=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((K)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,K)}).join(`
15064
+ `)}catch{return""}})}function Nq($,X,Z){let J=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((K)=>Q.replace(/\{\{\s*message\s*\}\}/g,K)).join(`
15065
+ `)}catch{return""}})}function Tq($,X,Z){let J=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(J,(Y,G,Q)=>{try{let w=G.trim().split("."),q=X;for(let K of w)if(q&&typeof q==="object"&&K in q)q=q[K];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return Q}catch{return""}})}function VL($,X,Z){let J=$;return J=Rq(J,X,Z),J=Nq(J,X,Z),J=Tq(J,X,Z),J}var FL;var kq=D(()=>{Aq();FL=new Z7});var Dq={};t(Dq,{processXElementDirectives:()=>AL,hasXElementDirectives:()=>Eq,generateXElementRuntime:()=>Iq});function Iq(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
15064
15066
  (function() {
15065
15067
  'use strict';
15066
15068
 
@@ -15344,16 +15346,16 @@ else {
15344
15346
  // Expose for manual initialization
15345
15347
  window.XElement = XElement;
15346
15348
  })();
15347
- </script>`}function Tq($){return/\bx-data(?:\s|=)/.test($)}function LL($){let X=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=$.match(X)||[],J=Z.length>0?$.replace(X,""):$;if(!Tq(J))return J;let Y=Z[0]?.trim()||Nq(),G=J.lastIndexOf("</body>");if(G!==-1)return J.slice(0,G)+Y+`
15349
+ </script>`}function Eq($){return/\bx-data(?:\s|=)/.test($)}function AL($){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(!Eq(J))return J;let Y=Z[0]?.trim()||Iq(),G=J.lastIndexOf("</body>");if(G!==-1)return J.slice(0,G)+Y+`
15348
15350
  `+J.slice(G);return J+`
15349
- `+Y}var kq={};a(kq,{rewriteImagesWithSiblings:()=>AL});import M1 from"path";async function AL($,X){let Z=X.formats??VL;if(!X.publicDir)return $;let J=TL($),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(ML(w.index,J))continue;Q.push({idx:w.index,length:z.length,src:U[1],raw:z})}if(Q.length===0)return $;let q=await Promise.all(Q.map(async(z)=>{let U=await RL(z.src,X.publicDir,Z);return{match:z,sources:U}}));for(let{match:z,sources:U}of q){if(U.length===0)continue;let j=`<picture>${U.map((_)=>`<source type="${_.mime}" srcset="${kL(_.url)}">`).join("")}${z.raw}</picture>`;Y.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Y.length===0)return $;let W="",K=0;for(let z of Y)W+=$.slice(K,z.start),W+=z.replacement,K=z.end;return W+=$.slice(K),W}async function RL($,X,Z){if(!NL($))return[];let J=M1.extname($).toLowerCase();if(!FL.has(J))return[];if(!$.startsWith("/"))return[];let Y=M1.join(X,$.slice(1)),G=M1.dirname(Y),Q=M1.basename(Y,J),w=M1.resolve(G),q=M1.resolve(X);if(!w.startsWith(q))return[];let W=M1.posix.dirname($),K=Z.map(async(U)=>{let B=M1.join(G,`${Q}${U.ext}`);if(!await Bun.file(B).exists())return null;return{url:M1.posix.join(W,`${Q}${U.ext}`),mime:U.mime}});return(await Promise.all(K)).filter((U)=>U!==null)}function NL($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function TL($){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 ML($,X){for(let[Z,J]of X)if($>=Z&&$<J)return!0;return!1}function kL($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var FL,VL;var Iq=y(()=>{FL=new Set([".jpg",".jpeg",".png",".gif"]),VL=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var Eq=()=>{};function U6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var Dq=y(()=>{Eq()});var yq={};a(yq,{injectPwaTags:()=>IL,generateThemeColorMeta:()=>yL,generateSwRegistrationScript:()=>EL,generatePwaTags:()=>V9,generateManifestLink:()=>DL});function V9($){let X=$.pwa;if(!X?.enabled)return"";let Z=X.manifest,J=X.icons?.outputDir?`/${X.icons.outputDir}`:"/pwa-icons",Y=U6($),G=`
15351
+ `+Y}var yq={};t(yq,{rewriteImagesWithSiblings:()=>TL});import D1 from"path";async function TL($,X){let Z=X.formats??NL;if(!X.publicDir)return $;let J=IL($),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(EL(w.index,J))continue;Q.push({idx:w.index,length:z.length,src:U[1],raw:z})}if(Q.length===0)return $;let q=await Promise.all(Q.map(async(z)=>{let U=await ML(z.src,X.publicDir,Z);return{match:z,sources:U}}));for(let{match:z,sources:U}of q){if(U.length===0)continue;let j=`<picture>${U.map((_)=>`<source type="${_.mime}" srcset="${DL(_.url)}">`).join("")}${z.raw}</picture>`;Y.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Y.length===0)return $;let W="",K=0;for(let z of Y)W+=$.slice(K,z.start),W+=z.replacement,K=z.end;return W+=$.slice(K),W}async function ML($,X,Z){if(!kL($))return[];let J=D1.extname($).toLowerCase();if(!RL.has(J))return[];if(!$.startsWith("/"))return[];let Y=D1.join(X,$.slice(1)),G=D1.dirname(Y),Q=D1.basename(Y,J),w=D1.resolve(G),q=D1.resolve(X);if(!w.startsWith(q))return[];let W=D1.posix.dirname($),K=Z.map(async(U)=>{let B=D1.join(G,`${Q}${U.ext}`);if(!await Bun.file(B).exists())return null;return{url:D1.posix.join(W,`${Q}${U.ext}`),mime:U.mime}});return(await Promise.all(K)).filter((U)=>U!==null)}function kL($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function IL($){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 EL($,X){for(let[Z,J]of X)if($>=Z&&$<J)return!0;return!1}function DL($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var RL,NL;var bq=D(()=>{RL=new Set([".jpg",".jpeg",".png",".gif"]),NL=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var Sq=()=>{};function H6($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var Cq=D(()=>{Sq()});var Pq={};t(Pq,{injectPwaTags:()=>yL,generateThemeColorMeta:()=>CL,generateSwRegistrationScript:()=>bL,generatePwaTags:()=>T9,generateManifestLink:()=>SL});function T9($){let X=$.pwa;if(!X?.enabled)return"";let Z=X.manifest,J=X.icons?.outputDir?`/${X.icons.outputDir}`:"/pwa-icons",Y=H6($),G=`
15350
15352
  <!-- stx PWA Meta Tags -->
15351
15353
  <link rel="manifest" href="/manifest.json">
15352
- <meta name="theme-color" content="${j6(Z?.themeColor||"#000000")}">
15354
+ <meta name="theme-color" content="${O6(Z?.themeColor||"#000000")}">
15353
15355
  <meta name="mobile-web-app-capable" content="yes">
15354
15356
  <meta name="apple-mobile-web-app-capable" content="yes">
15355
15357
  <meta name="apple-mobile-web-app-status-bar-style" content="default">
15356
- <meta name="apple-mobile-web-app-title" content="${j6(Z?.shortName||Z?.name||"App")}">`;if(X.icons?.generateAppleIcons!==!1)G+=`
15358
+ <meta name="apple-mobile-web-app-title" content="${O6(Z?.shortName||Z?.name||"App")}">`;if(X.icons?.generateAppleIcons!==!1)G+=`
15357
15359
  <link rel="apple-touch-icon" href="${J}/apple-touch-icon.png">
15358
15360
  <link rel="apple-touch-icon" sizes="120x120" href="${J}/apple-touch-icon-120x120.png">
15359
15361
  <link rel="apple-touch-icon" sizes="152x152" href="${J}/apple-touch-icon-152x152.png">
@@ -15390,12 +15392,12 @@ if ('serviceWorker' in navigator) {
15390
15392
  });
15391
15393
  }
15392
15394
  </script>
15393
- <!-- End stx PWA -->`,G}function IL($,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=V9(X);return $.slice(0,Y)+G+`
15394
- `+$.slice(Y)}return $+V9(X)}let J=V9(X);return $.replace("</head>",`${J}
15395
- </head>`)}function EL($){if(!$.pwa?.enabled)return"";return`<script>
15395
+ <!-- End stx PWA -->`,G}function yL($,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+`
15396
+ `+$.slice(Y)}return $+T9(X)}let J=T9(X);return $.replace("</head>",`${J}
15397
+ </head>`)}function bL($){if(!$.pwa?.enabled)return"";return`<script>
15396
15398
  if ('serviceWorker' in navigator) {
15397
15399
  window.addEventListener('load', function() {
15398
- navigator.serviceWorker.register('/${U6($)}')
15400
+ navigator.serviceWorker.register('/${H6($)}')
15399
15401
  .then(function(registration) {
15400
15402
  console.log('[PWA] Service Worker registered:', registration.scope);
15401
15403
  })
@@ -15404,92 +15406,92 @@ if ('serviceWorker' in navigator) {
15404
15406
  });
15405
15407
  });
15406
15408
  }
15407
- </script>`}function DL(){return'<link rel="manifest" href="/manifest.json">'}function yL($){return`<meta name="theme-color" content="${j6($)}">`}function j6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var bq=y(()=>{Dq()});import bL from"fs";import P0 from"path";function Sq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function SL($,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(`
15409
+ </script>`}function SL(){return'<link rel="manifest" href="/manifest.json">'}function CL($){return`<meta name="theme-color" content="${O6($)}">`}function O6($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var vq=D(()=>{Cq()});import PL from"fs";import f0 from"path";function xq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function vL($,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(`
15408
15410
  `,J+2),J===-1)return-1;J+=1,Y=!0;continue}if(w==="/"&&$[J+1]==="*"){let q=$.indexOf("*/",J+2);if(q===-1)return-1;J=q+2,Y=!0;continue}if(w==="/"&&Y){let q=J+1,W=!1;while(q<Z){let K=$[q];if(K==="\\"){q+=2;continue}if(K==="[")W=!0;else if(K==="]")W=!1;else if(K==="/"&&!W){q++;break}else if(K===`
15409
15411
  `){q=-1;break}q++}if(q===-1){J++,Y=!1;continue}while(q<Z&&/[a-z]/.test($[q]))q++;J=q,Y=!1;continue}if(w==="'"||w==='"'){let q=w;J++;while(J<Z){if($[J]==="\\"){J+=2;continue}if($[J]===q){J++;break}if($[J]===`
15410
- `)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 e5($,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 Cq($){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=e5($,"data-stx-runtime");if(!X)return $;let Z=Cq($);if(Z===-1||Z===X.start)return $;let J=$.slice(X.start,X.end),Y=$.slice(0,X.start)+$.slice(X.end),G=Cq(Y);if(G===-1)return 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 J7($,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 fq($){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 xL($){let X=J7($,"data-stx-runtime");if(!X)return $;let Z=fq($);if(Z===-1||Z===X.start)return $;let J=$.slice(X.start,X.end),Y=$.slice(0,X.start)+$.slice(X.end),G=fq(Y);if(G===-1)return J+`
15411
15413
  `+Y;return Y.slice(0,G)+J+`
15412
- `+Y.slice(G)}async function F0($,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=V1($);let G=!X.__stxProcessingDepth;if(G)P2(X);if(!X.__stxProcessingDepth)X.__stxProcessingDepth=0;if(X.__stxProcessingDepth++,!X.__onceStore)X.__onceStore=new Set;if((J.debug||!l7()&&!x$())&&Z&&Z.endsWith(".stx"))w3($,Z);try{return await JZ.timeAsync("template-processing",async()=>{let Q=await PL($,X,Z,J,Y);if(G)Q=X6(Q);if(G&&J.autoShell&&J.buildMode!=="compile"){let w=J.app?.head||{},W=(X.__stx_runtime_head||null)??OX(),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=W.title||z||B,_=!W.title&&(!!z||!!B),H={...w,...j&&{title:j},meta:[...w.meta||[],...W.meta||[]],link:[...w.link||[],...W.link||[]],script:[...w.script||[],...W.script||[]],headRaw:[w.headRaw,K].filter(Boolean).join(`
15413
- `),...W.htmlAttrs&&{htmlAttrs:aQ(w.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...W.bodyAttrs}}},L=t3(Q);if(Q=Xw(Q,H,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)Q=$w(Q,w),Q=tQ(Q,H.htmlAttrs);let O=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(O&&Q.includes("<head")){let A=O[1],R=H7(A);Q=Q.replace(/<head\b[^>]*>/i,(N)=>`${N}
15414
- <meta name="stx-layout" content="${Sq(A)}">
15415
- <meta name="stx-layout-group" content="${Sq(R)}">`)}let F=Q.match(/function (__stx_setup_\d+_\d+)\(/),V=F?h7(Q):null;if(F&&V&&!/\bdata-stx=/.test(V.tag)){Q=c8(Q,(R,N)=>`<body${N} data-stx="${F[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${F[1]}"`,"i");Q=Q.replace(A,"$1")}}if(G){Q=eQ(Q);let w=J.app?.colorMode;if(w)Q=iQ(Q,w);Q=rQ(Q),Q=CL(Q)}if(G)try{let{getStoreScript:w}=await t("stx/store-loader",()=>Promise.resolve().then(() => (zw(),Kw))),q=J.storesDir,W=await w(q);if(W){let K=`<script data-stx-stores>${W}</script>`,z=e5(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
15416
- `+K+Q.slice(z.end)}}catch{}if(G)try{let{getFrameworkComposableScript:w}=await t("stx/framework-composables",()=>Promise.resolve().then(() => (Hw(),_w))),q=await w(Q);if(q){let W=e5(Q,"data-stx-stores")||e5(Q,"data-stx-runtime");if(W)Q=Q.slice(0,W.end)+`
15417
- `+q+Q.slice(W.end)}}catch{}if(G)try{let{getComposableScript:w}=await t("stx/composable-loader",()=>Promise.resolve().then(() => (Fw(),Lw))),q=J.composablesDir,W=await w(q);if(W){let K=`<script data-stx-composables>${W}</script>`,z=e5(Q,"data-stx-stores")||e5(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
15418
- `+K+Q.slice(z.end)}}catch{}if(G)Q=nQ(Q);if(G&&X.__stx_inject_css!==!1)Q=await r7(Q,void 0,J.buildMode==="serve");if(G)Q=qZ(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof u$)throw Q;let w=Q instanceof Error?Q.message:String(Q),q=new G5(`Template processing failed: ${w}`,Z,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(Y1.log(q,{filePath:Z,context:X}),x4.logDetailedError(q,{filePath:Z,template:$.substring(0,500)}),J.debug)throw q;return P4.createFallbackContent("Template Processing",q)}}async function PL($,X,Z,J,Y){let G=process.cwd(),Q={...J,partialsDir:J.partialsDir&&!P0.isAbsolute(J.partialsDir)?P0.resolve(G,J.partialsDir):J.partialsDir,componentsDir:J.componentsDir&&!P0.isAbsolute(J.componentsDir)?P0.resolve(G,J.componentsDir):J.componentsDir,layoutsDir:J.layoutsDir&&!P0.isAbsolute(J.layoutsDir)?P0.resolve(G,J.layoutsDir):J.layoutsDir},w=Q,q=$;await fL(Z,X),xL(X,w),q=await v5(()=>EQ(q,X,Z,w),q,(F)=>{Y1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=q1(q,b7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let K=W.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";q=q.replace(/@@/g,U),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),q=hQ(q),q=await Gw(q,Z,Y);let B={};q=m3(q,B);let j={...X.__sections||{}},_="",H=sY(o$($)),L=/@nolayout\b/.test(q)||H===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let O=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(_=H,!/@section\s*\(/.test(q))q=`@section('content')
15414
+ `+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=N1($);let G=!X.__stxProcessingDepth;if(G)g2(X);if(!X.__stxProcessingDepth)X.__stxProcessingDepth=0;if(X.__stxProcessingDepth++,!X.__onceStore)X.__onceStore=new Set;if((J.debug||!n7()&&!u$())&&Z&&Z.endsWith(".stx"))z3($,Z);try{return await wZ.timeAsync("template-processing",async()=>{let Q=await fL($,X,Z,J,Y);if(G)Q=G6(Q);if(G&&J.autoShell&&J.buildMode!=="compile"){let w=J.app?.head||{},W=(X.__stx_runtime_head||null)??AX(),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=W.title||z||B,_=!W.title&&(!!z||!!B),H={...w,...j&&{title:j},meta:[...w.meta||[],...W.meta||[]],link:[...w.link||[],...W.link||[]],script:[...w.script||[],...W.script||[]],headRaw:[w.headRaw,K].filter(Boolean).join(`
15415
+ `),...W.htmlAttrs&&{htmlAttrs:Xw(w.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...W.bodyAttrs}}},L=Z6(Q);if(Q=Gw(Q,H,{..._&&{titleIsHtml:!0},...J.app?.colorMode&&{colorMode:J.app.colorMode}}),L)Q=Yw(Q,w),Q=Zw(Q,H.htmlAttrs);let O=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(O&&Q.includes("<head")){let A=O[1],R=V7(A);Q=Q.replace(/<head\b[^>]*>/i,(N)=>`${N}
15416
+ <meta name="stx-layout" content="${xq(A)}">
15417
+ <meta name="stx-layout-group" content="${xq(R)}">`)}let F=Q.match(/function (__stx_setup_\d+_\d+)\(/),V=F?m7(Q):null;if(F&&V&&!/\bdata-stx=/.test(V.tag)){Q=n8(Q,(R,N)=>`<body${N} data-stx="${F[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${F[1]}"`,"i");Q=Q.replace(A,"$1")}}if(G){Q=Jw(Q);let w=J.app?.colorMode;if(w)Q=sQ(Q,w);Q=tQ(Q),Q=xL(Q)}if(G)try{let{getStoreScript:w}=await $0("stx/store-loader",()=>Promise.resolve().then(() => (_w(),Bw))),q=J.storesDir,W=await w(q);if(W){let K=`<script data-stx-stores>${W}</script>`,z=J7(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 $0("stx/framework-composables",()=>Promise.resolve().then(() => (Vw(),Fw))),q=await w(Q);if(q){let W=J7(Q,"data-stx-stores")||J7(Q,"data-stx-runtime");if(W)Q=Q.slice(0,W.end)+`
15419
+ `+q+Q.slice(W.end)}}catch{}if(G)try{let{getComposableScript:w}=await $0("stx/composable-loader",()=>Promise.resolve().then(() => (Nw(),Rw))),q=J.composablesDir,W=await w(q);if(W){let K=`<script data-stx-composables>${W}</script>`,z=J7(Q,"data-stx-stores")||J7(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
15420
+ `+K+Q.slice(z.end)}}catch{}if(G)Q=aQ(Q);if(G&&X.__stx_inject_css!==!1)Q=await a7(Q,void 0,J.buildMode==="serve");if(G)Q=UZ(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof l$)throw Q;let w=Q instanceof Error?Q.message:String(Q),q=new K5(`Template processing failed: ${w}`,Z,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(Q1.log(q,{filePath:Z,context:X}),u4.logDetailedError(q,{filePath:Z,template:$.substring(0,500)}),J.debug)throw q;return g4.createFallbackContent("Template Processing",q)}}async function fL($,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,q=$;await uL(Z,X),hL(X,w),q=await h5(()=>SQ(q,X,Z,w),q,(F)=>{Q1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=z1(q,v7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let K=W.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";q=q.replace(/@@/g,U),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),q=cQ(q),q=await Ww(q,Z,Y);let B={};q=i3(q,B);let j={...X.__sections||{}},_="",H=$G(e$($)),L=/@nolayout\b/.test(q)||H===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let O=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(_=H,!/@section\s*\(/.test(q))q=`@section('content')
15419
15421
  ${q.trim()}
15420
- @endsection`}if(!_&&!L&&w.defaultLayout){let F=a3(q),V=/@section\s*\(/.test(q);if(!F||V){let A="",R=P0.dirname(Z),N=w.layoutsDir?P0.dirname(w.layoutsDir):process.cwd();for(let M=0;M<20;M++){let k=P0.join(R,"_layout.stx");if(await n(k)){A=k;break}let T=P0.dirname(R);if(T===R||T.length<N.length)break;R=T}if(A)_=A;else if(w.layoutsDir){let M=P0.isAbsolute(w.layoutsDir)?w.layoutsDir:P0.resolve(process.cwd(),w.layoutsDir),k=P0.join(M,`${w.defaultLayout}.stx`);if(await n(k))_=k}if(_&&!V)q=`@section('content')
15422
+ @endsection`}if(!_&&!L&&w.defaultLayout){let F=X6(q),V=/@section\s*\(/.test(q);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 k=f0.join(R,"_layout.stx");if(await n(k)){A=k;break}let M=f0.dirname(R);if(M===R||M.length<N.length)break;R=M}if(A)_=A;else if(w.layoutsDir){let T=f0.isAbsolute(w.layoutsDir)?w.layoutsDir:f0.resolve(process.cwd(),w.layoutsDir),k=f0.join(T,`${w.defaultLayout}.stx`);if(await n(k))_=k}if(_&&!V)q=`@section('content')
15421
15423
  ${q.trim()}
15422
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return j[V]=A,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=G0(A.trim(),X);if(R===void 0)return F;return j[V]=String(R??""),""}catch{return F}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))j[V]=A.replace("@parent",U5);else j[V]=A.trim();return""}),X.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return j[V]||A||""}),!("slot"in X)||X.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=c3(q,B),_){let F=[],V=b1(q),A=q1(V.output,k5,(R,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(q=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,N,M)=>{let k=N==="SCRIPT"?V.scripts[Number(M)]:A.tokens[Number(M)];if(k)F.push(k);return""}),F.length>0){let R=F.join(`
15424
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return j[V]=A,""}),q=q.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 j[V]=String(R??""),""}catch{return F}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))j[V]=A.replace("@parent",O5);else j[V]=A.trim();return""}),X.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return j[V]||A||""}),!("slot"in X)||X.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=n3(q,B),_){let F=[],V=U1(q),A=z1(V.output,D5,(R,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(q=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,N,T)=>{let k=N==="SCRIPT"?V.scripts[Number(T)]:A.tokens[Number(T)];if(k)F.push(k);return""}),F.length>0){let R=F.join(`
15423
15425
  `);j.content=j.content?`${j.content}
15424
- ${R}`:R,X.__sections=j}}if(_)try{let F;if(P0.isAbsolute(_))F=_,Y.add(_);else F=await v5(()=>eX(_,Z,Q,Y),null,()=>{throw new G5(`Failed to resolve layout path: ${_}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let k=[];try{let D=Q.layoutsDir;if(D){let I=P0.isAbsolute(D)?D:P0.resolve(process.cwd(),D);k=bL.readdirSync(I).filter((S)=>S.endsWith(".stx")).map((S)=>S.replace(/\.stx$/,"")).sort()}}catch{}let T=`Layout not found: ${_} (referenced from ${Z})`+(k.length>0?`. Available layouts: ${k.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if(Y1.log(Error(T),{layoutPath:_,filePath:Z,available:k},"error"),console.error(`[stx] ${T}`),Q.debug)throw new G5(T,Z);return q}let V=await v5(()=>Bun.file(F).text(),"",()=>{throw new G5(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let k={},T=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(S,b,E)=>{return k[b]=E.trim(),""});for(let[S,b]of Object.entries(k))if(j[S]&&j[S].includes(U5)){let E=j[S].indexOf(U5);j[S]=j[S].slice(0,E)+b+j[S].slice(E+U5.length)}else if(!j[S])j[S]=b;let D={...X,__sections:j},I=`@layout('${A[1]}')${T}`;return await F0(I,D,F,Q,Y)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=m3(R,B),M={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,T,D)=>{return M[T]=D.trim(),`@slot('${T}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,T,D)=>{if(j[T]){let I=j[T];if(I.includes(U5)){let S=M[T]||"",b=I.indexOf(U5);I=I.slice(0,b)+S+I.slice(b+U5.length)}return I}return D||""}),N=vL(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=c3(N,B),X.__originalFilePath=Z,q=await Pq(N,X,F,Q,Y),q=`<!-- stx-layout: ${_} -->
15425
- ${q}`,z(q)}catch(F){return Y1.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await Pq(q,X,Z,Q,Y))}function vL($,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 xL($,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 fL($,X){await v5(()=>CQ($,X),void 0,(Z)=>{Y1.log(Z,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Z.message}`)})}async function gL($,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:q}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (f7(),u8)));await q(Q,X,Z,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));Y1.log(W,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${W.message}`)}}}async function hL($,X,Z){try{let{interpolateScriptsInTemplate:J}=await t("stx/expressions",()=>Promise.resolve().then(() => (W1(),$Z)));return J($,X,{skipServer:!0})}catch(J){let Y=J instanceof Error?J:Error(String(J));return Y1.log(Y,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${Y.message}`),$}}async function Pq($,X,Z,J,Y){let G=$,Q=J;if(await gL(G,X,Z),G=await hL(G,X,Z),G=await RQ(G,X,Z),G=await NQ(G,X,Z),G=await _G(G,X,Z,Q),V1(G))G=nX(G,X),G=oX(G,X);G=rX(G);let{processStreamDirectives:w}=await t("stx/streaming",()=>Promise.resolve().then(() => (Q3(),G3)));G=w(G,X),G=g3(G,X,Z,Q),G=await lQ(G,X,Z,Q,Y),G=await q9(G,X,Z,Q,Y),G=a6(G,X,Z,Q);let{processDeferDirectives:q}=await t("stx/defer",()=>Promise.resolve().then(() => Aw));G=q(G,X,Z);let{processTeleportDirectives:W}=await t("stx/teleport",()=>Promise.resolve().then(() => Nw));G=W(G,X,Z);let{processTransitionDirectives:K,processTransitionAttributes:z}=await t("stx/transitions",()=>Promise.resolve().then(() => Iw));G=K(G,X,Z),G=z(G);let{processErrorBoundaryDirectives:U}=await t("stx/error-boundaries",()=>Promise.resolve().then(() => Dw));G=U(G,X,Z);let{processSuspenseDirectives:B}=await t("stx/suspense",()=>Promise.resolve().then(() => yw));G=B(G,X,Z);let{processAsyncDirectives:j}=await t("stx/async-components",()=>Promise.resolve().then(() => Pw));G=j(G,X,Z);let{processKeepAliveDirectives:_}=await t("stx/keep-alive",()=>Promise.resolve().then(() => xw));G=_(G,X,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await t("stx/virtual-scrolling",()=>Promise.resolve().then(() => (mw(),dw)));G=H(G,X,Z),G=L(G,X,Z),G=O(G,X,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await t("stx/partial-hydration",()=>Promise.resolve().then(() => (Jq(),Zq)));G=F(G,X,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await t("stx/computed",()=>Promise.resolve().then(() => (_q(),Bq)));G=A(G,X,Z),G=R(G,X,Z);let{processFormValidationDirectives:N}=await t("stx/forms-validation",()=>Promise.resolve().then(() => (Rq(),Aq)));G=N(G,X,Z);let{processHeadDirective:M,processTitleDirective:k,processMetaDirective:T,resetHead:D}=await t("stx/head",()=>Promise.resolve().then(() => (x7(),FX)));if(!X.__stx_head_preset&&!X.__stx_runtime_head)D();let I=M(G);if(G=I.content,I.headContent)X.__stx_head_raw=`${X.__stx_head_raw||""}${I.headContent}
15426
- `;if(G=k(G,X),G=T(G,X),G=bQ(G),G=p4(G,X),G=jG(G),G=kQ(G),G=await d3(G,X,Z,Q,Y),G=await q9(G,X,Z,Q,Y),X.__stxProcessingDepth===1)G=x2(G,X);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=X6(G),G=N1(G,X,Z),G=i4(G,X),G=n4(G,X),G=e$(G,X),G=TG(G,X),G=MG(G,X),G=await XG(G,X,Z,Q),G=await jJ(G,X,Z),G=await yG(G,X,Z,Q),G=l6(G,X,Z,Q),G=AY(G,X,Z,Q),G=RY(G,X,Z),G=NY(G,X,Z,Q),G=KG(G,X,Z,Q),G=e3(G,X),G=$6(G),G=ww(G),!Q.skipEventDirectives)G=O2(G,X,Z);if(G=eY(G,X,Z),Q.debug){let r=/\bx-data\s*=/.test(G),e=G$($);if(r&&e)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
15426
+ ${R}`:R,X.__sections=j}}if(_)try{let F;if(f0.isAbsolute(_))F=_,Y.add(_);else F=await h5(()=>J4(_,Z,Q,Y),null,()=>{throw new K5(`Failed to resolve layout path: ${_}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let k=[];try{let E=Q.layoutsDir;if(E){let I=f0.isAbsolute(E)?E:f0.resolve(process.cwd(),E);k=PL.readdirSync(I).filter((S)=>S.endsWith(".stx")).map((S)=>S.replace(/\.stx$/,"")).sort()}}catch{}let M=`Layout not found: ${_} (referenced from ${Z})`+(k.length>0?`. Available layouts: ${k.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if(Q1.log(Error(M),{layoutPath:_,filePath:Z,available:k},"error"),console.error(`[stx] ${M}`),Q.debug)throw new K5(M,Z);return q}let V=await h5(()=>Bun.file(F).text(),"",()=>{throw new K5(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let k={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(S,b,y)=>{return k[b]=y.trim(),""});for(let[S,b]of Object.entries(k))if(j[S]&&j[S].includes(O5)){let y=j[S].indexOf(O5);j[S]=j[S].slice(0,y)+b+j[S].slice(y+O5.length)}else if(!j[S])j[S]=b;let E={...X,__sections:j},I=`@layout('${A[1]}')${M}`;return await R0(I,E,F,Q,Y)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=i3(R,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,M,E)=>{return T[M]=E.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,M,E)=>{if(j[M]){let I=j[M];if(I.includes(O5)){let S=T[M]||"",b=I.indexOf(O5);I=I.slice(0,b)+S+I.slice(b+O5.length)}return I}return E||""}),N=gL(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=n3(N,B),X.__originalFilePath=Z,q=await gq(N,X,F,Q,Y),q=`<!-- stx-layout: ${_} -->
15427
+ ${q}`,z(q)}catch(F){return Q1.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await gq(q,X,Z,Q,Y))}function gL($,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 hL($,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 uL($,X){await h5(()=>fQ($,X),void 0,(Z)=>{Q1.log(Z,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Z.message}`)})}async function dL($,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:q}=await $0("stx/variable-extractor",()=>Promise.resolve().then(() => (u7(),l8)));await q(Q,X,Z,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));Q1.log(W,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${W.message}`)}}}async function mL($,X,Z){try{let{interpolateScriptsInTemplate:J}=await $0("stx/expressions",()=>Promise.resolve().then(() => (j1(),YZ)));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 gq($,X,Z,J,Y){let G=$,Q=J;if(await dL(G,X,Z),G=await mL(G,X,Z),G=await kQ(G,X,Z),G=await IQ(G,X,Z),G=await FG(G,X,Z,Q),N1(G))G=aX(G,X),G=eX(G,X);G=tX(G);let{processStreamDirectives:w}=await $0("stx/streaming",()=>Promise.resolve().then(() => (K3(),W3)));G=w(G,X),G=m3(G,X,Z,Q),G=await rQ(G,X,Z,Q,Y),G=await U9(G,X,Z,Q,Y),G=X2(G,X,Z,Q);let{processDeferDirectives:q}=await $0("stx/defer",()=>Promise.resolve().then(() => Mw));G=q(G,X,Z);let{processTeleportDirectives:W}=await $0("stx/teleport",()=>Promise.resolve().then(() => Iw));G=W(G,X,Z);let{processTransitionDirectives:K,processTransitionAttributes:z}=await $0("stx/transitions",()=>Promise.resolve().then(() => bw));G=K(G,X,Z),G=z(G);let{processErrorBoundaryDirectives:U}=await $0("stx/error-boundaries",()=>Promise.resolve().then(() => Cw));G=U(G,X,Z);let{processSuspenseDirectives:B}=await $0("stx/suspense",()=>Promise.resolve().then(() => Pw));G=B(G,X,Z);let{processAsyncDirectives:j}=await $0("stx/async-components",()=>Promise.resolve().then(() => gw));G=j(G,X,Z);let{processKeepAliveDirectives:_}=await $0("stx/keep-alive",()=>Promise.resolve().then(() => uw));G=_(G,X,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await $0("stx/virtual-scrolling",()=>Promise.resolve().then(() => (iw(),pw)));G=H(G,X,Z),G=L(G,X,Z),G=O(G,X,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await $0("stx/partial-hydration",()=>Promise.resolve().then(() => (wq(),Qq)));G=F(G,X,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await $0("stx/computed",()=>Promise.resolve().then(() => (Fq(),Lq)));G=A(G,X,Z),G=R(G,X,Z);let{processFormValidationDirectives:N}=await $0("stx/forms-validation",()=>Promise.resolve().then(() => (kq(),Mq)));G=N(G,X,Z);let{processHeadDirective:T,processTitleDirective:k,processMetaDirective:M,resetHead:E}=await $0("stx/head",()=>Promise.resolve().then(() => (h7(),NX)));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=k(G,X),G=M(G,X),G=vQ(G),G=o4(G,X),G=OG(G),G=yQ(G),G=await p3(G,X,Z,Q,Y),G=await U9(G,X,Z,Q,Y),X.__stxProcessingDepth===1)G=u2(G,X);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=G6(G),G=I1(G,X,Z),G=s4(G,X),G=a4(G,X),G=J9(G,X),G=EG(G,X),G=DG(G,X),G=await GG(G,X,Z,Q),G=await OJ(G,X,Z),G=await PG(G,X,Z,Q),G=r6(G,X,Z,Q),G=MY(G,X,Z,Q),G=kY(G,X,Z),G=IY(G,X,Z,Q),G=BG(G,X,Z,Q),G=J6(G,X),G=Y6(G),G=zw(G),!Q.skipEventDirectives)G=A2(G,X,Z);if(G=JG(G,X,Z),Q.debug){let r=/\bx-data\s*=/.test(G),e=W$($);if(r&&e)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
15427
15429
  Both work on the same page, but they manage separate scopes.
15428
- Prefer signals (state/derived/effect) for new components.`)}G=xQ(G,X),G=await S1(G,X,Z),G=qw(G),G=Ww(G),G=iY(G);let{processXElementDirectives:S}=await t("stx/x-element",()=>Promise.resolve().then(() => Mq));G=S(G);let b=X.__originalFilePath||Z,E=E7(X);if(G=await sX(G,Q,b,E),G=VG(G,X),G=await DQ(G,X,Z,Q),Q.media?.image?.autoSiblings){let r=Q.publicDir||"public",{rewriteImagesWithSiblings:e}=await t("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (Iq(),kq)));G=await e(G,{publicDir:r})}if(Q.seo?.enabled)G=TY(G,X,Q);let v=(r,e,K0=!0)=>{if(!e)return r;let x0=e.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),V0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(x0&&V0){if(K0)r=r.replace(V0[0],x0[0]);if(e=e.replace(x0[0],"").trim(),!e)return r}if(/<\/head>/i.test(r))return r.replace(/<\/head>/i,`${e}
15430
+ Prefer signals (state/derived/effect) for new components.`)}G=uQ(G,X),G=await x1(G,X,Z),G=Uw(G),G=jw(G),G=sY(G);let{processXElementDirectives:S}=await $0("stx/x-element",()=>Promise.resolve().then(() => Dq));G=S(G);let b=X.__originalFilePath||Z,y=S7(X);if(G=await $4(G,Q,b,y),G=TG(G,X),G=await CQ(G,X,Z,Q),Q.media?.image?.autoSiblings){let r=Q.publicDir||"public",{rewriteImagesWithSiblings:e}=await $0("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (bq(),yq)));G=await e(G,{publicDir:r})}if(Q.seo?.enabled)G=EY(G,X,Q);let P=(r,e,U0=!0)=>{if(!e)return r;let m0=e.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),C0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(m0&&C0){if(U0)r=r.replace(C0[0],m0[0]);if(e=e.replace(m0[0],"").trim(),!e)return r}if(/<\/head>/i.test(r))return r.replace(/<\/head>/i,`${e}
15429
15431
  </head>`);if(/<head\b[^>]*>/i.test(r))return r.replace(/(<head\b[^>]*>)/i,`$1
15430
15432
  ${e}`);if(/<html\b[^>]*>/i.test(r))return r.replace(/(<html\b[^>]*>)/i,`$1
15431
15433
  <head>
15432
15434
  ${e}
15433
- </head>`);return r},{renderHead:x,getHead:f}=await t("stx/head",()=>Promise.resolve().then(() => (x7(),FX))),p=X.__stx_runtime_head??f();if(p.title||p.meta?.length||p.link?.length){let r=x(p);if(r)G=v(G,r)}if(I.headContent)G=v(G,I.headContent,!p.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=qG(G,Q.csp,X);if(Q.analytics?.enabled)G=rY(G,Q);if(Q.heatmap?.enabled)G=X2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:r}=await t("stx/pwa/inject",()=>Promise.resolve().then(() => (bq(),yq)));G=r(G,Q)}let H0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),M0=/\bSTX\.\w+/.test(G),j0=/window\.STX\s*=/.test(G);if(H0&&M0&&!j0){let e=`<script data-stx-scoped data-stx-run="once">
15434
- ${mY()}
15435
- </script>`;if(G.includes("</head>")){let K0=G.indexOf("</head>"),V0=G.slice(0,K0).indexOf("<script");if(V0!==-1){let P=G.slice(0,V0),C=G.slice(V0);G=P+e+`
15436
- `+C}else G=G.replace("</head>",`${e}
15435
+ </head>`);return r},{renderHead:x,getHead:f}=await $0("stx/head",()=>Promise.resolve().then(() => (h7(),NX))),l=X.__stx_runtime_head??f();if(l.title||l.meta?.length||l.link?.length){let r=x(l);if(r)G=P(G,r)}if(I.headContent)G=P(G,I.headContent,!l.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=UG(G,Q.csp,X);if(Q.analytics?.enabled)G=tY(G,Q);if(Q.heatmap?.enabled)G=G2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:r}=await $0("stx/pwa/inject",()=>Promise.resolve().then(() => (vq(),Pq)));G=r(G,Q)}let H0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),S0=/\bSTX\.\w+/.test(G),z0=/window\.STX\s*=/.test(G);if(H0&&S0&&!z0){let e=`<script data-stx-scoped data-stx-run="once">
15436
+ ${iY()}
15437
+ </script>`;if(G.includes("</head>")){let U0=G.indexOf("</head>"),C0=G.slice(0,U0).indexOf("<script");if(C0!==-1){let C=G.slice(0,C0),g=G.slice(C0);G=C+e+`
15438
+ `+g}else G=G.replace("</head>",`${e}
15437
15439
  </head>`)}else if(G.includes("<body"))G=G.replace(/<body([^>]*)>/,`<body$1>
15438
15440
  ${e}`);else G=e+`
15439
- `+G}{let{scanScriptTags:r}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (d7(),Q$))),e=[];for(let K0 of r(G)){if(!/\bserver\b/i.test(K0.attrs))continue;let x0=K0.start+K0.fullMatch.indexOf(">")+1,V0=SL(G,x0);if(V0===-1)continue;let P=V0+9;while(P<G.length&&/\s/.test(G[P]))P++;e.push({start:K0.start,end:P})}for(let K0=e.length-1;K0>=0;K0--){let{start:x0,end:V0}=e[K0];G=G.substring(0,x0)+G.substring(V0)}}let Z0=x8(G,Z);if(Z0.hasScoped)G=Z0.html;let l=X.__stx_event_bindings||[],J0=!1,D0=[],v0=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:j5}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (d7(),Q$)));for(let r of j5(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))D0.push({match:r.fullMatch,attrs:r.attrs,content:r.body});for(let{match:r,attrs:e,content:K0}of D0){J0=!0;let x0=K0;J6(K0,Z,J.strict,X.__originalFilePath);let V0=await D7(K0,{eventBindings:l,attrs:e,hasColonDirectives:v0,templateContent:$,filePath:Z,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:E});G=G.replace(r,()=>V0)}if(J0)X.__stx_event_bindings=[];if(!J0&&X.__stxProcessingDepth===1){let r=X.__stx_event_bindings||[];if(r.length>0){let e=e9(r);if(e){let K0=G.lastIndexOf("</body>");G=K0===-1?G+e:G.slice(0,K0)+e+`
15440
- `+G.slice(K0)}X.__stx_event_bindings=[]}}if(!tZ(G)&&eZ(G))G=await $$(G,Q);if(G=$J(G),Q.csp?.enabled&&Q.csp.useNonce&&typeof X.cspNonce==="string")G=WG(G,X.cspNonce);return G}var U5="<!--PARENT_CONTENT_PLACEHOLDER-->";var z$=y(()=>{r$();IX();o1();i9();cY();nY();oY();o9();n9();$X();y7();$G();ZG();o7();zG();BG();OG();AG();A1();x7();W1();kG();bG();AQ();MQ();h3();$4();yQ();D5();SQ();m$();y0();PQ();fQ();uQ();pQ();_X();r3();Zw();d7();x3();Qw();Z6();Y6();I0();q3();KX();T7();X$();X$();Z6();Y6()});import R0 from"fs";import Y0 from"path";import O6 from"fs";import rq from"path";var N9="resources/assets",L6="assets";function F6($=process.cwd()){let X=rq.resolve($,N9);return O6.existsSync(X)&&O6.statSync(X).isDirectory()?X:null}import H5 from"fs";import T9 from"path";var V6="_stx";function oq($){return Bun.hash($).toString(16).slice(0,8)}function sq($){let X=[],Z=(J)=>{for(let Y of H5.readdirSync(J,{withFileTypes:!0})){let G=T9.join(J,Y.name);if(Y.isDirectory())Z(G);else if(Y.isFile()&&G.endsWith(".html"))X.push(G)}};if(H5.existsSync($))Z($);return X}var aq=[{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 tq($,X=`/${V6}`){let Z=[],J=new Set,Y=0,G=$;for(let Q of aq)G=G.replace(Q.pattern,(w,q,W)=>{if(/\b(?:src|href)\s*=/.test(q)||!W.trim())return w;let K=`${Q.prefix}.${oq(W)}.${Q.extension}`;if(!J.has(K))J.add(K),Z.push({filename:K,contents:W,contentType:Q.contentType});return Y+=W.length,Q.replace(`${X}/${K}`)});return{html:G,assets:Z,bytesInlined:Y}}function A6($){let X={pages:0,assets:0,bytesInlined:0},Z=T9.join($,V6),J=new Set;for(let Y of sq($)){let G=H5.readFileSync(Y,"utf8"),{html:Q,assets:w,bytesInlined:q}=tq(G);if(Q===G)continue;for(let W of w){if(J.has(W.filename))continue;J.add(W.filename),H5.mkdirSync(Z,{recursive:!0}),H5.writeFileSync(T9.join(Z,W.filename),W.contents),X.assets++}H5.writeFileSync(Y,Q),X.bytesInlined+=q,X.pages++}return X}m9();z$();import{createHash as uL}from"crypto";function dL($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var mL=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function cL($){return Bun.hash($).toString(16)}function vq($,X={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Z=new Map,J=$.replace(mL,(G,Q,w,q)=>{let W=q.trim();if(!W)return G;if(/\bdata-stx-src=/.test(w))return G;if(X.minify)W=dL(W);let K=cL(W);if(!Z.has(K))Z.set(K,W);let z=X.integrity?` data-stx-integrity="sha384-${uL("sha384").update(W).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 lL=new Set(["visible","idle"]);function xq($){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(lL.has(X.get(Q[1])||""))Y.add(Q[2]);let w=$.lastIndexOf("</head>");if(Y.size===0||w===-1)return $;let q=Array.from(Y).filter((W)=>!$.includes(`rel="prefetch" href="${W}"`)).map((W)=>`<link rel="prefetch" href="${W}" as="script">`).join("");if(!q)return $;return $.slice(0,w)+q+$.slice(w)}F1();import K8 from"fs";import A9 from"path";var pL="layout-types.d.ts";function iL($){let X=[],Z=(J,Y)=>{let G;try{G=K8.readdirSync(J,{withFileTypes:!0})}catch{return}for(let Q of G){if(Q.name.startsWith("."))continue;let w=A9.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 q=Q.name.slice(0,-4);X.push(Y?`${Y}/${q}`:q)}}};return Z($,""),X.sort()}function nL($){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(`
15441
+ `+G}{let{scanScriptTags:r}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (l7(),K$))),e=[];for(let U0 of r(G)){if(!/\bserver\b/i.test(U0.attrs))continue;let m0=U0.start+U0.fullMatch.indexOf(">")+1,C0=vL(G,m0);if(C0===-1)continue;let C=C0+9;while(C<G.length&&/\s/.test(G[C]))C++;e.push({start:U0.start,end:C})}for(let U0=e.length-1;U0>=0;U0--){let{start:m0,end:C0}=e[U0];G=G.substring(0,m0)+G.substring(C0)}}let k0=u8(G,Z);if(k0.hasScoped)G=k0.html;let d=X.__stx_event_bindings||[],Y0=!1,Q0=[],d0=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:Y7}=await $0("stx/signal-processing",()=>Promise.resolve().then(() => (l7(),K$)));for(let r of Y7(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))Q0.push({match:r.fullMatch,attrs:r.attrs,content:r.body});for(let{match:r,attrs:e,content:U0}of Q0){Y0=!0;let m0=U0;w6(U0,Z,J.strict,X.__originalFilePath);let C0=await C7(U0,{eventBindings:d,attrs:e,hasColonDirectives:d0,templateContent:$,filePath:Z,projectRoot:process.cwd(),production:J.buildMode==="compile",serverData:y});G=G.replace(r,()=>C0)}if(Y0)X.__stx_event_bindings=[];if(!Y0&&X.__stxProcessingDepth===1){let r=X.__stx_event_bindings||[];if(r.length>0){let e=JX(r);if(e){let U0=G.lastIndexOf("</body>");G=U0===-1?G+e:G.slice(0,U0)+e+`
15442
+ `+G.slice(U0)}X.__stx_event_bindings=[]}}if(!ZJ(G)&&JJ(G))G=await Y$(G,Q);if(G=YJ(G),Q.csp?.enabled&&Q.csp.useNonce&&typeof X.cspNonce==="string")G=jG(G,X.cspNonce);return G}var O5="<!--PARENT_CONTENT_PLACEHOLDER-->";var _$=D(()=>{t$();bX();v1();s9();nY();aY();eY();e9();a9();YX();P7();YG();QG();t7();_G();LG();AG();MG();M1();h7();j1();yG();vG();MQ();DQ();c3();Y4();PQ();C5();xQ();i$();A0();gQ();dQ();lQ();oQ();FX();t3();Qw();l7();u3();Kw();Q6();q6();y0();U3();BX();E7();G$();G$();Q6();q6()});import T0 from"fs";import G0 from"path";import A6 from"fs";import tq from"path";var I9="resources/assets",R6="assets";function N6($=process.cwd()){let X=tq.resolve($,I9);return A6.existsSync(X)&&A6.statSync(X).isDirectory()?X:null}import F5 from"fs";import E9 from"path";var T6="_stx";function eq($){return Bun.hash($).toString(16).slice(0,8)}function $W($){let X=[],Z=(J)=>{for(let Y of F5.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(F5.existsSync($))Z($);return X}var XW=[{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 ZW($,X=`/${T6}`){let Z=[],J=new Set,Y=0,G=$;for(let Q of XW)G=G.replace(Q.pattern,(w,q,W)=>{if(/\b(?:src|href)\s*=/.test(q)||!W.trim())return w;let K=`${Q.prefix}.${eq(W)}.${Q.extension}`;if(!J.has(K))J.add(K),Z.push({filename:K,contents:W,contentType:Q.contentType});return Y+=W.length,Q.replace(`${X}/${K}`)});return{html:G,assets:Z,bytesInlined:Y}}function M6($){let X={pages:0,assets:0,bytesInlined:0},Z=E9.join($,T6),J=new Set;for(let Y of $W($)){let G=F5.readFileSync(Y,"utf8"),{html:Q,assets:w,bytesInlined:q}=ZW(G);if(Q===G)continue;for(let W of w){if(J.has(W.filename))continue;J.add(W.filename),F5.mkdirSync(Z,{recursive:!0}),F5.writeFileSync(E9.join(Z,W.filename),W.contents),X.assets++}F5.writeFileSync(Y,Q),X.bytesInlined+=q,X.pages++}return X}i9();_$();import{createHash as cL}from"crypto";function lL($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var pL=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function iL($){return Bun.hash($).toString(16)}function hq($,X={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Z=new Map,J=$.replace(pL,(G,Q,w,q)=>{let W=q.trim();if(!W)return G;if(/\bdata-stx-src=/.test(w))return G;if(X.minify)W=lL(W);let K=iL(W);if(!Z.has(K))Z.set(K,W);let z=X.integrity?` data-stx-integrity="sha384-${cL("sha384").update(W).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 nL=new Set(["visible","idle"]);function uq($){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(nL.has(X.get(Q[1])||""))Y.add(Q[2]);let w=$.lastIndexOf("</head>");if(Y.size===0||w===-1)return $;let q=Array.from(Y).filter((W)=>!$.includes(`rel="prefetch" href="${W}"`)).map((W)=>`<link rel="prefetch" href="${W}" as="script">`).join("");if(!q)return $;return $.slice(0,w)+q+$.slice(w)}R1();import j8 from"fs";import M9 from"path";var rL="layout-types.d.ts";function oL($){let X=[],Z=(J,Y)=>{let G;try{G=j8.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 q=Q.name.slice(0,-4);X.push(Y?`${Y}/${q}`:q)}}};return Z($,""),X.sort()}function sL($){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(`
15441
15443
  `);return X.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...$.map((Z)=>` '${Z}': true`)," }","}","","export {}",""),X.join(`
15442
- `)}function fq($,X){if(!$)return[];let Z=A9.isAbsolute($)?$:A9.resolve(process.cwd(),$),J=iL(Z),Y=nL(J),G=A9.join(X,pL);try{if(K8.existsSync(G)&&K8.readFileSync(G,"utf8")===Y)return J;K8.mkdirSync(X,{recursive:!0}),K8.writeFileSync(G,Y)}catch{}return J}var rL=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function B6($){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 oL($){for(let X of rL){let Z=$[X];if(!Z)continue;let J=B6(Z);if(J)return{url:J,source:"env",via:X}}return null}function gq($){if(!$||typeof $!=="object")return null;let X=$,Z=X.site?.url??X.url??X.app?.url;return typeof Z==="string"?B6(Z):null}async function sL($){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=gq(G.default??G);if(Q)return Q}catch{}}return null}async function hq($={}){let X=$.cwd??process.cwd(),Z=$.env??process.env;if($.explicit){let Q=B6($.explicit);if(Q)return{url:Q,source:"option"}}let J=gq($.stxConfig);if(J)return{url:J,source:"stx.config",via:"site.url"};let Y=await sL(X);if(Y)return{url:Y,source:"site.config",via:"url"};let G=oL(Z);if(G)return G;return{url:"http://localhost",source:"fallback"}}function uq(){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(`
15443
- `)}m$();R7();r$();T5();I1();class dq{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=Y0.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 R0.promises.mkdir(this.cacheDir,{recursive:!0});let $=Y0.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=R0.statSync($),J=`${$}:${Z.mtimeMs}`;for(let G of X)if(R0.existsSync(G)){let Q=R0.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 mq{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let X=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return Y0.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 R0.promises.mkdir(Y0.dirname(Z),{recursive:!0}),await Bun.write(Z,JSON.stringify(X))}async invalidate($){let X=this.getFilePath($);if(await Bun.file(X).exists())await R0.promises.unlink(X)}async invalidatePattern($){let X=Y0.join(this.cacheDir,"isr");if(!R0.existsSync(X))return;let Z=await R0.promises.readdir(X);for(let J of Z){let Y=J.replace(/_/g,"/").replace(".json","");if($.test(Y))await R0.promises.unlink(Y0.join(X,J))}}async needsRevalidation($){let X=await this.get($);if(!X)return!0;return Date.now()>X.revalidateAfter}}async function aL($){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(`
15444
+ `)}function dq($,X){if(!$)return[];let Z=M9.isAbsolute($)?$:M9.resolve(process.cwd(),$),J=oL(Z),Y=sL(J),G=M9.join(X,rL);try{if(j8.existsSync(G)&&j8.readFileSync(G,"utf8")===Y)return J;j8.mkdirSync(X,{recursive:!0}),j8.writeFileSync(G,Y)}catch{}return J}var aL=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function L6($){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 tL($){for(let X of aL){let Z=$[X];if(!Z)continue;let J=L6(Z);if(J)return{url:J,source:"env",via:X}}return null}function mq($){if(!$||typeof $!=="object")return null;let X=$,Z=X.site?.url??X.url??X.app?.url;return typeof Z==="string"?L6(Z):null}async function eL($){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=mq(G.default??G);if(Q)return Q}catch{}}return null}async function cq($={}){let X=$.cwd??process.cwd(),Z=$.env??process.env;if($.explicit){let Q=L6($.explicit);if(Q)return{url:Q,source:"option"}}let J=mq($.stxConfig);if(J)return{url:J,source:"stx.config",via:"site.url"};let Y=await eL(X);if(Y)return{url:Y,source:"site.config",via:"url"};let G=tL(Z);if(G)return G;return{url:"http://localhost",source:"fallback"}}function lq(){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
+ `)}i$();k7();t$();I5();b1();class pq{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 T0.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=T0.statSync($),J=`${$}:${Z.mtimeMs}`;for(let G of X)if(T0.existsSync(G)){let Q=T0.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 iq{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 T0.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 T0.promises.unlink(X)}async invalidatePattern($){let X=G0.join(this.cacheDir,"isr");if(!T0.existsSync(X))return;let Z=await T0.promises.readdir(X);for(let J of Z){let Y=J.replace(/_/g,"/").replace(".json","");if($.test(Y))await T0.promises.unlink(G0.join(X,J))}}async needsRevalidation($){let X=await this.get($);if(!X)return!0;return Date.now()>X.revalidateAfter}}async function $F($){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(`
15444
15446
  return (async function getStaticPaths() {
15445
15447
  ${Y[1]}
15446
15448
  })()
15447
- `)()}catch(X){return console.error(`Error extracting static paths from ${$}:`,X),null}}async function tL($){let X=[];if(!$.isDynamic)X.push({url:$.pattern,params:{}});else{let Z=await aL($.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 eL($){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 $F($,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",`
15449
+ `)()}catch(X){return console.error(`Error extracting static paths from ${$}:`,X),null}}async function XF($){let X=[];if(!$.isDynamic)X.push({url:$.pattern,params:{}});else{let Z=await $F($.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 ZF($){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 JF($,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",`
15448
15450
  return (async function getStaticProps() {
15449
15451
  ${G[1]}
15450
15452
  })()
15451
- `)(X)}catch(G){return console.error(`Error executing getStaticProps in ${Z}:`,G),null}}function XF($){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test($)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test($)}async function cq($,X,Z={},J,Y){let G=await Bun.file($.filePath).text(),Q=await eL($.filePath),w=await $F(G,X,$.filePath),q={...Q||{},...w||{},...Z,params:X,$route:{path:$.pattern,params:X}},W=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(`${Y0.relative(process.cwd(),B.templatePath)}: ${B.message}
15452
- resolved against partialsDir: ${B.partialsDir}`)}};if(XF(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 F0(G,q,$.filePath,z,W);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}
15453
+ `)(X)}catch(G){return console.error(`Error executing getStaticProps in ${Z}:`,G),null}}function YF($){return/(?:^|[^\w$.])(?:export\s+)?(?:async\s+)?function\s+action\s*\(/.test($)||/(?:^|[^\w$.])(?:export\s+)?(?:const|let|var)\s+action\s*=/.test($)}async function nq($,X,Z={},J,Y){let G=await Bun.file($.filePath).text(),Q=await ZF($.filePath),w=await JF(G,X,$.filePath),q={...Q||{},...w||{},...Z,params:X,$route:{path:$.pattern,params:X}},W=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(YF(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,q,$.filePath,z,W);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}
15453
15455
  </head>`);else U=`${B}
15454
- ${U}`}if(U=await lX(U,{router:J.router}),U=await r7(U),J.minify!==!1)return{html:ZF(U),dependencies:Array.from(W),includeFailures:K};return{html:U,dependencies:Array.from(W),includeFailures:K}}function ZF($){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],q=Y[2],W=Y[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),X.push(w+q+W),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 YF($,X,Z,J){if(Z?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(X))return!0;return J.some((Y)=>{if(Y instanceof RegExp)return Y.test($);return Y.endsWith("/")?$===Y.slice(0,-1)||$.startsWith(Y):$===Y})}function GF($,X){return`<?xml version="1.0" encoding="UTF-8"?>
15456
+ ${U}`}if(U=await rX(U,{router:J.router}),U=await a7(U),J.minify!==!1)return{html:GF(U),dependencies:Array.from(W),includeFailures:K};return{html:U,dependencies:Array.from(W),includeFailures:K}}function GF($){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],q=Y[2],W=Y[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),X.push(w+q+W),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 QF($){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 wF($,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 qF($,X){return`<?xml version="1.0" encoding="UTF-8"?>
15455
15457
  <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
15456
15458
  ${$.map((J)=>{let Y=new URL(J.loc,X).href,G=` <url>
15457
- <loc>${w1(Y)}</loc>`;if(J.lastmod)G+=`
15459
+ <loc>${W1(Y)}</loc>`;if(J.lastmod)G+=`
15458
15460
  <lastmod>${J.lastmod}</lastmod>`;if(J.changefreq)G+=`
15459
15461
  <changefreq>${J.changefreq}</changefreq>`;if(J.priority!==void 0)G+=`
15460
15462
  <priority>${J.priority}</priority>`;return G+=`
15461
15463
  </url>`,G}).join(`
15462
15464
  `)}
15463
- </urlset>`}function w1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function QF($,X){let Z=X.map((J)=>{let Y=" <item>";if(Y+=`
15464
- <title>${w1(J.title)}</title>`,Y+=`
15465
- <link>${w1(J.link)}</link>`,J.description)Y+=`
15466
- <description>${w1(J.description)}</description>`;if(J.pubDate)Y+=`
15465
+ </urlset>`}function W1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}function WF($,X){let Z=X.map((J)=>{let Y=" <item>";if(Y+=`
15466
+ <title>${W1(J.title)}</title>`,Y+=`
15467
+ <link>${W1(J.link)}</link>`,J.description)Y+=`
15468
+ <description>${W1(J.description)}</description>`;if(J.pubDate)Y+=`
15467
15469
  <pubDate>${J.pubDate.toUTCString()}</pubDate>`;if(J.author)Y+=`
15468
- <author>${w1(J.author)}</author>`;if(J.categories)for(let G of J.categories)Y+=`
15469
- <category>${w1(G)}</category>`;if(J.guid)Y+=`
15470
- <guid>${w1(J.guid)}</guid>`;return Y+=`
15470
+ <author>${W1(J.author)}</author>`;if(J.categories)for(let G of J.categories)Y+=`
15471
+ <category>${W1(G)}</category>`;if(J.guid)Y+=`
15472
+ <guid>${W1(J.guid)}</guid>`;return Y+=`
15471
15473
  </item>`,Y});return`<?xml version="1.0" encoding="UTF-8"?>
15472
15474
  <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
15473
15475
  <channel>
15474
- <title>${w1($.title)}</title>
15475
- <link>${w1($.link)}</link>
15476
- <description>${w1($.description)}</description>
15476
+ <title>${W1($.title)}</title>
15477
+ <link>${W1($.link)}</link>
15478
+ <description>${W1($.description)}</description>
15477
15479
  ${$.language?`<language>${$.language}</language>`:""}
15478
- ${$.copyright?`<copyright>${w1($.copyright)}</copyright>`:""}
15480
+ ${$.copyright?`<copyright>${W1($.copyright)}</copyright>`:""}
15479
15481
  <lastBuildDate>${new Date().toUTCString()}</lastBuildDate>
15480
15482
  <atom:link href="${$.link}/rss.xml" rel="self" type="application/rss+xml"/>
15481
15483
  ${Z.join(`
15482
15484
  `)}
15483
15485
  </channel>
15484
- </rss>`}async function wF($={}){let X=Date.now();qX();let Z=await Z1(),J=await hq({explicit:$.domain,stxConfig:Z});if(J.source==="fallback"&&($.sitemap??!0))console.warn(uq());let Y={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:J.url,revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,sitemapExclude:$.sitemapExclude||[],robots:$.robots??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||H1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,partialsDir:$.partialsDir||Z?.partialsDir||"",componentsDir:$.componentsDir||Z?.componentsDir||"",failOnIncludeError:$.failOnIncludeError??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},G={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,w=0,q={},W={};await Y.hooks.onBuildStart?.();try{if(Y.cleanOutput&&R0.existsSync(Y.outputDir))await R0.promises.rm(Y.outputDir,{recursive:!0});await R0.promises.mkdir(Y.outputDir,{recursive:!0});let z=new dq(Y.cacheDir);if(Y.cache)await z.load();try{let{generateCrosswindCSS:N}=await Promise.resolve().then(() => (r$(),dY));await N('<div class="bg-black"></div>')}catch{}K7();let U=Z?.routeMiddleware?.dir||"middleware";await U7(process.cwd(),U);let B=z7();if(B.length>0)console.log(`Loaded ${B.length} middleware: ${B.join(", ")}`);let j=Z?.routeMiddleware?.global||[];fq(Z?.layoutsDir,H1(process.cwd()));let _=L7(".",{pagesDir:Y.pagesDir});console.log(`Found ${_.length} routes`);let H=[];for(let N of _){let M=await tL(N);for(let k of M)H.push({route:N,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??Y.revalidate})}G.totalPages=H.length,console.log(`Generating ${G.totalPages} pages...`);let L=[],O=[];for(let N=0;N<H.length;N+=Y.concurrency)O.push(H.slice(N,N+Y.concurrency));for(let N of O)await Promise.all(N.map(async(M)=>{let{route:k,url:T,params:D,props:I,revalidate:S}=M;try{await Y.hooks.onPageStart?.(T);let b=await Bun.file(k.filePath).text(),E=zF(b),v=E?.middleware?Array.isArray(E.middleware)?E.middleware:[E.middleware]:[],x=[...j,...v];if(x.length>0){let j0=j7(T,D,E||{}),Z0=B7(j0,null,void 0,{isServer:!0}),l=await _7(x,Z0);if(l.redirect){let J0=typeof l.redirect==="string"?l.redirect:l.redirect.path||l.redirect,D0=UF(String(J0),T),v0=jF(T,Y);await R0.promises.mkdir(Y0.dirname(v0),{recursive:!0}),await Bun.write(v0,D0),G.successCount++,G.pages.push({route:T,outputPath:v0,size:Buffer.byteLength(D0),cached:!1}),L.push({loc:T,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${T} \u2192 redirect to ${J0}`);return}if(l.abort){let J0=typeof l.abort==="string"?l.abort:l.abort?.error?.message||"aborted";console.warn(` \u21B3 ${T} \u2014 middleware aborted: ${J0}`);return}}let f=b.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(f)try{if(!await Function("route",`
15486
+ </rss>`}async function KF($={}){let X=Date.now();UX();let Z=await Y1(),J=await cq({explicit:$.domain,stxConfig:Z});if(J.source==="fallback"&&($.sitemap??!0))console.warn(lq());let Y={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:J.url,revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,sitemapExclude:$.sitemapExclude||[],robots:$.robots??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||F1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,partialsDir:$.partialsDir||Z?.partialsDir||"",componentsDir:$.componentsDir||Z?.componentsDir||"",failOnIncludeError:$.failOnIncludeError??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},G={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,w=0,q={},W={};await Y.hooks.onBuildStart?.();try{if(Y.cleanOutput&&T0.existsSync(Y.outputDir))await T0.promises.rm(Y.outputDir,{recursive:!0});await T0.promises.mkdir(Y.outputDir,{recursive:!0});let z=new pq(Y.cacheDir);if(Y.cache)await z.load();try{let{generateCrosswindCSS:N}=await Promise.resolve().then(() => (t$(),pY));await N('<div class="bg-black"></div>')}catch{}B7();let U=Z?.routeMiddleware?.dir||"middleware";await H7(process.cwd(),U);let B=_7();if(B.length>0)console.log(`Loaded ${B.length} middleware: ${B.join(", ")}`);let j=Z?.routeMiddleware?.global||[];dq(Z?.layoutsDir,F1(process.cwd()));let _=R7(".",{pagesDir:Y.pagesDir});console.log(`Found ${_.length} routes`);let H=[];for(let N of _){let T=await XF(N);for(let k of T)H.push({route:N,url:k.url,params:k.params,props:k.props,revalidate:k.revalidate??Y.revalidate})}G.totalPages=H.length,console.log(`Generating ${G.totalPages} pages...`);let L=[],O=[];for(let N=0;N<H.length;N+=Y.concurrency)O.push(H.slice(N,N+Y.concurrency));for(let N of O)await Promise.all(N.map(async(T)=>{let{route:k,url:M,params:E,props:I,revalidate:S}=T;try{await Y.hooks.onPageStart?.(M);let b=await Bun.file(k.filePath).text(),y=BF(b),P=y?.middleware?Array.isArray(y.middleware)?y.middleware:[y.middleware]:[],x=[...j,...P];if(x.length>0){let z0=O7(M,E,y||{}),k0=L7(z0,null,void 0,{isServer:!0}),d=await F7(x,k0);if(d.redirect){let Y0=typeof d.redirect==="string"?d.redirect:d.redirect.path||d.redirect,Q0=_F(String(Y0),M),d0=HF(M,Y);await T0.promises.mkdir(G0.dirname(d0),{recursive:!0}),await Bun.write(d0,Q0),G.successCount++,G.pages.push({route:M,outputPath:d0,size:Buffer.byteLength(Q0),cached:!1}),L.push({loc:M,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${M} \u2192 redirect to ${Y0}`);return}if(d.abort){let Y0=typeof d.abort==="string"?d.abort:d.abort?.error?.message||"aborted";console.warn(` \u21B3 ${M} \u2014 middleware aborted: ${Y0}`);return}}let f=b.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(f)try{if(!await Function("route",`
15485
15487
  const validate = ${f[1]};
15486
15488
  return validate(route);
15487
- `)({params:D})){console.warn(`Validation failed for ${T}, skipping...`);return}}catch{}let h=null,p=!1;if(Y.cache){if(h=z.get(T,k.filePath),h)p=!0,G.cachedCount++}if(!h){let j0=await cq(k,D,I,Y,Z);if(h=j0.html,Y.failOnIncludeError&&j0.includeFailures.length>0)throw Error(`${j0.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
15488
- ${j0.includeFailures.join(`
15489
+ `)({params:E})){console.warn(`Validation failed for ${M}, skipping...`);return}}catch{}let u=null,l=!1;if(Y.cache){if(u=z.get(M,k.filePath),u)l=!0,G.cachedCount++}if(!u){let z0=await nq(k,E,I,Y,Z);if(u=z0.html,Y.failOnIncludeError&&z0.includeFailures.length>0)throw Error(`${z0.includeFailures.length} include(s) failed to resolve, so this page would have shipped with an error banner where the markup should be:
15490
+ ${z0.includeFailures.join(`
15489
15491
  `)}
15490
- Set ssg.failOnIncludeError to false to build anyway.`);if(Y.cache)z.set(T,k.filePath,j0.dependencies,h)}let H0;if(Y.trailingSlash)H0=Y0.join(Y.outputDir,T,"index.html");else H0=T==="/"?Y0.join(Y.outputDir,"index.html"):Y0.join(Y.outputDir,`${T}.html`);if(Y.chunkIslands){let{html:j0,chunks:Z0}=vq(h,{integrity:Y.integrityIslands,minify:Y.minify});if(Z0.length>0){let l=Y0.join(Y.outputDir,"_stx","islands");await R0.promises.mkdir(l,{recursive:!0});for(let J0 of Z0){let D0=Y0.join(l,`${J0.hash}.js`);if(!await Bun.file(D0).exists())await Bun.write(D0,J0.code);if(!Q.has(J0.hash)){Q.add(J0.hash);let v0=Buffer.byteLength(J0.code,"utf8");w+=v0,q[J0.hash]={bytes:v0,file:`/_stx/islands/${J0.hash}.js`}}}if(W[T]=Z0.map((J0)=>J0.hash),h=j0,Y.prefetchIslands)h=xq(h)}}if(await R0.promises.mkdir(Y0.dirname(H0),{recursive:!0}),await Bun.write(H0,h),!YF(T,h,E,Y.sitemapExclude))L.push({loc:T,lastmod:new Date().toISOString().split("T")[0],priority:T==="/"?1:0.8});let M0={route:T,outputPath:H0,size:Buffer.byteLength(h,"utf8"),cached:p};if(S!==!1)M0.revalidateAt=Date.now()+S*1000;G.pages.push(M0),G.successCount++,await Y.hooks.onPageEnd?.(T,h)}catch(b){G.failedCount++,G.errors.push({route:T,error:b}),await Y.hooks.onError?.(b,T),console.error(`Error generating ${T}:`,b)}}));let F=wX();if(F.length>0){let N=F.map((M)=>`${M.filePath}: ${M.message}`).join(`
15492
+ Set ssg.failOnIncludeError to false to build anyway.`);if(Y.cache)z.set(M,k.filePath,z0.dependencies,u)}let H0;if(Y.trailingSlash)H0=G0.join(Y.outputDir,M,"index.html");else H0=M==="/"?G0.join(Y.outputDir,"index.html"):G0.join(Y.outputDir,`${M}.html`);if(Y.chunkIslands){let{html:z0,chunks:k0}=hq(u,{integrity:Y.integrityIslands,minify:Y.minify});if(k0.length>0){let d=G0.join(Y.outputDir,"_stx","islands");await T0.promises.mkdir(d,{recursive:!0});for(let Y0 of k0){let Q0=G0.join(d,`${Y0.hash}.js`);if(!await Bun.file(Q0).exists())await Bun.write(Q0,Y0.code);if(!Q.has(Y0.hash)){Q.add(Y0.hash);let d0=Buffer.byteLength(Y0.code,"utf8");w+=d0,q[Y0.hash]={bytes:d0,file:`/_stx/islands/${Y0.hash}.js`}}}if(W[M]=k0.map((Y0)=>Y0.hash),u=z0,Y.prefetchIslands)u=uq(u)}}if(await T0.promises.mkdir(G0.dirname(H0),{recursive:!0}),await Bun.write(H0,u),!wF(M,u,y,Y.sitemapExclude))L.push({loc:M,lastmod:new Date().toISOString().split("T")[0],priority:M==="/"?1:0.8});let S0={route:M,outputPath:H0,size:Buffer.byteLength(u,"utf8"),cached:l};if(S!==!1)S0.revalidateAt=Date.now()+S*1000;G.pages.push(S0),G.successCount++,await Y.hooks.onPageEnd?.(M,u)}catch(b){G.failedCount++,G.errors.push({route:M,error:b}),await Y.hooks.onError?.(b,M),console.error(`Error generating ${M}:`,b)}}));let F=zX();if(F.length>0){let N=F.map((T)=>`${T.filePath}: ${T.message}`).join(`
15491
15493
  `);throw Error(`Client script bundling failed:
15492
- ${N}`)}if(Y.cache)await z.save();if(Y.generate404){let N=Y0.join(Y.pagesDir,"404.stx");if(await Bun.file(N).exists()){let M=new Set,k={...Z,debug:!1,cache:!1},T=await F0(await Bun.file(N).text(),{},N,k,M);await Bun.write(Y0.join(Y.outputDir,"404.html"),T)}else await Bun.write(Y0.join(Y.outputDir,"404.html"),`<!DOCTYPE html>
15494
+ ${N}`)}if(Y.cache)await z.save();if(Y.generate404){let N=G0.join(Y.pagesDir,"404.stx");if(await Bun.file(N).exists()){let T=new Set,k={...Z,debug:!1,cache:!1},M=await R0(await Bun.file(N).text(),{},N,k,T);await Bun.write(G0.join(Y.outputDir,"404.html"),M)}else await Bun.write(G0.join(Y.outputDir,"404.html"),`<!DOCTYPE html>
15493
15495
  <html lang="en">
15494
15496
  <head>
15495
15497
  <meta charset="UTF-8">
@@ -15510,7 +15512,7 @@ ${N}`)}if(Y.cache)await z.save();if(Y.generate404){let N=Y0.join(Y.pagesDir,"404
15510
15512
  <a href="/">Go home</a>
15511
15513
  </div>
15512
15514
  </body>
15513
- </html>`)}for(let N of[500]){let M=Y0.join(Y.pagesDir,`${N}.stx`);if(await Bun.file(M).exists()){let k=new Set,T={...Z,debug:!1,cache:!1},D=await F0(await Bun.file(M).text(),{},M,T,k);await Bun.write(Y0.join(Y.outputDir,`${N}.html`),D)}}let V=Y0.join(Y.pagesDir,"error.stx");if(await Bun.file(V).exists()){let N=new Set,M={...Z,debug:!1,cache:!1},k=await F0(await Bun.file(V).text(),{},V,M,N);await Bun.write(Y0.join(Y.outputDir,"error.html"),k)}if(Y.sitemap&&L.length>0){let N=GF(L,Y.domain),M=Y0.join(Y.outputDir,"sitemap.xml");await Bun.write(M,N),G.sitemapPath=M,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(Y.robots!==!1){let N=typeof Y.robots==="object"?Y.robots:{},M=[...Y.sitemapExclude.filter((T)=>typeof T==="string"),...N.disallow||[]],k=IY({rules:[{userAgent:N.userAgent||"*",allow:N.allow||["/"],...M.length>0?{disallow:M}:{}}],...N.sitemap!==!1&&G.sitemapPath?{sitemap:new URL("/sitemap.xml",Y.domain).href}:{}});await Bun.write(Y0.join(Y.outputDir,"robots.txt"),k),console.log("Generated robots.txt")}if(Y.rss){let N=typeof Y.rss==="object"?Y.rss:{title:"Site Feed",description:"Latest updates",link:Y.domain},M=[];if(N.getItems)M=await N.getItems();let k=QF(N,M),T=Y0.join(Y.outputDir,"rss.xml");await Bun.write(T,k),G.rssPath=T,console.log(`Generated rss.xml with ${M.length} items`)}let A=A6(Y.outputDir);if(A.assets>0)console.log(`Externalized ${A.assets} asset(s) from ${A.pages} page(s) (${(A.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(Y.publicDir&&R0.existsSync(Y.publicDir))await _6(Y.publicDir,Y.outputDir),console.log(`Copied public assets from ${Y.publicDir}`);let R=F6();if(R)await _6(R,Y0.join(Y.outputDir,L6)),console.log(`Copied assets from ${N9}`)}catch(z){throw await Y.hooks.onError?.(z),z}if(G.buildTime=Date.now()-X,Q.size>0){G.islandChunks={count:Q.size,totalBytes:w};let z={generatedChunks:Q.size,totalBytes:w,chunks:q,pages:W};await Bun.write(Y0.join(Y.outputDir,"_stx","islands-manifest.json"),JSON.stringify(z,null,2))}await Y.hooks.onBuildEnd?.(G);let K=G.islandChunks?`
15515
+ </html>`)}for(let N of[500]){let T=G0.join(Y.pagesDir,`${N}.stx`);if(await Bun.file(T).exists()){let k=new Set,M={...Z,debug:!1,cache:!1},E=await R0(await Bun.file(T).text(),{},T,M,k);await Bun.write(G0.join(Y.outputDir,`${N}.html`),E)}}let V=G0.join(Y.pagesDir,"error.stx");if(await Bun.file(V).exists()){let N=new Set,T={...Z,debug:!1,cache:!1},k=await R0(await Bun.file(V).text(),{},V,T,N);await Bun.write(G0.join(Y.outputDir,"error.html"),k)}if(Y.sitemap&&L.length>0){let N=qF(L,Y.domain),T=G0.join(Y.outputDir,"sitemap.xml");await Bun.write(T,N),G.sitemapPath=T,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(Y.robots!==!1){let N=typeof Y.robots==="object"?Y.robots:{},T=[...Y.sitemapExclude.filter((M)=>typeof M==="string"),...N.disallow||[]],k=bY({rules:[{userAgent:N.userAgent||"*",allow:N.allow||["/"],...T.length>0?{disallow:T}:{}}],...N.sitemap!==!1&&G.sitemapPath?{sitemap:new URL("/sitemap.xml",Y.domain).href}:{}});await Bun.write(G0.join(Y.outputDir,"robots.txt"),k),console.log("Generated robots.txt")}if(Y.rss){let N=typeof Y.rss==="object"?Y.rss:{title:"Site Feed",description:"Latest updates",link:Y.domain},T=[];if(N.getItems)T=await N.getItems();let k=WF(N,T),M=G0.join(Y.outputDir,"rss.xml");await Bun.write(M,k),G.rssPath=M,console.log(`Generated rss.xml with ${T.length} items`)}let A=M6(Y.outputDir);if(A.assets>0)console.log(`Externalized ${A.assets} asset(s) from ${A.pages} page(s) (${(A.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(Y.publicDir&&T0.existsSync(Y.publicDir))await F6(Y.publicDir,Y.outputDir),console.log(`Copied public assets from ${Y.publicDir}`);let R=N6();if(R)await F6(R,G0.join(Y.outputDir,R6)),console.log(`Copied assets from ${I9}`)}catch(z){throw await Y.hooks.onError?.(z),z}if(G.buildTime=Date.now()-X,Q.size>0){G.islandChunks={count:Q.size,totalBytes:w};let z={generatedChunks:Q.size,totalBytes:w,chunks:q,pages:W};await Bun.write(G0.join(Y.outputDir,"_stx","islands-manifest.json"),JSON.stringify(z,null,2))}await Y.hooks.onBuildEnd?.(G);let K=G.islandChunks?`
15514
15516
  Island chunks: ${G.islandChunks.count} (${(G.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
15515
15517
  Build complete!
15516
15518
  Total: ${G.totalPages} pages
@@ -15518,8 +15520,8 @@ Build complete!
15518
15520
  Cached: ${G.cachedCount}
15519
15521
  Failed: ${G.failedCount}
15520
15522
  Time: ${G.buildTime}ms${K}
15521
- `),G}async function _6($,X){await R0.promises.mkdir(X,{recursive:!0});let Z=await R0.promises.readdir($,{withFileTypes:!0});for(let J of Z){let Y=Y0.join($,J.name),G=Y0.join(X,J.name);if(J.isDirectory())await R0.promises.mkdir(G,{recursive:!0}),await _6(Y,G);else await R0.promises.copyFile(Y,G)}}function qF($={}){let X=$.cacheDir||H1(process.cwd(),"ssg-cache"),Z=new mq(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=L7(".",{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),q={};if(w)Q.params.forEach((z,U)=>{q[z]=w[U+1]});let W=await Z1(),{html:K}=await cq(Q,q,{},$,W);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 WF($){return async()=>{return{paths:await $(),fallback:!1}}}function KF(){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 W=Z[1];Y=X.slice(Z[0].length).trim();for(let K of W.split(`
15522
- `)){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,q;while((q=w.exec(G))!==null){let W=parseInt(q[1],10),K=q[2],z=K.toLowerCase().replace(/[^a-z0-9]+/g,"-");Q.push({id:z,text:K,level:W})}return{content:G,data:J,toc:Q}}}}function zF($){return o$($)}function UF($,X){return`<!DOCTYPE html>
15523
+ `),G}async function F6($,X){await T0.promises.mkdir(X,{recursive:!0});let Z=await T0.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 T0.promises.mkdir(G,{recursive:!0}),await F6(Y,G);else await T0.promises.copyFile(Y,G)}}function zF($={}){let X=$.cacheDir||F1(process.cwd(),"ssg-cache"),Z=new iq(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=R7(".",{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),q={};if(w)Q.params.forEach((z,U)=>{q[z]=w[U+1]});let W=await Y1(),{html:K}=await nq(Q,q,{},$,W);await Z.set(Y,{html:K,generatedAt:Date.now(),revalidateAfter:Date.now()+J*1000,etag:QF(K)}),console.log(`Revalidated: ${Y}`)},async invalidate(Y){if(typeof Y==="string")await Z.invalidate(Y);else await Z.invalidatePattern(Y)}}}function UF($){return async()=>{return{paths:await $(),fallback:!1}}}function jF(){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 W=Z[1];Y=X.slice(Z[0].length).trim();for(let K of W.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,q;while((q=w.exec(G))!==null){let W=parseInt(q[1],10),K=q[2],z=K.toLowerCase().replace(/[^a-z0-9]+/g,"-");Q.push({id:z,text:K,level:W})}return{content:G,data:J,toc:Q}}}}function BF($){return e$($)}function _F($,X){return`<!DOCTYPE html>
15523
15525
  <html>
15524
15526
  <head>
15525
15527
  <meta charset="utf-8">
@@ -15531,4 +15533,4 @@ Build complete!
15531
15533
  <p>Redirecting to <a href="${$}">${$}</a>...</p>
15532
15534
  <script>window.location.replace('${$}')</script>
15533
15535
  </body>
15534
- </html>`}function jF($,X){if($==="/"||$==="")return Y0.join(X.outputDir,"index.html");let Z=$.replace(/^\/|\/$/g,"");if(X.trailingSlash)return Y0.join(X.outputDir,Z,"index.html");return Y0.join(X.outputDir,`${Z}.html`)}var zy={generateStaticSite:wF,createISRHandler:qF,defineStaticPaths:WF,createMarkdownLoader:KF};export{YF as isExcludedFromSitemap,wF as generateStaticSite,WF as defineStaticPaths,zy as default,XF as declaresPageAction,KF as createMarkdownLoader,qF as createISRHandler};
15536
+ </html>`}function HF($,X){if($==="/"||$==="")return G0.join(X.outputDir,"index.html");let Z=$.replace(/^\/|\/$/g,"");if(X.trailingSlash)return G0.join(X.outputDir,Z,"index.html");return G0.join(X.outputDir,`${Z}.html`)}var Fy={generateStaticSite:KF,createISRHandler:zF,defineStaticPaths:UF,createMarkdownLoader:jF};export{wF as isExcludedFromSitemap,KF as generateStaticSite,UF as defineStaticPaths,Fy as default,YF as declaresPageAction,jF as createMarkdownLoader,zF as createISRHandler};