@stacksjs/stx 0.2.86 → 0.2.88

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.
@@ -192,7 +192,7 @@ else {
192
192
  };
193
193
  })();
194
194
  </script>
195
- `}function g1($,Z,Y={}){let X=aG(Z,Y),J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);if($.includes("</html>"))return $.replace("</html>",`${X}</html>`);return $+X}function G4($){let Z=$.toLowerCase();return Z.endsWith(".css")||Z.endsWith(".scss")||Z.endsWith(".sass")||Z.endsWith(".less")}function K4($){let Z=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((X)=>Z.endsWith(X))}function W4($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Y)=>Y.test($))}function U4($){if(!x5)x5=new LY($);return x5}function v5(){if(x5)x5.stop(),x5=null}var x5=null;function _F($){let Z="",Y=null,X=!1;for(let J=0;J<$.length;J++){let Q=$[J];if(X){X=!1;continue}if(Q==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&J+1<$.length&&$[J+1]==="{"){let G=1;J+=2;while(J<$.length&&G>0){if($[J]==="{")G++;else if($[J]==="}")G--;if(G>0)Z+=$[J],J++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function zF($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=$[X.index-1];if(UF.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${Z}`);if(Q==="."&&ZK.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${Z}`)}}function qF($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!ZK.has(X))continue;let J=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function _3($){let Z=$.trim(),Y=_F(Z);zF(Y,Z),qF(Z);for(let X of $K)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!eG.allowBracketNotation&&BF.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function jF($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||$K.some((J)=>J.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=FY(X);else Z[Y]=X}return Z}function FY($,Z=0){if(Z>=eG.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>FY(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,J]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(J&&typeof J==="object")Y[X]=FY(J,Z+1);else Y[X]=J}return Y}function z0($,Z){try{let Y=jF(Z),X=Object.keys(Y),J=Object.values(Y);return O0($,X)(...J)}catch{return}}function H0($){try{return _3($),!0}catch{return!1}}function y0($,Z){try{let Y=z0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function O0($,Z){let Y=_3($),X=/^[A-Za-z_$][\w$]*$/,J=[],Q=[];for(let U=0;U<Z.length;U++){let B=Z[U];if(!X.test(B))continue;if(YK.has(B))continue;J.push(U),Q.push(B)}let G=(U)=>Function(...Q,...U,`
195
+ `}function g1($,Z,Y={}){let X=aG(Z,Y),J=$.lastIndexOf("</body>");if(J!==-1)return $.slice(0,J)+X+$.slice(J);if($.includes("</html>"))return $.replace("</html>",`${X}</html>`);return $+X}function G4($){let Z=$.toLowerCase();return Z.endsWith(".css")||Z.endsWith(".scss")||Z.endsWith(".sass")||Z.endsWith(".less")}function K4($){let Z=$.toLowerCase();return[".stx",".html",".htm",".md",".js",".ts",".jsx",".tsx",".json"].some((X)=>Z.endsWith(X))}function W4($){return[/^\./,/node_modules/,/\.stx\/output/,/\.stx\/cache/,/~$/,/\.swp$/,/\.swo$/].some((Y)=>Y.test($))}function U4($){if(!x5)x5=new LY($);return x5}function v5(){if(x5)x5.stop(),x5=null}var x5=null;function _F($){let Z="",Y=null,X=!1;for(let J=0;J<$.length;J++){let Q=$[J];if(X){X=!1;continue}if(Q==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&J+1<$.length&&$[J+1]==="{"){let G=1;J+=2;while(J<$.length&&G>0){if($[J]==="{")G++;else if($[J]==="}")G--;if(G>0)Z+=$[J],J++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function zF($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=$[X.index-1];if(UF.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${Z}`);if(Q==="."&&ZK.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${Z}`)}}function qF($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!ZK.has(X))continue;let J=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function _3($){let Z=$.trim(),Y=_F(Z);zF(Y,Z),qF(Z);for(let X of $K)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!eG.allowBracketNotation&&BF.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function jF($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||$K.some((J)=>J.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=FY(X);else Z[Y]=X}return Z}function FY($,Z=0){if(Z>=eG.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>FY(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,J]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(J&&typeof J==="object")Y[X]=FY(J,Z+1);else Y[X]=J}return Y}function z0($,Z){try{let Y=jF(Z),X=Object.keys(Y),J=Object.values(Y);return L0($,X)(...J)}catch{return}}function O0($){try{return _3($),!0}catch{return!1}}function y0($,Z){try{let Y=z0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function L0($,Z){let Y=_3($),X=/^[A-Za-z_$][\w$]*$/,J=[],Q=[];for(let U=0;U<Z.length;U++){let B=Z[U];if(!X.test(B))continue;if(YK.has(B))continue;J.push(U),Q.push(B)}let G=(U)=>Function(...Q,...U,`
196
196
  'use strict';
197
197
  try {
198
198
  return ${Y};
@@ -203,7 +203,7 @@ catch (e) {
203
203
  }
204
204
  throw e;
205
205
  }
206
- `),K=G([]);if(Q.length===Z.length)return tG(K,Q,G);return tG((...U)=>{let B=Array(J.length);for(let _=0;_<J.length;_++)B[_]=U[J[_]];return K(...B)},Q,G,(U)=>{K=G(U)})}function tG($,Z,Y,X){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...U)=>{for(let B=0;B<=8;B++)try{return G(...U)}catch(_){let z=_ instanceof Error?_.message:"",q=Q.exec(z);if(!(_ instanceof ReferenceError)||!q)return;let j=q[1];if(W.has(j)||YK.has(j))return;W.add(j),K.push(j),G=Y(K),X?.(K)}return}}function z3($){let Z=$.trim(),Y=[/\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 X of Y)if(X.test(Z))return!1;return!0}var WF,eG,$K,UF,ZK,BF,YK;var h0=D(()=>{WF={maxSanitizeDepth:10,allowBracketNotation:!1},eG={...WF},$K=[/\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/],UF=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"]),ZK=new Set(["__proto__","constructor","prototype"]),BF=/[\w)\]]\s*\[\s*['"]/;YK=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 t1($,Z){try{let Y=$.trim();if(H0(Y))return O0(Y,Object.keys(Z))(...Object.values(Z));else return z0(Y,Z)}catch{return!1}}var VY=D(()=>{h0()});function JK($){XK=$}function QK(){return XK}function GK($){q3={...q3,...$}}function KK(){q3={}}function NY($,Z={}){let Y=q3[$]||HF[$]||{message:`Unknown error (code: ${$})`},X=Y.message,J=Y.help;for(let[Q,G]of Object.entries(Z)){let K=`{{${Q}}}`;if(X=X.replace(new RegExp(K,"g"),G),J)J=J.replace(new RegExp(K,"g"),G)}return{message:X,help:J}}function WK($,Z={}){let{message:Y,help:X}=NY($,Z);return X?`${Y}
206
+ `),K=G([]);if(Q.length===Z.length)return tG(K,Q,G);return tG((...U)=>{let B=Array(J.length);for(let _=0;_<J.length;_++)B[_]=U[J[_]];return K(...B)},Q,G,(U)=>{K=G(U)})}function tG($,Z,Y,X){let Q=/^(\w+) is not defined$/,G=$,K=[],W=new Set(Z);return(...U)=>{for(let B=0;B<=8;B++)try{return G(...U)}catch(_){let z=_ instanceof Error?_.message:"",q=Q.exec(z);if(!(_ instanceof ReferenceError)||!q)return;let j=q[1];if(W.has(j)||YK.has(j))return;W.add(j),K.push(j),G=Y(K),X?.(K)}return}}function z3($){let Z=$.trim(),Y=[/\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 X of Y)if(X.test(Z))return!1;return!0}var WF,eG,$K,UF,ZK,BF,YK;var h0=D(()=>{WF={maxSanitizeDepth:10,allowBracketNotation:!1},eG={...WF},$K=[/\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/],UF=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"]),ZK=new Set(["__proto__","constructor","prototype"]),BF=/[\w)\]]\s*\[\s*['"]/;YK=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 t1($,Z){try{let Y=$.trim();if(O0(Y))return L0(Y,Object.keys(Z))(...Object.values(Z));else return z0(Y,Z)}catch{return!1}}var VY=D(()=>{h0()});function JK($){XK=$}function QK(){return XK}function GK($){q3={...q3,...$}}function KK(){q3={}}function NY($,Z={}){let Y=q3[$]||HF[$]||{message:`Unknown error (code: ${$})`},X=Y.message,J=Y.help;for(let[Q,G]of Object.entries(Z)){let K=`{{${Q}}}`;if(X=X.replace(new RegExp(K,"g"),G),J)J=J.replace(new RegExp(K,"g"),G)}return{message:X,help:J}}function WK($,Z={}){let{message:Y,help:X}=NY($,Z);return X?`${Y}
207
207
  Help: ${X}`:Y}function j3($){for(let[Z,Y]of Object.entries(e))if(Y===$)return Z;return}var HF,q3,XK="en",e;var H3=D(()=>{HF={1001:{message:"Unclosed directive: {{directive}}",help:"Make sure to close the directive with the appropriate end tag"},1002:{message:"Unclosed expression at position {{position}}",help:"Check for missing closing braces }}"},1003:{message:"Invalid directive syntax: {{directive}}",help:"Review the directive documentation for correct syntax"},1004:{message:"Malformed expression: {{expression}}",help:"Check for syntax errors in your expression"},1005:{message:"Unexpected token: {{token}}",help:"Remove or fix the unexpected token"},1101:{message:"Undefined variable: {{variable}}",help:"Make sure the variable is defined in the template context"},1102:{message:"Type error: {{details}}",help:"Check that you are using the correct types"},1103:{message:"Evaluation error: {{details}}",help:"Review the expression for errors"},1104:{message:"Infinite loop detected in {{location}}",help:"Check your loop conditions"},1105:{message:"Circular reference detected: {{path}}",help:"Remove the circular dependency"},1201:{message:"Unsafe expression blocked: {{expression}}",help:"This expression contains potentially dangerous code"},1202:{message:"Path traversal attempt blocked: {{path}}",help:"Use only relative paths within allowed directories"},1203:{message:"Potential XSS attempt blocked",help:"Sanitize user input before rendering"},1204:{message:"Code injection attempt blocked: {{code}}",help:"Avoid executing dynamic code"},1205:{message:"Prohibited DOM API usage: {{api}}",help:"Use STX.useRefs(), STX.useRef(), STX.el() and other STX helpers instead of direct DOM manipulation"},1301:{message:"File not found: {{path}}",help:"Check that the file exists and the path is correct"},1302:{message:"Error reading file: {{path}}",help:"Check file permissions and encoding"},1303:{message:"Invalid file path: {{path}}",help:"Use a valid file path"},1304:{message:"Permission denied: {{path}}",help:"Check file permissions"},1401:{message:"Invalid configuration: {{details}}",help:"Review your stx.config.ts file"},1402:{message:"Missing required configuration: {{key}}",help:"Add the required configuration option"},1403:{message:"Deprecated configuration: {{key}}",help:"Update to the new configuration format"},1501:{message:"Component not found: {{name}}",help:"Check that the component exists in your components directory"},1502:{message:"Invalid props for component {{name}}: {{details}}",help:"Check the component prop requirements"},1503:{message:"Error rendering component {{name}}: {{details}}",help:"Check the component template for errors"},1601:{message:"Filter not found: {{filter}}",help:"Register the filter or check the filter name"},1602:{message:"Invalid arguments for filter {{filter}}: {{details}}",help:"Check the filter documentation for correct arguments"},1603:{message:"Expression evaluation timed out",help:"Simplify the expression or increase the timeout"}},q3={};e={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 f5(){return!1}function F$(){return!f5()||process.env.STX_DEBUG==="true"}function B4(){return!1}import OF from"path";function BK($){g5={...g5,...$}}function _4(){return{...g5}}function _K(){g5={...UK}}function z4($){if(!g5.showRelativePaths||!$)return $;let Z=g5.baseDir||process.cwd();try{let Y=OF.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var UK,g5,V$,AY,k1,wY,h5,q4;var O3=D(()=>{H3();UK={showRelativePaths:!1,enableAutoRecovery:F$(),logRecoveryWarnings:!0},g5={...UK};V$=class V$ extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,J,Q,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=J;this.context=Q;if(this.name="StxError",this.numericCode=G||e.EVALUATION_ERROR,this.filePath)this.filePath=z4(this.filePath)}};AY=class AY extends V${constructor($,Z,Y,X,J,Q){super($,"stx_SYNTAX_ERROR",Z,Y,X,J,Q||e.INVALID_DIRECTIVE_SYNTAX);this.name="StxSyntaxError"}};k1=class k1 extends V${constructor($,Z,Y,X,J,Q){super($,"stx_RUNTIME_ERROR",Z,Y,X,J,Q||e.EVALUATION_ERROR);this.name="StxRuntimeError"}};wY=class wY extends V${constructor($,Z,Y,X,J,Q){super($,"stx_SECURITY_ERROR",Z,Y,X,J,Q||e.UNSAFE_EXPRESSION);this.name="StxSecurityError"}};h5=class h5 extends V${constructor($,Z,Y,X,J,Q){super($,"stx_FILE_ERROR",Z,Y,X,J,Q||e.FILE_NOT_FOUND);this.name="StxFileError"}};q4=class q4 extends V${isFatal=!0;constructor($,Z,Y,X,J,Q){super($,"stx_VALIDATION_ERROR",Z,Y,X,J,Q||e.DOM_API_VIOLATION);this.name="StxValidationError"}}});function L3($){let{type:Z,message:Y,code:X,filePath:J,line:Q,column:G,template:K,offset:W,snippet:U,suggestion:B,format:_="text"}=$,z=Q,q=G;if(!z&&K&&W!==void 0){let L=qK(K,W);z=L.line,q=L.column}let j=J?z4(J):void 0,H=X?j3(X):void 0,O={type:Z,code:X,codeName:H,message:Y,filePath:j,line:z,column:q,snippet:U,suggestion:B,timestamp:new Date().toISOString()},F;switch(_){case"html":F=FF(O);break;case"json":F=JSON.stringify(O,null,2);break;case"console":F=VF(O,K,W);break;case"text":default:F=LF(O,K,W);break}return{formatted:F,data:O}}function LF($,Z,Y){let X=[],J=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${J}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}X.push(`at ${Q}`)}if(X.push(`
208
208
  ${$.message}`),Z&&$.line){let Q=NF(Z,$.line,2);if(Q)X.push(`
209
209
  ${Q}`)}if($.snippet)X.push(`
@@ -238,7 +238,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
238
238
  @end${K}`;X.push(`Added ${B} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(F$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};o0=new V3,d5={isDevelopment(){return F$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
239
239
  `)}}});import RY from"path";function wF($){let Z={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"};return $.replace(/[&<>"']/g,(Y)=>Z[Y]||Y)}function j4($,Z={}){let{allowHtml:Y=!1,maxLength:X=1e4,allowSpecialChars:J=!0,customSanitizer:Q}=Z,G=[],K=$,W=!1;if(Q){let B=Q(K);if(B!==K)K=B,W=!0}if(K.includes("\x00"))K=K.replace(/\0/g,""),W=!0,G.push("Null bytes removed from parameter");if(K.length>X)K=K.substring(0,X),W=!0,G.push(`Parameter truncated to ${X} characters`);if(!Y&&/<[^>]+>/.test(K))K=wF(K),W=!0,G.push("HTML content was escaped");let U=[{pattern:/javascript:/gi,replacement:"",name:"javascript: URI"},{pattern:/vbscript:/gi,replacement:"",name:"vbscript: URI"},{pattern:/data:text\/html/gi,replacement:"",name:"data:text/html URI"}];for(let{pattern:B,replacement:_,name:z}of U)if(B.test(K))K=K.replace(B,_),W=!0,G.push(`Removed ${z} from parameter`);if(!J){let B=K;if(K=K.split("").filter((_)=>{let z=_.charCodeAt(0);return z>=32&&z!==127}).join(""),K!==B)W=!0,G.push("Control characters removed")}return{value:K,modified:W,warnings:G}}function VK($,Z){let Y=$.replace(/\0/g,"");Y=Y.replace(/\\/g,"/"),Y=Y.replace(/^[a-z][a-z0-9+.-]*:/i,"");while(Y.includes("../")||Y.includes("./"))Y=Y.replace(/\.\.\//g,"").replace(/\.\//g,"");if(!N3.isValidFilePath(Y,Z))return null;return Y}function NK($){let Z=[],Y=$.trim(),X=Y!==$,J=[{pattern:/\beval\s*\(/gi,name:"eval()"},{pattern:/\bFunction\s*\(/gi,name:"Function()"},{pattern:/\bsetTimeout\s*\(/gi,name:"setTimeout()"},{pattern:/\bsetInterval\s*\(/gi,name:"setInterval()"},{pattern:/\bimport\s*\(/gi,name:"dynamic import()"},{pattern:/\brequire\s*\(/gi,name:"require()"},{pattern:/\b__proto__\b/gi,name:"__proto__"},{pattern:/\bconstructor\b/gi,name:"constructor"},{pattern:/\bprototype\b/gi,name:"prototype"}];for(let{pattern:Q,name:G}of J)if(Q.test(Y))Z.push(`Potentially dangerous pattern detected: ${G}`);if(Y.includes("\x00"))Y=Y.replace(/\0/g,""),X=!0,Z.push("Null bytes removed from expression");return{value:Y,modified:X,warnings:Z}}function AK($,Z={}){return $.map((Y)=>j4(Y,Z))}function MY($){let Z={};for(let[Y,X]of Object.entries($)){if(!N3.isValidVariableName(Y))continue;if(typeof X==="string"){let J=j4(X);Z[Y]=J.value}else if(Array.isArray(X))Z[Y]=X.map((J)=>typeof J==="string"?j4(J).value:J);else if(typeof X==="object"&&X!==null)Z[Y]=MY(X);else Z[Y]=X}return Z}var N3;var wK=D(()=>{N3={isValidFilePath($,Z){let Y=$.replace(/\\/g,"/");if(Y.includes("\x00"))return!1;if(Y.includes("../")||Y.includes("..\\")||Y===".."||Y.startsWith("../")||Y.endsWith("/..")||Y.includes("/..\\")||Y.includes("\\../"))return!1;if(/^[a-z][a-z0-9+.-]*:/i.test(Y))return!1;if(Y.startsWith("/")){if(["/etc/","/root/","/var/","/usr/","/bin/","/sbin/","/proc/","/sys/","/dev/","/boot/","/home/","/private/","/Library/","/System/"].some((Q)=>Y===Q.slice(0,-1)||Y.startsWith(Q)))return!1}if(/^[a-z]:/i.test(Y)){if(["Windows/","Windows\\","System32/","System32\\","Program Files/","Program Files\\"].some((Q)=>Y.includes(Q)))return!1}if(Z){let J=RY.resolve(Z,$),Q=RY.resolve(Z);if(!J.startsWith(Q+RY.sep)&&J!==Q)return!1}return!0},isValidVariableName($){return/^[a-z_$]\w*$/i.test($)},isValidDirectiveName($){return/^[a-z][\w-]*$/i.test($)},isSafeContent($){return![/<script[^>]*>[\s\S]*?<\/script>/i,/javascript:/i,/data:text\/html/i,/vbscript:/i,/on\w+\s*=/i].some((Y)=>Y.test($))}}});var RK=D(()=>{H3();LK();FK();wK();O3()});var j1=D(()=>{RK()});class H4{source;pos=0;line=1;column=0;tokens=[];constructor($){this.source=$}tokenize(){this.tokens=[],this.pos=0,this.line=1,this.column=0;while(this.pos<this.source.length){let $=this.nextToken();if($)this.tokens.push($)}return this.tokens.push({type:"EOF",value:"",start:this.pos,end:this.pos,line:this.line,column:this.column}),this.tokens}nextToken(){if(this.pos>=this.source.length)return null;let $=this.pos,Z=this.line,Y=this.column,X=this.source[this.pos];if(/\s/.test(X))return this.readWhitespace($,Z,Y);if(X==="/"&&this.peek(1)==="/")return this.readLineComment($,Z,Y);if(X==="/"&&this.peek(1)==="*")return this.readBlockComment($,Z,Y);if(X==='"'||X==="'")return this.readString(X,$,Z,Y);if(X==="`")return this.readTemplateString($,Z,Y);if(/\d/.test(X)||X==="."&&/\d/.test(this.peek(1)||""))return this.readNumber($,Z,Y);if(/[a-z_$]/i.test(X))return this.readIdentifier($,Z,Y);if(X==="{"){if(this.peek(1)==="{"&&this.peek(2)==="{")return this.advance(3),{type:"RAW_START",value:"{{{",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="{")return this.advance(2),{type:"EXPRESSION_START",value:"{{",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="!"&&this.peek(2)==="!")return this.advance(3),{type:"RAW_START",value:"{!!",start:$,end:this.pos,line:Z,column:Y}}if(X==="}"){if(this.peek(1)==="}"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"}}}",start:$,end:this.pos,line:Z,column:Y};if(this.peek(1)==="}")return this.advance(2),{type:"EXPRESSION_END",value:"}}",start:$,end:this.pos,line:Z,column:Y}}if(X==="!"&&this.peek(1)==="!"&&this.peek(2)==="}")return this.advance(3),{type:"RAW_END",value:"!!}",start:$,end:this.pos,line:Z,column:Y};if(X==="@"&&/[a-z]/i.test(this.peek(1)||""))return this.readDirective($,Z,Y);let J=["===","!==","==","!=","<=",">=","&&","||","??","++","--","+=","-=","*=","/=","%=","**","=>","?.","...","<<",">>",">>>","&=","|=","^="];for(let Q of J)if(this.source.slice(this.pos,this.pos+Q.length)===Q)return this.advance(Q.length),{type:"OPERATOR",value:Q,start:$,end:this.pos,line:Z,column:Y};if(/[+\-*/%<>=!&|^~?:]/.test(X))return this.advance(),{type:"OPERATOR",value:X,start:$,end:this.pos,line:Z,column:Y};if(/[()[\]{},;.]/.test(X))return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:Y};return this.advance(),{type:"PUNCTUATION",value:X,start:$,end:this.pos,line:Z,column:Y}}readWhitespace($,Z,Y){while(this.pos<this.source.length&&/\s/.test(this.source[this.pos]))this.advance();return{type:"WHITESPACE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readLineComment($,Z,Y){this.advance(2);while(this.pos<this.source.length&&this.source[this.pos]!==`
240
240
  `)this.advance();return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readBlockComment($,Z,Y){this.advance(2);while(this.pos<this.source.length-1){if(this.source[this.pos]==="*"&&this.source[this.pos+1]==="/"){this.advance(2);break}this.advance()}return{type:"COMMENT",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readString($,Z,Y,X){this.advance();while(this.pos<this.source.length){let J=this.source[this.pos];if(J==="\\"){this.advance(2);continue}if(J===$){this.advance();break}this.advance()}return{type:"STRING",value:this.source.slice(Z,this.pos),start:Z,end:this.pos,line:Y,column:X}}readTemplateString($,Z,Y){this.advance();let X=0,J=256;while(this.pos<this.source.length){let Q=this.source[this.pos];if(Q==="\\"){this.advance(2);continue}if(Q==="$"&&this.peek(1)==="{"){if(X>=J){this.pos=this.source.length;break}this.advance(2),X++;continue}if(Q==="{"&&X>0){X++,this.advance();continue}if(Q==="}"&&X>0){X--,this.advance();continue}if(Q==="`"&&X===0){this.advance();break}this.advance()}return{type:"TEMPLATE_STRING",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readNumber($,Z,Y){if(this.source[this.pos]==="0"){let X=this.peek(1)?.toLowerCase();if(X==="x"||X==="o"||X==="b"){this.advance(2);while(this.pos<this.source.length&&/[\da-f_]/i.test(this.source[this.pos]))this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}}while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance();if(this.source[this.pos]==="."&&/\d/.test(this.peek(1)||"")){this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(/e/i.test(this.source[this.pos]||"")){if(this.advance(),/[+-]/.test(this.source[this.pos]||""))this.advance();while(this.pos<this.source.length&&/[\d_]/.test(this.source[this.pos]))this.advance()}if(this.source[this.pos]==="n")this.advance();return{type:"NUMBER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readIdentifier($,Z,Y){while(this.pos<this.source.length&&/[\w$]/.test(this.source[this.pos]))this.advance();return{type:"IDENTIFIER",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}readDirective($,Z,Y){this.advance();while(this.pos<this.source.length&&/[a-z]/i.test(this.source[this.pos]))this.advance();return{type:"DIRECTIVE",value:this.source.slice($,this.pos),start:$,end:this.pos,line:Z,column:Y}}advance($=1){for(let Z=0;Z<$&&this.pos<this.source.length;Z++){if(this.source[this.pos]===`
241
- `)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function P0($,Z,Y,X=0){let J=0,Q=X,G=null,K=0,W=!1;while(Q<$.length){let U=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&U==="\\"){W=!0,Q++;continue}if(W=!1,(U==='"'||U==="'"||U==="`")&&!G){G=U,Q++;continue}if(U===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&U==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&U==="}"){K--,Q++;continue}if(U==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(U===Z)J++;else if(U===Y){if(J--,J===0)return Q}Q++}return-1}function TY($,Z){let Y=Z,X={paren:0,bracket:0,brace:0},J=null,Q=0;while(Y<$.length){let G=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&J){Y++;continue}if((G==='"'||G==="'")&&!J){J=G,Y++;continue}if(G===J&&J!=="`"){J=null,Y++;continue}if(G==="`"&&!J){J="`",Y++;continue}if(G==="`"&&J==="`"&&Q===0){J=null,Y++;continue}if(J==="`"&&G==="$"&&$[Y+1]==="{"){Q++,Y+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;Y++;continue}if(J){Y++;continue}if(X.paren===0&&X.bracket===0&&X.brace===0){if($.slice(Y,Y+2)==="}}"||$.slice(Y,Y+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")X.paren++;else if(G===")"){if(X.paren--,X.paren<0)break}else if(G==="[")X.bracket++;else if(G==="]"){if(X.bracket--,X.bracket<0)break}else if(G==="{")X.brace++;else if(G==="}"){if(X.brace--,X.brace<0)break}Y++}return{expression:$.slice(Z,Y),endPos:Y}}function A3($){let Z=[],Y="",X={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let K=$[G];if((G>0?$[G-1]:"")==="\\"&&J){Y+=K;continue}if((K==='"'||K==="'")&&!J){J=K,Y+=K;continue}if(K===J&&J!=="`"){J=null,Y+=K;continue}if(K==="`"&&!J){J="`",Y+=K;continue}if(K==="`"&&J==="`"&&Q===0){J=null,Y+=K;continue}if(J==="`"&&K==="$"&&$[G+1]==="{"){Q++,Y+=K+$[G+1],G++;continue}if(Q>0&&K==="{"){Q++,Y+=K;continue}if(Q>0&&K==="}"){Q--,Y+=K;continue}if(J){Y+=K;continue}if(K==="(")X.paren++;else if(K===")")X.paren--;else if(K==="[")X.bracket++;else if(K==="]")X.bracket--;else if(K==="{")X.brace++;else if(K==="}")X.brace--;if(K==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(Y.trim()),Y="";continue}if(K==="|"&&$[G-1]==="\\"&&!J){Y=Y.slice(0,-1)+K;continue}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function e1($,Z){let Y=RF($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function RF($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=P0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function N$($,Z,Y,X){let J=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&J>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),U=K.exec($),B=W?W.index:1/0,_=U?U.index:1/0;if(B<_)J++,Q=B+W[0].length;else if(_<1/0){if(J--,J===0)return _;Q=_+U[0].length}else break}return-1}function IY($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,J=e1($,X);if(!J)return null;let Q=J.endPos,G=N$($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],U=0,B="if",_=J.expression,z=0,q=0;while(U<K.length){let j=K.indexOf("@",U);if(j===-1)break;U=j;let H=K.substring(j);if(/^@if\s*\(/.test(H)){q++,U++;continue}if(/^@endif(?![a-z])/.test(H)){q--,U+=6;continue}if(q===0){let O=H.match(/^@elseif\s*/);if(O){W.push({type:B,condition:_,content:K.substring(z,U),start:Q+z,end:Q+U});let F=U+O[0].length,L=e1(K,F);if(!L){U++;continue}B="elseif",_=L.expression,U=L.endPos,z=U;continue}else if(/^@else(?![a-z])/.test(H)){W.push({type:B,condition:_,content:K.substring(z,U),start:Q+z,end:Q+U}),B="else",_=void 0,U+=5,z=U;continue}}U++}return W.push({type:B,condition:_,content:K.slice(z),start:Q+z,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function u5($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let Q=IY($,X.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;X=Y.exec($)}return Z}function O4($,Z,Y){let X=[],J=new RegExp(`@${Z}\\s*\\(`,"g"),Q=J.exec($);while(Q!==null){if(X.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=J.exec($);continue}let K=Q.index,W=K+Q[0].length-1,U=P0($,"(",")",W);if(U===-1){Q=J.exec($);continue}let B=$.slice(W+1,U),_=U+1,z=N$($,Z,Y,_);if(z===-1){Q=J.exec($);continue}let q=$.slice(_,z),j=z+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:B,content:q,start:K,end:j}),J.lastIndex=j,Q=J.exec($)}return X}function w3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,J=e1($,X);if(!J)return null;let Q=J.endPos,G=N$($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],U=0,B=null,_=0;while(U<K.length){let z=K.slice(U),q=z.match(/^@switch\s*\(/),j=z.match(/^@endswitch(?![a-z])/);if(q){if(_++,B)B.content+=q[0];U+=q[0].length;continue}if(j){if(_--,B)B.content+=j[0];U+=j[0].length;continue}if(_>0){if(B)B.content+=K[U];U++;continue}let H=z.match(/^@case\s*/),O=z.match(/^@default(?![a-z])/),F=z.match(/^@break(?![a-z])/);if(H&&z.startsWith("@case")){if(B)W.push(B);let L=U+H[0].length,V=e1(K,L);if(!V){U++;continue}B={type:"case",value:V.expression,content:""},U=V.endPos}else if(O&&z.startsWith("@default")){if(B)W.push(B);B={type:"default",content:""},U+=O[0].length}else if(F&&z.startsWith("@break"))U+=F[0].length;else{if(B)B.content+=K[U];U++}}if(B)W.push(B);return{fullMatch:$.slice(Z,G+10),expression:J.expression,cases:W,start:Z,end:G+10}}var MK=()=>{};function EK($){let Z=[],Y=0;while(Y<$.length){let X=$.indexOf("{{",Y),J=$.indexOf("{!!",Y),Q=!1,G;if(X===-1&&J===-1)break;else if(X===-1)G=J,Q=!0;else if(J===-1)G=X,Q=!1;else if(J<X)G=J,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let K=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",W=Q?K==="{{{"?"}}}":"!!}":"}}",U=G+K.length,B=MF($,U,W);if(B===-1){Y=G+1;continue}let _=$.slice(U,B).trim(),z=B+W.length;Z.push({fullMatch:$.slice(G,z),expression:_,start:G,end:z,isRaw:Q}),Y=z}return Z}function MF($,Z,Y){let X=Z,J=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let K=$[X];if((X>0?$[X-1]:"")==="\\"&&J){X++;continue}if((K==='"'||K==="'")&&!J){J=K,X++;continue}if(K===J&&J!=="`"){J=null,X++;continue}if(K==="`"&&!J){J="`",X++;continue}if(K==="`"&&J==="`"&&G===0){J=null,X++;continue}if(J==="`"&&K==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(K==="{")G++;else if(K==="}")G--;X++;continue}if(J){X++;continue}if(K==="(")Q.paren++;else if(K===")")Q.paren--;else if(K==="[")Q.bracket++;else if(K==="]")Q.bracket--;else if(K==="{")Q.brace++;else if(K==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+Y.length)===Y)return X}X++}return-1}function DK($){let Z=A3($);if(Z.length===0)return{baseExpression:"",filters:[]};let Y=Z[0],X=[];for(let J=1;J<Z.length;J++){let Q=TF(Z[J]);if(Q)X.push(Q)}return{baseExpression:Y,filters:X}}function TF($){let Z=$.trim();if(!Z)return null;let Y=Z.indexOf("(");if(Y===-1)return{name:Z,args:[]};let X=Z.slice(0,Y).trim(),J=Y+1,Q=P0(Z,"(",")",Y);if(Q===-1)return{name:X,args:[]};let G=Z.slice(J,Q),K=EY(G);return{name:X,args:K}}function EY($){let Z=[],Y="",X={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let K=$[G];if((G>0?$[G-1]:"")==="\\"&&J){Y+=K;continue}if((K==='"'||K==="'")&&!J){J=K,Y+=K;continue}if(K===J&&J!=="`"){J=null,Y+=K;continue}if(K==="`"&&!J){J="`",Y+=K;continue}if(K==="`"&&J==="`"&&Q===0){J=null,Y+=K;continue}if(J==="`"&&K==="$"&&$[G+1]==="{"){Q++,Y+="${",G++;continue}if(Q>0&&K==="{"){Q++,Y+=K;continue}if(Q>0&&K==="}"){Q--,Y+=K;continue}if(J){Y+=K;continue}if(K==="(")X.paren++;else if(K===")")X.paren--;else if(K==="[")X.bracket++;else if(K==="]")X.bracket--;else if(K==="{")X.brace++;else if(K==="}")X.brace--;if(K===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(Y.trim()),Y="";continue}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function kK($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;let X=P0($,"(",")",Y);if(X===-1)return null;return{params:$.slice(Y+1,X),endPos:X+1}}function SK($){let Z=[],X=new H4($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),J=0;while(J<X.length){let Q=X[J],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,J++,J>=X.length)break}let K=X[J];if(K.type==="IDENTIFIER"&&(K.value==="const"||K.value==="let"||K.value==="var")){let W=K.value;if(J++,J>=X.length)break;let U=X[J];if(U.type==="IDENTIFIER"){let B=U.value;if(J++,J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let _=J<X.length?X[J].start:$.length,z=TK(X,J,$);J=z.nextIndex,Z.push({type:"variable",name:B,value:$.slice(_,z.endPos),exported:G,start:K.start,end:z.endPos})}}else if(U.type==="PUNCTUATION"&&(U.value==="{"||U.value==="[")){let B=U.start,_=U.value==="{"?"}":"]",z=P0($,U.value,_,B);if(z!==-1){let q=$.slice(B,z+1);if(J=IK(X,z+1),J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let j=J<X.length?X[J].start:$.length,H=TK(X,J,$);J=H.nextIndex;let O=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:O,value:`${$.slice(j,H.endPos)}; ${W} ${q} = ${O}`,exported:G,start:K.start,end:H.endPos})}}}}else if(K.type==="IDENTIFIER"&&K.value==="function"){let W=G?X[J-1].start:K.start;if(J++,J>=X.length)break;let U=X[J];if(U.type==="IDENTIFIER"){let B=U.value;J++;let _=-1;while(J<X.length){if(X[J].type==="PUNCTUATION"&&X[J].value==="{"){_=X[J].start;break}J++}if(_!==-1){let z=P0($,"{","}",_);if(z!==-1)Z.push({type:"function",name:B,value:$.slice(W,z+1).replace(/^export\s+/,""),exported:G,start:W,end:z+1}),J=IK(X,z+1)}}}else J++}return Z}function TK($,Z,Y){let X=Z,J={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:Y.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")J.paren++;else if(G.value===")")J.paren--;else if(G.value==="[")J.bracket++;else if(G.value==="]")J.bracket--;else if(G.value==="{")J.brace++;else if(G.value==="}")J.brace--;if(G.value===";"&&J.paren===0&&J.bracket===0&&J.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(J.paren===0&&J.bracket===0&&J.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function IK($,Z){for(let Y=0;Y<$.length;Y++)if($[Y].start>=Z)return Y;return $.length}var bK=()=>{};var L4=D(()=>{MK();bK()});function IF($,Z,Y){let X=$,J=!0;while(J){J=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=w3(X,G);if(!K)break;try{let W;if(H0(K.expression))W=O0(K.expression,Object.keys(Z))(...Object.values(Z));else W=z0(K.expression,Z);let U="",B=!1;for(let _ of K.cases)if(_.type==="default"){if(!B)U=_.content.trim()}else try{let z;if(_.value&&H0(_.value))z=O0(_.value,Object.keys(Z))(...Object.values(Z));else if(_.value)z=z0(_.value,Z);if(W===z){U=_.content.trim(),B=!0;break}}catch{continue}X=X.substring(0,G)+U+X.substring(K.end),J=!0}catch(W){let U=W instanceof Error?W.message:String(W),B=J0("Switch",`Error evaluating @switch expression: ${U}`,e.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(K.end);break}}return X}function Q5($,Z,Y){let X=$;X=IF(X,Z,Y);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=e1(X,K+7);if(!W)break;let U=W.endPos,B=N$(X,"unless","endunless",U);if(B===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let _=X.slice(U,B),z=W.expression,q=-1;{let H=0,O=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,V=[],N;while((N=O.exec(_))!==null)V.push({pos:N.index,type:"open"});while((N=F.exec(_))!==null)V.push({pos:N.index,type:"close"});while((N=L.exec(_))!==null)V.push({pos:N.index,type:"else"});V.sort((A,w)=>A.pos-w.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){q=A.pos;break}}let j;if(q!==-1){let H=_.slice(0,q),O=_.slice(q+5);j=`@if (${z})${O}@else ${H}@endif`}else j=`@if (!(${z}))${_}@endif`;X=X.substring(0,K)+j+X.substring(B+10),Q=!0}}X=kY(X,Z,Y),X=SY(X,Z,Y),X=DY(X,Z);let J=()=>{let Q=u5(X);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",U=!1;for(let B of K.branches){if(U)break;if(B.type==="else")W=B.content,U=!0;else try{let _;if(B.condition&&H0(B.condition))_=O0(B.condition,Object.keys(Z))(...Object.values(Z));else if(B.condition)_=z0(B.condition,Z);if(_)W=B.content,U=!0}catch(_){W=J0(B.type==="if"?"If":"Elseif",`Error in @${B.type}(${B.condition}): ${_ instanceof Error?_.message:String(_)}`,e.EVALUATION_ERROR),U=!0}}X=X.substring(0,K.start)+W+X.substring(K.end)}catch(W){let U=W instanceof Error?W.message:String(W),B=J0("If",`Error processing @if block: ${U}`,e.EVALUATION_ERROR);X=X.substring(0,K.start)+B+X.substring(K.end)}}return!0};while(!0){let Q=X;if(!J())break;if(X===Q)break}return X}function CK($){let Z=0;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 X=[];while(Z<$.length){let J=$[Z];if(J==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(J===Y){Z++;break}X.push(J),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function DY($,Z){let Y=$;function X(K,W,U,B){let _=1,z=B,q=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${U}(?![a-z])`,"g");while(z<K.length&&_>0){q.lastIndex=z,j.lastIndex=z;let H=q.exec(K),O=j.exec(K),F=H?H.index:1/0,L=O?O.index:1/0;if(F<L)_++,z=F+H[0].length;else if(L<1/0){if(_--,_===0)return L;z=L+O[0].length}else break}return-1}function J(K,W,U){let B=0,_=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${U}(?![a-z])`,"g"),q=/@else(?![a-z])/g,j=[],H;while((H=_.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=z.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=q.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((O,F)=>O.pos-F.pos);for(let O of j)if(O.type==="open")B++;else if(O.type==="close")B--;else if(O.type==="else"&&B===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let W=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let U=W.index,B,_,z=Y.slice(U+5),q=CK(z);if(q)B=q.value,_=U+5+q.consumed;else _=U+5;let j=X(Y,"auth","endauth",_);if(j===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(_,j),O=J(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=B?t1(`auth?.check && auth?.user?.[${B}]`,Z):t1("auth?.check",Z);let L;if(O!==-1){let V=H.slice(0,O),N=H.slice(O+5);L=F?V:N}else L=F?H:"";Y=Y.substring(0,U)+L+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let W=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let U=W.index,B,_,z=Y.slice(U+6),q=CK(z);if(q)B=q.value,_=U+6+q.consumed;else _=U+6;let j=X(Y,"guest","endguest",_);if(j===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(_,j),O=J(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=B?t1(`!auth?.check || !auth?.user?.[${B}]`,Z):t1("!auth?.check",Z);let L;if(O!==-1){let V=H.slice(0,O),N=H.slice(O+5);L=F?V:N}else L=F?H:"";Y=Y.substring(0,U)+L+Y.substring(j+9),K=!0}}function Q(K,W,U){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let B=[K];if(W)B.push(W);if(U){let _=t1(U,Z);B.push(_)}return Z.permissions.check(...B)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,U=K==="can"?"elsecan":"elsecannot",B=!0;while(B){B=!1;let _=Y.match(new RegExp(`@${K}\\s*\\(`));if(!_||_.index===void 0)break;let z=_.index,q=Y.slice(z+`@${K}`.length),j=G(q);if(!j)break;let H=z+`@${K}`.length+j.paramsEnd,O=X(Y,K,W,H);if(O===-1){console.warn(`[stx] @${K} directive at position ${z} has no matching @${W} \u2014 the block was skipped.`);break}let F=Y.slice(H,O),L=[],V=0,N=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${W}(?![a-z])`,"g"),w=new RegExp(`@${U}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],I;while((I=N.exec(F))!==null)T.push({pos:I.index,type:"open"});while((I=A.exec(F))!==null)T.push({pos:I.index,type:"close"});while((I=w.exec(F))!==null)T.push({pos:I.index,type:"elseDirective"});while((I=R.exec(F))!==null)T.push({pos:I.index,type:"else"});T.sort((b,f)=>b.pos-f.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)L.push(b)}let E=[],k=0;for(let b=0;b<L.length;b++){let f=L[b];if(E.push({content:F.slice(k,f.pos),ability:void 0}),f.type==="elseDirective"){let r=F.slice(f.pos+`@${U}`.length),u=G(r);if(u){E[E.length-1]={content:F.slice(k,f.pos)},k=f.pos+`@${U}`.length+u.paramsEnd,E.push({content:"",ability:u.ability,type:u.type,id:u.id}),E.pop();let C=L[b+1],h=C?C.pos:F.length;E.push({content:F.slice(k,h),ability:u.ability,type:u.type,id:u.id}),k=h}}else k=f.pos+5}if(k<F.length){let b=E[E.length-1];if(L.length>0&&L[L.length-1].type==="else")E.push({content:F.slice(k),isFinalElse:!0});else if(E.length===0)E.push({content:F.slice(k)})}let S=Q(j.ability,j.type,j.id),x=K==="can"?S:!S,y="";if(x)y=E[0]?.content||"";else{let b=!1;for(let f=1;f<E.length;f++){let r=E[f];if(r.isFinalElse){y=r.content,b=!0;break}if(r.ability){let u=Q(r.ability,r.type,r.id);if(K==="can"?u:!u){y=r.content,b=!0;break}}}if(!b&&E.length>0){let f=E[E.length-1];if(f.isFinalElse)y=f.content}}Y=Y.substring(0,z)+y+Y.substring(O+`@${W}`.length),B=!0}}return Y}function kY($,Z,Y){let X=$;function J(Q,G,K,W,U){let B=!0;while(B){B=!1;let _=new RegExp(`@${G}\\s*\\(`),z=Q.match(_);if(!z||z.index===void 0)break;let q=z.index,j=e1(Q,q+`@${G}`.length);if(!j)break;let H=j.endPos,O=N$(Q,G,K,H);if(O===-1){console.warn(`[stx] @${G} directive at position ${q} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(H,O),L=j.expression,V=-1,N=0,A=0;while(A<F.length){let w=F.indexOf("@",A);if(w===-1)break;let R=F.substring(w);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){N++,A=w+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){N--,A=w+1;continue}if(N===0&&/^@else(?![a-z])/.test(R)){V=w;break}A=w+1}try{let w=W(L.trim()),R;if(V!==-1){let T=F.slice(0,V),I=F.slice(V+5);R=w?T:I}else R=w?F:"";Q=Q.substring(0,q)+R+Q.substring(O+`@${K}`.length),B=!0}catch(w){let R=w instanceof Error?w.message:String(w),T=J0(U,`Error processing @${G} directive: ${R}`,e.EVALUATION_ERROR);Q=Q.substring(0,q)+T+Q.substring(O+`@${K}`.length);break}}return Q}return X=J(X,"isset","endisset",(Q)=>{let G=t1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=J(X,"empty","endempty",(Q)=>{let G=t1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function SY($,Z,Y){let X=$,J="development";function Q(G,K,W,U){let B=new RegExp(`@${K}(?![a-z])`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g"),z=new RegExp(`^@${K}(?![a-z])`),q=new RegExp(`^@${W}(?![a-z])`),j=G,H=!0;while(H){H=!1,B.lastIndex=0;let O=B.exec(j);if(!O)break;let F=O.index,L=F+O[0].length;if(K==="env"){let S=j.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!S)break;L+=S[0].length,U=J===S[2]}let V=1,N=L,A=-1;while(V>0&&N<j.length){B.lastIndex=N,_.lastIndex=N;let S=B.exec(j),x=_.exec(j),y=S?S.index:1/0,b=x?x.index:1/0;if(y<b)V++,N=y+S[0].length;else if(b<1/0){if(V--,V===0){A=b;break}N=b+x[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${W} \u2014 the block was skipped.`);break}let w=j.substring(L,A),R=-1,T=0,I=0;while(I<w.length){let S=w.indexOf("@",I);if(S===-1)break;let x=w.substring(S);if(z.test(x)){T++,I=S+1;continue}if(q.test(x)){T--,I=S+1;continue}if(T===0&&/^@else(?![a-z])/.test(x)){R=S;break}I=S+1}let E;if(R!==-1){let S=w.slice(0,R),x=w.slice(R+5);E=U?S:x}else E=U?w:"";let k=`@${W}`.length;j=j.substring(0,F)+E+j.substring(A+k),H=!0}return j}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",J==="production"),X=Q(X,"development","enddevelopment",J==="development"),X=Q(X,"staging","endstaging",J==="staging"),X=Q(X,"testing","endtesting",J==="testing"),X}var R3=D(()=>{VY();j1();L4();h0()});function $$($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
241
+ `)this.line++,this.column=0;else this.column++;this.pos++}}peek($){return this.source[this.pos+$]}saveState(){return{pos:this.pos,line:this.line,column:this.column}}restoreState($){this.pos=$.pos,this.line=$.line,this.column=$.column}}function P0($,Z,Y,X=0){let J=0,Q=X,G=null,K=0,W=!1;while(Q<$.length){let U=$[Q];if(G&&W){W=!1,Q++;continue}if(G&&U==="\\"){W=!0,Q++;continue}if(W=!1,(U==='"'||U==="'"||U==="`")&&!G){G=U,Q++;continue}if(U===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&U==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&U==="}"){K--,Q++;continue}if(U==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(U===Z)J++;else if(U===Y){if(J--,J===0)return Q}Q++}return-1}function TY($,Z){let Y=Z,X={paren:0,bracket:0,brace:0},J=null,Q=0;while(Y<$.length){let G=$[Y];if((Y>0?$[Y-1]:"")==="\\"&&J){Y++;continue}if((G==='"'||G==="'")&&!J){J=G,Y++;continue}if(G===J&&J!=="`"){J=null,Y++;continue}if(G==="`"&&!J){J="`",Y++;continue}if(G==="`"&&J==="`"&&Q===0){J=null,Y++;continue}if(J==="`"&&G==="$"&&$[Y+1]==="{"){Q++,Y+=2;continue}if(Q>0){if(G==="{")Q++;else if(G==="}")Q--;Y++;continue}if(J){Y++;continue}if(X.paren===0&&X.bracket===0&&X.brace===0){if($.slice(Y,Y+2)==="}}"||$.slice(Y,Y+3)==="!!}")break;if(G===","||G===";")break}if(G==="(")X.paren++;else if(G===")"){if(X.paren--,X.paren<0)break}else if(G==="[")X.bracket++;else if(G==="]"){if(X.bracket--,X.bracket<0)break}else if(G==="{")X.brace++;else if(G==="}"){if(X.brace--,X.brace<0)break}Y++}return{expression:$.slice(Z,Y),endPos:Y}}function A3($){let Z=[],Y="",X={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let K=$[G];if((G>0?$[G-1]:"")==="\\"&&J){Y+=K;continue}if((K==='"'||K==="'")&&!J){J=K,Y+=K;continue}if(K===J&&J!=="`"){J=null,Y+=K;continue}if(K==="`"&&!J){J="`",Y+=K;continue}if(K==="`"&&J==="`"&&Q===0){J=null,Y+=K;continue}if(J==="`"&&K==="$"&&$[G+1]==="{"){Q++,Y+=K+$[G+1],G++;continue}if(Q>0&&K==="{"){Q++,Y+=K;continue}if(Q>0&&K==="}"){Q--,Y+=K;continue}if(J){Y+=K;continue}if(K==="(")X.paren++;else if(K===")")X.paren--;else if(K==="[")X.bracket++;else if(K==="]")X.bracket--;else if(K==="{")X.brace++;else if(K==="}")X.brace--;if(K==="|"&&$[G+1]!=="|"&&(G===0||$[G-1]!=="|")&&$[G-1]!=="\\"&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(Y.trim()),Y="";continue}if(K==="|"&&$[G-1]==="\\"&&!J){Y=Y.slice(0,-1)+K;continue}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function e1($,Z){let Y=RF($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function RF($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=P0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function N$($,Z,Y,X){let J=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&J>0){G.lastIndex=Q,K.lastIndex=Q;let W=G.exec($),U=K.exec($),B=W?W.index:1/0,_=U?U.index:1/0;if(B<_)J++,Q=B+W[0].length;else if(_<1/0){if(J--,J===0)return _;Q=_+U[0].length}else break}return-1}function IY($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,J=e1($,X);if(!J)return null;let Q=J.endPos,G=N$($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],U=0,B="if",_=J.expression,z=0,q=0;while(U<K.length){let j=K.indexOf("@",U);if(j===-1)break;U=j;let H=K.substring(j);if(/^@if\s*\(/.test(H)){q++,U++;continue}if(/^@endif(?![a-z])/.test(H)){q--,U+=6;continue}if(q===0){let O=H.match(/^@elseif\s*/);if(O){W.push({type:B,condition:_,content:K.substring(z,U),start:Q+z,end:Q+U});let F=U+O[0].length,L=e1(K,F);if(!L){U++;continue}B="elseif",_=L.expression,U=L.endPos,z=U;continue}else if(/^@else(?![a-z])/.test(H)){W.push({type:B,condition:_,content:K.substring(z,U),start:Q+z,end:Q+U}),B="else",_=void 0,U+=5,z=U;continue}}U++}return W.push({type:B,condition:_,content:K.slice(z),start:Q+z,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:W,start:Z,end:G+6}}function u5($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let Q=IY($,X.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;X=Y.exec($)}return Z}function O4($,Z,Y){let X=[],J=new RegExp(`@${Z}\\s*\\(`,"g"),Q=J.exec($);while(Q!==null){if(X.some((H)=>Q.index>H.start&&Q.index<H.end)){Q=J.exec($);continue}let K=Q.index,W=K+Q[0].length-1,U=P0($,"(",")",W);if(U===-1){Q=J.exec($);continue}let B=$.slice(W+1,U),_=U+1,z=N$($,Z,Y,_);if(z===-1){Q=J.exec($);continue}let q=$.slice(_,z),j=z+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:B,content:q,start:K,end:j}),J.lastIndex=j,Q=J.exec($)}return X}function w3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,J=e1($,X);if(!J)return null;let Q=J.endPos,G=N$($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),W=[],U=0,B=null,_=0;while(U<K.length){let z=K.slice(U),q=z.match(/^@switch\s*\(/),j=z.match(/^@endswitch(?![a-z])/);if(q){if(_++,B)B.content+=q[0];U+=q[0].length;continue}if(j){if(_--,B)B.content+=j[0];U+=j[0].length;continue}if(_>0){if(B)B.content+=K[U];U++;continue}let H=z.match(/^@case\s*/),O=z.match(/^@default(?![a-z])/),F=z.match(/^@break(?![a-z])/);if(H&&z.startsWith("@case")){if(B)W.push(B);let L=U+H[0].length,V=e1(K,L);if(!V){U++;continue}B={type:"case",value:V.expression,content:""},U=V.endPos}else if(O&&z.startsWith("@default")){if(B)W.push(B);B={type:"default",content:""},U+=O[0].length}else if(F&&z.startsWith("@break"))U+=F[0].length;else{if(B)B.content+=K[U];U++}}if(B)W.push(B);return{fullMatch:$.slice(Z,G+10),expression:J.expression,cases:W,start:Z,end:G+10}}var MK=()=>{};function EK($){let Z=[],Y=0;while(Y<$.length){let X=$.indexOf("{{",Y),J=$.indexOf("{!!",Y),Q=!1,G;if(X===-1&&J===-1)break;else if(X===-1)G=J,Q=!0;else if(J===-1)G=X,Q=!1;else if(J<X)G=J,Q=!0;else G=X,Q=!1;if(!Q&&$.slice(G,G+3)==="{{{")Q=!0;let K=Q?$.slice(G,G+3)==="{{{"?"{{{":"{!!":"{{",W=Q?K==="{{{"?"}}}":"!!}":"}}",U=G+K.length,B=MF($,U,W);if(B===-1){Y=G+1;continue}let _=$.slice(U,B).trim(),z=B+W.length;Z.push({fullMatch:$.slice(G,z),expression:_,start:G,end:z,isRaw:Q}),Y=z}return Z}function MF($,Z,Y){let X=Z,J=null,Q={paren:0,bracket:0,brace:0},G=0;while(X<$.length){let K=$[X];if((X>0?$[X-1]:"")==="\\"&&J){X++;continue}if((K==='"'||K==="'")&&!J){J=K,X++;continue}if(K===J&&J!=="`"){J=null,X++;continue}if(K==="`"&&!J){J="`",X++;continue}if(K==="`"&&J==="`"&&G===0){J=null,X++;continue}if(J==="`"&&K==="$"&&$[X+1]==="{"){G++,X+=2;continue}if(G>0){if(K==="{")G++;else if(K==="}")G--;X++;continue}if(J){X++;continue}if(K==="(")Q.paren++;else if(K===")")Q.paren--;else if(K==="[")Q.bracket++;else if(K==="]")Q.bracket--;else if(K==="{")Q.brace++;else if(K==="}")Q.brace--;if(Q.paren===0&&Q.bracket===0&&Q.brace<=0){if($.slice(X,X+Y.length)===Y)return X}X++}return-1}function DK($){let Z=A3($);if(Z.length===0)return{baseExpression:"",filters:[]};let Y=Z[0],X=[];for(let J=1;J<Z.length;J++){let Q=TF(Z[J]);if(Q)X.push(Q)}return{baseExpression:Y,filters:X}}function TF($){let Z=$.trim();if(!Z)return null;let Y=Z.indexOf("(");if(Y===-1)return{name:Z,args:[]};let X=Z.slice(0,Y).trim(),J=Y+1,Q=P0(Z,"(",")",Y);if(Q===-1)return{name:X,args:[]};let G=Z.slice(J,Q),K=EY(G);return{name:X,args:K}}function EY($){let Z=[],Y="",X={paren:0,bracket:0,brace:0},J=null,Q=0;for(let G=0;G<$.length;G++){let K=$[G];if((G>0?$[G-1]:"")==="\\"&&J){Y+=K;continue}if((K==='"'||K==="'")&&!J){J=K,Y+=K;continue}if(K===J&&J!=="`"){J=null,Y+=K;continue}if(K==="`"&&!J){J="`",Y+=K;continue}if(K==="`"&&J==="`"&&Q===0){J=null,Y+=K;continue}if(J==="`"&&K==="$"&&$[G+1]==="{"){Q++,Y+="${",G++;continue}if(Q>0&&K==="{"){Q++,Y+=K;continue}if(Q>0&&K==="}"){Q--,Y+=K;continue}if(J){Y+=K;continue}if(K==="(")X.paren++;else if(K===")")X.paren--;else if(K==="[")X.bracket++;else if(K==="]")X.bracket--;else if(K==="{")X.brace++;else if(K==="}")X.brace--;if(K===","&&X.paren===0&&X.bracket===0&&X.brace===0){Z.push(Y.trim()),Y="";continue}Y+=K}if(Y.trim())Z.push(Y.trim());return Z}function kK($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;let X=P0($,"(",")",Y);if(X===-1)return null;return{params:$.slice(Y+1,X),endPos:X+1}}function SK($){let Z=[],X=new H4($).tokenize().filter((Q)=>Q.type!=="WHITESPACE"&&Q.type!=="COMMENT"),J=0;while(J<X.length){let Q=X[J],G=!1;if(Q.type==="IDENTIFIER"&&Q.value==="export"){if(G=!0,J++,J>=X.length)break}let K=X[J];if(K.type==="IDENTIFIER"&&(K.value==="const"||K.value==="let"||K.value==="var")){let W=K.value;if(J++,J>=X.length)break;let U=X[J];if(U.type==="IDENTIFIER"){let B=U.value;if(J++,J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let _=J<X.length?X[J].start:$.length,z=TK(X,J,$);J=z.nextIndex,Z.push({type:"variable",name:B,value:$.slice(_,z.endPos),exported:G,start:K.start,end:z.endPos})}}else if(U.type==="PUNCTUATION"&&(U.value==="{"||U.value==="[")){let B=U.start,_=U.value==="{"?"}":"]",z=P0($,U.value,_,B);if(z!==-1){let q=$.slice(B,z+1);if(J=IK(X,z+1),J<X.length&&X[J].type==="OPERATOR"&&X[J].value==="="){J++;let j=J<X.length?X[J].start:$.length,H=TK(X,J,$);J=H.nextIndex;let O=`__stx_destructured_${Z.length}`;Z.push({type:"variable",name:O,value:`${$.slice(j,H.endPos)}; ${W} ${q} = ${O}`,exported:G,start:K.start,end:H.endPos})}}}}else if(K.type==="IDENTIFIER"&&K.value==="function"){let W=G?X[J-1].start:K.start;if(J++,J>=X.length)break;let U=X[J];if(U.type==="IDENTIFIER"){let B=U.value;J++;let _=-1;while(J<X.length){if(X[J].type==="PUNCTUATION"&&X[J].value==="{"){_=X[J].start;break}J++}if(_!==-1){let z=P0($,"{","}",_);if(z!==-1)Z.push({type:"function",name:B,value:$.slice(W,z+1).replace(/^export\s+/,""),exported:G,start:W,end:z+1}),J=IK(X,z+1)}}}else J++}return Z}function TK($,Z,Y){let X=Z,J={paren:0,bracket:0,brace:0},Q=Z<$.length?$[Z].start:Y.length;while(X<$.length){let G=$[X];if(G.type==="PUNCTUATION"){if(G.value==="(")J.paren++;else if(G.value===")")J.paren--;else if(G.value==="[")J.bracket++;else if(G.value==="]")J.bracket--;else if(G.value==="{")J.brace++;else if(G.value==="}")J.brace--;if(G.value===";"&&J.paren===0&&J.bracket===0&&J.brace===0){Q=G.start,X++;break}}if(G.type==="IDENTIFIER"&&(G.value==="const"||G.value==="let"||G.value==="var"||G.value==="function"||G.value==="export")){if(J.paren===0&&J.bracket===0&&J.brace===0){Q=$[X-1]?.end??G.start;break}}Q=G.end,X++}return{nextIndex:X,endPos:Q}}function IK($,Z){for(let Y=0;Y<$.length;Y++)if($[Y].start>=Z)return Y;return $.length}var bK=()=>{};var L4=D(()=>{MK();bK()});function IF($,Z,Y){let X=$,J=!0;while(J){J=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=w3(X,G);if(!K)break;try{let W;if(O0(K.expression))W=L0(K.expression,Object.keys(Z))(...Object.values(Z));else W=z0(K.expression,Z);let U="",B=!1;for(let _ of K.cases)if(_.type==="default"){if(!B)U=_.content.trim()}else try{let z;if(_.value&&O0(_.value))z=L0(_.value,Object.keys(Z))(...Object.values(Z));else if(_.value)z=z0(_.value,Z);if(W===z){U=_.content.trim(),B=!0;break}}catch{continue}X=X.substring(0,G)+U+X.substring(K.end),J=!0}catch(W){let U=W instanceof Error?W.message:String(W),B=J0("Switch",`Error evaluating @switch expression: ${U}`,e.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(K.end);break}}return X}function Q5($,Z,Y){let X=$;X=IF(X,Z,Y);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=e1(X,K+7);if(!W)break;let U=W.endPos,B=N$(X,"unless","endunless",U);if(B===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let _=X.slice(U,B),z=W.expression,q=-1;{let H=0,O=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,V=[],N;while((N=O.exec(_))!==null)V.push({pos:N.index,type:"open"});while((N=F.exec(_))!==null)V.push({pos:N.index,type:"close"});while((N=L.exec(_))!==null)V.push({pos:N.index,type:"else"});V.sort((A,w)=>A.pos-w.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){q=A.pos;break}}let j;if(q!==-1){let H=_.slice(0,q),O=_.slice(q+5);j=`@if (${z})${O}@else ${H}@endif`}else j=`@if (!(${z}))${_}@endif`;X=X.substring(0,K)+j+X.substring(B+10),Q=!0}}X=kY(X,Z,Y),X=SY(X,Z,Y),X=DY(X,Z);let J=()=>{let Q=u5(X);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let W="",U=!1;for(let B of K.branches){if(U)break;if(B.type==="else")W=B.content,U=!0;else try{let _;if(B.condition&&O0(B.condition))_=L0(B.condition,Object.keys(Z))(...Object.values(Z));else if(B.condition)_=z0(B.condition,Z);if(_)W=B.content,U=!0}catch(_){W=J0(B.type==="if"?"If":"Elseif",`Error in @${B.type}(${B.condition}): ${_ instanceof Error?_.message:String(_)}`,e.EVALUATION_ERROR),U=!0}}X=X.substring(0,K.start)+W+X.substring(K.end)}catch(W){let U=W instanceof Error?W.message:String(W),B=J0("If",`Error processing @if block: ${U}`,e.EVALUATION_ERROR);X=X.substring(0,K.start)+B+X.substring(K.end)}}return!0};while(!0){let Q=X;if(!J())break;if(X===Q)break}return X}function CK($){let Z=0;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 X=[];while(Z<$.length){let J=$[Z];if(J==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(J===Y){Z++;break}X.push(J),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function DY($,Z){let Y=$;function X(K,W,U,B){let _=1,z=B,q=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${U}(?![a-z])`,"g");while(z<K.length&&_>0){q.lastIndex=z,j.lastIndex=z;let H=q.exec(K),O=j.exec(K),F=H?H.index:1/0,L=O?O.index:1/0;if(F<L)_++,z=F+H[0].length;else if(L<1/0){if(_--,_===0)return L;z=L+O[0].length}else break}return-1}function J(K,W,U){let B=0,_=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${U}(?![a-z])`,"g"),q=/@else(?![a-z])/g,j=[],H;while((H=_.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=z.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=q.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((O,F)=>O.pos-F.pos);for(let O of j)if(O.type==="open")B++;else if(O.type==="close")B--;else if(O.type==="else"&&B===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let W=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let U=W.index,B,_,z=Y.slice(U+5),q=CK(z);if(q)B=q.value,_=U+5+q.consumed;else _=U+5;let j=X(Y,"auth","endauth",_);if(j===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(_,j),O=J(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=B?t1(`auth?.check && auth?.user?.[${B}]`,Z):t1("auth?.check",Z);let L;if(O!==-1){let V=H.slice(0,O),N=H.slice(O+5);L=F?V:N}else L=F?H:"";Y=Y.substring(0,U)+L+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let W=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let U=W.index,B,_,z=Y.slice(U+6),q=CK(z);if(q)B=q.value,_=U+6+q.consumed;else _=U+6;let j=X(Y,"guest","endguest",_);if(j===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(_,j),O=J(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=B?t1(`!auth?.check || !auth?.user?.[${B}]`,Z):t1("!auth?.check",Z);let L;if(O!==-1){let V=H.slice(0,O),N=H.slice(O+5);L=F?V:N}else L=F?H:"";Y=Y.substring(0,U)+L+Y.substring(j+9),K=!0}}function Q(K,W,U){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let B=[K];if(W)B.push(W);if(U){let _=t1(U,Z);B.push(_)}return Z.permissions.check(...B)}catch{return!1}return!1}function G(K){let W=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let K of["can","cannot"]){let W=`end${K}`,U=K==="can"?"elsecan":"elsecannot",B=!0;while(B){B=!1;let _=Y.match(new RegExp(`@${K}\\s*\\(`));if(!_||_.index===void 0)break;let z=_.index,q=Y.slice(z+`@${K}`.length),j=G(q);if(!j)break;let H=z+`@${K}`.length+j.paramsEnd,O=X(Y,K,W,H);if(O===-1){console.warn(`[stx] @${K} directive at position ${z} has no matching @${W} \u2014 the block was skipped.`);break}let F=Y.slice(H,O),L=[],V=0,N=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${W}(?![a-z])`,"g"),w=new RegExp(`@${U}\\s*\\(`,"g"),R=/@else(?![a-z])/g,T=[],I;while((I=N.exec(F))!==null)T.push({pos:I.index,type:"open"});while((I=A.exec(F))!==null)T.push({pos:I.index,type:"close"});while((I=w.exec(F))!==null)T.push({pos:I.index,type:"elseDirective"});while((I=R.exec(F))!==null)T.push({pos:I.index,type:"else"});T.sort((b,f)=>b.pos-f.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)L.push(b)}let E=[],k=0;for(let b=0;b<L.length;b++){let f=L[b];if(E.push({content:F.slice(k,f.pos),ability:void 0}),f.type==="elseDirective"){let r=F.slice(f.pos+`@${U}`.length),u=G(r);if(u){E[E.length-1]={content:F.slice(k,f.pos)},k=f.pos+`@${U}`.length+u.paramsEnd,E.push({content:"",ability:u.ability,type:u.type,id:u.id}),E.pop();let C=L[b+1],h=C?C.pos:F.length;E.push({content:F.slice(k,h),ability:u.ability,type:u.type,id:u.id}),k=h}}else k=f.pos+5}if(k<F.length){let b=E[E.length-1];if(L.length>0&&L[L.length-1].type==="else")E.push({content:F.slice(k),isFinalElse:!0});else if(E.length===0)E.push({content:F.slice(k)})}let S=Q(j.ability,j.type,j.id),x=K==="can"?S:!S,y="";if(x)y=E[0]?.content||"";else{let b=!1;for(let f=1;f<E.length;f++){let r=E[f];if(r.isFinalElse){y=r.content,b=!0;break}if(r.ability){let u=Q(r.ability,r.type,r.id);if(K==="can"?u:!u){y=r.content,b=!0;break}}}if(!b&&E.length>0){let f=E[E.length-1];if(f.isFinalElse)y=f.content}}Y=Y.substring(0,z)+y+Y.substring(O+`@${W}`.length),B=!0}}return Y}function kY($,Z,Y){let X=$;function J(Q,G,K,W,U){let B=!0;while(B){B=!1;let _=new RegExp(`@${G}\\s*\\(`),z=Q.match(_);if(!z||z.index===void 0)break;let q=z.index,j=e1(Q,q+`@${G}`.length);if(!j)break;let H=j.endPos,O=N$(Q,G,K,H);if(O===-1){console.warn(`[stx] @${G} directive at position ${q} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(H,O),L=j.expression,V=-1,N=0,A=0;while(A<F.length){let w=F.indexOf("@",A);if(w===-1)break;let R=F.substring(w);if(/^@(?:if|unless|isset|empty)\s*\(/.test(R)){N++,A=w+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(R)){N--,A=w+1;continue}if(N===0&&/^@else(?![a-z])/.test(R)){V=w;break}A=w+1}try{let w=W(L.trim()),R;if(V!==-1){let T=F.slice(0,V),I=F.slice(V+5);R=w?T:I}else R=w?F:"";Q=Q.substring(0,q)+R+Q.substring(O+`@${K}`.length),B=!0}catch(w){let R=w instanceof Error?w.message:String(w),T=J0(U,`Error processing @${G} directive: ${R}`,e.EVALUATION_ERROR);Q=Q.substring(0,q)+T+Q.substring(O+`@${K}`.length);break}}return Q}return X=J(X,"isset","endisset",(Q)=>{let G=t1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=J(X,"empty","endempty",(Q)=>{let G=t1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function SY($,Z,Y){let X=$,J="development";function Q(G,K,W,U){let B=new RegExp(`@${K}(?![a-z])`,"g"),_=new RegExp(`@${W}(?![a-z])`,"g"),z=new RegExp(`^@${K}(?![a-z])`),q=new RegExp(`^@${W}(?![a-z])`),j=G,H=!0;while(H){H=!1,B.lastIndex=0;let O=B.exec(j);if(!O)break;let F=O.index,L=F+O[0].length;if(K==="env"){let S=j.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!S)break;L+=S[0].length,U=J===S[2]}let V=1,N=L,A=-1;while(V>0&&N<j.length){B.lastIndex=N,_.lastIndex=N;let S=B.exec(j),x=_.exec(j),y=S?S.index:1/0,b=x?x.index:1/0;if(y<b)V++,N=y+S[0].length;else if(b<1/0){if(V--,V===0){A=b;break}N=b+x[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${W} \u2014 the block was skipped.`);break}let w=j.substring(L,A),R=-1,T=0,I=0;while(I<w.length){let S=w.indexOf("@",I);if(S===-1)break;let x=w.substring(S);if(z.test(x)){T++,I=S+1;continue}if(q.test(x)){T--,I=S+1;continue}if(T===0&&/^@else(?![a-z])/.test(x)){R=S;break}I=S+1}let E;if(R!==-1){let S=w.slice(0,R),x=w.slice(R+5);E=U?S:x}else E=U?w:"";let k=`@${W}`.length;j=j.substring(0,F)+E+j.substring(A+k),H=!0}return j}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",J==="production"),X=Q(X,"development","enddevelopment",J==="development"),X=Q(X,"staging","endstaging",J==="staging"),X=Q(X,"testing","endtesting",J==="testing"),X}var R3=D(()=>{VY();j1();L4();h0()});function $$($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
242
242
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
243
243
  `}),$}import yK from"process";function N1($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(yK.env)){if(!X.startsWith($)||J===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(J),Y[X]=J}return Z["import.meta.env"]=JSON.stringify(Y),Z}function PK($="STX_PUBLIC_"){let Z={};for(let[Y,X]of Object.entries(yK.env))if(Y.startsWith($)&&X!==void 0)Z[Y]=X;return Z}var G5=()=>{};var M3={};Z0(M3,{hasUserImports:()=>EF,bundleClientScript:()=>kF});import x0 from"path";import A1 from"fs";function EF($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,J;while((J=X.exec($))!==null){let G=J[1];if(!xK.some((W)=>W.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let Q=/^\s*import\s+['"]([^'"]+)['"]/gm;while((J=Q.exec($))!==null){let G=J[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!xK.some((W)=>W.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function DF($,Z,Y,X){let J=(Q,G)=>{let K=Q===Y?Z:x0.dirname(Q),W=x0.resolve(K,G),U=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,x0.join(W,"index.ts"),x0.join(W,"index.tsx"),x0.join(W,"index.js"),x0.join(W,"index.mjs")];for(let B of U)try{if(A1.existsSync(B)&&A1.statSync(B,{throwIfNoEntry:!1})?.isFile())return B}catch{}return W};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=J(G.importer,G.path);return X.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=x0.resolve($,G.path.slice(2)),W=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,x0.join(K,"index.ts"),x0.join(K,"index.tsx"),x0.join(K,"index.js"),x0.join(K,"index.mjs")];for(let U of W)if(A1.existsSync(U)&&A1.statSync(U,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",U),X.add(U),{path:U};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function kF($,Z,Y={}){let X=Y.projectRoot||process.cwd(),J=Y.minify??!1,Q=Y.cacheDir||x0.join(X,".stx","bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),W=x0.join(Q,`${K}.js`),U=x0.join(Q,`${K}.deps.json`),B=Bun.file(W);if(await B.exists()){let A=Bun.file(U),w=!0;if(await A.exists())try{let R=JSON.parse(await A.text());for(let T of R.files)try{if(A1.statSync(T.path).mtimeMs!==T.mtimeMs){w=!1;break}}catch{w=!1;break}}catch{w=!1}if(w)return console.log("[stx:bundler] cache hit:",K),await B.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let _=x0.join(X,".stx","bundle-tmp"),z=x0.join(_,`${K}.ts`),q=x0.join(_,"out",K);A1.mkdirSync(_,{recursive:!0}),A1.mkdirSync(q,{recursive:!0});let j=x0.dirname(Z),H=[],O=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=O.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((A)=>{let w=A.split(":")[0].trim();if(w)H.push(w)});else if(L[3])H.push(L[3])}while((L=F.exec($))!==null){if(L[1])continue;H.push(L[2])}let V=H.length>0?`
244
244
  export { ${H.join(", ")} }`:"";await Bun.write(z,$+V),console.log("[stx:bundler] bundling:",K,"from:",x0.basename(Z));let N=new Set;try{let A=await Bun.build({entrypoints:[z],outdir:q,target:"browser",format:"esm",minify:J,plugins:[DF(X,j,z,N)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...N1()},root:X});if(!A.success){let I=A.logs.filter((E)=>E.level==="error").map((E)=>E.message).join(", ");return console.warn("[stx:bundler] build failed:",I),$}let w="";for(let I of A.outputs){w=await I.text();break}let R=[];for(let I of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let E of I[1].split(",")){let k=E.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k&&k[1]!==k[2])R.push([k[2],k[1]])}if(w=w.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),R.length>0){let I=R.map(([E,k])=>`${JSON.stringify(E)}: ${k}`).join(", ");w+=`
@@ -310,7 +310,7 @@ ${U}${F}
310
310
  'use strict';
311
311
  ${X}${Y}
312
312
  ${U}
313
- })()</script>`}var SF,vF,fF,gF,mF,iF;var W5=D(()=>{N0();SF=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;vF=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],fF=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],gF=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"]);mF={left:0,middle:1,right:2};iF=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"])});class N4{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function p5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!m5.has(Y)){if(m5.size>=sF){let X=m5.keys().next().value;if(X)m5.delete(X)}m5.set(Y,new RegExp($,Z))}return m5.get(Y)}class gK{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let J=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let U=`${Y}:${W}`,B=J.get(U);if(!B){if(J.size>=Q){let _=J.keys().next().value;if(_)J.delete(_)}B=Function(...Z,`
313
+ })()</script>`}var SF,vF,fF,gF,mF,iF;var W5=D(()=>{A0();SF=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;vF=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","useStore","action","createSelector","h","Fragment"],fF=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser"],gF=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"]);mF={left:0,middle:1,right:2};iF=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"])});class N4{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function p5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!m5.has(Y)){if(m5.size>=sF){let X=m5.keys().next().value;if(X)m5.delete(X)}m5.set(Y,new RegExp($,Z))}return m5.get(Y)}class gK{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let J=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(W)=>{try{let U=`${Y}:${W}`,B=J.get(U);if(!B){if(J.size>=Q){let _=J.keys().next().value;if(_)J.delete(_)}B=Function(...Z,`
314
314
  'use strict';
315
315
  try {
316
316
  return ${W};
@@ -1130,7 +1130,7 @@ ${H}
1130
1130
  `)}</p>`);if(J=K.join(`
1131
1131
  `),X)J=J.replace(/\n/g,`<br />
1132
1132
  `);for(let B=0;B<Q.length;B++)J=J.replace(`\x00CODEBLOCK${B}\x00`,Q[B]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}async function mY($,Z,Y=""){let X=$,J=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,W=G[0].match(/@markdown\(([^)]*)\)/),U=W?W[1]:"",B=K+G[0].length,_=1,z=B,q=-1;while(_>0&&z<$.length){let O=$.indexOf("@markdown",z),F=$.indexOf("@endmarkdown",z);if(F===-1)break;if(O!==-1&&O<F&&O!==K){let L=$[O+9];if(L==="("||L===`
1133
- `||L==="\r"||L===" "||L===void 0)_++;z=O+9}else{if(_--,_===0){q=F;break}z=F+12}}if(q===-1)continue;let j=$.slice(B,q),H=$.slice(K,q+12);J.push({fullMatch:H,options:U,content:j,index:K}),Q.lastIndex=q+12}for(let{fullMatch:K,options:W,content:U,index:B}of J)try{let _={};if(W)W.split(",").forEach((j)=>{let H=j.trim();if(H)_[H]=!0});let z={gfm:_.gfm??!0,breaks:_.breaks??!1},q=R4(U.trim(),z);X=X.split(K).join(q)}catch(_){let z=_ instanceof Error?_.message:String(_),q=L0("Markdown Directive",`Error processing markdown: ${z}`,Y,$,B,K);X=X.split(K).join(q)}return X}async function pY($,Z,Y,X){let J={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")J.breaks=!0;if(G==="no-gfm")J.gfm=!1}),R4($.trim(),J)}var v3=D(()=>{N0()});function YW($){if(f3.set($.name,$),$.client)cY.set($.name,$.client)}function VV($){return f3.get($)}function NV(){return Array.from(f3.values())}function AV($){return cY.delete($),f3.delete($)}function S0($){return YW($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,J,Q)=>{let G=RV(X,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let U=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(U)}}let K=Y;if($.transform)K=await $.transform(Y,G,J,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function wV($,Z){let Y=typeof Z==="function"?{mounted:Z}:Z;return cY.set($,Y),Y}function RV($,Z){let Y={...Z};for(let X of $){let J=X.indexOf(":"),Q=X.indexOf("="),G=J>=0&&(Q<0||J<Q)?J:Q;if(G>=0){let K=X.slice(0,G).trim(),W=X.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}function MV(){return[S0({name:"uppercase",description:"Convert content to uppercase",transform:($)=>$.toUpperCase()}),S0({name:"lowercase",description:"Convert content to lowercase",transform:($)=>$.toLowerCase()}),S0({name:"capitalize",description:"Capitalize first letter of content",transform:($)=>$.charAt(0).toUpperCase()+$.slice(1)}),S0({name:"trim",description:"Remove leading and trailing whitespace",transform:($)=>$.trim()}),S0({name:"truncate",description:"Truncate content to specified length",defaults:{length:100,suffix:"..."},transform:($,{length:Z,suffix:Y})=>$.length>Z?$.slice(0,Z)+Y:$}),S0({name:"highlight",description:"Highlight content with background color",defaults:{color:"yellow"},transform:($,{color:Z})=>`<mark style="background-color: ${Z}; padding: 0.1em 0.2em; border-radius: 0.2em;">${$}</mark>`}),S0({name:"badge",description:"Create a badge/tag",defaults:{variant:"default",color:""},transform:($,{variant:Z,color:Y})=>{let X={default:"background: #e5e7eb; color: #374151;",primary:"background: #3b82f6; color: white;",success:"background: #10b981; color: white;",warning:"background: #f59e0b; color: white;",danger:"background: #ef4444; color: white;",info:"background: #06b6d4; color: white;"};return`<span style="${Y?`background: ${Y}; color: white;`:X[Z]||X.default} padding: 0.25em 0.5em; border-radius: 9999px; font-size: 0.875em; font-weight: 500;">${$}</span>`}}),S0({name:"code",description:"Style content as inline code",transform:($)=>`<code style="background: #f3f4f6; padding: 0.2em 0.4em; border-radius: 0.25em; font-family: ui-monospace, monospace; font-size: 0.875em;">${$}</code>`}),S0({name:"tooltip",description:"Add a tooltip to content",defaults:{text:"",position:"top"},hasEndTag:!0,transform:($,{text:Z,position:Y})=>`<span class="stx-tooltip" data-tooltip="${Z}" data-tooltip-position="${Y}" style="position: relative; cursor: help;">${$}</span>`,css:()=>`
1133
+ `||L==="\r"||L===" "||L===void 0)_++;z=O+9}else{if(_--,_===0){q=F;break}z=F+12}}if(q===-1)continue;let j=$.slice(B,q),H=$.slice(K,q+12);J.push({fullMatch:H,options:U,content:j,index:K}),Q.lastIndex=q+12}for(let{fullMatch:K,options:W,content:U,index:B}of J)try{let _={};if(W)W.split(",").forEach((j)=>{let H=j.trim();if(H)_[H]=!0});let z={gfm:_.gfm??!0,breaks:_.breaks??!1},q=R4(U.trim(),z);X=X.split(K).join(q)}catch(_){let z=_ instanceof Error?_.message:String(_),q=F0("Markdown Directive",`Error processing markdown: ${z}`,Y,$,B,K);X=X.split(K).join(q)}return X}async function pY($,Z,Y,X){let J={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")J.breaks=!0;if(G==="no-gfm")J.gfm=!1}),R4($.trim(),J)}var v3=D(()=>{A0()});function YW($){if(f3.set($.name,$),$.client)cY.set($.name,$.client)}function VV($){return f3.get($)}function NV(){return Array.from(f3.values())}function AV($){return cY.delete($),f3.delete($)}function S0($){return YW($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,J,Q)=>{let G=RV(X,$.defaults);if($.validate){let W=$.validate(G);if(W!==!0){let U=typeof W==="string"?W:`Invalid parameters for @${$.name}`;throw Error(U)}}let K=Y;if($.transform)K=await $.transform(Y,G,J,Q);if($.clientScript){let W=$.clientScript(G);K+=`<script>${W}</script>`}if($.css){let W=$.css(G);K+=`<style>${W}</style>`}return K}}}function wV($,Z){let Y=typeof Z==="function"?{mounted:Z}:Z;return cY.set($,Y),Y}function RV($,Z){let Y={...Z};for(let X of $){let J=X.indexOf(":"),Q=X.indexOf("="),G=J>=0&&(Q<0||J<Q)?J:Q;if(G>=0){let K=X.slice(0,G).trim(),W=X.slice(G+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}Y[K]=W}else{let K=Object.keys(Y).filter((W)=>!Z||!(W in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}function MV(){return[S0({name:"uppercase",description:"Convert content to uppercase",transform:($)=>$.toUpperCase()}),S0({name:"lowercase",description:"Convert content to lowercase",transform:($)=>$.toLowerCase()}),S0({name:"capitalize",description:"Capitalize first letter of content",transform:($)=>$.charAt(0).toUpperCase()+$.slice(1)}),S0({name:"trim",description:"Remove leading and trailing whitespace",transform:($)=>$.trim()}),S0({name:"truncate",description:"Truncate content to specified length",defaults:{length:100,suffix:"..."},transform:($,{length:Z,suffix:Y})=>$.length>Z?$.slice(0,Z)+Y:$}),S0({name:"highlight",description:"Highlight content with background color",defaults:{color:"yellow"},transform:($,{color:Z})=>`<mark style="background-color: ${Z}; padding: 0.1em 0.2em; border-radius: 0.2em;">${$}</mark>`}),S0({name:"badge",description:"Create a badge/tag",defaults:{variant:"default",color:""},transform:($,{variant:Z,color:Y})=>{let X={default:"background: #e5e7eb; color: #374151;",primary:"background: #3b82f6; color: white;",success:"background: #10b981; color: white;",warning:"background: #f59e0b; color: white;",danger:"background: #ef4444; color: white;",info:"background: #06b6d4; color: white;"};return`<span style="${Y?`background: ${Y}; color: white;`:X[Z]||X.default} padding: 0.25em 0.5em; border-radius: 9999px; font-size: 0.875em; font-weight: 500;">${$}</span>`}}),S0({name:"code",description:"Style content as inline code",transform:($)=>`<code style="background: #f3f4f6; padding: 0.2em 0.4em; border-radius: 0.25em; font-family: ui-monospace, monospace; font-size: 0.875em;">${$}</code>`}),S0({name:"tooltip",description:"Add a tooltip to content",defaults:{text:"",position:"top"},hasEndTag:!0,transform:($,{text:Z,position:Y})=>`<span class="stx-tooltip" data-tooltip="${Z}" data-tooltip-position="${Y}" style="position: relative; cursor: help;">${$}</span>`,css:()=>`
1134
1134
  .stx-tooltip::after {
1135
1135
  content: attr(data-tooltip);
1136
1136
  position: absolute;
@@ -1323,7 +1323,7 @@ ${H}
1323
1323
  filter: blur(0);
1324
1324
  transform: scale(1);
1325
1325
  }
1326
- `.trim();i5=new Map});import{createHash as _X}from"crypto";import{readFile as DV,stat as QW}from"fs/promises";async function c0($){try{let Z=await DV($);return _X("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function GW($){return _X("sha256").update($).digest("hex").slice(0,16)}function u3($){return _X("sha256").update($).digest("hex").slice(0,16)}function s5($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${u3($)}-${u3(Y)}`}async function b4($){try{return(await QW($)).mtimeMs}catch{return 0}}async function l0($){try{return await QW($),!0}catch{return!1}}var E$=()=>{};import{mkdir as kV,readFile as WW,writeFile as SV,readdir as UW,rm as zX,stat as bV}from"fs/promises";import{join as r5,dirname as CV}from"path";async function yV($){try{await kV($,{recursive:!0})}catch{}}function BW($,Z,Y){return r5($,Y,`${Z}.json`)}async function KW($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await b4(Z)!==$.srcMtime)return!1;return!0}async function o5($,Z,Y,X=C4){if(!X.enabled)return null;let J=s5($,Z),Q=D$.get(J);if(Q){if(await KW(Q,$,X.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;D$.delete(J)}let G=BW(X.directory,J,Y);if(await l0(G))try{let K=await WW(G,"utf-8"),W=JSON.parse(K);if(await KW(W,$,X.maxAge))return W.lastAccessedAt=Date.now(),D$.set(J,W),W.data}catch{}return null}async function a5($,Z,Y,X,J=C4){if(!J.enabled)return;let Q=s5($,Z),G=await c0($),K=await b4($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:s5("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};D$.set(Q,W);let U=BW(J.directory,Q,X);try{await yV(CV(U)),await SV(U,JSON.stringify(W,null,2))}catch(B){console.warn(`[stx-media] Failed to write cache: ${B}`)}}async function t5($,Z=C4){if($==="all")D$.clear();else D$.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let J=r5(Z.directory,X);try{await zX(J,{recursive:!0,force:!0})}catch{}}}async function _W($=C4){let Z={memoryEntries:D$.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let Y of["image","video"]){let X=r5($.directory,Y);try{let J=await UW(X);Z.diskEntries[Y]=J.length;for(let Q of J){let G=r5(X,Q),K=await bV(G);Z.totalSizeMB+=K.size/1048576}}catch{}}return Z}async function zW($=C4){let Z=0,Y=$.maxAge*24*60*60*1000;for(let X of["image","video"]){let J=r5($.directory,X);try{let Q=await UW(J);for(let G of Q){let K=r5(J,G);try{let W=await WW(K,"utf-8"),U=JSON.parse(W);if(Date.now()-U.createdAt>Y)await zX(K),D$.delete(U.key),Z++}catch{await zX(K).catch(()=>{}),Z++}}}catch{}}return Z}var D$,C4;var m3=D(()=>{E$();D$=new Map,C4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class e5{config;constructor($={}){this.config={...PV,...$}}async get($,Z){return o5($,Z,"image",this.config)}async set($,Z,Y){return a5($,Z,Y,"image",this.config)}async clear(){return t5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function qX($){if(!p3)p3=new e5($);else if($)p3.updateConfig($);return p3}async function $7($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return qX(X).get($,Z)}async function Z7($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return qX(J).set($,Z,Y)}async function jX(){return qX().clear()}var PV,p3=null;var HX=D(()=>{m3();PV={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as xV,basename as vV,extname as fV,join as gV}from"path";import{mkdir as hV}from"fs/promises";async function OX(){try{return await import("ts-images")}catch{return null}}function qW($){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 dV($,Z){let Y=Z?qW(Z):qW("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function LX($,Z,Y){let X=await OX();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await $7($,Z,Y);if(J)return J;try{let Q=xV($);if(!await l0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=dV(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await hV(K,{recursive:!0});let U=await c0(Q),B=vV($,fV($)),_=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],z={src:$,processed:!0,variants:[],hash:U},q=null;if(Z.transformations&&Z.transformations.length>0)q=await y4(Q,Z.transformations,X);for(let j of _){let H=G[j]||{},O=`${B}-${U}.${j}`,F=gV(K,O);try{let L=await X.optimizeImage({input:q||Q,output:F,format:j,quality:H.quality,progressive:H.progressive});if(L){if(z.variants.push({path:F,url:`${W}/${O}`,width:L.width||0,height:L.height||0,format:j,size:L.outputSize||0}),!z.originalWidth&&L.width)z.originalWidth=L.width,z.originalHeight=L.height}}catch(L){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${j}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(Q);z.placeholder=j.dataUrl}catch(j){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(Q,{strategy:"dominant-color"});z.dominantColor=j.dominantColor}catch(j){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${j}`)}return await Z7($,Z,z,Y),z}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function FX($,Z,Y,X){let J=await OX();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function y4($,Z,Y){let X=Y||await OX();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await X.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)J=await X.resize(J,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)J=await X.blur(J,G.sigma);break;case"sharpen":if(G.amount!==void 0)J=await X.sharpen(J,G.amount);break;case"grayscale":J=await X.grayscale(J);break;case"rotate":if(G.angle!==void 0)J=await X.rotate(J,G.angle);break;case"flip":J=await X.flip(J);break;case"flop":J=await X.flop(J);break;case"brightness":if(G.value!==void 0)J=await X.brightness(J,G.value);break;case"contrast":if(G.value!==void 0)J=await X.contrast(J,G.value);break;case"saturation":if(G.value!==void 0)J=await X.saturation(J,G.value);break}}return await X.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var jW=D(()=>{E$();HX()});import{resolve as uV,basename as mV,extname as pV,join as cV}from"path";import{mkdir as lV}from"fs/promises";async function iV(){try{return await import("ts-images")}catch{return null}}async function c3($,Z,Y){let X=await iV();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=uV($);if(!await l0(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||nV,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await lV(K,{recursive:!0});let U=await c0(J),B=mV($,pV($)),_=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:$,byFormat:{},srcsets:{}};for(let j of G){z.byFormat[j]=[];let H=[];for(let O of Q){let F=`${B}-${O}w-${U}.${j}`,L=cV(K,F),V=`${W}/${F}`;try{let N=_[j]?.quality||80;if(await l0(L)){z.byFormat[j].push({path:L,url:V,width:O,height:0,format:j,size:0}),H.push(`${V} ${O}w`);continue}let A=await X.processImage({input:J,output:L,format:j,quality:N,resize:{width:O}});if(A)z.byFormat[j].push({path:L,url:V,width:O,height:A.height||Math.round(O*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${O}w`)}catch(N){console.warn(`[stx-media] Failed to generate ${j} at ${O}w: ${N}`)}}z.srcsets[j]=H.join(", ")}let q=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(q!=="none")try{if(q==="thumbhash"){let j=await X.generateThumbHash(J);z.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(J,{strategy:q,width:20});z.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:q}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return z.sizes=Z.sizes||sV(Q),z}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function sV($){let Z=[...$].sort((X,J)=>X-J),Y=[];for(let X=0;X<Z.length-1;X++){let J=Z[X];Y.push(`(max-width: ${J}px) ${J}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function l3($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var nV;var HW=D(()=>{E$();nV=[320,480,640,768,1024,1280,1536,1920]});var OW={};Z0(OW,{setCachedImageResult:()=>Z7,processImage:()=>LX,optimizeImage:()=>FX,getCachedImageResult:()=>$7,generateSrcset:()=>l3,generateResponsiveVariants:()=>c3,clearImageCache:()=>jX,applyTransformations:()=>y4,ImageProcessorCache:()=>e5});var VX=D(()=>{jW();HW();HX()});async function rV(){try{return await Promise.resolve().then(() => (VX(),OW))}catch($){if(!LW)console.warn("[stx-media] Image processor not available, some features disabled:",$),LW=!0;return null}}async function k$($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return eV(X,Y)}if(Y.processedResult?.processed)return MX($,Y.processedResult,Z);if(Y.responsiveVariants)return AW($,Y.responsiveVariants,Z);let{src:J,alt:Q,width:G,height:K,sizes:W,widths:U=u1,dpr:B,formats:_=Z$,quality:z=NX,params:q={},placeholder:j="none",placeholderOptions:H={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":n3,decoding:V=i3,fetchpriority:N,objectFit:A,objectPosition:w,crossorigin:R,referrerpolicy:T}=$,I=$.class,E=$.style,k=$.id,S=$.data||{},{isDev:x=!1,baseUrl:y=""}=Z;if(x&&!Z.optimize)return tV($);let b,f,r=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{b=await S4(J,{strategy:j,...H}),f=k4(r,b,H)}catch{}let u=B!==void 0&&G!==void 0,C;if(u)C=aV($,r,b,Z);else C=await oV($,r,b,Z);let h;if(F){let s=_.includes("webp")?"webp":_[0],K0=I$(J,U,{...q,q:z},s),$0=typeof W==="object"?l5(W):W||"100vw";h=`<link rel="preload" as="image" imagesrcset="${K0}" imagesizes="${$0}" />`}let p=[];if(!FW&&j!=="none")p.push(n5),FW=!0;if(f)p.push(f);let i=O?NW(r):void 0;return{html:C,preloadLink:h,css:p.length>0?p.join(`
1326
+ `.trim();i5=new Map});import{createHash as _X}from"crypto";import{readFile as DV,stat as QW}from"fs/promises";async function c0($){try{let Z=await DV($);return _X("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function GW($){return _X("sha256").update($).digest("hex").slice(0,16)}function u3($){return _X("sha256").update($).digest("hex").slice(0,16)}function s5($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${u3($)}-${u3(Y)}`}async function b4($){try{return(await QW($)).mtimeMs}catch{return 0}}async function l0($){try{return await QW($),!0}catch{return!1}}var E$=()=>{};import{mkdir as kV,readFile as WW,writeFile as SV,readdir as UW,rm as zX,stat as bV}from"fs/promises";import{join as r5,dirname as CV}from"path";async function yV($){try{await kV($,{recursive:!0})}catch{}}function BW($,Z,Y){return r5($,Y,`${Z}.json`)}async function KW($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await b4(Z)!==$.srcMtime)return!1;return!0}async function o5($,Z,Y,X=C4){if(!X.enabled)return null;let J=s5($,Z),Q=D$.get(J);if(Q){if(await KW(Q,$,X.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;D$.delete(J)}let G=BW(X.directory,J,Y);if(await l0(G))try{let K=await WW(G,"utf-8"),W=JSON.parse(K);if(await KW(W,$,X.maxAge))return W.lastAccessedAt=Date.now(),D$.set(J,W),W.data}catch{}return null}async function a5($,Z,Y,X,J=C4){if(!J.enabled)return;let Q=s5($,Z),G=await c0($),K=await b4($),W={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:s5("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};D$.set(Q,W);let U=BW(J.directory,Q,X);try{await yV(CV(U)),await SV(U,JSON.stringify(W,null,2))}catch(B){console.warn(`[stx-media] Failed to write cache: ${B}`)}}async function t5($,Z=C4){if($==="all")D$.clear();else D$.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let J=r5(Z.directory,X);try{await zX(J,{recursive:!0,force:!0})}catch{}}}async function _W($=C4){let Z={memoryEntries:D$.size,diskEntries:{image:0,video:0},totalSizeMB:0};for(let Y of["image","video"]){let X=r5($.directory,Y);try{let J=await UW(X);Z.diskEntries[Y]=J.length;for(let Q of J){let G=r5(X,Q),K=await bV(G);Z.totalSizeMB+=K.size/1048576}}catch{}}return Z}async function zW($=C4){let Z=0,Y=$.maxAge*24*60*60*1000;for(let X of["image","video"]){let J=r5($.directory,X);try{let Q=await UW(J);for(let G of Q){let K=r5(J,G);try{let W=await WW(K,"utf-8"),U=JSON.parse(W);if(Date.now()-U.createdAt>Y)await zX(K),D$.delete(U.key),Z++}catch{await zX(K).catch(()=>{}),Z++}}}catch{}}return Z}var D$,C4;var m3=D(()=>{E$();D$=new Map,C4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class e5{config;constructor($={}){this.config={...PV,...$}}async get($,Z){return o5($,Z,"image",this.config)}async set($,Z,Y){return a5($,Z,Y,"image",this.config)}async clear(){return t5("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function qX($){if(!p3)p3=new e5($);else if($)p3.updateConfig($);return p3}async function $7($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return qX(X).get($,Z)}async function Z7($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return qX(J).set($,Z,Y)}async function jX(){return qX().clear()}var PV,p3=null;var HX=D(()=>{m3();PV={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as xV,basename as vV,extname as fV,join as gV}from"path";import{mkdir as hV}from"fs/promises";async function OX(){try{return await import("ts-images")}catch{return null}}function qW($){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 dV($,Z){let Y=Z?qW(Z):qW("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function LX($,Z,Y){let X=await OX();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await $7($,Z,Y);if(J)return J;try{let Q=xV($);if(!await l0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=dV(Y,Z.preset),K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await hV(K,{recursive:!0});let U=await c0(Q),B=vV($,fV($)),_=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],z={src:$,processed:!0,variants:[],hash:U},q=null;if(Z.transformations&&Z.transformations.length>0)q=await y4(Q,Z.transformations,X);for(let j of _){let H=G[j]||{},O=`${B}-${U}.${j}`,F=gV(K,O);try{let L=await X.optimizeImage({input:q||Q,output:F,format:j,quality:H.quality,progressive:H.progressive});if(L){if(z.variants.push({path:F,url:`${W}/${O}`,width:L.width||0,height:L.height||0,format:j,size:L.outputSize||0}),!z.originalWidth&&L.width)z.originalWidth=L.width,z.originalHeight=L.height}}catch(L){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${j}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(Q);z.placeholder=j.dataUrl}catch(j){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(Q,{strategy:"dominant-color"});z.dominantColor=j.dominantColor}catch(j){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${j}`)}return await Z7($,Z,z,Y),z}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function FX($,Z,Y,X){let J=await OX();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function y4($,Z,Y){let X=Y||await OX();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await X.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)J=await X.resize(J,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)J=await X.blur(J,G.sigma);break;case"sharpen":if(G.amount!==void 0)J=await X.sharpen(J,G.amount);break;case"grayscale":J=await X.grayscale(J);break;case"rotate":if(G.angle!==void 0)J=await X.rotate(J,G.angle);break;case"flip":J=await X.flip(J);break;case"flop":J=await X.flop(J);break;case"brightness":if(G.value!==void 0)J=await X.brightness(J,G.value);break;case"contrast":if(G.value!==void 0)J=await X.contrast(J,G.value);break;case"saturation":if(G.value!==void 0)J=await X.saturation(J,G.value);break}}return await X.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var jW=D(()=>{E$();HX()});import{resolve as uV,basename as mV,extname as pV,join as cV}from"path";import{mkdir as lV}from"fs/promises";async function iV(){try{return await import("ts-images")}catch{return null}}async function c3($,Z,Y){let X=await iV();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=uV($);if(!await l0(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||nV,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",W=Y.baseUrl||"/images";await lV(K,{recursive:!0});let U=await c0(J),B=mV($,pV($)),_=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:$,byFormat:{},srcsets:{}};for(let j of G){z.byFormat[j]=[];let H=[];for(let O of Q){let F=`${B}-${O}w-${U}.${j}`,L=cV(K,F),V=`${W}/${F}`;try{let N=_[j]?.quality||80;if(await l0(L)){z.byFormat[j].push({path:L,url:V,width:O,height:0,format:j,size:0}),H.push(`${V} ${O}w`);continue}let A=await X.processImage({input:J,output:L,format:j,quality:N,resize:{width:O}});if(A)z.byFormat[j].push({path:L,url:V,width:O,height:A.height||Math.round(O*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${O}w`)}catch(N){console.warn(`[stx-media] Failed to generate ${j} at ${O}w: ${N}`)}}z.srcsets[j]=H.join(", ")}let q=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(q!=="none")try{if(q==="thumbhash"){let j=await X.generateThumbHash(J);z.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(J,{strategy:q,width:20});z.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:q}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return z.sizes=Z.sizes||sV(Q),z}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function sV($){let Z=[...$].sort((X,J)=>X-J),Y=[];for(let X=0;X<Z.length-1;X++){let J=Z[X];Y.push(`(max-width: ${J}px) ${J}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function l3($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var nV;var HW=D(()=>{E$();nV=[320,480,640,768,1024,1280,1536,1920]});var OW={};Z0(OW,{setCachedImageResult:()=>Z7,processImage:()=>LX,optimizeImage:()=>FX,getCachedImageResult:()=>$7,generateSrcset:()=>l3,generateResponsiveVariants:()=>c3,clearImageCache:()=>jX,applyTransformations:()=>y4,ImageProcessorCache:()=>e5});var VX=D(()=>{jW();HW();HX()});async function rV(){try{return await Promise.resolve().then(() => (VX(),OW))}catch($){if(!LW)console.warn("[stx-media] Image processor not available, some features disabled:",$),LW=!0;return null}}async function k$($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return eV(X,Y)}if(Y.processedResult?.processed)return MX($,Y.processedResult,Z);if(Y.responsiveVariants)return AW($,Y.responsiveVariants,Z);let{src:J,alt:Q,width:G,height:K,sizes:W,widths:U=u1,dpr:B,formats:_=Z$,quality:z=NX,params:q={},placeholder:j="none",placeholderOptions:H={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":n3,decoding:V=i3,fetchpriority:N,objectFit:A,objectPosition:w,crossorigin:R,referrerpolicy:T}=$,I=$.class,E=$.style,k=$.id,S=$.data||{},{isDev:x=!1,baseUrl:y=""}=Z;if(x&&!Z.optimize)return tV($);let b,f,r=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{b=await S4(J,{strategy:j,...H}),f=k4(r,b,H)}catch{}let u=B!==void 0&&G!==void 0,C;if(u)C=aV($,r,b,Z);else C=await oV($,r,b,Z);let h;if(F){let s=_.includes("webp")?"webp":_[0],W0=I$(J,U,{...q,q:z},s),$0=typeof W==="object"?l5(W):W||"100vw";h=`<link rel="preload" as="image" imagesrcset="${W0}" imagesizes="${$0}" />`}let p=[];if(!FW&&j!=="none")p.push(n5),FW=!0;if(f)p.push(f);let i=O?NW(r):void 0;return{html:C,preloadLink:h,css:p.length>0?p.join(`
1327
1327
  `):void 0,script:i}}async function oV($,Z,Y,X){let{src:J,alt:Q,width:G,height:K,sizes:W,widths:U=u1,formats:B=Z$,quality:_=NX,params:z={},lazy:q=!0,priority:j=!1,loading:H=j?"eager":n3,decoding:O=i3,fetchpriority:F,objectFit:L,objectPosition:V,crossorigin:N,referrerpolicy:A}=$,w=$.class,R=$.style,T=$.data||{},I=typeof W==="object"?l5(W):W||"100vw",E=[];for(let x of B){let y=I$(J,U,{...z,q:_},x),b=E4(x);if(q&&!j)E.push(` <source type="${b}" data-srcset="${y}" data-sizes="${I}" />`);else E.push(` <source type="${b}" srcset="${y}" sizes="${I}" />`)}let k=AX({src:S1(J,{...z,q:_}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:O,fetchpriority:j?"high":F,objectFit:L,objectPosition:V,crossorigin:N,referrerpolicy:A,className:VW(w,Y),style:wX(R,L,V,Y),lazy:q&&!j,data:T}),S;if(Y){let x=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;S=`<div id="${Z}" class="stx-img-placeholder" style="${x}">
1328
1328
  <picture>
1329
1329
  ${E.join(`
@@ -3097,7 +3097,7 @@ ${B}
3097
3097
  customElements.define('${Z}', ${G});
3098
3098
  `}async function iX($,Z,Y,X){if(Z.length<1)return J0("WebComponent","@webcomponent directive requires at least the tag name parameter",e.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[S$.join(S$.dirname(X),G,`${J}.stx`),S$.join(process.cwd(),G,`${J}.stx`),S$.join(S$.dirname(X),`${J}.stx`)],W=null;for(let _ of K)if(await t(_)){W=await Bun.file(_).text();break}if(!W)return J0("WebComponent",`Component file not found: ${J}.stx`,e.FILE_NOT_FOUND);let U=iW(W,J);return`<script type="module">
3099
3099
  ${nW(U)}
3100
- </script>`}var lX;var nX=D(()=>{j1();N0();lX={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0}});var sW={};Z0(sW,{timingPlugin:()=>oN,pluginManager:()=>rX,definePlugin:()=>_7,debugPlugin:()=>rN,createVariablesPlugin:()=>aN,createFilterPlugin:()=>sN,createDirectivePlugin:()=>nN,PluginManager:()=>sX});function _7($){return $}class sX{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.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 Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let J=X[$];if(J)try{let Q=await J(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 "${X.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let G=await Q(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${J.name}" ${$} hook:`,G)}}return X}}function nN($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function sN($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function aN($){return _7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var rX,rN,oN;var oX=D(()=>{rX=new sX;rN=_7({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($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){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)}}),oN=_7({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var tX={};Z0(tX,{validateConfig:()=>aW,loadStxConfig:()=>v0,defineStxConfig:()=>oW,defaultConfig:()=>G1,config:()=>K1});import aX from"fs";import Y1 from"path";import{loadConfigWithResult as tN}from"bunfig";function eN($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=Y1.join(process.cwd(),"resources","views"),J=Y1.join(process.cwd(),"resources","layouts");if(aX.existsSync(X)&&aX.existsSync(J))return{root:"resources",pagesDir:"views"};let Q=Y1.join(process.cwd(),"resources","views","pages");if(aX.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}async function v0($){if(!$){if(z7)return z7;if(K8)return K8}let Z=$?Y1.resolve($):process.cwd(),Y=rW.get(Z);if(Y)return Y;let X=(async()=>{let Q=(await tN({name:"stx",alias:"ui",cwd:Z,defaultConfig:G1,verbose:!1})).config,G=eN(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!Y1.isAbsolute(Q.partialsDir))Q.partialsDir=Y1.join(K,Q.partialsDir);if(Q.componentsDir&&!Y1.isAbsolute(Q.componentsDir))Q.componentsDir=Y1.join(K,Q.componentsDir);if(Q.layoutsDir&&!Y1.isAbsolute(Q.layoutsDir))Q.layoutsDir=Y1.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (oX(),sW)),W=[],U=[];for(let B of Q.plugins){let _=typeof B==="string"?B:B[0],z=typeof B==="string"?{}:B[1]||{};try{let q,j;try{q=await import(_),j=Y1.dirname(_0.resolve(_))}catch{let O=Y1.resolve(process.cwd(),_);q=await import(O),j=Y1.dirname(O)}let H=q.default||q;if(K.register(H,Q),H.components){let O=Y1.resolve(j,H.components);W.push(O)}if(H.pages){let O=Y1.resolve(j,H.pages),F=z.path||"/";U.push({dir:O,prefix:F})}if(H.setup){let O={addDirective:(F)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(F)},addRoute:(F,L)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[F]=L},addMiddleware:(F)=>{Q.middleware=Q.middleware||[],Q.middleware.push(F)},pluginDir:j,config:Q};await H.setup(z,O)}console.log(`[stx] Plugin loaded: ${H.name||_}`)}catch(q){console.warn(`[stx] Failed to load plugin ${_}:`,q.message)}}Q._pluginComponentDirs=W,Q._pluginPageDirs=U}return Q})();if(rW.set(Z,X),!$)K8=X,X.then((J)=>{z7=J}).catch(()=>{});return X}function oW($){return $}function aW($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.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)Z.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)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.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)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.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)Y.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)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((J,Q)=>{if(!J.pattern||typeof J.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(J.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].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))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.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)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.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)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var G1,z7=null,rW,K8=null,K1;var i0=D(()=>{k3();P3();fY();x3();v3();EX();hX();mW();Q8();nX();G1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,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:pY,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:iX,hasEndTag:!1,description:"Include a web component in the template"},E3,D3,X8,J8,S3,C3,y3,b3,tK,dY,P4,v4,...uW],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:"#app-content",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}};rW=new Map;K1=new Proxy(G1,{get($,Z){if(z7&&Z in z7)return z7[Z];if(!K8)v0().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var z8={};Z0(z8,{resetCssCache:()=>JA,resetCrosswindCache:()=>QA,rebuildCrosswindCSS:()=>h4,loadCrosswindConfig:()=>XJ,loadCrosswind:()=>YJ,injectCrosswindCSS:()=>T0,getCachedCSS:()=>GA,generateCrosswindCSS:()=>_8,extractClassNames:()=>B8,buildCrosswindCSS:()=>H7});import U8 from"fs";import B0 from"path";function ZJ($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function eX($,Z){if(Y$.has($))Y$.delete($);else if(Y$.size>=$A)Y$.delete(Y$.keys().next().value);Y$.set($,Z)}async function ZA($){if(!b$)return null;try{let Z=Bun.file(B0.join(b$,`cw-${ZJ($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function YA($,Z){if(!b$)return;try{if(!U8.existsSync(b$))U8.mkdirSync(b$,{recursive:!0});await Bun.write(B0.join(b$,`cw-${ZJ($)}.css`),Z)}catch{}}async function tW($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function XA(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==B0.dirname(Y))$.push(B0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(B0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(B0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push(B0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push(B0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(B0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=B0.dirname(Y);if(Z){let X=[B0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),B0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),B0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),B0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),B0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),B0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(B0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(B0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function YJ(){if($J)return j7;$J=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let X=await tW(Y);if(X){if(j7=X,!process.env.STACKS_DEV_QUIET)console.log(`${M.green}[Crosswind]${M.reset} CSS engine loaded`);return j7}}let Z=XA();for(let Y of Z)if(await Bun.file(Y).exists()){let X=await tW(Y);if(X){if(j7=X,!process.env.STACKS_DEV_QUIET)console.log(`${M.green}[Crosswind]${M.reset} CSS engine loaded from ${B0.dirname(B0.dirname(Y))}`);return j7}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${M.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${M.reset}`),console.warn(`${M.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${M.reset}`),null}}function JA(){Y$.clear()}function QA(){j7=null,$J=!1,C1=null,g4="",Y$.clear(),W8=null}async function XJ($){try{let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=B0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${M.green}[Crosswind]${M.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${M.yellow}[Crosswind]${M.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function H7($){if(q7)return g4;q7=!0;try{let Z=await YJ();if(!Z||!Z.build)return q7=!1,"";if(!C1)C1=await XJ($);if(!C1)return q7=!1,"";let Y=Z.defaultConfig?.theme||{},X=C1.theme||{},J={...Z.defaultConfig,...C1,theme:{...Y,...X,extend:{...Y.extend||{},...X.extend||{}}}},Q=performance.now(),G=await Z.build(J),K=performance.now()-Q;if(g4=G.css,console.log(`${M.cyan}[Crosswind]${M.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),J.output){let W=B0.isAbsolute(J.output)?J.output:B0.join($,J.output),U=B0.dirname(W);if(!U8.existsSync(U))U8.mkdirSync(U,{recursive:!0});await Bun.write(W,G.css)}return q7=!1,G.css}catch(Z){return console.error(`${M.red}[Crosswind]${M.reset} Build error:`,Z),q7=!1,g4}}async function h4($){C1=null,await H7($)}function GA(){return g4}function B8($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=J.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=J.exec($)}return Z}async function _8($,Z){try{let Y=await YJ();if(!Y)return"";let X=B8($);if(X.size===0)return"";let J=Z?B0.resolve(Z):process.cwd();if(!b$)b$=B0.join(J,".stx/cache");let Q=[...X].sort().join(" "),G=`${W8||"default"}::${Q}`,K=Y$.get(G);if(K!==void 0)return eX(G,K),K;let W=await ZA(G);if(W!==null)return eX(G,W),W;if(!C1){let A=null;try{let{loadStxConfig:w}=await Promise.resolve().then(() => (i0(),tX)),R=await w(J);if(R.css)if(typeof R.css==="string"){let T=B0.isAbsolute(R.css)?R.css:B0.resolve(J,R.css);if(await Bun.file(T).exists()){let I=await import(T);A=I.default||I,console.log(`${M.green}[Crosswind]${M.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=B0.isAbsolute(R.css.config)?R.css.config:B0.resolve(J,R.css.config);if(await Bun.file(T).exists()){let I=await import(T);A={...I.default||I,...A}}}console.log(`${M.green}[Crosswind]${M.reset} Using inline CSS config from stx.config.ts`)}}catch{}C1=A||await XJ(J);try{W8=ZJ(JSON.stringify(C1??{}))}catch{W8="unhashable"}}let U=Y.defaultConfig||Y.config,B=C1||{},_=U.theme||{},q=(B.theme||{}).extend||{},j={..._};if(Object.keys(q).length>0)j.extend=q;let H=[...U.safelist||[],...B.safelist||[]],O={...U,...B,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(O);for(let A of H)F.generate(A);for(let A of X)F.generate(A);let L=F.toCSS(!0,!1),V=O.shortcuts||B.shortcuts||{};for(let[A,w]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let R=w.split(/\s+/).filter(Boolean);for(let T of R)F.generate(T)}L=F.toCSS(!0,!1);let N=L.split(`
3100
+ </script>`}var lX;var nX=D(()=>{j1();A0();lX={strategy:"attribute",attributeName:"data-v",preserveOriginal:!0}});var sW={};Z0(sW,{timingPlugin:()=>oN,pluginManager:()=>rX,definePlugin:()=>_7,debugPlugin:()=>rN,createVariablesPlugin:()=>aN,createFilterPlugin:()=>sN,createDirectivePlugin:()=>nN,PluginManager:()=>sX});function _7($){return $}class sX{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.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 Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let J=X[$];if(J)try{let Q=await J(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 "${X.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let G=await Q(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${J.name}" ${$} hook:`,G)}}return X}}function nN($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function sN($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function aN($){return _7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var rX,rN,oN;var oX=D(()=>{rX=new sX;rN=_7({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($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){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)}}),oN=_7({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var tX={};Z0(tX,{validateConfig:()=>aW,loadStxConfig:()=>v0,defineStxConfig:()=>oW,defaultConfig:()=>G1,config:()=>K1});import aX from"fs";import Y1 from"path";import{loadConfigWithResult as tN}from"bunfig";function eN($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=Y1.join(process.cwd(),"resources","views"),J=Y1.join(process.cwd(),"resources","layouts");if(aX.existsSync(X)&&aX.existsSync(J))return{root:"resources",pagesDir:"views"};let Q=Y1.join(process.cwd(),"resources","views","pages");if(aX.existsSync(Q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}async function v0($){if(!$){if(z7)return z7;if(K8)return K8}let Z=$?Y1.resolve($):process.cwd(),Y=rW.get(Z);if(Y)return Y;let X=(async()=>{let Q=(await tN({name:"stx",alias:"ui",cwd:Z,defaultConfig:G1,verbose:!1})).config,G=eN(Q.root,Q.pagesDir);if(Q.root=G.root,Q.pagesDir=G.pagesDir,Q.root&&Q.root!=="."){let K=Q.root;if(Q.partialsDir&&!Y1.isAbsolute(Q.partialsDir))Q.partialsDir=Y1.join(K,Q.partialsDir);if(Q.componentsDir&&!Y1.isAbsolute(Q.componentsDir))Q.componentsDir=Y1.join(K,Q.componentsDir);if(Q.layoutsDir&&!Y1.isAbsolute(Q.layoutsDir))Q.layoutsDir=Y1.join(K,Q.layoutsDir)}if(Q.plugins&&Q.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (oX(),sW)),W=[],U=[];for(let B of Q.plugins){let _=typeof B==="string"?B:B[0],z=typeof B==="string"?{}:B[1]||{};try{let q,j;try{q=await import(_),j=Y1.dirname(_0.resolve(_))}catch{let O=Y1.resolve(process.cwd(),_);q=await import(O),j=Y1.dirname(O)}let H=q.default||q;if(K.register(H,Q),H.components){let O=Y1.resolve(j,H.components);W.push(O)}if(H.pages){let O=Y1.resolve(j,H.pages),F=z.path||"/";U.push({dir:O,prefix:F})}if(H.setup){let O={addDirective:(F)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(F)},addRoute:(F,L)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[F]=L},addMiddleware:(F)=>{Q.middleware=Q.middleware||[],Q.middleware.push(F)},pluginDir:j,config:Q};await H.setup(z,O)}console.log(`[stx] Plugin loaded: ${H.name||_}`)}catch(q){console.warn(`[stx] Failed to load plugin ${_}:`,q.message)}}Q._pluginComponentDirs=W,Q._pluginPageDirs=U}return Q})();if(rW.set(Z,X),!$)K8=X,X.then((J)=>{z7=J}).catch(()=>{});return X}function oW($){return $}function aW($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.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)Z.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)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.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)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.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)Y.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)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((J,Q)=>{if(!J.pattern||typeof J.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(J.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].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))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.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)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.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)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var G1,z7=null,rW,K8=null,K1;var i0=D(()=>{k3();P3();fY();x3();v3();EX();hX();mW();Q8();nX();G1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,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:pY,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:iX,hasEndTag:!1,description:"Include a web component in the template"},E3,D3,X8,J8,S3,C3,y3,b3,tK,dY,P4,v4,...uW],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:"#app-content",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}};rW=new Map;K1=new Proxy(G1,{get($,Z){if(z7&&Z in z7)return z7[Z];if(!K8)v0().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});var z8={};Z0(z8,{resetCssCache:()=>JA,resetCrosswindCache:()=>QA,rebuildCrosswindCSS:()=>h4,loadCrosswindConfig:()=>XJ,loadCrosswind:()=>YJ,injectCrosswindCSS:()=>T0,getCachedCSS:()=>GA,generateCrosswindCSS:()=>_8,extractClassNames:()=>B8,buildCrosswindCSS:()=>H7});import U8 from"fs";import B0 from"path";function ZJ($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function eX($,Z){if(Y$.has($))Y$.delete($);else if(Y$.size>=$A)Y$.delete(Y$.keys().next().value);Y$.set($,Z)}async function ZA($){if(!b$)return null;try{let Z=Bun.file(B0.join(b$,`cw-${ZJ($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function YA($,Z){if(!b$)return;try{if(!U8.existsSync(b$))U8.mkdirSync(b$,{recursive:!0});await Bun.write(B0.join(b$,`cw-${ZJ($)}.css`),Z)}catch{}}async function tW($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig}}catch{}return null}function XA(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"",Y=process.cwd();while(Y!==B0.dirname(Y))$.push(B0.join(Y,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(B0.join(Y,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(B0.join(Y,"pantry","@cwcss","crosswind","dist","index.js")),$.push(B0.join(Y,"pantry","@cwcss","crosswind","src","index.ts")),$.push(B0.join(Y,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(B0.join(Y,"pantry","@stacksjs","crosswind","dist","index.js")),Y=B0.dirname(Y);if(Z){let X=[B0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),B0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),B0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),B0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),B0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),B0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...X)}return $.push(B0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(B0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function YJ(){if($J)return j7;$J=!0;try{let $=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Y of $){let X=await tW(Y);if(X){if(j7=X,!process.env.STACKS_DEV_QUIET)console.log(`${M.green}[Crosswind]${M.reset} CSS engine loaded`);return j7}}let Z=XA();for(let Y of Z)if(await Bun.file(Y).exists()){let X=await tW(Y);if(X){if(j7=X,!process.env.STACKS_DEV_QUIET)console.log(`${M.green}[Crosswind]${M.reset} CSS engine loaded from ${B0.dirname(B0.dirname(Y))}`);return j7}}throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${M.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${M.reset}`),console.warn(`${M.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${M.reset}`),null}}function JA(){Y$.clear()}function QA(){j7=null,$J=!1,C1=null,g4="",Y$.clear(),W8=null}async function XJ($){try{let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=B0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${M.green}[Crosswind]${M.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${M.yellow}[Crosswind]${M.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}async function H7($){if(q7)return g4;q7=!0;try{let Z=await YJ();if(!Z||!Z.build)return q7=!1,"";if(!C1)C1=await XJ($);if(!C1)return q7=!1,"";let Y=Z.defaultConfig?.theme||{},X=C1.theme||{},J={...Z.defaultConfig,...C1,theme:{...Y,...X,extend:{...Y.extend||{},...X.extend||{}}}},Q=performance.now(),G=await Z.build(J),K=performance.now()-Q;if(g4=G.css,console.log(`${M.cyan}[Crosswind]${M.reset} Built ${G.classes.size} classes in ${K.toFixed(1)}ms`),J.output){let W=B0.isAbsolute(J.output)?J.output:B0.join($,J.output),U=B0.dirname(W);if(!U8.existsSync(U))U8.mkdirSync(U,{recursive:!0});await Bun.write(W,G.css)}return q7=!1,G.css}catch(Z){return console.error(`${M.red}[Crosswind]${M.reset} Build error:`,Z),q7=!1,g4}}async function h4($){C1=null,await H7($)}function GA(){return g4}function B8($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=J.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let W of K.slice(1,-1).split(/\s+/))if(W.trim())Z.add(W.trim())}Q=J.exec($)}return Z}async function _8($,Z){try{let Y=await YJ();if(!Y)return"";let X=B8($);if(X.size===0)return"";let J=Z?B0.resolve(Z):process.cwd();if(!b$)b$=B0.join(J,".stx/cache");let Q=[...X].sort().join(" "),G=`${W8||"default"}::${Q}`,K=Y$.get(G);if(K!==void 0)return eX(G,K),K;let W=await ZA(G);if(W!==null)return eX(G,W),W;if(!C1){let A=null;try{let{loadStxConfig:w}=await Promise.resolve().then(() => (i0(),tX)),R=await w(J);if(R.css)if(typeof R.css==="string"){let T=B0.isAbsolute(R.css)?R.css:B0.resolve(J,R.css);if(await Bun.file(T).exists()){let I=await import(T);A=I.default||I,console.log(`${M.green}[Crosswind]${M.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(A={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=B0.isAbsolute(R.css.config)?R.css.config:B0.resolve(J,R.css.config);if(await Bun.file(T).exists()){let I=await import(T);A={...I.default||I,...A}}}console.log(`${M.green}[Crosswind]${M.reset} Using inline CSS config from stx.config.ts`)}}catch{}C1=A||await XJ(J);try{W8=ZJ(JSON.stringify(C1??{}))}catch{W8="unhashable"}}let U=Y.defaultConfig||Y.config,B=C1||{},_=U.theme||{},q=(B.theme||{}).extend||{},j={..._};if(Object.keys(q).length>0)j.extend=q;let H=[...U.safelist||[],...B.safelist||[]],O={...U,...B,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(O);for(let A of H)F.generate(A);for(let A of X)F.generate(A);let L=F.toCSS(!0,!1),V=O.shortcuts||B.shortcuts||{};for(let[A,w]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let R=w.split(/\s+/).filter(Boolean);for(let T of R)F.generate(T)}L=F.toCSS(!0,!1);let N=L.split(`
3101
3101
  `);for(let[A,w]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let R=w.split(/\s+/).filter(Boolean),T=[],I=[];for(let E of R){let k=E.startsWith("dark:"),y=`.${(k?E.slice(5):E).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<N.length;b++){let f=N[b].trim();if(f===`${y} {`||f.startsWith(`${y} {`)){let r=b,u="";while(r<N.length){if(u+=N[r],N[r].includes("}"))break;r++}let C=u.match(/\{([^}]+)\}/);if(C)if(k)I.push(C[1].trim());else T.push(C[1].trim());break}}}if(T.length)L+=`
3102
3102
  .${A} { ${T.join(" ")} }`;if(I.length)L+=`
3103
3103
  @media (prefers-color-scheme: dark) { .dark .${A} { ${I.join(" ")} } }`}return eX(G,L),YA(G,L),L}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function T0($,Z){let Y=await _8($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
@@ -3989,12 +3989,12 @@ window.__stx_reactive = (function() {
3989
3989
  ${SA()}
3990
3990
  ${Y}
3991
3991
  </script>`}function LU($,Z,Y){if(OU=0,!yA($))return $;let X=IA($);if(X.length===0)return $;let J=CA($,X),Q=bA(X,Z),G=J.lastIndexOf("</body>");if(G!==-1)J=J.slice(0,G)+Q+`
3992
- `+J.slice(G);else J+=Q;return J}function CA($,Z){let Y=$;for(let X of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${H8(X.stateExpr)}["']`,"gi").exec(Y);if(Q)X.id=Q[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${H8(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${H8(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${H8(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}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 yA($){return/x-data\s*=\s*["']/.test($)}var OU=0,TA=0;var FU=D(()=>{n0()});import PA from"fs";import jJ from"path";import{createHighlighter as xA}from"ts-syntax-highlighter";async function X$($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let X=(await PA.promises.stat($)).mtime.getTime();if(Z.cache&&L8.has($)){let _=L8.get($);if(_.updatedAt>=X)return{content:_.content,data:_.data}}let J=await Bun.file($).text(),{data:Q,content:G}=ZW(J),K=Z.markdown||K1.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=R4(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)U=await vA(U,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let B={content:U,data:Q||{}};if(Z.cache)L8.set($,{...B,updatedAt:X});return B}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:L0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function vA($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!O8)try{O8=await xA({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let J=async(K,W,U,B)=>{let _=B.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),z=U||(Y?"text":"");if(!z)return K;try{if(!O8.getSupportedLanguages().includes(z))return K;return(await O8.highlight(_,z,{theme:Z})).html}catch(q){console.error(`Error highlighting code block with language ${U}:`,q)}return K},Q=$,G=$.matchAll(X);for(let K of G){let[W,U,B,_]=K,z=await J(W,U,B,_);Q=Q.replace(W,z)}return Q}async function HJ($,Z,Y="",X={}){return await fA($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,U)=>{try{let B=K;if(!jJ.isAbsolute(K))B=jJ.resolve(jJ.dirname(Y),K);let _={};if(W)try{try{_=JSON.parse(W)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let L=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of L){let N=V.indexOf(":");if(N>0){let A=V.substring(0,N).trim(),w=V.substring(N+1).trim(),R=w.startsWith('"')&&w.endsWith('"'),T=w.startsWith("'")&&w.endsWith("'");if(R||T)w=w.substring(1,w.length-1);_[A]=w}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:z,data:q}=await X$(B,X),j={...Z,...q,..._},H=z,O=/\{\{([^}]+)\}\}/g;return H=H.replace(O,(F,L)=>{let V=L.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(B){let _=B instanceof Error?B.message:String(B);return L0("Markdown File",`Error including markdown file: ${_}`,Y,$,U,G)}})}async function fA($,Z,Y){let X=[],J;while((J=Z.exec($))!==null){let K=J[0],W=J.index,U=J;X.push(Y(...U).then((B)=>({match:K,replacement:B,index:W})))}let Q=await Promise.all(X);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var L8,O8=null;var O7=D(()=>{i0();N0();L8=new Map});function LJ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function C$($,Z){if(!$)return Z?.nonceGenerator?.()??LJ();let Y=OJ.get($);if(!Y)Y=Z?.nonceGenerator?.()??LJ(),OJ.set($,Y);return Y}function gA($){OJ.delete($)}function FJ($,Z){let Y=[];for(let[X,J]of Object.entries($)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Y.push(X);continue}if(Array.isArray(J)){let Q=[...J];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${X} ${Q.join(" ")}`)}}return Y.join("; ")}function V8($,Z){return`<meta http-equiv="Content-Security-Policy" content="${FJ($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function hA($){return{enabled:!0,directives:{strict:VU,moderate:F8,relaxed:NU,api:AU}[$]||F8,useNonce:$==="strict",addMetaTag:!0}}function dA($,Z){let Y={...$};for(let[X,J]of Object.entries(Z)){let Q=X,G=Y[Q];if(J===void 0||J===null)continue;if(typeof J==="boolean")Y[Q]=G||J;else if(Array.isArray(J)){let K=Array.isArray(G)?G:[],W=[...new Set([...K,...J])];Y[Q]=W}}return Y}function VJ($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?C$(Y,Z):void 0,J=V8(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3992
+ `+J.slice(G);else J+=Q;return J}function CA($,Z){let Y=$;for(let X of Z){let Q=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${H8(X.stateExpr)}["']`,"gi").exec(Y);if(Q)X.id=Q[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${H8(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${H8(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${H8(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}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 yA($){return/x-data\s*=\s*["']/.test($)}var OU=0,TA=0;var FU=D(()=>{n0()});import PA from"fs";import jJ from"path";import{createHighlighter as xA}from"ts-syntax-highlighter";async function X$($,Z={}){try{if(!await t($))throw Error(`Markdown file not found: ${$}`);let X=(await PA.promises.stat($)).mtime.getTime();if(Z.cache&&L8.has($)){let _=L8.get($);if(_.updatedAt>=X)return{content:_.content,data:_.data}}let J=await Bun.file($).text(),{data:Q,content:G}=ZW(J),K=Z.markdown||K1.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=R4(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)U=await vA(U,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let B={content:U,data:Q||{}};if(Z.cache)L8.set($,{...B,updatedAt:X});return B}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:F0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function vA($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!O8)try{O8=await xA({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let J=async(K,W,U,B)=>{let _=B.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),z=U||(Y?"text":"");if(!z)return K;try{if(!O8.getSupportedLanguages().includes(z))return K;return(await O8.highlight(_,z,{theme:Z})).html}catch(q){console.error(`Error highlighting code block with language ${U}:`,q)}return K},Q=$,G=$.matchAll(X);for(let K of G){let[W,U,B,_]=K,z=await J(W,U,B,_);Q=Q.replace(W,z)}return Q}async function HJ($,Z,Y="",X={}){return await fA($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,W,U)=>{try{let B=K;if(!jJ.isAbsolute(K))B=jJ.resolve(jJ.dirname(Y),K);let _={};if(W)try{try{_=JSON.parse(W)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let L=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of L){let N=V.indexOf(":");if(N>0){let A=V.substring(0,N).trim(),w=V.substring(N+1).trim(),R=w.startsWith('"')&&w.endsWith('"'),T=w.startsWith("'")&&w.endsWith("'");if(R||T)w=w.substring(1,w.length-1);_[A]=w}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:z,data:q}=await X$(B,X),j={...Z,...q,..._},H=z,O=/\{\{([^}]+)\}\}/g;return H=H.replace(O,(F,L)=>{let V=L.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(B){let _=B instanceof Error?B.message:String(B);return F0("Markdown File",`Error including markdown file: ${_}`,Y,$,U,G)}})}async function fA($,Z,Y){let X=[],J;while((J=Z.exec($))!==null){let K=J[0],W=J.index,U=J;X.push(Y(...U).then((B)=>({match:K,replacement:B,index:W})))}let Q=await Promise.all(X);Q.sort((K,W)=>W.index-K.index);let G=$;for(let{match:K,replacement:W}of Q)G=G.replace(K,()=>W);return G}var L8,O8=null;var O7=D(()=>{i0();A0();L8=new Map});function LJ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function C$($,Z){if(!$)return Z?.nonceGenerator?.()??LJ();let Y=OJ.get($);if(!Y)Y=Z?.nonceGenerator?.()??LJ(),OJ.set($,Y);return Y}function gA($){OJ.delete($)}function FJ($,Z){let Y=[];for(let[X,J]of Object.entries($)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Y.push(X);continue}if(Array.isArray(J)){let Q=[...J];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${X} ${Q.join(" ")}`)}}return Y.join("; ")}function V8($,Z){return`<meta http-equiv="Content-Security-Policy" content="${FJ($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function hA($){return{enabled:!0,directives:{strict:VU,moderate:F8,relaxed:NU,api:AU}[$]||F8,useNonce:$==="strict",addMetaTag:!0}}function dA($,Z){let Y={...$};for(let[X,J]of Object.entries(Z)){let Q=X,G=Y[Q];if(J===void 0||J===null)continue;if(typeof J==="boolean")Y[Q]=G||J;else if(Array.isArray(J)){let K=Array.isArray(G)?G:[],W=[...new Set([...K,...J])];Y[Q]=W}}return Y}function VJ($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?C$(Y,Z):void 0,J=V8(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3993
3993
  ${J}`)}function uA($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<script nonce="${Z}"${J}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<style nonce="${Z}"${J}>`}),Y}function NJ($,Z,Y,X){let J=$,Q=X.csp;if(J=J.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?C$(Z,Q):void 0;return V8(Q.directives,G)}),J=J.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return C$(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=C$(Z,Q);return J}function mA(){return[wU,RU]}function pA($){let Z=[];if($["script-src"]?.includes("'unsafe-inline'"))Z.push("CSP: Using unsafe-inline in script-src significantly reduces XSS protection");if($["script-src"]?.includes("'unsafe-eval'"))Z.push("CSP: Using unsafe-eval in script-src allows eval() and related functions");if(!$["default-src"])Z.push("CSP: No default-src specified. Recommend adding default-src as a fallback");if($["default-src"]?.includes("*"))Z.push("CSP: Using * in default-src provides minimal protection");if(!$["object-src"]&&!$["default-src"]?.includes("'none'"))Z.push("CSP: Consider adding object-src: none to block plugins");if(!$["base-uri"])Z.push("CSP: Consider adding base-uri to prevent base tag injection attacks");for(let[Y,X]of Object.entries($))if(Array.isArray(X)&&X.includes("http:"))Z.push(`CSP: Using http: in ${Y} allows insecure resources`);return Z}function MU($=!1){return $?"Content-Security-Policy-Report-Only":"Content-Security-Policy"}function cA($,Z){if(!$.enabled)return{};let Y=$.useNonce?C$(Z,$):void 0,X=FJ($.directives,Y);return{[MU($.reportOnly)]:X}}var OJ,VU,F8,NU,AU,wU,RU,lA;var AJ=D(()=>{OJ=new WeakMap;VU={"default-src":["'self'"],"script-src":["'self'","'strict-dynamic'"],"style-src":["'self'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'none'"],"base-uri":["'self'"],"form-action":["'self'"],"frame-ancestors":["'self'"],"upgrade-insecure-requests":!0},F8={"default-src":["'self'"],"script-src":["'self'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:"],"font-src":["'self'","https:","data:"],"connect-src":["'self'","https:"],"media-src":["'self'"],"object-src":["'none'"],"frame-src":["'self'"],"base-uri":["'self'"],"form-action":["'self'"],"upgrade-insecure-requests":!0},NU={"default-src":["'self'"],"script-src":["'self'","'unsafe-inline'"],"style-src":["'self'","'unsafe-inline'"],"img-src":["'self'","data:","https:","http:"],"font-src":["'self'","https:","http:","data:"],"connect-src":["'self'","https:","http:","ws:","wss:"],"media-src":["'self'","https:","http:"],"object-src":["'none'"],"frame-src":["'self'","https:"],"base-uri":["'self'"]},AU={"default-src":["'none'"],"frame-ancestors":["'none'"]};wU={name:"csp",handler:($,Z,Y,X)=>{let Q=Y.__stx_options?.csp;if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?C$(Y,Q):void 0;return V8(Q.directives,G)},hasEndTag:!1,description:"Insert Content-Security-Policy meta tag"},RU={name:"cspNonce",handler:($,Z,Y,X)=>{let Q=Y.__stx_options?.csp;if(!Q?.enabled||!Q.useNonce)return"";return C$(Y,Q)},hasEndTag:!1,description:"Output the current CSP nonce value"};lA={enabled:!1,reportOnly:!1,directives:F8,useNonce:!1,addMetaTag:!0}});import iA from"crypto";function sA($=nA){let Z=iA.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return wJ=Z,Z}function rA(){if(!wJ)sA();return wJ}function oA($=TU){let Z=rA();return`<input type="hidden" name="${$}" value="${Z}">`}function IU($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return oA(X||TU)})}var nA=40,TU="_token",wJ=null;var EU=()=>{};async function RJ($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let J=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)J=await aA(J,Q,Z,Y,X);else J=await tA(J,Q,Z,Y,X)}return J}async function aA($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=`@${Q}`,W=`@end${Q}`,U=$,B=p5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),_=[],z=B.exec(U);while(z!==null){let[q,j="",H=""]=z,O=z.index||0;try{let F=j?DU(j):[],L=H.trim(),V=await G(L,F,Y,X);_.push({original:q,processed:V,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(J.debug)console.error(`Error processing custom directive @${Q}:`,F);_.push({original:q,processed:J0("CustomDirective",`Error in @${Q}${j?`(${j})`:""}: ${L}`,e.EVALUATION_ERROR),startIndex:O})}z=B.exec(U)}for(let q=_.length-1;q>=0;q--){let{original:j,processed:H}=_[q];U=U.replace(j,H)}return U}async function tA($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=$,W=p5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),U=[],B=W.exec(K);while(B!==null){let[q,j=""]=B,H=B.index||0;try{let O=DU(j),F=await G("",O,Y,X);U.push({original:q,processed:F,startIndex:H})}catch(O){let F=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${Q}:`,O);U.push({original:q,processed:J0("CustomDirective",`Error in @${Q}(${j}): ${F}`,e.EVALUATION_ERROR),startIndex:H})}B=W.exec(K)}let _=p5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),z=_.exec(K);while(z!==null){let[q]=z,j=z.index||0;try{let H=await G("",[],Y,X);U.push({original:q,processed:H,startIndex:j})}catch(H){let O=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${Q}:`,H);U.push({original:q,processed:J0("CustomDirective",`Error in @${Q}: ${O}`,e.EVALUATION_ERROR),startIndex:j})}z=_.exec(K)}for(let q=U.length-1;q>=0;q--){let{original:j,processed:H}=U[q];K=K.replace(j,H)}return K}function DU($){if(!$.trim())return[];let Z=[],Y="",X=!1,J="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,J=G;else if(G===J)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var MJ=D(()=>{j1();U5()});var w8={};Z0(w8,{useTitle:()=>bU,useSeoMeta:()=>u4,usePageTitle:()=>bU,useHead:()=>P$,resetHead:()=>kU,renderHtmlAttrs:()=>yU,renderHead:()=>CU,renderBodyAttrs:()=>PU,processTitleDirective:()=>fU,processMetaDirective:()=>gU,processHeadDirective:()=>vU,getPageMeta:()=>A8,getHead:()=>L7,definePageMeta:()=>SU,applyHead:()=>xU});function L7(){return y$}function A8(){return N8}function kU(){y$={},eA.length=0,N8={}}function P$($){y$=$w(y$,$)}function $w($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function u4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let W=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:W})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let J=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(J)Z.push({name:"twitter:title",content:J});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let W of $.articleTags)Z.push({property:"article:tag",content:W});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});P$({title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K})}function SU($){if(N8={...N8,...$},$.title||$.description)u4({title:$.title,description:$.description})}function bU($){let Z=typeof $==="function"?$():$;P$({title:Z})}function CU($=y$){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${_5(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,J])=>`${X}="${_5(J)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>{return`${J==="httpEquiv"?"http-equiv":J}="${_5(String(Q))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>`${J}="${_5(String(Q))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...J}=Y,Q=Object.entries(J).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${_5(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${Q}>${X}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
3994
3994
  `)}function yU($=y$){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${_5(Y)}"`).join(" ")}function PU($=y$){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${_5(Y)}"`).join(" ")}function _5($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function xU($=y$){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[J,Q]of Object.entries(Z))if(Q!==void 0)X.setAttribute(J,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function vU($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,J)=>{return Z+=J.trim()+`
3995
3995
  `,""}),headContent:Z.trim()}}function fU($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,J,Q)=>{let G=X?J:Z[(Q||"").trim()]??Q;return P$({title:G}),""})}function gU($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,J,Q,G,K)=>{let W=Q?G:K,U=Q?W:Z[(W||"").trim()]??W,_=J.includes(":")?{property:J,content:U}:{name:J,content:U};return P$({meta:[_]}),""})}var y$,eA,N8;var x$=D(()=>{y$={},eA=[],N8={}});import Zw from"crypto";function s0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function Yw($){return{...M8,...$.forms?.classes}}function R8($,Z,Y,X){let J=$||Z;return Y?`${J} ${X}`:J}function Xw(){return Zw.randomUUID()}function Jw($,Z,Y,X){let J=Yw(X),Q=$;return Q=mU(Q,Z),Q=F7(Q,Z),Q=T8(Q,Z,J),Q=I8(Q,Z,J),Q}function F7($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=Xw();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${s0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,J)=>{let Q=J.toUpperCase();if(J&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${s0(Q)}">`;return X}),Y}function T8($,Z,Y=M8){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,Q,G,K,W,U="")=>{let B=Q||G||"POST",_=K||W||"",z=v$(U),q=B.toUpperCase(),j=["GET","POST"].includes(q)?q:"POST",H=`<form method="${s0(j)}" action="${s0(_)}"${z?` ${z}`:""}>`;if(H+=`
3996
3996
  ${F7("@csrf",Z)}`,!["GET","POST"].includes(q))H+=`
3997
- ${F7(`@method('${q}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,Q,G,K,W,U="")=>{let B=Q||G||"",_=K||W||"",z=v$(U),q=m4(B,Z),j=q!==void 0&&q!==null?q:_||"",H=z.match(/type=['"]([^'"]+)['"]/i),O=H?H[1]:"text",F=p4(B,Z),L=z.match(/class=['"]([^'"]+)['"]/i),V=R8(L?L[1]:"",Y.input,F,Y.inputError),N=z.replace(/class=['"][^'"]+['"]/i,"");return N=N.replace(/type=['"][^'"]+['"]/i,""),`<input type="${s0(O)}" name="${s0(B)}" value="${s0(j)}" class="${V}"${N?` ${N}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,Q,G="",K="")=>{let W=v$(G),U=m4(Q,Z)||K.trim(),B=p4(Q,Z),_=W.match(/class=['"]([^'"]+)['"]/i),z=R8(_?_[1]:"",Y.input,B,Y.inputError),q=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${s0(Q)}" class="${z}"${q?` ${q}`:""}>${s0(U)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,Q,G="",K)=>{let W=v$(G),U=m4(Q,Z),B=p4(Q,Z),_=W.match(/class=['"]([^'"]+)['"]/i),z=R8(_?_[1]:"",Y.input,B,Y.inputError),q=W.replace(/class=['"][^'"]+['"]/i,""),j=K;if(U!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,O,F)=>{if((Array.isArray(U)?U.some((V)=>String(V)===F):String(U)===F)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return H});return`<select name="${s0(Q)}" class="${z}"${q?` ${q}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="1",K="")=>{let W=v$(K),U=m4(Q,Z),B=U!==void 0&&(Array.isArray(U)?U.some((j)=>String(j)===G):U===!0||String(U)===G),_=W.match(/class=['"]([^'"]+)['"]/i),z=_?_[1]:Y.checkInput,q=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${s0(Q)}" value="${s0(G)}" class="${z}"${B?" checked":""}${q?` ${q}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let W=v$(K),U=m4(Q,Z),B=U!==void 0&&U===G,_=W.match(/class=['"]([^'"]+)['"]/i),z=_?_[1]:Y.checkInput,q=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${s0(Q)}" value="${s0(G)}" class="${z}"${B?" checked":""}${q?` ${q}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="")=>{let K=v$(G),W=K.match(/accept=['"]([^'"]+)['"]/i),U=W?W[1]:"",B=K.includes("multiple"),_=p4(Q,Z),z=K.match(/class=['"]([^'"]+)['"]/i),q=R8(z?z[1]:"",Y.input,_,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${s0(Q)}"`,`class="${q}"`];if(U)H.push(`accept="${s0(U)}"`);if(B)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,Q,G="",K)=>{let W=v$(G),U=W.match(/class=['"]([^'"]+)['"]/i),B=U?U[1]:Y.label,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${s0(Q)}" class="${B}"${_?` ${_}`:""}>${K}</label>`}),X}function I8($,Z,Y=M8){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,J,Q)=>{try{if(p4(J,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return hU(J,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(J);return hU(J,Z)}let W=K.trim();if(H0(W)){let U=z0(W,Z);return U!==void 0?String(U):W}return W}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function p4($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function hU($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function m4($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function v$($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=X.exec(Y))!==null){let[,Q,,G]=J;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}function Qw($,Z){dU[$]=Z}function TJ($){let[Z,...Y]=$.split(":"),X=Y.length>0?Y.join(":").split(","):[];return{name:Z.trim(),params:X}}function uU($,Z,Y,X={}){let J=[],Q=Y.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let K=TJ(G),W=dU[K.name];if(!W){console.warn(`Unknown validation rule: ${K.name}`);continue}if(K.name==="confirmed"){let B=`${$}_confirmation`;K.params=[X[B]]}let U=W(Z,K.params||[],$);if(U)J.push(K.message||U)}return{field:$,valid:J.length===0,errors:J}}function Gw($,Z){let Y={};for(let[X,J]of Object.entries(Z)){let Q=uU(X,$[X],J,$);if(!Q.valid)Y[X]=Q.errors}return Y}function mU($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(Y,X,J,Q)=>{let G=J.split("|").map((W)=>W.trim()),K=[];for(let W of G){let U=TJ(W);switch(U.name){case"required":K.push("required");break;case"email":K.push('type="email"');break;case"url":K.push('type="url"');break;case"numeric":case"integer":if(K.push('type="number"'),U.name==="integer")K.push('step="1"');break;case"min":if(U.params?.[0])K.push(`minlength="${U.params[0]}"`);break;case"max":if(U.params?.[0])K.push(`maxlength="${U.params[0]}"`);break;case"regex":if(U.params?.[0])K.push(`pattern="${U.params[0]}"`);break}}return`<!-- @validate:${X}:${J} -->${K.length>0?`<!-- attrs:${K.join(" ")} -->`:""}`})}function Kw($){IJ[$.name]=$}function pU($,Z,Y={}){let X=[],J=Z.split("|").map((Q)=>Q.trim());for(let Q of J){let G=TJ(Q),K=IJ[G.name];if(!K){console.warn(`Unknown validation rule: ${G.name}`);continue}let W=K.validate($,G.params||[],Y);if(W!==!0)X.push(W)}return{valid:X.length===0,errors:X}}function Ww($,Z){let Y={},X=!0;for(let[J,Q]of Object.entries(Z)){let G=pU($[J],Q,$);if(!G.valid)X=!1,Y[J]=G.errors}return{valid:X,errors:Y}}function Uw($,Z){let Y=JSON.stringify(Z);return`
3997
+ ${F7(`@method('${q}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,Q,G,K,W,U="")=>{let B=Q||G||"",_=K||W||"",z=v$(U),q=m4(B,Z),j=q!==void 0&&q!==null?q:_||"",H=z.match(/type=['"]([^'"]+)['"]/i),O=H?H[1]:"text",F=p4(B,Z),L=z.match(/class=['"]([^'"]+)['"]/i),V=R8(L?L[1]:"",Y.input,F,Y.inputError),N=z.replace(/class=['"][^'"]+['"]/i,"");return N=N.replace(/type=['"][^'"]+['"]/i,""),`<input type="${s0(O)}" name="${s0(B)}" value="${s0(j)}" class="${V}"${N?` ${N}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,Q,G="",K="")=>{let W=v$(G),U=m4(Q,Z)||K.trim(),B=p4(Q,Z),_=W.match(/class=['"]([^'"]+)['"]/i),z=R8(_?_[1]:"",Y.input,B,Y.inputError),q=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${s0(Q)}" class="${z}"${q?` ${q}`:""}>${s0(U)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,Q,G="",K)=>{let W=v$(G),U=m4(Q,Z),B=p4(Q,Z),_=W.match(/class=['"]([^'"]+)['"]/i),z=R8(_?_[1]:"",Y.input,B,Y.inputError),q=W.replace(/class=['"][^'"]+['"]/i,""),j=K;if(U!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,O,F)=>{if((Array.isArray(U)?U.some((V)=>String(V)===F):String(U)===F)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return H});return`<select name="${s0(Q)}" class="${z}"${q?` ${q}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="1",K="")=>{let W=v$(K),U=m4(Q,Z),B=U!==void 0&&(Array.isArray(U)?U.some((j)=>String(j)===G):U===!0||String(U)===G),_=W.match(/class=['"]([^'"]+)['"]/i),z=_?_[1]:Y.checkInput,q=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${s0(Q)}" value="${s0(G)}" class="${z}"${B?" checked":""}${q?` ${q}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let W=v$(K),U=m4(Q,Z),B=U!==void 0&&U===G,_=W.match(/class=['"]([^'"]+)['"]/i),z=_?_[1]:Y.checkInput,q=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${s0(Q)}" value="${s0(G)}" class="${z}"${B?" checked":""}${q?` ${q}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="")=>{let K=v$(G),W=K.match(/accept=['"]([^'"]+)['"]/i),U=W?W[1]:"",B=K.includes("multiple"),_=p4(Q,Z),z=K.match(/class=['"]([^'"]+)['"]/i),q=R8(z?z[1]:"",Y.input,_,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${s0(Q)}"`,`class="${q}"`];if(U)H.push(`accept="${s0(U)}"`);if(B)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,Q,G="",K)=>{let W=v$(G),U=W.match(/class=['"]([^'"]+)['"]/i),B=U?U[1]:Y.label,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${s0(Q)}" class="${B}"${_?` ${_}`:""}>${K}</label>`}),X}function I8($,Z,Y=M8){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,J,Q)=>{try{if(p4(J,Z))return Q.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return hU(J,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(J);return hU(J,Z)}let W=K.trim();if(O0(W)){let U=z0(W,Z);return U!==void 0?String(U):W}return W}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function p4($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function hU($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function m4($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function v$($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=X.exec(Y))!==null){let[,Q,,G]=J;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}function Qw($,Z){dU[$]=Z}function TJ($){let[Z,...Y]=$.split(":"),X=Y.length>0?Y.join(":").split(","):[];return{name:Z.trim(),params:X}}function uU($,Z,Y,X={}){let J=[],Q=Y.split("|").map((G)=>G.trim()).filter(Boolean);for(let G of Q){let K=TJ(G),W=dU[K.name];if(!W){console.warn(`Unknown validation rule: ${K.name}`);continue}if(K.name==="confirmed"){let B=`${$}_confirmation`;K.params=[X[B]]}let U=W(Z,K.params||[],$);if(U)J.push(K.message||U)}return{field:$,valid:J.length===0,errors:J}}function Gw($,Z){let Y={};for(let[X,J]of Object.entries(Z)){let Q=uU(X,$[X],J,$);if(!Q.valid)Y[X]=Q.errors}return Y}function mU($,Z){return $.replace(/@validate\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]*)\})?\s*\)/g,(Y,X,J,Q)=>{let G=J.split("|").map((W)=>W.trim()),K=[];for(let W of G){let U=TJ(W);switch(U.name){case"required":K.push("required");break;case"email":K.push('type="email"');break;case"url":K.push('type="url"');break;case"numeric":case"integer":if(K.push('type="number"'),U.name==="integer")K.push('step="1"');break;case"min":if(U.params?.[0])K.push(`minlength="${U.params[0]}"`);break;case"max":if(U.params?.[0])K.push(`maxlength="${U.params[0]}"`);break;case"regex":if(U.params?.[0])K.push(`pattern="${U.params[0]}"`);break}}return`<!-- @validate:${X}:${J} -->${K.length>0?`<!-- attrs:${K.join(" ")} -->`:""}`})}function Kw($){IJ[$.name]=$}function pU($,Z,Y={}){let X=[],J=Z.split("|").map((Q)=>Q.trim());for(let Q of J){let G=TJ(Q),K=IJ[G.name];if(!K){console.warn(`Unknown validation rule: ${G.name}`);continue}let W=K.validate($,G.params||[],Y);if(W!==!0)X.push(W)}return{valid:X.length===0,errors:X}}function Ww($,Z){let Y={},X=!0;for(let[J,Q]of Object.entries(Z)){let G=pU($[J],Q,$);if(!G.valid)X=!1,Y[J]=G.errors}return{valid:X,errors:Y}}function Uw($,Z){let Y=JSON.stringify(Z);return`
3998
3998
  <script>
3999
3999
  (function() {
4000
4000
  const form = document.getElementById('${$}');
@@ -4050,7 +4050,7 @@ catch { return 'Please enter a valid URL'; } },
4050
4050
  `),X=[{obj:Z,indent:-1}];for(let J of Y){let Q=J.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,W=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,U,B]=W,_=U.trim(),z=B.trim();if(z==="")K[_]={},X.push({obj:K[_],indent:G});else K[_]=Tw(z)}}return Z}function Tw($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function Iw($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function sU($,Z){return l4($,Z)}function Ew($,Z){for(let Y of $){let X=Y.trim(),J=X.match(/^\{(\d+)\}\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10);if(Z===G)return J[2];continue}let Q=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function rU($,Z={}){return oU($,Z)}function oU($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let J=Dw($,X);if(J===-1){Y+=$[X],X++;continue}let Q=$.slice(X+1,J);Y+=kw(Q,Z),X=J+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function Dw($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function kw($,Z){let Y=Sw($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),J=Z[X];if(Y.length===1)return J!==void 0?String(J):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return bw(J,Y.slice(2).join(","),Z);case"select":return yw(J,Y.slice(2).join(","));case"selectordinal":return Pw(J,Y.slice(2).join(","));case"number":return vw(J,Y[2]?.trim());case"date":return fw(J,Y[2]?.trim());case"time":return gw(J,Y[2]?.trim());default:return J!==void 0?String(J):`{${$}}`}}function Sw($){let Z=[],Y="",X=0;for(let J=0;J<$.length;J++){let Q=$[J];if(Q==="{")X++,Y+=Q;else if(Q==="}")X--,Y+=Q;else if(Q===","&&X===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function bw($,Z,Y){let X=Number($)||0,J=bJ(Z),Q=`=${X}`;if(J[Q])return DJ(J[Q],X,Y);let G=Cw(X);if(J[G])return DJ(J[G],X,Y);if(J.other)return DJ(J.other,X,Y);return String(X)}function DJ($,Z,Y){let X=$.replace(/#/g,String(Z));return oU(X,Y)}function Cw($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function yw($,Z){let Y=String($||""),X=bJ(Z);if(X[Y])return X[Y];return X.other||String($)}function Pw($,Z){let Y=Number($)||0,X=bJ(Z),J=xw(Y);if(X[J])return X[J].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function xw($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function bJ($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function vw($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function fw($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function gw($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function aU($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function E8($,Z,Y=!0,X={}){let J=$.split("."),Q=Z;for(let K of J){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(aU(G))return rU(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),W=G.split("|");G=Ew(W,K)}for(let[K,W]of Object.entries(X)){let U=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${U}`,"g"),String(W))}return G}async function CJ($,Z,Y,X){let J=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...D8,...X.i18n},K=await sU(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,J=await cU(J,Q,async(B,_,z,q,j)=>{try{let H={};if(z)try{let F=[()=>JSON.parse(z),()=>{let L=`{"data":${z}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return y0(z,Z)}];for(let L of F)try{if(H=L(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return E8(_,K,G.fallbackToKey,H)||q.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return J0("Translate",`Error in @translate('${_}'): ${H instanceof Error?H.message:String(H)}`,e.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let B=[...J.matchAll(W)];console.warn(`Found ${B.length} @translate matches`),B.forEach((_,z)=>console.warn(`Match ${z}: ${_[0]}, Key: ${_[1]}, Params: ${_[2]||"none"}`))}return J=await cU(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(B,_,z,q)=>{try{let j={};if(z)try{let H=[()=>JSON.parse(z),()=>{let O=`{"data":${z}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return y0(z,Z)}];for(let O of H)try{if(j=O(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return E8(_,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return J0("Translate",`Error in @translate('${_}'): ${j instanceof Error?j.message:String(j)}`,e.EVALUATION_ERROR)}}),J}async function cU($,Z,Y){let X=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((W)=>({match:Q,replacement:W}));return X.push(K),Q}),(await Promise.all(X)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}function hw($,Z=!0){return(Y,X={})=>{return E8(Y,$,Z,X)}}var c4,D8,W1,y1,J$;var yJ=D(()=>{j1();h0();D8={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},W1={},y1={},J$={}});import*as PJ from"path";async function tU($,Z,Y=""){if(PJ.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return $B($,Z,Y,"@js","@endjs")}async function eU($,Z,Y=""){if(PJ.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return $B($,Z,Y,"@ts","@endts")}async function $B($,Z,Y,X,J){let Q=$,G=p5(`${X}([\\s\\S]*?)${J}`,"g"),K=[],W;while((W=G.exec($))!==null)K.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:U,content:B,index:_}of K)try{let z=Object.keys(Z),q=Object.values(Z),j=B.trim();if(X==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let O=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=O.length>0?`return { ${O.join(", ")} };`:"return {};",L=`
4051
4051
  ${j}
4052
4052
  ${F}
4053
- `,N=Function(...z,L)(...q);if(N&&typeof N==="object")Object.assign(Z,N);Q=Q.replace(U,"")}catch(z){console.error(`Error executing ${X} code block in ${Y}:`,z);let q=z instanceof Error?z.message:String(z),j=L0(`${X} Directive`,`Error executing code: ${q}`,Y,$,_,U);console.error(j),Q=Q.replace(U,"")}return Q}var ZB=D(()=>{U5();N0()});var WB={};Z0(WB,{processLoops:()=>C8});function mw($,Z){let Y=/@component\s*\(/g,X=$,J,Q=[];while((J=Y.exec(X))!==null){let G=J.index,K=G+J[0].length-1,W=1,U=K+1;while(U<X.length&&W>0){if(X[U]==="(")W++;else if(X[U]===")"){if(W--,W===0)break}U++}if(W!==0)continue;let B=X.substring(K+1,U),_=U+1,z=B.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let q=z[1],j=B.slice(z[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let O=j.slice(H[0].length).trim();if(!O)continue;try{let F=y0(O,Z),L=JSON.stringify(F),V=`@component('${q}', ${L})`;Q.push({start:G,end:_,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:U}=Q[G];X=X.substring(0,K)+U+X.substring(W)}return X}function k8($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,U=K+1,B=null,_=!1;while(U<X.length&&W>0){let j=X[U];if(_){_=!1,U++;continue}if(j==="\\"&&B){_=!0,U++;continue}if(B){if(j===B)B=null;U++;continue}if(j==='"'||j==="'"||j==="`"){B=j,U++;continue}if(j==="(")W++;else if(j===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=X.substring(K+1,U),q=Y(z);X=X.substring(0,G)+q+X.substring(U+1)}return X}function pw($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,J)=>{if(J in Z)return`:${J}="${J}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,J,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);_3(Q);let U=O0(Q,G)(...K),B=JSON.stringify(U),_=Buffer.from(B,"utf8").toString("base64");return`__stx_${J}="${_}"`}catch(G){return X}}),Y}function cw($,Z){let Y=$;return Y=k8(Y,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(H0(Q)){let K=O0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(z0(Q,Z));return G?S8:""}catch{return""}}),Y=k8(Y,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(H0(Q)){let K=O0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(z0(Q,Z));return G?b8:""}catch{return""}}),Y}function lw($){let Z=$;return Z=Z.replace(/@break(?!\()/g,S8),Z=Z.replace(/@continue(?!\()/g,b8),Z}function YB($){let Z=$.includes(S8),Y=Z?$.substring(0,$.indexOf(S8)):$;return{hasBreak:Z,content:Y}}function XB($){let Z=$.includes(b8),Y=Z?$.substring(0,$.indexOf(b8)):$;return{hasContinue:Z,content:Y}}function QB($){let Z=$;return Z=k8(Z,"@break",(Y)=>{let X=Y.trim();if(!z3(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=k8(Z,"@continue",(Y)=>{let X=Y.trim();if(!z3(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function iw($){let Z=/@forelse\s*\(/g,Y,X=[],J=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=J.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((B,_)=>B.pos-_.pos);let K=[],W=0;for(let B of X)W+=B.delta,K.push({pos:B.pos,depth:W});function U(B){let _=0,z=K.length-1,q=0;while(_<=z){let j=_+z>>1;if(K[j].pos<=B)q=K[j].depth,_=j+1;else z=j-1}return q}while((Y=Z.exec($))!==null){if(U(Y.index)>0)continue;let B=Y.index,_=Y.index+Y[0].length-1,z=1,q=_+1,j=-1;while(q<$.length&&z>0){if($[q]==="(")z++;else if($[q]===")"){if(z--,z===0){j=q;break}}q++}if(j===-1)continue;let H=$.substring(_+1,j),O=H.indexOf(" as ");if(O===-1)continue;let F=H.substring(0,O).trim(),L=H.substring(O+4).trim(),V=j+1,N=1,A=V,w=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(N>0&&A<$.length){w.lastIndex=A,R.lastIndex=A;let y=w.exec($),b=R.exec($);if(!b)break;if(y&&y.index<b.index)N++,A=y.index+y[0].length;else{if(N--,N===0){T=b.index;break}A=b.index+11}}if(T===-1)continue;let I=$.substring(V,T),E=T+11,k=-1,S=0,x=0;while(x<I.length){let y=I.indexOf("@",x);if(y===-1)break;let b=I.substring(y);if(/^@forelse\s*\(/.test(b))S++,x=y+1;else if(b.startsWith("@endforelse"))S--,x=y+11;else if(S===0&&b.startsWith("@empty")){if(I.length<=y+6||!/[a-z]/i.test(I[y+6])){k=y;break}x=y+1}else x=y+1}if(k===-1)continue;return{start:B,end:E,arrayExpr:F,itemVar:L,foreachContent:I.substring(0,k),emptyContent:I.substring(k+6)}}return null}function JB($,Z){let Y=$;while(!0){let X=iw(Y);if(!X)break;let{start:J,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:U}=X;try{let B;if(H0(G))B=O0(G,Object.keys(Z))(...Object.values(Z));else B=z0(G,Z);let _;if(!Array.isArray(B)||B.length===0)_=U;else _=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,J)+_+Y.substring(Q)}catch(B){let _=B instanceof Error?B.message:String(B),z=J0("Forelse",`Error in @forelse(${G} as ${K}): ${_}`,e.EVALUATION_ERROR);Y=Y.substring(0,J)+z+Y.substring(Q)}}return Y}function C8($,Z,Y,X){let J=$;J=JB(J,Z);function Q(W){let U=/@foreach\s*\(/g,B;while((B=U.exec(W))!==null){let _=B.index,z=B.index+B[0].length-1,q=1,j=z+1,H=-1;while(j<W.length&&q>0){if(W[j]==="(")q++;else if(W[j]===")"){if(q--,q===0){H=j;break}}j++}if(H===-1)continue;let O=W.substring(z+1,H),F=O.indexOf(" as ");if(F===-1)continue;let L=_,V=O.substring(0,F),N=O.substring(F+4),A=H+1,w=1,R=A,T=/@foreach\s*\(/g,I=/@endforeach/g;while(w>0&&R<W.length){T.lastIndex=R,I.lastIndex=R;let E=T.exec(W),k=I.exec(W);if(!k)break;if(E&&E.index<k.index)w++,R=E.index+E[0].length;else{if(w--,w===0){let S=W.substring(A,k.index),x=k.index+11;return{start:L,end:x,arrayExpr:V,itemVar:N,content:S}}R=k.index+11}}}return null}function G(W,U){let B=W;while(!0){let _=Q(B);if(!_)break;let{start:z,end:q,arrayExpr:j,itemVar:H,content:O}=_;try{let F=j.trim(),L;if(H0(F))L=O0(F,Object.keys(U))(...Object.values(U));else L=z0(F,U);let V=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),V=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),V=!0;else{let k=J0("Foreach",`Error in @foreach: ${F} is not iterable`,e.TYPE_ERROR);B=B.substring(0,z)+k+B.substring(q);continue}let N=X?.loops?.useAltLoopVariable??uw,A=H.trim(),w=null,R,T=!1;if(A.includes("=>")){let k=A.split("=>").map((S)=>S.trim());if(k.length===2&&k[0]&&k[1])w=k[0],R=k[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let k=A.split(",").map((S)=>S.trim());if(k.length===2&&k[0]&&k[1])R=k[0],w=k[1],T=!0;else R=A}else R=A;let I="",E=L;for(let k=0;k<E.length;k++){let S=E[k],x={index:k,iteration:k+1,first:k===0,last:k===E.length-1,count:E.length},y={...U,loop:x,$loop:x};if(R.startsWith("[")&&R.endsWith("]")){let u=R.slice(1,-1).split(",").map((C)=>C.trim());if(Array.isArray(S))u.forEach((C,h)=>{if(C)y[C]=S[h]});else y[R]=S}else y[R]=S;if(w)if(!T&&V&&Array.isArray(S)&&S.length===2)y[w]=S[0],y[R]=S[1];else y[w]=k;let b=cw(O,y),f=XB(b);if(f.hasContinue){I+=f.content;continue}let r=YB(b);if(r.hasBreak){I+=r.content;break}if(b=JB(b,y),b=G(b,y),b=Q5(b,y,Y),b=lw(b),r=YB(b),r.hasBreak){I+=r.content;break}if(f=XB(b),f.hasContinue){I+=f.content;continue}b=U1(b,y,Y),b=pw(b,y),b=mw(b,y),I+=b}B=B.substring(0,z)+I+B.substring(q)}catch(F){let L=J0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,e.EVALUATION_ERROR);B=B.substring(0,z)+L+B.substring(q)}}return B}J=G(J,Z),J=KB(J,Z,Y,X);let K=X?.loops?.maxWhileIterations??dw;return J=rw(J,Z,K),J}function GB($){return z3($)}function KB($,Z,Y,X){let J=$,Q=!0;while(Q){Q=!1;let G=J.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,U=P0(J,"(",")",W);if(U===-1)break;let B=J.slice(W+1,U),_=U+1,z=O4(J.slice(K),"for","endfor");if(z.length===0)break;let q=z[0].content,j=K+z[0].end;if(!GB(B)){let H=J0("For",`Unsafe expression in @for: ${B}`,e.UNSAFE_EXPRESSION);J=J.substring(0,K)+H+J.substring(j),Q=!0;continue}try{let H=nw(B),O=/@(?:for|foreach|if|unless)\s*\(/.test(q);if(H.length>0&&O){let w=sw({forExpr:B,content:q,iterVarNames:H,context:Z,filePath:Y,options:X});J=J.substring(0,K)+w+J.substring(j),Q=!0;continue}let F=Object.keys(Z),L=Object.values(Z),V=q.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(w,R)=>{return`\${${R}}`});V=QB(V);let A=Function(...F,`
4053
+ `,N=Function(...z,L)(...q);if(N&&typeof N==="object")Object.assign(Z,N);Q=Q.replace(U,"")}catch(z){console.error(`Error executing ${X} code block in ${Y}:`,z);let q=z instanceof Error?z.message:String(z),j=F0(`${X} Directive`,`Error executing code: ${q}`,Y,$,_,U);console.error(j),Q=Q.replace(U,"")}return Q}var ZB=D(()=>{U5();A0()});var WB={};Z0(WB,{processLoops:()=>C8});function mw($,Z){let Y=/@component\s*\(/g,X=$,J,Q=[];while((J=Y.exec(X))!==null){let G=J.index,K=G+J[0].length-1,W=1,U=K+1;while(U<X.length&&W>0){if(X[U]==="(")W++;else if(X[U]===")"){if(W--,W===0)break}U++}if(W!==0)continue;let B=X.substring(K+1,U),_=U+1,z=B.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let q=z[1],j=B.slice(z[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let O=j.slice(H[0].length).trim();if(!O)continue;try{let F=y0(O,Z),L=JSON.stringify(F),V=`@component('${q}', ${L})`;Q.push({start:G,end:_,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:U}=Q[G];X=X.substring(0,K)+U+X.substring(W)}return X}function k8($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,W=1,U=K+1,B=null,_=!1;while(U<X.length&&W>0){let j=X[U];if(_){_=!1,U++;continue}if(j==="\\"&&B){_=!0,U++;continue}if(B){if(j===B)B=null;U++;continue}if(j==='"'||j==="'"||j==="`"){B=j,U++;continue}if(j==="(")W++;else if(j===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=X.substring(K+1,U),q=Y(z);X=X.substring(0,G)+q+X.substring(U+1)}return X}function pw($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,J)=>{if(J in Z)return`:${J}="${J}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,J,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);_3(Q);let U=L0(Q,G)(...K),B=JSON.stringify(U),_=Buffer.from(B,"utf8").toString("base64");return`__stx_${J}="${_}"`}catch(G){return X}}),Y}function cw($,Z){let Y=$;return Y=k8(Y,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(O0(Q)){let K=L0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(z0(Q,Z));return G?S8:""}catch{return""}}),Y=k8(Y,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(O0(Q)){let K=L0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(z0(Q,Z));return G?b8:""}catch{return""}}),Y}function lw($){let Z=$;return Z=Z.replace(/@break(?!\()/g,S8),Z=Z.replace(/@continue(?!\()/g,b8),Z}function YB($){let Z=$.includes(S8),Y=Z?$.substring(0,$.indexOf(S8)):$;return{hasBreak:Z,content:Y}}function XB($){let Z=$.includes(b8),Y=Z?$.substring(0,$.indexOf(b8)):$;return{hasContinue:Z,content:Y}}function QB($){let Z=$;return Z=k8(Z,"@break",(Y)=>{let X=Y.trim();if(!z3(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=k8(Z,"@continue",(Y)=>{let X=Y.trim();if(!z3(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function iw($){let Z=/@forelse\s*\(/g,Y,X=[],J=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=J.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((B,_)=>B.pos-_.pos);let K=[],W=0;for(let B of X)W+=B.delta,K.push({pos:B.pos,depth:W});function U(B){let _=0,z=K.length-1,q=0;while(_<=z){let j=_+z>>1;if(K[j].pos<=B)q=K[j].depth,_=j+1;else z=j-1}return q}while((Y=Z.exec($))!==null){if(U(Y.index)>0)continue;let B=Y.index,_=Y.index+Y[0].length-1,z=1,q=_+1,j=-1;while(q<$.length&&z>0){if($[q]==="(")z++;else if($[q]===")"){if(z--,z===0){j=q;break}}q++}if(j===-1)continue;let H=$.substring(_+1,j),O=H.indexOf(" as ");if(O===-1)continue;let F=H.substring(0,O).trim(),L=H.substring(O+4).trim(),V=j+1,N=1,A=V,w=/@forelse\s*\(/g,R=/@endforelse/g,T=-1;while(N>0&&A<$.length){w.lastIndex=A,R.lastIndex=A;let y=w.exec($),b=R.exec($);if(!b)break;if(y&&y.index<b.index)N++,A=y.index+y[0].length;else{if(N--,N===0){T=b.index;break}A=b.index+11}}if(T===-1)continue;let I=$.substring(V,T),E=T+11,k=-1,S=0,x=0;while(x<I.length){let y=I.indexOf("@",x);if(y===-1)break;let b=I.substring(y);if(/^@forelse\s*\(/.test(b))S++,x=y+1;else if(b.startsWith("@endforelse"))S--,x=y+11;else if(S===0&&b.startsWith("@empty")){if(I.length<=y+6||!/[a-z]/i.test(I[y+6])){k=y;break}x=y+1}else x=y+1}if(k===-1)continue;return{start:B,end:E,arrayExpr:F,itemVar:L,foreachContent:I.substring(0,k),emptyContent:I.substring(k+6)}}return null}function JB($,Z){let Y=$;while(!0){let X=iw(Y);if(!X)break;let{start:J,end:Q,arrayExpr:G,itemVar:K,foreachContent:W,emptyContent:U}=X;try{let B;if(O0(G))B=L0(G,Object.keys(Z))(...Object.values(Z));else B=z0(G,Z);let _;if(!Array.isArray(B)||B.length===0)_=U;else _=`@foreach (${G} as ${K})${W}@endforeach`;Y=Y.substring(0,J)+_+Y.substring(Q)}catch(B){let _=B instanceof Error?B.message:String(B),z=J0("Forelse",`Error in @forelse(${G} as ${K}): ${_}`,e.EVALUATION_ERROR);Y=Y.substring(0,J)+z+Y.substring(Q)}}return Y}function C8($,Z,Y,X){let J=$;J=JB(J,Z);function Q(W){let U=/@foreach\s*\(/g,B;while((B=U.exec(W))!==null){let _=B.index,z=B.index+B[0].length-1,q=1,j=z+1,H=-1;while(j<W.length&&q>0){if(W[j]==="(")q++;else if(W[j]===")"){if(q--,q===0){H=j;break}}j++}if(H===-1)continue;let O=W.substring(z+1,H),F=O.indexOf(" as ");if(F===-1)continue;let L=_,V=O.substring(0,F),N=O.substring(F+4),A=H+1,w=1,R=A,T=/@foreach\s*\(/g,I=/@endforeach/g;while(w>0&&R<W.length){T.lastIndex=R,I.lastIndex=R;let E=T.exec(W),k=I.exec(W);if(!k)break;if(E&&E.index<k.index)w++,R=E.index+E[0].length;else{if(w--,w===0){let S=W.substring(A,k.index),x=k.index+11;return{start:L,end:x,arrayExpr:V,itemVar:N,content:S}}R=k.index+11}}}return null}function G(W,U){let B=W;while(!0){let _=Q(B);if(!_)break;let{start:z,end:q,arrayExpr:j,itemVar:H,content:O}=_;try{let F=j.trim(),L;if(O0(F))L=L0(F,Object.keys(U))(...Object.values(U));else L=z0(F,U);let V=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),V=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),V=!0;else{let k=J0("Foreach",`Error in @foreach: ${F} is not iterable`,e.TYPE_ERROR);B=B.substring(0,z)+k+B.substring(q);continue}let N=X?.loops?.useAltLoopVariable??uw,A=H.trim(),w=null,R,T=!1;if(A.includes("=>")){let k=A.split("=>").map((S)=>S.trim());if(k.length===2&&k[0]&&k[1])w=k[0],R=k[1];else R=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let k=A.split(",").map((S)=>S.trim());if(k.length===2&&k[0]&&k[1])R=k[0],w=k[1],T=!0;else R=A}else R=A;let I="",E=L;for(let k=0;k<E.length;k++){let S=E[k],x={index:k,iteration:k+1,first:k===0,last:k===E.length-1,count:E.length},y={...U,loop:x,$loop:x};if(R.startsWith("[")&&R.endsWith("]")){let u=R.slice(1,-1).split(",").map((C)=>C.trim());if(Array.isArray(S))u.forEach((C,h)=>{if(C)y[C]=S[h]});else y[R]=S}else y[R]=S;if(w)if(!T&&V&&Array.isArray(S)&&S.length===2)y[w]=S[0],y[R]=S[1];else y[w]=k;let b=cw(O,y),f=XB(b);if(f.hasContinue){I+=f.content;continue}let r=YB(b);if(r.hasBreak){I+=r.content;break}if(b=JB(b,y),b=G(b,y),b=Q5(b,y,Y),b=lw(b),r=YB(b),r.hasBreak){I+=r.content;break}if(f=XB(b),f.hasContinue){I+=f.content;continue}b=U1(b,y,Y),b=pw(b,y),b=mw(b,y),I+=b}B=B.substring(0,z)+I+B.substring(q)}catch(F){let L=J0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,e.EVALUATION_ERROR);B=B.substring(0,z)+L+B.substring(q)}}return B}J=G(J,Z),J=KB(J,Z,Y,X);let K=X?.loops?.maxWhileIterations??dw;return J=rw(J,Z,K),J}function GB($){return z3($)}function KB($,Z,Y,X){let J=$,Q=!0;while(Q){Q=!1;let G=J.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,W=K+G[0].length-1,U=P0(J,"(",")",W);if(U===-1)break;let B=J.slice(W+1,U),_=U+1,z=O4(J.slice(K),"for","endfor");if(z.length===0)break;let q=z[0].content,j=K+z[0].end;if(!GB(B)){let H=J0("For",`Unsafe expression in @for: ${B}`,e.UNSAFE_EXPRESSION);J=J.substring(0,K)+H+J.substring(j),Q=!0;continue}try{let H=nw(B),O=/@(?:for|foreach|if|unless)\s*\(/.test(q);if(H.length>0&&O){let w=sw({forExpr:B,content:q,iterVarNames:H,context:Z,filePath:Y,options:X});J=J.substring(0,K)+w+J.substring(j),Q=!0;continue}let F=Object.keys(Z),L=Object.values(Z),V=q.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(w,R)=>{return`\${${R}}`});V=QB(V);let A=Function(...F,`
4054
4054
  let result = '';
4055
4055
  for (${B}) {
4056
4056
  result += \`${V}\`;
@@ -4072,9 +4072,9 @@ catch { return 'Please enter a valid URL'; } },
4072
4072
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
4073
4073
  }
4074
4074
  return result;
4075
- `)(...j);X=X.substring(0,G)+F+X.substring(z),J=!0}catch(q){let j=J0("While",`Error in @while(${U}): ${q instanceof Error?q.message:String(q)}`,e.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(z),J=!0}}return X}var dw=1000,uw=!1,S8="<!--__STX_BREAK__-->",b8="<!--__STX_CONTINUE__-->";var y8=D(()=>{R3();j1();n0();L4();h0()});function ow($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function UB($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,J,Q)=>{return ow(X,Q||"_method")})}async function xJ($,Z,Y,X,J){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((K)=>K.timing===J);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,Y,X);if(typeof W==="string")Q=W;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(X.debug)console.error(`Error in middleware ${K.name}:`,W);if(X.debug){let U=L0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
4075
+ `)(...j);X=X.substring(0,G)+F+X.substring(z),J=!0}catch(q){let j=J0("While",`Error in @while(${U}): ${q instanceof Error?q.message:String(q)}`,e.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(z),J=!0}}return X}var dw=1000,uw=!1,S8="<!--__STX_BREAK__-->",b8="<!--__STX_CONTINUE__-->";var y8=D(()=>{R3();j1();n0();L4();h0()});function ow($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function UB($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,J,Q)=>{return ow(X,Q||"_method")})}async function xJ($,Z,Y,X,J){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((K)=>K.timing===J);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let W=await K.handler(Q,Z,Y,X);if(typeof W==="string")Q=W;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(W){if(X.debug)console.error(`Error in middleware ${K.name}:`,W);if(X.debug){let U=F0("Middleware",`Error in middleware '${K.name}': ${W instanceof Error?W.message:String(W)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
4076
4076
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${E0(U)}</div>
4077
- `)}}}return Q}async function vJ($,Z,Y,X){return xJ($,Z,Y,X,"before")}async function fJ($,Z,Y,X){return xJ($,Z,Y,X,"after")}var gJ=D(()=>{n0();N0()});import{defineRoute as ux,defineRoutes as mx,resetRoutes as px,route as cx,setAppUrl as lx}from"stx-router";import{route as aw}from"stx-router";function BB($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,J,Q)=>{try{let G=J?y0(J,{}):{};return aw(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var _B=D(()=>{h0()});async function zB($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(i4.exact[$])for(let X of i4.exact[$])await Promise.resolve(X(Z,$));if(i4.exact[Y])for(let X of i4.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:J}of i4.patterns)if(X.test($)||X.test(Y))await Promise.resolve(J(Z,$))}var i4;var qB=D(()=>{i4={patterns:[],exact:{}}});function jB($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>jB(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function P8($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],Q;while((Q=X.exec($))!==null)J.push([Q.index,Q.index+Q[0].length]);function G(U){return J.some(([B,_])=>U>=B&&U<_)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let U=Q[0],B=Q[2];if(!B||!B.includes(":"))continue;let _=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,z,q=B,j=!1;while((z=_.exec(B))!==null){let H=z[1],O=z[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let F=Object.keys(Z),L=Object.values(Z),V=O.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let A=Function(...F,`return (${O})`)(...L);if(H==="class"){let w=jB(A);if(w){let R=q.match(/\sclass="([^"]*)"/);if(R)q=q.replace(R[0],` class="${R[1]} ${w}"`);else q=q.replace(z[0],` class="${w}"`)}else q=q.replace(z[0],"");j=!0;continue}if(tw.has(H)){if(A)q=q.replace(z[0],` ${H}`);else q=q.replace(z[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)q=q.replace(z[0],"");else{let w=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");q=q.replace(z[0],` ${H}="${w}"`)}j=!0}catch{continue}}if(j){let H=U.endsWith("/>")?" /":"",F=`<${Q[1]}${q}${H}>`;W.push({start:Q.index,end:Q.index+U.length,replacement:F})}}for(let U=W.length-1;U>=0;U--){let{start:B,end:_,replacement:z}=W[U];Y=Y.slice(0,B)+z+Y.slice(_)}return Y}var tw;var hJ=D(()=>{tw=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function z5($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||ew.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function ZR($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)X++,J=K.index+K[0].length;else{if(X--,X===0)return W.index+W[0].length;J=W.index+W[0].length}}return-1}function p1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=ZR($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function HB($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function V7($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function f$($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function g$($,Z,Y){let X=Z.selfClosing?" /":"",J=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+J+$.slice(Z.end)}function OB($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function YR($){let Z=$,Y=0;while(Y<Z.length){let X=z5(Z,Y);if(!X)break;let J=V7(X.attrs,"v-for");if(J===null){Y=X.end;continue}let Q=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=X.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let O=G.split(",").map((V)=>V.trim()),F=O[0],L=O[1];W=`${K} as ${L} => ${F}`}else W=`${K} as ${G}`;let U=f$(X.attrs,"v-for"),B=f$(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),_=p1(Z,X),z=Z.slice(_.outerStart,_.outerEnd),q=g$(z,{...X,start:0,end:X.end-X.start},B),j=`@foreach(${W})
4077
+ `)}}}return Q}async function vJ($,Z,Y,X){return xJ($,Z,Y,X,"before")}async function fJ($,Z,Y,X){return xJ($,Z,Y,X,"after")}var gJ=D(()=>{n0();A0()});import{defineRoute as ux,defineRoutes as mx,resetRoutes as px,route as cx,setAppUrl as lx}from"stx-router";import{route as aw}from"stx-router";function BB($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,J,Q)=>{try{let G=J?y0(J,{}):{};return aw(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var _B=D(()=>{h0()});async function zB($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(i4.exact[$])for(let X of i4.exact[$])await Promise.resolve(X(Z,$));if(i4.exact[Y])for(let X of i4.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:J}of i4.patterns)if(X.test($)||X.test(Y))await Promise.resolve(J(Z,$))}var i4;var qB=D(()=>{i4={patterns:[],exact:{}}});function jB($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>jB(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function P8($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],Q;while((Q=X.exec($))!==null)J.push([Q.index,Q.index+Q[0].length]);function G(U){return J.some(([B,_])=>U>=B&&U<_)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,W=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let U=Q[0],B=Q[2];if(!B||!B.includes(":"))continue;let _=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,z,q=B,j=!1;while((z=_.exec(B))!==null){let H=z[1],O=z[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let F=Object.keys(Z),L=Object.values(Z),V=O.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let A=Function(...F,`return (${O})`)(...L);if(H==="class"){let w=jB(A);if(w){let R=q.match(/\sclass="([^"]*)"/);if(R)q=q.replace(R[0],` class="${R[1]} ${w}"`);else q=q.replace(z[0],` class="${w}"`)}else q=q.replace(z[0],"");j=!0;continue}if(tw.has(H)){if(A)q=q.replace(z[0],` ${H}`);else q=q.replace(z[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)q=q.replace(z[0],"");else{let w=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");q=q.replace(z[0],` ${H}="${w}"`)}j=!0}catch{continue}}if(j){let H=U.endsWith("/>")?" /":"",F=`<${Q[1]}${q}${H}>`;W.push({start:Q.index,end:Q.index+U.length,replacement:F})}}for(let U=W.length-1;U>=0;U--){let{start:B,end:_,replacement:z}=W[U];Y=Y.slice(0,B)+z+Y.slice(_)}return Y}var tw;var hJ=D(()=>{tw=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function z5($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;return{full:X[0],tag:X[1],attrs:X[2],selfClosing:X[3].includes("/")||ew.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function ZR($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J;let K=Q.exec($),W=G.exec($);if(!W)return-1;if(K&&K.index<W.index)X++,J=K.index+K[0].length;else{if(X--,X===0)return W.index+W[0].length;J=W.index+W[0].length}}return-1}function p1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=ZR($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function HB($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function V7($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function f$($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function g$($,Z,Y){let X=Z.selfClosing?" /":"",J=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+J+$.slice(Z.end)}function OB($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function YR($){let Z=$,Y=0;while(Y<Z.length){let X=z5(Z,Y);if(!X)break;let J=V7(X.attrs,"v-for");if(J===null){Y=X.end;continue}let Q=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=X.end;continue}let G=Q[1].trim(),K=Q[2].trim(),W;if(G.includes(",")){let O=G.split(",").map((V)=>V.trim()),F=O[0],L=O[1];W=`${K} as ${L} => ${F}`}else W=`${K} as ${G}`;let U=f$(X.attrs,"v-for"),B=f$(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),_=p1(Z,X),z=Z.slice(_.outerStart,_.outerEnd),q=g$(z,{...X,start:0,end:X.end-X.start},B),j=`@foreach(${W})
4078
4078
  `,H=`${j}${q}
4079
4079
  @endforeach`;Z=Z.slice(0,_.outerStart)+H+Z.slice(_.outerEnd),Y=_.outerStart+j.length}return Z}function XR($){let Z=$,Y=0;while(Y<Z.length){let X=z5(Z,Y);if(!X)break;let J=V7(X.attrs,"v-if");if(J===null){Y=X.end;continue}let Q=[],G=p1(Z,X),K=f$(X.attrs,"v-if"),W=g$(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);Q.push({type:"if",expr:J,outerStart:G.outerStart,outerEnd:G.outerEnd,element:W,parsedTag:X});let U=G.outerEnd,B=!0;while(B){let H=Z.slice(U).match(/^\s*/),O=H?H[0].length:0,F=z5(Z,U+O);if(!F){B=!1;break}let L=V7(F.attrs,"v-else-if"),V=HB(F.attrs,"v-else");if(L!==null){let N=p1(Z,F),A=f$(F.attrs,"v-else-if"),w=g$(Z.slice(N.outerStart,N.outerEnd),{...F,start:0,end:F.end-F.start},A);Q.push({type:"else-if",expr:L,outerStart:U,outerEnd:N.outerEnd,element:w,parsedTag:F}),U=N.outerEnd}else if(V){let N=p1(Z,F),A=f$(F.attrs,"v-else"),w=g$(Z.slice(N.outerStart,N.outerEnd),{...F,start:0,end:F.end-F.start},A);Q.push({type:"else",outerStart:U,outerEnd:N.outerEnd,element:w,parsedTag:F}),B=!1}else B=!1}let _=[];for(let H of Q)if(H.type==="if")_.push(`@if(${H.expr})
4080
4080
  ${H.element}`);else if(H.type==="else-if")_.push(`@elseif(${H.expr})
@@ -4082,7 +4082,7 @@ ${H.element}`);else _.push(`@else
4082
4082
  ${H.element}`);_.push("@endif");let z=_.join(`
4083
4083
  `),q=Q[0].outerStart,j=Q[Q.length-1].outerEnd;Z=Z.slice(0,q)+z+Z.slice(j),Y=q+z.length}return Z}function JR($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function QR($){let Z=$,Y=0;while(Y<Z.length){let X=z5(Z,Y);if(!X)break;let J=X.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=J.match(G);while(K){Q=!0;let B=K[1],_=K[2],z=K[3];J=J.replace(K[0],""),J+=` :${B}="${z}" @update:${B}="${z} = $event"`,K=J.match(G)}if(Q){let B=p1(Z,X),_=Z.slice(B.outerStart,B.outerEnd),z=g$(_,{...X,start:0,end:X.end-X.start},J);Z=Z.slice(0,B.outerStart)+z+Z.slice(B.outerEnd),Y=B.outerStart+z.length;continue}let W=V7(X.attrs,"v-model");if(W===null){Y=X.end;continue}if($R.has(X.tag.toLowerCase())){let B=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,_=p1(Z,X),z=Z.slice(_.outerStart,_.outerEnd),q=g$(z,{...X,start:0,end:X.end-X.start},B);Z=Z.slice(0,_.outerStart)+q+Z.slice(_.outerEnd),Y=_.outerStart+q.length}else{let B=X.attrs.replace(/\s*v-model="[^"]*"/g,"");B+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let _=p1(Z,X),z=Z.slice(_.outerStart,_.outerEnd),q=g$(z,{...X,start:0,end:X.end-X.start},B);Z=Z.slice(0,_.outerStart)+q+Z.slice(_.outerEnd),Y=_.outerStart+q.length}}return Z}function GR($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function KR($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function WR($){let Z=$,Y=0;while(Y<Z.length){let X=z5(Z,Y);if(!X)break;let J=V7(X.attrs,"v-html");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=p1(Z,X),G=f$(X.attrs,"v-html"),K=X.selfClosing?" /":"",W=`<${X.tag}${G}${K}>{!! ${J} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function UR($){let Z=$,Y=0;while(Y<Z.length){let X=z5(Z,Y);if(!X)break;let J=V7(X.attrs,"v-text");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=p1(Z,X),G=f$(X.attrs,"v-text"),K=X.selfClosing?" /":"",W=`<${X.tag}${G}${K}>{{ ${J} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function BR($){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 _R($){let Z=$,Y=0;while(Y<Z.length){let X=z5(Z,Y);if(!X)break;if(!HB(X.attrs,"v-once")){Y=X.end;continue}let J=f$(X.attrs,"v-once"),Q=p1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),W=`@once
4084
4084
  ${g$(G,{...X,start:0,end:X.end-X.start},J)}
4085
- @endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function zR($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function qR($){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 dJ($){if(!OB($))return $;let Z=$;return Z=YR(Z),Z=XR(Z),Z=_R(Z),Z=GR(Z),Z=KR(Z),Z=QR(Z),Z=JR(Z),Z=qR(Z),Z=WR(Z),Z=UR(Z),Z=BR(Z),Z=zR(Z),Z}var ew,$R;var uJ=D(()=>{ew=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),$R=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 x8($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function mJ($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let U=K.length-1;U>=0;U--){let B=K[U];try{let _=z0(B.expr,Z);if(!_||typeof _!=="string"){let L=`<!-- dynamic component: could not resolve "${x8(B.expr)}" -->`;Q=Q.slice(0,B.index)+L+Q.slice(B.index+B.full.length);continue}let z=B.attrs.trim(),q={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(z))!==null){let L=H[1]||H[2],V=H[3];if(H[1])try{q[L]=z0(V,Z)}catch{q[L]=V}else q[L]=V}let O=X.componentsDir||"components",F=await c1(_,q,B.slotContent,O,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,B.index)+F+Q.slice(B.index+B.full.length)}catch(_){let z=_ instanceof Error?_.message:String(_),q=`<!-- dynamic component error: ${x8(z)} -->`;Q=Q.slice(0,B.index)+q+Q.slice(B.index+B.full.length)}}return Q=await jR(Q,Z,Y,X,J),Q}async function jR($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let U=K.length-1;U>=0;U--){let B=K[U];try{let _=z0(B.expr,Z);if(!_||typeof _!=="string"){let j=`<!-- dynamic component: could not resolve "${x8(B.expr)}" -->`;Q=Q.slice(0,B.index)+j+Q.slice(B.index+B.full.length);continue}let z=X.componentsDir||"components",q=await c1(_,{},"",z,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,B.index)+q+Q.slice(B.index+B.full.length)}catch(_){let z=_ instanceof Error?_.message:String(_),q=`<!-- dynamic component error: ${x8(z)} -->`;Q=Q.slice(0,B.index)+q+Q.slice(B.index+B.full.length)}}return Q}var pJ=D(()=>{N0();h0()});function LB($,Z=""){let Y=`${$}${Z}`,X=0;for(let J=0;J<Y.length;J++){let Q=Y.charCodeAt(J);X=(X<<5)-X+Q,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function FB($,Z,Y={}){let{prefix:X="",preserveHost:J=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=cJ($),W=[],U=new Map;if(Q)for(let B of K){let _=B.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(_){let z=_[1],q=`${Z}_${z}`;U.set(z,q)}}for(let B of K){let _=VB(B,Z,X,J,U,G);W.push(_)}return W.join(`
4085
+ @endonce`;Z=Z.slice(0,Q.outerStart)+W+Z.slice(Q.outerEnd),Y=Q.outerStart+W.length}return Z}function zR($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function qR($){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 dJ($){if(!OB($))return $;let Z=$;return Z=YR(Z),Z=XR(Z),Z=_R(Z),Z=GR(Z),Z=KR(Z),Z=QR(Z),Z=JR(Z),Z=qR(Z),Z=WR(Z),Z=UR(Z),Z=BR(Z),Z=zR(Z),Z}var ew,$R;var uJ=D(()=>{ew=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),$R=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 x8($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function mJ($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let U=K.length-1;U>=0;U--){let B=K[U];try{let _=z0(B.expr,Z);if(!_||typeof _!=="string"){let L=`<!-- dynamic component: could not resolve "${x8(B.expr)}" -->`;Q=Q.slice(0,B.index)+L+Q.slice(B.index+B.full.length);continue}let z=B.attrs.trim(),q={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(z))!==null){let L=H[1]||H[2],V=H[3];if(H[1])try{q[L]=z0(V,Z)}catch{q[L]=V}else q[L]=V}let O=X.componentsDir||"components",F=await c1(_,q,B.slotContent,O,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,B.index)+F+Q.slice(B.index+B.full.length)}catch(_){let z=_ instanceof Error?_.message:String(_),q=`<!-- dynamic component error: ${x8(z)} -->`;Q=Q.slice(0,B.index)+q+Q.slice(B.index+B.full.length)}}return Q=await jR(Q,Z,Y,X,J),Q}async function jR($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],W;while((W=G.exec(Q))!==null)K.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let U=K.length-1;U>=0;U--){let B=K[U];try{let _=z0(B.expr,Z);if(!_||typeof _!=="string"){let j=`<!-- dynamic component: could not resolve "${x8(B.expr)}" -->`;Q=Q.slice(0,B.index)+j+Q.slice(B.index+B.full.length);continue}let z=X.componentsDir||"components",q=await c1(_,{},"",z,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,B.index)+q+Q.slice(B.index+B.full.length)}catch(_){let z=_ instanceof Error?_.message:String(_),q=`<!-- dynamic component error: ${x8(z)} -->`;Q=Q.slice(0,B.index)+q+Q.slice(B.index+B.full.length)}}return Q}var pJ=D(()=>{A0();h0()});function LB($,Z=""){let Y=`${$}${Z}`,X=0;for(let J=0;J<Y.length;J++){let Q=Y.charCodeAt(J);X=(X<<5)-X+Q,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function FB($,Z,Y={}){let{prefix:X="",preserveHost:J=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=cJ($),W=[],U=new Map;if(Q)for(let B of K){let _=B.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(_){let z=_[1],q=`${Z}_${z}`;U.set(z,q)}}for(let B of K){let _=VB(B,Z,X,J,U,G);W.push(_)}return W.join(`
4086
4086
 
4087
4087
  `)}function cJ($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,J="",Q=!1,G="";for(let K=0;K<Y.length;K++){let W=Y[K];if(W==="@"&&X===0)Q=!0;if(W==="{")X++;else if(W==="}"){if(X--,X===0){if(Q){G+=W;let U=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(U){let[,B,_,z]=U;if(B==="keyframes")Z.push({selector:`@keyframes ${_.trim()}`,declarations:z.trim()});else if(B==="media"||B==="supports"||B==="container"){let q=cJ(z);Z.push({selector:`@${B} ${_.trim()}`,declarations:q.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
4088
4088
  `)})}else Z.push({selector:`@${B} ${_.trim()}`,declarations:z.trim()})}G="",Q=!1}else if(J.trim()){J+=W;let U=J.match(/([^{]+)\{([^}]*)\}/);if(U)Z.push({selector:U[1].trim(),declarations:U[2].trim()});J=""}continue}}if(Q)G+=W;else J+=W}return Z}function VB($,Z,Y,X,J,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let B=G.replace("@keyframes ","").trim();return`@keyframes ${J.get(B)||B} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let _=cJ(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((z)=>VB(z,Z,Y,X,J,Q)).join(`
@@ -9325,7 +9325,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
9325
9325
  }
9326
9326
  }
9327
9327
  })();
9328
- `}var wR;var c8=D(()=>{nJ();nJ();wR={state:o4,derived:a4,effect:t4,batch:d8,onMount:u8,onDestroy:m8,isSignal:e4,isDerived:$6,untrack:p8,peek:Z6,generateSignalsRuntime:Y6,generateSignalsRuntimeDev:q5}});var w7={};Z0(w7,{templateCache:()=>sJ,readFileCached:()=>RB,invalidateFileCacheByDir:()=>TB,invalidateFileCache:()=>MB,hashFilePath:()=>A7,getCachedSignalsRuntime:()=>DB,getCachedRouterScript:()=>kB,clearDevCaches:()=>SB,checkCache:()=>n8,cacheTemplate:()=>s8,__setSignalsGeneratorsForTest:()=>EB});import h$ from"fs";import N7 from"path";async function RB($){let Y;for(let X=0;X<3;X++)try{let Q=(await h$.promises.stat($)).mtime.getTime(),G=j5.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),U=(await h$.promises.stat($)).mtime.getTime();if(U!==Q)continue;return j5.set($,{content:K,mtime:U}),K}catch(J){Y=J;break}throw j5.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function MB($){j5.delete($)}function TB($){for(let Z of j5.keys())if(Z.startsWith($))j5.delete(Z)}function EB($){IB=$}async function DB($=!1){let Z=IB??await Promise.resolve().then(() => (c8(),wB));if($)return Z.generateSignalsRuntimeDev();if(l8===null)l8=Z.generateSignalsRuntime();return l8}async function kB(){if(i8===null){let{getRouterScript:$}=await import("stx-router");i8=$()}return i8}function SB(){j5.clear(),l8=null,RR=null,i8=null}function bB($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function n8($,Z){try{if(!Z.cachePath)return null;let Y=N7.resolve(Z.cachePath),X=N7.join(Y,`${A7($)}.html`),J=N7.join(Y,`${A7($)}.meta.json`);if(!await t(X)||!await t(J))return null;let Q=await Bun.file(J).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==bB(Z))return null;if((await h$.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await t(W)){if((await h$.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function s8($,Z,Y,X){try{if(!X.cachePath)return;let J=N7.resolve(X.cachePath);await h$.promises.mkdir(J,{recursive:!0});let Q=N7.join(J,`${A7($)}.html`),G=N7.join(J,`${A7($)}.meta.json`),K=await h$.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:bB(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),sJ.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(J){console.warn(`Failed to cache template ${$}:`,J)}}function A7($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,MR)}var sJ,j5,l8=null,RR=null,IB=null,i8=null,MR=16;var H5=D(()=>{N0();sJ=new Map,j5=new Map});function CB($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
9328
+ `}var wR;var c8=D(()=>{nJ();nJ();wR={state:o4,derived:a4,effect:t4,batch:d8,onMount:u8,onDestroy:m8,isSignal:e4,isDerived:$6,untrack:p8,peek:Z6,generateSignalsRuntime:Y6,generateSignalsRuntimeDev:q5}});var w7={};Z0(w7,{templateCache:()=>sJ,readFileCached:()=>RB,invalidateFileCacheByDir:()=>TB,invalidateFileCache:()=>MB,hashFilePath:()=>A7,getCachedSignalsRuntime:()=>DB,getCachedRouterScript:()=>kB,clearDevCaches:()=>SB,checkCache:()=>n8,cacheTemplate:()=>s8,__setSignalsGeneratorsForTest:()=>EB});import h$ from"fs";import N7 from"path";async function RB($){let Y;for(let X=0;X<3;X++)try{let Q=(await h$.promises.stat($)).mtime.getTime(),G=j5.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),U=(await h$.promises.stat($)).mtime.getTime();if(U!==Q)continue;return j5.set($,{content:K,mtime:U}),K}catch(J){Y=J;break}throw j5.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function MB($){j5.delete($)}function TB($){for(let Z of j5.keys())if(Z.startsWith($))j5.delete(Z)}function EB($){IB=$}async function DB($=!1){let Z=IB??await Promise.resolve().then(() => (c8(),wB));if($)return Z.generateSignalsRuntimeDev();if(l8===null)l8=Z.generateSignalsRuntime();return l8}async function kB(){if(i8===null){let{getRouterScript:$}=await import("stx-router");i8=$()}return i8}function SB(){j5.clear(),l8=null,RR=null,i8=null}function bB($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function n8($,Z){try{if(!Z.cachePath)return null;let Y=N7.resolve(Z.cachePath),X=N7.join(Y,`${A7($)}.html`),J=N7.join(Y,`${A7($)}.meta.json`);if(!await t(X)||!await t(J))return null;let Q=await Bun.file(J).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==bB(Z))return null;if((await h$.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let W of G.dependencies)if(await t(W)){if((await h$.promises.stat(W)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function s8($,Z,Y,X){try{if(!X.cachePath)return;let J=N7.resolve(X.cachePath);await h$.promises.mkdir(J,{recursive:!0});let Q=N7.join(J,`${A7($)}.html`),G=N7.join(J,`${A7($)}.meta.json`),K=await h$.promises.stat($);await Bun.write(Q,Z);let W={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:bB(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(W,null,2)),sJ.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(J){console.warn(`Failed to cache template ${$}:`,J)}}function A7($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,MR)}var sJ,j5,l8=null,RR=null,IB=null,i8=null,MR=16;var H5=D(()=>{A0();sJ=new Map,j5=new Map});function CB($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
9329
9329
  `;let J=/\{\{([\s\S]*?)\}\}/g;while((X=J.exec($))!==null)Y+=X[1]+`
9330
9330
  `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((z)=>{return new RegExp(`\\b${z}\\b`).test(Y)}),K=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"]),W=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,U,B=!1;while((U=W.exec(Y))!==null)if(!K.has(U[1])){B=!0;break}if(!G&&!B)return $;let _=`<script type="module">
9331
9331
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
@@ -9362,7 +9362,7 @@ if(window.stx)window.stx._latestSetup=${G};
9362
9362
  `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},q=()=>{if(J!==0)return;let j=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let N=V.trim();if(!N)return;let A=N.indexOf(":"),R=(A>=0?N.slice(A+1).trim():N).split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((V)=>{let N=V.trim().replace(/^\.\.\./,"");if(!N)return;let A=N.split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let F=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let L=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!X.has(V))Y.push(V),X.add(V)}};while(Q<G){if(z())continue;if(Z[Q]==="'"||Z[Q]==='"'){B(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){_(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&U()){W(),K="/";continue}if(Z[Q]==="{"){J++,K="{",Q++;continue}if(Z[Q]==="}"){J--,K="}",Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))q();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function eJ($,Z,Y,X){if(!a8($))return $;let J=$;if(Z.skipSignalsRuntime)return J;let{output:Q,setupCode:G}=await dB(J,Y,X);if(J=Q,J=await yB(J,Z),J=CB(J),G)if(J.includes("</head>"))J=J.replace("</head>",`${G}
9363
9363
  </head>`);else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
9364
9364
  ${G}`);else J=J+`
9365
- `+G;let W=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),U=W&&/data-stx/.test(W[1]);if(!G&&!U&&W&&!/data-stx-auto/.test(W[1])){let B=/<body[^>]*>/i,_=/<(script|style)\b[\s\S]*?<\/\1>/gi,z=[],q;while((q=_.exec(J))!==null)z.push([q.index,q.index+q[0].length]);let j=0,H=-1;while(j<J.length){B.lastIndex=j;let O=B.exec(J.slice(j));if(!O)break;let F=j+O.index;if(!z.some(([V,N])=>F>=V&&F<N)){H=F;break}j=F+O[0].length}if(H!==-1){let O=J.slice(0,H),F=J.slice(H).replace(B,(L)=>L.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=O+F}}return J}var TR=0,r8,fB,xB,rJ,CR;var $2=D(()=>{W5();L4();N0();r8=/<script\b([^>]*)>/gi,fB=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;xB=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"]);rJ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);CR=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import w1 from"path";import Z2 from"fs";function pB($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function cB($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class lB{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let J=$.endsWith(".stx")?$.slice(0,-4):$,Q=X?.__importedComponents;if(Q){let q=[J,J.toLowerCase(),pB(J),cB(J)];for(let j of q)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${J}.stx`,`${pB(J)}.stx`,`${cB(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let q=w1.resolve(w1.dirname(Z),`${J}.stx`);if(await t(q))return q;return null}let K=[],W=Y.componentsDir||"",U=X?.__originalFilePath;if(U)K.push(w1.join(w1.dirname(U),"components"));if(W)K.push(W);let B=w1.join(w1.dirname(Z),"components");if(!K.includes(B))K.push(B);let _=process.cwd(),z=[w1.resolve(_,"src/components"),w1.resolve(_,"components"),w1.resolve(import.meta.dir,"components")];for(let q of z)if(!K.includes(q))K.push(q);for(let q of K){if(!q)continue;for(let j of G){let H=w1.join(q,j);if(await t(H))return H}try{if(!Z2.statSync(q,{throwIfNoEntry:!1})?.isDirectory())continue;let H=Z2.readdirSync(q,{withFileTypes:!0});for(let O of H)if(O.isDirectory()){let F=w1.join(q,O.name);for(let L of G){let V=w1.join(F,L);if(await t(V))return V}}}catch{}}return null}}var B1;var Y2=D(()=>{N0();B1=new lB});function d$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xR($){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 X2;var J2=D(()=>{X2={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=xR($),J=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,W=[];if(X.reactive)W.push(`:href="${d$(X.value)}"`);else W.push(`href="${d$(X.value)}"`);if(J)W.push(`class="${d$(J)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${d$(Q)}"`),W.push(`data-stx-exact-active-class="${d$(G)}"`),K)W.push("data-stx-prefetch");let U=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[B,_]of Object.entries($.static)){if(U.has(B))continue;if(typeof _==="boolean"){if(_)W.push(d$(B))}else W.push(`${d$(B)}="${d$(_)}"`)}return`<a ${W.join(" ")}>${Z}</a>`}}});function f0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function X1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function G2($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let J=$.static[Z];if(J!==void 0)return J!=="false"&&J!==!1;return Y}function iB($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[J,Q]=X.split(":"),G=vR[J];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(J);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(X);return Y.join(", ")}function K2($,Z,Y,X){return Z.map((J)=>`${X6($,J,void 0,Y,X)} ${J}w`).join(", ")}function fR($,Z,Y,X,J){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${X6($,G,void 0,X,J)} ${Q}x`}).join(", ")}function X6($,Z,Y,X,J){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(J)Q.push(`f_${J}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(J)Q.set("fm",J);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(J)Q.set("format",J);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function gR($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var vR,Q2,W2;var U2=D(()=>{vR={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Q2=[320,640,768,1024,1280,1536,1920];W2={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=X1($,"src")||"",J=X1($,"alt")||"",Q=X1($,"width"),G=X1($,"height"),K=X1($,"sizes"),W=X1($,"srcset"),U=X1($,"densities"),B=X1($,"format"),_=X1($,"placeholder"),z=X1($,"placeholderColor")||"#e5e7eb",q=X1($,"provider"),j=X1($,"class")||X1($,"className")||"",H=X1($,"style")||"",O=X1($,"quality"),F=G2($,"lazy",!0),L=G2($,"preload",!1),V=G2($,"picture",!1)||!!B,N=Q?Number.parseInt(Q):void 0,A=G?Number.parseInt(G):void 0,w=W||"",R="";if(!w&&K)w=K2(X,Q2,q,B),R=iB(K);else if(!w&&U){let y=U.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));w=fR(X,y,N,q,B)}else if(K)R=iB(K);let T=[];if(H)T.push(H);if(N&&A)T.push(`aspect-ratio:${N}/${A}`);if(_==="blur"||_==="color"||_==="thumbhash"){let y=gR(N||16,A||9,z);T.push(`background-image:url(${y})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(_&&_!=="empty"&&_!=="none")T.push(`background-image:url(${f0(_)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let I=X6(X,N,A,q,B),E=[];if(E.push(`src="${f0(I)}"`),E.push(`alt="${f0(J)}"`),Q)E.push(`width="${f0(Q)}"`);if(G)E.push(`height="${f0(G)}"`);if(F)E.push('loading="lazy"');if(E.push('decoding="async"'),j)E.push(`class="${f0(j)}"`);if(T.length>0)E.push(`style="${f0(T.join(";"))}"`);if(w)E.push(`srcset="${f0(w)}"`);if(R)E.push(`sizes="${f0(R)}"`);let k=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[y,b]of Object.entries($.static)){if(k.has(y))continue;if(typeof b==="boolean"){if(b)E.push(f0(y))}else E.push(`${f0(y)}="${f0(b)}"`)}let S=`<img ${E.join(" ")} />`,x="";if(L){let b=B==="webp"?"image/webp":B==="avif"?"image/avif":"";x=`<link rel="preload" as="image" href="${f0(I)}"${b?` type="${b}"`:""}${w?` imagesrcset="${f0(w)}"`:""}${R?` imagesizes="${f0(R)}"`:""} />
9365
+ `+G;let W=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),U=W&&/data-stx/.test(W[1]);if(!G&&!U&&W&&!/data-stx-auto/.test(W[1])){let B=/<body[^>]*>/i,_=/<(script|style)\b[\s\S]*?<\/\1>/gi,z=[],q;while((q=_.exec(J))!==null)z.push([q.index,q.index+q[0].length]);let j=0,H=-1;while(j<J.length){B.lastIndex=j;let O=B.exec(J.slice(j));if(!O)break;let F=j+O.index;if(!z.some(([V,N])=>F>=V&&F<N)){H=F;break}j=F+O[0].length}if(H!==-1){let O=J.slice(0,H),F=J.slice(H).replace(B,(L)=>L.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=O+F}}return J}var TR=0,r8,fB,xB,rJ,CR;var $2=D(()=>{W5();L4();A0();r8=/<script\b([^>]*)>/gi,fB=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;xB=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"]);rJ=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);CR=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import w1 from"path";import Z2 from"fs";function pB($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function cB($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class lB{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let J=$.endsWith(".stx")?$.slice(0,-4):$,Q=X?.__importedComponents;if(Q){let q=[J,J.toLowerCase(),pB(J),cB(J)];for(let j of q)if(Q.has(j))return Q.get(j)}let G=[...new Set([`${J}.stx`,`${pB(J)}.stx`,`${cB(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let q=w1.resolve(w1.dirname(Z),`${J}.stx`);if(await t(q))return q;return null}let K=[],W=Y.componentsDir||"",U=X?.__originalFilePath;if(U)K.push(w1.join(w1.dirname(U),"components"));if(W)K.push(W);let B=w1.join(w1.dirname(Z),"components");if(!K.includes(B))K.push(B);let _=process.cwd(),z=[w1.resolve(_,"src/components"),w1.resolve(_,"components"),w1.resolve(import.meta.dir,"components")];for(let q of z)if(!K.includes(q))K.push(q);for(let q of K){if(!q)continue;for(let j of G){let H=w1.join(q,j);if(await t(H))return H}try{if(!Z2.statSync(q,{throwIfNoEntry:!1})?.isDirectory())continue;let H=Z2.readdirSync(q,{withFileTypes:!0});for(let O of H)if(O.isDirectory()){let F=w1.join(q,O.name);for(let L of G){let V=w1.join(F,L);if(await t(V))return V}}}catch{}}return null}}var B1;var Y2=D(()=>{A0();B1=new lB});function d$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xR($){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 X2;var J2=D(()=>{X2={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=xR($),J=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,W=[];if(X.reactive)W.push(`:href="${d$(X.value)}"`);else W.push(`href="${d$(X.value)}"`);if(J)W.push(`class="${d$(J)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${d$(Q)}"`),W.push(`data-stx-exact-active-class="${d$(G)}"`),K)W.push("data-stx-prefetch");let U=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[B,_]of Object.entries($.static)){if(U.has(B))continue;if(typeof _==="boolean"){if(_)W.push(d$(B))}else W.push(`${d$(B)}="${d$(_)}"`)}return`<a ${W.join(" ")}>${Z}</a>`}}});function f0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function X1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function G2($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let J=$.static[Z];if(J!==void 0)return J!=="false"&&J!==!1;return Y}function iB($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[J,Q]=X.split(":"),G=vR[J];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(J);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(X);return Y.join(", ")}function K2($,Z,Y,X){return Z.map((J)=>`${X6($,J,void 0,Y,X)} ${J}w`).join(", ")}function fR($,Z,Y,X,J){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${X6($,G,void 0,X,J)} ${Q}x`}).join(", ")}function X6($,Z,Y,X,J){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(J)Q.push(`f_${J}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(J)Q.set("fm",J);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(J)Q.set("format",J);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function gR($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var vR,Q2,W2;var U2=D(()=>{vR={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},Q2=[320,640,768,1024,1280,1536,1920];W2={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=X1($,"src")||"",J=X1($,"alt")||"",Q=X1($,"width"),G=X1($,"height"),K=X1($,"sizes"),W=X1($,"srcset"),U=X1($,"densities"),B=X1($,"format"),_=X1($,"placeholder"),z=X1($,"placeholderColor")||"#e5e7eb",q=X1($,"provider"),j=X1($,"class")||X1($,"className")||"",H=X1($,"style")||"",O=X1($,"quality"),F=G2($,"lazy",!0),L=G2($,"preload",!1),V=G2($,"picture",!1)||!!B,N=Q?Number.parseInt(Q):void 0,A=G?Number.parseInt(G):void 0,w=W||"",R="";if(!w&&K)w=K2(X,Q2,q,B),R=iB(K);else if(!w&&U){let y=U.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));w=fR(X,y,N,q,B)}else if(K)R=iB(K);let T=[];if(H)T.push(H);if(N&&A)T.push(`aspect-ratio:${N}/${A}`);if(_==="blur"||_==="color"||_==="thumbhash"){let y=gR(N||16,A||9,z);T.push(`background-image:url(${y})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(_&&_!=="empty"&&_!=="none")T.push(`background-image:url(${f0(_)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let I=X6(X,N,A,q,B),E=[];if(E.push(`src="${f0(I)}"`),E.push(`alt="${f0(J)}"`),Q)E.push(`width="${f0(Q)}"`);if(G)E.push(`height="${f0(G)}"`);if(F)E.push('loading="lazy"');if(E.push('decoding="async"'),j)E.push(`class="${f0(j)}"`);if(T.length>0)E.push(`style="${f0(T.join(";"))}"`);if(w)E.push(`srcset="${f0(w)}"`);if(R)E.push(`sizes="${f0(R)}"`);let k=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[y,b]of Object.entries($.static)){if(k.has(y))continue;if(typeof b==="boolean"){if(b)E.push(f0(y))}else E.push(`${f0(y)}="${f0(b)}"`)}let S=`<img ${E.join(" ")} />`,x="";if(L){let b=B==="webp"?"image/webp":B==="avif"?"image/avif":"";x=`<link rel="preload" as="image" href="${f0(I)}"${b?` type="${b}"`:""}${w?` imagesrcset="${f0(w)}"`:""}${R?` imagesizes="${f0(R)}"`:""} />
9366
9366
  `}if(V){let y=[];if(B==="avif"||B==="auto"){let b=X6(X,N,A,q,"avif"),f=w?K2(X,Q2,q,"avif"):`${b}`;y.push(`<source type="image/avif" srcset="${f0(f)}"${R?` sizes="${f0(R)}"`:""} />`)}if(B==="webp"||B==="auto"){let b=X6(X,N,A,q,"webp"),f=w?K2(X,Q2,q,"webp"):`${b}`;y.push(`<source type="image/webp" srcset="${f0(f)}"${R?` sizes="${f0(R)}"`:""} />`)}return`${x}<picture>
9367
9367
  ${y.join(`
9368
9368
  `)}
@@ -9401,13 +9401,13 @@ ${S}
9401
9401
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
9402
9402
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
9403
9403
  </style>`}}});var tB={};Z0(tB,{preloadIconCollection:()=>ZZ,IconBuiltin:()=>$Z});import{existsSync as uR,readFileSync as mR}from"fs";function aB($){try{return _0.resolve(`@iconify/json/json/${$}.json`)}catch{}let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(uR(Y))return Y;return null}function pR($){if(O5.has($))return O5.get($);let Z=aB($);if(!Z)return null;try{let Y=JSON.parse(mR(Z,"utf8"));return O5.set($,Y.icons),Y.icons}catch{return null}}async function cR($){if(O5.has($))return O5.get($);let Z=aB($);if(!Z)return null;try{let Y=await Bun.file(Z).json();return O5.set($,Y.icons),Y.icons}catch{return null}}function T7($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}async function ZZ($="lucide"){await cR($)}var O5,$Z;var YZ=D(()=>{O5=new Map;$Z={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=T7($,"name")??T7($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let J="lucide",Q=X;if(X.includes(":")){let L=X.split(":");J=L[0],Q=L[1]}let G=P1(T7($,"size")||"24"),K=P1(T7($,"color")||"currentColor"),W=P1(T7($,"class")||""),U=P1(T7($,"style")||""),B=O5.get(J)??pR(J);if(!B)return`<!-- Icon: collection "${J}" not loaded -->`;let _=B[Q];if(!_)return`<!-- Icon: "${Q}" not found in ${J} -->`;let z=_.width||24,q=_.height||24,j=`0 0 ${z} ${q}`,H=_.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let O=W?` class="${W}"`:"",F=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${O}${F}>${H}</svg>`}}});function eB($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function $_($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var A2;var w2=D(()=>{A2={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=$_(Z,"fallback"),J=X.rest,Q=$_(J,"error"),G=Q.rest,K=X.region??eB($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=Q.region??eB($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function XZ($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var R2;var M2=D(()=>{R2={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(XZ($,"name")||"v").replace(/["'<>]/g,""),J=(XZ($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=XZ($,"class"),G=XZ($,"id"),K=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${J} ${K}>${Z}</${J}>`}}});function Z_(){B1.registerBuiltin(X2),B1.registerBuiltin(W2),B1.registerBuiltin(B2),B1.registerBuiltin(q2),B1.registerBuiltin(H2),B1.registerBuiltin(L2),B1.registerBuiltin(V2),B1.registerBuiltin($Z),B1.registerBuiltin(A2),B1.registerBuiltin(R2)}var T2=D(()=>{J2();U2();_2();j2();O2();F2();N2();YZ();w2();M2();Y2();J2();U2();_2();j2();O2();F2();N2();YZ();w2();M2()});function Y_($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function X_($,Z,Y){let X=[],J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})`));if(!K){J=Q+1;continue}let W=K[1];if(Y&&Y.has(W.toLowerCase())){let H=Q+1+W.length;while(H<$.length&&$[H]!==">")H++;J=H+1;continue}let U=Q+1+W.length,B=null,_=U,z=-1,q=!1;while(U<$.length){let H=$[U];if(B){if(H==="\\"&&U+1<$.length){U+=2;continue}if(H===B)B=null;U++;continue}if(H==='"'||H==="'"){B=H,U++;continue}if(H==="/"&&U+1<$.length&&$[U+1]===">"){z=U+2,q=!0;break}if(H===">"){z=U+1;break}U++}if(z===-1){J=Q+1;continue}let j=$.slice(_,q?z-2:z-1).trim();if(q)X.push({fullMatch:$.slice(Q,z),tagName:W,attributes:j,content:"",startIndex:Q,endIndex:z,isSelfClosing:!0}),J=z;else{let H=`<${W}`,O=`</${W}>`,F=1,L=z,V=-1;while(F>0&&L<$.length){let w=$.indexOf(H,L),R=$.indexOf(O,L);if(R===-1)break;if(w!==-1&&w<R){let T=$[w+H.length];if(T===" "||T===">"||T==="/"||T===`
9404
- `||T==="\t")F++;L=w+H.length}else{if(F--,F===0){V=R;break}L=R+O.length}}if(V===-1){J=z;continue}let N=$.slice(z,V),A=V+O.length;X.push({fullMatch:$.slice(Q,A),tagName:W,attributes:j,content:N,startIndex:Q,endIndex:A,isSelfClosing:!1}),J=A}}return X}function J_($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var Q_=D(()=>{h0();N0();j8()});var __={};Z0(__,{processESImports:()=>B_,processComponents:()=>QZ});import JZ from"fs";import L1 from"path";function iR($,Z,Y){let X={static:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),Q=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,W)=>W.toUpperCase())};for(let[G,K]of Object.entries($)){let W=G.startsWith("x-")&&!J.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(W.startsWith("@")){X.events[W]=K;continue}if(W.startsWith("__stx_")){let U=Q(W.slice(6));X.serverDynamic[U]=J_(K,Y);continue}if(W.startsWith(":")){let U=Q(W.slice(1)),B=K==="true"?U:K;try{if(!H0(B)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${B}`);X.clientReactive[U]=B;continue}let _=Object.keys(Z),q=O0(B,_)(...Object.values(Z));if(q===void 0){let j=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!_.includes(F))){X.clientReactive[U]=B;continue}}X.serverDynamic[U]=q}catch{X.clientReactive[U]=B}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let U=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let B=U[1];if(H0(B)){let z=O0(B,Object.keys(Z))(...Object.values(Z));X.static[W]=z!=null?String(z):""}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${B}`);X.static[W]=K}}catch(B){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,B);X.static[W]=K}else{let B=K,_=/\{\{\s*([\s\S]+?)\s*\}\}/g,z;while((z=_.exec(K))!==null)try{let q=z[1];if(!H0(q)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${q}`);continue}let H=O0(q,Object.keys(Z))(...Object.values(Z));B=B.replace(z[0],String(H??""))}catch(q){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,q)}X.static[W]=B}continue}X.static[W]=K}return X}function nR($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let J="";while(Y<X&&!/[\s=]/.test($[Y]))J+=$[Y],Y++;if(!J)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let Q="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[J]=Q}else Z[J]="true"}return Z}function K_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function sR($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let J=X[1];if(B1.isBuiltin(J))Z.add(J)}return[...Z].sort()}function rR($){let Z=W_.get($);if(Z)return Z;let Y=new Map,X=[L1.join($,"src"),L1.join($,"dist"),$];function J(Q,G){if(G>6)return;let K;try{K=JZ.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let U=L1.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;J(U,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let B=W.name.slice(0,-4);if(!Y.has(B))Y.set(B,U);let _=B.toLowerCase();if(!Y.has(_))Y.set(_,U);let z=B.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(z))Y.set(z,U)}}}for(let Q of X)if(J(Q,0),Y.size>0)break;return W_.set($,Y),Y}function oR($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=L1.join(Y,"node_modules",$);try{if(JZ.statSync(X).isDirectory())return X}catch{}let J=L1.dirname(Y);if(J===Y)return null;Y=J}}async function B_($,Z,Y,X,J){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=L1.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(U,B,_)=>{let z=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,q=_,j,H=[];while((j=z.exec(_))!==null){let[O,F,L,V]=j,N=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=L1.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let I=`${T}.stx`;try{if(JZ.statSync(I).isFile())A=I}catch{try{if(JZ.statSync(T).isDirectory())N=T}catch{}}}}else N=oR(V,G);if(!N&&!A)continue;let w=!1,R=(T,I)=>{Q.set(T,I),Q.set(T.toLowerCase(),I);let E=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(E,I),J.add(I)};if(L&&A)R(L,A),w=!0;else if(F){let T=F.slice(1,-1).split(",").map((E)=>E.trim()).filter(Boolean).map((E)=>{let k=E.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:E,local:E}}),I=N?rR(N):null;for(let{source:E,local:k}of T){let S=null;if(A)S=A;else if(I)S=I.get(E)??I.get(E.toLowerCase())??I.get(E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(S)R(k,S),w=!0}}if(w)H.push({start:j.index,end:j.index+O.length})}if(H.length===0)return U;for(let O=H.length-1;O>=0;O--)q=q.slice(0,H[O].start)+q.slice(H[O].end);return`<script${B}>${q}</script>`}),K}async function aR($,Z,Y,X,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[U,B]=W,_=B.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of _){let q=z.split("/"),H=q[q.length-1].replace(/\.stx$/,""),O=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,L=[L1.resolve(L1.dirname(Y),`${z}.stx`),L1.resolve(L1.dirname(Y),z),L1.resolve(X.componentsDir||"components",`${z}.stx`),L1.resolve(X.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let V of L)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(O,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),J.add(F),X.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${z}`)}Q=Q.replace(U,""),K.lastIndex=0}return Q}async function tR($,Z,Y,X,J){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,U;while((U=W.exec(Q))!==null){let B=U.index,_=B+U[0].length-1,z=1,q=_+1;while(q<Q.length&&z>0){if(Q[q]==="(")z++;else if(Q[q]===")"){if(z--,z===0)break}q++}if(z!==0)break;let j=Q.substring(_+1,q),H=q+1,O=j.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let F=O[1],L,V=j.slice(O[0].length),N=V.match(/^\s*,\s*/);if(N)L=V.slice(N[0].length).trim();let A={};if(L)try{A=y0(L,Z)}catch(k){let S=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(B,H),`[Error parsing component props: ${S}]`);continue}let w="",R=H,I=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(I)w=I[1].trim(),R=H+I[0].length;let E=await c1(F,A,w,G,Z,Y,X,K,J);Q=Q.substring(0,B)+E+Q.substring(R),W.lastIndex=0}return Q}async function eR($,Z,Y,X,J){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=JJ(Q);return Q=W.output,Q=await z(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await z(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await z(Q,/[a-z][a-z0-9]*/,!1,lR),Q=QJ(Q,W.scripts),Q;async function z(q,j,H,O){if(!q)return q;let F=q,L=X_(F,j,O);for(let V=L.length-1;V>=0;V--){let N=L[V],A=H?Y_(N.tagName):N.tagName,w=nR(N.attributes),R=iR(w,Z,X),T=B1.getBuiltin(N.tagName),I=T?await E2(A,G,Z,Y,X):!1;if(T&&!I){let x={context:Z,filePath:Y,options:X,dependencies:J},y=T.render(R,N.content,x);if(Object.keys(R.clientReactive).length>0)y=U_(y,R.clientReactive);if(Object.keys(R.events).length>0){let b=Object.entries(R.events).map(([f,r])=>`${f}="${K_(r)}"`).join(" ");y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,N.startIndex)+y+F.substring(N.endIndex);continue}let E={};for(let[x,y]of Object.entries(R.static))E[x]=y;for(let[x,y]of Object.entries(R.serverDynamic))E[x]=y;let S=await c1(A,E,N.content,G,Z,Y,X,K,J);if(Object.keys(R.clientReactive).length>0)S=U_(S,R.clientReactive);if(Object.keys(R.events).length>0){let x=S.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(x){let y=Object.entries(R.events).map(([f,r])=>`${f}="${K_(r)}"`).join(" "),b=x[1].length+x[2].length;S=S.substring(0,b)+" "+y+S.substring(b)}}F=F.substring(0,N.startIndex)+S+F.substring(N.endIndex)}return F}}function U_($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let X=Object.entries(Z).map(([Q,G])=>`:${Q}="${G.replace(/"/g,"&quot;")}"`).join(" "),J=Y[1].length+Y[2].length;return $.substring(0,J)+" "+X+$.substring(J)}async function QZ($,Z,Y,X,J){if(!G_)Z_(),G_=!0;let Q=await B_($,Z,Y,X,J);Q=await aR(Q,Z,Y,X,J),Q=await tR(Q,Z,Y,X,J);for(let G=0;G<3;G++){let K=Q;if(Q=await eR(Q,Z,Y,X,J),Q===K)break}if(X.debug){let G=sR(Q);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var G_=!1,lR,W_;var I2=D(()=>{Y2();T2();Q_();N0();h0();lR=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","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"]);W_=new Map});import I7 from"path";function z_($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function q_($,Z,Y){try{let X;if($.startsWith("/")){let J=Z;for(let Q=0;Q<5;Q++){let G=I7.join(J,$);if(await Bun.file(G).exists())return G;J=I7.dirname(J)}X=I7.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=I7.resolve(Z,$);else X=I7.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function j_($,Z,Y){let X=$,J=I7.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[U,B,_,z]=G;if(z_(_))continue;let q=await q_(_,J,Z);if(q)try{let j=await Bun.file(q).text();if(Y.add(q),_.endsWith(".ts")||_.endsWith(".tsx")){let O=await Bun.build({entrypoints:[q],target:"browser",minify:!1,define:N1()});if(O.outputs.length>0)j=await O.outputs[0].text()}let H=`<script>
9404
+ `||T==="\t")F++;L=w+H.length}else{if(F--,F===0){V=R;break}L=R+O.length}}if(V===-1){J=z;continue}let N=$.slice(z,V),A=V+O.length;X.push({fullMatch:$.slice(Q,A),tagName:W,attributes:j,content:N,startIndex:Q,endIndex:A,isSelfClosing:!1}),J=A}}return X}function J_($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var Q_=D(()=>{h0();A0();j8()});var __={};Z0(__,{processESImports:()=>B_,processComponents:()=>QZ});import JZ from"fs";import L1 from"path";function iR($,Z,Y){let X={static:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),Q=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,W)=>W.toUpperCase())};for(let[G,K]of Object.entries($)){let W=G.startsWith("x-")&&!J.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(W.startsWith("@")){X.events[W]=K;continue}if(W.startsWith("__stx_")){let U=Q(W.slice(6));X.serverDynamic[U]=J_(K,Y);continue}if(W.startsWith(":")){let U=Q(W.slice(1)),B=K==="true"?U:K;try{if(!O0(B)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${B}`);X.clientReactive[U]=B;continue}let _=Object.keys(Z),q=L0(B,_)(...Object.values(Z));if(q===void 0){let j=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(j.some((F)=>!H.has(F)&&!_.includes(F))){X.clientReactive[U]=B;continue}}X.serverDynamic[U]=q}catch{X.clientReactive[U]=B}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let U=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let B=U[1];if(O0(B)){let z=L0(B,Object.keys(Z))(...Object.values(Z));X.static[W]=z!=null?String(z):""}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${B}`);X.static[W]=K}}catch(B){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,B);X.static[W]=K}else{let B=K,_=/\{\{\s*([\s\S]+?)\s*\}\}/g,z;while((z=_.exec(K))!==null)try{let q=z[1];if(!O0(q)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${q}`);continue}let H=L0(q,Object.keys(Z))(...Object.values(Z));B=B.replace(z[0],String(H??""))}catch(q){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,q)}X.static[W]=B}continue}X.static[W]=K}return X}function nR($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let J="";while(Y<X&&!/[\s=]/.test($[Y]))J+=$[Y],Y++;if(!J)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let Q="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[J]=Q}else Z[J]="true"}return Z}function K_($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function sR($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let J=X[1];if(B1.isBuiltin(J))Z.add(J)}return[...Z].sort()}function rR($){let Z=W_.get($);if(Z)return Z;let Y=new Map,X=[L1.join($,"src"),L1.join($,"dist"),$];function J(Q,G){if(G>6)return;let K;try{K=JZ.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let W of K){let U=L1.join(Q,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;J(U,G+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let B=W.name.slice(0,-4);if(!Y.has(B))Y.set(B,U);let _=B.toLowerCase();if(!Y.has(_))Y.set(_,U);let z=B.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(z))Y.set(z,U)}}}for(let Q of X)if(J(Q,0),Y.size>0)break;return W_.set($,Y),Y}function oR($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=L1.join(Y,"node_modules",$);try{if(JZ.statSync(X).isDirectory())return X}catch{}let J=L1.dirname(Y);if(J===Y)return null;Y=J}}async function B_($,Z,Y,X,J){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=L1.dirname(Y),K=$,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(W,(U,B,_)=>{let z=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,q=_,j,H=[];while((j=z.exec(_))!==null){let[O,F,L,V]=j,N=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=L1.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let I=`${T}.stx`;try{if(JZ.statSync(I).isFile())A=I}catch{try{if(JZ.statSync(T).isDirectory())N=T}catch{}}}}else N=oR(V,G);if(!N&&!A)continue;let w=!1,R=(T,I)=>{Q.set(T,I),Q.set(T.toLowerCase(),I);let E=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(E,I),J.add(I)};if(L&&A)R(L,A),w=!0;else if(F){let T=F.slice(1,-1).split(",").map((E)=>E.trim()).filter(Boolean).map((E)=>{let k=E.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:E,local:E}}),I=N?rR(N):null;for(let{source:E,local:k}of T){let S=null;if(A)S=A;else if(I)S=I.get(E)??I.get(E.toLowerCase())??I.get(E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(S)R(k,S),w=!0}}if(w)H.push({start:j.index,end:j.index+O.length})}if(H.length===0)return U;for(let O=H.length-1;O>=0;O--)q=q.slice(0,H[O].start)+q.slice(H[O].end);return`<script${B}>${q}</script>`}),K}async function aR($,Z,Y,X,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=K.exec(Q))!==null){let[U,B]=W,_=B.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of _){let q=z.split("/"),H=q[q.length-1].replace(/\.stx$/,""),O=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,L=[L1.resolve(L1.dirname(Y),`${z}.stx`),L1.resolve(L1.dirname(Y),z),L1.resolve(X.componentsDir||"components",`${z}.stx`),L1.resolve(X.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let V of L)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(O,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),J.add(F),X.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${z}`)}Q=Q.replace(U,""),K.lastIndex=0}return Q}async function tR($,Z,Y,X,J){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=/@component\s*\(/g,U;while((U=W.exec(Q))!==null){let B=U.index,_=B+U[0].length-1,z=1,q=_+1;while(q<Q.length&&z>0){if(Q[q]==="(")z++;else if(Q[q]===")"){if(z--,z===0)break}q++}if(z!==0)break;let j=Q.substring(_+1,q),H=q+1,O=j.match(/^\s*['"]([^'"]+)['"]/);if(!O){W.lastIndex=0;continue}let F=O[1],L,V=j.slice(O[0].length),N=V.match(/^\s*,\s*/);if(N)L=V.slice(N[0].length).trim();let A={};if(L)try{A=y0(L,Z)}catch(k){let S=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(B,H),`[Error parsing component props: ${S}]`);continue}let w="",R=H,I=Q.substring(H).match(/^([\s\S]*?)@endcomponent/);if(I)w=I[1].trim(),R=H+I[0].length;let E=await c1(F,A,w,G,Z,Y,X,K,J);Q=Q.substring(0,B)+E+Q.substring(R),W.lastIndex=0}return Q}async function eR($,Z,Y,X,J){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,W=JJ(Q);return Q=W.output,Q=await z(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await z(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await z(Q,/[a-z][a-z0-9]*/,!1,lR),Q=QJ(Q,W.scripts),Q;async function z(q,j,H,O){if(!q)return q;let F=q,L=X_(F,j,O);for(let V=L.length-1;V>=0;V--){let N=L[V],A=H?Y_(N.tagName):N.tagName,w=nR(N.attributes),R=iR(w,Z,X),T=B1.getBuiltin(N.tagName),I=T?await E2(A,G,Z,Y,X):!1;if(T&&!I){let x={context:Z,filePath:Y,options:X,dependencies:J},y=T.render(R,N.content,x);if(Object.keys(R.clientReactive).length>0)y=U_(y,R.clientReactive);if(Object.keys(R.events).length>0){let b=Object.entries(R.events).map(([f,r])=>`${f}="${K_(r)}"`).join(" ");y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,N.startIndex)+y+F.substring(N.endIndex);continue}let E={};for(let[x,y]of Object.entries(R.static))E[x]=y;for(let[x,y]of Object.entries(R.serverDynamic))E[x]=y;let S=await c1(A,E,N.content,G,Z,Y,X,K,J);if(Object.keys(R.clientReactive).length>0)S=U_(S,R.clientReactive);if(Object.keys(R.events).length>0){let x=S.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(x){let y=Object.entries(R.events).map(([f,r])=>`${f}="${K_(r)}"`).join(" "),b=x[1].length+x[2].length;S=S.substring(0,b)+" "+y+S.substring(b)}}F=F.substring(0,N.startIndex)+S+F.substring(N.endIndex)}return F}}function U_($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let X=Object.entries(Z).map(([Q,G])=>`:${Q}="${G.replace(/"/g,"&quot;")}"`).join(" "),J=Y[1].length+Y[2].length;return $.substring(0,J)+" "+X+$.substring(J)}async function QZ($,Z,Y,X,J){if(!G_)Z_(),G_=!0;let Q=await B_($,Z,Y,X,J);Q=await aR(Q,Z,Y,X,J),Q=await tR(Q,Z,Y,X,J);for(let G=0;G<3;G++){let K=Q;if(Q=await eR(Q,Z,Y,X,J),Q===K)break}if(X.debug){let G=sR(Q);if(G.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${G.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var G_=!1,lR,W_;var I2=D(()=>{Y2();T2();Q_();A0();h0();lR=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","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"]);W_=new Map});import I7 from"path";function z_($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function q_($,Z,Y){try{let X;if($.startsWith("/")){let J=Z;for(let Q=0;Q<5;Q++){let G=I7.join(J,$);if(await Bun.file(G).exists())return G;J=I7.dirname(J)}X=I7.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=I7.resolve(Z,$);else X=I7.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function j_($,Z,Y){let X=$,J=I7.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[U,B,_,z]=G;if(z_(_))continue;let q=await q_(_,J,Z);if(q)try{let j=await Bun.file(q).text();if(Y.add(q),_.endsWith(".ts")||_.endsWith(".tsx")){let O=await Bun.build({entrypoints:[q],target:"browser",minify:!1,define:N1()});if(O.outputs.length>0)j=await O.outputs[0].text()}let H=`<script>
9405
9405
  // Source: ${_}
9406
9406
  ${j}
9407
9407
  </script>`;X=X.replace(U,H),Q.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=K.exec(X))!==null){let[U,B,_,z]=W,q=B+z;if(z_(_))continue;if(/rel=["']stylesheet["']/.test(q)||_.endsWith(".css")){let H=await q_(_,J,Z);if(H)try{let O=await Bun.file(H).text();Y.add(H);let F=`<style>
9408
9408
  /* Source: ${_} */
9409
9409
  ${O}
9410
- </style>`;X=X.replace(U,F),K.lastIndex=0}catch(O){}}}return X}var H_=D(()=>{G5()});function Q6($,Z){let Y=$,X=/@json\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index,G=Q+J[0].length-1,K=1,W=G+1,U=null,B=!1;while(W<Y.length&&K>0){let V=Y[W];if(B){B=!1,W++;continue}if(V==="\\"&&U){B=!0,W++;continue}if(U){if(V===U)U=null;W++;continue}if(V==='"'||V==="'"||V==="`"){U=V,W++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}W++}if(K!==0)break;let _=Y.substring(G+1,W).trim(),z=Y.substring(Q,W+1),q=-1,j=0,H=null,O=!1;for(let V=0;V<_.length;V++){let N=_[V];if(O){O=!1;continue}if(N==="\\"&&H){O=!0;continue}if(H){if(N===H)H=null;continue}if(N==='"'||N==="'"||N==="`"){H=N;continue}if(N==="("||N==="["||N==="{")j++;else if(N===")"||N==="]"||N==="}")j--;if(N===","&&j===0){q=V;break}}let F=q>=0?_.substring(0,q).trim():_,L=q>=0?_.substring(q+1).trim():void 0;try{let V=F.trim(),N;if(H0(V))N=O0(V,Object.keys(Z))(...Object.values(Z));else N=void 0;let A;if(L==="true")A=JSON.stringify(N,null,2);else A=JSON.stringify(N);let w=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+w+Y.substring(W+1),X.lastIndex=Q+w.length}catch(V){o0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=Q+z.length}}return Y}function G6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function O_($){let Z=$,Y=/@memo\s*\(/g,X,J=[];while((X=Y.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let U=Z.slice(G,W-1).trim(),B=W,_=Z.slice(B),z=_.indexOf("@endmemo");if(z===-1)continue;let q=_.slice(0,z),j=B+z+8,H=q.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=H?H[0].length:0,F=q.slice(O),L=q.match(/(\s*)$/),V=L?L[0].length:0,N=F.slice(0,F.length-V),A=N.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),w;if(A){let[R,T,I="",E]=A,k=`<${T}${I} data-stx-memo="${U}"${E}>`;w=q.slice(0,O)+k+N.slice(R.length)+q.slice(O+N.length)}else w=`${q.slice(0,O)}<div data-stx-memo="${U}">${N}</div>${q.slice(O+N.length)}`;J.push({start:Q,end:j,replacement:w}),Y.lastIndex=j}for(let Q=J.length-1;Q>=0;Q--){let G=J[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function D2($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function L_($){let Y=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"),X="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,U=!1,B=-1;while(K<$.length){let H=$[K];if(W){if(H==="'")W=!1}else if(U){if(H==='"')U=!1}else if(H==="'")W=!0;else if(H==='"')U=!0;else if(H===">"){B=K;break}K++}if(B===-1)continue;if($.slice(G,B+1).includes("x-cloak"))continue;let z=$.slice(B+1),q=z.indexOf("</"),j=q>=0?z.slice(0,q):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(J,B)+" x-cloak>",J=B+1}return X+=$.slice(J),X}function F_($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,J;while((J=Z.exec($))!==null){let Q=J.index,G=J[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,Q);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=Q+J[0].length,W=!1,U=!1,B=-1;while(K<$.length){let j=$[K];if(W){if(j==="'")W=!1}else if(U){if(j==='"')U=!1}else if(j==="'")W=!0;else if(j==='"')U=!0;else if(j===">"){B=K;break}K++}if(B===-1)continue;let _=$.slice(Q+J[0].length,B);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(_))continue;if(!$M.test(_))continue;let z=$[B-1]==="/",q=z?B-1:B;Y+=`${$.slice(X,q)} x-cloak${z?" ":""}`,X=q}return Y+=$.slice(X),Y}var $M;var k2=D(()=>{j1();h0();$M=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function K6($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},J=X.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:W}of ZM){if(J.some((B)=>K.includes(B)||G.source.includes(B)))continue;G.lastIndex=0;let U=$.match(G);if(U&&U.length>0){let B=$.split(`
9410
+ </style>`;X=X.replace(U,F),K.lastIndex=0}catch(O){}}}return X}var H_=D(()=>{G5()});function Q6($,Z){let Y=$,X=/@json\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index,G=Q+J[0].length-1,K=1,W=G+1,U=null,B=!1;while(W<Y.length&&K>0){let V=Y[W];if(B){B=!1,W++;continue}if(V==="\\"&&U){B=!0,W++;continue}if(U){if(V===U)U=null;W++;continue}if(V==='"'||V==="'"||V==="`"){U=V,W++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}W++}if(K!==0)break;let _=Y.substring(G+1,W).trim(),z=Y.substring(Q,W+1),q=-1,j=0,H=null,O=!1;for(let V=0;V<_.length;V++){let N=_[V];if(O){O=!1;continue}if(N==="\\"&&H){O=!0;continue}if(H){if(N===H)H=null;continue}if(N==='"'||N==="'"||N==="`"){H=N;continue}if(N==="("||N==="["||N==="{")j++;else if(N===")"||N==="]"||N==="}")j--;if(N===","&&j===0){q=V;break}}let F=q>=0?_.substring(0,q).trim():_,L=q>=0?_.substring(q+1).trim():void 0;try{let V=F.trim(),N;if(O0(V))N=L0(V,Object.keys(Z))(...Object.values(Z));else N=void 0;let A;if(L==="true")A=JSON.stringify(N,null,2);else A=JSON.stringify(N);let w=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+w+Y.substring(W+1),X.lastIndex=Q+w.length}catch(V){o0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=Q+z.length}}return Y}function G6($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function O_($){let Z=$,Y=/@memo\s*\(/g,X,J=[];while((X=Y.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,K=1,W=G;while(W<Z.length&&K>0){if(Z[W]==="(")K++;else if(Z[W]===")")K--;W++}if(K!==0)continue;let U=Z.slice(G,W-1).trim(),B=W,_=Z.slice(B),z=_.indexOf("@endmemo");if(z===-1)continue;let q=_.slice(0,z),j=B+z+8,H=q.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=H?H[0].length:0,F=q.slice(O),L=q.match(/(\s*)$/),V=L?L[0].length:0,N=F.slice(0,F.length-V),A=N.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),w;if(A){let[R,T,I="",E]=A,k=`<${T}${I} data-stx-memo="${U}"${E}>`;w=q.slice(0,O)+k+N.slice(R.length)+q.slice(O+N.length)}else w=`${q.slice(0,O)}<div data-stx-memo="${U}">${N}</div>${q.slice(O+N.length)}`;J.push({start:Q,end:j,replacement:w}),Y.lastIndex=j}for(let Q=J.length-1;Q>=0;Q--){let G=J[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function D2($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function L_($){let Y=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"),X="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,W=!1,U=!1,B=-1;while(K<$.length){let H=$[K];if(W){if(H==="'")W=!1}else if(U){if(H==='"')U=!1}else if(H==="'")W=!0;else if(H==='"')U=!0;else if(H===">"){B=K;break}K++}if(B===-1)continue;if($.slice(G,B+1).includes("x-cloak"))continue;let z=$.slice(B+1),q=z.indexOf("</"),j=q>=0?z.slice(0,q):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(J,B)+" x-cloak>",J=B+1}return X+=$.slice(J),X}function F_($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,J;while((J=Z.exec($))!==null){let Q=J.index,G=J[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,Q);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=Q+J[0].length,W=!1,U=!1,B=-1;while(K<$.length){let j=$[K];if(W){if(j==="'")W=!1}else if(U){if(j==='"')U=!1}else if(j==="'")W=!0;else if(j==='"')U=!0;else if(j===">"){B=K;break}K++}if(B===-1)continue;let _=$.slice(Q+J[0].length,B);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(_))continue;if(!$M.test(_))continue;let z=$[B-1]==="/",q=z?B-1:B;Y+=`${$.slice(X,q)} x-cloak${z?" ":""}`,X=q}return Y+=$.slice(X),Y}var $M;var k2=D(()=>{j1();h0();$M=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function K6($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},J=X.allowPatterns??[],Q=[];for(let{pattern:G,message:K,suggestion:W}of ZM){if(J.some((B)=>K.includes(B)||G.source.includes(B)))continue;G.lastIndex=0;let U=$.match(G);if(U&&U.length>0){let B=$.split(`
9411
9411
  `),_=[];B.forEach((q,j)=>{if(G.lastIndex=0,G.test(q))_.push(j+1)});let z=_.length>0?` (line${_.length>1?"s":""}: ${_.join(", ")})`:"";Q.push(` \u2717 ${K}${z}
9412
9412
  \u2192 ${W}`)}}if(Q.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
9413
9413
  ${Q.join(`
@@ -9421,12 +9421,12 @@ ${K.join(`
9421
9421
  })();`;return E7.set(Z,U),U}function QM(){E7.clear()}var E7;var R_=D(()=>{i0();G5();E7=new Map});var WZ={};Z0(WZ,{stripTypeScript:()=>D_,hasVariables:()=>x2,extractVariables:()=>D0,extractScriptFromTemplate:()=>P2,convertToCommonJS:()=>KZ});import D7 from"path";import W6 from"process";function GM($){let Z=[],Y=0,X=$.split(`
9422
9422
  `);for(let J of X){let Q=Y,G=null,K=!1;for(let W=0;W<J.length;W++){let U=J[W];if(K){K=!1;continue}if(U==="\\"){K=!0;continue}if(G){if(U===G)G=null;continue}if(U==="'"||U==='"'||U==="`"){G=U;continue}if(U==="/"&&W+1<J.length&&J[W+1]==="/")break;if(U==="{")Y++;else if(U==="}")Y--}if(Q===0){let W=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)Z.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let U=J.match(/(?:const|let|var)\s+(\w+)/);if(U)Z.push(U[1])}else{let U=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(U){let _=U[1].slice(1,-1).split(",").map((z)=>{let q=z.split(":");return(q.length>1?q[1]:q[0]).trim()}).filter((z)=>/^\w+$/.test(z));Z.push(..._)}}}}return[...new Set(Z)]}function D_($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let J=[],Q="",G=0,K=0,W=null;for(let U=0;U<X.length;U++){let B=X[U];if(W){if(Q+=B,B===W)W=null;continue}if(B==='"'||B==="'"||B==="`"){W=B,Q+=B;continue}if(B==="<")G++;else if(B===">"&&G>0)G--;else if(B==="(")K++;else if(B===")")K--;if(B===","&&G===0&&K===0){J.push(Q),Q="";continue}Q+=B}if(Q)J.push(Q);return J.map((U)=>{let B=U.trim(),_=B.startsWith("..."),z=_?B.slice(3):B,q=-1,j=0;for(let A=0;A<z.length;A++)if(z[A]==="<")j++;else if(z[A]===">")j--;else if(z[A]===":"&&j===0){q=A;break}if(q===-1)return U;let O=z.substring(0,q).trim().replace(/\?$/,""),F=z.substring(q+1),L=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){L=A;break}let N=_?"...":"";if(L!==-1)return`${N}${O} = ${F.substring(L+1).trim()}`;return`${N}${O}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,J,Q)=>{if(!Q.includes(":"))return X;return`${J}(${Y(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,J,Q=[];while((J=X.exec(Z))!==null){let G=J.index+J[0].length-1,K=1,W=G+1,U=0,B=null;while(W<Z.length&&K>0){let q=Z[W];if(B){if(q===B)B=null;W++;continue}if(q==='"'||q==="'"||q==="`"){B=q,W++;continue}if(q==="<")U++;else if(q===">"&&U>0)U--;else if(U===0){if(q==="(")K++;else if(q===")")K--}if(K>0)W++}if(K!==0)continue;let _=Z.substring(G+1,W);if(!_.includes(":"))continue;let z=Y(_);Q.push({start:G+1,end:W,replacement:z})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:W,replacement:U}=Q[G];Z=Z.substring(0,K)+U+Z.substring(W)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,J)=>{if(!J.includes(":"))return X;if(J.includes("{")||J.includes("}"))return X;return`(${J.split(",").map((G)=>{let[K,...W]=G.split("="),U=K.split(":")[0].trim();if(W.length>0)return`${U} = ${W.join("=").trim()}`;return U}).join(", ")}) =>`}),Z=Z.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"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
9423
9423
 
9424
- `),Z}async function D0($,Z,Y,X={}){if(!$.trim())return;let J;try{let P=new Bun.Transpiler({loader:"ts",target:"browser",define:N1()}),d=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");d=d.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=P.transformSync(d)}catch{J=D_($)}let Q={exports:{}},G=Q.exports,K=W6.cwd(),W={},U=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((P)=>P[1]).filter((P)=>!P.startsWith("node:")&&!P.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(P));for(let P of U)try{let d=D7.resolve(K,"node_modules",P),m=D7.join(d,"package.json"),g=JSON.parse(_0("fs").readFileSync(m,"utf8")),c=g.main||"index.js";if(g.exports){let a=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof a==="string")c=a;else if(a?.bun)c=a.bun;else if(a?.import)c=a.import;else if(a?.default)c=a.default}W[P]=await import(D7.resolve(d,c))}catch{}let B=(P)=>{if(W[P])return W[P];return _0(P)},_=Z.props||{},z=Object.assign((P)=>{if(!P)return _;let d={};for(let[m,g]of Object.entries(P)){let c=_[m];if(c!==void 0)d[m]=c;else if(typeof g==="function")d[m]=g();else d[m]=g}return d},_),q=(P)=>{if(!P)return _;let d={..._};for(let[m,g]of Object.entries(P)){let c=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(d[m]===void 0&&c.default!==void 0)d[m]=typeof c.default==="function"?c.default():c.default}return d},j=()=>Z.slots||{},H=(P,d)=>{let m={...P};for(let[g,c]of Object.entries(d))if(m[g]===void 0)if(typeof c==="function")m[g]=c();else m[g]=c;return m},O=(P)=>{let d=()=>P;return d.set=(m)=>{},d.update=(m)=>{},d},F=(P)=>{let d,m=!1;return()=>{if(!m)try{d=P(),m=!0}catch{d=void 0}return d}},L=(P)=>{},V=(P)=>P(),N=(P)=>{},A=(P)=>{},w=(P)=>{},R=()=>{let P=Z.__stxServeContext,d=Z.__stxServeSearch??P?.search??"",m=P?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(d)),path:m,name:"",fullPath:m+d,hash:"",matched:[]}},T=()=>({push:(P)=>{},replace:(P)=>{},back:()=>{},forward:()=>{},go:(P)=>{}}),I=(P)=>{P$(P);let d=Z.__stx_runtime_head||{},m=P||{};Z.__stx_runtime_head={...d,...m.title&&{title:m.title},meta:[...d.meta||[],...m.meta||[]],link:[...d.link||[],...m.link||[]],script:[...d.script||[],...m.script||[]],htmlAttrs:{...d.htmlAttrs||{},...m.htmlAttrs||{}},bodyAttrs:{...d.bodyAttrs||{},...m.bodyAttrs||{}}}},E=(P)=>{u4(P);let d=L7();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...d.title&&{title:d.title},meta:d.meta?[...d.meta]:[]}},k=(P)=>({value:P}),S=(P)=>P,x=(P)=>({value:typeof P==="function"?P():P}),y=(P,d)=>{},b=(P)=>{},f=(P)=>{},r=(P)=>P?P():Promise.resolve(),u=(P)=>(d,...m)=>{},C=(P)=>{},h=(P,d)=>{},p=(P,d)=>d,i=()=>({value:"light"}),s=()=>({value:!1}),K0={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:{}},$0=new Proxy(K0,{get(P,d){if(d in P)return P[d];return},set(P,d,m){return P[d]=m,!0}}),F0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},R0=console;try{let P=KZ(J,Y),d=new Set(Object.keys(_)),m=Object.keys(Z).filter((G0)=>!d.has(G0)&&G0!=="props"),g=m.map((G0)=>Z[G0]),c=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),a=[],l=[];for(let[G0,k0]of Object.entries(_)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G0))continue;if(c.has(G0))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${G0}\\b`).test(P))continue;a.push(G0),l.push(k0)}let M0=GM(P).map((G0)=>`module.exports.${G0} = typeof ${G0} !== 'undefined' ? ${G0} : module.exports.${G0};`).join(`
9425
- `),w0=Z.params??{},W0=[],r0=[];for(let G0=0;G0<m.length;G0++){if(m[G0]==="params")continue;W0.push(m[G0]),r0.push(g[G0])}let P5=await Function("module","exports","require","props","$props","defineProps","withDefaults","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","window","document","console","confirm","alert","fetch","params",...a,...W0,`return (async () => {
9424
+ `),Z}async function D0($,Z,Y,X={}){if(!$.trim())return;let J;try{let P=new Bun.Transpiler({loader:"ts",target:"browser",define:N1()}),d=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");d=d.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=P.transformSync(d)}catch{J=D_($)}let Q={exports:{}},G=Q.exports,K=W6.cwd(),W={},U=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((P)=>P[1]).filter((P)=>!P.startsWith("node:")&&!P.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(P));for(let P of U)try{let d=D7.resolve(K,"node_modules",P),m=D7.join(d,"package.json"),g=JSON.parse(_0("fs").readFileSync(m,"utf8")),c=g.main||"index.js";if(g.exports){let a=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof a==="string")c=a;else if(a?.bun)c=a.bun;else if(a?.import)c=a.import;else if(a?.default)c=a.default}W[P]=await import(D7.resolve(d,c))}catch{}let B=(P)=>{if(W[P])return W[P];return _0(P)},_=Z.props||{},z=Object.assign((P)=>{if(!P)return _;let d={};for(let[m,g]of Object.entries(P)){let c=_[m];if(c!==void 0)d[m]=c;else if(typeof g==="function")d[m]=g();else d[m]=g}return d},_),q=(P)=>{if(!P)return _;let d={..._};for(let[m,g]of Object.entries(P)){let c=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(d[m]===void 0&&c.default!==void 0)d[m]=typeof c.default==="function"?c.default():c.default}return d},j=()=>Z.slots||{},H=(P,d)=>{let m={...P};for(let[g,c]of Object.entries(d))if(m[g]===void 0)if(typeof c==="function")m[g]=c();else m[g]=c;return m},O=(P)=>{let d=()=>P;return d.set=(m)=>{},d.update=(m)=>{},d},F=(P)=>{let d,m=!1;return()=>{if(!m)try{d=P(),m=!0}catch{d=void 0}return d}},L=(P)=>{},V=(P)=>P(),N=(P)=>{},A=(P)=>{},w=(P)=>{},R=()=>{let P=Z.__stxServeContext,d=Z.__stxServeSearch??P?.search??"",m=P?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(d)),path:m,name:"",fullPath:m+d,hash:"",matched:[]}},T=()=>({push:(P)=>{},replace:(P)=>{},back:()=>{},forward:()=>{},go:(P)=>{}}),I=(P)=>{P$(P);let d=Z.__stx_runtime_head||{},m=P||{};Z.__stx_runtime_head={...d,...m.title&&{title:m.title},meta:[...d.meta||[],...m.meta||[]],link:[...d.link||[],...m.link||[]],script:[...d.script||[],...m.script||[]],htmlAttrs:{...d.htmlAttrs||{},...m.htmlAttrs||{}},bodyAttrs:{...d.bodyAttrs||{},...m.bodyAttrs||{}}}},E=(P)=>{u4(P);let d=L7();Z.__stx_runtime_head={...Z.__stx_runtime_head||{},...d.title&&{title:d.title},meta:d.meta?[...d.meta]:[]}},k=(P)=>({value:P}),S=(P)=>P,x=(P)=>({value:typeof P==="function"?P():P}),y=(P,d)=>{},b=(P)=>{},f=(P)=>{},r=(P)=>P?P():Promise.resolve(),u=(P)=>(d,...m)=>{},C=(P)=>{},h=(P,d)=>{},p=(P,d)=>d,i=()=>({value:"light"}),s=()=>({value:!1}),W0={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:{}},$0=new Proxy(W0,{get(P,d){if(d in P)return P[d];return},set(P,d,m){return P[d]=m,!0}}),V0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},M0=console;try{let P=KZ(J,Y),d=new Set(Object.keys(_)),m=Object.keys(Z).filter((G0)=>!d.has(G0)&&G0!=="props"),g=m.map((G0)=>Z[G0]),c=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),a=[],l=[];for(let[G0,k0]of Object.entries(_)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(G0))continue;if(c.has(G0))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${G0}\\b`).test(P))continue;a.push(G0),l.push(k0)}let R0=GM(P).map((G0)=>`module.exports.${G0} = typeof ${G0} !== 'undefined' ? ${G0} : module.exports.${G0};`).join(`
9425
+ `),j0=Z.params??{},K0=[],r0=[];for(let G0=0;G0<m.length;G0++){if(m[G0]==="params")continue;K0.push(m[G0]),r0.push(g[G0])}let P5=await Function("module","exports","require","props","$props","defineProps","withDefaults","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","window","document","console","confirm","alert","fetch","params",...a,...K0,`return (async () => {
9426
9426
  ${P}
9427
- ${M0}
9427
+ ${R0}
9428
9428
  return module.exports
9429
- })()`)(Q,G,B,_,z,q,H,O,F,L,V,N,A,w,R,T,I,E,k,S,x,y,b,f,r,u,C,j,h,p,i,s,$0,F0,R0,K0.confirm,K0.alert,K0.fetch,w0,...l,...r0);if(X.preserveExisting){for(let[G0,k0]of Object.entries(P5))if(!(G0 in Z)||Z[G0]===void 0)Z[G0]=k0}else Object.assign(Z,P5);for(let[G0,k0]of Object.entries(_))if(!(G0 in Z))Z[G0]=k0}catch(P){if(W6.env.STX_DEBUG){let d=P instanceof Error?P.message:String(P);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${d}`)}try{await _M(J,Z,Y)}catch(d){if(W6.env.STX_DEBUG){let m=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${m}`)}}}}function KZ($,Z){let Y=Z?D7.dirname(Z):W6.cwd(),X=$.split(`
9429
+ })()`)(Q,G,B,_,z,q,H,O,F,L,V,N,A,w,R,T,I,E,k,S,x,y,b,f,r,u,C,j,h,p,i,s,$0,V0,M0,W0.confirm,W0.alert,W0.fetch,j0,...l,...r0);if(X.preserveExisting){for(let[G0,k0]of Object.entries(P5))if(!(G0 in Z)||Z[G0]===void 0)Z[G0]=k0}else Object.assign(Z,P5);for(let[G0,k0]of Object.entries(_))if(!(G0 in Z))Z[G0]=k0}catch(P){if(W6.env.STX_DEBUG){let d=P instanceof Error?P.message:String(P);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${d}`)}try{await _M(J,Z,Y)}catch(d){if(W6.env.STX_DEBUG){let m=d instanceof Error?d.message:String(d);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${m}`)}}}}function KZ($,Z){let Y=Z?D7.dirname(Z):W6.cwd(),X=$.split(`
9430
9430
  `),J=[],Q=0;while(Q<X.length){let G=X[Q].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;Q<X.length;Q++){for(let W of X[Q])if(W==="{")K++;else if(W==="}")K--;if(K<=0)break}}Q++;continue}if(G.startsWith("definePageMeta(")){let K=0,W=!1;for(let U=Q;U<X.length&&!W;U++){let B=null,_=!1,z=X[U];for(let q=0;q<z.length;q++){let j=z[q];if(_){_=!1;continue}if(j==="\\"){_=!0;continue}if(B){if(j===B)B=null;continue}if(j==='"'||j==="'"||j==="`"){B=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){Q=U+1,W=!0;break}}}}if(!W)Q=X.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),U=G.match(/^import\s+['"](.+)['"]/),B=(_)=>{if(_.startsWith("."))return D7.resolve(Y,_);return _};if(K){let[,_,z]=K,q=B(z);J.push(`const ${_} = await import('${q}')`),J.push(`module.exports.${_} = ${_};`)}else if(W){let[,_,z]=W,q=_.trim(),j=B(z);J.push(`const { ${q} } = await import('${j}')`);for(let H of q.split(",")){let O=H.trim().split(/\s+as\s+/).pop()?.trim();if(O)J.push(`module.exports.${O} = ${O};`)}}else if(U){let _=B(U[1]);J.push(`await import('${_}')`)}else J.push(G);Q++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))J.push(X[Q]),Q++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=M_(X,Q),{type:W,name:U,value:B}=K;J.push(`${W} ${U} = ${B};`),J.push(`module.exports.${U} = ${U};`),Q=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=y2(X,Q);J.push(K.functionCode),J.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=M_(X,Q),{type:W,name:U,value:B}=K;J.push(`${W} ${U} = ${B};`),J.push(`module.exports.${U} = ${U};`),Q=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=y2(X,Q);J.push(K.functionCode),J.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[Q].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...X];W[Q]=K;let U=y2(W,Q);if(J.push(U.functionCode),U.name)J.push(`module.exports.default = ${U.name};`);Q=U.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");J.push(`module.exports.default = ${K};`),Q++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let W=K[1],U=X[Q].replace(/^export\s+/,""),B=0,_=Q;for(;_<X.length;_++){let z=X[_];for(let q of z)if(q==="{")B++;else if(q==="}")B--;if(_>Q)U+=`
9431
9431
  `+z;if(B<=0&&_>=Q)break}J.push(U),J.push(`module.exports.${W} = ${W};`),Q=_+1}else J.push(G),Q++}else if(G.includes("module.exports"))J.push(G),Q++;else if(G.trim()&&!G.startsWith("//"))J.push(G),Q++;else Q++}return KM(J.join(`
9432
9432
  `),Y)}function KM($,Z){let Y=$.length,X="",J=0,Q=null,G=!1,K=!1,W=0;while(J<Y){let U=$[J],B=$[J+1];if(G){if(X+=U,U===`
@@ -9460,7 +9460,7 @@ window.__stxSuspense.resolve('${$}', \`${X}\`);
9460
9460
  </script>`}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return`
9461
9461
  <script>
9462
9462
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${E0(X)}</div>');
9463
- </script>`}}function qM($,Z,Y){if(!Z||Z<=0)return $;let X,J=new Promise((Q,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,J]).finally(()=>clearTimeout(X))}function P_($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue($),Z.length>0)J.enqueue(f2),await Promise.all(Z.map(async(Q)=>{let G=qM(Q.render(),X,Q.id);J.enqueue(await BZ(Q.id,G))}));J.close()}catch(Q){J.error(Q)}}})}function x_($,Z){return $.replace(jM,(Y,X,J)=>{let Q=X.trim(),G=J.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function v_($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,J])=>({id:X,render:J})):void 0}async function f_($,Z={},Y={}){let X={...G1,...Y,streaming:{...v2,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",U=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),B={...Z,__filename:$,__dirname:UZ.dirname($)};if(W.trim())await D0(W,B,$);let _=new Set,z=X.streaming?.strategy||"auto",q=new RegExp(L5.source,"g");if(!(z!=="manual"&&q.test(U))){let H=await X0(U,B,$,X,_);for(let O=0;O<H.length;O+=J)Q.enqueue(H.slice(O,O+J))}else{let H=[],O=new RegExp(L5.source,"g"),F;while((F=O.exec(U))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let L=0;for(let V of H){if(V.start>L){let A=U.slice(L,V.start);if(A.trim()){let w=await X0(A,B,$,X,_);Q.enqueue(w)}}let N=await X0(V.content,B,$,X,_);Q.enqueue(N),L=V.end}if(L<U.length){let V=U.slice(L);if(V.trim()){let N=await X0(V,B,$,X,_);Q.enqueue(N)}}}Q.close()}catch(G){Q.error(G)}}})}async function g_($,Z={}){let Y={...G1,...Z,streaming:{...v2,...Z.streaming}},X=await Bun.file($).text(),J=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=J?J[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},U;L5.lastIndex=0;while((U=L5.exec(G))!==null){let z=U[1],q=U[2];W[z]=q}let B=G.replace(L5,"");return{renderShell:async(z={})=>{let q={...z,__filename:$,__dirname:UZ.dirname($)};return await D0(Q,q,$),X0(B,q,$,Y,new Set)},renderSection:async(z,q={})=>{try{if(!W[z])return`<div class="error-message">Section "${E0(z)}" not found in template "${E0($)}"</div>`;let j={...q,__filename:$,__dirname:UZ.dirname($)};await D0(Q,j,$);let H=new Set;return await X0(W[z],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return L0("Expression",H,$,W[z]||"",0,W[z]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function h_($={}){let Z=[];if($.streaming?.enabled)Z.push(g2);if($.hydration?.enabled)Z.push(h2);return Z}async function d_($,Z,Y,X={}){return $}function u_($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),J=new Headers(Z.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(X,{...Z,headers:J})}function m_($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,J=Object.entries(Y).map(([Q,G])=>`'${Q}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
9463
+ </script>`}}function qM($,Z,Y){if(!Z||Z<=0)return $;let X,J=new Promise((Q,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,J]).finally(()=>clearTimeout(X))}function P_($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue($),Z.length>0)J.enqueue(f2),await Promise.all(Z.map(async(Q)=>{let G=qM(Q.render(),X,Q.id);J.enqueue(await BZ(Q.id,G))}));J.close()}catch(Q){J.error(Q)}}})}function x_($,Z){return $.replace(jM,(Y,X,J)=>{let Q=X.trim(),G=J.split(/@fallback/i),K=G[0].trim(),W=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${W}</div>`})}function v_($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,J])=>({id:X,render:J})):void 0}async function f_($,Z={},Y={}){let X={...G1,...Y,streaming:{...v2,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=K?K[1]:"",U=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),B={...Z,__filename:$,__dirname:UZ.dirname($)};if(W.trim())await D0(W,B,$);let _=new Set,z=X.streaming?.strategy||"auto",q=new RegExp(L5.source,"g");if(!(z!=="manual"&&q.test(U))){let H=await X0(U,B,$,X,_);for(let O=0;O<H.length;O+=J)Q.enqueue(H.slice(O,O+J))}else{let H=[],O=new RegExp(L5.source,"g"),F;while((F=O.exec(U))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let L=0;for(let V of H){if(V.start>L){let A=U.slice(L,V.start);if(A.trim()){let w=await X0(A,B,$,X,_);Q.enqueue(w)}}let N=await X0(V.content,B,$,X,_);Q.enqueue(N),L=V.end}if(L<U.length){let V=U.slice(L);if(V.trim()){let N=await X0(V,B,$,X,_);Q.enqueue(N)}}}Q.close()}catch(G){Q.error(G)}}})}async function g_($,Z={}){let Y={...G1,...Z,streaming:{...v2,...Z.streaming}},X=await Bun.file($).text(),J=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=J?J[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,W={},U;L5.lastIndex=0;while((U=L5.exec(G))!==null){let z=U[1],q=U[2];W[z]=q}let B=G.replace(L5,"");return{renderShell:async(z={})=>{let q={...z,__filename:$,__dirname:UZ.dirname($)};return await D0(Q,q,$),X0(B,q,$,Y,new Set)},renderSection:async(z,q={})=>{try{if(!W[z])return`<div class="error-message">Section "${E0(z)}" not found in template "${E0($)}"</div>`;let j={...q,__filename:$,__dirname:UZ.dirname($)};await D0(Q,j,$);let H=new Set;return await X0(W[z],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return F0("Expression",H,$,W[z]||"",0,W[z]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return K}}}function h_($={}){let Z=[];if($.streaming?.enabled)Z.push(g2);if($.hydration?.enabled)Z.push(h2);return Z}async function d_($,Z,Y,X={}){return $}function u_($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),J=new Headers(Z.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(X,{...Z,headers:J})}function m_($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,J=Object.entries(Y).map(([Q,G])=>`'${Q}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
9464
9464
  `);if(Z==="loader")return`
9465
9465
  (function() {
9466
9466
  window.__stx = window.__stx || {};
@@ -9622,7 +9622,7 @@ else {
9622
9622
  }
9623
9623
  };
9624
9624
  })();
9625
- </script>`,jM,g2,h2;var c$=D(()=>{i0();n0();F1();N0();v2={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},L5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,C_=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;jM=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;g2={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let J=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${$}<!-- @endsuspense:${J} -->`}},h2={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${J}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=K?K[1].trim():"",U=K?$.replace(K[0],""):$;return`<div data-island="${J}" data-island-id="${G}" data-priority="${Q}">
9625
+ </script>`,jM,g2,h2;var c$=D(()=>{i0();n0();F1();A0();v2={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},L5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,C_=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;jM=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;g2={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let J=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${$}<!-- @endsuspense:${J} -->`}},h2={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${J}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=K?K[1].trim():"",U=K?$.replace(K[0],""):$;return`<div data-island="${J}" data-island-id="${G}" data-priority="${Q}">
9626
9626
  ${U}
9627
9627
  <script type="application/json" data-island-props="${G}">
9628
9628
  ${W?`{${W}}`:"{}"}
@@ -12351,21 +12351,21 @@ ${g}`);if(/<html\b[^>]*>/i.test(m))return m.replace(/(<html\b[^>]*>)/i,`$1
12351
12351
  ${g}
12352
12352
  </head>`);return m},{renderHead:r,getHead:u}=await Promise.resolve().then(() => (x$(),w8)),C=Z.__stx_runtime_head,h=C&&(C.title||C.meta?.length||C.link?.length)?C:u();if(h.title||h.meta?.length||h.link?.length){let m=r(h);if(m)Q=f(Q,m)}if(S.headContent)Q=f(Q,S.headContent);if(G.csp?.enabled&&G.csp.addMetaTag)Q=VJ(Q,G.csp,Z);if(G.analytics?.enabled)Q=BJ(Q,G);if(G.heatmap?.enabled)Q=hY(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:m}=await Promise.resolve().then(() => (Jq(),Xq));Q=m(Q,G)}let p=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),i=/\bSTX\.\w+/.test(Q),s=/window\.STX\s*=/.test(Q);if(p&&i&&!s){let g=`<script data-stx-scoped>
12353
12353
  ${YU()}
12354
- </script>`;if(Q.includes("</head>")){let c=Q.indexOf("</head>"),l=Q.slice(0,c).indexOf("<script");if(l!==-1){let Q0=Q.slice(0,l),M0=Q.slice(l);Q=Q0+g+`
12355
- `+M0}else Q=Q.replace("</head>",`${g}
12354
+ </script>`;if(Q.includes("</head>")){let c=Q.indexOf("</head>"),l=Q.slice(0,c).indexOf("<script");if(l!==-1){let Q0=Q.slice(0,l),R0=Q.slice(l);Q=Q0+g+`
12355
+ `+R0}else Q=Q.replace("</head>",`${g}
12356
12356
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
12357
12357
  ${g}`);else Q=g+`
12358
- `+Q}{let m=/<script\s+server\b[^>]*>/gi,g,c=[];while((g=m.exec(Q))!==null){let a=g.index+g[0].length,l=qT(Q,a);if(l===-1)continue;let Q0=l+9;while(Q0<Q.length&&/\s/.test(Q[Q0]))Q0++;c.push({start:g.index,end:Q0}),m.lastIndex=Q0}for(let a=c.length-1;a>=0;a--){let{start:l,end:Q0}=c[a];Q=Q.substring(0,l)+Q.substring(Q0)}}let K0=n4(Q,Y);if(K0.hasScoped)Q=K0.html;let $0=Z.__stx_event_bindings||[],F0=!1,R0=[],P=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:d}=await Promise.resolve().then(() => ($2(),mB));for(let m of d(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))R0.push({match:m.fullMatch,attrs:m.attrs,content:m.body});for(let{match:m,attrs:g,content:c}of R0){F0=!0;let a=c;K6(c,Y,X.strict);let l=await w$(c,{eventBindings:$0,attrs:g,hasColonDirectives:P,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(m,()=>l)}if(F0)Z.__stx_event_bindings=[];return Q}var N5="<!--PARENT_CONTENT_PLACEHOLDER-->";var F1=D(()=>{m1();j8();k3();XU();WJ();_J();x3();P3();qJ();W5();FU();O7();R3();AJ();EU();MJ();j1();x$();n0();EJ();yJ();C7();ZB();y8();v3();gJ();U5();_B();Q8();N0();qB();hJ();uJ();pJ();v8();$2();I2();H_();k2();S2();h0();C2();k2();S2()});function Wq($){let Z=[],Y=[];return RT($,Z),MT($,Z,Y),TT($,Y),IT($,Z),{valid:Z.length===0,errors:Z,warnings:Y}}function RT($,Z){let Y=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(Y!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${Y} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function MT($,Z,Y){for(let X of NT){let J=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(J)||[]).length,K=($.match(Q)||[]).length;if(X.altClose){let W=new RegExp(X.altClose,"g");K+=($.match(W)||[]).length}if(G>K)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${K} closing`,suggestion:`Add ${G-K} missing ${X.close} tag(s)`});else if(K>G)Y.push({type:"directive",message:`Extra ${X.close} found: ${K-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function TT($,Z){for(let Y of AT)if(Y.pattern.test($))Z.push({type:"syntax",message:Y.message,suggestion:Y.suggestion})}function IT($,Z){for(let Y of wT)if(Y.pattern.test($))Z.push({type:"expression",message:`Security warning: ${Y.message}`,suggestion:"Remove dangerous code from template expressions"})}function Uq($,Z){let Y=$.slice(0,Z).split(`
12359
- `);return{line:Y.length,column:Y[Y.length-1].length+1}}function Bq($,Z,Y){let X=[];switch($){case"if":case"elseif":case"unless":if(Y.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(Y.length===0||!Y[0].includes(" as "))X.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(Y.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(Y.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(Y.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(Y.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function _q($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function zq($){let Z=$.matchAll(/@([a-z]+)/gi),Y=new Set;for(let X of Z){let J=X[1].toLowerCase();if(!J.startsWith("end"))Y.add(J)}return Array.from(Y)}var NT,AT,wT;var qq=D(()=>{NT=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],AT=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],wT=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}]});var Fq={};Z0(Fq,{renderSlot:()=>B9,processSlots:()=>_9,parseSlots:()=>U9,parseSlotElement:()=>jq,extractSlotContent:()=>Oq,applySlots:()=>Lq});function ET($,Z){let Y=1,X=Z,J="<template",Q="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(J,X)&&(X+J.length>=$.length||/[\s>\/]/.test($[X+J.length]))){Y++,X+=J.length;continue}if($.startsWith(Q,X)){let K=$.indexOf(">",X+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function U9($){let Z={default:"",named:new Map},Y=$,X=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,J=[],Q;while((Q=X.exec($))!==null){let[B,_,z,q,j]=Q,H=_||z||q,O=Q.index+B.length,F=ET($,O);if(F!==-1){let L=$.slice(O,F-11).trim();J.push({start:Q.index,end:F,slotName:H,content:L,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:L,propsBinding:j||void 0})}}J.sort((B,_)=>_.start-B.start);for(let B of J)Y=Y.slice(0,B.start)+Y.slice(B.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,W;while((W=K.exec(Y))!==null){let[B,_,z,q,j,H]=W,O=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+F).trim(),V=`<${_}${L?" "+L:""}>${H}</${_}>`;G.push({start:W.index,end:W.index+B.length,slotName:q,element:V})}let U=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((W=U.exec(Y))!==null){let[B,_,z,q,j]=W,H=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+O).trim(),L=`<${_}${F?" "+F:""} />`;G.push({start:W.index,end:W.index+B.length,slotName:q,element:L})}G.sort((B,_)=>_.start-B.start);for(let B of G){let _=Z.named.get(B.slotName);if(_)_.content+=B.element;else Z.named.set(B.slotName,{name:B.slotName,content:B.element});Y=Y.slice(0,B.start)+Y.slice(B.end)}return Z.default=Y.trim(),Z}function jq($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=J.exec($))!==null)X[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function B9($,Z,Y,X){if(!$)return Y;let J=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...X};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[U,B]=W.split(":").map((z)=>z.trim()),_=B||U;if(Z[U]!==void 0)G[_]=Z[U]}}else G[Q]=Z;J=DT(J,G)}return J}function DT($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let J=X.trim(),Q=Hq(J,Z);return E0(String(Q??""))}catch{return`{{ ${X} }}`}})}function Hq($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),J=Z;for(let Q of X)if(J&&typeof J==="object"&&Q in J)J=J[Q];else return;return J}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,J,Q]=Y,G=Z[X],K=parseInt(Q,10);if(typeof G==="number")switch(J){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!H0($))return;return O0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function _9($,Z,Y){let X=$;X=await kT(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,U)=>{let B=Z.named.get(K),_=U?.trim()||"",z=W||"",q={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(z))!==null){let O=H[1],F=H[2];q[O]=Hq(F,Y)}return await B9(B,q,_,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),X}async function kT($,Z,Y){let X=[],J=[];$.replace(Z,(K,...W)=>{let U=W[W.length-2];return J.push({match:K,index:U}),X.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(X),G=$;for(let K=J.length-1;K>=0;K--){let{match:W,index:U}=J[K];G=G.slice(0,U)+Q[K]+G.slice(U+W.length)}return G}function Oq($){let Z=U9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function Lq($,Z,Y,X){return await _9($,{default:Z,named:Y},X)}var z9=D(()=>{n0();h0()});import ST from"fs";import o from"path";function Vq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Nq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function R$($){return!Nq($)}function M$($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:N1()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)J=J.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),J=J.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return J}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function CT($){let Z=[],Y=new Set,X=0,J=0,Q=$.length,G=(B)=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]===B){J++;return}J++}},K=()=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let B=1;while(J<Q&&B>0)if($[J]==="{")B++,J++;else if($[J]==="}")B--,J++;else if($[J]==="'"||$[J]==='"')G($[J]);else if($[J]==="`")K();else J++;continue}J++}},W=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<Q&&$[J]!==`
12360
- `)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(X!==0)return;let B=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(B){let j=B[2].split(",").map((H)=>{let O=H.trim().split(":");return O[O.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let _=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(_){let j=_[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let z=$.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let j=z[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let q=$.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(q){let j=q[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(J<Q){if(W())continue;if($[J]==="'"||$[J]==='"'){G($[J]);continue}if($[J]==="`"){K();continue}if($[J]==="{"){X++,J++;continue}if($[J]==="}"){X--,J++;continue}if(X===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))U();J++}return Z}function yT($){let Z=[],Y=0,X=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G==="\\"){Q++;continue}if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function PT($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function xT($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let J=X,Q=0,G=-1;for(;X>=0;X--){let W=$[X];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,J);for(let W of yT(K)){let U=W.trim();if(!U||U.startsWith("..."))continue;let B=PT(U);if(B===-1)continue;let _=U.slice(0,B).trim();if(!/^[A-Z_$][\w$]*$/i.test(_))continue;if(Z[_]!==void 0)continue;let z=U.slice(B+1).trim();if(!z)continue;try{let q=Object.keys(Z),j=Function(...q,`"use strict"; return (${z});`);Z[_]=j(...q.map((H)=>Z[H]))}catch{}}}catch{}}async function E2($,Z,Y,X,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Y.__importedComponents;if(W){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(O))return!0}let U=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],B=typeof J.root==="string"?o.resolve(J.root):void 0,_=B??o.dirname(X),z=[],q=(O)=>{if(O&&!z.includes(O))z.push(O)},j=Y.__originalFilePath;if(j)q(o.join(o.dirname(j),"components"));q(Z),q(o.join(o.dirname(X),"components")),q(J.componentsDir);let H=J._pluginComponentDirs;if(Array.isArray(H))for(let O of H)q(typeof O==="string"?O:null);if(B)q(o.resolve(B,"resources/views/components")),q(o.resolve(B,"resources/components")),q(o.resolve(B,"src/components")),q(o.resolve(B,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return t(o.resolve(o.dirname(X),`${Q}.stx`));for(let O of z){let F=o.isAbsolute(O)?O:o.resolve(_,O);for(let L of U)if(await t(o.join(F,L)))return!0}return!1}function Aq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}async function c1($,Z,Y,X,J,Q,G,K=new Set,W){let{extractVariables:U}=await Promise.resolve().then(() => (p$(),WZ)),B=K??new Set;if(B.has($))return`[Circular component reference: ${$}]`;let _=new Set(B);_.add($);let z=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let q=z&&z!=="load"&&Aq(z)?z:"";try{let j=(P)=>P.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),H=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,F=null,L=J.__importedComponents;if(L){let P=[O,O.toLowerCase(),j(O),H(O)];for(let d of P)if(L.has(d)){F=L.get(d);break}}let V=[];if(!F){let P=[`${O}.stx`,`${j(O)}.stx`,`${H(O)}.stx`],d=[...new Set(P)],m=J.__originalFilePath,g=[];if(m){let W0=o.join(o.dirname(m),"components");g.push(W0)}if(X)g.push(X);let c=o.join(o.dirname(Q),"components");if(!g.includes(c))g.push(c);if(G.componentsDir&&G.componentsDir!==X&&!g.includes(G.componentsDir))g.push(G.componentsDir);let a=G._pluginComponentDirs;if(Array.isArray(a)){for(let W0 of a)if(typeof W0==="string"&&!g.includes(W0))g.push(W0)}let l=typeof G.root==="string"?o.resolve(G.root):void 0,Q0=l??o.dirname(Q),M0=[];if(l)M0.push(o.resolve(l,"resources/views/components")),M0.push(o.resolve(l,"resources/components")),M0.push(o.resolve(l,"src/components")),M0.push(o.resolve(l,"components"));M0.push(o.resolve(import.meta.dir,"components"));for(let W0 of M0)if(!g.includes(W0))g.push(W0);let w0=[...new Set(g.map((W0)=>{if(!W0)return W0;return o.isAbsolute(W0)?W0:o.resolve(Q0,W0)}))];if(g.length=0,g.push(...w0),O.startsWith("./")||O.startsWith("../"))F=o.resolve(o.dirname(Q),`${O}.stx`),V.push(F);else for(let W0 of g){if(!W0)continue;for(let r0 of d){let p0=o.join(W0,r0);if(V.push(p0),await t(p0)){F=p0;break}}if(F)break;if(!F)try{let r0=await import("fs");if(!r0.statSync(W0,{throwIfNoEntry:!1})?.isDirectory())continue;let P5=8,G0=[{path:W0,depth:0}];while(G0.length>0&&!F){let k0=G0.pop();if(k0.depth>=P5)continue;let Q4;try{Q4=r0.readdirSync(k0.path,{withFileTypes:!0})}catch{continue}for(let E1 of Q4){if(!E1.isDirectory())continue;if(E1.name==="node_modules"||E1.name.startsWith("."))continue;let O$=o.join(k0.path,E1.name);for(let V0 of d){let $1=o.join(O$,V0);if(V.push($1),await t($1)){F=$1;break}}if(F)break;G0.push({path:O$,depth:k0.depth+1})}}}catch{}if(F)break}}if(!F||!await t(F)){let P=V.length>0?`
12358
+ `+Q}{let m=/<script\s+server\b[^>]*>/gi,g,c=[];while((g=m.exec(Q))!==null){let a=g.index+g[0].length,l=qT(Q,a);if(l===-1)continue;let Q0=l+9;while(Q0<Q.length&&/\s/.test(Q[Q0]))Q0++;c.push({start:g.index,end:Q0}),m.lastIndex=Q0}for(let a=c.length-1;a>=0;a--){let{start:l,end:Q0}=c[a];Q=Q.substring(0,l)+Q.substring(Q0)}}let W0=n4(Q,Y);if(W0.hasScoped)Q=W0.html;let $0=Z.__stx_event_bindings||[],V0=!1,M0=[],P=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:d}=await Promise.resolve().then(() => ($2(),mB));for(let m of d(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))M0.push({match:m.fullMatch,attrs:m.attrs,content:m.body});for(let{match:m,attrs:g,content:c}of M0){V0=!0;let a=c;K6(c,Y,X.strict);let l=await w$(c,{eventBindings:$0,attrs:g,hasColonDirectives:P,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});Q=Q.replace(m,()=>l)}if(V0)Z.__stx_event_bindings=[];return Q}var N5="<!--PARENT_CONTENT_PLACEHOLDER-->";var F1=D(()=>{m1();j8();k3();XU();WJ();_J();x3();P3();qJ();W5();FU();O7();R3();AJ();EU();MJ();j1();x$();n0();EJ();yJ();C7();ZB();y8();v3();gJ();U5();_B();Q8();A0();qB();hJ();uJ();pJ();v8();$2();I2();H_();k2();S2();h0();C2();k2();S2()});function Wq($){let Z=[],Y=[];return RT($,Z),MT($,Z,Y),TT($,Y),IT($,Z),{valid:Z.length===0,errors:Z,warnings:Y}}function RT($,Z){let Y=($.match(/\{\{/g)||[]).length,X=($.match(/\}\}/g)||[]).length;if(Y!==X)Z.push({type:"expression",message:`Unclosed expression brackets: found ${Y} opening '{{' and ${X} closing '}}'`,suggestion:"Ensure every {{ has a matching }}"})}function MT($,Z,Y){for(let X of NT){let J=new RegExp(`${X.open}(?:\\s|\\()`,"g"),Q=new RegExp(X.close,"g"),G=($.match(J)||[]).length,K=($.match(Q)||[]).length;if(X.altClose){let W=new RegExp(X.altClose,"g");K+=($.match(W)||[]).length}if(G>K)Z.push({type:"directive",message:`Unclosed @${X.name} directive: found ${G} opening and ${K} closing`,suggestion:`Add ${G-K} missing ${X.close} tag(s)`});else if(K>G)Y.push({type:"directive",message:`Extra ${X.close} found: ${K-G} more closing than opening`,suggestion:`Check for orphaned ${X.close} tags`})}}function TT($,Z){for(let Y of AT)if(Y.pattern.test($))Z.push({type:"syntax",message:Y.message,suggestion:Y.suggestion})}function IT($,Z){for(let Y of wT)if(Y.pattern.test($))Z.push({type:"expression",message:`Security warning: ${Y.message}`,suggestion:"Remove dangerous code from template expressions"})}function Uq($,Z){let Y=$.slice(0,Z).split(`
12359
+ `);return{line:Y.length,column:Y[Y.length-1].length+1}}function Bq($,Z,Y){let X=[];switch($){case"if":case"elseif":case"unless":if(Y.length===0)X.push({type:"syntax",message:`@${$} requires a condition`,suggestion:`Use @${$}(condition)`});break;case"foreach":if(Y.length===0||!Y[0].includes(" as "))X.push({type:"syntax",message:'@foreach requires "items as item" syntax',suggestion:"Use @foreach(items as item) or @foreach(items as key => value)"});break;case"for":if(Y.length===0)X.push({type:"syntax",message:"@for requires loop parameters",suggestion:"Use @for(let i = 0; i < 10; i++)"});break;case"switch":if(Y.length===0)X.push({type:"syntax",message:"@switch requires an expression",suggestion:"Use @switch(expression)"});break;case"case":if(Y.length===0)X.push({type:"syntax",message:"@case requires a value",suggestion:"Use @case(value)"});break;case"include":case"extends":case"component":if(Y.length===0)X.push({type:"syntax",message:`@${$} requires a path`,suggestion:`Use @${$}('path/to/template')`});break}return X}function _q($){return/@[a-z]+/i.test($)||/\{\{/.test($)}function zq($){let Z=$.matchAll(/@([a-z]+)/gi),Y=new Set;for(let X of Z){let J=X[1].toLowerCase();if(!J.startsWith("end"))Y.add(J)}return Array.from(Y)}var NT,AT,wT;var qq=D(()=>{NT=[{open:"@if",close:"@endif",name:"if"},{open:"@unless",close:"@endunless",name:"unless"},{open:"@foreach",close:"@endforeach",name:"foreach"},{open:"@for",close:"@endfor",name:"for"},{open:"@while",close:"@endwhile",name:"while"},{open:"@forelse",close:"@endforelse",name:"forelse"},{open:"@switch",close:"@endswitch",name:"switch"},{open:"@isset",close:"@endisset",name:"isset"},{open:"@empty",close:"@endempty",name:"empty"},{open:"@auth",close:"@endauth",name:"auth"},{open:"@guest",close:"@endguest",name:"guest"},{open:"@can",close:"@endcan",name:"can"},{open:"@cannot",close:"@endcannot",name:"cannot"},{open:"@section",close:"@endsection",name:"section",altClose:"@show"},{open:"@push",close:"@endpush",name:"push"},{open:"@prepend",close:"@endprepend",name:"prepend"},{open:"@once",close:"@endonce",name:"once"},{open:"@markdown",close:"@endmarkdown",name:"markdown"},{open:"@component",close:"@endcomponent",name:"component"}],AT=[{pattern:/@if\s*[^(]/,message:"@if directive missing parentheses",suggestion:"Use @if(condition)"},{pattern:/@foreach\s*[^(]/,message:"@foreach directive missing parentheses",suggestion:"Use @foreach(items as item)"},{pattern:/@foreach\([^)]*\)\s*[^@\n<]/,message:"@foreach may have content on same line",suggestion:"Put content on new line after @foreach()"},{pattern:/@include\s*[^(]/,message:"@include directive missing parentheses",suggestion:"Use @include('partial-name')"},{pattern:/@extends\s*[^(]/,message:"@extends directive missing parentheses",suggestion:"Use @extends('layout-name') or @layout('layout-name')"},{pattern:/@layout\s*[^(]/,message:"@layout directive missing parentheses",suggestion:"Use @layout('layout-name')"}],wT=[{pattern:/\{\{\s*constructor\s*\}\}/,message:"Attempting to access constructor property"},{pattern:/\{\{\s*__proto__\s*\}\}/,message:"Attempting to access __proto__ property"},{pattern:/\{\{\s*eval\s*\(/,message:"Attempting to use eval in expression"}]});var Fq={};Z0(Fq,{renderSlot:()=>B9,processSlots:()=>_9,parseSlots:()=>U9,parseSlotElement:()=>jq,extractSlotContent:()=>Oq,applySlots:()=>Lq});function ET($,Z){let Y=1,X=Z,J="<template",Q="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(J,X)&&(X+J.length>=$.length||/[\s>\/]/.test($[X+J.length]))){Y++,X+=J.length;continue}if($.startsWith(Q,X)){let K=$.indexOf(">",X+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function U9($){let Z={default:"",named:new Map},Y=$,X=/<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>/gi,J=[],Q;while((Q=X.exec($))!==null){let[B,_,z,q,j]=Q,H=_||z||q,O=Q.index+B.length,F=ET($,O);if(F!==-1){let L=$.slice(O,F-11).trim();J.push({start:Q.index,end:F,slotName:H,content:L,propsBinding:j||void 0}),Z.named.set(H,{name:H,content:L,propsBinding:j||void 0})}}J.sort((B,_)=>_.start-B.start);for(let B of J)Y=Y.slice(0,B.start)+Y.slice(B.end);let G=[],K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,W;while((W=K.exec(Y))!==null){let[B,_,z,q,j,H]=W,O=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(O+F).trim(),V=`<${_}${L?" "+L:""}>${H}</${_}>`;G.push({start:W.index,end:W.index+B.length,slotName:q,element:V})}let U=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((W=U.exec(Y))!==null){let[B,_,z,q,j]=W,H=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),F=(H+O).trim(),L=`<${_}${F?" "+F:""} />`;G.push({start:W.index,end:W.index+B.length,slotName:q,element:L})}G.sort((B,_)=>_.start-B.start);for(let B of G){let _=Z.named.get(B.slotName);if(_)_.content+=B.element;else Z.named.set(B.slotName,{name:B.slotName,content:B.element});Y=Y.slice(0,B.start)+Y.slice(B.end)}return Z.default=Y.trim(),Z}function jq($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=J.exec($))!==null)X[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function B9($,Z,Y,X){if(!$)return Y;let J=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...X};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of K){let[U,B]=W.split(":").map((z)=>z.trim()),_=B||U;if(Z[U]!==void 0)G[_]=Z[U]}}else G[Q]=Z;J=DT(J,G)}return J}function DT($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let J=X.trim(),Q=Hq(J,Z);return E0(String(Q??""))}catch{return`{{ ${X} }}`}})}function Hq($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),J=Z;for(let Q of X)if(J&&typeof J==="object"&&Q in J)J=J[Q];else return;return J}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,J,Q]=Y,G=Z[X],K=parseInt(Q,10);if(typeof G==="number")switch(J){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!O0($))return;return L0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function _9($,Z,Y){let X=$;X=await kT(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,W,U)=>{let B=Z.named.get(K),_=U?.trim()||"",z=W||"",q={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(z))!==null){let O=H[1],F=H[2];q[O]=Hq(F,Y)}return await B9(B,q,_,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(Q,(G,K)=>{if(G.includes("name="))return G;let W=K?.trim()||"";return Z.default||W}),X}async function kT($,Z,Y){let X=[],J=[];$.replace(Z,(K,...W)=>{let U=W[W.length-2];return J.push({match:K,index:U}),X.push(Y(K,...W.slice(0,-2))),K});let Q=await Promise.all(X),G=$;for(let K=J.length-1;K>=0;K--){let{match:W,index:U}=J[K];G=G.slice(0,U)+Q[K]+G.slice(U+W.length)}return G}function Oq($){let Z=U9($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function Lq($,Z,Y,X){return await _9($,{default:Z,named:Y},X)}var z9=D(()=>{n0();h0()});import ST from"fs";import o from"path";function Vq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Nq($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function R$($){return!Nq($)}function M$($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:N1()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)J=J.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),J=J.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return J}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function CT($){let Z=[],Y=new Set,X=0,J=0,Q=$.length,G=(B)=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]===B){J++;return}J++}},K=()=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let B=1;while(J<Q&&B>0)if($[J]==="{")B++,J++;else if($[J]==="}")B--,J++;else if($[J]==="'"||$[J]==='"')G($[J]);else if($[J]==="`")K();else J++;continue}J++}},W=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<Q&&$[J]!==`
12360
+ `)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(X!==0)return;let B=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(B){let j=B[2].split(",").map((H)=>{let O=H.trim().split(":");return O[O.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let _=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(_){let j=_[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let z=$.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let j=z[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let q=$.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(q){let j=q[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(J<Q){if(W())continue;if($[J]==="'"||$[J]==='"'){G($[J]);continue}if($[J]==="`"){K();continue}if($[J]==="{"){X++,J++;continue}if($[J]==="}"){X--,J++;continue}if(X===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))U();J++}return Z}function yT($){let Z=[],Y=0,X=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G==="\\"){Q++;continue}if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function PT($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function xT($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let J=X,Q=0,G=-1;for(;X>=0;X--){let W=$[X];if(W==="}")Q++;else if(W==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,J);for(let W of yT(K)){let U=W.trim();if(!U||U.startsWith("..."))continue;let B=PT(U);if(B===-1)continue;let _=U.slice(0,B).trim();if(!/^[A-Z_$][\w$]*$/i.test(_))continue;if(Z[_]!==void 0)continue;let z=U.slice(B+1).trim();if(!z)continue;try{let q=Object.keys(Z),j=Function(...q,`"use strict"; return (${z});`);Z[_]=j(...q.map((H)=>Z[H]))}catch{}}}catch{}}async function E2($,Z,Y,X,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Y.__importedComponents;if(W){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(W.has(O))return!0}let U=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],B=typeof J.root==="string"?o.resolve(J.root):void 0,_=B??o.dirname(X),z=[],q=(O)=>{if(O&&!z.includes(O))z.push(O)},j=Y.__originalFilePath;if(j)q(o.join(o.dirname(j),"components"));q(Z),q(o.join(o.dirname(X),"components")),q(J.componentsDir);let H=J._pluginComponentDirs;if(Array.isArray(H))for(let O of H)q(typeof O==="string"?O:null);if(B)q(o.resolve(B,"resources/views/components")),q(o.resolve(B,"resources/components")),q(o.resolve(B,"src/components")),q(o.resolve(B,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return t(o.resolve(o.dirname(X),`${Q}.stx`));for(let O of z){let F=o.isAbsolute(O)?O:o.resolve(_,O);for(let L of U)if(await t(o.join(F,L)))return!0}return!1}function Aq($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}async function c1($,Z,Y,X,J,Q,G,K=new Set,W){let{extractVariables:U}=await Promise.resolve().then(() => (p$(),WZ)),B=K??new Set;if(B.has($))return`[Circular component reference: ${$}]`;let _=new Set(B);_.add($);let z=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let q=z&&z!=="load"&&Aq(z)?z:"";try{let j=(P)=>P.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),H=(P)=>P.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),O=$.endsWith(".stx")?$.slice(0,-4):$,F=null,L=J.__importedComponents;if(L){let P=[O,O.toLowerCase(),j(O),H(O)];for(let d of P)if(L.has(d)){F=L.get(d);break}}let V=[];if(!F){let P=[`${O}.stx`,`${j(O)}.stx`,`${H(O)}.stx`],d=[...new Set(P)],m=J.__originalFilePath,g=[];if(m){let K0=o.join(o.dirname(m),"components");g.push(K0)}if(X)g.push(X);let c=o.join(o.dirname(Q),"components");if(!g.includes(c))g.push(c);if(G.componentsDir&&G.componentsDir!==X&&!g.includes(G.componentsDir))g.push(G.componentsDir);let a=G._pluginComponentDirs;if(Array.isArray(a)){for(let K0 of a)if(typeof K0==="string"&&!g.includes(K0))g.push(K0)}let l=typeof G.root==="string"?o.resolve(G.root):void 0,Q0=l??o.dirname(Q),R0=[];if(l)R0.push(o.resolve(l,"resources/views/components")),R0.push(o.resolve(l,"resources/components")),R0.push(o.resolve(l,"src/components")),R0.push(o.resolve(l,"components"));R0.push(o.resolve(import.meta.dir,"components"));for(let K0 of R0)if(!g.includes(K0))g.push(K0);let j0=[...new Set(g.map((K0)=>{if(!K0)return K0;return o.isAbsolute(K0)?K0:o.resolve(Q0,K0)}))];if(g.length=0,g.push(...j0),O.startsWith("./")||O.startsWith("../"))F=o.resolve(o.dirname(Q),`${O}.stx`),V.push(F);else for(let K0 of g){if(!K0)continue;for(let r0 of d){let p0=o.join(K0,r0);if(V.push(p0),await t(p0)){F=p0;break}}if(F)break;if(!F)try{let r0=await import("fs");if(!r0.statSync(K0,{throwIfNoEntry:!1})?.isDirectory())continue;let P5=8,G0=[{path:K0,depth:0}];while(G0.length>0&&!F){let k0=G0.pop();if(k0.depth>=P5)continue;let Q4;try{Q4=r0.readdirSync(k0.path,{withFileTypes:!0})}catch{continue}for(let E1 of Q4){if(!E1.isDirectory())continue;if(E1.name==="node_modules"||E1.name.startsWith("."))continue;let O$=o.join(k0.path,E1.name);for(let N0 of d){let $1=o.join(O$,N0);if(V.push($1),await t($1)){F=$1;break}}if(F)break;G0.push({path:O$,depth:k0.depth+1})}}}catch{}if(F)break}}if(!F||!await t(F)){let P=V.length>0?`
12361
12361
  Searched paths:
12362
12362
  ${V.map((d)=>` - ${d}`).join(`
12363
12363
  `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${P}`}W.add(F);let N;if(z6.has(F))N=z6.get(F);else try{N=await Bun.file(F).text(),z6.set(F,N)}catch(P){return`[Error loading component: ${P instanceof Error?P.message:String(P)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),w={};for(let[P,d]of Object.entries(J))if(!P.startsWith("__")||A.has(P))w[P]=d;let R={...w,...Z,props:Z,slot:Y,__processedComponents:_,__sections:{}};xT(N,R);let T=N,I=T.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(I)T=I[1].trim();let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,k=[...N.matchAll(E)],S=[];for(let P of k){let d=P[1]||"",m=P[2]||"",g=d.includes("server");if(R$(d)&&m.trim())m=M$(m);if(g&&m)try{await U(m,R,F)}catch(a){}if(!g){let a=m.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,"");if(a.includes("{{")&&a.includes("}}"))a=U1(a,R,F);let l=d.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");S.push(`<script${l}>${a}</script>`)}}let x=N.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),y=x?x[1]:"",b=x?x[2]:"",f="",r=y&&/\bscoped\b/i.test(y);if(x)f=`<style${y}>${b}</style>`;let u=T;if(u=u.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),x)u=u.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let P=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,d=[];if(u=u.replace(P,(m,g)=>{let c=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(c)d.push(`<style${c[1]}>${c[2]}</style>`);return""}),u=u.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),d.length>0)f=`${f}${d.join(`
12364
- `)}`}if(Y&&u.includes("{{ text || slot }}"))u=u.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{extractSlotContent:C,applySlots:h}=await Promise.resolve().then(() => (z9(),Fq)),{defaultSlot:p,namedSlots:i}=C(Y);u=await h(u,p||Y,i,R);for(let[P,d]of Object.entries(R))if(typeof d==="string"){if(d.includes("<")&&d.includes(">")||d.includes("&lt;")||d.includes("&quot;")){let m=FZ(d);R[P]=m}}let s=S.some((P)=>/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),K0={...G,componentsDir:o.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:s,defaultLayout:void 0};R.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let $0=await X0(u,R,F,K0,W),F0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++bT}_${Math.random().toString(36).slice(2,8)}`,R0=$0;if(s){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${Vq(JSON.stringify(Z))}"`}catch{}let d=q?` stx-hydrate="${Vq(q)}"`:"";if(R0=`<div data-stx-scope="${F0}"${P}${d}>${$0}</div>`,R0=S.map((g)=>{let c=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!c)return g;let[,a,l]=c,Q0=$$(l),M0=`
12364
+ `)}`}if(Y&&u.includes("{{ text || slot }}"))u=u.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{extractSlotContent:C,applySlots:h}=await Promise.resolve().then(() => (z9(),Fq)),{defaultSlot:p,namedSlots:i}=C(Y);u=await h(u,p||Y,i,R);for(let[P,d]of Object.entries(R))if(typeof d==="string"){if(d.includes("<")&&d.includes(">")||d.includes("&lt;")||d.includes("&quot;")){let m=FZ(d);R[P]=m}}let s=S.some((P)=>/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(P)),W0={...G,componentsDir:o.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:s,defaultLayout:void 0};R.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let $0=await X0(u,R,F,W0,W),V0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++bT}_${Math.random().toString(36).slice(2,8)}`,M0=$0;if(s){let P="";if(Object.keys(Z).length>0)try{P=` data-stx-props="${Vq(JSON.stringify(Z))}"`}catch{}let d=q?` stx-hydrate="${Vq(q)}"`:"";if(M0=`<div data-stx-scope="${V0}"${P}${d}>${$0}</div>`,M0=S.map((g)=>{let c=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!c)return g;let[,a,l]=c,Q0=$$(l),R0=`
12365
12365
  (function() {
12366
12366
  const { state, derived, effect, batch, defineEmits, defineExpose, defineSlots, defineProps, withDefaults, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, inject, ref, reactive, computed, watch, watchEffect, nextTick } = window.stx;
12367
12367
  const __scope = window.stx._scopes = window.stx._scopes || {};
12368
- const __scopeVars = __scope['${F0}'] = __scope['${F0}'] || {};
12368
+ const __scopeVars = __scope['${V0}'] = __scope['${V0}'] || {};
12369
12369
 
12370
12370
  // Scope-specific lifecycle callbacks
12371
12371
  __scopeVars.__mountCallbacks = __scopeVars.__mountCallbacks || [];
@@ -12378,20 +12378,20 @@ ${Q0}
12378
12378
  // Register all defined signals and functions in this scope
12379
12379
  const __localVars = {};
12380
12380
  try {
12381
- ${CT(Q0).map((w0)=>`if (typeof ${w0} !== 'undefined') __localVars['${w0}'] = ${w0};`).join(`
12381
+ ${CT(Q0).map((j0)=>`if (typeof ${j0} !== 'undefined') __localVars['${j0}'] = ${j0};`).join(`
12382
12382
  `)}
12383
12383
  }
12384
12384
  catch (e) {}
12385
12385
  Object.assign(__scopeVars, __localVars);
12386
- })();`;if(q)return`<script type="stx/island" data-stx-island="${F0}" data-stx-scoped${a}>${M0}</script>`;return`<script data-stx-scoped${a}>${M0}</script>`}).join(`
12386
+ })();`;if(q)return`<script type="stx/island" data-stx-island="${V0}" data-stx-scoped${a}>${R0}</script>`;return`<script data-stx-scoped${a}>${R0}</script>`}).join(`
12387
12387
  `)+`
12388
- `+R0,f)R0+=`
12389
- `+f}else{if(f)R0+=`
12390
- `+f;if(S.length>0){let P=R.__stx_event_bindings||[],d=A$(R),m=await Promise.all(S.map(async(g)=>{let c=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!c)return g;return await w$(c[1],{eventBindings:P,templateContent:R0,filePath:F,projectRoot:process.cwd(),serverData:d})}));R0+=`
12388
+ `+M0,f)M0+=`
12389
+ `+f}else{if(f)M0+=`
12390
+ `+f;if(S.length>0){let P=R.__stx_event_bindings||[],d=A$(R),m=await Promise.all(S.map(async(g)=>{let c=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!c)return g;return await w$(c[1],{eventBindings:P,templateContent:M0,filePath:F,projectRoot:process.cwd(),serverData:d})}));M0+=`
12391
12391
  `+m.join(`
12392
- `),R.__stx_event_bindings=[]}}if(r){let P=n4(R0,F);if(P.hasScoped)R0=P.html}return R0}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{B.delete($)}}async function t($){return Bun.file($).exists()}function q9($,Z){let Y=o.resolve(Z),X=o.resolve($),J=Y.endsWith(o.sep)?Y:Y+o.sep;if(X===Y||X.startsWith(J))return X;return null}async function f4($,Z,Y,X){let J=await vT($,Z,Y,X);if(J===null)return null;let Q=q9(J,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let W=o.isAbsolute(K)?K:o.resolve(process.cwd(),K);if(q9(J,W))return o.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${$}, from: ${Z})`),null}async function vT($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let J=o.dirname(Z),Q=process.cwd();if($.startsWith("/")){let z=o.join(Q,$),q=q9(z,Q);if(!q)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${q}`);if(await t(q)&&X)X.add(q);return q}let G=o.join(J,$);if(await t(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let z of[".stx",".tsx",".jsx"]){let q=`${G}${z}`;if(await t(q)){if(Y.debug)console.log(`Found direct path with extension: ${q}`);if(X)X.add(q);return q}}let K="",W=o.resolve(J),U=process.cwd();for(let z=0;z<10;z++){let q=o.join(W,"layouts"),j=!1;try{j=ST.statSync(q,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=q;break}let H=o.dirname(W);if(H===W||H.length<U.length)break;W=H}if(K){let z=$.startsWith("layouts/")?$.slice(8):$,q=o.join(K,z);if(await t(q)){if(Y.debug)console.log(`Found in current layouts dir: ${q}`);if(X)X.add(q);return q}if(!z.endsWith(".stx")){let j=`${q}.stx`;if(await t(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let z=o.isAbsolute(Y.layoutsDir)?Y.layoutsDir:o.resolve(process.cwd(),Y.layoutsDir),q=$.startsWith("layouts/")?$.slice(8):$,j=o.join(z,q);if(await t(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await t(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let z=$.split("layouts/"),q=o.join(Y.partialsDir||J,"layouts",z[1]);if(await t(q)){if(Y.debug)console.log(`Found in layouts path: ${q}`);if(X)X.add(q);return q}if(!q.endsWith(".stx")){let j=`${q}.stx`;if(await t(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=o.join(Y.partialsDir,"layouts"),await t(K)){let z=o.join(K,$);if(await t(z)){if(Y.debug)console.log(`Found in partials layouts dir: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let q=`${z}.stx`;if(await t(q)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${q}`);if(X)X.add(q);return q}}}}let B=Y.partialsDir||o.join(process.cwd(),"views"),_=o.join(B,$);if(await t(_)){if(Y.debug)console.log(`Found in views path: ${_}`);if(X)X.add(_);return _}if(!$.endsWith(".stx")){let z=`${_}.stx`;if(await t(z)){if(Y.debug)console.log(`Found in views path with extension: ${z}`);if(X)X.add(z);return z}}if(J.includes("temp")){let z=o.join(o.dirname(J),"layouts",$);if(await t(z)){if(Y.debug)console.log(`Found in temp layouts dir: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let q=`${z}.stx`;if(await t(q)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${q}`);if(X)X.add(q);return q}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function j9($,Z,Y){let X=0,J="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
12392
+ `),R.__stx_event_bindings=[]}}if(r){let P=n4(M0,F);if(P.hasScoped)M0=P.html}return M0}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{B.delete($)}}async function t($){return Bun.file($).exists()}function q9($,Z){let Y=o.resolve(Z),X=o.resolve($),J=Y.endsWith(o.sep)?Y:Y+o.sep;if(X===Y||X.startsWith(J))return X;return null}async function f4($,Z,Y,X){let J=await vT($,Z,Y,X);if(J===null)return null;let Q=q9(J,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let W=o.isAbsolute(K)?K:o.resolve(process.cwd(),K);if(q9(J,W))return o.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${$}, from: ${Z})`),null}async function vT($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let J=o.dirname(Z),Q=process.cwd();if($.startsWith("/")){let z=o.join(Q,$),q=q9(z,Q);if(!q)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${q}`);if(await t(q)&&X)X.add(q);return q}let G=o.join(J,$);if(await t(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let z of[".stx",".tsx",".jsx"]){let q=`${G}${z}`;if(await t(q)){if(Y.debug)console.log(`Found direct path with extension: ${q}`);if(X)X.add(q);return q}}let K="",W=o.resolve(J),U=process.cwd();for(let z=0;z<10;z++){let q=o.join(W,"layouts"),j=!1;try{j=ST.statSync(q,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=q;break}let H=o.dirname(W);if(H===W||H.length<U.length)break;W=H}if(K){let z=$.startsWith("layouts/")?$.slice(8):$,q=o.join(K,z);if(await t(q)){if(Y.debug)console.log(`Found in current layouts dir: ${q}`);if(X)X.add(q);return q}if(!z.endsWith(".stx")){let j=`${q}.stx`;if(await t(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let z=o.isAbsolute(Y.layoutsDir)?Y.layoutsDir:o.resolve(process.cwd(),Y.layoutsDir),q=$.startsWith("layouts/")?$.slice(8):$,j=o.join(z,q);if(await t(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await t(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let z=$.split("layouts/"),q=o.join(Y.partialsDir||J,"layouts",z[1]);if(await t(q)){if(Y.debug)console.log(`Found in layouts path: ${q}`);if(X)X.add(q);return q}if(!q.endsWith(".stx")){let j=`${q}.stx`;if(await t(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=o.join(Y.partialsDir,"layouts"),await t(K)){let z=o.join(K,$);if(await t(z)){if(Y.debug)console.log(`Found in partials layouts dir: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let q=`${z}.stx`;if(await t(q)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${q}`);if(X)X.add(q);return q}}}}let B=Y.partialsDir||o.join(process.cwd(),"views"),_=o.join(B,$);if(await t(_)){if(Y.debug)console.log(`Found in views path: ${_}`);if(X)X.add(_);return _}if(!$.endsWith(".stx")){let z=`${_}.stx`;if(await t(z)){if(Y.debug)console.log(`Found in views path with extension: ${z}`);if(X)X.add(z);return z}}if(J.includes("temp")){let z=o.join(o.dirname(J),"layouts",$);if(await t(z)){if(Y.debug)console.log(`Found in temp layouts dir: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let q=`${z}.stx`;if(await t(q)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${q}`);if(X)X.add(q);return q}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function j9($,Z,Y){let X=0,J="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
12393
12393
  `),K=0;for(let W=0;W<G.length;W++)if(K+=G[W].length+1,K>=Z){X=W+1,J=G[W].trim();let U=Math.max(0,W-2),B=Math.min(G.length,W+3);Q=G.slice(U,B).map((_,z)=>{let q=U+z+1;return`${q===X?"> ":" "}${q}: ${_}`}).join(`
12394
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return j9($,G)}}catch{}return{lineNumber:X,lineContent:J,context:Q}}function L0($,Z,Y,X,J,Q){let{lineNumber:G,context:K}=j9(X,J,Q),W=Y.split("/").pop(),U=0;if(typeof J==="number"&&J>=0&&X){let _=X.lastIndexOf(`
12394
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return j9($,G)}}catch{}return{lineNumber:X,lineContent:J,context:Q}}function F0($,Z,Y,X,J,Q){let{lineNumber:G,context:K}=j9(X,J,Q),W=Y.split("/").pop(),U=0;if(typeof J==="number"&&J>=0&&X){let _=X.lastIndexOf(`
12395
12395
  `,Math.max(0,J-1));U=J-(_+1)+1}let B="";if(G>0)B+=`
12396
12396
  ${Y}:${G}${U>0?`:${U}`:""}: ${$.toLowerCase()} error: ${Z}
12397
12397
  `;if(B+=`
@@ -12404,7 +12404,7 @@ ${U0.yellow}${U0.bold}Message:${U0.reset} ${Z}
12404
12404
  `,K)B+=`
12405
12405
  ${U0.blue}${U0.bold}Context:${U0.reset}
12406
12406
  ${U0.dim}${K}${U0.reset}
12407
- `;return B}function i$(){z6.clear()}function fT(){return{size:z6.size,maxSize:500}}var z6,bT=0,U0;var N0=D(()=>{W5();n0();U5();F1();G5();v8();qq();p$();z6=new N4(500);U0={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"}});function H9(){wq=0,VZ.clear()}function q6($,Z){let Y=wq++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return VZ.set(X,{type:$,expression:Z}),X}function O9(){let $={};for(let[Z,Y]of VZ)$[Z]={type:Y.type,expression:Y.expression};return $}function gT($){let Z={},Y=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=X[1].toLowerCase(),G=VZ.get(J);Z[J]={type:Q,expression:G?.expression||""}}return Z}function NZ($,Z){let Y=$;for(let[X,J]of Z)Y=Y.split(X).join(J);return Y}function y7($){return $.includes("<!--__STX_")}var wq=0,VZ;var j6=D(()=>{VZ=new Map});var _6={};Z0(_6,{usesSignalsInScript:()=>A5,unescapeHtml:()=>FZ,registerFilters:()=>Tq,registerFilter:()=>L9,processExpressions:()=>U1,interpolateScriptsInTemplate:()=>Eq,interpolateScriptExpressions:()=>V9,getAllFilters:()=>F9,evaluateExpression:()=>a0,escapeHtml:()=>E0,defaultFilters:()=>P7,clearCustomFilters:()=>Iq,applyFilters:()=>N9});function hT($){let Z=Rq.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),Rq.set($,Z)}return Z.lastIndex=0,Z}function L9($,Z){if($ in P7)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);H6[$]=Z}function Tq($){for(let[Z,Y]of Object.entries($))L9(Z,Y)}function F9(){return{...P7,...H6}}function Iq(){for(let $ of Object.keys(H6))delete H6[$]}function E0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function A5($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))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 Mq($,Z){let Y=["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"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",Q=!1,G=0;for(let U=0;U<X.length;U++){let B=X[U];if(!Q&&B==="`"){Q=!0,G=0;continue}if(Q){if(B==="`"&&G===0){Q=!1;continue}if(B==="$"&&X[U+1]==="{"){G++,U++;continue}if(B==="}"&&G>0){G--;continue}continue}J+=B}X=J;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,W;while((W=K.exec(X))!==null){let U=W[1];if(!X.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(U)&&!(U in Z))return!1}}return!0}function V9($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=a0(J,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{let Q=J.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=a0(J,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function Eq($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,J,Q)=>{if(/\bsrc\s*=/.test(J))return X;if(/\bdata-raw\b/.test(J))return X;if(/\btype\s*=\s*["']application\/json["']/.test(J))return X;if(Y.skipServer&&/\bserver\b/.test(J))return X;let G=V9(Q,Z);return`<script${J}>${G}</script>`})}function U1($,Z,Y,X){let J=$,Q=(B,_)=>{let z=$U(B,_);if(z===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(_,z))?-1:z},G=(B,_,z,q)=>{let j=z.length,{output:H,tokens:O}=d4(B,_,(F,L)=>q(j+L));return z.push(...O),H},K=[];J=G(J,Q,K,(B)=>`<!--__STX_STYLE_${B}__-->`);let W=[];J=G(J,q8,W,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let U=X?.forceSignals===!0||A5($);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(B,_,z)=>{try{let q=a0(_,Z);return q!==void 0&&q!==null?String(q):""}catch(q){let j=q instanceof Error?q.message:String(q);return L0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${j}`,Y,$,z,B)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(B,_,z)=>{try{let q=a0(_,Z);if(q===void 0&&Z.__stx_buildMode==="compile")return q6("raw",_.trim());return q!==void 0&&q!==null?String(q):""}catch(q){if(Z.__stx_buildMode==="compile")return q6("raw",_.trim());let j=q instanceof Error?q.message:String(q);return L0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${j}`,Y,$,z,B)}}),J=G(J,q8,W,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),J=G(J,Q,K,(B)=>`<!--__STX_STYLE_${B}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(B,_,z)=>{let q=_.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=q.match(H)?.[1],L=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=q.match(V),A=N&&!j.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(q))return"";try{let w=a0(_,Z);if(w===void 0&&U&&!Mq(q,Z))return B;if(w===void 0&&Z.__stx_buildMode==="compile"&&!U)return q6("expr",q);return w!==void 0&&w!==null?E0(String(w)):""}catch(w){if(U&&!Mq(q,Z))return B;if(A)return B;let R=w instanceof Error?w.message:String(w);return L0("Expression",`Error evaluating: {{ ${q} }}: ${R}`,Y,$,z,B)}});for(let B=0;B<W.length;B++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${B}__-->`,()=>W[B]);for(let B=0;B<K.length;B++)J=J.replace(`<!--__STX_STYLE_${B}__-->`,()=>K[B]);return J}function N9($,Z,Y){if(!Z.trim())return $;let X=$,J=Z.trim();while(J.length>0){let Q=J.match(/^(\w+)/);if(!Q)break;let G=Q[1];J=J.substring(G.length).trim();let K=H6[G]||P7[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(F9()).join(", ")}`);let W=[];if(J.startsWith(":")){let U=J.match(/^:([^|\s]+)/);if(U){let B=U[1].trim();try{let _=Number(B);W=[Number.isNaN(_)?B:_]}catch{W=[B]}J=J.substring(U[0].length).trim()}}else if(J.startsWith("(")){let U=1,B=1;while(U>0&&B<J.length){if(J[B]==="(")U++;if(J[B]===")")U--;B++}if(U===0){let _=J.substring(1,B-1).trim();if(_)try{if(_.startsWith("{")&&_.endsWith("}"))W=[a0(`(${_})`,Y,!0)];else{let z=[],q="",j=null,H=0,O=0,F=0,L=!1;for(let V=0;V<_.length;V++){let N=_[V];if(L){q+=N,L=!1;continue}if(N==="\\"){q+=N,L=!0;continue}if(j){if(q+=N,N===j)j=null;continue}if(N==='"'||N==="'"||N==="`"){j=N,q+=N;continue}if(N==="(")H++;else if(N===")")H--;else if(N==="[")O++;else if(N==="]")O--;else if(N==="{")F++;else if(N==="}")F--;if(N===","&&H===0&&O===0&&F===0){z.push(q),q="";continue}q+=N}if(q)z.push(q);W=z.map((V)=>{let N=V.trim();return a0(N,Y,!0)})}}catch{W=[_]}J=J.substring(B).trim()}}try{X=K(X,Y,...W)}catch(U){let B=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${G}': ${B}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return X}function dT($){let Z=!1,Y="",X=0,J=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],U=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&U==="{"){let B=1;K+=2;while(K<$.length&&B>0){if($[K]==="{")B++;else if($[K]==="}")B--;if(B>0)K++}continue}if(Z)continue;if(W==="(")X++;else if(W===")")X--;else if(W==="[")J++;else if(W==="]")J--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&X===0&&J===0&&Q===0){if(U==="|"){K++;continue}if(U==="="){K++;continue}return K}}return-1}function a0($,Z,Y=!1){try{let X=$.trim(),J=dT(X);if(J>0){let Q=X.substring(0,J).trim(),G=X.substring(J+1).trim(),K=a0(Q,Z,!0);return N9(K,G,Z)}if(!H0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return z0(X,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return O0(X,Q)(...G)}catch{return z0(X,Z)}}catch(X){if(X instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(X.message);if(J){let Q=J[1],G=uT(Q,Object.keys(Z));if(G&&G!==Q)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function uT($,Z){let Y=null;for(let J of Z){if(J===$)continue;let Q=mT($,J);if(Y===null||Q<Y.dist)Y={key:J,dist:Q}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function mT($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],J=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)J[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===X[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,J[K]+1,J[K-1]+W)}for(let K=0;K<=Y.length;K++)J[K]=Q[K]}return J[Y.length]}function FZ($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var H6,Rq,P7;var n0=D(()=>{h0();N0();j6();j8();H6={},Rq=new Map;P7={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return E0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,J=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return J?$:"";let K=String(G);return Object.entries(Y).forEach(([W,U])=>{K=K.replace(hT(W),String(U))}),K},t:($,Z,Y={})=>{return P7.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let J=String($);if(J.length<=Y)return J;if(Y<=X.length)return X.substring(0,Y);return J.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let J=$ instanceof Date?$:new Date($);if(Number.isNaN(J.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return J.toISOString();return new Intl.DateTimeFormat(X,Q[Y]||Q.short).format(J)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(J)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let J=Number($);if(Number.isNaN(J))return Y;let Q=X||`${Y}s`;return J===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{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:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let J=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(J,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let J=10**Y;return Math.round(X*J)/J}}});import I0 from"path";function A9($,Z){let Y=0;for(let X=Z;X<$.length;X++){let J=$[X];if(J==="("||J==="["||J==="{")Y++;else if(J===")"||J==="]"||J==="}")Y--;else if(J===","&&Y===0)return X}return-1}function pT($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=J.exec(X);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,U=K+1;while(U<X.length&&W>0){if(X[U]==="(")W++;else if(X[U]===")")W--;U++}if(W!==0)break;let B=X.substring(K+1,U-1),_=`${Y}(${B})`;X=X.substring(0,G)+_+X.substring(U),J.lastIndex=G+_.length,Q=J.exec(X)}return X}function cT($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function lT($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K=(_)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===_){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let _=1;while(Q<G&&_>0)if(Z[Q]==="{")_++,Q++;else if(Z[Q]==="}")_--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},U=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
12407
+ `;return B}function i$(){z6.clear()}function fT(){return{size:z6.size,maxSize:500}}var z6,bT=0,U0;var A0=D(()=>{W5();n0();U5();F1();G5();v8();qq();p$();z6=new N4(500);U0={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"}});function H9(){wq=0,VZ.clear()}function q6($,Z){let Y=wq++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return VZ.set(X,{type:$,expression:Z}),X}function O9(){let $={};for(let[Z,Y]of VZ)$[Z]={type:Y.type,expression:Y.expression};return $}function gT($){let Z={},Y=/<!--__STX_(EXPR|COND|RAW)_(\d+)__-->/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=X[1].toLowerCase(),G=VZ.get(J);Z[J]={type:Q,expression:G?.expression||""}}return Z}function NZ($,Z){let Y=$;for(let[X,J]of Z)Y=Y.split(X).join(J);return Y}function y7($){return $.includes("<!--__STX_")}var wq=0,VZ;var j6=D(()=>{VZ=new Map});var _6={};Z0(_6,{usesSignalsInScript:()=>A5,unescapeHtml:()=>FZ,registerFilters:()=>Tq,registerFilter:()=>L9,processExpressions:()=>U1,interpolateScriptsInTemplate:()=>Eq,interpolateScriptExpressions:()=>V9,getAllFilters:()=>F9,evaluateExpression:()=>a0,escapeHtml:()=>E0,defaultFilters:()=>P7,clearCustomFilters:()=>Iq,applyFilters:()=>N9});function hT($){let Z=Rq.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),Rq.set($,Z)}return Z.lastIndex=0,Z}function L9($,Z){if($ in P7)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);H6[$]=Z}function Tq($){for(let[Z,Y]of Object.entries($))L9(Z,Y)}function F9(){return{...P7,...H6}}function Iq(){for(let $ of Object.keys(H6))delete H6[$]}function E0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function A5($){let Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y;while((Y=Z.exec($))!==null){let X=Y[1];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(X))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 Mq($,Z){let Y=["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"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",Q=!1,G=0;for(let U=0;U<X.length;U++){let B=X[U];if(!Q&&B==="`"){Q=!0,G=0;continue}if(Q){if(B==="`"&&G===0){Q=!1;continue}if(B==="$"&&X[U+1]==="{"){G++,U++;continue}if(B==="}"&&G>0){G--;continue}continue}J+=B}X=J;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,W;while((W=K.exec(X))!==null){let U=W[1];if(!X.substring(0,W.index).trimEnd().endsWith(".")){if(!Y.includes(U)&&!(U in Z))return!1}}return!0}function V9($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=a0(J,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{let Q=J.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=a0(J,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function Eq($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,J,Q)=>{if(/\bsrc\s*=/.test(J))return X;if(/\bdata-raw\b/.test(J))return X;if(/\btype\s*=\s*["']application\/json["']/.test(J))return X;if(Y.skipServer&&/\bserver\b/.test(J))return X;let G=V9(Q,Z);return`<script${J}>${G}</script>`})}function U1($,Z,Y,X){let J=$,Q=(B,_)=>{let z=$U(B,_);if(z===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(_,z))?-1:z},G=(B,_,z,q)=>{let j=z.length,{output:H,tokens:O}=d4(B,_,(F,L)=>q(j+L));return z.push(...O),H},K=[];J=G(J,Q,K,(B)=>`<!--__STX_STYLE_${B}__-->`);let W=[];J=G(J,q8,W,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let U=X?.forceSignals===!0||A5($);J=J.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(B,_,z)=>{try{let q=a0(_,Z);return q!==void 0&&q!==null?String(q):""}catch(q){let j=q instanceof Error?q.message:String(q);return F0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${j}`,Y,$,z,B)}}),J=J.replace(/\{!!([\s\S]*?)!!\}/g,(B,_,z)=>{try{let q=a0(_,Z);if(q===void 0&&Z.__stx_buildMode==="compile")return q6("raw",_.trim());return q!==void 0&&q!==null?String(q):""}catch(q){if(Z.__stx_buildMode==="compile")return q6("raw",_.trim());let j=q instanceof Error?q.message:String(q);return F0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${j}`,Y,$,z,B)}}),J=G(J,q8,W,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),J=G(J,Q,K,(B)=>`<!--__STX_STYLE_${B}__-->`),J=J.replace(/\{\{([\s\S]*?)\}\}/g,(B,_,z)=>{let q=_.trim(),j=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,F=q.match(H)?.[1],L=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=q.match(V),A=N&&!j.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(q))return"";try{let w=a0(_,Z);if(w===void 0&&U&&!Mq(q,Z))return B;if(w===void 0&&Z.__stx_buildMode==="compile"&&!U)return q6("expr",q);return w!==void 0&&w!==null?E0(String(w)):""}catch(w){if(U&&!Mq(q,Z))return B;if(A)return B;let R=w instanceof Error?w.message:String(w);return F0("Expression",`Error evaluating: {{ ${q} }}: ${R}`,Y,$,z,B)}});for(let B=0;B<W.length;B++)J=J.replace(`<!--__STX_SCRIPT_EXPR_${B}__-->`,()=>W[B]);for(let B=0;B<K.length;B++)J=J.replace(`<!--__STX_STYLE_${B}__-->`,()=>K[B]);return J}function N9($,Z,Y){if(!Z.trim())return $;let X=$,J=Z.trim();while(J.length>0){let Q=J.match(/^(\w+)/);if(!Q)break;let G=Q[1];J=J.substring(G.length).trim();let K=H6[G]||P7[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(F9()).join(", ")}`);let W=[];if(J.startsWith(":")){let U=J.match(/^:([^|\s]+)/);if(U){let B=U[1].trim();try{let _=Number(B);W=[Number.isNaN(_)?B:_]}catch{W=[B]}J=J.substring(U[0].length).trim()}}else if(J.startsWith("(")){let U=1,B=1;while(U>0&&B<J.length){if(J[B]==="(")U++;if(J[B]===")")U--;B++}if(U===0){let _=J.substring(1,B-1).trim();if(_)try{if(_.startsWith("{")&&_.endsWith("}"))W=[a0(`(${_})`,Y,!0)];else{let z=[],q="",j=null,H=0,O=0,F=0,L=!1;for(let V=0;V<_.length;V++){let N=_[V];if(L){q+=N,L=!1;continue}if(N==="\\"){q+=N,L=!0;continue}if(j){if(q+=N,N===j)j=null;continue}if(N==='"'||N==="'"||N==="`"){j=N,q+=N;continue}if(N==="(")H++;else if(N===")")H--;else if(N==="[")O++;else if(N==="]")O--;else if(N==="{")F++;else if(N==="}")F--;if(N===","&&H===0&&O===0&&F===0){z.push(q),q="";continue}q+=N}if(q)z.push(q);W=z.map((V)=>{let N=V.trim();return a0(N,Y,!0)})}}catch{W=[_]}J=J.substring(B).trim()}}try{X=K(X,Y,...W)}catch(U){let B=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${G}': ${B}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return X}function dT($){let Z=!1,Y="",X=0,J=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let W=$[K],U=$[K+1];if(Z&&G){G=!1;continue}if(Z&&W==="\\"){G=!0;continue}if(G=!1,(W==='"'||W==="'"||W==="`")&&!G){if(!Z)Z=!0,Y=W;else if(W===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&W==="$"&&U==="{"){let B=1;K+=2;while(K<$.length&&B>0){if($[K]==="{")B++;else if($[K]==="}")B--;if(B>0)K++}continue}if(Z)continue;if(W==="(")X++;else if(W===")")X--;else if(W==="[")J++;else if(W==="]")J--;else if(W==="{")Q++;else if(W==="}")Q--;if(W==="|"&&X===0&&J===0&&Q===0){if(U==="|"){K++;continue}if(U==="="){K++;continue}return K}}return-1}function a0($,Z,Y=!1){try{let X=$.trim(),J=dT(X);if(J>0){let Q=X.substring(0,J).trim(),G=X.substring(J+1).trim(),K=a0(Q,Z,!0);return N9(K,G,Z)}if(!O0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return z0(X,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return L0(X,Q)(...G)}catch{return z0(X,Z)}}catch(X){if(X instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(X.message);if(J){let Q=J[1],G=uT(Q,Object.keys(Z));if(G&&G!==Q)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function uT($,Z){let Y=null;for(let J of Z){if(J===$)continue;let Q=mT($,J);if(Y===null||Q<Y.dist)Y={key:J,dist:Q}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function mT($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],J=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)J[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let W=Y[K-1]===X[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,J[K]+1,J[K-1]+W)}for(let K=0;K<=Y.length;K++)J[K]=Q[K]}return J[Y.length]}function FZ($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var H6,Rq,P7;var n0=D(()=>{h0();A0();j6();j8();H6={},Rq=new Map;P7={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return E0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,J=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let W of Q){if(G===void 0||G===null)break;G=G[W]}if(G===void 0||G===null)return J?$:"";let K=String(G);return Object.entries(Y).forEach(([W,U])=>{K=K.replace(hT(W),String(U))}),K},t:($,Z,Y={})=>{return P7.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let J=String($);if(J.length<=Y)return J;if(Y<=X.length)return X.substring(0,Y);return J.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let J=$ instanceof Date?$:new Date($);if(Number.isNaN(J.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return J.toISOString();return new Intl.DateTimeFormat(X,Q[Y]||Q.short).format(J)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(J)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let J=Number($);if(Number.isNaN(J))return Y;let Q=X||`${Y}s`;return J===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{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:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let J=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(J,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let J=10**Y;return Math.round(X*J)/J}}});import I0 from"path";function A9($,Z){let Y=0;for(let X=Z;X<$.length;X++){let J=$[X];if(J==="("||J==="["||J==="{")Y++;else if(J===")"||J==="]"||J==="}")Y--;else if(J===","&&Y===0)return X}return-1}function pT($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=J.exec(X);while(Q){let G=Q.index,K=G+Q[0].length-1,W=1,U=K+1;while(U<X.length&&W>0){if(X[U]==="(")W++;else if(X[U]===")")W--;U++}if(W!==0)break;let B=X.substring(K+1,U-1),_=`${Y}(${B})`;X=X.substring(0,G)+_+X.substring(U),J.lastIndex=G+_.length,Q=J.exec(X)}return X}function cT($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function lT($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K=(_)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===_){Q++;return}Q++}},W=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let _=1;while(Q<G&&_>0)if(Z[Q]==="{")_++,Q++;else if(Z[Q]==="}")_--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")W();else Q++;continue}Q++}},U=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
12408
12408
  `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},B=()=>{if(J!==0)return;let _=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(_){let j=_[2];if(!X.has(j))Y.push(j),X.add(j);return}let z=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let j=z[1];if(!X.has(j))Y.push(j),X.add(j);return}let q=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(q){let j=q[1];if(!X.has(j))Y.push(j),X.add(j)}};while(Q<G){if(U())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){W();continue}if(Z[Q]==="{"){J++,Q++;continue}if(Z[Q]==="}"){J--,Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))B();Q++}return Y.join(", ")}function kq($,Z=""){return`
12409
12409
  (function() {
12410
12410
  var { state, derived, effect, batch, onMount, onDestroy, defineStore, useStore, useFetch, useRef, useQuery, useMutation, useOptimistic, useDebounce, useDebouncedValue, useThrottle, useInterval, useTimeout, useToggle, useCounter, useClickOutside, useFocus, useAsync, useLocalStorage, useSessionStorage, useCookie, useReactiveProp, useEventListener, useWebSocket, useColorMode, useDark, useHead, useSeoMeta, definePageMeta, useRoute, useSearchParams, navigate, goBack, goForward, provide, ref, reactive, computed, watch, watchEffect, defineProps, withDefaults, defineEmits, defineExpose, defineSlots } = window.stx;
@@ -12439,15 +12439,15 @@ ${lT($).split(",").map((W)=>W.trim()).filter(Boolean).map((W)=>` try { __scopeR
12439
12439
  } finally {
12440
12440
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
12441
12441
  }
12442
- })();`}function nT($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let J=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function sT(){w9.clear()}function rT($){if($.__onceStore instanceof Set)return $.__onceStore;return w9}async function LZ($,Z,Y,X,J,Q=new Set){let G=X.partialsDir||I0.join(I0.dirname(Y),"partials");if(G&&!I0.isAbsolute(G))G=I0.resolve(process.cwd(),G);let K=pT($,"@partial","@include"),W=rT(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,O)=>{let F=H.trim(),L=`${Y}:${F}`;if(W.has(L))return"";return W.add(L),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,F=O+H[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let N=K.substring(F+1,V-1),A=N.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let w=A[1],R=U(w,G,Y),T="";if(R&&await Bun.file(R).exists())J.add(R),T=`@include(${N})`;K=K.substring(0,O)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(K))!==null){let L=F.index,V=L+F[0].length-1,N=1,A=V+1;while(A<K.length&&N>0){if(K[A]==="(")N++;else if(K[A]===")")N--;A++}if(N!==0)break;let w=K.substring(V+1,A-1),R=A9(w,0);if(R===-1){O.lastIndex=A;continue}let T=w.substring(0,R).trim(),I=w.substring(R+1).trim(),E=I.match(/^\s*['"]([^'"]+)['"]/);if(!E){O.lastIndex=A;continue}let k=E[1],S=I.substring(E[0].length),x,y=A9(S,0);if(y!==-1)x=S.substring(y+1).trim();try{let b=`Boolean(${T})`,f;if(H0(b)){let C=O0(b,Object.keys(Z));f=Boolean(C(...Object.values(Z)))}else f=Boolean(z0(b,Z));let r=H?!f:f,u="";if(r){let C=U(k,G,Y);if(C&&await Bun.file(C).exists())J.add(C);u=`@include('${k}'${x?`, ${x}`:""})`}K=K.substring(0,L)+u+K.substring(A),O.lastIndex=0}catch(b){let f=b instanceof Error?b.message:String(b),r=L0("Include",`Error evaluating ${j} condition: ${f}`,Y,$,L);K=K.substring(0,L)+r+K.substring(A),O.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,F=O+H[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let N=K.substring(F+1,V),A=K.substring(O,V+1),w=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!w){j.lastIndex=0,K=K.replace(A,"");continue}let[,R,T,I,E]=w;try{let k,S=T.trim();if(H0(S))k=O0(S,Object.keys(Z))(...Object.values(Z));else k=z0(S,Z);let x="";if(Array.isArray(k)&&k.length>0)for(let y of k){let b={...Z,[I]:y},f=await _(R,b,$,O);x+=f}else if(E)x=await _(E,{},$,O);K=K.substring(0,O)+x+K.substring(V+1),j.lastIndex=0}catch(k){let S=k instanceof Error?k.message:String(k);K=K.substring(0,O)+L0("Each",`Error in @each: ${S}`,Y,$,O)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,F=O+H[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let N=K.substring(F+1,V),A=K.substring(O,V+1),w=N.match(/^\s*(\[[^\]]+\])/);if(!w){j.lastIndex=0,K=K.replace(A,"");continue}let R=w[1],T=N.slice(w[0].length),I,E=T.match(/^\s*,\s*\{/);if(E){T=T.slice(E[0].length-1);let x=1,y=1;while(y<T.length&&x>0){if(T[y]==="{")x++;else if(T[y]==="}"){if(x--,x===0)break}y++}I=T.substring(0,y+1),T=T.slice(y+1)}let k,S=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(S)k=S[1];try{let x=JSON.parse(R.replace(/'/g,'"')),y={};if(I)try{y=y0(I,Z)}catch(f){let r=f instanceof Error?f.message:String(f);if(X.debug){let u=L0("Include",`Error parsing includeFirst variables: ${r}`,Y,$,O,A);K=K.replace(A,()=>u)}else K=K.replace(A,()=>k||"");continue}let b=!1;for(let f of x){let r=U(f,G,Y);if(!r)continue;if(await t(r)){let u=await _(f,y,$,O);K=K.replace(A,()=>u),b=!0;break}}if(!b)if(k!==void 0)K=K.replace(A,()=>k);else if(X.debug){let f=L0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,O,A);K=K.replace(A,()=>f)}else K=K.replace(A,"")}catch(x){let y=x instanceof Error?x.message:String(x),b=L0("Include",`Error processing @includeFirst: ${y}`,Y,$,O,A);K=K.replace(A,()=>b)}j.lastIndex=0}}function U(j,H,O){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let L=I0.resolve(H),V=I0.resolve(I0.dirname(O)),N;if(!F.startsWith("./")&&!F.startsWith("../"))N=I0.resolve(H,F);else N=I0.resolve(V,F);let A=I0.normalize(N),w=A.startsWith(L+I0.sep)||A===L,R=A.startsWith(V+I0.sep)||A===V,T=!1,I=I0.dirname(V);if(A.startsWith(I+I0.sep)){if(!I0.relative(I,A).split(I0.sep).some((x)=>x.startsWith(".")&&x!=="."&&x!==".."))T=!0}if(!w&&!R&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${L}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let B=I0.resolve(Y);Q.add(B);async function _(j,H={},O,F){let L=U(j,G,Y);if(!L)return L0("Include",`Could not resolve path for include: ${j}`,Y,O,F);let V=I0.resolve(L);if(Q.has(V)){let N=[...Q,V].map((A)=>I0.basename(A)).join(" -> ");return L0("Include",`Circular include detected: ${N}`,Y,O,F)}try{J.add(L);let N;if(!N)try{N=await Bun.file(L).text()}catch(u){let C=u instanceof Error?u.message:String(u);return L0("Include",`Error loading include file ${j}: ${C}`,Y,O,F)}if(N&&N.includes("@stream")){let{processStreamDirectives:u}=await Promise.resolve().then(() => (c$(),F5));N=u(N,Z)}if(N&&(X.debug||!f5()&&!B4()))try{let{warnUnbalancedTags:u}=await Promise.resolve().then(() => (C2(),A_));u(N,L)}catch{}let A=N;try{let{processESImports:u}=await Promise.resolve().then(() => (I2(),__));await u(N,Z,L,X,J)}catch(u){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,u instanceof Error?u.message:u)}let w=A.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(w)A=w[1].trim();let T=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(T)I=`<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 E={...Z};for(let[u,C]of Object.entries(H))E[u]=C;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...N.matchAll(k)],x="",y=null;for(let u of S){let C=u[1]||"",h=u[2]||"",p=C.includes("server"),i=R$(C),s="";try{let{extractAndStripCssImports:$0,renderVendorStyleTags:F0}=await Promise.resolve().then(() => (W5(),fK)),R0=$0(h,{filePath:L,projectRoot:process.cwd()});h=R0.code,s=F0(R0.styles)}catch($0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,$0 instanceof Error?$0.message:$0)}if(i&&h.trim())h=M$(h);if(!p)try{let{hasUserImports:$0,bundleClientScript:F0}=await Promise.resolve().then(() => (T3(),M3));if($0(h))h=await F0(h,L,{projectRoot:process.cwd()})}catch($0){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,$0 instanceof Error?$0.message:$0)}let K0=cT(h);if(K0&&!p){y=`stx_scope_${I0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Dq}`;let $0=$$(h),F0=iT($0,y);x+=`${s}<script data-stx-scoped>${F0}</script>
12443
- `;continue}if(p)try{let{extractVariables:$0}=await Promise.resolve().then(() => (p$(),WZ));await $0(h,E,L)}catch($0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,$0)}if(!p&&!K0){let $0=C.replace(/\bclient\b/i,"").trim();y=`stx_scope_${I0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Dq}`;let F0=$$(h),R0=`
12442
+ })();`}function nT($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let J=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function sT(){w9.clear()}function rT($){if($.__onceStore instanceof Set)return $.__onceStore;return w9}async function LZ($,Z,Y,X,J,Q=new Set){let G=X.partialsDir||I0.join(I0.dirname(Y),"partials");if(G&&!I0.isAbsolute(G))G=I0.resolve(process.cwd(),G);let K=pT($,"@partial","@include"),W=rT(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,O)=>{let F=H.trim(),L=`${Y}:${F}`;if(W.has(L))return"";return W.add(L),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,F=O+H[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let N=K.substring(F+1,V-1),A=N.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let w=A[1],R=U(w,G,Y),T="";if(R&&await Bun.file(R).exists())J.add(R),T=`@include(${N})`;K=K.substring(0,O)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(K))!==null){let L=F.index,V=L+F[0].length-1,N=1,A=V+1;while(A<K.length&&N>0){if(K[A]==="(")N++;else if(K[A]===")")N--;A++}if(N!==0)break;let w=K.substring(V+1,A-1),R=A9(w,0);if(R===-1){O.lastIndex=A;continue}let T=w.substring(0,R).trim(),I=w.substring(R+1).trim(),E=I.match(/^\s*['"]([^'"]+)['"]/);if(!E){O.lastIndex=A;continue}let k=E[1],S=I.substring(E[0].length),x,y=A9(S,0);if(y!==-1)x=S.substring(y+1).trim();try{let b=`Boolean(${T})`,f;if(O0(b)){let C=L0(b,Object.keys(Z));f=Boolean(C(...Object.values(Z)))}else f=Boolean(z0(b,Z));let r=H?!f:f,u="";if(r){let C=U(k,G,Y);if(C&&await Bun.file(C).exists())J.add(C);u=`@include('${k}'${x?`, ${x}`:""})`}K=K.substring(0,L)+u+K.substring(A),O.lastIndex=0}catch(b){let f=b instanceof Error?b.message:String(b),r=F0("Include",`Error evaluating ${j} condition: ${f}`,Y,$,L);K=K.substring(0,L)+r+K.substring(A),O.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,F=O+H[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let N=K.substring(F+1,V),A=K.substring(O,V+1),w=N.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!w){j.lastIndex=0,K=K.replace(A,"");continue}let[,R,T,I,E]=w;try{let k,S=T.trim();if(O0(S))k=L0(S,Object.keys(Z))(...Object.values(Z));else k=z0(S,Z);let x="";if(Array.isArray(k)&&k.length>0)for(let y of k){let b={...Z,[I]:y},f=await _(R,b,$,O);x+=f}else if(E)x=await _(E,{},$,O);K=K.substring(0,O)+x+K.substring(V+1),j.lastIndex=0}catch(k){let S=k instanceof Error?k.message:String(k);K=K.substring(0,O)+F0("Each",`Error in @each: ${S}`,Y,$,O)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let O=H.index,F=O+H[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let N=K.substring(F+1,V),A=K.substring(O,V+1),w=N.match(/^\s*(\[[^\]]+\])/);if(!w){j.lastIndex=0,K=K.replace(A,"");continue}let R=w[1],T=N.slice(w[0].length),I,E=T.match(/^\s*,\s*\{/);if(E){T=T.slice(E[0].length-1);let x=1,y=1;while(y<T.length&&x>0){if(T[y]==="{")x++;else if(T[y]==="}"){if(x--,x===0)break}y++}I=T.substring(0,y+1),T=T.slice(y+1)}let k,S=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(S)k=S[1];try{let x=JSON.parse(R.replace(/'/g,'"')),y={};if(I)try{y=y0(I,Z)}catch(f){let r=f instanceof Error?f.message:String(f);if(X.debug){let u=F0("Include",`Error parsing includeFirst variables: ${r}`,Y,$,O,A);K=K.replace(A,()=>u)}else K=K.replace(A,()=>k||"");continue}let b=!1;for(let f of x){let r=U(f,G,Y);if(!r)continue;if(await t(r)){let u=await _(f,y,$,O);K=K.replace(A,()=>u),b=!0;break}}if(!b)if(k!==void 0)K=K.replace(A,()=>k);else if(X.debug){let f=F0("Include",`None of the includeFirst paths exist: ${R}`,Y,$,O,A);K=K.replace(A,()=>f)}else K=K.replace(A,"")}catch(x){let y=x instanceof Error?x.message:String(x),b=F0("Include",`Error processing @includeFirst: ${y}`,Y,$,O,A);K=K.replace(A,()=>b)}j.lastIndex=0}}function U(j,H,O){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let L=I0.resolve(H),V=I0.resolve(I0.dirname(O)),N;if(!F.startsWith("./")&&!F.startsWith("../"))N=I0.resolve(H,F);else N=I0.resolve(V,F);let A=I0.normalize(N),w=A.startsWith(L+I0.sep)||A===L,R=A.startsWith(V+I0.sep)||A===V,T=!1,I=I0.dirname(V);if(A.startsWith(I+I0.sep)){if(!I0.relative(I,A).split(I0.sep).some((x)=>x.startsWith(".")&&x!=="."&&x!==".."))T=!0}if(!w&&!R&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${L}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let B=I0.resolve(Y);Q.add(B);async function _(j,H={},O,F){let L=U(j,G,Y);if(!L)return F0("Include",`Could not resolve path for include: ${j}`,Y,O,F);let V=I0.resolve(L);if(Q.has(V)){let N=[...Q,V].map((A)=>I0.basename(A)).join(" -> ");return F0("Include",`Circular include detected: ${N}`,Y,O,F)}try{J.add(L);let N;if(!N)try{N=await Bun.file(L).text()}catch(u){let C=u instanceof Error?u.message:String(u);return F0("Include",`Error loading include file ${j}: ${C}`,Y,O,F)}if(N&&N.includes("@stream")){let{processStreamDirectives:u}=await Promise.resolve().then(() => (c$(),F5));N=u(N,Z)}if(N&&(X.debug||!f5()&&!B4()))try{let{warnUnbalancedTags:u}=await Promise.resolve().then(() => (C2(),A_));u(N,L)}catch{}let A=N;try{let{processESImports:u}=await Promise.resolve().then(() => (I2(),__));await u(N,Z,L,X,J)}catch(u){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,u instanceof Error?u.message:u)}let w=A.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(w)A=w[1].trim();let T=N.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(T)I=`<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 E={...Z};for(let[u,C]of Object.entries(H))E[u]=C;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...N.matchAll(k)],x="",y=null;for(let u of S){let C=u[1]||"",h=u[2]||"",p=C.includes("server"),i=R$(C),s="";try{let{extractAndStripCssImports:$0,renderVendorStyleTags:V0}=await Promise.resolve().then(() => (W5(),fK)),M0=$0(h,{filePath:L,projectRoot:process.cwd()});h=M0.code,s=V0(M0.styles)}catch($0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,$0 instanceof Error?$0.message:$0)}if(i&&h.trim())h=M$(h);if(!p)try{let{hasUserImports:$0,bundleClientScript:V0}=await Promise.resolve().then(() => (T3(),M3));if($0(h))h=await V0(h,L,{projectRoot:process.cwd()})}catch($0){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,$0 instanceof Error?$0.message:$0)}let W0=cT(h);if(W0&&!p){y=`stx_scope_${I0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Dq}`;let $0=$$(h),V0=iT($0,y);x+=`${s}<script data-stx-scoped>${V0}</script>
12443
+ `;continue}if(p)try{let{extractVariables:$0}=await Promise.resolve().then(() => (p$(),WZ));await $0(h,E,L)}catch($0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,$0)}if(!p&&!W0){let $0=C.replace(/\bclient\b/i,"").trim();y=`stx_scope_${I0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++Dq}`;let V0=$$(h),M0=`
12444
12444
  if (!window.stx._scopes) window.stx._scopes = {};
12445
12445
  window.stx._scopes['${y}'] = { __destroyCallbacks: __destroyHooks };
12446
- `,P=kq(F0,R0);x+=`${s}<script data-stx-scoped${$0?` ${$0}`:""}>${P}</script>
12446
+ `,P=kq(V0,M0);x+=`${s}<script data-stx-scoped${$0?` ${$0}`:""}>${P}</script>
12447
12447
  `}}if(y){let u=nT(A,y);if(A=u.html,u.mergedIntoExisting)x=x.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${u.mergedIntoExisting}']`),y=u.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await LZ(A,E,L,X,J,Q);let{processLoops:b}=await Promise.resolve().then(() => (y8(),WB)),f=b(A,E,L);f=Q5(f,E,L);let r=A5(N);if(f=U1(f,E,L,{forceSignals:r}),I)f+=`
12448
12448
  `+I;if(x)f+=`
12449
- `+x;return f}catch(N){let A=N instanceof Error?N.message:String(N);return L0("Include",`Error processing include ${j}: ${A}`,Y,O,F)}}let z=/@include\s*\(/g,q;while((q=z.exec(K))!==null){let j=q.index,H=j+q[0].length-1,O=1,F=H+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let L=K.substring(j,F),V=K.substring(H+1,F-1),N=V.match(/^\s*['"]([^'"]+)['"]/);if(!N){z.lastIndex=F;continue}let A=N[1],w,R=V.substring(N[0].length),T=A9(R,0);if(T!==-1)w=R.substring(T+1).trim();let I={};if(w)try{I=y0(w,Z)}catch(k){let S=k instanceof Error?k.message:String(k);K=K.replace(L,L0("Include",`Error parsing include variables for ${A}: ${S}`,Y,$,j)),z.lastIndex=0;continue}let E=await _(A,I,$,j);K=K.substring(0,j)+E+K.substring(F),z.lastIndex=0}return K}function HZ($,Z){let Y=$;function X(J,Q,G,K){let W=J,U=!0;while(U){U=!1;let B=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),_=W.match(B);if(!_||_.index===void 0)break;let z=_.index,q=_[1],j=z+_[0].length,H=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),F=1,L=j,V=-1;while(F>0&&L<W.length){let A=W.slice(L),w=A.match(H),R=A.match(O),T=w?L+w.index:1/0,I=R?L+R.index:1/0;if(T<I)F++,L=T+(w[0].length||1);else if(I<1/0){if(F--,F===0){V=I;break}L=I+G.length+1}else break}if(V===-1)break;let N=W.slice(j,V);if(!Z[q])Z[q]=[];if(K)Z[q].unshift(N);else Z[q].push(N);W=W.substring(0,z)+W.substring(V+`@${G}`.length),U=!0}return W}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function OZ($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
12450
- `)})}var Dq=0,n$,w9;var C7=D(()=>{R3();n0();U5();h0();N0();n$=new N4(500),w9=new Set});function AZ($){let{token:Z,baseUrl:Y="https://api.netlify.com/api/v1"}=$;async function X(J,Q,G={}){let K=`${Y}${Q}`,W={Authorization:`Bearer ${Z}`,"User-Agent":"stx-deploy/1.0"},U;if(G.rawBody)W["Content-Type"]=G.contentType||"application/octet-stream",U=G.rawBody;else if(G.body)W["Content-Type"]="application/json",U=JSON.stringify(G.body);let B=await fetch(K,{method:J,headers:W,body:U});if(!B.ok){let z=Error(`Netlify API error: ${B.status} ${B.statusText}`);z.status=B.status;try{let q=await B.json();z.message=q.message||z.message,z.code=q.code,z.details=q}catch{}throw z}let _=await B.text();if(!_)return{};return JSON.parse(_)}return{async getSite(J){return X("GET",`/sites/${J}`)},async listSites(){return X("GET","/sites")},async createSite(J){let Q={};if(J)Q.name=J;return X("POST","/sites",{body:Q})},async createDeploy(J,Q){let G={files:Q.files,draft:Q.draft??!0,async:Q.async??!0};if(Q.title)G.title=Q.title;if(Q.branch)G.branch=Q.branch;if(Q.functions)G.functions=Q.functions;return X("POST",`/sites/${J}/deploys`,{body:G})},async uploadFile(J,Q,G){let K=Q.startsWith("/")?Q.slice(1):Q;await X("PUT",`/deploys/${J}/files/${K}`,{rawBody:G,contentType:"application/octet-stream"})},async uploadFiles(J,Q){let K=[...Q],W=async()=>{while(K.length>0){let B=K.shift();if(B)await this.uploadFile(J,B.path,B.content)}},U=Array.from({length:Math.min(5,Q.length)},()=>W());await Promise.all(U)},async getDeploy(J){return X("GET",`/deploys/${J}`)},async waitForDeploy(J,Q={}){let{timeout:G=300000,pollInterval:K=2000,onProgress:W}=Q,U=Date.now();while(!0){let B=await this.getDeploy(J);if(W)W(B);if(B.state==="ready")return B;if(B.state==="error"){let _=Error(`Deploy failed: ${B.error_message||"Unknown error"}`);throw _.status=500,_.details=B,_}if(Date.now()-U>G){let _=Error(`Deploy timed out after ${G}ms`);throw _.status=408,_.details=B,_}await new Promise((_)=>setTimeout(_,K))}},async lockDeploy(J){return X("POST",`/deploys/${J}/lock`)},async unlockDeploy(J){return X("POST",`/deploys/${J}/unlock`)}}}async function R9($){let Z=await crypto.subtle.digest("SHA-1",$);return Array.from(new Uint8Array(Z)).map((X)=>X.toString(16).padStart(2,"0")).join("")}async function O6($,Z={}){let{ignore:Y=["node_modules",".git",".env*","*.map"]}=Z,X=[],J=new Bun.Glob("**/*");for await(let Q of J.scan({cwd:$,onlyFiles:!0,dot:!1})){if(Y.some((_)=>{if(_.includes("*"))return new RegExp(`^${_.replace(/\*/g,".*")}$`).test(Q);return Q.includes(_)}))continue;let K=`${$}/${Q}`,U=await Bun.file(K).arrayBuffer(),B=await R9(U);X.push({path:Q,content:new Uint8Array(U),sha1:B})}return X}function wZ($){let Z={};for(let Y of $)Z[`/${Y.path}`]=Y.sha1;return Z}function RZ($,Z){let Y=new Set(Z.map((X)=>X.startsWith("/")?X.slice(1):X));return $.filter((X)=>Y.has(X.path))}function w5($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;if($<1073741824)return`${($/1048576).toFixed(1)} MB`;return`${($/1073741824).toFixed(1)} GB`}function s$($){return $.reduce((Z,Y)=>Z+Y.content.byteLength,0)}import K$ from"fs";import i1 from"path";function M9($){let Z=[];if(Z.push("[build]"),Z.push(` command = "${u0($.build.command)}"`),Z.push(` publish = "${u0($.build.publish)}"`),$.build.functions)Z.push(` functions = "${u0($.build.functions)}"`);if($.build.edge_functions)Z.push(` edge_functions = "${u0($.build.edge_functions)}"`);if($.build.environment&&Object.keys($.build.environment).length>0){Z.push(""),Z.push("[build.environment]");for(let[Y,X]of Object.entries($.build.environment))Z.push(` ${Y} = "${u0(X)}"`)}if($.functions){if(Z.push(""),Z.push("[functions]"),$.functions.directory)Z.push(` directory = "${u0($.functions.directory)}"`);if($.functions.node_bundler)Z.push(` node_bundler = "${$.functions.node_bundler}"`);if($.functions.external_node_modules&&$.functions.external_node_modules.length>0)Z.push(` external_node_modules = [${$.functions.external_node_modules.map((Y)=>`"${Y}"`).join(", ")}]`)}if($.edge_functions&&$.edge_functions.length>0){Z.push("");for(let Y of $.edge_functions)Z.push("[[edge_functions]]"),Z.push(` function = "${u0(Y.function)}"`),Z.push(` path = "${u0(Y.path)}"`)}if($.redirects&&$.redirects.length>0){Z.push("");for(let Y of $.redirects){if(Z.push("[[redirects]]"),Z.push(` from = "${u0(Y.from)}"`),Z.push(` to = "${u0(Y.to)}"`),Y.status!==void 0)Z.push(` status = ${Y.status}`);if(Y.force!==void 0)Z.push(` force = ${Y.force}`);if(Y.conditions&&Object.keys(Y.conditions).length>0){Z.push(" [redirects.conditions]");for(let[X,J]of Object.entries(Y.conditions))Z.push(` ${X} = "${u0(J)}"`)}}}if($.headers&&$.headers.length>0){Z.push("");for(let Y of $.headers){Z.push("[[headers]]"),Z.push(` for = "${u0(Y.for)}"`),Z.push(" [headers.values]");for(let[X,J]of Object.entries(Y.values))Z.push(` ${X} = "${u0(J)}"`)}}if($.plugins&&$.plugins.length>0){Z.push("");for(let Y of $.plugins)if(Z.push("[[plugins]]"),Z.push(` package = "${u0(Y.package)}"`),Y.inputs&&Object.keys(Y.inputs).length>0){Z.push(" [plugins.inputs]");for(let[X,J]of Object.entries(Y.inputs))if(typeof J==="string")Z.push(` ${X} = "${u0(J)}"`);else if(typeof J==="boolean"||typeof J==="number")Z.push(` ${X} = ${J}`)}}if($.context&&Object.keys($.context).length>0)for(let[Y,X]of Object.entries($.context)){if(Z.push(""),Z.push(`[context.${Y}]`),X.command)Z.push(` command = "${u0(X.command)}"`);if(X.publish)Z.push(` publish = "${u0(X.publish)}"`);if(X.environment&&Object.keys(X.environment).length>0){Z.push(` [context.${Y}.environment]`);for(let[J,Q]of Object.entries(X.environment))Z.push(` ${J} = "${u0(Q)}"`)}}return Z.join(`
12449
+ `+x;return f}catch(N){let A=N instanceof Error?N.message:String(N);return F0("Include",`Error processing include ${j}: ${A}`,Y,O,F)}}let z=/@include\s*\(/g,q;while((q=z.exec(K))!==null){let j=q.index,H=j+q[0].length-1,O=1,F=H+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let L=K.substring(j,F),V=K.substring(H+1,F-1),N=V.match(/^\s*['"]([^'"]+)['"]/);if(!N){z.lastIndex=F;continue}let A=N[1],w,R=V.substring(N[0].length),T=A9(R,0);if(T!==-1)w=R.substring(T+1).trim();let I={};if(w)try{I=y0(w,Z)}catch(k){let S=k instanceof Error?k.message:String(k);K=K.replace(L,F0("Include",`Error parsing include variables for ${A}: ${S}`,Y,$,j)),z.lastIndex=0;continue}let E=await _(A,I,$,j);K=K.substring(0,j)+E+K.substring(F),z.lastIndex=0}return K}function HZ($,Z){let Y=$;function X(J,Q,G,K){let W=J,U=!0;while(U){U=!1;let B=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),_=W.match(B);if(!_||_.index===void 0)break;let z=_.index,q=_[1],j=z+_[0].length,H=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),F=1,L=j,V=-1;while(F>0&&L<W.length){let A=W.slice(L),w=A.match(H),R=A.match(O),T=w?L+w.index:1/0,I=R?L+R.index:1/0;if(T<I)F++,L=T+(w[0].length||1);else if(I<1/0){if(F--,F===0){V=I;break}L=I+G.length+1}else break}if(V===-1)break;let N=W.slice(j,V);if(!Z[q])Z[q]=[];if(K)Z[q].unshift(N);else Z[q].push(N);W=W.substring(0,z)+W.substring(V+`@${G}`.length),U=!0}return W}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function OZ($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
12450
+ `)})}var Dq=0,n$,w9;var C7=D(()=>{R3();n0();U5();h0();A0();n$=new N4(500),w9=new Set});function AZ($){let{token:Z,baseUrl:Y="https://api.netlify.com/api/v1"}=$;async function X(J,Q,G={}){let K=`${Y}${Q}`,W={Authorization:`Bearer ${Z}`,"User-Agent":"stx-deploy/1.0"},U;if(G.rawBody)W["Content-Type"]=G.contentType||"application/octet-stream",U=G.rawBody;else if(G.body)W["Content-Type"]="application/json",U=JSON.stringify(G.body);let B=await fetch(K,{method:J,headers:W,body:U});if(!B.ok){let z=Error(`Netlify API error: ${B.status} ${B.statusText}`);z.status=B.status;try{let q=await B.json();z.message=q.message||z.message,z.code=q.code,z.details=q}catch{}throw z}let _=await B.text();if(!_)return{};return JSON.parse(_)}return{async getSite(J){return X("GET",`/sites/${J}`)},async listSites(){return X("GET","/sites")},async createSite(J){let Q={};if(J)Q.name=J;return X("POST","/sites",{body:Q})},async createDeploy(J,Q){let G={files:Q.files,draft:Q.draft??!0,async:Q.async??!0};if(Q.title)G.title=Q.title;if(Q.branch)G.branch=Q.branch;if(Q.functions)G.functions=Q.functions;return X("POST",`/sites/${J}/deploys`,{body:G})},async uploadFile(J,Q,G){let K=Q.startsWith("/")?Q.slice(1):Q;await X("PUT",`/deploys/${J}/files/${K}`,{rawBody:G,contentType:"application/octet-stream"})},async uploadFiles(J,Q){let K=[...Q],W=async()=>{while(K.length>0){let B=K.shift();if(B)await this.uploadFile(J,B.path,B.content)}},U=Array.from({length:Math.min(5,Q.length)},()=>W());await Promise.all(U)},async getDeploy(J){return X("GET",`/deploys/${J}`)},async waitForDeploy(J,Q={}){let{timeout:G=300000,pollInterval:K=2000,onProgress:W}=Q,U=Date.now();while(!0){let B=await this.getDeploy(J);if(W)W(B);if(B.state==="ready")return B;if(B.state==="error"){let _=Error(`Deploy failed: ${B.error_message||"Unknown error"}`);throw _.status=500,_.details=B,_}if(Date.now()-U>G){let _=Error(`Deploy timed out after ${G}ms`);throw _.status=408,_.details=B,_}await new Promise((_)=>setTimeout(_,K))}},async lockDeploy(J){return X("POST",`/deploys/${J}/lock`)},async unlockDeploy(J){return X("POST",`/deploys/${J}/unlock`)}}}async function R9($){let Z=await crypto.subtle.digest("SHA-1",$);return Array.from(new Uint8Array(Z)).map((X)=>X.toString(16).padStart(2,"0")).join("")}async function O6($,Z={}){let{ignore:Y=["node_modules",".git",".env*","*.map"]}=Z,X=[],J=new Bun.Glob("**/*");for await(let Q of J.scan({cwd:$,onlyFiles:!0,dot:!1})){if(Y.some((_)=>{if(_.includes("*"))return new RegExp(`^${_.replace(/\*/g,".*")}$`).test(Q);return Q.includes(_)}))continue;let K=`${$}/${Q}`,U=await Bun.file(K).arrayBuffer(),B=await R9(U);X.push({path:Q,content:new Uint8Array(U),sha1:B})}return X}function wZ($){let Z={};for(let Y of $)Z[`/${Y.path}`]=Y.sha1;return Z}function RZ($,Z){let Y=new Set(Z.map((X)=>X.startsWith("/")?X.slice(1):X));return $.filter((X)=>Y.has(X.path))}function w5($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;if($<1073741824)return`${($/1048576).toFixed(1)} MB`;return`${($/1073741824).toFixed(1)} GB`}function s$($){return $.reduce((Z,Y)=>Z+Y.content.byteLength,0)}import K$ from"fs";import i1 from"path";function M9($){let Z=[];if(Z.push("[build]"),Z.push(` command = "${u0($.build.command)}"`),Z.push(` publish = "${u0($.build.publish)}"`),$.build.functions)Z.push(` functions = "${u0($.build.functions)}"`);if($.build.edge_functions)Z.push(` edge_functions = "${u0($.build.edge_functions)}"`);if($.build.environment&&Object.keys($.build.environment).length>0){Z.push(""),Z.push("[build.environment]");for(let[Y,X]of Object.entries($.build.environment))Z.push(` ${Y} = "${u0(X)}"`)}if($.functions){if(Z.push(""),Z.push("[functions]"),$.functions.directory)Z.push(` directory = "${u0($.functions.directory)}"`);if($.functions.node_bundler)Z.push(` node_bundler = "${$.functions.node_bundler}"`);if($.functions.external_node_modules&&$.functions.external_node_modules.length>0)Z.push(` external_node_modules = [${$.functions.external_node_modules.map((Y)=>`"${Y}"`).join(", ")}]`)}if($.edge_functions&&$.edge_functions.length>0){Z.push("");for(let Y of $.edge_functions)Z.push("[[edge_functions]]"),Z.push(` function = "${u0(Y.function)}"`),Z.push(` path = "${u0(Y.path)}"`)}if($.redirects&&$.redirects.length>0){Z.push("");for(let Y of $.redirects){if(Z.push("[[redirects]]"),Z.push(` from = "${u0(Y.from)}"`),Z.push(` to = "${u0(Y.to)}"`),Y.status!==void 0)Z.push(` status = ${Y.status}`);if(Y.force!==void 0)Z.push(` force = ${Y.force}`);if(Y.conditions&&Object.keys(Y.conditions).length>0){Z.push(" [redirects.conditions]");for(let[X,J]of Object.entries(Y.conditions))Z.push(` ${X} = "${u0(J)}"`)}}}if($.headers&&$.headers.length>0){Z.push("");for(let Y of $.headers){Z.push("[[headers]]"),Z.push(` for = "${u0(Y.for)}"`),Z.push(" [headers.values]");for(let[X,J]of Object.entries(Y.values))Z.push(` ${X} = "${u0(J)}"`)}}if($.plugins&&$.plugins.length>0){Z.push("");for(let Y of $.plugins)if(Z.push("[[plugins]]"),Z.push(` package = "${u0(Y.package)}"`),Y.inputs&&Object.keys(Y.inputs).length>0){Z.push(" [plugins.inputs]");for(let[X,J]of Object.entries(Y.inputs))if(typeof J==="string")Z.push(` ${X} = "${u0(J)}"`);else if(typeof J==="boolean"||typeof J==="number")Z.push(` ${X} = ${J}`)}}if($.context&&Object.keys($.context).length>0)for(let[Y,X]of Object.entries($.context)){if(Z.push(""),Z.push(`[context.${Y}]`),X.command)Z.push(` command = "${u0(X.command)}"`);if(X.publish)Z.push(` publish = "${u0(X.publish)}"`);if(X.environment&&Object.keys(X.environment).length>0){Z.push(` [context.${Y}.environment]`);for(let[J,Q]of Object.entries(X.environment))Z.push(` ${J} = "${u0(Q)}"`)}}return Z.join(`
12451
12451
  `)+`
12452
12452
  `}function u0($){return $.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}async function L6($){let Z={framework:"stx",buildCommand:"bun run build",outputDir:"dist"},Y=i1.join($,"package.json");if(await Bun.file(Y).exists())try{let U=JSON.parse(await Bun.file(Y).text());if(U.scripts?.build)Z.buildCommand="bun run build";let B={...U.dependencies,...U.devDependencies};if(B["@stacksjs/stx"]||B.stx)Z.framework="stx"}catch{}let X=i1.join($,"stx.config.ts"),J=i1.join($,".config","stx.config.ts");if(await Bun.file(X).exists()||await Bun.file(J).exists())Z.framework="stx";let Q=["dist","build","out","public",".output"];for(let U of Q){let B=i1.join($,U);if(K$.existsSync(B)&&K$.statSync(B).isDirectory()){Z.outputDir=U;break}}let G=["functions","netlify/functions","api"];for(let U of G){let B=i1.join($,U);if(K$.existsSync(B)&&K$.statSync(B).isDirectory()){Z.functionsDir=U;break}}let K=i1.join($,"netlify","edge-functions");if(K$.existsSync(K))Z.edgeFunctionsDir="netlify/edge-functions";let W=i1.join($,Z.outputDir||"dist");if(K$.existsSync(W)){let U=K$.existsSync(i1.join(W,"index.html")),B=K$.readdirSync(W).filter((_)=>_.endsWith(".html"));Z.isSPA=U&&B.length===1}return Z}function F6($={}){let Z={build:{command:$.buildCommand||"bun run build",publish:$.outputDir||"dist"}};if($.functionsDir)Z.build.functions=$.functionsDir,Z.functions={directory:$.functionsDir,node_bundler:"esbuild"};if($.edgeFunctionsDir)Z.build.edge_functions=$.edgeFunctionsDir;if(Z.headers=[{for:"/*",values:{"X-Frame-Options":"DENY","X-Content-Type-Options":"nosniff","X-XSS-Protection":"1; mode=block","Referrer-Policy":"strict-origin-when-cross-origin"}},{for:"/assets/*",values:{"Cache-Control":"public, max-age=31536000, immutable"}}],$.isSPA!==!1)Z.redirects=[{from:"/*",to:"/index.html",status:200}];return Z.context={production:{environment:{NODE_ENV:"production"}},"deploy-preview":{environment:{NODE_ENV:"development"}}},Z}async function MZ($,Z){let Y=await L6($),X=Z||F6(Y),J=M9(X),Q=i1.join($,"netlify.toml");return await Bun.write(Q,J),Q}function TZ($){return K$.existsSync(i1.join($,"netlify.toml"))}var T9=()=>{};import I9 from"fs";import E9 from"path";async function oT($={}){let Z=Date.now(),Y=[],X=$.cwd||process.cwd(),J=(L)=>{Y.push(L)},Q=(L)=>{if($.onProgress)$.onProgress(L)},G=E9.resolve(X,$.directory||"dist"),K=$.token||process.env.NETLIFY_AUTH_TOKEN,W=$.siteId||process.env.NETLIFY_SITE_ID;if(!K)throw new r$(`No Netlify auth token found.
12453
12453
 
@@ -12720,7 +12720,7 @@ ${K}
12720
12720
  `));return K=K.replace(/<body\b[^>]*>/i,""),K=K.replace(/<\/body\s*>/i,""),K.trim()}function l9($){return $.headers.get("X-STX-Router")==="true"}function S6($,Z="main"){let Y=$.trim(),X=[],J=Y.match(/<head\b[^>]*>([\s\S]*?)<\/head>/i);if(J){let L=J[1],V=/<style\b[^>]*>[\s\S]*?<\/style>/gi,N;while((N=V.exec(L))!==null)X.push(N[0])}let Q=Z.replace(/^[.#]/,"").toLowerCase(),G=new RegExp(`<${Q}\\b[^>]*>`,"i"),K=Y.match(G);if(!K||K.index===void 0)return U$($);let W=K.index+K[0].length,U=new RegExp(`<${Q}\\b[^>]*>`,"gi"),B=new RegExp(`</${Q}\\s*>`,"gi");U.lastIndex=W,B.lastIndex=W;let _=1,z=-1;while(_>0){let L=U.exec(Y),V=B.exec(Y);if(!V)break;if(L&&L.index<V.index)_++,B.lastIndex=L.index+L[0].length;else if(_--,z=V.index,_>0)U.lastIndex=V.index+V[0].length}if(z===-1)return U$($);let q=Y.slice(W,z).trim(),j=[],H=Y.match(/<body\b[^>]*>/i),O=Y.lastIndexOf("</body>");if(H&&H.index!==void 0&&O!==-1){let V=[[H.index+H[0].length,K.index],[z+`</${Q}>`.length,O]],N=/<script\b[^>]*>[\s\S]*?<\/script>/gi;for(let[A,w]of V){if(A>=w)continue;let R=Y.slice(A,w),T;N.lastIndex=0;while((T=N.exec(R))!==null)j.push(T[0])}}let F=[];if(X.length>0)F.push(X.join(`
12721
12721
  `));if(j.length>0)F.push(j.join(`
12722
12722
  `));return F.push(q),F.join(`
12723
- `)}var zE="stx-page-head:",qE,D6=null;var p7=D(()=>{m9();qE=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/});import{matchRoute as HE,Router as OE}from"stx-router";import{findErrorPage as i9,formatRoutes as n9,generateRouteManifest as FE,generateRouteTypes as VE,matchRoute as vZ}from"stx-router";function B$($,Z={}){return new OE($,Z).routes}function LE($,Z){let Y=HE($,Z);return Y?Y.params:null}var C6=()=>{};import{createHash as NE}from"crypto";function AE($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function RE($){return Bun.hash($).toString(16)}function _j($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,X=$.replace(wE,(Q,G,K,W)=>{let U=W.trim();if(!U)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)U=AE(U);let B=RE(U);if(!Y.has(B))Y.set(B,U);let _=Z.integrity?` data-stx-integrity="sha384-${NE("sha384").update(U).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${B}.js"${_}${K}></script>`}),J=Array.from(Y,([Q,G])=>({hash:Q,code:G}));return{html:X,chunks:J}}function zj($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,X;while((X=Y.exec($))!==null)Z.set(X[1],X[2]);let J=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(ME.has(Z.get(G[1])||""))J.add(G[2]);let K=$.lastIndexOf("</head>");if(J.size===0||K===-1)return $;let W=Array.from(J).filter((U)=>!$.includes(`rel="prefetch" href="${U}"`)).map((U)=>`<link rel="prefetch" href="${U}" as="script">`).join("");if(!W)return $;return $.slice(0,K)+W+$.slice(K)}var wE,ME;var qj=D(()=>{wE=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;ME=new Set(["visible","idle"])});var wj={};Z0(wj,{generateStaticSite:()=>Lj,defineStaticPaths:()=>Nj,default:()=>vE,createMarkdownLoader:()=>Aj,createISRHandler:()=>Vj});import g0 from"fs";import j0 from"path";class jj{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=j0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,X]of Object.entries(Z))this.cache.set(Y,X)}catch{}this.loaded=!0}async save(){await g0.promises.mkdir(this.cacheDir,{recursive:!0});let $=j0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,X]of this.cache)Z[Y]=X;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=g0.statSync($),X=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(g0.existsSync(Q)){let G=g0.statSync(Q);X+=`:${Q}:${G.mtimeMs}`}let J=0;for(let Q=0;Q<X.length;Q++){let G=X.charCodeAt(Q);J=(J<<5)-J+G,J=J&J}return Math.abs(J).toString(36)}get($,Z){let Y=this.cache.get($);if(!Y)return null;let X=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==X)return this.cache.delete($),null;return Y.html}set($,Z,Y,X){let J=this.getHash(Z,Y);this.cache.set($,{hash:J,html:X,generatedAt:Date.now(),dependencies:Y})}}class Hj{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return j0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await g0.promises.mkdir(j0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await g0.promises.unlink(Z)}async invalidatePattern($){let Z=j0.join(this.cacheDir,"isr");if(!g0.existsSync(Z))return;let Y=await g0.promises.readdir(Z);for(let X of Y){let J=X.replace(/_/g,"/").replace(".json","");if($.test(J))await g0.promises.unlink(j0.join(Z,X))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function TE($){try{let Y=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let X=Y[1];if(!X.includes("getStaticPaths"))return null;let J=X.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!J)return null;return await Function(`
12723
+ `)}var zE="stx-page-head:",qE,D6=null;var p7=D(()=>{m9();qE=/<!--stx-page-head:([A-Za-z0-9+/=]+)-->\n?/});import{matchRoute as HE,Router as OE}from"stx-router";import{findErrorPage as i9,formatRoutes as n9,generateRouteManifest as FE,generateRouteTypes as VE,matchRoute as vZ}from"stx-router";function B$($,Z={}){return new OE($,Z).routes}function LE($,Z){let Y=HE($,Z);return Y?Y.params:null}var C6=()=>{};import{createHash as NE}from"crypto";function AE($){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return $}}function RE($){return Bun.hash($).toString(16)}function _j($,Z={}){if(!$.includes('type="stx/island"'))return{html:$,chunks:[]};let Y=new Map,X=$.replace(wE,(Q,G,K,W)=>{let U=W.trim();if(!U)return Q;if(/\bdata-stx-src=/.test(K))return Q;if(Z.minify)U=AE(U);let B=RE(U);if(!Y.has(B))Y.set(B,U);let _=Z.integrity?` data-stx-integrity="sha384-${NE("sha384").update(U).digest("base64")}"`:"";return`<script type="stx/island" data-stx-island="${G}" data-stx-src="/_stx/islands/${B}.js"${_}${K}></script>`}),J=Array.from(Y,([Q,G])=>({hash:Q,code:G}));return{html:X,chunks:J}}function zj($){if(!$.includes("data-stx-src="))return $;let Z=new Map,Y=/data-stx-scope="([^"]+)"[^>]*?stx-hydrate="([^"]+)"/g,X;while((X=Y.exec($))!==null)Z.set(X[1],X[2]);let J=new Set,Q=/data-stx-island="([^"]+)"[^>]*?data-stx-src="([^"]+)"/g,G;while((G=Q.exec($))!==null)if(ME.has(Z.get(G[1])||""))J.add(G[2]);let K=$.lastIndexOf("</head>");if(J.size===0||K===-1)return $;let W=Array.from(J).filter((U)=>!$.includes(`rel="prefetch" href="${U}"`)).map((U)=>`<link rel="prefetch" href="${U}" as="script">`).join("");if(!W)return $;return $.slice(0,K)+W+$.slice(K)}var wE,ME;var qj=D(()=>{wE=/<script\s+type="stx\/island"\s+data-stx-island="([^"]+)"([^>]*)>([\s\S]*?)<\/script>/g;ME=new Set(["visible","idle"])});var wj={};Z0(wj,{generateStaticSite:()=>Lj,defineStaticPaths:()=>Nj,default:()=>vE,createMarkdownLoader:()=>Aj,createISRHandler:()=>Vj});import g0 from"fs";import H0 from"path";class jj{cacheDir;cache=new Map;loaded=!1;constructor($){this.cacheDir=$}async load(){if(this.loaded)return;let $=H0.join(this.cacheDir,"build-cache.json");if(await Bun.file($).exists())try{let Z=JSON.parse(await Bun.file($).text());for(let[Y,X]of Object.entries(Z))this.cache.set(Y,X)}catch{}this.loaded=!0}async save(){await g0.promises.mkdir(this.cacheDir,{recursive:!0});let $=H0.join(this.cacheDir,"build-cache.json"),Z={};for(let[Y,X]of this.cache)Z[Y]=X;await Bun.write($,JSON.stringify(Z))}getHash($,Z){let Y=g0.statSync($),X=`${$}:${Y.mtimeMs}`;for(let Q of Z)if(g0.existsSync(Q)){let G=g0.statSync(Q);X+=`:${Q}:${G.mtimeMs}`}let J=0;for(let Q=0;Q<X.length;Q++){let G=X.charCodeAt(Q);J=(J<<5)-J+G,J=J&J}return Math.abs(J).toString(36)}get($,Z){let Y=this.cache.get($);if(!Y)return null;let X=this.getHash(Z,Y.dependencies??[]);if(Y.hash!==X)return this.cache.delete($),null;return Y.html}set($,Z,Y,X){let J=this.getHash(Z,Y);this.cache.set($,{hash:J,html:X,generatedAt:Date.now(),dependencies:Y})}}class Hj{cacheDir;constructor($){this.cacheDir=$}getFilePath($){let Z=$.replace(/[^a-zA-Z0-9]/g,"_")+".json";return H0.join(this.cacheDir,"isr",Z)}async get($){let Z=this.getFilePath($);if(!await Bun.file(Z).exists())return null;try{return JSON.parse(await Bun.file(Z).text())}catch{return null}}async set($,Z){let Y=this.getFilePath($);await g0.promises.mkdir(H0.dirname(Y),{recursive:!0}),await Bun.write(Y,JSON.stringify(Z))}async invalidate($){let Z=this.getFilePath($);if(await Bun.file(Z).exists())await g0.promises.unlink(Z)}async invalidatePattern($){let Z=H0.join(this.cacheDir,"isr");if(!g0.existsSync(Z))return;let Y=await g0.promises.readdir(Z);for(let X of Y){let J=X.replace(/_/g,"/").replace(".json","");if($.test(J))await g0.promises.unlink(H0.join(Z,X))}}async needsRevalidation($){let Z=await this.get($);if(!Z)return!0;return Date.now()>Z.revalidateAfter}}async function TE($){try{let Y=(await Bun.file($).text()).match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return null;let X=Y[1];if(!X.includes("getStaticPaths"))return null;let J=X.match(/(?:export\s+)?(?:async\s+)?function\s+getStaticPaths\s*\([^)]*\)\s*\{([\s\S]*?)\n[\t ]*\}/);if(!J)return null;return await Function(`
12724
12724
  return (async function getStaticPaths() {
12725
12725
  ${J[1]}
12726
12726
  })()
@@ -12760,10 +12760,10 @@ ${$.map((X)=>{let J=new URL(X.loc,Z).href,Q=` <url>
12760
12760
  ${Y.join(`
12761
12761
  `)}
12762
12762
  </channel>
12763
- </rss>`}async function Lj($={}){let Z=Date.now(),Y=await v0(),X={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:$.domain||"http://localhost",revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||".stx/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},J={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,G=0,K={},W={};await X.hooks.onBuildStart?.();try{if(X.cleanOutput&&g0.existsSync(X.outputDir))await g0.promises.rm(X.outputDir,{recursive:!0});await g0.promises.mkdir(X.outputDir,{recursive:!0});let B=new jj(X.cacheDir);if(X.cache)await B.load();try{let{preloadIconCollection:V}=await Promise.resolve().then(() => (YZ(),tB));await V("lucide")}catch{}try{let{generateCrosswindCSS:V}=await Promise.resolve().then(() => (m1(),z8));await V('<div class="bg-black"></div>')}catch{}w6();let _=Y?.routeMiddleware?.dir||"middleware";await I6(process.cwd(),_);let z=T6();if(z.length>0)console.log(`Loaded ${z.length} middleware: ${z.join(", ")}`);let q=Y?.routeMiddleware?.global||[],j=B$(".",{pagesDir:X.pagesDir});console.log(`Found ${j.length} routes`);let H=[];for(let V of j){let N=await IE(V);for(let A of N)H.push({route:V,url:A.url,params:A.params,props:A.props,revalidate:A.revalidate??X.revalidate})}J.totalPages=H.length,console.log(`Generating ${J.totalPages} pages...`);let O=[],F=[];for(let V=0;V<H.length;V+=X.concurrency)F.push(H.slice(V,V+X.concurrency));for(let V of F)await Promise.all(V.map(async(N)=>{let{route:A,url:w,params:R,props:T,revalidate:I}=N;try{await X.hooks.onPageStart?.(w);let E=await Bun.file(A.filePath).text(),k=yE(E),S=k?.middleware?Array.isArray(k.middleware)?k.middleware:[k.middleware]:[],x=[...q,...S];if(x.length>0){let C=M6(w,R,k||{}),h=R6(C,null),p=await E6(x,h);if(p.redirect){let i=typeof p.redirect==="string"?p.redirect:p.redirect.path||p.redirect,s=PE(String(i),w),K0=xE(w,X);await g0.promises.mkdir(j0.dirname(K0),{recursive:!0}),await Bun.write(K0,s),J.successCount++,J.pages.push({route:w,outputPath:K0,size:Buffer.byteLength(s),cached:!1}),O.push({loc:w,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${w} \u2192 redirect to ${i}`);return}if(p.abort){let i=typeof p.abort==="string"?p.abort:p.abort?.error?.message||"aborted";console.warn(` \u21B3 ${w} \u2014 middleware aborted: ${i}`);return}}let y=E.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(y)try{if(!await Function("route",`
12763
+ </rss>`}async function Lj($={}){let Z=Date.now(),Y=await v0(),X={pagesDir:$.pagesDir||"pages",outputDir:$.outputDir||"dist",baseUrl:$.baseUrl||"/",domain:$.domain||"http://localhost",revalidate:$.revalidate??!1,sitemap:$.sitemap??!0,rss:$.rss??!1,concurrency:$.concurrency||10,cache:$.cache??!0,cacheDir:$.cacheDir||".stx/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},J={totalPages:0,successCount:0,failedCount:0,cachedCount:0,buildTime:0,pages:[],errors:[]},Q=new Set,G=0,K={},W={};await X.hooks.onBuildStart?.();try{if(X.cleanOutput&&g0.existsSync(X.outputDir))await g0.promises.rm(X.outputDir,{recursive:!0});await g0.promises.mkdir(X.outputDir,{recursive:!0});let B=new jj(X.cacheDir);if(X.cache)await B.load();try{let{preloadIconCollection:V}=await Promise.resolve().then(() => (YZ(),tB));await V("lucide")}catch{}try{let{generateCrosswindCSS:V}=await Promise.resolve().then(() => (m1(),z8));await V('<div class="bg-black"></div>')}catch{}w6();let _=Y?.routeMiddleware?.dir||"middleware";await I6(process.cwd(),_);let z=T6();if(z.length>0)console.log(`Loaded ${z.length} middleware: ${z.join(", ")}`);let q=Y?.routeMiddleware?.global||[],j=B$(".",{pagesDir:X.pagesDir});console.log(`Found ${j.length} routes`);let H=[];for(let V of j){let N=await IE(V);for(let A of N)H.push({route:V,url:A.url,params:A.params,props:A.props,revalidate:A.revalidate??X.revalidate})}J.totalPages=H.length,console.log(`Generating ${J.totalPages} pages...`);let O=[],F=[];for(let V=0;V<H.length;V+=X.concurrency)F.push(H.slice(V,V+X.concurrency));for(let V of F)await Promise.all(V.map(async(N)=>{let{route:A,url:w,params:R,props:T,revalidate:I}=N;try{await X.hooks.onPageStart?.(w);let E=await Bun.file(A.filePath).text(),k=yE(E),S=k?.middleware?Array.isArray(k.middleware)?k.middleware:[k.middleware]:[],x=[...q,...S];if(x.length>0){let C=M6(w,R,k||{}),h=R6(C,null),p=await E6(x,h);if(p.redirect){let i=typeof p.redirect==="string"?p.redirect:p.redirect.path||p.redirect,s=PE(String(i),w),W0=xE(w,X);await g0.promises.mkdir(H0.dirname(W0),{recursive:!0}),await Bun.write(W0,s),J.successCount++,J.pages.push({route:w,outputPath:W0,size:Buffer.byteLength(s),cached:!1}),O.push({loc:w,lastmod:new Date().toISOString()}),console.log(` \u21B3 ${w} \u2192 redirect to ${i}`);return}if(p.abort){let i=typeof p.abort==="string"?p.abort:p.abort?.error?.message||"aborted";console.warn(` \u21B3 ${w} \u2014 middleware aborted: ${i}`);return}}let y=E.match(/definePageMeta\s*\(\s*\{[\s\S]*?validate\s*:\s*((?:\([^)]*\)|[^,}])*(?:\{[\s\S]*?\})?)/m);if(y)try{if(!await Function("route",`
12764
12764
  const validate = ${y[1]};
12765
12765
  return validate(route);
12766
- `)({params:R})){console.warn(`Validation failed for ${w}, skipping...`);return}}catch{}let b=null,f=!1;if(X.cache){if(b=B.get(w,A.filePath),b)f=!0,J.cachedCount++}if(!b){let C=await Oj(A,R,T,X,Y);if(b=C.html,X.cache)B.set(w,A.filePath,C.dependencies,b)}let r;if(X.trailingSlash)r=j0.join(X.outputDir,w,"index.html");else r=w==="/"?j0.join(X.outputDir,"index.html"):j0.join(X.outputDir,`${w}.html`);if(X.chunkIslands){let{html:C,chunks:h}=_j(b,{integrity:X.integrityIslands,minify:X.minify});if(h.length>0){let p=j0.join(X.outputDir,"_stx","islands");await g0.promises.mkdir(p,{recursive:!0});for(let i of h){let s=j0.join(p,`${i.hash}.js`);if(!await Bun.file(s).exists())await Bun.write(s,i.code);if(!Q.has(i.hash)){Q.add(i.hash);let K0=Buffer.byteLength(i.code,"utf8");G+=K0,K[i.hash]={bytes:K0,file:`/_stx/islands/${i.hash}.js`}}}if(W[w]=h.map((i)=>i.hash),b=C,X.prefetchIslands)b=zj(b)}}await g0.promises.mkdir(j0.dirname(r),{recursive:!0}),await Bun.write(r,b),O.push({loc:w,lastmod:new Date().toISOString().split("T")[0],priority:w==="/"?1:0.8});let u={route:w,outputPath:r,size:Buffer.byteLength(b,"utf8"),cached:f};if(I!==!1)u.revalidateAt=Date.now()+I*1000;J.pages.push(u),J.successCount++,await X.hooks.onPageEnd?.(w,b)}catch(E){J.failedCount++,J.errors.push({route:w,error:E}),await X.hooks.onError?.(E,w),console.error(`Error generating ${w}:`,E)}}));if(X.cache)await B.save();if(X.generate404){let V=j0.join(X.pagesDir,"404.stx");if(await Bun.file(V).exists()){let N=new Set,A={...Y,debug:!1,cache:!1},w=await X0(await Bun.file(V).text(),{},V,A,N);await Bun.write(j0.join(X.outputDir,"404.html"),w)}else await Bun.write(j0.join(X.outputDir,"404.html"),`<!DOCTYPE html>
12766
+ `)({params:R})){console.warn(`Validation failed for ${w}, skipping...`);return}}catch{}let b=null,f=!1;if(X.cache){if(b=B.get(w,A.filePath),b)f=!0,J.cachedCount++}if(!b){let C=await Oj(A,R,T,X,Y);if(b=C.html,X.cache)B.set(w,A.filePath,C.dependencies,b)}let r;if(X.trailingSlash)r=H0.join(X.outputDir,w,"index.html");else r=w==="/"?H0.join(X.outputDir,"index.html"):H0.join(X.outputDir,`${w}.html`);if(X.chunkIslands){let{html:C,chunks:h}=_j(b,{integrity:X.integrityIslands,minify:X.minify});if(h.length>0){let p=H0.join(X.outputDir,"_stx","islands");await g0.promises.mkdir(p,{recursive:!0});for(let i of h){let s=H0.join(p,`${i.hash}.js`);if(!await Bun.file(s).exists())await Bun.write(s,i.code);if(!Q.has(i.hash)){Q.add(i.hash);let W0=Buffer.byteLength(i.code,"utf8");G+=W0,K[i.hash]={bytes:W0,file:`/_stx/islands/${i.hash}.js`}}}if(W[w]=h.map((i)=>i.hash),b=C,X.prefetchIslands)b=zj(b)}}await g0.promises.mkdir(H0.dirname(r),{recursive:!0}),await Bun.write(r,b),O.push({loc:w,lastmod:new Date().toISOString().split("T")[0],priority:w==="/"?1:0.8});let u={route:w,outputPath:r,size:Buffer.byteLength(b,"utf8"),cached:f};if(I!==!1)u.revalidateAt=Date.now()+I*1000;J.pages.push(u),J.successCount++,await X.hooks.onPageEnd?.(w,b)}catch(E){J.failedCount++,J.errors.push({route:w,error:E}),await X.hooks.onError?.(E,w),console.error(`Error generating ${w}:`,E)}}));if(X.cache)await B.save();if(X.generate404){let V=H0.join(X.pagesDir,"404.stx");if(await Bun.file(V).exists()){let N=new Set,A={...Y,debug:!1,cache:!1},w=await X0(await Bun.file(V).text(),{},V,A,N);await Bun.write(H0.join(X.outputDir,"404.html"),w)}else await Bun.write(H0.join(X.outputDir,"404.html"),`<!DOCTYPE html>
12767
12767
  <html lang="en">
12768
12768
  <head>
12769
12769
  <meta charset="UTF-8">
@@ -12784,7 +12784,7 @@ ${Y.join(`
12784
12784
  <a href="/">Go home</a>
12785
12785
  </div>
12786
12786
  </body>
12787
- </html>`)}for(let V of[500]){let N=j0.join(X.pagesDir,`${V}.stx`);if(await Bun.file(N).exists()){let A=new Set,w={...Y,debug:!1,cache:!1},R=await X0(await Bun.file(N).text(),{},N,w,A);await Bun.write(j0.join(X.outputDir,`${V}.html`),R)}}let L=j0.join(X.pagesDir,"error.stx");if(await Bun.file(L).exists()){let V=new Set,N={...Y,debug:!1,cache:!1},A=await X0(await Bun.file(L).text(),{},L,N,V);await Bun.write(j0.join(X.outputDir,"error.html"),A)}if(X.sitemap&&O.length>0){let V=bE(O,X.domain),N=j0.join(X.outputDir,"sitemap.xml");await Bun.write(N,V),J.sitemapPath=N,console.log(`Generated sitemap.xml with ${O.length} URLs`)}if(X.rss){let V=typeof X.rss==="object"?X.rss:{title:"Site Feed",description:"Latest updates",link:X.domain},N=[];if(V.getItems)N=await V.getItems();let A=CE(V,N),w=j0.join(X.outputDir,"rss.xml");await Bun.write(w,A),J.rssPath=w,console.log(`Generated rss.xml with ${N.length} items`)}if(X.publicDir&&g0.existsSync(X.publicDir))await Fj(X.publicDir,X.outputDir),console.log(`Copied public assets from ${X.publicDir}`)}catch(B){throw await X.hooks.onError?.(B),B}if(J.buildTime=Date.now()-Z,Q.size>0){J.islandChunks={count:Q.size,totalBytes:G};let B={generatedChunks:Q.size,totalBytes:G,chunks:K,pages:W};await Bun.write(j0.join(X.outputDir,"_stx","islands-manifest.json"),JSON.stringify(B,null,2))}await X.hooks.onBuildEnd?.(J);let U=J.islandChunks?`
12787
+ </html>`)}for(let V of[500]){let N=H0.join(X.pagesDir,`${V}.stx`);if(await Bun.file(N).exists()){let A=new Set,w={...Y,debug:!1,cache:!1},R=await X0(await Bun.file(N).text(),{},N,w,A);await Bun.write(H0.join(X.outputDir,`${V}.html`),R)}}let L=H0.join(X.pagesDir,"error.stx");if(await Bun.file(L).exists()){let V=new Set,N={...Y,debug:!1,cache:!1},A=await X0(await Bun.file(L).text(),{},L,N,V);await Bun.write(H0.join(X.outputDir,"error.html"),A)}if(X.sitemap&&O.length>0){let V=bE(O,X.domain),N=H0.join(X.outputDir,"sitemap.xml");await Bun.write(N,V),J.sitemapPath=N,console.log(`Generated sitemap.xml with ${O.length} URLs`)}if(X.rss){let V=typeof X.rss==="object"?X.rss:{title:"Site Feed",description:"Latest updates",link:X.domain},N=[];if(V.getItems)N=await V.getItems();let A=CE(V,N),w=H0.join(X.outputDir,"rss.xml");await Bun.write(w,A),J.rssPath=w,console.log(`Generated rss.xml with ${N.length} items`)}if(X.publicDir&&g0.existsSync(X.publicDir))await Fj(X.publicDir,X.outputDir),console.log(`Copied public assets from ${X.publicDir}`)}catch(B){throw await X.hooks.onError?.(B),B}if(J.buildTime=Date.now()-Z,Q.size>0){J.islandChunks={count:Q.size,totalBytes:G};let B={generatedChunks:Q.size,totalBytes:G,chunks:K,pages:W};await Bun.write(H0.join(X.outputDir,"_stx","islands-manifest.json"),JSON.stringify(B,null,2))}await X.hooks.onBuildEnd?.(J);let U=J.islandChunks?`
12788
12788
  Island chunks: ${J.islandChunks.count} (${(J.islandChunks.totalBytes/1024).toFixed(1)} KB lifted out of inline HTML)`:"";return console.log(`
12789
12789
  Build complete!
12790
12790
  Total: ${J.totalPages} pages
@@ -12792,7 +12792,7 @@ Build complete!
12792
12792
  Cached: ${J.cachedCount}
12793
12793
  Failed: ${J.failedCount}
12794
12794
  Time: ${J.buildTime}ms${U}
12795
- `),J}async function Fj($,Z){let Y=await g0.promises.readdir($,{withFileTypes:!0});for(let X of Y){let J=j0.join($,X.name),Q=j0.join(Z,X.name);if(X.isDirectory())await g0.promises.mkdir(Q,{recursive:!0}),await Fj(J,Q);else await g0.promises.copyFile(J,Q)}}function Vj($={}){let Z=$.cacheDir||".stx/ssg-cache",Y=new Hj(Z),X=$.revalidate||3600;return{async get(J){let Q=await Y.get(J);if(!Q)return null;if(Date.now()>Q.revalidateAfter)this.revalidate(J).catch(console.error);return{html:Q.html,headers:{"Cache-Control":`public, max-age=${X}, stale-while-revalidate=${X*2}`,ETag:Q.etag,"X-ISR-Generated":new Date(Q.generatedAt).toISOString(),...Q.headers}}},async revalidate(J){let G=B$(".",{pagesDir:$.pagesDir||"pages"}).find((_)=>{return J.match(_.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${J}`);return}let K=J.match(G.regex),W={};if(K)G.params.forEach((_,z)=>{W[_]=K[z+1]});let U=await v0(),{html:B}=await Oj(G,W,{},$,U);await Y.set(J,{html:B,generatedAt:Date.now(),revalidateAfter:Date.now()+X*1000,etag:SE(B)}),console.log(`Revalidated: ${J}`)},async invalidate(J){if(typeof J==="string")await Y.invalidate(J);else await Y.invalidatePattern(J)}}}function Nj($){return async()=>{return{paths:await $(),fallback:!1}}}function Aj(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),Y=Z.match(/^---\n([\s\S]*?)\n---/),X={},J=Z;if(Y){let U=Y[1];J=Z.slice(Y[0].length).trim();for(let B of U.split(`
12795
+ `),J}async function Fj($,Z){let Y=await g0.promises.readdir($,{withFileTypes:!0});for(let X of Y){let J=H0.join($,X.name),Q=H0.join(Z,X.name);if(X.isDirectory())await g0.promises.mkdir(Q,{recursive:!0}),await Fj(J,Q);else await g0.promises.copyFile(J,Q)}}function Vj($={}){let Z=$.cacheDir||".stx/ssg-cache",Y=new Hj(Z),X=$.revalidate||3600;return{async get(J){let Q=await Y.get(J);if(!Q)return null;if(Date.now()>Q.revalidateAfter)this.revalidate(J).catch(console.error);return{html:Q.html,headers:{"Cache-Control":`public, max-age=${X}, stale-while-revalidate=${X*2}`,ETag:Q.etag,"X-ISR-Generated":new Date(Q.generatedAt).toISOString(),...Q.headers}}},async revalidate(J){let G=B$(".",{pagesDir:$.pagesDir||"pages"}).find((_)=>{return J.match(_.regex)!==null});if(!G){console.warn(`Route not found for revalidation: ${J}`);return}let K=J.match(G.regex),W={};if(K)G.params.forEach((_,z)=>{W[_]=K[z+1]});let U=await v0(),{html:B}=await Oj(G,W,{},$,U);await Y.set(J,{html:B,generatedAt:Date.now(),revalidateAfter:Date.now()+X*1000,etag:SE(B)}),console.log(`Revalidated: ${J}`)},async invalidate(J){if(typeof J==="string")await Y.invalidate(J);else await Y.invalidatePattern(J)}}}function Nj($){return async()=>{return{paths:await $(),fallback:!1}}}function Aj(){return{name:"markdown",extensions:[".md",".mdx"],async load($){let Z=await Bun.file($).text(),Y=Z.match(/^---\n([\s\S]*?)\n---/),X={},J=Z;if(Y){let U=Y[1];J=Z.slice(Y[0].length).trim();for(let B of U.split(`
12796
12796
  `)){let _=B.indexOf(":");if(_>0){let z=B.slice(0,_).trim(),q=B.slice(_+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(/^\d+$/.test(q))q=parseInt(q,10);else if(/^\d+\.\d+$/.test(q))q=parseFloat(q);else if(q.startsWith("[")&&q.endsWith("]"))q=q.slice(1,-1).split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,""));X[z]=q}}}let Q=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>"),G=[],K=/<h([1-6])>([^<]+)<\/h[1-6]>/gi,W;while((W=K.exec(Q))!==null){let U=parseInt(W[1],10),B=W[2],_=B.toLowerCase().replace(/[^a-z0-9]+/g,"-");G.push({id:_,text:B,level:U})}return{content:Q,data:X,toc:G}}}}function yE($){let Z=$.match(/definePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function PE($,Z){return`<!DOCTYPE html>
12797
12797
  <html>
12798
12798
  <head>
@@ -12805,7 +12805,7 @@ Build complete!
12805
12805
  <p>Redirecting to <a href="${$}">${$}</a>...</p>
12806
12806
  <script>window.location.replace('${$}')</script>
12807
12807
  </body>
12808
- </html>`}function xE($,Z){if($==="/"||$==="")return j0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return j0.join(Z.outputDir,Y,"index.html");return j0.join(Z.outputDir,`${Y}.html`)}var vE;var Rj=D(()=>{C6();F1();qj();i0();m1();yZ();vE={generateStaticSite:Lj,createISRHandler:Vj,defineStaticPaths:Nj,createMarkdownLoader:Aj}});import{createHash as fE}from"crypto";import{getRouterScript as gE}from"stx-router";function s9($){return fE("sha256").update($).digest("hex").slice(0,8)}function r9($=!1){let Z=$?q5():Y6(),Y=s9(Z);return{content:Z,filename:`runtime.${Y}.js`,hash:Y}}function o9(){let $=gE(),Z=s9($);return{content:$,filename:`router.${Z}.js`,hash:Z}}function hE($){return{runtimeTag:$.runtime?`<script src="/__stx/${$.runtime.filename}"></script>`:"",routerTag:$.router?`<script src="/__stx/${$.router.filename}"></script>`:"",cssTag:$.css?`<link rel="stylesheet" href="/__stx/${$.css.filename}">`:""}}var a9=D(()=>{c8()});import Mj from"path";import{createHash as dE}from"crypto";function uE($={}){let Z=new Set;return{context:new Proxy($,{get(X,J){if(J in X)return X[J];if(typeof J==="string"&&!J.startsWith("__"))Z.add(J);return},has(X,J){if(J in X)return!0;if(typeof J==="string"&&!J.startsWith("__"))Z.add(J);return!1}}),accessedKeys:Z}}async function t9($,Z,Y={}){let X=Mj.resolve($),J=await Bun.file(X).text(),Q=dE("sha256").update(J).digest("hex").slice(0,16);H9();let G={};try{G=await v0()}catch{}let K=[],W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U;while((U=W.exec(J))!==null){let O=U[1];if(/\bserver\b/.test(O))K.push(U[2])}let{context:B}=uE({__filename:X,__dirname:Mj.dirname(X)}),_=new Set,z={...G1,...G,...Y,buildMode:"compile",strict:!1},q=await X0(J,B,X,z,_),j=U$(q),H=O9();return{route:Z,sourceFile:$,html:q,fragment:j,placeholders:H,hasServerScripts:K.length>0,serverScriptContent:K,dependencies:Array.from(_),contentHash:Q,streamTemplates:B.__streamTemplates}}var e9=D(()=>{F1();i0();j6();p7()});import $Q from"fs";import Tj from"path";function ZQ($,Z,Y){return{version:1,buildTime:new Date().toISOString(),routes:$,assets:Z,outputDir:Y}}function YQ($,Z){let Y=Tj.join(Z,"manifest.json");$Q.writeFileSync(Y,JSON.stringify($,null,2))}function XQ($){let Z=Tj.join($,"manifest.json");if(!$Q.existsSync(Z))return null;try{let Y=$Q.readFileSync(Z,"utf-8"),X=JSON.parse(Y);if(X.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${X.version}`),null;return X}catch(Y){return console.warn("[stx] Failed to load manifest:",Y),null}}var fZ=()=>{};var Ej={};Z0(Ej,{buildForProduction:()=>Ij});import r1 from"fs";import t0 from"path";function pE($,Z){let Y=0,X=0;if(!r1.existsSync($))return{copied:Y,bytes:X};function J(Q,G){let K=r1.readdirSync(Q,{withFileTypes:!0});for(let W of K){if(mE.has(W.name))continue;let U=t0.join(Q,W.name),B=t0.join(G,W.name);if(W.isDirectory())r1.mkdirSync(B,{recursive:!0}),J(U,B);else if(W.isFile()){if(r1.existsSync(B))continue;r1.copyFileSync(U,B),Y++,X+=r1.statSync(B).size}}}return J($,Z),{copied:Y,bytes:X}}async function Ij($={}){let Z=Date.now(),Y=t0.resolve($.root||process.cwd()),X=t0.resolve(Y,$.outputDir||".output");console.log("[stx build] Starting production build...");let J={};try{J=await v0()}catch{}let Q=$.componentsDir??J.componentsDir??"components",G=$.partialsDir??J.partialsDir??"partials",K=$.layoutsDir??J.layoutsDir??"layouts",W=$.publicDir??J.publicDir??"public",U=J.app?.head||{},B=J.router?.container||"main";if(r1.existsSync(X))r1.rmSync(X,{recursive:!0});let _=[t0.join(X,"public","__stx"),t0.join(X,"public","assets"),t0.join(X,"server","pages"),t0.join(X,"server","fragments")];for(let R of _)r1.mkdirSync(R,{recursive:!0});console.log("[stx build] Discovering routes...");let z=B$(Y),q=["components","layouts","partials"],j=z.filter((R)=>{return!q.some((T)=>R.pattern.startsWith(`/${T}/`)||R.pattern===`/${T}`)});console.log(`[stx build] Found ${j.length} page routes (${z.length-j.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let H=r9($.debug),O=o9();await Bun.write(t0.join(X,"public","__stx",H.filename),H.content),await Bun.write(t0.join(X,"public","__stx",O.filename),O.content),console.log(`[stx build] Runtime: ${H.filename} (${(H.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${O.filename} (${(O.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let F=[],L=[];for(let R of j)try{let T=await t9(R.filePath,R.pattern,{componentsDir:Q,partialsDir:G,layoutsDir:K,debug:$.debug});if(F.push(T),T.html=T.html.replace(/runtime\.__STX_HASH__\.js/g,H.filename).replace(/router\.__STX_HASH__\.js/g,O.filename),T.html=s4(T.html,U,{bodyScripts:[`<script src="/__stx/${O.filename}"></script>`]}),!/<body[^>]*\bdata-stx=/.test(T.html)){let x=T.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(x&&x[1]){let y=x[1];T.html=T.html.replace(" "+y,""),T.html=T.html.replace(/<body([^>]*)>/,`<body$1 ${y}>`)}}T.html=T.html.replace(/<style data-crosswind="generated">[\s\S]*?<\/style>\s*/g,""),T.html=await T0(T.html),T.fragment=S6(T.html,B);let E=R.pattern==="/"?"index":R.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),k=t0.join("server","pages",`${E}.compiled.json`),S=t0.join("server","fragments",`${E}.html`);await Bun.write(t0.join(X,k),JSON.stringify(T,null,2)),await Bun.write(t0.join(X,S),T.fragment),L.push({pattern:R.pattern,compiledPath:k,fragmentPath:S,isDynamic:T.hasServerScripts,hasParams:R.pattern.includes(":")||R.pattern.includes("[")}),console.log(`[stx build] \u2713 ${R.pattern}`)}catch(T){console.error(`[stx build] \u2717 ${R.pattern}:`,T instanceof Error?T.message:T)}let V=t0.resolve(Y,W);if(r1.existsSync(V)){let{copied:R,bytes:T}=pE(V,t0.join(X,"public"));if(R>0)console.log(`[stx build] Copied ${R} public asset${R===1?"":"s"} (${(T/1024).toFixed(1)}KB) from ${W}/`)}let N={runtime:H.filename,router:O.filename},A=ZQ(L,N,X);YQ(A,X);let w=Date.now()-Z;return console.log(`
12808
+ </html>`}function xE($,Z){if($==="/"||$==="")return H0.join(Z.outputDir,"index.html");let Y=$.replace(/^\/|\/$/g,"");if(Z.trailingSlash)return H0.join(Z.outputDir,Y,"index.html");return H0.join(Z.outputDir,`${Y}.html`)}var vE;var Rj=D(()=>{C6();F1();qj();i0();m1();yZ();vE={generateStaticSite:Lj,createISRHandler:Vj,defineStaticPaths:Nj,createMarkdownLoader:Aj}});import{createHash as fE}from"crypto";import{getRouterScript as gE}from"stx-router";function s9($){return fE("sha256").update($).digest("hex").slice(0,8)}function r9($=!1){let Z=$?q5():Y6(),Y=s9(Z);return{content:Z,filename:`runtime.${Y}.js`,hash:Y}}function o9(){let $=gE(),Z=s9($);return{content:$,filename:`router.${Z}.js`,hash:Z}}function hE($){return{runtimeTag:$.runtime?`<script src="/__stx/${$.runtime.filename}"></script>`:"",routerTag:$.router?`<script src="/__stx/${$.router.filename}"></script>`:"",cssTag:$.css?`<link rel="stylesheet" href="/__stx/${$.css.filename}">`:""}}var a9=D(()=>{c8()});import Mj from"path";import{createHash as dE}from"crypto";function uE($={}){let Z=new Set;return{context:new Proxy($,{get(X,J){if(J in X)return X[J];if(typeof J==="string"&&!J.startsWith("__"))Z.add(J);return},has(X,J){if(J in X)return!0;if(typeof J==="string"&&!J.startsWith("__"))Z.add(J);return!1}}),accessedKeys:Z}}async function t9($,Z,Y={}){let X=Mj.resolve($),J=await Bun.file(X).text(),Q=dE("sha256").update(J).digest("hex").slice(0,16);H9();let G={};try{G=await v0()}catch{}let K=[],W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U;while((U=W.exec(J))!==null){let O=U[1];if(/\bserver\b/.test(O))K.push(U[2])}let{context:B}=uE({__filename:X,__dirname:Mj.dirname(X)}),_=new Set,z={...G1,...G,...Y,buildMode:"compile",strict:!1},q=await X0(J,B,X,z,_),j=U$(q),H=O9();return{route:Z,sourceFile:$,html:q,fragment:j,placeholders:H,hasServerScripts:K.length>0,serverScriptContent:K,dependencies:Array.from(_),contentHash:Q,streamTemplates:B.__streamTemplates}}var e9=D(()=>{F1();i0();j6();p7()});import $Q from"fs";import Tj from"path";function ZQ($,Z,Y){return{version:1,buildTime:new Date().toISOString(),routes:$,assets:Z,outputDir:Y}}function YQ($,Z){let Y=Tj.join(Z,"manifest.json");$Q.writeFileSync(Y,JSON.stringify($,null,2))}function XQ($){let Z=Tj.join($,"manifest.json");if(!$Q.existsSync(Z))return null;try{let Y=$Q.readFileSync(Z,"utf-8"),X=JSON.parse(Y);if(X.version!==1)return console.warn(`[stx] Manifest version mismatch: expected 1, got ${X.version}`),null;return X}catch(Y){return console.warn("[stx] Failed to load manifest:",Y),null}}var fZ=()=>{};var Ej={};Z0(Ej,{buildForProduction:()=>Ij});import r1 from"fs";import t0 from"path";function pE($,Z){let Y=0,X=0;if(!r1.existsSync($))return{copied:Y,bytes:X};function J(Q,G){let K=r1.readdirSync(Q,{withFileTypes:!0});for(let W of K){if(mE.has(W.name))continue;let U=t0.join(Q,W.name),B=t0.join(G,W.name);if(W.isDirectory())r1.mkdirSync(B,{recursive:!0}),J(U,B);else if(W.isFile()){if(r1.existsSync(B))continue;r1.copyFileSync(U,B),Y++,X+=r1.statSync(B).size}}}return J($,Z),{copied:Y,bytes:X}}async function Ij($={}){let Z=Date.now(),Y=t0.resolve($.root||process.cwd()),X=t0.resolve(Y,$.outputDir||".output");console.log("[stx build] Starting production build...");let J={};try{J=await v0()}catch{}let Q=$.componentsDir??J.componentsDir??"components",G=$.partialsDir??J.partialsDir??"partials",K=$.layoutsDir??J.layoutsDir??"layouts",W=$.publicDir??J.publicDir??"public",U=J.app?.head||{},B=J.router?.container||"main";if(r1.existsSync(X))r1.rmSync(X,{recursive:!0});let _=[t0.join(X,"public","__stx"),t0.join(X,"public","assets"),t0.join(X,"server","pages"),t0.join(X,"server","fragments")];for(let R of _)r1.mkdirSync(R,{recursive:!0});console.log("[stx build] Discovering routes...");let z=B$(Y),q=["components","layouts","partials"],j=z.filter((R)=>{return!q.some((T)=>R.pattern.startsWith(`/${T}/`)||R.pattern===`/${T}`)});console.log(`[stx build] Found ${j.length} page routes (${z.length-j.length} non-page files excluded)`),console.log("[stx build] Generating shared assets...");let H=r9($.debug),O=o9();await Bun.write(t0.join(X,"public","__stx",H.filename),H.content),await Bun.write(t0.join(X,"public","__stx",O.filename),O.content),console.log(`[stx build] Runtime: ${H.filename} (${(H.content.length/1024).toFixed(1)}KB)`),console.log(`[stx build] Router: ${O.filename} (${(O.content.length/1024).toFixed(1)}KB)`),console.log("[stx build] Compiling templates...");let F=[],L=[];for(let R of j)try{let T=await t9(R.filePath,R.pattern,{componentsDir:Q,partialsDir:G,layoutsDir:K,debug:$.debug});if(F.push(T),T.html=T.html.replace(/runtime\.__STX_HASH__\.js/g,H.filename).replace(/router\.__STX_HASH__\.js/g,O.filename),T.html=s4(T.html,U,{bodyScripts:[`<script src="/__stx/${O.filename}"></script>`]}),!/<body[^>]*\bdata-stx=/.test(T.html)){let x=T.html.match(/<(?!body\b)[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?\s(data-stx="[^"]+")[^>]*>/);if(x&&x[1]){let y=x[1];T.html=T.html.replace(" "+y,""),T.html=T.html.replace(/<body([^>]*)>/,`<body$1 ${y}>`)}}T.html=T.html.replace(/<style data-crosswind="generated">[\s\S]*?<\/style>\s*/g,""),T.html=await T0(T.html),T.fragment=S6(T.html,B);let E=R.pattern==="/"?"index":R.pattern.slice(1).replace(/\//g,"-").replace(/[[\]]/g,"_"),k=t0.join("server","pages",`${E}.compiled.json`),S=t0.join("server","fragments",`${E}.html`);await Bun.write(t0.join(X,k),JSON.stringify(T,null,2)),await Bun.write(t0.join(X,S),T.fragment),L.push({pattern:R.pattern,compiledPath:k,fragmentPath:S,isDynamic:T.hasServerScripts,hasParams:R.pattern.includes(":")||R.pattern.includes("[")}),console.log(`[stx build] \u2713 ${R.pattern}`)}catch(T){console.error(`[stx build] \u2717 ${R.pattern}:`,T instanceof Error?T.message:T)}let V=t0.resolve(Y,W);if(r1.existsSync(V)){let{copied:R,bytes:T}=pE(V,t0.join(X,"public"));if(R>0)console.log(`[stx build] Copied ${R} public asset${R===1?"":"s"} (${(T/1024).toFixed(1)}KB) from ${W}/`)}let N={runtime:H.filename,router:O.filename},A=ZQ(L,N,X);YQ(A,X);let w=Date.now()-Z;return console.log(`
12809
12809
  [stx build] Done in ${w}ms \u2014 ${F.length} pages compiled`),{pageCount:F.length,assets:N,outputDir:X,duration:w}}var mE;var JQ=D(()=>{C6();a9();e9();fZ();p7();m1();i0();mE=new Set([".DS_Store","Thumbs.db","desktop.ini",".gitkeep",".gitignore"])});import cE from"path";async function lE($={}){let Z=performance.now(),Y=$.root||process.cwd(),X=await v0(),J=X.ssr?"ssr":"ssg";console.log(`[stx build] Mode: ${J.toUpperCase()}${X.ssr?" (ssr: true in stx.config.ts)":" (default \u2014 ssr is false)"}`);let Q,G;if(J==="ssg"){let{generateStaticSite:W}=await Promise.resolve().then(() => (Rj(),wj));Q=await W({pagesDir:cE.join(X.root||".",X.pagesDir||X.build?.pagesDir||"pages"),publicDir:X.publicDir||X.build?.publicDir||"public",outputDir:X.build?.outputDir||"dist",generate404:X.build?.generate404??!0,minify:X.build?.minify??!0,cleanOutput:X.build?.cleanOutput??!0,...$.ssg})}else{let{buildForProduction:W}=await Promise.resolve().then(() => (JQ(),Ej));G=await W({outputDir:".output",debug:$.debug,...$.ssr})}let K=Math.round(performance.now()-Z);return{mode:J,ssg:Q,ssr:G,duration:K}}var Dj=D(()=>{i0()});import gZ from"path";async function nE($){let Z=performance.now(),Y=await v0($),X=$||Y.root||process.cwd(),J=[Y.build?.pagesDir||Y.pagesDir||"pages",Y.componentsDir||"components",Y.layoutsDir||"layouts",Y.partialsDir||"partials"].map((K)=>gZ.resolve(X,K)),Q=[],G=0;for(let K of J){let W=await Sj(K);for(let U of W){G++;let B=await Bun.file(U).text();if(kj.test(B))Q.push(gZ.relative(X,U))}}return{mode:Q.length>0?"ssr":"ssg",serverScriptFiles:Q,totalFilesScanned:G,scanDurationMs:Math.round(performance.now()-Z)}}async function sE($){let Z=await v0($),Y=$||Z.root||process.cwd(),X=gZ.resolve(Y,Z.componentsDir||"components"),J=[],Q=await Sj(X);for(let G of Q){let K=await Bun.file(G).text(),W=kj.test(K),U=iE.test(K)||/<script\b(?![^>]*\bserver\b)[^>]*>/i.test(K)&&!W;if(W&&U){let B=gZ.relative(Y,G);J.push({file:B,message:`Component "${B}" has both <script server> and <script client>. `+"Components should be server OR client \u2014 compose them via props/slots."})}}return J}async function Sj($){let Z=[];try{let Y=new Bun.Glob("**/*.stx");for await(let X of Y.scan({cwd:$,absolute:!0}))Z.push(X)}catch{}return Z}var kj,iE;var bj=D(()=>{i0();kj=/<script\b[^>]*\bserver\b/i,iE=/<script\b[^>]*\bclient\b/i});function QQ($){let Z=new Map,Y=/@(\w+)/g,X,J=1,Q=0;while((X=Y.exec($))!==null){let G=X[1],K=$.slice(Q,X.index);J+=(K.match(/\n/g)||[]).length,Q=X.index;let W=X.index-$.lastIndexOf(`
12810
12810
  `,X.index-1);if(yj.includes(G)){let U=Z.get(G);if(U)U.count++,U.locations.push({line:J,column:W});else Z.set(G,{name:G,count:1,locations:[{line:J,column:W}]})}}return Array.from(Z.values())}function Pj($,Z=[]){let Y=QQ($),X=new Set(Y.map((J)=>J.name));for(let J of Z)X.add(J);for(let J of Array.from(X))if(!J.startsWith("end"))X.add(`end${J}`);return yj.filter((J)=>!X.has(J))}function xj($){let Z=[],Y={conditionals:["if","else","elseif","endif","unless","endunless","switch","case","default","endswitch","isset","endisset"],loops:["for","endfor","foreach","endforeach","forelse","endforelse","while","endwhile","break","continue","empty"],includes:["include","includeIf","includeWhen","includeFirst","once","endonce","extends","section","endsection","yield","parent","push","endpush","prepend","endprepend","stack"],components:["component","endcomponent","slot","endslot","props"],auth:["auth","endauth","guest","endguest","can","endcan","cannot","endcannot","role","endrole","hasRole","endhasRole","hasAnyRole","endhasAnyRole"],forms:["csrf","method","error","enderror","old","input","textarea","select","checkbox","radio","file"],i18n:["translate","lang","choice"],seo:["meta","title","seo","jsonld","canonical","robots","sitemap"]},X=new Set;for(let Q of $)for(let[G,K]of Object.entries(Y))if(K.includes(Q)){X.add(G);break}for(let Q of X)Z.push(`import { process${oE(Q)} } from './${Q}'`);let J=$.filter((Q)=>!Q.startsWith("end")).map((Q)=>` '${Q}': true`).join(`,
12811
12811
  `);return`// Tree-shaken directive bundle
@@ -12820,7 +12820,7 @@ ${J}
12820
12820
  export function isDirectiveActive(name: string): boolean {
12821
12821
  return name in activeDirectives
12822
12822
  }
12823
- `}function vj($,Z={}){let Y=[],X=/@if\(([^)]+)\)[\s\S]*?@endif/g,J=$.matchAll(X);for(let U of J){let B=U[1].trim();if(hZ(B,Z)===!1)Y.push({start:U.index,end:U.index+U[0].length,reason:`@if condition always false: ${B}`})}let Q=/@unless\(([^)]+)\)[\s\S]*?@endunless/g,G=$.matchAll(Q);for(let U of G){let B=U[1].trim();if(hZ(B,Z)===!0)Y.push({start:U.index,end:U.index+U[0].length,reason:`@unless condition always true: ${B}`})}let K=/@env\(['"]development['"]\)[\s\S]*?@endenv/g;if(Z.__ENV__==="production"){let U=$.matchAll(K);for(let B of U)Y.push({start:B.index,end:B.index+B[0].length,reason:"Development-only code in production build"})}let W=/@debug[\s\S]*?@enddebug/g;if(Z.__ENV__==="production"){let U=$.matchAll(W);for(let B of U)Y.push({start:B.index,end:B.index+B[0].length,reason:"Debug code in production build"})}return Y}function fj($,Z={}){let Y=vj($,Z),X=[];Y.sort((Q,G)=>G.start-Q.start);let J=$;for(let Q of Y)J=J.slice(0,Q.start)+J.slice(Q.end),X.push(Q.reason);return{content:J,removed:X}}function hZ($,Z){if($==="true")return!0;if($==="false")return!1;if($==="null")return null;if(/^\d+$/.test($))return Number.parseInt($,10);if(/^\d+\.\d+$/.test($))return Number.parseFloat($);if(/^['"].*['"]$/.test($))return $.slice(1,-1);if($ in Z)return Z[$];let Y=$.match(/^(\w+)\s*(===|!==|==|!=|>=|<=|>|<)\s*(.+)$/);if(Y){let[,X,J,Q]=Y,G=X in Z?Z[X]:void 0,K=hZ(Q,Z);if(G!==void 0&&K!==void 0)switch(J){case"==":case"===":return G===K;case"!=":case"!==":return G!==K;case">":return G>K;case"<":return G<K;case">=":return G>=K;case"<=":return G<=K}}return}function gj($,Z){let Y=[],X=$;return X=X.replace(/\{\{\s*(\w+)\s*\}\}/g,(J,Q)=>{if(Q in Z)return Y.push(`{{ ${Q} }} -> ${Z[Q]}`),String(Z[Q]);return J}),X=X.replace(/\{\{\s*(\d+)\s*([+\-*])\s*(\d+)\s*\}\}/g,(J,Q,G,K)=>{let W=Number.parseInt(Q,10),U=Number.parseInt(K,10),B;switch(G){case"+":B=W+U;break;case"-":B=W-U;break;case"*":B=W*U;break;default:return J}return Y.push(`{{ ${Q} ${G} ${K} }} -> ${B}`),String(B)}),{content:X,folded:Y}}function hj($){let Z=$,Y=[],X=0;Z=Z.replace(/<(pre|code|script|style)([^>]*)>([\s\S]*?)<\/\1>/gi,(J)=>{let Q=`__PRESERVE_${X++}__`;return Y.push({marker:Q,content:J}),Q}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(J)=>{let Q=`__PRESERVE_${X++}__`;return Y.push({marker:Q,content:J}),Q}),Z=Z.replace(/\{\{--([\s\S]*?)--\}\}/g,""),Z=Z.replace(/<!--[\s\S]*?-->/g,""),Z=Z.replace(/>\s+</g,"><"),Z=Z.replace(/^\s+/gm,""),Z=Z.replace(/\s+$/gm,""),Z=Z.replace(/\s{2,}/g," ");for(let{marker:J,content:Q}of Y){let G=Z.indexOf(J);if(G!==-1)Z=Z.slice(0,G)+Q+Z.slice(G+J.length)}return Z.trim()}function dj($){let Z=new Map,Y=new Map,X=/(['"])([^'"]{10,})\1/g,J;while((J=X.exec($))!==null){let K=J[2];Y.set(K,(Y.get(K)||0)+1)}let Q=0,G=$;for(let[K,W]of Y)if(W>1){let U=`__STR_${Q++}__`;Z.set(U,K);let B=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`(['"])${B}\\1`,"g");G=G.replace(_,U)}return{content:G,pool:Z,count:Z.size}}function uj($,Z={}){let Y={...Cj,...Z},X=new Blob([$]).size,J=$,Q=[],G=[],K=[],W=[],U=0;if(Y.target==="production")Y.constants={...Y.constants,__ENV__:"production"};if(Y.deadCodeElimination){let z=fj(J,Y.constants);if(J=z.content,z.removed.length>0)Q.push("Dead code elimination"),G.push(...z.removed.map((q)=>`Removed: ${q}`))}if(Y.constantFolding&&Object.keys(Y.constants).length>0){let z=gj(J,Y.constants);if(J=z.content,W=z.folded,W.length>0)Q.push("Constant folding")}if(Y.treeShake){if(K=Pj(J,Y.preserveDirectives),K.length>0)Q.push("Tree shaking")}if(Y.stringPooling){let z=dj(J);if(J=z.content,U=z.count,U>0)Q.push("String pooling")}if(Y.minifyHtml){let z=hj(J);if(z.length<J.length)J=z,Q.push("HTML minification")}let B=new Blob([J]).size,_=X>0?Math.round((1-B/X)*100):0;return{content:J,originalSize:X,optimizedSize:B,reduction:_,appliedOptimizations:Q,removedDirectives:K,foldedConstants:W,pooledStrings:U,warnings:G}}async function rE($,Z={}){let Y={...Cj,...Z},X=new Map,J=[],Q=0,G=0,K=new Set;for(let[_,z]of $){let q=uj(z,Y);X.set(_,q),Q+=q.originalSize,G+=q.optimizedSize,J.push(...q.warnings.map((H)=>`${_}: ${H}`));let j=QQ(z);for(let H of j)K.add(H.name)}let W;if(Y.treeShake)W=xj(Array.from(K));let U;if(Y.stringPooling)U=new Map;let B=Q>0?Math.round((1-G/Q)*100):0;return{templates:X,directiveBundle:W,stringPool:U,totalOriginalSize:Q,totalOptimizedSize:G,overallReduction:B,warnings:J}}function oE($){return $.charAt(0).toUpperCase()+$.slice(1)}var Cj,yj;var mj=D(()=>{Cj={treeShake:!0,deadCodeElimination:!0,constantFolding:!0,stringPooling:!1,minifyHtml:!0,removeDevCode:!0,constants:{},preserveDirectives:[],target:"production"},yj=["if","else","elseif","endif","unless","endunless","switch","case","default","endswitch","for","endfor","foreach","endforeach","forelse","endforelse","while","endwhile","break","continue","empty","extends","section","endsection","yield","parent","include","includeIf","includeWhen","includeFirst","once","endonce","push","endpush","prepend","endprepend","stack","component","endcomponent","slot","endslot","props","auth","endauth","guest","endguest","can","endcan","cannot","endcannot","role","endrole","hasRole","endhasRole","hasAnyRole","endhasAnyRole","csrf","method","error","enderror","old","input","textarea","select","checkbox","radio","file","translate","lang","choice","meta","title","seo","jsonld","canonical","robots","sitemap","ts","endts","js","endjs","css","endcss","markdown","endmarkdown","verbatim","endverbatim","env","production","debug","isset","endisset","empty","endempty"]});var WQ={};Z0(WQ,{toUsers:()=>rj,toUser:()=>sj,stopBroadcasting:()=>ij,startBroadcasting:()=>lj,loadChannels:()=>nj,getBroadcastServer:()=>cj,channel:()=>tj,broadcastPrivate:()=>oj,broadcastPresence:()=>aj,broadcast:()=>KQ,BroadcastServer:()=>$H,Broadcast:()=>ej});import{Broadcast as c7,BroadcastServer as aE}from"ts-broadcasting";import{channel as tj}from"ts-broadcasting";import{Broadcast as ej,BroadcastServer as $H}from"ts-broadcasting";function cj(){return V1}async function lj($){if(V1)return V1;let Z=$.driver??"bun",Y=$.host??"0.0.0.0",X=$.port??6001,J=$.scheme??"ws",Q={verbose:$.verbose??!1,driver:Z,default:Z,connections:{[Z]:{driver:Z,host:Y,port:X,scheme:J}}};return V1=new aE(Q),c7.setServer(V1),await V1.start(),V1}async function ij(){for(let $ of GQ)clearInterval($);if(GQ.length=0,!V1)return;await V1.stop(),V1=null}async function nj($){let Z=await import($),Y=Z.default??Z;if(typeof Y!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof Y}`);let X=0;return Y({channel(Q,G){if(X++,G.authorize&&V1)V1.channels.channel(Q,G.authorize);if(G.interval&&G.data){let K=G.event??`${Q}.updated`,W=G.data,U=setInterval(async()=>{try{let B=await W();KQ(Q,K,B)}catch{}},G.interval);GQ.push(U)}}}),X}function y6(){if(V1)return!0;if(!pj)pj=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function KQ($,Z,Y){if(!y6())return;c7.send($,Z,Y)}function sj($,Z,Y){if(!y6())return;c7.toUser($,Z,Y)}function rj($,Z,Y){if(!y6())return;c7.toUsers($,Z,Y)}function oj($,Z,Y){if(!y6())return;c7.send(`private-${$}`,Z,Y)}function aj($,Z,Y){if(!y6())return;c7.presence($,Z,Y)}var V1=null,GQ,pj=!1;var dZ=D(()=>{GQ=[]});function ZH($,Z){let Y={},X=$.trim();if(X.startsWith("{"))X=X.slice(1);if(X.endsWith("}"))X=X.slice(0,-1);if(X=X.trim(),!X)return Y;let J=0;while(J<X.length){while(J<X.length&&/\s/.test(X[J]))J++;if(J>=X.length)break;let Q="";if(X[J]==='"'||X[J]==="'"){let W=X[J];J++;while(J<X.length&&X[J]!==W)if(X[J]==="\\"&&J+1<X.length)Q+=X[J+1],J+=2;else Q+=X[J],J++;J++}else while(J<X.length&&/[\w$]/.test(X[J]))Q+=X[J],J++;while(J<X.length&&/\s/.test(X[J]))J++;if(X[J]===":")J++;while(J<X.length&&/\s/.test(X[J]))J++;let G,K=J;if(X[J]==='"'||X[J]==="'"){let W=X[J];J++;let U="";while(J<X.length&&X[J]!==W)if(X[J]==="\\"&&J+1<X.length)U+=X[J+1],J+=2;else U+=X[J],J++;J++,G=U}else if(X[J]==="{"){let W=1;J++;while(J<X.length&&W>0){if(X[J]==="{")W++;else if(X[J]==="}")W--;else if(X[J]==='"'||X[J]==="'"){let B=X[J];J++;while(J<X.length&&X[J]!==B){if(X[J]==="\\")J++;J++}}J++}let U=X.slice(K,J);G=ZH(U,Z)}else if(X[J]==="["){let W=1;J++;while(J<X.length&&W>0){if(X[J]==="[")W++;else if(X[J]==="]")W--;else if(X[J]==='"'||X[J]==="'"){let B=X[J];J++;while(J<X.length&&X[J]!==B){if(X[J]==="\\")J++;J++}}J++}let U=X.slice(K,J);try{G=JSON.parse(U.replace(/'/g,'"'))}catch{G=U}}else{let W="";while(J<X.length&&X[J]!==","&&!/\s/.test(X[J]))W+=X[J],J++;if(W=W.trim(),W==="true")G=!0;else if(W==="false")G=!1;else if(W==="null")G=null;else if(W==="undefined")G=void 0;else if(/^-?\d+(\.\d+)?$/.test(W))G=Number(W);else if(W in Z)G=Z[W];else G=W}if(Q)Y[Q]=G;while(J<X.length&&/\s/.test(X[J]))J++;if(X[J]===",")J++}return Y}function tE($,Z,Y){let X=[];for(let[J,Q]of Object.entries(Z)){let G=$[J];if(Q.required&&(G===void 0||G===null)){X.push(`Component "${Y}": Missing required prop "${J}"`);continue}if(G===void 0||G===null)continue;let K=Array.isArray(Q.type)?Q.type:[Q.type];if(!K.includes("any")){let W=$D(G);if(!K.includes(W))X.push(`Component "${Y}": Prop "${J}" expected ${K.join(" | ")}, got ${W}`)}if(Q.validator&&!Q.validator(G))X.push(`Component "${Y}": Prop "${J}" failed custom validation`)}return X}function eE($,Z){let Y={...$};for(let[X,J]of Object.entries(Z))if(Y[X]===void 0&&J.default!==void 0)Y[X]=typeof J.default==="function"?J.default():J.default;return Y}function $D($){if(Array.isArray($))return"array";if($===null)return"null";return typeof $}function ZD(){return[YH]}var YH;var XH=D(()=>{j1();h0();N0();YH={name:"component",handler:async($,Z,Y,X)=>{if(Z.length<1)return J0("Component","component directive requires at least the component name",e.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q={};if(Z.length>1)try{let B=Z.slice(1).join(",").trim();if(B.startsWith("{")){if(Q=y0(B,Y),Object.keys(Q).length===0)Q=ZH(B,Y)}else{let _=B.trim(),z=Y[_];if(z&&typeof z==="object"&&!Array.isArray(z))Q=z}}catch(B){let _=B instanceof Error?B.message:String(B);return console.error("Component props parsing error:",_),J0("Component",`Error parsing component props: ${_}`,e.EVALUATION_ERROR)}let G=Y.__stx_options||{},K=G.componentsDir||"components",W=new Set;if(!Y.__processedComponents)Y.__processedComponents=new Set;let U=Y.__processedComponents;try{return await c1(J,Q,"",K,Y,X,G,U,W)}catch(B){console.error("Component rendering error:",B);let _=B instanceof Error?B.message:String(B);return J0("Component",`Error rendering component: ${_}`,e.COMPONENT_RENDER_ERROR)}},hasEndTag:!1}});function uZ(){return`
12823
+ `}function vj($,Z={}){let Y=[],X=/@if\(([^)]+)\)[\s\S]*?@endif/g,J=$.matchAll(X);for(let U of J){let B=U[1].trim();if(hZ(B,Z)===!1)Y.push({start:U.index,end:U.index+U[0].length,reason:`@if condition always false: ${B}`})}let Q=/@unless\(([^)]+)\)[\s\S]*?@endunless/g,G=$.matchAll(Q);for(let U of G){let B=U[1].trim();if(hZ(B,Z)===!0)Y.push({start:U.index,end:U.index+U[0].length,reason:`@unless condition always true: ${B}`})}let K=/@env\(['"]development['"]\)[\s\S]*?@endenv/g;if(Z.__ENV__==="production"){let U=$.matchAll(K);for(let B of U)Y.push({start:B.index,end:B.index+B[0].length,reason:"Development-only code in production build"})}let W=/@debug[\s\S]*?@enddebug/g;if(Z.__ENV__==="production"){let U=$.matchAll(W);for(let B of U)Y.push({start:B.index,end:B.index+B[0].length,reason:"Debug code in production build"})}return Y}function fj($,Z={}){let Y=vj($,Z),X=[];Y.sort((Q,G)=>G.start-Q.start);let J=$;for(let Q of Y)J=J.slice(0,Q.start)+J.slice(Q.end),X.push(Q.reason);return{content:J,removed:X}}function hZ($,Z){if($==="true")return!0;if($==="false")return!1;if($==="null")return null;if(/^\d+$/.test($))return Number.parseInt($,10);if(/^\d+\.\d+$/.test($))return Number.parseFloat($);if(/^['"].*['"]$/.test($))return $.slice(1,-1);if($ in Z)return Z[$];let Y=$.match(/^(\w+)\s*(===|!==|==|!=|>=|<=|>|<)\s*(.+)$/);if(Y){let[,X,J,Q]=Y,G=X in Z?Z[X]:void 0,K=hZ(Q,Z);if(G!==void 0&&K!==void 0)switch(J){case"==":case"===":return G===K;case"!=":case"!==":return G!==K;case">":return G>K;case"<":return G<K;case">=":return G>=K;case"<=":return G<=K}}return}function gj($,Z){let Y=[],X=$;return X=X.replace(/\{\{\s*(\w+)\s*\}\}/g,(J,Q)=>{if(Q in Z)return Y.push(`{{ ${Q} }} -> ${Z[Q]}`),String(Z[Q]);return J}),X=X.replace(/\{\{\s*(\d+)\s*([+\-*])\s*(\d+)\s*\}\}/g,(J,Q,G,K)=>{let W=Number.parseInt(Q,10),U=Number.parseInt(K,10),B;switch(G){case"+":B=W+U;break;case"-":B=W-U;break;case"*":B=W*U;break;default:return J}return Y.push(`{{ ${Q} ${G} ${K} }} -> ${B}`),String(B)}),{content:X,folded:Y}}function hj($){let Z=$,Y=[],X=0;Z=Z.replace(/<(pre|code|script|style)([^>]*)>([\s\S]*?)<\/\1>/gi,(J)=>{let Q=`__PRESERVE_${X++}__`;return Y.push({marker:Q,content:J}),Q}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(J)=>{let Q=`__PRESERVE_${X++}__`;return Y.push({marker:Q,content:J}),Q}),Z=Z.replace(/\{\{--([\s\S]*?)--\}\}/g,""),Z=Z.replace(/<!--[\s\S]*?-->/g,""),Z=Z.replace(/>\s+</g,"><"),Z=Z.replace(/^\s+/gm,""),Z=Z.replace(/\s+$/gm,""),Z=Z.replace(/\s{2,}/g," ");for(let{marker:J,content:Q}of Y){let G=Z.indexOf(J);if(G!==-1)Z=Z.slice(0,G)+Q+Z.slice(G+J.length)}return Z.trim()}function dj($){let Z=new Map,Y=new Map,X=/(['"])([^'"]{10,})\1/g,J;while((J=X.exec($))!==null){let K=J[2];Y.set(K,(Y.get(K)||0)+1)}let Q=0,G=$;for(let[K,W]of Y)if(W>1){let U=`__STR_${Q++}__`;Z.set(U,K);let B=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`(['"])${B}\\1`,"g");G=G.replace(_,U)}return{content:G,pool:Z,count:Z.size}}function uj($,Z={}){let Y={...Cj,...Z},X=new Blob([$]).size,J=$,Q=[],G=[],K=[],W=[],U=0;if(Y.target==="production")Y.constants={...Y.constants,__ENV__:"production"};if(Y.deadCodeElimination){let z=fj(J,Y.constants);if(J=z.content,z.removed.length>0)Q.push("Dead code elimination"),G.push(...z.removed.map((q)=>`Removed: ${q}`))}if(Y.constantFolding&&Object.keys(Y.constants).length>0){let z=gj(J,Y.constants);if(J=z.content,W=z.folded,W.length>0)Q.push("Constant folding")}if(Y.treeShake){if(K=Pj(J,Y.preserveDirectives),K.length>0)Q.push("Tree shaking")}if(Y.stringPooling){let z=dj(J);if(J=z.content,U=z.count,U>0)Q.push("String pooling")}if(Y.minifyHtml){let z=hj(J);if(z.length<J.length)J=z,Q.push("HTML minification")}let B=new Blob([J]).size,_=X>0?Math.round((1-B/X)*100):0;return{content:J,originalSize:X,optimizedSize:B,reduction:_,appliedOptimizations:Q,removedDirectives:K,foldedConstants:W,pooledStrings:U,warnings:G}}async function rE($,Z={}){let Y={...Cj,...Z},X=new Map,J=[],Q=0,G=0,K=new Set;for(let[_,z]of $){let q=uj(z,Y);X.set(_,q),Q+=q.originalSize,G+=q.optimizedSize,J.push(...q.warnings.map((H)=>`${_}: ${H}`));let j=QQ(z);for(let H of j)K.add(H.name)}let W;if(Y.treeShake)W=xj(Array.from(K));let U;if(Y.stringPooling)U=new Map;let B=Q>0?Math.round((1-G/Q)*100):0;return{templates:X,directiveBundle:W,stringPool:U,totalOriginalSize:Q,totalOptimizedSize:G,overallReduction:B,warnings:J}}function oE($){return $.charAt(0).toUpperCase()+$.slice(1)}var Cj,yj;var mj=D(()=>{Cj={treeShake:!0,deadCodeElimination:!0,constantFolding:!0,stringPooling:!1,minifyHtml:!0,removeDevCode:!0,constants:{},preserveDirectives:[],target:"production"},yj=["if","else","elseif","endif","unless","endunless","switch","case","default","endswitch","for","endfor","foreach","endforeach","forelse","endforelse","while","endwhile","break","continue","empty","extends","section","endsection","yield","parent","include","includeIf","includeWhen","includeFirst","once","endonce","push","endpush","prepend","endprepend","stack","component","endcomponent","slot","endslot","props","auth","endauth","guest","endguest","can","endcan","cannot","endcannot","role","endrole","hasRole","endhasRole","hasAnyRole","endhasAnyRole","csrf","method","error","enderror","old","input","textarea","select","checkbox","radio","file","translate","lang","choice","meta","title","seo","jsonld","canonical","robots","sitemap","ts","endts","js","endjs","css","endcss","markdown","endmarkdown","verbatim","endverbatim","env","production","debug","isset","endisset","empty","endempty"]});var WQ={};Z0(WQ,{toUsers:()=>rj,toUser:()=>sj,stopBroadcasting:()=>ij,startBroadcasting:()=>lj,loadChannels:()=>nj,getBroadcastServer:()=>cj,channel:()=>tj,broadcastPrivate:()=>oj,broadcastPresence:()=>aj,broadcast:()=>KQ,BroadcastServer:()=>$H,Broadcast:()=>ej});import{Broadcast as c7,BroadcastServer as aE}from"ts-broadcasting";import{channel as tj}from"ts-broadcasting";import{Broadcast as ej,BroadcastServer as $H}from"ts-broadcasting";function cj(){return V1}async function lj($){if(V1)return V1;let Z=$.driver??"bun",Y=$.host??"0.0.0.0",X=$.port??6001,J=$.scheme??"ws",Q={verbose:$.verbose??!1,driver:Z,default:Z,connections:{[Z]:{driver:Z,host:Y,port:X,scheme:J}}};return V1=new aE(Q),c7.setServer(V1),await V1.start(),V1}async function ij(){for(let $ of GQ)clearInterval($);if(GQ.length=0,!V1)return;await V1.stop(),V1=null}async function nj($){let Z=await import($),Y=Z.default??Z;if(typeof Y!=="function")throw Error(`routes/channels.ts must export a default function, got ${typeof Y}`);let X=0;return Y({channel(Q,G){if(X++,G.authorize&&V1)V1.channels.channel(Q,G.authorize);if(G.interval&&G.data){let K=G.event??`${Q}.updated`,W=G.data,U=setInterval(async()=>{try{let B=await W();KQ(Q,K,B)}catch{}},G.interval);GQ.push(U)}}}),X}function y6(){if(V1)return!0;if(!pj)pj=!0,console.warn("[stx] broadcast() called before server started \u2014 messages will be sent once broadcasting is ready");return!1}function KQ($,Z,Y){if(!y6())return;c7.send($,Z,Y)}function sj($,Z,Y){if(!y6())return;c7.toUser($,Z,Y)}function rj($,Z,Y){if(!y6())return;c7.toUsers($,Z,Y)}function oj($,Z,Y){if(!y6())return;c7.send(`private-${$}`,Z,Y)}function aj($,Z,Y){if(!y6())return;c7.presence($,Z,Y)}var V1=null,GQ,pj=!1;var dZ=D(()=>{GQ=[]});function ZH($,Z){let Y={},X=$.trim();if(X.startsWith("{"))X=X.slice(1);if(X.endsWith("}"))X=X.slice(0,-1);if(X=X.trim(),!X)return Y;let J=0;while(J<X.length){while(J<X.length&&/\s/.test(X[J]))J++;if(J>=X.length)break;let Q="";if(X[J]==='"'||X[J]==="'"){let W=X[J];J++;while(J<X.length&&X[J]!==W)if(X[J]==="\\"&&J+1<X.length)Q+=X[J+1],J+=2;else Q+=X[J],J++;J++}else while(J<X.length&&/[\w$]/.test(X[J]))Q+=X[J],J++;while(J<X.length&&/\s/.test(X[J]))J++;if(X[J]===":")J++;while(J<X.length&&/\s/.test(X[J]))J++;let G,K=J;if(X[J]==='"'||X[J]==="'"){let W=X[J];J++;let U="";while(J<X.length&&X[J]!==W)if(X[J]==="\\"&&J+1<X.length)U+=X[J+1],J+=2;else U+=X[J],J++;J++,G=U}else if(X[J]==="{"){let W=1;J++;while(J<X.length&&W>0){if(X[J]==="{")W++;else if(X[J]==="}")W--;else if(X[J]==='"'||X[J]==="'"){let B=X[J];J++;while(J<X.length&&X[J]!==B){if(X[J]==="\\")J++;J++}}J++}let U=X.slice(K,J);G=ZH(U,Z)}else if(X[J]==="["){let W=1;J++;while(J<X.length&&W>0){if(X[J]==="[")W++;else if(X[J]==="]")W--;else if(X[J]==='"'||X[J]==="'"){let B=X[J];J++;while(J<X.length&&X[J]!==B){if(X[J]==="\\")J++;J++}}J++}let U=X.slice(K,J);try{G=JSON.parse(U.replace(/'/g,'"'))}catch{G=U}}else{let W="";while(J<X.length&&X[J]!==","&&!/\s/.test(X[J]))W+=X[J],J++;if(W=W.trim(),W==="true")G=!0;else if(W==="false")G=!1;else if(W==="null")G=null;else if(W==="undefined")G=void 0;else if(/^-?\d+(\.\d+)?$/.test(W))G=Number(W);else if(W in Z)G=Z[W];else G=W}if(Q)Y[Q]=G;while(J<X.length&&/\s/.test(X[J]))J++;if(X[J]===",")J++}return Y}function tE($,Z,Y){let X=[];for(let[J,Q]of Object.entries(Z)){let G=$[J];if(Q.required&&(G===void 0||G===null)){X.push(`Component "${Y}": Missing required prop "${J}"`);continue}if(G===void 0||G===null)continue;let K=Array.isArray(Q.type)?Q.type:[Q.type];if(!K.includes("any")){let W=$D(G);if(!K.includes(W))X.push(`Component "${Y}": Prop "${J}" expected ${K.join(" | ")}, got ${W}`)}if(Q.validator&&!Q.validator(G))X.push(`Component "${Y}": Prop "${J}" failed custom validation`)}return X}function eE($,Z){let Y={...$};for(let[X,J]of Object.entries(Z))if(Y[X]===void 0&&J.default!==void 0)Y[X]=typeof J.default==="function"?J.default():J.default;return Y}function $D($){if(Array.isArray($))return"array";if($===null)return"null";return typeof $}function ZD(){return[YH]}var YH;var XH=D(()=>{j1();h0();A0();YH={name:"component",handler:async($,Z,Y,X)=>{if(Z.length<1)return J0("Component","component directive requires at least the component name",e.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q={};if(Z.length>1)try{let B=Z.slice(1).join(",").trim();if(B.startsWith("{")){if(Q=y0(B,Y),Object.keys(Q).length===0)Q=ZH(B,Y)}else{let _=B.trim(),z=Y[_];if(z&&typeof z==="object"&&!Array.isArray(z))Q=z}}catch(B){let _=B instanceof Error?B.message:String(B);return console.error("Component props parsing error:",_),J0("Component",`Error parsing component props: ${_}`,e.EVALUATION_ERROR)}let G=Y.__stx_options||{},K=G.componentsDir||"components",W=new Set;if(!Y.__processedComponents)Y.__processedComponents=new Set;let U=Y.__processedComponents;try{return await c1(J,Q,"",K,Y,X,G,U,W)}catch(B){console.error("Component rendering error:",B);let _=B instanceof Error?B.message:String(B);return J0("Component",`Error rendering component: ${_}`,e.COMPONENT_RENDER_ERROR)}},hasEndTag:!1}});function uZ(){return`
12824
12824
  /* Theme selector for code blocks */
12825
12825
  .theme-selector {
12826
12826
  margin: 1rem 0;
@@ -13554,12 +13554,12 @@ ${j.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),con
13554
13554
  ${M.blue}stx${M.reset} ${M.green}${process.env.stx_VERSION||"v0.0.10"}${M.reset} ${M.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${M.reset}`),console.log(`
13555
13555
  ${M.bright}\u2192 ${M.cyan}http://localhost:${B}/${M.reset}`),console.log(`
13556
13556
  ${M.yellow}Routes:${M.reset}`);let z=new Set(K.map((j)=>j.routeTemplate)),q=Object.entries(G).filter(([j])=>!z.has(j)).sort(([j],[H])=>j.localeCompare(H)).map(([j,H])=>({route:j==="/"?"/":j,filePath:e0.relative(process.cwd(),H.filePath),fileType:H.fileType}));for(let j of K){let H=j.routeTemplate.replace(/\[([^\]]+)\]/g,":$1");q.push({route:H,filePath:e0.relative(process.cwd(),j.filePath),fileType:"stx"})}if(q.sort((j,H)=>j.route.localeCompare(H.route)),q.forEach((j,H)=>{let F=H===q.length-1?"\u2514\u2500 ":"\u251C\u2500 ",L=j.fileType==="md"?`${M.magenta}(markdown)${M.reset}`:"";console.log(` ${M.green}${F}${j.route}${M.reset} \u2192 ${M.bright}${j.filePath}${M.reset} ${L}`)}),console.log(`
13557
- Press ${M.cyan}h${M.reset} + ${M.cyan}Enter${M.reset} to show shortcuts`),t$(_.url.toString(),()=>{if(X)e$.watch(Q,{recursive:!0}).close();_.stop()}),X){console.log(`${M.blue}Watching for changes...${M.reset}`);let j=e$.watch(Q,{recursive:!0},async(H,O)=>{if(!O)return;if(O.endsWith(".stx")||O.endsWith(".js")||O.endsWith(".ts")||O.endsWith(".md"))console.log(`${M.yellow}File ${M.bright}${O}${M.yellow} changed, rebuilding...${M.reset}`),n$.clear(),i$(),await W()});process.on("SIGINT",()=>{j.close(),_.stop(),process.exit(0)})}return!0}var _H=D(()=>{O7();i0();C7();nZ();N0();P6()});var{serve:zD}=globalThis.Bun;import z1 from"fs";import q0 from"path";function jQ($){let Z=Bun.file($),Y=q0.extname($).toLowerCase(),X={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},Q=[".js",".css",".json"].includes(Y)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(Z,{headers:{"Content-Type":X[Y]||"application/octet-stream",...Q}})}async function zH($=".",Z={}){let Y=Z.port||3000,X=Z.watch!==!1,J=Z.hotReload!==!1&&X,Q=null,G=Z.hmrPort||Y+1,K=q0.resolve($),{loadStxConfig:W}=await Promise.resolve().then(() => (o$(),I5)),U=await W(K),B=U.root&&U.root!=="."?q0.join(K,U.root):K,_=U.pagesDir||"pages",z=q0.join(B,_);if(!z1.existsSync(z))return console.error(`${M.red}Error: No '${_}' directory found in ${M.bright}${B}${M.reset}`),console.log(`${M.dim}Create a ${_}/ directory with .stx files to define your routes.${M.reset}`),console.log(`${M.dim}Example: ${_}/index.stx for the homepage.${M.reset}`),!1;let q=B$(B);if(q.length===0)return console.error(`${M.red}Error: No page files found in ${M.bright}${z}${M.reset}`),!1;console.log(`${M.blue}Found ${M.bright}${q.length}${M.blue} routes${M.reset}`);let j=U?._pluginPageDirs||[],H=[];for(let{dir:C,prefix:h}of j)if(z1.existsSync(C)){let p=B$(q0.dirname(C),{pagesDir:q0.basename(C)});for(let i of p){let s=h==="/"?i.pattern:`${h}${i.pattern==="/"?"":i.pattern}`;H.push({route:{...i,pattern:s},prefix:h})}if(p.length>0)console.log(`${M.blue}Plugin pages: ${M.bright}${p.length}${M.blue} routes at ${M.cyan}${h}${M.reset}`)}let O=new Map,F=null,L=null;if(Z.stxOptions?.shell!==!1){if(L=await c9(K,Z.stxOptions?.shell),L){if(F=await xZ(L,Z.stxOptions||{}),F)console.log(`${M.blue}Using app shell: ${M.bright}${q0.relative(K,L)}${M.reset} ${M.dim}(deprecated: use layouts/default.stx instead)${M.reset}`)}}w6(),await I6(K);let V=T6();if(V.length>0)console.log(`${M.blue}Loaded ${M.bright}${V.length}${M.blue} middleware: ${M.dim}${V.join(", ")}${M.reset}`);let N={},A=null;try{let{loadStxConfig:C}=await Promise.resolve().then(() => (o$(),I5)),h=await C(K);if(h?.apiRouter)A=h?.apiRouter,console.log(`${M.blue}Using custom router for API handling${M.reset}`);if(h?.apiRoutes){N=h.apiRoutes;let p=Object.keys(N).length;if(p>0)console.log(`${M.blue}Loaded ${M.bright}${p} API route${p>1?"s":""}${M.reset}`)}if(h?.broadcasting?.enabled)try{let{startBroadcasting:p,loadChannels:i}=await Promise.resolve().then(() => (dZ(),WQ)),s=h.broadcasting;await p(s);let K0=s.port??6001;console.log(`${M.magenta}Broadcasting on ${M.cyan}ws://localhost:${K0}/ws${M.reset}`);let $0=q0.join(process.cwd(),"channels.ts");if(z1.existsSync($0))try{let F0=await i($0);console.log(`${M.blue}Loaded ${M.bright}${F0} broadcast channel${F0!==1?"s":""}${M.blue} from channels.ts${M.reset}`)}catch(F0){console.warn(`${M.yellow}Failed to load channels.ts: ${F0.message}${M.reset}`)}}catch(p){console.warn(`${M.yellow}Broadcasting failed to start: ${p.message}${M.reset}`)}}catch{}let w=q0.join(K,".stx/output");z1.mkdirSync(w,{recursive:!0});let R=new Map,T=new Set,I=async(C)=>{let h=i9(z,C);if(!h)return null;try{let p=await Bun.build({entrypoints:[h],outdir:w,plugins:[n7],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...Z.stxOptions});if(!p.success)return null;let i=p.outputs.find((s)=>s.path.endsWith(".html"));if(!i)return null;return await Bun.file(i.path).text()}catch{return null}},E=async(C,h)=>{try{let{processDirectives:p,extractVariables:i,defaultConfig:s,loadStxConfig:K0,injectRouterScript:$0}=await Promise.resolve().then(() => (o$(),I5)),{checkCache:F0,cacheTemplate:R0,readFileCached:P,templateCache:d}=await Promise.resolve().then(() => (H5(),w7)),m=await K0(K),g=(V0)=>{if(!V0)return V0;if(q0.isAbsolute(V0))return V0;return q0.resolve(K,V0)},c={...s,...m,...Z.stxOptions,autoShell:!0};if(Z.debugDirectives)c.debug=!0;c.partialsDir=g(c.partialsDir),c.componentsDir=g(c.componentsDir),c.layoutsDir=g(c.layoutsDir),c.storesDir=g(c.storesDir||"stores"),c.cachePath=g(c.cachePath||".stx/cache");let a=!h&&!Z.profile,l=c.cache!==!1;if(l&&a){let V0=d.get(C.filePath);if(V0)try{if((await z1.promises.stat(C.filePath)).mtime.getTime()<=V0.mtime){let L$=!0;for(let Z1 of V0.dependencies){if(!z1.existsSync(Z1)){L$=!1;break}if((await z1.promises.stat(Z1)).mtime.getTime()>V0.mtime){L$=!1;break}}if(L$){let Z1=V0.output;if(F)Z1=U$(Z1,{preserveHead:!0});return{route:C,content:Z1}}}}catch{}let $1=await F0(C.filePath,c);if($1){let D1=$1;if(F)D1=U$(D1,{preserveHead:!0});return{route:C,content:D1}}}let Q0=l?await P(C.filePath):await Bun.file(C.filePath).text(),{classifyAllScripts:M0}=await Promise.resolve().then(() => (o$(),I5)),w0=M0(Q0),W0=w0.server.map((V0)=>V0.content),r0=Q0;for(let V0 of w0.server)r0=r0.replace(V0.fullTag,"");let p0={__filename:C.filePath,__dirname:q0.dirname(C.filePath),params:h??{}},{resetHead:P5}=await Promise.resolve().then(() => (x$(),w8));P5();for(let V0 of W0)try{await i(V0,p0,C.filePath)}catch($1){if(Z.stxOptions?.debug)console.error("[stx] variable extraction error",C.filePath,$1?.message||$1)}let G0=new Set,k0;if(Z.profile){let V0=performance.now();k0=await p(r0,p0,C.filePath,c,G0);let $1=performance.now()-V0,D1=q0.relative(K,C.filePath)||C.filePath;console.log(`[stx:profile] ${D1} \u2192 ${$1.toFixed(2)}ms`)}else k0=await p(r0,p0,C.filePath,c,G0);if(!F)k0=await $0(k0);{let{interpolateScriptExpressions:V0}=await Promise.resolve().then(() => (n0(),_6));k0=k0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,($1,D1,L$)=>{if(!/function\s+__stx_setup_/.test(L$))return $1;return`<script${D1}>${V0(L$,p0)}</script>`})}if(F)k0=U$(k0,{preserveHead:!0});if(l&&a)await R0(C.filePath,k0,G0,c);let{extractStreamBoundaries:Q4}=await Promise.resolve().then(() => (c$(),F5)),E1=Q4(p0),O$=p0.__streamTemplates;if(O$&&typeof O$==="object"&&Object.keys(O$).length>0){let V0=p0.streamBoundaries||{},$1={...c,autoShell:!1},D1=Object.keys(O$).map((Z1)=>({id:Z1,render:async()=>{let oG=typeof V0[Z1]==="function"?await V0[Z1]():void 0;return p(O$[Z1],{...p0,$boundary:oG},C.filePath,$1,new Set)}})),L$=new Set(D1.map((Z1)=>Z1.id));E1=[...(E1||[]).filter((Z1)=>!L$.has(Z1.id)),...D1]}if(E1&&E1.length>0)T.add(C.pattern);else E1=void 0;return{route:C,content:k0,boundaries:E1}}catch(p){return console.error(`${M.red}Error building ${M.bright}${C.pattern}${M.reset}:`,p),null}},k=8,S=async()=>{R.clear(),O.clear();for(let C=0;C<q.length;C+=k){let h=q.slice(C,C+k),p=await Promise.all(h.map((i)=>E(i)));for(let i of p)if(i)R.set(i.route.pattern,i)}for(let C=0;C<H.length;C+=k){let h=H.slice(C,C+k),p=await Promise.all(h.map(({route:i})=>E(i)));for(let i of p)if(i)O.set(i.route.pattern,i)}return R.size>0};if(console.log(`${M.blue}Building pages...${M.reset}`),!await S())return console.error(`${M.red}No pages were successfully built${M.reset}`),!1;await H7(K);let y=Y;try{if(y=await a$(Y),y!==Y)console.log(`${M.yellow}Port ${Y} is busy, using port ${y} instead${M.reset}`)}catch{return console.error(`${M.red}Could not find an available port${M.reset}`),!1}if(J){let C=Z.hmrPort||y+1;Q=U4({wsPort:C,verbose:!1}),G=Q.start(C)}let b=(C,h)=>{let p=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._rp=${JSON.stringify(h)};if(s.setRouteParams)s.setRouteParams(s._rp);})()</script>`;if(C.includes("</head>"))return C.replace("</head>",`${p}</head>`);if(C.includes("<body"))return C.replace(/<body([^>]*)>/,`<body$1>${p}`);return p+C};console.log(`${M.blue}Starting server...${M.reset}`);let f=zD({port:y,async fetch(C){let h=new URL(C.url),p=U?.publicDir||"public",i=q0.join(K,p,h.pathname),s=q0.join(K,h.pathname),K0=q0.join(w,h.pathname),[$0,F0,R0]=await Promise.all([z1.promises.stat(i).catch(()=>null),z1.promises.stat(s).catch(()=>null),z1.promises.stat(K0).catch(()=>null)]);if($0?.isFile())return jQ(i);if(F0?.isFile())return jQ(s);if(R0?.isFile())return jQ(K0);if(h.pathname.startsWith("/_stx/component/")){let g=decodeURIComponent(h.pathname.slice(16));if(g)try{let c=`<${g} />`,a={...buildConfig,autoShell:!1},l=await processDirectives(c,{},q0.join(K,"components",`${g}.stx`),a,new Set);return new Response(l,{headers:{"Content-Type":"text/html"}})}catch(c){return new Response(`<div class="stx-async-error">${c.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(h.pathname==="/_stx/img"){let{handleImageRequest:g}=await Promise.resolve().then(() => (y9(),hq)),c=await g(C,{publicDir:q0.join(K,p),cacheDir:q0.join(K,".stx/cache/img")});if(c)return c}if(A)try{let g=await A.handleRequest(C);if(g.status!==404)return g}catch{}if(N[h.pathname])try{return await N[h.pathname](C)}catch(g){return new Response(JSON.stringify({error:g.message}),{status:500,headers:{"Content-Type":"application/json"}})}let P=vZ(h.pathname,q);if(P){let g=R.get(P.route.pattern),c=T.has(P.route.pattern);if(P.route.isDynamic&&Object.keys(P.params).length>0||c){let a=await E(P.route,P.params);if(a)g=a}if(g){let a=A8();if(a.validate){if(!await a.validate({params:P.params})){let M0=await I(404);if(M0){let w0=M0;if(w0=await T0(w0,K),J)w0=g1(w0,G);return new Response(w0,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(a.middleware){let Q0=M6(h.pathname,P.params,a,h.search),M0=R6(Q0,null,C),w0=await E6(a.middleware,M0);if(w0.redirect){let W0=w0.redirect.path,r0=w0.redirect.options.redirectCode||302,p0=new Headers(w0.responseHeaders);return p0.set("Location",W0),new Response(null,{status:r0,headers:p0})}if(w0.abort){let{statusCode:W0,message:r0}=w0.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${W0}</title></head><body><h1>Error ${W0}</h1><p>${r0}</p></body></html>`,{status:W0,headers:{"Content-Type":"text/html"}})}if(Object.keys(w0.state).length>0){let W0=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(w0.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;g.content=g.content.replace("</head>",`${W0}</head>`)}}let l=g.content;if(F&&l9(C)){let Q0=b6(l);if(Object.keys(P.params).length>0)l=b(l,P.params);l=await T0(l,K);let M0=U?.router?.container||"main";return l=S6(l,M0),new Response(l,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":Q0.layout,"X-STX-Layout-Group":Q0.group,"Cache-Control":"no-store, no-cache, must-revalidate"}})}if(F)l=k6(F,l);if(Object.keys(P.params).length>0)l=b(l,P.params);if(l=await T0(l,K),J)l=g1(l,G);if(Z.native)if(l.includes("<head>"))l=l.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else l="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+l;if(Z.titlebarHidden)if(l.includes("<head>"))l=l.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else l=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${l}`;if(g.boundaries&&g.boundaries.length>0){let{renderStreamingPage:Q0,streamToResponse:M0}=await Promise.resolve().then(() => (c$(),F5));return M0(Q0(l,g.boundaries,{timeoutMs:30000}),{headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(l,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}if(H.length>0){let g=H.map((a)=>a.route),c=vZ(h.pathname,g);if(c){let a=O.get(c.route.pattern);if(a){let l=a.content;if(F)l=k6(F,l);if(Object.keys(c.params).length>0)l=b(l,c.params);if(l=await T0(l,K),J)l=g1(l,G);return new Response(l,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:a}of j)if(a!=="/"&&h.pathname.startsWith(a)){let l=O.get(a)||O.get(a+"/");if(l){let Q0=l.content;if(F)Q0=k6(F,Q0);if(Q0=await T0(Q0,K),J)Q0=g1(Q0,G);return new Response(Q0,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let d=R.get("/");if(d){let g=d.content;if(g=await T0(g,K),J)g=g1(g,G);if(Z.native)if(g.includes("<head>"))g=g.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else g="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+g;return new Response(g,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let m=await I(404);if(m){let g=m;if(g=await T0(g,K),J)g=g1(g,G);return new Response(g,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(C){let h=await I(500);if(h)return new Response(h,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${C}
13557
+ Press ${M.cyan}h${M.reset} + ${M.cyan}Enter${M.reset} to show shortcuts`),t$(_.url.toString(),()=>{if(X)e$.watch(Q,{recursive:!0}).close();_.stop()}),X){console.log(`${M.blue}Watching for changes...${M.reset}`);let j=e$.watch(Q,{recursive:!0},async(H,O)=>{if(!O)return;if(O.endsWith(".stx")||O.endsWith(".js")||O.endsWith(".ts")||O.endsWith(".md"))console.log(`${M.yellow}File ${M.bright}${O}${M.yellow} changed, rebuilding...${M.reset}`),n$.clear(),i$(),await W()});process.on("SIGINT",()=>{j.close(),_.stop(),process.exit(0)})}return!0}var _H=D(()=>{O7();i0();C7();nZ();A0();P6()});var{serve:zD}=globalThis.Bun;import z1 from"fs";import q0 from"path";function jQ($){let Z=Bun.file($),Y=q0.extname($).toLowerCase(),X={".html":"text/html",".css":"text/css",".js":"text/javascript",".json":"application/json",".png":"image/png",".jpg":"image/jpeg",".jpeg":"image/jpeg",".gif":"image/gif",".svg":"image/svg+xml",".ico":"image/x-icon",".woff":"font/woff",".woff2":"font/woff2",".ttf":"font/ttf",".otf":"font/otf",".eot":"application/vnd.ms-fontobject"},Q=[".js",".css",".json"].includes(Y)?{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}:{};return new Response(Z,{headers:{"Content-Type":X[Y]||"application/octet-stream",...Q}})}async function zH($=".",Z={}){let Y=Z.port||3000,X=Z.watch!==!1,J=Z.hotReload!==!1&&X,Q=null,G=Z.hmrPort||Y+1,K=q0.resolve($),{loadStxConfig:W}=await Promise.resolve().then(() => (o$(),I5)),U=await W(K),B=U.root&&U.root!=="."?q0.join(K,U.root):K,_=U.pagesDir||"pages",z=q0.join(B,_);if(!z1.existsSync(z))return console.error(`${M.red}Error: No '${_}' directory found in ${M.bright}${B}${M.reset}`),console.log(`${M.dim}Create a ${_}/ directory with .stx files to define your routes.${M.reset}`),console.log(`${M.dim}Example: ${_}/index.stx for the homepage.${M.reset}`),!1;let q=B$(B);if(q.length===0)return console.error(`${M.red}Error: No page files found in ${M.bright}${z}${M.reset}`),!1;console.log(`${M.blue}Found ${M.bright}${q.length}${M.blue} routes${M.reset}`);let j=U?._pluginPageDirs||[],H=[];for(let{dir:C,prefix:h}of j)if(z1.existsSync(C)){let p=B$(q0.dirname(C),{pagesDir:q0.basename(C)});for(let i of p){let s=h==="/"?i.pattern:`${h}${i.pattern==="/"?"":i.pattern}`;H.push({route:{...i,pattern:s},prefix:h})}if(p.length>0)console.log(`${M.blue}Plugin pages: ${M.bright}${p.length}${M.blue} routes at ${M.cyan}${h}${M.reset}`)}let O=new Map,F=null,L=null;if(Z.stxOptions?.shell!==!1){if(L=await c9(K,Z.stxOptions?.shell),L){if(F=await xZ(L,Z.stxOptions||{}),F)console.log(`${M.blue}Using app shell: ${M.bright}${q0.relative(K,L)}${M.reset} ${M.dim}(deprecated: use layouts/default.stx instead)${M.reset}`)}}w6(),await I6(K);let V=T6();if(V.length>0)console.log(`${M.blue}Loaded ${M.bright}${V.length}${M.blue} middleware: ${M.dim}${V.join(", ")}${M.reset}`);let N={},A=null;try{let{loadStxConfig:C}=await Promise.resolve().then(() => (o$(),I5)),h=await C(K);if(h?.apiRouter)A=h?.apiRouter,console.log(`${M.blue}Using custom router for API handling${M.reset}`);if(h?.apiRoutes){N=h.apiRoutes;let p=Object.keys(N).length;if(p>0)console.log(`${M.blue}Loaded ${M.bright}${p} API route${p>1?"s":""}${M.reset}`)}if(h?.broadcasting?.enabled)try{let{startBroadcasting:p,loadChannels:i}=await Promise.resolve().then(() => (dZ(),WQ)),s=h.broadcasting;await p(s);let W0=s.port??6001;console.log(`${M.magenta}Broadcasting on ${M.cyan}ws://localhost:${W0}/ws${M.reset}`);let $0=q0.join(process.cwd(),"channels.ts");if(z1.existsSync($0))try{let V0=await i($0);console.log(`${M.blue}Loaded ${M.bright}${V0} broadcast channel${V0!==1?"s":""}${M.blue} from channels.ts${M.reset}`)}catch(V0){console.warn(`${M.yellow}Failed to load channels.ts: ${V0.message}${M.reset}`)}}catch(p){console.warn(`${M.yellow}Broadcasting failed to start: ${p.message}${M.reset}`)}}catch{}let w=q0.join(K,".stx/output");z1.mkdirSync(w,{recursive:!0});let R=new Map,T=new Set,I=async(C)=>{let h=i9(z,C);if(!h)return null;try{let p=await Bun.build({entrypoints:[h],outdir:w,plugins:[n7],publicPath:"/",define:{"process.env.NODE_ENV":'"development"'},...Z.stxOptions});if(!p.success)return null;let i=p.outputs.find((s)=>s.path.endsWith(".html"));if(!i)return null;return await Bun.file(i.path).text()}catch{return null}},E=async(C,h)=>{try{let{processDirectives:p,extractVariables:i,defaultConfig:s,loadStxConfig:W0,injectRouterScript:$0}=await Promise.resolve().then(() => (o$(),I5)),{checkCache:V0,cacheTemplate:M0,readFileCached:P,templateCache:d}=await Promise.resolve().then(() => (H5(),w7)),m=await W0(K),g=(N0)=>{if(!N0)return N0;if(q0.isAbsolute(N0))return N0;return q0.resolve(K,N0)},c={...s,...m,...Z.stxOptions,autoShell:!0};if(Z.debugDirectives)c.debug=!0;c.partialsDir=g(c.partialsDir),c.componentsDir=g(c.componentsDir),c.layoutsDir=g(c.layoutsDir),c.storesDir=g(c.storesDir||"stores"),c.cachePath=g(c.cachePath||".stx/cache");let a=!h&&!Z.profile,l=c.cache!==!1;if(l&&a){let N0=d.get(C.filePath);if(N0)try{if((await z1.promises.stat(C.filePath)).mtime.getTime()<=N0.mtime){let L$=!0;for(let Z1 of N0.dependencies){if(!z1.existsSync(Z1)){L$=!1;break}if((await z1.promises.stat(Z1)).mtime.getTime()>N0.mtime){L$=!1;break}}if(L$){let Z1=N0.output;if(F)Z1=U$(Z1,{preserveHead:!0});return{route:C,content:Z1}}}}catch{}let $1=await V0(C.filePath,c);if($1){let D1=$1;if(F)D1=U$(D1,{preserveHead:!0});return{route:C,content:D1}}}let Q0=l?await P(C.filePath):await Bun.file(C.filePath).text(),{classifyAllScripts:R0}=await Promise.resolve().then(() => (o$(),I5)),j0=R0(Q0),K0=j0.server.map((N0)=>N0.content),r0=Q0;for(let N0 of j0.server)r0=r0.replace(N0.fullTag,"");let p0={__filename:C.filePath,__dirname:q0.dirname(C.filePath),params:h??{}},{resetHead:P5}=await Promise.resolve().then(() => (x$(),w8));P5();for(let N0 of K0)try{await i(N0,p0,C.filePath)}catch($1){if(Z.stxOptions?.debug)console.error("[stx] variable extraction error",C.filePath,$1?.message||$1)}let G0=new Set,k0;if(Z.profile){let N0=performance.now();k0=await p(r0,p0,C.filePath,c,G0);let $1=performance.now()-N0,D1=q0.relative(K,C.filePath)||C.filePath;console.log(`[stx:profile] ${D1} \u2192 ${$1.toFixed(2)}ms`)}else k0=await p(r0,p0,C.filePath,c,G0);if(!F)k0=await $0(k0);{let{interpolateScriptExpressions:N0}=await Promise.resolve().then(() => (n0(),_6));k0=k0.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/g,($1,D1,L$)=>{if(!/function\s+__stx_setup_/.test(L$))return $1;return`<script${D1}>${N0(L$,p0)}</script>`})}if(F)k0=U$(k0,{preserveHead:!0});if(l&&a)await M0(C.filePath,k0,G0,c);let{extractStreamBoundaries:Q4}=await Promise.resolve().then(() => (c$(),F5)),E1=Q4(p0),O$=p0.__streamTemplates;if(O$&&typeof O$==="object"&&Object.keys(O$).length>0){let N0=p0.streamBoundaries||{},$1={...c,autoShell:!1},D1=Object.keys(O$).map((Z1)=>({id:Z1,render:async()=>{let oG=typeof N0[Z1]==="function"?await N0[Z1]():void 0;return p(O$[Z1],{...p0,$boundary:oG},C.filePath,$1,new Set)}})),L$=new Set(D1.map((Z1)=>Z1.id));E1=[...(E1||[]).filter((Z1)=>!L$.has(Z1.id)),...D1]}if(E1&&E1.length>0)T.add(C.pattern);else E1=void 0;return{route:C,content:k0,boundaries:E1}}catch(p){return console.error(`${M.red}Error building ${M.bright}${C.pattern}${M.reset}:`,p),null}},k=8,S=async()=>{R.clear(),O.clear();for(let C=0;C<q.length;C+=k){let h=q.slice(C,C+k),p=await Promise.all(h.map((i)=>E(i)));for(let i of p)if(i)R.set(i.route.pattern,i)}for(let C=0;C<H.length;C+=k){let h=H.slice(C,C+k),p=await Promise.all(h.map(({route:i})=>E(i)));for(let i of p)if(i)O.set(i.route.pattern,i)}return R.size>0};if(console.log(`${M.blue}Building pages...${M.reset}`),!await S())return console.error(`${M.red}No pages were successfully built${M.reset}`),!1;await H7(K);let y=Y;try{if(y=await a$(Y),y!==Y)console.log(`${M.yellow}Port ${Y} is busy, using port ${y} instead${M.reset}`)}catch{return console.error(`${M.red}Could not find an available port${M.reset}`),!1}if(J){let C=Z.hmrPort||y+1;Q=U4({wsPort:C,verbose:!1}),G=Q.start(C)}let b=(C,h)=>{let p=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._rp=${JSON.stringify(h)};if(s.setRouteParams)s.setRouteParams(s._rp);})()</script>`;if(C.includes("</head>"))return C.replace("</head>",`${p}</head>`);if(C.includes("<body"))return C.replace(/<body([^>]*)>/,`<body$1>${p}`);return p+C};console.log(`${M.blue}Starting server...${M.reset}`);let f=zD({port:y,async fetch(C){let h=new URL(C.url),p=U?.publicDir||"public",i=q0.join(K,p,h.pathname),s=q0.join(K,h.pathname),W0=q0.join(w,h.pathname),[$0,V0,M0]=await Promise.all([z1.promises.stat(i).catch(()=>null),z1.promises.stat(s).catch(()=>null),z1.promises.stat(W0).catch(()=>null)]);if($0?.isFile())return jQ(i);if(V0?.isFile())return jQ(s);if(M0?.isFile())return jQ(W0);if(h.pathname.startsWith("/_stx/component/")){let g=decodeURIComponent(h.pathname.slice(16));if(g)try{let c=`<${g} />`,a={...buildConfig,autoShell:!1},l=await processDirectives(c,{},q0.join(K,"components",`${g}.stx`),a,new Set);return new Response(l,{headers:{"Content-Type":"text/html"}})}catch(c){return new Response(`<div class="stx-async-error">${c.message}</div>`,{status:500,headers:{"Content-Type":"text/html"}})}}if(h.pathname==="/_stx/img"){let{handleImageRequest:g}=await Promise.resolve().then(() => (y9(),hq)),c=await g(C,{publicDir:q0.join(K,p),cacheDir:q0.join(K,".stx/cache/img")});if(c)return c}if(A)try{let g=await A.handleRequest(C);if(g.status!==404)return g}catch{}if(N[h.pathname])try{return await N[h.pathname](C)}catch(g){return new Response(JSON.stringify({error:g.message}),{status:500,headers:{"Content-Type":"application/json"}})}let P=vZ(h.pathname,q);if(P){let g=R.get(P.route.pattern),c=T.has(P.route.pattern);if(P.route.isDynamic&&Object.keys(P.params).length>0||c){let a=await E(P.route,P.params);if(a)g=a}if(g){let a=A8();if(a.validate){if(!await a.validate({params:P.params})){let R0=await I(404);if(R0){let j0=R0;if(j0=await T0(j0,K),J)j0=g1(j0,G);return new Response(j0,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})}}if(a.middleware){let Q0=M6(h.pathname,P.params,a,h.search),R0=R6(Q0,null,C),j0=await E6(a.middleware,R0);if(j0.redirect){let K0=j0.redirect.path,r0=j0.redirect.options.redirectCode||302,p0=new Headers(j0.responseHeaders);return p0.set("Location",K0),new Response(null,{status:r0,headers:p0})}if(j0.abort){let{statusCode:K0,message:r0}=j0.abort.error;return new Response(`<!DOCTYPE html><html><head><title>Error ${K0}</title></head><body><h1>Error ${K0}</h1><p>${r0}</p></body></html>`,{status:K0,headers:{"Content-Type":"text/html"}})}if(Object.keys(j0.state).length>0){let K0=`<script>(function(){var s=typeof stx!=='undefined'?stx:{};s._ms=${JSON.stringify(j0.state)};if(s.setMiddlewareState)s.setMiddlewareState(s._ms);})()</script>`;g.content=g.content.replace("</head>",`${K0}</head>`)}}let l=g.content;if(F&&l9(C)){let Q0=b6(l),R0=l.match(/<title[^>]*>([\s\S]*?)<\/title>/i),j0=R0?R0[1].trim():"";if(Object.keys(P.params).length>0)l=b(l,P.params);l=await T0(l,K);let K0=U?.router?.container||"main";return l=S6(l,K0),new Response(l,{headers:{"Content-Type":"text/html","X-STX-Fragment":"true","X-STX-Layout":Q0.layout,"X-STX-Layout-Group":Q0.group,...j0&&{"X-STX-Title":encodeURIComponent(j0)},"Cache-Control":"no-store, no-cache, must-revalidate"}})}if(F)l=k6(F,l);if(Object.keys(P.params).length>0)l=b(l,P.params);if(l=await T0(l,K),J)l=g1(l,G);if(Z.native)if(l.includes("<head>"))l=l.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else l="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+l;if(Z.titlebarHidden)if(l.includes("<head>"))l=l.replace("<head>","<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script>");else l=`<head><style>html.stx-titlebar-hidden .stx-traffic-lights-dot{visibility:hidden}</style><script>document.documentElement.classList.add('stx-titlebar-hidden')</script></head>${l}`;if(g.boundaries&&g.boundaries.length>0){let{renderStreamingPage:Q0,streamToResponse:R0}=await Promise.resolve().then(() => (c$(),F5));return R0(Q0(l,g.boundaries,{timeoutMs:30000}),{headers:{"Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}return new Response(l,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}if(H.length>0){let g=H.map((a)=>a.route),c=vZ(h.pathname,g);if(c){let a=O.get(c.route.pattern);if(a){let l=a.content;if(F)l=k6(F,l);if(Object.keys(c.params).length>0)l=b(l,c.params);if(l=await T0(l,K),J)l=g1(l,G);return new Response(l,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}for(let{prefix:a}of j)if(a!=="/"&&h.pathname.startsWith(a)){let l=O.get(a)||O.get(a+"/");if(l){let Q0=l.content;if(F)Q0=k6(F,Q0);if(Q0=await T0(Q0,K),J)Q0=g1(Q0,G);return new Response(Q0,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}}}let d=R.get("/");if(d){let g=d.content;if(g=await T0(g,K),J)g=g1(g,G);if(Z.native)if(g.includes("<head>"))g=g.replace("<head>","<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script>");else g="<head><style>[data-stx-sidebar],.stx-sidebar{display:none!important}</style><script>window.__craftNativeSidebar=true;document.documentElement.classList.add('has-native-sidebar')</script></head>"+g;return new Response(g,{headers:{"Content-Type":"text/html","Cache-Control":"no-store, no-cache, must-revalidate",Pragma:"no-cache",Expires:"0"}})}let m=await I(404);if(m){let g=m;if(g=await T0(g,K),J)g=g1(g,G);return new Response(g,{status:404,headers:{"Content-Type":"text/html"}})}return new Response("Not Found",{status:404})},async error(C){let h=await I(500);if(h)return new Response(h,{status:500,headers:{"Content-Type":"text/html"}});return new Response(`<pre>${C}
13558
13558
  ${C.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});if(console.clear(),console.log(`
13559
13559
  ${M.blue}stx${M.reset} ${M.green}${process.env.stx_VERSION||"v0.0.10"}${M.reset} ${M.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${M.reset}`),console.log(`
13560
13560
  ${M.bright}\u2192 ${M.cyan}http://localhost:${y}/${M.reset}`),J)console.log(`${M.dim} HMR: ws://localhost:${G}${M.reset}`);console.log(`
13561
13561
  ${M.yellow}Routes:${M.reset}`);let u=[...n9(q,K)];for(let{route:C}of H)u.push(`${C.pattern}`);if(u.forEach((C,h)=>{let i=h===u.length-1?"\u2514\u2500 ":"\u251C\u2500 ";console.log(` ${M.green}${i}${M.reset}${C}`)}),console.log(`
13562
- Press ${M.cyan}h${M.reset} + ${M.cyan}Enter${M.reset} to show shortcuts`),t$(f.url.toString(),()=>{if(Q)v5();f.stop()}),Z.native){let C,h=q0.join(z,"index.stx");if(z1.existsSync(h)){let i=await Bun.file(h).text();C=lZ(i)}let p=U?.app?.window??{};await l7(y,{title:U?.app?.head?.title||q0.basename(K)||"stx App",width:p.width,height:p.height,darkMode:p.darkMode,hotReload:p.hotReload,titlebarHidden:p.titlebarHidden??Z.titlebarHidden===!0,nativeSidebar:!!C,sidebarConfig:C})}if(X){console.log(`${M.blue}Watching for changes...${M.reset}`);let C=(i)=>{return i.startsWith("public/")||i.startsWith("public\\")},h=(i)=>{let s=i.toLowerCase();return s.endsWith(".stx")||s.endsWith(".html")||s.endsWith(".md")},p=z1.watch(K,{recursive:!0},async(i,s)=>{if(!s||W4(s))return;if(K4(s))if(C(s)){if(console.log(`${M.cyan}${s} changed${M.reset}`),J&&Q)Q.reload(s)}else if(h(s)){console.log(`${M.yellow}${s} changed, rebuilding...${M.reset}`),n$.clear(),i$();try{let{invalidateFileCache:K0,templateCache:$0}=await Promise.resolve().then(() => (H5(),w7));K0(q0.resolve(K,s)),$0.delete(q0.resolve(K,s))}catch{}if(L&&s){if(q0.resolve(K,s)===L||q0.basename(L)===s){let $0=await xZ(L,Z.stxOptions||{});if($0)F=$0}}if(await S(),await h4(K),J&&Q)Q.reload(s)}else{console.log(`${M.yellow}${s} changed, rebuilding...${M.reset}`),n$.clear(),i$();try{let{invalidateFileCache:K0,templateCache:$0}=await Promise.resolve().then(() => (H5(),w7));K0(q0.resolve(K,s)),$0.delete(q0.resolve(K,s))}catch{}if(await S(),J&&Q)Q.reload(s)}else if(G4(s)){if(console.log(`${M.cyan}CSS ${s} changed${M.reset}`),J&&Q)Q.updateCss(s)}});process.on("SIGINT",()=>{if(p.close(),Q)v5();f.stop(),process.exit(0)})}return!0}var qH=D(()=>{p7();C7();nZ();C6();yZ();x$();N0();P6()});var jH=D(()=>{_Q();OH();_H();qH()});import HQ from"fs";import x6 from"path";async function LH($){try{let Y=(await Bun.file($).text()).match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return[];let X=Y[1],J=[],Q=/\/\*\*\s*([\s\S]*?)\s*\*\/\s*(?:(?:const|let|var)\s*)?(?:([\w$]+)\s*=|module\.exports\.([\w$]+)\s*=|\s*([\w$]+)\s*:)/g,G;while((G=Q.exec(X))!==null){let K=G[1],W=G[2]||G[3]||G[4];if(!W)continue;let U={name:W},B=K.match(/@type\s+\{([^}]+)\}/i);if(B)U.type=B[1].trim();if(K.match(/@required/i))U.required=!0;let z=K.match(/@default\s+(.+?)(?:\s+|$)/i);if(z)U.default=z[1].trim();let q=K.split(`
13562
+ Press ${M.cyan}h${M.reset} + ${M.cyan}Enter${M.reset} to show shortcuts`),t$(f.url.toString(),()=>{if(Q)v5();f.stop()}),Z.native){let C,h=q0.join(z,"index.stx");if(z1.existsSync(h)){let i=await Bun.file(h).text();C=lZ(i)}let p=U?.app?.window??{};await l7(y,{title:U?.app?.head?.title||q0.basename(K)||"stx App",width:p.width,height:p.height,darkMode:p.darkMode,hotReload:p.hotReload,titlebarHidden:p.titlebarHidden??Z.titlebarHidden===!0,nativeSidebar:!!C,sidebarConfig:C})}if(X){console.log(`${M.blue}Watching for changes...${M.reset}`);let C=(i)=>{return i.startsWith("public/")||i.startsWith("public\\")},h=(i)=>{let s=i.toLowerCase();return s.endsWith(".stx")||s.endsWith(".html")||s.endsWith(".md")},p=z1.watch(K,{recursive:!0},async(i,s)=>{if(!s||W4(s))return;if(K4(s))if(C(s)){if(console.log(`${M.cyan}${s} changed${M.reset}`),J&&Q)Q.reload(s)}else if(h(s)){console.log(`${M.yellow}${s} changed, rebuilding...${M.reset}`),n$.clear(),i$();try{let{invalidateFileCache:W0,templateCache:$0}=await Promise.resolve().then(() => (H5(),w7));W0(q0.resolve(K,s)),$0.delete(q0.resolve(K,s))}catch{}if(L&&s){if(q0.resolve(K,s)===L||q0.basename(L)===s){let $0=await xZ(L,Z.stxOptions||{});if($0)F=$0}}if(await S(),await h4(K),J&&Q)Q.reload(s)}else{console.log(`${M.yellow}${s} changed, rebuilding...${M.reset}`),n$.clear(),i$();try{let{invalidateFileCache:W0,templateCache:$0}=await Promise.resolve().then(() => (H5(),w7));W0(q0.resolve(K,s)),$0.delete(q0.resolve(K,s))}catch{}if(await S(),J&&Q)Q.reload(s)}else if(G4(s)){if(console.log(`${M.cyan}CSS ${s} changed${M.reset}`),J&&Q)Q.updateCss(s)}});process.on("SIGINT",()=>{if(p.close(),Q)v5();f.stop(),process.exit(0)})}return!0}var qH=D(()=>{p7();C7();nZ();C6();yZ();x$();A0();P6()});var jH=D(()=>{_Q();OH();_H();qH()});import HQ from"fs";import x6 from"path";async function LH($){try{let Y=(await Bun.file($).text()).match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(!Y)return[];let X=Y[1],J=[],Q=/\/\*\*\s*([\s\S]*?)\s*\*\/\s*(?:(?:const|let|var)\s*)?(?:([\w$]+)\s*=|module\.exports\.([\w$]+)\s*=|\s*([\w$]+)\s*:)/g,G;while((G=Q.exec(X))!==null){let K=G[1],W=G[2]||G[3]||G[4];if(!W)continue;let U={name:W},B=K.match(/@type\s+\{([^}]+)\}/i);if(B)U.type=B[1].trim();if(K.match(/@required/i))U.required=!0;let z=K.match(/@default\s+(.+?)(?:\s+|$)/i);if(z)U.default=z[1].trim();let q=K.split(`
13563
13563
  `).map((j)=>j.trim().replace(/^\*\s*/,"")).filter((j)=>!j.startsWith("@")&&j.length>0);U.description=q.join(" ").trim(),J.push(U)}if(J.length===0){let K=X.match(/module\.exports\s*=\s*\{([^}]+)\}/i);if(K){let U=K[1].split(",").map((B)=>B.trim()).filter(Boolean);for(let B of U){let[_]=B.split(":").map((z)=>z.trim());if(_)J.push({name:_})}}}return J}catch(Z){return console.error(`Error extracting props from ${$}:`,Z),[]}}async function FH($){try{let Z=await Bun.file($).text(),Y=Z.match(/^\s*<!--\s*([\s\S]*?)\s*-->/)||Z.match(/^\s*\/\*\*\s*([\s\S]*?)\s*\*\//);if(Y)return Y[1].split(`
13564
13564
  `).map((X)=>X.trim().replace(/^\*\s*/,"")).join(" ").trim();return""}catch{return""}}async function VH($,Z=!1,Y){let X=x6.basename($,".stx"),J=await LH($),Q=await FH($),G="";if(Z&&Y)G=`<${Y}></${Y}>`;else{let K=J.map((W)=>{if(W.type==="boolean")return`:${W.name}="true"`;return`${W.name}="value"`}).join(`
13565
13565
  `);G=`<${X}
@@ -13698,7 +13698,7 @@ Press ${M.cyan}h${M.reset} + ${M.cyan}Enter${M.reset} to show shortcuts`),t$(f.u
13698
13698
  <td>@${Q.name}</td>
13699
13699
  <td>${Q.description||"-"}</td>
13700
13700
  <td>${Q.hasEndTag?"Yes":"No"}</td>
13701
- </tr>`;J+="</tbody></table>";for(let Q of Y)if(Q.example)J+=`<h3>@${Q.name}</h3>`,J+=`<p>${Q.description||""}</p>`,J+="<h4>Example</h4>",J+=`<pre><code>${Q.example.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}</code></pre>`}return J+="</body></html>",J}function TH($=[],Z=[],Y=[],X){return JSON.stringify({components:$,templates:Z,directives:Y,extraContent:X||""},null,2)}async function IH($){try{let{componentsDir:Z,templatesDir:Y,webComponentsConfig:X,customDirectives:J,config:Q}=$;if(!Q.enabled)return!1;let G=Q.outputDir||"docs";if(await HQ.promises.mkdir(G,{recursive:!0}),console.log("Generating documentation..."),Z)console.log(`Components directory: ${Z}`);if(Y)console.log(`Templates directory: ${Y}`);console.log(`Output directory: ${G}`);let K=[];if(Q.components!==!1&&Z)console.log("Generating component documentation..."),K=await NH(Z,X),console.log(`Found ${K.length} components`);let W=[];if(Q.templates!==!1&&Y)console.log("Generating template documentation..."),W=await AH(Y),console.log(`Found ${W.length} templates`);let U=[];if(Q.directives!==!1)console.log("Generating directive documentation..."),U=await wH(J),console.log(`Found ${U.length} directives`);let B=Q.format||"markdown",_=Q.extraContent,z="",q="";switch(B){case"markdown":z=RH(K,W,U,_),q="md";break;case"html":z=MH(K,W,U,_),q="html";break;case"json":z=TH(K,W,U,_),q="json";break;default:throw Error(`Unsupported documentation format: ${B}`)}let j=x6.join(G,`stx-docs.${q}`);return await Bun.write(j,z),console.log(`Documentation generated: ${j}`),!0}catch(Z){return console.error("Error generating documentation:",Z),!1}}async function qD($){let Z={enabled:!0,outputDir:$.output||"docs",format:$.format||"markdown",components:$.components!==!1,templates:$.templates!==!1,directives:$.directives!==!1,extraContent:$.extraContent},Y=$.componentsDir||K1.componentsDir,X=$.templatesDir||".";return IH({componentsDir:Y,templatesDir:X,webComponentsConfig:K1.webComponents,customDirectives:K1.customDirectives,config:Z})}var EH=D(()=>{i0();N0()});import s7 from"process";function r7(){if(typeof globalThis<"u"&&"caches"in globalThis&&"CF"in globalThis)return{platform:"cloudflare",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["kv","r2","d1","durable-objects","queues"]};if(typeof globalThis<"u"&&"Deno"in globalThis)return{platform:"deno",version:globalThis.Deno.version?.deno,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["kv","deploy","ffi"]};if(typeof globalThis<"u"&&"Bun"in globalThis)return{platform:"bun",version:globalThis.Bun.version,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!1,supportsCache:!1,capabilities:["sqlite","ffi","native-modules"]};if(typeof globalThis<"u"&&"EdgeRuntime"in globalThis)return{platform:"vercel",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["edge-config","blob"]};if(typeof globalThis<"u"&&"Netlify"in globalThis)return{platform:"netlify",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!1,capabilities:["blobs","edge-functions"]};if(typeof globalThis<"u"&&"fastly"in globalThis)return{platform:"fastly",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["dictionary","backend","geolocation"]};if(s7.versions?.node)return{platform:"node",version:s7.versions.node,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!1,supportsCache:!1,capabilities:["fs","child-process","native-modules"]};return{platform:"unknown",supportsStreaming:!1,supportsCrypto:!1,supportsKV:!1,supportsCache:!1,capabilities:[]}}function jD(){let $=r7();return["cloudflare","deno","vercel","netlify","fastly"].includes($.platform)}function HD(){return r7().platform!=="unknown"}function kH($){return{get(Z){if($&&Z in $){let Y=$[Z];return typeof Y==="string"?Y:void 0}if(typeof globalThis<"u"&&"Deno"in globalThis)return globalThis.Deno.env.get(Z);if(s7.env)return s7.env[Z];return},getOrThrow(Z){let Y=this.get(Z);if(Y===void 0)throw Error(`Environment variable "${Z}" is not set`);return Y},has(Z){return this.get(Z)!==void 0},all(){let Z={};if($){for(let[Y,X]of Object.entries($))if(typeof X==="string")Z[Y]=X}if(typeof globalThis<"u"&&"Deno"in globalThis){let Y=globalThis.Deno.env.toObject();Object.assign(Z,Y)}if(s7.env){for(let[Y,X]of Object.entries(s7.env))if(X!==void 0)Z[Y]=X}return Z}}}function SH($){let Z=r7();if(Z.platform==="cloudflare"&&$)return $;if(Z.platform==="deno"&&"Deno"in globalThis)return OD();if(Z.platform==="node"||Z.platform==="bun")return LD();return}function OD(){let $=null,Z=async()=>{if(!$)$=await globalThis.Deno.openKv();return $};return{async get(Y){return(await(await Z()).get(["stx",Y])).value},async getWithMetadata(Y){let X=await Z(),J=await X.get(["stx",Y]),Q=await X.get(["stx-meta",Y]);return{value:J.value,metadata:Q.value}},async put(Y,X,J){let Q=await Z(),G=J?.expirationTtl?J.expirationTtl*1000:void 0;if(await Q.set(["stx",Y],X,G?{expireIn:G}:void 0),J?.metadata)await Q.set(["stx-meta",Y],J.metadata,G?{expireIn:G}:void 0)},async delete(Y){let X=await Z();await X.delete(["stx",Y]),await X.delete(["stx-meta",Y])},async list(Y){let X=await Z(),J=Y?.prefix?["stx",Y.prefix]:["stx"],Q=X.list({prefix:J,limit:Y?.limit||100}),G=[];for await(let K of Q){let U=K.key.slice(1).join("/");if(!U.startsWith("stx-meta/"))G.push({name:U})}return{keys:G,list_complete:!0}}}}function LD(){let $=new Map,Z=()=>{let Y=Date.now();for(let[X,J]of $.entries())if(J.expiration&&J.expiration<Y)$.delete(X)};return{async get(Y){Z();let X=$.get(Y);if(!X)return null;if(X.expiration&&X.expiration<Date.now())return $.delete(Y),null;return X.value},async getWithMetadata(Y){Z();let X=$.get(Y);if(!X)return{value:null,metadata:null};if(X.expiration&&X.expiration<Date.now())return $.delete(Y),{value:null,metadata:null};return{value:X.value,metadata:X.metadata||null}},async put(Y,X,J){let Q=J?.expiration?J.expiration*1000:J?.expirationTtl?Date.now()+J.expirationTtl*1000:void 0;$.set(Y,{value:X,metadata:J?.metadata,expiration:Q})},async delete(Y){$.delete(Y)},async list(Y){Z();let X=[];for(let[J,Q]of $.entries()){if(Y?.prefix&&!J.startsWith(Y.prefix))continue;if(X.push({name:J,expiration:Q.expiration,metadata:Q.metadata}),Y?.limit&&X.length>=Y.limit)break}return{keys:X,list_complete:!0}}}}function bH(){let $=r7();if($.platform==="cloudflare"&&"caches"in globalThis)return FD();if($.supportsStreaming)return VD();return}function FD(){return{async match($){return(await caches.default).match($)},async put($,Z){await(await caches.default).put($,Z.clone())},async delete($){return(await caches.default).delete($)}}}function VD(){let $=new Map,Z=60000;return{async match(Y){let X=Y.url,J=$.get(X);if(!J)return;if(Date.now()>J.expiration){$.delete(X);return}return J.response.clone()},async put(Y,X){let J=Y.url,Q=X.headers.get("Cache-Control"),G=60000;if(Q){let K=Q.match(/max-age=(\d+)/);if(K)G=Number.parseInt(K[1],10)*1000}$.set(J,{response:X.clone(),expiration:Date.now()+G})},async delete(Y){return $.delete(Y.url)}}}function ND(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,9)}`}function AD($,Z){if(Z.platform==="cloudflare"){let Y=$.cf;if(Y)return{city:Y.city,country:Y.country,countryCode:Y.country,region:Y.region,latitude:Y.latitude?Number.parseFloat(Y.latitude):void 0,longitude:Y.longitude?Number.parseFloat(Y.longitude):void 0,timezone:Y.timezone}}if(Z.platform==="vercel"){let Y={},X=$.headers.get("x-vercel-ip-city"),J=$.headers.get("x-vercel-ip-country"),Q=$.headers.get("x-vercel-ip-country-region"),G=$.headers.get("x-vercel-ip-latitude"),K=$.headers.get("x-vercel-ip-longitude");if(X)Y.city=decodeURIComponent(X);if(J)Y.countryCode=J;if(Q)Y.region=Q;if(G)Y.latitude=Number.parseFloat(G);if(K)Y.longitude=Number.parseFloat(K);return Object.keys(Y).length>0?Y:void 0}if(Z.platform==="netlify"){let Y={},X=$.headers.get("x-nf-geo-city"),J=$.headers.get("x-nf-geo-country");if(X)Y.city=X;if(J)Y.countryCode=J;return Object.keys(Y).length>0?Y:void 0}return}function LQ($,Z,Y){let X=new Headers($.headers);if(Z.origins==="*")X.set("Access-Control-Allow-Origin","*");else if(Z.origins&&Y&&Z.origins.includes(Y))X.set("Access-Control-Allow-Origin",Y),X.set("Vary","Origin");if(Z.methods)X.set("Access-Control-Allow-Methods",Z.methods.join(", "));if(Z.headers)X.set("Access-Control-Allow-Headers",Z.headers.join(", "));if(Z.exposeHeaders)X.set("Access-Control-Expose-Headers",Z.exposeHeaders.join(", "));if(Z.credentials)X.set("Access-Control-Allow-Credentials","true");if(Z.maxAge)X.set("Access-Control-Max-Age",String(Z.maxAge));return new Response($.body,{status:$.status,statusText:$.statusText,headers:X})}function v6($){let Z=r7();return async(Y,X)=>{let J=performance.now(),Q=ND(),G={runtime:Z,platform:X||{},requestId:Q,geo:AD(Y,Z),timing:{start:J,getElapsed:()=>performance.now()-J},kv:SH(X?.KV),cache:bH(),env:kH(X?.env)};try{if(Y.method==="OPTIONS"&&$.cors){let W=new Response(null,{status:204});return W=LQ(W,$.cors,Y.headers.get("Origin")||void 0),W}if($.cache?.enabled&&Y.method==="GET"&&G.cache){if(DH(Y,$.cache)){let U=await G.cache.match(Y);if(U){let B=new Response(U.body,U);return B.headers.set("X-Cache","HIT"),B.headers.set("X-Request-Id",Q),$.cors?LQ(B,$.cors,Y.headers.get("Origin")||void 0):B}}}let K;if($.middleware&&$.middleware.length>0)K=await wD(Y,G,$.middleware,async()=>{let W=await $.render(Y,G);return typeof W==="string"?new Response(W,{headers:{"Content-Type":"text/html; charset=utf-8"}}):W});else{let W=await $.render(Y,G);K=typeof W==="string"?new Response(W,{headers:{"Content-Type":"text/html; charset=utf-8"}}):W}if(K.headers.set("X-Request-Id",Q),K.headers.set("X-Response-Time",`${G.timing.getElapsed().toFixed(2)}ms`),$.cache?.enabled&&Y.method==="GET"&&G.cache){if(DH(Y,$.cache)&&K.status===200){let U=$.cache.ttl||60,B=K.clone();B.headers.set("Cache-Control",`public, max-age=${U}`),await G.cache.put(Y,B),K.headers.set("X-Cache","MISS")}}if($.cors)K=LQ(K,$.cors,Y.headers.get("Origin")||void 0);return K}catch(K){let W=K instanceof Error?K:Error(String(K));if($.onError)return $.onError(W,Y);return new Response(`Internal Server Error: ${W.message}`,{status:500,headers:{"Content-Type":"text/plain","X-Request-Id":Q}})}}}function DH($,Z){let X=new URL($.url).pathname;if(Z.excludePaths){for(let J of Z.excludePaths)if(J.test(X))return!1}if(Z.includePaths){for(let J of Z.includePaths)if(J.test(X))return!0;return!1}return!0}async function wD($,Z,Y,X){let J=0,Q=async()=>{if(J>=Y.length)return X();let G=Y[J];return J++,G($,Z,Q)};return Q()}function RD($,Z){let Y=new Headers(Z?.headers);return Y.set("Content-Type","text/html; charset=utf-8"),Y.set("Transfer-Encoding","chunked"),new Response($,{...Z,headers:Y})}function MD(){let $=new TextEncoder;return new TransformStream({transform(Z,Y){Y.enqueue($.encode(Z))}})}function TD($){let Z=new TextEncoder;return new ReadableStream({async start(Y){for await(let X of $)Y.enqueue(Z.encode(X));Y.close()}})}function ID($){let Z=v6($);return{async fetch(Y,X,J){return Z(Y,{env:X,ctx:J,KV:X.KV})}}}function ED($){let Z=v6($);return(Y)=>Z(Y,{})}function DD($){let Z=v6($);return(Y)=>Z(Y,{})}function kD($){let Z=v6($);return(Y,X)=>{return Z(Y,{netlifyContext:X})}}function SD($){let Z=$.headers.get("Cookie");if(!Z)return{};let Y={};for(let X of Z.split(";")){let[J,Q]=X.split("=").map((G)=>G.trim());if(J&&Q)Y[J]=decodeURIComponent(Q)}return Y}function bD($,Z,Y){let X=`${encodeURIComponent($)}=${encodeURIComponent(Z)}`;if(Y?.maxAge!==void 0)X+=`; Max-Age=${Y.maxAge}`;if(Y?.expires)X+=`; Expires=${Y.expires.toUTCString()}`;if(Y?.path)X+=`; Path=${Y.path}`;if(Y?.domain)X+=`; Domain=${Y.domain}`;if(Y?.secure)X+="; Secure";if(Y?.httpOnly)X+="; HttpOnly";if(Y?.sameSite)X+=`; SameSite=${Y.sameSite}`;return X}function CD($,Z){let Y=new Headers(Z?.headers);return Y.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify($),{...Z,headers:Y})}function yD($,Z=302){return new Response(null,{status:Z,headers:{Location:$}})}function PD($="Not Found"){return new Response($,{status:404,headers:{"Content-Type":"text/plain"}})}var CH=()=>{};var{WebView:xD}=globalThis.Bun;import{existsSync as xH,mkdirSync as vH,readdirSync as vD,statSync as fH}from"fs";import o7 from"path";function fD($){if(/^https?:\/\//.test($)||$.startsWith("file://"))return $;return`file://${o7.resolve($)}`}function yH($,Z,Y){return new Promise((X)=>{let J=!1,Q=()=>{if(!J)J=!0,X()};$.onNavigated=()=>setTimeout(Q,Z),setTimeout(Q,Y)})}async function PH($,Z,Y){let X=`!!document.querySelector(${JSON.stringify(Z)})`,J=Date.now()+Y;while(Date.now()<J){try{if(await $.evaluate(X))return}catch{}await new Promise((Q)=>setTimeout(Q,100))}}async function gD($){try{let Z=await $.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof Z==="number"&&Number.isFinite(Z)&&Z>0?Math.min(Z,FQ):0}catch{return 0}}async function gH($,Z,Y={}){let X=Math.min(Y.width??1440,FQ),J=Math.min(Y.height??2200,FQ),Q=Y.waitMs??800,G=Y.timeoutMs??15000,K=Y.format??"png",W=fD($),U=(_)=>new xD({url:W,width:X,height:_,headless:!0,...Y.backend?{backend:Y.backend}:{}}),B=U(J);try{if(await yH(B,Q,G),Y.waitSelector)await PH(B,Y.waitSelector,G);if(Y.fullPage){let z=await gD(B);if(z>J){if(B.close(),B=U(z),await yH(B,Q,G),Y.waitSelector)await PH(B,Y.waitSelector,G)}}let _=await B.screenshot({encoding:"buffer",format:K});vH(o7.dirname(o7.resolve(Z)),{recursive:!0}),await Bun.write(Z,_)}finally{B.close()}if(!xH(Z))throw Error(`Screenshot was not produced for ${$}`);return{input:$,output:Z,bytes:fH(Z).size}}async function hD($,Z,Y={}){vH(Z,{recursive:!0});let X;if(!/^https?:\/\//.test($)&&xH($)&&fH($).isDirectory())X=vD($).filter((G)=>G.endsWith(".html")).map((G)=>o7.join($,G));else X=[$];let J=Y.format??"png",Q=[];for(let G of X){let K=/^https?:\/\//.test(G)?new URL(G).pathname.replace(/\W+/g,"-").replace(/^-|-$/g,"")||"index":o7.basename(G).replace(/\.html?$/,"");Q.push(await gH(G,o7.join(Z,`${K}.${J}`),Y))}return Q}var FQ=16384;var hH=()=>{};function mH($,Z={}){let Y={...uH,...Z};if($.trim()==="")return`
13701
+ </tr>`;J+="</tbody></table>";for(let Q of Y)if(Q.example)J+=`<h3>@${Q.name}</h3>`,J+=`<p>${Q.description||""}</p>`,J+="<h4>Example</h4>",J+=`<pre><code>${Q.example.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}</code></pre>`}return J+="</body></html>",J}function TH($=[],Z=[],Y=[],X){return JSON.stringify({components:$,templates:Z,directives:Y,extraContent:X||""},null,2)}async function IH($){try{let{componentsDir:Z,templatesDir:Y,webComponentsConfig:X,customDirectives:J,config:Q}=$;if(!Q.enabled)return!1;let G=Q.outputDir||"docs";if(await HQ.promises.mkdir(G,{recursive:!0}),console.log("Generating documentation..."),Z)console.log(`Components directory: ${Z}`);if(Y)console.log(`Templates directory: ${Y}`);console.log(`Output directory: ${G}`);let K=[];if(Q.components!==!1&&Z)console.log("Generating component documentation..."),K=await NH(Z,X),console.log(`Found ${K.length} components`);let W=[];if(Q.templates!==!1&&Y)console.log("Generating template documentation..."),W=await AH(Y),console.log(`Found ${W.length} templates`);let U=[];if(Q.directives!==!1)console.log("Generating directive documentation..."),U=await wH(J),console.log(`Found ${U.length} directives`);let B=Q.format||"markdown",_=Q.extraContent,z="",q="";switch(B){case"markdown":z=RH(K,W,U,_),q="md";break;case"html":z=MH(K,W,U,_),q="html";break;case"json":z=TH(K,W,U,_),q="json";break;default:throw Error(`Unsupported documentation format: ${B}`)}let j=x6.join(G,`stx-docs.${q}`);return await Bun.write(j,z),console.log(`Documentation generated: ${j}`),!0}catch(Z){return console.error("Error generating documentation:",Z),!1}}async function qD($){let Z={enabled:!0,outputDir:$.output||"docs",format:$.format||"markdown",components:$.components!==!1,templates:$.templates!==!1,directives:$.directives!==!1,extraContent:$.extraContent},Y=$.componentsDir||K1.componentsDir,X=$.templatesDir||".";return IH({componentsDir:Y,templatesDir:X,webComponentsConfig:K1.webComponents,customDirectives:K1.customDirectives,config:Z})}var EH=D(()=>{i0();A0()});import s7 from"process";function r7(){if(typeof globalThis<"u"&&"caches"in globalThis&&"CF"in globalThis)return{platform:"cloudflare",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["kv","r2","d1","durable-objects","queues"]};if(typeof globalThis<"u"&&"Deno"in globalThis)return{platform:"deno",version:globalThis.Deno.version?.deno,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["kv","deploy","ffi"]};if(typeof globalThis<"u"&&"Bun"in globalThis)return{platform:"bun",version:globalThis.Bun.version,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!1,supportsCache:!1,capabilities:["sqlite","ffi","native-modules"]};if(typeof globalThis<"u"&&"EdgeRuntime"in globalThis)return{platform:"vercel",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["edge-config","blob"]};if(typeof globalThis<"u"&&"Netlify"in globalThis)return{platform:"netlify",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!1,capabilities:["blobs","edge-functions"]};if(typeof globalThis<"u"&&"fastly"in globalThis)return{platform:"fastly",supportsStreaming:!0,supportsCrypto:!0,supportsKV:!0,supportsCache:!0,capabilities:["dictionary","backend","geolocation"]};if(s7.versions?.node)return{platform:"node",version:s7.versions.node,supportsStreaming:!0,supportsCrypto:!0,supportsKV:!1,supportsCache:!1,capabilities:["fs","child-process","native-modules"]};return{platform:"unknown",supportsStreaming:!1,supportsCrypto:!1,supportsKV:!1,supportsCache:!1,capabilities:[]}}function jD(){let $=r7();return["cloudflare","deno","vercel","netlify","fastly"].includes($.platform)}function HD(){return r7().platform!=="unknown"}function kH($){return{get(Z){if($&&Z in $){let Y=$[Z];return typeof Y==="string"?Y:void 0}if(typeof globalThis<"u"&&"Deno"in globalThis)return globalThis.Deno.env.get(Z);if(s7.env)return s7.env[Z];return},getOrThrow(Z){let Y=this.get(Z);if(Y===void 0)throw Error(`Environment variable "${Z}" is not set`);return Y},has(Z){return this.get(Z)!==void 0},all(){let Z={};if($){for(let[Y,X]of Object.entries($))if(typeof X==="string")Z[Y]=X}if(typeof globalThis<"u"&&"Deno"in globalThis){let Y=globalThis.Deno.env.toObject();Object.assign(Z,Y)}if(s7.env){for(let[Y,X]of Object.entries(s7.env))if(X!==void 0)Z[Y]=X}return Z}}}function SH($){let Z=r7();if(Z.platform==="cloudflare"&&$)return $;if(Z.platform==="deno"&&"Deno"in globalThis)return OD();if(Z.platform==="node"||Z.platform==="bun")return LD();return}function OD(){let $=null,Z=async()=>{if(!$)$=await globalThis.Deno.openKv();return $};return{async get(Y){return(await(await Z()).get(["stx",Y])).value},async getWithMetadata(Y){let X=await Z(),J=await X.get(["stx",Y]),Q=await X.get(["stx-meta",Y]);return{value:J.value,metadata:Q.value}},async put(Y,X,J){let Q=await Z(),G=J?.expirationTtl?J.expirationTtl*1000:void 0;if(await Q.set(["stx",Y],X,G?{expireIn:G}:void 0),J?.metadata)await Q.set(["stx-meta",Y],J.metadata,G?{expireIn:G}:void 0)},async delete(Y){let X=await Z();await X.delete(["stx",Y]),await X.delete(["stx-meta",Y])},async list(Y){let X=await Z(),J=Y?.prefix?["stx",Y.prefix]:["stx"],Q=X.list({prefix:J,limit:Y?.limit||100}),G=[];for await(let K of Q){let U=K.key.slice(1).join("/");if(!U.startsWith("stx-meta/"))G.push({name:U})}return{keys:G,list_complete:!0}}}}function LD(){let $=new Map,Z=()=>{let Y=Date.now();for(let[X,J]of $.entries())if(J.expiration&&J.expiration<Y)$.delete(X)};return{async get(Y){Z();let X=$.get(Y);if(!X)return null;if(X.expiration&&X.expiration<Date.now())return $.delete(Y),null;return X.value},async getWithMetadata(Y){Z();let X=$.get(Y);if(!X)return{value:null,metadata:null};if(X.expiration&&X.expiration<Date.now())return $.delete(Y),{value:null,metadata:null};return{value:X.value,metadata:X.metadata||null}},async put(Y,X,J){let Q=J?.expiration?J.expiration*1000:J?.expirationTtl?Date.now()+J.expirationTtl*1000:void 0;$.set(Y,{value:X,metadata:J?.metadata,expiration:Q})},async delete(Y){$.delete(Y)},async list(Y){Z();let X=[];for(let[J,Q]of $.entries()){if(Y?.prefix&&!J.startsWith(Y.prefix))continue;if(X.push({name:J,expiration:Q.expiration,metadata:Q.metadata}),Y?.limit&&X.length>=Y.limit)break}return{keys:X,list_complete:!0}}}}function bH(){let $=r7();if($.platform==="cloudflare"&&"caches"in globalThis)return FD();if($.supportsStreaming)return VD();return}function FD(){return{async match($){return(await caches.default).match($)},async put($,Z){await(await caches.default).put($,Z.clone())},async delete($){return(await caches.default).delete($)}}}function VD(){let $=new Map,Z=60000;return{async match(Y){let X=Y.url,J=$.get(X);if(!J)return;if(Date.now()>J.expiration){$.delete(X);return}return J.response.clone()},async put(Y,X){let J=Y.url,Q=X.headers.get("Cache-Control"),G=60000;if(Q){let K=Q.match(/max-age=(\d+)/);if(K)G=Number.parseInt(K[1],10)*1000}$.set(J,{response:X.clone(),expiration:Date.now()+G})},async delete(Y){return $.delete(Y.url)}}}function ND(){return`${Date.now().toString(36)}-${Math.random().toString(36).slice(2,9)}`}function AD($,Z){if(Z.platform==="cloudflare"){let Y=$.cf;if(Y)return{city:Y.city,country:Y.country,countryCode:Y.country,region:Y.region,latitude:Y.latitude?Number.parseFloat(Y.latitude):void 0,longitude:Y.longitude?Number.parseFloat(Y.longitude):void 0,timezone:Y.timezone}}if(Z.platform==="vercel"){let Y={},X=$.headers.get("x-vercel-ip-city"),J=$.headers.get("x-vercel-ip-country"),Q=$.headers.get("x-vercel-ip-country-region"),G=$.headers.get("x-vercel-ip-latitude"),K=$.headers.get("x-vercel-ip-longitude");if(X)Y.city=decodeURIComponent(X);if(J)Y.countryCode=J;if(Q)Y.region=Q;if(G)Y.latitude=Number.parseFloat(G);if(K)Y.longitude=Number.parseFloat(K);return Object.keys(Y).length>0?Y:void 0}if(Z.platform==="netlify"){let Y={},X=$.headers.get("x-nf-geo-city"),J=$.headers.get("x-nf-geo-country");if(X)Y.city=X;if(J)Y.countryCode=J;return Object.keys(Y).length>0?Y:void 0}return}function LQ($,Z,Y){let X=new Headers($.headers);if(Z.origins==="*")X.set("Access-Control-Allow-Origin","*");else if(Z.origins&&Y&&Z.origins.includes(Y))X.set("Access-Control-Allow-Origin",Y),X.set("Vary","Origin");if(Z.methods)X.set("Access-Control-Allow-Methods",Z.methods.join(", "));if(Z.headers)X.set("Access-Control-Allow-Headers",Z.headers.join(", "));if(Z.exposeHeaders)X.set("Access-Control-Expose-Headers",Z.exposeHeaders.join(", "));if(Z.credentials)X.set("Access-Control-Allow-Credentials","true");if(Z.maxAge)X.set("Access-Control-Max-Age",String(Z.maxAge));return new Response($.body,{status:$.status,statusText:$.statusText,headers:X})}function v6($){let Z=r7();return async(Y,X)=>{let J=performance.now(),Q=ND(),G={runtime:Z,platform:X||{},requestId:Q,geo:AD(Y,Z),timing:{start:J,getElapsed:()=>performance.now()-J},kv:SH(X?.KV),cache:bH(),env:kH(X?.env)};try{if(Y.method==="OPTIONS"&&$.cors){let W=new Response(null,{status:204});return W=LQ(W,$.cors,Y.headers.get("Origin")||void 0),W}if($.cache?.enabled&&Y.method==="GET"&&G.cache){if(DH(Y,$.cache)){let U=await G.cache.match(Y);if(U){let B=new Response(U.body,U);return B.headers.set("X-Cache","HIT"),B.headers.set("X-Request-Id",Q),$.cors?LQ(B,$.cors,Y.headers.get("Origin")||void 0):B}}}let K;if($.middleware&&$.middleware.length>0)K=await wD(Y,G,$.middleware,async()=>{let W=await $.render(Y,G);return typeof W==="string"?new Response(W,{headers:{"Content-Type":"text/html; charset=utf-8"}}):W});else{let W=await $.render(Y,G);K=typeof W==="string"?new Response(W,{headers:{"Content-Type":"text/html; charset=utf-8"}}):W}if(K.headers.set("X-Request-Id",Q),K.headers.set("X-Response-Time",`${G.timing.getElapsed().toFixed(2)}ms`),$.cache?.enabled&&Y.method==="GET"&&G.cache){if(DH(Y,$.cache)&&K.status===200){let U=$.cache.ttl||60,B=K.clone();B.headers.set("Cache-Control",`public, max-age=${U}`),await G.cache.put(Y,B),K.headers.set("X-Cache","MISS")}}if($.cors)K=LQ(K,$.cors,Y.headers.get("Origin")||void 0);return K}catch(K){let W=K instanceof Error?K:Error(String(K));if($.onError)return $.onError(W,Y);return new Response(`Internal Server Error: ${W.message}`,{status:500,headers:{"Content-Type":"text/plain","X-Request-Id":Q}})}}}function DH($,Z){let X=new URL($.url).pathname;if(Z.excludePaths){for(let J of Z.excludePaths)if(J.test(X))return!1}if(Z.includePaths){for(let J of Z.includePaths)if(J.test(X))return!0;return!1}return!0}async function wD($,Z,Y,X){let J=0,Q=async()=>{if(J>=Y.length)return X();let G=Y[J];return J++,G($,Z,Q)};return Q()}function RD($,Z){let Y=new Headers(Z?.headers);return Y.set("Content-Type","text/html; charset=utf-8"),Y.set("Transfer-Encoding","chunked"),new Response($,{...Z,headers:Y})}function MD(){let $=new TextEncoder;return new TransformStream({transform(Z,Y){Y.enqueue($.encode(Z))}})}function TD($){let Z=new TextEncoder;return new ReadableStream({async start(Y){for await(let X of $)Y.enqueue(Z.encode(X));Y.close()}})}function ID($){let Z=v6($);return{async fetch(Y,X,J){return Z(Y,{env:X,ctx:J,KV:X.KV})}}}function ED($){let Z=v6($);return(Y)=>Z(Y,{})}function DD($){let Z=v6($);return(Y)=>Z(Y,{})}function kD($){let Z=v6($);return(Y,X)=>{return Z(Y,{netlifyContext:X})}}function SD($){let Z=$.headers.get("Cookie");if(!Z)return{};let Y={};for(let X of Z.split(";")){let[J,Q]=X.split("=").map((G)=>G.trim());if(J&&Q)Y[J]=decodeURIComponent(Q)}return Y}function bD($,Z,Y){let X=`${encodeURIComponent($)}=${encodeURIComponent(Z)}`;if(Y?.maxAge!==void 0)X+=`; Max-Age=${Y.maxAge}`;if(Y?.expires)X+=`; Expires=${Y.expires.toUTCString()}`;if(Y?.path)X+=`; Path=${Y.path}`;if(Y?.domain)X+=`; Domain=${Y.domain}`;if(Y?.secure)X+="; Secure";if(Y?.httpOnly)X+="; HttpOnly";if(Y?.sameSite)X+=`; SameSite=${Y.sameSite}`;return X}function CD($,Z){let Y=new Headers(Z?.headers);return Y.set("Content-Type","application/json; charset=utf-8"),new Response(JSON.stringify($),{...Z,headers:Y})}function yD($,Z=302){return new Response(null,{status:Z,headers:{Location:$}})}function PD($="Not Found"){return new Response($,{status:404,headers:{"Content-Type":"text/plain"}})}var CH=()=>{};var{WebView:xD}=globalThis.Bun;import{existsSync as xH,mkdirSync as vH,readdirSync as vD,statSync as fH}from"fs";import o7 from"path";function fD($){if(/^https?:\/\//.test($)||$.startsWith("file://"))return $;return`file://${o7.resolve($)}`}function yH($,Z,Y){return new Promise((X)=>{let J=!1,Q=()=>{if(!J)J=!0,X()};$.onNavigated=()=>setTimeout(Q,Z),setTimeout(Q,Y)})}async function PH($,Z,Y){let X=`!!document.querySelector(${JSON.stringify(Z)})`,J=Date.now()+Y;while(Date.now()<J){try{if(await $.evaluate(X))return}catch{}await new Promise((Q)=>setTimeout(Q,100))}}async function gD($){try{let Z=await $.evaluate("Math.ceil(Math.max(document.documentElement.scrollHeight, document.documentElement.offsetHeight, document.body ? document.body.scrollHeight : 0, document.body ? document.body.offsetHeight : 0))");return typeof Z==="number"&&Number.isFinite(Z)&&Z>0?Math.min(Z,FQ):0}catch{return 0}}async function gH($,Z,Y={}){let X=Math.min(Y.width??1440,FQ),J=Math.min(Y.height??2200,FQ),Q=Y.waitMs??800,G=Y.timeoutMs??15000,K=Y.format??"png",W=fD($),U=(_)=>new xD({url:W,width:X,height:_,headless:!0,...Y.backend?{backend:Y.backend}:{}}),B=U(J);try{if(await yH(B,Q,G),Y.waitSelector)await PH(B,Y.waitSelector,G);if(Y.fullPage){let z=await gD(B);if(z>J){if(B.close(),B=U(z),await yH(B,Q,G),Y.waitSelector)await PH(B,Y.waitSelector,G)}}let _=await B.screenshot({encoding:"buffer",format:K});vH(o7.dirname(o7.resolve(Z)),{recursive:!0}),await Bun.write(Z,_)}finally{B.close()}if(!xH(Z))throw Error(`Screenshot was not produced for ${$}`);return{input:$,output:Z,bytes:fH(Z).size}}async function hD($,Z,Y={}){vH(Z,{recursive:!0});let X;if(!/^https?:\/\//.test($)&&xH($)&&fH($).isDirectory())X=vD($).filter((G)=>G.endsWith(".html")).map((G)=>o7.join($,G));else X=[$];let J=Y.format??"png",Q=[];for(let G of X){let K=/^https?:\/\//.test(G)?new URL(G).pathname.replace(/\W+/g,"-").replace(/^-|-$/g,"")||"index":o7.basename(G).replace(/\.html?$/,"");Q.push(await gH(G,o7.join(Z,`${K}.${J}`),Y))}return Q}var FQ=16384;var hH=()=>{};function mH($,Z={}){let Y={...uH,...Z};if($.trim()==="")return`
13702
13702
  `;let X=$;if(Y.trimTrailingWhitespace)X=X.replace(/[ \t]+$/gm,"");if(X=mD(X,Y),X=iD(X,Y),X=pD(X,Y),Y.trimTrailingWhitespace)X=X.replace(/[ \t]+$/gm,""),X=X.replace(/(\S)[ \t]+(<\/[^>]+>)/g,"$1$2");if(X=X.replace(/\r\n/g,`
13703
13703
  `).replace(/\r/g,`
13704
13704
  `),!X.endsWith(`
@@ -14709,7 +14709,7 @@ $1`)}if(E.length>0){let{interpolateScriptsInTemplate:C}=await Promise.resolve().
14709
14709
  $1`);else u+=`
14710
14710
  ${h}`}return _.set(N,{content:u,mtime:V.mtimeMs}),u}async function q(L){let V=p6.statSync(L),N=`${L}:${V.mtimeMs}`,A=_.get(N);if(A)return A.content;let{content:w}=await X$(L,X);return _.set(N,{content:w,mtime:V.mtimeMs}),w}function j(L){let V=L.startsWith("/")?L.slice(1):L,N=[V,`${V}.stx`,`${V}.md`,`${V}.html`,X5.join(V,"index.stx"),X5.join(V,"index.md"),X5.join(V,"index.html")];for(let A of N){let w=X5.join(B,A);if(p6.existsSync(w)&&p6.statSync(w).isFile())return w}return null}async function H(L){let V=new URL(L.url),N=async()=>{if(G[V.pathname])return await G[V.pathname](L);if(Q){let w=await Q(L);if(w)return w}let A=j(V.pathname);if(!A){if(W)return await W(L);return new Response("Not Found",{status:404})}try{let w,R="text/html";if(A.endsWith(".stx"))w=await z(A);else if(A.endsWith(".md"))w=await q(A);else if(A.endsWith(".html"))w=await Bun.file(A).text();else if(A.endsWith(".css"))w=await Bun.file(A).text(),R="text/css";else if(A.endsWith(".js"))w=await Bun.file(A).text(),R="text/javascript";else if(A.endsWith(".json"))w=await Bun.file(A).text(),R="application/json";else return new Response(Bun.file(A));return new Response(w,{headers:{"Content-Type":R}})}catch(w){if(U)return await U(w,L);let R=w instanceof Error?w.message:String(w),I=X?.debug===!0?`<h1>Error</h1><pre>${R}
14711
14711
  ${w instanceof Error?w.stack:""}</pre>`:"<h1>Internal Server Error</h1><p>An error occurred while processing your request.</p>";return new Response(I,{status:500,headers:{"Content-Type":"text/html"}})}};for(let A=K.length-1;A>=0;A--){let w=K[A],R=N;N=async()=>await w(L,R)}return await N()}let O=XS({port:Z,fetch:H}),F=null;if(J)F=p6.watch(B,{recursive:!0},(L,V)=>{if(V&&(V.endsWith(".stx")||V.endsWith(".md")||V.endsWith(".html")))_.clear()});return{server:O,url:O.url.toString(),stop(){if(F)F.close();O.stop()}}}async function QS($,Z={}){let Y=X5.resolve($);if(!await Bun.file(Y).exists())throw Error(`File not found: ${Y}`);let X=Y.endsWith(".md"),J=Y.endsWith(".stx");if(!X&&!J)throw Error(`Unsupported file type: ${Y}. Only .stx and .md files are supported.`);return await UO({...Z,root:X5.dirname(Y),routes:{"/":async()=>{let Q;if(X){let{content:G}=await X$(Y,Z.stxOptions);Q=G}else{let G=await Bun.file(Y).text(),K=[],W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,U;while((U=W.exec(G))!==null)if(U[1].includes("server"))K.push(U[2]);let B=K.join(`
14712
- `),_=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={};if(B.trim())await D0(B,z,Y);let q=new Set;Q=await X0(_,z,Y,Z.stxOptions||{},q)}return new Response(Q,{headers:{"Content-Type":"text/html"}})},...Z.routes}})}function GS($){return $}function KS($){return $}var BO=D(()=>{O7();F1();N0()});import{existsSync as WS,readFileSync as US}from"fs";class TQ{options;variables=new Map;errors=[];warnings=[];currentFile="";constructor($={}){if(this.options={...BS,...$},this.options.includeBuiltins)Object.entries(_O).forEach(([Z,Y])=>{this.variables.set(Z,Y)});if(this.options.customTypes)Object.entries(this.options.customTypes).forEach(([Z,Y])=>{this.variables.set(Z,Y)})}checkFile($){if(this.currentFile=$,this.errors=[],this.warnings=[],!WS($))return this.errors.push({message:`File not found: ${$}`,file:$,line:0,column:0,expression:"",severity:"error"}),this.getResult();let Z=US($,"utf-8");return this.checkTemplate(Z,$)}checkTemplate($,Z="<inline>"){this.currentFile=Z,this.errors=[],this.warnings=[];let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(Y)this.analyzeScript(Y[1],$.indexOf(Y[0]));return this.checkDirectives($),this.checkExpressions($),this.getResult()}analyzeScript($,Z){let Y=$.split(`
14712
+ `),_=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={};if(B.trim())await D0(B,z,Y);let q=new Set;Q=await X0(_,z,Y,Z.stxOptions||{},q)}return new Response(Q,{headers:{"Content-Type":"text/html"}})},...Z.routes}})}function GS($){return $}function KS($){return $}var BO=D(()=>{O7();F1();A0()});import{existsSync as WS,readFileSync as US}from"fs";class TQ{options;variables=new Map;errors=[];warnings=[];currentFile="";constructor($={}){if(this.options={...BS,...$},this.options.includeBuiltins)Object.entries(_O).forEach(([Z,Y])=>{this.variables.set(Z,Y)});if(this.options.customTypes)Object.entries(this.options.customTypes).forEach(([Z,Y])=>{this.variables.set(Z,Y)})}checkFile($){if(this.currentFile=$,this.errors=[],this.warnings=[],!WS($))return this.errors.push({message:`File not found: ${$}`,file:$,line:0,column:0,expression:"",severity:"error"}),this.getResult();let Z=US($,"utf-8");return this.checkTemplate(Z,$)}checkTemplate($,Z="<inline>"){this.currentFile=Z,this.errors=[],this.warnings=[];let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i);if(Y)this.analyzeScript(Y[1],$.indexOf(Y[0]));return this.checkDirectives($),this.checkExpressions($),this.getResult()}analyzeScript($,Z){let Y=$.split(`
14713
14713
  `),X=this.getLineNumber(Z);for(let J=0;J<Y.length;J++){let Q=Y[J],G=X+J;this.extractTypedVariables(Q,G),this.extractInterfaces(Q,Y,J,G),this.extractTypeAliases(Q,G)}}extractTypedVariables($,Z){let Y=$.match(/(?:export\s+)?(?:const|let|var)\s+(\w+)\s*:\s*([^=]+?)\s*=/);if(Y){let[,Q,G]=Y,K=this.parseTypeAnnotation(G.trim());this.variables.set(Q,K);return}let X=$.match(/(?:export\s+)?(?:const|let|var)\s+(\w+)\s*=\s*(.+)/);if(X){let[,Q,G]=X,K=this.inferType(G.trim());this.variables.set(Q,K);return}let J=$.match(/(?:export\s+)?function\s+(\w+)\s*\(([^)]*)\)(?:\s*:\s*(\w+))?/);if(J){let[,Q,G,K]=J,W=this.parseParams(G),U=K?this.parseTypeAnnotation(K):{kind:"primitive",value:"any"};this.variables.set(Q,{kind:"function",params:W,returnType:U})}}extractInterfaces($,Z,Y,X){let J=$.match(/(?:export\s+)?interface\s+(\w+)\s*\{/);if(J){let[,Q]=J,G={},K=1,W=Y+1;while(W<Z.length&&K>0){let U=Z[W].trim();if(U.includes("{"))K++;if(U.includes("}"))K--;let B=U.match(/(\w+)\??\s*:\s*([^;]+)/);if(B&&K>0){let[,_,z]=B;G[_]=this.parseTypeAnnotation(z.trim())}W++}this.variables.set(Q,{kind:"object",name:Q,properties:G})}}extractTypeAliases($,Z){let Y=$.match(/(?:export\s+)?type\s+(\w+)\s*=\s*(.+)/);if(Y){let[,X,J]=Y,Q=this.parseTypeAnnotation(J.trim());Q.name=X,this.variables.set(X,Q)}}parseTypeAnnotation($){let Z=$.trim();if(Z.includes("|"))return{kind:"union",types:Z.split("|").map((Q)=>this.parseTypeAnnotation(Q.trim()))};if(Z.includes("&"))return{kind:"intersection",types:Z.split("&").map((Q)=>this.parseTypeAnnotation(Q.trim()))};if(Z.endsWith("[]"))return{kind:"array",elementType:this.parseTypeAnnotation(Z.slice(0,-2))};let Y=Z.match(/^Array<(.+)>$/);if(Y)return{kind:"array",elementType:this.parseTypeAnnotation(Y[1])};if(Z.startsWith("{")&&Z.endsWith("}")){let J={},Q=Z.slice(1,-1).trim();if(Q){let G=this.splitByComma(Q);for(let K of G){let W=K.match(/(\w+)\??\s*:\s*(.+)/);if(W){let[,U,B]=W;J[U]=this.parseTypeAnnotation(B.trim())}}}return{kind:"object",properties:J}}if(Z.startsWith('"')||Z.startsWith("'"))return{kind:"literal",value:Z.slice(1,-1)};if(/^\d+$/.test(Z))return{kind:"literal",value:Z};if(Z==="true"||Z==="false")return{kind:"literal",value:Z};if(["string","number","boolean","null","undefined","any","unknown","void","never"].includes(Z))return{kind:"primitive",value:Z};if(this.variables.has(Z))return this.variables.get(Z);return{kind:"primitive",value:"any"}}inferType($){let Z=$.trim().replace(/;$/,"");if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'")||Z.startsWith("`")&&Z.endsWith("`"))return{kind:"primitive",value:"string"};if(/^-?\d+(\.\d+)?$/.test(Z))return{kind:"primitive",value:"number"};if(Z==="true"||Z==="false")return{kind:"primitive",value:"boolean"};if(Z==="null")return{kind:"primitive",value:"null"};if(Z==="undefined")return{kind:"primitive",value:"undefined"};if(Z.startsWith("[")){let Y=Z.slice(1,-1).trim();if(Y){let X=this.splitByComma(Y)[0];if(X)return{kind:"array",elementType:this.inferType(X.trim())}}return{kind:"array",elementType:{kind:"primitive",value:"any"}}}if(Z.startsWith("{")){let Y={},X=this.extractObjectLiteral(Z);for(let[J,Q]of Object.entries(X))Y[J]=this.inferType(Q);return{kind:"object",properties:Y}}if(Z.includes("=>")){let Y=Z.match(/^\(([^)]*)\)\s*(?::\s*(\w+))?\s*=>/);if(Y){let X=this.parseParams(Y[1]),J=Y[2]?this.parseTypeAnnotation(Y[2]):{kind:"primitive",value:"any"};return{kind:"function",params:X,returnType:J}}}if(/^\w+$/.test(Z)&&this.variables.has(Z))return this.variables.get(Z);if(Z.includes("."))return this.resolvePropertyAccess(Z);if(Z.includes("(")){let Y=Z.split("(")[0],X=this.variables.get(Y);if(X?.kind==="function"&&X.returnType)return X.returnType}return{kind:"primitive",value:"any"}}parseParams($){if(!$.trim())return[];let Z=[],Y=this.splitByComma($);for(let X of Y){let J=X.trim(),Q=J.includes("?"),G=J.match(/(\w+)\??\s*(?::\s*([^=]+))?(?:\s*=)?/);if(G){let[,K,W]=G,U=W?this.parseTypeAnnotation(W.trim()):{kind:"primitive",value:"any"};Z.push({name:K,type:U,optional:Q})}}return Z}checkExpressions($){let Z=/\{\{([\s\S]*?)\}\}/g,Y;while((Y=Z.exec($))!==null){let J=Y[1].trim(),Q=Y.index,G=this.getLineNumber(Q,$),K=this.getColumn(Q,$);if(!J)continue;if(J.startsWith("!")||J.endsWith("!"))continue;this.checkExpression(J,G,K)}let X=/\{!!([\s\S]*?)!!\}/g;while((Y=X.exec($))!==null){let J=Y[1].trim(),Q=Y.index,G=this.getLineNumber(Q,$),K=this.getColumn(Q,$);if(!J)continue;this.checkExpression(J,G,K)}}checkExpression($,Z,Y){if($.includes("?")&&$.includes(":")){let Q=$.split("?");this.checkExpression(Q[0].trim(),Z,Y);let G=Q.slice(1).join("?").split(":");if(G.length>=2)this.checkExpression(G[0].trim(),Z,Y),this.checkExpression(G.slice(1).join(":").trim(),Z,Y);return}for(let Q of["&&","||","??"])if($.includes(Q)){$.split(Q).forEach((K)=>this.checkExpression(K.trim(),Z,Y));return}for(let Q of["===","!==","==","!=",">=","<=",">","<"])if($.includes(Q)){$.split(Q).forEach((K)=>this.checkExpression(K.trim(),Z,Y));return}if($.startsWith("!")){this.checkExpression($.slice(1).trim(),Z,Y);return}if(this.isLiteral($))return;let X=$.match(/^(\w+(?:\.\w+)*)\s*\(/);if(X){let Q=X[1],G=this.resolvePropertyAccess(Q);if(G.kind!=="function"&&G.value!=="any")this.addWarning(`'${Q}' is not a function`,Z,Y,$);return}if($.includes(".")){if(this.resolvePropertyAccess($).value==="undefined"&&this.options.checkPropertyAccess)this.addWarning(`Property access '${$}' may be undefined`,Z,Y,$);return}let J=$.match(/^\w+/)?.[0];if(J&&!this.variables.has(J))this.addError(`Variable '${J}' is not defined`,Z,Y,$)}checkDirectives($){let Z=/@if\s*\(([^)]+)\)/g,Y;while((Y=Z.exec($))!==null){let G=Y[1].trim(),K=Y.index,W=this.getLineNumber(K,$),U=this.getColumn(K,$);this.checkExpression(G,W,U)}let X=/@foreach\s*\((\w+)\s+(?:as|in)\s+(\w+)(?:\s*,\s*(\w+))?\)/g;while((Y=X.exec($))!==null){let[,G,K,W]=Y,U=Y.index,B=this.getLineNumber(U,$),_=this.getColumn(U,$);if(!this.variables.has(G))this.addError(`Collection '${G}' is not defined`,B,_,Y[0]);else{let z=this.variables.get(G);if(z.kind==="array"&&z.elementType)this.variables.set(K,z.elementType);else this.variables.set(K,{kind:"primitive",value:"any"});if(W)this.variables.set(W,{kind:"primitive",value:"number"})}}let J=/@unless\s*\(([^)]+)\)/g;while((Y=J.exec($))!==null){let G=Y[1].trim(),K=Y.index,W=this.getLineNumber(K,$),U=this.getColumn(K,$);this.checkExpression(G,W,U)}let Q=/@switch\s*\(([^)]+)\)/g;while((Y=Q.exec($))!==null){let G=Y[1].trim(),K=Y.index,W=this.getLineNumber(K,$),U=this.getColumn(K,$);this.checkExpression(G,W,U)}}resolvePropertyAccess($){let Z=$.split("."),Y=this.variables.get(Z[0])||{kind:"primitive",value:"any"};for(let X=1;X<Z.length;X++){let J=Z[X].replace(/\(\)$/,"");if(Y.kind==="object"&&Y.properties)if(Y.properties[J])Y=Y.properties[J];else if(!this.options.allowAny)return{kind:"primitive",value:"undefined"};else Y={kind:"primitive",value:"any"};else if(Y.kind==="array"&&Y.elementType)if(["length"].includes(J))Y={kind:"primitive",value:"number"};else if(["map","filter","find","forEach","some","every","reduce"].includes(J))Y={kind:"function",returnType:{kind:"primitive",value:"any"}};else if(["join"].includes(J))Y={kind:"function",returnType:{kind:"primitive",value:"string"}};else Y={kind:"primitive",value:"any"};else if(Y.kind==="primitive"&&Y.value==="string")if(["length"].includes(J))Y={kind:"primitive",value:"number"};else if(["toUpperCase","toLowerCase","trim","slice","substring"].includes(J))Y={kind:"function",returnType:{kind:"primitive",value:"string"}};else if(["split"].includes(J))Y={kind:"function",returnType:{kind:"array",elementType:{kind:"primitive",value:"string"}}};else Y={kind:"primitive",value:"any"};else Y={kind:"primitive",value:"any"}}return Y}isLiteral($){let Z=$.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'")||Z.startsWith("`")&&Z.endsWith("`"))return!0;if(/^-?\d+(\.\d+)?$/.test(Z))return!0;if(Z==="true"||Z==="false")return!0;if(Z==="null"||Z==="undefined")return!0;return!1}extractObjectLiteral($){let Z={},Y=$.slice(1,-1).trim();if(!Y)return Z;let X=this.splitByComma(Y);for(let J of X){let Q=J.indexOf(":");if(Q>0){let G=J.slice(0,Q).trim(),K=J.slice(Q+1).trim();Z[G]=K}}return Z}splitByComma($){let Z=[],Y="",X=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q],K=Q>0?$[Q-1]:"";if((G==='"'||G==="'"||G==="`")&&K!=="\\"){if(J===G)J=null;else if(!J)J=G}if(!J){if(G==="{"||G==="["||G==="(")X++;if(G==="}"||G==="]"||G===")")X--;if(G===","&&X===0){Z.push(Y.trim()),Y="";continue}}Y+=G}if(Y.trim())Z.push(Y.trim());return Z}getLineNumber($,Z){return((Z||"").slice(0,$).match(/\n/g)||[]).length+1}getColumn($,Z){let X=Z.slice(0,$).lastIndexOf(`
14714
14714
  `);return $-X}addError($,Z,Y,X,J,Q){this.errors.push({message:$,file:this.currentFile,line:Z,column:Y,expression:X,expected:J,received:Q,severity:"error"})}addWarning($,Z,Y,X,J,Q){let G={message:$,file:this.currentFile,line:Z,column:Y,expression:X,expected:J,received:Q,severity:"warning"};if(this.options.strict)this.errors.push(G);else this.warnings.push(G)}getResult(){return{valid:this.errors.length===0,errors:this.errors,warnings:this.warnings,variables:new Map(this.variables)}}addVariable($,Z){this.variables.set($,Z)}reset(){if(this.errors=[],this.warnings=[],this.variables.clear(),this.options.includeBuiltins)Object.entries(_O).forEach(([$,Z])=>{this.variables.set($,Z)})}}function IQ($){return new TQ($)}function _S($,Z){return IQ(Z).checkFile($)}function zS($,Z){return IQ(Z).checkTemplate($)}function qS($){let Z=[];for(let Y of $.errors){if(Z.push(`\x1B[31merror\x1B[0m: ${Y.message}`),Z.push(` --> ${Y.file}:${Y.line}:${Y.column}`),Y.expression)Z.push(" |"),Z.push(` | ${Y.expression}`),Z.push(" |");if(Y.expected&&Y.received)Z.push(` expected: ${Y.expected}`),Z.push(` received: ${Y.received}`);Z.push("")}for(let Y of $.warnings){if(Z.push(`\x1B[33mwarning\x1B[0m: ${Y.message}`),Z.push(` --> ${Y.file}:${Y.line}:${Y.column}`),Y.expression)Z.push(" |"),Z.push(` | ${Y.expression}`),Z.push(" |");Z.push("")}if($.valid)Z.push("\x1B[32m\u2713 No type errors found\x1B[0m");else Z.push(`\x1B[31m\u2717 Found ${$.errors.length} error(s) and ${$.warnings.length} warning(s)\x1B[0m`);return Z.join(`
14715
14715
  `)}var BS,_O;var zO=D(()=>{BS={strict:!1,allowAny:!0,checkPropertyAccess:!0,checkFunctionCalls:!0,includeBuiltins:!0},_O={console:{kind:"object",properties:{log:{kind:"function",params:[{name:"message",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"void"}},error:{kind:"function",params:[{name:"message",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"void"}},warn:{kind:"function",params:[{name:"message",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"void"}}}},Math:{kind:"object",properties:{abs:{kind:"function",params:[{name:"x",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},floor:{kind:"function",params:[{name:"x",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},ceil:{kind:"function",params:[{name:"x",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},round:{kind:"function",params:[{name:"x",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},max:{kind:"function",params:[{name:"values",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},min:{kind:"function",params:[{name:"values",type:{kind:"primitive",value:"number"}}],returnType:{kind:"primitive",value:"number"}},random:{kind:"function",params:[],returnType:{kind:"primitive",value:"number"}},PI:{kind:"primitive",value:"number"},E:{kind:"primitive",value:"number"}}},JSON:{kind:"object",properties:{stringify:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"string"}},parse:{kind:"function",params:[{name:"text",type:{kind:"primitive",value:"string"}}],returnType:{kind:"primitive",value:"any"}}}},Date:{kind:"function",returnType:{kind:"object",properties:{getTime:{kind:"function",params:[],returnType:{kind:"primitive",value:"number"}},toISOString:{kind:"function",params:[],returnType:{kind:"primitive",value:"string"}},toLocaleDateString:{kind:"function",params:[],returnType:{kind:"primitive",value:"string"}}}}},Array:{kind:"object",properties:{isArray:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"boolean"}},from:{kind:"function",params:[{name:"arrayLike",type:{kind:"primitive",value:"any"}}],returnType:{kind:"array",elementType:{kind:"primitive",value:"any"}}}}},Object:{kind:"object",properties:{keys:{kind:"function",params:[{name:"obj",type:{kind:"primitive",value:"any"}}],returnType:{kind:"array",elementType:{kind:"primitive",value:"string"}}},values:{kind:"function",params:[{name:"obj",type:{kind:"primitive",value:"any"}}],returnType:{kind:"array",elementType:{kind:"primitive",value:"any"}}},entries:{kind:"function",params:[{name:"obj",type:{kind:"primitive",value:"any"}}],returnType:{kind:"array",elementType:{kind:"primitive",value:"any"}}}}},String:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"string"}},Number:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"number"}},Boolean:{kind:"function",params:[{name:"value",type:{kind:"primitive",value:"any"}}],returnType:{kind:"primitive",value:"boolean"}},props:{kind:"object",properties:{}},slot:{kind:"primitive",value:"string"},loop:{kind:"object",properties:{index:{kind:"primitive",value:"number"},iteration:{kind:"primitive",value:"number"},first:{kind:"primitive",value:"boolean"},last:{kind:"primitive",value:"boolean"},even:{kind:"primitive",value:"boolean"},odd:{kind:"primitive",value:"boolean"},count:{kind:"primitive",value:"number"},remaining:{kind:"primitive",value:"number"},depth:{kind:"primitive",value:"number"},parent:{kind:"object",properties:{}}}}}});async function EQ($,Z,Y){if(!DQ)return;try{let X=$.getAttribute("data-island-id"),J=document.querySelector(`script[data-island-props="${X}"]`),Q=J?JSON.parse(J.textContent||"{}"):{},G=await Y(),K=G.default||G.hydrate;if(typeof K!=="function"){console.error(`Island handler for "${Z}" does not export a valid hydration function`);return}await K($,Q),$.setAttribute("data-hydrated","true")}catch(X){console.error(`Failed to hydrate island "${Z}":`,X)}}function jS($){if(!DQ)return;let Z=document.querySelectorAll("[data-island]"),Y=[];if(Z.forEach((X)=>{let J=X.getAttribute("data-island"),Q=X.getAttribute("data-priority")||"lazy";if(!J||!$[J]||X.getAttribute("data-hydrated")==="true")return;if(Q==="eager")EQ(X,J,$[J]);else Y.push([X,J])}),Y.length>0&&"IntersectionObserver"in window){let X=new IntersectionObserver((J)=>{J.forEach((Q)=>{if(Q.isIntersecting){let G=Q.target,K=G.getAttribute("data-island");if(K&&$[K]&&G.getAttribute("data-hydrated")!=="true")EQ(G,K,$[K]),X.unobserve(G)}})},{rootMargin:"200px",threshold:0});Y.forEach(([J])=>{X.observe(J)})}else setTimeout(()=>{Y.forEach(([X,J])=>{if(X.getAttribute("data-hydrated")!=="true")EQ(X,J,$[J])})},1000)}function HS($){if(!DQ)return;Object.entries($).forEach(([Z,Y])=>{try{let J=Y.toString().match(/import\(['"](.+)['"]\)/);if(J&&J[1]){let Q=document.createElement("link");Q.rel="modulepreload",Q.href=J[1],Q.setAttribute("data-island-module",Z),document.head.appendChild(Q)}}catch(X){console.warn(`Failed to preload island handler for "${Z}":`,X)}})}var DQ;var qO=D(()=>{DQ=typeof window<"u"&&typeof document<"u"});function jO($){if(!t7)return null;let Z=document.getElementById("stx-loading-indicator");if(Z)Z.remove();let Y=document.createElement("div");Y.id="stx-loading-indicator";let X=$.initialColor?`linear-gradient(to right, ${$.initialColor}, ${$.color})`:$.color;Y.style.cssText=`
@@ -15239,7 +15239,7 @@ else {
15239
15239
  }
15240
15240
  }
15241
15241
  </style>
15242
- `}var CQ=null;var MO=()=>{};import TO from"path";class IO{store=new Map;async get($){let Z=this.store.get($);if(!Z||Z.expires<=Date.now()){if(Z)this.store.delete($);return null}return{...Z.data}}async set($,Z,Y){this.store.set($,{data:{...Z},expires:Date.now()+Y*1000})}async delete($){this.store.delete($)}}async function SS($,Z={},Y={}){let X=Y.viewsDir||"./views",J=Y.layoutsDir||"./layouts",Q=!$.includes("<")&&!$.includes("@"),G,K;if(Q){if(K=TO.resolve(X,$),!K.endsWith(".stx"))K+=".stx";if(!await Bun.file(K).exists())return new Response(`Template not found: ${$}`,{status:500});G=await Bun.file(K).text()}else G=$,K="inline-template.stx";let W={...Z,props:Z,__filename:K,__dirname:TO.dirname(K)};if(Y.ctx)W.csrf_token=Y.ctx.csrfToken,W.csrf_field=`<input type="hidden" name="_token" value="${Y.ctx.csrfToken}">`,W.old=Y.ctx.old,W.errors=Y.ctx.errors,W.session=Y.ctx.session,W.user=Y.ctx.user(),W.isAuthenticated=Y.ctx.isAuthenticated();let U=G.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(U){let j=U[1];G=G.replace(/<script\s+server\b[^>]*>[\s\S]*?<\/script>/gi,""),await D0(j,W,K)}let B={layoutsDir:J,...Y.stxOptions},z=await X0(G,W,K,B,new Set),q=new Headers({"Content-Type":"text/html; charset=utf-8"});if(Y.ctx)Y.ctx.responseHeaders.forEach((j,H)=>{q.set(H,j)});return new Response(z,{headers:q})}var EO=D(()=>{j1();F1();N0()});function bS($,Z){l6.stores.set($,Z)}function PQ($){return l6.stores.get($)}function kO($){return l6.stores.has($)}function SO(){return Array.from(l6.stores.keys())}function DO($){if($==="memory")return{getItem:(Z)=>$4.get(Z)??null,setItem:(Z,Y)=>$4.set(Z,Y),removeItem:(Z)=>$4.delete(Z)};if(typeof window>"u")return{getItem:(Z)=>$4.get(Z)??null,setItem:(Z,Y)=>$4.set(Z,Y),removeItem:(Z)=>$4.delete(Z)};return $==="local"?window.localStorage:window.sessionStorage}function CS($,Z){let Y={};for(let X of Z){let J=X.split("."),Q=$,G=Y,K=!0;for(let W=0;W<J.length-1;W++){let U=J[W];if(Q&&typeof Q==="object"&&U in Q){if(Q=Q[U],!(U in G))G[U]={};G=G[U]}else{K=!1;break}}if(K&&Q&&typeof Q==="object"){let W=J[J.length-1];if(W in Q)G[W]=Q[W]}}return Y}function xQ($,Z={}){let{name:Y,persist:X,devtools:J=!1,middleware:Q=[],equals:G=(O,F)=>O===F}=Z,K=$,W=new Set,U=null;if(X){let O=DO(X.storage||"local"),F=X.key||`stx-store:${Y||"unnamed"}`,L=X.deserialize||JSON.parse;try{let V=O.getItem(F);if(V){let N=L(V);if(X.paths&&typeof N==="object"&&N!==null)K={...$,...N};else K=N}}catch{}}let B=(O)=>{if(!X)return;let F=DO(X.storage||"local"),L=X.key||`stx-store:${Y||"unnamed"}`,V=X.serialize||JSON.stringify,N=X.paths&&typeof O==="object"&&O!==null?CS(O,X.paths):O;if(X.debounce){if(U)clearTimeout(U);U=setTimeout(()=>{F.setItem(L,V(N))},X.debounce)}else F.setItem(L,V(N))},_=(O,F)=>{for(let L of W)try{L(O,F)}catch(V){console.error("[stx-store] Subscriber error:",V)}},z=J?(O,F)=>{if(typeof window<"u"&&window.__STX_DEVTOOLS__)window.__STX_DEVTOOLS__.onStoreChange(Y||"unnamed",O,F)}:()=>{},q=(O)=>{let F=K;if(!G(O,F))K=O,B(O),_(O,F),z("set",O)},j=q,H={get:()=>K,set:(O)=>{if(typeof O==="function")j(O(K));else j(O)},subscribe:(O)=>{return W.add(O),()=>{W.delete(O)}},update:(O)=>{if(typeof K!=="object"||K===null)throw Error("update() can only be used with object stores");let F=typeof O==="function"?O(K):O;H.set({...K,...F})},reset:()=>{H.set($),z("reset",$)},name:Y,destroy:()=>{if(W.clear(),U)clearTimeout(U);if(Y)l6.stores.delete(Y)}};for(let O of Q.reverse())j=O(q,()=>K,H)(j);if(Y)bS(Y,H);return H}function bO($){let Z=typeof $==="string"?PQ($):$;if(!Z)throw Error(`Store "${$}" not found`);return Z.get()}function CO($,Z,Y){if(typeof Z==="function"){if(typeof window<"u"&&window.stx?.defineStore)return window.stx.defineStore($,Z,Y);return Z()}let X=Z,{state:J,getters:Q={},actions:G={},persist:K,devtools:W=!0}=X,U=typeof J==="function"?J():J,B=K===!0?{storage:"local",key:`stx-store:${$}`}:K||void 0,_=xQ(U,{name:$,persist:B,devtools:W}),z=new Proxy({},{get(q,j){let H=String(j);if(H==="$state")return _.get();if(H==="$subscribe")return _.subscribe;if(H==="$reset")return _.reset;if(H==="$patch")return(F)=>{if(typeof F==="function"){let V={..._.get()};F(V),_.set(V)}else _.update(F)};if(H==="_store")return _;if(H==="$id")return $;if(H in Q)return Q[H](_.get());if(H in G)return(...F)=>{return G[H].apply(z,F)};let O=_.get();if(O&&typeof O==="object"&&H in O)return O[H];return},set(q,j,H){let O=String(j);if(O.startsWith("$")||O==="_store")return!1;let F=_.get();if(F&&typeof F==="object")return _.set({...F,[O]:H}),!0;return!1},has(q,j){let H=String(j),O=_.get();return H.startsWith("$")||H==="_store"||H in Q||H in G||O&&typeof O==="object"&&H in O},ownKeys(){let q=_.get();return[...q&&typeof q==="object"?Object.keys(q):[],...Object.keys(Q),...Object.keys(G),"$state","$subscribe","$reset","$patch","$id"]},getOwnPropertyDescriptor(q,j){return{enumerable:!0,configurable:!0,get:()=>this.get(q,j,z)}}});return yS.set($,z),z}var l6,$4,yS;var yO=D(()=>{l6={stores:new Map,subscriptions:new Map};$4=new Map;yS=new Map});function A0($,Z={}){let Y=[];for(let[J,Q]of Object.entries(Z)){if(Q===void 0||Q===null)continue;if(Array.isArray(Q))Y.push(`${J}=${encodeURIComponent(Q.join(","))}`);else if(typeof Q==="boolean"){if(Q)Y.push(`${J}=true`)}else Y.push(`${J}=${encodeURIComponent(String(Q))}`)}if(Y.length===0)return $;let X=$.includes("?")?"&":"?";return`${$}${X}${Y.join("&")}`}function vQ($){let Z=$.indexOf("?");if(Z===-1)return{src:$,params:{}};let Y=$.slice(0,Z),X=$.slice(Z+1),J={};for(let Q of X.split("&")){let[G,K]=Q.split("="),W=K?decodeURIComponent(K):"";if(W==="true")J[G]=!0;else if(W==="false")J[G]=!1;else if(/^-?\d+$/.test(W))J[G]=Number.parseInt(W,10);else if(/^-?\d+\.\d+$/.test(W))J[G]=Number.parseFloat(W);else if(W.includes(","))J[G]=W.split(",");else J[G]=W}return{src:Y,params:J}}function oZ(...$){let Z={};for(let Y of $)if(Y)Object.assign(Z,Y);return Z}function fQ($,Z,Y,X){let J={w:Z};if(Y)J.h=Y;if(X)J.fit=X;return A0($,J)}function gQ($,Z,Y,X="center"){return A0($,{w:Z,h:Y,fit:"crop",crop:X})}function hQ($,Z,Y="center"){return A0($,{w:Z,h:Z,fit:"crop",crop:Y})}function dQ($,Z,Y){return A0($,{w:Z,h:Y,fit:"max"})}function uQ($,Z,Y){return A0($,{w:Z,h:Y,fit:"crop"})}function mQ($,Z){return A0($,{blur:Math.min(2000,Math.max(0,Z))})}function pQ($,Z){return A0($,{sharp:Math.min(100,Math.max(0,Z))})}function cQ($){return A0($,{sat:-100})}function lQ($,Z=100){return A0($,{sepia:Math.min(100,Math.max(0,Z))})}function iQ($){return A0($,{invert:!0})}function nQ($,Z){return A0($,{bri:Math.min(100,Math.max(-100,Z))})}function sQ($,Z){return A0($,{con:Math.min(100,Math.max(-100,Z))})}function rQ($,Z){return A0($,{sat:Math.min(100,Math.max(-100,Z))})}function oQ($,Z){return A0($,{rot:(Z%360+360)%360})}function aQ($){return A0($,{flip:"h"})}function tQ($){return A0($,{flip:"v"})}function eQ($,Z,Y){let X={fm:Z};if(Y!==void 0)X.q=Y;return A0($,X)}function $G($,Z){return A0($,{q:Math.min(100,Math.max(1,Z))})}function ZG($,Z=["format","compress"]){return A0($,{auto:Z})}function YG($,Z,Y={}){return A0($,{mark:Z,markx:Y.x,marky:Y.y,markalpha:Y.alpha,markscale:Y.scale,markalign:Y.align})}function XG($,Z,Y){return A0($,oZ(aZ[Z],Y))}function JG($,Z,Y){return Z.map((X)=>A0($,{...Y,w:X}))}function QG($,Z,Y=[1,2,3],X){return Y.map((J)=>A0($,{...X,w:Math.round(Z*J),dpr:J}))}function GG($){let Z=[];if($.w!==void 0&&($.w<1||$.w>16383))Z.push("Width must be between 1 and 16383");if($.h!==void 0&&($.h<1||$.h>16383))Z.push("Height must be between 1 and 16383");if($.q!==void 0&&($.q<1||$.q>100))Z.push("Quality must be between 1 and 100");if($.blur!==void 0&&($.blur<0||$.blur>2000))Z.push("Blur must be between 0 and 2000");if($.rot!==void 0&&($.rot<0||$.rot>359))Z.push("Rotation must be between 0 and 359");if($.dpr!==void 0&&($.dpr<1||$.dpr>5))Z.push("DPR must be between 1 and 5");return{valid:Z.length===0,errors:Z}}function KG($){let Z={...$};if(Z.w!==void 0)Z.w=Math.min(16383,Math.max(1,Z.w));if(Z.h!==void 0)Z.h=Math.min(16383,Math.max(1,Z.h));if(Z.q!==void 0)Z.q=Math.min(100,Math.max(1,Z.q));if(Z.blur!==void 0)Z.blur=Math.min(2000,Math.max(0,Z.blur));if(Z.rot!==void 0)Z.rot=(Z.rot%360+360)%360;if(Z.dpr!==void 0)Z.dpr=Math.min(5,Math.max(1,Z.dpr));return Z}var aZ;var PO=D(()=>{aZ={web:{fm:"webp",q:80,auto:["format","compress"]},highQuality:{q:95},thumb:{w:150,h:150,fit:"crop",crop:"center"},avatar:{w:200,h:200,fit:"crop",crop:"faces"},social:{w:1200,h:630,fit:"crop"},preview:{w:400,q:70},placeholder:{w:20,blur:200,q:20}}});var xO=D(()=>{TX();EX();h3();BX();PO()});function WG($){let{endpoint:Z,accept:Y,maxSize:X,maxFiles:J=1,fieldName:Q="file",preview:G=!1,dropzone:K=!0,multiple:W=!1,autoUpload:U=!0,showProgress:B=!0,disabled:_=!1,placeholder:z="Drop files here or click to select",label:q}=$,j=$.class||"",H=$.style||"",O=$.id||`stx-upload-${Math.random().toString(36).slice(2,8)}`,F=Array.isArray(Y)?Y.join(","):Y,L=`
15242
+ `}var CQ=null;var MO=()=>{};import TO from"path";class IO{store=new Map;async get($){let Z=this.store.get($);if(!Z||Z.expires<=Date.now()){if(Z)this.store.delete($);return null}return{...Z.data}}async set($,Z,Y){this.store.set($,{data:{...Z},expires:Date.now()+Y*1000})}async delete($){this.store.delete($)}}async function SS($,Z={},Y={}){let X=Y.viewsDir||"./views",J=Y.layoutsDir||"./layouts",Q=!$.includes("<")&&!$.includes("@"),G,K;if(Q){if(K=TO.resolve(X,$),!K.endsWith(".stx"))K+=".stx";if(!await Bun.file(K).exists())return new Response(`Template not found: ${$}`,{status:500});G=await Bun.file(K).text()}else G=$,K="inline-template.stx";let W={...Z,props:Z,__filename:K,__dirname:TO.dirname(K)};if(Y.ctx)W.csrf_token=Y.ctx.csrfToken,W.csrf_field=`<input type="hidden" name="_token" value="${Y.ctx.csrfToken}">`,W.old=Y.ctx.old,W.errors=Y.ctx.errors,W.session=Y.ctx.session,W.user=Y.ctx.user(),W.isAuthenticated=Y.ctx.isAuthenticated();let U=G.match(/<script\s+server\b[^>]*>([\s\S]*?)<\/script>/i);if(U){let j=U[1];G=G.replace(/<script\s+server\b[^>]*>[\s\S]*?<\/script>/gi,""),await D0(j,W,K)}let B={layoutsDir:J,...Y.stxOptions},z=await X0(G,W,K,B,new Set),q=new Headers({"Content-Type":"text/html; charset=utf-8"});if(Y.ctx)Y.ctx.responseHeaders.forEach((j,H)=>{q.set(H,j)});return new Response(z,{headers:q})}var EO=D(()=>{j1();F1();A0()});function bS($,Z){l6.stores.set($,Z)}function PQ($){return l6.stores.get($)}function kO($){return l6.stores.has($)}function SO(){return Array.from(l6.stores.keys())}function DO($){if($==="memory")return{getItem:(Z)=>$4.get(Z)??null,setItem:(Z,Y)=>$4.set(Z,Y),removeItem:(Z)=>$4.delete(Z)};if(typeof window>"u")return{getItem:(Z)=>$4.get(Z)??null,setItem:(Z,Y)=>$4.set(Z,Y),removeItem:(Z)=>$4.delete(Z)};return $==="local"?window.localStorage:window.sessionStorage}function CS($,Z){let Y={};for(let X of Z){let J=X.split("."),Q=$,G=Y,K=!0;for(let W=0;W<J.length-1;W++){let U=J[W];if(Q&&typeof Q==="object"&&U in Q){if(Q=Q[U],!(U in G))G[U]={};G=G[U]}else{K=!1;break}}if(K&&Q&&typeof Q==="object"){let W=J[J.length-1];if(W in Q)G[W]=Q[W]}}return Y}function xQ($,Z={}){let{name:Y,persist:X,devtools:J=!1,middleware:Q=[],equals:G=(O,F)=>O===F}=Z,K=$,W=new Set,U=null;if(X){let O=DO(X.storage||"local"),F=X.key||`stx-store:${Y||"unnamed"}`,L=X.deserialize||JSON.parse;try{let V=O.getItem(F);if(V){let N=L(V);if(X.paths&&typeof N==="object"&&N!==null)K={...$,...N};else K=N}}catch{}}let B=(O)=>{if(!X)return;let F=DO(X.storage||"local"),L=X.key||`stx-store:${Y||"unnamed"}`,V=X.serialize||JSON.stringify,N=X.paths&&typeof O==="object"&&O!==null?CS(O,X.paths):O;if(X.debounce){if(U)clearTimeout(U);U=setTimeout(()=>{F.setItem(L,V(N))},X.debounce)}else F.setItem(L,V(N))},_=(O,F)=>{for(let L of W)try{L(O,F)}catch(V){console.error("[stx-store] Subscriber error:",V)}},z=J?(O,F)=>{if(typeof window<"u"&&window.__STX_DEVTOOLS__)window.__STX_DEVTOOLS__.onStoreChange(Y||"unnamed",O,F)}:()=>{},q=(O)=>{let F=K;if(!G(O,F))K=O,B(O),_(O,F),z("set",O)},j=q,H={get:()=>K,set:(O)=>{if(typeof O==="function")j(O(K));else j(O)},subscribe:(O)=>{return W.add(O),()=>{W.delete(O)}},update:(O)=>{if(typeof K!=="object"||K===null)throw Error("update() can only be used with object stores");let F=typeof O==="function"?O(K):O;H.set({...K,...F})},reset:()=>{H.set($),z("reset",$)},name:Y,destroy:()=>{if(W.clear(),U)clearTimeout(U);if(Y)l6.stores.delete(Y)}};for(let O of Q.reverse())j=O(q,()=>K,H)(j);if(Y)bS(Y,H);return H}function bO($){let Z=typeof $==="string"?PQ($):$;if(!Z)throw Error(`Store "${$}" not found`);return Z.get()}function CO($,Z,Y){if(typeof Z==="function"){if(typeof window<"u"&&window.stx?.defineStore)return window.stx.defineStore($,Z,Y);return Z()}let X=Z,{state:J,getters:Q={},actions:G={},persist:K,devtools:W=!0}=X,U=typeof J==="function"?J():J,B=K===!0?{storage:"local",key:`stx-store:${$}`}:K||void 0,_=xQ(U,{name:$,persist:B,devtools:W}),z=new Proxy({},{get(q,j){let H=String(j);if(H==="$state")return _.get();if(H==="$subscribe")return _.subscribe;if(H==="$reset")return _.reset;if(H==="$patch")return(F)=>{if(typeof F==="function"){let V={..._.get()};F(V),_.set(V)}else _.update(F)};if(H==="_store")return _;if(H==="$id")return $;if(H in Q)return Q[H](_.get());if(H in G)return(...F)=>{return G[H].apply(z,F)};let O=_.get();if(O&&typeof O==="object"&&H in O)return O[H];return},set(q,j,H){let O=String(j);if(O.startsWith("$")||O==="_store")return!1;let F=_.get();if(F&&typeof F==="object")return _.set({...F,[O]:H}),!0;return!1},has(q,j){let H=String(j),O=_.get();return H.startsWith("$")||H==="_store"||H in Q||H in G||O&&typeof O==="object"&&H in O},ownKeys(){let q=_.get();return[...q&&typeof q==="object"?Object.keys(q):[],...Object.keys(Q),...Object.keys(G),"$state","$subscribe","$reset","$patch","$id"]},getOwnPropertyDescriptor(q,j){return{enumerable:!0,configurable:!0,get:()=>this.get(q,j,z)}}});return yS.set($,z),z}var l6,$4,yS;var yO=D(()=>{l6={stores:new Map,subscriptions:new Map};$4=new Map;yS=new Map});function w0($,Z={}){let Y=[];for(let[J,Q]of Object.entries(Z)){if(Q===void 0||Q===null)continue;if(Array.isArray(Q))Y.push(`${J}=${encodeURIComponent(Q.join(","))}`);else if(typeof Q==="boolean"){if(Q)Y.push(`${J}=true`)}else Y.push(`${J}=${encodeURIComponent(String(Q))}`)}if(Y.length===0)return $;let X=$.includes("?")?"&":"?";return`${$}${X}${Y.join("&")}`}function vQ($){let Z=$.indexOf("?");if(Z===-1)return{src:$,params:{}};let Y=$.slice(0,Z),X=$.slice(Z+1),J={};for(let Q of X.split("&")){let[G,K]=Q.split("="),W=K?decodeURIComponent(K):"";if(W==="true")J[G]=!0;else if(W==="false")J[G]=!1;else if(/^-?\d+$/.test(W))J[G]=Number.parseInt(W,10);else if(/^-?\d+\.\d+$/.test(W))J[G]=Number.parseFloat(W);else if(W.includes(","))J[G]=W.split(",");else J[G]=W}return{src:Y,params:J}}function oZ(...$){let Z={};for(let Y of $)if(Y)Object.assign(Z,Y);return Z}function fQ($,Z,Y,X){let J={w:Z};if(Y)J.h=Y;if(X)J.fit=X;return w0($,J)}function gQ($,Z,Y,X="center"){return w0($,{w:Z,h:Y,fit:"crop",crop:X})}function hQ($,Z,Y="center"){return w0($,{w:Z,h:Z,fit:"crop",crop:Y})}function dQ($,Z,Y){return w0($,{w:Z,h:Y,fit:"max"})}function uQ($,Z,Y){return w0($,{w:Z,h:Y,fit:"crop"})}function mQ($,Z){return w0($,{blur:Math.min(2000,Math.max(0,Z))})}function pQ($,Z){return w0($,{sharp:Math.min(100,Math.max(0,Z))})}function cQ($){return w0($,{sat:-100})}function lQ($,Z=100){return w0($,{sepia:Math.min(100,Math.max(0,Z))})}function iQ($){return w0($,{invert:!0})}function nQ($,Z){return w0($,{bri:Math.min(100,Math.max(-100,Z))})}function sQ($,Z){return w0($,{con:Math.min(100,Math.max(-100,Z))})}function rQ($,Z){return w0($,{sat:Math.min(100,Math.max(-100,Z))})}function oQ($,Z){return w0($,{rot:(Z%360+360)%360})}function aQ($){return w0($,{flip:"h"})}function tQ($){return w0($,{flip:"v"})}function eQ($,Z,Y){let X={fm:Z};if(Y!==void 0)X.q=Y;return w0($,X)}function $G($,Z){return w0($,{q:Math.min(100,Math.max(1,Z))})}function ZG($,Z=["format","compress"]){return w0($,{auto:Z})}function YG($,Z,Y={}){return w0($,{mark:Z,markx:Y.x,marky:Y.y,markalpha:Y.alpha,markscale:Y.scale,markalign:Y.align})}function XG($,Z,Y){return w0($,oZ(aZ[Z],Y))}function JG($,Z,Y){return Z.map((X)=>w0($,{...Y,w:X}))}function QG($,Z,Y=[1,2,3],X){return Y.map((J)=>w0($,{...X,w:Math.round(Z*J),dpr:J}))}function GG($){let Z=[];if($.w!==void 0&&($.w<1||$.w>16383))Z.push("Width must be between 1 and 16383");if($.h!==void 0&&($.h<1||$.h>16383))Z.push("Height must be between 1 and 16383");if($.q!==void 0&&($.q<1||$.q>100))Z.push("Quality must be between 1 and 100");if($.blur!==void 0&&($.blur<0||$.blur>2000))Z.push("Blur must be between 0 and 2000");if($.rot!==void 0&&($.rot<0||$.rot>359))Z.push("Rotation must be between 0 and 359");if($.dpr!==void 0&&($.dpr<1||$.dpr>5))Z.push("DPR must be between 1 and 5");return{valid:Z.length===0,errors:Z}}function KG($){let Z={...$};if(Z.w!==void 0)Z.w=Math.min(16383,Math.max(1,Z.w));if(Z.h!==void 0)Z.h=Math.min(16383,Math.max(1,Z.h));if(Z.q!==void 0)Z.q=Math.min(100,Math.max(1,Z.q));if(Z.blur!==void 0)Z.blur=Math.min(2000,Math.max(0,Z.blur));if(Z.rot!==void 0)Z.rot=(Z.rot%360+360)%360;if(Z.dpr!==void 0)Z.dpr=Math.min(5,Math.max(1,Z.dpr));return Z}var aZ;var PO=D(()=>{aZ={web:{fm:"webp",q:80,auto:["format","compress"]},highQuality:{q:95},thumb:{w:150,h:150,fit:"crop",crop:"center"},avatar:{w:200,h:200,fit:"crop",crop:"faces"},social:{w:1200,h:630,fit:"crop"},preview:{w:400,q:70},placeholder:{w:20,blur:200,q:20}}});var xO=D(()=>{TX();EX();h3();BX();PO()});function WG($){let{endpoint:Z,accept:Y,maxSize:X,maxFiles:J=1,fieldName:Q="file",preview:G=!1,dropzone:K=!0,multiple:W=!1,autoUpload:U=!0,showProgress:B=!0,disabled:_=!1,placeholder:z="Drop files here or click to select",label:q}=$,j=$.class||"",H=$.style||"",O=$.id||`stx-upload-${Math.random().toString(36).slice(2,8)}`,F=Array.isArray(Y)?Y.join(","):Y,L=`
15243
15243
  <div id="${O}" class="stx-upload${K?" stx-upload-dropzone":""}${_?" stx-upload-disabled":""}${j?" "+j:""}"${H?` style="${H}"`:""}>
15244
15244
  ${q?`<label class="stx-upload-label">${vO(q)}</label>`:""}
15245
15245
  <div class="stx-upload-area" data-stx-upload-area>
@@ -16271,7 +16271,7 @@ ${Q}`}var J4=null;function X3($,Z){if(Z.theme===!1)return $;let Y=typeof Z.theme
16271
16271
  ${J.slice(K)}`;return`${$.slice(0,X)}${_}${$.slice(Y)}`}function mb($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function rG($){return $}var gL=D(()=>{m1();lG()});var hL=D(()=>{gL();lG()});function lb($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function ib($){let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function nb($,Z){for(let[Y,X]of $)if(Z>=Y&&Z<X)return!0;return!1}function U3($,Z){let Y=1,X=0;for(let J=0;J<Z&&J<$.length;J++)if($[J]===`
16272
16272
  `)Y++,X=J+1;return{line:Y,column:Z-X+1}}function sb($,Z,Y){let X=Z.toLowerCase(),J=$.length,Q=1,G=Y;while(G<J){let K=$.indexOf("<",G);if(K===-1)return-1;if(G=K,$.startsWith("<!--",G)){let B=$.indexOf("-->",G+4);if(B===-1)return-1;G=B+3;continue}if($[G+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(G,G+64));if(!B){G++;continue}if(B[1].toLowerCase()===X){if(Q--,G+=B[0].length,Q===0)return G;continue}G+=B[0].length;continue}let W=/^<([a-z][\w-]*)\b/i.exec($.slice(G,G+64));if(!W){G++;continue}let U=$.indexOf(">",G);if(U===-1)return-1;if(W[1].toLowerCase()===X&&$[U-1]!=="/")Q++;G=U+1}return-1}function rb($,Z,Y){let X=/@([a-z][\w:-]*)((?:\.[a-z][\w-]*)*)\s*=\s*"([^"]*)"/gi,J;while((J=X.exec($))!==null){if(nb(Z,J.index))continue;let Q=J[1].toLowerCase().split(":")[0];if(pb.has(Q))continue;let G=J[3].trim();if(/^[A-Za-z_$][\w$]*(?:\.[A-Za-z_$][\w$]*)*$/.test(G)){let K=$.indexOf(J[3],J.index),{line:W,column:U}=U3($,K<0?J.index:K);Y.push({ruleId:"stx/no-bare-function-ref-in-event",message:`Event handler @${J[1]}="${G}" is a bare reference and will not fire. Call it: @${J[1]}="${G}()".`,line:W,column:U,severity:"error"})}}}function ob($,Z,Y){if(Z!=="view")return;let X=/<script\b([^>]*)>/gi,J;while((J=X.exec($))!==null)if(/(?:^|\s)client(?=[\s/=]|$)/i.test(J[1])){let{line:Q,column:G}=U3($,J.index);Y.push({ruleId:"stx/no-view-level-script-client",message:"<script client> at the top level of a view is silently dropped \u2014 only components get client scopes. Move it into a component, or use <script> (server).",line:Q,column:G,severity:"error"})}}function dL($){let Z=$.split("/"),Y=[];for(let X of Z){if(X===""||X===".")continue;if(X==="..")Y.pop();else Y.push(X)}return Y.join("/")}function ab($,Z,Y){let X=Z.replace(/\\/g,"/"),J=X.indexOf("resources/stores/");if(J===-1)return;let Q=X.slice(0,J+16),G=X.slice(0,X.lastIndexOf("/")),K=/\b(import|export)\s+(type\s+)?([^'"]*?)\s*from\s*['"]([^'"]+)['"]/g,W;while((W=K.exec($))!==null){if(W[2])continue;let U=W[1],B=W[4],_;if(B.startsWith("."))_=!dL(`${G}/${B}`).startsWith(dL(Q));else _=!0;if(_){let{line:z,column:q}=U3($,W.index),j=U==="export"?"Value re-export":"Value import";Y.push({ruleId:"stx/store-value-imports-must-be-local",message:`${j} from "${B}" is outside resources/stores/ and will be stripped from the store bundle. Use \`${U} type\`, or move the value into the stores dir.`,line:z,column:q,severity:"error"})}}}function tb($){let Z=$.trim(),Y=(G)=>{let K=G.match(/[A-Za-z_$][\w$]*/g);return K?K:[]},X=/\bas\s+(.+)$/.exec(Z);if(X){let G=X[1].trim(),K=/^([A-Za-z_$][\w$]*)\s*=>\s*([A-Za-z_$][\w$]*)/.exec(G);if(K)return[K[1],K[2]];let W=/^\(([^)]*)\)/.exec(G);if(W)return Y(W[1]);let U=/^([A-Za-z_$][\w$]*)/.exec(G);return U?[U[1]]:[]}let J=/^\(([^)]*)\)\s+(?:in|of)\s+/.exec(Z);if(J)return Y(J[1]);let Q=/^([A-Za-z_$][\w$]*)\s+(?:in|of)\s+/.exec(Z);return Q?[Q[1]]:[]}function eb($,Z){let Y=/(?::for|x-for|@for)\s*=\s*"([^"]*)"/gi,X;while((X=Y.exec($))!==null){let J=tb(X[1]);if(J.length===0)continue;let Q=$.lastIndexOf("<",X.index);if(Q===-1)continue;let G=/^<([a-z][\w-]*)/i.exec($.slice(Q,Q+64));if(!G)continue;let K=$.indexOf(">",X.index);if(K===-1)continue;let U=$[K-1]==="/"||cb.has(G[1].toLowerCase())?K+1:sb($,G[1],K+1),B=U===-1?K+1:U,_=$.indexOf(X[1],X.index),z=$.slice(Q,B);if(_>=0&&_+X[1].length<=B){let q=_-Q;z=z.slice(0,q)+" ".repeat(X[1].length)+z.slice(q+X[1].length)}for(let q of J){let j=new RegExp(`(?<![.\\w$])${lb(q)}\\s*\\(`,"g"),H;while((H=j.exec(z))!==null){let O=Q+H.index,{line:F,column:L}=U3($,O);Z.push({ruleId:"stx/no-signal-call-in-for-iteration-var",message:`"${q}" is a :for iteration variable, not a signal \u2014 calling it as "${q}()" leaves it as a function and silently breaks comparisons. Use "${q}" directly.`,line:F,column:L,severity:"error"})}}}}function $C($,Z){let Y=/<!--([\s\S]*?)-->/g,X;while((X=Y.exec($))!==null){let Q=X[1].indexOf("`");if(Q!==-1){let G=X.index+4+Q,{line:K,column:W}=U3($,G);Z.push({ruleId:"stx/no-backticks-in-html-comments",message:"Backtick inside an HTML comment leaks into the merged setup function and flips the JS parser into template-literal mode. Remove it or rephrase the comment.",line:K,column:W,severity:"error"})}}}function W3($,Z){return $?.[Z]!==!1}function uL($,Z={}){let Y=[],X=ib($),J=(Z.filePath??"").replace(/\\/g,"/"),Q=Z.fileKind??(/\/components?\//i.test(J)?"component":"view");if(W3(Z.rules,"stx/no-bare-function-ref-in-event"))rb($,X,Y);if(W3(Z.rules,"stx/no-view-level-script-client"))ob($,Q,Y);if(J&&W3(Z.rules,"stx/store-value-imports-must-be-local"))ab($,J,Y);if(W3(Z.rules,"stx/no-signal-call-in-for-iteration-var"))eb($,Y);if(W3(Z.rules,"stx/no-backticks-in-html-comments"))$C($,Y);Y.sort((K,W)=>K.line-W.line||K.column-W.column);let G=new Set;return Y.filter((K)=>{let W=`${K.ruleId}:${K.line}:${K.column}`;if(G.has(W))return!1;return G.add(W),!0})}var pb,cb;var mL=D(()=>{pb=new Set(["if","else","elseif","else-if","for","foreach","show","model","html","text","bind","key","ref","once","memo","slot","teleport","cloak","pre","effect","init"]),cb=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function pL($,Z){return $.kind===Z}var cL=()=>{};var lL=D(()=>{cL()});function iL($){if($===String)return"string";if($===Number)return"number";if($===Boolean)return"boolean";if($===Array)return"array";if($===Object)return"object";if($===Function)return"function";if($===Date)return"date";if($===Symbol)return"symbol";if(typeof $==="function"&&$.name)return $.name;return"unknown"}function ZC($,Z){if($===null||$===void 0)return!0;if(Z===String)return typeof $==="string";if(Z===Number)return typeof $==="number"&&!Number.isNaN($);if(Z===Boolean)return typeof $==="boolean";if(Z===Array)return Array.isArray($);if(Z===Object)return typeof $==="object"&&!Array.isArray($);if(Z===Function)return typeof $==="function";if(Z===Date)return $ instanceof Date;if(Z===Symbol)return typeof $==="symbol";if(typeof Z==="function")return $ instanceof Z;return!0}function nL($,Z,Y,X){let J=X?`[${X}]`:"";if(Y.required&&(Z===void 0||Z===null))return{prop:$,message:`${J} Missing required prop: "${$}"`,value:Z,expected:Y.type?iL(Y.type):void 0};if(Z===void 0||Z===null)return null;if(Y.type){let Q=Array.isArray(Y.type)?Y.type:[Y.type];if(!Q.some((K)=>ZC(Z,K))){let K=Q.map((W)=>iL(W)).join(" | ");return{prop:$,message:`${J} Invalid prop type for "${$}": expected ${K}, got ${typeof Z}`,value:Z,expected:K}}}if(Y.validator){if(!Y.validator(Z))return{prop:$,message:`${J} Custom validation failed for prop "${$}"`,value:Z}}return null}function sL($){let Z=globalThis.__STX_CURRENT_PROPS__||{};if(!$)return Z;let Y={...Z};for(let[X,J]of Object.entries($)){let Q=typeof J==="function"||Array.isArray(J)?{type:J}:J||{};if(Y[X]===void 0&&Q.default!==void 0)Y[X]=typeof Q.default==="function"?Q.default():Q.default}return Y}function rL($,Z={}){let{componentName:Y,throwOnError:X=!1,logWarnings:J=!0}=Z,Q=globalThis.__STX_CURRENT_PROPS__||{},G={...Q},K={valid:!0,errors:[],warnings:[]};for(let[W,U]of Object.entries($)){let B=typeof U==="function"||Array.isArray(U)?{type:U}:U||{};if(G[W]===void 0&&B.default!==void 0)G[W]=typeof B.default==="function"?B.default():B.default;let _=nL(W,G[W],B,Y);if(_){if(K.valid=!1,K.errors.push(_),J)console.warn(_.message)}}for(let W of Object.keys(Q))if(!(W in $)){let U=`${Y?`[${Y}]`:""} Unknown prop: "${W}"`;if(K.warnings.push(U),J)console.warn(U)}if(X&&!K.valid){let W=K.errors.map((U)=>U.message).join(`
16273
16273
  `);throw Error(`Prop validation failed:
16274
- ${W}`)}return{props:G,validation:K}}function oL($,Z){let Y={...$};for(let[X,J]of Object.entries(Z))if(Y[X]===void 0)Y[X]=typeof J==="function"?J():J;return Y}function aL($){return $}function tL($){return{type:$,required:!0}}function eL($,Z){return{type:Z,default:$}}function $F($,Z={}){return{...Z,validator:$}}function ZF($,Z={}){return{...Z,validator:(Y)=>$.includes(Y)}}function YF($,Z={}){return{...Z,type:Array,validator:(Y)=>{if(!Array.isArray(Y))return!1;return!0}}}function XF($,Z={}){return{...Z,type:Object}}function JF($,Z,Y){if(!Z)return $;let X={};for(let[J,Q]of Object.entries(Z)){let G=typeof Q==="function"||Array.isArray(Q)?{type:Q}:Q||{},K=$[J];if(K===void 0&&G.default!==void 0)K=typeof G.default==="function"?G.default():G.default;{let W=nL(J,K,G,Y);if(W)console.warn(W.message)}X[J]=K}for(let[J,Q]of Object.entries($))if(!(J in X))X[J]=Q;return X}var I5={};Z0(I5,{writeNetlifyConfig:()=>MZ,writeManifest:()=>YQ,writeImageManifest:()=>oq,wrapComponentForHMR:()=>RS,withDefaults:()=>oL,webComponentDirectiveHandler:()=>iX,watermark:()=>YG,watchViews:()=>nS,watchMultiple:()=>EI,watchEffect:()=>DI,watch:()=>II,waitForStore:()=>rI,waitForLocale:()=>Vw,videoDirective:()=>v4,validators:()=>N3,validated:()=>$F,validateValueEnhanced:()=>pU,validateTemplate:()=>Wq,validateParams:()=>GG,validateFormEnhanced:()=>Ww,validateFile:()=>GY,validateFields:()=>Gw,validateField:()=>uU,validateDirective:()=>Bq,validateCspDirectives:()=>pA,validateConfig:()=>aW,validateComponentScripts:()=>sE,validateComponentProps:()=>tE,validateClientScript:()=>K6,usesSignalsInScript:()=>A5,userComponentFileExists:()=>E2,useVirtualList:()=>u2,useTitle:()=>bU,useStoreOrThrow:()=>sI,useStore:()=>bO,useSlots:()=>WL,useSeoMeta:()=>u4,useRouteParams:()=>Xj,useRouteParamOrThrow:()=>oI,useRouteParam:()=>Jj,usePageTitle:()=>bU,useOptimistic:()=>AB,useMiddlewareValue:()=>aI,useMiddlewareState:()=>Qj,useLoadingIndicator:()=>HO,useHead:()=>P$,useAttrs:()=>BL,uploadFiles:()=>bG,uploadFile:()=>KY,updateInstance:()=>vI,untrack:()=>p8,unregisterDirective:()=>AV,unmountInstance:()=>fI,unescapeHtml:()=>FZ,transpileTypeScript:()=>M$,translate:()=>qY,transitionDirective:()=>S3,toUsers:()=>rj,toUser:()=>sj,thumbnail:()=>hQ,thumbHashToRGBA:()=>o6,thumbHashToDataURL:()=>IG,templateCache:()=>sJ,stxClientHelpers:()=>zQ,structuredDataDirective:()=>J8,stripLocalePrefix:()=>cG,stripDocumentWrapper:()=>U$,stringToStream:()=>TD,strictCspPreset:()=>VU,streamingSuspenseDirective:()=>g2,streamToResponse:()=>u_,streamTemplateSimple:()=>f_,streamTemplate:()=>y_,stopHmrServer:()=>v5,stopBroadcasting:()=>ij,state:()=>o4,startProductionServer:()=>Hk,startInteractive:()=>Zk,startBroadcasting:()=>lj,staggerDirective:()=>sK,srcsetUrls:()=>JG,springDirective:()=>rK,splitByPipe:()=>A3,smartBatchSign:()=>UG,signUrl:()=>tZ,shouldTranspileTypeScript:()=>R$,shouldReloadOnChange:()=>K4,shouldRefreshSignature:()=>YY,shouldIgnoreFile:()=>W4,shouldCacheComponent:()=>Iz,sharpen:()=>pQ,shape:()=>XF,setRouteParams:()=>ZE,setMiddlewareState:()=>YE,setGlobalProvide:()=>BY,setErrorLocale:()=>JK,setCurrentInstance:()=>AI,setCachedVideoResult:()=>J7,setCachedImageResult:()=>Z7,setCached:()=>a5,serveStxFile:()=>HH,serveMultipleStxFiles:()=>BH,serveMarkdownFile:()=>iZ,serveFile:()=>QS,serveApp:()=>zH,serve:()=>UO,serializeState:()=>VO,sepia:()=>lQ,scrollAnimateDirective:()=>b3,screenReaderDirective:()=>D3,scopeHTML:()=>lW,scopeCSS:()=>cW,scanForSitemapEntries:()=>bN,scanA11yIssues:()=>tF,saturation:()=>rQ,sanitizeParams:()=>KG,sanitizeFilePath:()=>VK,sanitizeExpression:()=>NK,sanitizeDirectiveParams:()=>AK,sanitizeDirectiveParam:()=>j4,sanitizeComponentProps:()=>MY,safeExecuteAsync:()=>h1,safeExecute:()=>OK,runPreProcessingMiddleware:()=>vJ,runPostProcessingMiddleware:()=>fJ,runMiddleware:()=>E6,runHooks:()=>T5,runDoctor:()=>bL,rotate:()=>oQ,rewriteImagesWithSiblings:()=>Q9,resolveTemplatePath:()=>f4,resolveI18n:()=>J3,resize:()=>fQ,resetPlaceholders:()=>H9,resetHead:()=>kU,resetHMRHandler:()=>TS,resetErrorConfig:()=>_K,required:()=>tL,replacePlaceholders:()=>NZ,renderView:()=>vG,renderVideoComponent:()=>U7,renderVendorStyleTags:()=>CY,renderToString:()=>b5,renderToStream:()=>NL,renderToDOM:()=>Y4,renderThumbhashToCanvas:()=>TG,renderTemplate:()=>Wb,renderString:()=>Ub,renderStreamingPage:()=>P_,renderSlot:()=>B9,renderSSRSuspense:()=>Bz,renderProtectedVideo:()=>HG,renderProtectedImg:()=>jG,renderMediaUpload:()=>WG,renderImgComponent:()=>k$,renderImageComponent:()=>dq,renderHtmlAttrs:()=>yU,renderHead:()=>CU,renderEmail:()=>sS,renderComponentWithSlot:()=>c1,renderBodyAttrs:()=>PU,render:()=>SS,relaxedCspPreset:()=>NU,registerValidationRule:()=>Qw,registerStreamingDirectives:()=>h_,registerStore:()=>eI,registerSeoDirectives:()=>kN,registerMiddleware:()=>nI,registerFilters:()=>Tq,registerFilter:()=>L9,registerErrorMessages:()=>GK,registerEnhancedValidationRule:()=>Kw,registerDirective:()=>YW,registerCspDirectives:()=>mA,registerComponentDirectives:()=>ZD,registerAnimationDirectives:()=>HV,registerA11yDirectives:()=>ZV,ref:()=>MI,redirect:()=>yD,readMarkdownFile:()=>X$,readFileCached:()=>RB,reactive:()=>$j,quality:()=>$G,pruneSignatureCache:()=>zG,pruneCache:()=>zW,provide:()=>ZL,prop:()=>aL,processVueTemplate:()=>dJ,processVirtualListDirectives:()=>zZ,processVirtualGridDirectives:()=>p2,processVideo:()=>Z8,processValidateDirective:()=>mU,processTranslateDirective:()=>CJ,processTransitionDirectives:()=>Zz,processTransitionAttributes:()=>Jz,processTitleDirective:()=>fU,processTemplateBindings:()=>KJ,processTeleportDirectives:()=>n_,processSuspenseDirectives:()=>Wz,processStructuredData:()=>uX,processStreamDirectives:()=>x_,processStaticDirectives:()=>Y9,processStackReplacements:()=>OZ,processStackPushDirectives:()=>HZ,processSlots:()=>_9,processShell:()=>xZ,processServerBindings:()=>P8,processSeoDirective:()=>mX,processSectionDirectives:()=>d_,processScopedStyles:()=>n4,processReactiveBindings:()=>GU,processProtectedMedia:()=>OG,processPartialHydrationDirectives:()=>r2,processOnceDirective:()=>G6,processMiddleware:()=>xJ,processMetaDirectives:()=>dX,processMetaDirective:()=>gU,processMarkdownFileDirectives:()=>HJ,processMarkdownDirectives:()=>mY,processLoops:()=>C8,processKeepAliveDirectives:()=>Mz,processJsonDirective:()=>Q6,processInfiniteListDirectives:()=>m2,processIncludes:()=>LZ,processImgComponents:()=>RX,processImageComponents:()=>uq,processImage:()=>s1,processHeadDirective:()=>vU,processForms:()=>Jw,processFormInputDirectives:()=>T8,processExpressions:()=>U1,processEventDirectives:()=>zJ,processErrorDirective:()=>I8,processDynamicComponents:()=>mJ,processDirectives:()=>X0,processDirectiveAttributes:()=>IV,processDeferDirectives:()=>c_,processCustomDirectives:()=>RJ,processCspDirectives:()=>NJ,processComponentProps:()=>JF,processClientScript:()=>w$,processBasicFormDirectives:()=>F7,processAsyncDirectives:()=>Lz,processAnimationDirectives:()=>vY,processA11yDirectives:()=>PY,preloadTranslationsBackground:()=>Lw,preloadTranslations:()=>iU,preloadIslandHandlers:()=>HS,preloadIconCollection:()=>ZZ,poolStrings:()=>dj,pluginManager:()=>rX,performLeave:()=>$z,performEnter:()=>e_,peek:()=>Z6,partialsCache:()=>n$,parseVideoDirectiveOptions:()=>gW,parseUrl:()=>vQ,parseThumbhashString:()=>EG,parseSwitchBlock:()=>w3,parseSlots:()=>U9,parseSlotElement:()=>jq,parseScriptDeclarations:()=>SK,parseSFCComponent:()=>iW,parseProtectedArgs:()=>LG,parseImgComponent:()=>s3,parseImageUrl:()=>rY,parseImageComponent:()=>P9,parseExpressionWithFilters:()=>DK,parseCookies:()=>SD,parseConditionalBlock:()=>IY,parseArguments:()=>EY,parseAnimationShorthand:()=>qV,optional:()=>eL,optimizeTemplate:()=>uj,optimizeImage:()=>g9,optimizeDirectory:()=>rq,oneOf:()=>ZF,onceStore:()=>w9,onUpdated:()=>CI,onUnmounted:()=>PI,onServer:()=>JE,onMounted:()=>SI,onMount:()=>u8,onHydrated:()=>Z9,onErrorCaptured:()=>GL,onDestroy:()=>m8,onDeactivated:()=>Sz,onClient:()=>XE,onBeforeUpdate:()=>bI,onBeforeUnmount:()=>yI,onBeforeMount:()=>kI,onActivated:()=>kz,observeElement:()=>wG,notFound:()=>PD,nextTick:()=>QL,navigateTo:()=>iI,mountInstance:()=>xI,motionDirective:()=>y3,moderateCspPreset:()=>F8,minifyHtml:()=>hj,metaDirective:()=>X8,mergeParams:()=>oZ,mergeCspDirectives:()=>dA,matchRoute:()=>vZ,markdownDirectiveHandler:()=>pY,markdownCache:()=>L8,localizePath:()=>j$,loadTranslationLazy:()=>l4,loadTranslation:()=>sU,loadStxConfig:()=>v0,loadMiddlewareFromDirectory:()=>I6,loadManifest:()=>XQ,loadElement:()=>q$,loadChannels:()=>nj,lintStxStrict:()=>uL,lazyLoadAll:()=>NG,lazyLoad:()=>VG,keyframeDirective:()=>nK,jsxs:()=>LL,jsxDEV:()=>FL,jsx:()=>y5,jsonResponse:()=>CD,islandDirective:()=>h2,isTest:()=>B4,isSpaNavigation:()=>l9,isSignatureValid:()=>$Y,isSignal:()=>e4,isSharpAvailable:()=>V6,isServerEnvironment:()=>HD,isServer:()=>Gj,isProduction:()=>f5,isNativeLazySupported:()=>XY,isLoading:()=>Hw,isLoaded:()=>Ow,isJavaScriptScript:()=>Nq,isIntersectionObserverSupported:()=>JY,isImageFile:()=>N6,isImageBackendAvailable:()=>n1,isICUFormat:()=>aU,isHydrated:()=>$9,isHydrateTrigger:()=>Aq,isEdgeEnvironment:()=>jD,isDirectiveKind:()=>pL,isDevelopment:()=>F$,isDerived:()=>$6,isCssOnlyChange:()=>G4,isClient:()=>Kj,isAsyncComponent:()=>Vz,invert:()=>iQ,invalidateFileCacheByDir:()=>TB,invalidateFileCache:()=>MB,interpolateScriptsInTemplate:()=>Eq,interpolateScriptExpressions:()=>V9,inlineError:()=>J0,injectThemeBootstrap:()=>X3,injectSeoTags:()=>pX,injectSeo:()=>$3,injectRouterScript:()=>Q$,injectHotReload:()=>g1,injectHeatmap:()=>hY,injectCspMetaTag:()=>VJ,injectCrosswindCSS:()=>T0,injectConfigHeadTags:()=>iJ,injectCloakStyle:()=>lJ,injectAnalytics:()=>BJ,inject:()=>YL,initStoreRegistry:()=>tI,initNetlify:()=>aT,initLoadingIndicator:()=>VS,initLazyLoading:()=>FG,initFile:()=>sD,initBlurUp:()=>QY,initAllBlurUp:()=>kG,imgDirective:()=>P4,imageDirective:()=>cq,hydrateTemplateStream:()=>AQ,hydrateTemplate:()=>_k,hydrateIslands:()=>jS,hydrateIsland:()=>a2,hydrateFragment:()=>zk,hydrateByStrategy:()=>t2,hydrateAll:()=>e2,hydrate:()=>DS,htmlResponse:()=>JS,heatmapDirective:()=>dY,hashString:()=>u3,hashFilePath:()=>A7,hashFile:()=>c0,hashBuffer:()=>GW,hasVueTemplateSyntax:()=>OB,hasVariables:()=>x2,hasStore:()=>kO,hasPlaceholders:()=>y7,hasNetlifyConfig:()=>TZ,hasMiddleware:()=>lI,hasEventDirectives:()=>MA,hasDocumentShell:()=>f8,hasDirectives:()=>_q,hasDOMSupport:()=>dK,handleImageRequest:()=>kZ,handleError:()=>KL,h:()=>ML,groupVariantsByFormat:()=>h7,grayscale:()=>cQ,gitHash:()=>Ok,getUnusedDirectives:()=>Pj,getTranslationSync:()=>nU,getTranslationCacheStats:()=>zw,getTranslationAsync:()=>Fw,getTranslation:()=>E8,getTotalSize:()=>s$,getTimeUntilExpiry:()=>ZY,getStoreNames:()=>SO,getStore:()=>PQ,getSourceLineInfo:()=>j9,getScreenReaderOnlyStyle:()=>oF,getScopeAttribute:()=>uN,getRouteParams:()=>LE,getPublicEnvDefine:()=>N1,getPublicEnv:()=>PK,getPositionInfo:()=>Uq,getPlaceholderRegistry:()=>O9,getPlaceholderCacheStats:()=>UX,getPageMeta:()=>A8,getNonce:()=>C$,getMimeType:()=>I1,getMiddlewareNames:()=>T6,getMiddleware:()=>cI,getLoadingState:()=>jw,getLoadingLocales:()=>Nw,getImageMetadata:()=>v7,getHydrationRuntime:()=>RO,getHydratedStoreState:()=>$E,getHmrServer:()=>U4,getHead:()=>L7,getHMRHandler:()=>MS,getFormatExtension:()=>eY,getFileMtime:()=>b4,getFallbackVariant:()=>g7,getErrorMessage:()=>NY,getErrorLocale:()=>QK,getErrorConfig:()=>_4,getErrorCodeName:()=>j3,getDirectives:()=>NV,getDirective:()=>VV,getCurrentInstance:()=>wI,getCspPreset:()=>hA,getCspHeaderName:()=>MU,getComponentCacheStats:()=>fT,getCachedVideoResult:()=>X7,getCachedSignature:()=>BG,getCachedSignalsRuntime:()=>DB,getCachedRouterScript:()=>kB,getCachedPlaceholder:()=>S4,getCachedImageResult:()=>$7,getCached:()=>o5,getCacheStats:()=>_W,getBroadcastServer:()=>cj,getBestVariant:()=>tY,getAllFilters:()=>F9,generateWidthSrcset:()=>I$,generateVirtualListCSS:()=>d2,generateVideoPreview:()=>yG,generateValidationScript:()=>Uw,generateUploadRuntime:()=>e6,generateTreeShakenBundle:()=>xj,generateTransitionRuntime:()=>Xz,generateTransitionCSS:()=>Yz,generateThumbnails:()=>G7,generateThumbhashPlaceholder:()=>YX,generateTemplatesDocs:()=>AH,generateSuspenseRuntime:()=>zz,generateSuspenseCSS:()=>_z,generateStateScript:()=>AO,generateSrcsetData:()=>oY,generateSrcset:()=>l3,generateSrcSet:()=>R5,generateSpriteSheet:()=>e3,generateSpaShell:()=>$b,generateSourceTags:()=>aY,generateSizesFromBreakpoints:()=>nY,generateSizesAttribute:()=>l5,generateSizes:()=>f7,generateSitemapIndex:()=>SN,generateSitemap:()=>Z3,generateSimpleMediaPicker:()=>pO,generateSignatureRuntime:()=>s6,generateSignalsRuntimeDev:()=>q5,generateSignalsRuntime:()=>Y6,generateServerDataBridge:()=>V4,generateScopeId:()=>G8,generateSFCWebComponent:()=>nW,generateRouteTypes:()=>VE,generateRouteManifest:()=>FE,generateRobotsTxt:()=>pW,generateRobots:()=>Y3,generateResponsiveVariants:()=>c3,generateReactiveWebComponentTS:()=>cN,generateReactiveWebComponent:()=>pN,generateReactiveRuntime:()=>iN,generateReactiveMixin:()=>lN,generatePoster:()=>Q7,generatePlaceholderStyle:()=>KX,generatePlaceholderCSS:()=>k4,generatePlaceholder:()=>D4,generatePartialHydrationCSS:()=>o2,generateNonce:()=>LJ,generateNetlifyToml:()=>M9,generateMinifiedMediaRuntime:()=>rO,generateMediaRuntime:()=>xG,generateMediaManagerEmbed:()=>mO,generateManifest:()=>ZQ,generateLoadingIndicatorHtml:()=>AS,generateLazyLoadRuntime:()=>r6,generateLQIP:()=>JX,generateKeepAliveRuntime:()=>Dz,generateKeepAliveCSS:()=>Ez,generateIslandManifest:()=>X9,generateImagePreview:()=>CG,generateImageManifest:()=>h9,generateHydrationScript:()=>ES,generateHydrationRuntime:()=>m_,generateHydrationCSS:()=>kS,generateHydrationBootstrap:()=>l2,generateHotReloadScript:()=>aG,generateHeatmapScript:()=>gY,generateHMRClientScript:()=>wS,generateHLSManifest:()=>K7,generateEventBindings:()=>IS,generateDprSrcsetWithVariableQuality:()=>iY,generateDprSrcset:()=>c5,generateDocumentShell:()=>NB,generateDocs:()=>IH,generateDirectivesDocs:()=>wH,generateDirectiveRuntime:()=>TV,generateDefaultRobotsTxt:()=>CN,generateDASHManifest:()=>W7,generateCspMetaTag:()=>V8,generateCspHeader:()=>FJ,generateCrosswindCSS:()=>_8,generateCompositionRuntime:()=>zL,generateComponentsDocs:()=>NH,generateComponentManifest:()=>uM,generateComponentDoc:()=>VH,generateColorPlaceholder:()=>GX,generateClientRuntime:()=>gI,generateCacheKey:()=>s5,generateBlurUpRuntime:()=>a6,generateBlurUpCSS:()=>t6,generateBindingsRuntime:()=>KU,generateAutoWidthSrcset:()=>lY,generateAsyncComponentRuntime:()=>Az,generateAsyncComponentCSS:()=>Nz,generateAnimationRuntime:()=>jV,generateAnimationCSS:()=>zV,generateAnalyticsScript:()=>UJ,formatTypeErrors:()=>qS,formatStxContent:()=>mH,formatSize:()=>w5,formatRoutes:()=>n9,formatMarkdownContent:()=>dD,formatLocalizedError:()=>WK,formatICU:()=>rU,formatFilePath:()=>z4,formatError:()=>L3,formatDoctorReport:()=>CL,formatDocsAsMarkdown:()=>RH,formatDocsAsJson:()=>TH,formatDocsAsHtml:()=>MH,format:()=>eQ,foldConstants:()=>gj,flipVertical:()=>tQ,flipHorizontal:()=>aQ,fingerprint:()=>s9,findPantryPackage:()=>uG,findMatchingEndTag:()=>N$,findMatchingDelimiter:()=>P0,findIfBlocks:()=>u5,findExpressions:()=>EK,findErrorPage:()=>i9,findDirectiveBlocks:()=>O4,findDeadCode:()=>vj,findDeadBranches:()=>vj,findComponentFiles:()=>OQ,findCommonDir:()=>qQ,filterRequiredFiles:()=>RZ,fileExists:()=>t,extractVariables:()=>D0,extractStreamBoundaries:()=>v_,extractState:()=>wO,extractSlotContent:()=>Oq,extractScriptFromTemplate:()=>P2,extractPlaceholders:()=>gT,extractParenthesizedExpression:()=>e1,extractLayoutMetadata:()=>b6,extractDominantColor:()=>QX,extractDirectiveParams:()=>kK,extractDirectiveNames:()=>zq,extractContainerContent:()=>S6,extractComponentProps:()=>LH,extractComponentName:()=>i2,extractComponentDescription:()=>FH,extractClassNames:()=>B8,extractBridgeData:()=>A$,extractBoundProps:()=>n2,extractBalancedExpression:()=>TY,extractAndStripCssImports:()=>bY,extractAndScopeStyles:()=>mN,extractAndProcessEvents:()=>qU,evaluateExpression:()=>a0,evaluateConstant:()=>hZ,evaluateAuthExpression:()=>t1,escapeHtml:()=>E0,errorRecovery:()=>F3,errorLogger:()=>o0,ensureTeleportTargets:()=>s_,ensureDocumentShell:()=>s4,enhancedValidationRules:()=>IJ,eliminateDeadCode:()=>fj,effect:()=>t4,dprUrls:()=>QG,docsCommand:()=>qD,disconnectObserver:()=>RG,devHelpers:()=>d5,detectShell:()=>c9,detectRuntime:()=>r7,detectProjectConfig:()=>L6,detectFormat:()=>$X,detectBuildMode:()=>nE,derived:()=>a4,deploy:()=>oT,defineStxConfig:()=>oW,defineStore:()=>CO,defineSlots:()=>UL,defineSiteConfig:()=>rG,definePropsWithValidation:()=>rL,defineProps:()=>sL,definePlugin:()=>_7,definePageMeta:()=>SU,defineMiddleware:()=>pI,defineExpose:()=>JL,defineEmits:()=>XL,defineDirective:()=>S0,defineCustomElement:()=>IL,defineConfig:()=>Bk,defineClientDirective:()=>wV,defineAsyncComponent:()=>Fz,defaultMediaConfig:()=>iS,defaultImageConfig:()=>NI,defaultI18nConfig:()=>D8,defaultHeatmapConfig:()=>eK,defaultFormClasses:()=>M8,defaultFilters:()=>P7,defaultCspConfig:()=>lA,defaultConfig:()=>G1,default:()=>YC,decodeThumbhash:()=>XX,cspNonceDirective:()=>RU,cspDirective:()=>wU,crossfadeTransition:()=>DG,crop:()=>gQ,createVirtualList:()=>_Z,createVideoDirective:()=>Y8,createVercelHandler:()=>DD,createTypeChecker:()=>IQ,createTranslateFilter:()=>hw,createTextEncoderStream:()=>MD,createStxApp:()=>dG,createStreamingResponse:()=>RD,createStreamRenderer:()=>g_,createStore:()=>xQ,createStorageManager:()=>mI,createServerCookieManager:()=>uI,createScope:()=>eq,createSSRSuspense:()=>Uz,createRouter:()=>B$,createRouteLocation:()=>M6,createRoute:()=>KS,createRef:()=>MI,createReactive:()=>$j,createProvideContext:()=>_L,createProject:()=>Vk,createProductionBuild:()=>Uk,createPlaceholder:()=>q6,createOptimizedBuild:()=>rE,createNetlifyHandler:()=>kD,createNetlifyClient:()=>AZ,createMiddlewareContext:()=>R6,createMiddleware:()=>GS,createLazyObserver:()=>AG,createKeepAliveCache:()=>Tz,createKVNamespace:()=>SH,createIslandRegistry:()=>s2,createImgDirective:()=>r3,createImagePlugin:()=>iq,createImageHandler:()=>C9,createImageDirective:()=>f9,createHeatmapAggregator:()=>FV,createFileManifest:()=>wZ,createEnvAccessor:()=>kH,createEnhancedError:()=>HK,createEdgeHandler:()=>v6,createEdgeCache:()=>bH,createDetailedErrorMessage:()=>L0,createDenoHandler:()=>ED,createDefaultNetlifyConfig:()=>F6,createCspHeaders:()=>cA,createCookie:()=>bD,createComputed:()=>TI,createComponentInstance:()=>RI,createCloudflareHandler:()=>ID,createClientCookieManager:()=>dI,createBuiltinDirectives:()=>MV,createApp:()=>dG,createAnimationTimeline:()=>_V,cover:()=>uQ,convertToCommonJS:()=>KZ,contrast:()=>sQ,contain:()=>dQ,consoleError:()=>jK,configureErrorHandling:()=>BK,config:()=>K1,computed:()=>TI,composeShellWithPage:()=>k6,componentDirective:()=>YH,compileTemplate:()=>t9,collectDeployFiles:()=>O6,clearVideoCache:()=>a3,clearTranslationCache:()=>_w,clearSignatureCache:()=>_G,clearPlaceholderCache:()=>WX,clearOnceStore:()=>sT,clearNonce:()=>gA,clearMiddleware:()=>w6,clearImageCache:()=>v9,clearErrorMessages:()=>KK,clearDevCaches:()=>SB,clearCustomFilters:()=>Iq,clearComponentCache:()=>i$,clearCache:()=>t5,cleanupLoadingIndicator:()=>NS,classifyScript:()=>Bj,classifyAllScripts:()=>u9,checkTemplateFile:()=>_S,checkTemplate:()=>zS,checkCache:()=>n8,checkAuthAccess:()=>Z4,checkA11y:()=>uK,channel:()=>tj,captureScreenshots:()=>hD,captureScreenshot:()=>gH,cancelPendingLoads:()=>Aw,calculateSha1:()=>R9,calculateOptimalWidths:()=>g3,cacheTemplate:()=>s8,buildWebComponents:()=>cX,buildViews:()=>eO,buildUrl:()=>A0,buildSuspenseResolveScript:()=>BZ,buildStaticSite:()=>nG,buildRuntimeAsset:()=>r9,buildRouterAsset:()=>o9,buildLangPickerScript:()=>K3,buildImageUrl:()=>S1,buildForProduction:()=>Ij,buildAuthParams:()=>n6,buildApp:()=>lE,buildAlternateLinks:()=>G3,build:()=>Wk,broadcastPrivate:()=>oj,broadcastPresence:()=>aj,broadcast:()=>KQ,brightness:()=>nQ,blur:()=>mQ,batchSignUrls:()=>eZ,batch:()=>d8,autoFixA11yFile:()=>pK,autoFixA11yDirectory:()=>$V,autoFixA11y:()=>mK,auto:()=>ZG,assetTags:()=>hE,arrayOf:()=>YF,applyTranslations:()=>Q3,applyTransformations:()=>y4,applySlots:()=>Lq,applyPropDefaults:()=>eE,applyPreset:()=>XG,applyHead:()=>xU,applyFilters:()=>N9,apiCspPreset:()=>AU,animationGroupDirective:()=>C3,analyzeVideo:()=>x4,analyzeUsage:()=>QQ,analyzeTemplate:()=>Uj,analyzeProject:()=>UE,analyzeDirectiveUsage:()=>QQ,analyticsDirective:()=>FA,addStore:()=>Mk,addPage:()=>Rk,addNonceToInlineContent:()=>uA,addLayout:()=>Tk,addComponent:()=>wk,abortNavigation:()=>hI,a11yDirective:()=>E3,__setSignalsGeneratorsForTest:()=>EB,VideoProcessorCache:()=>Y7,TransitionType:()=>cK,TransitionEase:()=>iK,TransitionDirection:()=>lK,Tokenizer:()=>H4,TemplateTypeChecker:()=>TQ,TEMPLATE_PRESETS:()=>nD,StxValidationError:()=>q4,StxSyntaxError:()=>AY,StxSecurityError:()=>wY,StxRuntimeError:()=>k1,StxFileError:()=>h5,StxError:()=>V$,Show:()=>AL,SUSPENSE_RESOLVER_RUNTIME:()=>f2,SPRING_PRESETS:()=>xY,ProductionBuild:()=>sZ,Portal:()=>RL,PROJECT_TEMPLATES:()=>Fk,PRESETS:()=>aZ,MemorySessionStore:()=>IO,MIME_TYPES:()=>I4,MEDIA_DEFAULT_WIDTHS:()=>u1,MEDIA_DEFAULT_FORMATS:()=>Z$,ImageProcessorCache:()=>e5,ImageProcessingError:()=>d7,HydrationRuntime:()=>yQ,HotReloadServer:()=>LY,HeatmapAggregator:()=>uY,Fragment:()=>C5,For:()=>wL,ErrorLogger:()=>V3,ErrorCodes:()=>e,DeployError:()=>r$,DEFAULT_WIDTHS:()=>R1,DEFAULT_TRANSITION_OPTIONS:()=>d1,DEFAULT_QUALITY:()=>T1,DEFAULT_PLACEHOLDER_OPTIONS:()=>d3,DEFAULT_FORMATS:()=>M1,DEFAULT_DPR_VALUES:()=>T4,ComponentHMRHandler:()=>bQ,COMMON_SIZES:()=>sY,CLOAK_STYLE:()=>FR,BroadcastServer:()=>$H,Broadcast:()=>ej,BLUR_UP_CSS:()=>n5});var YC;var o$=D(()=>{D9();d9();N0();T2();G5();yO();hJ();fG();TL();EL();oX();m1();yL();hL();mL();Zj();x$();yZ();EJ();k3();_J();P3();O7();p7();VY();Dj();a9();bj();mj();dZ();H5();XH();i0();AJ();MJ();D9();jH();M4();EH();CH();hH();j1();qJ();n0();pH();x3();yJ();C7();nH();rH();y8();v3();gJ();L4();fZ();j6();F1();tH();JQ();ZO();C6();WO();m9();Q8();BO();v8();e9();wQ();c$();zO();nX();c2();J9();qO();OO();WJ();W5();FO();MO();EO();d9();tO();$L();c8();uJ();pJ();kL();N0();z9();lL();YC={}});import B3 from"path";var n7;var nZ=D(()=>{o$();j1();n0();U5();F1();n7={name:"bun-plugin-stx",async setup($){let Y={...await v0(),...$.config?.stx},X=new Set,J=Y.webComponents?.enabled?`./${B3.relative(B3.dirname($.config?.outdir||"dist"),Y.webComponents.outputDir||"dist/web-components")}`:"/web-components",Q=[];if(Y.webComponents?.enabled)try{let G=await cX(Y,X);if(Q.push(...G),Y.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let K=new Set;if(Y.cache&&Y.cachePath){let H=await n8(G,Y);if(H){if(Y.debug)console.log(`Using cached version of ${G}`);return{contents:H,loader:"html"}}}let W=await h1(()=>Bun.file(G).text(),"",(H)=>{throw new h5(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${H.message}`)});if(!W)throw new h5(`stx file is empty: ${G}`,G);let{scriptContent:U,templateContent:B,allScripts:_}=A4.time("script-extraction",()=>{let H=W,O=W.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(O)H=O[1].trim();let F=W.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],L="",V=[];for(let A of F){let w=A.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",R=A.match(/<script\b([^>]*)>/i),T=R?R[1]:"";if(/\bserver\b/i.test(T))L=w;else V.push(A)}let N=H.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:L,templateContent:N,allScripts:V}}),z={__filename:G,__dirname:B3.dirname(G),__stx:{webComponentsPath:J,builtComponents:Q}};await h1(()=>D0(U,z,G),void 0,(H)=>{let O=new k1(`Script execution failed in ${G}: ${H.message}`,G,void 0,void 0,U.substring(0,100));if(o0.log(O,{filePath:G,scriptContent:U}),Y.debug)throw O});let j=await A4.timeAsync("directive-processing",async()=>{return await X0(B,z,G,Y,K)});if(_.length>0){let{interpolateScriptsInTemplate:H}=await Promise.resolve().then(() => (n0(),_6)),O=H(_.join(`
16274
+ ${W}`)}return{props:G,validation:K}}function oL($,Z){let Y={...$};for(let[X,J]of Object.entries(Z))if(Y[X]===void 0)Y[X]=typeof J==="function"?J():J;return Y}function aL($){return $}function tL($){return{type:$,required:!0}}function eL($,Z){return{type:Z,default:$}}function $F($,Z={}){return{...Z,validator:$}}function ZF($,Z={}){return{...Z,validator:(Y)=>$.includes(Y)}}function YF($,Z={}){return{...Z,type:Array,validator:(Y)=>{if(!Array.isArray(Y))return!1;return!0}}}function XF($,Z={}){return{...Z,type:Object}}function JF($,Z,Y){if(!Z)return $;let X={};for(let[J,Q]of Object.entries(Z)){let G=typeof Q==="function"||Array.isArray(Q)?{type:Q}:Q||{},K=$[J];if(K===void 0&&G.default!==void 0)K=typeof G.default==="function"?G.default():G.default;{let W=nL(J,K,G,Y);if(W)console.warn(W.message)}X[J]=K}for(let[J,Q]of Object.entries($))if(!(J in X))X[J]=Q;return X}var I5={};Z0(I5,{writeNetlifyConfig:()=>MZ,writeManifest:()=>YQ,writeImageManifest:()=>oq,wrapComponentForHMR:()=>RS,withDefaults:()=>oL,webComponentDirectiveHandler:()=>iX,watermark:()=>YG,watchViews:()=>nS,watchMultiple:()=>EI,watchEffect:()=>DI,watch:()=>II,waitForStore:()=>rI,waitForLocale:()=>Vw,videoDirective:()=>v4,validators:()=>N3,validated:()=>$F,validateValueEnhanced:()=>pU,validateTemplate:()=>Wq,validateParams:()=>GG,validateFormEnhanced:()=>Ww,validateFile:()=>GY,validateFields:()=>Gw,validateField:()=>uU,validateDirective:()=>Bq,validateCspDirectives:()=>pA,validateConfig:()=>aW,validateComponentScripts:()=>sE,validateComponentProps:()=>tE,validateClientScript:()=>K6,usesSignalsInScript:()=>A5,userComponentFileExists:()=>E2,useVirtualList:()=>u2,useTitle:()=>bU,useStoreOrThrow:()=>sI,useStore:()=>bO,useSlots:()=>WL,useSeoMeta:()=>u4,useRouteParams:()=>Xj,useRouteParamOrThrow:()=>oI,useRouteParam:()=>Jj,usePageTitle:()=>bU,useOptimistic:()=>AB,useMiddlewareValue:()=>aI,useMiddlewareState:()=>Qj,useLoadingIndicator:()=>HO,useHead:()=>P$,useAttrs:()=>BL,uploadFiles:()=>bG,uploadFile:()=>KY,updateInstance:()=>vI,untrack:()=>p8,unregisterDirective:()=>AV,unmountInstance:()=>fI,unescapeHtml:()=>FZ,transpileTypeScript:()=>M$,translate:()=>qY,transitionDirective:()=>S3,toUsers:()=>rj,toUser:()=>sj,thumbnail:()=>hQ,thumbHashToRGBA:()=>o6,thumbHashToDataURL:()=>IG,templateCache:()=>sJ,stxClientHelpers:()=>zQ,structuredDataDirective:()=>J8,stripLocalePrefix:()=>cG,stripDocumentWrapper:()=>U$,stringToStream:()=>TD,strictCspPreset:()=>VU,streamingSuspenseDirective:()=>g2,streamToResponse:()=>u_,streamTemplateSimple:()=>f_,streamTemplate:()=>y_,stopHmrServer:()=>v5,stopBroadcasting:()=>ij,state:()=>o4,startProductionServer:()=>Hk,startInteractive:()=>Zk,startBroadcasting:()=>lj,staggerDirective:()=>sK,srcsetUrls:()=>JG,springDirective:()=>rK,splitByPipe:()=>A3,smartBatchSign:()=>UG,signUrl:()=>tZ,shouldTranspileTypeScript:()=>R$,shouldReloadOnChange:()=>K4,shouldRefreshSignature:()=>YY,shouldIgnoreFile:()=>W4,shouldCacheComponent:()=>Iz,sharpen:()=>pQ,shape:()=>XF,setRouteParams:()=>ZE,setMiddlewareState:()=>YE,setGlobalProvide:()=>BY,setErrorLocale:()=>JK,setCurrentInstance:()=>AI,setCachedVideoResult:()=>J7,setCachedImageResult:()=>Z7,setCached:()=>a5,serveStxFile:()=>HH,serveMultipleStxFiles:()=>BH,serveMarkdownFile:()=>iZ,serveFile:()=>QS,serveApp:()=>zH,serve:()=>UO,serializeState:()=>VO,sepia:()=>lQ,scrollAnimateDirective:()=>b3,screenReaderDirective:()=>D3,scopeHTML:()=>lW,scopeCSS:()=>cW,scanForSitemapEntries:()=>bN,scanA11yIssues:()=>tF,saturation:()=>rQ,sanitizeParams:()=>KG,sanitizeFilePath:()=>VK,sanitizeExpression:()=>NK,sanitizeDirectiveParams:()=>AK,sanitizeDirectiveParam:()=>j4,sanitizeComponentProps:()=>MY,safeExecuteAsync:()=>h1,safeExecute:()=>OK,runPreProcessingMiddleware:()=>vJ,runPostProcessingMiddleware:()=>fJ,runMiddleware:()=>E6,runHooks:()=>T5,runDoctor:()=>bL,rotate:()=>oQ,rewriteImagesWithSiblings:()=>Q9,resolveTemplatePath:()=>f4,resolveI18n:()=>J3,resize:()=>fQ,resetPlaceholders:()=>H9,resetHead:()=>kU,resetHMRHandler:()=>TS,resetErrorConfig:()=>_K,required:()=>tL,replacePlaceholders:()=>NZ,renderView:()=>vG,renderVideoComponent:()=>U7,renderVendorStyleTags:()=>CY,renderToString:()=>b5,renderToStream:()=>NL,renderToDOM:()=>Y4,renderThumbhashToCanvas:()=>TG,renderTemplate:()=>Wb,renderString:()=>Ub,renderStreamingPage:()=>P_,renderSlot:()=>B9,renderSSRSuspense:()=>Bz,renderProtectedVideo:()=>HG,renderProtectedImg:()=>jG,renderMediaUpload:()=>WG,renderImgComponent:()=>k$,renderImageComponent:()=>dq,renderHtmlAttrs:()=>yU,renderHead:()=>CU,renderEmail:()=>sS,renderComponentWithSlot:()=>c1,renderBodyAttrs:()=>PU,render:()=>SS,relaxedCspPreset:()=>NU,registerValidationRule:()=>Qw,registerStreamingDirectives:()=>h_,registerStore:()=>eI,registerSeoDirectives:()=>kN,registerMiddleware:()=>nI,registerFilters:()=>Tq,registerFilter:()=>L9,registerErrorMessages:()=>GK,registerEnhancedValidationRule:()=>Kw,registerDirective:()=>YW,registerCspDirectives:()=>mA,registerComponentDirectives:()=>ZD,registerAnimationDirectives:()=>HV,registerA11yDirectives:()=>ZV,ref:()=>MI,redirect:()=>yD,readMarkdownFile:()=>X$,readFileCached:()=>RB,reactive:()=>$j,quality:()=>$G,pruneSignatureCache:()=>zG,pruneCache:()=>zW,provide:()=>ZL,prop:()=>aL,processVueTemplate:()=>dJ,processVirtualListDirectives:()=>zZ,processVirtualGridDirectives:()=>p2,processVideo:()=>Z8,processValidateDirective:()=>mU,processTranslateDirective:()=>CJ,processTransitionDirectives:()=>Zz,processTransitionAttributes:()=>Jz,processTitleDirective:()=>fU,processTemplateBindings:()=>KJ,processTeleportDirectives:()=>n_,processSuspenseDirectives:()=>Wz,processStructuredData:()=>uX,processStreamDirectives:()=>x_,processStaticDirectives:()=>Y9,processStackReplacements:()=>OZ,processStackPushDirectives:()=>HZ,processSlots:()=>_9,processShell:()=>xZ,processServerBindings:()=>P8,processSeoDirective:()=>mX,processSectionDirectives:()=>d_,processScopedStyles:()=>n4,processReactiveBindings:()=>GU,processProtectedMedia:()=>OG,processPartialHydrationDirectives:()=>r2,processOnceDirective:()=>G6,processMiddleware:()=>xJ,processMetaDirectives:()=>dX,processMetaDirective:()=>gU,processMarkdownFileDirectives:()=>HJ,processMarkdownDirectives:()=>mY,processLoops:()=>C8,processKeepAliveDirectives:()=>Mz,processJsonDirective:()=>Q6,processInfiniteListDirectives:()=>m2,processIncludes:()=>LZ,processImgComponents:()=>RX,processImageComponents:()=>uq,processImage:()=>s1,processHeadDirective:()=>vU,processForms:()=>Jw,processFormInputDirectives:()=>T8,processExpressions:()=>U1,processEventDirectives:()=>zJ,processErrorDirective:()=>I8,processDynamicComponents:()=>mJ,processDirectives:()=>X0,processDirectiveAttributes:()=>IV,processDeferDirectives:()=>c_,processCustomDirectives:()=>RJ,processCspDirectives:()=>NJ,processComponentProps:()=>JF,processClientScript:()=>w$,processBasicFormDirectives:()=>F7,processAsyncDirectives:()=>Lz,processAnimationDirectives:()=>vY,processA11yDirectives:()=>PY,preloadTranslationsBackground:()=>Lw,preloadTranslations:()=>iU,preloadIslandHandlers:()=>HS,preloadIconCollection:()=>ZZ,poolStrings:()=>dj,pluginManager:()=>rX,performLeave:()=>$z,performEnter:()=>e_,peek:()=>Z6,partialsCache:()=>n$,parseVideoDirectiveOptions:()=>gW,parseUrl:()=>vQ,parseThumbhashString:()=>EG,parseSwitchBlock:()=>w3,parseSlots:()=>U9,parseSlotElement:()=>jq,parseScriptDeclarations:()=>SK,parseSFCComponent:()=>iW,parseProtectedArgs:()=>LG,parseImgComponent:()=>s3,parseImageUrl:()=>rY,parseImageComponent:()=>P9,parseExpressionWithFilters:()=>DK,parseCookies:()=>SD,parseConditionalBlock:()=>IY,parseArguments:()=>EY,parseAnimationShorthand:()=>qV,optional:()=>eL,optimizeTemplate:()=>uj,optimizeImage:()=>g9,optimizeDirectory:()=>rq,oneOf:()=>ZF,onceStore:()=>w9,onUpdated:()=>CI,onUnmounted:()=>PI,onServer:()=>JE,onMounted:()=>SI,onMount:()=>u8,onHydrated:()=>Z9,onErrorCaptured:()=>GL,onDestroy:()=>m8,onDeactivated:()=>Sz,onClient:()=>XE,onBeforeUpdate:()=>bI,onBeforeUnmount:()=>yI,onBeforeMount:()=>kI,onActivated:()=>kz,observeElement:()=>wG,notFound:()=>PD,nextTick:()=>QL,navigateTo:()=>iI,mountInstance:()=>xI,motionDirective:()=>y3,moderateCspPreset:()=>F8,minifyHtml:()=>hj,metaDirective:()=>X8,mergeParams:()=>oZ,mergeCspDirectives:()=>dA,matchRoute:()=>vZ,markdownDirectiveHandler:()=>pY,markdownCache:()=>L8,localizePath:()=>j$,loadTranslationLazy:()=>l4,loadTranslation:()=>sU,loadStxConfig:()=>v0,loadMiddlewareFromDirectory:()=>I6,loadManifest:()=>XQ,loadElement:()=>q$,loadChannels:()=>nj,lintStxStrict:()=>uL,lazyLoadAll:()=>NG,lazyLoad:()=>VG,keyframeDirective:()=>nK,jsxs:()=>LL,jsxDEV:()=>FL,jsx:()=>y5,jsonResponse:()=>CD,islandDirective:()=>h2,isTest:()=>B4,isSpaNavigation:()=>l9,isSignatureValid:()=>$Y,isSignal:()=>e4,isSharpAvailable:()=>V6,isServerEnvironment:()=>HD,isServer:()=>Gj,isProduction:()=>f5,isNativeLazySupported:()=>XY,isLoading:()=>Hw,isLoaded:()=>Ow,isJavaScriptScript:()=>Nq,isIntersectionObserverSupported:()=>JY,isImageFile:()=>N6,isImageBackendAvailable:()=>n1,isICUFormat:()=>aU,isHydrated:()=>$9,isHydrateTrigger:()=>Aq,isEdgeEnvironment:()=>jD,isDirectiveKind:()=>pL,isDevelopment:()=>F$,isDerived:()=>$6,isCssOnlyChange:()=>G4,isClient:()=>Kj,isAsyncComponent:()=>Vz,invert:()=>iQ,invalidateFileCacheByDir:()=>TB,invalidateFileCache:()=>MB,interpolateScriptsInTemplate:()=>Eq,interpolateScriptExpressions:()=>V9,inlineError:()=>J0,injectThemeBootstrap:()=>X3,injectSeoTags:()=>pX,injectSeo:()=>$3,injectRouterScript:()=>Q$,injectHotReload:()=>g1,injectHeatmap:()=>hY,injectCspMetaTag:()=>VJ,injectCrosswindCSS:()=>T0,injectConfigHeadTags:()=>iJ,injectCloakStyle:()=>lJ,injectAnalytics:()=>BJ,inject:()=>YL,initStoreRegistry:()=>tI,initNetlify:()=>aT,initLoadingIndicator:()=>VS,initLazyLoading:()=>FG,initFile:()=>sD,initBlurUp:()=>QY,initAllBlurUp:()=>kG,imgDirective:()=>P4,imageDirective:()=>cq,hydrateTemplateStream:()=>AQ,hydrateTemplate:()=>_k,hydrateIslands:()=>jS,hydrateIsland:()=>a2,hydrateFragment:()=>zk,hydrateByStrategy:()=>t2,hydrateAll:()=>e2,hydrate:()=>DS,htmlResponse:()=>JS,heatmapDirective:()=>dY,hashString:()=>u3,hashFilePath:()=>A7,hashFile:()=>c0,hashBuffer:()=>GW,hasVueTemplateSyntax:()=>OB,hasVariables:()=>x2,hasStore:()=>kO,hasPlaceholders:()=>y7,hasNetlifyConfig:()=>TZ,hasMiddleware:()=>lI,hasEventDirectives:()=>MA,hasDocumentShell:()=>f8,hasDirectives:()=>_q,hasDOMSupport:()=>dK,handleImageRequest:()=>kZ,handleError:()=>KL,h:()=>ML,groupVariantsByFormat:()=>h7,grayscale:()=>cQ,gitHash:()=>Ok,getUnusedDirectives:()=>Pj,getTranslationSync:()=>nU,getTranslationCacheStats:()=>zw,getTranslationAsync:()=>Fw,getTranslation:()=>E8,getTotalSize:()=>s$,getTimeUntilExpiry:()=>ZY,getStoreNames:()=>SO,getStore:()=>PQ,getSourceLineInfo:()=>j9,getScreenReaderOnlyStyle:()=>oF,getScopeAttribute:()=>uN,getRouteParams:()=>LE,getPublicEnvDefine:()=>N1,getPublicEnv:()=>PK,getPositionInfo:()=>Uq,getPlaceholderRegistry:()=>O9,getPlaceholderCacheStats:()=>UX,getPageMeta:()=>A8,getNonce:()=>C$,getMimeType:()=>I1,getMiddlewareNames:()=>T6,getMiddleware:()=>cI,getLoadingState:()=>jw,getLoadingLocales:()=>Nw,getImageMetadata:()=>v7,getHydrationRuntime:()=>RO,getHydratedStoreState:()=>$E,getHmrServer:()=>U4,getHead:()=>L7,getHMRHandler:()=>MS,getFormatExtension:()=>eY,getFileMtime:()=>b4,getFallbackVariant:()=>g7,getErrorMessage:()=>NY,getErrorLocale:()=>QK,getErrorConfig:()=>_4,getErrorCodeName:()=>j3,getDirectives:()=>NV,getDirective:()=>VV,getCurrentInstance:()=>wI,getCspPreset:()=>hA,getCspHeaderName:()=>MU,getComponentCacheStats:()=>fT,getCachedVideoResult:()=>X7,getCachedSignature:()=>BG,getCachedSignalsRuntime:()=>DB,getCachedRouterScript:()=>kB,getCachedPlaceholder:()=>S4,getCachedImageResult:()=>$7,getCached:()=>o5,getCacheStats:()=>_W,getBroadcastServer:()=>cj,getBestVariant:()=>tY,getAllFilters:()=>F9,generateWidthSrcset:()=>I$,generateVirtualListCSS:()=>d2,generateVideoPreview:()=>yG,generateValidationScript:()=>Uw,generateUploadRuntime:()=>e6,generateTreeShakenBundle:()=>xj,generateTransitionRuntime:()=>Xz,generateTransitionCSS:()=>Yz,generateThumbnails:()=>G7,generateThumbhashPlaceholder:()=>YX,generateTemplatesDocs:()=>AH,generateSuspenseRuntime:()=>zz,generateSuspenseCSS:()=>_z,generateStateScript:()=>AO,generateSrcsetData:()=>oY,generateSrcset:()=>l3,generateSrcSet:()=>R5,generateSpriteSheet:()=>e3,generateSpaShell:()=>$b,generateSourceTags:()=>aY,generateSizesFromBreakpoints:()=>nY,generateSizesAttribute:()=>l5,generateSizes:()=>f7,generateSitemapIndex:()=>SN,generateSitemap:()=>Z3,generateSimpleMediaPicker:()=>pO,generateSignatureRuntime:()=>s6,generateSignalsRuntimeDev:()=>q5,generateSignalsRuntime:()=>Y6,generateServerDataBridge:()=>V4,generateScopeId:()=>G8,generateSFCWebComponent:()=>nW,generateRouteTypes:()=>VE,generateRouteManifest:()=>FE,generateRobotsTxt:()=>pW,generateRobots:()=>Y3,generateResponsiveVariants:()=>c3,generateReactiveWebComponentTS:()=>cN,generateReactiveWebComponent:()=>pN,generateReactiveRuntime:()=>iN,generateReactiveMixin:()=>lN,generatePoster:()=>Q7,generatePlaceholderStyle:()=>KX,generatePlaceholderCSS:()=>k4,generatePlaceholder:()=>D4,generatePartialHydrationCSS:()=>o2,generateNonce:()=>LJ,generateNetlifyToml:()=>M9,generateMinifiedMediaRuntime:()=>rO,generateMediaRuntime:()=>xG,generateMediaManagerEmbed:()=>mO,generateManifest:()=>ZQ,generateLoadingIndicatorHtml:()=>AS,generateLazyLoadRuntime:()=>r6,generateLQIP:()=>JX,generateKeepAliveRuntime:()=>Dz,generateKeepAliveCSS:()=>Ez,generateIslandManifest:()=>X9,generateImagePreview:()=>CG,generateImageManifest:()=>h9,generateHydrationScript:()=>ES,generateHydrationRuntime:()=>m_,generateHydrationCSS:()=>kS,generateHydrationBootstrap:()=>l2,generateHotReloadScript:()=>aG,generateHeatmapScript:()=>gY,generateHMRClientScript:()=>wS,generateHLSManifest:()=>K7,generateEventBindings:()=>IS,generateDprSrcsetWithVariableQuality:()=>iY,generateDprSrcset:()=>c5,generateDocumentShell:()=>NB,generateDocs:()=>IH,generateDirectivesDocs:()=>wH,generateDirectiveRuntime:()=>TV,generateDefaultRobotsTxt:()=>CN,generateDASHManifest:()=>W7,generateCspMetaTag:()=>V8,generateCspHeader:()=>FJ,generateCrosswindCSS:()=>_8,generateCompositionRuntime:()=>zL,generateComponentsDocs:()=>NH,generateComponentManifest:()=>uM,generateComponentDoc:()=>VH,generateColorPlaceholder:()=>GX,generateClientRuntime:()=>gI,generateCacheKey:()=>s5,generateBlurUpRuntime:()=>a6,generateBlurUpCSS:()=>t6,generateBindingsRuntime:()=>KU,generateAutoWidthSrcset:()=>lY,generateAsyncComponentRuntime:()=>Az,generateAsyncComponentCSS:()=>Nz,generateAnimationRuntime:()=>jV,generateAnimationCSS:()=>zV,generateAnalyticsScript:()=>UJ,formatTypeErrors:()=>qS,formatStxContent:()=>mH,formatSize:()=>w5,formatRoutes:()=>n9,formatMarkdownContent:()=>dD,formatLocalizedError:()=>WK,formatICU:()=>rU,formatFilePath:()=>z4,formatError:()=>L3,formatDoctorReport:()=>CL,formatDocsAsMarkdown:()=>RH,formatDocsAsJson:()=>TH,formatDocsAsHtml:()=>MH,format:()=>eQ,foldConstants:()=>gj,flipVertical:()=>tQ,flipHorizontal:()=>aQ,fingerprint:()=>s9,findPantryPackage:()=>uG,findMatchingEndTag:()=>N$,findMatchingDelimiter:()=>P0,findIfBlocks:()=>u5,findExpressions:()=>EK,findErrorPage:()=>i9,findDirectiveBlocks:()=>O4,findDeadCode:()=>vj,findDeadBranches:()=>vj,findComponentFiles:()=>OQ,findCommonDir:()=>qQ,filterRequiredFiles:()=>RZ,fileExists:()=>t,extractVariables:()=>D0,extractStreamBoundaries:()=>v_,extractState:()=>wO,extractSlotContent:()=>Oq,extractScriptFromTemplate:()=>P2,extractPlaceholders:()=>gT,extractParenthesizedExpression:()=>e1,extractLayoutMetadata:()=>b6,extractDominantColor:()=>QX,extractDirectiveParams:()=>kK,extractDirectiveNames:()=>zq,extractContainerContent:()=>S6,extractComponentProps:()=>LH,extractComponentName:()=>i2,extractComponentDescription:()=>FH,extractClassNames:()=>B8,extractBridgeData:()=>A$,extractBoundProps:()=>n2,extractBalancedExpression:()=>TY,extractAndStripCssImports:()=>bY,extractAndScopeStyles:()=>mN,extractAndProcessEvents:()=>qU,evaluateExpression:()=>a0,evaluateConstant:()=>hZ,evaluateAuthExpression:()=>t1,escapeHtml:()=>E0,errorRecovery:()=>F3,errorLogger:()=>o0,ensureTeleportTargets:()=>s_,ensureDocumentShell:()=>s4,enhancedValidationRules:()=>IJ,eliminateDeadCode:()=>fj,effect:()=>t4,dprUrls:()=>QG,docsCommand:()=>qD,disconnectObserver:()=>RG,devHelpers:()=>d5,detectShell:()=>c9,detectRuntime:()=>r7,detectProjectConfig:()=>L6,detectFormat:()=>$X,detectBuildMode:()=>nE,derived:()=>a4,deploy:()=>oT,defineStxConfig:()=>oW,defineStore:()=>CO,defineSlots:()=>UL,defineSiteConfig:()=>rG,definePropsWithValidation:()=>rL,defineProps:()=>sL,definePlugin:()=>_7,definePageMeta:()=>SU,defineMiddleware:()=>pI,defineExpose:()=>JL,defineEmits:()=>XL,defineDirective:()=>S0,defineCustomElement:()=>IL,defineConfig:()=>Bk,defineClientDirective:()=>wV,defineAsyncComponent:()=>Fz,defaultMediaConfig:()=>iS,defaultImageConfig:()=>NI,defaultI18nConfig:()=>D8,defaultHeatmapConfig:()=>eK,defaultFormClasses:()=>M8,defaultFilters:()=>P7,defaultCspConfig:()=>lA,defaultConfig:()=>G1,default:()=>YC,decodeThumbhash:()=>XX,cspNonceDirective:()=>RU,cspDirective:()=>wU,crossfadeTransition:()=>DG,crop:()=>gQ,createVirtualList:()=>_Z,createVideoDirective:()=>Y8,createVercelHandler:()=>DD,createTypeChecker:()=>IQ,createTranslateFilter:()=>hw,createTextEncoderStream:()=>MD,createStxApp:()=>dG,createStreamingResponse:()=>RD,createStreamRenderer:()=>g_,createStore:()=>xQ,createStorageManager:()=>mI,createServerCookieManager:()=>uI,createScope:()=>eq,createSSRSuspense:()=>Uz,createRouter:()=>B$,createRouteLocation:()=>M6,createRoute:()=>KS,createRef:()=>MI,createReactive:()=>$j,createProvideContext:()=>_L,createProject:()=>Vk,createProductionBuild:()=>Uk,createPlaceholder:()=>q6,createOptimizedBuild:()=>rE,createNetlifyHandler:()=>kD,createNetlifyClient:()=>AZ,createMiddlewareContext:()=>R6,createMiddleware:()=>GS,createLazyObserver:()=>AG,createKeepAliveCache:()=>Tz,createKVNamespace:()=>SH,createIslandRegistry:()=>s2,createImgDirective:()=>r3,createImagePlugin:()=>iq,createImageHandler:()=>C9,createImageDirective:()=>f9,createHeatmapAggregator:()=>FV,createFileManifest:()=>wZ,createEnvAccessor:()=>kH,createEnhancedError:()=>HK,createEdgeHandler:()=>v6,createEdgeCache:()=>bH,createDetailedErrorMessage:()=>F0,createDenoHandler:()=>ED,createDefaultNetlifyConfig:()=>F6,createCspHeaders:()=>cA,createCookie:()=>bD,createComputed:()=>TI,createComponentInstance:()=>RI,createCloudflareHandler:()=>ID,createClientCookieManager:()=>dI,createBuiltinDirectives:()=>MV,createApp:()=>dG,createAnimationTimeline:()=>_V,cover:()=>uQ,convertToCommonJS:()=>KZ,contrast:()=>sQ,contain:()=>dQ,consoleError:()=>jK,configureErrorHandling:()=>BK,config:()=>K1,computed:()=>TI,composeShellWithPage:()=>k6,componentDirective:()=>YH,compileTemplate:()=>t9,collectDeployFiles:()=>O6,clearVideoCache:()=>a3,clearTranslationCache:()=>_w,clearSignatureCache:()=>_G,clearPlaceholderCache:()=>WX,clearOnceStore:()=>sT,clearNonce:()=>gA,clearMiddleware:()=>w6,clearImageCache:()=>v9,clearErrorMessages:()=>KK,clearDevCaches:()=>SB,clearCustomFilters:()=>Iq,clearComponentCache:()=>i$,clearCache:()=>t5,cleanupLoadingIndicator:()=>NS,classifyScript:()=>Bj,classifyAllScripts:()=>u9,checkTemplateFile:()=>_S,checkTemplate:()=>zS,checkCache:()=>n8,checkAuthAccess:()=>Z4,checkA11y:()=>uK,channel:()=>tj,captureScreenshots:()=>hD,captureScreenshot:()=>gH,cancelPendingLoads:()=>Aw,calculateSha1:()=>R9,calculateOptimalWidths:()=>g3,cacheTemplate:()=>s8,buildWebComponents:()=>cX,buildViews:()=>eO,buildUrl:()=>w0,buildSuspenseResolveScript:()=>BZ,buildStaticSite:()=>nG,buildRuntimeAsset:()=>r9,buildRouterAsset:()=>o9,buildLangPickerScript:()=>K3,buildImageUrl:()=>S1,buildForProduction:()=>Ij,buildAuthParams:()=>n6,buildApp:()=>lE,buildAlternateLinks:()=>G3,build:()=>Wk,broadcastPrivate:()=>oj,broadcastPresence:()=>aj,broadcast:()=>KQ,brightness:()=>nQ,blur:()=>mQ,batchSignUrls:()=>eZ,batch:()=>d8,autoFixA11yFile:()=>pK,autoFixA11yDirectory:()=>$V,autoFixA11y:()=>mK,auto:()=>ZG,assetTags:()=>hE,arrayOf:()=>YF,applyTranslations:()=>Q3,applyTransformations:()=>y4,applySlots:()=>Lq,applyPropDefaults:()=>eE,applyPreset:()=>XG,applyHead:()=>xU,applyFilters:()=>N9,apiCspPreset:()=>AU,animationGroupDirective:()=>C3,analyzeVideo:()=>x4,analyzeUsage:()=>QQ,analyzeTemplate:()=>Uj,analyzeProject:()=>UE,analyzeDirectiveUsage:()=>QQ,analyticsDirective:()=>FA,addStore:()=>Mk,addPage:()=>Rk,addNonceToInlineContent:()=>uA,addLayout:()=>Tk,addComponent:()=>wk,abortNavigation:()=>hI,a11yDirective:()=>E3,__setSignalsGeneratorsForTest:()=>EB,VideoProcessorCache:()=>Y7,TransitionType:()=>cK,TransitionEase:()=>iK,TransitionDirection:()=>lK,Tokenizer:()=>H4,TemplateTypeChecker:()=>TQ,TEMPLATE_PRESETS:()=>nD,StxValidationError:()=>q4,StxSyntaxError:()=>AY,StxSecurityError:()=>wY,StxRuntimeError:()=>k1,StxFileError:()=>h5,StxError:()=>V$,Show:()=>AL,SUSPENSE_RESOLVER_RUNTIME:()=>f2,SPRING_PRESETS:()=>xY,ProductionBuild:()=>sZ,Portal:()=>RL,PROJECT_TEMPLATES:()=>Fk,PRESETS:()=>aZ,MemorySessionStore:()=>IO,MIME_TYPES:()=>I4,MEDIA_DEFAULT_WIDTHS:()=>u1,MEDIA_DEFAULT_FORMATS:()=>Z$,ImageProcessorCache:()=>e5,ImageProcessingError:()=>d7,HydrationRuntime:()=>yQ,HotReloadServer:()=>LY,HeatmapAggregator:()=>uY,Fragment:()=>C5,For:()=>wL,ErrorLogger:()=>V3,ErrorCodes:()=>e,DeployError:()=>r$,DEFAULT_WIDTHS:()=>R1,DEFAULT_TRANSITION_OPTIONS:()=>d1,DEFAULT_QUALITY:()=>T1,DEFAULT_PLACEHOLDER_OPTIONS:()=>d3,DEFAULT_FORMATS:()=>M1,DEFAULT_DPR_VALUES:()=>T4,ComponentHMRHandler:()=>bQ,COMMON_SIZES:()=>sY,CLOAK_STYLE:()=>FR,BroadcastServer:()=>$H,Broadcast:()=>ej,BLUR_UP_CSS:()=>n5});var YC;var o$=D(()=>{D9();d9();A0();T2();G5();yO();hJ();fG();TL();EL();oX();m1();yL();hL();mL();Zj();x$();yZ();EJ();k3();_J();P3();O7();p7();VY();Dj();a9();bj();mj();dZ();H5();XH();i0();AJ();MJ();D9();jH();M4();EH();CH();hH();j1();qJ();n0();pH();x3();yJ();C7();nH();rH();y8();v3();gJ();L4();fZ();j6();F1();tH();JQ();ZO();C6();WO();m9();Q8();BO();v8();e9();wQ();c$();zO();nX();c2();J9();qO();OO();WJ();W5();FO();MO();EO();d9();tO();$L();c8();uJ();pJ();kL();A0();z9();lL();YC={}});import B3 from"path";var n7;var nZ=D(()=>{o$();j1();n0();U5();F1();n7={name:"bun-plugin-stx",async setup($){let Y={...await v0(),...$.config?.stx},X=new Set,J=Y.webComponents?.enabled?`./${B3.relative(B3.dirname($.config?.outdir||"dist"),Y.webComponents.outputDir||"dist/web-components")}`:"/web-components",Q=[];if(Y.webComponents?.enabled)try{let G=await cX(Y,X);if(Q.push(...G),Y.debug&&G.length>0)console.log(`Successfully built ${G.length} web components`)}catch(G){console.error("Failed to build web components:",G)}$.onLoad({filter:/\.stx$/},async({path:G})=>{try{let K=new Set;if(Y.cache&&Y.cachePath){let H=await n8(G,Y);if(H){if(Y.debug)console.log(`Using cached version of ${G}`);return{contents:H,loader:"html"}}}let W=await h1(()=>Bun.file(G).text(),"",(H)=>{throw new h5(`Failed to read stx file: ${G}`,G,void 0,void 0,`File read error: ${H.message}`)});if(!W)throw new h5(`stx file is empty: ${G}`,G);let{scriptContent:U,templateContent:B,allScripts:_}=A4.time("script-extraction",()=>{let H=W,O=W.match(/<template\b(?![^>]*\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=)[^>]*>([\s\S]*?)<\/template>/i);if(O)H=O[1].trim();let F=W.match(/<script\b[^>]*>[\s\S]*?<\/script>/gi)||[],L="",V=[];for(let A of F){let w=A.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i)?.[1]||"",R=A.match(/<script\b([^>]*)>/i),T=R?R[1]:"";if(/\bserver\b/i.test(T))L=w;else V.push(A)}let N=H.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"");return{scriptContent:L,templateContent:N,allScripts:V}}),z={__filename:G,__dirname:B3.dirname(G),__stx:{webComponentsPath:J,builtComponents:Q}};await h1(()=>D0(U,z,G),void 0,(H)=>{let O=new k1(`Script execution failed in ${G}: ${H.message}`,G,void 0,void 0,U.substring(0,100));if(o0.log(O,{filePath:G,scriptContent:U}),Y.debug)throw O});let j=await A4.timeAsync("directive-processing",async()=>{return await X0(B,z,G,Y,K)});if(_.length>0){let{interpolateScriptsInTemplate:H}=await Promise.resolve().then(() => (n0(),_6)),O=H(_.join(`
16275
16275
  `),z),F=j.search(/<\/body>/i);if(F!==-1)j=j.slice(0,F)+O+`
16276
16276
  `+j.slice(F);else j+=`
16277
16277
  ${O}`}if(j=await Q$(j),K.forEach((H)=>X.add(H)),Y.cache&&Y.cachePath){if(await s8(G,j,K,Y),Y.debug)console.log(`Cached template ${G} with ${K.size} dependencies`)}return{contents:j,loader:"html"}}catch(K){let W=K instanceof Error?K:new k1(`Plugin processing failed: ${String(K)}`,G);if(o0.log(W,{filePath:G,buildConfig:$.config}),d5.logDetailedError(W,{filePath:G,plugin:"bun-plugin-stx"}),Y.debug)console.error("stx Plugin Error:",W);let U=W,B=U.line||null,_=U.context||null;return{contents:Y.debug||F$()?`<!DOCTYPE html>
@@ -16339,4 +16339,4 @@ ${L.stack}</pre>`,{headers:{"Content-Type":"text/html"}})}});console.clear(),con
16339
16339
  ${M.blue}stx${M.reset} ${M.green}${process.env.stx_VERSION||"v0.0.10"}${M.reset} ${M.dim}ready in ${Math.random()*10+5|0}.${Math.random()*90+10|0} ms${M.reset}`),console.log(`
16340
16340
  ${M.bright}\u2192 ${M.cyan}http://localhost:${q}/${M.reset}`),console.log(`
16341
16341
  ${M.yellow}Routes:${M.reset}`);let F=Q1.relative(process.cwd(),K);if(console.log(` ${M.green}\u2514\u2500 /${M.reset} \u2192 ${M.bright}${F}${M.reset}`),console.log(`
16342
- Press ${M.cyan}h${M.reset} + ${M.cyan}Enter${M.reset} to show shortcuts`),t$(O.url.toString(),()=>{if(X)f1.watch(Q1.dirname(K),{recursive:!0}).close();O.stop()}),Z.native){let L=await Bun.file(K).text(),V=lZ(L);await l7(q,{title:Q1.basename(K,".stx"),titlebarHidden:Z.titlebarHidden===!0,nativeSidebar:!!V,sidebarConfig:V})}if(X){let L=Q1.dirname(K);console.log(`${M.blue}Watching ${M.bright}${L}${M.reset} for changes...`);let V=f1.watch(L,{recursive:!0},async(N,A)=>{if(!A||W4(A))return;if(K4(A)){console.log(`${M.yellow}File ${M.bright}${A}${M.yellow} changed, rebuilding...${M.reset}`),n$.clear(),i$();let w=await B();if(await h4(z),J&&Q)if(w)Q.reload(A);else Q.error("Build failed - check console for details")}else if(G4(A)){if(console.log(`${M.cyan}CSS ${M.bright}${A}${M.cyan} changed${M.reset}`),J&&Q)Q.updateCss(A)}});process.on("SIGINT",()=>{if(V.close(),Q)v5();O.stop(),process.exit(0)})}return!0}var OH=D(()=>{C7();nZ();N0();P6();_Q()});OH();export{HH as serveStxFile};
16342
+ Press ${M.cyan}h${M.reset} + ${M.cyan}Enter${M.reset} to show shortcuts`),t$(O.url.toString(),()=>{if(X)f1.watch(Q1.dirname(K),{recursive:!0}).close();O.stop()}),Z.native){let L=await Bun.file(K).text(),V=lZ(L);await l7(q,{title:Q1.basename(K,".stx"),titlebarHidden:Z.titlebarHidden===!0,nativeSidebar:!!V,sidebarConfig:V})}if(X){let L=Q1.dirname(K);console.log(`${M.blue}Watching ${M.bright}${L}${M.reset} for changes...`);let V=f1.watch(L,{recursive:!0},async(N,A)=>{if(!A||W4(A))return;if(K4(A)){console.log(`${M.yellow}File ${M.bright}${A}${M.yellow} changed, rebuilding...${M.reset}`),n$.clear(),i$();let w=await B();if(await h4(z),J&&Q)if(w)Q.reload(A);else Q.error("Build failed - check console for details")}else if(G4(A)){if(console.log(`${M.cyan}CSS ${M.bright}${A}${M.cyan} changed${M.reset}`),J&&Q)Q.updateCss(A)}});process.on("SIGINT",()=>{if(V.close(),Q)v5();O.stop(),process.exit(0)})}return!0}var OH=D(()=>{C7();nZ();A0();P6();_Q()});OH();export{HH as serveStxFile};