@stacksjs/stx 0.2.162 → 0.2.163
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/cli.js +720 -720
- package/dist/craft.js +273 -273
- package/dist/pwa.js +265 -265
- package/dist/ssg.js +254 -254
- package/dist/variable-extractor.d.ts +22 -0
- package/dist/variable-extractor.js +62 -3
- package/package.json +5 -5
package/dist/ssg.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
var
|
|
2
|
+
var Oq=Object.defineProperty;var Lq=($)=>$;function Fq($,X){this[$]=Lq.bind(null,X)}var a=($,X)=>{for(var Z in X)Oq($,Z,{get:X[Z],enumerable:!0,configurable:!0,set:Fq.bind(X,Z)})};var y=($,X)=>()=>($&&(X=$($=0)),X);var j0=import.meta.require;function F9($){return $.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>a5.includes(Z))}function t5($){return F9($.replace(/^\//,""))}var a5;var W8=y(()=>{a5=["components","layouts","partials"]});import H5 from"fs";import e5 from"path";function $7($,X){let Z=$.filter((Q)=>!t5(Q.pattern)),Y=["// Auto-generated by STX - do not edit"];if(Z.length===0)Y.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{Y.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let Q of Z){let w=[];for(let W of Q.params){let K=Q.pattern.includes(`:${W}?`)?"?":"";w.push(`${W}${K}: string`)}let q=w.join("; ");Y.push(` '${Q.pattern}': { ${q} }`)}Y.push(" }","}","","export {}","")}let J=Y.join(`
|
|
3
3
|
`),G=e5.join(X,"route-types.d.ts");try{if(H5.existsSync(G)&&H5.readFileSync(G,"utf8")===J)return;H5.mkdirSync(X,{recursive:!0}),H5.writeFileSync(G,J)}catch{}}function X7($,X,Z){let Y=process.cwd(),J=e5.relative(Y,Z),G=$.filter((w)=>!t5(w.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${J||"pages"}/`,"","export const routes = ["];for(let w of G){let q=e5.relative(Y,w.filePath).replace(/\\/g,"/"),W=JSON.stringify(w.params),K=w.layout?`, layout: '${e5.relative(Y,w.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${w.pattern}', filePath: '${q}', isDynamic: ${w.isDynamic}, params: ${W}${K} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),H5.mkdirSync(X,{recursive:!0}),H5.writeFileSync(e5.join(X,"routes.ts"),Q.join(`
|
|
4
|
-
`))}var V9=y(()=>{W8()});import
|
|
4
|
+
`))}var V9=y(()=>{W8()});import Z2 from"path";function K8($,X){let Y=Z2.relative(X,$).replace(/\.(stx|md)$/,"");if(Y=Y.split(Z2.sep).join("/"),Y==="index")return"/";if(Y.endsWith("/index"))Y=Y.slice(0,-6);return Y=Y.replace(/\[\[([^\]]+)\]\]/g,":$1?"),Y=Y.replace(/\[([^\]]+)\]/g,":$1"),Y=Y.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${Y}`}function Z7($){let X=[],Z="",Y=0;while(Y<$.length){let J=$.slice(Y),G=/^\/:([^/?*]+)\?/.exec(J);if(G){X.push(G[1]),Z+="(?:/([^/]+))?",Y+=G[0].length;continue}let Q=/^:([^/?*]+)\*/.exec(J);if(Q){X.push(Q[1]),Z+="(.+)",Y+=Q[0].length;continue}let w=/^:([^/?*]+)/.exec(J);if(w){X.push(w[1]),Z+="([^/]+)",Y+=w[0].length;continue}Z+=$[Y].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),Y+=1}return{regex:new RegExp(`^${Z}$`),params:X}}function z8($,X){let Z=$===""?"/":$;for(let Y of X){let J=Z.match(Y.regex);if(J){let G={};return Y.params.forEach((Q,w)=>{G[Q]=J[w+1]}),{route:Y,params:G}}}return null}function Y2($){let X=$.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return Z7(X)}var A9=()=>{};import Mq from"fs";import R9 from"path";function U8($,X){let Z=[],Y=R9.dirname($);while(Y.startsWith(X)||Y===X){let J=R9.join(Y,"_layout.stx");if(Mq.existsSync(J))Z.unshift(J);if(Y===X)break;Y=R9.dirname(Y)}return Z}var N9=()=>{};import T9 from"fs";import O5 from"path";function J2($,X){let Z=[];if(!T9.existsSync($))return Z;let Y=T9.readdirSync($,{withFileTypes:!0});for(let J of Y){let G=O5.join($,J.name);if(J.isDirectory()){if(J.name.startsWith("."))continue;if(a5.includes(J.name))continue;Z.push(...J2(G,X))}else if(J.isFile()){let Q=O5.extname(J.name);if(X.includes(Q)){if(J.name.startsWith("_")&&J.name!=="_layout.stx")continue;if(J.name==="_layout.stx")continue;Z.push(G)}}}return Z}class L5{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)=>O5.resolve($,Q)),this.pagesDir=this.pagesDirs[0];let Y=X.extensions||[".stx"],J=new Set;this.routes=[];for(let Q of this.pagesDirs){let w=J2(Q,Y);for(let q of w){let W=K8(q,Q);if(J.has(W))continue;J.add(W);let{regex:K,params:z}=Z7(W),U=X.layouts!==!1?U8(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=O5.resolve($,X.stateDir||process.env.STX_DIR?.trim()||".stx");$7(this.routes,G),X7(this.routes,G,this.pagesDir)}match($){let X=$===""?"/":$;for(let Z of this.routes){let Y=X.match(Z.regex);if(Y){let J={};return Z.params.forEach((G,Q)=>{J[G]=Y[Q+1]}),{route:Z,params:J}}}return null}resolve($,X){let Z=this.routes.find((J)=>J.pattern===$||J.filePath.includes($));if(!Z)return"#not-found";let Y=Z.pattern;if(X)for(let[J,G]of Object.entries(X))Y=Y.replace(`:${J}`,encodeURIComponent(G));return Y}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 G2($,X){return new L5($,X)}function M9($,X){let Z=[`${X}.stx`,"error.stx"];for(let Y of Z){let J=O5.join($,Y);if(T9.existsSync(J))return J}return null}function k9($,X){return $.map((Z)=>{let Y=O5.relative(X,Z.filePath),J=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${Y}${J}`})}var Q2=y(()=>{V9();A9();N9();W8()});function I9($){j8=$.replace(/\/$/,"")}function E9($,X,Z={}){F5[$]={path:X,name:$,params:Z}}function D9($){for(let[X,Z]of Object.entries($))if(typeof Z==="string")F5[X]={path:Z,name:X};else F5[X]={...Z,name:X}}function Y7($,X={},Z=!1){let Y=F5[$];if(!Y)return console.warn(`Route [${$}] not defined.`),"#undefined-route";let J={...Y.params,...X},G=Y.path;G=G.replace(/:(\w+)/g,(w,q)=>{let W=J[q];if(W===void 0)return console.warn(`Missing parameter [${q}] for route [${$}].`),`:${q}`;return delete J[q],encodeURIComponent(String(W))});let Q=Object.entries(J);if(Q.length>0){let w=Q.map(([q,W])=>`${encodeURIComponent(q)}=${encodeURIComponent(String(W))}`).join("&");G+=(G.includes("?")?"&":"?")+w}return Z&&j8?`${j8}${G}`:G}function y9(){for(let $ of Object.keys(F5))delete F5[$];j8=""}var F5,j8="";var w2=y(()=>{F5={}});import q2 from"fs";import W2 from"path";function S9($,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 P9($,X={}){return{handler:$,mode:X.mode??"universal"}}function b9($){let X={};if(!$)return X;let Z=$.split(";");for(let Y of Z){let[J,...G]=Y.split("=");if(J){let Q=J.trim(),w=G.join("=").trim();if(Q)X[Q]=decodeURIComponent(w)}}return X}function B8($,X,Z={}){let Y=`${encodeURIComponent($)}=${encodeURIComponent(X)}`;if(Z.expires){let J=typeof Z.expires==="number"?new Date(Date.now()+Z.expires*1000):Z.expires;Y+=`; Expires=${J.toUTCString()}`}if(Z.path)Y+=`; Path=${Z.path}`;if(Z.domain)Y+=`; Domain=${Z.domain}`;if(Z.secure)Y+="; Secure";if(Z.httpOnly)Y+="; HttpOnly";if(Z.sameSite)Y+=`; SameSite=${Z.sameSite}`;return Y}function _8($,X){let Z=$.headers.get("cookie")||"",Y=b9(Z);return{get(J){return Y[J]},set(J,G,Q={}){Y[J]=G,X.append("Set-Cookie",B8(J,G,Q))},delete(J){delete Y[J],X.append("Set-Cookie",B8(J,"",{expires:new Date(0),path:"/"}))},getAll(){return{...Y}}}}function H8(){return{get($){if(typeof document>"u")return;return b9(document.cookie)[$]},set($,X,Z={}){if(typeof document>"u")return;document.cookie=B8($,X,Z)},delete($){if(typeof document>"u")return;document.cookie=B8($,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return b9(document.cookie)}}}function O8(){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 J7($,X){G7.set($,X)}function L8($){return G7.get($)}function v9($){return G7.has($)}function Q7(){G7.clear()}function w7(){return Array.from(G7.keys())}async function q7($,X="middleware"){let Z=W2.resolve($,X);if(!q2.existsSync(Z))return;let Y=q2.readdirSync(Z);for(let J of Y){if(!J.endsWith(".ts")&&!J.endsWith(".js"))continue;if(J.includes(".test.")||J.includes(".spec."))continue;let G=J.replace(/\.(ts|js)$/,""),Q=W2.join(Z,J);try{let q=(await import(Q)).default;if(q&&typeof q.handler==="function")J7(G,q);else if(typeof q==="function")J7(G,{handler:q,mode:"universal"})}catch(w){console.warn(`Failed to load middleware '${G}' from ${Q}:`,w)}}}function kq($){let X={};if(!$)return X;let Z=new URLSearchParams($);for(let[Y,J]of Z)X[Y]=J;return X}function W7($,X,Z,Y=""){return{path:$,params:X,query:kq(Y),fullPath:Y?`${$}?${Y}`:$,meta:Z}}function K7($,X,Z,Y){let J=Y?.isServer??typeof window>"u",G=!J,Q=new Headers;return{to:$,from:X,isClient:G,isServer:J,cookies:J&&Z?_8(Z,Q):H8(),storage:O8(),state:{},request:Z,responseHeaders:Q}}async function z7($,X){let Z=Array.isArray($)?$:[$],Y=X.isServer;for(let J of Z){let G=L8(J);if(!G)return console.error(`Route middleware '${J}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${J}' is not registered`}},state:X.state,responseHeaders:X.responseHeaders};if(G.mode==="server"&&!Y)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 '${J}':`,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 G7;var K2=y(()=>{G7=new Map});function U7($){let Z=$.replace(/\\/g,"/").split("/").filter(Boolean),Y=Z.lastIndexOf("layouts"),J=Y>=0?Z[Y+1]:Z.at(-1);if(!J)return"app";return J.replace(/\.stx$/i,"")||"app"}function z2($){let X=$.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),Z=$.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),Y=$.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),J=X?.[1]||Y?.[1]||"";return{layout:J,group:Z?.[1]||U7(J)}}function Iq($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function j7(){if(F8)return F8;return F8=Iq(`
|
|
5
5
|
;(function(){
|
|
6
6
|
'use strict';
|
|
7
7
|
var ROUTER_REV=7;
|
|
@@ -1651,7 +1651,7 @@ else {
|
|
|
1651
1651
|
|
|
1652
1652
|
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
|
|
1653
1653
|
})();
|
|
1654
|
-
`),F8}var F8;var
|
|
1654
|
+
`),F8}var F8;var U2={};a(U2,{setAppUrl:()=>I9,runMiddleware:()=>z7,route:()=>Y7,resolveLayoutChain:()=>U8,resetRoutes:()=>y9,registerMiddleware:()=>J7,patternToRegex:()=>Z7,navigateTo:()=>S9,matchRoute:()=>z8,loadMiddlewareFromDirectory:()=>q7,isNonPageRoutePattern:()=>t5,isNonPageRoutePath:()=>F9,hasMiddleware:()=>v9,getRouterScript:()=>j7,getMiddlewareNames:()=>w7,getMiddleware:()=>L8,generateRouteTypes:()=>$7,generateRouteManifest:()=>X7,formatRoutes:()=>k9,findErrorPage:()=>M9,filePathToPattern:()=>K8,extractLayoutMetadata:()=>z2,deriveLayoutGroup:()=>U7,defineRoutes:()=>D9,defineRoute:()=>E9,defineMiddleware:()=>P9,createStorageManager:()=>O8,createServerCookieManager:()=>_8,createRouter:()=>G2,createRouteLocation:()=>W7,createMiddlewareContext:()=>K7,createClientCookieManager:()=>H8,clearMiddleware:()=>Q7,bracketPathToRegex:()=>Y2,abortNavigation:()=>C9,Router:()=>L5,NON_PAGE_DIRS:()=>a5});var k1=y(()=>{Q2();A9();w2();K2();N9();V9();W8()});function B7($,X={}){return new L5($,X).routes}var x9=y(()=>{k1();k1()});function j2($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function f9($,X){let Z={...$};for(let[Y,J]of Object.entries(X))Z[Y]=j2(J)&&j2(Z[Y])?f9(Z[Y],J):J;return Z}function B2($={},X={}){let Z=$.theme||{},Y=X.theme||{},{extend:J,...G}=Y,{extend:Q,...w}=Z,q=f9(w,G),W=f9(Q||{},J||{});if(Object.keys(W).length>0)q.extend=W;let K=[...$.safelist||[],...X.safelist||[]],z={...$.shortcuts||{},...X.shortcuts||{}},U=[...$.preflights||[],...X.preflights||[]];return{config:{...$,...X,theme:q,safelist:K,shortcuts:z,...U.length>0?{preflights:U}:{},content:[],output:""},safelist:K,shortcuts:z,includePreflight:X.preflight!==!1,minify:X.minify===!0}}import _7 from"path";function H2($){_2=$?.trim()||null}function H7(){return process.env[Eq]?.trim()||_2||V5}function _1($=process.cwd(),...X){let Z=H7();return _7.isAbsolute(Z)?_7.join(Z,...X):_7.join($,Z,...X)}function O7($){if(!$||_7.isAbsolute($))return $;let X=$.replace(/\\/g,"/");if(X!==V5&&!X.startsWith(`${V5}/`))return $;let Z=X.slice(V5.length+1);return Z?_7.join(H7(),Z):H7()}var V5=".stx",Eq="STX_DIR",_2=null;var L7=()=>{};var H0;var O2=y(()=>{H0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function L2($,X,Z,Y){let J=$;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,w,q)=>{let K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[w]||"Make this element accessible";return`<!-- a11y-hint: ${q||K} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(G,(Q,w)=>{return`<span class="sr-only">${w.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,w,q)=>{return`<span id="${`desc-${w}`}" class="sr-only">${q}</span>`}),J}var F2,V2;var g9=y(()=>{F2={name:"a11y",handler:($,X,Z,Y)=>{if(!X.length)return $;let J=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"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${G||w} -->${$}`},hasEndTag:!1},V2={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function Dq($,X={}){let{duration:Z,delay:Y,ease:J,direction:G,custom:Q}={...H1,...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);"}
|
|
1655
1655
|
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
|
|
1656
1656
|
@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);"}
|
|
1657
1657
|
@keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
|
|
@@ -1661,7 +1661,7 @@ else {
|
|
|
1661
1661
|
@keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
|
|
1662
1662
|
@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);"}
|
|
1663
1663
|
@keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
|
|
1664
|
-
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function
|
|
1664
|
+
@keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function yq(){return`
|
|
1665
1665
|
<script data-stx-scoped data-stx-run="once">
|
|
1666
1666
|
// Motion preferences handling
|
|
1667
1667
|
(function() {
|
|
@@ -1689,7 +1689,7 @@ else {
|
|
|
1689
1689
|
});
|
|
1690
1690
|
})();
|
|
1691
1691
|
</script>
|
|
1692
|
-
`}function
|
|
1692
|
+
`}function bq($){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Z)=>Z.test($))}function Sq($=0.1,X="0px"){return`
|
|
1693
1693
|
<script data-stx-scoped data-stx-run="always">
|
|
1694
1694
|
// Intersection Observer for scroll animations
|
|
1695
1695
|
(function() {
|
|
@@ -1732,7 +1732,7 @@ else {
|
|
|
1732
1732
|
}
|
|
1733
1733
|
})();
|
|
1734
1734
|
</script>
|
|
1735
|
-
`}function
|
|
1735
|
+
`}function Cq(){return`
|
|
1736
1736
|
<style id="stx-animation-base">
|
|
1737
1737
|
:root {
|
|
1738
1738
|
--stx-transition-duration: 300ms;
|
|
@@ -1847,7 +1847,7 @@ else {
|
|
|
1847
1847
|
transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
|
|
1848
1848
|
}
|
|
1849
1849
|
</style>
|
|
1850
|
-
`}function
|
|
1850
|
+
`}function Pq($,X,Z={}){let{staggerDelay:Y=50,sequence:J=!1}=Z;return`
|
|
1851
1851
|
<script data-stx-scoped data-stx-run="always">
|
|
1852
1852
|
// Animation Group: ${$}
|
|
1853
1853
|
(function() {
|
|
@@ -1884,11 +1884,11 @@ else {
|
|
|
1884
1884
|
}
|
|
1885
1885
|
})();
|
|
1886
1886
|
</script>
|
|
1887
|
-
`}function
|
|
1888
|
-
</head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let q=
|
|
1889
|
-
`+J.slice(W)}}return J}var H1,
|
|
1890
|
-
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"},
|
|
1891
|
-
${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},
|
|
1887
|
+
`}function M2($,X,Z,Y){let J=$;if(Y.animation?.enabled===!1)return J;let G=Z.includes("test")&&Z.includes("animation");if(!bq(J)&&!G)return J;if(!J.includes('<style id="stx-animation-base">')){let w=Cq();J=J.replace("</head>",`${w}
|
|
1888
|
+
</head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let q=Sq(),W=J.lastIndexOf("</body>");if(W!==-1)J=J.slice(0,W)+q+`
|
|
1889
|
+
`+J.slice(W)}}return J}var H1,A2,R2,N2,T2;var h9=y(()=>{H1={duration:300,delay:0,ease:"ease",direction:"both"};A2={name:"transition",handler:($,X,Z,Y)=>{if(X.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let J=X[0],G=X.length>1?Number.parseInt(X[1],10)||H1.duration:H1.duration,Q=X.length>2?X[2]||H1.ease:H1.ease,w=X.length>3?Number.parseInt(X[3],10)||H1.delay:H1.delay,q=X.length>4?X[4]||H1.direction:H1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,K=Dq(J,{duration:G,delay:w,ease:Q,direction:q}),z="stx-transition",U="";if(J==="fade")U="stx-fade";else if(J==="slide")U="stx-slide";else if(J==="scale")U="stx-scale";else if(J==="flip")U="stx-flip";else if(J==="rotate")U="stx-rotate";return`<div id="${W}" class="${z} ${U} ${q==="out"?"stx-out":""}"
|
|
1890
|
+
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"},R2={name:"scrollAnimate",handler:($,X,Z,Y)=>{if(X.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let J=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(J==="fade")z+=" stx-fade";else if(J==="slide-up"||J==="slide")z+=" stx-from-bottom";else if(J==="slide-down")z+=" stx-from-top";else if(J==="slide-left")z+=" stx-from-right";else if(J==="slide-right")z+=" stx-from-left";else if(J==="scale")z+=" stx-scale";else if(J.includes("-"))z+=` stx-${J}`;else z+=` stx-${J}`;return`<div id="${W}" class="${z}" style="${K}" data-threshold="${w}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},N2={name:"animationGroup",handler:($,X,Z,Y)=>{if(X.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let J=X[0],G=X.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),Q=Z.staggerDelay||50,w=Z.sequence||!0,q=Pq(J,G,{staggerDelay:Q,sequence:w});return`${$}
|
|
1891
|
+
${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},T2={name:"motion",handler:($,X,Z,Y)=>{let J=X.length>0?X[0].toLowerCase()==="true":!0,G=yq();return`<div data-animate="${J?"auto":"true"}">${$}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});var k2=y(()=>{k1();u9()});async function vq($,X,Z,Y){let J=X[0]?.replace(/['"]/g,"")||"main",G=j7();if(J!=="main")G=G.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${G}</script>`}var I2;var u9=y(()=>{k2();I2={name:"stxRouter",handler:vq,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function E2($){let X=$.heatmap;if(!X?.enabled)return"";let Z={...xq,...X};return`
|
|
1892
1892
|
<!-- stx Heatmap - Privacy-Compliant Tracking -->
|
|
1893
1893
|
<script>
|
|
1894
1894
|
(function() {
|
|
@@ -2271,8 +2271,8 @@ else {
|
|
|
2271
2271
|
};
|
|
2272
2272
|
})();
|
|
2273
2273
|
</script>
|
|
2274
|
-
`}function
|
|
2275
|
-
`)){let w=Q.trim();if(!w||w.startsWith("#"))continue;let q=w.indexOf(":");if(q===-1)continue;let W=w.slice(0,q).trim(),K=w.slice(q+1).trim();if(typeof K==="string"){if(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'"))K=K.slice(1,-1);else if(K.startsWith("[")&&K.endsWith("]"))try{K=JSON.parse(K)}catch{}else if(K==="true")K=!0;else if(K==="false")K=!1;else if(/^-?\d+(?:\.\d+)?$/.test(K))K=Number(K)}G[W]=K}return{data:G,content:J.trim()}}function F7($,X={}){let{gfm:Z=!0,breaks:Y=!1}=X,J=$,G=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(K,z,U)=>{let B=G.length,j=z?` class="language-${I1(z)}"`:"";return G.push(`<pre><code${j}>${I1(U.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),J=J.replace(/`([^`]*)`/g,(K,z)=>`<code>${I1(z)}</code>`),J=J.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),J=J.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),J=J.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),J=J.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),J=J.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),J=J.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),J=J.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),J=J.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),J=J.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),J=J.replace(/__(.+?)__/g,"<strong>$1</strong>"),J=J.replace(/\*(.+?)\*/g,"<em>$1</em>"),J=J.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(K,z,U)=>{return`<img src="${
|
|
2274
|
+
`}function D2($,X){let Z=E2(X);if(!Z)return $;let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+$.slice(Y);return $+Z}function fq($){let X={},Z=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of Z){let[J,G]=Y.split("="),Q=G?.replace(/["']/g,"");switch(J){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 xq,y2;var d9=y(()=>{xq={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};y2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,X,Z,Y)=>{let J=Z.__stx_config||{};if(X.length>0){let G=fq(X.join(" "));J.heatmap={...J.heatmap,...G,enabled:!0}}return E2(J)}}});function I1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function b2($){let X=$.trim().toLowerCase();return!X.startsWith("javascript:")&&!X.startsWith("vbscript:")&&!X.startsWith("data:text/html")}function S2($){let X=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=$.match(X);if(!Z)return{data:{},content:$.trim()};let Y=Z[1],J=$.slice(Z[0].length),G={};for(let Q of Y.split(`
|
|
2275
|
+
`)){let w=Q.trim();if(!w||w.startsWith("#"))continue;let q=w.indexOf(":");if(q===-1)continue;let W=w.slice(0,q).trim(),K=w.slice(q+1).trim();if(typeof K==="string"){if(K.startsWith('"')&&K.endsWith('"')||K.startsWith("'")&&K.endsWith("'"))K=K.slice(1,-1);else if(K.startsWith("[")&&K.endsWith("]"))try{K=JSON.parse(K)}catch{}else if(K==="true")K=!0;else if(K==="false")K=!1;else if(/^-?\d+(?:\.\d+)?$/.test(K))K=Number(K)}G[W]=K}return{data:G,content:J.trim()}}function F7($,X={}){let{gfm:Z=!0,breaks:Y=!1}=X,J=$,G=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(K,z,U)=>{let B=G.length,j=z?` class="language-${I1(z)}"`:"";return G.push(`<pre><code${j}>${I1(U.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),J=J.replace(/`([^`]*)`/g,(K,z)=>`<code>${I1(z)}</code>`),J=J.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),J=J.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),J=J.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),J=J.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),J=J.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),J=J.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),J=J.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),J=J.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),J=J.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),J=J.replace(/__(.+?)__/g,"<strong>$1</strong>"),J=J.replace(/\*(.+?)\*/g,"<em>$1</em>"),J=J.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(K,z,U)=>{return`<img src="${b2(U)?I1(U):""}" alt="${I1(z)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(K,z,U)=>{return`<a href="${b2(U)?I1(U):""}">${z}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
|
|
2276
2276
|
`),J=J.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),J=J.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),J=J.replace(/<\/ul>\n<ul>/g,""),J=J.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),J=J.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),J=J.replace(/<\/ol>\n<ol>/g,""),J=J.replace(/<li data-ul>/g,"<li>"),J=J.replace(/<li data-ol>/g,"<li>"),Z)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(K,z,U)=>{let j=`<tr>${z.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${I1(H)}</th>`).join("")}</tr>`,_=U.trim().split(`
|
|
2277
2277
|
`).map((H)=>{return`<tr>${H.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${I1(O)}</td>`).join("")}</tr>`}).join(`
|
|
2278
2278
|
`);return`<table>
|
|
@@ -2289,7 +2289,7 @@ ${_}
|
|
|
2289
2289
|
`:`
|
|
2290
2290
|
`)}</p>`);if(J=w.join(`
|
|
2291
2291
|
`),Y)J=J.replace(/\n/g,`<br />
|
|
2292
|
-
`);for(let K=0;K<G.length;K++)J=J.replace(`\x00CODEBLOCK${K}\x00`,G[K]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function A5($="const",X=[],Z){let Y=X.length?O1.filter((J)=>!X.includes(J)):O1;if(Z!==void 0)Y=Y.filter((J)=>{let G=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${$} { ${Y.join(", ")} } = window.stx;`}function m9($){if(!$)return!1;return
|
|
2292
|
+
`);for(let K=0;K<G.length;K++)J=J.replace(`\x00CODEBLOCK${K}\x00`,G[K]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function A5($="const",X=[],Z){let Y=X.length?O1.filter((J)=>!X.includes(J)):O1;if(Z!==void 0)Y=Y.filter((J)=>{let G=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${$} { ${Y.join(", ")} } = window.stx;`}function m9($){if(!$)return!1;return hq.some((X)=>new RegExp(`\\b${X}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function l9($){if(!$)return!1;let X=g2($);if(uq.some((Z)=>Z.test(X)))return!0;return m9(X)}function P2($){if(!$)return!1;return dq.test(g2($))||l9($)}function f2(){return`{${v2.map(($)=>`'${$}':1`).join(",")}}`}function g2($){if(!$)return $;let X=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(Y,J,G)=>J??" ".repeat(G.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,Y,J,G)=>Y+X(J)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,Y,J,G)=>Y+X(J)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var O1,C2,gq,hq,uq,dq,v2,mq,x2;var w1=y(()=>{O1=["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"],C2=["onMount","onDestroy"];gq=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],hq=O1.filter(($)=>!gq.includes($));uq=[/@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/],dq=/\s@[a-z][\w.:-]*\s*=/i;v2=["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"],mq=["x-init","x-transition","x-effect","x-on"],x2=[...v2,...mq]});function d2($){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 Y=Z.toLowerCase();if(Y==="prevent")X.prevent=!0;else if(Y==="stop")X.stop=!0;else if(Y==="once")X.once=!0;else if(Y==="capture")X.capture=!0;else if(Y==="self")X.self=!0;else if(Y==="passive")X.passive=!0;else if(lq.has(Y))X.systemKeys.push(Y);else if(Y in m2)X.mouse=Y;else if(Y in u2||/^[a-z]$/.test(Y))X.keys.push(u2[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);X.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);X.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return X}function l2($){let X=[],Z=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec($))!==null){let[G,Q,w]=J,q=J.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:d2(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:d2(L.slice(1)),elementId:K})}if(z.length>0)X.push({originalTag:G,elementId:K,events:z,startIndex:q,endIndex:W})}return X}function cq($){let X=[],{modifiers:Z}=$;if(Z.self)X.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)X.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");X.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=m2[Z.mouse];X.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)X.push("$event.preventDefault()");if(Z.stop)X.push("$event.stopPropagation()");return X.join("; ")}function pq($,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 c9($){let X=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(X))return $;return`if (typeof ${X} === 'function' && !${X}._isSignal) ${X}($event);`}function iq($){let{modifiers:X}=$,Z=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=cq($),J=pq(c9($.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=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
|
|
2293
2293
|
(function() {
|
|
2294
2294
|
var $el = document.getElementById('${Z}');
|
|
2295
2295
|
if (!$el) return;
|
|
@@ -2398,16 +2398,16 @@ else {
|
|
|
2398
2398
|
}
|
|
2399
2399
|
|
|
2400
2400
|
// Event listeners
|
|
2401
|
-
${$.map(
|
|
2401
|
+
${$.map(iq).join(`
|
|
2402
2402
|
`)}
|
|
2403
2403
|
})();
|
|
2404
|
-
</script>`}function
|
|
2405
|
-
`+J.slice(Q);else J+=G;return J}var
|
|
2404
|
+
</script>`}function nq($){let X=l2($);if(X.length===0)return{template:$,bindings:[]};let Z=$,Y=[];for(let J=X.length-1;J>=0;J--){let G=X[J],Q=G.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${G.elementId}"`);else{let w=Q.match(/id=["']([^"']+)["']/);if(w)for(let q of G.events)q.elementId=w[1]}for(let w of G.events){let q=w.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),K=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(W,""),Q=Q.replace(K,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),Y.push(...G.events)}return{template:Z,bindings:Y}}function c2($,X,Z){if(l9($))return $;if(X.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:w,bindings:q}=nq($),W=X.__stx_event_bindings||[];return X.__stx_event_bindings=[...W,...q],w}let Y=l2($);if(Y.length===0)return $;let J=$;for(let w=Y.length-1;w>=0;w--){let q=Y[w],W=q.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let K=W.match(/id=["']([^"']+)["']/);if(K)for(let 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,"")}J=J.slice(0,q.startIndex)+W+J.slice(q.endIndex)}let G=p9(Y.flatMap((w)=>w.events)),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
|
|
2405
|
+
`+J.slice(Q);else J+=G;return J}var h2,u2,lq,m2;var i9=y(()=>{w1();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"]),u2={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"},lq=new Set(["ctrl","alt","shift","meta"]),m2={left:0,middle:1,right:2}});function l0($){let X=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(X,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
|
|
2406
2406
|
`});let Z=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Z,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__composables
|
|
2407
|
-
`}),$}function V8($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function
|
|
2407
|
+
`}),$}function V8($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function rq(){let $=globalThis;return $[p2]??=new Map,$[p2]}function e($,X){let Z=rq(),Y=`${import.meta.url}\x00${$}`,J=Z.get(Y);if(J)return J;let G=X();return Z.set(Y,G),G.catch(()=>{if(Z.get(Y)===G)Z.delete(Y)}),G}var p2;var V7=y(()=>{p2=Symbol.for("stx.lazy-module-promises")});function R5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(oq,"<\\/$1")}var oq;var n9=y(()=>{oq=/<\/(script)/gi});import sq from"process";function g0($="STX_PUBLIC_"){let X={},Z={};for(let[Y,J]of Object.entries(sq.env)){if(!Y.startsWith($)||J===void 0)continue;X[`import.meta.env.${Y}`]=JSON.stringify(J),Z[Y]=J}return X["import.meta.env"]=JSON.stringify(Z),X}var E1=()=>{};function aq($){if(!$||typeof $!=="object")return!1;let X=$;return typeof X.message==="string"&&(X.name==="BuildMessage"||X.name==="ResolveMessage"||("position"in X))}function tq($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function r9($,X){let Z=[];for(let Y of tq($)){if(aq(Y)){let J=Y.position||void 0;Z.push({file:X||J?.file,line:J?.line,column:J?.column,message:Y.message??"",lineText:J?.lineText});continue}Z.push({file:X,message:Y instanceof Error?Y.message:String(Y)})}return Z}function i2($,X){return r9($,X).map((Z)=>{let Y=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",J=Z.lineText?`
|
|
2408
2408
|
${Z.lineText.trim()}`:"";return Y?`${Y}: ${Z.message}${J}`:`${Z.message}${J}`}).join(`
|
|
2409
|
-
`)}var A7={};a(A7,{shouldLogBundlerDiagnostics:()=>
|
|
2410
|
-
export { ${B.join(", ")} }`:"";await Bun.write(K,$+L),c1("bundling:",Q,"from:",F0.basename(X));let O=new Set;try{let F=await Bun.build({entrypoints:[K],outdir:z,target:"browser",format:"esm",minify:J,plugins:[
|
|
2409
|
+
`)}var A7={};a(A7,{shouldLogBundlerDiagnostics:()=>s2,setBundlerFallbackMode:()=>ZW,resolveBundlerFallback:()=>t2,recordBundleFailure:()=>a2,queueClientBundleBuild:()=>e2,hasUserImports:()=>YW,getBundleFailures:()=>$W,clearBundleFailures:()=>XW,bundleClientScript:()=>GW});import F0 from"path";import h0 from"fs";function s2($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function c1(...$){if(s2())console.log("[stx:bundler]",...$)}function a2($,X,Z){a9.push({filePath:$||"<inline>",message:X,details:Z})}function $W(){return a9.slice()}function XW(){a9.length=0}function ZW($){s9=$}function t2(){if(s9)return s9;try{return N7.strict?.bundlerFallback??"warn"}catch{return"warn"}}function YW($){let X=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=X.exec($))!==null){let J=Z[1];if(!n2.some((Q)=>Q.test(J)))return c1("detected user import:",J),!0}let Y=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=Y.exec($))!==null){let J=Z[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!n2.some((Q)=>Q.test(J)))return c1("detected side-effect import:",J),!0}return!1}function JW($,X,Z,Y){let J=(G,Q)=>{let w=G===Z?X:F0.dirname(G),q=F0.resolve(w,Q),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,F0.join(q,"index.ts"),F0.join(q,"index.tsx"),F0.join(q,"index.js"),F0.join(q,"index.mjs")];for(let K of W)try{if(h0.existsSync(K)&&h0.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(h0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let w=J(Q.importer,Q.path);return Y.add(w),{path:w}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let w=F0.resolve($,Q.path.slice(2)),q=[w,`${w}.ts`,`${w}.tsx`,`${w}.js`,`${w}.mjs`,`${w}.jsx`,F0.join(w,"index.ts"),F0.join(w,"index.tsx"),F0.join(w,"index.js"),F0.join(w,"index.mjs")];for(let W of q)if(h0.existsSync(W)&&h0.statSync(W,{throwIfNoEntry:!1})?.isFile())return c1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",W),Y.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${Q.path[0]}/ import:`,Q.path),{path:w}}),G.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Q)=>{let w=F0.extname(Q.path).toLowerCase(),q=w===".json"?"json":w===".tsx"?"tsx":w===".jsx"?"jsx":w===".ts"||w===".mts"||w===".cts"?"ts":"js";if(Q.path!==Z)Y.add(Q.path);return{contents:h0.readFileSync(Q.path,"utf8"),loader:q}})}}}function e2($){let X=globalThis,Y=(X[r2]??Promise.resolve()).then($,$);return X[r2]=Y.then(()=>{return},()=>{return}),Y}async function GW($,X,Z={}){let Y=Z.projectRoot||process.cwd(),J=Z.minify??!1,G=Z.cacheDir||_1(Y,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${eq}\x00${$}\x00${X}`);let w=Q.digest("hex").slice(0,12),q=F0.join(G,`${w}.js`),W=F0.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!==o2||!Array.isArray(_.files))j=!1;for(let H of Array.isArray(_.files)?_.files:[])try{if(h0.statSync(H.path).mtimeMs!==H.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return c1("cache hit:",w),await K.text();c1("cache invalidated by dep change:",w)}let z=o9.get(w);if(z)return await z;let U=e2(()=>QW($,X,{projectRoot:Y,minify:J,cacheDir:G,hash:w,cachePath:q,depsPath:W}));o9.set(w,U);try{return await U}finally{o9.delete(w)}}async function QW($,X,Z){let{projectRoot:Y,minify:J,cacheDir:G,hash:Q,cachePath:w,depsPath:q}=Z,W=_1(Y,"bundle-tmp"),K=F0.join(W,`${Q}.ts`),z=F0.join(W,"out",Q);h0.mkdirSync(W,{recursive:!0}),h0.mkdirSync(z,{recursive:!0});let U=F0.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?`
|
|
2410
|
+
export { ${B.join(", ")} }`:"";await Bun.write(K,$+L),c1("bundling:",Q,"from:",F0.basename(X));let O=new Set;try{let F=await Bun.build({entrypoints:[K],outdir:z,target:"browser",format:"esm",minify:J,plugins:[JW(Y,U,K,O)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...g0()},root:Y});if(!F.success){let I=F.logs.filter((S)=>S.level==="error").map((S)=>S.message).join(", ");return console.warn("[stx:bundler] build failed:",I),$}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 C=S.trim();if(/^[A-Za-z_$][\w$]*$/.test(C))A.push([C,C])}let R=V.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];V=V.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let N=`__stxBundle_${Q}`,T=A.map(([I,S])=>`${JSON.stringify(I)}: ${S}`).join(", "),M=A.map(([I])=>`var ${I} = undefined;`).join(`
|
|
2411
2411
|
`),k=A.map(([I])=>`${I} = ${N}[${JSON.stringify(I)}];`).join(`
|
|
2412
2412
|
`);if(V=`${R.join(`
|
|
2413
2413
|
`)}
|
|
@@ -2416,26 +2416,26 @@ var ${N} = (function() {
|
|
|
2416
2416
|
${V}
|
|
2417
2417
|
return { ${T} };
|
|
2418
2418
|
})();
|
|
2419
|
-
${k}`.trim(),c1("bundled:",Q,"output:",V.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${F0.basename(X)} (${Q}); serving the unbundled source and not caching this result`),$;h0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let D=Array.from(O).map((I)=>{try{return{path:I,mtimeMs:h0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(q,JSON.stringify({metadataVersion:
|
|
2419
|
+
${k}`.trim(),c1("bundled:",Q,"output:",V.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${F0.basename(X)} (${Q}); serving the unbundled source and not caching this result`),$;h0.mkdirSync(G,{recursive:!0}),await Bun.write(w,V);let D=Array.from(O).map((I)=>{try{return{path:I,mtimeMs:h0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(q,JSON.stringify({metadataVersion:o2,files:D})),V}catch(F){let V=r9(F,X||void 0),A=i2(F,X||void 0);if(console.warn(`[stx:bundler] error: ${A}`),a2(X||"",A,V),t2()==="error")throw F;return $}finally{try{h0.rmSync(K,{force:!0}),h0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var eq=5,o2=1,a9,s9,n2,o9,r2;var R7=y(()=>{E1();L7();L1();a9=[];n2=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];o9=new Map,r2=Symbol.for("stx.client-bundle-build-queue")});var q6={};a(q6,{stripCommentsAndLiterals:()=>N8,renderVendorStyleTags:()=>R8,processClientScript:()=>k7,injectBrowserCoreAutoImports:()=>N5,generateServerDataBridge:()=>T8,generateBrowserAutoImportDestructuring:()=>OW,generateAutoImportDestructuring:()=>t9,extractBridgeData:()=>M7,extractAndStripCssImports:()=>A8,STX_AUTO_IMPORTS:()=>Y6});import p1 from"path";import T7 from"fs";function qW($){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 WW($,X){let Z=X;while(!0){let Y=p1.join(Z,"node_modules",$,"package.json");if(T7.existsSync(Y))return p1.dirname(Y);let J=p1.dirname(Z);if(J===Z)return null;Z=J}}function KW($,X){if(!$||typeof $!=="object")return null;let Z=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Z(J.import);if(typeof J.default==="object")return Z(J.default)}return null};if(Object.prototype.hasOwnProperty.call($,X))return Z($[X]);let Y=null;for(let J of Object.keys($)){let G=J.indexOf("*");if(G===-1)continue;let Q=J.slice(0,G),w=J.slice(G+1);if(!X.startsWith(Q)||!X.endsWith(w))continue;if(X.length<Q.length+w.length)continue;if(!Y||Q.length>Y.prefix.length)Y={pattern:J,prefix:Q,suffix:w}}if(Y){let J=X.slice(Y.prefix.length,X.length-Y.suffix.length),G=Z($[Y.pattern]);if(G)return G.replace("*",J)}return null}function zW($,X){let Z=qW($);if(!Z||!Z.subpath)return null;let Y=WW(Z.pkg,X);if(!Y)return null;let J;try{J=JSON.parse(T7.readFileSync(p1.join(Y,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=KW(J.exports,G);if(!Q)return null;let w=p1.resolve(Y,Q);return T7.existsSync(w)?w:null}function A8($,X){let Z=X.filePath?p1.dirname(X.filePath):X.projectRoot||process.cwd(),Y=X.projectRoot||process.cwd(),J=new Set,G=[];return{code:$.replace(wW,(w,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:p1.resolve(Z,q),!T7.existsSync(W))throw Error(`file not found: ${W}`)}else{let K=null;try{K=Bun.resolveSync(q,Y)}catch{K=zW(q,Y)}if(!K)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=K}}catch(K){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${X.filePath||"<unknown>"}): ${K?.message||K}`),""}if(J.has(W))return"";J.add(W);try{let K=T7.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 UW($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function R8($){if($.length===0)return"";return`${$.map((X)=>{return`<style data-stx-vendor="${UW(X.source)}" data-stx-layer="vendor">
|
|
2420
2420
|
@layer vendor {
|
|
2421
2421
|
${X.contents}
|
|
2422
2422
|
}
|
|
2423
2423
|
</style>`}).join(`
|
|
2424
2424
|
`)}
|
|
2425
|
-
`}function N5($){let X=N8($),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 Y=new Set;for(let w of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.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)Y.add(W)}let J=
|
|
2425
|
+
`}function N5($){let X=N8($),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 Y=new Set;for(let w of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.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)Y.add(W)}let J=J6.filter((w)=>{if(Z.has(w)||Y.has(w))return!1;return new RegExp(`\\b${w}\\s*\\(`).test(X)}),G=Q6(X).filter((w)=>!Z.has(w)&&!Y.has(w));if(J.length===0&&G.length===0)return{code:$,imports:J,models:G};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
|
|
2426
2426
|
`)}
|
|
2427
|
-
${$}`,imports:J,models:G}}function
|
|
2427
|
+
${$}`,imports:J,models:G}}function BW($,X){let Z=$[X],Y=X+1;while(Y<$.length){if($[Y]==="\\"){Y+=2;continue}if($[Y]===Z)return Y+1;Y++}return $.length}function _W($,X){let Z=X+1;while(Z<$.length){if($[Z]==="\\"){Z+=2;continue}if($[Z]==="`")return Z+1;if($[Z]==="$"&&$[Z+1]==="{"){if(Z=G6($,Z+2),Z<$.length)Z++;continue}Z++}return $.length}function G6($,X){let Z=1,Y=X;while(Y<$.length){let J=$[Y];if(J==="\\"){Y+=2;continue}if(J==='"'||J==="'"){Y=BW($,Y);continue}if(J==="`"){Y=_W($,Y);continue}if(J==="/"&&$[Y+1]==="/"){while(Y<$.length&&$[Y]!==`
|
|
2428
2428
|
`)Y++;continue}if(J==="/"&&$[Y+1]==="*"){Y+=2;while(Y<$.length&&$.slice(Y,Y+2)!=="*/")Y++;Y+=2;continue}if(J==="{"){Z++,Y++;continue}if(J==="}"){if(Z--,Z===0)return Y;Y++;continue}Y++}return $.length}function N8($){let X="",Z=0;while(Z<$.length){let Y=$.slice(Z,Z+2);if(Y==="//"){while(Z<$.length&&$[Z]!==`
|
|
2429
2429
|
`)X+=" ",Z++;continue}if(Y==="/*"){while(Z<$.length&&$.slice(Z,Z+2)!=="*/")X+=$[Z]===`
|
|
2430
2430
|
`?`
|
|
2431
2431
|
`:" ",Z++;X+=" ",Z+=2;continue}let J=$[Z];if(J==='"'||J==="'"){let G=J;X+=" ",Z++;while(Z<$.length&&$[Z]!==G){if($[Z]==="\\"){X+=" ",Z+=2;continue}X+=$[Z]===`
|
|
2432
2432
|
`?`
|
|
2433
|
-
`:" ",Z++}X+=" ",Z++;continue}if(J==="`"){X+=" ",Z++;while(Z<$.length&&$[Z]!=="`"){if($[Z]==="\\"){X+=" ",Z+=2;continue}if($[Z]==="$"&&$[Z+1]==="{"){let G=Z+2,Q=
|
|
2433
|
+
`:" ",Z++}X+=" ",Z++;continue}if(J==="`"){X+=" ",Z++;while(Z<$.length&&$[Z]!=="`"){if($[Z]==="\\"){X+=" ",Z+=2;continue}if($[Z]==="$"&&$[Z+1]==="{"){let G=Z+2,Q=G6($,G);if(X+=" ",X+=N8($.slice(G,Q)),Q<$.length)X+=" ";Z=Q+1;continue}X+=$[Z]===`
|
|
2434
2434
|
`?`
|
|
2435
|
-
`:" ",Z++}X+=" ",Z++;continue}X+=J,Z++}return X}function
|
|
2435
|
+
`:" ",Z++}X+=" ",Z++;continue}X+=J,Z++}return X}function Q6($){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,Y;while((Y=Z.exec($))!==null)if(!jW.has(Y[1]))X.add(Y[1]);return Array.from(X)}function HW($){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 Y of Z[1].split(",")){let J=Y.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))X.add(J)}return X}function w6($){let X=new Set,Z=new Set,Y=$;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,G=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,Q;while((Q=G.exec($))!==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(J.add(H),J.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]";Y=Y.replace(Q[0],U)}let w=HW(Y);for(let W of Y6){if(J.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(Y))X.add(W)}for(let W of J6){if(J.has(W)||w.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(Y))Z.add(W)}let q=Q6(Y);for(let W of q)if(!J.has(W)&&!w.has(W))Z.add(W);return{code:Y,stxImports:Array.from(X),browserImports:Array.from(Z)}}function t9($,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
2436
|
${Z.join(`
|
|
2437
2437
|
`)}
|
|
2438
|
-
${
|
|
2438
|
+
${LW($,X)}`;return""}function OW($,X=[]){let{browserImports:Z}=w6($),Y=new Set(X);return t9([],Z.filter((J)=>!Y.has(J)))}function LW($,X){let Z=[...$.map((Y)=>`['${Y}', typeof ${Y}, 'stx']`),...X.map((Y)=>`['${Y}', typeof ${Y}, '@stacksjs/browser']`)];if(Z.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
|
|
2439
2439
|
[${Z.join(", ")}].forEach(function (e) {
|
|
2440
2440
|
if (e[1] !== 'undefined') return;
|
|
2441
2441
|
console.error(
|
|
@@ -2444,10 +2444,10 @@ ${HW($,X)}`;return""}function _W($,X=[]){let{browserImports:Z}=Q6($),Y=new Set(X
|
|
|
2444
2444
|
+ 'or it should be imported from a relative path so the bundler includes it.'
|
|
2445
2445
|
);
|
|
2446
2446
|
});
|
|
2447
|
-
`}function M7($){let X=$.__stxClientPayload;if(X&&typeof X==="object"){let Y={};for(let J in X){let G=X[J];if(typeof G==="function")continue;Y[J]=G}return Y.__stxDeclaredPayload=!0,Y}let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=$[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function
|
|
2447
|
+
`}function M7($){let X=$.__stxClientPayload;if(X&&typeof X==="object"){let Y={};for(let J in X){let G=X[J];if(typeof G==="function")continue;Y[J]=G}return Y.__stxDeclaredPayload=!0,Y}let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=$[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function $6($,X){let Z=new Set;for(let Y of $.split(",")){let J=Y.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if(X){let G=J.lastIndexOf(":");if(G!==-1)J=J.slice(G+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function FW($,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($6(Z[1],!0).has(X))return!0;for(let Z of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if($6(Z[1],!1).has(X))return!0;return!1}function VW($,X){return new RegExp(`(?<![.#\\w$])${X}(?![\\w$])`).test($)}function RW($,X){let Z=AW.test($),Y=X.length>32768;if(!Z&&!Y)return;if(X6.has($))return;if(X6.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(Y)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 T8($,X){if(!X)return"";let Z=N8($),Y=X.__stxDeclaredPayload===!0,J=[];for(let[G,Q]of Object.entries(X)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!Y&&!VW(Z,G))continue;if(FW($,G))continue;let w;try{w=JSON.stringify(Q)}catch{continue}if(w===void 0)continue;RW(G,w),J.push(` var ${G} = ${w.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
|
|
2448
2448
|
${J.join(`
|
|
2449
2449
|
`)}
|
|
2450
|
-
`}function
|
|
2450
|
+
`}function TW($){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((Y)=>`$event.key === '${Y}'`).join(" || ");X.push(`if (!(${Z})) return`)}if($.mouse!==null){let Z=NW[$.mouse];X.push(`if ($event.button !== ${Z}) return`)}if($.prevent)X.push("$event.preventDefault()");if($.stop)X.push("$event.stopPropagation()");return X.join("; ")}function MW($,X){let{elementId:Z,event:Y,modifiers:J}=$,G=c9($.handler),Q=TW(J),w=[];if(J.once)w.push("once: true");if(J.capture)w.push("capture: true");if(J.passive)w.push("passive: true");let q=w.length>0?`, { ${w.join(", ")} }`:"",W="";if(Q)W+=`${Q}; `;let K=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
|
|
2451
2451
|
$el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
|
|
2452
2452
|
};`;function U(B){if(/\$emit\s*\(/.test(B))return`${z}
|
|
2453
2453
|
${B}`;return`var scope = $el.closest('[data-stx-scope]');
|
|
@@ -2490,11 +2490,11 @@ else {
|
|
|
2490
2490
|
else {
|
|
2491
2491
|
${G}
|
|
2492
2492
|
}
|
|
2493
|
-
}${q})`}function
|
|
2493
|
+
}${q})`}function kW($){if($.length===0)return"";return`
|
|
2494
2494
|
// STX: auto-generated event bindings
|
|
2495
|
-
${$.map((Z,Y)=>
|
|
2496
|
-
`)}`}function
|
|
2497
|
-
`)Q++;continue}if(w==="/"&&Y[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Y[Q]==="*"&&Y[Q+1]==="/"))Q++;Q+=2;continue}if(w==="{"){J++,Q++;continue}if(w==="}"){J--,Q++;continue}if(J===0){let q=Y.slice(Q),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let 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
|
|
2495
|
+
${$.map((Z,Y)=>MW(Z,Y)).join(`
|
|
2496
|
+
`)}`}function Z6($){let X=[],Z=new Set,Y=$.replace(/^\s*import\s+.*$/gm,""),J=0,G=Y.length,Q=0;while(Q<G){let w=Y[Q];if(w==="'"||w==='"'||w==="`"){let q=w;if(Q++,q==="`"){let W=0;while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]==="`"&&W===0){Q++;break}if(Y[Q]==="$"&&Y[Q+1]==="{"){W++,Q+=2;continue}if(Y[Q]==="}"&&W>0){W--,Q++;continue}Q++}}else while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]===q){Q++;break}Q++}continue}if(w==="/"&&Y[Q+1]==="/"){while(Q<G&&Y[Q]!==`
|
|
2497
|
+
`)Q++;continue}if(w==="/"&&Y[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Y[Q]==="*"&&Y[Q+1]==="/"))Q++;Q+=2;continue}if(w==="{"){J++,Q++;continue}if(w==="}"){J--,Q++;continue}if(J===0){let q=Y.slice(Q),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let 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 EW($){let X=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(U){let B;while((B=Z.exec(U))!==null){let j=B[0];if(!IW.has(j))X.add(j)}}let J=/\{\{([\s\S]*?)\}\}/g,G;while((G=J.exec($))!==null)Y(G[1]);let Q=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((G=Q.exec($))!==null)Y(G[1]);let w=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((G=w.exec($))!==null)Y(G[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=q.exec($))!==null)Y(G[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=W.exec($))!==null)Y(G[1]);let K=/@model\s*=\s*["']([^"']*)["']/gi;while((G=K.exec($))!==null)Y(G[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((G=z.exec($))!==null)Y(G[1]);return X}async function k7($,X={}){let Z=$,Y="",J=!1,G=[],Q=A8(Z,{filePath:X.filePath,projectRoot:X.projectRoot});Z=Q.code;let w=R8(Q.styles),q=N5(Z);Z=q.code,G=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:K}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (R7(),A7)));if(W(Z))Z=await K(Z,X.filePath||"",{projectRoot:X.projectRoot,minify:X.production}),J=!0;if(X.autoImports!==!1){let O=w6(Z);Z=O.code,Y=t9(O.stxImports,O.browserImports.filter((F)=>!G.includes(F)))}if(Y=`${T8(Z,X.serverData)}${Y}`,Z=l0(Z),!J&&i1(X.attrs||""))Z=n1(Z);let z=kW(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}>
|
|
2498
2498
|
${R5(`${Y}${Z}
|
|
2499
2499
|
${z}`)}
|
|
2500
2500
|
</script>`}let j=m9($),_=/function __stx_setup_/.test(Z),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function L(O){let F=O.length>0?`
|
|
@@ -2503,12 +2503,12 @@ window.stx.mount(function() {
|
|
|
2503
2503
|
'use strict';
|
|
2504
2504
|
${R5(`${Y}${Z}
|
|
2505
2505
|
${z}${F}`)}
|
|
2506
|
-
})</script>`}if(!H&&!_){if(j)return L(
|
|
2506
|
+
})</script>`}if(!H&&!_){if(j)return L(Z6($));if(X.templateContent){let O=Z6($);if(O.length>0){let F=EW(X.templateContent);if(O.some((A)=>F.has(A)))return L(O)}}}return`${w}<script data-stx-scoped data-stx-run="always">
|
|
2507
2507
|
;(function() {
|
|
2508
2508
|
'use strict';
|
|
2509
2509
|
${R5(`${Y}${Z}
|
|
2510
2510
|
${z}`)}
|
|
2511
|
-
})()</script>`}var
|
|
2511
|
+
})()</script>`}var wW,Y6,J6,jW,AW,X6,NW,IW;var I7=y(()=>{i9();k0();V7();w1();n9();wW=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;Y6=O1,J6=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];jW=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"]);AW=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,X6=new Set;NW={left:0,middle:1,right:2};IW=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 DW}from"crypto";function W6($){let X=$[M8];return X instanceof Map?X:null}function K6($){$[M8]=new Map}function z6($,X){let Z=W6($);if(!Z)return null;let Y=DW("sha256").update(X).digest("hex").slice(0,16),J=Z.get(Y);if(J)J.instances++;else Z.set(Y,{body:X,instances:1});return Y}function U6($,X){let Z=W6(X);if(!Z?.size)return $;let Y=$;for(let[q,W]of Z){if(W.instances!==1)continue;let K=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(K,(z,U)=>`(${W.body})(${U});`)}let J=[...Z].filter(([,q])=>q.instances>1);if(J.length===0)return Y;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
|
|
2512
2512
|
(function() {
|
|
2513
2513
|
const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
|
|
2514
2514
|
${J.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${W.body}; }
|
|
@@ -2517,7 +2517,7 @@ ${J.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.str
|
|
|
2517
2517
|
})();
|
|
2518
2518
|
</script>`,w=Y.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(w<0)return`${Q}
|
|
2519
2519
|
${Y}`;return`${Y.slice(0,w)}${Q}
|
|
2520
|
-
${Y.slice(w)}`}var M8="__stx_component_client_factories";var e9=()=>{};function
|
|
2520
|
+
${Y.slice(w)}`}var M8="__stx_component_client_factories";var e9=()=>{};function CW($){let X="",Z=null,Y=!1;for(let J=0;J<$.length;J++){let G=$[J];if(Y){Y=!1;continue}if(G==="\\"&&Z){Y=!0;continue}if(Z){if(Z==="`"&&G==="$"&&J+1<$.length&&$[J+1]==="{"){let Q=1;J+=2;while(J<$.length&&Q>0){if($[J]==="{")Q++;else if($[J]==="}")Q--;if(Q>0)X+=$[J],J++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}X+=G}return X}function PW($,X){let Z=/[$A-Z_a-z][$\w]*/g,Y;while((Y=Z.exec($))!==null){let J=Y[0],G=$[Y.index-1];if(bW.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${X}`);if(G==="."&&H6.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${X}`)}}function vW($){let X=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=X.exec($))!==null){let Y=Z[2];if(!H6.has(Y))continue;let J=$.slice(0,Z.index).match(/\S(?=\s*$)/)?.[0],G=$.slice(Z.index+Z[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&G===":"))throw Error(`Potentially unsafe expression (bracket key ${Z[2]}): ${$}`)}}function k8($){let X=$.trim(),Z=CW(X);PW(Z,X),vW(X);for(let Y of _6)if(Y.test(Z))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${X}`);if(!B6.allowBracketNotation&&SW.test(X))throw Error(`Bracket notation with strings not allowed: ${X}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return X}function xW($){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,Y]of Object.entries($)){if(Z.startsWith("__")||_6.some((J)=>J.test(Z)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))X[Z]=$X(Y);else X[Z]=Y}return X}function $X($,X=0){if(X>=B6.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>$X(Y,X+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Z={};for(let[Y,J]of Object.entries($)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(J&&typeof J==="object")Z[Y]=$X(J,X+1);else Z[Y]=J}return Z}function Y0($,X){try{let Z=xW(X),Y=Object.keys(Z),J=Object.values(Z);return W0($,Y)(...J)}catch{return}}function q0($){try{return k8($),!0}catch{return!1}}function N0($,X){try{let Z=Y0($,X);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function W0($,X){let Z=k8($),Y=/^[A-Za-z_$][\w$]*$/,J=[],G=[];for(let W=0;W<X.length;W++){let K=X[W];if(!Y.test(K))continue;if(O6.has(K))continue;J.push(W),G.push(K)}let Q=(W)=>Function(...G,...W,`
|
|
2521
2521
|
'use strict';
|
|
2522
2522
|
try {
|
|
2523
2523
|
return ${Z};
|
|
@@ -2528,7 +2528,7 @@ catch (e) {
|
|
|
2528
2528
|
}
|
|
2529
2529
|
throw e;
|
|
2530
2530
|
}
|
|
2531
|
-
`),w=Q([]);if(G.length===X.length)return U6(w,G,Q);return U6((...W)=>{let K=Array(J.length);for(let z=0;z<J.length;z++)K[z]=W[J[z]];return w(...K)},G,Q,(W)=>{w=Q(W)})}function U6($,X,Z,Y){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)||H6.has(j))return;q.add(j),w.push(j),Q=Z(w),Y?.(w)}return}}function I8($){let X=$.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of Z)if(Y.test(X))return!1;return!0}var EW,j6,B6,DW,_6,yW,H6;var T0=y(()=>{EW={maxSanitizeDepth:10,allowBracketNotation:!1},j6={...EW},B6=[/\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/],DW=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"]),_6=new Set(["__proto__","constructor","prototype"]),yW=/[\w)\]]\s*\[\s*['"]/;H6=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 E8($,X){let Z=vW++,Y=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return xW.set(Y,{type:$,expression:X}),Y}var vW=0,xW;var O6=y(()=>{xW=new Map});function R6($,X,Z,Y){Z.lastIndex=X;let J=Z.exec($);if(!J||J.index!==X)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec($);if(!G)return-1;return G.index+G[0].length}function D1($,X){return R6($,X,L6,F6)}function T5($,X){return R6($,X,V6,A6)}function E7($,X){if(!$.startsWith("<!--",X))return-1;let Z=$.indexOf("-->",X+4);if(Z===-1)return-1;return Z+3}function fW($,X){if($.startsWith("<!--",X)){let Z=E7($,X);return Z===-1?$.length:Z}for(let[Z,Y]of[[L6,F6],[V6,A6]]){Z.lastIndex=X;let J=Z.exec($);if(!J||J.index!==X)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec($);return G?G.index+G[0].length:$.length}return-1}function XX($,X){let Z=[],Y=0,J=$.length,G=!1,Q=null;while(Y<J){let w=$[Y];if(G){if(Q){if(w===Q)Q=null}else if(w==='"'||w==="'")Q=w;else if(w===">")G=!1;Y++;continue}if(w!=="<"){Y++;continue}let q=X($,Y);if(q>Y){Z.push({start:Y,end:q,token:$.slice(Y,q)}),Y=q;continue}let W=fW($,Y);if(W>Y){Y=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(Y,Y+2)))G=!0;Y++}return Z}function q1($,X,Z){let Y=XX($,X);if(Y.length===0)return{output:$,tokens:[]};let J=Y.map((w)=>w.token),G="",Q=0;for(let w=0;w<Y.length;w++){let q=Y[w];G+=$.slice(Q,q.start),G+=Z(q.token,w),Q=q.end}return G+=$.slice(Q),{output:G,tokens:J}}function y1($){let{output:X,tokens:Z}=q1($,D1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:X,scripts:Z}}function D7($,X){if(X.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>X[+Y]??"")}var L6,F6,V6,A6;var r1=y(()=>{L6=/<script\b[^>]*>/iy,F6=/<\/script\s*>/ig,V6=/<style\b[^>]*>/iy,A6=/<\/style\s*>/ig});var D6={};a(D6,{usesSignalsInScript:()=>F1,unescapeHtml:()=>pW,registerFilters:()=>hW,registerFilter:()=>M6,processExpressions:()=>b1,interpolateScriptsInTemplate:()=>dW,interpolateScriptExpressions:()=>D8,interpolateScriptAttributes:()=>I6,getAllFilters:()=>k6,evaluateExpression:()=>u0,escapeHtml:()=>t0,defaultFilters:()=>b7,clearCustomFilters:()=>uW,applyFilters:()=>E6});function gW($){let X=N6.get($);if(!X){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");X=new RegExp(`:${Z}(?!\\w)`,"g"),N6.set($,X)}return X.lastIndex=0,X}function M6($,X){if($ in b7)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);y7[$]=X}function hW($){for(let[X,Z]of Object.entries($))M6(X,Z)}function k6(){return{...b7,...y7}}function uW(){for(let $ of Object.keys(y7))delete y7[$]}function t0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function F1($){let{scripts:X}=y1($);for(let Z of X){let Y=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let J=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))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 T6($,X){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let W=0;W<Y.length;W++){let K=Y[W];if(!G&&K==="`"){G=!0,Q=0;continue}if(G){if(K==="`"&&Q===0){G=!1;continue}if(K==="$"&&Y[W+1]==="{"){Q++,W++,J+=" ";continue}if(K==="}"&&Q>0){Q--;continue}if(Q>0){J+=K;continue}continue}J+=K}Y=J;let w=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=w.exec(Y))!==null){let W=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(W)&&!(W in X))return!1}}return!0}function D8($,X){let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=u0(J,X);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=u0(J,X);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function I6($,X){if(!$.includes("{"))return $;let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=u0(J,X);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=u0(J,X);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch{return Y}}),Z}function dW($,X,Z={}){let{output:Y,scripts:J}=y1($),G=J.map((Q)=>{let w=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=Q.match(/^<script\b[^>]*>/i),W=Q.search(/<\/script\s*>$/i);if(!w||!q||W===-1)return Q;let K=w[1],z=w[2];if(/\bdata-raw\b/.test(K))return Q;if(Z.skipServer&&/\bserver\b/.test(K))return Q;let B=`<script${I6(K,X)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return B+z+Q.slice(W);return B+D8(z,X)+Q.slice(W)});return D7(Y,G)}function b1($,X,Z){let Y=$,J=(z,U)=>{let B=T5(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=[];Y=G(Y,J,Q,(z)=>`<!--__STX_STYLE_${z}__-->`);let w=[];Y=G(Y,D1,w,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let q=X?.__stx_signals_gate===!0||F1($),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:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,U,B)=>{try{let j=u0(U,X);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return z0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${_}`,Z,$,B,z)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(z,U,B)=>{try{let j=u0(U,X);if(j===void 0&&X.__stx_buildMode==="compile")return E8("raw",U.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(X.__stx_buildMode==="compile")return E8("raw",U.trim());let _=j instanceof Error?j.message:String(j);return z0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${_}`,Z,$,B,z)}}),Y=G(Y,D1,w,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),Y=G(Y,J,Q,(z)=>`<!--__STX_STYLE_${z}__-->`),Y=Y.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=u0(U,X);if(V)return z;if(q&&!T6(j,X))return z;if(T===void 0&&X.__stx_buildMode==="compile"&&!q)return E8("expr",j);return T!==void 0&&T!==null?t0(String(T)):""}catch(T){if(V)return z;if(q&&!T6(j,X))return z;if(N)return z;let M=T instanceof Error?T.message:String(T);return z0("Expression",`Error evaluating: {{ ${j} }}: ${M}`,Z,$,B,z)}});for(let z=0;z<w.length;z++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>w[z]);for(let z=0;z<Q.length;z++)Y=Y.replace(`<!--__STX_STYLE_${z}__-->`,()=>Q[z]);return Y}function E6($,X,Z){if(!X.trim())return $;let Y=$,J=X.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let w=y7[Q]||b7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(k6()).join(", ")}`);let q=[];if(J.startsWith(":")){let W=J.match(/^:([^|\s]+)/);if(W){let K=W[1].trim();try{let z=Number(K);q=[Number.isNaN(z)?K:z]}catch{q=[K]}J=J.substring(W[0].length).trim()}}else if(J.startsWith("(")){let W=1,K=1;while(W>0&&K<J.length){if(J[K]==="(")W++;if(J[K]===")")W--;K++}if(W===0){let z=J.substring(1,K-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[u0(`(${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 u0(V,Z,!0)})}}catch{q=[z]}J=J.substring(K).trim()}}try{Y=w(Y,Z,...q)}catch(W){let K=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${Q}': ${K}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function mW($){let X=!1,Z="",Y=0,J=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==="(")Y++;else if(q===")")Y--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")G++;else if(q==="}")G--;if(q==="|"&&Y===0&&J===0&&G===0){if(W==="|"){w++;continue}if(W==="="){w++;continue}return w}}return-1}function u0($,X,Z=!1){try{let Y=$.trim(),J=mW(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),w=u0(G,X,!0);return E6(w,Q,X)}if(!q0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return Y0(Y,X)}try{let G=Object.keys(X),Q=Object.values(X);return W0(Y,G)(...Q)}catch{return Y0(Y,X)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=lW(G,Object.keys(X));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function lW($,X){let Z=null;for(let J of X){if(J===$)continue;let G=cW($,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max($.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function cW($,X){if($===X)return 0;if($.length===0)return X.length;if(X.length===0)return $.length;let[Z,Y]=$.length<X.length?[$,X]:[X,$],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let w=1;w<=Z.length;w++){let q=Z[w-1]===Y[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,J[w]+1,J[w-1]+q)}for(let w=0;w<=Z.length;w++)J[w]=G[w]}return J[Z.length]}function pW($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var y7,N6,b7;var W1=y(()=>{T0();k0();O6();r1();y7={},N6=new Map;b7={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 Y=Number($);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:($,X,Z="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return Y.toLocaleString(Z)}catch{return String($)}},join:($,X,Z=",")=>{if(!Array.isArray($))return"";return $.join(String(Z))},escape:($,X)=>{if($===void 0||$===null)return"";return t0(String($))},translate:($,X,Z={})=>{if(!X||!X.__translations)return $;let Y=X.__translations,J=X.__i18nConfig?.fallbackToKey??!0,G=String($).split("."),Q=Y;for(let q of G){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return J?$:"";let w=String(Q);return Object.entries(Z).forEach(([q,W])=>{w=w.replace(gW(q),String(W))}),w},t:($,X,Z={})=>{return b7.translate($,X,Z)},truncate:($,X,Z=50,Y="...")=>{if($===void 0||$===null)return"";let J=String($);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:($,X,Z="short",Y="en-US")=>{if($===void 0||$===null)return"";try{let J=$ instanceof Date?$:new Date($);if(Number.isNaN(J.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 J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String($)}},currency:($,X,Z="USD",Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String($)}},pluralize:($,X,Z,Y)=>{let J=Number($);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===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,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Z,Y);return $},replace:($,X,Z,Y="")=>{if($===void 0||$===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(J,"g"),()=>Y)},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 Y=Number($);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class o1{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 k5($,X){if(X?.includes("g"))return new RegExp($,X);let Z=`${$}:${X||""}`;if(!M5.has(Z)){if(M5.size>=iW){let Y=M5.keys().next().value;if(Y)M5.delete(Y)}M5.set(Z,new RegExp($,X))}return M5.get(Z)}class y6{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let X=Array.from(new Set($)),Z=X.sort().join(","),Y=this.pool.find((w)=>w.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...w)=>{return(q)=>{try{let W=`${Z}:${q}`,K=J.get(W);if(!K){if(J.size>=G){let z=J.keys().next().value;if(z)J.delete(z)}K=Function(...X,`
|
|
2531
|
+
`),w=Q([]);if(G.length===X.length)return j6(w,G,Q);return j6((...W)=>{let K=Array(J.length);for(let z=0;z<J.length;z++)K[z]=W[J[z]];return w(...K)},G,Q,(W)=>{w=Q(W)})}function j6($,X,Z,Y){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)||O6.has(j))return;q.add(j),w.push(j),Q=Z(w),Y?.(w)}return}}function I8($){let X=$.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of Z)if(Y.test(X))return!1;return!0}var yW,B6,_6,bW,H6,SW,O6;var T0=y(()=>{yW={maxSanitizeDepth:10,allowBracketNotation:!1},B6={...yW},_6=[/\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/],bW=new Set(["eval","Function","setTimeout","setInterval","setImmediate","process","require","import","exports","module","window","document","global","globalThis","constructor","prototype","Reflect","Proxy","Symbol","WeakMap","WeakSet","WeakRef","FinalizationRegistry","Generator","AsyncGenerator","delete","this"]),H6=new Set(["__proto__","constructor","prototype"]),SW=/[\w)\]]\s*\[\s*['"]/;O6=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 E8($,X){let Z=fW++,Y=`<!--__STX_${$.toUpperCase()}_${Z}__-->`;return gW.set(Y,{type:$,expression:X}),Y}var fW=0,gW;var L6=y(()=>{gW=new Map});function N6($,X,Z,Y){Z.lastIndex=X;let J=Z.exec($);if(!J||J.index!==X)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec($);if(!G)return-1;return G.index+G[0].length}function D1($,X){return N6($,X,F6,V6)}function T5($,X){return N6($,X,A6,R6)}function E7($,X){if(!$.startsWith("<!--",X))return-1;let Z=$.indexOf("-->",X+4);if(Z===-1)return-1;return Z+3}function hW($,X){if($.startsWith("<!--",X)){let Z=E7($,X);return Z===-1?$.length:Z}for(let[Z,Y]of[[F6,V6],[A6,R6]]){Z.lastIndex=X;let J=Z.exec($);if(!J||J.index!==X)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec($);return G?G.index+G[0].length:$.length}return-1}function XX($,X){let Z=[],Y=0,J=$.length,G=!1,Q=null;while(Y<J){let w=$[Y];if(G){if(Q){if(w===Q)Q=null}else if(w==='"'||w==="'")Q=w;else if(w===">")G=!1;Y++;continue}if(w!=="<"){Y++;continue}let q=X($,Y);if(q>Y){Z.push({start:Y,end:q,token:$.slice(Y,q)}),Y=q;continue}let W=hW($,Y);if(W>Y){Y=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(Y,Y+2)))G=!0;Y++}return Z}function q1($,X,Z){let Y=XX($,X);if(Y.length===0)return{output:$,tokens:[]};let J=Y.map((w)=>w.token),G="",Q=0;for(let w=0;w<Y.length;w++){let q=Y[w];G+=$.slice(Q,q.start),G+=Z(q.token,w),Q=q.end}return G+=$.slice(Q),{output:G,tokens:J}}function y1($){let{output:X,tokens:Z}=q1($,D1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:X,scripts:Z}}function D7($,X){if(X.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>X[+Y]??"")}var F6,V6,A6,R6;var r1=y(()=>{F6=/<script\b[^>]*>/iy,V6=/<\/script\s*>/ig,A6=/<style\b[^>]*>/iy,R6=/<\/style\s*>/ig});var y6={};a(y6,{usesSignalsInScript:()=>F1,unescapeHtml:()=>nW,registerFilters:()=>dW,registerFilter:()=>k6,processExpressions:()=>b1,interpolateScriptsInTemplate:()=>lW,interpolateScriptExpressions:()=>D8,interpolateScriptAttributes:()=>E6,getAllFilters:()=>I6,evaluateExpression:()=>u0,escapeHtml:()=>t0,defaultFilters:()=>b7,clearCustomFilters:()=>mW,applyFilters:()=>D6});function uW($){let X=T6.get($);if(!X){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");X=new RegExp(`:${Z}(?!\\w)`,"g"),T6.set($,X)}return X.lastIndex=0,X}function k6($,X){if($ in b7)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);y7[$]=X}function dW($){for(let[X,Z]of Object.entries($))k6(X,Z)}function I6(){return{...b7,...y7}}function mW(){for(let $ of Object.keys(y7))delete y7[$]}function t0($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function F1($){let{scripts:X}=y1($);for(let Z of X){let Y=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let J=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))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 M6($,X){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let W=0;W<Y.length;W++){let K=Y[W];if(!G&&K==="`"){G=!0,Q=0;continue}if(G){if(K==="`"&&Q===0){G=!1;continue}if(K==="$"&&Y[W+1]==="{"){Q++,W++,J+=" ";continue}if(K==="}"&&Q>0){Q--;continue}if(Q>0){J+=K;continue}continue}J+=K}Y=J;let w=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=w.exec(Y))!==null){let W=q[1];if(!Y.substring(0,q.index).trimEnd().endsWith(".")){if(!Z.includes(W)&&!(W in X))return!1}}return!0}function D8($,X){let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=u0(J,X);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=u0(J,X);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function E6($,X){if(!$.includes("{"))return $;let Z=$;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=u0(J,X);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=u0(J,X);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}catch{return Y}}),Z}function lW($,X,Z={}){let{output:Y,scripts:J}=y1($),G=J.map((Q)=>{let w=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=Q.match(/^<script\b[^>]*>/i),W=Q.search(/<\/script\s*>$/i);if(!w||!q||W===-1)return Q;let K=w[1],z=w[2];if(/\bdata-raw\b/.test(K))return Q;if(Z.skipServer&&/\bserver\b/.test(K))return Q;let B=`<script${E6(K,X)}>`;if(/\bsrc\s*=/.test(K)||/\btype\s*=\s*["']application\/json["']/.test(K))return B+z+Q.slice(W);return B+D8(z,X)+Q.slice(W)});return D7(Y,G)}function b1($,X,Z){let Y=$,J=(z,U)=>{let B=T5(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=[];Y=G(Y,J,Q,(z)=>`<!--__STX_STYLE_${z}__-->`);let w=[];Y=G(Y,D1,w,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let q=X?.__stx_signals_gate===!0||F1($),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:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,U,B)=>{try{let j=u0(U,X);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return z0("Expression",`Error evaluating: {{{ ${U.trim()}}}}: ${_}`,Z,$,B,z)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(z,U,B)=>{try{let j=u0(U,X);if(j===void 0&&X.__stx_buildMode==="compile")return E8("raw",U.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if(X.__stx_buildMode==="compile")return E8("raw",U.trim());let _=j instanceof Error?j.message:String(j);return z0("Expression",`Error evaluating: {!! ${U.trim()} !!}: ${_}`,Z,$,B,z)}}),Y=G(Y,D1,w,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),Y=G(Y,J,Q,(z)=>`<!--__STX_STYLE_${z}__-->`),Y=Y.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=u0(U,X);if(V)return z;if(q&&!M6(j,X))return z;if(T===void 0&&X.__stx_buildMode==="compile"&&!q)return E8("expr",j);return T!==void 0&&T!==null?t0(String(T)):""}catch(T){if(V)return z;if(q&&!M6(j,X))return z;if(N)return z;let M=T instanceof Error?T.message:String(T);return z0("Expression",`Error evaluating: {{ ${j} }}: ${M}`,Z,$,B,z)}});for(let z=0;z<w.length;z++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>w[z]);for(let z=0;z<Q.length;z++)Y=Y.replace(`<!--__STX_STYLE_${z}__-->`,()=>Q[z]);return Y}function D6($,X,Z){if(!X.trim())return $;let Y=$,J=X.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let w=y7[Q]||b7[Q];if(!w)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(I6()).join(", ")}`);let q=[];if(J.startsWith(":")){let W=J.match(/^:([^|\s]+)/);if(W){let K=W[1].trim();try{let z=Number(K);q=[Number.isNaN(z)?K:z]}catch{q=[K]}J=J.substring(W[0].length).trim()}}else if(J.startsWith("(")){let W=1,K=1;while(W>0&&K<J.length){if(J[K]==="(")W++;if(J[K]===")")W--;K++}if(W===0){let z=J.substring(1,K-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[u0(`(${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 u0(V,Z,!0)})}}catch{q=[z]}J=J.substring(K).trim()}}try{Y=w(Y,Z,...q)}catch(W){let K=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${Q}': ${K}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function cW($){let X=!1,Z="",Y=0,J=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==="(")Y++;else if(q===")")Y--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")G++;else if(q==="}")G--;if(q==="|"&&Y===0&&J===0&&G===0){if(W==="|"){w++;continue}if(W==="="){w++;continue}return w}}return-1}function u0($,X,Z=!1){try{let Y=$.trim(),J=cW(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),w=u0(G,X,!0);return D6(w,Q,X)}if(!q0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return Y0(Y,X)}try{let G=Object.keys(X),Q=Object.values(X);return W0(Y,G)(...Q)}catch{return Y0(Y,X)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=pW(G,Object.keys(X));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${$}`,Y);throw Y}}function pW($,X){let Z=null;for(let J of X){if(J===$)continue;let G=iW($,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max($.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function iW($,X){if($===X)return 0;if($.length===0)return X.length;if(X.length===0)return $.length;let[Z,Y]=$.length<X.length?[$,X]:[X,$],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let w=1;w<=Z.length;w++){let q=Z[w-1]===Y[Q-1]?0:1;G[w]=Math.min(G[w-1]+1,J[w]+1,J[w-1]+q)}for(let w=0;w<=Z.length;w++)J[w]=G[w]}return J[Z.length]}function nW($){if(!$)return"";return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/'/g,"'").replace(/&/g,"&")}var y7,T6,b7;var W1=y(()=>{T0();k0();L6();r1();y7={},T6=new Map;b7={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 Y=Number($);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:($,X,Z="en-US")=>{if($===void 0||$===null)return"";try{let Y=Number($);if(Number.isNaN(Y))return String($);return Y.toLocaleString(Z)}catch{return String($)}},join:($,X,Z=",")=>{if(!Array.isArray($))return"";return $.join(String(Z))},escape:($,X)=>{if($===void 0||$===null)return"";return t0(String($))},translate:($,X,Z={})=>{if(!X||!X.__translations)return $;let Y=X.__translations,J=X.__i18nConfig?.fallbackToKey??!0,G=String($).split("."),Q=Y;for(let q of G){if(Q===void 0||Q===null)break;Q=Q[q]}if(Q===void 0||Q===null)return J?$:"";let w=String(Q);return Object.entries(Z).forEach(([q,W])=>{w=w.replace(uW(q),String(W))}),w},t:($,X,Z={})=>{return b7.translate($,X,Z)},truncate:($,X,Z=50,Y="...")=>{if($===void 0||$===null)return"";let J=String($);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:($,X,Z="short",Y="en-US")=>{if($===void 0||$===null)return"";try{let J=$ instanceof Date?$:new Date($);if(Number.isNaN(J.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 J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String($)}},currency:($,X,Z="USD",Y="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String($)}},pluralize:($,X,Z,Y)=>{let J=Number($);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===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,Y)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Z,Y);return $},replace:($,X,Z,Y="")=>{if($===void 0||$===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(J,"g"),()=>Y)},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 Y=Number($);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class o1{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 k5($,X){if(X?.includes("g"))return new RegExp($,X);let Z=`${$}:${X||""}`;if(!M5.has(Z)){if(M5.size>=rW){let Y=M5.keys().next().value;if(Y)M5.delete(Y)}M5.set(Z,new RegExp($,X))}return M5.get(Z)}class b6{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let X=Array.from(new Set($)),Z=X.sort().join(","),Y=this.pool.find((w)=>w.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...w)=>{return(q)=>{try{let W=`${Z}:${q}`,K=J.get(W);if(!K){if(J.size>=G){let z=J.keys().next().value;if(z)J.delete(z)}K=Function(...X,`
|
|
2532
2532
|
'use strict';
|
|
2533
2533
|
try {
|
|
2534
2534
|
return ${q};
|
|
@@ -2539,34 +2539,34 @@ catch (e) {
|
|
|
2539
2539
|
}
|
|
2540
2540
|
throw e;
|
|
2541
2541
|
}
|
|
2542
|
-
`),J.set(W,K)}return K(...w)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:X.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class
|
|
2542
|
+
`),J.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 S6{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(),Y=X(),J=performance.now()-Z;return this.recordTime($,J),this.checkBudget($,J),Y}async timeAsync($,X){if(!this.enabled)return X();let Z=performance.now(),Y=await X(),J=performance.now()-Z;return this.recordTime($,J),this.checkBudget($,J),Y}checkBudget($,X){let Z=this.budgets.get($);if(!Z)return;let Y=X/Z.maxTime*100,J=Z.warnThreshold!==void 0?X>=Z.maxTime*Z.warnThreshold&&X<Z.maxTime:!1,G=X>=Z.maxTime;if(!J&&!G)return;let Q={label:$,actualTime:X,budgetTime:Z.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(Q)}catch{}let w=J?`[Performance Warning] "${$}" took ${X.toFixed(2)}ms (${Y.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${X.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(w);break;case"warn":console.warn(w);break;case"error":console.error(w);break;case"throw":if(G)throw Error(w);else console.warn(w);break}}recordTime($,X){let Z=this.metrics.get($);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 Y=this.budgets.get($);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:Y?.maxTime,budgetUtilization:Y?Z.totalTime/Z.count/Y.maxTime*100:void 0}}let X={};for(let[Z,Y]of this.metrics.entries()){let J=this.budgets.get(Z);X[Z]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}return X}getViolations($){if($)return this.violations.filter((X)=>X.label===$);return[...this.violations]}getViolationStats(){let $={},X=0,Z=0;for(let Y of this.violations)if($[Y.label]=($[Y.label]||0)+1,Y.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 oW(){if(!ZX)ZX=new S6;return ZX}var M5,rW=500,zV,ZX=null,C6;var I5=y(()=>{M5=new Map;zV=new b6;C6=new Proxy({},{get($,X){return oW()[X]}})});function P6($,X=""){let Z=`${$}${X}`,Y=0;for(let J=0;J<Z.length;J++){let G=Z.charCodeAt(J);Y=(Y<<5)-Y+G,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function v6($,X,Z={}){let{prefix:Y="",preserveHost:J=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!$.trim())return"";let w=YX($),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=x6(K,X,Y,J,W,Q);q.push(z)}return q.join(`
|
|
2543
2543
|
|
|
2544
2544
|
`)}function YX($){let X=[],Z=$.replace(/\/\*[\s\S]*?\*\//g,""),Y=0,J="",G=!1,Q="";for(let w=0;w<Z.length;w++){let q=Z[w];if(q==="@"&&Y===0)G=!0;if(q==="{")Y++;else if(q==="}"){if(Y--,Y===0){if(G){Q+=q;let W=Q.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,K,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=YX(U);X.push({selector:`@${K} ${z.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
|
|
2545
|
-
`)})}else X.push({selector:`@${K} ${z.trim()}`,declarations:U.trim()})}Q="",G=!1}else if(J.trim()){J+=q;let W=J.match(/([^{]+)\{([^}]*)\}/);if(W)X.push({selector:W[1].trim(),declarations:W[2].trim()});J=""}continue}}if(G)Q+=q;else J+=q}return X}function
|
|
2545
|
+
`)})}else X.push({selector:`@${K} ${z.trim()}`,declarations:U.trim()})}Q="",G=!1}else if(J.trim()){J+=q;let W=J.match(/([^{]+)\{([^}]*)\}/);if(W)X.push({selector:W[1].trim(),declarations:W[2].trim()});J=""}continue}}if(G)Q+=q;else J+=q}return X}function x6($,X,Z,Y,J,G){let{selector:Q,declarations:w}=$;if(Q.startsWith("@")){if(Q.startsWith("@keyframes")){let K=Q.replace("@keyframes ","").trim();return`@keyframes ${J.get(K)||K} { ${w} }`}if(Q.startsWith("@media")||Q.startsWith("@supports")||Q.startsWith("@container")){let z=YX(`x { ${w} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((U)=>x6(U,X,Z,Y,J,G)).join(`
|
|
2546
2546
|
`);return`${Q} {
|
|
2547
2547
|
${z}
|
|
2548
|
-
}`}return`${Q} { ${w} }`}let q=
|
|
2549
|
-
`)}function
|
|
2550
|
-
`,""}),headContent:X.trim()}}function
|
|
2551
|
-
`);for(let J of Y){let G=Z,Q=null,w=!1;for(let q=0;q<J.length;q++){let W=J[q];if(w){w=!1;continue}if(W==="\\"){w=!0;continue}if(Q){if(W===Q)Q=null;continue}if(W==="'"||W==='"'||W==="`"){Q=W;continue}if(W==="/"&&q+1<J.length&&J[q+1]==="/")break;if(W==="{")Z++;else if(W==="}")Z--}if(G===0){let q=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)X.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let W=J.match(/(?:const|let|var)\s+(\w+)/);if(W)X.push(W[1])}else{let W=J.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
|
|
2548
|
+
}`}return`${Q} { ${w} }`}let q=sW(Q,X,Z,Y),W=w;for(let[K,z]of J)W=W.replace(new RegExp(`\\b${K}\\b`,"g"),z);if(G)W=W.replace(/--([a-z-]+)/gi,`--${X}-$1`);return`${q} { ${W} }`}function sW($,X,Z,Y){let J=$.split(",").map((Q)=>Q.trim()),G=[];for(let Q of J){if(Q.startsWith(":host")){if(Y)G.push(Q);else{let W=Q.replace(/:host(\([^)]*\))?/,`.${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=aW(Q,X);if(q)G.push(Z?`${Z} ${q}`:q)}return G.join(", ")}function aW($,X){let Z=0,Y=$.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==="~")){Y=q;break}}let J=$.slice(0,Y),G=$.slice(Y);if(!J)return"";let Q=J.length,w=0;for(let q=0;q<J.length;q++){let W=J[q];if(W==="["||W==="(")w++;else if(W==="]"||W===")")w--;else if(Z===0&&w===0&&W===":"){Q=q;break}}return`${J.slice(0,Q)}.${X}${J.slice(Q)}${G}`}function g6($){let X=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let Y=Z.trim();if(X.has(Y))return"";return X.add(Y),Z})}function y8($,X){if(!tW.test($))return{html:$,hasScoped:!1};let Z=P6(X),Y=`data-v-${Z}`,J=$,G=new RegExp(`<style\\s+([^>]*${JX}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(J=J.replace(G,(w,q,W)=>{Q=!0;let K=eW(W,Y),z=q.replace(new RegExp(JX,"gi"),"").trim(),U=z?` ${z}`:"";return`<style data-stx-scoped="${Z}"${U}>${K}</style>`}),!Q)return{html:$,hasScoped:!1};return J=XK(J,Y),{html:J,hasScoped:!0}}function eW($,X){return v6($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${X}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${X}]`)}function XK($,X){let Z=q1($,(J,G)=>{let Q=D1(J,G);return Q>G?Q:T5(J,G)},(J,G)=>$K(G)),Y=ZK(Z.output,X);return f6.lastIndex=0,Y.replace(f6,(J,G)=>Z.tokens[Number(G)])}function ZK($,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,(Y,J,G)=>{if(Z.has(J.toLowerCase()))return Y;if(Y.includes(X))return Y;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return Y;if(G)return Y.replace(`<${J}${G}`,`<${J} ${X}${G}`);if(Y.endsWith("/>"))return`<${J} ${X} />`;return`<${J} ${X}>`})}var JX,tW,$K=($)=>`\x00stx-scope-mask-${$}\x00`,f6;var GX=y(()=>{r1();JX=String.raw`(?<![\w-])scoped(?![\w-])`,tW=new RegExp(`<style\\s+[^>]*${JX}`,"i");f6=/\u0000stx-scope-mask-(\d+)\u0000/g});function JK($){let X=$.replace(/^<template\b/i,"").replace(/>$/,"");return YK.test(X)}function b8($){S7.lastIndex=0;let X;while((X=S7.exec($))!==null){if(X[0].startsWith("</")||JK(X[0]))continue;let Z=X.index,Y=S7.lastIndex,J=1,G;while((G=S7.exec($))!==null)if(G[0].startsWith("</")){if(J--,J===0){let Q=G.index;return{start:Z,openEnd:Y,closeStart:Q,end:S7.lastIndex,content:$.slice(Y,Q)}}}else J++;return null}return null}var S7,YK;var QX=y(()=>{S7=/<\/?template\b[^>]*>/gi,YK=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var h6=()=>{};function E0($,X,Z,Y=0){let J=0,G=Y,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)J++;else if(W===Z){if(J--,J===0)return G}G++}return-1}var WX={};a(WX,{useTitle:()=>WK,useSeoMeta:()=>u6,usePageTitle:()=>WK,useHead:()=>qX,seoMetaToHeadConfig:()=>C8,resetHead:()=>wK,renderHtmlAttrs:()=>zK,renderHead:()=>KK,renderBodyAttrs:()=>UK,processTitleDirective:()=>_K,processMetaDirective:()=>HK,processHeadDirective:()=>BK,mergeHeadConfigs:()=>E5,getPageMeta:()=>QK,getHead:()=>wX,definePageMeta:()=>qK,applyHead:()=>jK});function wX(){return S1}function QK(){return S8}function wK(){S1={},GK.length=0,S8={}}function qX($){S1=E5(S1,$)}function E5($,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 u6($){qX(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,Y=$.ogDescription??$.description;if(Z)X.push({property:"og:title",content:Z});if(Y)X.push({property:"og:description",content:Y});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 J=$.twitterTitle??$.title,G=$.twitterDescription??$.description,Q=$.twitterImage??$.ogImage;if($.twitterCard)X.push({name:"twitter:card",content:$.twitterCard});if(J)X.push({name:"twitter:title",content:J});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 qK($){if(S8={...S8,...$},$.title||$.description)u6({title:$.title,description:$.description})}function WK($){let X=typeof $==="function"?$():$;qX({title:X})}function KK($=S1){let X=[];if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);X.push(`<title>${s1(Z)}</title>`)}if($.base){let Z=Object.entries($.base).map(([Y,J])=>`${Y}="${s1(J)}"`).join(" ");X.push(`<base ${Z}>`)}for(let Z of $.meta||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>{return`${J==="httpEquiv"?"http-equiv":J}="${s1(String(G))}"`}).join(" ");X.push(`<meta ${Y}>`)}for(let Z of $.link||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>`${J}="${s1(String(G))}"`).join(" ");X.push(`<link ${Y}>`)}for(let Z of $.script||[]){let{content:Y,...J}=Z,G=Object.entries(J).filter(([Q,w])=>w!==void 0).map(([Q,w])=>{if(typeof w==="boolean")return w?Q:"";return`${Q}="${s1(String(w))}"`}).filter(Boolean).join(" ");if(Y)X.push(`<script ${G}>${Y}</script>`);else X.push(`<script ${G}></script>`)}for(let Z of $.style||[]){let Y=Z.type?` type="${Z.type}"`:"";X.push(`<style${Y}>${Z.content}</style>`)}return X.join(`
|
|
2549
|
+
`)}function zK($=S1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([X,Z])=>`${X}="${s1(Z)}"`).join(" ")}function UK($=S1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([X,Z])=>`${X}="${s1(Z)}"`).join(" ")}function s1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function jK($=S1){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 Y=document.querySelector(Z);if(!Y){if(Y=document.createElement("meta"),X.name)Y.setAttribute("name",X.name);if(X.property)Y.setAttribute("property",X.property);document.head.appendChild(Y)}Y.setAttribute("content",X.content)}}for(let X of $.link||[]){let Z=`link[rel="${X.rel}"]${X.href?`[href="${X.href}"]`:""}`,Y=document.querySelector(Z);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[J,G]of Object.entries(X))if(G!==void 0)Y.setAttribute(J,String(G))}if($.htmlAttrs)for(let[X,Z]of Object.entries($.htmlAttrs))if(X==="class")for(let Y of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add(Y);else document.documentElement.setAttribute(X,Z);if($.bodyAttrs)for(let[X,Z]of Object.entries($.bodyAttrs))document.body.setAttribute(X,Z)}function BK($){let X="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,J)=>{return X+=J.trim()+`
|
|
2550
|
+
`,""}),headContent:X.trim()}}function _K($,X){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,Y,J,G)=>{let Q=Y?J:X[(G||"").trim()]??G,w=X.__stx_runtime_head??{};return X.__stx_runtime_head=E5(w,{title:Q}),""})}function HK($,X){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,Y,J,G,Q,w)=>{let q=G?Q:w,W=G?q:X[(q||"").trim()]??q,z=J.includes(":")?{property:J,content:W}:{name:J,content:W},U=X.__stx_runtime_head??{};return X.__stx_runtime_head=E5(U,{meta:[z]}),""})}var S1,GK,S8;var C7=y(()=>{S1={},GK=[],S8={}});var P8={};a(P8,{stripTypeScript:()=>i6,splitDeclaration:()=>t6,isModuleResolutionFailure:()=>n6,isMissingBindingFailure:()=>r6,isCompleteImport:()=>o6,hasVariables:()=>ZZ,extractVariables:()=>a1,extractScriptFromTemplate:()=>XZ,convertToCommonJS:()=>UX,STX_ENGINE_BINDING_NAMES:()=>zX});import C1 from"path";import D5 from"process";function LK($){let X=[],Z=0,Y=$.split(`
|
|
2551
|
+
`);for(let J of Y){let G=Z,Q=null,w=!1;for(let q=0;q<J.length;q++){let W=J[q];if(w){w=!1;continue}if(W==="\\"){w=!0;continue}if(Q){if(W===Q)Q=null;continue}if(W==="'"||W==='"'||W==="`"){Q=W;continue}if(W==="/"&&q+1<J.length&&J[q+1]==="/")break;if(W==="{")Z++;else if(W==="}")Z--}if(G===0){let q=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)X.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let W=J.match(/(?:const|let|var)\s+(\w+)/);if(W)X.push(W[1])}else{let W=J.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 i6($){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(Y){if(!Y.includes(":"))return Y;let J=[],G="",Q=0,w=0,q=null;for(let W=0;W<Y.length;W++){let K=Y[W];if(q){if(G+=K,K===q)q=null;continue}if(K==='"'||K==="'"||K==="`"){q=K,G+=K;continue}if(K==="<")Q++;else if(K===">"&&Q>0)Q--;else if(K==="(")w++;else if(K===")")w--;if(K===","&&Q===0&&w===0){J.push(G),G="";continue}G+=K}if(G)J.push(G);return J.map((W)=>{let K=W.trim(),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,(Y,J,G)=>{if(!G.includes(":"))return Y;return`${J}(${Z(G)})`});{let Y=/\b(function\s+\w*\s*)\(/g,J,G=[];while((J=Y.exec(X))!==null){let Q=J.index+J[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,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((Q)=>{let[w,...q]=Q.split("="),W=w.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),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,`
|
|
2552
2552
|
|
|
2553
|
-
`),X}function
|
|
2554
|
-
`),B5=X.params??{},T1=[],M1=[];for(let i=0;i<g.length;i++){if(g[i]==="params")continue;T1.push(g[i]),M1.push(r[i])}let G1=await Function(
|
|
2553
|
+
`),X}function n6($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function r6($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function a1($,X,Z,Y={}){if(!$.trim())return;let J;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=E.transformSync(v)}catch{J=i6($)}let G={exports:{}},Q=G.exports,w=D5.cwd(),q={},W=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((E)=>E[1]).filter((E)=>!E.startsWith("node:")&&!E.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(E));for(let E of W)try{let v=C1.resolve(w,"node_modules",E),m=C1.join(v,"package.json"),g=JSON.parse(j0("fs").readFileSync(m,"utf8")),r=g.main||"index.js";if(g.exports){let Q0=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof Q0==="string")r=Q0;else if(Q0?.bun)r=Q0.bun;else if(Q0?.import)r=Q0.import;else if(Q0?.default)r=Q0.default}q[E]=await import(C1.resolve(v,r))}catch{}let K=(E)=>{if(q[E])return q[E];return j0(E)},z=X.props||{},U=(E)=>{if(!E)return z;let v={};for(let[m,g]of Object.entries(E)){let r=z[m];if(r!==void 0)v[m]=r;else if(typeof g==="function")v[m]=g();else v[m]=g}return v};for(let[E,v]of Object.entries(z))Object.defineProperty(U,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,E))continue;try{Object.defineProperty(U,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(E)=>{if(!E)return z;let v={...z};for(let[m,g]of Object.entries(E)){let r=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(v[m]===void 0&&r.default!==void 0)v[m]=typeof r.default==="function"?r.default():r.default}return v},j=()=>X.slots||{},_=(E,v)=>{let m={...E};for(let[g,r]of Object.entries(v))if(m[g]===void 0)if(typeof r==="function")m[g]=r();else m[g]=r;return m},H=(E)=>{let v=()=>E;return v.set=(m)=>{},v.update=(m)=>{},v},L=(E)=>{let v,m=!1;return()=>{if(!m)try{v=E(),m=!0}catch{v=void 0}return v}},O=(E)=>{},F=(E)=>E(),V=(E)=>{},A=(E)=>{};function R(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)D({title:v.title,description:v.description})}function N(E){if(!E||typeof E!=="object")return;let v=X.__stxClientPayload??{};Object.assign(v,E),X.__stxClientPayload=v}let T=()=>{let E=X.__stxServeContext,v=X.__stxServeSearch??E?.search??"",m=E?.path??"",g=Object.fromEntries(new URLSearchParams(v)),r=X.query,Q0=Object.keys(g).length>0?g:r??{},s0=v||(Object.keys(Q0).length>0?`?${new URLSearchParams(Q0).toString()}`:"");return{params:X.params??{},query:Q0,path:m,name:"",fullPath:m+s0,hash:"",matched:[]}},M=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),k=(E)=>{let v=X.__stx_runtime_head||{};X.__stx_runtime_head=E5(v,E||{})},D=(E)=>{k(C8(E||{}))},I=(E)=>({value:E}),S=(E)=>E,b=(E)=>({value:typeof E==="function"?E():E}),C=(E,v)=>{},P=(E)=>{},x=(E)=>{},f=(E)=>E?E():Promise.resolve(),l=(E)=>(v,...m)=>{},$0=(E)=>{},C0=(E,v)=>{},U0=(E,v)=>v,A0=()=>({value:"light"}),u=()=>H(!1),t=(E)=>H(!1),R0=()=>H(!1),P0=()=>t("(prefers-color-scheme: dark)"),U5=()=>t("(prefers-color-scheme: light)"),j5=()=>t("(prefers-reduced-motion: reduce)"),n=()=>t("(prefers-contrast: more)"),s={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(s,{get(E,v){if(v in E)return E[v];return},set(E,v,m){return E[v]=m,!0}}),I0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},w0=console;try{let E=UX(J,Z),v=new Set(Object.keys(z)),m=(i)=>/^[a-z_$][\w$]*$/i.test(i),g=Object.keys(X).filter((i)=>!v.has(i)&&i!=="props"&&m(i)),r=g.map((i)=>X[i]);if(!g.includes("__stxServeContext"))g.push("__stxServeContext"),r.push(void 0);let Q0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),s0=[],f0=[];for(let[i,Q1]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(Q0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(E))continue;s0.push(i),f0.push(Q1)}let a0=LK(E).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
|
|
2554
|
+
`),B5=X.params??{},T1=[],M1=[];for(let i=0;i<g.length;i++){if(g[i]==="params")continue;T1.push(g[i]),M1.push(r[i])}let G1=await Function(...zX,...s0,...T1,`return (async () => {
|
|
2555
2555
|
${E}
|
|
2556
2556
|
${a0}
|
|
2557
2557
|
return module.exports
|
|
2558
|
-
})()`)(G,Q,K,z,U,B,_,N,H,L,O,F,V,A,R,T,M,k,D,I,S,b,C,P,x,f,l,$0,j,C0,U0,A0,u,t,R0,P0,U5,j5,n,K0,I0,w0,s.confirm,s.alert,s.fetch,B5,...f0,...M1);if(Y.preserveExisting){for(let[i,Q1]of Object.entries(G1))if(!(i in X)||X[i]===void 0)X[i]=Q1}else Object.assign(X,G1);for(let[i,Q1]of Object.entries(z))if(!(i in X))X[i]=Q1}catch(E){let v=E instanceof Error?E.message:String(E);if(
|
|
2558
|
+
})()`)(G,Q,K,z,U,B,_,N,H,L,O,F,V,A,R,T,M,k,D,I,S,b,C,P,x,f,l,$0,j,C0,U0,A0,u,t,R0,P0,U5,j5,n,K0,I0,w0,s.confirm,s.alert,s.fetch,B5,...f0,...M1);if(Y.preserveExisting){for(let[i,Q1]of Object.entries(G1))if(!(i in X)||X[i]===void 0)X[i]=Q1}else Object.assign(X,G1);for(let[i,Q1]of Object.entries(z))if(!(i in X))X[i]=Q1}catch(E){let v=E instanceof Error?E.message:String(E);if(n6(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(r6(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(D5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await NK(J,X,Z)}catch(m){if(D5.env.STX_DEBUG){let g=m instanceof Error?m.message:String(m);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${g}`)}}}}function o6($){let X=0,Z=null,Y=!1,J=!1;for(let G=0;G<$.length;G++){let Q=$[G];if(Z){if(Q===Z){if(Z=null,Y||X===0)J=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")X++;else if(Q==="}")X--;else if($.startsWith("from",G)&&X===0)Y=!0}return Z===null&&X===0&&J}function UX($,X){let Z=X?C1.dirname(X):D5.cwd(),Y=D5.cwd(),J=$.split(`
|
|
2559
2559
|
`),G=[],Q=0;while(Q<J.length){let w=J[Q].trim();if(w.startsWith("interface ")||w.startsWith("export interface ")||w.startsWith("type ")||w.startsWith("export type ")){if(w.includes("{")&&!w.includes("}")){let q=0;for(;Q<J.length;Q++){for(let W of J[Q])if(W==="{")q++;else if(W==="}")q--;if(q<=0)break}}Q++;continue}if(w.startsWith("definePageMeta(")){let q=0,W=!1,K=Q;for(let B=Q;B<J.length&&!W;B++){let j=null,_=!1,H=J[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=J.length;let z=J.slice(K,Q).join(`
|
|
2560
|
-
`),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(!
|
|
2561
|
-
`+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
|
|
2562
|
-
`),Z,Y)}function
|
|
2563
|
-
`)w=!1;G++;continue}if(q){if(J+=K,K==="*"&&z==="/"){J+=z,G+=2,q=!1;continue}G++;continue}if(!Q&&K==="/"&&z==="/"){w=!0,J+=K,G++;continue}if(!Q&&K==="/"&&z==="*"){q=!0,J+=K,G++;continue}if(Q){if(J+=K,K==="\\"){J+=z,G+=2;continue}if(K===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(K==="$"&&z==="{"){W++,J+=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,J+=K,G++;continue}if(K==="a"&&$.startsWith("await",G)){let U=
|
|
2560
|
+
`),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(!o6(q)&&Q+W+1<J.length)W++,q=`${q} ${J[Q+W].trim()}`;Q+=W;let K=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),U=q.match(/^import\s+['"](.+?)['"]/),B=q,j=(_)=>{if(_.startsWith("."))return C1.resolve(Z,_);if(_.startsWith("~/")||_.startsWith("@/"))return C1.resolve(Y,_.slice(2));return _};if(K){let[,_,H]=K,L=j(H);G.push(`const ${_} = await import('${L}')`),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,M]=[N[0].trim(),N[1].trim()];if(V&&d6.has(T)){G.push(`const ${M} = ${T};`),F.push(M);continue}O.push(`${T}: ${M}`),F.push(M)}else{if(V&&d6.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((w.startsWith("const ")||w.startsWith("let ")||w.startsWith("var ")||w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var "))&&!w.includes("="))G.push(J[Q]),Q++;else if(w.startsWith("export const ")||w.startsWith("export let ")||w.startsWith("export var ")){let q=m6(J,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=KX(J,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("const ")||w.startsWith("let ")||w.startsWith("var ")){let q=m6(J,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=KX(J,Q);G.push(q.functionCode),G.push(`module.exports.${q.name} = ${q.name};`),Q=q.nextIndex}else if(w.startsWith("export default function ")||w.startsWith("export default async function ")){let q=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...J];W[Q]=q;let K=KX(W,Q);if(G.push(K.functionCode),K.name)G.push(`module.exports.default = ${K.name};`);Q=K.nextIndex}else if(w.startsWith("export default ")){let q=w.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${q};`),Q++}else if(w.startsWith("class ")||w.startsWith("export class ")){let q=w.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],K=J[Q].replace(/^export\s+/,""),z=0,U=Q;for(;U<J.length;U++){let B=J[U];for(let j of B)if(j==="{")z++;else if(j==="}")z--;if(U>Q)K+=`
|
|
2561
|
+
`+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 FK(G.join(`
|
|
2562
|
+
`),Z,Y)}function FK($,X,Z){let Y=$.length,J="",G=0,Q=null,w=!1,q=!1,W=0;while(G<Y){let K=$[G],z=$[G+1];if(w){if(J+=K,K===`
|
|
2563
|
+
`)w=!1;G++;continue}if(q){if(J+=K,K==="*"&&z==="/"){J+=z,G+=2,q=!1;continue}G++;continue}if(!Q&&K==="/"&&z==="/"){w=!0,J+=K,G++;continue}if(!Q&&K==="/"&&z==="*"){q=!0,J+=K,G++;continue}if(Q){if(J+=K,K==="\\"){J+=z,G+=2;continue}if(K===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(K==="$"&&z==="{"){W++,J+=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,J+=K,G++;continue}if(K==="a"&&$.startsWith("await",G)){let U=VK($,G);if(U){let{quote:B,path:j,end:_}=U;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let H=j.startsWith(".")?C1.resolve(X,j):C1.resolve(Z,j.slice(2));J+=`await import(${B}${H}${B})`,G=_;continue}}}J+=K,G++}return J}function VK($,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 Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=Z;while(Z<$.length&&$[Z]!==Y)if($[Z]==="\\")Z+=2;else Z++;if(Z>=$.length)return null;let G=$.slice(J,Z);Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return{quote:Y,path:G,end:Z+1}}function s6($,X){let Z=$[X];if(Z!=="{"&&Z!=="[")return null;let J=E0($,Z,Z==="{"?"}":"]",X);if(J===-1)return null;return{pattern:$.slice(X,J+1),endPos:J+1}}function a6($){let X=[],Z=$.slice(1,-1).trim();if(!Z)return X;let Y=0,J=0,G="";while(Y<Z.length){let Q=Z[Y];if(Q==="{"||Q==="["){if(J++,J===1){let w=s6(Z,Y);if(w){let q=a6(w.pattern);X.push(...q),Y=w.endPos,G="";continue}}}else if(Q==="}"||Q==="]")J--;if(J>0){Y++;continue}if(Q===","){if(G.trim())X.push(G.trim());G="",Y++;continue}if(Q===":"){G="",Y++;continue}if(Q==="="){if(G.trim())X.push(G.trim());G="",Y++;while(Y<Z.length&&Z[Y]!==","&&J===0){if(Z[Y]==="{"||Z[Y]==="[")J++;else if(Z[Y]==="}"||Z[Y]==="]")J--;Y++}continue}if(/[\w$]/.test(Q))G+=Q;Y++}if(G.trim())X.push(G.trim());return X}function t6($){let X=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!X)return null;let Z=X[0].length,Y=(J)=>J===" "||J==="\t";while(Z<$.length&&Y($[Z]))Z++;if($[Z]===":"){let J=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==="<"){J++;continue}if(Q===")"||Q==="]"||Q==="}"||Q===">"){J--;continue}if(Q==="="&&J<=0){let w=$[Z+1],q=$[Z-1];if(w!=="="&&w!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if($[Z]!=="=")return null}while(Z<$.length&&Y($[Z]))Z++;if($[Z]!=="=")return null;return{type:X[1],name:X[2],value:$.slice(Z+1).trim()}}function m6($,X){let Z=$[X].trim(),Y=t6(Z),J=Y?[Z,Y.type,Y.name,Y.value]:null;if(!J){let K=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(K){let z=Z.slice(K[0].length),U=X;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let j=z.startsWith("{")?"}":"]",_=z;for(let H=X+1;H<$.length;H++)if(_+=" "+$[H].trim(),U=H,$[H].includes(j))break;z=_}let B=s6(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(l6(L)){let N=c6($,F,L);O=N.value,F=N.nextIndex}else F=F+1;O=O.trim().replace(/;$/,"");let V=a6(_),A=`__stx_src_${X}`,R=V.map((N)=>`module.exports.${N} = ${N};`).join(`
|
|
2564
2564
|
`);return{type:j,name:A,value:`${O}; ${j} ${_} = ${A};
|
|
2565
|
-
${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,w]=J,q=w,W=X;if(
|
|
2566
|
-
${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:G,name:Q,value:q,nextIndex:W}}function KX($,X){let Z=$[X].trim(),Y=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${Z}`);let[,J]=Y,G=Z.replace(/^export\s+/,""),Q=X;if(
|
|
2565
|
+
${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,w]=J,q=w,W=X;if(l6(w)){let K=c6($,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+=`
|
|
2566
|
+
${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:G,name:Q,value:q,nextIndex:W}}function KX($,X){let Z=$[X].trim(),Y=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${Z}`);let[,J]=Y,G=Z.replace(/^export\s+/,""),Q=X;if(AK(Z)){let w=RK($,X,G);G=w.functionCode,Q=w.nextIndex}else Q=X+1;return{name:J,functionCode:G,nextIndex:Q}}function l6($){let X=$.trim();if(X.startsWith("{"))return E0(X,"{","}",0)===-1;if(X.startsWith("["))return E0(X,"[","]",0)===-1;return!e6(X)}function e6($){let X={paren:0,bracket:0,brace:0},Z=null,Y=0;for(let J=0;J<$.length;J++){let G=$[J];if((J>0?$[J-1]:"")==="\\"&&Z)continue;if((G==='"'||G==="'")&&!Z){Z=G;continue}if(G===Z&&Z!=="`"){Z=null;continue}if(G==="`"&&!Z){Z="`";continue}if(G==="`"&&Z==="`"&&Y===0){Z=null;continue}if(Z==="`"&&G==="$"&&$[J+1]==="{"){Y++,J++;continue}if(Y>0&&G==="{"){Y++;continue}if(Y>0&&G==="}"){Y--;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 $Z($){let X=$.indexOf("(");if(X===-1)return $.indexOf("{");let Z=E0($,"(",")",X);if(Z===-1)return-1;return $.indexOf("{",Z)}function AK($){let X=$Z($);if(X===-1)return!0;return E0($,"{","}",X)===-1}function c6($,X,Z){let Y=Z,J=X+1;while(J<$.length&&!e6(Y)){let G=$[J];Y+=`
|
|
2567
2567
|
${G}`,J++}while(J<$.length){let G=$[J].trim();if(G.startsWith(".")||G.startsWith("?."))Y+=`
|
|
2568
|
-
${$[J]}`,J++;else break}return{value:Y,nextIndex:J}}function
|
|
2569
|
-
${Q}`,J++}return{functionCode:Y,nextIndex:J}}function l6($,X){let Z=Y0($,X)??Y0(`(${$})`,X);if(Z!==void 0)return Z;if(!/\bprocess\b/.test($))return;let Y={...X,process:Object.freeze({env:{...D5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${$});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${$};`)(...Object.values(Y))}catch{return}}}async function VK($,X,Z){let Y=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of Y){let[,,Q,w]=G;try{let q=w.trim().replace(/;$/,""),W=l6(q,X);if(W!==void 0)X[Q]=W}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}let J=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of J){let[,,Q,w]=G;if(!(Q in X))try{let q=w.trim().replace(/;$/,""),W=l6(q,X);if(W!==void 0)X[Q]=W}catch{}}}function e6($){let X=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=X?X[1]:"",Y=X?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Z,templateWithoutScript:Y}}function $Z($){let X=$.trim();if(!X)return!1;return/(?:const|let|var|function)\s+\w+/.test(X)}var P7=y(()=>{C7();E1();T0()});var UX={};a(UX,{renderSlot:()=>ZZ,processSlots:()=>JZ,parseSlots:()=>XZ,parseSlotElement:()=>MK,extractSlotContent:()=>EK,applySlots:()=>DK});function AK($,X){let Z=1,Y=X,J="<template",G="</template";while(Y<$.length&&Z>0){let Q=$.indexOf("<",Y);if(Q===-1)break;if(Y=Q,$.startsWith(J,Y)&&(Y+J.length>=$.length||/[\s>\/]/.test($[Y+J.length]))){Z++,Y+=J.length;continue}if($.startsWith(G,Y)){let w=$.indexOf(">",Y+G.length);if(w!==-1){if(Z--,Z===0)return w+1;Y=w+1;continue}}Y++}return Z===0?Y:-1}function NK($,X){let Z=null;for(let Y=X;Y<$.length;Y++){let J=$[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"){Z=J;continue}if(J===">")return Y+1}return-1}function TK($){let X=[],Z=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<$.length){let G=$.indexOf("<",J);if(G===-1)break;if($.startsWith("<!--",G)){let U=$.indexOf("-->",G+4);J=U===-1?$.length:U+3;continue}let Q=NK($,G+1);if(Q===-1)break;let w=$.slice(G,Q),q=w.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){J=Q;continue}let W=q[1]==="/",K=q[2].toLowerCase();if(W){let U=Z.lastIndexOf(K);if(U!==-1)Z.splice(U);J=Q;continue}if(K==="template"&&Z.length===0){let U=w.match(Y);if(U){let B=AK($,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}),J=B;continue}}}if(!/\/\s*>$/.test(w)&&!RK.has(K)){if(Z.push(K),K==="script"||K==="style"){let U=$.toLowerCase().indexOf(`</${K}>`,Q);if(U!==-1){J=U;continue}}}J=Q}return X}function XZ($){let X={default:"",named:new Map},Z=$,Y=TK($);for(let q of Y)X.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});Y.sort((q,W)=>W.start-q.start);for(let q of Y)Z=Z.slice(0,q.start)+Z.slice(q.end);let J=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[q,W,K,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}>`;J.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}${_?" "+_:""} />`;J.push({start:Q.index,end:Q.index+q.length,slotName:z,element:H})}J.sort((q,W)=>W.start-q.start);for(let q of J){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 MK($){let X=$.match(/name\s*=\s*["']([^"']+)["']/),Z=X?X[1]:"",Y={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=J.exec($))!==null)Y[G[1]]=G[2];let Q=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),w=Q?Q[1].trim():"";return{name:Z,props:Y,defaultContent:w}}async function ZZ($,X,Z,Y){if(!$)return Z;let J=$.content;if($.propsBinding&&Object.keys(X).length>0){let G=$.propsBinding.trim(),Q={...Y};if(G.startsWith("{")&&G.endsWith("}")){let w=G.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of w){let[W,K]=q.split(":").map((U)=>U.trim()),z=K||W;if(X[W]!==void 0)Q[z]=X[W]}}else Q[G]=X;J=kK(J,Q)}return J}function kK($,X){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,Y)=>{try{let J=Y.trim(),G=YZ(J,X);return t0(String(G??""))}catch{return`{{ ${Y} }}`}})}function YZ($,X){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let Y=$.split("."),J=X;for(let G of Y)if(J&&typeof J==="object"&&G in J)J=J[G];else return;return J}let Z=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,Y,J,G]=Z,Q=X[Y],w=parseInt(G,10);if(typeof Q==="number")switch(J){case"+":return Q+w;case"-":return Q-w;case"*":return Q*w;case"/":return Q/w}}try{if(!q0($))return;return W0($,Object.keys(X))(...Object.values(X))}catch{return}}async function JZ($,X,Z){let Y=$;Y=await IK(Y,/<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 ZZ(K,B,z,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(G,(Q,w)=>{if(Q.includes("name="))return Q;let q=w?.trim()||"";return X.default||q}),Y}async function IK($,X,Z){let Y=[],J=[];$.replace(X,(w,...q)=>{let W=q[q.length-2];return J.push({match:w,index:W}),Y.push(Z(w,...q.slice(0,-2))),w});let G=await Promise.all(Y),Q=$;for(let w=J.length-1;w>=0;w--){let{match:q,index:W}=J[w];Q=Q.slice(0,W)+G[w]+Q.slice(W+q.length)}return Q}function EK($){let X=XZ($);return{defaultSlot:X.default,namedSlots:X.named}}async function DK($,X,Z,Y){return await JZ($,{default:X,named:Z},Y)}var RK;var jX=y(()=>{W1();T0();RK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function P1($,X){let Z=yK($,X);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function yK($,X){let Z=X;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let Y=E0($,"(",")",Z);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:$.slice(Z+1,Y),endPos:Y+1}}function bK($,X){let Z=$.lastIndexOf("<",X);if(Z===-1)return!1;return Z>$.lastIndexOf(">",X)}function t1($,X,Z,Y){let J=1,G=Y,Q=new RegExp(`@${X}\\s*\\(`,"g"),w=new RegExp(`@${Z}(?![a-z])`,"g");while(G<$.length&&J>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)J++,G=K+q[0].length;else if(z<1/0){if(J--,J===0)return z;G=z+W[0].length}else break}return-1}function GZ($,X){let Z=$.slice(X).match(/^@if\s*/);if(!Z)return null;let Y=X+Z[0].length,J=P1($,Y);if(!J)return null;let G=J.endPos,Q=t1($,"if","endif",G);if(Q===-1)return null;let w=$.slice(G,Q),q=[],W=0,K="if",z=J.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(bK(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=P1(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 v7($){let X=[],Z=/@if\s*\(/g,Y=Z.exec($);while(Y!==null){if(X.some((Q)=>Y.index>Q.start&&Y.index<Q.end)){Y=Z.exec($);continue}let G=GZ($,Y.index);if(G)X.push(G),Z.lastIndex=G.end;Y=Z.exec($)}return X}function v8($,X,Z){let Y=[],J=new RegExp(`@${X}\\s*\\(`,"g"),G=J.exec($);while(G!==null){if(Y.some((_)=>G.index>_.start&&G.index<_.end)){G=J.exec($);continue}let w=G.index,q=w+G[0].length-1,W=E0($,"(",")",q);if(W===-1){G=J.exec($);continue}let K=$.slice(q+1,W),z=W+1,U=t1($,X,Z,z);if(U===-1){G=J.exec($);continue}let B=$.slice(z,U),j=U+`@${Z}`.length;Y.push({fullMatch:$.slice(w,j),name:X,params:K,content:B,start:w,end:j}),J.lastIndex=j,G=J.exec($)}return Y}function BX($,X){let Z=$.slice(X).match(/^@switch\s*/);if(!Z)return null;let Y=X+Z[0].length,J=P1($,Y);if(!J)return null;let G=J.endPos,Q=t1($,"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=P1(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:J.expression,cases:q,start:X,end:Q+10}}var QZ=()=>{};var wZ=()=>{};var x8=y(()=>{QZ();wZ()});async function WZ($){let X=$;if(!X)try{X=(await e0())?.pagesDir||"pages"}catch{X="pages"}let Z=X,Y=qZ.get(Z);if(Y)return Y;let J=[];try{J=B7(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{J=[]}return qZ.set(Z,J),J}var qZ;var KZ=y(()=>{x9();L1();qZ=new Map});function vK($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function zZ($){return vK(JSON.stringify($))}function f8($){let X=0;while(X<$.length){let Z=$.slice(X),Y=/<body\b([^>]*)>/i.exec(Z);if(!Y)return null;let J=X+Y.index,G=-1,Q="";for(let q of xK){let W=q.open.exec(Z);if(!W)continue;let K=X+W.index;if(K<J&&(G===-1||K<G))G=K,Q=q.close}if(G===-1)return{index:J,tag:Y[0],attrs:Y[1]??""};let w=$.toLowerCase().indexOf(Q,G);if(w===-1)return null;X=w+Q.length}return null}function _X($,X){let Z=f8($);if(!Z)return $;return $.slice(0,Z.index)+X(Z.tag,Z.attrs)+$.slice(Z.index+Z.tag.length)}var xK;var HX=y(()=>{xK=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function v1($){let X=$,Z=new Set,Y=new Set,J=()=>{if(c0)Y.add(c0);return X};return J.set=(G)=>{if(!Object.is(G,X)){let Q=X;if(X=G,Z.forEach((w)=>w(X,Q)),x7)Y.forEach((w)=>h8.add(w));else Y.forEach((w)=>w())}},J.update=(G)=>{J.set(G(X))},J.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(G)=>J.set(G),configurable:!0}),J}function d8($){let X,Z=!0,Y=new Set,J=()=>{if(!Z)if(Z=!0,x7)Y.forEach((Q)=>h8.add(Q));else Y.forEach((Q)=>Q())},G=()=>{if(c0)Y.add(c0);if(Z){let Q=c0;c0=J,g8.push(J);try{X=$()}finally{g8.pop(),c0=Q}Z=!1}return X};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function m8($,X={}){let Z,Y=!1,J=()=>{if(Y)return;if(Z)Z(),Z=void 0;let G=c0;c0=J,g8.push(J);try{let Q=$();Z=typeof Q==="function"?Q:void 0}finally{g8.pop(),c0=G}};if(X.immediate!==!1)J();return()=>{if(Y=!0,Z)Z()}}function LX($){if(x7){$();return}x7=!0;try{$()}finally{x7=!1,h8.forEach((X)=>X()),h8.clear()}}function FX($){OX.push($)}function VX($){u8.push($)}function fK(){UZ(OX,"onMount",u8)}function gK(){UZ(u8,"onDestroy")}function UZ($,X,Z){let Y=$.splice(0,$.length);for(let J of Y)try{let G=J();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${X} callback threw:`,G)}}function hK(){return{mount:OX.length,destroy:u8.length}}function l8($){return typeof $==="function"&&$._isSignal===!0}function c8($){return typeof $==="function"&&$._isDerived===!0}function AX($){if(l8($)||c8($))return $();return $}function p8($){let X=c0;c0=null;try{return $()}finally{c0=X}}function uK($,X){let Z=typeof $==="function"?$:()=>$,Y=v1([]),J=d8(()=>Y().reduce((w,q)=>X(w,q.action),Z())),G=!1;return m8(()=>{if(Z(),!G){G=!0;return}if(p8(()=>Y().length))Y.set([])}),[J,(w,q)=>{let W={action:w};Y.set([...Y(),W]);let K=()=>{let z=Y().filter((U)=>U!==W);if(z.length!==Y().length)Y.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(K,K);return K}]}var c0=null,g8,x7=!1,h8,OX,u8;var i8=y(()=>{g8=[],h8=new Set,OX=[],u8=[]});var BZ={};a(BZ,{useOptimistic:()=>uK,untrack:()=>AX,state:()=>v1,runMountCallbacks:()=>fK,runDestroyCallbacks:()=>gK,pendingLifecycleCounts:()=>hK,peek:()=>p8,onMount:()=>FX,onDestroy:()=>VX,isSignal:()=>l8,isDerived:()=>c8,generateSignalsRuntimeDev:()=>RX,generateSignalsRuntime:()=>jZ,effect:()=>m8,derived:()=>d8,default:()=>mK,batch:()=>LX});function jZ(){let $=dK(RX());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 dK($){let X=[],Z=0,Y="console.log(";while(Z<$.length){let J=$.indexOf(Y,Z);if(J===-1){X.push($.slice(Z));break}X.push($.slice(Z,J));let G=1,Q=J+Y.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 RX(){return`
|
|
2568
|
+
${$[J]}`,J++;else break}return{value:Y,nextIndex:J}}function RK($,X,Z){let Y=Z,J=X+1;while(J<$.length){let G=$Z(Y);if(G!==-1){if(E0(Y,"{","}",G)!==-1)break}let Q=$[J];Y+=`
|
|
2569
|
+
${Q}`,J++}return{functionCode:Y,nextIndex:J}}function p6($,X){let Z=Y0($,X)??Y0(`(${$})`,X);if(Z!==void 0)return Z;if(!/\bprocess\b/.test($))return;let Y={...X,process:Object.freeze({env:{...D5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${$});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${$};`)(...Object.values(Y))}catch{return}}}async function NK($,X,Z){let Y=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of Y){let[,,Q,w]=G;try{let q=w.trim().replace(/;$/,""),W=p6(q,X);if(W!==void 0)X[Q]=W}catch(q){console.warn(`Failed to parse export ${Q} in fallback:`,q)}}let J=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of J){let[,,Q,w]=G;if(!(Q in X))try{let q=w.trim().replace(/;$/,""),W=p6(q,X);if(W!==void 0)X[Q]=W}catch{}}}function XZ($){let X=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=X?X[1]:"",Y=X?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Z,templateWithoutScript:Y}}function ZZ($){let X=$.trim();if(!X)return!1;return/(?:const|let|var|function)\s+\w+/.test(X)}var zX,d6,OK;var P7=y(()=>{C7();E1();T0();zX=["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"],d6=new Set(zX),OK=new Set(["stx","@stacksjs/stx"])});var jX={};a(jX,{renderSlot:()=>JZ,processSlots:()=>QZ,parseSlots:()=>YZ,parseSlotElement:()=>EK,extractSlotContent:()=>bK,applySlots:()=>SK});function TK($,X){let Z=1,Y=X,J="<template",G="</template";while(Y<$.length&&Z>0){let Q=$.indexOf("<",Y);if(Q===-1)break;if(Y=Q,$.startsWith(J,Y)&&(Y+J.length>=$.length||/[\s>\/]/.test($[Y+J.length]))){Z++,Y+=J.length;continue}if($.startsWith(G,Y)){let w=$.indexOf(">",Y+G.length);if(w!==-1){if(Z--,Z===0)return w+1;Y=w+1;continue}}Y++}return Z===0?Y:-1}function kK($,X){let Z=null;for(let Y=X;Y<$.length;Y++){let J=$[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"){Z=J;continue}if(J===">")return Y+1}return-1}function IK($){let X=[],Z=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<$.length){let G=$.indexOf("<",J);if(G===-1)break;if($.startsWith("<!--",G)){let U=$.indexOf("-->",G+4);J=U===-1?$.length:U+3;continue}let Q=kK($,G+1);if(Q===-1)break;let w=$.slice(G,Q),q=w.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){J=Q;continue}let W=q[1]==="/",K=q[2].toLowerCase();if(W){let U=Z.lastIndexOf(K);if(U!==-1)Z.splice(U);J=Q;continue}if(K==="template"&&Z.length===0){let U=w.match(Y);if(U){let B=TK($,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}),J=B;continue}}}if(!/\/\s*>$/.test(w)&&!MK.has(K)){if(Z.push(K),K==="script"||K==="style"){let U=$.toLowerCase().indexOf(`</${K}>`,Q);if(U!==-1){J=U;continue}}}J=Q}return X}function YZ($){let X={default:"",named:new Map},Z=$,Y=IK($);for(let q of Y)X.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});Y.sort((q,W)=>W.start-q.start);for(let q of Y)Z=Z.slice(0,q.start)+Z.slice(q.end);let J=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[q,W,K,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}>`;J.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}${_?" "+_:""} />`;J.push({start:Q.index,end:Q.index+q.length,slotName:z,element:H})}J.sort((q,W)=>W.start-q.start);for(let q of J){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 EK($){let X=$.match(/name\s*=\s*["']([^"']+)["']/),Z=X?X[1]:"",Y={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=J.exec($))!==null)Y[G[1]]=G[2];let Q=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),w=Q?Q[1].trim():"";return{name:Z,props:Y,defaultContent:w}}async function JZ($,X,Z,Y){if(!$)return Z;let J=$.content;if($.propsBinding&&Object.keys(X).length>0){let G=$.propsBinding.trim(),Q={...Y};if(G.startsWith("{")&&G.endsWith("}")){let w=G.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of w){let[W,K]=q.split(":").map((U)=>U.trim()),z=K||W;if(X[W]!==void 0)Q[z]=X[W]}}else Q[G]=X;J=DK(J,Q)}return J}function DK($,X){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,Y)=>{try{let J=Y.trim(),G=GZ(J,X);return t0(String(G??""))}catch{return`{{ ${Y} }}`}})}function GZ($,X){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let Y=$.split("."),J=X;for(let G of Y)if(J&&typeof J==="object"&&G in J)J=J[G];else return;return J}let Z=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,Y,J,G]=Z,Q=X[Y],w=parseInt(G,10);if(typeof Q==="number")switch(J){case"+":return Q+w;case"-":return Q-w;case"*":return Q*w;case"/":return Q/w}}try{if(!q0($))return;return W0($,Object.keys(X))(...Object.values(X))}catch{return}}async function QZ($,X,Z){let Y=$;Y=await yK(Y,/<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]=GZ(L,Z)}return await JZ(K,B,z,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(G,(Q,w)=>{if(Q.includes("name="))return Q;let q=w?.trim()||"";return X.default||q}),Y}async function yK($,X,Z){let Y=[],J=[];$.replace(X,(w,...q)=>{let W=q[q.length-2];return J.push({match:w,index:W}),Y.push(Z(w,...q.slice(0,-2))),w});let G=await Promise.all(Y),Q=$;for(let w=J.length-1;w>=0;w--){let{match:q,index:W}=J[w];Q=Q.slice(0,W)+G[w]+Q.slice(W+q.length)}return Q}function bK($){let X=YZ($);return{defaultSlot:X.default,namedSlots:X.named}}async function SK($,X,Z,Y){return await QZ($,{default:X,named:Z},Y)}var MK;var BX=y(()=>{W1();T0();MK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function P1($,X){let Z=CK($,X);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function CK($,X){let Z=X;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let Y=E0($,"(",")",Z);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:$.slice(Z+1,Y),endPos:Y+1}}function PK($,X){let Z=$.lastIndexOf("<",X);if(Z===-1)return!1;return Z>$.lastIndexOf(">",X)}function t1($,X,Z,Y){let J=1,G=Y,Q=new RegExp(`@${X}\\s*\\(`,"g"),w=new RegExp(`@${Z}(?![a-z])`,"g");while(G<$.length&&J>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)J++,G=K+q[0].length;else if(z<1/0){if(J--,J===0)return z;G=z+W[0].length}else break}return-1}function wZ($,X){let Z=$.slice(X).match(/^@if\s*/);if(!Z)return null;let Y=X+Z[0].length,J=P1($,Y);if(!J)return null;let G=J.endPos,Q=t1($,"if","endif",G);if(Q===-1)return null;let w=$.slice(G,Q),q=[],W=0,K="if",z=J.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(PK(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=P1(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 v7($){let X=[],Z=/@if\s*\(/g,Y=Z.exec($);while(Y!==null){if(X.some((Q)=>Y.index>Q.start&&Y.index<Q.end)){Y=Z.exec($);continue}let G=wZ($,Y.index);if(G)X.push(G),Z.lastIndex=G.end;Y=Z.exec($)}return X}function v8($,X,Z){let Y=[],J=new RegExp(`@${X}\\s*\\(`,"g"),G=J.exec($);while(G!==null){if(Y.some((_)=>G.index>_.start&&G.index<_.end)){G=J.exec($);continue}let w=G.index,q=w+G[0].length-1,W=E0($,"(",")",q);if(W===-1){G=J.exec($);continue}let K=$.slice(q+1,W),z=W+1,U=t1($,X,Z,z);if(U===-1){G=J.exec($);continue}let B=$.slice(z,U),j=U+`@${Z}`.length;Y.push({fullMatch:$.slice(w,j),name:X,params:K,content:B,start:w,end:j}),J.lastIndex=j,G=J.exec($)}return Y}function _X($,X){let Z=$.slice(X).match(/^@switch\s*/);if(!Z)return null;let Y=X+Z[0].length,J=P1($,Y);if(!J)return null;let G=J.endPos,Q=t1($,"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=P1(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:J.expression,cases:q,start:X,end:Q+10}}var qZ=()=>{};var WZ=()=>{};var x8=y(()=>{qZ();WZ()});async function zZ($){let X=$;if(!X)try{X=(await e0())?.pagesDir||"pages"}catch{X="pages"}let Z=X,Y=KZ.get(Z);if(Y)return Y;let J=[];try{J=B7(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{J=[]}return KZ.set(Z,J),J}var KZ;var UZ=y(()=>{x9();L1();KZ=new Map});function gK($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function jZ($){return gK(JSON.stringify($))}function f8($){let X=0;while(X<$.length){let Z=$.slice(X),Y=/<body\b([^>]*)>/i.exec(Z);if(!Y)return null;let J=X+Y.index,G=-1,Q="";for(let q of hK){let W=q.open.exec(Z);if(!W)continue;let K=X+W.index;if(K<J&&(G===-1||K<G))G=K,Q=q.close}if(G===-1)return{index:J,tag:Y[0],attrs:Y[1]??""};let w=$.toLowerCase().indexOf(Q,G);if(w===-1)return null;X=w+Q.length}return null}function HX($,X){let Z=f8($);if(!Z)return $;return $.slice(0,Z.index)+X(Z.tag,Z.attrs)+$.slice(Z.index+Z.tag.length)}var hK;var OX=y(()=>{hK=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function v1($){let X=$,Z=new Set,Y=new Set,J=()=>{if(c0)Y.add(c0);return X};return J.set=(G)=>{if(!Object.is(G,X)){let Q=X;if(X=G,Z.forEach((w)=>w(X,Q)),x7)Y.forEach((w)=>h8.add(w));else Y.forEach((w)=>w())}},J.update=(G)=>{J.set(G(X))},J.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(G)=>J.set(G),configurable:!0}),J}function d8($){let X,Z=!0,Y=new Set,J=()=>{if(!Z)if(Z=!0,x7)Y.forEach((Q)=>h8.add(Q));else Y.forEach((Q)=>Q())},G=()=>{if(c0)Y.add(c0);if(Z){let Q=c0;c0=J,g8.push(J);try{X=$()}finally{g8.pop(),c0=Q}Z=!1}return X};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function m8($,X={}){let Z,Y=!1,J=()=>{if(Y)return;if(Z)Z(),Z=void 0;let G=c0;c0=J,g8.push(J);try{let Q=$();Z=typeof Q==="function"?Q:void 0}finally{g8.pop(),c0=G}};if(X.immediate!==!1)J();return()=>{if(Y=!0,Z)Z()}}function FX($){if(x7){$();return}x7=!0;try{$()}finally{x7=!1,h8.forEach((X)=>X()),h8.clear()}}function VX($){LX.push($)}function AX($){u8.push($)}function uK(){BZ(LX,"onMount",u8)}function dK(){BZ(u8,"onDestroy")}function BZ($,X,Z){let Y=$.splice(0,$.length);for(let J of Y)try{let G=J();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${X} callback threw:`,G)}}function mK(){return{mount:LX.length,destroy:u8.length}}function l8($){return typeof $==="function"&&$._isSignal===!0}function c8($){return typeof $==="function"&&$._isDerived===!0}function RX($){if(l8($)||c8($))return $();return $}function p8($){let X=c0;c0=null;try{return $()}finally{c0=X}}function lK($,X){let Z=typeof $==="function"?$:()=>$,Y=v1([]),J=d8(()=>Y().reduce((w,q)=>X(w,q.action),Z())),G=!1;return m8(()=>{if(Z(),!G){G=!0;return}if(p8(()=>Y().length))Y.set([])}),[J,(w,q)=>{let W={action:w};Y.set([...Y(),W]);let K=()=>{let z=Y().filter((U)=>U!==W);if(z.length!==Y().length)Y.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(K,K);return K}]}var c0=null,g8,x7=!1,h8,LX,u8;var i8=y(()=>{g8=[],h8=new Set,LX=[],u8=[]});var HZ={};a(HZ,{useOptimistic:()=>lK,untrack:()=>RX,state:()=>v1,runMountCallbacks:()=>uK,runDestroyCallbacks:()=>dK,pendingLifecycleCounts:()=>mK,peek:()=>p8,onMount:()=>VX,onDestroy:()=>AX,isSignal:()=>l8,isDerived:()=>c8,generateSignalsRuntimeDev:()=>NX,generateSignalsRuntime:()=>_Z,effect:()=>m8,derived:()=>d8,default:()=>pK,batch:()=>FX});function _Z(){let $=cK(NX());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 cK($){let X=[],Z=0,Y="console.log(";while(Z<$.length){let J=$.indexOf(Y,Z);if(J===-1){X.push($.slice(Z));break}X.push($.slice(Z,J));let G=1,Q=J+Y.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 NX(){return`
|
|
2570
2570
|
// STX Signals Runtime (Development Build)
|
|
2571
2571
|
console.log('[stx] signals runtime loading');
|
|
2572
2572
|
// Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
|
|
@@ -5116,7 +5116,7 @@ catch (e2) {
|
|
|
5116
5116
|
// :attr still works for backward compat but is reserved for structural directives.
|
|
5117
5117
|
// x-text, x-html, x-model, x-show, x-if, x-for, x-cloak, x-ref, x-data are
|
|
5118
5118
|
// handled by their own code paths below \u2014 exclude them here.
|
|
5119
|
-
var X_HANDLED = ${
|
|
5119
|
+
var X_HANDLED = ${f2()};
|
|
5120
5120
|
if (name.startsWith('@bind:') || name.startsWith('x-bind:')
|
|
5121
5121
|
|| (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
|
|
5122
5122
|
|| (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
|
|
@@ -10327,25 +10327,25 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
|
|
|
10327
10327
|
}
|
|
10328
10328
|
}
|
|
10329
10329
|
})();
|
|
10330
|
-
`}var
|
|
10330
|
+
`}var pK;var OZ=y(()=>{i8();w1();i8();pK={state:v1,derived:d8,effect:m8,batch:FX,onMount:VX,onDestroy:AX,isSignal:l8,isDerived:c8,untrack:RX,peek:p8,generateSignalsRuntime:_Z,generateSignalsRuntimeDev:NX}});var TX={};a(TX,{templateCache:()=>LZ,readFileCached:()=>iK,invalidateFileCacheByDir:()=>rK,invalidateFileCache:()=>nK,hashFilePath:()=>f7,getCachedSignalsRuntime:()=>aK,getCachedRouterScript:()=>tK,clearDevCaches:()=>eK,checkCache:()=>$z,cacheTemplate:()=>Xz,__setSignalsGeneratorsForTest:()=>sK});import x1 from"fs";import y5 from"path";async function iK($){let Z;for(let Y=0;Y<3;Y++)try{let G=(await x1.promises.stat($)).mtime.getTime(),Q=e1.get($);if(Q&&Q.mtime===G)return Q.content;let w=await Bun.file($).text(),W=(await x1.promises.stat($)).mtime.getTime();if(W!==G)continue;return e1.set($,{content:w,mtime:W}),w}catch(J){Z=J;break}throw e1.delete($),Error(`File not found: ${$}${Z?` (${Z.message})`:""}`)}function nK($){e1.delete($)}function rK($){for(let X of e1.keys())if(X.startsWith($))e1.delete(X)}function sK($){FZ=$}async function aK($=!1){let X=FZ??await Promise.resolve().then(() => (OZ(),HZ));if($)return X.generateSignalsRuntimeDev();if(n8===null)n8=X.generateSignalsRuntime();return n8}async function tK(){if(r8===null){let{getRouterScript:$}=await Promise.resolve().then(() => (k1(),U2));r8=$()}return r8}function eK(){e1.clear(),AZ(),n8=null,oK=null,r8=null}function VZ($){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 $z($,X){try{if(!X.cachePath)return null;let Z=y5.resolve(X.cachePath),Y=y5.join(Z,`${f7($)}.html`),J=y5.join(Z,`${f7($)}.meta.json`);if(!await p(Y)||!await p(J))return null;let G=await Bun.file(J).text(),Q=JSON.parse(G);if(Q.cacheVersion!==X.cacheVersion)return null;if(Q.optionsSignature!==VZ(X))return null;if((await x1.promises.stat($)).mtime.getTime()>Q.mtime)return null;for(let q of Q.dependencies)if(await p(q)){if((await x1.promises.stat(q)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(Y).text()}catch(Z){return console.warn(`Cache error for ${$}:`,Z),null}}async function Xz($,X,Z,Y){try{if(!Y.cachePath)return;let J=y5.resolve(Y.cachePath);await x1.promises.mkdir(J,{recursive:!0});let G=y5.join(J,`${f7($)}.html`),Q=y5.join(J,`${f7($)}.meta.json`),w=await x1.promises.stat($);await Bun.write(G,X);let q={sourcePath:$,mtime:w.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:Y.cacheVersion,optionsSignature:VZ(Y),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(q,null,2)),LZ.set($,{output:X,mtime:w.mtime.getTime(),dependencies:Z})}catch(J){console.warn(`Failed to cache template ${$}:`,J)}}function f7($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Zz)}var LZ,e1,n8=null,oK=null,FZ=null,r8=null,Zz=16;var MX=y(()=>{k0();LZ=new Map,e1=new Map});function RZ($){return $.includes("data-stx-runtime")}function NZ($){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 Y=$.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}async function o8($,X){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(X.buildMode==="serve"){let w=$.indexOf("<script");if(w!==-1)return $.slice(0,w)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
|
|
10331
10331
|
`+$.slice(w);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
|
|
10332
10332
|
`+$.slice(q)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
|
|
10333
10333
|
`+$}if(X.buildMode==="compile"){let w=$.indexOf("<script");if(w!==-1)return $.slice(0,w)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
10334
10334
|
`+$.slice(w);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
10335
10335
|
`+$.slice(q)}return`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
|
|
10336
|
-
`+$}let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (
|
|
10336
|
+
`+$}let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (MX(),TX)),J=`<script data-stx-scoped data-stx-runtime>${await Z(X.debug)}</script>`,G=$.indexOf("<script");if(G!==-1)return $.slice(0,G)+J+`
|
|
10337
10337
|
`+$.slice(G);if($.includes("</head>")){let Q=$.indexOf("</head>");return $.slice(0,Q)+J+`
|
|
10338
10338
|
`+$.slice(Q)}if($.includes("<body")){let Q=$.indexOf("<body"),w=$.indexOf(">",Q);return $.slice(0,w+1)+`
|
|
10339
10339
|
`+J+$.slice(w+1)}return J+`
|
|
10340
|
-
`+$}async function
|
|
10341
|
-
`}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (
|
|
10342
|
-
</body>`+$.slice(Q+7)}var s8=y(()=>{
|
|
10343
|
-
`)}else{if(!
|
|
10340
|
+
`+$}async function kX($,X){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Z=X?.router,Y="";{let w={};if(Z){if(Z.container)w.container=Z.container;if(Z.interceptAllLinks!==void 0)w.interceptAllLinks=Z.interceptAllLinks;if(Z.progress!==void 0)w.progress=Z.progress;if(Z.viewTransitions!==void 0)w.viewTransitions=Z.viewTransitions;if(Z.viewTransitionDuration!==void 0)w.viewTransitionDuration=Z.viewTransitionDuration;if(Z.viewTransitionEasing!==void 0)w.viewTransitionEasing=Z.viewTransitionEasing;if(Z.scrollToTop!==void 0)w.scrollToTop=Z.scrollToTop;if(Z.prefetch!==void 0)w.prefetch=Z.prefetch;if(Z.cache!==void 0)w.cache=Z.cache;if(Z.progressColor!==void 0)w.progressColor=Z.progressColor;if(Z.progressHeight!==void 0)w.progressHeight=Z.progressHeight}try{let q=await zZ(X?.pagesDir);if(q.length>0)w.ownedRoutes=q}catch{}if(Object.keys(w).length>0)Y=`<script>window.__stxRouterConfig=${jZ(w)};</script>
|
|
10341
|
+
`}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (MX(),TX)),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 J()}</script>`,Q=$.lastIndexOf("</body>");return $.slice(0,Q)+Y+G+`
|
|
10342
|
+
</body>`+$.slice(Q+7)}var s8=y(()=>{UZ();OX()});var $$={};a($$,{scanScriptTags:()=>yZ,rewriteStxImportSpecifiers:()=>PZ,processSignals:()=>bX,processScriptSetup:()=>SZ,preEvalLiteralReactiveIfs:()=>DX,parseLoopExpression:()=>bZ,hasSignalsSyntax:()=>e8,findMarkupIndexOutsideScripts:()=>t8,extractExports:()=>CZ,convertSignalLoopsToAttributes:()=>yX,convertSignalDirectivesToAttributes:()=>EX});function yZ($,X={}){let Z=[];for(let Y of XX($,D1)){let J=Y.token.match(/^<script\b([^>]*)>/i),G=Y.token.match(/<\/script\s*>$/i);if(!J||!G)continue;let Q=J[1];if(X.skipAttrs){if(X.skipAttrs.lastIndex=0,X.skipAttrs.test(Q))continue}let w=J[0].length,q=Y.token.length-G[0].length;Z.push({fullMatch:Y.token,attrs:Q,body:Y.token.slice(w,q),start:Y.start,end:Y.end})}return Z}function bZ($){let X=$.trim(),Z=X.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let J=Z[1].trim(),G=Z[2].trim(),{itemVar:Q,indexVar:w}=MZ(G);if(Q)return{style:"as",iterable:J,itemVar:Q,indexVar:w}}let Y=X.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let J=Y[1].trim(),G=Y[2].trim(),{itemVar:Q,indexVar:w}=MZ(J);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:w}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function MZ($){let X=$.trim(),Z=X.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let Y=X.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let J=X.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let G=X.match(/^(\w+)$/);if(G)return{itemVar:G[1],indexVar:null};return{itemVar:null,indexVar:null}}function e8($){return P2($)}function Jz($){let X=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,Y;while((Y=X.exec($))!==null){let J=Y[1];if(J.startsWith("if"))Z++;else if(J==="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,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=Z.exec($))!==null){let G=J[1],Q;while((Q=Y.exec(G))!==null)X.add(Q[1])}return X}function Qz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function IZ($,X,Z){if(!$)return!1;let Y=Qz($),J=!1,G=!1,Q=!1,w=/([a-zA-Z_$][\w$]*)/g,q;while((q=w.exec(Y))!==null){let U=q[1];if(Y.slice(0,q.index).trimEnd().endsWith("."))continue;if(kZ.has(U))continue;if(X.has(U))J=!0;else if(Z&&U in Z)G=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,K;while((K=W.exec(Y))!==null){let U=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(kZ.has(U)||Z&&U in Z)continue;Q=!0}return(J||Q)&&!G}function a8($,X,Z){let Y=Z===void 0?` ${X}`:` ${X}="${Z.replace(/"/g,""")}"`,J=$.trim(),G=J.match(DZ);if(G&&wz(G[3],G[1])){let[,Q,w,q]=G;return`<${Q}${w}${Y}>${q}</${Q}>`}return`<template${Y}>${J}</template>`}function wz($,X){let Z=new RegExp(`<(/)?${X}(?=[\\s/>])`,"gi"),Y=0,J;while((J=Z.exec($))!==null)if(J[1]){if(Y--,Y<0)return!1}else Y++;return!0}function EX($,X){let Z=Gz($);function Y(J){let G=J,Q=/@if\s*\(/g,w,q=[];while((w=Q.exec(G))!==null){let W=w.index,K=W+w[0].length,z=1,U=K;while(U<G.length&&z>0){if(G[U]==="(")z++;else if(G[U]===")")z--;U++}if(z!==0)continue;let B=G.substring(K,U-1).trim(),j=U,_=1,H=j,L=/@(if\s*\(|endif)/g;L.lastIndex=j;let O;while((O=L.exec(G))!==null)if(O[1].startsWith("if"))_++;else if(O[1]==="endif"){if(_--,_===0){H=O.index+O[0].length;break}}if(_!==0)continue;let F=G.substring(j,H-6).trim(),V;if(Jz(F)){let A=v7(G.substring(W,H));if(A.length===0)continue;let R=A[0].branches.filter((M)=>M.type!=="else");if(!(R.length>0&&R.every((M)=>IZ(M.condition,Z,X))))continue;V=A[0].branches.map((M)=>{let k=Y(M.content);if(M.type==="elseif")return a8(k,"@else-if",M.condition??"");if(M.type==="else")return a8(k,"@else");return a8(k,"@if",M.condition??"")}).join(`
|
|
10343
|
+
`)}else{if(!IZ(B,Z,X))continue;V=a8(Y(F),"@if",B)}q.push({start:W,end:H,replacement:V}),Q.lastIndex=H}for(let W=q.length-1;W>=0;W--){let{start:K,end:z,replacement:U}=q[W];G=G.substring(0,K)+U+G.substring(z)}return G}return Y($)}function qz($){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 J=Number(X);return J!==0&&!Number.isNaN(J)}let Z=X.match(/^'((?:\\.|[^'\\])*)'$/);if(Z)return Z[1].length>0;let Y=X.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}function Wz($,X,Z,Y){if(IX.has(Z.toLowerCase()))return Y;let J=Z.toLowerCase(),G=$.toLowerCase(),Q=$.length,w=1,q=Y;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()===J){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()===J){let B=$.slice(q,U+1);if(!(/\/\s*>$/.test(B)||IX.has(J)))w++}q=U+1}return-1}function zz($,X){let Z=X,Y=$.length;for(;;){while(Z<Y&&$[Z]!=="<")Z++;if(Z>=Y)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 J=$.indexOf(">",Z);if(J===-1)return!1;let G=$.slice(Z,J+1);return Kz.test(G)}function DX($){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,Y;while((Y=Z.exec($))!==null)X.push([Y.index,Y.index+Y[0].length]);let J=(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(J(w.index))continue;let[z,U,B,j,_,H,L]=w,O=qz(_);if(O===void 0)continue;let F=w.index,V=F+z.length,N=!!L||/\/\s*>$/.test(z)||IX.has(U.toLowerCase())?V:Wz($,F,U,V);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&zz($,N)){G.lastIndex=V;continue}if(O===!0){let M=`<${U}${B}${H}${L}>`;Q.push({start:F,end:V,replacement:M});continue}Q.push({start:F,end:N,replacement:""}),G.lastIndex=N}if(Q.length===0)return $;Q.sort((z,U)=>z.start-U.start);let 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 yX($,X){let Z=$,Y=/@(for|foreach)\s*\(/g,J,G=[],Q=[];while((J=Y.exec(Z))!==null){let w=J[1],q=J.index,W=q+J[0].length,K=1,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=bZ(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 M=T.split(/[.[(]/)[0].trim(),k=X?M in X:!1,D=Q.some((I)=>q>I.start&&q<I.end&&I.vars.includes(M));if(M&&(k||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(DZ),N;if(R){let[,T,M,k]=R;N=`<${T}${M} @for="${U}">${k}</${T}>`}else N=`<template @for="${U}">${A}</template>`;G.push({start: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 Uz($){let X=new Set,Z=[],Y=0,J=0,G=$.length,Q=(K)=>{let z=Y+1;while(z<G){let U=$[z];if(U==="\\"){z+=2;continue}if(U===K)return z+1;z++}return G},w=()=>{let K=Y+2;while(K<G&&$[K]!==`
|
|
10344
10344
|
`)K++;return K},q=()=>{let K=Y+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]!==`
|
|
10345
|
-
`)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(Y<G){let K=$[Y];if(K==="/"&&$[Y+1]==="/"){let z=w();Z.push($.slice(Y,z)),Y=z;continue}if(K==="/"&&$[Y+1]==="*"){let z=q();Z.push($.slice(Y,z)),Y=z;continue}if(K==='"'||K==="'"||K==="`"){let z=Q(K);Z.push($.slice(Y,z)),Y=z;continue}if(K==="{"){J++,Z.push(K),Y++;continue}if(K==="}"){J--,Z.push(K),Y++;continue}if(J===0){let z=Y>0?$[Y-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(Y+B[0].length);if(X.has(j)){Z.push(`/* stx: deduped const ${j} */`),Y=_;continue}X.add(j),Z.push($.slice(Y,_)),Y=_;continue}}}Z.push(K),Y++}return Z.join("")}async function
|
|
10345
|
+
`)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(Y<G){let K=$[Y];if(K==="/"&&$[Y+1]==="/"){let z=w();Z.push($.slice(Y,z)),Y=z;continue}if(K==="/"&&$[Y+1]==="*"){let z=q();Z.push($.slice(Y,z)),Y=z;continue}if(K==='"'||K==="'"||K==="`"){let z=Q(K);Z.push($.slice(Y,z)),Y=z;continue}if(K==="{"){J++,Z.push(K),Y++;continue}if(K==="}"){J--,Z.push(K),Y++;continue}if(J===0){let z=Y>0?$[Y-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=$.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=W(Y+B[0].length);if(X.has(j)){Z.push(`/* stx: deduped const ${j} */`),Y=_;continue}X.add(j),Z.push($.slice(Y,_)),Y=_;continue}}}Z.push(K),Y++}return Z.join("")}async function SZ($,X,Z){let Y=yZ($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,G=[];for(let H of Y){let L=H.body;if(i1(H.attrs))L=n1(L);if(J.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()}_${Yz++}`,{hasUserImports:w,bundleClientScript:q}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (R7(),A7))),W=[];for(let H=0;H<G.length;H++){let L=G[H].content;if(L=N5(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)=>PZ(V));let O=l0(L);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
|
|
10346
10346
|
${O}`)}let K=W.join(`
|
|
10347
10347
|
|
|
10348
|
-
`);K=
|
|
10348
|
+
`);K=Uz(K);let z=CZ(K),U=z.split(",").map((H)=>H.trim()).filter(Boolean),B=T8(K,Z),j=`
|
|
10349
10349
|
<script data-stx-scoped>
|
|
10350
10350
|
function ${Q}() {
|
|
10351
10351
|
${A5("const",U)}
|
|
@@ -10354,18 +10354,18 @@ ${R5(`${B}${K}`)}
|
|
|
10354
10354
|
}
|
|
10355
10355
|
window.__stx_latestSetup=${Q};
|
|
10356
10356
|
if(window.stx)window.stx._latestSetup=${Q};
|
|
10357
|
-
</script>`,_=$;for(let H of G)_=_.split(H.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${
|
|
10357
|
+
</script>`,_=$;for(let H of G)_=_.split(H.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${TZ})>`),`<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(${TZ})>`,"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 CZ($){let X=$,Z=[],Y=new Set,J=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(_===`
|
|
10358
10358
|
`)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]!==`
|
|
10359
|
-
`)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(J!==0)return;let j=X.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let F=j[2];if(!Y.has(F))Z.push(F),Y.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&&!Y.has(N))Z.push(N),Y.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&&!Y.has(A))Z.push(A),Y.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(!Y.has(F))Z.push(F),Y.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(!Y.has(F))Z.push(F),Y.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]==="{"){J++,w="{",G++;continue}if(X[G]==="}"){J--,w="}",G++;continue}if(J===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
|
|
10359
|
+
`)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(J!==0)return;let j=X.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let F=j[2];if(!Y.has(F))Z.push(F),Y.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&&!Y.has(N))Z.push(N),Y.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&&!Y.has(A))Z.push(A),Y.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(!Y.has(F))Z.push(F),Y.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(!Y.has(F))Z.push(F),Y.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]==="{"){J++,w="{",G++;continue}if(X[G]==="}"){J--,w="}",G++;continue}if(J===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 bX($,X,Z,Y){if(!e8($))return $;let J=$;if(X.skipSignalsRuntime)return J;let{output:G,setupCode:Q}=await SZ(J,Z,Y);if(J=G,J=await o8(J,X),Q){let K=t8(J,/<\/head>/i),z=K===-1?t8(J,/<body[^>]*>/i):-1;if(K!==-1)J=`${J.slice(0,K)}${Q}
|
|
10360
10360
|
${J.slice(K)}`;else if(z!==-1){let U=/<body[^>]*>/i.exec(J.slice(z))[0],B=z+U.length;J=`${J.slice(0,B)}
|
|
10361
10361
|
${Q}${J.slice(B)}`}else J=`${J}
|
|
10362
|
-
${Q}`}let q=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!Q&&!W&&q&&!/data-stx-auto/.test(q[1])){let K=/<body[^>]*>/i,z=t8(J,K);if(z!==-1){let U=J.slice(0,z),B=J.slice(z).replace(K,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=U+B}}return J}function t8($,X){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec($))!==null)Y.push([J.index,J.index+J[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(!Y.some(([K,z])=>q>=K&&q<z))return q;Q=q+Math.max(w[0].length,1)}return-1}function
|
|
10363
|
-
`)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<G-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(Y!==0)return;let K=$.slice(J).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(J).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(J).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(J).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(J<G){if(q())continue;if($[J]==="'"||$[J]==='"'){Q($[J]);continue}if($[J]==="`"){w();continue}if($[J]==="{"){Y++,J++;continue}if($[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))W();J++}return X}function
|
|
10362
|
+
${Q}`}let q=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!Q&&!W&&q&&!/data-stx-auto/.test(q[1])){let K=/<body[^>]*>/i,z=t8(J,K);if(z!==-1){let U=J.slice(0,z),B=J.slice(z).replace(K,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=U+B}}return J}function t8($,X){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec($))!==null)Y.push([J.index,J.index+J[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(!Y.some(([K,z])=>q>=K&&q<z))return q;Q=q+Math.max(w[0].length,1)}return-1}function PZ($){let X=[];for(let Z of $.split(",")){let Y=Z.trim();if(!Y||Y.startsWith("type "))continue;let J=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])X.push(`${J[2]} = ${J[1]}`)}if(X.length===0)return EZ;return`var ${X.join(", ")}; ${EZ}`}var Yz=0,TZ=`(?:"[^"]*"|'[^']*'|[^>"'])*`,DZ,kZ,IX,Kz,EZ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var g7=y(()=>{I7();x8();w1();n9();k0();s8();r1();V7();DZ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;kZ=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"]);IX=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Kz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import jz from"fs";import h from"path";function _z($){let X=new WeakSet;try{let Z=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if(X.has(Y))throw TypeError("Circular component input");if(X.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(Z);let J={};for(let G of Object.keys(Y).sort())J[G]=Z(Y[G]);return J};return JSON.stringify(Z($))}catch{return null}}function vZ($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Hz($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function i1($){return!Hz($)}function n1($){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 J=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}).transformSync(X);for(let G=0;G<Z.length;G++)J=J.replace(`"__STX_EXPR_${G}__"`,Z[G]),J=J.replace(`'__STX_EXPR_${G}__'`,Z[G]);return J}catch(X){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",X);return $}}function Oz($){let X=[],Z=new Set,Y=0,J=0,G=$.length,Q=(K)=>{J++;while(J<G){if($[J]==="\\"){J+=2;continue}if($[J]===K){J++;return}J++}},w=()=>{J++;while(J<G){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let K=1;while(J<G&&K>0)if($[J]==="{")K++,J++;else if($[J]==="}")K--,J++;else if($[J]==="'"||$[J]==='"')Q($[J]);else if($[J]==="`")w();else J++;continue}J++}},q=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<G&&$[J]!==`
|
|
10363
|
+
`)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<G-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(Y!==0)return;let K=$.slice(J).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(J).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(J).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(J).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(J<G){if(q())continue;if($[J]==="'"||$[J]==='"'){Q($[J]);continue}if($[J]==="`"){w();continue}if($[J]==="{"){Y++,J++;continue}if($[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))W();J++}return X}function Lz($){let X=[],Z=0,Y=0,J=null;for(let G=0;G<$.length;G++){let Q=$[G];if(J){if(Q==="\\"){G++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)X.push($.slice(Y,G)),Y=G+1}if(Y<$.length)X.push($.slice(Y));return X}function Fz($){let X=0,Z=null;for(let Y=0;Y<$.length;Y++){let J=$[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}if(J==="("||J==="["||J==="{")X++;else if(J===")"||J==="]"||J==="}")X--;else if(J==="="&&X===0){let G=$[Y-1],Q=$[Y+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return Y}}return-1}function Vz($,X){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Z)return;let Y=Z.index-1;while(Y>=0&&/\s/.test($[Y]))Y--;if($[Y]!=="}")return;let J=Y,G=0,Q=-1;for(;Y>=0;Y--){let q=$[Y];if(q==="}")G++;else if(q==="{"){if(G--,G===0){Q=Y;break}}}if(Q===-1)return;let w=$.slice(Q+1,J);for(let q of Lz(w)){let W=q.trim();if(!W||W.startsWith("..."))continue;let K=Fz(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 Y$($,X,Z,Y,J){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 J.root==="string"?h.resolve(J.root):void 0,z=K??h.dirname(Y),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(J._rootComponentsDir),B(h.join(h.dirname(Y),"components")),B(J.componentsDir);let _=J._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 p(h.resolve(h.dirname(Y),`${G}.stx`));for(let H of U){let L=h.isAbsolute(H)?H:h.resolve(z,H);for(let O of W)if(await p(h.join(L,O)))return!0}return!1}function Az($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function Rz($){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 Nz($){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 Y of $){let J;while((J=Z.exec(Y))!==null)X.add(J[1]);Z.lastIndex=0}return[...X]}async function $5($,X,Z,Y,J,G,Q,w=new Set,q){let{extractVariables:W}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (P7(),P8))),K=w??new Set;if(K.has($))return`[Circular component reference: ${$}]`;let z=new Set(K);z.add($);let U=typeof X.client==="string"?X.client.trim():"";if("client"in X)delete X.client;let B=U&&U!=="load"&&Az(U)?U:"";try{let j=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),_=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=$.endsWith(".stx")?$.slice(0,-4):$,L=null,O=J.__importedComponents;if(O){let E=[H,H.toLowerCase(),j(H),_(H)];for(let v of E)if(O.has(v)){L=O.get(v);break}}let F=[];if(!L){let E=[`${H}.stx`,`${j(H)}.stx`,`${_(H)}.stx`],v=[...new Set(E)],m=J.__originalFilePath,g=[];if(m){let B0=h.join(h.dirname(m),"components");g.push(B0)}if(Y)g.push(Y);let r=Q._rootComponentsDir;if(typeof r==="string"&&!g.includes(r))g.push(r);let Q0=h.join(h.dirname(G),"components");if(!g.includes(Q0))g.push(Q0);if(Q.componentsDir&&Q.componentsDir!==Y&&!g.includes(Q.componentsDir))g.push(Q.componentsDir);let s0=Q._pluginComponentDirs;if(Array.isArray(s0)){for(let B0 of s0)if(typeof B0==="string"&&!g.includes(B0))g.push(B0)}let f0=typeof Q.root==="string"?h.resolve(Q.root):void 0,m0=f0??h.dirname(G),a0=[];if(f0)a0.push(h.resolve(f0,"resources/views/components")),a0.push(h.resolve(f0,"resources/components")),a0.push(h.resolve(f0,"src/components")),a0.push(h.resolve(f0,"components"));a0.push(h.resolve(import.meta.dir,"components"));for(let B0 of a0)if(!g.includes(B0))g.push(B0);let B5=[...new Set(g.map((B0)=>{if(!B0)return B0;return h.isAbsolute(B0)?B0:h.resolve(m0,B0)}))];g.length=0,g.push(...B5);let T1=`${H}\x00${G}\x00${B5.join("\x00")}`,M1=Z$.get(T1);if(M1)if(await p(M1))L=M1;else Z$.delete(T1);if(!L&&(H.startsWith("./")||H.startsWith("../")))L=h.resolve(h.dirname(G),`${H}.stx`),F.push(L);else if(!L)for(let B0 of g){if(!B0)continue;for(let G1 of v){let i=h.join(B0,G1);if(F.push(i),await p(i)){L=i;break}}if(L)break;if(!L)try{let G1=await import("fs");if(!G1.statSync(B0,{throwIfNoEntry:!1})?.isDirectory())continue;let Q1=8,l1=[{path:B0,depth:0}];while(l1.length>0&&!L){let B1=l1.pop();if(B1.depth>=Q1)continue;let w8;try{w8=G1.readdirSync(B1.path,{withFileTypes:!0})}catch{continue}for(let q8 of w8){if(!q8.isDirectory())continue;if(q8.name==="node_modules"||q8.name.startsWith("."))continue;let s4=h.join(B1.path,q8.name);for(let Hq of v){let H9=h.join(s4,Hq);if(F.push(H9),await p(H9)){L=H9;break}}if(L)break;l1.push({path:s4,depth:B1.depth+1})}}}catch{}if(L)break}if(L)Z$.set(T1,L)}if(!L||!await p(L)){let E=F.length>0?`
|
|
10364
10364
|
Searched paths:
|
|
10365
10365
|
${F.map((v)=>` - ${v}`).join(`
|
|
10366
|
-
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${E}`}q.add(L);let V;if(X$.has(L))V=X$.get(L);else try{V=await Bun.file(L).text(),X$.set(L,V)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let A=new Set(["__originalFilePath","__importedComponents",M8]),R={};for(let[E,v]of Object.entries(J))if(!E.startsWith("__")||A.has(E))R[E]=v;let{extractSlotContent:N}=await e("stx/slots",()=>Promise.resolve().then(() => (
|
|
10367
|
-
`)}`}if(Z&&u.includes("{{ text || slot }}"))u=u.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:t}=await e("stx/slots",()=>Promise.resolve().then(() => (
|
|
10368
|
-
${A5("const",[...
|
|
10366
|
+
`)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${E}`}q.add(L);let V;if(X$.has(L))V=X$.get(L);else try{V=await Bun.file(L).text(),X$.set(L,V)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let A=new Set(["__originalFilePath","__importedComponents",M8]),R={};for(let[E,v]of Object.entries(J))if(!E.startsWith("__")||A.has(E))R[E]=v;let{extractSlotContent:N}=await e("stx/slots",()=>Promise.resolve().then(() => (BX(),jX))),T=N(Z),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[E,v]of T.namedSlots)M[E]=v.content;let k={...R,...X,props:X,slot:Z,$slots:M,__processedComponents:z,__sections:{},__stx_signals_gate:F1(V)||Rz(Z)};Vz(V,k);let D=V,I=b8(D);if(I)D=I.content.trim();let S=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,b=[...V.matchAll(S)],C=[],P=b.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&b.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,f=null;if(P){let E=_z({props:X,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(E!==null){x=`${L}\x00${E}`;let v=SX.get(x);if(v){for(let m of v.dependencies)q.add(m);return v.output}f=new Set(q)}}for(let E of b){let v=E[1]||"",m=E[2]||"",g=v.includes("server");if(i1(v)&&m.trim())m=n1(m);if(g&&m)try{await W(m,k,L)}catch(Q0){}if(!g){let Q0=m.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),s0=Q0.includes("{{")&&Q0.includes("}}"),f0=Q0.includes("{!!")&&Q0.includes("!!}");if(s0||f0)Q0=D8(Q0,k);let m0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");C.push(`<script${m0}>${Q0}</script>`)}}let l=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),$0=l?l[1]:"",C0=l?l[2]:"",U0="",A0=$0&&/\bscoped\b/i.test($0);if(l)U0=`<style${$0}>${C0}</style>`;let u=D;if(u=u.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),l)u=u.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(u=u.replace(E,(m,g)=>{let r=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(r)v.push(`<style${r[1]}>${r[2]}</style>`);return""}),u=u.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)U0=`${U0}${v.join(`
|
|
10367
|
+
`)}`}if(Z&&u.includes("{{ text || slot }}"))u=u.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:t}=await e("stx/slots",()=>Promise.resolve().then(() => (BX(),jX))),{defaultSlot:R0,namedSlots:P0}=T;u=await t(u,R0,P0,k);let U5=C.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),j5=Nz(C);if(j5.length>0)k.__stx_client_signal_names=j5;let n={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:h.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:U5||C.length===0,defaultLayout:void 0};k.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let s=await O0(u,k,L,n,q),K0=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let E of s.matchAll(/\{\{([\s\S]*?)\}\}/g))K0.add(E[1].trim());if(K0.size>0)J.__stx_preserved_client_expressions=[...K0];let I0=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++Bz}_${Math.random().toString(36).slice(2,8)}`,w0=s;if(U5){let E="";if(Object.keys(X).length>0)try{E=` data-stx-props="${vZ(JSON.stringify(X))}"`}catch{}let v=B?` stx-hydrate="${vZ(B)}"`:"";w0=`<div data-stx-scope="${I0}"${E}${v}>${s}</div>`;let m=await Promise.all(C.map(async(g)=>{let r=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!r)return g;let[,Q0,s0]=r,f0=A8(s0,{filePath:L,projectRoot:process.cwd()}),m0=f0.code,a0=R8(f0.styles);m0=N5(m0).code;let{hasUserImports:B5,bundleClientScript:T1}=await e("stx/client-script-bundler",()=>Promise.resolve().then(() => (R7(),A7)));if(B5(m0))m0=await T1(m0,L,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:M1}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (g7(),$$)));m0=m0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(B1,w8)=>M1(w8));let B0=l0(m0),G1=Oz(B0),i=`function(__scopeId) {
|
|
10368
|
+
${A5("const",[...C2,...G1],B0)}
|
|
10369
10369
|
const __scope = window.stx._scopes = window.stx._scopes || {};
|
|
10370
10370
|
const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
|
|
10371
10371
|
const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
|
|
@@ -10392,15 +10392,15 @@ catch (e) {}
|
|
|
10392
10392
|
finally {
|
|
10393
10393
|
window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
|
|
10394
10394
|
}
|
|
10395
|
-
}`,Q1=B?null:
|
|
10395
|
+
}`,Q1=B?null:z6(J,i),l1=Q1?`window.__stxComponentFactories[${JSON.stringify(Q1)}](${JSON.stringify(I0)});`:`(${i})(${JSON.stringify(I0)});`;if(B)return`${a0}<script type="stx/island" data-stx-island="${I0}" data-stx-scoped${Q0}>${l1}</script>`;return`${a0}<script data-stx-scoped data-stx-run="always"${Q0}>${l1}</script>`}));if(w0=w0+`
|
|
10396
10396
|
`+m.join(`
|
|
10397
10397
|
`),U0)w0+=`
|
|
10398
10398
|
`+U0}else{if(U0)w0+=`
|
|
10399
10399
|
`+U0;if(C.length>0){let E=k.__stx_event_bindings||[],v=M7(k),m=await Promise.all(C.map(async(g)=>{let r=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!r)return g;return await k7(r[1],{eventBindings:E,templateContent:w0,filePath:L,projectRoot:process.cwd(),serverData:v})}));w0+=`
|
|
10400
10400
|
`+m.join(`
|
|
10401
|
-
`),k.__stx_event_bindings=[]}}if(A0){let E=y8(w0,L);if(E.hasScoped)w0=E.html}if(x&&f)
|
|
10401
|
+
`),k.__stx_event_bindings=[]}}if(A0){let E=y8(w0,L);if(E.hasScoped)w0=E.html}if(x&&f)SX.set(x,{output:w0,dependencies:[...q].filter((E)=>!f.has(E))});return w0}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{K.delete($)}}async function p($){return Bun.file($).exists()}function CX($,X){let Z=h.resolve(X),Y=h.resolve($),J=Z.endsWith(h.sep)?Z:Z+h.sep;if(Y===Z||Y.startsWith(J))return Y;return null}async function PX($,X,Z,Y){let J=await Tz($,X,Z,Y);if(J===null)return null;let G=CX(J,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((w)=>typeof w==="string"&&w.length>0);for(let w of Q){let q=h.isAbsolute(w)?w:h.resolve(process.cwd(),w);if(CX(J,q))return h.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${$}, from: ${X})`),null}async function Tz($,X,Z,Y){if(Z.debug)console.log(`Resolving template path: ${$} from ${X}`);let J=h.dirname(X),G=process.cwd();if($.startsWith("/")){let U=h.join(G,$),B=CX(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 p(B)&&Y)Y.add(B);return B}let Q=h.join(J,$);if(await p(Q)){if(Z.debug)console.log(`Found direct path: ${Q}`);if(Y)Y.add(Q);return Q}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let U of[".stx",".tsx",".jsx"]){let B=`${Q}${U}`;if(await p(B)){if(Z.debug)console.log(`Found direct path with extension: ${B}`);if(Y)Y.add(B);return B}}let w="",q=h.resolve(J),W=process.cwd();for(let U=0;U<10;U++){let B=h.join(q,"layouts"),j=!1;try{j=jz.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 p(B)){if(Z.debug)console.log(`Found in current layouts dir: ${B}`);if(Y)Y.add(B);return B}if(!U.endsWith(".stx")){let j=`${B}.stx`;if(await p(j)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(Y)Y.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 p(j)){if(Z.debug)console.log(`Found in options.layoutsDir: ${j}`);if(Y)Y.add(j);return j}if(!$.endsWith(".stx")){let _=`${j}.stx`;if(await p(_)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(Y)Y.add(_);return _}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let U=$.split("layouts/"),B=h.join(Z.partialsDir||J,"layouts",U[1]);if(await p(B)){if(Z.debug)console.log(`Found in layouts path: ${B}`);if(Y)Y.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await p(j)){if(Z.debug)console.log(`Found in layouts path with extension: ${j}`);if(Y)Y.add(j);return j}}}if(Z.partialsDir){if(w=h.join(Z.partialsDir,"layouts"),await p(w)){let U=h.join(w,$);if(await p(U)){if(Z.debug)console.log(`Found in partials layouts dir: ${U}`);if(Y)Y.add(U);return U}if(!$.endsWith(".stx")){let B=`${U}.stx`;if(await p(B)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}}let K=Z.partialsDir||h.join(process.cwd(),"views"),z=h.join(K,$);if(await p(z)){if(Z.debug)console.log(`Found in views path: ${z}`);if(Y)Y.add(z);return z}if(!$.endsWith(".stx")){let U=`${z}.stx`;if(await p(U)){if(Z.debug)console.log(`Found in views path with extension: ${U}`);if(Y)Y.add(U);return U}}if(J.includes("temp")){let U=h.join(h.dirname(J),"layouts",$);if(await p(U)){if(Z.debug)console.log(`Found in temp layouts dir: ${U}`);if(Y)Y.add(U);return U}if(!$.endsWith(".stx")){let B=`${U}.stx`;if(await p(B)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${X})`);else console.warn(`Template not found: ${$} (referenced from ${X})`);return null}function xZ($,X,Z){let Y=0,J="",G="";try{if(typeof X==="number"&&X>=0){let Q=$.split(`
|
|
10402
10402
|
`),w=0;for(let q=0;q<Q.length;q++)if(w+=Q[q].length+1,w>=X){Y=q+1,J=Q[q].trim();let W=Math.max(0,q-2),K=Math.min(Q.length,q+3);G=Q.slice(W,K).map((z,U)=>{let B=W+U+1;return`${B===Y?"> ":" "}${B}: ${z}`}).join(`
|
|
10403
|
-
`);break}}else if(Z){let Q=$.indexOf(Z);if(Q>=0)return
|
|
10403
|
+
`);break}}else if(Z){let Q=$.indexOf(Z);if(Q>=0)return xZ($,Q)}}catch{}return{lineNumber:Y,lineContent:J,context:G}}function z0($,X,Z,Y,J,G){let{lineNumber:Q,context:w}=xZ(Y,J,G),q=Z.split("/").pop(),W=0;if(typeof J==="number"&&J>=0&&Y){let z=Y.lastIndexOf(`
|
|
10404
10404
|
`,Math.max(0,J-1));W=J-(z+1)+1}let K="";if(Q>0)K+=`
|
|
10405
10405
|
${Z}:${Q}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${X}
|
|
10406
10406
|
`;if(K+=`
|
|
@@ -10413,8 +10413,8 @@ ${X0.yellow}${X0.bold}Message:${X0.reset} ${X}
|
|
|
10413
10413
|
`,w)K+=`
|
|
10414
10414
|
${X0.blue}${X0.bold}Context:${X0.reset}
|
|
10415
10415
|
${X0.dim}${w}${X0.reset}
|
|
10416
|
-
`;return K}function
|
|
10417
|
-
`||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);J.push({fullMatch:_,options:W,content:j,index:w}),G.lastIndex=B+12}for(let{fullMatch:w,options:q,content:W,index:K}of J)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=F7(W.trim(),U);Y=Y.split(w).join(B)}catch(z){let U=z instanceof Error?z.message:String(z),B=z0("Markdown Directive",`Error processing markdown: ${U}`,Z,$,K,w);Y=Y.split(w).join(B)}return Y}async function
|
|
10416
|
+
`;return K}function AZ(){X$.clear(),Z$.clear(),SX.clear()}var X$,Z$,SX,Bz=0,X0;var k0=y(()=>{I7();e9();W1();w1();I5();J$();E1();GX();QX();V7();h6();P7();X$=new o1(500),Z$=new o1(1000),SX=new o1(2000);X0={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 fZ($,X,Z=""){let Y=$,J=[],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===`
|
|
10417
|
+
`||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);J.push({fullMatch:_,options:W,content:j,index:w}),G.lastIndex=B+12}for(let{fullMatch:w,options:q,content:W,index:K}of J)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=F7(W.trim(),U);Y=Y.split(w).join(B)}catch(z){let U=z instanceof Error?z.message:String(z),B=z0("Markdown Directive",`Error processing markdown: ${U}`,Z,$,K,w);Y=Y.split(w).join(B)}return Y}async function gZ($,X,Z,Y){let J={gfm:!0,breaks:!1};return X.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")J.breaks=!0;if(Q==="no-gfm")J.gfm=!1}),F7($.trim(),J)}var vX=y(()=>{k0()});function Iz($){if(Mz.set($.name,$),$.client)kz.set($.name,$.client)}function G$($){return Iz($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Z,Y,J,G)=>{let Q=Ez(Y,$.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,J,G);if($.clientScript){let q=$.clientScript(Q);w+=`<script>${q}</script>`}if($.css){let q=$.css(Q);w+=`<style>${q}</style>`}return w}}}function Ez($,X){let Z={...X};for(let Y of $){let J=Y.indexOf(":"),G=Y.indexOf("="),Q=J>=0&&(G<0||J<G)?J:G;if(Q>=0){let w=Y.slice(0,Q).trim(),q=Y.slice(Q+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Z[w]=q}else{let w=Object.keys(Z).filter((q)=>!X||!(q in X)).length;Z[w===0?"value":`arg${w}`]=Y}}return Z}var Mz,kz;var xX=y(()=>{Mz=new Map,kz=new Map});function fX($,X=b5,Z={},Y){return X.sort((J,G)=>J-G).map((J)=>{return`${u7($,{...Z,w:J,fm:Y})} ${J}w`}).join(", ")}function hZ($,X,Z=Dz,Y={},J){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round(X*G);return`${u7($,{...Y,w:Q,dpr:G,fm:J})} ${G}x`}).join(", ")}function gX($,X="100vw"){if(!$||Object.keys($).length===0)return X;let Y=Object.entries($).map(([J,G])=>{let Q=/^\d+$/.test(J)?`${J}px`:J;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((J,G)=>J.numericBp-G.numericBp).map(({bp:J,size:G})=>`(max-width: ${J}) ${G}`);return Y.push(X),Y.join(", ")}function u7($,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 Y=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),J=$.includes("?")?"&":"?";return`${$}${J}${Y}`}function hX($){return yz[$]||"application/octet-stream"}var b5,Dz,h7,yz;var uX=y(()=>{b5=[320,480,640,768,1024,1280,1536,1920,2560],Dz=[1,1.5,2,3],h7=["avif","webp","jpeg"],yz={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function Sz(){try{return await import("ts-images")}catch{return null}}async function Cz($,X={}){let Z={...bz,...X},Y=await Sz();if(Y)try{return await Pz($,Z,Y)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return vz($,Z)}async function Pz($,X,Z){let{generatePlaceholder:Y,generateThumbHash:J}=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 J($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let w=await Y($,{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 vz($,X){let Z=X.width||20,Y=X.height||Z,J="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}" viewBox="0 0 ${Z} ${Y}"><rect fill="#e5e7eb" width="${Z}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:Y,aspectRatio:Z/Y,originalWidth:0,originalHeight:0,strategy:X.strategy,dominantColor:"#e5e7eb"}}function uZ($,X,Z={}){let Y=Z.transitionDuration||300,J=Z.easing||"ease-out";return`
|
|
10418
10418
|
#${$} {
|
|
10419
10419
|
--stx-img-transition-duration: ${Y}ms;
|
|
10420
10420
|
--stx-img-transition-easing: ${J};
|
|
@@ -10431,7 +10431,7 @@ ${X0.dim}${w}${X0.reset}
|
|
|
10431
10431
|
#${$}.stx-img-loaded img {
|
|
10432
10432
|
opacity: 1;
|
|
10433
10433
|
}
|
|
10434
|
-
`.trim()}async function
|
|
10434
|
+
`.trim()}async function dZ($,X={}){let Z=`${$}:${JSON.stringify(X)}`;if(dX.has(Z))return dX.get(Z);let Y=await Cz($,X);return dX.set(Z,Y),Y}var bz,mX,dX;var mZ=y(()=>{bz={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},mX=`
|
|
10435
10435
|
.stx-img-placeholder {
|
|
10436
10436
|
position: relative;
|
|
10437
10437
|
overflow: hidden;
|
|
@@ -10460,8 +10460,8 @@ ${X0.dim}${w}${X0.reset}
|
|
|
10460
10460
|
filter: blur(0);
|
|
10461
10461
|
transform: scale(1);
|
|
10462
10462
|
}
|
|
10463
|
-
`.trim();uX=new Map});import{createHash as mZ}from"crypto";import{readFile as Cz,stat as lZ}from"fs/promises";async function v0($){try{let X=await Cz($);return mZ("sha256").update(X).digest("hex").slice(0,16)}catch{return""}}function dZ($){return mZ("sha256").update($).digest("hex").slice(0,16)}function Q$($,X){let Z=JSON.stringify(X,Object.keys(X).sort());return`${dZ($)}-${dZ(Z)}`}async function mX($){try{return(await lZ($)).mtimeMs}catch{return 0}}async function D0($){try{return await lZ($),!0}catch{return!1}}var X5=()=>{};import{mkdir as Pz,readFile as vz,writeFile as xz,readdir as cA,rm as fz,stat as pA}from"fs/promises";import{join as pZ,dirname as gz}from"path";async function hz($){try{await Pz($,{recursive:!0})}catch{}}function iZ($,X,Z){return pZ($,Z,`${X}.json`)}async function cZ($,X,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await mX(X)!==$.srcMtime)return!1;return!0}async function w$($,X,Z,Y=lX){if(!Y.enabled)return null;let J=Q$($,X),G=S5.get(J);if(G){if(await cZ(G,$,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;S5.delete(J)}let Q=iZ(Y.directory,J,Z);if(await D0(Q))try{let w=await vz(Q,"utf-8"),q=JSON.parse(w);if(await cZ(q,$,Y.maxAge))return q.lastAccessedAt=Date.now(),S5.set(J,q),q.data}catch{}return null}async function q$($,X,Z,Y,J=lX){if(!J.enabled)return;let G=Q$($,X),Q=await v0($),w=await mX($),q={key:G,src:$,srcHash:Q,srcMtime:w,optionsHash:Q$("",X),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};S5.set(G,q);let W=iZ(J.directory,G,Y);try{await hz(gz(W)),await xz(W,JSON.stringify(q,null,2))}catch(K){console.warn(`[stx-media] Failed to write cache: ${K}`)}}async function W$($,X=lX){if($==="all")S5.clear();else S5.clear();let Z=$==="all"?["image","video"]:[$];for(let Y of Z){let J=pZ(X.directory,Y);try{await fz(J,{recursive:!0,force:!0})}catch{}}}var S5,lX;var cX=y(()=>{X5();S5=new Map,lX={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class z${config;constructor($={}){this.config={...uz,...$}}async get($,X){return w$($,X,"image",this.config)}async set($,X,Z){return q$($,X,Z,"image",this.config)}async clear(){return W$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function pX($){if(!K$)K$=new z$($);else if($)K$.updateConfig($);return K$}async function U$($,X,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return pX(Y).get($,X)}async function j$($,X,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return pX(J).set($,X,Z)}async function nZ(){return pX().clear()}var uz,K$=null;var iX=y(()=>{cX();uz={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as dz,basename as mz,extname as lz,join as cz}from"path";import{mkdir as pz}from"fs/promises";async function nX(){try{return await import("ts-images")}catch{return null}}function rZ($){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 iz($,X){let Z=X?rZ(X):rZ("web"),Y=$.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function oZ($,X,Z){let Y=await nX();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await U$($,X,Z);if(J)return J;try{let G=dz($);if(!await D0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let Q=iz(Z,X.preset),w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await pz(w,{recursive:!0});let W=await v0(G),K=mz($,lz($)),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 rX(G,X.transformations,Y);for(let j of z){let _=Q[j]||{},H=`${K}-${W}.${j}`,L=cz(w,H);try{let O=await Y.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 Y.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 Y.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 j$($,X,U,Z),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function sZ($,X,Z,Y){let J=await nX();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:$,output:Y,format:X,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function rX($,X,Z){let Y=Z||await nX();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode($);for(let G of X){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var aZ=y(()=>{X5();iX()});import{resolve as nz,basename as rz,extname as oz,join as sz}from"path";import{mkdir as az}from"fs/promises";async function tz(){try{return await import("ts-images")}catch{return null}}async function tZ($,X,Z){let Y=await tz();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=nz($);if(!await D0(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let G=X.responsiveWidths||Z.breakpoints||ez,Q=X.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await az(w,{recursive:!0});let W=await v0(J),K=rz($,oz($)),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=sz(w,L),F=`${q}/${L}`;try{let V=z[j]?.quality||80;if(await D0(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 Y.processImage({input:J,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 Y.generateThumbHash(J);U.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await Y.generatePlaceholder(J,{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||$U(G),U}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function $U($){let X=[...$].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<X.length-1;Y++){let J=X[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${X[X.length-1]}px`),Z.join(", ")}function eZ($,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 ez;var $Y=y(()=>{X5();ez=[320,480,640,768,1024,1280,1536,1920]});var XY={};a(XY,{setCachedImageResult:()=>j$,processImage:()=>oZ,optimizeImage:()=>sZ,getCachedImageResult:()=>U$,generateSrcset:()=>eZ,generateResponsiveVariants:()=>tZ,clearImageCache:()=>nZ,applyTransformations:()=>rX,ImageProcessorCache:()=>z$});var ZY=y(()=>{aZ();$Y();iX()});async function XU(){try{return await Promise.resolve().then(() => (ZY(),XY))}catch($){if(!YY)console.warn("[stx-media] Image processor not available, some features disabled:",$),YY=!0;return null}}async function B$($,X={}){let Z=X,Y=$;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return GU(Y,Z)}if(Z.processedResult?.processed)return tX($,Z.processedResult,X);if(Z.responsiveVariants)return wY($,Z.responsiveVariants,X);let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=b5,dpr:K,formats:z=h7,quality:U=oX,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:H=!0,priority:L=!1,loading:O=L?"eager":H$,decoding:F=_$,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:T}=$,M=$.class,k=$.style,D=$.id,I=$.data||{},{isDev:S=!1,baseUrl:b=""}=X;if(S&&!X.optimize)return JU($);let C,P,x=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!L)try{C=await hZ(J,{strategy:j,..._}),P=gZ(x,C,_)}catch{}let f=K!==void 0&&Q!==void 0,l;if(f)l=YU($,x,C,X);else l=await ZU($,x,C,X);let $0;if(L){let A0=z.includes("webp")?"webp":z[0],u=xX(J,W,{...B,q:U},A0),t=typeof q==="object"?fX(q):q||"100vw";$0=`<link rel="preload" as="image" imagesrcset="${u}" imagesizes="${t}" />`}let C0=[];if(!JY&&j!=="none")C0.push(dX),JY=!0;if(P)C0.push(P);let U0=H?QY(x):void 0;return{html:l,preloadLink:$0,css:C0.length>0?C0.join(`
|
|
10464
|
-
`):void 0,script:U0}}async function
|
|
10463
|
+
`.trim();dX=new Map});import{createHash as cZ}from"crypto";import{readFile as xz,stat as pZ}from"fs/promises";async function v0($){try{let X=await xz($);return cZ("sha256").update(X).digest("hex").slice(0,16)}catch{return""}}function lZ($){return cZ("sha256").update($).digest("hex").slice(0,16)}function Q$($,X){let Z=JSON.stringify(X,Object.keys(X).sort());return`${lZ($)}-${lZ(Z)}`}async function lX($){try{return(await pZ($)).mtimeMs}catch{return 0}}async function D0($){try{return await pZ($),!0}catch{return!1}}var X5=()=>{};import{mkdir as fz,readFile as gz,writeFile as hz,readdir as nA,rm as uz,stat as rA}from"fs/promises";import{join as nZ,dirname as dz}from"path";async function mz($){try{await fz($,{recursive:!0})}catch{}}function rZ($,X,Z){return nZ($,Z,`${X}.json`)}async function iZ($,X,Z){if((Date.now()-$.createdAt)/86400000>Z)return!1;if(await lX(X)!==$.srcMtime)return!1;return!0}async function w$($,X,Z,Y=cX){if(!Y.enabled)return null;let J=Q$($,X),G=S5.get(J);if(G){if(await iZ(G,$,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;S5.delete(J)}let Q=rZ(Y.directory,J,Z);if(await D0(Q))try{let w=await gz(Q,"utf-8"),q=JSON.parse(w);if(await iZ(q,$,Y.maxAge))return q.lastAccessedAt=Date.now(),S5.set(J,q),q.data}catch{}return null}async function q$($,X,Z,Y,J=cX){if(!J.enabled)return;let G=Q$($,X),Q=await v0($),w=await lX($),q={key:G,src:$,srcHash:Q,srcMtime:w,optionsHash:Q$("",X),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};S5.set(G,q);let W=rZ(J.directory,G,Y);try{await mz(dz(W)),await hz(W,JSON.stringify(q,null,2))}catch(K){console.warn(`[stx-media] Failed to write cache: ${K}`)}}async function W$($,X=cX){if($==="all")S5.clear();else S5.clear();let Z=$==="all"?["image","video"]:[$];for(let Y of Z){let J=nZ(X.directory,Y);try{await uz(J,{recursive:!0,force:!0})}catch{}}}var S5,cX;var pX=y(()=>{X5();S5=new Map,cX={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class z${config;constructor($={}){this.config={...lz,...$}}async get($,X){return w$($,X,"image",this.config)}async set($,X,Z){return q$($,X,Z,"image",this.config)}async clear(){return W$("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function iX($){if(!K$)K$=new z$($);else if($)K$.updateConfig($);return K$}async function U$($,X,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return iX(Y).get($,X)}async function j$($,X,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return iX(J).set($,X,Z)}async function oZ(){return iX().clear()}var lz,K$=null;var nX=y(()=>{pX();lz={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as cz,basename as pz,extname as iz,join as nz}from"path";import{mkdir as rz}from"fs/promises";async function rX(){try{return await import("ts-images")}catch{return null}}function sZ($){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 oz($,X){let Z=X?sZ(X):sZ("web"),Y=$.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function aZ($,X,Z){let Y=await rX();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await U$($,X,Z);if(J)return J;try{let G=cz($);if(!await D0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let Q=oz(Z,X.preset),w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await rz(w,{recursive:!0});let W=await v0(G),K=pz($,iz($)),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 oX(G,X.transformations,Y);for(let j of z){let _=Q[j]||{},H=`${K}-${W}.${j}`,L=nz(w,H);try{let O=await Y.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 Y.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 Y.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 j$($,X,U,Z),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function tZ($,X,Z,Y){let J=await rX();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:$,output:Y,format:X,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function oX($,X,Z){let Y=Z||await rX();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode($);for(let G of X){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var eZ=y(()=>{X5();nX()});import{resolve as sz,basename as az,extname as tz,join as ez}from"path";import{mkdir as $U}from"fs/promises";async function XU(){try{return await import("ts-images")}catch{return null}}async function $Y($,X,Z){let Y=await XU();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=sz($);if(!await D0(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let G=X.responsiveWidths||Z.breakpoints||ZU,Q=X.formats||Z.defaultFormats||["avif","webp","jpeg"],w=Z.outputDir||"dist/images",q=Z.baseUrl||"/images";await $U(w,{recursive:!0});let W=await v0(J),K=az($,tz($)),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=ez(w,L),F=`${q}/${L}`;try{let V=z[j]?.quality||80;if(await D0(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 Y.processImage({input:J,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 Y.generateThumbHash(J);U.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await Y.generatePlaceholder(J,{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||YU(G),U}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function YU($){let X=[...$].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<X.length-1;Y++){let J=X[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${X[X.length-1]}px`),Z.join(", ")}function XY($,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 ZU;var ZY=y(()=>{X5();ZU=[320,480,640,768,1024,1280,1536,1920]});var YY={};a(YY,{setCachedImageResult:()=>j$,processImage:()=>aZ,optimizeImage:()=>tZ,getCachedImageResult:()=>U$,generateSrcset:()=>XY,generateResponsiveVariants:()=>$Y,clearImageCache:()=>oZ,applyTransformations:()=>oX,ImageProcessorCache:()=>z$});var JY=y(()=>{eZ();ZY();nX()});async function JU(){try{return await Promise.resolve().then(() => (JY(),YY))}catch($){if(!GY)console.warn("[stx-media] Image processor not available, some features disabled:",$),GY=!0;return null}}async function B$($,X={}){let Z=X,Y=$;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return qU(Y,Z)}if(Z.processedResult?.processed)return eX($,Z.processedResult,X);if(Z.responsiveVariants)return WY($,Z.responsiveVariants,X);let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=b5,dpr:K,formats:z=h7,quality:U=sX,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:H=!0,priority:L=!1,loading:O=L?"eager":H$,decoding:F=_$,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:T}=$,M=$.class,k=$.style,D=$.id,I=$.data||{},{isDev:S=!1,baseUrl:b=""}=X;if(S&&!X.optimize)return wU($);let C,P,x=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!L)try{C=await dZ(J,{strategy:j,..._}),P=uZ(x,C,_)}catch{}let f=K!==void 0&&Q!==void 0,l;if(f)l=QU($,x,C,X);else l=await GU($,x,C,X);let $0;if(L){let A0=z.includes("webp")?"webp":z[0],u=fX(J,W,{...B,q:U},A0),t=typeof q==="object"?gX(q):q||"100vw";$0=`<link rel="preload" as="image" imagesrcset="${u}" imagesizes="${t}" />`}let C0=[];if(!QY&&j!=="none")C0.push(mX),QY=!0;if(P)C0.push(P);let U0=H?qY(x):void 0;return{html:l,preloadLink:$0,css:C0.length>0?C0.join(`
|
|
10464
|
+
`):void 0,script:U0}}async function GU($,X,Z,Y){let{src:J,alt:G,width:Q,height:w,sizes:q,widths:W=b5,formats:K=h7,quality:z=sX,params:U={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":H$,decoding:H=_$,fetchpriority:L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A}=$,R=$.class,N=$.style,T=$.data||{},M=typeof q==="object"?gX(q):q||"100vw",k=[];for(let S of K){let b=fX(J,W,{...U,q:z},S),C=hX(S);if(B&&!j)k.push(` <source type="${C}" data-srcset="${b}" data-sizes="${M}" />`);else k.push(` <source type="${C}" srcset="${b}" sizes="${M}" />`)}let D=aX({src:u7(J,{...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:wY(R,Z),style:tX(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}">
|
|
10465
10465
|
<picture>
|
|
10466
10466
|
${k.join(`
|
|
10467
10467
|
`)}
|
|
@@ -10471,9 +10471,9 @@ ${k.join(`
|
|
|
10471
10471
|
${k.join(`
|
|
10472
10472
|
`)}
|
|
10473
10473
|
<img ${D} />
|
|
10474
|
-
</picture>`;return I}function
|
|
10474
|
+
</picture>`;return I}function QU($,X,Z,Y){let{src:J,alt:G,width:Q,height:w,dpr:q=[1,2,3],quality:W=sX,params:K={},lazy:z=!0,priority:U=!1,loading:B=U?"eager":H$,decoding:j=_$,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=hZ(J,N,q,{...K,q:W}),M=aX({src:u7(J,{...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:wY(V,Z),style:tX(A,H,L,Z),lazy:z&&!U,data:R}),k=z&&!U?`data-srcset="${T}"`:`srcset="${T}"`;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}">
|
|
10475
10475
|
<img ${M} ${k} />
|
|
10476
|
-
</div>`}return`<img ${X?`id="${X}" `:""}${M} ${k} />`}function
|
|
10476
|
+
</div>`}return`<img ${X?`id="${X}" `:""}${M} ${k} />`}function wU($){let{src:X,alt:Z,width:Y,height:J,loading:G=H$,decoding:Q=_$,fetchpriority:w,objectFit:q,objectPosition:W,crossorigin:K,referrerpolicy:z,priority:U=!1}=$,B=$.class,j=$.style,_=$.id,H=$.data||{};return{html:`<img ${aX({src:X,alt:Z,width:Y,height:J,loading:U?"eager":G,decoding:Q,fetchpriority:U?"high":w,objectFit:q,objectPosition:W,crossorigin:K,referrerpolicy:z,className:B,style:tX(j,q,W),id:_,data:H})} />`}}function aX($){let X=[];if($.lazy)X.push(`data-src="${$1($.src)}"`),X.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else X.push(`src="${$1($.src)}"`);if(X.push(`alt="${$1($.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="${$1($.className)}"`);if($.style)X.push(`style="${$1($.style)}"`);if($.id)X.push(`id="${$1($.id)}"`);if($.data)for(let[Z,Y]of Object.entries($.data))X.push(`data-${Z}="${$1(Y)}"`);if($.lazy)X.push("data-stx-lazy");return X.join(" ")}function wY($,X){let Z=[];if($)Z.push($);if(X)Z.push("stx-img-blur");return Z.join(" ")||""}function tX($,X,Z,Y){let J=[];if(X)J.push(`object-fit: ${X}`);if(Z)J.push(`object-position: ${Z}`);if(Y)J.push("opacity: 0; transition: opacity 300ms ease-out");if($)J.push($);return J.join("; ")}function $1($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function qY($){return`
|
|
10477
10477
|
(function() {
|
|
10478
10478
|
const container = document.getElementById('${$}');
|
|
10479
10479
|
if (!container) return;
|
|
@@ -10510,7 +10510,7 @@ ${k.join(`
|
|
|
10510
10510
|
|
|
10511
10511
|
observer.observe(container);
|
|
10512
10512
|
})();
|
|
10513
|
-
`.trim()}async function
|
|
10513
|
+
`.trim()}async function qU($,X){let Z=await JU();if(!Z)return B$({...$,process:!1},X);let Y=X.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let G=await Z.generateResponsiveVariants($.src,$,Y);if(G)return WY($,G,X)}else{let G=await Z.processImage($.src,$,Y);if(G.processed)return eX($,G,X)}return B$({...$,process:!1},X)}async function eX($,X,Z){let{alt:Y,width:J,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(($0)=>`${$0.url} ${$0.width}w`).join(", "),l=hX(P);if(Q&&!w)A.push(` <source type="${l}" data-srcset="${f}" />`);else A.push(` <source type="${l}" srcset="${f}" />`)}}let N=[];if(Q&&!w){if(N.push(`data-src="${$1(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${$1(O)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${$1(Y)}"`);let T=J||X.originalWidth,M=G||X.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);if(!w)N.push(`loading="${Q?"lazy":"eager"}"`);if(N.push('decoding="async"'),w)N.push('fetchpriority="high"');if(K)N.push(`crossorigin="${K}"`);if(z)N.push(`referrerpolicy="${z}"`);let k=[];if(q)k.push(`object-fit: ${q}`);if(W)k.push(`object-position: ${W}`);if(X.placeholder&&Q)k.push("opacity: 0; transition: opacity 300ms ease-out");if(B)k.push(B);if(k.length>0)N.push(`style="${k.join("; ")}"`);let 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[P,x]of Object.entries(_))N.push(`data-${P}="${$1(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}">
|
|
10514
10514
|
<picture>
|
|
10515
10515
|
${A.join(`
|
|
10516
10516
|
`)}
|
|
@@ -10520,12 +10520,12 @@ ${A.join(`
|
|
|
10520
10520
|
${A.join(`
|
|
10521
10521
|
`)}
|
|
10522
10522
|
<img ${N.join(" ")} />
|
|
10523
|
-
</picture>`;let S=[];if(X.placeholder)S.push(
|
|
10524
|
-
`):void 0,script:b}}async function
|
|
10523
|
+
</picture>`;let S=[];if(X.placeholder)S.push(mX);let b=Q?qY(j):void 0,C;if(w&&F)C=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:I,preloadLink:C,css:S.length>0?S.join(`
|
|
10524
|
+
`):void 0,script:b}}async function WY($,X,Z){let Y={src:X.src,processed:!0,variants:[],placeholder:X.placeholder?.dataURL,originalWidth:X.placeholder?.width,originalHeight:X.placeholder?.height};for(let[J,G]of Object.entries(X.byFormat))if(G)Y.variants.push(...G);return eX($,Y,Z)}var GY=!1,sX=80,_$="async",H$="lazy",QY=!1;var KY=y(()=>{uX();mZ()});function WU(){return G$({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,X,Z,Y)=>{let{src:J,alt:G,options:Q}=KU($,X,Z);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let w={src:J,alt:G||"",widths:Q.widths||b5,formats:Q.formats||h7,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 B$(w,{isDev:q}),K=W.html;if(W.preloadLink)K=W.preloadLink+`
|
|
10525
10525
|
`+K;if(W.css)K+=`
|
|
10526
10526
|
<style>${W.css}</style>`;if(W.script)K+=`
|
|
10527
|
-
<script>${W.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function
|
|
10528
|
-
`)}async function k$($,X,Z,Y,J){let G=await
|
|
10527
|
+
<script>${W.script}</script>`;return K},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function KU($,X,Z){if(X.src)return{src:String(X.src),alt:String(X.alt||""),options:X.options||{}};let Y=$.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=zU(Y),G=$3(J[0],Z)||"",Q=$3(J[1],Z)||"",w={};if(J[2]){let q=$3(J[2],Z);if(typeof q==="object"&&q!==null)w=q;else if(typeof J[2]==="string")try{w=JSON.parse(J[2])}catch{}}return{src:G,alt:Q,options:w}}function zU($){let X=[],Z="",Y=!1,J="",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(!Y)Y=!0,J=q;else if(q===J)Y=!1,J="";else Z+=q;continue}if(!Y){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){X.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())X.push(Z.trim());return X}function $3($,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 Y=X[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var zY;var UY=y(()=>{xX();KY();uX();zY=WU()});class L${config;constructor($={}){this.config={...UU,...$}}async get($,X){return w$($,X,"video",this.config)}async set($,X,Z){return q$($,X,Z,"video",this.config)}async clear(){return W$("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function X3($){if(!O$)O$=new L$($);else if($)O$.updateConfig($);return O$}async function F$($,X,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return X3(Y).get($,X)}async function V$($,X,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return X3(J).set($,X,Z)}async function jY(){return X3().clear()}var UU,O$=null;var Z3=y(()=>{pX();UU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as Y3,basename as J3,extname as G3,join as A$}from"path";import{mkdir as Q3}from"fs/promises";async function w3(){try{return await import("ts-videos")}catch{return null}}async function R$($,X,Z,Y){let J=await w3();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=Y3($);if(!await D0(G))return null;await Q3(Z,{recursive:!0});let Q=await v0(G),w=J3($,G3($)),q=X.format||"webp",W=X.timestamp||0,K=`${w}-poster-${Q}.${q}`,z=A$(Z,K),U=await J.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:`${Y}/${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 N$($,X,Z,Y){let J=await w3();if(!J)return[];try{let G=Y3($);if(!await D0(G))return[];await Q3(Z,{recursive:!0});let Q=await v0(G),w=J3($,G3($)),q=X.format||"webp",z=(await new J.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 J.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||A$(Z,`${w}-thumb-${Q}-${L}.${q}`),url:`${Y}/${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 BY($,X,Z,Y){let J=await w3();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=Y3($);if(!await D0(G))return null;await Q3(Z,{recursive:!0});let Q=await v0(G),w=J3($,G3($)),K=(await new J.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=A$(Z,O),V=[];for(let R=0;R<H;R++)V.push(R*U);let A=await J.extractThumbnails(G,{timestamps:V,width:B,height:j,format:_,quality:X.quality||70,outputDir:A$(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=z*B,T=L*j,M=await R.createSprite({images:A.map((k)=>k.path),columns:z,padding:0,outputPath:F,format:_,quality:X.quality||70});return{url:`${Y}/${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 q3=y(()=>{X5()});import{resolve as HY,basename as OY,extname as LY,join as Z5}from"path";import{mkdir as T$,writeFile as FY}from"fs/promises";async function VY(){try{return await import("ts-videos")}catch{return null}}async function M$($,X,Z,Y,J){let G=await VY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=HY($);if(!await D0(Q))return null;let w=await v0(Q),q=OY($,LY($)),W=Z5(Z,`${q}-${w}-hls`);await T$(W,{recursive:!0});let K=X.length>0?X:AY,z=J?.segmentDuration||6,j=(await new G.Input(Q).getInfo()).duration||0,_=[],H=0;for(let F of K){let V=Z5(W,F.label);await T$(V,{recursive:!0});let A=`${F.label}.m3u8`,R=Z5(V,A);try{let N=await G.generateHLS(Q,{outputDir:V,segmentDuration:z,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(N)_.push({quality:F,url:`${Y}/${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=Z5(W,"master.m3u8"),O=jU(_,Y,q,w);return await FY(L,O),{manifestUrl:`${Y}/${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 jU($,X,Z,Y){let J=["#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)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${w},RESOLUTION=${q},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return J.join(`
|
|
10528
|
+
`)}async function k$($,X,Z,Y,J){let G=await VY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=HY($);if(!await D0(Q))return null;let w=await v0(Q),q=OY($,LY($)),W=Z5(Z,`${q}-${w}-dash`);await T$(W,{recursive:!0});let K=X.length>0?X:AY,z=J?.segmentDuration||4,U=J?.minBufferTime||2,_=(await new G.Input(Q).getInfo()).duration||0,H=[],L=[];for(let A of K){let R=Z5(W,A.label);await T$(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:`${Y}/${q}-${w}-dash/${A.label}/video`}),A.audioBitrate)L.push({bandwidth:A.audioBitrate,url:`${Y}/${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=Z5(W,"manifest.mpd"),F=BU(H,L,_,z,U);await FY(O,F);let V=[{type:"video",representations:H}];if(L.length>0)V.push({type:"audio",representations:L});return{manifestUrl:`${Y}/${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 BU($,X,Z,Y,J){let G=_Y(Z),Q=_Y(J),w=`<?xml version="1.0" encoding="UTF-8"?>
|
|
10529
10529
|
<MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
|
|
10530
10530
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
10531
10531
|
xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
|
|
@@ -10551,7 +10551,7 @@ ${A.join(`
|
|
|
10551
10551
|
</Representation>
|
|
10552
10552
|
`}w+=` </AdaptationSet>
|
|
10553
10553
|
`}return w+=` </Period>
|
|
10554
|
-
</MPD>`,w}function
|
|
10554
|
+
</MPD>`,w}function _Y($){let X=Math.floor($/3600),Z=Math.floor($%3600/60),Y=Math.floor($%60),J="PT";if(X>0)J+=`${X}H`;if(Z>0)J+=`${Z}M`;return J+=`${Y}S`,J}var AY;var W3=y(()=>{X5();AY=[{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 RY,basename as _U,extname as HU,join as OU}from"path";import{mkdir as LU}from"fs/promises";async function NY(){try{return await import("ts-videos")}catch{return null}}function FU($){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 VU($){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 K3($){let X=await NY();if(!X)return null;try{let Z=RY($),J=await new X.Input(Z).getInfo();return{duration:J.duration||0,width:J.width||0,height:J.height||0,frameRate:J.frameRate||0,bitrate:J.bitrate||0,codec:J.videoCodec||"",audioCodec:J.audioCodec}}catch(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function TY($,X,Z,Y){let J=await NY();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let G=await F$($,X,Z);if(G)return G;try{let Q=RY($);if(!await D0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let w=Z.outputDir||"dist/videos",q=Z.baseUrl||"/videos";await LU(w,{recursive:!0});let W=await v0(Q),K=_U($,HU($)),z={src:$,processed:!0,hash:W};Y?.({percentage:5,stage:"analyzing"}),z.metadata=await K3(Q)||void 0;let U={};if(X.quality)U.bitrate=FU(X.quality);if(X.platform)Object.assign(U,VU(X.platform));if(X.transcode)Object.assign(U,X.transcode);if(Object.keys(U).length>0||X.process){Y?.({percentage:10,stage:"transcoding"});let B=`${K}-${W}.mp4`,j=OU(w,B);try{let _=await AU(Q,j,U,J,(H)=>Y?.({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){Y?.({percentage:65,stage:"generating-poster"});let B=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},j=await R$(Q,B,w,q);if(j)z.poster=j}if(Z.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let B=await N$(Q,Z.thumbnails,w,q);if(B.length>0)z.thumbnails=B}if(X.streaming){Y?.({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 M$(Q,B.qualities||Z.streaming?.defaultQualities||[],w,q);if(j)z.streaming={...z.streaming,hls:j}}if(B.format==="dash"){let j=await k$(Q,B.qualities||Z.streaming?.defaultQualities||[],w,q);if(j)z.streaming={...z.streaming,dash:j}}}if(X.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await V$($,X,z,Z),z}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function AU($,X,Z,Y,J){try{let Q=await new Y.Conversion($,X,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((w)=>{J?.(w.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Z.maxWidth||0,height:Q.height||Z.maxHeight||0,bitrate:Q.bitrate||Z.bitrate||0,frameRate:Q.frameRate||Z.frameRate||30,audioCodec:Q.audioCodec}}catch(G){return console.error(`[stx-media] Transcoding failed: ${G}`),null}}var MY=y(()=>{X5();Z3();q3();W3()});var kY={};a(kY,{setCachedVideoResult:()=>V$,processVideo:()=>TY,getCachedVideoResult:()=>F$,generateThumbnails:()=>N$,generateSpriteSheet:()=>BY,generatePoster:()=>R$,generateHLSManifest:()=>M$,generateDASHManifest:()=>k$,clearVideoCache:()=>jY,analyzeVideo:()=>K3,VideoProcessorCache:()=>L$});var IY=y(()=>{MY();q3();W3();Z3()});async function DY(){try{return await Promise.resolve().then(() => (IY(),kY))}catch($){if(!EY)console.warn("[stx-media] Video processor not available, some features disabled:",$),EY=!0;return null}}async function I$($,X={}){let Z=X,Y=$;if(Y.process&&!Y.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return IU(Y,Z)}if(Z.processedResult?.processed)return CY($,Z.processedResult,X);let J;if(Y.generatePoster&&Y.src&&!$.poster)J=await EU(Y,Z);let{src:G,sources:Q=[],poster:w,posterPlaceholder:q,controls:W=yY,autoplay:K=!1,muted:z=!1,loop:U=!1,preload:B=bY,playsinline:j=!0,lazy:_=!0,player:H="native",type:L,width:O,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=$,N=J||w,T=$.class,M=$.style,k=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(H==="ts-video")return TU($,X);if(L&&L!=="video")return NU(G||"",L,$);let D=Q.length>0?Q:G?[{src:G,type:SY(G)}]:[],I=[`id="${k}"`];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="${M0(N)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),N)I.push(`poster="${M0(N)}"`);if(O)I.push(`width="${O}"`);if(F)I.push(`height="${F}"`);if(T)I.push(`class="${M0(T)}"`);if(M)I.push(`style="${M0(M)}"`);let S=D.map((P)=>{return` <source ${_?`data-src="${M0(P.src)}"`:`src="${M0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
|
|
10555
10555
|
`),b=`<video ${I.join(" ")}>
|
|
10556
10556
|
${S}
|
|
10557
10557
|
Your browser does not support the video tag.
|
|
@@ -10590,9 +10590,9 @@ ${S}
|
|
|
10590
10590
|
|
|
10591
10591
|
observer.observe(video);
|
|
10592
10592
|
})();
|
|
10593
|
-
`.trim();return{html:b,script:C}}function
|
|
10593
|
+
`.trim();return{html:b,script:C}}function NU($,X,Z){let{width:Y=640,height:J=360}=Z,G=Z.class,Q=Z.style,w=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(X){case"youtube":W=MU($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=kU($),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="${M0(q)}"`,`width="${Y}"`,`height="${J}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)K.push(`class="${M0(G)}"`);if(Q)K.push(`style="${M0(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;">
|
|
10594
10594
|
<iframe ${K.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
|
|
10595
|
-
</div>`}}function
|
|
10595
|
+
</div>`}}function TU($,X={}){let{src:Z,sources:Y=[],poster:J,controls:G=!0,autoplay:Q=!1,muted:w=!1,loop:q=!1,preload:W="metadata",playsinline:K=!0,lazy:z=!0,width:U,height:B}=$,j=$.class,_=$.style,H=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:Y.length>0?Y:Z,autoplay:Q,loop:q,muted:w,playsinline:K,preload:W,poster:J,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=`
|
|
10596
10596
|
<div
|
|
10597
10597
|
id="${H}"
|
|
10598
10598
|
class="ts-video-player${j?" "+M0(j):""}"
|
|
@@ -10629,7 +10629,7 @@ ${S}
|
|
|
10629
10629
|
|
|
10630
10630
|
// Load ts-video-player from CDN
|
|
10631
10631
|
var script = document.createElement('script');
|
|
10632
|
-
script.src = '${
|
|
10632
|
+
script.src = '${RU}';
|
|
10633
10633
|
script.onload = initPlayer;
|
|
10634
10634
|
script.onerror = function() {
|
|
10635
10635
|
console.error('[stx] Failed to load ts-video-player');
|
|
@@ -10759,7 +10759,7 @@ else {
|
|
|
10759
10759
|
.ts-video-player__play-button svg {
|
|
10760
10760
|
margin-left: 4px;
|
|
10761
10761
|
}
|
|
10762
|
-
`.trim();return{html:F,script:V,css:A}}function
|
|
10762
|
+
`.trim();return{html:F,script:V,css:A}}function SY($){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 MU($){let X=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of X){let Y=$.match(Z);if(Y)return Y[1]}return null}function kU($){let X=$.match(/vimeo\.com\/(\d+)/);return X?X[1]:null}function M0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'")}async function IU($,X){let Z=await DY();if(!Z)return I$({...$,process:!1},X);let Y=X.tsVideosConfig,J=await Z.processVideo($.src,$,Y,$.onProcessProgress);if(J.processed)return CY($,J,X);return I$({...$,process:!1},X)}async function EU($,X){let Z=await DY();if(!Z||!$.src)return;let Y=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},J=X.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster($.src,Y,J.outputDir,J.baseUrl||"/videos"))?.url}function CY($,X,Z){let{controls:Y=yY,autoplay:J=!1,muted:G=!1,loop:Q=!1,preload:w=bY,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=SY(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(Y)R.push("controls");if(J)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(q)R.push("playsinline");if(B)R.push("disablepictureinpicture");if(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="${M0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${w}"`),A)R.push(`poster="${M0(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="${M0(_)}"`);if(H)R.push(`style="${M0(H)}"`);let k=` <source ${W?`data-src="${M0(O)}"`:`src="${M0(O)}"`} type="${F}" />`,D=`<video ${R.join(" ")}>
|
|
10763
10763
|
${k}
|
|
10764
10764
|
Your browser does not support the video tag.
|
|
10765
10765
|
</video>`;if(X.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${M0(X.spriteSheet.url)}" data-sprite-cols="${X.spriteSheet.columns}" data-sprite-interval="${X.spriteSheet.interval}">
|
|
@@ -10808,9 +10808,9 @@ ${D}
|
|
|
10808
10808
|
width: 100%;
|
|
10809
10809
|
height: auto;
|
|
10810
10810
|
}
|
|
10811
|
-
`.trim();return{html:D,script:I,css:S}}var
|
|
10811
|
+
`.trim();return{html:D,script:I,css:S}}var EY=!1,yY=!0,bY="metadata",RU="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var PY=y(()=>{U3()});function vY(){return G$({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,X,Z,Y)=>{let{src:J,options:G}=DU($,X,Z);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:J,poster:G.poster,controls:G.controls!==!1,autoplay:G.autoplay||!1,muted:G.muted||!1,loop:G.loop||!1,preload:G.preload||"metadata",playsinline:G.playsinline!==!1,lazy:G.lazy!==!1,player:G.player||"native",type:G.type,width:G.width,height:G.height,class:G.class,style:G.style,id:G.id,crossorigin:G.crossorigin,disablePictureInPicture:G.disablePictureInPicture,disableRemotePlayback:G.disableRemotePlayback,title:G.title,quality:G.quality,platform:G.platform,process:G.process,generatePoster:G.generatePoster,streaming:G.streaming,transcode:G.transcode,spriteSheet:G.spriteSheet,waveform:G.waveform},q={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},W=await I$(Q,q),K=W.html;if(W.css)K+=`
|
|
10812
10812
|
<style>${W.css}</style>`;if(W.script)K+=`
|
|
10813
|
-
<script>${W.script}</script>`;return K},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function
|
|
10813
|
+
<script>${W.script}</script>`;return K},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function DU($,X,Z){if(X.src)return{src:String(X.src),options:X.options||{}};let Y=$.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=yU(Y),G=xY(J[0],Z)||"",Q={};if(J[1]){let w=xY(J[1],Z);if(typeof w==="object"&&w!==null)Q=w;else if(typeof J[1]==="string")try{Q=JSON.parse(J[1])}catch{}}return{src:G,options:Q}}function yU($){let X=[],Z="",Y=!1,J="",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(!Y)Y=!0,J=q;else if(q===J)Y=!1,J="";else Z+=q;continue}if(!Y){if(q==="{")G++;if(q==="}")G--;if(q==="[")Q++;if(q==="]")Q--;if(q===","&&G===0&&Q===0){X.push(Z.trim()),Z="";continue}}Z+=q}if(Z.trim())X.push(Z.trim());return X}function xY($,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 Y=X[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var z3;var U3=y(()=>{xX();PY();z3=vY()});function bU($,X){let Z=X.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
|
|
10814
10814
|
${$}
|
|
10815
10815
|
</div>
|
|
10816
10816
|
<script>
|
|
@@ -10855,7 +10855,7 @@ ${D}
|
|
|
10855
10855
|
}
|
|
10856
10856
|
}
|
|
10857
10857
|
})();
|
|
10858
|
-
</script>`}function
|
|
10858
|
+
</script>`}function SU($,X){let Z=X.pwa?.updates,Y=Z?.message||"A new version is available. Reload to update?",J=Z?.autoReload||!1,G=$.trim().length>0,Q=`
|
|
10859
10859
|
<div class="stx-pwa-update-banner" style="
|
|
10860
10860
|
position: fixed;
|
|
10861
10861
|
bottom: 0;
|
|
@@ -10966,7 +10966,7 @@ else {
|
|
|
10966
10966
|
// Also listen for custom event
|
|
10967
10967
|
window.addEventListener('pwa-update-available', showUpdate);
|
|
10968
10968
|
})();
|
|
10969
|
-
</script>`}function
|
|
10969
|
+
</script>`}function CU($,X){let Z=$.trim().length>0,Y=`
|
|
10970
10970
|
<div class="stx-offline-indicator" style="
|
|
10971
10971
|
position: fixed;
|
|
10972
10972
|
top: 16px;
|
|
@@ -11027,7 +11027,7 @@ else {
|
|
|
11027
11027
|
window.addEventListener('offline', updateStatus);
|
|
11028
11028
|
updateStatus();
|
|
11029
11029
|
})();
|
|
11030
|
-
</script>`}function
|
|
11030
|
+
</script>`}function PU($,X){let Z=X.pwa?.push,Y=Z?.vapidPublicKey||"",J=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
|
|
11031
11031
|
${$}
|
|
11032
11032
|
</div>
|
|
11033
11033
|
<script>
|
|
@@ -11109,33 +11109,33 @@ catch (error) {
|
|
|
11109
11109
|
init();
|
|
11110
11110
|
}
|
|
11111
11111
|
})();
|
|
11112
|
-
</script>`}var
|
|
11113
|
-
${$.message}`),X&&$.line){let G=
|
|
11112
|
+
</script>`}var vU,xU,fU,gU,fY;var gY=y(()=>{vU={name:"pwa.installButton",handler:($,X,Z,Y)=>{let J=Z.__stx_options||{};return bU($,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},xU={name:"pwa.updatePrompt",handler:($,X,Z,Y)=>{let J=Z.__stx_options||{};return SU($,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},fU={name:"pwa.offlineIndicator",handler:($,X,Z,Y)=>{let J=Z.__stx_options||{};return CU($,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},gU={name:"pwa.pushSubscribe",handler:($,X,Z,Y)=>{let J=Z.__stx_options||{};return PU($,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},fY=[vU,xU,fU,gU]});function j3($){for(let[X,Z]of Object.entries(o))if(Z===$)return X;return}var o;var E$=y(()=>{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 d7(){return!1}function m7(){return!d7()||process.env.STX_DEBUG==="true"}function D$(){return!1}import hU from"path";function y$(){return{...B3}}function b$($){if(!B3.showRelativePaths||!$)return $;let X=B3.baseDir||process.cwd();try{let Z=hU.relative(X,$);return Z.startsWith("..")?$:Z}catch{return $}}var uU,B3,S$,Y5,C$;var P$=y(()=>{E$();uU={showRelativePaths:!1,enableAutoRecovery:m7(),logRecoveryWarnings:!0},B3={...uU};S$=class S$ extends Error{code;filePath;line;column;context;numericCode;constructor($,X,Z,Y,J,G,Q){super($);this.code=X;this.filePath=Z;this.line=Y;this.column=J;this.context=G;if(this.name="StxError",this.numericCode=Q||o.EVALUATION_ERROR,this.filePath)this.filePath=b$(this.filePath)}};Y5=class Y5 extends S${constructor($,X,Z,Y,J,G){super($,"stx_RUNTIME_ERROR",X,Z,Y,J,G||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};C$=class C$ extends S${isFatal=!0;constructor($,X,Z,Y,J,G){super($,"stx_VALIDATION_ERROR",X,Z,Y,J,G||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function uY($){let{type:X,message:Z,code:Y,filePath:J,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=iU(w,q);U=O.line,B=O.column}let j=J?b$(J):void 0,_=Y?j3(Y):void 0,H={type:X,code:Y,codeName:_,message:Z,filePath:j,line:U,column:B,snippet:W,suggestion:K,timestamp:new Date().toISOString()},L;switch(z){case"html":L=mU(H);break;case"json":L=JSON.stringify(H,null,2);break;case"console":L=lU(H,w,q);break;case"text":default:L=dU(H,w,q);break}return{formatted:L,data:H}}function dU($,X,Z){let Y=[],J=$.code?` [${$.codeName||$.code}]`:"";if(Y.push(`[${$.type} Error${J}]`),$.filePath){let G=$.filePath;if($.line){if(G+=`:${$.line}`,$.column)G+=`:${$.column}`}Y.push(`at ${G}`)}if(Y.push(`
|
|
11113
|
+
${$.message}`),X&&$.line){let G=cU(X,$.line,2);if(G)Y.push(`
|
|
11114
11114
|
${G}`)}if($.snippet)Y.push(`
|
|
11115
11115
|
Snippet: ${$.snippet}`);if($.suggestion)Y.push(`
|
|
11116
|
-
Suggestion: ${$.suggestion}`);return Y.join(" ")}function
|
|
11116
|
+
Suggestion: ${$.suggestion}`);return Y.join(" ")}function mU($){let X=$.code?` [${$.code}]`:"",Z=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",Y=`<!-- [${$.type} Error${X}]${Z}: ${hY($.message)}`;if($.suggestion)Y+=` | Suggestion: ${hY($.suggestion)}`;return Y+=" -->",Y}function lU($,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(`
|
|
11117
11117
|
\x1B[90mat\x1B[0m ${z}`)}if(W.push(`
|
|
11118
11118
|
|
|
11119
|
-
${$.message}`),X&&$.line){let z=
|
|
11119
|
+
${$.message}`),X&&$.line){let z=pU(X,$.line,2);if(z)W.push(`
|
|
11120
11120
|
|
|
11121
11121
|
\x1B[90mContext:\x1B[0m
|
|
11122
11122
|
${z}`)}if($.suggestion)W.push(`
|
|
11123
11123
|
|
|
11124
11124
|
\x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
|
|
11125
|
-
${"\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
|
|
11125
|
+
${"\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 cU($,X,Z){let Y=$.split(`
|
|
11126
11126
|
`),J=Math.max(0,X-Z-1),G=Math.min(Y.length-1,X+Z-1),Q=[];for(let w=J;w<=G;w++){let q=(w+1).toString().padStart(4),W=w===X-1?">":" ";Q.push(`${W}${q} | ${Y[w]}`)}return Q.join(`
|
|
11127
|
-
`)}function
|
|
11127
|
+
`)}function pU($,X,Z){let Y=$.split(`
|
|
11128
11128
|
`),J=Math.max(0,X-Z-1),G=Math.min(Y.length-1,X+Z-1),Q="\x1B[90m",w="\x1B[31m",q="\x1B[0m",W=[];for(let K=J;K<=G;K++){let z=(K+1).toString().padStart(4),U=K===X-1,B=U?"\x1B[31m>\x1B[0m":" ",j=U?`\x1B[31m${Y[K]}\x1B[0m`:`\x1B[90m${Y[K]}\x1B[0m`;W.push(`${B}\x1B[90m${z}\x1B[0m | ${j}`)}return W.join(`
|
|
11129
|
-
`)}function
|
|
11130
|
-
`);return{line:Y.length,column:Y[Y.length-1].length}}function Z0($,X,Z){return
|
|
11129
|
+
`)}function hY($){return $.replace(/--/g,"- -").replace(/>/g,">")}function iU($,X){let Y=$.substring(0,X).split(`
|
|
11130
|
+
`);return{line:Y.length,column:Y[Y.length-1].length}}function Z0($,X,Z){return uY({type:$,message:X,code:Z,format:"html"}).formatted}async function C5($,X,Z){try{return await $()}catch(Y){if(Z&&Y instanceof Error)Z(Y);return X}}var dY=y(()=>{E$();P$()});class H3{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 Y={timestamp:new Date,error:$,context:X,level:Z};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))this.writeToFile(Y)}shouldLog($){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(`
|
|
11131
11131
|
`).slice(1).join(`
|
|
11132
11132
|
`)}`);if($.context)X.push(` Context: ${JSON.stringify($.context)}`);return X.join(`
|
|
11133
11133
|
`)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let X=await import("fs"),Y=(await import("path")).dirname(this.logFilePath);if(!X.existsSync(Y))X.mkdirSync(Y,{recursive:!0});await this.rotateIfNeeded(X);let J=`${this.formatEntry($)}
|
|
11134
11134
|
`;X.appendFileSync(this.logFilePath,J,"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 Y=`${this.logFilePath}.${Z}`,J=`${this.logFilePath}.${Z+1}`;if($.existsSync(Y))if(Z>=this.maxLogFiles-1)$.unlinkSync(Y);else $.renameSync(Y,J)}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 Y=Z.error.constructor.name;$[Y]=($[Y]||0)+1;let J=Z.level||"error";X[J]=(X[J]||0)+1}return{total:this.errors.length,byType:$,byLevel:X}}async exportToFile($,X="json"){let Z=await import("fs"),J=(await import("path")).dirname($);if(!Z.existsSync(J))Z.mkdirSync(J,{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(`
|
|
11135
11135
|
|
|
11136
|
-
`),"utf-8")}}async flush(){await this.writeQueue}}var
|
|
11137
|
-
@end${w}`;Y.push(`Added ${K} missing @end${w}`)}}if(Y.length>0&&X.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((w)=>console.warn(` - ${w}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:Y}},createFallbackContent($,X){if(m7())return`<!-- ${$} failed: ${X.message} -->`;return"<!-- stx rendering error -->"}};X1=new
|
|
11138
|
-
`)}}});var
|
|
11136
|
+
`),"utf-8")}}async flush(){await this.writeQueue}}var _3,X1,O3;var mY=y(()=>{P$();_3={isEnabled(){return y$().enableAutoRecovery},fixCommonSyntaxErrors($){let X=y$();if(!X.enableAutoRecovery)return{fixed:$,fixes:[]};let Z=$,Y=[],J=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(J>G){let w=J-G;Z+="}}".repeat(w),Y.push(`Added ${w} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let w of Q){let q=(Z.match(new RegExp(`@${w}\\b`,"g"))||[]).length,W=(Z.match(new RegExp(`@end${w}\\b`,"g"))||[]).length;if(q>W){let K=q-W;for(let z=0;z<K;z++)Z+=`
|
|
11137
|
+
@end${w}`;Y.push(`Added ${K} missing @end${w}`)}}if(Y.length>0&&X.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((w)=>console.warn(` - ${w}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:Y}},createFallbackContent($,X){if(m7())return`<!-- ${$} failed: ${X.message} -->`;return"<!-- stx rendering error -->"}};X1=new H3,O3={isDevelopment(){return m7()},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(`
|
|
11138
|
+
`)}}});var lY=()=>{};var cY=y(()=>{E$();dY();mY();lY();P$()});var V1=y(()=>{cY()});function pY($,X,Z,Y){let J=$;J=J.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="${c(z)}" content="${c(W)}">`:""}return W?`<meta name="${c(q)}" content="${c(W)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(J))!==null){let w=Q.index,q=w+Q[0].length-1,W=1,K=q+1;while(K<J.length&&W>0){if(J[K]==="(")W++;else if(J[K]===")"){if(W--,W===0)break}K++}if(W!==0)break;let z=J.substring(q+1,K).trim(),U=K+1,B=(()=>{try{let j=N0(z,X);if(!j)return"";let _="<meta";if(j.name)_+=` name="${c(String(j.name))}"`;if(j.property)_+=` property="${c(String(j.property))}"`;if(j.httpEquiv)_+=` http-equiv="${c(String(j.httpEquiv))}"`;if(j.content)_+=` content="${c(String(j.content))}"`;return _+=">",_}catch(j){let _=j instanceof Error?j.message:String(j);return Z0("MetaTag",_,o.EVALUATION_ERROR)}})();J=J.substring(0,w)+B+J.substring(U),G.lastIndex=0}return J}function iY($,X,Z){let Y=$,J=/@structuredData\s*\(/g,G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let K=Y.substring(w+1,W).trim(),z=W+1,U=(()=>{try{let B=N0(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 Z0("StructuredData",j,o.EVALUATION_ERROR)}})();Y=Y.substring(0,Q)+U+Y.substring(z),J.lastIndex=0}return Y}function nY($,X,Z,Y){let J=$,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(J))!==null){let w=J.indexOf("{",Q.index+4),q=1,W=w+1,K=null,z=!1;while(W<J.length&&q>0){let L=J[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=J.substring(W).match(/^\s*\)/);if(!U)break;let B=W+U[0].length,j=J.substring(w,W),_=J.substring(Q.index,B),H=((L)=>{try{let O=N0(L,X);if(!O)return"";let F="";if(O.title)F+=`<title>${c(O.title)}</title>
|
|
11139
11139
|
`,F+=`<meta name="title" content="${c(O.title)}">
|
|
11140
11140
|
`;if(O.description)F+=`<meta name="description" content="${c(O.description)}">
|
|
11141
11141
|
`;if(O.keywords){let V=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;F+=`<meta name="keywords" content="${c(V)}">
|
|
@@ -11157,7 +11157,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
11157
11157
|
`}if(V.site)F+=`<meta name="twitter:site" content="${c(V.site)}">
|
|
11158
11158
|
`;if(V.creator)F+=`<meta name="twitter:creator" content="${c(V.creator)}">
|
|
11159
11159
|
`}if(O.structuredData){let V=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${V}</script>
|
|
11160
|
-
`}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return Z0("SEO",`Error processing @seo directive: ${F}`,o.EVALUATION_ERROR)}})(j);J=J.substring(0,Q.index)+H+J.substring(B),G.lastIndex=Q.index+H.length}return J}function
|
|
11160
|
+
`}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return Z0("SEO",`Error processing @seo directive: ${F}`,o.EVALUATION_ERROR)}})(j);J=J.substring(0,Q.index)+H+J.substring(B),G.lastIndex=Q.index+H.length}return J}function rY($,X,Z){if(Z.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Z.skipDefaultSeoTags===!0)return $;let Y=X.__stx_runtime_head;if(!!(Y?.title||Y?.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=`
|
|
11161
11161
|
<!-- stx SEO Tags -->
|
|
11162
11162
|
<meta name="title" content="${c(Q)}">
|
|
11163
11163
|
<meta name="description" content="${c(w)}">
|
|
@@ -11173,8 +11173,8 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
|
|
|
11173
11173
|
`;let K=$;if(!G)K=K.replace(/<head[^>]*>/,`$&
|
|
11174
11174
|
<title>${c(Q)}</title>`);return K.replace(/<head[^>]*>/,`$&
|
|
11175
11175
|
${W}
|
|
11176
|
-
`)}function c($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function
|
|
11177
|
-
`).trim()}var
|
|
11176
|
+
`)}function c($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function aY($){let X=[];for(let Z of $.rules){if(X.push(`User-agent: ${Z.userAgent}`),Z.allow)for(let Y of Z.allow)X.push(`Allow: ${Y}`);if(Z.disallow)for(let Y of Z.disallow)X.push(`Disallow: ${Y}`);if(Z.crawlDelay!==void 0)X.push(`Crawl-delay: ${Z.crawlDelay}`);X.push("")}if($.sitemap){let Z=Array.isArray($.sitemap)?$.sitemap:[$.sitemap];for(let Y of Z)X.push(`Sitemap: ${Y}`)}if($.host)X.push(`Host: ${$.host}`);return X.join(`
|
|
11177
|
+
`).trim()}var oY,sY;var v$=y(()=>{V1();T0();oY={name:"meta",handler:($,X,Z,Y)=>{if(X.length<1)return Z0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let J=X[0].replace(/['"]/g,""),G=X.length>1?X[1].replace(/['"]/g,""):"";return`<meta name="${c(J)}" content="${c(G)}">`},hasEndTag:!1},sY={name:"structuredData",handler:($,X,Z,Y)=>{if($.trim()==="")return Z0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse($);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return Z0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let G=J instanceof Error?J.message:String(J);return Z0("StructuredData",G,o.EVALUATION_ERROR)}},hasEndTag:!0}});import l7 from"path";function nU($,X){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1].trim():"",J=X,G=[],Q=!0;if(Y){let z=Y.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let U=z[1],B=U.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)J=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:J,props:G,template:q,styles:K,script:Y,shadowDOM:Q}}function rU($){let{tag:X,props:Z,template:Y,styles:J,shadowDOM:G}=$,Q=X.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),w=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Z.map((z)=>`'${z}'`).join(", "),K=Z.map((z)=>`
|
|
11178
11178
|
get ${z}() {
|
|
11179
11179
|
return this.getAttribute('${z}') || '';
|
|
11180
11180
|
}
|
|
@@ -11225,16 +11225,16 @@ ${K}
|
|
|
11225
11225
|
}
|
|
11226
11226
|
|
|
11227
11227
|
customElements.define('${X}', ${Q});
|
|
11228
|
-
`}async function
|
|
11229
|
-
${
|
|
11230
|
-
</script>`}var aY=y(()=>{V1();k0()});var tY={};a(tY,{timingPlugin:()=>sU,pluginManager:()=>iU,definePlugin:()=>x$,debugPlugin:()=>oU,createVariablesPlugin:()=>aU,createFilterPlugin:()=>rU,createDirectivePlugin:()=>nU,PluginManager:()=>O3});function x$($){return $}class O3{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,Y]of this.plugins)if(Y.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 Y of this.sortedPlugins){let J=Y[$];if(J)try{let G=await J(Z);if(G){if(G.template!==void 0)Z.template=G.template;if(G.context)Z.context={...Z.context,...G.context};if(G.metadata)Z.metadata={...Z.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Y.name}" ${$} hook:`,G)}}return Z}async runDirectiveHooks($,X,Z){let Y={...Z};for(let J of this.sortedPlugins){let G=J[$];if(G)try{let Q=await G(X,Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${$} hook:`,Q)}}return Y}}function nU($,X,Z={}){return{name:$,...Z,registerDirectives:()=>X}}function rU($,X,Z={}){return{name:$,...Z,registerFilters:()=>X}}function aU($){return x$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(X){return{context:{...X.context,...$}}}})}var iU,oU,sU;var eY=y(()=>{iU=new O3;oU=x$({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)}}),sU=x$({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 YJ={};a(YJ,{validateConfig:()=>Jj,resolveStxDirectories:()=>ZJ,loadStxConfig:()=>e0,defineStxConfig:()=>Yj,defaultConfig:()=>J5,config:()=>N7});import f$ from"fs";import p0 from"path";import{loadConfigWithResult as tU}from"bunfig";function eU($,X,Z){let Y=X||"pages";if($)return{root:$,pagesDir:Y};let J=Z||process.cwd(),G=p0.join(J,"resources","views"),Q=p0.join(J,"resources","layouts");if(f$.existsSync(G)&&f$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=p0.join(J,"resources","views","pages");if(f$.existsSync(w))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function $j($,X){let Z=X.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let Y=$.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/");return Y===J||Y.startsWith(`${J}/`)}function ZJ($,X){let Z=!$.root,Y=eU($.root,$.pagesDir,X);if($.root=Y.root,$.pagesDir=Y.pagesDir,Z&&Y.root!=="."){let J=`${X}::${Y.root}`;if(!$J.has(J))$J.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let J=$.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=$[G];if(typeof Q!=="string"||!Q)continue;if(p0.isAbsolute(Q)||$j(Q,J))continue;$[G]=p0.join(J,Q)}}return $}function Xj($,X){let Z=["componentsDir","layoutsDir","partialsDir"];for(let Y of Z){let J=$[Y];if(typeof J!=="string"||!J)continue;let G=p0.isAbsolute(J)?J:p0.join(X,J);if(f$.existsSync(G))continue;let Q=$.root,w=!!Q&&Q!==".";console.warn(`[stx] ${String(Y)} resolves to "${G}", which does not exist. Configured as "${J}"`+(w?`, resolved under root "${Q}".`:"."))}}function Zj($){if(_2($.stateDir),$.stateDir=H7(),$.cachePath=O7($.cachePath),$.build)$.build.cacheDir=O7($.build.cacheDir);if($.media?.cache)$.media.cache.directory=O7($.media.cache.directory);if($.story)$.story.outDir=O7($.story.outDir)}async function e0($){if(!$){if(P5)return P5;if(g$)return g$}let X=$?p0.resolve($):process.cwd(),Z=XJ.get(X);if(Z)return Z;let Y=(async()=>{let G=(await tU({name:"stx",alias:"ui",cwd:X,defaultConfig:J5,verbose:!1})).config;if(Zj(G),ZJ(G,X),Xj(G,X),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (eY(),tY)),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=p0.dirname(j0.resolve(K))}catch{let _=p0.resolve(process.cwd(),K);U=await import(_),B=p0.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(p0.resolve(B,H))}if(j.pages){let _=p0.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(XJ.set(X,Y),!$)g$=Y,Y.then((J)=>{P5=J}).catch(()=>{});return Y}function Yj($){return $}function Jj($){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 Y=["auto","manual","sections"];if(!Y.includes($.streaming.strategy))X.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes($.i18n.format))X.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.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 Y=["AA","AAA"];if(!Y.includes($.a11y.level))X.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes($.hydration.mode))X.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes($.hydration.preload))X.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))X.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")X.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")X.push({path:`customDirectives[${J}].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((Y,J)=>{if(!Y.name||typeof Y.name!=="string")X.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")X.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))X.push({path:`middleware[${J}].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 Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes($.pwa.manifest.display))X.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes($.pwa.manifest.orientation))X.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((J,G)=>{if(!J.pattern||typeof J.pattern!=="string")X.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(J.strategy))X.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))X.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))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((J)=>typeof J!=="number"||J<16||J>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 Y=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((G)=>!Y.includes(G)).length>0)X.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:X.length===0,errors:X,warnings:Z}}var J5,$J,P5=null,XJ,g$=null,N7;var L1=y(()=>{g9();h9();u9();d9();PX();KY();z3();xY();v$();L7();aY();J5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:V5,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:xZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:sY,hasEndTag:!1,description:"Include a web component in the template"},L2,F2,nY,rY,V2,R2,N2,A2,k2,D2,WY,K3,...vY],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}};$J=new Set;XJ=new Map;N7=new Proxy(J5,{get($,X){if(P5&&X in P5)return P5[X];if(!g$)e0().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[X]}})});var WJ={};a(WJ,{resetCssCache:()=>Uj,resetCrosswindCache:()=>jj,rebuildCrosswindCSS:()=>Bj,loadCrosswindConfig:()=>A3,loadCrosswind:()=>V3,injectCrosswindCSS:()=>p7,getCrosswindServeAsset:()=>wj,getCachedCSS:()=>_j,generateCrosswindCSS:()=>qJ,extractClassNames:()=>wJ,buildCrosswindCSS:()=>QJ});import J0 from"path";import{hasLocalConfig as Gj}from"bunfig";function u$($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function L3($,X){if(A1.has($))A1.delete($);else if(A1.size>=GJ)A1.delete(A1.keys().next().value);A1.set($,X)}function Qj($){let X=u$($);if(Z1.has(X))Z1.delete(X);else if(Z1.size>=GJ)Z1.delete(Z1.keys().next().value);return Z1.set(X,$),X}function wj($){let X=Z1.get($);if(X===void 0)return;return Z1.delete($),Z1.set($,X),X}async function qj($){if(!f1)return null;try{let X=Bun.file(J0.join(f1,`cw-${u$($)}.css`));if(!await X.exists())return null;return await X.text()}catch{return null}}async function Wj($,X){if(!f1)return;try{if(!fs.existsSync(f1))fs.mkdirSync(f1,{recursive:!0});await Bun.write(J0.join(f1,`cw-${u$($)}.css`),X)}catch{}}async function JJ($){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 Kj(){let $=[],X=process.cwd();while(X!==J0.dirname(X))$.push(J0.join(X,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(J0.join(X,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(J0.join(X,"pantry","@cwcss","crosswind","dist","index.js")),$.push(J0.join(X,"pantry","@cwcss","crosswind","src","index.ts")),$.push(J0.join(X,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(J0.join(X,"pantry","@stacksjs","crosswind","dist","index.js")),X=J0.dirname(X);return $}function zj(){let $=[],X=process.env.HOME||process.env.USERPROFILE||"";if(X){let Z=[J0.join(X,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),J0.join(X,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),J0.join(X,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),J0.join(X,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),J0.join(X,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),J0.join(X,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Z)}return $.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function V3(){if(F3)return K1;F3=!0;try{let $=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await JJ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded from ${J0.dirname(J0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=J0.resolve(process.env.CROSSWIND_SRC),G=await $([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return K1=G,K1}let X=await $(Kj());if(X)return K1=X,K1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await JJ(J);if(G){if(K1=G,!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded`);return K1}}let Y=await $(zj());if(Y)return K1=Y,K1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${H0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${H0.reset}`),console.warn(`${H0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${H0.reset}`),null}}function Uj(){A1.clear(),Z1.clear()}function jj(){K1=null,F3=!1,Y1=null,c7="",A1.clear(),Z1.clear(),h$=null}async function A3($){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 Y=J0.relative($,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch(X){if(X instanceof Error&&X.name==="ConfigNotFoundError")return null;return console.warn(`${H0.yellow}[Crosswind]${H0.reset} Failed to load crosswind config:`,X instanceof Error?X.message:X),null}}async function QJ($){if(v5)return c7;v5=!0;try{let X=await V3();if(!X||!X.build)return v5=!1,"";if(!Y1)Y1=await A3($);if(!Y1)return v5=!1,"";let Z=X.defaultConfig?.theme||{},Y=Y1.theme||{},J={...X.defaultConfig,...Y1,theme:{...Z,...Y,extend:{...Z.extend||{},...Y.extend||{}}}},G=performance.now(),Q=await X.build(J),w=performance.now()-G;if(c7=Q.css,console.log(`${H0.cyan}[Crosswind]${H0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),J.output){let q=J0.isAbsolute(J.output)?J.output:J0.join($,J.output),W=J0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,Q.css)}return v5=!1,Q.css}catch(X){return console.error(`${H0.red}[Crosswind]${H0.reset} Build error:`,X),v5=!1,c7}}async function Bj($){Y1=null,await QJ($)}function _j(){return c7}function wJ($){let X=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec($);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())X.add(Q.trim());Y=Z.exec($)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.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=J.exec($)}return X}async function qJ($,X){try{let Z=await V3();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses($):wJ($);if(Y.size===0)return"";let J=X?J0.resolve(X):process.cwd();if(!f1)f1=_1(J,"cache");let G=[...Y].sort().join(" "),Q=`${h$||"default"}::${G}`,w=A1.get(Q);if(w!==void 0)return L3(Q,w),w;let q=await qj(Q);if(q!==null)return L3(Q,q),q;if(!Y1){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (L1(),YJ)),R=await A(J);if(R.css)if(typeof R.css==="string"){let N=J0.isAbsolute(R.css)?R.css:J0.resolve(J,R.css);if(await Bun.file(N).exists()){let T=await import(N);V=T.default||T,console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let N=J0.isAbsolute(R.css.config)?R.css.config:J0.resolve(J,R.css.config);if(await Bun.file(N).exists()){let T=await import(N);V={...T.default||T,...V}}}console.log(`${H0.green}[Crosswind]${H0.reset} Using inline CSS config from stx.config.ts`)}}catch{}Y1=V||await A3(J);try{h$=u$(JSON.stringify(Y1??{}))}catch{h$="unhashable"}}let W=Z.defaultConfig||Z.config,K=Y1||{},z=j2(W,K),{safelist:U,includePreflight:B,minify:j}=z,_=z.config,H=new Z.CSSGenerator(_);for(let V of U)H.generate(V);for(let V of Y)H.generate(V);let L=H.toCSS(B,j),O=_.shortcuts||K.shortcuts||{};for(let[V,A]of Object.entries(O)){if(!Y.has(V)&&!U.includes(V))continue;let R=A.split(/\s+/).filter(Boolean);for(let N of R)H.generate(N)}L=H.toCSS(B,j);let F=L.split(`
|
|
11228
|
+
`}async function tY($,X,Z,Y){if(X.length<1)return Z0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let J=X[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",w=[l7.join(l7.dirname(Y),Q,`${J}.stx`),l7.join(process.cwd(),Q,`${J}.stx`),l7.join(l7.dirname(Y),`${J}.stx`)],q=null;for(let z of w)if(await p(z)){q=await Bun.file(z).text();break}if(!q)return Z0("WebComponent",`Component file not found: ${J}.stx`,o.FILE_NOT_FOUND);let W=nU(q,J);return`<script type="module">
|
|
11229
|
+
${rU(W)}
|
|
11230
|
+
</script>`}var eY=y(()=>{V1();k0()});var $J={};a($J,{timingPlugin:()=>eU,pluginManager:()=>oU,definePlugin:()=>x$,debugPlugin:()=>tU,createVariablesPlugin:()=>$j,createFilterPlugin:()=>aU,createDirectivePlugin:()=>sU,PluginManager:()=>L3});function x$($){return $}class L3{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,Y]of this.plugins)if(Y.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 Y of this.sortedPlugins){let J=Y[$];if(J)try{let G=await J(Z);if(G){if(G.template!==void 0)Z.template=G.template;if(G.context)Z.context={...Z.context,...G.context};if(G.metadata)Z.metadata={...Z.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Y.name}" ${$} hook:`,G)}}return Z}async runDirectiveHooks($,X,Z){let Y={...Z};for(let J of this.sortedPlugins){let G=J[$];if(G)try{let Q=await G(X,Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${$} hook:`,Q)}}return Y}}function sU($,X,Z={}){return{name:$,...Z,registerDirectives:()=>X}}function aU($,X,Z={}){return{name:$,...Z,registerFilters:()=>X}}function $j($){return x$({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(X){return{context:{...X.context,...$}}}})}var oU,tU,eU;var XJ=y(()=>{oU=new L3;tU=x$({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)}}),eU=x$({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 GJ={};a(GJ,{validateConfig:()=>wj,resolveStxDirectories:()=>JJ,loadStxConfig:()=>e0,defineStxConfig:()=>Qj,defaultConfig:()=>J5,config:()=>N7});import f$ from"fs";import p0 from"path";import{loadConfigWithResult as Xj}from"bunfig";function Zj($,X,Z){let Y=X||"pages";if($)return{root:$,pagesDir:Y};let J=Z||process.cwd(),G=p0.join(J,"resources","views"),Q=p0.join(J,"resources","layouts");if(f$.existsSync(G)&&f$.existsSync(Q))return{root:"resources",pagesDir:"views"};let w=p0.join(J,"resources","views","pages");if(f$.existsSync(w))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function Yj($,X){let Z=X.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let Y=$.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/");return Y===J||Y.startsWith(`${J}/`)}function JJ($,X){let Z=!$.root,Y=Zj($.root,$.pagesDir,X);if($.root=Y.root,$.pagesDir=Y.pagesDir,Z&&Y.root!=="."){let J=`${X}::${Y.root}`;if(!ZJ.has(J))ZJ.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let J=$.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=$[G];if(typeof Q!=="string"||!Q)continue;if(p0.isAbsolute(Q)||Yj(Q,J))continue;$[G]=p0.join(J,Q)}}return $}function Jj($,X){let Z=["componentsDir","layoutsDir","partialsDir"];for(let Y of Z){let J=$[Y];if(typeof J!=="string"||!J)continue;let G=p0.isAbsolute(J)?J:p0.join(X,J);if(f$.existsSync(G))continue;let Q=$.root,w=!!Q&&Q!==".";console.warn(`[stx] ${String(Y)} resolves to "${G}", which does not exist. Configured as "${J}"`+(w?`, resolved under root "${Q}".`:"."))}}function Gj($){if(H2($.stateDir),$.stateDir=H7(),$.cachePath=O7($.cachePath),$.build)$.build.cacheDir=O7($.build.cacheDir);if($.media?.cache)$.media.cache.directory=O7($.media.cache.directory);if($.story)$.story.outDir=O7($.story.outDir)}async function e0($){if(!$){if(P5)return P5;if(g$)return g$}let X=$?p0.resolve($):process.cwd(),Z=YJ.get(X);if(Z)return Z;let Y=(async()=>{let G=(await Xj({name:"stx",alias:"ui",cwd:X,defaultConfig:J5,verbose:!1})).config;if(Gj(G),JJ(G,X),Jj(G,X),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (XJ(),$J)),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=p0.dirname(j0.resolve(K))}catch{let _=p0.resolve(process.cwd(),K);U=await import(_),B=p0.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(p0.resolve(B,H))}if(j.pages){let _=p0.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(YJ.set(X,Y),!$)g$=Y,Y.then((J)=>{P5=J}).catch(()=>{});return Y}function Qj($){return $}function wj($){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 Y=["auto","manual","sections"];if(!Y.includes($.streaming.strategy))X.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes($.i18n.format))X.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.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 Y=["AA","AAA"];if(!Y.includes($.a11y.level))X.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes($.hydration.mode))X.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes($.hydration.preload))X.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))X.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")X.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")X.push({path:`customDirectives[${J}].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((Y,J)=>{if(!Y.name||typeof Y.name!=="string")X.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")X.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))X.push({path:`middleware[${J}].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 Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes($.pwa.manifest.display))X.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes($.pwa.manifest.orientation))X.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((J,G)=>{if(!J.pattern||typeof J.pattern!=="string")X.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(J.strategy))X.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))X.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))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((J)=>typeof J!=="number"||J<16||J>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 Y=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((G)=>!Y.includes(G)).length>0)X.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:X.length===0,errors:X,warnings:Z}}var J5,ZJ,P5=null,YJ,g$=null,N7;var L1=y(()=>{g9();h9();u9();d9();vX();UY();U3();gY();v$();L7();eY();J5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:V5,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:gZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:tY,hasEndTag:!1,description:"Include a web component in the template"},F2,V2,oY,sY,A2,N2,T2,R2,I2,y2,zY,z3,...fY],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};ZJ=new Set;YJ=new Map;N7=new Proxy(J5,{get($,X){if(P5&&X in P5)return P5[X];if(!g$)e0().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return $[X]}})});var zJ={};a(zJ,{resetCssCache:()=>_j,resetCrosswindCache:()=>Hj,rebuildCrosswindCSS:()=>Oj,loadCrosswindConfig:()=>R3,loadCrosswind:()=>A3,injectCrosswindCSS:()=>p7,getCrosswindServeAsset:()=>Kj,getCachedCSS:()=>Lj,generateCrosswindCSS:()=>KJ,extractClassNames:()=>WJ,buildCrosswindCSS:()=>qJ});import J0 from"path";import{hasLocalConfig as qj}from"bunfig";function u$($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function F3($,X){if(A1.has($))A1.delete($);else if(A1.size>=wJ)A1.delete(A1.keys().next().value);A1.set($,X)}function Wj($){let X=u$($);if(Z1.has(X))Z1.delete(X);else if(Z1.size>=wJ)Z1.delete(Z1.keys().next().value);return Z1.set(X,$),X}function Kj($){let X=Z1.get($);if(X===void 0)return;return Z1.delete($),Z1.set($,X),X}async function zj($){if(!f1)return null;try{let X=Bun.file(J0.join(f1,`cw-${u$($)}.css`));if(!await X.exists())return null;return await X.text()}catch{return null}}async function Uj($,X){if(!f1)return;try{if(!fs.existsSync(f1))fs.mkdirSync(f1,{recursive:!0});await Bun.write(J0.join(f1,`cw-${u$($)}.css`),X)}catch{}}async function QJ($){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 jj(){let $=[],X=process.cwd();while(X!==J0.dirname(X))$.push(J0.join(X,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(J0.join(X,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(J0.join(X,"pantry","@cwcss","crosswind","dist","index.js")),$.push(J0.join(X,"pantry","@cwcss","crosswind","src","index.ts")),$.push(J0.join(X,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(J0.join(X,"pantry","@stacksjs","crosswind","dist","index.js")),X=J0.dirname(X);return $}function Bj(){let $=[],X=process.env.HOME||process.env.USERPROFILE||"";if(X){let Z=[J0.join(X,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),J0.join(X,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),J0.join(X,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),J0.join(X,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),J0.join(X,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),J0.join(X,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Z)}return $.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(J0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function A3(){if(V3)return K1;V3=!0;try{let $=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await QJ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded from ${J0.dirname(J0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=J0.resolve(process.env.CROSSWIND_SRC),G=await $([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return K1=G,K1}let X=await $(jj());if(X)return K1=X,K1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await QJ(J);if(G){if(K1=G,!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded`);return K1}}let Y=await $(Bj());if(Y)return K1=Y,K1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${H0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${H0.reset}`),console.warn(`${H0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${H0.reset}`),null}}function _j(){A1.clear(),Z1.clear()}function Hj(){K1=null,V3=!1,Y1=null,c7="",A1.clear(),Z1.clear(),h$=null}async function R3($){try{if(!qj({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 Y=J0.relative($,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch(X){if(X instanceof Error&&X.name==="ConfigNotFoundError")return null;return console.warn(`${H0.yellow}[Crosswind]${H0.reset} Failed to load crosswind config:`,X instanceof Error?X.message:X),null}}async function qJ($){if(v5)return c7;v5=!0;try{let X=await A3();if(!X||!X.build)return v5=!1,"";if(!Y1)Y1=await R3($);if(!Y1)return v5=!1,"";let Z=X.defaultConfig?.theme||{},Y=Y1.theme||{},J={...X.defaultConfig,...Y1,theme:{...Z,...Y,extend:{...Z.extend||{},...Y.extend||{}}}},G=performance.now(),Q=await X.build(J),w=performance.now()-G;if(c7=Q.css,console.log(`${H0.cyan}[Crosswind]${H0.reset} Built ${Q.classes.size} classes in ${w.toFixed(1)}ms`),J.output){let q=J0.isAbsolute(J.output)?J.output:J0.join($,J.output),W=J0.dirname(q);if(!fs.existsSync(W))fs.mkdirSync(W,{recursive:!0});await Bun.write(q,Q.css)}return v5=!1,Q.css}catch(X){return console.error(`${H0.red}[Crosswind]${H0.reset} Build error:`,X),v5=!1,c7}}async function Oj($){Y1=null,await qJ($)}function Lj(){return c7}function WJ($){let X=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec($);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())X.add(Q.trim());Y=Z.exec($)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.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=J.exec($)}return X}async function KJ($,X){try{let Z=await A3();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses($):WJ($);if(Y.size===0)return"";let J=X?J0.resolve(X):process.cwd();if(!f1)f1=_1(J,"cache");let G=[...Y].sort().join(" "),Q=`${h$||"default"}::${G}`,w=A1.get(Q);if(w!==void 0)return F3(Q,w),w;let q=await zj(Q);if(q!==null)return F3(Q,q),q;if(!Y1){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (L1(),GJ)),R=await A(J);if(R.css)if(typeof R.css==="string"){let N=J0.isAbsolute(R.css)?R.css:J0.resolve(J,R.css);if(await Bun.file(N).exists()){let T=await import(N);V=T.default||T,console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let N=J0.isAbsolute(R.css.config)?R.css.config:J0.resolve(J,R.css.config);if(await Bun.file(N).exists()){let T=await import(N);V={...T.default||T,...V}}}console.log(`${H0.green}[Crosswind]${H0.reset} Using inline CSS config from stx.config.ts`)}}catch{}Y1=V||await R3(J);try{h$=u$(JSON.stringify(Y1??{}))}catch{h$="unhashable"}}let W=Z.defaultConfig||Z.config,K=Y1||{},z=B2(W,K),{safelist:U,includePreflight:B,minify:j}=z,_=z.config,H=new Z.CSSGenerator(_);for(let V of U)H.generate(V);for(let V of Y)H.generate(V);let L=H.toCSS(B,j),O=_.shortcuts||K.shortcuts||{};for(let[V,A]of Object.entries(O)){if(!Y.has(V)&&!U.includes(V))continue;let R=A.split(/\s+/).filter(Boolean);for(let N of R)H.generate(N)}L=H.toCSS(B,j);let F=L.split(`
|
|
11231
11231
|
`);for(let[V,A]of Object.entries(O)){if(!Y.has(V)&&!U.includes(V))continue;let R=A.split(/\s+/).filter(Boolean),N=[],T=[];for(let M of R){let k=M.startsWith("dark:"),S=`.${(k?M.slice(5):M).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<F.length;b++){let C=F[b].trim();if(C===`${S} {`||C.startsWith(`${S} {`)){let P=b,x="";while(P<F.length){if(x+=F[P],F[P].includes("}"))break;P++}let f=x.match(/\{([^}]+)\}/);if(f)if(k)T.push(f[1].trim());else N.push(f[1].trim());break}}}if(N.length)L+=`
|
|
11232
11232
|
.${V} { ${N.join(" ")} }`;if(T.length)L+=`
|
|
11233
|
-
@media (prefers-color-scheme: dark) { .dark .${V} { ${T.join(" ")} } }`}return
|
|
11233
|
+
@media (prefers-color-scheme: dark) { .dark .${V} { ${T.join(" ")} } }`}return F3(Q,L),Uj(Q,L),L}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function p7($,X,Z=!1){let Y=await KJ($,X);if(!Y)return $;let J=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${Wj(Y)}.css">`:`<style data-crosswind="generated">
|
|
11234
11234
|
${Y}
|
|
11235
11235
|
</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,J})}if($.includes("</head>"))return $.replace("</head>",`${J}
|
|
11236
11236
|
</head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
|
|
11237
|
-
${J}`);return J+$}var K1=null,
|
|
11237
|
+
${J}`);return J+$}var K1=null,V3=!1,Y1=null,c7="",v5=!1,wJ=256,A1,Z1,f1=null,h$=null;var d$=y(()=>{L7();O2();A1=new Map,Z1=new Map});function UJ(){return`
|
|
11238
11238
|
// STX Lifecycle Runtime
|
|
11239
11239
|
(function() {
|
|
11240
11240
|
if (typeof window === 'undefined') return;
|
|
@@ -11579,7 +11579,7 @@ else {
|
|
|
11579
11579
|
|
|
11580
11580
|
console.log('[stx] Lifecycle runtime initialized');
|
|
11581
11581
|
})();
|
|
11582
|
-
`}function
|
|
11582
|
+
`}function N3($){return Symbol($)}var qT,WT,KT;var jJ=y(()=>{qT=N3("theme"),WT=N3("router"),KT=N3("i18n")});import*as _J from"crypto";function BJ($){let X=/\$(\w+)\./g,Z=[],Y;while((Y=X.exec($))!==null)if(!Z.includes(Y[1]))Z.push(Y[1]);return Z}function Fj(){return`stx-${_J.randomBytes(4).toString("hex")}`}function Vj($){return/\$\w+\./.test($)}function Aj($){let X=[],Z=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,J=$;return J=J.replace(Y,(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(Vj(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}),BJ(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 _=Fj(),z=` id="${_}"${z}`;for(let H of W)X.push({elementId:_,attribute:H.attr,expression:H.expr,stores:BJ(H.expr)});return`<${Q}${z}${q}`}),{html:J,bindings:X,stores:Z}}function Rj($,X){if($.length===0)return"";let Z=Array.from(X),Y=`
|
|
11583
11583
|
<script>
|
|
11584
11584
|
(function() {
|
|
11585
11585
|
'use strict';
|
|
@@ -11737,10 +11737,10 @@ else {
|
|
|
11737
11737
|
}
|
|
11738
11738
|
})();
|
|
11739
11739
|
</script>
|
|
11740
|
-
`,Y}function
|
|
11740
|
+
`,Y}function HJ($){let{html:X,bindings:Z,stores:Y}=Aj($);if(Z.length===0)return $;let J=Rj(Z,Y),G=X.lastIndexOf("</body>");if(G!==-1)return X.slice(0,G)+J+X.slice(G);return X+J}var OJ=()=>{};function Nj($){let X=$.analytics;if(!X?.enabled)return"";switch(X.driver){case"fathom":return Tj(X);case"google-analytics":return Mj(X);case"plausible":return kj(X);case"self-hosted":return Ij(X);case"custom":return Ej(X);default:return""}}function Tj($){let X=$.fathom;if(!X?.siteId)return"";let Z=X.scriptUrl||"https://cdn.usefathom.com/script.js",Y=X.defer!==!1?" defer":"",J=[`data-site="${i0(X.siteId)}"`];if(X.honorDnt)J.push('data-honor-dnt="true"');if(X.spa)J.push('data-spa="auto"');if(X.canonical)J.push(`data-canonical="${i0(X.canonical)}"`);if(X.auto===!1)J.push('data-auto="false"');return`
|
|
11741
11741
|
<!-- Fathom Analytics -->
|
|
11742
11742
|
<script src="${i0(Z)}" ${J.join(" ")}${Y}></script>
|
|
11743
|
-
`}function
|
|
11743
|
+
`}function Mj($){let X=$.googleAnalytics;if(!X?.measurementId)return"";let Z=i0(X.measurementId),Y=X.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
|
|
11744
11744
|
<!-- Google Analytics -->
|
|
11745
11745
|
<script async src="https://www.googletagmanager.com/gtag/js?id=${Z}"></script>
|
|
11746
11746
|
<script>
|
|
@@ -11750,10 +11750,10 @@ else {
|
|
|
11750
11750
|
gtag('config', '${Z}');
|
|
11751
11751
|
${Y}
|
|
11752
11752
|
</script>
|
|
11753
|
-
`}function
|
|
11753
|
+
`}function kj($){let X=$.plausible;if(!X?.domain)return"";let Z=X.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${i0(X.domain)}"`],J=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")J=`https://plausible.io/js/script.${G.join(".")}.js`;return`
|
|
11754
11754
|
<!-- Plausible Analytics -->
|
|
11755
11755
|
<script defer data-domain="${i0(X.domain)}" src="${i0(J)}"></script>
|
|
11756
|
-
`}function
|
|
11756
|
+
`}function Ij($){let X=$.selfHosted;if(!X?.siteId||!X?.apiEndpoint)return"";let Z=i0(X.siteId),Y=i0(X.apiEndpoint),J=X.honorDnt?'if(n.doNotTrack==="1")return;':"",G=X.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=X.trackOutboundLinks?`
|
|
11757
11757
|
d.addEventListener('click',function(e){
|
|
11758
11758
|
var a=e.target.closest('a');
|
|
11759
11759
|
if(a&&a.hostname!==location.hostname){
|
|
@@ -11786,7 +11786,7 @@ else {
|
|
|
11786
11786
|
w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
|
|
11787
11787
|
})();
|
|
11788
11788
|
</script>
|
|
11789
|
-
`}function
|
|
11789
|
+
`}function Ej($){let X=$.custom;if(!X)return"";if(X.inlineScript)return`
|
|
11790
11790
|
<!-- Custom Analytics -->
|
|
11791
11791
|
<script>
|
|
11792
11792
|
${X.inlineScript}
|
|
@@ -11794,7 +11794,7 @@ ${X.inlineScript}
|
|
|
11794
11794
|
`;if(!X.scriptUrl)return"";let Z=[];if(X.scriptId)Z.push(`id="${i0(X.scriptId)}"`);if(X.attributes)for(let[J,G]of Object.entries(X.attributes))Z.push(`${i0(J)}="${i0(G)}"`);return`
|
|
11795
11795
|
<!-- Custom Analytics -->
|
|
11796
11796
|
<script${Z.length>0?` ${Z.join(" ")}`:""} src="${i0(X.scriptUrl)}" defer></script>
|
|
11797
|
-
`}function
|
|
11797
|
+
`}function LJ($,X){let Z=Nj(X);if(!Z)return $;if(!$.includes("</head>")){let Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+$.slice(Y);return $+Z}return $.replace("</head>",`${Z}</head>`)}function i0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}var FJ=()=>{};function m$($){let X=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!X)return null;try{return Function(`return ${X[1]}`)()}catch{return null}}function VJ($){let X=$?.layout;if(X===!1)return!1;return typeof X==="string"&&X.trim()?X.trim():void 0}function AJ($,X){let Z=$.match(new RegExp(`${X}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let Y=$.match(new RegExp(`${X}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function yj($){let X=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=Z.exec($))!==null){let[J,G,Q]=Y,w=Y.index,q=AJ(Q,"x-data");if(!q)continue;let W=`__stx_scope_${NJ++}`,K=AJ(Q,"x-init"),z=bj($,G,w+J.length),U=$.slice(w,z.endIndex),B=Sj(U);X.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:K,bindings:[],refs:B})}return X}function bj($,X,Z){let Y=1,J=Z,G=new RegExp(`<${X}(?:\\s|>)`,"gi"),Q=new RegExp(`</${X}>`,"gi"),w=new RegExp(`<${X}[^>]*/\\s*>`,"gi");while(Y>0&&J<$.length){G.lastIndex=J,Q.lastIndex=J,w.lastIndex=J;let q=G.exec($),W=Q.exec($),K=w.exec($);if(K&&K.index<(q?.index??1/0)){J=K.index+K[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)Y++,J=q.index+q[0].length;else{if(Y--,Y===0)return{endIndex:W.index+W[0].length};J=W.index+W[0].length}}return{endIndex:$.length}}function Sj($){let X=new Map,Z=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[,G,Q]=J,w=Cj(G);X.set(Q,w)}return X}function Cj($){let X=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(X)return X[1];return`__stx_el_${Dj++}`}function Pj(){return`
|
|
11798
11798
|
// STX Reactive Runtime - x-cloak and transition CSS
|
|
11799
11799
|
(function() {
|
|
11800
11800
|
var style = document.createElement('style');
|
|
@@ -12001,7 +12001,7 @@ window.__stx_reactive = (function() {
|
|
|
12001
12001
|
|
|
12002
12002
|
return { initScope: initScope, reactive: reactive };
|
|
12003
12003
|
})();
|
|
12004
|
-
`}function
|
|
12004
|
+
`}function RJ($,X){let Z=$.replace(/\{!!([\s\S]*?)!!\}/g,(w,q)=>{try{let W=u0(q,X,!0);if(W===void 0)return w;return String(W)}catch{return w}}),Y="",J=0,G=null;while(J<Z.length){let w=Z[J];if(G&&w==="\\"){Y+=w+(Z[J+1]??""),J+=2;continue}if(w==="{"&&Z[J+1]==="{"){let q=Z.indexOf("}}",J+2);if(q!==-1){let W=Z.slice(J,q+2);Y+=Q(Z.slice(J+2,q),W,G),J=q+2;continue}}if(G){if(w===G)G=null}else if(w==="'"||w==='"'||w==="`")G=w;Y+=w,J++}return Y;function Q(w,q,W){let K;try{K=u0(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 vj($,X){if($.length===0)return"";let Z=$.map((Y)=>{let J=JSON.stringify(Object.fromEntries(Y.refs)),G=RJ(Y.stateExpr,X),Q=Y.initExpr?RJ(Y.initExpr,X):null,w=JSON.stringify(G),q=Q?JSON.stringify(Q):"null";return`
|
|
12005
12005
|
(function() {
|
|
12006
12006
|
var scopeEl = document.querySelector('${Y.selector}');
|
|
12007
12007
|
if (!scopeEl) return;
|
|
@@ -12010,14 +12010,14 @@ window.__stx_reactive = (function() {
|
|
|
12010
12010
|
})();`}).join(`
|
|
12011
12011
|
`);return`
|
|
12012
12012
|
<script data-stx-scoped data-stx-reactive data-stx-run="always">
|
|
12013
|
-
${
|
|
12013
|
+
${Pj()}
|
|
12014
12014
|
${Z}
|
|
12015
|
-
</script>`}function
|
|
12016
|
-
`+J.slice(Q);else J+=G;return J}function Cj($,X){let Z=0,Y=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,G,Q)=>{let w=X[Z++];if(!w)return J;let q=/data-stx-scope="([^"]*)"/.exec(Q);if(q)return w.id=q[1],w.selector=`[data-stx-scope="${w.id}"]`,J;return`<${G} data-stx-scope="${w.id}"${Q}>`});return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Pj($){return/x-data\s*=\s*["']/.test($)}var AJ=0,kj=0;var NJ=y(()=>{W1()});import vj from"fs";import N3 from"path";import{createHighlighter as xj}from"ts-syntax-highlighter";async function fj($,X={}){try{if(!await p($))throw Error(`Markdown file not found: ${$}`);let Y=(await vj.promises.stat($)).mtime.getTime();if(X.cache&&T3.has($)){let z=T3.get($);if(z.updatedAt>=Y)return{content:z.content,data:z.data}}let J=await Bun.file($).text(),{data:G,content:Q}=b2(J),w=X.markdown||N7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=F7(Q,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)W=await gj(W,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:W,data:G||{}};if(X.cache)T3.set($,{...K,updatedAt:Y});return K}catch(Z){if(X.debug)console.error(`Error reading/parsing markdown file ${$}:`,Z);let Y=Z instanceof Error?Z.message:String(Z);return{content:z0("Markdown File",`Error reading/parsing markdown file: ${Y}`,$,"",0,""),data:{}}}}async function gj($,X,Z){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!l$)try{l$=await xj({theme:X||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),$}let J=async(w,q,W,K)=>{let z=K.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),U=W||(Z?"text":"");if(!U)return w;try{if(!l$.getSupportedLanguages().includes(U))return w;return(await l$.highlight(z,U,{theme:X})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return w},G=$,Q=$.matchAll(Y);for(let w of Q){let[q,W,K,z]=w,U=await J(q,W,K,z);G=G.replace(q,U)}return G}async function TJ($,X,Z="",Y={}){return await hj($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,w,q,W)=>{try{let K=w;if(!N3.isAbsolute(w))K=N3.resolve(N3.dirname(Z),w);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(Y.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(Y.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:U,data:B}=await fj(K,Y),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 z0("Markdown File",`Error including markdown file: ${z}`,Z,$,W,Q)}})}async function hj($,X,Z){let Y=[],J;while((J=X.exec($))!==null){let w=J[0],q=J.index,W=J;Y.push(Z(...W).then((K)=>({match:w,replacement:K,index:q})))}let G=await Promise.all(Y);G.sort((w,q)=>q.index-w.index);let Q=$;for(let{match:w,replacement:q}of G)Q=Q.replace(w,()=>q);return Q}var T3,l$=null;var MJ=y(()=>{L1();k0();T3=new Map});function g1($,X){try{let Z=$.trim();if(q0(Z))return W0(Z,Object.keys(X))(...Object.values(X));else return Y0(Z,X)}catch{return!1}}var kJ=y(()=>{T0()});function uj($,X,Z){let Y=$,J=!0;while(J){J=!1;let G=Y.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=BX(Y,Q);if(!w)break;try{let q;if(q0(w.expression))q=W0(w.expression,Object.keys(X))(...Object.values(X));else q=Y0(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=Y0(z.value,X);if(q===U){W=z.content.trim(),K=!0;break}}catch{continue}Y=Y.substring(0,Q)+W+Y.substring(w.end),J=!0}catch(q){let W=q instanceof Error?q.message:String(q),K=Z0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+K+Y.substring(w.end);break}}return Y}function dj($){let X=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return X.push(Y),`\x00stx-script-${X.length-1}\x00`}),scripts:X}}function mj($,X){if(X.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,Y)=>X[Number(Y)]??Z)}function G5($,X,Z){let{masked:Y,scripts:J}=dj($);return mj(lj(Y,X,Z),J)}function lj($,X,Z){let Y=$;Y=uj(Y,X,Z);{let G=!0;while(G){G=!1;let Q=Y.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=P1(Y,w+7);if(!q)break;let W=q.endPos,K=t1(Y,"unless","endunless",W);if(K===-1){console.warn(`[stx] @unless directive at position ${w} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=Y.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`;Y=Y.substring(0,w)+j+Y.substring(K+10),G=!0}}Y=k3(Y,X,Z),Y=I3(Y,X,Z),Y=M3(Y,X);let J=()=>{let G=v7(Y);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let w=G[Q];try{let q="",W=!1;for(let K of w.branches){if(W)break;if(K.type==="else")q=K.content,W=!0;else try{let z;if(K.condition&&q0(K.condition))z=W0(K.condition,Object.keys(X))(...Object.values(X));else if(K.condition)z=Y0(K.condition,X);if(z)q=K.content,W=!0}catch(z){q=Z0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),W=!0}}Y=Y.substring(0,w.start)+q+Y.substring(w.end)}catch(q){let W=q instanceof Error?q.message:String(q),K=Z0("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,w.start)+K+Y.substring(w.end)}}return!0};while(!0){let G=Y;if(!J())break;if(Y===G)break}return Y}function IJ($){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 Y=[];while(X<$.length){let J=$[X];if(J==="\\"&&X+1<$.length){Y.push($[X+1]),X+=2;continue}if(J===Z){X++;break}Y.push(J),X++}while(X<$.length&&/\s/.test($[X]))X++;if($[X]!==")")return null;return X++,{value:Y.join(""),consumed:X}}function M3($,X){let Z=$;function Y(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 J(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=IJ(U);if(B)K=B.value,z=W+5+B.consumed;else z=W+5;let j=Y(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=J(_,"auth","endauth"),L;if(!X.auth)L=!1;else L=K?g1(`auth?.check && auth?.user?.[${K}]`,X):g1("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=IJ(U);if(B)K=B.value,z=W+6+B.consumed;else z=W+6;let j=Y(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=J(_,"guest","endguest"),L;if(!X.auth)L=!0;else L=K?g1(`!auth?.check || !auth?.user?.[${K}]`,X):g1("!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=g1(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=Y(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=[],M;while((M=V.exec(L))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(L))!==null)T.push({pos:M.index,type:"close"});while((M=R.exec(L))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(L))!==null)T.push({pos:M.index,type:"else"});T.sort((C,P)=>C.pos-P.pos);for(let C of T){if(C.type==="open"){F++;continue}if(C.type==="close"){F--;continue}if(F===0)O.push(C)}let k=[],D=0;for(let C=0;C<O.length;C++){let P=O[C];if(k.push({content:L.slice(D,P.pos),ability:void 0}),P.type==="elseDirective"){let x=L.slice(P.pos+`@${W}`.length),f=Q(x);if(f){k[k.length-1]={content:L.slice(D,P.pos)},D=P.pos+`@${W}`.length+f.paramsEnd,k.push({content:"",ability:f.ability,type:f.type,id:f.id}),k.pop();let l=O[C+1],$0=l?l.pos:L.length;k.push({content:L.slice(D,$0),ability:f.ability,type:f.type,id:f.id}),D=$0}}else D=P.pos+5}if(D<L.length){let C=k[k.length-1];if(O.length>0&&O[O.length-1].type==="else")k.push({content:L.slice(D),isFinalElse:!0});else if(k.length===0)k.push({content:L.slice(D)})}let I=G(j.ability,j.type,j.id),S=w==="can"?I:!I,b="";if(S)b=k[0]?.content||"";else{let C=!1;for(let P=1;P<k.length;P++){let x=k[P];if(x.isFinalElse){b=x.content,C=!0;break}if(x.ability){let f=G(x.ability,x.type,x.id);if(w==="can"?f:!f){b=x.content,C=!0;break}}}if(!C&&k.length>0){let P=k[k.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,U)+b+Z.substring(H+`@${q}`.length),K=!0}}return Z}function k3($,X,Z){let Y=$;function J(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=P1(G,B+`@${Q}`.length);if(!j)break;let _=j.endPos,H=t1(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),M=L.slice(F+5);N=R?T:M}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=Z0(W,`Error processing @${Q} directive: ${N}`,o.EVALUATION_ERROR);G=G.substring(0,B)+T+G.substring(H+`@${w}`.length);break}}return G}return Y=J(Y,"isset","endisset",(G)=>{let Q=g1(G,X);return Q!==void 0&&Q!==null},"Isset"),Y=J(Y,"empty","endempty",(G)=>{let Q=g1(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"),Y}function I3($,X,Z){let Y=$,J="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=J===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,C=S?S.index:1/0;if(b<C)F++,V=b+I[0].length;else if(C<1/0){if(F--,F===0){A=C;break}V=C+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,M=0;while(M<R.length){let I=R.indexOf("@",M);if(I===-1)break;let S=R.substring(I);if(U.test(S)){T++,M=I+1;continue}if(B.test(S)){T--,M=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(S)){N=I;break}M=I+1}let k;if(N!==-1){let I=R.slice(0,N),S=R.slice(N+5);k=W?I:S}else k=W?R:"";let D=`@${q}`.length;j=j.substring(0,L)+k+j.substring(A+D),_=!0}return j}return Y=G(Y,"env","endenv",!1),Y=G(Y,"production","endproduction",J==="production"),Y=G(Y,"development","enddevelopment",J==="development"),Y=G(Y,"staging","endstaging",J==="staging"),Y=G(Y,"testing","endtesting",J==="testing"),Y}var c$=y(()=>{kJ();V1();x8();T0()});function DJ($=16){let X=new Uint8Array($);return crypto.getRandomValues(X),btoa(String.fromCharCode(...X))}function p$($,X){if(!$)return X?.nonceGenerator?.()??DJ();let Z=EJ.get($);if(!Z)Z=X?.nonceGenerator?.()??DJ(),EJ.set($,Z);return Z}function cj($,X){let Z=[];for(let[Y,J]of Object.entries($)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Z.push(Y);continue}if(Array.isArray(J)){let G=[...J];if(X&&(Y==="script-src"||Y==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${X}'`);if(G.length>0)Z.push(`${Y} ${G.join(" ")}`)}}return Z.join("; ")}function yJ($,X){return`<meta http-equiv="Content-Security-Policy" content="${cj($,X).replace(/&/g,"&").replace(/"/g,""")}">`}function bJ($,X,Z){if(!X.enabled||!X.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Y=X.useNonce?p$(Z,X):void 0,J=yJ(X.directives,Y);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
12017
|
-
${J}`)}function
|
|
12015
|
+
</script>`}function TJ($,X,Z){if(NJ=0,!fj($))return $;let Y=yj($);if(Y.length===0)return $;let J=xj($,Y),G=vj(Y,X),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
|
|
12016
|
+
`+J.slice(Q);else J+=G;return J}function xj($,X){let Z=0,Y=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,G,Q)=>{let w=X[Z++];if(!w)return J;let q=/data-stx-scope="([^"]*)"/.exec(Q);if(q)return w.id=q[1],w.selector=`[data-stx-scope="${w.id}"]`,J;return`<${G} data-stx-scope="${w.id}"${Q}>`});return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function fj($){return/x-data\s*=\s*["']/.test($)}var NJ=0,Dj=0;var MJ=y(()=>{W1()});import gj from"fs";import T3 from"path";import{createHighlighter as hj}from"ts-syntax-highlighter";async function uj($,X={}){try{if(!await p($))throw Error(`Markdown file not found: ${$}`);let Y=(await gj.promises.stat($)).mtime.getTime();if(X.cache&&M3.has($)){let z=M3.get($);if(z.updatedAt>=Y)return{content:z.content,data:z.data}}let J=await Bun.file($).text(),{data:G,content:Q}=S2(J),w=X.markdown||N7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=F7(Q,{gfm:!0});if(w.syntaxHighlighting?.enabled&&w.syntaxHighlighting?.serverSide)W=await dj(W,w.syntaxHighlighting?.defaultTheme||"github-dark",w.syntaxHighlighting?.highlightUnknownLanguages||!1);let K={content:W,data:G||{}};if(X.cache)M3.set($,{...K,updatedAt:Y});return K}catch(Z){if(X.debug)console.error(`Error reading/parsing markdown file ${$}:`,Z);let Y=Z instanceof Error?Z.message:String(Z);return{content:z0("Markdown File",`Error reading/parsing markdown file: ${Y}`,$,"",0,""),data:{}}}}async function dj($,X,Z){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!l$)try{l$=await hj({theme:X||"github-dark",cache:!0})}catch(w){return console.error("Failed to initialize ts-syntax-highlighter:",w),$}let J=async(w,q,W,K)=>{let z=K.replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&").replace(/"/g,'"').replace(/'/g,"'"),U=W||(Z?"text":"");if(!U)return w;try{if(!l$.getSupportedLanguages().includes(U))return w;return(await l$.highlight(z,U,{theme:X})).html}catch(B){console.error(`Error highlighting code block with language ${W}:`,B)}return w},G=$,Q=$.matchAll(Y);for(let w of Q){let[q,W,K,z]=w,U=await J(q,W,K,z);G=G.replace(q,U)}return G}async function kJ($,X,Z="",Y={}){return await mj($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,w,q,W)=>{try{let K=w;if(!T3.isAbsolute(w))K=T3.resolve(T3.dirname(Z),w);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(Y.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(Y.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:U,data:B}=await uj(K,Y),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 z0("Markdown File",`Error including markdown file: ${z}`,Z,$,W,Q)}})}async function mj($,X,Z){let Y=[],J;while((J=X.exec($))!==null){let w=J[0],q=J.index,W=J;Y.push(Z(...W).then((K)=>({match:w,replacement:K,index:q})))}let G=await Promise.all(Y);G.sort((w,q)=>q.index-w.index);let Q=$;for(let{match:w,replacement:q}of G)Q=Q.replace(w,()=>q);return Q}var M3,l$=null;var IJ=y(()=>{L1();k0();M3=new Map});function g1($,X){try{let Z=$.trim();if(q0(Z))return W0(Z,Object.keys(X))(...Object.values(X));else return Y0(Z,X)}catch{return!1}}var EJ=y(()=>{T0()});function lj($,X,Z){let Y=$,J=!0;while(J){J=!1;let G=Y.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=_X(Y,Q);if(!w)break;try{let q;if(q0(w.expression))q=W0(w.expression,Object.keys(X))(...Object.values(X));else q=Y0(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=Y0(z.value,X);if(q===U){W=z.content.trim(),K=!0;break}}catch{continue}Y=Y.substring(0,Q)+W+Y.substring(w.end),J=!0}catch(q){let W=q instanceof Error?q.message:String(q),K=Z0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+K+Y.substring(w.end);break}}return Y}function cj($){let X=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return X.push(Y),`\x00stx-script-${X.length-1}\x00`}),scripts:X}}function pj($,X){if(X.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,Y)=>X[Number(Y)]??Z)}function G5($,X,Z){let{masked:Y,scripts:J}=cj($);return pj(ij(Y,X,Z),J)}function ij($,X,Z){let Y=$;Y=lj(Y,X,Z);{let G=!0;while(G){G=!1;let Q=Y.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=P1(Y,w+7);if(!q)break;let W=q.endPos,K=t1(Y,"unless","endunless",W);if(K===-1){console.warn(`[stx] @unless directive at position ${w} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=Y.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`;Y=Y.substring(0,w)+j+Y.substring(K+10),G=!0}}Y=I3(Y,X,Z),Y=E3(Y,X,Z),Y=k3(Y,X);let J=()=>{let G=v7(Y);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let w=G[Q];try{let q="",W=!1;for(let K of w.branches){if(W)break;if(K.type==="else")q=K.content,W=!0;else try{let z;if(K.condition&&q0(K.condition))z=W0(K.condition,Object.keys(X))(...Object.values(X));else if(K.condition)z=Y0(K.condition,X);if(z)q=K.content,W=!0}catch(z){q=Z0(K.type==="if"?"If":"Elseif",`Error in @${K.type}(${K.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),W=!0}}Y=Y.substring(0,w.start)+q+Y.substring(w.end)}catch(q){let W=q instanceof Error?q.message:String(q),K=Z0("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);Y=Y.substring(0,w.start)+K+Y.substring(w.end)}}return!0};while(!0){let G=Y;if(!J())break;if(Y===G)break}return Y}function DJ($){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 Y=[];while(X<$.length){let J=$[X];if(J==="\\"&&X+1<$.length){Y.push($[X+1]),X+=2;continue}if(J===Z){X++;break}Y.push(J),X++}while(X<$.length&&/\s/.test($[X]))X++;if($[X]!==")")return null;return X++,{value:Y.join(""),consumed:X}}function k3($,X){let Z=$;function Y(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 J(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=DJ(U);if(B)K=B.value,z=W+5+B.consumed;else z=W+5;let j=Y(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=J(_,"auth","endauth"),L;if(!X.auth)L=!1;else L=K?g1(`auth?.check && auth?.user?.[${K}]`,X):g1("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=DJ(U);if(B)K=B.value,z=W+6+B.consumed;else z=W+6;let j=Y(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=J(_,"guest","endguest"),L;if(!X.auth)L=!0;else L=K?g1(`!auth?.check || !auth?.user?.[${K}]`,X):g1("!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=g1(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=Y(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=[],M;while((M=V.exec(L))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(L))!==null)T.push({pos:M.index,type:"close"});while((M=R.exec(L))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(L))!==null)T.push({pos:M.index,type:"else"});T.sort((C,P)=>C.pos-P.pos);for(let C of T){if(C.type==="open"){F++;continue}if(C.type==="close"){F--;continue}if(F===0)O.push(C)}let k=[],D=0;for(let C=0;C<O.length;C++){let P=O[C];if(k.push({content:L.slice(D,P.pos),ability:void 0}),P.type==="elseDirective"){let x=L.slice(P.pos+`@${W}`.length),f=Q(x);if(f){k[k.length-1]={content:L.slice(D,P.pos)},D=P.pos+`@${W}`.length+f.paramsEnd,k.push({content:"",ability:f.ability,type:f.type,id:f.id}),k.pop();let l=O[C+1],$0=l?l.pos:L.length;k.push({content:L.slice(D,$0),ability:f.ability,type:f.type,id:f.id}),D=$0}}else D=P.pos+5}if(D<L.length){let C=k[k.length-1];if(O.length>0&&O[O.length-1].type==="else")k.push({content:L.slice(D),isFinalElse:!0});else if(k.length===0)k.push({content:L.slice(D)})}let I=G(j.ability,j.type,j.id),S=w==="can"?I:!I,b="";if(S)b=k[0]?.content||"";else{let C=!1;for(let P=1;P<k.length;P++){let x=k[P];if(x.isFinalElse){b=x.content,C=!0;break}if(x.ability){let f=G(x.ability,x.type,x.id);if(w==="can"?f:!f){b=x.content,C=!0;break}}}if(!C&&k.length>0){let P=k[k.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,U)+b+Z.substring(H+`@${q}`.length),K=!0}}return Z}function I3($,X,Z){let Y=$;function J(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=P1(G,B+`@${Q}`.length);if(!j)break;let _=j.endPos,H=t1(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),M=L.slice(F+5);N=R?T:M}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=Z0(W,`Error processing @${Q} directive: ${N}`,o.EVALUATION_ERROR);G=G.substring(0,B)+T+G.substring(H+`@${w}`.length);break}}return G}return Y=J(Y,"isset","endisset",(G)=>{let Q=g1(G,X);return Q!==void 0&&Q!==null},"Isset"),Y=J(Y,"empty","endempty",(G)=>{let Q=g1(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"),Y}function E3($,X,Z){let Y=$,J="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=J===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,C=S?S.index:1/0;if(b<C)F++,V=b+I[0].length;else if(C<1/0){if(F--,F===0){A=C;break}V=C+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,M=0;while(M<R.length){let I=R.indexOf("@",M);if(I===-1)break;let S=R.substring(I);if(U.test(S)){T++,M=I+1;continue}if(B.test(S)){T--,M=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(S)){N=I;break}M=I+1}let k;if(N!==-1){let I=R.slice(0,N),S=R.slice(N+5);k=W?I:S}else k=W?R:"";let D=`@${q}`.length;j=j.substring(0,L)+k+j.substring(A+D),_=!0}return j}return Y=G(Y,"env","endenv",!1),Y=G(Y,"production","endproduction",J==="production"),Y=G(Y,"development","enddevelopment",J==="development"),Y=G(Y,"staging","endstaging",J==="staging"),Y=G(Y,"testing","endtesting",J==="testing"),Y}var c$=y(()=>{EJ();V1();x8();T0()});function bJ($=16){let X=new Uint8Array($);return crypto.getRandomValues(X),btoa(String.fromCharCode(...X))}function p$($,X){if(!$)return X?.nonceGenerator?.()??bJ();let Z=yJ.get($);if(!Z)Z=X?.nonceGenerator?.()??bJ(),yJ.set($,Z);return Z}function nj($,X){let Z=[];for(let[Y,J]of Object.entries($)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Z.push(Y);continue}if(Array.isArray(J)){let G=[...J];if(X&&(Y==="script-src"||Y==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${X}'`);if(G.length>0)Z.push(`${Y} ${G.join(" ")}`)}}return Z.join("; ")}function SJ($,X){return`<meta http-equiv="Content-Security-Policy" content="${nj($,X).replace(/&/g,"&").replace(/"/g,""")}">`}function CJ($,X,Z){if(!X.enabled||!X.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Y=X.useNonce?p$(Z,X):void 0,J=SJ(X.directives,Y);return $.replace(/<head([^>]*)>/,`<head$1>
|
|
12017
|
+
${J}`)}function PJ($,X){let Z=$;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<script nonce="${X}"${J}>`}),Z=Z.replace(/<style([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<style nonce="${X}"${J}>`}),Z}function vJ($,X,Z,Y){let J=$,G=Y.csp;if(J=J.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?p$(X,G):void 0;return SJ(G.directives,Q)}),J=J.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return p$(X,G)}),G?.enabled&&G.useNonce)X.cspNonce=p$(X,G);return J}var yJ;var xJ=y(()=>{yJ=new WeakMap});import rj from"crypto";function sj($=oj){let X=rj.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return D3=X,X}function aj(){if(!D3)sj();return D3}function tj($=fJ){let X=aj();return`<input type="hidden" name="${$}" value="${X}">`}function gJ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(X,Z,Y)=>{return tj(Y||fJ)})}var oj=40,fJ="_token",D3=null;var hJ=()=>{};async function uJ($,X,Z,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return $;let J=$;for(let G of Y.customDirectives){if(!G.name||typeof G.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)J=await ej(J,G,X,Z,Y);else J=await $B(J,G,X,Z,Y)}return J}async function ej($,X,Z,Y,J){let{name:G,handler:Q}=X,w=`@${G}`,q=`@end${G}`,W=$,K=k5(`${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?dJ(j):[],O=_.trim(),F=await Q(O,L,Z,Y);z.push({original:B,processed:F,startIndex:H})}catch(L){let O=L instanceof Error?L.message:String(L);if(J.debug)console.error(`Error processing custom directive @${G}:`,L);z.push({original:B,processed:Z0("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 $B($,X,Z,Y,J){let{name:G,handler:Q}=X,w=$,q=k5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],K=q.exec(w);while(K!==null){let[B,j=""]=K,_=K.index||0;try{let H=dJ(j),L=await Q("",H,Z,Y);W.push({original:B,processed:L,startIndex:_})}catch(H){let L=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${G}:`,H);W.push({original:B,processed:Z0("CustomDirective",`Error in @${G}(${j}): ${L}`,o.EVALUATION_ERROR),startIndex:_})}K=q.exec(w)}let z=k5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),U=z.exec(w);while(U!==null){let[B]=U,j=U.index||0;try{let _=await Q("",[],Z,Y);W.push({original:B,processed:_,startIndex:j})}catch(_){let H=_ instanceof Error?_.message:String(_);if(J.debug)console.error(`Error processing custom directive @${G}:`,_);W.push({original:B,processed:Z0("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 dJ($){if(!$.trim())return[];let X=[],Z="",Y=!1,J="";for(let G=0;G<$.length;G++){let Q=$[G];if((Q==='"'||Q==="'")&&(G===0||$[G-1]!=="\\"))if(!Y)Y=!0,J=Q;else if(Q===J)Y=!1;else Z+=Q;else if(Q===","&&!Y)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 mJ=y(()=>{V1();I5()});function Q5($,X){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${X} must be a non-empty string`)}function ZB($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let X=$,Z=X.appearance,Y=X.colorMode;if(Q5(X.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(Q5(Z.key,"appearance.key"),Q5(Z.attribute,"appearance.attribute"),Q5(Z.default,"appearance.default"),Q5(Y.key,"colorMode.key"),Q5(Y.attribute,"colorMode.attribute"),Q5(Y.default,"colorMode.default"),!cJ.test(Z.key)||!cJ.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!lJ.test(Z.attribute)||!lJ.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Z.allowed.includes(Z.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!XB.has(Y.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:Y.key,attribute:Y.attribute,default:Y.default}}}function YB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function JB($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${YB($)};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 GB($,X){let Z=1,Y=null,J=!1;for(let G=X+1;G<$.length;G++){let Q=$[G];if(J){J=!1;continue}if(Y){if(Q==="\\")J=!0;else if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function pJ($,X){let Z=$,Y=/@appearanceBootstrap\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,Q=GB(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let w=Z.slice(G+1,Q).trim(),q=Y0(`(${w})`,X),W=JB(ZB(q));Z=Z.slice(0,J.index)+W+Z.slice(Q+1),Y.lastIndex=J.index+W.length}return Z}var lJ,cJ,XB;var iJ=y(()=>{T0();lJ=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,cJ=/^[A-Za-z_$][\w$]*$/,XB=new Set(["light","dark","system"])});import QB from"crypto";function L0($){return String($??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function i$($,X,Z,Y){let J=$||X;return Z?`${J} ${Y}`:J}function r0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function x5($,X){if(/\bid\s*=/i.test($))return"";return` id="${L0(X)}"`}function y3($,X,Z){if(!X)return"";let Y="";if(!/\baria-invalid\s*=/i.test(Z))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))Y+=` aria-describedby="${L0(`${r0($)}-error`)}"`;return Y}function wB(){return QB.randomUUID()}function n$($,X){let Z=$;return Z=Z.replace(/@csrf/g,()=>{if(!X.csrf||typeof X.csrf!=="object"){let Y=wB();X.csrf={token:Y}}if(X.csrf.field)return X.csrf.field;if(X.csrf.token)return`<input type="hidden" name="_token" value="${L0(X.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,J)=>{let G=J.toUpperCase();if(J&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${L0(G)}">`;return Y}),Z}function oJ($,X,Z=rJ){let Y=$;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,G,Q,w,q,W="")=>{let K=G||Q||"POST",z=w||q||"",U=h1(W),B=K.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${L0(j)}" action="${L0(z)}"${U?` ${U}`:""}>`;if(_+=`
|
|
12018
12018
|
${n$("@csrf",X)}`,!["GET","POST"].includes(B))_+=`
|
|
12019
|
-
${n$(`@method('${B}')`,X)}`;return _}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,w,q,W="")=>{let K=G||Q||"",z=w||q||"",U=h1(W),B=i7(K,X),j=B!==void 0&&B!==null?B:z||"",_=U.match(/type=['"]([^'"]+)['"]/i),H=_?_[1]:"text",L=n7(K,X),O=U.match(/class=['"]([^'"]+)['"]/i),F=i$(O?O[1]:"",Z.input,L,Z.inputError),V=U.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${L0(H)}" name="${L0(K)}"${x5(U,r0(K))} value="${L0(j)}" class="${F}"${
|
|
12020
|
-
`),Y=[{obj:X,indent:-1}];for(let J of Z){let G=J.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let w=Y[Y.length-1].obj,q=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,K]=q,z=W.trim(),U=K.trim();if(U==="")w[z]={},Y.push({obj:w[z],indent:Q});else w[z]=
|
|
12019
|
+
${n$(`@method('${B}')`,X)}`;return _}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,w,q,W="")=>{let K=G||Q||"",z=w||q||"",U=h1(W),B=i7(K,X),j=B!==void 0&&B!==null?B:z||"",_=U.match(/type=['"]([^'"]+)['"]/i),H=_?_[1]:"text",L=n7(K,X),O=U.match(/class=['"]([^'"]+)['"]/i),F=i$(O?O[1]:"",Z.input,L,Z.inputError),V=U.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${L0(H)}" name="${L0(K)}"${x5(U,r0(K))} value="${L0(j)}" class="${F}"${y3(K,L,U)}${V?` ${V}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,G,Q="",w="")=>{let q=h1(Q),W=i7(G,X)||w.trim(),K=n7(G,X),z=q.match(/class=['"]([^'"]+)['"]/i),U=i$(z?z[1]:"",Z.input,K,Z.inputError),B=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${L0(G)}"${x5(q,r0(G))} class="${U}"${y3(G,K,q)}${B?` ${B}`:""}>${L0(W)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,G,Q="",w)=>{let q=h1(Q),W=i7(G,X),K=n7(G,X),z=q.match(/class=['"]([^'"]+)['"]/i),U=i$(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="${L0(G)}"${x5(q,r0(G))} class="${U}"${y3(G,K,q)}${B?` ${B}`:""}>${j}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=Q===void 0?"1":Q,W=Q===void 0?r0(G):`${r0(G)}-${r0(q)}`,K=h1(w),z=i7(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="${L0(G)}"${x5(K,W)} value="${L0(q)}" class="${j}"${U?" checked":""}${_?` ${_}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,w="")=>{let q=h1(w),W=i7(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="${L0(G)}"${x5(q,`${r0(G)}-${r0(Q)}`)} value="${L0(Q)}" class="${U}"${K?" checked":""}${B?` ${B}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q="")=>{let w=h1(Q),q=w.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",K=w.includes("multiple"),z=n7(G,X),U=w.match(/class=['"]([^'"]+)['"]/i),B=i$(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="${L0(G)}"${x5(w,r0(G))}`,`class="${B}"`];if(W)_.push(`accept="${L0(W)}"`);if(K)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,G,Q="",w)=>{let q=h1(Q),W=q.match(/class=['"]([^'"]+)['"]/i),K=W?W[1]:Z.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${L0(r0(G))}" class="${K}"${z?` ${z}`:""}>${w}</label>`}),Y}function sJ($,X,Z=rJ){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,J,G)=>{try{if(n7(J,X)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(w,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return nJ(J,X);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof X.errors?.first==="function")return X.errors.first(J);return nJ(J,X)}let W=q.trim();if(q0(W)){let K=Y0(W,X);return K!==void 0?String(K):W}return W}catch{return q}});return`<div id="${L0(`${r0(J)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),Y}})}function n7($,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 nJ($,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 i7($,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 Y=$.slice(0,-2);if(Z=X[Y],Z!==void 0)return Z}return X[$]}function h1($){if(!$.trim())return"";let X=[],Z=$.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=Y.exec(Z))!==null){let[,G,,Q]=J;X.push(`${G}="${Q.trim()}"`)}return X.join(" ")}var rJ;var aJ=y(()=>{T0();rJ={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import C3 from"path";async function qB(){if(r7!==void 0)return r7;try{r7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{r7=null}return r7}function WB($,X=0){if(X<=0)return!1;return Date.now()-$.loadedAt>X}async function KB($,X){if({...x3,...X.i18n}.cache&&P3[$]){let J=P3[$],G=X.i18n?.cacheMaxAge??0;if(!WB(J,G))return J.translations}if(o7[$]?.state==="loading")return o7[$].promise;b3[$]="loading";let Y=v3($,X).then((J)=>{return b3[$]="loaded",delete o7[$],J}).catch((J)=>{throw b3[$]="error",o7[$]={promise:Y,state:"error",error:J instanceof Error?J:Error(String(J))},J});return o7[$]={promise:Y,state:"loading"},Y}async function v3($,X){let Z={...x3,...X.i18n},Y=C3.isAbsolute(Z.translationsDir)?Z.translationsDir:C3.resolve(X.root||process.cwd(),Z.translationsDir);try{let J=await qB(),G=J?await J($,{translationsDir:Y,defaultLocale:Z.defaultLocale,sources:_B(Z.format)}):await zB($,Z,Y);if(G===void 0){if($!==Z.defaultLocale)return v3(Z.defaultLocale,X);return{}}let Q=G;if(Z.cache)P3[$]={translations:Q,loadedAt:Date.now(),locale:$};return Q}catch(J){if(X.debug)console.error(`Error loading translation file for locale "${$}":`,J);if($!==Z.defaultLocale)return v3(Z.defaultLocale,X);return{}}}async function zB($,X,Z){let Y=C3.join(Z,`${$}${UB(X.format)}`);try{let J=await import(Y);return J.default||J}catch(J){try{let G=await Bun.file(Y).text();if(X.format==="yaml"||X.format==="yml")return jB(G);if(X.format==="json")return JSON.parse(G);throw J}catch{return}}}function UB($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function jB($){let X={},Z=$.split(`
|
|
12020
|
+
`),Y=[{obj:X,indent:-1}];for(let J of Z){let G=J.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let w=Y[Y.length-1].obj,q=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,K]=q,z=W.trim(),U=K.trim();if(U==="")w[z]={},Y.push({obj:w[z],indent:Q});else w[z]=BB(U)}}return X}function BB($){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 _B($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function HB($,X){return KB($,X)}function OB($,X){for(let Z of $){let Y=Z.trim(),J=Y.match(/^\{(\d+)\}\s*(.*)$/);if(J){let Q=Number.parseInt(J[1],10);if(X===Q)return J[2];continue}let G=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10),w=G[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(G[2],10);if(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 LB($,X={}){return $G($,X)}function $G($,X){let Z="",Y=0;while(Y<$.length)if($[Y]==="{"){let J=FB($,Y);if(J===-1){Z+=$[Y],Y++;continue}let G=$.slice(Y+1,J);Z+=VB(G,X),Y=J+1}else if($[Y]==="'"&&Y+1<$.length)if($[Y+1]==="'")Z+="'",Y+=2;else if($[Y+1]==="{"||$[Y+1]==="}")Z+=$[Y+1],Y+=2;else Z+=$[Y],Y++;else Z+=$[Y],Y++;return Z}function FB($,X){let Z=0;for(let Y=X;Y<$.length;Y++)if($[Y]==="{")Z++;else if($[Y]==="}"){if(Z--,Z===0)return Y}return-1}function VB($,X){let Z=AB($);if(Z.length===0)return`{${$}}`;let Y=Z[0].trim(),J=X[Y];if(Z.length===1)return J!==void 0?String(J):`{${Y}}`;switch(Z[1].trim().toLowerCase()){case"plural":return RB(J,Z.slice(2).join(","),X);case"select":return TB(J,Z.slice(2).join(","));case"selectordinal":return MB(J,Z.slice(2).join(","));case"number":return IB(J,Z[2]?.trim());case"date":return EB(J,Z[2]?.trim());case"time":return DB(J,Z[2]?.trim());default:return J!==void 0?String(J):`{${$}}`}}function AB($){let X=[],Z="",Y=0;for(let J=0;J<$.length;J++){let G=$[J];if(G==="{")Y++,Z+=G;else if(G==="}")Y--,Z+=G;else if(G===","&&Y===0)X.push(Z),Z="";else Z+=G}if(Z)X.push(Z);return X}function RB($,X,Z){let Y=Number($)||0,J=f3(X),G=`=${Y}`;if(J[G])return S3(J[G],Y,Z);let Q=NB(Y);if(J[Q])return S3(J[Q],Y,Z);if(J.other)return S3(J.other,Y,Z);return String(Y)}function S3($,X,Z){let Y=$.replace(/#/g,String(X));return $G(Y,Z)}function NB($){let X=Math.abs($),Z=Math.floor(X),Y=String($).includes(".")?String($).split(".")[1].length:0;if(Z===1&&Y===0)return"one";return"other"}function TB($,X){let Z=String($||""),Y=f3(X);if(Y[Z])return Y[Z];return Y.other||String($)}function MB($,X){let Z=Number($)||0,Y=f3(X),J=kB(Z);if(Y[J])return Y[J].replace(/#/g,String(Z));if(Y.other)return Y.other.replace(/#/g,String(Z));return String(Z)}function kB($){let X=Math.abs($),Z=X%10,Y=X%100;if(Z===1&&Y!==11)return"one";if(Z===2&&Y!==12)return"two";if(Z===3&&Y!==13)return"few";return"other"}function f3($){let X={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=Z.exec($);while(Y!==null)X[Y[1]]=Y[2],Y=Z.exec($);return X}function IB($,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 EB($,X){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let Y={};switch(X){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return Z.toLocaleDateString(void 0,Y)}function DB($,X){let Z=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Z.getTime()))return String($);let Y={};switch(X){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return Z.toLocaleTimeString(void 0,Y)}function yB($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function tJ($,X,Z=!0,Y={}){let J=$.split("."),G=X;for(let w of J){if(G===void 0||G===null)break;G=G[w]}if(G===void 0||G===null)return Z?$:"";let Q=String(G);if(yB(Q))return LB(Q,Y);if(Q.includes("|")&&"count"in Y){let w=Number(Y.count),q=Q.split("|");Q=OB(q,w)}for(let[w,q]of Object.entries(Y)){let W=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${W}`,"g"),String(q))}return Q}async function XG($,X,Z,Y){let J=$,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...x3,...Y.i18n},w=await HB(Q.locale,Y);X.__translations=w,X.__locale=Q.locale,X.__i18nConfig=Q,J=await eJ(J,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 N0(U,X)}];for(let O of L)try{if(_=O(),Object.keys(_).length>0)break}catch{}}catch(L){if(Y.debug)console.error("Error parsing parameters for @translate directive:",L)}return tJ(z,w,Q.fallbackToKey,_)||B.trim()}catch(_){if(Y.debug)console.error("Error processing @translate directive:",_);return Z0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let K=[...J.matchAll(q)];console.warn(`Found ${K.length} @translate matches`),K.forEach((z,U)=>console.warn(`Match ${U}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return J=await eJ(J,/@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 N0(U,X)}];for(let H of _)try{if(j=H(),Object.keys(j).length>0)break}catch{}}catch(_){if(Y.debug)console.error("Error parsing parameters for @translate directive:",_)}return tJ(z,w,Q.fallbackToKey,j)}catch(j){if(Y.debug)console.error("Error processing @translate directive:",j);return Z0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),J}async function eJ($,X,Z){let Y=[];return $.replace(X,(G,...Q)=>{let w=Z(G,...Q).then((q)=>({match:G,replacement:q}));return Y.push(w),G}),(await Promise.all(Y)).reduce((G,{match:Q,replacement:w})=>G.replace(Q,w),$)}var r7,x3,P3,o7,b3;var ZG=y(()=>{V1();T0();x3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},P3={},o7={},b3={}});var u3={};a(u3,{streamingSuspenseDirective:()=>GG,streamToResponse:()=>mB,streamTemplateSimple:()=>gB,streamTemplate:()=>SB,renderStreamingPage:()=>PB,registerStreamingDirectives:()=>uB,processStreamDirectives:()=>xB,processSectionDirectives:()=>dB,islandDirective:()=>QG,generateHydrationRuntime:()=>lB,extractStreamBoundaries:()=>fB,createStreamRenderer:()=>hB,buildSuspenseResolveScript:()=>h3,SUSPENSE_RESOLVER_RUNTIME:()=>JG});import r$ from"path";function bB($){let X=[],Z=0,Y;YG.lastIndex=0;while((Y=YG.exec($))!==null){if(Y.index>Z){let Q=$.slice(Z,Y.index);if(Q.trim())X.push({type:X.length===0?"shell":"content",content:Q})}let J=Y[1],G=Y[2];X.push({type:"suspense",name:J,content:G}),Z=Y.index+Y[0].length}if(Z<$.length){let J=$.slice(Z);if(J.trim())X.push({type:X.length===0?"shell":"content",content:J})}if(X.length===0)X.push({type:"shell",content:$});return X}async function SB($,X={},Z={}){let Y={...J5,...Z,streaming:{...g3,...Z.streaming}},J=Y.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:r$.dirname($)};if(q.trim())await a1(q,K,$);let z=bB(W),U=new Set;if(!z.some((j)=>j.type==="suspense")){let j=Y.streaming?.strategy||"auto",_=new RegExp(w5.source,"g");if(!(j!=="manual"&&_.test(W))){let L=await O0(W,K,$,Y,U);for(let O=0;O<L.length;O+=J)G.enqueue(L.slice(O,O+J)),await new Promise((F)=>setTimeout(F,0))}else{let L=[],O=new RegExp(w5.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 O0(N,K,$,Y,U);G.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let R=await O0(A.content,K,$,Y,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 O0(A,K,$,Y,U);G.enqueue(R)}}}}else{let j=new Map;for(let H of z)if(H.type==="shell"||H.type==="content"){let L=await O0(H.content,K,$,Y,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;">
|
|
12021
12021
|
<template data-suspense-fallback>Loading...</template>
|
|
12022
12022
|
</div>`),j.set(H.name,O0(H.content,K,$,Y,U))}G.enqueue(`
|
|
12023
12023
|
<script>
|
|
@@ -12035,13 +12035,13 @@ ${J}`)}function SJ($,X){let Z=$;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*
|
|
|
12035
12035
|
}
|
|
12036
12036
|
};
|
|
12037
12037
|
})();
|
|
12038
|
-
</script>`);let _=Array.from(j.entries()).map(async([H,L])=>{G.enqueue(await
|
|
12038
|
+
</script>`);let _=Array.from(j.entries()).map(async([H,L])=>{G.enqueue(await h3(H,L))});await Promise.all(_)}G.close()}catch(Q){G.error(Q)}}})}async function h3($,X){try{let Y=(await X).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
|
|
12039
12039
|
<script>
|
|
12040
12040
|
window.__stxSuspense.resolve('${$}', \`${Y}\`);
|
|
12041
12041
|
</script>`}catch(Z){let Y=Z instanceof Error?Z.message:String(Z);return`
|
|
12042
12042
|
<script>
|
|
12043
12043
|
window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${t0(Y)}</div>');
|
|
12044
|
-
</script>`}}function
|
|
12044
|
+
</script>`}}function CB($,X,Z){if(!X||X<=0)return $;let Y,J=new Promise((G,Q)=>{Y=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${X}ms`)),X)});return Promise.race([$,J]).finally(()=>clearTimeout(Y))}function PB($,X=[],Z={}){let Y=Z.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue($),X.length>0)J.enqueue(JG),await Promise.all(X.map(async(G)=>{let Q=CB(G.render(),Y,G.id);J.enqueue(await h3(G.id,Q))}));J.close()}catch(G){J.error(G)}}})}function xB($,X){return $.replace(vB,(Z,Y,J)=>{let G=Y.trim(),Q=J.split(/@fallback/i),w=Q[0].trim(),q=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!X.__streamTemplates)X.__streamTemplates={};return X.__streamTemplates[G]=w,`<div data-suspense="${G}">${q}</div>`})}function fB($){let X=$?.streamBoundaries;if(!X||typeof X!=="object")return;let Z=Object.entries(X).filter(([,Y])=>typeof Y==="function");return Z.length>0?Z.map(([Y,J])=>({id:Y,render:J})):void 0}async function gB($,X={},Z={}){let Y={...J5,...Z,streaming:{...g3,...Z.streaming}},J=Y.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:r$.dirname($)};if(q.trim())await a1(q,K,$);let z=new Set,U=Y.streaming?.strategy||"auto",B=new RegExp(w5.source,"g");if(!(U!=="manual"&&B.test(W))){let _=await O0(W,K,$,Y,z);for(let H=0;H<_.length;H+=J)G.enqueue(_.slice(H,H+J))}else{let _=[],H=new RegExp(w5.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 O0(A,K,$,Y,z);G.enqueue(R)}}let V=await O0(F.content,K,$,Y,z);G.enqueue(V),O=F.end}if(O<W.length){let F=W.slice(O);if(F.trim()){let V=await O0(F,K,$,Y,z);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function hB($,X={}){let Z={...J5,...X,streaming:{...g3,...X.streaming}},Y=await Bun.file($).text(),J=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=J?J[1]:"",Q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),w=Q,q={},W;w5.lastIndex=0;while((W=w5.exec(Q))!==null){let U=W[1],B=W[2];q[U]=B}let K=Q.replace(w5,"");return{renderShell:async(U={})=>{let B={...U,__filename:$,__dirname:r$.dirname($)};return await a1(G,B,$),O0(K,B,$,Z,new Set)},renderSection:async(U,B={})=>{try{if(!q[U])return`<div class="error-message">Section "${t0(U)}" not found in template "${t0($)}"</div>`;let j={...B,__filename:$,__dirname:r$.dirname($)};await a1(G,j,$);let _=new Set;return await O0(q[U],j,$,Z,_)}catch(j){let _=j instanceof Error?j.message:String(j);return z0("Expression",_,$,q[U]||"",0,q[U]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return w}}}function uB($={}){let X=[];if($.streaming?.enabled)X.push(GG);if($.hydration?.enabled)X.push(QG);return X}async function dB($,X,Z,Y={}){return $}function mB($,X={}){let Z=new TextEncoder,Y=$.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),J=new Headers(X.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(Y,{...X,headers:J})}function lB($={mode:"full"}){let{mode:X,components:Z={},dynamicImports:Y=!0}=$,J=Object.entries(Z).map(([G,Q])=>`'${G}': ${Y?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
|
|
12045
12045
|
`);if(X==="loader")return`
|
|
12046
12046
|
(function() {
|
|
12047
12047
|
window.__stx = window.__stx || {};
|
|
@@ -12183,7 +12183,7 @@ else {
|
|
|
12183
12183
|
else {
|
|
12184
12184
|
stx.hydrate();
|
|
12185
12185
|
}
|
|
12186
|
-
})();`}var
|
|
12186
|
+
})();`}var g3,w5,YG,JG=`
|
|
12187
12187
|
<script>
|
|
12188
12188
|
(function(){
|
|
12189
12189
|
window.__stxSuspense = window.__stxSuspense || {
|
|
@@ -12203,25 +12203,25 @@ else {
|
|
|
12203
12203
|
}
|
|
12204
12204
|
};
|
|
12205
12205
|
})();
|
|
12206
|
-
</script>`,
|
|
12206
|
+
</script>`,vB,GG,QG;var d3=y(()=>{L1();W1();J$();k0();g3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},w5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,YG=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;vB=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;GG={name:"suspense",hasEndTag:!0,handler:($,X,Z,Y)=>{if(!X||X.length===0)throw Error("Suspense directive requires a name parameter");let J=X[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${$}<!-- @endsuspense:${J} -->`}},QG={name:"island",hasEndTag:!0,handler:($,X,Z,Y)=>{if(!X||X.length===0)throw Error("Island directive requires a name parameter");let J=X[0].replace(/['"`]/g,""),G=X[1]?X[1].replace(/['"`]/g,""):"lazy",Q=`island-${J}-${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="${J}" data-island-id="${Q}" data-priority="${G}">
|
|
12207
12207
|
${W}
|
|
12208
12208
|
<script type="application/json" data-island-props="${Q}">
|
|
12209
12209
|
${q?`{${q}}`:"{}"}
|
|
12210
12210
|
</script>
|
|
12211
|
-
</div>`}}});var
|
|
12212
|
-
`).length;Z.set(q,{count:1,firstLine:z})}}}let Q=[];for(let w of new Set([...Z.keys(),...Y.keys()])){if(
|
|
12213
|
-
`}if(F){let b=[];if(K==="avif"||K==="auto"){let C=a7(Y,V,A,B,"avif"),P=R?
|
|
12211
|
+
</div>`}}});var WG={};a(WG,{warnUnbalancedTags:()=>m3,findUnbalancedTags:()=>qG});function f5($){return $.replace(/[^\n]/g," ")}function qG($){let X=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,f5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,f5).replace(/<!--[\s\S]*?-->/g,f5).replace(/\{\{\{[\s\S]*?\}\}\}/g,f5).replace(/\{\{[\s\S]*?\}\}/g,f5).replace(/\{!![\s\S]*?!!\}/g,f5),Z=new Map,Y=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=J.exec(X))!==null){let w=G[1]==="/",q=G[2],W=G[3]==="/";if(cB.has(q.toLowerCase()))continue;if(W)continue;if(w)Y.set(q,(Y.get(q)??0)+1);else{let K=Z.get(q);if(K)K.count++;else{let z=X.slice(0,G.index).split(`
|
|
12212
|
+
`).length;Z.set(q,{count:1,firstLine:z})}}}let Q=[];for(let w of new Set([...Z.keys(),...Y.keys()])){if(pB.has(w.toLowerCase()))continue;let q=Z.get(w)?.count??0,W=Y.get(w)??0;if(q!==W)Q.push({tag:w,opened:q,closed:W,firstOpenLine:Z.get(w)?.firstLine??0})}return Q}function m3($,X){let Z;try{Z=qG($)}catch{return}if(Z.length===0)return;let Y=`${X}:${$.length}`;if(wG.has(Y))return;wG.add(Y);let J=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] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 an unclosed <${G}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${w} closed \u2014 ${w-Q} stray </${G}>.`)}var cB,pB,wG;var l3=y(()=>{cB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),pB=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);wG=new Set});import o0 from"path";import c3 from"fs";function KG($){return $.split("-").map((X)=>X.charAt(0).toUpperCase()+X.slice(1)).join("")}function zG($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class UG{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,Y){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=Y?.__importedComponents;if(G){let B=[J,J.toLowerCase(),KG(J),zG(J)];for(let j of B)if(G.has(j))return G.get(j)}let Q=[...new Set([`${J}.stx`,`${KG(J)}.stx`,`${zG(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let B=o0.resolve(o0.dirname(X),`${J}.stx`);if(await p(B))return B;return null}let w=[],q=Z.componentsDir||"",W=Y?.__originalFilePath;if(W)w.push(o0.join(o0.dirname(W),"components"));if(q)w.push(q);let K=o0.join(o0.dirname(X),"components");if(!w.includes(K))w.push(K);let z=process.cwd(),U=[o0.resolve(z,"src/components"),o0.resolve(z,"components"),o0.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 _=o0.join(B,j);if(await p(_))return _}try{if(!c3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let _=c3.readdirSync(B,{withFileTypes:!0});for(let H of _)if(H.isDirectory()){let L=o0.join(B,H.name);for(let O of Q){let F=o0.join(L,O);if(await p(F))return F}}}catch{}}return null}}var d0;var p3=y(()=>{k0();d0=new UG});function y0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/'/g,"'").replace(/</g,"<").replace(/>/g,">")}function jG($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var q5="\x00stx-boolean-attribute";function g5($,X){let Z=[];for(let[Y,J]of Object.entries($.static)){if(X.has(Y))continue;let G=$.staticNames?.[Y]??Y;if(typeof J==="boolean"){if(J)Z.push(y0(G));continue}if(J===q5){Z.push(y0(G));continue}Z.push(`${y0(G)}="${y0(jG(String(J)))}"`)}return Z}var o$=()=>{};function s7($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function iB($){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 i3;var n3=y(()=>{o$();i3={name:"StxLink",aliases:["stx-link"],render($,X,Z){let Y=iB($),J=(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(Y.reactive)q.push(`:href="${s7(Y.value)}"`);else q.push(`href="${s7(Y.value)}"`);if(J)q.push(`class="${s7(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${s7(G)}"`),q.push(`data-stx-exact-active-class="${s7(Q)}"`),w)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...g5($,W)),`<a ${q.join(" ")}>${X}</a>`}}});function b0($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function x0($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function o3($,X,Z=!1){let Y=$.serverDynamic[X];if(Y!==void 0)return Y!==!1&&Y!=="false";let J=$.static[X];if(J!==void 0)return J!=="false"&&J!==!1;return Z}function BG($){if($.includes("(")||$.includes(","))return $;let X=$.trim().split(/\s+/),Z=[];for(let Y of X)if(Y.includes(":")){let[J,G]=Y.split(":"),Q=nB[J];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let w=Number.parseInt(J);if(!Number.isNaN(w))Z.push(`(max-width: ${w}px) ${G}`)}}else Z.push(Y);return Z.join(", ")}function s3($,X,Z,Y){return X.map((J)=>`${a7($,J,void 0,Z,Y)} ${J}w`).join(", ")}function rB($,X,Z,Y,J){return X.map((G)=>{let Q=Z?Z*G:void 0;return`${a7($,Q,void 0,Y,J)} ${G}x`}).join(", ")}function a7($,X,Z,Y,J){if(!Y||Y==="local"||Y==="static")return $;if(Y==="cloudinary"){let G=[];if(X)G.push(`w_${X}`);if(Z)G.push(`h_${Z}`);if(J)G.push(`f_${J}`);G.push("q_auto");let Q=G.join(",");return $.replace("/upload/",`/upload/${Q}/`)}if(Y==="imgix"){let G=new URLSearchParams;if(X)G.set("w",String(X));if(Z)G.set("h",String(Z));if(J)G.set("fm",J);G.set("auto","format");let Q=$.includes("?")?"&":"?";return`${$}${Q}${G.toString()}`}if(Y==="bunny"){let G=new URLSearchParams;if(X)G.set("width",String(X));if(Z)G.set("height",String(Z));if(J)G.set("format",J);let Q=$.includes("?")?"&":"?";return`${$}${Q}${G.toString()}`}return $}function oB($,X,Z="#e5e7eb"){let Y=`<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(Y)}`}var nB,r3,a3;var t3=y(()=>{o$();nB={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},r3=[320,640,768,1024,1280,1536,1920];a3={name:"StxImage",aliases:["stx-image","stx-img"],render($,X,Z){let Y=x0($,"src")||"",J=x0($,"alt")||"",G=x0($,"width"),Q=x0($,"height"),w=x0($,"sizes"),q=x0($,"srcset"),W=x0($,"densities"),K=x0($,"format"),z=x0($,"placeholder"),U=x0($,"placeholderColor")||"#e5e7eb",B=x0($,"provider"),j=x0($,"class")||x0($,"className")||"",_=x0($,"style")||"",H=x0($,"quality"),L=o3($,"lazy",!0),O=o3($,"preload",!1),F=o3($,"picture",!1)||!!K,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=q||"",N="";if(!R&&w)R=s3(Y,r3,B,K),N=BG(w);else if(!R&&W){let b=W.split(/\s+/).map((C)=>Number.parseFloat(C.replace("x","")));R=rB(Y,b,V,B,K)}else if(w)N=BG(w);let T=[];if(_)T.push(_);if(V&&A)T.push(`aspect-ratio:${V}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let b=oB(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(${b0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=a7(Y,V,A,B,K),k=[];if(k.push(`src="${b0(M)}"`),k.push(`alt="${b0(J)}"`),G)k.push(`width="${b0(G)}"`);if(Q)k.push(`height="${b0(Q)}"`);if(L)k.push('loading="lazy"');if(k.push('decoding="async"'),j)k.push(`class="${b0(j)}"`);if(T.length>0)k.push(`style="${b0(T.join(";"))}"`);if(R)k.push(`srcset="${b0(R)}"`);if(N)k.push(`sizes="${b0(N)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);k.push(...g5($,D));let I=`<img ${k.join(" ")} />`,S="";if(O){let C=K==="webp"?"image/webp":K==="avif"?"image/avif":"";S=`<link rel="preload" as="image" href="${b0(M)}"${C?` type="${C}"`:""}${R?` imagesrcset="${b0(R)}"`:""}${N?` imagesizes="${b0(N)}"`:""} />
|
|
12213
|
+
`}if(F){let b=[];if(K==="avif"||K==="auto"){let C=a7(Y,V,A,B,"avif"),P=R?s3(Y,r3,B,"avif"):`${C}`;b.push(`<source type="image/avif" srcset="${b0(P)}"${N?` sizes="${b0(N)}"`:""} />`)}if(K==="webp"||K==="auto"){let C=a7(Y,V,A,B,"webp"),P=R?s3(Y,r3,B,"webp"):`${C}`;b.push(`<source type="image/webp" srcset="${b0(P)}"${N?` sizes="${b0(N)}"`:""} />`)}return`${S}<picture>
|
|
12214
12214
|
${b.join(`
|
|
12215
12215
|
`)}
|
|
12216
12216
|
${I}
|
|
12217
|
-
</picture>`}return`${S}${I}`}}});function t7($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function h5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var
|
|
12217
|
+
</picture>`}return`${S}${I}`}}});function t7($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function h5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var _G="/images/safe-image-default.svg",sB,e3;var $4=y(()=>{o$();sB=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${_G}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,e3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,X,Z){let Y=h5($,"src")||"",J=h5($,"alt")||"",G=h5($,"fallback")||_G,Q=h5($,"class")||h5($,"className")||"",w=h5($,"fallbackClassName")||"",q=[];if(q.push(`src="${t7(Y)}"`),q.push(`alt="${t7(J)}"`),Q)q.push(`class="${t7(Q)}"`);if(q.push(`data-fallback="${t7(G)}"`),w)q.push(`data-fallback-class="${t7(w)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...g5($,W));let K=`<img ${q.join(" ")} />`,z=Z.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${sB}${K}`;return K}}});function X4($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function e7($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}function s$($,X,Z){let Y=e7($,X);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var Z4;var Y4=y(()=>{Z4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,X,Z){let Y=X4(e7($,"color")||"#6366f1"),J=X4(e7($,"initialColor")||e7($,"initial-color")||""),G=X4(e7($,"height")||"3px"),Q=s$($,"duration",2000),w=s$($,"throttle",200),q=s$($,"zIndex",999999)||s$($,"z-index",999999),W=J?`linear-gradient(to right, ${J}, ${Y})`:Y;return`
|
|
12218
12218
|
<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">
|
|
12219
12219
|
<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>
|
|
12220
12220
|
</div>
|
|
12221
12221
|
<style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
|
|
12222
12222
|
<script>
|
|
12223
12223
|
(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()})})();
|
|
12224
|
-
</script>`}}});function
|
|
12224
|
+
</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 aB($,X,Z){let Y=OG($,X);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var HG,J4;var G4=y(()=>{HG={"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%)"},J4={name:"StxToast",aliases:["stx-toast"],render($,X,Z){let Y=y0(OG($,"position")||"top-right"),J=aB($,"max",5),G=HG[Y]||HG["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${J}" style="position:fixed;${G};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
|
|
12225
12225
|
<style>
|
|
12226
12226
|
@keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
|
|
12227
12227
|
@keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
|
|
@@ -12229,7 +12229,7 @@ ${I}
|
|
|
12229
12229
|
@keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
|
|
12230
12230
|
@keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
|
|
12231
12231
|
@keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
|
|
12232
|
-
</style>`}}});function a$($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var
|
|
12232
|
+
</style>`}}});function a$($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var LG,Q4;var w4=y(()=>{LG={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)"},Q4={name:"StxModal",aliases:["stx-modal"],render($,X,Z){let Y=a$($,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=y0(Y),G=a$($,"size")||"md",Q=a$($,"closeOnBackdrop")!=="false",w=a$($,"closeOnEscape")!=="false",q=LG[G]||LG.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${Q}" data-close-escape="${w}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
|
|
12233
12233
|
<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)">
|
|
12234
12234
|
<div style="padding:1.5rem">${X}</div>
|
|
12235
12235
|
</div>
|
|
@@ -12238,7 +12238,7 @@ ${I}
|
|
|
12238
12238
|
@media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
|
|
12239
12239
|
.stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
|
|
12240
12240
|
.stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
|
|
12241
|
-
</style>`}}});function u5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var
|
|
12241
|
+
</style>`}}});function u5($,X){if($.serverDynamic[X]!==void 0)return String($.serverDynamic[X]);let Z=$.static[X];if(typeof Z==="string")return Z;return}var FG,q4;var W4=y(()=>{FG={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},q4={name:"StxDrawer",aliases:["stx-drawer"],render($,X,Z){let Y=u5($,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=y0(Y),G=u5($,"side")||"right",Q=u5($,"size")||"md",w=u5($,"closeOnBackdrop")!=="false",q=u5($,"closeOnEscape")!=="false",W=u5($,"overlay")!=="false",K=FG[Q]||FG.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-${J}" class="stx-drawer-backdrop" data-stx-drawer="${J}" data-close-backdrop="${w}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
|
|
12242
12242
|
<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">
|
|
12243
12243
|
<div style="padding:1.5rem">${X}</div>
|
|
12244
12244
|
</div>
|
|
@@ -12247,18 +12247,18 @@ ${I}
|
|
|
12247
12247
|
@media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
|
|
12248
12248
|
.stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
|
|
12249
12249
|
.stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
|
|
12250
|
-
</style>`}}});import{existsSync as
|
|
12251
|
-
`||T==="\t")L++;O=R+_.length}else{if(L--,L===0){F=N;break}O=N+H.length}}if(F===-1){J=U;continue}let V=$.slice(U,F),A=F+H.length;Y.push({fullMatch:$.slice(G,A),tagName:q,attributes:j,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function TG($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function MG($,X){try{let Z=Buffer.from($,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Z)}catch(Z){if(X?.debug)console.error("Error decoding __stx_ prop:",Z);return $}}var kG=y(()=>{T0();k0();r1()});var CG={};a(CG,{processESImports:()=>bG,processComponents:()=>Z9});import X9 from"fs";import n0 from"path";function X_($,X,Z){let Y={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(v2),G=(w)=>{if(!w.includes("-")||w.startsWith("@")||w.startsWith(":")||w.startsWith("x-")||w.startsWith("__"))return w;if(w.startsWith("aria-")||w.startsWith("data-"))return w;return w.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},Q=(w,q)=>{let W=G(w);if(Y.static[W]=q,W!==w)Y.staticNames[W]=w};for(let[w,q]of Object.entries($)){let W=w.startsWith("x-")&&!J.has(w)&&!w.startsWith("x-bind:")&&!w.startsWith("x-on:")?`:${w.slice(2)}`:w;if(W.startsWith("@")){Y.events[W]=q;continue}if(W.startsWith("__stx_")){let K=G(W.slice(6));Y.serverDynamic[K]=MG(q,Z);continue}if(W.startsWith(":")){let K=G(W.slice(1)),z=q===q5?K:q;if(K==="if"||K==="for"||K==="show"){Y.clientReactive[K]=z;continue}try{if(!q0(z)){if(Z.debug)console.error(`Unsafe expression in :${K} binding: ${z}`);Y.clientReactive[K]=z;continue}let U=Object.keys(X),j=W0(z,U)(...Object.values(X));if(j===void 0){let _=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((O)=>!H.has(O)&&!U.includes(O))){Y.clientReactive[K]=z;continue}}Y.serverDynamic[K]=j}catch{Y.clientReactive[K]=z}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let K=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(K)try{let z=K[1];if(q0(z)){let B=W0(z,Object.keys(X))(...Object.values(X));Q(W,B!=null?String(B):"")}else{if(Z.debug)console.error(`Unsafe expression in ${W}: ${z}`);Q(W,q)}}catch(z){if(Z.debug)console.error(`Error evaluating expression for ${W}:`,z);Q(W,q)}else{let z=q,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=U.exec(q))!==null)try{let j=B[1];if(!q0(j)){if(Z.debug)console.error(`Unsafe expression in ${W}: ${j}`);continue}let H=W0(j,Object.keys(X))(...Object.values(X));z=z.replace(B[0],String(H??""))}catch(j){if(Z.debug)console.error(`Error evaluating expression in ${W}:`,j)}Q(W,z)}continue}Q(W,q===q5?"true":TG(q))}return Y}function Z_($){let X={},Z=0,Y=$.length;while(Z<Y){while(Z<Y&&/\s/.test($[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test($[Z]))J+=$[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test($[Z]))Z++;if(Z<Y&&$[Z]==="="){Z++;while(Z<Y&&/\s/.test($[Z]))Z++;let G="";if(Z<Y&&($[Z]==='"'||$[Z]==="'")){let Q=$[Z];Z++;while(Z<Y){let w=$[Z];if(w==="\\"&&Z+1<Y){Z++,G+=$[Z],Z++;continue}if(w===Q){Z++;break}G+=w,Z++}}else while(Z<Y&&!/\s/.test($[Z]))G+=$[Z],Z++;X[J]=G}else X[J]=q5}return X}function EG($){return Object.entries($).map(([X,Z])=>Z===q5?X:`${X}="${Y_(Z)}"`).join(" ")}function Y_($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function J_($){let X=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(d0.isBuiltin(J))X.add(J)}return[...X].sort()}function G_($){let X=DG.get($);if(X)return X;let Z=new Map,Y=[n0.join($,"src"),n0.join($,"dist"),$];function J(G,Q){if(Q>6)return;let w;try{w=X9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of w){let W=n0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(W,Q+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let K=q.name.slice(0,-4);if(!Z.has(K))Z.set(K,W);let 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 Y)if(J(G,0),Z.size>0)break;return DG.set($,Z),Z}function Q_($,X){if($.startsWith(".")||$.startsWith("/"))return null;let Z=X;while(!0){let Y=n0.join(Z,"node_modules",$);try{if(X9.statSync(Y).isDirectory())return Y}catch{}let J=n0.dirname(Z);if(J===Z)return null;Z=J}}async function bG($,X,Z,Y,J){if(!$.includes("import"))return $;if(!X.__importedComponents)X.__importedComponents=new Map;let G=X.__importedComponents,Q=n0.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=n0.resolve(Q,F);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(X9.statSync(M).isFile())A=M}catch{try{if(X9.statSync(T).isDirectory())V=T}catch{}}}}else V=Q_(F,Q);if(!V&&!A)continue;let R=!1,N=(T,M)=>{G.set(T,M),G.set(T.toLowerCase(),M);let k=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(k,M),J.add(M)};if(O&&A)N(O,A),R=!0;else if(L){let T=L.slice(1,-1).split(",").map((k)=>k.trim()).filter(Boolean).map((k)=>{let D=k.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:k,local:k}}),M=V?G_(V):null;for(let{source:k,local:D}of T){let I=null;if(A)I=A;else if(M)I=M.get(k)??M.get(k.toLowerCase())??M.get(k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(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 w_($,X,Z,Y,J){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=[n0.resolve(n0.dirname(Z),`${U}.stx`),n0.resolve(n0.dirname(Z),U),n0.resolve(Y.componentsDir||"components",`${U}.stx`),n0.resolve(Y.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),J.add(L),Y.debug)console.log(`Imported component: ${H} -> ${L}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${U}`)}G=G.replace(W,""),w.lastIndex=0}return G}async function q_($,X,Z,Y,J){let G=$,Q=Y.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=N0(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=_,M=G.substring(_).match(/^([\s\S]*?)@endcomponent/);if(M)R=M[1].trim(),N=_+M[0].length;let k=await $5(L,A,R,Q,X,Z,Y,w,J);G=G.substring(0,K)+k+G.substring(N),q.lastIndex=0}return G}async function W_($,X,Z,Y,J){if(!$)return $;let G=$,Q=Y.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let w=X.__processedComponents,q=y1(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,$_),G=D7(G,q.scripts),G;async function U(B,j,_,H){if(!B)return B;let L=B,O=NG(L,j,H);for(let F=O.length-1;F>=0;F--){let V=O[F],A=_?$9(V.tagName):V.tagName,R=Z_(V.attributes),N=X_(R,X,Y),T=d0.getBuiltin(V.tagName),M=T?await Y$(A,Q,X,Z,Y):!1;if(T&&!M){let S={context:X,filePath:Z,options:Y,dependencies:J},b=T.render(N,V.content,S);if(Object.keys(N.clientReactive).length>0)b=yG(b,N.clientReactive);if(Object.keys(N.events).length>0){let C=EG(N.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${C}`)}L=L.substring(0,V.startIndex)+b+L.substring(V.endIndex);continue}if(!_&&V.tagName.includes("-")&&!await Y$(A,Q,X,Z,Y))continue;let k={};for(let[S,b]of Object.entries(N.static))k[S]=b;for(let[S,b]of Object.entries(N.serverDynamic))k[S]=b;let I=await $5(A,k,V.content,Q,X,Z,Y,w,J);if(Object.keys(N.clientReactive).length>0)I=yG(I,N.clientReactive);if(Object.keys(N.events).length>0){let S=SG(I);if(S){let b=EG(N.events),C=Object.keys(N.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,S.insertPos)+` data-stx-parent-events="${C}" ${b}`+I.substring(S.insertPos)}}L=L.substring(0,V.startIndex)+I+L.substring(V.endIndex)}return L}}function yG($,X){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries(X).filter(([K])=>!Z.has(K)),G=J.filter(([K])=>!Y.has(K)).map(([K])=>$9(K)).join(" "),Q=$,w=J.length>0?SG(Q):null;if(w){let K=J.map(([U,B])=>`:${$9(U)}="${B.replace(/"/g,""")}"`).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,""")}">${Q}</template>`;let W=X.for;if(W)Q=`<template :for="${W.replace(/"/g,""")}">${Q}</template>`;return Q}function SG($){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 Y=$.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let w=$.indexOf("-->",Z+4);if(w===-1)return null;Z=w+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let w=`</${G[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(w,Z+G[0].length);if(q===-1)return null;Z=q+w.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function Z9($,X,Z,Y,J){if(!IG)AG(),IG=!0;let G=await bG($,X,Z,Y,J);G=await w_(G,X,Z,Y,J),G=await q_(G,X,Z,Y,J);let Q=[];for(let w=0;w<3;w++){let q=q1(G,E7,(K,z)=>`\x00STX_COMPONENT_COMMENT_${Q.length+z}\x00`);Q.push(...q.tokens);let W=G;if(G=await W_(q.output,X,Z,Y,J),G===W)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,q)=>Q[Number(q)]??"");if(Y.debug){let w=J_(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 IG=!1,$_,DG;var _4=y(()=>{c3();RG();kG();r1();k0();T0();w1();$_=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"]);DG=new Map});var uG={};a(uG,{processLoops:()=>O4,parseLoopBinding:()=>H4});function U_($,X){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",J=0,G;while((G=Z.exec($))!==null){let Q=G.index+G[0].length,w=G.index+G[0].indexOf("("),q=E0($,"(",")",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=N0(W,X);if(!U||typeof U!=="object")continue;z=JSON.stringify(U)}catch{continue}Y+=$.slice(J,Q)+z,J=q,Z.lastIndex=q}return J===0?$:Y+$.slice(J)}function j_($,X){let Z=/@component\s*\(/g,Y=$,J,G=[];while((J=Z.exec(Y))!==null){let Q=J.index,w=Q+J[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let K=Y.substring(w+1,W),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=N0(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];Y=Y.substring(0,w)+W+Y.substring(q)}return Y}function Y9($,X,Z){let Y=$,J=new RegExp(`${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1,K=null,z=!1;while(W<Y.length&&q>0){let j=Y[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=Y.substring(w+1,W),B=Z(U);Y=Y.substring(0,Q)+B+Y.substring(W+1)}return Y}function B_($,X){let Z=$;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,J)=>{if(J in X)return`:${J}="${J}"`;return Y}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,J,G)=>{try{let Q=Object.keys(X),w=Object.values(X);k8(G);let W=W0(G,Q)(...w),K=JSON.stringify(W),z=Buffer.from(K,"utf8").toString("base64");return`__stx_${J}="${z}"`}catch(Q){return Y}}),Z}function __($,X){let Z=$;return Z=Y9(Z,"@break",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(Y0(G,X));return Q?J9:""}catch{return""}}),Z=Y9(Z,"@continue",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(Y0(G,X));return Q?G9:""}catch{return""}}),Z}function H_($){let X=$;return X=X.replace(/@break(?!\()/g,J9),X=X.replace(/@continue(?!\()/g,G9),X}function PG($){let X=$.includes(J9),Z=X?$.substring(0,$.indexOf(J9)):$;return{hasBreak:X,content:Z}}function vG($){let X=$.includes(G9),Z=X?$.substring(0,$.indexOf(G9)):$;return{hasContinue:X,content:Z}}function fG($){let X=$;return X=Y9(X,"@break",(Z)=>{let Y=Z.trim();if(!I8(Y))return"";return`\`; if (${Y}) { break; } result += \``}),X=Y9(X,"@continue",(Z)=>{let Y=Z.trim();if(!I8(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),X=X.replace(/@break(?!\()/g,"`; break; result += `"),X=X.replace(/@continue(?!\()/g,"`; continue; result += `"),X}function O_($){let X=/@forelse\s*\(/g,Z,Y=[],J=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=J.exec($))!==null)Y.push({pos:Q.index,delta:1});while((Q=G.exec($))!==null)Y.push({pos:Q.index,delta:-1});Y.sort((K,z)=>K.pos-z.pos);let w=[],q=0;for(let K of Y)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=H4(_);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($),C=N.exec($);if(!C)break;if(b&&b.index<C.index)V++,A=b.index+b[0].length;else{if(V--,V===0){T=C.index;break}A=C.index+11}}if(T===-1)continue;let M=$.substring(F,T),k=T+11,D=-1,I=0,S=0;while(S<M.length){let b=M.indexOf("@",S);if(b===-1)break;let C=M.substring(b);if(/^@forelse\s*\(/.test(C))I++,S=b+1;else if(C.startsWith("@endforelse"))I--,S=b+11;else if(I===0&&C.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){D=b;break}S=b+1}else S=b+1}if(D===-1)continue;return{start:K,end:k,arrayExpr:L,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function xG($,X){let Z=$;while(!0){let Y=O_(Z);if(!Y)break;let{start:J,end:G,arrayExpr:Q,itemVar:w,foreachContent:q,emptyContent:W}=Y;try{let K;if(q0(Q))K=W0(Q,Object.keys(X))(...Object.values(X));else K=Y0(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,J)+z+Z.substring(G)}catch(K){let z=K instanceof Error?K.message:String(K),U=Z0("Forelse",`Error in @forelse(${Q} as ${w}): ${z}`,o.EVALUATION_ERROR);Z=Z.substring(0,J)+U+Z.substring(G)}}return Z}function H4($){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 Y=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Z[2].trim();return Y&&J?{arrayExpr:J,itemVar:Y}:null}function O4($,X,Z,Y){let J=$;J=xG(J,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=H4(H);if(!L)continue;let O=z,{arrayExpr:F,itemVar:V}=L,A=_+1,R=1,N=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(R>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let k=T.exec(q),D=M.exec(q);if(!D)break;if(k&&k.index<D.index)R++,N=k.index+k[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=Y0(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=Z0("Foreach",`Error in @foreach: ${L} is not iterable`,o.TYPE_ERROR);K=K.substring(0,U)+D+K.substring(B);continue}let V=Y?.loops?.useAltLoopVariable??z_,A=_.trim(),R=null,N,T=!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],T=!0;else N=A}else N=A;let M="",k=O;for(let D=0;D<k.length;D++){let I=k[D],S={index:D,iteration:D+1,first:D===0,last:D===k.length-1,count:k.length},b={...W,loop:S,$loop:S};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((l)=>l.trim());if(Array.isArray(I))f.forEach((l,$0)=>{if(l)b[l]=I[$0]});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]=D;let C=__(H,b),P=vG(C);if(P.hasContinue){M+=P.content;continue}let x=PG(C);if(x.hasBreak){M+=x.content;break}if(C=xG(C,b),C=Q(C,b),C=G5(C,b,Z),C=H_(C),x=PG(C),x.hasBreak){M+=x.content;break}if(P=vG(C),P.hasContinue){M+=P.content;continue}C=b1(C,b,Z),C=B_(C,b),C=j_(C,b),C=U_(C,b),M+=C}K=K.substring(0,U)+M+K.substring(B)}catch(L){let O=Z0("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}J=Q(J,X),J=hG(J,X,Z,Y);let w=Y?.loops?.maxWhileIterations??K_;return J=V_(J,X,w),J}function gG($){return I8($)}function hG($,X,Z,Y){let J=$,G=!0;while(G){G=!1;let Q=J.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=w+Q[0].length-1,W=E0(J,"(",")",q);if(W===-1)break;let K=J.slice(q+1,W),z=W+1,U=v8(J.slice(w),"for","endfor");if(U.length===0)break;let B=U[0].content,j=w+U[0].end;if(!gG(K)){let _=Z0("For",`Unsafe expression in @for: ${K}`,o.UNSAFE_EXPRESSION);J=J.substring(0,w)+_+J.substring(j),G=!0;continue}try{let _=L_(K),H=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&H){let R=F_({forExpr:K,content:B,iterVarNames:_,context:X,filePath:Z,options:Y});J=J.substring(0,w)+R+J.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=fG(F);let A=Function(...L,`
|
|
12250
|
+
</style>`}}});import{existsSync as tB,readFileSync as eB}from"fs";function $_($){if(VG.has($))return;VG.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function X_($){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(tB(Z))return Z;for(let Z of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return j0.resolve(Z)}catch{}return null}function Z_($){if(t$.has($))return t$.get($);let X=X_($);if(!X)return $_($),null;try{let Z=JSON.parse(eB(X,"utf8"));return t$.set($,Z.icons),Z.icons}catch{return null}}function d5($,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 t$,VG,K4;var z4=y(()=>{t$=new Map,VG=new Set;K4={name:"Icon",aliases:["icon","stx-icon"],render($,X,Z){let Y=d5($,"name")??d5($,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let J="lucide",G=Y;if(Y.includes(":")){let O=Y.split(":");J=O[0],G=O[1]}let Q=y0(d5($,"size")||"24"),w=y0(d5($,"color")||"currentColor"),q=y0(d5($,"class")||""),W=y0(d5($,"style")||""),K=t$.get(J)??Z_(J);if(!K)return`<!-- Icon: collection "${J}" not loaded -->`;let z=K[G];if(!z)return`<!-- Icon: "${G}" not found in ${J} -->`;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 AG($,...X){for(let Z of X){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y}return}function RG($,X){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${X}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=$.match(Z);if(!Y)return{region:null,rest:$};return{region:Y[2],rest:$.replace(Y[0],"")}}var U4;var j4=y(()=>{U4={name:"Suspense",aliases:["suspense"],render($,X,Z){let Y=RG(X,"fallback"),J=Y.rest,G=RG(J,"error"),Q=G.rest,w=Y.region??AG($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=G.region??AG($,"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 e$($,...X){for(let Z of X){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y}return}var B4;var _4=y(()=>{B4={name:"TransitionGroup",aliases:["transition-group"],render($,X,Z){let Y=(e$($,"name")||"v").replace(/["'<>]/g,""),J=(e$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=e$($,"class"),Q=e$($,"id"),w=[`data-stx-transition-group="${Y}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${J} ${w}>${X}</${J}>`}}});function NG(){d0.registerBuiltin(i3),d0.registerBuiltin(a3),d0.registerBuiltin(e3),d0.registerBuiltin(Z4),d0.registerBuiltin(J4),d0.registerBuiltin(Q4),d0.registerBuiltin(q4),d0.registerBuiltin(K4),d0.registerBuiltin(U4),d0.registerBuiltin(B4)}var TG=y(()=>{n3();t3();$4();Y4();G4();w4();W4();z4();j4();_4();p3();n3();t3();$4();Y4();G4();w4();W4();z4();j4();_4()});function $9($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function MG($,X,Z){let Y=[],J=0;while(J<$.length){let G=$.indexOf("<",J);if(G===-1)break;let w=$.slice(G+1).match(new RegExp(`^(${X.source})(?![\\w.:-])`));if(!w){J=G+1;continue}let q=w[1];if(Z&&Z.has(q.toLowerCase())){let _=G+1+q.length;while(_<$.length&&$[_]!==">")_++;J=_+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){J=G+1;continue}let j=$.slice(z,B?U-2:U-1).trim();if(B)Y.push({fullMatch:$.slice(G,U),tagName:q,attributes:j,content:"",startIndex:G,endIndex:U,isSelfClosing:!0}),J=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===`
|
|
12251
|
+
`||T==="\t")L++;O=R+_.length}else{if(L--,L===0){F=N;break}O=N+H.length}}if(F===-1){J=U;continue}let V=$.slice(U,F),A=F+H.length;Y.push({fullMatch:$.slice(G,A),tagName:q,attributes:j,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function kG($){return $.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/�?39;/g,"'").replace(/'/gi,"'").replace(/&/g,"&")}function IG($,X){try{let Z=Buffer.from($,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=$.replace(/"/g,'"').replace(/</g,"<").replace(/>/g,">").replace(/&/g,"&");return JSON.parse(Z)}catch(Z){if(X?.debug)console.error("Error decoding __stx_ prop:",Z);return $}}var EG=y(()=>{T0();k0();r1()});var vG={};a(vG,{processESImports:()=>CG,processComponents:()=>Z9});import X9 from"fs";import n0 from"path";function J_($,X,Z){let Y={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(x2),G=(w)=>{if(!w.includes("-")||w.startsWith("@")||w.startsWith(":")||w.startsWith("x-")||w.startsWith("__"))return w;if(w.startsWith("aria-")||w.startsWith("data-"))return w;return w.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},Q=(w,q)=>{let W=G(w);if(Y.static[W]=q,W!==w)Y.staticNames[W]=w};for(let[w,q]of Object.entries($)){let W=w.startsWith("x-")&&!J.has(w)&&!w.startsWith("x-bind:")&&!w.startsWith("x-on:")?`:${w.slice(2)}`:w;if(W.startsWith("@")){Y.events[W]=q;continue}if(W.startsWith("__stx_")){let K=G(W.slice(6));Y.serverDynamic[K]=IG(q,Z);continue}if(W.startsWith(":")){let K=G(W.slice(1)),z=q===q5?K:q;if(K==="if"||K==="for"||K==="show"){Y.clientReactive[K]=z;continue}try{if(!q0(z)){if(Z.debug)console.error(`Unsafe expression in :${K} binding: ${z}`);Y.clientReactive[K]=z;continue}let U=Object.keys(X),j=W0(z,U)(...Object.values(X));if(j===void 0){let _=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((O)=>!H.has(O)&&!U.includes(O))){Y.clientReactive[K]=z;continue}}Y.serverDynamic[K]=j}catch{Y.clientReactive[K]=z}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let K=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(K)try{let z=K[1];if(q0(z)){let B=W0(z,Object.keys(X))(...Object.values(X));Q(W,B!=null?String(B):"")}else{if(Z.debug)console.error(`Unsafe expression in ${W}: ${z}`);Q(W,q)}}catch(z){if(Z.debug)console.error(`Error evaluating expression for ${W}:`,z);Q(W,q)}else{let z=q,U=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=U.exec(q))!==null)try{let j=B[1];if(!q0(j)){if(Z.debug)console.error(`Unsafe expression in ${W}: ${j}`);continue}let H=W0(j,Object.keys(X))(...Object.values(X));z=z.replace(B[0],String(H??""))}catch(j){if(Z.debug)console.error(`Error evaluating expression in ${W}:`,j)}Q(W,z)}continue}Q(W,q===q5?"true":kG(q))}return Y}function G_($){let X={},Z=0,Y=$.length;while(Z<Y){while(Z<Y&&/\s/.test($[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test($[Z]))J+=$[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test($[Z]))Z++;if(Z<Y&&$[Z]==="="){Z++;while(Z<Y&&/\s/.test($[Z]))Z++;let G="";if(Z<Y&&($[Z]==='"'||$[Z]==="'")){let Q=$[Z];Z++;while(Z<Y){let w=$[Z];if(w==="\\"&&Z+1<Y){Z++,G+=$[Z],Z++;continue}if(w===Q){Z++;break}G+=w,Z++}}else while(Z<Y&&!/\s/.test($[Z]))G+=$[Z],Z++;X[J]=G}else X[J]=q5}return X}function yG($){return Object.entries($).map(([X,Z])=>Z===q5?X:`${X}="${Q_(Z)}"`).join(" ")}function Q_($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function w_($){let X=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(d0.isBuiltin(J))X.add(J)}return[...X].sort()}function q_($){let X=bG.get($);if(X)return X;let Z=new Map,Y=[n0.join($,"src"),n0.join($,"dist"),$];function J(G,Q){if(Q>6)return;let w;try{w=X9.readdirSync(G,{withFileTypes:!0})}catch{return}for(let q of w){let W=n0.join(G,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(W,Q+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let K=q.name.slice(0,-4);if(!Z.has(K))Z.set(K,W);let 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 Y)if(J(G,0),Z.size>0)break;return bG.set($,Z),Z}function W_($,X){if($.startsWith(".")||$.startsWith("/"))return null;let Z=X;while(!0){let Y=n0.join(Z,"node_modules",$);try{if(X9.statSync(Y).isDirectory())return Y}catch{}let J=n0.dirname(Z);if(J===Z)return null;Z=J}}async function CG($,X,Z,Y,J){if(!$.includes("import"))return $;if(!X.__importedComponents)X.__importedComponents=new Map;let G=X.__importedComponents,Q=n0.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=n0.resolve(Q,F);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(X9.statSync(M).isFile())A=M}catch{try{if(X9.statSync(T).isDirectory())V=T}catch{}}}}else V=W_(F,Q);if(!V&&!A)continue;let R=!1,N=(T,M)=>{G.set(T,M),G.set(T.toLowerCase(),M);let k=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(k,M),J.add(M)};if(O&&A)N(O,A),R=!0;else if(L){let T=L.slice(1,-1).split(",").map((k)=>k.trim()).filter(Boolean).map((k)=>{let D=k.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:k,local:k}}),M=V?q_(V):null;for(let{source:k,local:D}of T){let I=null;if(A)I=A;else if(M)I=M.get(k)??M.get(k.toLowerCase())??M.get(k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(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 K_($,X,Z,Y,J){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=[n0.resolve(n0.dirname(Z),`${U}.stx`),n0.resolve(n0.dirname(Z),U),n0.resolve(Y.componentsDir||"components",`${U}.stx`),n0.resolve(Y.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),J.add(L),Y.debug)console.log(`Imported component: ${H} -> ${L}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${U}`)}G=G.replace(W,""),w.lastIndex=0}return G}async function z_($,X,Z,Y,J){let G=$,Q=Y.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=N0(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=_,M=G.substring(_).match(/^([\s\S]*?)@endcomponent/);if(M)R=M[1].trim(),N=_+M[0].length;let k=await $5(L,A,R,Q,X,Z,Y,w,J);G=G.substring(0,K)+k+G.substring(N),q.lastIndex=0}return G}async function U_($,X,Z,Y,J){if(!$)return $;let G=$,Q=Y.componentsDir||"components";if(!X.__processedComponents)X.__processedComponents=new Set;let w=X.__processedComponents,q=y1(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,Y_),G=D7(G,q.scripts),G;async function U(B,j,_,H){if(!B)return B;let L=B,O=MG(L,j,H);for(let F=O.length-1;F>=0;F--){let V=O[F],A=_?$9(V.tagName):V.tagName,R=G_(V.attributes),N=J_(R,X,Y),T=d0.getBuiltin(V.tagName),M=T?await Y$(A,Q,X,Z,Y):!1;if(T&&!M){let S={context:X,filePath:Z,options:Y,dependencies:J},b=T.render(N,V.content,S);if(Object.keys(N.clientReactive).length>0)b=SG(b,N.clientReactive);if(Object.keys(N.events).length>0){let C=yG(N.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${C}`)}L=L.substring(0,V.startIndex)+b+L.substring(V.endIndex);continue}if(!_&&V.tagName.includes("-")&&!await Y$(A,Q,X,Z,Y))continue;let k={};for(let[S,b]of Object.entries(N.static))k[S]=b;for(let[S,b]of Object.entries(N.serverDynamic))k[S]=b;let I=await $5(A,k,V.content,Q,X,Z,Y,w,J);if(Object.keys(N.clientReactive).length>0)I=SG(I,N.clientReactive);if(Object.keys(N.events).length>0){let S=PG(I);if(S){let b=yG(N.events),C=Object.keys(N.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,S.insertPos)+` data-stx-parent-events="${C}" ${b}`+I.substring(S.insertPos)}}L=L.substring(0,V.startIndex)+I+L.substring(V.endIndex)}return L}}function SG($,X){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries(X).filter(([K])=>!Z.has(K)),G=J.filter(([K])=>!Y.has(K)).map(([K])=>$9(K)).join(" "),Q=$,w=J.length>0?PG(Q):null;if(w){let K=J.map(([U,B])=>`:${$9(U)}="${B.replace(/"/g,""")}"`).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,""")}">${Q}</template>`;let W=X.for;if(W)Q=`<template :for="${W.replace(/"/g,""")}">${Q}</template>`;return Q}function PG($){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 Y=$.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let w=$.indexOf("-->",Z+4);if(w===-1)return null;Z=w+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let w=`</${G[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(w,Z+G[0].length);if(q===-1)return null;Z=q+w.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function Z9($,X,Z,Y,J){if(!DG)NG(),DG=!0;let G=await CG($,X,Z,Y,J);G=await K_(G,X,Z,Y,J),G=await z_(G,X,Z,Y,J);let Q=[];for(let w=0;w<3;w++){let q=q1(G,E7,(K,z)=>`\x00STX_COMPONENT_COMMENT_${Q.length+z}\x00`);Q.push(...q.tokens);let W=G;if(G=await U_(q.output,X,Z,Y,J),G===W)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(w,q)=>Q[Number(q)]??"");if(Y.debug){let w=w_(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 DG=!1,Y_,bG;var H4=y(()=>{p3();TG();EG();r1();k0();T0();w1();Y_=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);bG=new Map});var mG={};a(mG,{processLoops:()=>L4,parseLoopBinding:()=>O4});function __($,X){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",J=0,G;while((G=Z.exec($))!==null){let Q=G.index+G[0].length,w=G.index+G[0].indexOf("("),q=E0($,"(",")",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=N0(W,X);if(!U||typeof U!=="object")continue;z=JSON.stringify(U)}catch{continue}Y+=$.slice(J,Q)+z,J=q,Z.lastIndex=q}return J===0?$:Y+$.slice(J)}function H_($,X){let Z=/@component\s*\(/g,Y=$,J,G=[];while((J=Z.exec(Y))!==null){let Q=J.index,w=Q+J[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let K=Y.substring(w+1,W),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=N0(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];Y=Y.substring(0,w)+W+Y.substring(q)}return Y}function Y9($,X,Z){let Y=$,J=new RegExp(`${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=J.exec(Y))!==null){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1,K=null,z=!1;while(W<Y.length&&q>0){let j=Y[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=Y.substring(w+1,W),B=Z(U);Y=Y.substring(0,Q)+B+Y.substring(W+1)}return Y}function O_($,X){let Z=$;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,J)=>{if(J in X)return`:${J}="${J}"`;return Y}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,J,G)=>{try{let Q=Object.keys(X),w=Object.values(X);k8(G);let W=W0(G,Q)(...w),K=JSON.stringify(W),z=Buffer.from(K,"utf8").toString("base64");return`__stx_${J}="${z}"`}catch(Q){return Y}}),Z}function L_($,X){let Z=$;return Z=Y9(Z,"@break",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(Y0(G,X));return Q?J9:""}catch{return""}}),Z=Y9(Z,"@continue",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(q0(G)){let w=W0(G,Object.keys(X));Q=Boolean(w(...Object.values(X)))}else Q=Boolean(Y0(G,X));return Q?G9:""}catch{return""}}),Z}function F_($){let X=$;return X=X.replace(/@break(?!\()/g,J9),X=X.replace(/@continue(?!\()/g,G9),X}function xG($){let X=$.includes(J9),Z=X?$.substring(0,$.indexOf(J9)):$;return{hasBreak:X,content:Z}}function fG($){let X=$.includes(G9),Z=X?$.substring(0,$.indexOf(G9)):$;return{hasContinue:X,content:Z}}function hG($){let X=$;return X=Y9(X,"@break",(Z)=>{let Y=Z.trim();if(!I8(Y))return"";return`\`; if (${Y}) { break; } result += \``}),X=Y9(X,"@continue",(Z)=>{let Y=Z.trim();if(!I8(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),X=X.replace(/@break(?!\()/g,"`; break; result += `"),X=X.replace(/@continue(?!\()/g,"`; continue; result += `"),X}function V_($){let X=/@forelse\s*\(/g,Z,Y=[],J=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=J.exec($))!==null)Y.push({pos:Q.index,delta:1});while((Q=G.exec($))!==null)Y.push({pos:Q.index,delta:-1});Y.sort((K,z)=>K.pos-z.pos);let w=[],q=0;for(let K of Y)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=O4(_);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($),C=N.exec($);if(!C)break;if(b&&b.index<C.index)V++,A=b.index+b[0].length;else{if(V--,V===0){T=C.index;break}A=C.index+11}}if(T===-1)continue;let M=$.substring(F,T),k=T+11,D=-1,I=0,S=0;while(S<M.length){let b=M.indexOf("@",S);if(b===-1)break;let C=M.substring(b);if(/^@forelse\s*\(/.test(C))I++,S=b+1;else if(C.startsWith("@endforelse"))I--,S=b+11;else if(I===0&&C.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){D=b;break}S=b+1}else S=b+1}if(D===-1)continue;return{start:K,end:k,arrayExpr:L,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function gG($,X){let Z=$;while(!0){let Y=V_(Z);if(!Y)break;let{start:J,end:G,arrayExpr:Q,itemVar:w,foreachContent:q,emptyContent:W}=Y;try{let K;if(q0(Q))K=W0(Q,Object.keys(X))(...Object.values(X));else K=Y0(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,J)+z+Z.substring(G)}catch(K){let z=K instanceof Error?K.message:String(K),U=Z0("Forelse",`Error in @forelse(${Q} as ${w}): ${z}`,o.EVALUATION_ERROR);Z=Z.substring(0,J)+U+Z.substring(G)}}return Z}function O4($){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 Y=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Z[2].trim();return Y&&J?{arrayExpr:J,itemVar:Y}:null}function L4($,X,Z,Y){let J=$;J=gG(J,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=O4(H);if(!L)continue;let O=z,{arrayExpr:F,itemVar:V}=L,A=_+1,R=1,N=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(R>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let k=T.exec(q),D=M.exec(q);if(!D)break;if(k&&k.index<D.index)R++,N=k.index+k[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=Y0(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=Z0("Foreach",`Error in @foreach: ${L} is not iterable`,o.TYPE_ERROR);K=K.substring(0,U)+D+K.substring(B);continue}let V=Y?.loops?.useAltLoopVariable??B_,A=_.trim(),R=null,N,T=!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],T=!0;else N=A}else N=A;let M="",k=O;for(let D=0;D<k.length;D++){let I=k[D],S={index:D,iteration:D+1,first:D===0,last:D===k.length-1,count:k.length},b={...W,loop:S,$loop:S};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((l)=>l.trim());if(Array.isArray(I))f.forEach((l,$0)=>{if(l)b[l]=I[$0]});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]=D;let C=L_(H,b),P=fG(C);if(P.hasContinue){M+=P.content;continue}let x=xG(C);if(x.hasBreak){M+=x.content;break}if(C=gG(C,b),C=Q(C,b),C=G5(C,b,Z),C=F_(C),x=xG(C),x.hasBreak){M+=x.content;break}if(P=fG(C),P.hasContinue){M+=P.content;continue}C=b1(C,b,Z),C=O_(C,b),C=H_(C,b),C=__(C,b),M+=C}K=K.substring(0,U)+M+K.substring(B)}catch(L){let O=Z0("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}J=Q(J,X),J=dG(J,X,Z,Y);let w=Y?.loops?.maxWhileIterations??j_;return J=N_(J,X,w),J}function uG($){return I8($)}function dG($,X,Z,Y){let J=$,G=!0;while(G){G=!1;let Q=J.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let w=Q.index,q=w+Q[0].length-1,W=E0(J,"(",")",q);if(W===-1)break;let K=J.slice(q+1,W),z=W+1,U=v8(J.slice(w),"for","endfor");if(U.length===0)break;let B=U[0].content,j=w+U[0].end;if(!uG(K)){let _=Z0("For",`Unsafe expression in @for: ${K}`,o.UNSAFE_EXPRESSION);J=J.substring(0,w)+_+J.substring(j),G=!0;continue}try{let _=A_(K),H=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&H){let R=R_({forExpr:K,content:B,iterVarNames:_,context:X,filePath:Z,options:Y});J=J.substring(0,w)+R+J.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=hG(F);let A=Function(...L,`
|
|
12252
12252
|
let result = '';
|
|
12253
12253
|
for (${K}) {
|
|
12254
12254
|
result += \`${F}\`;
|
|
12255
12255
|
}
|
|
12256
12256
|
return result;
|
|
12257
|
-
`)(...O);J=J.substring(0,w)+A+J.substring(j),G=!0}catch(_){let H=Z0("For",`Error in @for(${K}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);J=J.substring(0,w)+H+J.substring(j),G=!0}}return J}function
|
|
12257
|
+
`)(...O);J=J.substring(0,w)+A+J.substring(j),G=!0}catch(_){let H=Z0("For",`Error in @for(${K}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);J=J.substring(0,w)+H+J.substring(j),G=!0}}return J}function A_($){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 Y=X.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let J=X.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(J)return[J[1]];return[]}function R_($){let{forExpr:X,content:Z,iterVarNames:Y,context:J,filePath:G,options:Q}=$,w=Object.keys(J),q=Object.values(J),W=Function(...w,"__pushIter",`
|
|
12258
12258
|
for (${X}) {
|
|
12259
12259
|
__pushIter([${Y.join(", ")}])
|
|
12260
12260
|
}
|
|
12261
|
-
`),K=[];W(...q,(B)=>{K.push(B)});let z=G??"inline.stx",U="";for(let B of K){let j={...J};Y.forEach((H,L)=>{j[H]=B[L]});let _=
|
|
12261
|
+
`),K=[];W(...q,(B)=>{K.push(B)});let z=G??"inline.stx",U="";for(let B of K){let j={...J};Y.forEach((H,L)=>{j[H]=B[L]});let _=dG(Z,j,G,Q);_=G5(_,j,z),_=b1(_,j,z),U+=_}return U}function N_($,X,Z){let Y=$,J=!0;while(J){J=!1;let G=Y.match(/@while\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,w=Q+G[0].length-1,q=E0(Y,"(",")",w);if(q===-1)break;let W=Y.slice(w+1,q),K=v8(Y.slice(Q),"while","endwhile");if(K.length===0)break;let z=K[0].content,U=Q+K[0].end;if(!uG(W)){let B=Z0("While",`Unsafe expression in @while: ${W}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,Q)+B+Y.substring(U),J=!0;continue}try{let B=Object.keys(X),j=Object.values(X),_=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});_=hG(_);let L=Function(...B,`
|
|
12262
12262
|
let result = '';
|
|
12263
12263
|
let maxIterations = ${Z}; // Configurable safety limit
|
|
12264
12264
|
let counter = 0;
|
|
@@ -12270,8 +12270,8 @@ ${I}
|
|
|
12270
12270
|
result += '<!-- [While Error [1104]]: Maximum iterations (${Z}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
|
|
12271
12271
|
}
|
|
12272
12272
|
return result;
|
|
12273
|
-
`)(...j);Y=Y.substring(0,Q)+L+Y.substring(U),J=!0}catch(B){let j=Z0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+j+Y.substring(U),J=!0}}return Y}var
|
|
12274
|
-
`)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(J!==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(!Y.has(j))Z.push(j),Y.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(!Y.has(j))Z.push(j),Y.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(!Y.has(j))Z.push(j),Y.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]==="{"){J++,G++;continue}if(X[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test(X[G])&&(G===0||/\s|[;{}()]/.test(X[G-1])))K();G++}return Z.join(", ")}function
|
|
12273
|
+
`)(...j);Y=Y.substring(0,Q)+L+Y.substring(U),J=!0}catch(B){let j=Z0("While",`Error in @while(${W}): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+j+Y.substring(U),J=!0}}return Y}var j_=1000,B_=!1,J9="<!--__STX_BREAK__-->",G9="<!--__STX_CONTINUE__-->";var F4=y(()=>{c$();V1();W1();x8();T0()});import _0 from"path";function V4($,X){let Z=0;for(let Y=X;Y<$.length;Y++){let J=$[Y];if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J===","&&Z===0)return Y}return-1}function T_($,X,Z){let Y=$,J=new RegExp(`${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=J.exec(Y);while(G){let Q=G.index,w=Q+G[0].length-1,q=1,W=w+1;while(W<Y.length&&q>0){if(Y[W]==="(")q++;else if(Y[W]===")")q--;W++}if(q!==0)break;let K=Y.substring(w+1,W-1),z=`${Z}(${K})`;Y=Y.substring(0,Q)+z+Y.substring(W),J.lastIndex=Q+z.length,G=J.exec(Y)}return Y}function M_($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function cG($){let X=$,Z=[],Y=new Set,J=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]!==`
|
|
12274
|
+
`)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(J!==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(!Y.has(j))Z.push(j),Y.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(!Y.has(j))Z.push(j),Y.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(!Y.has(j))Z.push(j),Y.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]==="{"){J++,G++;continue}if(X[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test(X[G])&&(G===0||/\s|[;{}()]/.test(X[G-1])))K();G++}return Z.join(", ")}function pG($,X=""){let Z=cG($).split(",").map((Y)=>Y.trim()).filter(Boolean);return`
|
|
12275
12275
|
(function() {
|
|
12276
12276
|
${A5("var",Z)}
|
|
12277
12277
|
var __destroyHooks = [];
|
|
@@ -12280,11 +12280,11 @@ ${I}
|
|
|
12280
12280
|
|
|
12281
12281
|
${$}
|
|
12282
12282
|
${X}})();
|
|
12283
|
-
`}function
|
|
12283
|
+
`}function iG($,X){return`
|
|
12284
12284
|
// Register scope variables for STX runtime
|
|
12285
12285
|
if (!window.stx._scopes) window.stx._scopes = {};
|
|
12286
12286
|
var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
|
|
12287
|
-
${
|
|
12287
|
+
${cG($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeRegistration[${JSON.stringify(G)}] = ${G}; } catch (e) { /* not actually top-level */ }`).join(`
|
|
12288
12288
|
`)}
|
|
12289
12289
|
// #1767: when the bundler renamed a component const that collided with an
|
|
12290
12290
|
// inlined import (foo -> foo2), rebind the ORIGINAL template name to the
|
|
@@ -12292,7 +12292,7 @@ ${mG($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
|
|
|
12292
12292
|
// shadowing import. __stxScopeRenames is emitted by bundleClientScript.
|
|
12293
12293
|
try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
|
|
12294
12294
|
window.stx._scopes['${X}'] = __scopeRegistration;
|
|
12295
|
-
`}function
|
|
12295
|
+
`}function k_($,X){let Z=iG($,X),Y=`
|
|
12296
12296
|
(function() {
|
|
12297
12297
|
var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${X}"]') : null;
|
|
12298
12298
|
var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
|
|
@@ -12301,37 +12301,37 @@ ${mG($).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
|
|
|
12301
12301
|
} finally {
|
|
12302
12302
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
12303
12303
|
}
|
|
12304
|
-
})();`;return Y+
|
|
12304
|
+
})();`;return Y+pG($,Z)+`
|
|
12305
12305
|
} finally {
|
|
12306
12306
|
if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
|
|
12307
12307
|
}
|
|
12308
|
-
})();`}function
|
|
12309
|
-
`;continue}if($0)try{let{extractVariables:u}=await Promise.resolve().then(() => (P7(),P8));await u(l,k,O)}catch(u){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,u)}if(!$0&&!A0){let u=f.replace(/\bclient\b/i,"").trim();b=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++
|
|
12310
|
-
`}}if(b){let x=
|
|
12308
|
+
})();`}function I_($,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 J=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[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 D_($){if($.__onceStore instanceof Set)return $.__onceStore;return E_}async function A4($,X,Z,Y,J,G=new Set){let Q=Y.partialsDir||_0.join(_0.dirname(Z),"partials");if(Q&&!_0.isAbsolute(Q))Q=_0.resolve(process.cwd(),Q);let w=T_($,"@partial","@include"),q=D_(X);w=w.replace(/@once([\s\S]*?)@endonce/g,(j,_,H)=>{let L=_.trim(),O=`${Z}:${L}`;if(q.has(O))return"";return q.add(O),_});{let j=/@includeIf\s*\(/g,_;while((_=j.exec(w))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<w.length&&O>0){if(w[F]==="(")O++;else if(w[F]===")")O--;F++}if(O!==0)break;let V=w.substring(L+1,F-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=F;continue}let R=A[1],N=W(R,Q,Z),T="";if(N&&await Bun.file(N).exists())J.add(N),T=`@include(${V})`;w=w.substring(0,H)+T+w.substring(F),j.lastIndex=0}}for(let[j,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let H=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=H.exec(w))!==null){let O=L.index,F=O+L[0].length-1,V=1,A=F+1;while(A<w.length&&V>0){if(w[A]==="(")V++;else if(w[A]===")")V--;A++}if(V!==0)break;let R=w.substring(F+1,A-1),N=V4(R,0);if(N===-1){H.lastIndex=A;continue}let T=R.substring(0,N).trim(),M=R.substring(N+1).trim(),k=M.match(/^\s*['"]([^'"]+)['"]/);if(!k){H.lastIndex=A;continue}let D=k[1],I=M.substring(k[0].length),S,b=V4(I,0);if(b!==-1)S=I.substring(b+1).trim();try{let C=`Boolean(${T})`,P;if(q0(C)){let l=W0(C,Object.keys(X));P=Boolean(l(...Object.values(X)))}else P=Boolean(Y0(C,X));let x=_?!P:P,f="";if(x){let l=W(D,Q,Z);if(l&&await Bun.file(l).exists())J.add(l);f=`@include('${D}'${S?`, ${S}`:""})`}w=w.substring(0,O)+f+w.substring(A),H.lastIndex=0}catch(C){let P=C instanceof Error?C.message:String(C),x=z0("Include",`Error evaluating ${j} condition: ${P}`,Z,$,O);w=w.substring(0,O)+x+w.substring(A),H.lastIndex=0}}}{let j=/@each\s*\(/g,_;while((_=j.exec(w))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<w.length&&O>0){if(w[F]==="(")O++;else if(w[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let V=w.substring(L+1,F),A=w.substring(H,F+1),R=V.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){j.lastIndex=0,w=w.replace(A,"");continue}let[,N,T,M,k]=R;try{let D,I=T.trim();if(q0(I))D=W0(I,Object.keys(X))(...Object.values(X));else D=Y0(I,X);let S="";if(Array.isArray(D)&&D.length>0)for(let b of D){let C={...X,[M]:b},P=await z(N,C,$,H);S+=P}else if(k)S=await z(k,{},$,H);w=w.substring(0,H)+S+w.substring(F+1),j.lastIndex=0}catch(D){let I=D instanceof Error?D.message:String(D);w=w.substring(0,H)+z0("Each",`Error in @each: ${I}`,Z,$,H)+w.substring(F+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,_;while((_=j.exec(w))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<w.length&&O>0){if(w[F]==="(")O++;else if(w[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let V=w.substring(L+1,F),A=w.substring(H,F+1),R=V.match(/^\s*(\[[^\]]+\])/);if(!R){j.lastIndex=0,w=w.replace(A,"");continue}let N=R[1],T=V.slice(R[0].length),M,k=T.match(/^\s*,\s*\{/);if(k){T=T.slice(k[0].length-1);let S=1,b=1;while(b<T.length&&S>0){if(T[b]==="{")S++;else if(T[b]==="}"){if(S--,S===0)break}b++}M=T.substring(0,b+1),T=T.slice(b+1)}let D,I=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(I)D=I[1];try{let S=JSON.parse(N.replace(/'/g,'"')),b={};if(M)try{b=N0(M,X)}catch(P){let x=P instanceof Error?P.message:String(P);if(Y.debug){let f=z0("Include",`Error parsing includeFirst variables: ${x}`,Z,$,H,A);w=w.replace(A,()=>f)}else w=w.replace(A,()=>D||"");continue}let C=!1;for(let P of S){let x=W(P,Q,Z);if(!x)continue;if(await p(x)){let f=await z(P,b,$,H);w=w.replace(A,()=>f),C=!0;break}}if(!C)if(D!==void 0)w=w.replace(A,()=>D);else if(Y.debug){let P=z0("Include",`None of the includeFirst paths exist: ${N}`,Z,$,H,A);w=w.replace(A,()=>P)}else w=w.replace(A,"")}catch(S){let b=S instanceof Error?S.message:String(S),C=z0("Include",`Error processing @includeFirst: ${b}`,Z,$,H,A);w=w.replace(A,()=>C)}j.lastIndex=0}}function W(j,_,H){try{let L=j;if(!j.endsWith(".stx"))L=`${j}.stx`;let O=_0.resolve(_),F=_0.resolve(_0.dirname(H)),V;if(!L.startsWith("./")&&!L.startsWith("../"))V=_0.resolve(_,L);else V=_0.resolve(F,L);let A=_0.normalize(V),R=A.startsWith(O+_0.sep)||A===O,N=A.startsWith(F+_0.sep)||A===F,T=!1,M=_0.dirname(F);if(A.startsWith(M+_0.sep)){if(!_0.relative(M,A).split(_0.sep).some((S)=>S.startsWith(".")&&S!=="."&&S!==".."))T=!0}if(!R&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${F}`),null;return A}catch(L){return console.error(`Error resolving path ${j}: ${L}`),null}}let K=_0.resolve(Z);G.add(K);async function z(j,_={},H,L){let O=W(j,Q,Z);if(!O)return z0("Include",`Could not resolve path for include: ${j}`,Z,H,L);let F=_0.resolve(O);if(G.has(F)){let V=[...G,F].map((A)=>_0.basename(A)).join(" -> ");return z0("Include",`Circular include detected: ${V}`,Z,H,L)}try{J.add(O);let V;if(!V)try{V=await Bun.file(O).text()}catch(x){let f=x instanceof Error?x.message:String(x);return z0("Include",`Error loading include file ${j}: ${f}`,Z,H,L)}if(V)V=V.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(V&&V.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (d3(),u3));V=x(V,X)}if(V&&(Y.debug||!d7()&&!D$()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (l3(),WG));x(V,O)}catch{}let A=V;try{let{processESImports:x}=await Promise.resolve().then(() => (H4(),vG));await x(V,X,O,Y,J)}catch(x){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,x instanceof Error?x.message:x)}let R=b8(A);if(R)A=R.content.trim();let T=V.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let k={...X};k.__stx_signals_gate=F1(V);for(let[x,f]of Object.entries(_))k[x]=f;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...V.matchAll(D)],S="",b=null;for(let x of I){let f=x[1]||"",l=x[2]||"",$0=f.includes("server"),C0=i1(f),U0="";try{let{extractAndStripCssImports:u,renderVendorStyleTags:t}=await Promise.resolve().then(() => (I7(),q6)),R0=u(l,{filePath:O,projectRoot:process.cwd()});l=R0.code,U0=t(R0.styles)}catch(u){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,u instanceof Error?u.message:u)}if(C0&&l.trim())l=n1(l);if(!$0)try{let{hasUserImports:u,bundleClientScript:t}=await Promise.resolve().then(() => (R7(),A7));if(u(l))l=await t(l,O,{projectRoot:process.cwd()})}catch(u){if(Y.debug)console.warn(`[stx] bundler skipped for ${O}:`,u instanceof Error?u.message:u)}let A0=M_(l);if(A0&&!$0){b=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++lG}`;let u=l0(l),t=k_(u,b);S+=`${U0}<script data-stx-scoped data-stx-run="always">${t}</script>
|
|
12309
|
+
`;continue}if($0)try{let{extractVariables:u}=await Promise.resolve().then(() => (P7(),P8));await u(l,k,O)}catch(u){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,u)}if(!$0&&!A0){let u=f.replace(/\bclient\b/i,"").trim();b=`stx_scope_${_0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++lG}`;let t=l0(l),R0=iG(t,b),P0=pG(t,R0);S+=`${U0}<script data-stx-scoped data-stx-run="always"${u?` ${u}`:""}>${P0}</script>
|
|
12310
|
+
`}}if(b){let x=I_(A,b);if(A=x.html,x.mergedIntoExisting)S=S.replace(`window.stx._scopes['${b}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),b=x.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await A4(A,k,O,Y,J,G);let{processLoops:C}=await Promise.resolve().then(() => (F4(),mG)),P=C(A,k,O);if(P=G5(P,k,O),P=b1(P,k,O),M)P+=`
|
|
12311
12311
|
`+M;if(S)P+=`
|
|
12312
|
-
`+S;return P}catch(V){let A=V instanceof Error?V.message:String(V);return z0("Include",`Error processing include ${j}: ${A}`,Z,H,L)}}let U=/@include\s*\(/g,B;while((B=U.exec(w))!==null){let j=B.index,_=j+B[0].length-1,H=1,L=_+1;while(L<w.length&&H>0){if(w[L]==="(")H++;else if(w[L]===")")H--;L++}if(H!==0)break;let O=w.substring(j,L),F=w.substring(_+1,L-1),V=F.match(/^\s*['"]([^'"]+)['"]/);if(!V){U.lastIndex=L;continue}let A=V[1],R,N=F.substring(V[0].length),T=
|
|
12313
|
-
`)})}var
|
|
12312
|
+
`+S;return P}catch(V){let A=V instanceof Error?V.message:String(V);return z0("Include",`Error processing include ${j}: ${A}`,Z,H,L)}}let U=/@include\s*\(/g,B;while((B=U.exec(w))!==null){let j=B.index,_=j+B[0].length-1,H=1,L=_+1;while(L<w.length&&H>0){if(w[L]==="(")H++;else if(w[L]===")")H--;L++}if(H!==0)break;let O=w.substring(j,L),F=w.substring(_+1,L-1),V=F.match(/^\s*['"]([^'"]+)['"]/);if(!V){U.lastIndex=L;continue}let A=V[1],R,N=F.substring(V[0].length),T=V4(N,0);if(T!==-1)R=N.substring(T+1).trim();let M={};if(R)try{M=N0(R,X)}catch(D){let I=D instanceof Error?D.message:String(D);w=w.replace(O,z0("Include",`Error parsing include variables for ${A}: ${I}`,Z,$,j)),U.lastIndex=0;continue}let k=await z(A,M,$,j);w=w.substring(0,j)+k+w.substring(L),U.lastIndex=0}return w}function R4($,X){let Z=$;function Y(J,G,Q,w){let q=J,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,M=N?O+N.index:1/0;if(T<M)L++,O=T+(R[0].length||1);else if(M<1/0){if(L--,L===0){F=M;break}O=M+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=Y(Z,"push","endpush",!1),Z=Y(Z,"prepend","endprepend",!0),Z}function N4($,X){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,Y)=>{if(!X[Y]||X[Y].length===0)return"";return X[Y].join(`
|
|
12313
|
+
`)})}var lG=0,Ik,E_;var nG=y(()=>{QX();c$();W1();w1();I5();T0();k0();Ik=new o1(500),E_=new Set});import*as T4 from"path";async function rG($,X,Z=""){if(T4.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 sG($,X,Z,"@js","@endjs")}async function oG($,X,Z=""){if(T4.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 sG($,X,Z,"@ts","@endts")}async function sG($,X,Z,Y,J){let G=$,Q=k5(`${Y}([\\s\\S]*?)${J}`,"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(Y==="@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=`
|
|
12314
12314
|
${_}
|
|
12315
12315
|
${O}
|
|
12316
|
-
`,A=Function(...B,F)(...j);if(A&&typeof A==="object")Object.assign(X,A);G=G.replace(W,"")}catch(U){console.error(`Error executing ${Y} code block in ${Z}:`,U);let B=U instanceof Error?U.message:String(U),j=z0(`${Y} Directive`,`Error executing code: ${B}`,Z,$,z,W);console.error(j),G=G.replace(W,"")}return G}var
|
|
12316
|
+
`,A=Function(...B,F)(...j);if(A&&typeof A==="object")Object.assign(X,A);G=G.replace(W,"")}catch(U){console.error(`Error executing ${Y} code block in ${Z}:`,U);let B=U instanceof Error?U.message:String(U),j=z0(`${Y} Directive`,`Error executing code: ${B}`,Z,$,z,W);console.error(j),G=G.replace(W,"")}return G}var aG=y(()=>{I5();k0()});function y_($,X="_method"){let Z=$.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${X}" value="${Z}">`}function tG($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(X,Z,Y,J,G)=>{return y_(Y,G||"_method")})}async function eG($,X,Z,Y,J){if(!Y.middleware||Y.middleware.length===0)return $;let G=$,Q=Y.middleware.filter((w)=>w.timing===J);if(Q.length===0)return G;for(let w of Q){if(!w.name||typeof w.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",w);continue}try{let q=await w.handler(G,X,Z,Y);if(typeof q==="string")G=q;else if(Y.debug)console.warn(`Middleware ${w.name} did not return a string`)}catch(q){if(Y.debug)console.error(`Error in middleware ${w.name}:`,q);if(Y.debug){let W=z0("Middleware",`Error in middleware '${w.name}': ${q instanceof Error?q.message:String(q)}`,Z,$);G=G.replace(/<body[^>]*>/,`$&
|
|
12317
12317
|
<div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${t0(W)}</div>
|
|
12318
|
-
`)}}}return G}async function
|
|
12318
|
+
`)}}}return G}async function $Q($,X,Z,Y){return eG($,X,Z,Y,"before")}async function XQ($,X,Z,Y){return eG($,X,Z,Y,"after")}var ZQ=y(()=>{W1();k0()});function YQ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(X,Z,Y,J,G)=>{try{let Q=J?N0(J,{}):{};return Y7(Y,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var JQ=y(()=>{k1();k1();T0()});async function GQ($,X){let Z=$.split("/").pop()?.split(".")[0]||"";if($8.exact[$])for(let Y of $8.exact[$])await Promise.resolve(Y(X,$));if($8.exact[Z])for(let Y of $8.exact[Z])await Promise.resolve(Y(X,$));for(let{pattern:Y,callback:J}of $8.patterns)if(Y.test($)||Y.test(Z))await Promise.resolve(J(X,$))}var $8;var QQ=y(()=>{$8={patterns:[],exact:{}}});function wQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((X)=>wQ(X)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,X])=>X).map(([X])=>X).join(" ");return $?String($):""}function qQ($,X){if(!/:[\w-]+=/.test($))return $;let Z=$,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],G;while((G=Y.exec($))!==null)J.push([G.index,G.index+G[0].length]);function Q(W){return J.some(([K,z])=>W>=K&&W<z)}let w=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((G=w.exec(Z))!==null){if(Q(G.index))continue;let W=G[0],K=G[2];if(!K||!K.includes(":"))continue;let 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(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=wQ(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(b_.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,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">");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 b_;var WQ=y(()=>{b_=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function W5($,X){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=X;let Y=Z.exec($);if(!Y)return null;let J=/\/\s*>$/.test(Y[0])||Y[1]===Y[1].toLowerCase()&&S_.has(Y[1]),G=J?Y[2].replace(/\/\s*$/,""):Y[2];return{full:Y[0],tag:Y[1],attrs:G,selfClosing:J,start:Y.index,end:Y.index+Y[0].length}}function P_($,X,Z){let Y=1,J=Z,G=new RegExp(`<${X}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${X}\\s*>`,"gi");while(Y>0&&J<$.length){G.lastIndex=J,Q.lastIndex=J;let w=G.exec($),q=Q.exec($);if(!q)return-1;if(w&&w.index<q.index)Y++,J=w.index+w[0].length;else{if(Y--,Y===0)return q.index+q[0].length;J=q.index+q[0].length}}return-1}function z1($,X){if(X.selfClosing)return{outerStart:X.start,outerEnd:X.end,innerHTML:""};let Z=P_($,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 KQ($,X){return new RegExp(`(?:^|\\s)${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${X}=`)||$.includes(` ${X} `)||$.trimEnd().endsWith(` ${X}`)}function m5($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=$.match(new RegExp(`${Z}="([^"]*)"`,"s"))||$.match(new RegExp(`${Z}='([^']*)'`,"s"));return Y?Y[1]:null}function u1($,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 d1($,X,Z){let Y=X.selfClosing?" /":"",J=`<${X.tag}${Z}${Y}>`;return $.slice(0,X.start)+J+$.slice(X.end)}function v_($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function x_($){let X=$,Z=0;while(Z<X.length){let Y=W5(X,Z);if(!Y)break;let J=m5(Y.attrs,"v-for");if(J===null){Z=Y.end;continue}let G=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=Y.end;continue}let Q=G[1].trim(),w=G[2].trim(),q;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),L=H[0],O=H[1];q=`${w} as ${O} => ${L}`}else q=`${w} as ${Q}`;let W=u1(Y.attrs,"v-for"),K=u1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=z1(X,Y),U=X.slice(z.outerStart,z.outerEnd),B=d1(U,{...Y,start:0,end:Y.end-Y.start},K),j=`@foreach(${q})
|
|
12319
12319
|
`,_=`${j}${B}
|
|
12320
|
-
@endforeach`;X=X.slice(0,z.outerStart)+_+X.slice(z.outerEnd),Z=z.outerStart+j.length}return X}function
|
|
12320
|
+
@endforeach`;X=X.slice(0,z.outerStart)+_+X.slice(z.outerEnd),Z=z.outerStart+j.length}return X}function f_($){let X=$,Z=0;while(Z<X.length){let Y=W5(X,Z);if(!Y)break;let J=m5(Y.attrs,"v-if");if(J===null){Z=Y.end;continue}let G=[],Q=z1(X,Y),w=u1(Y.attrs,"v-if"),q=d1(X.slice(Q.outerStart,Q.outerEnd),{...Y,start:0,end:Y.end-Y.start},w);G.push({type:"if",expr:J,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:q,parsedTag:Y});let W=Q.outerEnd,K=!0;while(K){let _=X.slice(W).match(/^\s*/),H=_?_[0].length:0,L=W5(X,W+H);if(!L){K=!1;break}let O=m5(L.attrs,"v-else-if"),F=KQ(L.attrs,"v-else");if(O!==null){let V=z1(X,L),A=u1(L.attrs,"v-else-if"),R=d1(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=u1(L.attrs,"v-else"),R=d1(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})
|
|
12321
12321
|
${_.element}`);else if(_.type==="else-if")z.push(`@elseif(${_.expr})
|
|
12322
12322
|
${_.element}`);else z.push(`@else
|
|
12323
12323
|
${_.element}`);z.push("@endif");let U=z.join(`
|
|
12324
|
-
`),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
|
|
12324
|
+
`),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 g_($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function h_($){let X=$,Z=0;while(Z<X.length){let Y=W5(X,Z);if(!Y)break;let J=Y.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,w=J.match(Q);while(w){G=!0;let K=w[1],z=w[2],U=w[3];J=J.replace(w[0],""),J+=` :${K}="${U}" @update:${K}="${U} = $event"`,w=J.match(Q)}if(G){let K=z1(X,Y),z=X.slice(K.outerStart,K.outerEnd),U=d1(z,{...Y,start:0,end:Y.end-Y.start},J);X=X.slice(0,K.outerStart)+U+X.slice(K.outerEnd),Z=K.outerStart+U.length;continue}let q=m5(Y.attrs,"v-model");if(q===null){Z=Y.end;continue}if(C_.has(Y.tag)){let K=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=z1(X,Y),U=X.slice(z.outerStart,z.outerEnd),B=d1(U,{...Y,start:0,end:Y.end-Y.start},K);X=X.slice(0,z.outerStart)+B+X.slice(z.outerEnd),Z=z.outerStart+B.length}else{let K=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");K+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=z1(X,Y),U=X.slice(z.outerStart,z.outerEnd),B=d1(U,{...Y,start:0,end:Y.end-Y.start},K);X=X.slice(0,z.outerStart)+B+X.slice(z.outerEnd),Z=z.outerStart+B.length}}return X}function u_($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function d_($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function m_($){let X=$,Z=0;while(Z<X.length){let Y=W5(X,Z);if(!Y)break;let J=m5(Y.attrs,"v-html");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=z1(X,Y),Q=u1(Y.attrs,"v-html"),w=Y.selfClosing?" /":"",q=`<${Y.tag}${Q}${w}>{!! ${J} !!}</${Y.tag}>`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function l_($){let X=$,Z=0;while(Z<X.length){let Y=W5(X,Z);if(!Y)break;let J=m5(Y.attrs,"v-text");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=z1(X,Y),Q=u1(Y.attrs,"v-text"),w=Y.selfClosing?" /":"",q=`<${Y.tag}${Q}${w}>{{ ${J} }}</${Y.tag}>`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function c_($){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 p_($){let X=$,Z=0;while(Z<X.length){let Y=W5(X,Z);if(!Y)break;if(!KQ(Y.attrs,"v-once")){Z=Y.end;continue}let J=u1(Y.attrs,"v-once"),G=z1(X,Y),Q=X.slice(G.outerStart,G.outerEnd),q=`@once
|
|
12325
12325
|
${d1(Q,{...Y,start:0,end:Y.end-Y.start},J)}
|
|
12326
|
-
@endonce`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function
|
|
12327
|
-
${Y}${$.slice(Z)}`}function
|
|
12328
|
-
${G[0]}`+Q+$.slice(Z+J.length)}function
|
|
12329
|
-
${X[0]}${Y.slice(J)}`}var
|
|
12330
|
-
<meta name="stx-build" content="${X}">${$.slice(Y)}`}var
|
|
12331
|
-
${$.slice(X)}`}function
|
|
12326
|
+
@endonce`;X=X.slice(0,G.outerStart)+q+X.slice(G.outerEnd),Z=G.outerStart+q.length}return X}function i_($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function n_($){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 zQ($){if(!v_($))return $;let X=$;return X=x_(X),X=f_(X),X=p_(X),X=u_(X),X=d_(X),X=h_(X),X=g_(X),X=n_(X),X=m_(X),X=l_(X),X=c_(X),X=i_(X),X}var S_,C_;var UQ=y(()=>{S_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),C_=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 Q9($){return $.replace(/--/g,"- -").replace(/</g,"<").replace(/>/g,">")}function jQ($,X){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),Y=Z?Z[1]:$,J=Y0(Y,X);if(J&&typeof J==="string")return J;let G=Y.trim();return M4.has(G)?G:null}function BQ($){let X=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return X?X[1]:$}function _Q($,X,Z){let Y=X.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=Y?`<${$} ${Y}>`:`<${$}>`;if(r_.has($))return Y?`<${$} ${Y}>`:`<${$}>`;return`${J}${Z}</${$}>`}async function HQ($,X,Z,Y,J){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=jQ(K.expr,X);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${Q9(BQ(K.expr))}" -->`;G=G.slice(0,K.index)+O+G.slice(K.index+K.full.length);continue}if(M4.has(z)){let O=_Q(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]=Y0(F,X)}catch{B[O]=F}else B[O]=F}let H=Y.componentsDir||"components",L=await $5(z,B,K.slotContent,H,X,Z,Y,new Set,J??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: ${Q9(U)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G=await o_(G,X,Z,Y,J),G}async function o_($,X,Z,Y,J){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=jQ(K.expr,X);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${Q9(BQ(K.expr))}" -->`;G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length);continue}if(M4.has(z)){let j=_Q(z,K.attrs,"");G=G.slice(0,K.index)+j+G.slice(K.index+K.full.length);continue}let U=Y.componentsDir||"components",B=await $5(z,{},"",U,X,Z,Y,new Set,J??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: ${Q9(U)} -->`;G=G.slice(0,K.index)+B+G.slice(K.index+K.full.length)}}return G}var M4,r_;var OQ=y(()=>{k0();T0();M4=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"]),r_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function $H($){let X=$.storageKey??"stx-color-mode",Z=$.initialMode??"auto",Y=$.darkClass===void 0?"dark":$.darkClass,J=$.attribute??null,G=$.autoValue??null;if(typeof X!=="string"||X.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!s_.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(Y!==null&&(typeof Y!=="string"||!e_.test(Y)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!t_.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(G!==null&&!a_.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(Y===null&&J===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:X,initialMode:Z==="system"?"auto":Z,darkClass:Y,attribute:J,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 I4($={}){let X=$H($);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 LQ($,X={}){if($.includes("data-stx-color-mode-boot"))return $;let Z=k4($);if(Z===null)return $;let Y=I4(X);return`${$.slice(0,Z)}
|
|
12327
|
+
${Y}${$.slice(Z)}`}function k4($){let X=/<head\b[^>]*>/i.exec($);if(!X)return null;let Z=X.index+X[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(Z));if(Y)Z+=Y[0].length;return Z}function JH($){let X=/<head\b[^>]*>/i.exec($);if(!X)return $;let Z=X.index+X[0].length,Y=$.toLowerCase().indexOf("</head>",Z),J=$.slice(Z,Y===-1?$.length:Y),G=YH.exec(J);if(!G||J.slice(0,G.index).trim()==="")return $;let Q=J.slice(0,G.index)+J.slice(G.index+G[0].length);return $.slice(0,Z)+`
|
|
12328
|
+
${G[0]}`+Q+$.slice(Z+J.length)}function FQ($){return GH(JH($))}function GH($){let X=ZH.exec($);if(!X)return $;let Z=k4($);if(Z===null)return $;if(X.index<=Z||$.slice(Z,X.index).trim()==="")return $;let Y=$.slice(0,X.index)+$.slice(X.index+X[0].length),J=k4(Y);if(J===null)return $;return`${Y.slice(0,J)}
|
|
12329
|
+
${X[0]}${Y.slice(J)}`}var s_,a_,t_,e_,ZH,YH;var E4=y(()=>{s_=new Set(["light","dark","auto","system"]),a_=new Set(["auto","system"]),t_=/^[a-z][\w:-]*$/i,e_=/^[\w-]+$/;ZH=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),YH=/<meta\b[^>]*\bcharset\b[^>]*>/i});function QH(){if(D4===null)D4=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return D4}function VQ($,X=QH()){if($.includes('name="stx-build"'))return $;let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let Y=Z.index+Z[0].length;return`${$.slice(0,Y)}
|
|
12330
|
+
<meta name="stx-build" content="${X}">${$.slice(Y)}`}var D4=null;function R1($){return String($).replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function wH($){return String($).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">")}function y4($){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 l5($,X){return Object.entries($).filter(([Z])=>!X?.(Z)).map(([Z,Y])=>`${Z}="${R1(String(Y))}"`).join(" ")}function qH($={},X="en"){let Z=[],Y=[],J="",G=X;for(let[w,q]of Object.entries($||{})){if(q==null)continue;let W=w.trim();if(!RQ.test(W))continue;let K=W.toLowerCase();if(K==="lang"){G=String(q);continue}if(K==="class"){J=String(q).trim();continue}Z.push(` ${W}="${R1(String(q))}"`),Y.push(W)}let Q=` lang="${R1(G)}"`;if(J)Q+=` class="${R1(J)}"`;if(Q+=Z.join(""),J)Q+=` ${q9}="${R1(J)}"`;if(Y.length)Q+=` ${w9}="${R1(Y.join(" "))}"`;return Q}function NQ($={},X={}){let Z={...$,...X};if($.class&&X.class){let Y=$.class.split(/\s+/).filter(Boolean);for(let J of X.class.split(/\s+/).filter(Boolean))if(!Y.includes(J))Y.push(J);Z.class=Y.join(" ")}return Z}function TQ($,X={}){if(!X||Object.keys(X).length===0)return $;let Z=$.match(/<html\b([^>]*)>/i);if(!Z)return $;let Y={},J=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let K=Q[1];if(!(K in Y))J.push(K);Y[K]=Q[2]??Q[3]??Q[4]??""}let w=[],q=[];for(let[K,z]of Object.entries(X)){if(z==null)continue;let U=K.trim();if(!RQ.test(U))continue;let B=U.toLowerCase();if(B==="class"){let j=(Y.class||"").split(/\s+/).filter(Boolean);for(let _ of String(z).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),w.push(_);if(!("class"in Y))J.push("class");Y.class=j.join(" ");continue}if(!(U in Y))J.push(U);if(Y[U]=String(z),B!=="lang")q.push(U)}if(w.length){if(!(q9 in Y))J.push(q9);Y[q9]=w.join(" ")}if(q.length){if(!(w9 in Y))J.push(w9);Y[w9]=q.join(" ")}let W=J.map((K)=>` ${K}="${R1(Y[K])}"`).join("");return $.replace(Z[0],()=>`<html${W}>`)}function MQ($){if($.includes("data-stx-cloak"))return $;let X=$.lastIndexOf("</head>");if(X===-1)return $;return`${$.slice(0,X)}${AQ}
|
|
12331
|
+
${$.slice(X)}`}function WH($){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 Y="",J=0;while(J<$.length&&J<Z){let G=$.slice(J),Q=G.match(/^<link\b[^>]*>/i);if(Q&&X.includes(Q[0])){J+=Q[0].length;continue}let w=G.match(/^<meta\b[^>]*>/i);if(w&&X.includes(w[0])){J+=w[0].length;continue}let q=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&X.includes(q[0])){J+=q[0].length;continue}Y+=$[J],J++}return Y+=$.slice(Z),{body:Y,hoisted:X}}function KH($,X={},Z={}){let{title:Y="stx App",lang:J="en",meta:G=[],link:Q=[],script:w=[],headRaw:q="",htmlAttrs:W={},bodyClass:K="",bodyAttrs:z={}}=X,U=Z.title||Y,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],j=new Set(G.map(y4).filter(Boolean)),H=[...B.filter((k)=>!j.has(y4(k))),...G].map((k)=>{return` <meta ${l5(k)}>`}).join(`
|
|
12332
12332
|
`),L=Q.map((k)=>{return` <link ${l5(k)}>`}).join(`
|
|
12333
12333
|
`),O=w.map((k)=>{if(k.src)return` <script ${l5(k,(D)=>D==="content")}></script>`;if(k.content)return` <script>${k.content}</script>`;return""}).filter(Boolean).join(`
|
|
12334
|
-
`),F=
|
|
12334
|
+
`),F=qH(W,J),V=Object.entries(z).map(([k,D])=>` ${k}="${R1(String(D))}"`).join(""),A=K?` class="${R1(K)}"`:"",{body:R,hoisted:N}=WH($),T=[H,Z.colorMode?` ${I4(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?U:wH(U)}</title>`,` ${AQ}`,L,O,q?` ${q}`:"",...(Z.styles||[]).map((k)=>` ${k}`),...N.map((k)=>` ${k}`),...(Z.headScripts||[]).map((k)=>` ${k}`),Z.headStack||""].filter(Boolean),M=[R,...(Z.bodyScripts||[]).map((k)=>k),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
|
|
12335
12335
|
<html${F}>
|
|
12336
12336
|
<head>
|
|
12337
12337
|
${T.join(`
|
|
@@ -12341,23 +12341,23 @@ ${T.join(`
|
|
|
12341
12341
|
${M.join(`
|
|
12342
12342
|
`)}
|
|
12343
12343
|
</body>
|
|
12344
|
-
</html>`}function
|
|
12344
|
+
</html>`}function b4($){let X=0;while(X<$.length){let Z=$.slice(X),Y=Z.match(/^\s+/);if(Y){X+=Y[0].length;continue}if(Z.startsWith("<!--")){let G=$.indexOf("-->",X);if(G===-1)return!1;X=G+3;continue}let J=Z.match(/^<(script|style)\b[^>]*>/i);if(J){let G=`</${J[1].toLowerCase()}>`,Q=$.toLowerCase().indexOf(G,X+J[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 S4($){return b4($)}function kQ($,X={}){let Z=$.lastIndexOf("</head>");if(Z===-1)return $;let{meta:Y=[],link:J=[],script:G=[],headRaw:Q=""}=X,w=$.slice(0,Z),q=[];for(let W of Y){let K=y4(W);if(K&&w.includes(K))continue;q.push(` <meta ${l5(W)}>`)}for(let W of J){if(W.href&&w.includes(`href="${W.href}"`))continue;q.push(` <link ${l5(W)}>`)}for(let W of G)if(W.src){if(w.includes(`src="${W.src}"`))continue;q.push(` <script ${l5(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(`
|
|
12345
12345
|
`)}
|
|
12346
|
-
${$.slice(Z)}`}function
|
|
12346
|
+
${$.slice(Z)}`}function IQ($,X={},Z={}){if(S4($))return $;return KH($,X,Z)}var AQ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",w9="data-stx-html-attrs",q9="data-stx-html-class",RQ;var EQ=y(()=>{E4();RQ=/^[A-Za-z_:][\w:.-]*$/});import c5 from"path";function DQ($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function yQ($,X,Z){try{let Y;if($.startsWith("/")){let J=X;for(let G=0;G<5;G++){let Q=c5.join(J,$);if(await Bun.file(Q).exists())return Q;J=c5.dirname(J)}Y=c5.join(X,$)}else if($.startsWith("./")||$.startsWith("../"))Y=c5.resolve(X,$);else Y=c5.resolve(X,$);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function bQ($,X,Z){let Y=$,J=c5.dirname(X),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(Y))!==null){let[W,K,z,U]=Q;if(DQ(z))continue;let B=await yQ(z,J,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:g0()});if(H.outputs.length>0)j=await H.outputs[0].text()}let _=`<script>
|
|
12347
12347
|
// Source: ${z}
|
|
12348
12348
|
${j}
|
|
12349
|
-
</script>`;Y=Y.replace(W,_),G.lastIndex=0}catch(j){}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=w.exec(Y))!==null){let[W,K,z,U]=q,B=K+U;if(
|
|
12349
|
+
</script>`;Y=Y.replace(W,_),G.lastIndex=0}catch(j){}}let w=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=w.exec(Y))!==null){let[W,K,z,U]=q,B=K+U;if(DQ(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let _=await yQ(z,J,X);if(_)try{let H=await Bun.file(_).text();Z.add(_);let L=`<style>
|
|
12350
12350
|
/* Source: ${z} */
|
|
12351
12351
|
${H}
|
|
12352
|
-
</style>`;Y=Y.replace(W,L),w.lastIndex=0}catch(H){}}}return Y}var
|
|
12352
|
+
</style>`;Y=Y.replace(W,L),w.lastIndex=0}catch(H){}}}return Y}var SQ=y(()=>{E1()});function C4($,X){let Z=$,Y=/@json\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index,Q=G+J[0].length-1,w=1,q=Q+1,W=null,K=!1;while(q<Z.length&&w>0){let F=Z[q];if(K){K=!1,q++;continue}if(F==="\\"&&W){K=!0,q++;continue}if(W){if(F===W)W=null;q++;continue}if(F==='"'||F==="'"||F==="`"){W=F,q++;continue}if(F==="(")w++;else if(F===")"){if(w--,w===0)break}q++}if(w!==0)break;let 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),Y.lastIndex=G+R.length}catch(F){X1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),Y.lastIndex=G+U.length}}return Z}function P4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function CQ($){let X=$,Z=/@memo\s*\(/g,Y,J=[];while((Y=Z.exec(X))!==null){let G=Y.index,Q=G+Y[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,M="",k]=A,D=`<${T}${M} data-stx-memo="${W}"${k}>`;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)}`;J.push({start:G,end:j,replacement:R}),Z.lastIndex=j}for(let G=J.length-1;G>=0;G--){let Q=J[G];X=X.slice(0,Q.start)+Q.replacement+X.slice(Q.end)}return X.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function v4($){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 PQ($){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",J=0,G;while((G=Z.exec($))!==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))Y+=$.slice(J,K)+" x-cloak>",J=K+1}return Y+=$.slice(J),Y}function vQ($){let X=/<[a-z][\w-]*/gi,Z="",Y=0,J;while((J=X.exec($))!==null){let G=J.index,Q=J[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+J[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+J[0].length,K);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!zH.test(z))continue;let U=$[K-1]==="/",B=U?K-1:K;Z+=`${$.slice(Y,B)} x-cloak${U?" ":""}`,Y=B}return Z+=$.slice(Y),Z}var zH;var x4=y(()=>{V1();T0();zH=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function f4($,X,Z,Y){let J=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=J.allowPatterns??[],Q=[];for(let{pattern:w,message:q,suggestion:W}of UH){if(G.some((z)=>/\w/.test(z)&&q.includes(z)))continue;w.lastIndex=0;let K=$.match(w);if(K&&K.length>0){let z=$.split(`
|
|
12353
12353
|
`),U=[];z.forEach((H,L)=>{if(w.lastIndex=0,w.test(H))U.push(L+1)});let B=U.length>0?` (script line${U.length>1?"s":""} ${U.join(", ")})`:"",j=U.slice(0,3).map((H)=>` ${H} | ${(z[H-1]??"").trim().slice(0,100)}`).join(`
|
|
12354
12354
|
`),_=j?`
|
|
12355
12355
|
${j}`:"";Q.push(` \u2717 ${q}${B}
|
|
12356
12356
|
\u2192 ${W}${_}`)}}if(Q.length>0&&J.enabled){let w=(K)=>{let z=`${process.cwd()}/`;return K.startsWith(z)?K.slice(z.length):K},W=`[STX] DOM API violation in ${Y&&Y!==X?`${w(Y)} (composed into ${w(X)})`:w(X)}:
|
|
12357
12357
|
${Q.join(`
|
|
12358
12358
|
`)}
|
|
12359
|
-
Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(W);else console.warn(W)}}var
|
|
12360
|
-
`)}function K9($,X,Z){let Y=$.get(X);return Y!==void 0&&Y.signature===Z?Y.value:void 0}function U1($,X,Z,Y){return $.set(X,{signature:Z,value:Y}),Y}var
|
|
12359
|
+
Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(W);else console.warn(W)}}var UH;var g4=y(()=>{UH=[{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 jH from"fs";function W9($){return[...$].sort().map((X)=>{try{let Z=jH.statSync(X);return`${X}:${Z.size}:${Z.mtimeMs}`}catch{return`${X}:missing`}}).join(`
|
|
12360
|
+
`)}function K9($,X,Z){let Y=$.get(X);return Y!==void 0&&Y.signature===Z?Y.value:void 0}function U1($,X,Z,Y){return $.set(X,{signature:Z,value:Y}),Y}var h4=()=>{};var xQ={};a(xQ,{getStoreScript:()=>_H,clearStoreCache:()=>HH});import z9 from"path";function BH($,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 Y of(Z[1]??"").split(",")){let G=((Y.includes(":")?Y.split(":").pop():Y)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))X.add(G)}for(let Z of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let Y of(Z[1]??"").split(",")){let J=Y.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))X.add(J)}}async function _H($){let X;if($)X=z9.resolve($);else{let j=await e0();X=z9.resolve(j.root||process.cwd(),j.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),Y=[];try{for await(let j of Z.scan({cwd:X,absolute:!0})){let _=z9.basename(j,".ts");if(["index","types"].includes(_))continue;if(j.includes(".d.ts"))continue;Y.push(j)}}catch{return U1(p5,X,"",""),null}let J=W9(Y),G=K9(p5,X,J);if(G!==void 0)return G||null;if(Y.length===0)return U1(p5,X,J,""),null;let Q=[];for(let j of Y){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:g0()});for(let j of w)try{let _=await Bun.file(j).text(),H=z9.basename(j,".ts");BH(_,W),_=l0(_),_=V8(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=K.transformSync(_),q.push(`// Store: ${H}
|
|
12361
12361
|
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${j}:`,_)}if(q.length===0)return U1(p5,X,J,""),null;let z=q.join(`
|
|
12362
12362
|
|
|
12363
12363
|
`),B=`;(function(){
|
|
@@ -12365,8 +12365,8 @@ var __stx = window.stx || {};
|
|
|
12365
12365
|
${O1.filter((j)=>!W.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
|
|
12366
12366
|
`)}
|
|
12367
12367
|
${z}
|
|
12368
|
-
})();`;return U1(p5,X,J,B),B}function
|
|
12369
|
-
${Q.transformSync(_).trim()}`);for(let L of H)W.add(L)}catch(L){console.warn(`[stx] framework composable ${U9.basename(j)} could not be bundled:`,L)}}let z=Z.filter((j)=>!W.has(j)&&!
|
|
12368
|
+
})();`;return U1(p5,X,J,B),B}function HH(){p5.clear()}var p5;var fQ=y(()=>{L1();E1();w1();h4();p5=new Map});var u4,UI;var gQ=y(()=>{u4=["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"],UI=new Set(u4)});var dQ={};a(dQ,{selectComposableFiles:()=>hQ,referencedFrameworkComposables:()=>uQ,getFrameworkComposableScript:()=>VH,clearFrameworkComposableCache:()=>LH,__setRuntimeOwnedForTest:()=>AH});import U9 from"path";function LH(){X8.clear()}function hQ($){let X=new Map;for(let Z of $){let Y=U9.basename(Z);if(Y.endsWith(".d.ts"))continue;let J=Y.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===Y)continue;let G=X.get(J);if(G&&!G.endsWith(".js"))continue;X.set(J,Z)}return[...X.values()].sort()}function FH($,X){let Z=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test($)}function uQ($){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 Y of OH){if(d4.has(Y))continue;let J=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test(X))Z.push(Y)}return Z.sort()}async function VH($,X){let Z=uQ($);if(Z.length===0)return null;let Y=X??U9.join(import.meta.dir,"composables"),J=`${Y}\x00${Z.join(",")}`,G=X8.get(J);if(G!==void 0)return G||null;let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),w=new Set(Z),q=[],W=new Set,K=[];try{let j=new Bun.Glob("*.{ts,js}");for await(let _ of j.scan({cwd:Y,absolute:!0}))K.push(_)}catch{return X8.set(J,""),null}K=hQ(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(`// ${U9.basename(j).replace(/\.[jt]s$/,"")}
|
|
12369
|
+
${Q.transformSync(_).trim()}`);for(let L of H)W.add(L)}catch(L){console.warn(`[stx] framework composable ${U9.basename(j)} could not be bundled:`,L)}}let z=Z.filter((j)=>!W.has(j)&&!FH($,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 X8.set(J,""),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(`
|
|
12370
12370
|
`),B=`<script data-stx-framework-composables>
|
|
12371
12371
|
;(function(){
|
|
12372
12372
|
var __s = window.stx = window.stx || {};
|
|
@@ -12375,7 +12375,7 @@ ${q.join(`
|
|
|
12375
12375
|
`)}
|
|
12376
12376
|
${U}
|
|
12377
12377
|
})();
|
|
12378
|
-
</script>`;return X8.set(J,B),B}function
|
|
12378
|
+
</script>`;return X8.set(J,B),B}function AH($){d4.clear();for(let X of $)d4.add(X)}var X8,d4,OH;var mQ=y(()=>{E1();gQ();X8=new Map,d4=new Set,OH=new Set(u4)});var cQ={};a(cQ,{getComposableScript:()=>MH,clearComposableCache:()=>kH});import Z8 from"path";function lQ($){let X=Z8.basename($,".ts");return X==="index"||X==="types"||$.endsWith(".d.ts")}async function NH($){if($)return Z8.resolve($);let X=`<default>:${process.cwd()}`,Z=m4.get(X);if(Z!==void 0)return Z;let Y=await TH();if(Y!==null)m4.set(X,Y);return Y}async function TH(){let $=await e0(),X=$.root||process.cwd(),Z=$.composablesDir;if(Z)return Z8.resolve(X,Z);for(let Y of RH){let J=Z8.resolve(X,Y);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:J,absolute:!0}))if(!lQ(Q))return J}catch{}}return null}async function MH($){let X=await NH($);if(!X)return null;let Z=[];try{let j=new Bun.Glob("**/*.ts");for await(let _ of j.scan({cwd:X,absolute:!0})){if(lQ(_))continue;Z.push(_)}}catch{return U1(i5,X,"",""),null}let Y=W9(Z),J=K9(i5,X,Y);if(J!==void 0)return J||null;if(Z.length===0)return U1(i5,X,Y,""),null;Z.sort();let G=new Bun.Transpiler({loader:"ts",target:"browser",define:g0()}),Q=[],w=new Set,q=new Set;for(let j of Z)try{let _=await Bun.file(j).text(),H=Z8.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{}_=l0(_),_=V8(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=G.transformSync(_),Q.push(`// Composable: ${H}
|
|
12379
12379
|
${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${j}:`,_)}if(Q.length===0||w.size===0)return U1(i5,X,Y,""),null;let W=[...w].map((j)=>` try { __c[${JSON.stringify(j)}] = ${j}; } catch (e) {}`).join(`
|
|
12380
12380
|
`),K=JSON.stringify([...w]),z=Q.join(`
|
|
12381
12381
|
|
|
@@ -12400,7 +12400,7 @@ ${W}
|
|
|
12400
12400
|
}
|
|
12401
12401
|
window[__n] = __c[__n];
|
|
12402
12402
|
}
|
|
12403
|
-
})();`;return U1(i5,X,Y,B),B}function
|
|
12403
|
+
})();`;return U1(i5,X,Y,B),B}function kH(){i5.clear(),m4.clear()}var i5,m4,RH;var pQ=y(()=>{L1();E1();h4();w1();i5=new Map,m4=new Map,RH=["composables","functions"]});var nQ={};a(nQ,{processDeferDirectives:()=>bH});function IH(){return`stx-defer-${++iQ}`}function EH($){let X=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(X)return{trigger:X[1],value:X[2]};return{trigger:"immediate"}}function DH($,X,Z){let{trigger:Y,value:J}=EH(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:Y,triggerValue:J,content:G,placeholder:Q,loading:w,error:q}}function yH($,X){let{trigger:Z,triggerValue:Y}=X,J;switch(Z){case"visible":J=`
|
|
12404
12404
|
const observer = new IntersectionObserver((entries) => {
|
|
12405
12405
|
if (entries[0].isIntersecting) {
|
|
12406
12406
|
observer.disconnect();
|
|
@@ -12473,7 +12473,7 @@ else {
|
|
|
12473
12473
|
${J}
|
|
12474
12474
|
})();
|
|
12475
12475
|
</script>
|
|
12476
|
-
`}function
|
|
12476
|
+
`}function bH($,X,Z){iQ=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(Y,(J,G,Q)=>{let w=IH(),q=DH(J,G,Q),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",K=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',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=yH(w,q);return`
|
|
12477
12477
|
<div id="${w}" class="stx-defer" data-defer-trigger="${q.trigger}">
|
|
12478
12478
|
${W}
|
|
12479
12479
|
${K}
|
|
@@ -12481,7 +12481,7 @@ else {
|
|
|
12481
12481
|
${z}
|
|
12482
12482
|
</div>
|
|
12483
12483
|
${B}
|
|
12484
|
-
`})}var
|
|
12484
|
+
`})}var iQ=0;var oQ={};a(oQ,{processTeleportDirectives:()=>vH,ensureTeleportTargets:()=>xH});function SH(){return`stx-teleport-${++rQ}`}function CH($){let X=$.split(",").map((J)=>J.trim()),Z=X[0].replace(/['"]/g,""),Y;for(let J=1;J<X.length;J++){let G=X[J].match(/disabled:\s*(.+)/);if(G)Y=G[1].trim()}return{target:Z,disabled:Y}}function PH($,X){return`
|
|
12485
12485
|
<script>
|
|
12486
12486
|
(function() {
|
|
12487
12487
|
const source = document.getElementById('${$}');
|
|
@@ -12527,12 +12527,12 @@ else {
|
|
|
12527
12527
|
});
|
|
12528
12528
|
})();
|
|
12529
12529
|
</script>
|
|
12530
|
-
`}function
|
|
12530
|
+
`}function vH($,X,Z){rQ=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(Y,(J,G,Q)=>{let w=SH(),{target:q,disabled:W}=CH(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=PH(w,q);return`
|
|
12531
12531
|
<div id="${w}" class="stx-teleport-source" style="display: none;">
|
|
12532
12532
|
<template>${K}</template>
|
|
12533
12533
|
</div>
|
|
12534
12534
|
${z}
|
|
12535
|
-
`})}function
|
|
12535
|
+
`})}function xH(){return`
|
|
12536
12536
|
<script>
|
|
12537
12537
|
(function() {
|
|
12538
12538
|
// Common teleport targets
|
|
@@ -12549,7 +12549,7 @@ else {
|
|
|
12549
12549
|
});
|
|
12550
12550
|
})();
|
|
12551
12551
|
</script>
|
|
12552
|
-
`}var
|
|
12552
|
+
`}var rQ=0;var eQ={};a(eQ,{processTransitionDirectives:()=>uH,processTransitionAttributes:()=>cH,performLeave:()=>hH,performEnter:()=>gH,generateTransitionRuntime:()=>lH,generateTransitionCSS:()=>mH});function sQ($,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 fH($){let X=getComputedStyle($),Z=X.transitionDuration||"0s",Y=X.animationDuration||"0s",J=(G)=>{let Q=G.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let w=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?w:w*1000};return Math.max(J(Z),J(Y))}function aQ($,X){return new Promise((Z)=>{let Y=X??fH($);if(Y===0){Z();return}let J=!1,G=()=>{if(J)return;J=!0,$.removeEventListener("transitionend",Q),$.removeEventListener("animationend",Q),Z()},Q=(w)=>{if(w.target===$)G()};$.addEventListener("transitionend",Q),$.addEventListener("animationend",Q),setTimeout(G,Y+50)})}function tQ($){$.offsetHeight}async function gH($,X={}){let Z=X.name||"stx",Y=sQ(Z,X),J=typeof X.duration==="object"?X.duration.enter:X.duration;if(X.onBeforeEnter?.($),$.classList.add(Y.enterFrom),$.classList.add(Y.enterActive),tQ($),$.classList.remove(Y.enterFrom),$.classList.add(Y.enterTo),X.onEnter)await new Promise((G)=>{X.onEnter($,G)});else await aQ($,J);$.classList.remove(Y.enterActive),$.classList.remove(Y.enterTo),X.onAfterEnter?.($)}async function hH($,X={}){let Z=X.name||"stx",Y=sQ(Z,X),J=typeof X.duration==="object"?X.duration.leave:X.duration;if(X.onBeforeLeave?.($),$.classList.add(Y.leaveFrom),$.classList.add(Y.leaveActive),tQ($),$.classList.remove(Y.leaveFrom),$.classList.add(Y.leaveTo),X.onLeave)await new Promise((G)=>{X.onLeave($,G)});else await aQ($,J);$.classList.remove(Y.leaveActive),$.classList.remove(Y.leaveTo),X.onAfterLeave?.($)}function uH($,X={},Z){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(Y,(J,G,Q)=>{let w=dH(G),q=w.name||"stx",W=w.duration||300,K=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
|
|
12553
12553
|
<div
|
|
12554
12554
|
class="stx-transition-wrapper"
|
|
12555
12555
|
data-transition="${q}"
|
|
@@ -12591,7 +12591,7 @@ else {
|
|
|
12591
12591
|
});
|
|
12592
12592
|
})();
|
|
12593
12593
|
</script>
|
|
12594
|
-
`})}function
|
|
12594
|
+
`})}function dH($){let X={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec($))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4]||Y[5];switch(J){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 mH(){return`
|
|
12595
12595
|
/* STX Transition Presets */
|
|
12596
12596
|
|
|
12597
12597
|
/* Fade */
|
|
@@ -12778,7 +12778,7 @@ else {
|
|
|
12778
12778
|
opacity: 1;
|
|
12779
12779
|
max-height: 1000px;
|
|
12780
12780
|
}
|
|
12781
|
-
`}function
|
|
12781
|
+
`}function lH(){return`
|
|
12782
12782
|
// STX Transition Runtime
|
|
12783
12783
|
(function() {
|
|
12784
12784
|
if (typeof window === 'undefined') return;
|
|
@@ -12867,7 +12867,7 @@ else {
|
|
|
12867
12867
|
|
|
12868
12868
|
console.log('[stx] Transition runtime initialized');
|
|
12869
12869
|
})();
|
|
12870
|
-
`}function
|
|
12870
|
+
`}function cH($){let X=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(X,(Z,Y,J,G)=>{let Q=J||"300",w=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${w}"`})}var Xw={};a(Xw,{withErrorBoundary:()=>$w,processErrorBoundaryDirectives:()=>nH,generateErrorBoundaryRuntime:()=>tH,generateErrorBoundaryCSS:()=>aH,createErrorBoundary:()=>sH});function iH(){return`eb-${++pH}-${Date.now().toString(36)}`}function nH($,X={},Z){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(Y,(J,G,Q,w)=>{let q=iH(),W=rH(G||"");return oH(q,Q.trim(),w.trim(),W)})}function rH($){let X={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=Z.exec($))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4];switch(J){case"id":X.id=G;break;case"logErrors":X.logErrors=G==="true";break}}return X}function oH($,X,Z,Y){let J=Y.logErrors!==!1;return`
|
|
12871
12871
|
<div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
|
|
12872
12872
|
<div class="stx-error-boundary-content" data-boundary-content="${$}">
|
|
12873
12873
|
${X}
|
|
@@ -12987,7 +12987,7 @@ else {
|
|
|
12987
12987
|
};
|
|
12988
12988
|
})();
|
|
12989
12989
|
</script>
|
|
12990
|
-
`}async function
|
|
12990
|
+
`}async function $w($,X,Z){try{return await $()}catch(Y){if(Z)Z(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return X}}function sH($,X={}){let Z=X.onError?(Y)=>X.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>$w(Y,$,Z)}function aH(){return`
|
|
12991
12991
|
/* STX Error Boundary Styles */
|
|
12992
12992
|
.stx-error-boundary {
|
|
12993
12993
|
position: relative;
|
|
@@ -13031,7 +13031,7 @@ else {
|
|
|
13031
13031
|
color: #fecaca;
|
|
13032
13032
|
}
|
|
13033
13033
|
}
|
|
13034
|
-
`}function
|
|
13034
|
+
`}function tH(){return`
|
|
13035
13035
|
// STX Error Boundary Runtime
|
|
13036
13036
|
(function() {
|
|
13037
13037
|
if (typeof window === 'undefined') return;
|
|
@@ -13096,7 +13096,7 @@ else {
|
|
|
13096
13096
|
|
|
13097
13097
|
console.log('[stx] Error boundary runtime initialized');
|
|
13098
13098
|
})();
|
|
13099
|
-
`}var
|
|
13099
|
+
`}var pH=0;var Zw={};a(Zw,{renderSSRSuspense:()=>GO,processSuspenseDirectives:()=>XO,generateSuspenseRuntime:()=>wO,generateSuspenseCSS:()=>QO,createSSRSuspense:()=>JO});function $O(){return`suspense-${++eH}-${Date.now().toString(36)}`}function XO($,X={},Z){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(Y,(J,G,Q,w)=>{let q=$O(),W=ZO(G||"");return YO(q,Q.trim(),w.trim(),W)})}function ZO($){let X={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec($))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"id":X.id=G;break;case"timeout":X.timeout=Q?parseInt(Q,10):void 0;break}}return X}function YO($,X,Z,Y){let J=Y.timeout||30000,G=Y.id||$;return`
|
|
13100
13100
|
<div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${G}" data-status="pending">
|
|
13101
13101
|
<div class="stx-suspense-fallback" data-suspense-fallback="${$}">
|
|
13102
13102
|
${Z}
|
|
@@ -13286,7 +13286,7 @@ else {
|
|
|
13286
13286
|
}, 0);
|
|
13287
13287
|
})();
|
|
13288
13288
|
</script>
|
|
13289
|
-
`}function
|
|
13289
|
+
`}function JO($,X,Z){return{id:$,fallback:Z,content:X}}async function GO($){let X=$.map((Y)=>`
|
|
13290
13290
|
<div id="stx-ssr-suspense-${Y.id}" class="stx-ssr-suspense">
|
|
13291
13291
|
${Y.fallback}
|
|
13292
13292
|
</div>
|
|
@@ -13311,7 +13311,7 @@ else {
|
|
|
13311
13311
|
}
|
|
13312
13312
|
})();
|
|
13313
13313
|
</script>
|
|
13314
|
-
`}}return{initial:X,streaming:Z()}}function
|
|
13314
|
+
`}}return{initial:X,streaming:Z()}}function QO(){return`
|
|
13315
13315
|
/* STX Suspense Styles */
|
|
13316
13316
|
.stx-suspense {
|
|
13317
13317
|
position: relative;
|
|
@@ -13367,7 +13367,7 @@ else {
|
|
|
13367
13367
|
background-size: 200% 100%;
|
|
13368
13368
|
}
|
|
13369
13369
|
}
|
|
13370
|
-
`}function
|
|
13370
|
+
`}function wO(){return`
|
|
13371
13371
|
// STX Suspense Runtime
|
|
13372
13372
|
(function() {
|
|
13373
13373
|
if (typeof window === 'undefined') return;
|
|
@@ -13434,7 +13434,7 @@ else {
|
|
|
13434
13434
|
|
|
13435
13435
|
console.log('[stx] Suspense runtime initialized');
|
|
13436
13436
|
})();
|
|
13437
|
-
`}var
|
|
13437
|
+
`}var eH=0;var Qw={};a(Qw,{processAsyncDirectives:()=>WO,isAsyncComponent:()=>zO,generateAsyncComponentRuntime:()=>jO,generateAsyncComponentCSS:()=>UO,defineAsyncComponent:()=>KO});function Yw(){return`async-${++qO}-${Date.now().toString(36)}`}function WO($,X={},Z){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,G=$;return G=G.replace(Y,(Q,w,q,W)=>{let K=Yw(),z=Jw(w);return Gw(K,z,q.trim(),W.trim())}),G=G.replace(J,(Q,w,q)=>{let W=Yw(),K=Jw(w);return Gw(W,K,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function Jw($){let X={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec($))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4],w=Y[5];switch(J){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 Gw($,X,Z,Y){let{component:J,timeout:G,delay:Q,suspensible:w,retries:q}=X;return`
|
|
13438
13438
|
<div class="stx-async-component" data-async-id="${$}" data-component="${J}" data-status="pending">
|
|
13439
13439
|
<div class="stx-async-loading" data-async-loading="${$}">
|
|
13440
13440
|
${Z}
|
|
@@ -13661,7 +13661,7 @@ catch (error) {
|
|
|
13661
13661
|
loadComponent();
|
|
13662
13662
|
})();
|
|
13663
13663
|
</script>
|
|
13664
|
-
`}function
|
|
13664
|
+
`}function KO($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function zO($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function UO(){return`
|
|
13665
13665
|
/* STX Async Component Styles */
|
|
13666
13666
|
.stx-async-component {
|
|
13667
13667
|
position: relative;
|
|
@@ -13735,7 +13735,7 @@ catch (error) {
|
|
|
13735
13735
|
background-size: 200% 100%;
|
|
13736
13736
|
}
|
|
13737
13737
|
}
|
|
13738
|
-
`}function
|
|
13738
|
+
`}function jO(){return`
|
|
13739
13739
|
// STX Async Component Runtime
|
|
13740
13740
|
(function() {
|
|
13741
13741
|
if (typeof window === 'undefined') return;
|
|
@@ -13789,7 +13789,7 @@ catch (error) {
|
|
|
13789
13789
|
|
|
13790
13790
|
console.log('[stx] Async component runtime initialized');
|
|
13791
13791
|
})();
|
|
13792
|
-
`}var
|
|
13792
|
+
`}var qO=0;var qw={};a(qw,{shouldCacheComponent:()=>FO,processKeepAliveDirectives:()=>_O,onDeactivated:()=>NO,onActivated:()=>RO,generateKeepAliveRuntime:()=>AO,generateKeepAliveCSS:()=>VO,createKeepAliveCache:()=>LO});function ww(){return`keep-alive-${++BO}-${Date.now().toString(36)}`}function _O($,X={},Z){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(Y,(J,G,Q)=>{let w=ww(),q=HO(G||"");return OO(w,Q.trim(),q)})}function HO($){let X={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec($))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){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 OO($,X,Z){let{max:Y,include:J,exclude:G}=Z,Q=Z.id||$;return`
|
|
13793
13793
|
<div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${Q}">
|
|
13794
13794
|
<div class="stx-keep-alive-content" data-keep-alive-content="${$}">
|
|
13795
13795
|
${X}
|
|
@@ -14076,7 +14076,7 @@ else {
|
|
|
14076
14076
|
});
|
|
14077
14077
|
})();
|
|
14078
14078
|
</script>
|
|
14079
|
-
`}function
|
|
14079
|
+
`}function LO($={}){return{id:$.id||ww(),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 FO($,X){if(X.exclude&&X.exclude.includes($))return!1;if(X.include&&!X.include.includes($))return!1;return!0}function VO(){return`
|
|
14080
14080
|
/* STX Keep-Alive Styles */
|
|
14081
14081
|
.stx-keep-alive {
|
|
14082
14082
|
position: relative;
|
|
@@ -14101,7 +14101,7 @@ else {
|
|
|
14101
14101
|
.stx-keep-alive-content > [data-activated] {
|
|
14102
14102
|
opacity: 1;
|
|
14103
14103
|
}
|
|
14104
|
-
`}function
|
|
14104
|
+
`}function AO(){return`
|
|
14105
14105
|
// STX Keep-Alive Runtime
|
|
14106
14106
|
(function() {
|
|
14107
14107
|
if (typeof window === 'undefined') return;
|
|
@@ -14137,7 +14137,7 @@ else {
|
|
|
14137
14137
|
|
|
14138
14138
|
console.log('[stx] Keep-alive runtime initialized');
|
|
14139
14139
|
})();
|
|
14140
|
-
`}function
|
|
14140
|
+
`}function RO($){if(typeof document<"u")document.addEventListener("stx:activated",(X)=>{$(X.detail)})}function NO($){if(typeof document<"u")document.addEventListener("stx:deactivated",(X)=>{$(X.detail)})}var BO=0;var jw={};a(jw,{useVirtualList:()=>Kw,processVirtualListDirectives:()=>c4,processVirtualGridDirectives:()=>Uw,processInfiniteListDirectives:()=>zw,generateVirtualListCSS:()=>Ww,default:()=>TO,createVirtualList:()=>l4});function l4($,X){let{itemHeight:Z,containerHeight:Y,overscan:J=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)-J),N=Math.ceil(Y/Z),T=Math.min(W.length-1,R+N+J*2);return{startIndex:R,endIndex:T}}function B(){let R=0,N=0,T=W.length-1;for(let M=0;M<W.length;M++){let k=z.get(M)||w;if(R+k>K){N=Math.max(0,M-J);break}R+=k}R=0;for(let M=0;M<W.length;M++){let k=z.get(M)||w;if(R+=k,R>K+Y){T=Math.min(W.length-1,M+J);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()-Y))}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 c4($,X={},Z){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(Y,(J,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+=`
|
|
14141
14141
|
<div class="virtual-item ${K.itemClass||""}"
|
|
14142
14142
|
style="position: absolute; top: ${O*K.itemHeight}px; height: ${K.itemHeight}px; width: 100%;"
|
|
14143
14143
|
data-index="${O}">
|
|
@@ -14214,7 +14214,7 @@ else {
|
|
|
14214
14214
|
};
|
|
14215
14215
|
})();
|
|
14216
14216
|
</script>
|
|
14217
|
-
`})}function
|
|
14217
|
+
`})}function Ww(){return`
|
|
14218
14218
|
.virtual-list-container {
|
|
14219
14219
|
position: relative;
|
|
14220
14220
|
overflow-y: auto;
|
|
@@ -14262,7 +14262,7 @@ else {
|
|
|
14262
14262
|
0% { background-position: 200% 0; }
|
|
14263
14263
|
100% { background-position: -200% 0; }
|
|
14264
14264
|
}
|
|
14265
|
-
`}function
|
|
14265
|
+
`}function Kw($,X){let Z=null,Y=()=>{if(!Z)Z=l4($(),X);return Z};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${X.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(J)=>{let G=J.target;if(Z)Z.scrollToOffset(G.scrollTop)}}),itemProps:(J)=>({style:{position:"absolute",top:`${J*X.itemHeight}px`,height:`${X.itemHeight}px`,width:"100%"},"data-index":J}),scrollToIndex:(J)=>{Y().scrollToIndex(J)}}}function zw($,X={},Z){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(Y,(J,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=c4(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${w}@endvirtualList`,X);return B=B.replace("</script>",`
|
|
14266
14266
|
// Infinite scroll detection
|
|
14267
14267
|
container.addEventListener('scroll', function() {
|
|
14268
14268
|
const scrollBottom = container.scrollTop + container.clientHeight;
|
|
@@ -14280,7 +14280,7 @@ else {
|
|
|
14280
14280
|
${q}
|
|
14281
14281
|
</div>
|
|
14282
14282
|
</div>
|
|
14283
|
-
`})}function
|
|
14283
|
+
`})}function Uw($,X={},Z){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(Y,(J,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)),M=w.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(k,D)=>{if(typeof R==="object"&&R!==null)return String(R[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
|
|
14284
14284
|
<div class="virtual-grid-item"
|
|
14285
14285
|
style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/K.columns}% - ${K.gap||0}px); height: ${K.rowHeight}px;"
|
|
14286
14286
|
data-index="${A}">
|
|
@@ -14350,7 +14350,7 @@ else {
|
|
|
14350
14350
|
});
|
|
14351
14351
|
})();
|
|
14352
14352
|
</script>
|
|
14353
|
-
`})}var
|
|
14353
|
+
`})}var TO;var Bw=y(()=>{TO={createVirtualList:l4,processVirtualListDirectives:c4,processInfiniteListDirectives:zw,processVirtualGridDirectives:Uw,generateVirtualListCSS:Ww,useVirtualList:Kw}});function _w(){return`<script data-stx-hydration-runtime>
|
|
14354
14354
|
(function() {
|
|
14355
14355
|
'use strict';
|
|
14356
14356
|
|
|
@@ -14510,7 +14510,7 @@ else {
|
|
|
14510
14510
|
stxIslands.initIslands();
|
|
14511
14511
|
}
|
|
14512
14512
|
})();
|
|
14513
|
-
</script>`}function
|
|
14513
|
+
</script>`}function Hw($){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={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=Y.exec($))!==null){let G=J[1],Q=J[2];if(Q in X)Z[G]=X[Q];else Z[G]=Q}return Z}var Ew={};a(Ew,{processStaticDirectives:()=>kw,processPartialHydrationDirectives:()=>Fw,onHydrated:()=>Mw,isHydrated:()=>Tw,hydrateIsland:()=>Aw,hydrateByStrategy:()=>Rw,hydrateAll:()=>Nw,generatePartialHydrationCSS:()=>Vw,generateIslandManifest:()=>Iw,default:()=>SO,createIslandRegistry:()=>Lw});function Lw(){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 MO($){return`
|
|
14514
14514
|
<script data-hydrate="${$}">
|
|
14515
14515
|
(function() {
|
|
14516
14516
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -14521,7 +14521,7 @@ else {
|
|
|
14521
14521
|
island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
|
|
14522
14522
|
})();
|
|
14523
14523
|
</script>
|
|
14524
|
-
`}function
|
|
14524
|
+
`}function kO($,X){let Z=X.timeout||2000,Y=X.priority||"low";return`
|
|
14525
14525
|
<script data-hydrate="${$}">
|
|
14526
14526
|
(function() {
|
|
14527
14527
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -14557,7 +14557,7 @@ else {
|
|
|
14557
14557
|
}
|
|
14558
14558
|
})();
|
|
14559
14559
|
</script>
|
|
14560
|
-
`}function
|
|
14560
|
+
`}function IO($,X){let Z=X.rootMargin||"0px",Y=X.threshold||0;return`
|
|
14561
14561
|
<script data-hydrate="${$}">
|
|
14562
14562
|
(function() {
|
|
14563
14563
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -14590,7 +14590,7 @@ else {
|
|
|
14590
14590
|
}
|
|
14591
14591
|
})();
|
|
14592
14592
|
</script>
|
|
14593
|
-
`}function
|
|
14593
|
+
`}function EO($,X){let Z=X.media||"(min-width: 768px)";return`
|
|
14594
14594
|
<script data-hydrate="${$}">
|
|
14595
14595
|
(function() {
|
|
14596
14596
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -14619,7 +14619,7 @@ else {
|
|
|
14619
14619
|
}
|
|
14620
14620
|
})();
|
|
14621
14621
|
</script>
|
|
14622
|
-
`}function
|
|
14622
|
+
`}function DO($){return`
|
|
14623
14623
|
<script data-hydrate="${$}">
|
|
14624
14624
|
(function() {
|
|
14625
14625
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -14641,7 +14641,7 @@ else {
|
|
|
14641
14641
|
events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
|
|
14642
14642
|
})();
|
|
14643
14643
|
</script>
|
|
14644
|
-
`}function
|
|
14644
|
+
`}function yO($,X){let Z=X.event||"stx:activate";return`
|
|
14645
14645
|
<script data-hydrate="${$}">
|
|
14646
14646
|
(function() {
|
|
14647
14647
|
const island = document.querySelector('[data-island="${$}"]');
|
|
@@ -14662,9 +14662,9 @@ else {
|
|
|
14662
14662
|
});
|
|
14663
14663
|
})();
|
|
14664
14664
|
</script>
|
|
14665
|
-
`}function
|
|
14666
|
-
`+
|
|
14667
|
-
<script type="application/json" data-island-props="${q}">${JSON.stringify(K)}</script>`:"",j="";switch(X){case"load":j=
|
|
14665
|
+
`}function Fw($,X={},Z){let Y=$,J=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(Y=n5(Y,"load",X),Y=n5(Y,"idle",X),Y=n5(Y,"visible",X),Y=n5(Y,"media",X),Y=bO(Y),Y=n5(Y,"hover",X),Y=n5(Y,"event",X),J=G&&Y!==$,J)Y+=`
|
|
14666
|
+
`+_w();return Y}function n5($,X,Z){let Y=new RegExp(`@client:${X}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(Y,(J,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=Hw(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?`
|
|
14667
|
+
<script type="application/json" data-island-props="${q}">${JSON.stringify(K)}</script>`:"",j="";switch(X){case"load":j=MO(q);break;case"idle":j=kO(q,w);break;case"visible":j=IO(q,w);break;case"media":j=EO(q,w);break;case"hover":j=DO(q);break;case"event":j=yO(q,w);break}return`
|
|
14668
14668
|
<div data-island="${q}"
|
|
14669
14669
|
data-strategy="${X}"
|
|
14670
14670
|
${z.join(`
|
|
@@ -14674,7 +14674,7 @@ else {
|
|
|
14674
14674
|
${Q.trim()}${B}
|
|
14675
14675
|
</div>
|
|
14676
14676
|
${j}
|
|
14677
|
-
`})}function
|
|
14677
|
+
`})}function bO($){let X=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(X,(Z,Y)=>{let J=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
|
|
14678
14678
|
<div data-island="${J}"
|
|
14679
14679
|
data-strategy="only"
|
|
14680
14680
|
class="stx-island stx-client-only">
|
|
@@ -14693,7 +14693,7 @@ else {
|
|
|
14693
14693
|
}
|
|
14694
14694
|
})();
|
|
14695
14695
|
</script>
|
|
14696
|
-
`})}function
|
|
14696
|
+
`})}function Vw(){return`
|
|
14697
14697
|
/* Island base styles */
|
|
14698
14698
|
.stx-island {
|
|
14699
14699
|
display: contents;
|
|
@@ -14734,11 +14734,11 @@ else {
|
|
|
14734
14734
|
.stx-island.hydrated {
|
|
14735
14735
|
opacity: 1;
|
|
14736
14736
|
}
|
|
14737
|
-
`}function
|
|
14737
|
+
`}function Aw($){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 Rw($){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 Nw(){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 Mw($){return new Promise((X)=>{if(typeof window>"u"){X();return}let Z=document.querySelector(`[data-island="${$}"]`);if(!Z){X();return}if(Z.classList.contains("hydrated")){X();return}Z.addEventListener("stx:hydrated",()=>X(),{once:!0})})}function kw($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(X,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function Iw($){let X=$.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
|
|
14738
14738
|
<script type="application/json" id="stx-island-manifest">
|
|
14739
14739
|
${JSON.stringify(X)}
|
|
14740
14740
|
</script>
|
|
14741
|
-
`}var
|
|
14741
|
+
`}var SO;var Dw=y(()=>{SO={processPartialHydrationDirectives:Fw,processStaticDirectives:kw,generatePartialHydrationCSS:Vw,generateIslandManifest:Iw,createIslandRegistry:Lw,hydrateIsland:Aw,hydrateByStrategy:Rw,hydrateAll:Nw,isHydrated:Tw,onHydrated:Mw}});var uw={};a(uw,{watchMultiple:()=>Pw,watchEffect:()=>vw,watch:()=>Cw,unref:()=>yw,toRefs:()=>bw,throttledComputed:()=>hw,stxWatchMultiple:()=>Pw,stxWatchEffect:()=>vw,stxWatch:()=>Cw,stxUnref:()=>yw,stxToRefs:()=>bw,stxThrottledComputed:()=>hw,stxShallowRef:()=>Sw,stxRef:()=>r5,stxIsRef:()=>m1,stxDebouncedComputed:()=>gw,stxComputed:()=>J8,shallowRef:()=>Sw,ref:()=>r5,processWatchDirectives:()=>fw,processComputedDirectives:()=>xw,isRef:()=>m1,default:()=>CO,debouncedComputed:()=>gw,computed:()=>J8});function r5($){let X=$,Z=new Set,Y={get value(){if(j1){let J=Y8.get(Y);if(!J)J=new Set,Y8.set(Y,J);J.add(j1)}return X},set value(J){if(!Object.is(X,J)){X=J,Z.forEach((Q)=>Q(J));let G=Y8.get(Y);if(G)G.forEach((Q)=>Q())}},subscribe(J){return Z.add(J),()=>Z.delete(J)},peek(){return X}};return Y}function m1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function yw($){return m1($)?$.value:$}function bw($){let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=r5($[Z]);return X}function Sw($){return r5($)}function J8($){let X=typeof $==="function",Z=X?$:$.get,Y=X?void 0:$.set,J=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,j9.push(W);try{return Z()}finally{j9.pop(),j1=U}}let z={get value(){if(j1){let U=Y8.get(z);if(!U)U=new Set,Y8.set(z,U);U.add(j1)}if(Q){let U=K();if(!J(G,U))G=U;Q=!1}return G},set value(U){if(Y)Y(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 Cw($,X,Z={}){let{immediate:Y=!1,deep:J=!1,flush:G="pre",once:Q=!1}=Z,w,q=!0,W=!1,K=()=>{if(m1($))return J?K5($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=K();if(w!==void 0&&Object.is(w,j)&&!J)return;let _=()=>{if(X(j,w),w=J?K5(j):j,Q)B()};if(G==="sync")_();else if(G==="post")queueMicrotask(_);else Promise.resolve().then(_)},U=null;if(m1($))U=$.subscribe(()=>z());else U=J8($).subscribe(()=>z());if(Y)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 Pw($,X,Z={}){let{immediate:Y=!1,once:J=!1}=Z,G=$.map((z)=>m1(z)?z.value:void 0),Q=!0,w=!1,q=()=>{if(!Q||w)return;let z=$.map((U)=>m1(U)?U.value:void 0);if(X(z,G),G=[...z],J)K()},W=$.map((z)=>{if(m1(z))return z.subscribe(()=>q());return()=>{}});if(Y)q();let K=()=>{Q=!1,W.forEach((z)=>z())};return K.pause=()=>{w=!0},K.resume=()=>{w=!1},K}function vw($,X={}){let{flush:Z="pre"}=X,Y,J=!0,G=!1,Q=()=>{if(!J||G)return;if(Y)Y();let q=j1;j1=Q,j9.push(Q);try{Y=$()}finally{j9.pop(),j1=q}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let w=()=>{if(J=!1,Y)Y()};return w.pause=()=>{G=!0},w.resume=()=>{G=!1},w}function xw($,X={},Z){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(Y,(J,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 fw($,X={},Z){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(Y,(J,G,Q)=>{return`
|
|
14742
14742
|
<script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
|
|
14743
14743
|
(function() {
|
|
14744
14744
|
// Watch implementation for ${G}
|
|
@@ -14750,9 +14750,9 @@ else {
|
|
|
14750
14750
|
}
|
|
14751
14751
|
})();
|
|
14752
14752
|
</script>
|
|
14753
|
-
`})}function K5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>K5(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((Y,J)=>Z.set(K5(J),K5(Y))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((Y)=>Z.add(K5(Y))),Z}let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=K5($[Z]);return X}function
|
|
14754
|
-
`)}catch{return""}})}function
|
|
14755
|
-
`)}catch{return""}})}function
|
|
14753
|
+
`})}function K5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Z)=>K5(Z));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Z=new Map;return $.forEach((Y,J)=>Z.set(K5(J),K5(Y))),Z}if($ instanceof Set){let Z=new Set;return $.forEach((Y)=>Z.add(K5(Y))),Z}let X={};for(let Z in $)if(Object.prototype.hasOwnProperty.call($,Z))X[Z]=K5($[Z]);return X}function gw($,X=100){let Z=r5($()),Y=null,J=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{Z.value=$()},X)};return J8($).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function hw($,X=100){let Z=r5($()),Y=0,J=()=>{let Q=Date.now();if(Q-Y>=X)Y=Q,Z.value=$()};return J8($).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var j1=null,j9,Y8,CO;var dw=y(()=>{j9=[],Y8=new WeakMap;CO={ref:r5,computed:J8,watch:Cw,watchMultiple:Pw,watchEffect:vw,isRef:m1,unref:yw,toRefs:bw,shallowRef:Sw,debouncedComputed:gw,throttledComputed:hw,processComputedDirectives:xw,processWatchDirectives:fw}});function G8($,X){let Z={};for(let Y of $)Z[Y]=v1(X(Y));return new Proxy({},{get:(Y,J)=>Z[J]?.(),set:(Y,J,G)=>{if(Z[J])Z[J].set(G);else Z[J]=v1(G);return!0},has:(Y,J)=>(J in Z),deleteProperty:(Y,J)=>{return delete Z[J],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(Y,J)=>(J in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[J]()}:void 0})}function PO($,X){let Z={};for(let Y of X)Z[Y]=$[Y];return Z}function p4($,X){let Z=Object.keys($),Y=G8(Z,(O)=>X?.[O]??$[O].getDefaultValue()),J=G8(Z,()=>[]),G=G8(Z,()=>!1),Q=G8(Z,()=>!1),w=G8(Z,()=>!1),q=v1(!1);async function W(O){w[O]=!0;let F=await $[O].validate(Y[O],Y);return J[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)Y[O]=X?.[O]??$[O].getDefaultValue(),J[O]=[],G[O]=!1,Q[O]=!1}function U(O){for(let F of Z)if(F in O)Y[F]=O[F],Q[F]=!0}function B(O,F){Y[O]=F,Q[O]=!0}function j(O,F=!0){if(G[O]=F,F)W(O)}function _(O){return{value:Y[O],errors:J[O],touched:G[O],dirty:Q[O],valid:J[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(PO(Y,Z))}}return{values:Y,errors:J,touched:G,dirty:Q,get isValid(){return Z.every((O)=>J[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 mw;var lw=y(()=>{i8();mw=p4});var nw={};a(nw,{v:()=>vO,useForm:()=>p4,processHasErrorsDirective:()=>iw,processFormValidationDirectives:()=>xO,processErrorsDirective:()=>pw,processErrorDirective:()=>cw,defineForm:()=>mw,Validator:()=>o5});class o5{rules=[];defaultValue="";addRule($){let X=new o5;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:(Y)=>{if(!Y)return!0;return String(Y).length>=$||Z}})}max($,X){let Z=X||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=$||Z}})}length($,X,Z){let Y=Z||`Must be between ${$} and ${X} characters`;return this.addRule({name:"length",message:Y,validate:(J)=>{if(!J)return!0;let G=String(J).length;return G>=$&&G<=X||Y}})}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:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=$||Z}})}maxValue($,X){let Z=X||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=$||Z}})}between($,X,Z){let Y=Z||`Must be between ${$} and ${X}`;return this.addRule({name:"between",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;let G=Number(J);return G>=$&&G<=X||Y}})}matches($,X){let Z=X||`Must match ${$}`;return this.addRule({name:"matches",message:Z,validate:(Y,J)=>{if(!J)return!0;return Y===J[$]||Z}})}oneOf($,X){let Z=X||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return $.includes(Y)||Z}})}notOneOf($,X){let Z=X||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return!$.includes(Y)||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($),Y=X||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Z||Y}})}after($,X){let Z=new Date($),Y=X||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Z||Y}})}custom($,X="Invalid value"){return this.addRule({name:"custom",message:X,validate:$})}async($,X="Invalid value"){return this.addRule({name:"async",message:X,async:!0,validate:$})}when($,X){let Z=new o5;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let Y of X.getRules())Z.rules.push({...Y,validate:(J,G)=>{if(!$(J,G||{}))return!0;return Y.validate(J,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let X=new o5;return X.rules=[...this.rules],X.defaultValue=$,X}async validate($,X){let Z=[];for(let Y of this.rules){let J=await Y.validate($,X);if(J!==!0)Z.push(J)}return Z}validateSync($,X){let Z=[];for(let Y of this.rules){if(Y.async)continue;let J=Y.validate($,X);if(J!==!0)Z.push(J)}return Z}}function cw($,X,Z){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(Y,(J,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(`
|
|
14754
|
+
`)}catch{return""}})}function pw($,X,Z){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(Y,(J,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(`
|
|
14755
|
+
`)}catch{return""}})}function iw($,X,Z){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(Y,(J,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 xO($,X,Z){let Y=$;return Y=cw(Y,X,Z),Y=pw(Y,X,Z),Y=iw(Y,X,Z),Y}var vO;var rw=y(()=>{lw();vO=new o5});var aw={};a(aw,{processXElementDirectives:()=>fO,hasXElementDirectives:()=>sw,generateXElementRuntime:()=>ow});function ow(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
|
|
14756
14756
|
(function() {
|
|
14757
14757
|
'use strict';
|
|
14758
14758
|
|
|
@@ -15036,16 +15036,16 @@ else {
|
|
|
15036
15036
|
// Expose for manual initialization
|
|
15037
15037
|
window.XElement = XElement;
|
|
15038
15038
|
})();
|
|
15039
|
-
</script>`}function
|
|
15039
|
+
</script>`}function sw($){return/\bx-data(?:\s|=)/.test($)}function fO($){let X=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=$.match(X)||[],Y=Z.length>0?$.replace(X,""):$;if(!sw(Y))return Y;let J=Z[0]?.trim()||ow(),G=Y.lastIndexOf("</body>");if(G!==-1)return Y.slice(0,G)+J+`
|
|
15040
15040
|
`+Y.slice(G);return Y+`
|
|
15041
|
-
`+J}var
|
|
15041
|
+
`+J}var tw={};a(tw,{rewriteImagesWithSiblings:()=>uO});import N1 from"path";async function uO($,X){let Z=X.formats??hO;if(!X.publicDir)return $;let Y=lO($),J=[],G=/<img\b[^>]*?>/gi,Q=[],w;while((w=G.exec($))!==null){let z=w[0],U=z.match(/\bsrc=["']([^"']+)["']/i);if(!U)continue;if(cO(w.index,Y))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 dO(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="${pO(_.url)}">`).join("")}${z.raw}</picture>`;J.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(J.length===0)return $;let W="",K=0;for(let z of J)W+=$.slice(K,z.start),W+=z.replacement,K=z.end;return W+=$.slice(K),W}async function dO($,X,Z){if(!mO($))return[];let Y=N1.extname($).toLowerCase();if(!gO.has(Y))return[];if(!$.startsWith("/"))return[];let J=N1.join(X,$.slice(1)),G=N1.dirname(J),Q=N1.basename(J,Y),w=N1.resolve(G),q=N1.resolve(X);if(!w.startsWith(q))return[];let W=N1.posix.dirname($),K=Z.map(async(U)=>{let B=N1.join(G,`${Q}${U.ext}`);if(!await Bun.file(B).exists())return null;return{url:N1.posix.join(W,`${Q}${U.ext}`),mime:U.mime}});return(await Promise.all(K)).filter((U)=>U!==null)}function mO($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function lO($){let X=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,Y;while((Y=Z.exec($))!==null)X.push([Y.index,Y.index+Y[0].length]);return X}function cO($,X){for(let[Z,Y]of X)if($>=Z&&$<Y)return!0;return!1}function pO($){return $.replace(/&/g,"&").replace(/"/g,""")}var gO,hO;var ew=y(()=>{gO=new Set([".jpg",".jpeg",".png",".gif"]),hO=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var $q=()=>{};function i4($){return $.pwa?.serviceWorker?.fileName||"sw.js"}var Xq=y(()=>{$q()});var Zq={};a(Zq,{injectPwaTags:()=>iO,generateThemeColorMeta:()=>oO,generateSwRegistrationScript:()=>nO,generatePwaTags:()=>B9,generateManifestLink:()=>rO});function B9($){let X=$.pwa;if(!X?.enabled)return"";let Z=X.manifest,Y=X.icons?.outputDir?`/${X.icons.outputDir}`:"/pwa-icons",J=i4($),G=`
|
|
15042
15042
|
<!-- stx PWA Meta Tags -->
|
|
15043
15043
|
<link rel="manifest" href="/manifest.json">
|
|
15044
|
-
<meta name="theme-color" content="${
|
|
15044
|
+
<meta name="theme-color" content="${n4(Z?.themeColor||"#000000")}">
|
|
15045
15045
|
<meta name="mobile-web-app-capable" content="yes">
|
|
15046
15046
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
|
15047
15047
|
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
|
15048
|
-
<meta name="apple-mobile-web-app-title" content="${
|
|
15048
|
+
<meta name="apple-mobile-web-app-title" content="${n4(Z?.shortName||Z?.name||"App")}">`;if(X.icons?.generateAppleIcons!==!1)G+=`
|
|
15049
15049
|
<link rel="apple-touch-icon" href="${Y}/apple-touch-icon.png">
|
|
15050
15050
|
<link rel="apple-touch-icon" sizes="120x120" href="${Y}/apple-touch-icon-120x120.png">
|
|
15051
15051
|
<link rel="apple-touch-icon" sizes="152x152" href="${Y}/apple-touch-icon-152x152.png">
|
|
@@ -15082,12 +15082,12 @@ if ('serviceWorker' in navigator) {
|
|
|
15082
15082
|
});
|
|
15083
15083
|
}
|
|
15084
15084
|
</script>
|
|
15085
|
-
<!-- End stx PWA -->`,G}function
|
|
15085
|
+
<!-- End stx PWA -->`,G}function iO($,X){let Z=X.pwa;if(!Z?.enabled||Z.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1){let G=B9(X);return $.slice(0,J)+G+`
|
|
15086
15086
|
`+$.slice(J)}return $+B9(X)}let Y=B9(X);return $.replace("</head>",`${Y}
|
|
15087
|
-
</head>`)}function
|
|
15087
|
+
</head>`)}function nO($){if(!$.pwa?.enabled)return"";return`<script>
|
|
15088
15088
|
if ('serviceWorker' in navigator) {
|
|
15089
15089
|
window.addEventListener('load', function() {
|
|
15090
|
-
navigator.serviceWorker.register('/${
|
|
15090
|
+
navigator.serviceWorker.register('/${i4($)}')
|
|
15091
15091
|
.then(function(registration) {
|
|
15092
15092
|
console.log('[PWA] Service Worker registered:', registration.scope);
|
|
15093
15093
|
})
|
|
@@ -15096,53 +15096,53 @@ if ('serviceWorker' in navigator) {
|
|
|
15096
15096
|
});
|
|
15097
15097
|
});
|
|
15098
15098
|
}
|
|
15099
|
-
</script>`}function
|
|
15099
|
+
</script>`}function rO(){return'<link rel="manifest" href="/manifest.json">'}function oO($){return`<meta name="theme-color" content="${n4($)}">`}function n4($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var Yq=y(()=>{Xq()});import sO from"fs";import S0 from"path";function Jq($){return $.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function aO($,X){let Z=$.length,Y=X,J=!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(Y<Z){let w=$[Y];if(Q(Y))return Y;if(w==="/"&&$[Y+1]==="/"){if(Y=$.indexOf(`
|
|
15100
15100
|
`,Y+2),Y===-1)return-1;Y+=1,J=!0;continue}if(w==="/"&&$[Y+1]==="*"){let q=$.indexOf("*/",Y+2);if(q===-1)return-1;Y=q+2,J=!0;continue}if(w==="/"&&J){let q=Y+1,W=!1;while(q<Z){let K=$[q];if(K==="\\"){q+=2;continue}if(K==="[")W=!0;else if(K==="]")W=!1;else if(K==="/"&&!W){q++;break}else if(K===`
|
|
15101
15101
|
`){q=-1;break}q++}if(q===-1){Y++,J=!1;continue}while(q<Z&&/[a-z]/.test($[q]))q++;Y=q,J=!1;continue}if(w==="'"||w==='"'){let q=w;Y++;while(Y<Z){if($[Y]==="\\"){Y+=2;continue}if($[Y]===q){Y++;break}if($[Y]===`
|
|
15102
|
-
`)break;Y++}J=!1;continue}if(w==="`"){Y++;while(Y<Z){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;break}if($[Y]==="$"&&$[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}if(G.length===0)J=!1;continue}if(w==="}"&&G.length>0){G.pop(),Y++;while(Y<Z){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++,J=!1;break}if($[Y]==="$"&&$[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))J=!1;else J=!0;Y++}return-1}function s5($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!Y)return null;let J=Y.index+Y[0].length,G=$.indexOf("</script>",J);if(G===-1)return null;let Q=$.indexOf(">",G);if(Q===-1)return null;return{start:Y.index,end:Q+1}}function
|
|
15102
|
+
`)break;Y++}J=!1;continue}if(w==="`"){Y++;while(Y<Z){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++;break}if($[Y]==="$"&&$[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}if(G.length===0)J=!1;continue}if(w==="}"&&G.length>0){G.pop(),Y++;while(Y<Z){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`"){Y++,J=!1;break}if($[Y]==="$"&&$[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}continue}if(/\s/.test(w));else if(/[)\].\w$]/.test(w))J=!1;else J=!0;Y++}return-1}function s5($,X){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!Y)return null;let J=Y.index+Y[0].length,G=$.indexOf("</script>",J);if(G===-1)return null;let Q=$.indexOf(">",G);if(Q===-1)return null;return{start:Y.index,end:Q+1}}function Gq($){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 Y=$.slice(Z),J=/^<style\b[^>]*>/i.exec(Y);if(J){let G=$.toLowerCase().indexOf("</style>",Z+J[0].length);X=G===-1?$.length:G+8;continue}if(/^<script\b[^>]*>/i.test(Y))return Z;X=Z+1}return-1}function tO($){let X=s5($,"data-stx-runtime");if(!X)return $;let Z=Gq($);if(Z===-1||Z===X.start)return $;let Y=$.slice(X.start,X.end),J=$.slice(0,X.start)+$.slice(X.end),G=Gq(J);if(G===-1)return Y+`
|
|
15103
15103
|
`+J;return J.slice(0,G)+Y+`
|
|
15104
|
-
`+J.slice(G)}async function O0($,X,Z,Y,J){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return $;if(X.__stx_signals_gate===void 0)X.__stx_signals_gate=F1($);let G=!X.__stxProcessingDepth;if(G)
|
|
15105
|
-
`),...W.htmlAttrs&&{htmlAttrs:
|
|
15106
|
-
<meta name="stx-layout" content="${
|
|
15107
|
-
<meta name="stx-layout-group" content="${
|
|
15108
|
-
`+K+Q.slice(z.end)}}catch{}if(G)try{let{getFrameworkComposableScript:w}=await e("stx/framework-composables",()=>Promise.resolve().then(() => (
|
|
15109
|
-
`+q+Q.slice(W.end)}}catch{}if(G)try{let{getComposableScript:w}=await e("stx/composable-loader",()=>Promise.resolve().then(() => (
|
|
15110
|
-
`+K+Q.slice(z.end)}}catch{}if(G)Q=
|
|
15104
|
+
`+J.slice(G)}async function O0($,X,Z,Y,J){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return $;if(X.__stx_signals_gate===void 0)X.__stx_signals_gate=F1($);let G=!X.__stxProcessingDepth;if(G)K6(X);if(!X.__stxProcessingDepth)X.__stxProcessingDepth=0;if(X.__stxProcessingDepth++,!X.__onceStore)X.__onceStore=new Set;if((Y.debug||!d7()&&!D$())&&Z&&Z.endsWith(".stx"))m3($,Z);try{return await C6.timeAsync("template-processing",async()=>{let Q=await eO($,X,Z,Y,J);if(G)Q=v4(Q);if(G&&Y.autoShell&&Y.buildMode!=="compile"){let w=Y.app?.head||{},W=(X.__stx_runtime_head||null)??wX(),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(`
|
|
15105
|
+
`),...W.htmlAttrs&&{htmlAttrs:NQ(w.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...w.bodyAttrs||{},...W.bodyAttrs}}},L=S4(Q);if(Q=IQ(Q,H,{..._&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),L)Q=kQ(Q,w),Q=TQ(Q,H.htmlAttrs);let O=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(O&&Q.includes("<head")){let A=O[1],R=U7(A);Q=Q.replace(/<head\b[^>]*>/i,(N)=>`${N}
|
|
15106
|
+
<meta name="stx-layout" content="${Jq(A)}">
|
|
15107
|
+
<meta name="stx-layout-group" content="${Jq(R)}">`)}let F=Q.match(/function (__stx_setup_\d+_\d+)\(/),V=F?f8(Q):null;if(F&&V&&!/\bdata-stx=/.test(V.tag)){Q=HX(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=MQ(Q);let w=Y.app?.colorMode;if(w)Q=LQ(Q,w);Q=VQ(Q),Q=tO(Q)}if(G)try{let{getStoreScript:w}=await e("stx/store-loader",()=>Promise.resolve().then(() => (fQ(),xQ))),q=Y.storesDir,W=await w(q);if(W){let K=`<script data-stx-stores>${W}</script>`,z=s5(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
|
|
15108
|
+
`+K+Q.slice(z.end)}}catch{}if(G)try{let{getFrameworkComposableScript:w}=await e("stx/framework-composables",()=>Promise.resolve().then(() => (mQ(),dQ))),q=await w(Q);if(q){let W=s5(Q,"data-stx-stores")||s5(Q,"data-stx-runtime");if(W)Q=Q.slice(0,W.end)+`
|
|
15109
|
+
`+q+Q.slice(W.end)}}catch{}if(G)try{let{getComposableScript:w}=await e("stx/composable-loader",()=>Promise.resolve().then(() => (pQ(),cQ))),q=Y.composablesDir,W=await w(q);if(W){let K=`<script data-stx-composables>${W}</script>`,z=s5(Q,"data-stx-stores")||s5(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
|
|
15110
|
+
`+K+Q.slice(z.end)}}catch{}if(G)Q=FQ(Q);if(G&&X.__stx_inject_css!==!1)Q=await p7(Q,void 0,Y.buildMode==="serve");if(G)Q=g6(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof C$)throw Q;let w=Q instanceof Error?Q.message:String(Q),q=new Y5(`Template processing failed: ${w}`,Z,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(X1.log(q,{filePath:Z,context:X}),O3.logDetailedError(q,{filePath:Z,template:$.substring(0,500)}),Y.debug)throw q;return _3.createFallbackContent("Template Processing",q)}}async function eO($,X,Z,Y,J){let G=process.cwd(),Q={...Y,partialsDir:Y.partialsDir&&!S0.isAbsolute(Y.partialsDir)?S0.resolve(G,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!S0.isAbsolute(Y.componentsDir)?S0.resolve(G,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!S0.isAbsolute(Y.layoutsDir)?S0.resolve(G,Y.layoutsDir):Y.layoutsDir},w=Q,q=$;await ZL(Z,X),XL(X,w),q=await C5(()=>$Q(q,X,Z,w),q,(F)=>{X1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=q1(q,E7,(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=zQ(q),q=await bQ(q,Z,J);let B={};q=R4(q,B);let j={...X.__sections||{}},_="",H=VJ(m$($)),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')
|
|
15111
15111
|
${q.trim()}
|
|
15112
|
-
@endsection`}if(!_&&!L&&w.defaultLayout){let F=
|
|
15112
|
+
@endsection`}if(!_&&!L&&w.defaultLayout){let F=b4(q),V=/@section\s*\(/.test(q);if(!F||V){let A="",R=S0.dirname(Z),N=w.layoutsDir?S0.dirname(w.layoutsDir):process.cwd();for(let T=0;T<20;T++){let M=S0.join(R,"_layout.stx");if(await p(M)){A=M;break}let k=S0.dirname(R);if(k===R||k.length<N.length)break;R=k}if(A)_=A;else if(w.layoutsDir){let T=S0.isAbsolute(w.layoutsDir)?w.layoutsDir:S0.resolve(process.cwd(),w.layoutsDir),M=S0.join(T,`${w.defaultLayout}.stx`);if(await p(M))_=M}if(_&&!V)q=`@section('content')
|
|
15113
15113
|
${q.trim()}
|
|
15114
|
-
@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=Y0(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",z5);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=
|
|
15114
|
+
@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=Y0(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",z5);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=N4(q,B),_){let F=[],V=y1(q),A=q1(V.output,T5,(R,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(q=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,N,T)=>{let M=N==="SCRIPT"?V.scripts[Number(T)]:A.tokens[Number(T)];if(M)F.push(M);return""}),F.length>0){let R=F.join(`
|
|
15115
15115
|
`);j.content=j.content?`${j.content}
|
|
15116
|
-
${R}`:R,X.__sections=j}}if(_)try{let F;if(S0.isAbsolute(_))F=_,J.add(_);else F=await C5(()=>
|
|
15117
|
-
${q}`,z(q)}catch(F){return X1.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
|
|
15118
|
-
`;if(G=M(G,X),G=k(G,X),G=
|
|
15116
|
+
${R}`:R,X.__sections=j}}if(_)try{let F;if(S0.isAbsolute(_))F=_,J.add(_);else F=await C5(()=>PX(_,Z,Q,J),null,()=>{throw new Y5(`Failed to resolve layout path: ${_}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let M=[];try{let D=Q.layoutsDir;if(D){let I=S0.isAbsolute(D)?D:S0.resolve(process.cwd(),D);M=sO.readdirSync(I).filter((S)=>S.endsWith(".stx")).map((S)=>S.replace(/\.stx$/,"")).sort()}}catch{}let k=`Layout not found: ${_} (referenced from ${Z})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if(X1.log(Error(k),{layoutPath:_,filePath:Z,available:M},"error"),console.error(`[stx] ${k}`),Q.debug)throw new Y5(k,Z);return q}let V=await C5(()=>Bun.file(F).text(),"",()=>{throw new Y5(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let M={},k=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(S,b,C)=>{return M[b]=C.trim(),""});for(let[S,b]of Object.entries(M))if(j[S]&&j[S].includes(z5)){let C=j[S].indexOf(z5);j[S]=j[S].slice(0,C)+b+j[S].slice(C+z5.length)}else if(!j[S])j[S]=b;let D={...X,__sections:j},I=`@layout('${A[1]}')${k}`;return await O0(I,D,F,Q,J)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=R4(R,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(M,k,D)=>{return T[k]=D.trim(),`@slot('${k}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(M,k,D)=>{if(j[k]){let I=j[k];if(I.includes(z5)){let S=T[k]||"",b=I.indexOf(z5);I=I.slice(0,b)+S+I.slice(b+z5.length)}return I}return D||""}),N=$L(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=N4(N,B),X.__originalFilePath=Z,q=await Qq(N,X,F,Q,J),q=`<!-- stx-layout: ${_} -->
|
|
15117
|
+
${q}`,z(q)}catch(F){return X1.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 Qq(q,X,Z,Q,J))}function $L($,X){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,Y,J)=>{let G=X[Y];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return J||""})}function XL($,X){if($.__stx_sfc_mode=!0,$.__stx_options=X,X.buildMode)$.__stx_buildMode=X.buildMode;let Z=X.envPrefix||"STX_PUBLIC_",Y={};for(let[J,G]of Object.entries(process.env))if(J.startsWith(Z)&&G!==void 0)Y[J]=G;$.$env=Y}async function ZL($,X){await C5(()=>GQ($,X),void 0,(Z)=>{X1.log(Z,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Z.message}`)})}async function YL($,X,Z){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec($))!==null){let G=J[1],Q=J[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:q}=await e("stx/variable-extractor",()=>Promise.resolve().then(() => (P7(),P8)));await q(Q,X,Z,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));X1.log(W,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${W.message}`)}}}async function JL($,X,Z){try{let{interpolateScriptsInTemplate:Y}=await e("stx/expressions",()=>Promise.resolve().then(() => (W1(),y6)));return Y($,X,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return X1.log(J,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${J.message}`),$}}async function Qq($,X,Z,Y,J){let G=$,Q=Y;if(await YL(G,X,Z),G=await JL(G,X,Z),G=await rG(G,X,Z),G=await oG(G,X,Z),G=await uJ(G,X,Z,Q),F1(G))G=EX(G,X),G=yX(G,X);G=DX(G);let{processStreamDirectives:w}=await e("stx/streaming",()=>Promise.resolve().then(() => (d3(),u3)));G=w(G,X),G=L4(G,X,Z,Q),G=await HQ(G,X,Z,Q,J),G=await Z9(G,X,Z,Q,J),G=M2(G,X,Z,Q);let{processDeferDirectives:q}=await e("stx/defer",()=>Promise.resolve().then(() => nQ));G=q(G,X,Z);let{processTeleportDirectives:W}=await e("stx/teleport",()=>Promise.resolve().then(() => oQ));G=W(G,X,Z);let{processTransitionDirectives:K,processTransitionAttributes:z}=await e("stx/transitions",()=>Promise.resolve().then(() => eQ));G=K(G,X,Z),G=z(G);let{processErrorBoundaryDirectives:U}=await e("stx/error-boundaries",()=>Promise.resolve().then(() => Xw));G=U(G,X,Z);let{processSuspenseDirectives:B}=await e("stx/suspense",()=>Promise.resolve().then(() => Zw));G=B(G,X,Z);let{processAsyncDirectives:j}=await e("stx/async-components",()=>Promise.resolve().then(() => Qw));G=j(G,X,Z);let{processKeepAliveDirectives:_}=await e("stx/keep-alive",()=>Promise.resolve().then(() => qw));G=_(G,X,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await e("stx/virtual-scrolling",()=>Promise.resolve().then(() => (Bw(),jw)));G=H(G,X,Z),G=L(G,X,Z),G=O(G,X,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await e("stx/partial-hydration",()=>Promise.resolve().then(() => (Dw(),Ew)));G=F(G,X,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await e("stx/computed",()=>Promise.resolve().then(() => (dw(),uw)));G=A(G,X,Z),G=R(G,X,Z);let{processFormValidationDirectives:N}=await e("stx/forms-validation",()=>Promise.resolve().then(() => (rw(),nw)));G=N(G,X,Z);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:k,resetHead:D}=await e("stx/head",()=>Promise.resolve().then(() => (C7(),WX)));if(!X.__stx_head_preset&&!X.__stx_runtime_head)D();let I=T(G);if(G=I.content,I.headContent)X.__stx_head_raw=`${X.__stx_head_raw||""}${I.headContent}
|
|
15118
|
+
`;if(G=M(G,X),G=k(G,X),G=YQ(G),G=k3(G,X),G=gJ(G),G=tG(G),G=await A4(G,X,Z,Q,J),G=await Z9(G,X,Z,Q,J),X.__stxProcessingDepth===1)G=U6(G,X);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=v4(G),G=G5(G,X,Z),G=I3(G,X),G=E3(G,X),G=n$(G,X),G=oJ(G,X),G=sJ(G,X),G=await kJ(G,X,Z,Q),G=await fZ(G,X,Z),G=await XG(G,X,Z,Q),G=L2(G,X,Z,Q),G=pY(G,X,Z,Q),G=iY(G,X,Z),G=nY(G,X,Z,Q),G=vJ(G,X,Z,Q),G=C4(G,X),G=P4(G),G=CQ(G),!Q.skipEventDirectives)G=c2(G,X,Z);if(G=TJ(G,X,Z),Q.debug){let n=/\bx-data\s*=/.test(G),s=e8($);if(n&&s)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
|
|
15119
15119
|
Both work on the same page, but they manage separate scopes.
|
|
15120
|
-
Prefer signals (state/derived/effect) for new components.`)}G=
|
|
15120
|
+
Prefer signals (state/derived/effect) for new components.`)}G=qQ(G,X),G=await b1(G,X,Z),G=PQ(G),G=vQ(G),G=HJ(G);let{processXElementDirectives:S}=await e("stx/x-element",()=>Promise.resolve().then(() => aw));G=S(G);let b=X.__originalFilePath||Z,C=M7(X);if(G=await bX(G,Q,b,C),G=pJ(G,X),G=await XQ(G,X,Z,Q),Q.media?.image?.autoSiblings){let n=Q.publicDir||"public",{rewriteImagesWithSiblings:s}=await e("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (ew(),tw)));G=await s(G,{publicDir:n})}if(Q.seo?.enabled)G=rY(G,X,Q);let P=(n,s,K0=!0)=>{if(!s)return n;let I0=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),w0=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(I0&&w0){if(K0)n=n.replace(w0[0],I0[0]);if(s=s.replace(I0[0],"").trim(),!s)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${s}
|
|
15121
15121
|
</head>`);if(/<head\b[^>]*>/i.test(n))return n.replace(/(<head\b[^>]*>)/i,`$1
|
|
15122
15122
|
${s}`);if(/<html\b[^>]*>/i.test(n))return n.replace(/(<html\b[^>]*>)/i,`$1
|
|
15123
15123
|
<head>
|
|
15124
15124
|
${s}
|
|
15125
|
-
</head>`);return n},{renderHead:x,getHead:f}=await e("stx/head",()=>Promise.resolve().then(() => (C7(),WX))),$0=X.__stx_runtime_head??f();if($0.title||$0.meta?.length||$0.link?.length){let n=x($0);if(n)G=P(G,n)}if(I.headContent)G=P(G,I.headContent,!$0.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=
|
|
15126
|
-
${
|
|
15125
|
+
</head>`);return n},{renderHead:x,getHead:f}=await e("stx/head",()=>Promise.resolve().then(() => (C7(),WX))),$0=X.__stx_runtime_head??f();if($0.title||$0.meta?.length||$0.link?.length){let n=x($0);if(n)G=P(G,n)}if(I.headContent)G=P(G,I.headContent,!$0.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=CJ(G,Q.csp,X);if(Q.analytics?.enabled)G=LJ(G,Q);if(Q.heatmap?.enabled)G=D2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:n}=await e("stx/pwa/inject",()=>Promise.resolve().then(() => (Yq(),Zq)));G=n(G,Q)}let C0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),U0=/\bSTX\.\w+/.test(G),A0=/window\.STX\s*=/.test(G);if(C0&&U0&&!A0){let s=`<script data-stx-scoped data-stx-run="once">
|
|
15126
|
+
${UJ()}
|
|
15127
15127
|
</script>`;if(G.includes("</head>")){let K0=G.indexOf("</head>"),w0=G.slice(0,K0).indexOf("<script");if(w0!==-1){let E=G.slice(0,w0),v=G.slice(w0);G=E+s+`
|
|
15128
15128
|
`+v}else G=G.replace("</head>",`${s}
|
|
15129
15129
|
</head>`)}else if(G.includes("<body"))G=G.replace(/<body([^>]*)>/,`<body$1>
|
|
15130
15130
|
${s}`);else G=s+`
|
|
15131
|
-
`+G}{let{scanScriptTags:n}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (g7(),$$))),s=[];for(let K0 of n(G)){if(!/\bserver\b/i.test(K0.attrs))continue;let I0=K0.start+K0.fullMatch.indexOf(">")+1,w0=
|
|
15132
|
-
`+G.slice(K0)}X.__stx_event_bindings=[]}}if(!
|
|
15131
|
+
`+G}{let{scanScriptTags:n}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (g7(),$$))),s=[];for(let K0 of n(G)){if(!/\bserver\b/i.test(K0.attrs))continue;let I0=K0.start+K0.fullMatch.indexOf(">")+1,w0=aO(G,I0);if(w0===-1)continue;let E=w0+9;while(E<G.length&&/\s/.test(G[E]))E++;s.push({start:K0.start,end:E})}for(let K0=s.length-1;K0>=0;K0--){let{start:I0,end:w0}=s[K0];G=G.substring(0,I0)+G.substring(w0)}}let u=y8(G,Z);if(u.hasScoped)G=u.html;let t=X.__stx_event_bindings||[],R0=!1,P0=[],U5=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:j5}=await e("stx/signal-processing",()=>Promise.resolve().then(() => (g7(),$$)));for(let n of j5(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))P0.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:s,content:K0}of P0){R0=!0;let I0=K0;f4(K0,Z,Y.strict,X.__originalFilePath);let w0=await k7(K0,{eventBindings:t,attrs:s,hasColonDirectives:U5,templateContent:$,filePath:Z,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:C});G=G.replace(n,()=>w0)}if(R0)X.__stx_event_bindings=[];if(!R0&&X.__stxProcessingDepth===1){let n=X.__stx_event_bindings||[];if(n.length>0){let s=p9(n);if(s){let K0=G.lastIndexOf("</body>");G=K0===-1?G+s:G.slice(0,K0)+s+`
|
|
15132
|
+
`+G.slice(K0)}X.__stx_event_bindings=[]}}if(!RZ(G)&&NZ(G))G=await o8(G,Q);if(Q.csp?.enabled&&Q.csp.useNonce&&typeof X.cspNonce==="string")G=PJ(G,X.cspNonce);return G}var z5="<!--PARENT_CONTENT_PLACEHOLDER-->";var J$=y(()=>{d$();OX();r1();g9();jJ();OJ();FJ();d9();h9();i9();I7();MJ();IJ();c$();xJ();hJ();mJ();iJ();V1();C7();W1();aJ();ZG();nG();aG();F4();vX();ZQ();I5();JQ();v$();k0();QQ();WQ();UQ();OQ();GX();E4();EQ();g7();H4();SQ();x4();g4();T0();l3();e9();V7();s8();s8();x4();g4()});import V0 from"fs";import G0 from"path";import a4 from"fs";import Vq from"path";var O9="resources/assets",t4="assets";function e4($=process.cwd()){let X=Vq.resolve($,O9);return a4.existsSync(X)&&a4.statSync(X).isDirectory()?X:null}import _5 from"fs";import L9 from"path";var $2="_stx";function Aq($){return Bun.hash($).toString(16).slice(0,8)}function Rq($){let X=[],Z=(Y)=>{for(let J of _5.readdirSync(Y,{withFileTypes:!0})){let G=L9.join(Y,J.name);if(J.isDirectory())Z(G);else if(J.isFile()&&G.endsWith(".html"))X.push(G)}};if(_5.existsSync($))Z($);return X}var Nq=[{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=`/${$2}`){let Z=[],Y=new Set,J=0,G=$;for(let Q of Nq)G=G.replace(Q.pattern,(w,q,W)=>{if(/\b(?:src|href)\s*=/.test(q)||!W.trim())return w;let K=`${Q.prefix}.${Aq(W)}.${Q.extension}`;if(!Y.has(K))Y.add(K),Z.push({filename:K,contents:W,contentType:Q.contentType});return J+=W.length,Q.replace(`${X}/${K}`)});return{html:G,assets:Z,bytesInlined:J}}function X2($){let X={pages:0,assets:0,bytesInlined:0},Z=L9.join($,$2),Y=new Set;for(let J of Rq($)){let G=_5.readFileSync(J,"utf8"),{html:Q,assets:w,bytesInlined:q}=Tq(G);if(Q===G)continue;for(let W of w){if(Y.has(W.filename))continue;Y.add(W.filename),_5.mkdirSync(Z,{recursive:!0}),_5.writeFileSync(L9.join(Z,W.filename),W.contents),X.assets++}_5.writeFileSync(J,Q),X.bytesInlined+=q,X.pages++}return X}x9();J$();import{createHash as GL}from"crypto";function QL($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}var wL=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;function qL($){return Bun.hash($).toString(16)}function wq($,X={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Z=new Map,Y=$.replace(wL,(G,Q,w,q)=>{let W=q.trim();if(!W)return G;if(/\bdata-stx-src=/.test(w))return G;if(X.minify)W=QL(W);let K=qL(W);if(!Z.has(K))Z.set(K,W);let z=X.integrity?` data-stx-integrity="sha384-${GL("sha384").update(W).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${Q}" data-stx-src="/_stx/islands/${K}.js"${z}${w}></script>`}),J=Array.from(Z,([G,Q])=>({hash:G,code:Q}));return{html:Y,chunks:J}}var WL=new Set(["visible","idle"]);function qq($){if(!$.includes("data-stx-src="))return $;let X=new Map,Z=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,Y;while((Y=Z.exec($))!==null)X.set(Y[1],Y[2]);let J=new Set,G=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,Q;while((Q=G.exec($))!==null)if(WL.has(X.get(Q[1])||""))J.add(Q[2]);let w=$.lastIndexOf("</head>");if(J.size===0||w===-1)return $;let q=Array.from(J).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)}L1();import Q8 from"fs";import _9 from"path";var KL="layout-types.d.ts";function zL($){let X=[],Z=(Y,J)=>{let G;try{G=Q8.readdirSync(Y,{withFileTypes:!0})}catch{return}for(let Q of G){if(Q.name.startsWith("."))continue;let w=_9.join(Y,Q.name);if(Q.isDirectory())Z(w,J?`${J}/${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(J?`${J}/${q}`:q)}}};return Z($,""),X.sort()}function UL($){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(`
|
|
15133
15133
|
`);return X.push("declare module '@stacksjs/stx' {"," interface KnownLayouts {",...$.map((Z)=>` '${Z}': true`)," }","}","","export {}",""),X.join(`
|
|
15134
|
-
`)}function
|
|
15135
|
-
`)}v$();L7();d$();k1();class
|
|
15134
|
+
`)}function Wq($,X){if(!$)return[];let Z=_9.isAbsolute($)?$:_9.resolve(process.cwd(),$),Y=zL(Z),J=UL(Y),G=_9.join(X,KL);try{if(Q8.existsSync(G)&&Q8.readFileSync(G,"utf8")===J)return Y;Q8.mkdirSync(X,{recursive:!0}),Q8.writeFileSync(G,J)}catch{}return Y}var jL=["STX_SITE_URL","SITE_URL","URL","VERCEL_URL","CF_PAGES_URL"];function r4($){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 BL($){for(let X of jL){let Z=$[X];if(!Z)continue;let Y=r4(Z);if(Y)return{url:Y,source:"env",via:X}}return null}function Kq($){if(!$||typeof $!=="object")return null;let X=$,Z=X.site?.url??X.url??X.app?.url;return typeof Z==="string"?r4(Z):null}async function _L($){let{existsSync:X}=await import("fs"),Z=await import("path");for(let Y of["site.config.ts","site.config.js",".config/site.config.ts"]){let J=Z.resolve($,Y);if(!X(J))continue;try{let G=await import(J),Q=Kq(G.default??G);if(Q)return Q}catch{}}return null}async function zq($={}){let X=$.cwd??process.cwd(),Z=$.env??process.env;if($.explicit){let Q=r4($.explicit);if(Q)return{url:Q,source:"option"}}let Y=Kq($.stxConfig);if(Y)return{url:Y,source:"stx.config",via:"site.url"};let J=await _L(X);if(J)return{url:J,source:"site.config",via:"url"};let G=BL(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(`
|
|
15135
|
+
`)}v$();L7();d$();k1();class jq{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,Y]of Object.entries(X))this.cache.set(Z,Y)}catch{}this.loaded=!0}async save(){await V0.promises.mkdir(this.cacheDir,{recursive:!0});let $=G0.join(this.cacheDir,"build-cache.json"),X={};for(let[Z,Y]of this.cache)X[Z]=Y;await Bun.write($,JSON.stringify(X))}getHash($,X){let Z=V0.statSync($),Y=`${$}:${Z.mtimeMs}`;for(let G of X)if(V0.existsSync(G)){let Q=V0.statSync(G);Y+=`:${G}:${Q.mtimeMs}`}let J=0;for(let G=0;G<Y.length;G++){let Q=Y.charCodeAt(G);J=(J<<5)-J+Q,J=J&J}return Math.abs(J).toString(36)}get($,X){let Z=this.cache.get($);if(!Z)return null;let Y=this.getHash(X,Z.dependencies??[]);if(Z.hash!==Y)return this.cache.delete($),null;return Z.html}set($,X,Z,Y){let J=this.getHash(X,Z);this.cache.set($,{hash:J,html:Y,generatedAt:Date.now(),dependencies:Z})}}class Bq{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 V0.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 V0.promises.unlink(X)}async invalidatePattern($){let X=G0.join(this.cacheDir,"isr");if(!V0.existsSync(X))return;let Z=await V0.promises.readdir(X);for(let Y of Z){let J=Y.replace(/_/g,"/").replace(".json","");if($.test(J))await V0.promises.unlink(G0.join(X,Y))}}async needsRevalidation($){let X=await this.get($);if(!X)return!0;return Date.now()>X.revalidateAfter}}async function HL($){try{let Z=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Z)return null;let Y=Z[1];if(!Y.includes("getStaticPaths"))return null;let J=Y.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!J)return null;return await Function(`
|
|
15136
15136
|
return (async function getStaticPaths() {
|
|
15137
15137
|
${J[1]}
|
|
15138
15138
|
})()
|
|
15139
|
-
`)()}catch(X){return console.error(`Error extracting static paths from ${$}:`,X),null}}async function
|
|
15139
|
+
`)()}catch(X){return console.error(`Error extracting static paths from ${$}:`,X),null}}async function OL($){let X=[];if(!$.isDynamic)X.push({url:$.pattern,params:{}});else{let Z=await HL($.filePath);if(!Z||Z.paths.length===0)return console.warn(`Warning: Dynamic route ${$.pattern} has no getStaticPaths or returned empty paths`),X;for(let Y of Z.paths){let J=$.pattern;for(let[G,Q]of Object.entries(Y.params))J=J.replace(`:${G}`,Q).replace(`:${G}*`,Q);X.push({url:J,params:Y.params,props:Y.props,revalidate:Y.revalidate})}}return X}async function LL($){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 Y=await import(Z);if(typeof Y.default==="function")return await Y.default();else if(typeof Y.default==="object")return Y.default;else if(typeof Y.getData==="function")return await Y.getData();else{let{default:J,...G}=Y;return G}}catch(Y){console.error(`Error loading data file ${Z}:`,Y)}return null}async function FL($,X,Z){let Y=$.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let J=Y[1];if(!J.includes("getStaticProps"))return null;try{let G=J.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticProps\s*\([^)]*\)\s*\{([\s\S]*?)\n\}/);if(!G)return null;return await Function("params",`
|
|
15140
15140
|
return (async function getStaticProps() {
|
|
15141
15141
|
${G[1]}
|
|
15142
15142
|
})()
|
|
15143
|
-
`)(X)}catch(G){return console.error(`Error executing getStaticProps in ${Z}:`,G),null}}async function
|
|
15143
|
+
`)(X)}catch(G){return console.error(`Error executing getStaticProps in ${Z}:`,G),null}}async function _q($,X,Z={},Y,J){let G=await Bun.file($.filePath).text(),Q=await LL($.filePath),w=await FL(G,X,$.filePath),q={...Q||{},...w||{},...Z,params:X,$route:{path:$.pattern,params:X}},W=new Set,K={...J,debug:!1,cache:!1,autoShell:!0},z=await O0(G,q,$.filePath,K,W);if(Object.keys(X).length>0){let U=`<script>if(window.stx)window.stx._rp=${JSON.stringify(X)};else window.__stx_rp=${JSON.stringify(X)};</script>`;if(z.includes("</head>"))z=z.replace("</head>",`${U}
|
|
15144
15144
|
</head>`);else z=`${U}
|
|
15145
|
-
${z}`}if(z=await
|
|
15145
|
+
${z}`}if(z=await kX(z,{router:Y.router}),z=await p7(z),Y.minify!==!1)return{html:VL(z),dependencies:Array.from(W)};return{html:z,dependencies:Array.from(W)}}function VL($){let X=[],Z=0,Y=/(<script[^>]*>)([\s\S]*?)(<\/script>)/gi,J;while((J=Y.exec($))!==null){let Q=$.slice(Z,J.index);X.push(Q.replace(/<!--(?!\[if)[\s\S]*?-->/g,"").replace(/\s+/g," ").replace(/>\s+</g,"><"));let w=J[1],q=J[2],W=J[3];q=q.replace(/([^:"\\'`])\/\/(?!\/)(?![*!])([^\n]*)/g,"$1"),X.push(w+q+W),Z=J.index+J[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 AL($){let X=0;for(let Z=0;Z<$.length;Z++){let Y=$.charCodeAt(Z);X=(X<<5)-X+Y,X=X&X}return`"${Math.abs(X).toString(36)}"`}function RL($,X,Z,Y){if(Z?.sitemap===!1)return!0;if(/<meta[^>]+name=["']robots["'][^>]+content=["'][^"']*noindex/i.test(X))return!0;return Y.some((J)=>{if(J instanceof RegExp)return J.test($);return J.endsWith("/")?$===J.slice(0,-1)||$.startsWith(J):$===J})}function NL($,X){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
15146
15146
|
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
|
|
15147
15147
|
${$.map((Y)=>{let J=new URL(Y.loc,X).href,G=` <url>
|
|
15148
15148
|
<loc>${J1(J)}</loc>`;if(Y.lastmod)G+=`
|
|
@@ -15151,7 +15151,7 @@ ${$.map((Y)=>{let J=new URL(Y.loc,X).href,G=` <url>
|
|
|
15151
15151
|
<priority>${Y.priority}</priority>`;return G+=`
|
|
15152
15152
|
</url>`,G}).join(`
|
|
15153
15153
|
`)}
|
|
15154
|
-
</urlset>`}function J1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function
|
|
15154
|
+
</urlset>`}function J1($){return $.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function TL($,X){let Z=X.map((Y)=>{let J=" <item>";if(J+=`
|
|
15155
15155
|
<title>${J1(Y.title)}</title>`,J+=`
|
|
15156
15156
|
<link>${J1(Y.link)}</link>`,Y.description)J+=`
|
|
15157
15157
|
<description>${J1(Y.description)}</description>`;if(Y.pubDate)J+=`
|
|
@@ -15172,10 +15172,10 @@ ${$.map((Y)=>{let J=new URL(Y.loc,X).href,G=` <url>
|
|
|
15172
15172
|
${Z.join(`
|
|
15173
15173
|
`)}
|
|
15174
15174
|
</channel>
|
|
15175
|
-
</rss>`}async function
|
|
15175
|
+
</rss>`}async function ML($={}){let X=Date.now(),Z=await e0(),Y=await zq({explicit:$.domain,stxConfig:Z});if(Y.source==="fallback"&&($.sitemap??!0))console.warn(Uq());let J={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:Y.url,revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,sitemapExclude:$.sitemapExclude||[],robots:$.robots??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||_1(process.cwd(),"ssg-cache"),contentLoaders:$.contentLoaders||[],hooks:$.hooks||{},minify:$.minify??!1,generate404:$.generate404??!0,publicDir:$.publicDir||"public",trailingSlash:$.trailingSlash??!1,cleanOutput:$.cleanOutput??!0,chunkIslands:$.chunkIslands===!0,prefetchIslands:$.prefetchIslands===!0,integrityIslands:$.integrityIslands===!0},G={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,w=0,q={},W={};await J.hooks.onBuildStart?.();try{if(J.cleanOutput&&V0.existsSync(J.outputDir))await V0.promises.rm(J.outputDir,{recursive:!0});await V0.promises.mkdir(J.outputDir,{recursive:!0});let z=new jq(J.cacheDir);if(J.cache)await z.load();try{let{generateCrosswindCSS:R}=await Promise.resolve().then(() => (d$(),zJ));await R('<div class="bg-black"></div>')}catch{}Q7();let U=Z?.routeMiddleware?.dir||"middleware";await q7(process.cwd(),U);let B=w7();if(B.length>0)console.log(`Loaded ${B.length} middleware: ${B.join(", ")}`);let j=Z?.routeMiddleware?.global||[];Wq(Z?.layoutsDir,_1(process.cwd()));let _=B7(".",{pagesDir:J.pagesDir});console.log(`Found ${_.length} routes`);let H=[];for(let R of _){let N=await OL(R);for(let T of N)H.push({route:R,url:T.url,params:T.params,props:T.props,revalidate:T.revalidate??J.revalidate})}G.totalPages=H.length,console.log(`Generating ${G.totalPages} pages...`);let L=[],O=[];for(let R=0;R<H.length;R+=J.concurrency)O.push(H.slice(R,R+J.concurrency));for(let R of O)await Promise.all(R.map(async(N)=>{let{route:T,url:M,params:k,props:D,revalidate:I}=N;try{await J.hooks.onPageStart?.(M);let S=await Bun.file(T.filePath).text(),b=DL(S),C=b?.middleware?Array.isArray(b.middleware)?b.middleware:[b.middleware]:[],P=[...j,...C];if(P.length>0){let U0=W7(M,k,b||{}),A0=K7(U0,null,void 0,{isServer:!0}),u=await z7(P,A0);if(u.redirect){let t=typeof u.redirect==="string"?u.redirect:u.redirect.path||u.redirect,R0=yL(String(t),M),P0=bL(M,J);await V0.promises.mkdir(G0.dirname(P0),{recursive:!0}),await Bun.write(P0,R0),G.successCount++,G.pages.push({route:M,outputPath:P0,size:Buffer.byteLength(R0),cached:!1}),L.push({loc:M,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${M} \u2192 redirect to ${t}`);return}if(u.abort){let t=typeof u.abort==="string"?u.abort:u.abort?.error?.message||"aborted";console.warn(` \u21B3 ${M} \u2014 middleware aborted: ${t}`);return}}let x=S.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(x)try{if(!await Function("route",`
|
|
15176
15176
|
const validate = ${x[1]};
|
|
15177
15177
|
return validate(route);
|
|
15178
|
-
`)({params:k})){console.warn(`Validation failed for ${M}, skipping...`);return}}catch{}let f=null,l=!1;if(J.cache){if(f=z.get(M,T.filePath),f)l=!0,G.cachedCount++}if(!f){let U0=await
|
|
15178
|
+
`)({params:k})){console.warn(`Validation failed for ${M}, skipping...`);return}}catch{}let f=null,l=!1;if(J.cache){if(f=z.get(M,T.filePath),f)l=!0,G.cachedCount++}if(!f){let U0=await _q(T,k,D,J,Z);if(f=U0.html,J.cache)z.set(M,T.filePath,U0.dependencies,f)}let $0;if(J.trailingSlash)$0=G0.join(J.outputDir,M,"index.html");else $0=M==="/"?G0.join(J.outputDir,"index.html"):G0.join(J.outputDir,`${M}.html`);if(J.chunkIslands){let{html:U0,chunks:A0}=wq(f,{integrity:J.integrityIslands,minify:J.minify});if(A0.length>0){let u=G0.join(J.outputDir,"_stx","islands");await V0.promises.mkdir(u,{recursive:!0});for(let t of A0){let R0=G0.join(u,`${t.hash}.js`);if(!await Bun.file(R0).exists())await Bun.write(R0,t.code);if(!Q.has(t.hash)){Q.add(t.hash);let P0=Buffer.byteLength(t.code,"utf8");w+=P0,q[t.hash]={bytes:P0,file:`/_stx/islands/${t.hash}.js`}}}if(W[M]=A0.map((t)=>t.hash),f=U0,J.prefetchIslands)f=qq(f)}}if(await V0.promises.mkdir(G0.dirname($0),{recursive:!0}),await Bun.write($0,f),!RL(M,f,b,J.sitemapExclude))L.push({loc:M,lastmod:new Date().toISOString().split("T")[0],priority:M==="/"?1:0.8});let C0={route:M,outputPath:$0,size:Buffer.byteLength(f,"utf8"),cached:l};if(I!==!1)C0.revalidateAt=Date.now()+I*1000;G.pages.push(C0),G.successCount++,await J.hooks.onPageEnd?.(M,f)}catch(S){G.failedCount++,G.errors.push({route:M,error:S}),await J.hooks.onError?.(S,M),console.error(`Error generating ${M}:`,S)}}));if(J.cache)await z.save();if(J.generate404){let R=G0.join(J.pagesDir,"404.stx");if(await Bun.file(R).exists()){let N=new Set,T={...Z,debug:!1,cache:!1},M=await O0(await Bun.file(R).text(),{},R,T,N);await Bun.write(G0.join(J.outputDir,"404.html"),M)}else await Bun.write(G0.join(J.outputDir,"404.html"),`<!DOCTYPE html>
|
|
15179
15179
|
<html lang="en">
|
|
15180
15180
|
<head>
|
|
15181
15181
|
<meta charset="UTF-8">
|
|
@@ -15196,7 +15196,7 @@ ${Z.join(`
|
|
|
15196
15196
|
<a href="/">Go home</a>
|
|
15197
15197
|
</div>
|
|
15198
15198
|
</body>
|
|
15199
|
-
</html>`)}for(let R of[500]){let N=G0.join(J.pagesDir,`${R}.stx`);if(await Bun.file(N).exists()){let T=new Set,M={...Z,debug:!1,cache:!1},k=await O0(await Bun.file(N).text(),{},N,M,T);await Bun.write(G0.join(J.outputDir,`${R}.html`),k)}}let F=G0.join(J.pagesDir,"error.stx");if(await Bun.file(F).exists()){let R=new Set,N={...Z,debug:!1,cache:!1},T=await O0(await Bun.file(F).text(),{},F,N,R);await Bun.write(G0.join(J.outputDir,"error.html"),T)}if(J.sitemap&&L.length>0){let R=
|
|
15199
|
+
</html>`)}for(let R of[500]){let N=G0.join(J.pagesDir,`${R}.stx`);if(await Bun.file(N).exists()){let T=new Set,M={...Z,debug:!1,cache:!1},k=await O0(await Bun.file(N).text(),{},N,M,T);await Bun.write(G0.join(J.outputDir,`${R}.html`),k)}}let F=G0.join(J.pagesDir,"error.stx");if(await Bun.file(F).exists()){let R=new Set,N={...Z,debug:!1,cache:!1},T=await O0(await Bun.file(F).text(),{},F,N,R);await Bun.write(G0.join(J.outputDir,"error.html"),T)}if(J.sitemap&&L.length>0){let R=NL(L,J.domain),N=G0.join(J.outputDir,"sitemap.xml");await Bun.write(N,R),G.sitemapPath=N,console.log(`Generated sitemap.xml with ${L.length} URLs`)}if(J.robots!==!1){let R=typeof J.robots==="object"?J.robots:{},N=[...J.sitemapExclude.filter((M)=>typeof M==="string"),...R.disallow||[]],T=aY({rules:[{userAgent:R.userAgent||"*",allow:R.allow||["/"],...N.length>0?{disallow:N}:{}}],...R.sitemap!==!1&&G.sitemapPath?{sitemap:new URL("/sitemap.xml",J.domain).href}:{}});await Bun.write(G0.join(J.outputDir,"robots.txt"),T),console.log("Generated robots.txt")}if(J.rss){let R=typeof J.rss==="object"?J.rss:{title:"Site Feed",description:"Latest updates",link:J.domain},N=[];if(R.getItems)N=await R.getItems();let T=TL(R,N),M=G0.join(J.outputDir,"rss.xml");await Bun.write(M,T),G.rssPath=M,console.log(`Generated rss.xml with ${N.length} items`)}let V=X2(J.outputDir);if(V.assets>0)console.log(`Externalized ${V.assets} asset(s) from ${V.pages} page(s) (${(V.bytesInlined/1024).toFixed(1)}KB removed from HTML)`);if(J.publicDir&&V0.existsSync(J.publicDir))await o4(J.publicDir,J.outputDir),console.log(`Copied public assets from ${J.publicDir}`);let A=e4();if(A)await o4(A,G0.join(J.outputDir,t4)),console.log(`Copied assets from ${O9}`)}catch(z){throw await J.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(J.outputDir,"_stx","islands-manifest.json"),JSON.stringify(z,null,2))}await J.hooks.onBuildEnd?.(G);let K=G.islandChunks?`
|
|
15200
15200
|
Island chunks: ${G.islandChunks.count} (${(G.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
|
|
15201
15201
|
Build complete!
|
|
15202
15202
|
Total: ${G.totalPages} pages
|
|
@@ -15204,8 +15204,8 @@ Build complete!
|
|
|
15204
15204
|
Cached: ${G.cachedCount}
|
|
15205
15205
|
Failed: ${G.failedCount}
|
|
15206
15206
|
Time: ${G.buildTime}ms${K}
|
|
15207
|
-
`),G}async function
|
|
15208
|
-
`)){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,""));Y[U]=B}}}let G=J.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:Y,toc:Q}}}}function
|
|
15207
|
+
`),G}async function o4($,X){let Z=await V0.promises.readdir($,{withFileTypes:!0});for(let Y of Z){let J=G0.join($,Y.name),G=G0.join(X,Y.name);if(Y.isDirectory())await V0.promises.mkdir(G,{recursive:!0}),await o4(J,G);else await V0.promises.copyFile(J,G)}}function kL($={}){let X=$.cacheDir||_1(process.cwd(),"ssg-cache"),Z=new Bq(X),Y=$.revalidate||3600;return{async get(J){let G=await Z.get(J);if(!G)return null;if(Date.now()>G.revalidateAfter)this.revalidate(J).catch(console.error);return{html:G.html,headers:{"Cache-Control":`public, max-age=${Y}, stale-while-revalidate=${Y*2}`,ETag:G.etag,"X-ISR-Generated":new Date(G.generatedAt).toISOString(),...G.headers}}},async revalidate(J){let Q=B7(".",{pagesDir:$.pagesDir||"pages"}).find((z)=>{return J.match(z.regex)!==null});if(!Q){console.warn(`Route not found for revalidation: ${J}`);return}let w=J.match(Q.regex),q={};if(w)Q.params.forEach((z,U)=>{q[z]=w[U+1]});let W=await e0(),{html:K}=await _q(Q,q,{},$,W);await Z.set(J,{html:K,generatedAt:Date.now(),revalidateAfter:Date.now()+Y*1000,etag:AL(K)}),console.log(`Revalidated: ${J}`)},async invalidate(J){if(typeof J==="string")await Z.invalidate(J);else await Z.invalidatePattern(J)}}}function IL($){return async()=>{return{paths:await $(),fallback:!1}}}function EL(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let X=await Bun.file($).text(),Z=X.match(/^---\n([\s\S]*?)\n---/),Y={},J=X;if(Z){let W=Z[1];J=X.slice(Z[0].length).trim();for(let K of W.split(`
|
|
15208
|
+
`)){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,""));Y[U]=B}}}let G=J.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:Y,toc:Q}}}}function DL($){return m$($)}function yL($,X){return`<!DOCTYPE html>
|
|
15209
15209
|
<html>
|
|
15210
15210
|
<head>
|
|
15211
15211
|
<meta charset="utf-8">
|
|
@@ -15217,4 +15217,4 @@ Build complete!
|
|
|
15217
15217
|
<p>Redirecting to <a href="${$}">${$}</a>...</p>
|
|
15218
15218
|
<script>window.location.replace('${$}')</script>
|
|
15219
15219
|
</body>
|
|
15220
|
-
</html>`}function
|
|
15220
|
+
</html>`}function bL($,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 UD={generateStaticSite:ML,createISRHandler:kL,defineStaticPaths:IL,createMarkdownLoader:EL};export{RL as isExcludedFromSitemap,ML as generateStaticSite,IL as defineStaticPaths,UD as default,EL as createMarkdownLoader,kL as createISRHandler};
|