@stacksjs/stx 0.2.109 → 0.2.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pwa.js CHANGED
@@ -1830,11 +1830,11 @@ ${H}
1830
1830
  `),X)Q=Q.replace(/\n/g,`<br />
1831
1831
  `);for(let U=0;U<J.length;U++)Q=Q.replace(`\x00CODEBLOCK${U}\x00`,J[U]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function a0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1832
1832
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
1833
- `}),$}import tJ from"process";function l0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(tJ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var h1=()=>{};var $4={};o($4,{hasUserImports:()=>eJ,bundleClientScript:()=>ZQ});import j0 from"path";import x0 from"fs";function eJ($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=X.exec($))!==null){let G=Q[1];if(!J9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let J=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=J.exec($))!==null){let G=Q[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!J9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function $Q($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let U of W)try{if(x0.existsSync(U)&&x0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx|@stacksjs\/browser)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=j0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,j0.join(K,"index.ts"),j0.join(K,"index.tsx"),j0.join(K,"index.js"),j0.join(K,"index.mjs")];for(let W of q)if(x0.existsSync(W)&&x0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function ZQ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||W5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=j0.join(J,`${K}.js`),W=j0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let A=Bun.file(W),N=!0;if(await A.exists())try{let w=JSON.parse(await A.text());for(let T of w.files)try{if(x0.statSync(T.path).mtimeMs!==T.mtimeMs){N=!1;break}}catch{N=!1;break}}catch{N=!1}if(N)return console.log("[stx:bundler] cache hit:",K),await U.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=W5(X,"bundle-tmp"),B=j0.join(z,`${K}.ts`),_=j0.join(z,"out",K);x0.mkdirSync(z,{recursive:!0}),x0.mkdirSync(_,{recursive:!0});let j=j0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((A)=>{let N=A.split(":")[0].trim();if(N)H.push(N)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
1833
+ `}),$}import tJ from"process";function l0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(tJ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var h1=()=>{};var $4={};o($4,{hasUserImports:()=>eJ,bundleClientScript:()=>ZQ});import j0 from"path";import x0 from"fs";function eJ($){let Z=/^\s*import\s+(?!type\s)/gm;if(!$.match(Z))return!1;let X=/^\s*import\s+(?!type\s).*?\s+from\s+['"]([^'"]+)['"]/gm,Q;while((Q=X.exec($))!==null){let G=Q[1];if(!J9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected user import:",G),!0}let J=/^\s*import\s+['"]([^'"]+)['"]/gm;while((Q=J.exec($))!==null){let G=Q[1];if(/\.css(?:\?.*)?$/.test(G))continue;if(!J9.some((q)=>q.test(G)))return console.log("[stx:bundler] detected side-effect import:",G),!0}return!1}function $Q($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let U of W)try{if(x0.existsSync(U)&&x0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=j0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,j0.join(K,"index.ts"),j0.join(K,"index.tsx"),j0.join(K,"index.js"),j0.join(K,"index.mjs")];for(let W of q)if(x0.existsSync(W)&&x0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function ZQ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||W5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update($+Z);let K=G.digest("hex").slice(0,12),q=j0.join(J,`${K}.js`),W=j0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let A=Bun.file(W),N=!0;if(await A.exists())try{let w=JSON.parse(await A.text());for(let T of w.files)try{if(x0.statSync(T.path).mtimeMs!==T.mtimeMs){N=!1;break}}catch{N=!1;break}}catch{N=!1}if(N)return console.log("[stx:bundler] cache hit:",K),await U.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=W5(X,"bundle-tmp"),B=j0.join(z,`${K}.ts`),_=j0.join(z,"out",K);x0.mkdirSync(z,{recursive:!0}),x0.mkdirSync(_,{recursive:!0});let j=j0.dirname(Z),H=[],L=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,F=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=L.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((A)=>{let N=A.split(":")[0].trim();if(N)H.push(N)});else if(O[3])H.push(O[3])}while((O=F.exec($))!==null){if(O[1])continue;H.push(O[2])}let V=H.length>0?`
1834
1834
  export { ${H.join(", ")} }`:"";await Bun.write(B,$+V),console.log("[stx:bundler] bundling:",K,"from:",j0.basename(Z));let R=new Set;try{let A=await Bun.build({entrypoints:[B],outdir:_,target:"browser",format:"esm",minify:Q,plugins:[$Q(X,j,B,R)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...l0()},root:X});if(!A.success){let M=A.logs.filter((I)=>I.level==="error").map((I)=>I.message).join(", ");return console.warn("[stx:bundler] build failed:",M),$}let N="";for(let M of A.outputs){N=await M.text();break}let w=[];for(let M of N.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let I of M[1].split(",")){let D=I.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D&&D[1]!==D[2])w.push([D[2],D[1]])}if(N=N.replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim(),w.length>0){let M=w.map(([I,D])=>`${JSON.stringify(I)}: ${D}`).join(", ");N+=`
1835
1835
  var __stxScopeRenames = { ${M} };`}console.log("[stx:bundler] bundled:",K,"output:",N.length,"bytes"),x0.mkdirSync(J,{recursive:!0}),await Bun.write(q,N);let T=Array.from(R).map((M)=>{try{return{path:M,mtimeMs:x0.statSync(M).mtimeMs}}catch{return null}}).filter((M)=>M!==null);return await Bun.write(W,JSON.stringify({files:T})),N}catch(A){let N=A instanceof Error?A.message:String(A),w=A?.errors,T=Array.isArray(w)&&w.length>0?`
1836
1836
  ${w.map((M)=>`- ${M?.message??M}`).join(`
1837
- `)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{x0.rmSync(B,{force:!0}),x0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var J9;var Z4=b(()=>{h1();e5();J9=[/^stx$/,/^@stacksjs\/stx$/,/^@stacksjs\/browser$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var U9={};o(U9,{renderVendorStyleTags:()=>K9,processClientScript:()=>H5,generateServerDataBridge:()=>Y4,generateAutoImportDestructuring:()=>q9,extractBridgeData:()=>j5,extractAndStripCssImports:()=>G9});import O1 from"path";import _5 from"fs";function XQ($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function JQ($,Z){let Y=Z;while(!0){let X=O1.join(Y,"node_modules",$,"package.json");if(_5.existsSync(X))return O1.dirname(X);let Q=O1.dirname(Y);if(Q===Y)return null;Y=Q}}function QQ($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function GQ($,Z){let Y=XQ($);if(!Y||!Y.subpath)return null;let X=JQ(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(_5.readFileSync(O1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=QQ(Q.exports,J);if(!G)return null;let K=O1.resolve(X,G);return _5.existsSync(K)?K:null}function G9($,Z){let Y=Z.filePath?O1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(YQ,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:O1.resolve(Y,q),!_5.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=GQ(q,X)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(Q.has(W))return"";Q.add(W);try{let U=_5.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:J}}function KQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function K9($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${KQ(Z.source)}" data-stx-layer="vendor">
1837
+ `)}`:"";return console.warn(`[stx:bundler] error: ${N}${T}`),$}finally{try{x0.rmSync(B,{force:!0}),x0.rmSync(_,{recursive:!0,force:!0})}catch{}}}var J9;var Z4=b(()=>{h1();e5();J9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/]});var U9={};o(U9,{renderVendorStyleTags:()=>K9,processClientScript:()=>H5,generateServerDataBridge:()=>Y4,generateAutoImportDestructuring:()=>q9,extractBridgeData:()=>j5,extractAndStripCssImports:()=>G9});import O1 from"path";import _5 from"fs";function XQ($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function JQ($,Z){let Y=Z;while(!0){let X=O1.join(Y,"node_modules",$,"package.json");if(_5.existsSync(X))return O1.dirname(X);let Q=O1.dirname(Y);if(Q===Y)return null;Y=Q}}function QQ($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function GQ($,Z){let Y=XQ($);if(!Y||!Y.subpath)return null;let X=JQ(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(_5.readFileSync(O1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=QQ(Q.exports,J);if(!G)return null;let K=O1.resolve(X,G);return _5.existsSync(K)?K:null}function G9($,Z){let Y=Z.filePath?O1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(YQ,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:O1.resolve(Y,q),!_5.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=GQ(q,X)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(Q.has(W))return"";Q.add(W);try{let U=_5.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:J}}function KQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function K9($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${KQ(Z.source)}" data-stx-layer="vendor">
1838
1838
  @layer vendor {
1839
1839
  ${Z.contents}
1840
1840
  }
@@ -1920,7 +1920,7 @@ catch (e) {
1920
1920
  }
1921
1921
  throw e;
1922
1922
  }
1923
- `),K=G([]);if(J.length===Z.length)return W9(K,J,G);return W9((...W)=>{let U=Array(Q.length);for(let z=0;z<Q.length;z++)U[z]=W[Q[z]];return K(...U)},J,G,(W)=>{K=G(W)})}function W9($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let U=0;U<=8;U++)try{return G(...W)}catch(z){let B=z instanceof Error?z.message:"",_=J.exec(B);if(!(z instanceof ReferenceError)||!_)return;let j=_[1];if(q.has(j)||j9.has(j))return;q.add(j),K.push(j),G=Y(K),X?.(K)}return}}function J4($){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 RQ,z9,B9,AQ,_9,NQ,j9;var L0=b(()=>{RQ={maxSanitizeDepth:10,allowBracketNotation:!1},z9={...RQ},B9=[/\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/],AQ=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"]),_9=new Set(["__proto__","constructor","prototype"]),NQ=/[\w)\]]\s*\[\s*['"]/;j9=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 Q4($,Z){let Y=DQ++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return EQ.set(X,{type:$,expression:Z}),X}var DQ=0,EQ;var H9=b(()=>{EQ=new Map});function O9($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function G4($,Z){return O9($,Z,kQ,bQ)}function L9($,Z){return O9($,Z,SQ,yQ)}function F9($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function L5($,Z,Y){let X=[],Q="",J=0,G=$.length,K=!1,q=null;while(J<G){let W=$[J];if(K){if(Q+=W,q){if(W===q)q=null}else if(W==='"'||W==="'")q=W;else if(W===">")K=!1;J++;continue}if(W==="<"){let U=Z($,J);if(U>J){Q+=Y($.slice(J,U),X.length),X.push($.slice(J,U)),J=U;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))K=!0;Q+=W,J++;continue}Q+=W,J++}return{output:Q,tokens:X}}function c$($){let{output:Z,tokens:Y}=L5($,G4,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function i$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var kQ,bQ,SQ,yQ;var K4=b(()=>{kQ=/<script\b[^>]*>/iy,bQ=/<\/script\s*>/ig,SQ=/<style\b[^>]*>/iy,yQ=/<\/style\s*>/ig});var M9={};o(M9,{usesSignalsInScript:()=>d1,unescapeHtml:()=>n$,registerFilters:()=>CQ,registerFilter:()=>A9,processExpressions:()=>p0,interpolateScriptsInTemplate:()=>xQ,interpolateScriptExpressions:()=>w9,getAllFilters:()=>N9,evaluateExpression:()=>f0,escapeHtml:()=>h0,defaultFilters:()=>V5,clearCustomFilters:()=>vQ,applyFilters:()=>T9});function PQ($){let Z=V9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),V9.set($,Z)}return Z.lastIndex=0,Z}function A9($,Z){if($ in V5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);F5[$]=Z}function CQ($){for(let[Z,Y]of Object.entries($))A9(Z,Y)}function N9(){return{...V5,...F5}}function vQ(){for(let $ of Object.keys(F5))delete F5[$]}function h0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function d1($){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 R9($,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,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++;continue}if(U==="}"&&G>0){G--;continue}continue}Q+=U}X=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function w9($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=f0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=f0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function xQ($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,Q,J)=>{if(/\bsrc\s*=/.test(Q))return X;if(/\bdata-raw\b/.test(Q))return X;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return X;if(Y.skipServer&&/\bserver\b/.test(Q))return X;let G=w9(J,Z);return`<script${Q}>${G}</script>`})}function p0($,Z,Y,X){let Q=$,J=(U,z)=>{let B=L9(U,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(z,B))?-1:B},G=(U,z,B,_)=>{let j=B.length,{output:H,tokens:L}=L5(U,z,(F,O)=>_(j+O));return B.push(...L),H},K=[];Q=G(Q,J,K,(U)=>`<!--__STX_STYLE_${U}__-->`);let q=[];Q=G(Q,G4,q,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||d1($);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,z,B)=>{try{let _=f0(z,Z);return _!==void 0&&_!==null?String(_):""}catch(_){let j=_ instanceof Error?_.message:String(_);return G0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Y,$,B,U)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(U,z,B)=>{try{let _=f0(z,Z);if(_===void 0&&Z.__stx_buildMode==="compile")return Q4("raw",z.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if(Z.__stx_buildMode==="compile")return Q4("raw",z.trim());let j=_ instanceof Error?_.message:String(_);return G0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Y,$,B,U)}}),Q=G(Q,G4,q,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),Q=G(Q,J,K,(U)=>`<!--__STX_STYLE_${U}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(U,z,B)=>{let _=z.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=_.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=_.match(V),A=R&&!j.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(_))return"";try{let N=f0(z,Z);if(N===void 0&&W&&!R9(_,Z))return U;if(N===void 0&&Z.__stx_buildMode==="compile"&&!W)return Q4("expr",_);return N!==void 0&&N!==null?h0(String(N)):""}catch(N){if(W&&!R9(_,Z))return U;if(A)return U;let w=N instanceof Error?N.message:String(N);return G0("Expression",`Error evaluating: {{ ${_} }}: ${w}`,Y,$,B,U)}});for(let U=0;U<q.length;U++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>q[U]);for(let U=0;U<K.length;U++)Q=Q.replace(`<!--__STX_STYLE_${U}__-->`,()=>K[U]);return Q}function T9($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=F5[G]||V5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(N9()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let z=Number(U);q=[Number.isNaN(z)?U:z]}catch{q=[U]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,U=1;while(W>0&&U<Q.length){if(Q[U]==="(")W++;if(Q[U]===")")W--;U++}if(W===0){let z=Q.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[f0(`(${z})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let R=z[V];if(O){_+=R,O=!1;continue}if(R==="\\"){_+=R,O=!0;continue}if(j){if(_+=R,R===j)j=null;continue}if(R==='"'||R==="'"||R==="`"){j=R,_+=R;continue}if(R==="(")H++;else if(R===")")H--;else if(R==="[")L++;else if(R==="]")L--;else if(R==="{")F++;else if(R==="}")F--;if(R===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=R}if(_)B.push(_);q=B.map((V)=>{let R=V.trim();return f0(R,Y,!0)})}}catch{q=[z]}Q=Q.substring(U).trim()}}try{X=K(X,Y,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function fQ($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function f0($,Z,Y=!1){try{let X=$.trim(),Q=fQ(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=f0(J,Z,!0);return T9(K,G,Z)}if(!X0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return $0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return J0(X,J)(...G)}catch{return $0(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=gQ(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function gQ($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=hQ($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}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 hQ($,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,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function n$($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var F5,V9,V5;var c0=b(()=>{L0();H0();H9();K4();F5={},V9=new Map;V5={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 h0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(PQ(q),String(W))}),K},t:($,Z,Y={})=>{return V5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={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 Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},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 Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"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 Q=10**Y;return Math.round(X*Q)/Q}}});class R5{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 u1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!m1.has(Y)){if(m1.size>=dQ){let X=m1.keys().next().value;if(X)m1.delete(X)}m1.set(Y,new RegExp($,Z))}return m1.get(Y)}class I9{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 Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,U=Q.get(W);if(!U){if(Q.size>=J){let z=Q.keys().next().value;if(z)Q.delete(z)}U=Function(...Z,`
1923
+ `),K=G([]);if(J.length===Z.length)return W9(K,J,G);return W9((...W)=>{let U=Array(Q.length);for(let z=0;z<Q.length;z++)U[z]=W[Q[z]];return K(...U)},J,G,(W)=>{K=G(W)})}function W9($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let U=0;U<=8;U++)try{return G(...W)}catch(z){let B=z instanceof Error?z.message:"",_=J.exec(B);if(!(z instanceof ReferenceError)||!_)return;let j=_[1];if(q.has(j)||j9.has(j))return;q.add(j),K.push(j),G=Y(K),X?.(K)}return}}function J4($){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 RQ,z9,B9,AQ,_9,NQ,j9;var L0=b(()=>{RQ={maxSanitizeDepth:10,allowBracketNotation:!1},z9={...RQ},B9=[/\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/],AQ=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"]),_9=new Set(["__proto__","constructor","prototype"]),NQ=/[\w)\]]\s*\[\s*['"]/;j9=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 Q4($,Z){let Y=DQ++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return EQ.set(X,{type:$,expression:Z}),X}var DQ=0,EQ;var H9=b(()=>{EQ=new Map});function O9($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function G4($,Z){return O9($,Z,kQ,bQ)}function L9($,Z){return O9($,Z,SQ,yQ)}function F9($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function L5($,Z,Y){let X=[],Q="",J=0,G=$.length,K=!1,q=null;while(J<G){let W=$[J];if(K){if(Q+=W,q){if(W===q)q=null}else if(W==='"'||W==="'")q=W;else if(W===">")K=!1;J++;continue}if(W==="<"){let U=Z($,J);if(U>J){Q+=Y($.slice(J,U),X.length),X.push($.slice(J,U)),J=U;continue}if(/^<\/?[a-zA-Z]/.test($.slice(J,J+2)))K=!0;Q+=W,J++;continue}Q+=W,J++}return{output:Q,tokens:X}}function c$($){let{output:Z,tokens:Y}=L5($,G4,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function i$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var kQ,bQ,SQ,yQ;var K4=b(()=>{kQ=/<script\b[^>]*>/iy,bQ=/<\/script\s*>/ig,SQ=/<style\b[^>]*>/iy,yQ=/<\/style\s*>/ig});var M9={};o(M9,{usesSignalsInScript:()=>d1,unescapeHtml:()=>n$,registerFilters:()=>CQ,registerFilter:()=>A9,processExpressions:()=>p0,interpolateScriptsInTemplate:()=>xQ,interpolateScriptExpressions:()=>w9,getAllFilters:()=>N9,evaluateExpression:()=>f0,escapeHtml:()=>h0,defaultFilters:()=>V5,clearCustomFilters:()=>vQ,applyFilters:()=>T9});function PQ($){let Z=V9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),V9.set($,Z)}return Z.lastIndex=0,Z}function A9($,Z){if($ in V5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);F5[$]=Z}function CQ($){for(let[Z,Y]of Object.entries($))A9(Z,Y)}function N9(){return{...V5,...F5}}function vQ(){for(let $ of Object.keys(F5))delete F5[$]}function h0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function d1($){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 R9($,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,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Q+=U;continue}continue}Q+=U}X=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function w9($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=f0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=f0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function xQ($,Z,Y={}){return $.replace(/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,(X,Q,J)=>{if(/\bsrc\s*=/.test(Q))return X;if(/\bdata-raw\b/.test(Q))return X;if(/\btype\s*=\s*["']application\/json["']/.test(Q))return X;if(Y.skipServer&&/\bserver\b/.test(Q))return X;let G=w9(J,Z);return`<script${Q}>${G}</script>`})}function p0($,Z,Y,X){let Q=$,J=(U,z)=>{let B=L9(U,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(z,B))?-1:B},G=(U,z,B,_)=>{let j=B.length,{output:H,tokens:L}=L5(U,z,(F,O)=>_(j+O));return B.push(...L),H},K=[];Q=G(Q,J,K,(U)=>`<!--__STX_STYLE_${U}__-->`);let q=[];Q=G(Q,G4,q,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||d1($);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,z,B)=>{try{let _=f0(z,Z);return _!==void 0&&_!==null?String(_):""}catch(_){let j=_ instanceof Error?_.message:String(_);return G0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${j}`,Y,$,B,U)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(U,z,B)=>{try{let _=f0(z,Z);if(_===void 0&&Z.__stx_buildMode==="compile")return Q4("raw",z.trim());return _!==void 0&&_!==null?String(_):""}catch(_){if(Z.__stx_buildMode==="compile")return Q4("raw",z.trim());let j=_ instanceof Error?_.message:String(_);return G0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${j}`,Y,$,B,U)}}),Q=G(Q,G4,q,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),Q=G(Q,J,K,(U)=>`<!--__STX_STYLE_${U}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(U,z,B)=>{let _=z.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=_.match(H)?.[1],O=F&&((F in Z)||j.includes(F)),V=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=_.match(V),A=R&&!j.includes(R[1])&&!(R[1]in Z);if(/^__[A-Z_]+__$/.test(_))return"";try{let N=f0(z,Z);if(W&&!R9(_,Z))return U;if(N===void 0&&Z.__stx_buildMode==="compile"&&!W)return Q4("expr",_);return N!==void 0&&N!==null?h0(String(N)):""}catch(N){if(W&&!R9(_,Z))return U;if(A)return U;let w=N instanceof Error?N.message:String(N);return G0("Expression",`Error evaluating: {{ ${_} }}: ${w}`,Y,$,B,U)}});for(let U=0;U<q.length;U++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>q[U]);for(let U=0;U<K.length;U++)Q=Q.replace(`<!--__STX_STYLE_${U}__-->`,()=>K[U]);return Q}function T9($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=F5[G]||V5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(N9()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let z=Number(U);q=[Number.isNaN(z)?U:z]}catch{q=[U]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,U=1;while(W>0&&U<Q.length){if(Q[U]==="(")W++;if(Q[U]===")")W--;U++}if(W===0){let z=Q.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[f0(`(${z})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let R=z[V];if(O){_+=R,O=!1;continue}if(R==="\\"){_+=R,O=!0;continue}if(j){if(_+=R,R===j)j=null;continue}if(R==='"'||R==="'"||R==="`"){j=R,_+=R;continue}if(R==="(")H++;else if(R===")")H--;else if(R==="[")L++;else if(R==="]")L--;else if(R==="{")F++;else if(R==="}")F--;if(R===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=R}if(_)B.push(_);q=B.map((V)=>{let R=V.trim();return f0(R,Y,!0)})}}catch{q=[z]}Q=Q.substring(U).trim()}}try{X=K(X,Y,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function fQ($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function f0($,Z,Y=!1){try{let X=$.trim(),Q=fQ(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=f0(J,Z,!0);return T9(K,G,Z)}if(!X0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return $0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return J0(X,J)(...G)}catch{return $0(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=gQ(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function gQ($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=hQ($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}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 hQ($,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,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function n$($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var F5,V9,V5;var c0=b(()=>{L0();H0();H9();K4();F5={},V9=new Map;V5={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 h0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(PQ(q),String(W))}),K},t:($,Z,Y={})=>{return V5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={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 Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},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 Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"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 Q=10**Y;return Math.round(X*Q)/Q}}});class R5{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 u1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!m1.has(Y)){if(m1.size>=dQ){let X=m1.keys().next().value;if(X)m1.delete(X)}m1.set(Y,new RegExp($,Z))}return m1.get(Y)}class I9{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 Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,U=Q.get(W);if(!U){if(Q.size>=J){let z=Q.keys().next().value;if(z)Q.delete(z)}U=Function(...Z,`
1924
1924
  'use strict';
1925
1925
  try {
1926
1926
  return ${q};
@@ -1931,7 +1931,7 @@ catch (e) {
1931
1931
  }
1932
1932
  throw e;
1933
1933
  }
1934
- `),Q.set(W,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class D9{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function mQ(){if(!o$)o$=new D9;return o$}var m1,dQ=500,s_,o$=null,E9;var l1=b(()=>{m1=new Map;s_=new I9;E9=new Proxy({},{get($,Z){return mQ()[Z]}})});function k9($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function b9($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=s$($),q=[],W=new Map;if(J)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let B=z[1],_=`${Z}_${B}`;W.set(B,_)}}for(let U of K){let z=S9(U,Z,X,Q,W,G);q.push(z)}return q.join(`
1934
+ `),Q.set(W,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class D9{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function mQ(){if(!o$)o$=new D9;return o$}var m1,dQ=500,r_,o$=null,E9;var l1=b(()=>{m1=new Map;r_=new I9;E9=new Proxy({},{get($,Z){return mQ()[Z]}})});function k9($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function b9($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=s$($),q=[],W=new Map;if(J)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let B=z[1],_=`${Z}_${B}`;W.set(B,_)}}for(let U of K){let z=S9(U,Z,X,Q,W,G);q.push(z)}return q.join(`
1935
1935
 
1936
1936
  `)}function s$($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,U,z,B]=W;if(U==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:B.trim()});else if(U==="media"||U==="supports"||U==="container"){let _=s$(B);Z.push({selector:`@${U} ${z.trim()}`,declarations:_.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
1937
1937
  `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:B.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function S9($,Z,Y,X,Q,J){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(U)||U} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=s$(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>S9(B,Z,Y,X,Q,J)).join(`
@@ -2052,7 +2052,7 @@ ${a.dim}${K}${a.reset}
2052
2052
  filter: blur(0);
2053
2053
  transform: scale(1);
2054
2054
  }
2055
- `.trim();z7=new Map});import{createHash as Y8}from"crypto";import{readFile as fG,stat as X8}from"fs/promises";async function A0($){try{let Z=await fG($);return Y8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function Z8($){return Y8("sha256").update($).digest("hex").slice(0,16)}function H4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${Z8($)}-${Z8(Y)}`}async function _7($){try{return(await X8($)).mtimeMs}catch{return 0}}async function R0($){try{return await X8($),!0}catch{return!1}}var w1=()=>{};import{mkdir as gG,readFile as hG,writeFile as dG,readdir as gj,rm as mG,stat as hj}from"fs/promises";import{join as Q8,dirname as uG}from"path";async function lG($){try{await gG($,{recursive:!0})}catch{}}function G8($,Z,Y){return Q8($,Y,`${Z}.json`)}async function J8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await _7(Z)!==$.srcMtime)return!1;return!0}async function O4($,Z,Y,X=j7){if(!X.enabled)return null;let Q=H4($,Z),J=i1.get(Q);if(J){if(await J8(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;i1.delete(Q)}let G=G8(X.directory,Q,Y);if(await R0(G))try{let K=await hG(G,"utf-8"),q=JSON.parse(K);if(await J8(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),i1.set(Q,q),q.data}catch{}return null}async function L4($,Z,Y,X,Q=j7){if(!Q.enabled)return;let J=H4($,Z),G=await A0($),K=await _7($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:H4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};i1.set(J,q);let W=G8(Q.directory,J,X);try{await lG(uG(W)),await dG(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function F4($,Z=j7){if($==="all")i1.clear();else i1.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=Q8(Z.directory,X);try{await mG(Q,{recursive:!0,force:!0})}catch{}}}var i1,j7;var H7=b(()=>{w1();i1=new Map,j7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class R4{config;constructor($={}){this.config={...pG,...$}}async get($,Z){return O4($,Z,"image",this.config)}async set($,Z,Y){return L4($,Z,Y,"image",this.config)}async clear(){return F4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function O7($){if(!V4)V4=new R4($);else if($)V4.updateConfig($);return V4}async function A4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return O7(X).get($,Z)}async function N4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return O7(Q).set($,Z,Y)}async function K8(){return O7().clear()}var pG,V4=null;var L7=b(()=>{H7();pG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as cG,basename as iG,extname as nG,join as oG}from"path";import{mkdir as sG}from"fs/promises";async function F7(){try{return await import("ts-images")}catch{return null}}function q8($){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 rG($,Z){let Y=Z?q8(Z):q8("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 U8($,Z,Y){let X=await F7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await A4($,Z,Y);if(Q)return Q;try{let J=cG($);if(!await R0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=rG(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await sG(K,{recursive:!0});let W=await A0(J),U=iG($,nG($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:W},_=null;if(Z.transformations&&Z.transformations.length>0)_=await V7(J,Z.transformations,X);for(let j of z){let H=G[j]||{},L=`${U}-${W}.${j}`,F=oG(K,L);try{let O=await X.optimizeImage({input:_||J,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(J);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await N4($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function W8($,Z,Y,X){let Q=await F7();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function V7($,Z,Y){let X=Y||await F7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var z8=b(()=>{w1();L7()});import{resolve as aG,basename as tG,extname as eG,join as $K}from"path";import{mkdir as ZK}from"fs/promises";async function YK(){try{return await import("ts-images")}catch{return null}}async function B8($,Z,Y){let X=await YK();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=aG($);if(!await R0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||XK,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await ZK(K,{recursive:!0});let W=await A0(Q),U=tG($,eG($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of J){let F=`${U}-${L}w-${W}.${j}`,O=$K(K,F),V=`${q}/${F}`;try{let R=z[j]?.quality||80;if(await R0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await X.processImage({input:Q,output:O,format:j,quality:R,resize:{width:L}});if(A)B.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(R){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${R}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await X.generateThumbHash(Q);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(Q,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||JK(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function JK($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function _8($,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 XK;var j8=b(()=>{w1();XK=[320,480,640,768,1024,1280,1536,1920]});var H8={};o(H8,{setCachedImageResult:()=>N4,processImage:()=>U8,optimizeImage:()=>W8,getCachedImageResult:()=>A4,generateSrcset:()=>_8,generateResponsiveVariants:()=>B8,clearImageCache:()=>K8,applyTransformations:()=>V7,ImageProcessorCache:()=>R4});var O8=b(()=>{z8();j8();L7()});async function QK(){try{return await Promise.resolve().then(() => (O8(),H8))}catch($){if(!L8)console.warn("[stx-media] Image processor not available, some features disabled:",$),L8=!0;return null}}async function w4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return UK(X,Y)}if(Y.processedResult?.processed)return w7($,Y.processedResult,Z);if(Y.responsiveVariants)return A8($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=c1,dpr:U,formats:z=M5,quality:B=R7,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":M4,decoding:V=T4,fetchpriority:R,objectFit:A,objectPosition:N,crossorigin:w,referrerpolicy:T}=$,M=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:C=!1,baseUrl:S=""}=Z;if(C&&!Z.optimize)return qK($);let k,P,d=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{k=await e9(Q,{strategy:j,...H}),P=t9(d,k,H)}catch{}let g=U!==void 0&&G!==void 0,m;if(g)m=KK($,d,k,Z);else m=await GK($,d,k,Z);let s;if(F){let P0=z.includes("webp")?"webp":z[0],T0=K7(Q,W,{..._,q:B},P0),e=typeof q==="object"?q7(q):q||"100vw";s=`<link rel="preload" as="image" imagesrcset="${T0}" imagesizes="${e}" />`}let Z0=[];if(!F8&&j!=="none")Z0.push(B7),F8=!0;if(P)Z0.push(P);let o0=L?R8(d):void 0;return{html:m,preloadLink:s,css:Z0.length>0?Z0.join(`
2055
+ `.trim();z7=new Map});import{createHash as Y8}from"crypto";import{readFile as fG,stat as X8}from"fs/promises";async function A0($){try{let Z=await fG($);return Y8("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function Z8($){return Y8("sha256").update($).digest("hex").slice(0,16)}function H4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${Z8($)}-${Z8(Y)}`}async function _7($){try{return(await X8($)).mtimeMs}catch{return 0}}async function R0($){try{return await X8($),!0}catch{return!1}}var w1=()=>{};import{mkdir as gG,readFile as hG,writeFile as dG,readdir as hj,rm as mG,stat as dj}from"fs/promises";import{join as Q8,dirname as uG}from"path";async function lG($){try{await gG($,{recursive:!0})}catch{}}function G8($,Z,Y){return Q8($,Y,`${Z}.json`)}async function J8($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await _7(Z)!==$.srcMtime)return!1;return!0}async function O4($,Z,Y,X=j7){if(!X.enabled)return null;let Q=H4($,Z),J=i1.get(Q);if(J){if(await J8(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;i1.delete(Q)}let G=G8(X.directory,Q,Y);if(await R0(G))try{let K=await hG(G,"utf-8"),q=JSON.parse(K);if(await J8(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),i1.set(Q,q),q.data}catch{}return null}async function L4($,Z,Y,X,Q=j7){if(!Q.enabled)return;let J=H4($,Z),G=await A0($),K=await _7($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:H4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};i1.set(J,q);let W=G8(Q.directory,J,X);try{await lG(uG(W)),await dG(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function F4($,Z=j7){if($==="all")i1.clear();else i1.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=Q8(Z.directory,X);try{await mG(Q,{recursive:!0,force:!0})}catch{}}}var i1,j7;var H7=b(()=>{w1();i1=new Map,j7={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class R4{config;constructor($={}){this.config={...pG,...$}}async get($,Z){return O4($,Z,"image",this.config)}async set($,Z,Y){return L4($,Z,Y,"image",this.config)}async clear(){return F4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function O7($){if(!V4)V4=new R4($);else if($)V4.updateConfig($);return V4}async function A4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return O7(X).get($,Z)}async function N4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return O7(Q).set($,Z,Y)}async function K8(){return O7().clear()}var pG,V4=null;var L7=b(()=>{H7();pG={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as cG,basename as iG,extname as nG,join as oG}from"path";import{mkdir as sG}from"fs/promises";async function F7(){try{return await import("ts-images")}catch{return null}}function q8($){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 rG($,Z){let Y=Z?q8(Z):q8("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 U8($,Z,Y){let X=await F7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await A4($,Z,Y);if(Q)return Q;try{let J=cG($);if(!await R0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=rG(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await sG(K,{recursive:!0});let W=await A0(J),U=iG($,nG($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:W},_=null;if(Z.transformations&&Z.transformations.length>0)_=await V7(J,Z.transformations,X);for(let j of z){let H=G[j]||{},L=`${U}-${W}.${j}`,F=oG(K,L);try{let O=await X.optimizeImage({input:_||J,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(J);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await N4($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function W8($,Z,Y,X){let Q=await F7();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function V7($,Z,Y){let X=Y||await F7();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var z8=b(()=>{w1();L7()});import{resolve as aG,basename as tG,extname as eG,join as $K}from"path";import{mkdir as ZK}from"fs/promises";async function YK(){try{return await import("ts-images")}catch{return null}}async function B8($,Z,Y){let X=await YK();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=aG($);if(!await R0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||XK,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await ZK(K,{recursive:!0});let W=await A0(Q),U=tG($,eG($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of J){let F=`${U}-${L}w-${W}.${j}`,O=$K(K,F),V=`${q}/${F}`;try{let R=z[j]?.quality||80;if(await R0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await X.processImage({input:Q,output:O,format:j,quality:R,resize:{width:L}});if(A)B.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(R){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${R}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await X.generateThumbHash(Q);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(Q,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||JK(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function JK($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function _8($,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 XK;var j8=b(()=>{w1();XK=[320,480,640,768,1024,1280,1536,1920]});var H8={};o(H8,{setCachedImageResult:()=>N4,processImage:()=>U8,optimizeImage:()=>W8,getCachedImageResult:()=>A4,generateSrcset:()=>_8,generateResponsiveVariants:()=>B8,clearImageCache:()=>K8,applyTransformations:()=>V7,ImageProcessorCache:()=>R4});var O8=b(()=>{z8();j8();L7()});async function QK(){try{return await Promise.resolve().then(() => (O8(),H8))}catch($){if(!L8)console.warn("[stx-media] Image processor not available, some features disabled:",$),L8=!0;return null}}async function w4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return UK(X,Y)}if(Y.processedResult?.processed)return w7($,Y.processedResult,Z);if(Y.responsiveVariants)return A8($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=c1,dpr:U,formats:z=M5,quality:B=R7,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":M4,decoding:V=T4,fetchpriority:R,objectFit:A,objectPosition:N,crossorigin:w,referrerpolicy:T}=$,M=$.class,I=$.style,D=$.id,E=$.data||{},{isDev:C=!1,baseUrl:S=""}=Z;if(C&&!Z.optimize)return qK($);let k,P,d=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{k=await e9(Q,{strategy:j,...H}),P=t9(d,k,H)}catch{}let g=U!==void 0&&G!==void 0,m;if(g)m=KK($,d,k,Z);else m=await GK($,d,k,Z);let s;if(F){let P0=z.includes("webp")?"webp":z[0],T0=K7(Q,W,{..._,q:B},P0),e=typeof q==="object"?q7(q):q||"100vw";s=`<link rel="preload" as="image" imagesrcset="${T0}" imagesizes="${e}" />`}let Z0=[];if(!F8&&j!=="none")Z0.push(B7),F8=!0;if(P)Z0.push(P);let o0=L?R8(d):void 0;return{html:m,preloadLink:s,css:Z0.length>0?Z0.join(`
2056
2056
  `):void 0,script:o0}}async function GK($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=c1,formats:U=M5,quality:z=R7,params:B={},lazy:_=!0,priority:j=!1,loading:H=j?"eager":M4,decoding:L=T4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:R,referrerpolicy:A}=$,N=$.class,w=$.style,T=$.data||{},M=typeof q==="object"?q7(q):q||"100vw",I=[];for(let C of U){let S=K7(Q,W,{...B,q:z},C),k=U7(C);if(_&&!j)I.push(` <source type="${k}" data-srcset="${S}" data-sizes="${M}" />`);else I.push(` <source type="${k}" srcset="${S}" sizes="${M}" />`)}let D=A7({src:I5(Q,{...B,q:z}),alt:J,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:R,referrerpolicy:A,className:V8(N,Y),style:N7(w,O,V,Y),lazy:_&&!j,data:T}),E;if(Y){let C=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;E=`<div id="${Z}" class="stx-img-placeholder" style="${C}">
2057
2057
  <picture>
2058
2058
  ${I.join(`
@@ -2701,7 +2701,7 @@ catch (error) {
2701
2701
  init();
2702
2702
  }
2703
2703
  })();
2704
- </script>`}function gH($){return[...$,...f7]}var xK,fK,gK,hK,f7;var g7=b(()=>{xK={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return yK($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},fK={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return PK($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},gK={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return CK($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},hK={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return vK($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},f7=[xK,fK,gK,hK]});function h7($){for(let[Z,Y]of Object.entries(n))if(Y===$)return Z;return}var n;var f4=b(()=>{n={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 D5(){return!1}function E5(){return!D5()||process.env.STX_DEBUG==="true"}function g4(){return!1}import dK from"path";function h4(){return{...d7}}function d4($){if(!d7.showRelativePaths||!$)return $;let Z=d7.baseDir||process.cwd();try{let Y=dK.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var mK,d7,m4,M1,u4;var l4=b(()=>{f4();mK={showRelativePaths:!1,enableAutoRecovery:E5(),logRecoveryWarnings:!0},d7={...mK};m4=class m4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||n.EVALUATION_ERROR,this.filePath)this.filePath=d4(this.filePath)}};M1=class M1 extends m4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||n.EVALUATION_ERROR);this.name="StxRuntimeError"}};u4=class u4 extends m4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||n.DOM_API_VIOLATION);this.name="StxValidationError"}}});function r8($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,B=J,_=G;if(!B&&K&&q!==void 0){let O=nK(K,q);B=O.line,_=O.column}let j=Q?d4(Q):void 0,H=X?h7(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:j,line:B,column:_,snippet:W,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=lK(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=pK(L,K,q);break;case"text":default:F=uK(L,K,q);break}return{formatted:F,data:L}}function uK($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
2704
+ </script>`}function hH($){return[...$,...f7]}var xK,fK,gK,hK,f7;var g7=b(()=>{xK={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return yK($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},fK={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return PK($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},gK={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return CK($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},hK={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return vK($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},f7=[xK,fK,gK,hK]});function h7($){for(let[Z,Y]of Object.entries(n))if(Y===$)return Z;return}var n;var f4=b(()=>{n={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 D5(){return!1}function E5(){return!D5()||process.env.STX_DEBUG==="true"}function g4(){return!1}import dK from"path";function h4(){return{...d7}}function d4($){if(!d7.showRelativePaths||!$)return $;let Z=d7.baseDir||process.cwd();try{let Y=dK.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var mK,d7,m4,M1,u4;var l4=b(()=>{f4();mK={showRelativePaths:!1,enableAutoRecovery:E5(),logRecoveryWarnings:!0},d7={...mK};m4=class m4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||n.EVALUATION_ERROR,this.filePath)this.filePath=d4(this.filePath)}};M1=class M1 extends m4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||n.EVALUATION_ERROR);this.name="StxRuntimeError"}};u4=class u4 extends m4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||n.DOM_API_VIOLATION);this.name="StxValidationError"}}});function r8($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,B=J,_=G;if(!B&&K&&q!==void 0){let O=nK(K,q);B=O.line,_=O.column}let j=Q?d4(Q):void 0,H=X?h7(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:j,line:B,column:_,snippet:W,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=lK(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=pK(L,K,q);break;case"text":default:F=uK(L,K,q);break}return{formatted:F,data:L}}function uK($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
2705
2705
  ${$.message}`),Z&&$.line){let J=cK(Z,$.line,2);if(J)X.push(`
2706
2706
  ${J}`)}if($.snippet)X.push(`
2707
2707
  Snippet: ${$.snippet}`);if($.suggestion)X.push(`
@@ -3170,7 +3170,7 @@ else {
3170
3170
 
3171
3171
  console.log('[stx] Lifecycle runtime initialized');
3172
3172
  })();
3173
- `}function a7($){return Symbol($)}var $L,ZL,YL;var FZ=b(()=>{$L=a7("theme"),ZL=a7("router"),YL=a7("i18n")});import*as RZ from"crypto";function VZ($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function Oq(){return`stx-${RZ.randomBytes(4).toString("hex")}`}function Lq($){return/\$\w+\./.test($)}function Fq($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],U=!1,z=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(Lq(V)){U=!0;let R=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(R){let A=R[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),VZ(A).forEach((w)=>Y.add(w)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!U)return J;let j=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=Oq(),z=` id="${H}"${z}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:VZ(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function Vq($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
3173
+ `}function a7($){return Symbol($)}var ZL,YL,XL;var FZ=b(()=>{ZL=a7("theme"),YL=a7("router"),XL=a7("i18n")});import*as RZ from"crypto";function VZ($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function Oq(){return`stx-${RZ.randomBytes(4).toString("hex")}`}function Lq($){return/\$\w+\./.test($)}function Fq($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],U=!1,z=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(Lq(V)){U=!0;let R=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(R){let A=R[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),VZ(A).forEach((w)=>Y.add(w)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!U)return J;let j=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=Oq(),z=` id="${H}"${z}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:VZ(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function Vq($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
3174
3174
  <script>
3175
3175
  (function() {
3176
3176
  'use strict';
@@ -3710,11 +3710,11 @@ window.__stx_reactive = (function() {
3710
3710
  ${fq()}
3711
3711
  ${Y}
3712
3712
  </script>`}function vZ($,Z,Y){if(CZ=0,!dq($))return $;let X=Pq($);if(X.length===0)return $;let Q=hq($,X),J=gq(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
3713
- `+Q.slice(G);else Q+=J;return Q}function hq($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${o4(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${o4(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*"${o4(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*'${o4(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 dq($){return/x-data\s*=\s*["']/.test($)}var CZ=0,yq=0;var xZ=b(()=>{c0()});import mq from"fs";import t7 from"path";import{createHighlighter as uq}from"ts-syntax-highlighter";async function lq($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let X=(await mq.promises.stat($)).mtime.getTime();if(Z.cache&&e7.has($)){let z=e7.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=X9(Q),K=Z.markdown||n7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=B5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await pq(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)e7.set($,{...U,updatedAt:X});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:G0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function pq($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!s4)try{s4=await uq({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=W||(Y?"text":"");if(!B)return K;try{if(!s4.getSupportedLanguages().includes(B))return K;return(await s4.highlight(z,B,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,U,z]=K,B=await Q(q,W,U,z);J=J.replace(q,B)}return J}async function fZ($,Z,Y="",X={}){return await cq($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!t7.isAbsolute(K))U=t7.resolve(t7.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let R=V.indexOf(":");if(R>0){let A=V.substring(0,R).trim(),N=V.substring(R+1).trim(),w=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(w||T)N=N.substring(1,N.length-1);z[A]=N}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:_}=await lq(U,X),j={...Z,..._,...z},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(U){let z=U instanceof Error?U.message:String(U);return G0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function cq($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).then((U)=>({match:K,replacement:U,index:q})))}let J=await Promise.all(X);J.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of J)G=G.replace(K,()=>q);return G}var e7,s4=null;var gZ=b(()=>{b5();H0();e7=new Map});function J1($,Z){try{let Y=$.trim();if(X0(Y))return J0(Y,Object.keys(Z))(...Object.values(Z));else return $0(Y,Z)}catch{return!1}}var hZ=b(()=>{L0()});function Q1($,Z){let Y=iq($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function iq($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=D0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function E1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),W=K.exec($),U=q?q.index:1/0,z=W?W.index:1/0;if(U<z)Q++,J=U+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;J=z+W[0].length}else break}return-1}function dZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=Q1($,X);if(!Q)return null;let J=Q.endPos,G=E1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,B=0,_=0;while(W<K.length){let j=K.indexOf("@",W);if(j===-1)break;W=j;let H=K.substring(j);if(/^@if\s*\(/.test(H)){_++,W++;continue}if(/^@endif(?![a-z])/.test(H)){_--,W+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W});let F=W+L[0].length,O=Q1(K,F);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,B=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W}),U="else",z=void 0,W+=5,B=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function y5($){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 J=dZ($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function r4($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,W=D0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,B=E1($,Z,Y,z);if(B===-1){J=Q.exec($);continue}let _=$.slice(z,B),j=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:U,content:_,start:K,end:j}),Q.lastIndex=j,J=Q.exec($)}return X}function $3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=Q1($,X);if(!Q)return null;let J=Q.endPos,G=E1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U=null,z=0;while(W<K.length){let B=K.slice(W),_=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(_){if(z++,U)U.content+=_[0];W+=_[0].length;continue}if(j){if(z--,U)U.content+=j[0];W+=j[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=Q1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=L[0].length}else if(F&&B.startsWith("@break"))W+=F[0].length;else{if(U)U.content+=K[W];W++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var mZ=()=>{};var uZ=()=>{};var a4=b(()=>{mZ();uZ()});function rq($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=$3(X,G);if(!K)break;try{let q;if(X0(K.expression))q=J0(K.expression,Object.keys(Z))(...Object.values(Z));else q=$0(K.expression,Z);let W="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)W=z.content.trim()}else try{let B;if(z.value&&X0(z.value))B=J0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)B=$0(z.value,Z);if(q===B){W=z.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=t("Switch",`Error evaluating @switch expression: ${W}`,n.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function k1($,Z,Y){let X=$;X=rq(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=Q1(X,K+7);if(!q)break;let W=q.endPos,U=E1(X,"unless","endunless",W);if(U===-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 z=X.slice(W,U),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],R;while((R=L.exec(z))!==null)V.push({pos:R.index,type:"open"});while((R=F.exec(z))!==null)V.push({pos:R.index,type:"close"});while((R=O.exec(z))!==null)V.push({pos:R.index,type:"else"});V.sort((A,N)=>A.pos-N.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){_=A.pos;break}}let j;if(_!==-1){let H=z.slice(0,_),L=z.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${z}@endif`;X=X.substring(0,K)+j+X.substring(U+10),J=!0}}X=Y3(X,Z,Y),X=X3(X,Z,Y),X=Z3(X,Z);let Q=()=>{let J=y5(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let U of K.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let z;if(U.condition&&X0(U.condition))z=J0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=$0(U.condition,Z);if(z)q=U.content,W=!0}catch(z){q=t(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,n.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=t("If",`Error processing @if block: ${W}`,n.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function lZ($){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 Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function Z3($,Z){let Y=$;function X(K,q,W,U){let z=1,B=U,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(B<K.length&&z>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,B=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;B=O+L[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=z.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")U++;else if(L.type==="close")U--;else if(L.type==="else"&&U===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+5),_=lZ(B);if(_)U=_.value,z=W+5+_.consumed;else z=W+5;let j=X(Y,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?J1(`auth?.check && auth?.user?.[${U}]`,Z):J1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+6),_=lZ(B);if(_)U=_.value,z=W+6+_.consumed;else z=W+6;let j=X(Y,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?J1(`!auth?.check || !auth?.user?.[${U}]`,Z):J1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function J(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(W){let z=J1(W,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let B=z.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,R=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),w=/@else(?![a-z])/g,T=[],M;while((M=R.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=w.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((k,P)=>k.pos-P.pos);for(let k of T){if(k.type==="open"){V++;continue}if(k.type==="close"){V--;continue}if(V===0)O.push(k)}let I=[],D=0;for(let k=0;k<O.length;k++){let P=O[k];if(I.push({content:F.slice(D,P.pos),ability:void 0}),P.type==="elseDirective"){let d=F.slice(P.pos+`@${W}`.length),g=G(d);if(g){I[I.length-1]={content:F.slice(D,P.pos)},D=P.pos+`@${W}`.length+g.paramsEnd,I.push({content:"",ability:g.ability,type:g.type,id:g.id}),I.pop();let m=O[k+1],s=m?m.pos:F.length;I.push({content:F.slice(D,s),ability:g.ability,type:g.type,id:g.id}),D=s}}else D=P.pos+5}if(D<F.length){let k=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=J(j.ability,j.type,j.id),C=K==="can"?E:!E,S="";if(C)S=I[0]?.content||"";else{let k=!1;for(let P=1;P<I.length;P++){let d=I[P];if(d.isFinalElse){S=d.content,k=!0;break}if(d.ability){let g=J(d.ability,d.type,d.id);if(K==="can"?g:!g){S=d.content,k=!0;break}}}if(!k&&I.length>0){let P=I[I.length-1];if(P.isFinalElse)S=P.content}}Y=Y.substring(0,B)+S+Y.substring(L+`@${q}`.length),U=!0}}return Y}function Y3($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),B=J.match(z);if(!B||B.index===void 0)break;let _=B.index,j=Q1(J,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=E1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=j.expression,V=-1,R=0,A=0;while(A<F.length){let N=F.indexOf("@",A);if(N===-1)break;let w=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(w)){R++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(w)){R--,A=N+1;continue}if(R===0&&/^@else(?![a-z])/.test(w)){V=N;break}A=N+1}try{let N=q(O.trim()),w;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);w=N?T:M}else w=N?F:"";J=J.substring(0,_)+w+J.substring(L+`@${K}`.length),U=!0}catch(N){let w=N instanceof Error?N.message:String(N),T=t(W,`Error processing @${G} directive: ${w}`,n.EVALUATION_ERROR);J=J.substring(0,_)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=J1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=J1(J,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 X3($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,U.lastIndex=0;let L=U.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=Q===E[2]}let V=1,R=O,A=-1;while(V>0&&R<j.length){U.lastIndex=R,z.lastIndex=R;let E=U.exec(j),C=z.exec(j),S=E?E.index:1/0,k=C?C.index:1/0;if(S<k)V++,R=S+E[0].length;else if(k<1/0){if(V--,V===0){A=k;break}R=k+C[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=j.substring(O,A),w=-1,T=0,M=0;while(M<N.length){let E=N.indexOf("@",M);if(E===-1)break;let C=N.substring(E);if(B.test(C)){T++,M=E+1;continue}if(_.test(C)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(C)){w=E;break}M=E+1}let I;if(w!==-1){let E=N.slice(0,w),C=N.slice(w+5);I=W?E:C}else I=W?N:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(A+D),H=!0}return j}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var t4=b(()=>{hZ();t0();a4();L0()});function cZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function e4($,Z){if(!$)return Z?.nonceGenerator?.()??cZ();let Y=pZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??cZ(),pZ.set($,Y);return Y}function aq($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function iZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${aq($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function nZ($,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?e4(Y,Z):void 0,Q=iZ(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3714
- ${Q}`)}function oZ($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?e4(Z,J):void 0;return iZ(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return e4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=e4(Z,J);return Q}var pZ;var sZ=b(()=>{pZ=new WeakMap});import tq from"crypto";function $U($=eq){let Z=tq.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return J3=Z,Z}function ZU(){if(!J3)$U();return J3}function YU($=rZ){let Z=ZU();return`<input type="hidden" name="${$}" value="${Z}">`}function aZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return YU(X||rZ)})}var eq=40,rZ="_token",J3=null;var tZ=()=>{};async function eZ($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await XU(Q,J,Z,Y,X);else Q=await JU(Q,J,Z,Y,X)}return Q}async function XU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=u1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],B=U.exec(W);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?$Y(j):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);z.push({original:_,processed:t("CustomDirective",`Error in @${J}${j?`(${j})`:""}: ${O}`,n.EVALUATION_ERROR),startIndex:L})}B=U.exec(W)}for(let _=z.length-1;_>=0;_--){let{original:j,processed:H}=z[_];W=W.replace(j,H)}return W}async function JU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=u1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[_,j=""]=U,H=U.index||0;try{let L=$Y(j),F=await G("",L,Y,X);W.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:_,processed:t("CustomDirective",`Error in @${J}(${j}): ${F}`,n.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=u1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=z.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,X);W.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:_,processed:t("CustomDirective",`Error in @${J}: ${L}`,n.EVALUATION_ERROR),startIndex:j})}B=z.exec(K)}for(let _=W.length-1;_>=0;_--){let{original:j,processed:H}=W[_];K=K.replace(j,H)}return K}function $Y($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)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((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var ZY=b(()=>{t0();l1()});import QU from"crypto";function V0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function $$($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function GU(){return QU.randomUUID()}function Z$($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=GU();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${V0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${V0(J)}">`;return X}),Y}function JY($,Z,Y=XY){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"POST",z=K||q||"",B=G1(W),_=U.toUpperCase(),j=["GET","POST"].includes(_)?_:"POST",H=`<form method="${V0(j)}" action="${V0(z)}"${B?` ${B}`:""}>`;if(H+=`
3713
+ `+Q.slice(G);else Q+=J;return Q}function hq($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${o4(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${o4(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*"${o4(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*'${o4(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 dq($){return/x-data\s*=\s*["']/.test($)}var CZ=0,yq=0;var xZ=b(()=>{c0()});import mq from"fs";import t7 from"path";import{createHighlighter as uq}from"ts-syntax-highlighter";async function lq($,Z={}){try{if(!await i($))throw Error(`Markdown file not found: ${$}`);let X=(await mq.promises.stat($)).mtime.getTime();if(Z.cache&&e7.has($)){let z=e7.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=X9(Q),K=Z.markdown||n7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=B5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await pq(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)e7.set($,{...U,updatedAt:X});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:G0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function pq($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!s4)try{s4=await uq({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=W||(Y?"text":"");if(!B)return K;try{if(!s4.getSupportedLanguages().includes(B))return K;return(await s4.highlight(z,B,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,U,z]=K,B=await Q(q,W,U,z);J=J.replace(q,B)}return J}async function fZ($,Z,Y="",X={}){return await cq($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!t7.isAbsolute(K))U=t7.resolve(t7.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let R=V.indexOf(":");if(R>0){let A=V.substring(0,R).trim(),N=V.substring(R+1).trim(),w=N.startsWith('"')&&N.endsWith('"'),T=N.startsWith("'")&&N.endsWith("'");if(w||T)N=N.substring(1,N.length-1);z[A]=N}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:_}=await lq(U,X),j={...Z,..._,...z},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(U){let z=U instanceof Error?U.message:String(U);return G0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function cq($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).then((U)=>({match:K,replacement:U,index:q})))}let J=await Promise.all(X);J.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of J)G=G.replace(K,()=>q);return G}var e7,s4=null;var gZ=b(()=>{b5();H0();e7=new Map});function J1($,Z){try{let Y=$.trim();if(X0(Y))return J0(Y,Object.keys(Z))(...Object.values(Z));else return $0(Y,Z)}catch{return!1}}var hZ=b(()=>{L0()});function Q1($,Z){let Y=iq($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function iq($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=D0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function nq($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function E1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),W=K.exec($),U=q?q.index:1/0,z=W?W.index:1/0;if(U<z)Q++,J=U+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;J=z+W[0].length}else break}return-1}function dZ($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=Q1($,X);if(!Q)return null;let J=Q.endPos,G=E1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,B=0,_=0;while(W<K.length){let j=K.indexOf("@",W);if(j===-1)break;W=j;let H=K.substring(j);if(nq(K,j)){W++;continue}if(/^@if\s*\(/.test(H)){_++,W++;continue}if(/^@endif(?![a-z])/.test(H)){_--,W+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W});let F=W+L[0].length,O=Q1(K,F);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,B=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W}),U="else",z=void 0,W+=5,B=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function y5($){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 J=dZ($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function r4($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,W=D0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,B=E1($,Z,Y,z);if(B===-1){J=Q.exec($);continue}let _=$.slice(z,B),j=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:U,content:_,start:K,end:j}),Q.lastIndex=j,J=Q.exec($)}return X}function $3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=Q1($,X);if(!Q)return null;let J=Q.endPos,G=E1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U=null,z=0;while(W<K.length){let B=K.slice(W),_=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(_){if(z++,U)U.content+=_[0];W+=_[0].length;continue}if(j){if(z--,U)U.content+=j[0];W+=j[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=Q1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=L[0].length}else if(F&&B.startsWith("@break"))W+=F[0].length;else{if(U)U.content+=K[W];W++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var mZ=()=>{};var uZ=()=>{};var a4=b(()=>{mZ();uZ()});function aq($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=$3(X,G);if(!K)break;try{let q;if(X0(K.expression))q=J0(K.expression,Object.keys(Z))(...Object.values(Z));else q=$0(K.expression,Z);let W="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)W=z.content.trim()}else try{let B;if(z.value&&X0(z.value))B=J0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)B=$0(z.value,Z);if(q===B){W=z.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=t("Switch",`Error evaluating @switch expression: ${W}`,n.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function k1($,Z,Y){let X=$;X=aq(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=Q1(X,K+7);if(!q)break;let W=q.endPos,U=E1(X,"unless","endunless",W);if(U===-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 z=X.slice(W,U),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],R;while((R=L.exec(z))!==null)V.push({pos:R.index,type:"open"});while((R=F.exec(z))!==null)V.push({pos:R.index,type:"close"});while((R=O.exec(z))!==null)V.push({pos:R.index,type:"else"});V.sort((A,N)=>A.pos-N.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){_=A.pos;break}}let j;if(_!==-1){let H=z.slice(0,_),L=z.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${z}@endif`;X=X.substring(0,K)+j+X.substring(U+10),J=!0}}X=Y3(X,Z,Y),X=X3(X,Z,Y),X=Z3(X,Z);let Q=()=>{let J=y5(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let U of K.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let z;if(U.condition&&X0(U.condition))z=J0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=$0(U.condition,Z);if(z)q=U.content,W=!0}catch(z){q=t(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,n.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=t("If",`Error processing @if block: ${W}`,n.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function lZ($){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 Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function Z3($,Z){let Y=$;function X(K,q,W,U){let z=1,B=U,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(B<K.length&&z>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,B=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;B=O+L[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=z.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")U++;else if(L.type==="close")U--;else if(L.type==="else"&&U===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+5),_=lZ(B);if(_)U=_.value,z=W+5+_.consumed;else z=W+5;let j=X(Y,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?J1(`auth?.check && auth?.user?.[${U}]`,Z):J1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+6),_=lZ(B);if(_)U=_.value,z=W+6+_.consumed;else z=W+6;let j=X(Y,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?J1(`!auth?.check || !auth?.user?.[${U}]`,Z):J1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function J(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(W){let z=J1(W,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let B=z.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,R=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),w=/@else(?![a-z])/g,T=[],M;while((M=R.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=w.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((k,P)=>k.pos-P.pos);for(let k of T){if(k.type==="open"){V++;continue}if(k.type==="close"){V--;continue}if(V===0)O.push(k)}let I=[],D=0;for(let k=0;k<O.length;k++){let P=O[k];if(I.push({content:F.slice(D,P.pos),ability:void 0}),P.type==="elseDirective"){let d=F.slice(P.pos+`@${W}`.length),g=G(d);if(g){I[I.length-1]={content:F.slice(D,P.pos)},D=P.pos+`@${W}`.length+g.paramsEnd,I.push({content:"",ability:g.ability,type:g.type,id:g.id}),I.pop();let m=O[k+1],s=m?m.pos:F.length;I.push({content:F.slice(D,s),ability:g.ability,type:g.type,id:g.id}),D=s}}else D=P.pos+5}if(D<F.length){let k=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(D),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(D)})}let E=J(j.ability,j.type,j.id),C=K==="can"?E:!E,S="";if(C)S=I[0]?.content||"";else{let k=!1;for(let P=1;P<I.length;P++){let d=I[P];if(d.isFinalElse){S=d.content,k=!0;break}if(d.ability){let g=J(d.ability,d.type,d.id);if(K==="can"?g:!g){S=d.content,k=!0;break}}}if(!k&&I.length>0){let P=I[I.length-1];if(P.isFinalElse)S=P.content}}Y=Y.substring(0,B)+S+Y.substring(L+`@${q}`.length),U=!0}}return Y}function Y3($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),B=J.match(z);if(!B||B.index===void 0)break;let _=B.index,j=Q1(J,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=E1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=j.expression,V=-1,R=0,A=0;while(A<F.length){let N=F.indexOf("@",A);if(N===-1)break;let w=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(w)){R++,A=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(w)){R--,A=N+1;continue}if(R===0&&/^@else(?![a-z])/.test(w)){V=N;break}A=N+1}try{let N=q(O.trim()),w;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);w=N?T:M}else w=N?F:"";J=J.substring(0,_)+w+J.substring(L+`@${K}`.length),U=!0}catch(N){let w=N instanceof Error?N.message:String(N),T=t(W,`Error processing @${G} directive: ${w}`,n.EVALUATION_ERROR);J=J.substring(0,_)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=J1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=J1(J,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 X3($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,U.lastIndex=0;let L=U.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let E=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!E)break;O+=E[0].length,W=Q===E[2]}let V=1,R=O,A=-1;while(V>0&&R<j.length){U.lastIndex=R,z.lastIndex=R;let E=U.exec(j),C=z.exec(j),S=E?E.index:1/0,k=C?C.index:1/0;if(S<k)V++,R=S+E[0].length;else if(k<1/0){if(V--,V===0){A=k;break}R=k+C[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=j.substring(O,A),w=-1,T=0,M=0;while(M<N.length){let E=N.indexOf("@",M);if(E===-1)break;let C=N.substring(E);if(B.test(C)){T++,M=E+1;continue}if(_.test(C)){T--,M=E+1;continue}if(T===0&&/^@else(?![a-z])/.test(C)){w=E;break}M=E+1}let I;if(w!==-1){let E=N.slice(0,w),C=N.slice(w+5);I=W?E:C}else I=W?N:"";let D=`@${q}`.length;j=j.substring(0,F)+I+j.substring(A+D),H=!0}return j}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var t4=b(()=>{hZ();t0();a4();L0()});function cZ($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function e4($,Z){if(!$)return Z?.nonceGenerator?.()??cZ();let Y=pZ.get($);if(!Y)Y=Z?.nonceGenerator?.()??cZ(),pZ.set($,Y);return Y}function tq($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function iZ($,Z){return`<meta http-equiv="Content-Security-Policy" content="${tq($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function nZ($,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?e4(Y,Z):void 0,Q=iZ(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
3714
+ ${Q}`)}function oZ($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?e4(Z,J):void 0;return iZ(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return e4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=e4(Z,J);return Q}var pZ;var sZ=b(()=>{pZ=new WeakMap});import eq from"crypto";function ZU($=$U){let Z=eq.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return J3=Z,Z}function YU(){if(!J3)ZU();return J3}function XU($=rZ){let Z=YU();return`<input type="hidden" name="${$}" value="${Z}">`}function aZ($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return XU(X||rZ)})}var $U=40,rZ="_token",J3=null;var tZ=()=>{};async function eZ($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await JU(Q,J,Z,Y,X);else Q=await QU(Q,J,Z,Y,X)}return Q}async function JU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=u1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],B=U.exec(W);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?$Y(j):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);z.push({original:_,processed:t("CustomDirective",`Error in @${J}${j?`(${j})`:""}: ${O}`,n.EVALUATION_ERROR),startIndex:L})}B=U.exec(W)}for(let _=z.length-1;_>=0;_--){let{original:j,processed:H}=z[_];W=W.replace(j,H)}return W}async function QU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=u1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[_,j=""]=U,H=U.index||0;try{let L=$Y(j),F=await G("",L,Y,X);W.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:_,processed:t("CustomDirective",`Error in @${J}(${j}): ${F}`,n.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=u1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=z.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,X);W.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:_,processed:t("CustomDirective",`Error in @${J}: ${L}`,n.EVALUATION_ERROR),startIndex:j})}B=z.exec(K)}for(let _=W.length-1;_>=0;_--){let{original:j,processed:H}=W[_];K=K.replace(j,H)}return K}function $Y($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)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((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var ZY=b(()=>{t0();l1()});import GU from"crypto";function V0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function $$($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function KU(){return GU.randomUUID()}function Z$($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=KU();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${V0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${V0(J)}">`;return X}),Y}function JY($,Z,Y=XY){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"POST",z=K||q||"",B=G1(W),_=U.toUpperCase(),j=["GET","POST"].includes(_)?_:"POST",H=`<form method="${V0(j)}" action="${V0(z)}"${B?` ${B}`:""}>`;if(H+=`
3715
3715
  ${Z$("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
3716
- ${Z$(`@method('${_}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"",z=K||q||"",B=G1(W),_=P5(U,Z),j=_!==void 0&&_!==null?_:z||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=C5(U,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=$$(O?O[1]:"",Y.input,F,Y.inputError),R=B.replace(/class=['"][^'"]+['"]/i,"");return R=R.replace(/type=['"][^'"]+['"]/i,""),`<input type="${V0(L)}" name="${V0(U)}" value="${V0(j)}" class="${V}"${R?` ${R}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=G1(G),W=P5(J,Z)||K.trim(),U=C5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=$$(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${V0(J)}" class="${B}"${_?` ${_}`:""}>${V0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=G1(G),W=P5(J,Z),U=C5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=$$(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(W!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${V0(J)}" class="${B}"${_?` ${_}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=G1(K),W=P5(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${V0(J)}" value="${V0(G)}" class="${B}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=G1(K),W=P5(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${V0(J)}" value="${V0(G)}" class="${B}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=G1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=C5(J,Z),B=K.match(/class=['"]([^'"]+)['"]/i),_=$$(B?B[1]:"",Y.input,z,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${V0(J)}"`,`class="${_}"`];if(W)H.push(`accept="${V0(W)}"`);if(U)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=G1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${V0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function QY($,Z,Y=XY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(C5(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return YY(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return YY(Q,Z)}let q=K.trim();if(X0(q)){let W=$0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function C5($,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 YY($,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 P5($,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 G1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var XY;var GY=b(()=>{L0();XY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import K3 from"path";async function KU(){if(v5!==void 0)return v5;try{v5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{v5=null}return v5}function qU($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function UU($,Z){if({...W3,...Z.i18n}.cache&&q3[$]){let Q=q3[$],J=Z.i18n?.cacheMaxAge??0;if(!qU(Q,J))return Q.translations}if(x5[$]?.state==="loading")return x5[$].promise;Q3[$]="loading";let X=U3($,Z).then((Q)=>{return Q3[$]="loaded",delete x5[$],Q}).catch((Q)=>{throw Q3[$]="error",x5[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return x5[$]={promise:X,state:"loading"},X}async function U3($,Z){let Y={...W3,...Z.i18n},X=K3.isAbsolute(Y.translationsDir)?Y.translationsDir:K3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await KU(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:jU(Y.format)}):await WU($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return U3(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)q3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return U3(Y.defaultLocale,Z);return{}}}async function WU($,Z,Y){let X=K3.join(Y,`${$}${zU(Z.format)}`);try{let Q=await import(X);return Q.default||Q}catch(Q){try{let J=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return BU(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function zU($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function BU($){let Z={},Y=$.split(`
3717
- `),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.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,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,z=W.trim(),B=U.trim();if(B==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=_U(B)}}return Z}function _U($){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 jU($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function HU($,Z){return UU($,Z)}function OU($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function LU($,Z={}){return UY($,Z)}function UY($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=FU($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=VU(J,Z),X=Q+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 FU($,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 VU($,Z){let Y=RU($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return AU(Q,Y.slice(2).join(","),Z);case"select":return wU(Q,Y.slice(2).join(","));case"selectordinal":return TU(Q,Y.slice(2).join(","));case"number":return IU(Q,Y[2]?.trim());case"date":return DU(Q,Y[2]?.trim());case"time":return EU(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function RU($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function AU($,Z,Y){let X=Number($)||0,Q=z3(Z),J=`=${X}`;if(Q[J])return G3(Q[J],X,Y);let G=NU(X);if(Q[G])return G3(Q[G],X,Y);if(Q.other)return G3(Q.other,X,Y);return String(X)}function G3($,Z,Y){let X=$.replace(/#/g,String(Z));return UY(X,Y)}function NU($){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 wU($,Z){let Y=String($||""),X=z3(Z);if(X[Y])return X[Y];return X.other||String($)}function TU($,Z){let Y=Number($)||0,X=z3(Z),Q=MU(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function MU($){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 z3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function IU($,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 DU($,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 EU($,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 kU($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function KY($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(kU(G))return LU(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=OU(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function WY($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...W3,...X.i18n},K=await HU(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await qY(Q,J,async(U,z,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return O0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return KY(z,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return t("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,n.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,B)=>console.warn(`Match ${B}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await qY(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return O0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return KY(z,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return t("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,n.EVALUATION_ERROR)}}),Q}async function qY($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var v5,W3,q3,x5,Q3;var zY=b(()=>{t0();L0();W3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},q3={},x5={},Q3={}});var j3={};o(j3,{streamingSuspenseDirective:()=>jY,streamToResponse:()=>mU,streamTemplateSimple:()=>fU,streamTemplate:()=>SU,renderStreamingPage:()=>PU,registerStreamingDirectives:()=>hU,processStreamDirectives:()=>vU,processSectionDirectives:()=>dU,islandDirective:()=>HY,generateHydrationRuntime:()=>uU,extractStreamBoundaries:()=>xU,createStreamRenderer:()=>gU,buildSuspenseResolveScript:()=>_3,SUSPENSE_RESOLVER_RUNTIME:()=>_Y});import Y$ from"path";function bU($){let Z=[],Y=0,X;BY.lastIndex=0;while((X=BY.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=X[1],J=X[2];Z.push({type:"suspense",name:Q,content:J}),Y=X.index+X[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function SU($,Z={},Y={}){let X={...I1,...Y,streaming:{...B3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:Y$.dirname($)};if(q.trim())await A1(q,U,$);let z=bU(W),B=new Set;if(!z.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(b1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await F0(W,U,$,X,B);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(b1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let R=0;for(let A of F){if(A.start>R){let w=W.slice(R,A.start);if(w.trim()){let T=await F0(w,U,$,X,B);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let N=await F0(A.content,U,$,X,B);J.enqueue(N),await new Promise((w)=>setTimeout(w,0)),R=A.end}if(R<W.length){let A=W.slice(R);if(A.trim()){let N=await F0(A,U,$,X,B);J.enqueue(N)}}}}else{let j=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await F0(L.content,U,$,X,B);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
3716
+ ${Z$(`@method('${_}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"",z=K||q||"",B=G1(W),_=P5(U,Z),j=_!==void 0&&_!==null?_:z||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=C5(U,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=$$(O?O[1]:"",Y.input,F,Y.inputError),R=B.replace(/class=['"][^'"]+['"]/i,"");return R=R.replace(/type=['"][^'"]+['"]/i,""),`<input type="${V0(L)}" name="${V0(U)}" value="${V0(j)}" class="${V}"${R?` ${R}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=G1(G),W=P5(J,Z)||K.trim(),U=C5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=$$(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${V0(J)}" class="${B}"${_?` ${_}`:""}>${V0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=G1(G),W=P5(J,Z),U=C5(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=$$(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(W!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${V0(J)}" class="${B}"${_?` ${_}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=G1(K),W=P5(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${V0(J)}" value="${V0(G)}" class="${B}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=G1(K),W=P5(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${V0(J)}" value="${V0(G)}" class="${B}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=G1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=C5(J,Z),B=K.match(/class=['"]([^'"]+)['"]/i),_=$$(B?B[1]:"",Y.input,z,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${V0(J)}"`,`class="${_}"`];if(W)H.push(`accept="${V0(W)}"`);if(U)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=G1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${V0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function QY($,Z,Y=XY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(C5(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return YY(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return YY(Q,Z)}let q=K.trim();if(X0(q)){let W=$0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function C5($,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 YY($,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 P5($,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 G1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var XY;var GY=b(()=>{L0();XY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import K3 from"path";async function qU(){if(v5!==void 0)return v5;try{v5=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{v5=null}return v5}function UU($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function WU($,Z){if({...W3,...Z.i18n}.cache&&q3[$]){let Q=q3[$],J=Z.i18n?.cacheMaxAge??0;if(!UU(Q,J))return Q.translations}if(x5[$]?.state==="loading")return x5[$].promise;Q3[$]="loading";let X=U3($,Z).then((Q)=>{return Q3[$]="loaded",delete x5[$],Q}).catch((Q)=>{throw Q3[$]="error",x5[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return x5[$]={promise:X,state:"loading"},X}async function U3($,Z){let Y={...W3,...Z.i18n},X=K3.isAbsolute(Y.translationsDir)?Y.translationsDir:K3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await qU(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:HU(Y.format)}):await zU($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return U3(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)q3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return U3(Y.defaultLocale,Z);return{}}}async function zU($,Z,Y){let X=K3.join(Y,`${$}${BU(Z.format)}`);try{let Q=await import(X);return Q.default||Q}catch(Q){try{let J=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return _U(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function BU($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function _U($){let Z={},Y=$.split(`
3717
+ `),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.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,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,z=W.trim(),B=U.trim();if(B==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=jU(B)}}return Z}function jU($){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 HU($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function OU($,Z){return WU($,Z)}function LU($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function FU($,Z={}){return UY($,Z)}function UY($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=VU($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=RU(J,Z),X=Q+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 VU($,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 RU($,Z){let Y=AU($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return NU(Q,Y.slice(2).join(","),Z);case"select":return TU(Q,Y.slice(2).join(","));case"selectordinal":return MU(Q,Y.slice(2).join(","));case"number":return DU(Q,Y[2]?.trim());case"date":return EU(Q,Y[2]?.trim());case"time":return kU(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function AU($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function NU($,Z,Y){let X=Number($)||0,Q=z3(Z),J=`=${X}`;if(Q[J])return G3(Q[J],X,Y);let G=wU(X);if(Q[G])return G3(Q[G],X,Y);if(Q.other)return G3(Q.other,X,Y);return String(X)}function G3($,Z,Y){let X=$.replace(/#/g,String(Z));return UY(X,Y)}function wU($){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 TU($,Z){let Y=String($||""),X=z3(Z);if(X[Y])return X[Y];return X.other||String($)}function MU($,Z){let Y=Number($)||0,X=z3(Z),Q=IU(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function IU($){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 z3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function DU($,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 EU($,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 kU($,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 bU($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function KY($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(bU(G))return FU(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=LU(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function WY($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...W3,...X.i18n},K=await OU(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await qY(Q,J,async(U,z,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return O0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return KY(z,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return t("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,n.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,B)=>console.warn(`Match ${B}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await qY(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return O0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return KY(z,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return t("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,n.EVALUATION_ERROR)}}),Q}async function qY($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var v5,W3,q3,x5,Q3;var zY=b(()=>{t0();L0();W3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},q3={},x5={},Q3={}});var j3={};o(j3,{streamingSuspenseDirective:()=>jY,streamToResponse:()=>uU,streamTemplateSimple:()=>gU,streamTemplate:()=>yU,renderStreamingPage:()=>CU,registerStreamingDirectives:()=>dU,processStreamDirectives:()=>xU,processSectionDirectives:()=>mU,islandDirective:()=>HY,generateHydrationRuntime:()=>lU,extractStreamBoundaries:()=>fU,createStreamRenderer:()=>hU,buildSuspenseResolveScript:()=>_3,SUSPENSE_RESOLVER_RUNTIME:()=>_Y});import Y$ from"path";function SU($){let Z=[],Y=0,X;BY.lastIndex=0;while((X=BY.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=X[1],J=X[2];Z.push({type:"suspense",name:Q,content:J}),Y=X.index+X[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function yU($,Z={},Y={}){let X={...I1,...Y,streaming:{...B3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:Y$.dirname($)};if(q.trim())await A1(q,U,$);let z=SU(W),B=new Set;if(!z.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(b1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await F0(W,U,$,X,B);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(b1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let R=0;for(let A of F){if(A.start>R){let w=W.slice(R,A.start);if(w.trim()){let T=await F0(w,U,$,X,B);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let N=await F0(A.content,U,$,X,B);J.enqueue(N),await new Promise((w)=>setTimeout(w,0)),R=A.end}if(R<W.length){let A=W.slice(R);if(A.trim()){let N=await F0(A,U,$,X,B);J.enqueue(N)}}}}else{let j=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await F0(L.content,U,$,X,B);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
3718
3718
  <template data-suspense-fallback>Loading...</template>
3719
3719
  </div>`),j.set(L.name,F0(L.content,U,$,X,B))}J.enqueue(`
3720
3720
  <script>
@@ -3738,7 +3738,7 @@ window.__stxSuspense.resolve('${$}', \`${X}\`);
3738
3738
  </script>`}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return`
3739
3739
  <script>
3740
3740
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${h0(X)}</div>');
3741
- </script>`}}function yU($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function PU($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(_Y),await Promise.all(Z.map(async(J)=>{let G=yU(J.render(),X,J.id);Q.enqueue(await _3(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function vU($,Z){return $.replace(CU,(Y,X,Q)=>{let J=X.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[J]=K,`<div data-suspense="${J}">${q}</div>`})}function xU($){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,Q])=>({id:X,render:Q})):void 0}async function fU($,Z={},Y={}){let X={...I1,...Y,streaming:{...B3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:Y$.dirname($)};if(q.trim())await A1(q,U,$);let z=new Set,B=X.streaming?.strategy||"auto",_=new RegExp(b1.source,"g");if(!(B!=="manual"&&_.test(W))){let H=await F0(W,U,$,X,z);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(b1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=W.slice(O,V.start);if(A.trim()){let N=await F0(A,U,$,X,z);J.enqueue(N)}}let R=await F0(V.content,U,$,X,z);J.enqueue(R),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let R=await F0(V,U,$,X,z);J.enqueue(R)}}}J.close()}catch(G){J.error(G)}}})}async function gU($,Z={}){let Y={...I1,...Z,streaming:{...B3,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;b1.lastIndex=0;while((W=b1.exec(G))!==null){let B=W[1],_=W[2];q[B]=_}let U=G.replace(b1,"");return{renderShell:async(B={})=>{let _={...B,__filename:$,__dirname:Y$.dirname($)};return await A1(J,_,$),F0(U,_,$,Y,new Set)},renderSection:async(B,_={})=>{try{if(!q[B])return`<div class="error-message">Section "${h0(B)}" not found in template "${h0($)}"</div>`;let j={..._,__filename:$,__dirname:Y$.dirname($)};await A1(J,j,$);let H=new Set;return await F0(q[B],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return G0("Expression",H,$,q[B]||"",0,q[B]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function hU($={}){let Z=[];if($.streaming?.enabled)Z.push(jY);if($.hydration?.enabled)Z.push(HY);return Z}async function dU($,Z,Y,X={}){return $}function mU($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(J,G){G.enqueue(Y.encode(J))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:Q})}function uU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
3741
+ </script>`}}function PU($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function CU($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(_Y),await Promise.all(Z.map(async(J)=>{let G=PU(J.render(),X,J.id);Q.enqueue(await _3(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function xU($,Z){return $.replace(vU,(Y,X,Q)=>{let J=X.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[J]=K,`<div data-suspense="${J}">${q}</div>`})}function fU($){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,Q])=>({id:X,render:Q})):void 0}async function gU($,Z={},Y={}){let X={...I1,...Y,streaming:{...B3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:Y$.dirname($)};if(q.trim())await A1(q,U,$);let z=new Set,B=X.streaming?.strategy||"auto",_=new RegExp(b1.source,"g");if(!(B!=="manual"&&_.test(W))){let H=await F0(W,U,$,X,z);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(b1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=W.slice(O,V.start);if(A.trim()){let N=await F0(A,U,$,X,z);J.enqueue(N)}}let R=await F0(V.content,U,$,X,z);J.enqueue(R),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let R=await F0(V,U,$,X,z);J.enqueue(R)}}}J.close()}catch(G){J.error(G)}}})}async function hU($,Z={}){let Y={...I1,...Z,streaming:{...B3,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;b1.lastIndex=0;while((W=b1.exec(G))!==null){let B=W[1],_=W[2];q[B]=_}let U=G.replace(b1,"");return{renderShell:async(B={})=>{let _={...B,__filename:$,__dirname:Y$.dirname($)};return await A1(J,_,$),F0(U,_,$,Y,new Set)},renderSection:async(B,_={})=>{try{if(!q[B])return`<div class="error-message">Section "${h0(B)}" not found in template "${h0($)}"</div>`;let j={..._,__filename:$,__dirname:Y$.dirname($)};await A1(J,j,$);let H=new Set;return await F0(q[B],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return G0("Expression",H,$,q[B]||"",0,q[B]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function dU($={}){let Z=[];if($.streaming?.enabled)Z.push(jY);if($.hydration?.enabled)Z.push(HY);return Z}async function mU($,Z,Y,X={}){return $}function uU($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(J,G){G.enqueue(Y.encode(J))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:Q})}function lU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
3742
3742
  `);if(Z==="loader")return`
3743
3743
  (function() {
3744
3744
  window.__stx = window.__stx || {};
@@ -3900,25 +3900,25 @@ else {
3900
3900
  }
3901
3901
  };
3902
3902
  })();
3903
- </script>`,CU,jY,HY;var H3=b(()=>{b5();c0();_4();H0();B3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},b1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,BY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;CU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;jY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},HY={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),J=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
3903
+ </script>`,vU,jY,HY;var H3=b(()=>{b5();c0();_4();H0();B3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},b1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,BY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;vU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;jY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},HY={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),J=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
3904
3904
  ${W}
3905
3905
  <script type="application/json" data-island-props="${G}">
3906
3906
  ${q?`{${q}}`:"{}"}
3907
3907
  </script>
3908
- </div>`}}});var FY={};o(FY,{warnUnbalancedTags:()=>O3,findUnbalancedTags:()=>LY});function s1($){return $.replace(/[^\n]/g," ")}function LY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,s1).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,s1).replace(/<!--[\s\S]*?-->/g,s1).replace(/\{\{\{[\s\S]*?\}\}\}/g,s1).replace(/\{\{[\s\S]*?\}\}/g,s1).replace(/\{!![\s\S]*?!!\}/g,s1),Y=new Map,X=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,J;while((J=Q.exec(Z))!==null){let K=J[1]==="/",q=J[2],W=J[3]==="/";if(lU.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let z=Z.slice(0,J.index).split(`
3909
- `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(pU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function O3($,Z){let Y;try{Y=LY($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(OY.has(X))return;OY.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var lU,pU,OY;var L3=b(()=>{lU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),pU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);OY=new Set});import g0 from"path";import F3 from"fs";function VY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function RY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class AY{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 Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let _=[Q,Q.toLowerCase(),VY(Q),RY(Q)];for(let j of _)if(J.has(j))return J.get(j)}let G=[...new Set([`${Q}.stx`,`${VY(Q)}.stx`,`${RY(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=g0.resolve(g0.dirname(Z),`${Q}.stx`);if(await i(_))return _;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(g0.join(g0.dirname(W),"components"));if(q)K.push(q);let U=g0.join(g0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),B=[g0.resolve(z,"src/components"),g0.resolve(z,"components"),g0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=g0.join(_,j);if(await i(H))return H}try{if(!F3.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=F3.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=g0.join(_,L.name);for(let O of G){let V=g0.join(F,O);if(await i(V))return V}}}catch{}}return null}}var E0;var V3=b(()=>{H0();E0=new AY});function K1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function cU($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var R3;var A3=b(()=>{R3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=cU($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),J=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,q=[];if(X.reactive)q.push(`:href="${K1(X.value)}"`);else q.push(`href="${K1(X.value)}"`);if(Q)q.push(`class="${K1(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${K1(J)}"`),q.push(`data-stx-exact-active-class="${K1(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,z]of Object.entries($.static)){if(W.has(U))continue;if(typeof z==="boolean"){if(z)q.push(K1(U))}else q.push(`${K1(U)}="${K1(z)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function z0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function w0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function w3($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function NY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=iU[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function T3($,Z,Y,X){return Z.map((Q)=>`${f5($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function nU($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${f5($,G,void 0,X,Q)} ${J}x`}).join(", ")}function f5($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function oU($,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 iU,N3,M3;var I3=b(()=>{iU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},N3=[320,640,768,1024,1280,1536,1920];M3={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=w0($,"src")||"",Q=w0($,"alt")||"",J=w0($,"width"),G=w0($,"height"),K=w0($,"sizes"),q=w0($,"srcset"),W=w0($,"densities"),U=w0($,"format"),z=w0($,"placeholder"),B=w0($,"placeholderColor")||"#e5e7eb",_=w0($,"provider"),j=w0($,"class")||w0($,"className")||"",H=w0($,"style")||"",L=w0($,"quality"),F=w3($,"lazy",!0),O=w3($,"preload",!1),V=w3($,"picture",!1)||!!U,R=J?Number.parseInt(J):void 0,A=G?Number.parseInt(G):void 0,N=q||"",w="";if(!N&&K)N=T3(X,N3,_,U),w=NY(K);else if(!N&&W){let S=W.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));N=nU(X,S,R,_,U)}else if(K)w=NY(K);let T=[];if(H)T.push(H);if(R&&A)T.push(`aspect-ratio:${R}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let S=oU(R||16,A||9,B);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${z0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=f5(X,R,A,_,U),I=[];if(I.push(`src="${z0(M)}"`),I.push(`alt="${z0(Q)}"`),J)I.push(`width="${z0(J)}"`);if(G)I.push(`height="${z0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${z0(j)}"`);if(T.length>0)I.push(`style="${z0(T.join(";"))}"`);if(N)I.push(`srcset="${z0(N)}"`);if(w)I.push(`sizes="${z0(w)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,k]of Object.entries($.static)){if(D.has(S))continue;if(typeof k==="boolean"){if(k)I.push(z0(S))}else I.push(`${z0(S)}="${z0(k)}"`)}let E=`<img ${I.join(" ")} />`,C="";if(O){let k=U==="webp"?"image/webp":U==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${z0(M)}"${k?` type="${k}"`:""}${N?` imagesrcset="${z0(N)}"`:""}${w?` imagesizes="${z0(w)}"`:""} />
3908
+ </div>`}}});var FY={};o(FY,{warnUnbalancedTags:()=>O3,findUnbalancedTags:()=>LY});function s1($){return $.replace(/[^\n]/g," ")}function LY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,s1).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,s1).replace(/<!--[\s\S]*?-->/g,s1).replace(/\{\{\{[\s\S]*?\}\}\}/g,s1).replace(/\{\{[\s\S]*?\}\}/g,s1).replace(/\{!![\s\S]*?!!\}/g,s1),Y=new Map,X=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,J;while((J=Q.exec(Z))!==null){let K=J[1]==="/",q=J[2],W=J[3]==="/";if(pU.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let z=Z.slice(0,J.index).split(`
3909
+ `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(cU.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function O3($,Z){let Y;try{Y=LY($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(OY.has(X))return;OY.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var pU,cU,OY;var L3=b(()=>{pU=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),cU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);OY=new Set});import g0 from"path";import F3 from"fs";function VY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function RY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class AY{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 Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let _=[Q,Q.toLowerCase(),VY(Q),RY(Q)];for(let j of _)if(J.has(j))return J.get(j)}let G=[...new Set([`${Q}.stx`,`${VY(Q)}.stx`,`${RY(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=g0.resolve(g0.dirname(Z),`${Q}.stx`);if(await i(_))return _;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(g0.join(g0.dirname(W),"components"));if(q)K.push(q);let U=g0.join(g0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),B=[g0.resolve(z,"src/components"),g0.resolve(z,"components"),g0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=g0.join(_,j);if(await i(H))return H}try{if(!F3.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=F3.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=g0.join(_,L.name);for(let O of G){let V=g0.join(F,O);if(await i(V))return V}}}catch{}}return null}}var E0;var V3=b(()=>{H0();E0=new AY});function K1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function iU($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var R3;var A3=b(()=>{R3={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=iU($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),J=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,q=[];if(X.reactive)q.push(`:href="${K1(X.value)}"`);else q.push(`href="${K1(X.value)}"`);if(Q)q.push(`class="${K1(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${K1(J)}"`),q.push(`data-stx-exact-active-class="${K1(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);for(let[U,z]of Object.entries($.static)){if(W.has(U))continue;if(typeof z==="boolean"){if(z)q.push(K1(U))}else q.push(`${K1(U)}="${K1(z)}"`)}return`<a ${q.join(" ")}>${Z}</a>`}}});function z0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function w0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function w3($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function NY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=nU[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function T3($,Z,Y,X){return Z.map((Q)=>`${f5($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function oU($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${f5($,G,void 0,X,Q)} ${J}x`}).join(", ")}function f5($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function sU($,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 nU,N3,M3;var I3=b(()=>{nU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},N3=[320,640,768,1024,1280,1536,1920];M3={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=w0($,"src")||"",Q=w0($,"alt")||"",J=w0($,"width"),G=w0($,"height"),K=w0($,"sizes"),q=w0($,"srcset"),W=w0($,"densities"),U=w0($,"format"),z=w0($,"placeholder"),B=w0($,"placeholderColor")||"#e5e7eb",_=w0($,"provider"),j=w0($,"class")||w0($,"className")||"",H=w0($,"style")||"",L=w0($,"quality"),F=w3($,"lazy",!0),O=w3($,"preload",!1),V=w3($,"picture",!1)||!!U,R=J?Number.parseInt(J):void 0,A=G?Number.parseInt(G):void 0,N=q||"",w="";if(!N&&K)N=T3(X,N3,_,U),w=NY(K);else if(!N&&W){let S=W.split(/\s+/).map((k)=>Number.parseFloat(k.replace("x","")));N=oU(X,S,R,_,U)}else if(K)w=NY(K);let T=[];if(H)T.push(H);if(R&&A)T.push(`aspect-ratio:${R}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let S=sU(R||16,A||9,B);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${z0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=f5(X,R,A,_,U),I=[];if(I.push(`src="${z0(M)}"`),I.push(`alt="${z0(Q)}"`),J)I.push(`width="${z0(J)}"`);if(G)I.push(`height="${z0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${z0(j)}"`);if(T.length>0)I.push(`style="${z0(T.join(";"))}"`);if(N)I.push(`srcset="${z0(N)}"`);if(w)I.push(`sizes="${z0(w)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);for(let[S,k]of Object.entries($.static)){if(D.has(S))continue;if(typeof k==="boolean"){if(k)I.push(z0(S))}else I.push(`${z0(S)}="${z0(k)}"`)}let E=`<img ${I.join(" ")} />`,C="";if(O){let k=U==="webp"?"image/webp":U==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${z0(M)}"${k?` type="${k}"`:""}${N?` imagesrcset="${z0(N)}"`:""}${w?` imagesizes="${z0(w)}"`:""} />
3910
3910
  `}if(V){let S=[];if(U==="avif"||U==="auto"){let k=f5(X,R,A,_,"avif"),P=N?T3(X,N3,_,"avif"):`${k}`;S.push(`<source type="image/avif" srcset="${z0(P)}"${w?` sizes="${z0(w)}"`:""} />`)}if(U==="webp"||U==="auto"){let k=f5(X,R,A,_,"webp"),P=N?T3(X,N3,_,"webp"):`${k}`;S.push(`<source type="image/webp" srcset="${z0(P)}"${w?` sizes="${z0(w)}"`:""} />`)}return`${C}<picture>
3911
3911
  ${S.join(`
3912
3912
  `)}
3913
3913
  ${E}
3914
- </picture>`}return`${C}${E}`}}});function q1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function r1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var sU="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",D3;var E3=b(()=>{D3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=r1($,"src")||"",Q=r1($,"alt")||"",J=r1($,"fallback")||"/images/safe-image-default.svg",G=r1($,"class")||r1($,"className")||"",K=r1($,"fallbackClassName")||"",q=[];if(q.push(`src="${q1(X)}"`),q.push(`alt="${q1(Q)}"`),G)q.push(`class="${q1(G)}"`);if(q.push(`data-fallback="${q1(J)}"`),K)q.push(`data-fallback-class="${q1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[B,_]of Object.entries($.static)){if(W.has(B))continue;if(typeof _==="boolean"){if(_)q.push(q1(B))}else q.push(`${q1(B)}="${q1(_)}"`)}let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${sU}${U}`;return U}}});function k3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function g5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function X$($,Z,Y){let X=g5($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var b3;var S3=b(()=>{b3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=k3(g5($,"color")||"#6366f1"),Q=k3(g5($,"initialColor")||g5($,"initial-color")||""),J=k3(g5($,"height")||"3px"),G=X$($,"duration",2000),K=X$($,"throttle",200),q=X$($,"zIndex",999999)||X$($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
3914
+ </picture>`}return`${C}${E}`}}});function q1($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function r1($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var rU="<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'/images/safe-image-default.svg';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>",D3;var E3=b(()=>{D3={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=r1($,"src")||"",Q=r1($,"alt")||"",J=r1($,"fallback")||"/images/safe-image-default.svg",G=r1($,"class")||r1($,"className")||"",K=r1($,"fallbackClassName")||"",q=[];if(q.push(`src="${q1(X)}"`),q.push(`alt="${q1(Q)}"`),G)q.push(`class="${q1(G)}"`);if(q.push(`data-fallback="${q1(J)}"`),K)q.push(`data-fallback-class="${q1(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);for(let[B,_]of Object.entries($.static)){if(W.has(B))continue;if(typeof _==="boolean"){if(_)q.push(q1(B))}else q.push(`${q1(B)}="${q1(_)}"`)}let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${rU}${U}`;return U}}});function k3($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function g5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function X$($,Z,Y){let X=g5($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var b3;var S3=b(()=>{b3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=k3(g5($,"color")||"#6366f1"),Q=k3(g5($,"initialColor")||g5($,"initial-color")||""),J=k3(g5($,"height")||"3px"),G=X$($,"duration",2000),K=X$($,"throttle",200),q=X$($,"zIndex",999999)||X$($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
3915
3915
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${J};background:${W};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
3916
3916
  <div style="position:absolute;top:0;left:0;right:0;bottom:0;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,0.4) 50%,transparent 100%);animation:stx-shimmer 1.5s infinite"></div>
3917
3917
  </div>
3918
3918
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
3919
3919
  <script>
3920
3920
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${K})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
3921
- </script>`}}});function u0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function TY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function rU($,Z,Y){let X=TY($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var wY,y3;var P3=b(()=>{wY={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},y3={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=u0(TY($,"position")||"top-right"),Q=rU($,"max",5),J=wY[X]||wY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${J};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
3921
+ </script>`}}});function u0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function TY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function aU($,Z,Y){let X=TY($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var wY,y3;var P3=b(()=>{wY={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},y3={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=u0(TY($,"position")||"top-right"),Q=aU($,"max",5),J=wY[X]||wY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${J};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
3922
3922
  <style>
3923
3923
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
3924
3924
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -3944,18 +3944,18 @@ ${E}
3944
3944
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
3945
3945
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
3946
3946
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
3947
- </style>`}}});import{existsSync as aU,readFileSync as tU}from"fs";function eU($){if(DY.has($))return;DY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function $W($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(aU(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return Q0.resolve(Y)}catch{}return null}function ZW($){if(Q$.has($))return Q$.get($);let Z=$W($);if(!Z)return eU($),null;try{let Y=JSON.parse(tU(Z,"utf8"));return Q$.set($,Y.icons),Y.icons}catch{return null}}function t1($,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}var Q$,DY,g3;var h3=b(()=>{Q$=new Map,DY=new Set;g3={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=t1($,"name")??t1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=u0(t1($,"size")||"24"),K=u0(t1($,"color")||"currentColor"),q=u0(t1($,"class")||""),W=u0(t1($,"style")||""),U=Q$.get(Q)??ZW(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=z.width||24,_=z.height||24,j=`0 0 ${B} ${_}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function EY($,...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 kY($,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 d3;var m3=b(()=>{d3={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=kY(Z,"fallback"),Q=X.rest,J=kY(Q,"error"),G=J.rest,K=X.region??EY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??EY($,"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>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function G$($,...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 u3;var l3=b(()=>{u3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(G$($,"name")||"v").replace(/["'<>]/g,""),Q=(G$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=G$($,"class"),G=G$($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function bY(){E0.registerBuiltin(R3),E0.registerBuiltin(M3),E0.registerBuiltin(D3),E0.registerBuiltin(b3),E0.registerBuiltin(y3),E0.registerBuiltin(C3),E0.registerBuiltin(x3),E0.registerBuiltin(g3),E0.registerBuiltin(d3),E0.registerBuiltin(u3)}var SY=b(()=>{A3();I3();E3();S3();P3();v3();f3();h3();m3();l3();V3();A3();I3();E3();S3();P3();v3();f3();h3();m3();l3()});function yY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function PY($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,U=null,z=W,B=-1,_=!1;while(W<$.length){let H=$[W];if(U){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===U)U=null;W++;continue}if(H==='"'||H==="'"){U=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){B=W+2,_=!0;break}if(H===">"){B=W+1;break}W++}if(B===-1){Q=J+1;continue}let j=$.slice(z,_?B-2:B-1).trim();if(_)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:j,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let N=$.indexOf(H,O),w=$.indexOf(L,O);if(w===-1)break;if(N!==-1&&N<w){let T=$[N+H.length];if(T===" "||T===">"||T==="/"||T===`
3948
- `||T==="\t")F++;O=N+H.length}else{if(F--,F===0){V=w;break}O=w+L.length}}if(V===-1){Q=B;continue}let R=$.slice(B,V),A=V+L.length;X.push({fullMatch:$.slice(J,A),tagName:q,attributes:j,content:R,startIndex:J,endIndex:A,isSelfClosing:!1}),Q=A}}return X}function CY($,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 vY=b(()=>{L0();H0();K4()});var mY={};o(mY,{processESImports:()=>dY,processComponents:()=>q$});import K$ from"fs";import S0 from"path";function XW($,Z,Y){let X={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=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"]),J=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){X.events[q]=K;continue}if(q.startsWith("__stx_")){let W=J(q.slice(6));X.serverDynamic[W]=CY(K,Y);continue}if(q.startsWith(":")){let W=J(q.slice(1)),U=K==="true"?W:K;try{if(!X0(U)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${U}`);X.clientReactive[W]=U;continue}let z=Object.keys(Z),_=J0(U,z)(...Object.values(Z));if(_===void 0){let j=U.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)&&!z.includes(F))){X.clientReactive[W]=U;continue}}X.serverDynamic[W]=_}catch{X.clientReactive[W]=U}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let W=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let U=W[1];if(X0(U)){let B=J0(U,Object.keys(Z))(...Object.values(Z));X.static[q]=B!=null?String(B):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${U}`);X.static[q]=K}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,U);X.static[q]=K}else{let U=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(K))!==null)try{let _=B[1];if(!X0(_)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${_}`);continue}let H=J0(_,Object.keys(Z))(...Object.values(Z));U=U.replace(B[0],String(H??""))}catch(_){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,_)}X.static[q]=U}continue}X.static[q]=K}return X}function JW($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]="true"}return Z}function fY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function QW($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(E0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function GW($){let Z=gY.get($);if(Z)return Z;let Y=new Map,X=[S0.join($,"src"),S0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=K$.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=S0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let B=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return gY.set($,Y),Y}function KW($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=S0.join(Y,"node_modules",$);try{if(K$.statSync(X).isDirectory())return X}catch{}let Q=S0.dirname(Y);if(Q===Y)return null;Y=Q}}async function dY($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=S0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=z,j,H=[];while((j=B.exec(z))!==null){let[L,F,O,V]=j,R=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=S0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(K$.statSync(M).isFile())A=M}catch{try{if(K$.statSync(T).isDirectory())R=T}catch{}}}}else R=KW(V,G);if(!R&&!A)continue;let N=!1,w=(T,M)=>{J.set(T,M),J.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,M),Q.add(M)};if(O&&A)w(O,A),N=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),M=R?GW(R):null;for(let{source:I,local:D}of T){let E=null;if(A)E=A;else if(M)E=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)w(D,E),N=!0}}if(N)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${U}>${_}</script>`}),K}async function qW($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,U]=q,z=U.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of z){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[S0.resolve(S0.dirname(Y),`${B}.stx`),S0.resolve(S0.dirname(Y),B),S0.resolve(X.componentsDir||"components",`${B}.stx`),S0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function UW($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let U=W.index,z=U+W[0].length-1,B=1,_=z+1;while(_<J.length&&B>0){if(J[_]==="(")B++;else if(J[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=J.substring(z+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),R=V.match(/^\s*,\s*/);if(R)O=V.slice(R[0].length).trim();let A={};if(O)try{A=O0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);J=J.replace(J.substring(U,H),`[Error parsing component props: ${E}]`);continue}let N="",w=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),w=H+M[0].length;let I=await N1(F,A,N,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(w),q.lastIndex=0}return J}async function WW($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=c$(J);return J=q.output,J=await B(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await B(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await B(J,/[a-z][a-z0-9]*/,!1,YW),J=i$(J,q.scripts),J;async function B(_,j,H,L){if(!_)return _;let F=_,O=PY(F,j,L);for(let V=O.length-1;V>=0;V--){let R=O[V],A=H?yY(R.tagName):R.tagName,N=JW(R.attributes),w=XW(N,Z,X),T=E0.getBuiltin(R.tagName),M=T?await B4(A,G,Z,Y,X):!1;if(T&&!M){let C={context:Z,filePath:Y,options:X,dependencies:Q},S=T.render(w,R.content,C);if(Object.keys(w.clientReactive).length>0)S=hY(S,w.clientReactive);if(Object.keys(w.events).length>0){let k=Object.entries(w.events).map(([P,d])=>`${P}="${fY(d)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}F=F.substring(0,R.startIndex)+S+F.substring(R.endIndex);continue}if(!H&&R.tagName.includes("-")&&!await B4(A,G,Z,Y,X))continue;let I={};for(let[C,S]of Object.entries(w.static))I[C]=S;for(let[C,S]of Object.entries(w.serverDynamic))I[C]=S;let E=await N1(A,I,R.content,G,Z,Y,X,K,Q);if(Object.keys(w.clientReactive).length>0)E=hY(E,w.clientReactive);if(Object.keys(w.events).length>0){let C=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(C){let S=Object.entries(w.events).map(([P,d])=>`${P}="${fY(d)}"`).join(" "),k=C[1].length+C[2].length;E=E.substring(0,k)+" "+S+E.substring(k)}}F=F.substring(0,R.startIndex)+E+F.substring(R.endIndex)}return F}}function hY($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let X=Object.entries(Z).map(([J,G])=>`:${J}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=Y[1].length+Y[2].length;return $.substring(0,Q)+" "+X+$.substring(Q)}async function q$($,Z,Y,X,Q){if(!xY)bY(),xY=!0;let J=await dY($,Z,Y,X,Q);J=await qW(J,Z,Y,X,Q),J=await UW(J,Z,Y,X,Q);for(let G=0;G<3;G++){let K=J;if(J=await WW(J,Z,Y,X,Q),J===K)break}if(X.debug){let G=QW(J);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 J}var xY=!1,YW,gY;var p3=b(()=>{V3();SY();vY();H0();L0();YW=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"]);gY=new Map});var oY={};o(oY,{processLoops:()=>c3});function _W($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=X.substring(K+1,W),z=W+1,B=U.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=U.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=O0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;J.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function U$($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,U=null,z=!1;while(W<X.length&&q>0){let j=X[W];if(z){z=!1,W++;continue}if(j==="\\"&&U){z=!0,W++;continue}if(U){if(j===U)U=null;W++;continue}if(j==='"'||j==="'"||j==="`"){U=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let B=X.substring(K+1,W),_=Y(B);X=X.substring(0,G)+_+X.substring(W+1)}return X}function jW($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);X4(J);let W=J0(J,G)(...K),U=JSON.stringify(W),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${Q}="${z}"`}catch(G){return X}}),Y}function HW($,Z){let Y=$;return Y=U$(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(J,Z));return G?W$:""}catch{return""}}),Y=U$(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(J,Z));return G?z$:""}catch{return""}}),Y}function OW($){let Z=$;return Z=Z.replace(/@break(?!\()/g,W$),Z=Z.replace(/@continue(?!\()/g,z$),Z}function uY($){let Z=$.includes(W$),Y=Z?$.substring(0,$.indexOf(W$)):$;return{hasBreak:Z,content:Y}}function lY($){let Z=$.includes(z$),Y=Z?$.substring(0,$.indexOf(z$)):$;return{hasContinue:Z,content:Y}}function cY($){let Z=$;return Z=U$(Z,"@break",(Y)=>{let X=Y.trim();if(!J4(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=U$(Z,"@continue",(Y)=>{let X=Y.trim();if(!J4(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function LW($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,z)=>U.pos-z.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function W(U){let z=0,B=K.length-1,_=0;while(z<=B){let j=z+B>>1;if(K[j].pos<=U)_=K[j].depth,z=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,B=1,_=z+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(z+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,R=1,A=V,N=/@forelse\s*\(/g,w=/@endforelse/g,T=-1;while(R>0&&A<$.length){N.lastIndex=A,w.lastIndex=A;let S=N.exec($),k=w.exec($);if(!k)break;if(S&&S.index<k.index)R++,A=S.index+S[0].length;else{if(R--,R===0){T=k.index;break}A=k.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,D=-1,E=0,C=0;while(C<M.length){let S=M.indexOf("@",C);if(S===-1)break;let k=M.substring(S);if(/^@forelse\s*\(/.test(k))E++,C=S+1;else if(k.startsWith("@endforelse"))E--,C=S+11;else if(E===0&&k.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){D=S;break}C=S+1}else C=S+1}if(D===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function pY($,Z){let Y=$;while(!0){let X=LW(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let U;if(X0(G))U=J0(G,Object.keys(Z))(...Object.values(Z));else U=$0(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=W;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+z+Y.substring(J)}catch(U){let z=U instanceof Error?U.message:String(U),B=t("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,n.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function c3($,Z,Y,X){let Q=$;Q=pY(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,B=U.index+U[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),R=L.substring(F+4),A=H+1,N=1,w=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&w<q.length){T.lastIndex=w,M.lastIndex=w;let I=T.exec(q),D=M.exec(q);if(!D)break;if(I&&I.index<D.index)N++,w=I.index+I[0].length;else{if(N--,N===0){let E=q.substring(A,D.index),C=D.index+11;return{start:O,end:C,arrayExpr:V,itemVar:R,content:E}}w=D.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=z;try{let F=j.trim(),O;if(X0(F))O=J0(F,Object.keys(W))(...Object.values(W));else O=$0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=t("Foreach",`Error in @foreach: ${F} is not iterable`,n.TYPE_ERROR);U=U.substring(0,B)+D+U.substring(_);continue}let R=X?.loops?.useAltLoopVariable??BW,A=H.trim(),N=null,w,T=!1;if(A.includes("=>")){let D=A.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])N=D[0],w=D[1];else w=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])w=D[0],N=D[1],T=!0;else w=A}else w=A;let M="",I=O;for(let D=0;D<I.length;D++){let E=I[D],C={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},S={...W,loop:C,$loop:C};if(w.startsWith("[")&&w.endsWith("]")){let g=w.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))g.forEach((m,s)=>{if(m)S[m]=E[s]});else S[w]=E}else S[w]=E;if(N)if(!T&&V&&Array.isArray(E)&&E.length===2)S[N]=E[0],S[w]=E[1];else S[N]=D;let k=HW(L,S),P=lY(k);if(P.hasContinue){M+=P.content;continue}let d=uY(k);if(d.hasBreak){M+=d.content;break}if(k=pY(k,S),k=G(k,S),k=k1(k,S,Y),k=OW(k),d=uY(k),d.hasBreak){M+=d.content;break}if(P=lY(k),P.hasContinue){M+=P.content;continue}k=p0(k,S,Y),k=jW(k,S),k=_W(k,S),M+=k}U=U.substring(0,B)+M+U.substring(_)}catch(F){let O=t("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,n.EVALUATION_ERROR);U=U.substring(0,B)+O+U.substring(_)}}return U}Q=G(Q,Z),Q=nY(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??zW;return Q=RW(Q,Z,K),Q}function iY($){return J4($)}function nY($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=D0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,B=r4(Q.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!iY(U)){let H=t("For",`Unsafe expression in @for: ${U}`,n.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),J=!0;continue}try{let H=FW(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let N=VW({forExpr:U,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+N+Q.substring(j),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,w)=>{return`\${${w}}`});V=cY(V);let A=Function(...F,`
3947
+ </style>`}}});import{existsSync as tU,readFileSync as eU}from"fs";function $W($){if(DY.has($))return;DY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function ZW($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(tU(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return Q0.resolve(Y)}catch{}return null}function YW($){if(Q$.has($))return Q$.get($);let Z=ZW($);if(!Z)return $W($),null;try{let Y=JSON.parse(eU(Z,"utf8"));return Q$.set($,Y.icons),Y.icons}catch{return null}}function t1($,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}var Q$,DY,g3;var h3=b(()=>{Q$=new Map,DY=new Set;g3={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=t1($,"name")??t1($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=u0(t1($,"size")||"24"),K=u0(t1($,"color")||"currentColor"),q=u0(t1($,"class")||""),W=u0(t1($,"style")||""),U=Q$.get(Q)??YW(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=z.width||24,_=z.height||24,j=`0 0 ${B} ${_}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function EY($,...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 kY($,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 d3;var m3=b(()=>{d3={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=kY(Z,"fallback"),Q=X.rest,J=kY(Q,"error"),G=J.rest,K=X.region??EY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??EY($,"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>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function G$($,...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 u3;var l3=b(()=>{u3={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(G$($,"name")||"v").replace(/["'<>]/g,""),Q=(G$($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=G$($,"class"),G=G$($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function bY(){E0.registerBuiltin(R3),E0.registerBuiltin(M3),E0.registerBuiltin(D3),E0.registerBuiltin(b3),E0.registerBuiltin(y3),E0.registerBuiltin(C3),E0.registerBuiltin(x3),E0.registerBuiltin(g3),E0.registerBuiltin(d3),E0.registerBuiltin(u3)}var SY=b(()=>{A3();I3();E3();S3();P3();v3();f3();h3();m3();l3();V3();A3();I3();E3();S3();P3();v3();f3();h3();m3();l3()});function yY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function PY($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,U=null,z=W,B=-1,_=!1;while(W<$.length){let H=$[W];if(U){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===U)U=null;W++;continue}if(H==='"'||H==="'"){U=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){B=W+2,_=!0;break}if(H===">"){B=W+1;break}W++}if(B===-1){Q=J+1;continue}let j=$.slice(z,_?B-2:B-1).trim();if(_)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:j,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let N=$.indexOf(H,O),w=$.indexOf(L,O);if(w===-1)break;if(N!==-1&&N<w){let T=$[N+H.length];if(T===" "||T===">"||T==="/"||T===`
3948
+ `||T==="\t")F++;O=N+H.length}else{if(F--,F===0){V=w;break}O=w+L.length}}if(V===-1){Q=B;continue}let R=$.slice(B,V),A=V+L.length;X.push({fullMatch:$.slice(J,A),tagName:q,attributes:j,content:R,startIndex:J,endIndex:A,isSelfClosing:!1}),Q=A}}return X}function CY($,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 vY=b(()=>{L0();H0();K4()});var mY={};o(mY,{processESImports:()=>dY,processComponents:()=>q$});import K$ from"fs";import S0 from"path";function JW($,Z,Y){let X={static:{},serverDynamic:{},clientReactive:{},events:{}},Q=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"]),J=(G)=>{if(!G.includes("-")||G.startsWith("@")||G.startsWith(":")||G.startsWith("x-")||G.startsWith("__"))return G;return G.replace(/-([a-z0-9])/g,(K,q)=>q.toUpperCase())};for(let[G,K]of Object.entries($)){let q=G.startsWith("x-")&&!Q.has(G)&&!G.startsWith("x-bind:")&&!G.startsWith("x-on:")?`:${G.slice(2)}`:G;if(q.startsWith("@")){X.events[q]=K;continue}if(q.startsWith("__stx_")){let W=J(q.slice(6));X.serverDynamic[W]=CY(K,Y);continue}if(q.startsWith(":")){let W=J(q.slice(1)),U=K==="true"?W:K;try{if(!X0(U)){if(Y.debug)console.error(`Unsafe expression in :${W} binding: ${U}`);X.clientReactive[W]=U;continue}let z=Object.keys(Z),_=J0(U,z)(...Object.values(Z));if(_===void 0){let j=U.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)&&!z.includes(F))){X.clientReactive[W]=U;continue}}X.serverDynamic[W]=_}catch{X.clientReactive[W]=U}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let W=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let U=W[1];if(X0(U)){let B=J0(U,Object.keys(Z))(...Object.values(Z));X.static[q]=B!=null?String(B):""}else{if(Y.debug)console.error(`Unsafe expression in ${q}: ${U}`);X.static[q]=K}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${q}:`,U);X.static[q]=K}else{let U=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(K))!==null)try{let _=B[1];if(!X0(_)){if(Y.debug)console.error(`Unsafe expression in ${q}: ${_}`);continue}let H=J0(_,Object.keys(Z))(...Object.values(Z));U=U.replace(B[0],String(H??""))}catch(_){if(Y.debug)console.error(`Error evaluating expression in ${q}:`,_)}X.static[q]=U}continue}X.static[q]=K}return X}function QW($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]="true"}return Z}function fY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function GW($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(E0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function KW($){let Z=gY.get($);if(Z)return Z;let Y=new Map,X=[S0.join($,"src"),S0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=K$.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=S0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let B=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return gY.set($,Y),Y}function qW($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=S0.join(Y,"node_modules",$);try{if(K$.statSync(X).isDirectory())return X}catch{}let Q=S0.dirname(Y);if(Q===Y)return null;Y=Q}}async function dY($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=S0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=z,j,H=[];while((j=B.exec(z))!==null){let[L,F,O,V]=j,R=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=S0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(K$.statSync(M).isFile())A=M}catch{try{if(K$.statSync(T).isDirectory())R=T}catch{}}}}else R=qW(V,G);if(!R&&!A)continue;let N=!1,w=(T,M)=>{J.set(T,M),J.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,M),Q.add(M)};if(O&&A)w(O,A),N=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let D=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:I,local:I}}),M=R?KW(R):null;for(let{source:I,local:D}of T){let E=null;if(A)E=A;else if(M)E=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(E)w(D,E),N=!0}}if(N)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${U}>${_}</script>`}),K}async function UW($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,U]=q,z=U.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of z){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[S0.resolve(S0.dirname(Y),`${B}.stx`),S0.resolve(S0.dirname(Y),B),S0.resolve(X.componentsDir||"components",`${B}.stx`),S0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function WW($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let U=W.index,z=U+W[0].length-1,B=1,_=z+1;while(_<J.length&&B>0){if(J[_]==="(")B++;else if(J[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=J.substring(z+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),R=V.match(/^\s*,\s*/);if(R)O=V.slice(R[0].length).trim();let A={};if(O)try{A=O0(O,Z)}catch(D){let E=D instanceof Error?D.message:String(D);J=J.replace(J.substring(U,H),`[Error parsing component props: ${E}]`);continue}let N="",w=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)N=M[1].trim(),w=H+M[0].length;let I=await N1(F,A,N,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(w),q.lastIndex=0}return J}async function zW($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=c$(J);return J=q.output,J=await B(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await B(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await B(J,/[a-z][a-z0-9]*/,!1,XW),J=i$(J,q.scripts),J;async function B(_,j,H,L){if(!_)return _;let F=_,O=PY(F,j,L);for(let V=O.length-1;V>=0;V--){let R=O[V],A=H?yY(R.tagName):R.tagName,N=QW(R.attributes),w=JW(N,Z,X),T=E0.getBuiltin(R.tagName),M=T?await B4(A,G,Z,Y,X):!1;if(T&&!M){let C={context:Z,filePath:Y,options:X,dependencies:Q},S=T.render(w,R.content,C);if(Object.keys(w.clientReactive).length>0)S=hY(S,w.clientReactive);if(Object.keys(w.events).length>0){let k=Object.entries(w.events).map(([P,d])=>`${P}="${fY(d)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${k}`)}F=F.substring(0,R.startIndex)+S+F.substring(R.endIndex);continue}if(!H&&R.tagName.includes("-")&&!await B4(A,G,Z,Y,X))continue;let I={};for(let[C,S]of Object.entries(w.static))I[C]=S;for(let[C,S]of Object.entries(w.serverDynamic))I[C]=S;let E=await N1(A,I,R.content,G,Z,Y,X,K,Q);if(Object.keys(w.clientReactive).length>0)E=hY(E,w.clientReactive);if(Object.keys(w.events).length>0){let C=E.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(C){let S=Object.entries(w.events).map(([P,d])=>`${P}="${fY(d)}"`).join(" "),k=C[1].length+C[2].length;E=E.substring(0,k)+" "+S+E.substring(k)}}F=F.substring(0,R.startIndex)+E+F.substring(R.endIndex)}return F}}function hY($,Z){let Y=$.match(/^(\s*<)([a-zA-Z][a-zA-Z0-9-]*)(\s|>|\/)/s);if(!Y)return $;let X=Object.entries(Z).map(([J,G])=>`:${J}="${G.replace(/"/g,"&quot;")}"`).join(" "),Q=Y[1].length+Y[2].length;return $.substring(0,Q)+" "+X+$.substring(Q)}async function q$($,Z,Y,X,Q){if(!xY)bY(),xY=!0;let J=await dY($,Z,Y,X,Q);J=await UW(J,Z,Y,X,Q),J=await WW(J,Z,Y,X,Q);for(let G=0;G<3;G++){let K=J;if(J=await zW(J,Z,Y,X,Q),J===K)break}if(X.debug){let G=GW(J);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 J}var xY=!1,XW,gY;var p3=b(()=>{V3();SY();vY();H0();L0();XW=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"]);gY=new Map});var oY={};o(oY,{processLoops:()=>c3});function jW($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=X.substring(K+1,W),z=W+1,B=U.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=U.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=O0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;J.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function U$($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,U=null,z=!1;while(W<X.length&&q>0){let j=X[W];if(z){z=!1,W++;continue}if(j==="\\"&&U){z=!0,W++;continue}if(U){if(j===U)U=null;W++;continue}if(j==='"'||j==="'"||j==="`"){U=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let B=X.substring(K+1,W),_=Y(B);X=X.substring(0,G)+_+X.substring(W+1)}return X}function HW($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);X4(J);let W=J0(J,G)(...K),U=JSON.stringify(W),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${Q}="${z}"`}catch(G){return X}}),Y}function OW($,Z){let Y=$;return Y=U$(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(J,Z));return G?W$:""}catch{return""}}),Y=U$(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(X0(J)){let K=J0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean($0(J,Z));return G?z$:""}catch{return""}}),Y}function LW($){let Z=$;return Z=Z.replace(/@break(?!\()/g,W$),Z=Z.replace(/@continue(?!\()/g,z$),Z}function uY($){let Z=$.includes(W$),Y=Z?$.substring(0,$.indexOf(W$)):$;return{hasBreak:Z,content:Y}}function lY($){let Z=$.includes(z$),Y=Z?$.substring(0,$.indexOf(z$)):$;return{hasContinue:Z,content:Y}}function cY($){let Z=$;return Z=U$(Z,"@break",(Y)=>{let X=Y.trim();if(!J4(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=U$(Z,"@continue",(Y)=>{let X=Y.trim();if(!J4(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function FW($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,z)=>U.pos-z.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function W(U){let z=0,B=K.length-1,_=0;while(z<=B){let j=z+B>>1;if(K[j].pos<=U)_=K[j].depth,z=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,B=1,_=z+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(z+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,R=1,A=V,N=/@forelse\s*\(/g,w=/@endforelse/g,T=-1;while(R>0&&A<$.length){N.lastIndex=A,w.lastIndex=A;let S=N.exec($),k=w.exec($);if(!k)break;if(S&&S.index<k.index)R++,A=S.index+S[0].length;else{if(R--,R===0){T=k.index;break}A=k.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,D=-1,E=0,C=0;while(C<M.length){let S=M.indexOf("@",C);if(S===-1)break;let k=M.substring(S);if(/^@forelse\s*\(/.test(k))E++,C=S+1;else if(k.startsWith("@endforelse"))E--,C=S+11;else if(E===0&&k.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){D=S;break}C=S+1}else C=S+1}if(D===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function pY($,Z){let Y=$;while(!0){let X=FW(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let U;if(X0(G))U=J0(G,Object.keys(Z))(...Object.values(Z));else U=$0(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=W;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+z+Y.substring(J)}catch(U){let z=U instanceof Error?U.message:String(U),B=t("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,n.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function c3($,Z,Y,X){let Q=$;Q=pY(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,B=U.index+U[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),R=L.substring(F+4),A=H+1,N=1,w=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(N>0&&w<q.length){T.lastIndex=w,M.lastIndex=w;let I=T.exec(q),D=M.exec(q);if(!D)break;if(I&&I.index<D.index)N++,w=I.index+I[0].length;else{if(N--,N===0){let E=q.substring(A,D.index),C=D.index+11;return{start:O,end:C,arrayExpr:V,itemVar:R,content:E}}w=D.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=z;try{let F=j.trim(),O;if(X0(F))O=J0(F,Object.keys(W))(...Object.values(W));else O=$0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let D=t("Foreach",`Error in @foreach: ${F} is not iterable`,n.TYPE_ERROR);U=U.substring(0,B)+D+U.substring(_);continue}let R=X?.loops?.useAltLoopVariable??_W,A=H.trim(),N=null,w,T=!1;if(A.includes("=>")){let D=A.split("=>").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])N=D[0],w=D[1];else w=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((E)=>E.trim());if(D.length===2&&D[0]&&D[1])w=D[0],N=D[1],T=!0;else w=A}else w=A;let M="",I=O;for(let D=0;D<I.length;D++){let E=I[D],C={index:D,iteration:D+1,first:D===0,last:D===I.length-1,count:I.length},S={...W,loop:C,$loop:C};if(w.startsWith("[")&&w.endsWith("]")){let g=w.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(E))g.forEach((m,s)=>{if(m)S[m]=E[s]});else S[w]=E}else S[w]=E;if(N)if(!T&&V&&Array.isArray(E)&&E.length===2)S[N]=E[0],S[w]=E[1];else S[N]=D;let k=OW(L,S),P=lY(k);if(P.hasContinue){M+=P.content;continue}let d=uY(k);if(d.hasBreak){M+=d.content;break}if(k=pY(k,S),k=G(k,S),k=k1(k,S,Y),k=LW(k),d=uY(k),d.hasBreak){M+=d.content;break}if(P=lY(k),P.hasContinue){M+=P.content;continue}k=p0(k,S,Y),k=HW(k,S),k=jW(k,S),M+=k}U=U.substring(0,B)+M+U.substring(_)}catch(F){let O=t("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,n.EVALUATION_ERROR);U=U.substring(0,B)+O+U.substring(_)}}return U}Q=G(Q,Z),Q=nY(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??BW;return Q=AW(Q,Z,K),Q}function iY($){return J4($)}function nY($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=D0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,B=r4(Q.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!iY(U)){let H=t("For",`Unsafe expression in @for: ${U}`,n.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),J=!0;continue}try{let H=VW(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let N=RW({forExpr:U,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+N+Q.substring(j),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,w)=>{return`\${${w}}`});V=cY(V);let A=Function(...F,`
3949
3949
  let result = '';
3950
3950
  for (${U}) {
3951
3951
  result += \`${V}\`;
3952
3952
  }
3953
3953
  return result;
3954
- `)(...O);Q=Q.substring(0,K)+A+Q.substring(j),J=!0}catch(H){let L=t("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,n.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(j),J=!0}}return Q}function FW($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let B=q.slice(W+1).trim(),_=B.indexOf("=");return(_>=0?B.slice(0,_):B).trim()}let U=q.indexOf("="),z=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function VW($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
3954
+ `)(...O);Q=Q.substring(0,K)+A+Q.substring(j),J=!0}catch(H){let L=t("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,n.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(j),J=!0}}return Q}function VW($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let B=q.slice(W+1).trim(),_=B.indexOf("=");return(_>=0?B.slice(0,_):B).trim()}let U=q.indexOf("="),z=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function RW($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
3955
3955
  for (${Z}) {
3956
3956
  __pushIter([${X.join(", ")}])
3957
3957
  }
3958
- `),U=[];W(...q,(_)=>{U.push(_)});let z=J??"inline.stx",B="";for(let _ of U){let j={...Q};X.forEach((L,F)=>{j[L]=_[F]});let H=nY(Y,j,J,G);H=k1(H,j,z),H=p0(H,j,z),B+=H}return B}function RW($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=D0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=r4(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,B=G+U[0].end;if(!iY(W)){let _=t("While",`Unsafe expression in @while: ${W}`,n.UNSAFE_EXPRESSION);X=X.substring(0,G)+_+X.substring(B),Q=!0;continue}try{let _=Object.keys(Z),j=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=cY(H);let F=Function(..._,`
3958
+ `),U=[];W(...q,(_)=>{U.push(_)});let z=J??"inline.stx",B="";for(let _ of U){let j={...Q};X.forEach((L,F)=>{j[L]=_[F]});let H=nY(Y,j,J,G);H=k1(H,j,z),H=p0(H,j,z),B+=H}return B}function AW($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=D0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=r4(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,B=G+U[0].end;if(!iY(W)){let _=t("While",`Unsafe expression in @while: ${W}`,n.UNSAFE_EXPRESSION);X=X.substring(0,G)+_+X.substring(B),Q=!0;continue}try{let _=Object.keys(Z),j=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=cY(H);let F=Function(..._,`
3959
3959
  let result = '';
3960
3960
  let maxIterations = ${Y}; // Configurable safety limit
3961
3961
  let counter = 0;
@@ -3967,7 +3967,7 @@ ${E}
3967
3967
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
3968
3968
  }
3969
3969
  return result;
3970
- `)(...j);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(_){let j=t("While",`Error in @while(${W}): ${_ instanceof Error?_.message:String(_)}`,n.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(B),Q=!0}}return X}var zW=1000,BW=!1,W$="<!--__STX_BREAK__-->",z$="<!--__STX_CONTINUE__-->";var i3=b(()=>{t4();t0();c0();a4();L0()});import U0 from"path";function n3($,Z){let Y=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return X}return-1}function AW($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let U=X.substring(K+1,W-1),z=`${Y}(${U})`;X=X.substring(0,G)+z+X.substring(W),Q.lastIndex=G+z.length,J=Q.exec(X)}return X}function NW($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function wW($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(z)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===z){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let z=1;while(J<G&&z>0)if(Z[J]==="{")z++,J++;else if(Z[J]==="}")z--,J++;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},W=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
3970
+ `)(...j);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(_){let j=t("While",`Error in @while(${W}): ${_ instanceof Error?_.message:String(_)}`,n.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(B),Q=!0}}return X}var BW=1000,_W=!1,W$="<!--__STX_BREAK__-->",z$="<!--__STX_CONTINUE__-->";var i3=b(()=>{t4();t0();c0();a4();L0()});import U0 from"path";function n3($,Z){let Y=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return X}return-1}function NW($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let U=X.substring(K+1,W-1),z=`${Y}(${U})`;X=X.substring(0,G)+z+X.substring(W),Q.lastIndex=G+z.length,J=Q.exec(X)}return X}function wW($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function TW($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(z)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===z){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let z=1;while(J<G&&z>0)if(Z[J]==="{")z++,J++;else if(Z[J]==="}")z--,J++;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},W=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
3971
3971
  `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let z=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Y.push(j),X.add(j);return}let B=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Y.push(j),X.add(j);return}let _=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!X.has(j))Y.push(j),X.add(j)}};while(J<G){if(W())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}function rY($,Z=""){return`
3972
3972
  (function() {
3973
3973
  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;
@@ -3977,11 +3977,11 @@ ${E}
3977
3977
 
3978
3978
  ${$}
3979
3979
  ${Z}})();
3980
- `}function TW($,Z){let J=`
3980
+ `}function MW($,Z){let J=`
3981
3981
  // Register scope variables for STX runtime
3982
3982
  if (!window.stx._scopes) window.stx._scopes = {};
3983
3983
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
3984
- ${wW($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeRegistration[${JSON.stringify(q)}] = ${q}; } catch (e) { /* not actually top-level */ }`).join(`
3984
+ ${TW($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeRegistration[${JSON.stringify(q)}] = ${q}; } catch (e) { /* not actually top-level */ }`).join(`
3985
3985
  `)}
3986
3986
  // #1767: when the bundler renamed a component const that collided with an
3987
3987
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -4002,29 +4002,29 @@ ${wW($).split(",").map((q)=>q.trim()).filter(Boolean).map((q)=>` try { __scopeR
4002
4002
  } finally {
4003
4003
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
4004
4004
  }
4005
- })();`}function MW($,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 Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function DW($){if($.__onceStore instanceof Set)return $.__onceStore;return IW}async function o3($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=AW($,"@partial","@include"),q=DW(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let R=K.substring(F+1,V-1),A=R.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let N=A[1],w=W(N,G,Y),T="";if(w&&await Bun.file(w).exists())Q.add(w),T=`@include(${R})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,R=1,A=V+1;while(A<K.length&&R>0){if(K[A]==="(")R++;else if(K[A]===")")R--;A++}if(R!==0)break;let N=K.substring(V+1,A-1),w=n3(N,0);if(w===-1){L.lastIndex=A;continue}let T=N.substring(0,w).trim(),M=N.substring(w+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let D=I[1],E=M.substring(I[0].length),C,S=n3(E,0);if(S!==-1)C=E.substring(S+1).trim();try{let k=`Boolean(${T})`,P;if(X0(k)){let m=J0(k,Object.keys(Z));P=Boolean(m(...Object.values(Z)))}else P=Boolean($0(k,Z));let d=H?!P:P,g="";if(d){let m=W(D,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);g=`@include('${D}'${C?`, ${C}`:""})`}K=K.substring(0,O)+g+K.substring(A),L.lastIndex=0}catch(k){let P=k instanceof Error?k.message:String(k),d=G0("Include",`Error evaluating ${j} condition: ${P}`,Y,$,O);K=K.substring(0,O)+d+K.substring(A),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),A=K.substring(L,V+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let[,w,T,M,I]=N;try{let D,E=T.trim();if(X0(E))D=J0(E,Object.keys(Z))(...Object.values(Z));else D=$0(E,Z);let C="";if(Array.isArray(D)&&D.length>0)for(let S of D){let k={...Z,[M]:S},P=await z(w,k,$,L);C+=P}else if(I)C=await z(I,{},$,L);K=K.substring(0,L)+C+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+G0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),A=K.substring(L,V+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let w=N[1],T=R.slice(N[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let C=1,S=1;while(S<T.length&&C>0){if(T[S]==="{")C++;else if(T[S]==="}"){if(C--,C===0)break}S++}M=T.substring(0,S+1),T=T.slice(S+1)}let D,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let C=JSON.parse(w.replace(/'/g,'"')),S={};if(M)try{S=O0(M,Z)}catch(P){let d=P instanceof Error?P.message:String(P);if(X.debug){let g=G0("Include",`Error parsing includeFirst variables: ${d}`,Y,$,L,A);K=K.replace(A,()=>g)}else K=K.replace(A,()=>D||"");continue}let k=!1;for(let P of C){let d=W(P,G,Y);if(!d)continue;if(await i(d)){let g=await z(P,S,$,L);K=K.replace(A,()=>g),k=!0;break}}if(!k)if(D!==void 0)K=K.replace(A,()=>D);else if(X.debug){let P=G0("Include",`None of the includeFirst paths exist: ${w}`,Y,$,L,A);K=K.replace(A,()=>P)}else K=K.replace(A,"")}catch(C){let S=C instanceof Error?C.message:String(C),k=G0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);K=K.replace(A,()=>k)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=U0.resolve(H,F);else R=U0.resolve(V,F);let A=U0.normalize(R),N=A.startsWith(O+U0.sep)||A===O,w=A.startsWith(V+U0.sep)||A===V,T=!1,M=U0.dirname(V);if(A.startsWith(M+U0.sep)){if(!U0.relative(M,A).split(U0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))T=!0}if(!N&&!w&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let U=U0.resolve(Y);J.add(U);async function z(j,H={},L,F){let O=W(j,G,Y);if(!O)return G0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=U0.resolve(O);if(J.has(V)){let R=[...J,V].map((A)=>U0.basename(A)).join(" -> ");return G0("Include",`Circular include detected: ${R}`,Y,L,F)}try{Q.add(O);let R;if(!R)try{R=await Bun.file(O).text()}catch(g){let m=g instanceof Error?g.message:String(g);return G0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(R&&R.includes("@stream")){let{processStreamDirectives:g}=await Promise.resolve().then(() => (H3(),j3));R=g(R,Z)}if(R&&(X.debug||!D5()&&!g4()))try{let{warnUnbalancedTags:g}=await Promise.resolve().then(() => (L3(),FY));g(R,O)}catch{}let A=R;try{let{processESImports:g}=await Promise.resolve().then(() => (p3(),mY));await g(R,Z,O,X,Q)}catch(g){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,g instanceof Error?g.message:g)}let N=A.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|@for|@if|:for|:if)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(N)A=N[1].trim();let T=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[g,m]of Object.entries(H))I[g]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...R.matchAll(D)],C="",S=null;for(let g of E){let m=g[1]||"",s=g[2]||"",Z0=m.includes("server"),o0=L1(m),P0="";try{let{extractAndStripCssImports:e,renderVendorStyleTags:M0}=await Promise.resolve().then(() => (O5(),U9)),C0=e(s,{filePath:O,projectRoot:process.cwd()});s=C0.code,P0=M0(C0.styles)}catch(e){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,e instanceof Error?e.message:e)}if(o0&&s.trim())s=F1(s);if(!Z0)try{let{hasUserImports:e,bundleClientScript:M0}=await Promise.resolve().then(() => (Z4(),$4));if(e(s))s=await M0(s,O,{projectRoot:process.cwd()})}catch(e){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,e instanceof Error?e.message:e)}let T0=NW(s);if(T0&&!Z0){S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++sY}`;let e=a0(s),M0=TW(e,S);C+=`${P0}<script data-stx-scoped>${M0}</script>
4005
+ })();`}function IW($,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 Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function EW($){if($.__onceStore instanceof Set)return $.__onceStore;return DW}async function o3($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=NW($,"@partial","@include"),q=EW(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let R=K.substring(F+1,V-1),A=R.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let N=A[1],w=W(N,G,Y),T="";if(w&&await Bun.file(w).exists())Q.add(w),T=`@include(${R})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,R=1,A=V+1;while(A<K.length&&R>0){if(K[A]==="(")R++;else if(K[A]===")")R--;A++}if(R!==0)break;let N=K.substring(V+1,A-1),w=n3(N,0);if(w===-1){L.lastIndex=A;continue}let T=N.substring(0,w).trim(),M=N.substring(w+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let D=I[1],E=M.substring(I[0].length),C,S=n3(E,0);if(S!==-1)C=E.substring(S+1).trim();try{let k=`Boolean(${T})`,P;if(X0(k)){let m=J0(k,Object.keys(Z));P=Boolean(m(...Object.values(Z)))}else P=Boolean($0(k,Z));let d=H?!P:P,g="";if(d){let m=W(D,G,Y);if(m&&await Bun.file(m).exists())Q.add(m);g=`@include('${D}'${C?`, ${C}`:""})`}K=K.substring(0,O)+g+K.substring(A),L.lastIndex=0}catch(k){let P=k instanceof Error?k.message:String(k),d=G0("Include",`Error evaluating ${j} condition: ${P}`,Y,$,O);K=K.substring(0,O)+d+K.substring(A),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),A=K.substring(L,V+1),N=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let[,w,T,M,I]=N;try{let D,E=T.trim();if(X0(E))D=J0(E,Object.keys(Z))(...Object.values(Z));else D=$0(E,Z);let C="";if(Array.isArray(D)&&D.length>0)for(let S of D){let k={...Z,[M]:S},P=await z(w,k,$,L);C+=P}else if(I)C=await z(I,{},$,L);K=K.substring(0,L)+C+K.substring(V+1),j.lastIndex=0}catch(D){let E=D instanceof Error?D.message:String(D);K=K.substring(0,L)+G0("Each",`Error in @each: ${E}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),A=K.substring(L,V+1),N=R.match(/^\s*(\[[^\]]+\])/);if(!N){j.lastIndex=0,K=K.replace(A,"");continue}let w=N[1],T=R.slice(N[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let C=1,S=1;while(S<T.length&&C>0){if(T[S]==="{")C++;else if(T[S]==="}"){if(C--,C===0)break}S++}M=T.substring(0,S+1),T=T.slice(S+1)}let D,E=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(E)D=E[1];try{let C=JSON.parse(w.replace(/'/g,'"')),S={};if(M)try{S=O0(M,Z)}catch(P){let d=P instanceof Error?P.message:String(P);if(X.debug){let g=G0("Include",`Error parsing includeFirst variables: ${d}`,Y,$,L,A);K=K.replace(A,()=>g)}else K=K.replace(A,()=>D||"");continue}let k=!1;for(let P of C){let d=W(P,G,Y);if(!d)continue;if(await i(d)){let g=await z(P,S,$,L);K=K.replace(A,()=>g),k=!0;break}}if(!k)if(D!==void 0)K=K.replace(A,()=>D);else if(X.debug){let P=G0("Include",`None of the includeFirst paths exist: ${w}`,Y,$,L,A);K=K.replace(A,()=>P)}else K=K.replace(A,"")}catch(C){let S=C instanceof Error?C.message:String(C),k=G0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);K=K.replace(A,()=>k)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=U0.resolve(H,F);else R=U0.resolve(V,F);let A=U0.normalize(R),N=A.startsWith(O+U0.sep)||A===O,w=A.startsWith(V+U0.sep)||A===V,T=!1,M=U0.dirname(V);if(A.startsWith(M+U0.sep)){if(!U0.relative(M,A).split(U0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))T=!0}if(!N&&!w&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let U=U0.resolve(Y);J.add(U);async function z(j,H={},L,F){let O=W(j,G,Y);if(!O)return G0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=U0.resolve(O);if(J.has(V)){let R=[...J,V].map((A)=>U0.basename(A)).join(" -> ");return G0("Include",`Circular include detected: ${R}`,Y,L,F)}try{Q.add(O);let R;if(!R)try{R=await Bun.file(O).text()}catch(g){let m=g instanceof Error?g.message:String(g);return G0("Include",`Error loading include file ${j}: ${m}`,Y,L,F)}if(R&&R.includes("@stream")){let{processStreamDirectives:g}=await Promise.resolve().then(() => (H3(),j3));R=g(R,Z)}if(R&&(X.debug||!D5()&&!g4()))try{let{warnUnbalancedTags:g}=await Promise.resolve().then(() => (L3(),FY));g(R,O)}catch{}let A=R;try{let{processESImports:g}=await Promise.resolve().then(() => (p3(),mY));await g(R,Z,O,X,Q)}catch(g){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,g instanceof Error?g.message:g)}let N=A.match(/<template\b(?![^>]*(?:\b(?:id|x-for|x-if|x-else|@for|@if|@else|:for|:if|:else)\s*=|\s#[\w-]|\bv-slot|\bslot\s*=))[^>]*>([\s\S]*?)<\/template>/i);if(N)A=N[1].trim();let T=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[g,m]of Object.entries(H))I[g]=m;let D=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,E=[...R.matchAll(D)],C="",S=null;for(let g of E){let m=g[1]||"",s=g[2]||"",Z0=m.includes("server"),o0=L1(m),P0="";try{let{extractAndStripCssImports:e,renderVendorStyleTags:M0}=await Promise.resolve().then(() => (O5(),U9)),C0=e(s,{filePath:O,projectRoot:process.cwd()});s=C0.code,P0=M0(C0.styles)}catch(e){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,e instanceof Error?e.message:e)}if(o0&&s.trim())s=F1(s);if(!Z0)try{let{hasUserImports:e,bundleClientScript:M0}=await Promise.resolve().then(() => (Z4(),$4));if(e(s))s=await M0(s,O,{projectRoot:process.cwd()})}catch(e){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,e instanceof Error?e.message:e)}let T0=wW(s);if(T0&&!Z0){S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++sY}`;let e=a0(s),M0=MW(e,S);C+=`${P0}<script data-stx-scoped>${M0}</script>
4006
4006
  `;continue}if(Z0)try{let{extractVariables:e}=await Promise.resolve().then(() => (T5(),z4));await e(s,I,O)}catch(e){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,e)}if(!Z0&&!T0){let e=m.replace(/\bclient\b/i,"").trim();S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++sY}`;let M0=a0(s),C0=`
4007
4007
  if (!window.stx._scopes) window.stx._scopes = {};
4008
4008
  window.stx._scopes['${S}'] = { __destroyCallbacks: __destroyHooks };
4009
4009
  `,v=rY(M0,C0);C+=`${P0}<script data-stx-scoped${e?` ${e}`:""}>${v}</script>
4010
- `}}if(S){let g=MW(A,S);if(A=g.html,g.mergedIntoExisting)C=C.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${g.mergedIntoExisting}']`),S=g.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await o3(A,I,O,X,Q,J);let{processLoops:k}=await Promise.resolve().then(() => (i3(),oY)),P=k(A,I,O);P=k1(P,I,O);let d=d1(R);if(P=p0(P,I,O,{forceSignals:d}),M)P+=`
4010
+ `}}if(S){let g=IW(A,S);if(A=g.html,g.mergedIntoExisting)C=C.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${g.mergedIntoExisting}']`),S=g.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await o3(A,I,O,X,Q,J);let{processLoops:k}=await Promise.resolve().then(() => (i3(),oY)),P=k(A,I,O);P=k1(P,I,O);let d=d1(R);if(P=p0(P,I,O,{forceSignals:d}),M)P+=`
4011
4011
  `+M;if(C)P+=`
4012
4012
  `+C;return P}catch(R){let A=R instanceof Error?R.message:String(R);return G0("Include",`Error processing include ${j}: ${A}`,Y,L,F)}}let B=/@include\s*\(/g,_;while((_=B.exec(K))!==null){let j=_.index,H=j+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),R=V.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let A=R[1],N,w=V.substring(R[0].length),T=n3(w,0);if(T!==-1)N=w.substring(T+1).trim();let M={};if(N)try{M=O0(N,Z)}catch(D){let E=D instanceof Error?D.message:String(D);K=K.replace(O,G0("Include",`Error parsing include variables for ${A}: ${E}`,Y,$,j)),B.lastIndex=0;continue}let I=await z(A,M,$,j);K=K.substring(0,j)+I+K.substring(F),B.lastIndex=0}return K}function s3($,Z){let Y=$;function X(Q,J,G,K){let q=Q,W=!0;while(W){W=!1;let U=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),z=q.match(U);if(!z||z.index===void 0)break;let B=z.index,_=z[1],j=B+z[0].length,H=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let A=q.slice(O),N=A.match(H),w=A.match(L),T=N?O+N.index:1/0,M=w?O+w.index:1/0;if(T<M)F++,O=T+(N[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let R=q.slice(j,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(R);else Z[_].push(R);q=q.substring(0,B)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function r3($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
4013
- `)})}var sY=0,VV,IW;var aY=b(()=>{t4();c0();l1();L0();H0();VV=new R5(500),IW=new Set});import*as a3 from"path";async function tY($,Z,Y=""){if(a3.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 $2($,Z,Y,"@js","@endjs")}async function eY($,Z,Y=""){if(a3.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return $2($,Z,Y,"@ts","@endts")}async function $2($,Z,Y,X,Q){let J=$,G=u1(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:z}of K)try{let B=Object.keys(Z),_=Object.values(Z),j=U.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 L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
4013
+ `)})}var sY=0,RV,DW;var aY=b(()=>{t4();c0();l1();L0();H0();RV=new R5(500),DW=new Set});import*as a3 from"path";async function tY($,Z,Y=""){if(a3.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 $2($,Z,Y,"@js","@endjs")}async function eY($,Z,Y=""){if(a3.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return $2($,Z,Y,"@ts","@endts")}async function $2($,Z,Y,X,Q){let J=$,G=u1(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:z}of K)try{let B=Object.keys(Z),_=Object.values(Z),j=U.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 L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
4014
4014
  ${j}
4015
4015
  ${F}
4016
- `,R=Function(...B,O)(..._);if(R&&typeof R==="object")Object.assign(Z,R);J=J.replace(W,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let _=B instanceof Error?B.message:String(B),j=G0(`${X} Directive`,`Error executing code: ${_}`,Y,$,z,W);console.error(j),J=J.replace(W,"")}return J}var Z2=b(()=>{l1();H0()});function EW($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function Y2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return EW(X,J||"_method")})}async function X2($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=G0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
4016
+ `,R=Function(...B,O)(..._);if(R&&typeof R==="object")Object.assign(Z,R);J=J.replace(W,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let _=B instanceof Error?B.message:String(B),j=G0(`${X} Directive`,`Error executing code: ${_}`,Y,$,z,W);console.error(j),J=J.replace(W,"")}return J}var Z2=b(()=>{l1();H0()});function kW($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function Y2($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return kW(X,J||"_method")})}async function X2($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=G0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
4017
4017
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${h0(W)}</div>
4018
- `)}}}return J}async function J2($,Z,Y,X){return X2($,Z,Y,X,"before")}async function Q2($,Z,Y,X){return X2($,Z,Y,X,"after")}var G2=b(()=>{c0();H0()});import{defineRoute as yV,defineRoutes as PV,resetRoutes as CV,route as vV,setAppUrl as xV}from"stx-router";import{route as kW}from"stx-router";function K2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?O0(Q,{}):{};return kW(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var q2=b(()=>{L0()});async function U2($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(h5.exact[$])for(let X of h5.exact[$])await Promise.resolve(X(Z,$));if(h5.exact[Y])for(let X of h5.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of h5.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var h5;var W2=b(()=>{h5={patterns:[],exact:{}}});function z2($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>z2(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function B2($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([U,z])=>W>=U&&W<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],U=J[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=U,j=!1;while((B=z.exec(U))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.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 (${L})`)(...O);if(H==="class"){let N=z2(A);if(N){let w=_.match(/\sclass="([^"]*)"/);if(w)_=_.replace(w[0],` class="${w[1]} ${N}"`);else _=_.replace(B[0],` class="${N}"`)}else _=_.replace(B[0],"");j=!0;continue}if(bW.has(H)){if(A)_=_.replace(B[0],` ${H}`);else _=_.replace(B[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(B[0],"");else{let N=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(B[0],` ${H}="${N}"`)}j=!0}catch{continue}}if(j){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${_}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:B}=q[W];Y=Y.slice(0,U)+B+Y.slice(z)}return Y}var bW;var _2=b(()=>{bW=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function S1($,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("/")||SW.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function PW($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function i0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=PW($,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 j2($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function e1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function U1($,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 W1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function CW($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function vW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=U1(X.attrs,"v-for"),U=U1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=W1(B,{...X,start:0,end:X.end-X.start},U),j=`@foreach(${q})
4018
+ `)}}}return J}async function J2($,Z,Y,X){return X2($,Z,Y,X,"before")}async function Q2($,Z,Y,X){return X2($,Z,Y,X,"after")}var G2=b(()=>{c0();H0()});import{defineRoute as PV,defineRoutes as CV,resetRoutes as vV,route as xV,setAppUrl as fV}from"stx-router";import{route as bW}from"stx-router";function K2($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?O0(Q,{}):{};return bW(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var q2=b(()=>{L0()});async function U2($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(h5.exact[$])for(let X of h5.exact[$])await Promise.resolve(X(Z,$));if(h5.exact[Y])for(let X of h5.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of h5.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var h5;var W2=b(()=>{h5={patterns:[],exact:{}}});function z2($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>z2(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function B2($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([U,z])=>W>=U&&W<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],U=J[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=U,j=!1;while((B=z.exec(U))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.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 (${L})`)(...O);if(H==="class"){let N=z2(A);if(N){let w=_.match(/\sclass="([^"]*)"/);if(w)_=_.replace(w[0],` class="${w[1]} ${N}"`);else _=_.replace(B[0],` class="${N}"`)}else _=_.replace(B[0],"");j=!0;continue}if(SW.has(H)){if(A)_=_.replace(B[0],` ${H}`);else _=_.replace(B[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(B[0],"");else{let N=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(B[0],` ${H}="${N}"`)}j=!0}catch{continue}}if(j){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${_}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:B}=q[W];Y=Y.slice(0,U)+B+Y.slice(z)}return Y}var SW;var _2=b(()=>{SW=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function S1($,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("/")||yW.has(X[1].toLowerCase()),start:X.index,end:X.index+X[0].length}}function CW($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function i0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=CW($,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 j2($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function e1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function U1($,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 W1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function vW($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function xW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=U1(X.attrs,"v-for"),U=U1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=W1(B,{...X,start:0,end:X.end-X.start},U),j=`@foreach(${q})
4019
4019
  `,H=`${j}${_}
4020
- @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+j.length}return Z}function xW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=i0(Z,X),K=U1(X.attrs,"v-if"),q=W1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,U=!0;while(U){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=S1(Z,W+L);if(!F){U=!1;break}let O=e1(F.attrs,"v-else-if"),V=j2(F.attrs,"v-else");if(O!==null){let R=i0(Z,F),A=U1(F.attrs,"v-else-if"),N=W1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:R.outerEnd,element:N,parsedTag:F}),W=R.outerEnd}else if(V){let R=i0(Z,F),A=U1(F.attrs,"v-else"),N=W1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else",outerStart:W,outerEnd:R.outerEnd,element:N,parsedTag:F}),U=!1}else U=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
4020
+ @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+j.length}return Z}function fW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=i0(Z,X),K=U1(X.attrs,"v-if"),q=W1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,U=!0;while(U){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=S1(Z,W+L);if(!F){U=!1;break}let O=e1(F.attrs,"v-else-if"),V=j2(F.attrs,"v-else");if(O!==null){let R=i0(Z,F),A=U1(F.attrs,"v-else-if"),N=W1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:R.outerEnd,element:N,parsedTag:F}),W=R.outerEnd}else if(V){let R=i0(Z,F),A=U1(F.attrs,"v-else"),N=W1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else",outerStart:W,outerEnd:R.outerEnd,element:N,parsedTag:F}),U=!1}else U=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
4021
4021
  ${H.element}`);else if(H.type==="else-if")z.push(`@elseif(${H.expr})
4022
4022
  ${H.element}`);else z.push(`@else
4023
4023
  ${H.element}`);z.push("@endif");let B=z.join(`
4024
- `),_=J[0].outerStart,j=J[J.length-1].outerEnd;Z=Z.slice(0,_)+B+Z.slice(j),Y=_+B.length}return Z}function fW($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function gW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let U=K[1],z=K[2],B=K[3];Q=Q.replace(K[0],""),Q+=` :${U}="${B}" @update:${U}="${B} = $event"`,K=Q.match(G)}if(J){let U=i0(Z,X),z=Z.slice(U.outerStart,U.outerEnd),B=W1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length;continue}let q=e1(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(yW.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=W1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=W1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}}return Z}function hW($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function dW($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function mW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=i0(Z,X),G=U1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function uW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=i0(Z,X),G=U1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function lW($){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 pW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;if(!j2(X.attrs,"v-once")){Y=X.end;continue}let Q=U1(X.attrs,"v-once"),J=i0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
4024
+ `),_=J[0].outerStart,j=J[J.length-1].outerEnd;Z=Z.slice(0,_)+B+Z.slice(j),Y=_+B.length}return Z}function gW($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function hW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let U=K[1],z=K[2],B=K[3];Q=Q.replace(K[0],""),Q+=` :${U}="${B}" @update:${U}="${B} = $event"`,K=Q.match(G)}if(J){let U=i0(Z,X),z=Z.slice(U.outerStart,U.outerEnd),B=W1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length;continue}let q=e1(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(PW.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=W1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=i0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=W1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}}return Z}function dW($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function mW($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function uW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=i0(Z,X),G=U1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function lW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;let Q=e1(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=i0(Z,X),G=U1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function pW($){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 cW($){let Z=$,Y=0;while(Y<Z.length){let X=S1(Z,Y);if(!X)break;if(!j2(X.attrs,"v-once")){Y=X.end;continue}let Q=U1(X.attrs,"v-once"),J=i0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
4025
4025
  ${W1(G,{...X,start:0,end:X.end-X.start},Q)}
4026
- @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function cW($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function iW($){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 H2($){if(!CW($))return $;let Z=$;return Z=vW(Z),Z=xW(Z),Z=pW(Z),Z=hW(Z),Z=dW(Z),Z=gW(Z),Z=fW(Z),Z=iW(Z),Z=mW(Z),Z=uW(Z),Z=lW(Z),Z=cW(Z),Z}var SW,yW;var O2=b(()=>{SW=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),yW=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 B$($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function L2($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=$0(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${B$(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let B=U.attrs.trim(),_={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(B))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=$0(V,Z)}catch{_[O]=V}else _[O]=V}let L=X.componentsDir||"components",F=await N1(z,_,U.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${B$(B)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J=await nW(J,Z,Y,X,Q),J}async function nW($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=$0(U.expr,Z);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${B$(U.expr)}" -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length);continue}let B=X.componentsDir||"components",_=await N1(z,{},"",B,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${B$(B)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J}var F2=b(()=>{H0();L0()});function V2($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
4027
- ${$.slice(Z)}`}function oW($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:U={}}=Z,z=Y.title||X,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((A)=>{return` <meta ${Object.entries(A).map(([w,T])=>`${w}="${T}"`).join(" ")}>`}).join(`
4026
+ @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function iW($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function nW($){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 H2($){if(!vW($))return $;let Z=$;return Z=xW(Z),Z=fW(Z),Z=cW(Z),Z=dW(Z),Z=mW(Z),Z=hW(Z),Z=gW(Z),Z=nW(Z),Z=uW(Z),Z=lW(Z),Z=pW(Z),Z=iW(Z),Z}var yW,PW;var O2=b(()=>{yW=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),PW=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 B$($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function L2($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=$0(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${B$(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let B=U.attrs.trim(),_={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(B))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=$0(V,Z)}catch{_[O]=V}else _[O]=V}let L=X.componentsDir||"components",F=await N1(z,_,U.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${B$(B)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J=await oW(J,Z,Y,X,Q),J}async function oW($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=$0(U.expr,Z);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${B$(U.expr)}" -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length);continue}let B=X.componentsDir||"components",_=await N1(z,{},"",B,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${B$(B)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J}var F2=b(()=>{H0();L0()});function V2($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
4027
+ ${$.slice(Z)}`}function sW($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:U={}}=Z,z=Y.title||X,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((A)=>{return` <meta ${Object.entries(A).map(([w,T])=>`${w}="${T}"`).join(" ")}>`}).join(`
4028
4028
  `),H=G.map((A)=>{return` <link ${Object.entries(A).map(([w,T])=>`${w}="${T}"`).join(" ")}>`}).join(`
4029
4029
  `),L=K.map((A)=>{if(A.src)return` <script ${Object.entries(A).filter(([w])=>w!=="content").map(([w,T])=>`${w}="${T}"`).join(" ")}></script>`;if(A.content)return` <script>${A.content}</script>`;return""}).filter(Boolean).join(`
4030
4030
  `),F=Object.entries(U).map(([A,N])=>` ${A}="${N}"`).join(""),O=W?` class="${W}"`:"",V=[j,` <title>${z}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((A)=>` ${A}`),...(Y.headScripts||[]).map((A)=>` ${A}`),Y.headStack||""].filter(Boolean),R=[$,...(Y.bodyScripts||[]).map((A)=>A),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
@@ -4039,7 +4039,7 @@ ${R.join(`
4039
4039
  </body>
4040
4040
  </html>`}function t3($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function R2($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:Q=[],script:J=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let U=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(U&&K.includes(U))continue;q.push(` <meta ${Object.entries(W).map(([z,B])=>`${z}="${B}"`).join(" ")}>`)}for(let W of Q){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([U,z])=>`${U}="${z}"`).join(" ")}>`)}for(let W of J)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([U])=>U!=="content").map(([U,z])=>`${U}="${z}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
4041
4041
  `)}
4042
- ${$.slice(Y)}`}function A2($,Z={},Y={}){if(t3($))return $;return oW($,Z,Y)}function H$($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(y0)X.add(y0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),d5)X.forEach((K)=>j$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function O$($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,d5)X.forEach((G)=>j$.add(G));else X.forEach((G)=>G())},J=()=>{if(y0)X.add(y0);if(Y){let G=y0;y0=Q,_$.push(Q);try{Z=$()}finally{_$.pop(),y0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),J}function L$($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=y0;y0=Q,_$.push(Q);try{Y=$()}finally{_$.pop(),y0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function e3($){if(d5){$();return}d5=!0;try{$()}finally{d5=!1,j$.forEach((Z)=>Z()),j$.clear()}}function $6($){sW.push($)}function Z6($){rW.push($)}function F$($){return typeof $==="function"&&$._isSignal===!0}function V$($){return typeof $==="function"&&$._isDerived===!0}function Y6($){if(F$($)||V$($))return $();return $}function R$($){let Z=y0;y0=null;try{return $()}finally{y0=Z}}function aW($,Z){let Y=typeof $==="function"?$:()=>$,X=H$([]),Q=O$(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return L$(()=>{if(Y(),!J){J=!0;return}if(R$(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((B)=>B!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var y0=null,_$,d5=!1,j$,sW,rW;var X6=b(()=>{_$=[],j$=new Set,sW=[],rW=[]});var w2={};o(w2,{useOptimistic:()=>aW,untrack:()=>Y6,state:()=>H$,peek:()=>R$,onMount:()=>$6,onDestroy:()=>Z6,isSignal:()=>F$,isDerived:()=>V$,generateSignalsRuntimeDev:()=>A$,generateSignalsRuntime:()=>N2,effect:()=>L$,derived:()=>O$,default:()=>eW,batch:()=>e3});function N2(){try{let $=tW(A$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return A$()}}function tW($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let Q=$.indexOf(X,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let J=1,G=Q+X.length;while(G<$.length&&J>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")J++;else if(K===")")J--;G++}Z.push("0"),Y=G}return Z.join("")}function A$(){return`
4042
+ ${$.slice(Y)}`}function A2($,Z={},Y={}){if(t3($))return $;return sW($,Z,Y)}function H$($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(y0)X.add(y0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),d5)X.forEach((K)=>j$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Q}function O$($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,d5)X.forEach((G)=>j$.add(G));else X.forEach((G)=>G())},J=()=>{if(y0)X.add(y0);if(Y){let G=y0;y0=Q,_$.push(Q);try{Z=$()}finally{_$.pop(),y0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),J}function L$($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=y0;y0=Q,_$.push(Q);try{Y=$()}finally{_$.pop(),y0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function e3($){if(d5){$();return}d5=!0;try{$()}finally{d5=!1,j$.forEach((Z)=>Z()),j$.clear()}}function $6($){rW.push($)}function Z6($){aW.push($)}function F$($){return typeof $==="function"&&$._isSignal===!0}function V$($){return typeof $==="function"&&$._isDerived===!0}function Y6($){if(F$($)||V$($))return $();return $}function R$($){let Z=y0;y0=null;try{return $()}finally{y0=Z}}function tW($,Z){let Y=typeof $==="function"?$:()=>$,X=H$([]),Q=O$(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return L$(()=>{if(Y(),!J){J=!0;return}if(R$(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((B)=>B!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var y0=null,_$,d5=!1,j$,rW,aW;var X6=b(()=>{_$=[],j$=new Set,rW=[],aW=[]});var w2={};o(w2,{useOptimistic:()=>tW,untrack:()=>Y6,state:()=>H$,peek:()=>R$,onMount:()=>$6,onDestroy:()=>Z6,isSignal:()=>F$,isDerived:()=>V$,generateSignalsRuntimeDev:()=>A$,generateSignalsRuntime:()=>N2,effect:()=>L$,derived:()=>O$,default:()=>$z,batch:()=>e3});function N2(){try{let $=eW(A$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return A$()}}function eW($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let Q=$.indexOf(X,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let J=1,G=Q+X.length;while(G<$.length&&J>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")J++;else if(K===")")J--;G++}Z.push("0"),Y=G}return Z.join("")}function A$(){return`
4043
4043
  // STX Signals Runtime (Development Build)
4044
4044
  console.log('[stx] signals runtime loading');
4045
4045
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -5570,7 +5570,7 @@ catch (e) {
5570
5570
  if (el.nodeType === Node.TEXT_NODE) {
5571
5571
  const text = el.textContent;
5572
5572
  if (text && text.includes('{{')) {
5573
- const parts = text.split(/(\\{\\{[^}]+\\}\\})/g);
5573
+ const parts = text.split(/(\\{\\{[\\s\\S]+?\\}\\})/g);
5574
5574
  if (parts.length > 1) {
5575
5575
  const fragment = document.createDocumentFragment();
5576
5576
  const parentEl = el.parentNode;
@@ -5579,7 +5579,7 @@ catch (e) {
5579
5579
  // through nested @if/@for processing where componentScope may be restored
5580
5580
  const capturedScope = { ...scope, ...(findElementScope(parentEl) || {}), ...globalHelpers };
5581
5581
  parts.forEach(part => {
5582
- const match = part.match(/^\\{\\{\\s*(.+?)\\s*\\}\\}$/);
5582
+ const match = part.match(/^\\{\\{\\s*([\\s\\S]+?)\\s*\\}\\}$/);
5583
5583
  if (match) {
5584
5584
  const expr = match[1];
5585
5585
  // Skip placeholder expressions like __TITLE__ (build-time placeholders)
@@ -6766,6 +6766,18 @@ catch (e) {
6766
6766
  b.placeholder = document.createComment('stx-if-chain');
6767
6767
  parent.insertBefore(b.placeholder, b.el);
6768
6768
  b.el.removeAttribute(b.attr);
6769
+ // A <template> branch (the wrapper convertSignalDirectivesToAttributes
6770
+ // emits for a multi-child / text branch) is INERT \u2014 inserting the element
6771
+ // renders nothing, its content lives in a document fragment. Clone that
6772
+ // content ONCE into a stable node set we toggle in and out, exactly as
6773
+ // bindIf/bindFor already do for template elements. An element branch is
6774
+ // its own single node. Without this, a multi-element @else / @else-if
6775
+ // branch rendered blank the moment the markup was well-formed enough to
6776
+ // survive as a real <template> (the #1784 markup fix). See #1784.
6777
+ b.isTemplate = b.el.tagName === 'TEMPLATE';
6778
+ b.nodes = b.isTemplate
6779
+ ? Array.prototype.slice.call(b.el.content.cloneNode(true).childNodes)
6780
+ : [b.el];
6769
6781
  b.el.remove();
6770
6782
  b.childrenProcessed = false;
6771
6783
  });
@@ -6849,13 +6861,16 @@ catch (e2) {
6849
6861
  // components under reactive conditionals (#1737). Permanent disposal is
6850
6862
  // still handled by bindFor (item removal) and cleanupContainer (SPA nav).
6851
6863
  if (currentIdx !== -1) {
6852
- chain[currentIdx].el.remove();
6864
+ chain[currentIdx].nodes.forEach(function (n) { if (n.parentNode) n.parentNode.removeChild(n); });
6853
6865
  }
6854
6866
 
6855
6867
  // Insert + process the newly-picked branch.
6856
6868
  if (pickedIdx !== -1) {
6857
6869
  var pick = chain[pickedIdx];
6858
- pick.placeholder.parentNode.insertBefore(pick.el, pick.placeholder.nextSibling);
6870
+ // Insert this branch's node(s) before the placeholder's next sibling.
6871
+ // The anchor is captured once so the nodes stack in source order.
6872
+ var anchor = pick.placeholder.nextSibling;
6873
+ pick.nodes.forEach(function (n) { pick.placeholder.parentNode.insertBefore(n, anchor); });
6859
6874
  pick.el.__stx_shown_at = performance.now();
6860
6875
  if (!pick.childrenProcessed) {
6861
6876
  pick.childrenProcessed = true;
@@ -6865,9 +6880,12 @@ catch (e2) {
6865
6880
  (function (branch) {
6866
6881
  setTimeout(function () {
6867
6882
  var childScope = { ...capturedComponentScope, ...(branch.capturedElementScope || {}), ...globalHelpers };
6868
- processElement(branch.el, childScope);
6869
- branch.el.removeAttribute('x-cloak');
6870
- branch.el.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
6883
+ branch.nodes.forEach(function (n) {
6884
+ if (n.nodeType !== 1) return; // whitespace/text between template children
6885
+ processElement(n, childScope);
6886
+ n.removeAttribute('x-cloak');
6887
+ n.querySelectorAll('[x-cloak]').forEach(function (c) { c.removeAttribute('x-cloak'); });
6888
+ });
6871
6889
  }, 0);
6872
6890
  })(pick);
6873
6891
  }
@@ -9260,7 +9278,7 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
9260
9278
  }
9261
9279
  }
9262
9280
  })();
9263
- `}var eW;var T2=b(()=>{X6();X6();eW={state:H$,derived:O$,effect:L$,batch:e3,onMount:$6,onDestroy:Z6,isSignal:F$,isDerived:V$,untrack:Y6,peek:R$,generateSignalsRuntime:N2,generateSignalsRuntimeDev:A$}});var J6={};o(J6,{templateCache:()=>M2,readFileCached:()=>$z,invalidateFileCacheByDir:()=>Yz,invalidateFileCache:()=>Zz,hashFilePath:()=>m5,getCachedSignalsRuntime:()=>Qz,getCachedRouterScript:()=>Gz,clearDevCaches:()=>Kz,checkCache:()=>qz,cacheTemplate:()=>Uz,__setSignalsGeneratorsForTest:()=>Jz});import z1 from"fs";import $5 from"path";async function $z($){let Y;for(let X=0;X<3;X++)try{let J=(await z1.promises.stat($)).mtime.getTime(),G=y1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await z1.promises.stat($)).mtime.getTime();if(W!==J)continue;return y1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw y1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function Zz($){y1.delete($)}function Yz($){for(let Z of y1.keys())if(Z.startsWith($))y1.delete(Z)}function Jz($){I2=$}async function Qz($=!1){let Z=I2??await Promise.resolve().then(() => (T2(),w2));if($)return Z.generateSignalsRuntimeDev();if(N$===null)N$=Z.generateSignalsRuntime();return N$}async function Gz(){if(w$===null){let{getRouterScript:$}=await import("stx-router");w$=$()}return w$}function Kz(){y1.clear(),N$=null,Xz=null,w$=null}function D2($){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 qz($,Z){try{if(!Z.cachePath)return null;let Y=$5.resolve(Z.cachePath),X=$5.join(Y,`${m5($)}.html`),Q=$5.join(Y,`${m5($)}.meta.json`);if(!await i(X)||!await i(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==D2(Z))return null;if((await z1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await i(q)){if((await z1.promises.stat(q)).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 Uz($,Z,Y,X){try{if(!X.cachePath)return;let Q=$5.resolve(X.cachePath);await z1.promises.mkdir(Q,{recursive:!0});let J=$5.join(Q,`${m5($)}.html`),G=$5.join(Q,`${m5($)}.meta.json`),K=await z1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:D2(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),M2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function m5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Wz)}var M2,y1,N$=null,Xz=null,I2=null,w$=null,Wz=16;var Q6=b(()=>{H0();M2=new Map,y1=new Map});function E2($){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]+`
9281
+ `}var $z;var T2=b(()=>{X6();X6();$z={state:H$,derived:O$,effect:L$,batch:e3,onMount:$6,onDestroy:Z6,isSignal:F$,isDerived:V$,untrack:Y6,peek:R$,generateSignalsRuntime:N2,generateSignalsRuntimeDev:A$}});var J6={};o(J6,{templateCache:()=>M2,readFileCached:()=>Zz,invalidateFileCacheByDir:()=>Xz,invalidateFileCache:()=>Yz,hashFilePath:()=>m5,getCachedSignalsRuntime:()=>Gz,getCachedRouterScript:()=>Kz,clearDevCaches:()=>qz,checkCache:()=>Uz,cacheTemplate:()=>Wz,__setSignalsGeneratorsForTest:()=>Qz});import z1 from"fs";import $5 from"path";async function Zz($){let Y;for(let X=0;X<3;X++)try{let J=(await z1.promises.stat($)).mtime.getTime(),G=y1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await z1.promises.stat($)).mtime.getTime();if(W!==J)continue;return y1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw y1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function Yz($){y1.delete($)}function Xz($){for(let Z of y1.keys())if(Z.startsWith($))y1.delete(Z)}function Qz($){I2=$}async function Gz($=!1){let Z=I2??await Promise.resolve().then(() => (T2(),w2));if($)return Z.generateSignalsRuntimeDev();if(N$===null)N$=Z.generateSignalsRuntime();return N$}async function Kz(){if(w$===null){let{getRouterScript:$}=await import("stx-router");w$=$()}return w$}function qz(){y1.clear(),N$=null,Jz=null,w$=null}function D2($){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 Uz($,Z){try{if(!Z.cachePath)return null;let Y=$5.resolve(Z.cachePath),X=$5.join(Y,`${m5($)}.html`),Q=$5.join(Y,`${m5($)}.meta.json`);if(!await i(X)||!await i(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==D2(Z))return null;if((await z1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await i(q)){if((await z1.promises.stat(q)).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 Wz($,Z,Y,X){try{if(!X.cachePath)return;let Q=$5.resolve(X.cachePath);await z1.promises.mkdir(Q,{recursive:!0});let J=$5.join(Q,`${m5($)}.html`),G=$5.join(Q,`${m5($)}.meta.json`),K=await z1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:D2(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),M2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function m5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,zz)}var M2,y1,N$=null,Jz=null,I2=null,w$=null,zz=16;var Q6=b(()=>{H0();M2=new Map,y1=new Map});function E2($){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]+`
9264
9282
  `;let Q=/\{\{([\s\S]*?)\}\}/g;while((X=Q.exec($))!==null)Y+=X[1]+`
9265
9283
  `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel"].some((B)=>{return new RegExp(`\\b${B}\\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"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,W,U=!1;while((W=q.exec(Y))!==null)if(!K.has(W[1])){U=!0;break}if(!G&&!U)return $;let z=`<script type="module">
9266
9284
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
@@ -9278,13 +9296,13 @@ ${z}`);return z+`
9278
9296
  `+Q+$.slice(K+1)}return Q+`
9279
9297
  `+$}async function b2($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
9280
9298
  `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (Q6(),J6)),J=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
9281
- </body>`+$.slice(G+7)}var m2={};o(m2,{scanScriptTags:()=>x2,rewriteStxImportSpecifiers:()=>d2,processSignals:()=>W6,processScriptSetup:()=>g2,preEvalLiteralReactiveIfs:()=>q6,parseLoopExpression:()=>f2,hasSignalsSyntax:()=>D$,findMarkupIndexOutsideScripts:()=>I$,extractExports:()=>h2,convertSignalLoopsToAttributes:()=>U6,convertSignalDirectivesToAttributes:()=>K6});function x2($,Z={}){let Y=[];T$.lastIndex=0;let X;while((X=T$.exec($))!==null){let Q=X[1],J=X.index+X[0].length,G=$.toLowerCase().indexOf("</script>",J);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(Q)){T$.lastIndex=K;continue}Y.push({fullMatch:$.slice(X.index,K),attrs:Q,body:$.slice(J,G),start:X.index,end:K}),T$.lastIndex=K}return Y}function f2($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=S2(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=S2(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function S2($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function D$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function Bz($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function _z($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function jz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function P2($,Z,Y){if(!$)return!1;let X=jz($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let B=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(y2.has(B))continue;if(Z.has(B))Q=!0;else if(Y&&B in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(X))!==null){let B=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(y2.has(B)||Y&&B in Y)continue;G=!0}return(Q||G)&&!J}function M$($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(v2);if(J&&Hz(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function Hz($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function K6($,Z){let Y=$,X=_z($),Q=/@if\s*\(/g,J,G=[];while((J=Q.exec(Y))!==null){let K=J.index,q=K+J[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),B=U,_=1,j=B,H=/@(if\s*\(|endif)/g;H.lastIndex=B;let L;while((L=H.exec(Y))!==null)if(L[1].startsWith("if"))_++;else if(L[1]==="endif"){if(_--,_===0){j=L.index+L[0].length;break}}if(_!==0)continue;let F=Y.substring(B,j-6).trim(),O;if(Bz(F)){let V=y5(Y.substring(K,j));if(V.length===0)continue;let R=V[0].branches.filter((w)=>w.type!=="else");if(!(R.length>0&&R.every((w)=>P2(w.condition,X,Z))))continue;O=V[0].branches.map((w)=>{if(w.type==="elseif")return M$(w.content,"@else-if",w.condition??"");if(w.type==="else")return M$(w.content,"@else");return M$(w.content,"@if",w.condition??"")}).join(`
9282
- `)}else{if(!P2(z,X,Z))continue;O=M$(F,"@if",z)}G.push({start:K,end:j,replacement:O})}for(let K=G.length-1;K>=0;K--){let{start:q,end:W,replacement:U}=G[K];Y=Y.substring(0,q)+U+Y.substring(W)}return Y}function Oz($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function Lz($,Z,Y,X){if(G6.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let j=J.indexOf(`</${U[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===Q){if(K--,q+=_[0].length,K===0)return q;continue}q+=_[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let B=$.indexOf(">",q);if(B===-1)return-1;if(z[1].toLowerCase()===Q){let _=$.slice(q,B+1);if(!(/\/\s*>$/.test(_)||G6.has(Q)))K++}q=B+1}return-1}function Vz($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let J=$.slice(Y,Q+1);return Fz.test(J)}function q6($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;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]);let Q=(z)=>Z.some(([B,_])=>z>=B&&z<_),J=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=J.exec($))!==null){if(Q(K.index))continue;let[z,B,_,j,H,L,F]=K,O=Oz(H);if(O===void 0)continue;let V=K.index,R=V+z.length,w=!!F||/\/\s*>$/.test(z)||G6.has(B.toLowerCase())?R:Lz($,V,B,R);if(w===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&Vz($,w)){J.lastIndex=R;continue}if(O===!0){let M=`<${B}${_}${L}${F}>`;G.push({start:V,end:R,replacement:M});continue}G.push({start:V,end:w,replacement:""}),J.lastIndex=w}if(G.length===0)return $;G.sort((z,B)=>z.start-B.start);let q=[],W=-1;for(let z of G){if(z.start<W)continue;q.push(z),W=z.end}let U=$;for(let z=q.length-1;z>=0;z--){let{start:B,end:_,replacement:j}=q[z];U=U.substring(0,B)+j+U.substring(_)}return U}function U6($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),B=U,_=f2(z);if(_.iterable){let N=_.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N))continue;if(Z){let w=N.split(/[.[(]/)[0].trim();if(w&&w in Z)continue}}if(_.style==="as")z=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=B,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=B;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(B,L-j.length).trim(),R=V.match(v2),A;if(R){let[,N,w,T]=R;A=`<${N}${w} @for="${z}">${T}</${N}>`}else A=`<template @for="${z}">${V}</template>`;J.push({start:K,end:L,replacement:A})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function Rz($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let B=$[z];if(B==="\\"){z+=2;continue}if(B===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
9299
+ </body>`+$.slice(G+7)}var m2={};o(m2,{scanScriptTags:()=>x2,rewriteStxImportSpecifiers:()=>d2,processSignals:()=>W6,processScriptSetup:()=>g2,preEvalLiteralReactiveIfs:()=>q6,parseLoopExpression:()=>f2,hasSignalsSyntax:()=>D$,findMarkupIndexOutsideScripts:()=>I$,extractExports:()=>h2,convertSignalLoopsToAttributes:()=>U6,convertSignalDirectivesToAttributes:()=>K6});function x2($,Z={}){let Y=[];T$.lastIndex=0;let X;while((X=T$.exec($))!==null){let Q=X[1],J=X.index+X[0].length,G=$.toLowerCase().indexOf("</script>",J);if(G===-1)break;let K=G+9;if(Z.skipAttrs&&Z.skipAttrs.test(Q)){T$.lastIndex=K;continue}Y.push({fullMatch:$.slice(X.index,K),attrs:Q,body:$.slice(J,G),start:X.index,end:K}),T$.lastIndex=K}return Y}function f2($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=S2(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=S2(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function S2($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function D$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function _z($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function jz($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function Hz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function P2($,Z,Y){if(!$)return!1;let X=Hz($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let B=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(y2.has(B))continue;if(Z.has(B))Q=!0;else if(Y&&B in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(X))!==null){let B=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(y2.has(B)||Y&&B in Y)continue;G=!0}return(Q||G)&&!J}function M$($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(v2);if(J&&Oz(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function Oz($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function K6($,Z){let Y=jz($);function X(Q){let J=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(J))!==null){let W=K.index,U=W+K[0].length,z=1,B=U;while(B<J.length&&z>0){if(J[B]==="(")z++;else if(J[B]===")")z--;B++}if(z!==0)continue;let _=J.substring(U,B-1).trim(),j=B,H=1,L=j,F=/@(if\s*\(|endif)/g;F.lastIndex=j;let O;while((O=F.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(j,L-6).trim(),R;if(_z(V)){let A=y5(J.substring(W,L));if(A.length===0)continue;let N=A[0].branches.filter((M)=>M.type!=="else");if(!(N.length>0&&N.every((M)=>P2(M.condition,Y,Z))))continue;R=A[0].branches.map((M)=>{let I=X(M.content);if(M.type==="elseif")return M$(I,"@else-if",M.condition??"");if(M.type==="else")return M$(I,"@else");return M$(I,"@if",M.condition??"")}).join(`
9300
+ `)}else{if(!P2(_,Y,Z))continue;R=M$(X(V),"@if",_)}q.push({start:W,end:L,replacement:R}),G.lastIndex=L}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:B}=q[W];J=J.substring(0,U)+B+J.substring(z)}return J}return X($)}function Lz($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function Fz($,Z,Y,X){if(G6.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let j=J.indexOf(`</${U[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===Q){if(K--,q+=_[0].length,K===0)return q;continue}q+=_[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let B=$.indexOf(">",q);if(B===-1)return-1;if(z[1].toLowerCase()===Q){let _=$.slice(q,B+1);if(!(/\/\s*>$/.test(_)||G6.has(Q)))K++}q=B+1}return-1}function Rz($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let J=$.slice(Y,Q+1);return Vz.test(J)}function q6($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;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]);let Q=(z)=>Z.some(([B,_])=>z>=B&&z<_),J=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=J.exec($))!==null){if(Q(K.index))continue;let[z,B,_,j,H,L,F]=K,O=Lz(H);if(O===void 0)continue;let V=K.index,R=V+z.length,w=!!F||/\/\s*>$/.test(z)||G6.has(B.toLowerCase())?R:Fz($,V,B,R);if(w===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&Rz($,w)){J.lastIndex=R;continue}if(O===!0){let M=`<${B}${_}${L}${F}>`;G.push({start:V,end:R,replacement:M});continue}G.push({start:V,end:w,replacement:""}),J.lastIndex=w}if(G.length===0)return $;G.sort((z,B)=>z.start-B.start);let q=[],W=-1;for(let z of G){if(z.start<W)continue;q.push(z),W=z.end}let U=$;for(let z=q.length-1;z>=0;z--){let{start:B,end:_,replacement:j}=q[z];U=U.substring(0,B)+j+U.substring(_)}return U}function U6($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),B=U,_=f2(z);if(_.iterable){let N=_.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N))continue;if(Z){let w=N.split(/[.[(]/)[0].trim();if(w&&w in Z)continue}}if(_.style==="as")z=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=B,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=B;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(B,L-j.length).trim(),R=V.match(v2),A;if(R){let[,N,w,T]=R;A=`<${N}${w} @for="${z}">${T}</${N}>`}else A=`<template @for="${z}">${V}</template>`;J.push({start:K,end:L,replacement:A})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function Az($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let B=$[z];if(B==="\\"){z+=2;continue}if(B===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
9283
9301
  `)U++;return U},q=()=>{let U=X+2;while(U<J-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return J},W=(U)=>{let z=U,B=0;while(z<J){let _=$[z];if(_==="/"&&$[z+1]==="/"){let j=z+2;while(j<J&&$[j]!==`
9284
- `)j++;z=j;continue}if(_==="/"&&$[z+1]==="*"){let j=z+2;while(j<J-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(_==='"'||_==="'"||_==="`"){let j=z+1;while(j<J){if($[j]==="\\"){j+=2;continue}if($[j]===_){j++;break}j++}z=j;continue}if(_==="("||_==="["||_==="{"){B++,z++;continue}if(_===")"||_==="]"||_==="}"){B--,z++;continue}if(_===";"&&B===0)return z+1;z++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let z=K();Y.push($.slice(X,z)),X=z;continue}if(U==="/"&&$[X+1]==="*"){let z=q();Y.push($.slice(X,z)),X=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(X,z)),X=z;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.push(U),X++;continue}if(Q===0){let z=X>0?$[X-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let _=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let j=_[2],H=W(X+_[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function g2($,Z,Y){let X=x2($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let H of X){let L=H.body;if(L1(H.attrs))L=F1(L);if(Q.test(L))J.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${zz++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (Z4(),$4)),W=[];for(let H=0;H<J.length;H++){let L=J[H].content;if(K(L))console.log("[stx:bundler] bundling signal script imports"),L=await q(L,Z||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(O,V)=>d2(V));let F=a0(L);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
9302
+ `)j++;z=j;continue}if(_==="/"&&$[z+1]==="*"){let j=z+2;while(j<J-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(_==='"'||_==="'"||_==="`"){let j=z+1;while(j<J){if($[j]==="\\"){j+=2;continue}if($[j]===_){j++;break}j++}z=j;continue}if(_==="("||_==="["||_==="{"){B++,z++;continue}if(_===")"||_==="]"||_==="}"){B--,z++;continue}if(_===";"&&B===0)return z+1;z++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let z=K();Y.push($.slice(X,z)),X=z;continue}if(U==="/"&&$[X+1]==="*"){let z=q();Y.push($.slice(X,z)),X=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(X,z)),X=z;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.push(U),X++;continue}if(Q===0){let z=X>0?$[X-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let _=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let j=_[2],H=W(X+_[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function g2($,Z,Y){let X=x2($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,J=[];for(let H of X){let L=H.body;if(L1(H.attrs))L=F1(L);if(Q.test(L))J.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${Bz++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (Z4(),$4)),W=[];for(let H=0;H<J.length;H++){let L=J[H].content;if(K(L))console.log("[stx:bundler] bundling signal script imports"),L=await q(L,Z||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(O,V)=>d2(V));let F=a0(L);W.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
9285
9303
  ${F}`)}let U=W.join(`
9286
9304
 
9287
- `);U=Rz(U);let z=h2(U),B=Y4(U,Y),_=`
9305
+ `);U=Az(U);let z=h2(U),B=Y4(U,Y),_=`
9288
9306
  <script data-stx-scoped>
9289
9307
  function ${G}() {
9290
9308
  const { 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;
@@ -9297,23 +9315,23 @@ if(window.stx)window.stx._latestSetup=${G};
9297
9315
  `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},_=()=>{if(Q!==0)return;let j=Z.slice(J).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(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let R=V.trim();if(!R)return;let A=R.indexOf(":"),w=(A>=0?R.slice(A+1).trim():R).split(/[\s=]/)[0];if(w&&!X.has(w))Y.push(w),X.add(w)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let R=V.trim().replace(/^\.\.\./,"");if(!R)return;let A=R.split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let F=Z.slice(J).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 O=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(J<G){if(B())continue;if(Z[J]==="'"||Z[J]==='"'){U(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){z(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))_();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function W6($,Z,Y,X){if(!D$($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await g2(Q,Y,X);if(Q=J,Q=await k2(Q,Z),Q=E2(Q),G){let U=I$(Q,/<\/head>/i),z=U===-1?I$(Q,/<body[^>]*>/i):-1;if(U!==-1)Q=`${Q.slice(0,U)}${G}
9298
9316
  ${Q.slice(U)}`;else if(z!==-1){let B=/<body[^>]*>/i.exec(Q.slice(z))[0],_=z+B.length;Q=`${Q.slice(0,_)}
9299
9317
  ${G}${Q.slice(_)}`}else Q=`${Q}
9300
- ${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,z=I$(Q,U);if(z!==-1){let B=Q.slice(0,z),_=Q.slice(z).replace(U,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=B+_}}return Q}function I$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=Y.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);let J=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=J.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([U,z])=>q>=U&&q<z))return q;G=q+Math.max(K[0].length,1)}return-1}function d2($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let Q=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return C2;return`const ${Z.join(", ")}; ${C2}`}var zz=0,T$,v2,y2,G6,Fz,C2="// [stx import stripped \u2014 resolved via window.stx in __stx_setup]";var z6=b(()=>{O5();a4();H0();T$=/<script\b([^>]*)>/gi,v2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;y2=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"]);G6=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Fz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Z5 from"path";function u2($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function l2($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=Z5.join(Q,$);if(await Bun.file(G).exists())return G;Q=Z5.dirname(Q)}X=Z5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=Z5.resolve(Z,$);else X=Z5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function p2($,Z,Y){let X=$,Q=Z5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,B]=G;if(u2(z))continue;let _=await l2(z,Q,Z);if(_)try{let j=await Bun.file(_).text();if(Y.add(_),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:l0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
9318
+ ${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,z=I$(Q,U);if(z!==-1){let B=Q.slice(0,z),_=Q.slice(z).replace(U,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=B+_}}return Q}function I$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=Y.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);let J=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=J.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([U,z])=>q>=U&&q<z))return q;G=q+Math.max(K[0].length,1)}return-1}function d2($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let Q=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return C2;return`const ${Z.join(", ")}; ${C2}`}var Bz=0,T$,v2,y2,G6,Vz,C2="// [stx import stripped \u2014 resolved via window.stx in __stx_setup]";var z6=b(()=>{O5();a4();H0();T$=/<script\b([^>]*)>/gi,v2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;y2=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"]);G6=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Vz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Z5 from"path";function u2($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function l2($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=Z5.join(Q,$);if(await Bun.file(G).exists())return G;Q=Z5.dirname(Q)}X=Z5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=Z5.resolve(Z,$);else X=Z5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function p2($,Z,Y){let X=$,Q=Z5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,B]=G;if(u2(z))continue;let _=await l2(z,Q,Z);if(_)try{let j=await Bun.file(_).text();if(Y.add(_),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:l0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
9301
9319
  // Source: ${z}
9302
9320
  ${j}
9303
9321
  </script>`;X=X.replace(W,H),J.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,U,z,B]=q,_=U+B;if(u2(z))continue;if(/rel=["']stylesheet["']/.test(_)||z.endsWith(".css")){let H=await l2(z,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
9304
9322
  /* Source: ${z} */
9305
9323
  ${L}
9306
- </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var c2=b(()=>{h1()});function E$($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,U=!1;while(q<Y.length&&K>0){let V=Y[q];if(U){U=!1,q++;continue}if(V==="\\"&&W){U=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),B=Y.substring(J,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<z.length;V++){let R=z[V];if(L){L=!1;continue}if(R==="\\"&&H){L=!0;continue}if(H){if(R===H)H=null;continue}if(R==='"'||R==="'"||R==="`"){H=R;continue}if(R==="("||R==="["||R==="{")j++;else if(R===")"||R==="]"||R==="}")j--;if(R===","&&j===0){_=V;break}}let F=_>=0?z.substring(0,_).trim():z,O=_>=0?z.substring(_+1).trim():void 0;try{let V=F.trim(),R;if(X0(V))R=J0(V,Object.keys(Z))(...Object.values(Z));else R=void 0;let A;if(O==="true")A=JSON.stringify(R,null,2);else A=JSON.stringify(R);let N=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+N+Y.substring(q+1),X.lastIndex=J+N.length}catch(V){m0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Y}function k$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function i2($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),U=q,z=Z.slice(U),B=z.indexOf("@endmemo");if(B===-1)continue;let _=z.slice(0,B),j=U+B+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,R=F.slice(0,F.length-V),A=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(A){let[w,T,M="",I]=A,D=`<${T}${M} data-stx-memo="${W}"${I}>`;N=_.slice(0,L)+D+R.slice(w.length)+_.slice(L+R.length)}else N=`${_.slice(0,L)}<div data-stx-memo="${W}">${R}</div>${_.slice(L+R.length)}`;Q.push({start:J,end:j,replacement:N}),Y.lastIndex=j}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function B6($){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 n2($){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="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,U=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let B=$.slice(U+1),_=B.indexOf("</"),j=_>=0?B.slice(0,_):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function o2($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,J);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!Az.test(z))continue;let B=$[U-1]==="/",_=B?U-1:U;Y+=`${$.slice(X,_)} x-cloak${B?" ":""}`,X=_}return Y+=$.slice(X),Y}var Az;var _6=b(()=>{t0();L0();Az=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function b$($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of Nz){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let U=$.split(`
9324
+ </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var c2=b(()=>{h1()});function E$($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,U=!1;while(q<Y.length&&K>0){let V=Y[q];if(U){U=!1,q++;continue}if(V==="\\"&&W){U=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),B=Y.substring(J,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<z.length;V++){let R=z[V];if(L){L=!1;continue}if(R==="\\"&&H){L=!0;continue}if(H){if(R===H)H=null;continue}if(R==='"'||R==="'"||R==="`"){H=R;continue}if(R==="("||R==="["||R==="{")j++;else if(R===")"||R==="]"||R==="}")j--;if(R===","&&j===0){_=V;break}}let F=_>=0?z.substring(0,_).trim():z,O=_>=0?z.substring(_+1).trim():void 0;try{let V=F.trim(),R;if(X0(V))R=J0(V,Object.keys(Z))(...Object.values(Z));else R=void 0;let A;if(O==="true")A=JSON.stringify(R,null,2);else A=JSON.stringify(R);let N=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+N+Y.substring(q+1),X.lastIndex=J+N.length}catch(V){m0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Y}function k$($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function i2($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),U=q,z=Z.slice(U),B=z.indexOf("@endmemo");if(B===-1)continue;let _=z.slice(0,B),j=U+B+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,R=F.slice(0,F.length-V),A=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(A){let[w,T,M="",I]=A,D=`<${T}${M} data-stx-memo="${W}"${I}>`;N=_.slice(0,L)+D+R.slice(w.length)+_.slice(L+R.length)}else N=`${_.slice(0,L)}<div data-stx-memo="${W}">${R}</div>${_.slice(L+R.length)}`;Q.push({start:J,end:j,replacement:N}),Y.lastIndex=j}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function B6($){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 n2($){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="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,U=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let B=$.slice(U+1),_=B.indexOf("</"),j=_>=0?B.slice(0,_):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function o2($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,J);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!Nz.test(z))continue;let B=$[U-1]==="/",_=B?U-1:U;Y+=`${$.slice(X,_)} x-cloak${B?" ":""}`,X=_}return Y+=$.slice(X),Y}var Nz;var _6=b(()=>{t0();L0();Nz=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function b$($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of wz){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let U=$.split(`
9307
9325
  `),z=[];U.forEach((_,j)=>{if(G.lastIndex=0,G.test(_))z.push(j+1)});let B=z.length>0?` (line${z.length>1?"s":""}: ${z.join(", ")})`:"";J.push(` \u2717 ${K}${B}
9308
9326
  \u2192 ${q}`)}}if(J.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
9309
9327
  ${J.join(`
9310
9328
  `)}
9311
- Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var Nz;var j6=b(()=>{Nz=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var s2={};o(s2,{getStoreScript:()=>wz,clearStoreCache:()=>Tz});import S$ from"path";async function wz($){let Z;if($)Z=S$.resolve($);else{let U=await i4();Z=S$.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=Y5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Z,absolute:!0})){let z=S$.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return Y5.set(Z,""),null}if(Q.length===0)return Y5.set(Z,""),null;let J=[];for(let U of Q){let z=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(z)})}J.sort((U,z)=>{if(U.hasUseStore===z.hasUseStore)return 0;return U.hasUseStore?1:-1});let G=J.map((U)=>U.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()});for(let U of G)try{let z=await Bun.file(U).text(),B=S$.basename(U,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${B}
9329
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var wz;var j6=b(()=>{wz=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var s2={};o(s2,{getStoreScript:()=>Tz,clearStoreCache:()=>Mz});import S$ from"path";async function Tz($){let Z;if($)Z=S$.resolve($);else{let U=await i4();Z=S$.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=Y5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Z,absolute:!0})){let z=S$.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return Y5.set(Z,""),null}if(Q.length===0)return Y5.set(Z,""),null;let J=[];for(let U of Q){let z=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(z)})}J.sort((U,z)=>{if(U.hasUseStore===z.hasUseStore)return 0;return U.hasUseStore?1:-1});let G=J.map((U)=>U.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:l0()});for(let U of G)try{let z=await Bun.file(U).text(),B=S$.basename(U,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${B}
9312
9330
  ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${U}:`,z)}if(K.length===0)return Y5.set(Z,""),null;let W=`;(function(){
9313
9331
  ${K.join(`
9314
9332
 
9315
9333
  `)}
9316
- })();`;return Y5.set(Z,W),W}function Tz(){Y5.clear()}var Y5;var r2=b(()=>{b5();h1();Y5=new Map});var t2={};o(t2,{processDeferDirectives:()=>kz});function Mz(){return`stx-defer-${++a2}`}function Iz($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function Dz($,Z,Y){let{trigger:X,value:Q}=Iz(Z),J=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),J=J.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return J=J.trim(),{trigger:X,triggerValue:Q,content:J,placeholder:G,loading:K,error:q}}function Ez($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
9334
+ })();`;return Y5.set(Z,W),W}function Mz(){Y5.clear()}var Y5;var r2=b(()=>{b5();h1();Y5=new Map});var t2={};o(t2,{processDeferDirectives:()=>bz});function Iz(){return`stx-defer-${++a2}`}function Dz($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function Ez($,Z,Y){let{trigger:X,value:Q}=Dz(Z),J=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),J=J.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return J=J.trim(),{trigger:X,triggerValue:Q,content:J,placeholder:G,loading:K,error:q}}function kz($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
9317
9335
  const observer = new IntersectionObserver((entries) => {
9318
9336
  if (entries[0].isIntersecting) {
9319
9337
  observer.disconnect();
@@ -9386,7 +9404,7 @@ else {
9386
9404
  ${Q}
9387
9405
  })();
9388
9406
  </script>
9389
- `}function kz($,Z,Y){a2=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=Mz(),q=Dz(Q,J,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",U=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,_=Ez(K,q);return`
9407
+ `}function bz($,Z,Y){a2=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=Iz(),q=Ez(Q,J,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",U=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,_=kz(K,q);return`
9390
9408
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
9391
9409
  ${W}
9392
9410
  ${U}
@@ -9394,7 +9412,7 @@ else {
9394
9412
  ${z}
9395
9413
  </div>
9396
9414
  ${_}
9397
- `})}var a2=0;var $X={};o($X,{processTeleportDirectives:()=>Pz,ensureTeleportTargets:()=>Cz});function bz(){return`stx-teleport-${++e2}`}function Sz($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let Q=1;Q<Z.length;Q++){let J=Z[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Y,disabled:X}}function yz($,Z){return`
9415
+ `})}var a2=0;var $X={};o($X,{processTeleportDirectives:()=>Cz,ensureTeleportTargets:()=>vz});function Sz(){return`stx-teleport-${++e2}`}function yz($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let Q=1;Q<Z.length;Q++){let J=Z[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Y,disabled:X}}function Pz($,Z){return`
9398
9416
  <script>
9399
9417
  (function() {
9400
9418
  const source = document.getElementById('${$}');
@@ -9440,12 +9458,12 @@ else {
9440
9458
  });
9441
9459
  })();
9442
9460
  </script>
9443
- `}function Pz($,Z,Y){e2=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=bz(),{target:q,disabled:W}=Sz(J),U=G.trim();if(W)try{let B=!1;if(W==="true")B=!0;else if(W==="false")B=!1;else if(W in Z)B=Boolean(Z[W]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=yz(K,q);return`
9461
+ `}function Cz($,Z,Y){e2=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=Sz(),{target:q,disabled:W}=yz(J),U=G.trim();if(W)try{let B=!1;if(W==="true")B=!0;else if(W==="false")B=!1;else if(W in Z)B=Boolean(Z[W]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=Pz(K,q);return`
9444
9462
  <div id="${K}" class="stx-teleport-source" style="display: none;">
9445
9463
  <template>${U}</template>
9446
9464
  </div>
9447
9465
  ${z}
9448
- `})}function Cz(){return`
9466
+ `})}function vz(){return`
9449
9467
  <script>
9450
9468
  (function() {
9451
9469
  // Common teleport targets
@@ -9462,7 +9480,7 @@ else {
9462
9480
  });
9463
9481
  })();
9464
9482
  </script>
9465
- `}var e2=0;var JX={};o(JX,{processTransitionDirectives:()=>gz,processTransitionAttributes:()=>uz,performLeave:()=>fz,performEnter:()=>xz,generateTransitionRuntime:()=>mz,generateTransitionCSS:()=>dz});function ZX($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function vz($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",Q=(J)=>{let G=J.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Y),Q(X))}function YX($,Z){return new Promise((Y)=>{let X=Z??vz($);if(X===0){Y();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function XX($){$.offsetHeight}async function xz($,Z={}){let Y=Z.name||"stx",X=ZX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),XX($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await YX($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function fz($,Z={}){let Y=Z.name||"stx",X=ZX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),XX($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await YX($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function gz($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=hz(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
9483
+ `}var e2=0;var JX={};o(JX,{processTransitionDirectives:()=>hz,processTransitionAttributes:()=>lz,performLeave:()=>gz,performEnter:()=>fz,generateTransitionRuntime:()=>uz,generateTransitionCSS:()=>mz});function ZX($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function xz($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",Q=(J)=>{let G=J.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Y),Q(X))}function YX($,Z){return new Promise((Y)=>{let X=Z??xz($);if(X===0){Y();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function XX($){$.offsetHeight}async function fz($,Z={}){let Y=Z.name||"stx",X=ZX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),XX($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await YX($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function gz($,Z={}){let Y=Z.name||"stx",X=ZX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),XX($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await YX($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function hz($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=dz(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
9466
9484
  <div
9467
9485
  class="stx-transition-wrapper"
9468
9486
  data-transition="${q}"
@@ -9504,7 +9522,7 @@ else {
9504
9522
  });
9505
9523
  })();
9506
9524
  </script>
9507
- `})}function hz($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Z.name=J;break;case"duration":Z.duration=parseInt(J,10);break;case"mode":Z.mode=J;break;case"easing":Z.easing=J;break}}return Z}function dz(){return`
9525
+ `})}function dz($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Z.name=J;break;case"duration":Z.duration=parseInt(J,10);break;case"mode":Z.mode=J;break;case"easing":Z.easing=J;break}}return Z}function mz(){return`
9508
9526
  /* STX Transition Presets */
9509
9527
 
9510
9528
  /* Fade */
@@ -9691,7 +9709,7 @@ else {
9691
9709
  opacity: 1;
9692
9710
  max-height: 1000px;
9693
9711
  }
9694
- `}function mz(){return`
9712
+ `}function uz(){return`
9695
9713
  // STX Transition Runtime
9696
9714
  (function() {
9697
9715
  if (typeof window === 'undefined') return;
@@ -9780,7 +9798,7 @@ else {
9780
9798
 
9781
9799
  console.log('[stx] Transition runtime initialized');
9782
9800
  })();
9783
- `}function uz($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,Q,J)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${J}" data-stx-transition-id="${K}"`})}var GX={};o(GX,{withErrorBoundary:()=>QX,processErrorBoundaryDirectives:()=>cz,generateErrorBoundaryRuntime:()=>rz,generateErrorBoundaryCSS:()=>sz,createErrorBoundary:()=>oz});function pz(){return`eb-${++lz}-${Date.now().toString(36)}`}function cz($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=pz(),W=iz(J||"");return nz(q,G.trim(),K.trim(),W)})}function iz($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Z.id=J;break;case"logErrors":Z.logErrors=J==="true";break}}return Z}function nz($,Z,Y,X){let Q=X.logErrors!==!1;return`
9801
+ `}function lz($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,Q,J)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${J}" data-stx-transition-id="${K}"`})}var GX={};o(GX,{withErrorBoundary:()=>QX,processErrorBoundaryDirectives:()=>iz,generateErrorBoundaryRuntime:()=>az,generateErrorBoundaryCSS:()=>rz,createErrorBoundary:()=>sz});function cz(){return`eb-${++pz}-${Date.now().toString(36)}`}function iz($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=cz(),W=nz(J||"");return oz(q,G.trim(),K.trim(),W)})}function nz($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Z.id=J;break;case"logErrors":Z.logErrors=J==="true";break}}return Z}function oz($,Z,Y,X){let Q=X.logErrors!==!1;return`
9784
9802
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
9785
9803
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
9786
9804
  ${Z}
@@ -9900,7 +9918,7 @@ else {
9900
9918
  };
9901
9919
  })();
9902
9920
  </script>
9903
- `}async function QX($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function oz($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>QX(X,$,Y)}function sz(){return`
9921
+ `}async function QX($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function sz($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>QX(X,$,Y)}function rz(){return`
9904
9922
  /* STX Error Boundary Styles */
9905
9923
  .stx-error-boundary {
9906
9924
  position: relative;
@@ -9944,7 +9962,7 @@ else {
9944
9962
  color: #fecaca;
9945
9963
  }
9946
9964
  }
9947
- `}function rz(){return`
9965
+ `}function az(){return`
9948
9966
  // STX Error Boundary Runtime
9949
9967
  (function() {
9950
9968
  if (typeof window === 'undefined') return;
@@ -10009,7 +10027,7 @@ else {
10009
10027
 
10010
10028
  console.log('[stx] Error boundary runtime initialized');
10011
10029
  })();
10012
- `}var lz=0;var KX={};o(KX,{renderSSRSuspense:()=>XB,processSuspenseDirectives:()=>ez,generateSuspenseRuntime:()=>QB,generateSuspenseCSS:()=>JB,createSSRSuspense:()=>YB});function tz(){return`suspense-${++az}-${Date.now().toString(36)}`}function ez($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=tz(),W=$B(J||"");return ZB(q,G.trim(),K.trim(),W)})}function $B($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function ZB($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
10030
+ `}var pz=0;var KX={};o(KX,{renderSSRSuspense:()=>JB,processSuspenseDirectives:()=>$B,generateSuspenseRuntime:()=>GB,generateSuspenseCSS:()=>QB,createSSRSuspense:()=>XB});function ez(){return`suspense-${++tz}-${Date.now().toString(36)}`}function $B($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=ez(),W=ZB(J||"");return YB(q,G.trim(),K.trim(),W)})}function ZB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function YB($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
10013
10031
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${J}" data-status="pending">
10014
10032
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
10015
10033
  ${Y}
@@ -10199,7 +10217,7 @@ else {
10199
10217
  }, 0);
10200
10218
  })();
10201
10219
  </script>
10202
- `}function YB($,Z,Y){return{id:$,fallback:Y,content:Z}}async function XB($){let Z=$.map((X)=>`
10220
+ `}function XB($,Z,Y){return{id:$,fallback:Y,content:Z}}async function JB($){let Z=$.map((X)=>`
10203
10221
  <div id="stx-ssr-suspense-${X.id}" class="stx-ssr-suspense">
10204
10222
  ${X.fallback}
10205
10223
  </div>
@@ -10224,7 +10242,7 @@ else {
10224
10242
  }
10225
10243
  })();
10226
10244
  </script>
10227
- `}}return{initial:Z,streaming:Y()}}function JB(){return`
10245
+ `}}return{initial:Z,streaming:Y()}}function QB(){return`
10228
10246
  /* STX Suspense Styles */
10229
10247
  .stx-suspense {
10230
10248
  position: relative;
@@ -10280,7 +10298,7 @@ else {
10280
10298
  background-size: 200% 100%;
10281
10299
  }
10282
10300
  }
10283
- `}function QB(){return`
10301
+ `}function GB(){return`
10284
10302
  // STX Suspense Runtime
10285
10303
  (function() {
10286
10304
  if (typeof window === 'undefined') return;
@@ -10347,7 +10365,7 @@ else {
10347
10365
 
10348
10366
  console.log('[stx] Suspense runtime initialized');
10349
10367
  })();
10350
- `}var az=0;var zX={};o(zX,{processAsyncDirectives:()=>KB,isAsyncComponent:()=>UB,generateAsyncComponentRuntime:()=>zB,generateAsyncComponentCSS:()=>WB,defineAsyncComponent:()=>qB});function qX(){return`async-${++GB}-${Date.now().toString(36)}`}function KB($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,W)=>{let U=qX(),z=UX(K);return WX(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=qX(),U=UX(K);return WX(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function UX($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function WX($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
10368
+ `}var tz=0;var zX={};o(zX,{processAsyncDirectives:()=>qB,isAsyncComponent:()=>WB,generateAsyncComponentRuntime:()=>BB,generateAsyncComponentCSS:()=>zB,defineAsyncComponent:()=>UB});function qX(){return`async-${++KB}-${Date.now().toString(36)}`}function qB($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,W)=>{let U=qX(),z=UX(K);return WX(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=qX(),U=UX(K);return WX(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function UX($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function WX($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
10351
10369
  <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
10352
10370
  <div class="stx-async-loading" data-async-loading="${$}">
10353
10371
  ${Y}
@@ -10574,7 +10592,7 @@ catch (error) {
10574
10592
  loadComponent();
10575
10593
  })();
10576
10594
  </script>
10577
- `}function qB($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function UB($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function WB(){return`
10595
+ `}function UB($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function WB($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function zB(){return`
10578
10596
  /* STX Async Component Styles */
10579
10597
  .stx-async-component {
10580
10598
  position: relative;
@@ -10648,7 +10666,7 @@ catch (error) {
10648
10666
  background-size: 200% 100%;
10649
10667
  }
10650
10668
  }
10651
- `}function zB(){return`
10669
+ `}function BB(){return`
10652
10670
  // STX Async Component Runtime
10653
10671
  (function() {
10654
10672
  if (typeof window === 'undefined') return;
@@ -10702,7 +10720,7 @@ catch (error) {
10702
10720
 
10703
10721
  console.log('[stx] Async component runtime initialized');
10704
10722
  })();
10705
- `}var GB=0;var _X={};o(_X,{shouldCacheComponent:()=>LB,processKeepAliveDirectives:()=>_B,onDeactivated:()=>AB,onActivated:()=>RB,generateKeepAliveRuntime:()=>VB,generateKeepAliveCSS:()=>FB,createKeepAliveCache:()=>OB});function BX(){return`keep-alive-${++BB}-${Date.now().toString(36)}`}function _B($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=BX(),q=jB(J||"");return HB(K,G.trim(),q)})}function jB($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function HB($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
10723
+ `}var KB=0;var _X={};o(_X,{shouldCacheComponent:()=>FB,processKeepAliveDirectives:()=>jB,onDeactivated:()=>NB,onActivated:()=>AB,generateKeepAliveRuntime:()=>RB,generateKeepAliveCSS:()=>VB,createKeepAliveCache:()=>LB});function BX(){return`keep-alive-${++_B}-${Date.now().toString(36)}`}function jB($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=BX(),q=HB(J||"");return OB(K,G.trim(),q)})}function HB($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function OB($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
10706
10724
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
10707
10725
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
10708
10726
  ${Z}
@@ -10989,7 +11007,7 @@ else {
10989
11007
  });
10990
11008
  })();
10991
11009
  </script>
10992
- `}function OB($={}){return{id:$.id||BX(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function LB($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function FB(){return`
11010
+ `}function LB($={}){return{id:$.id||BX(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function FB($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function VB(){return`
10993
11011
  /* STX Keep-Alive Styles */
10994
11012
  .stx-keep-alive {
10995
11013
  position: relative;
@@ -11014,7 +11032,7 @@ else {
11014
11032
  .stx-keep-alive-content > [data-activated] {
11015
11033
  opacity: 1;
11016
11034
  }
11017
- `}function VB(){return`
11035
+ `}function RB(){return`
11018
11036
  // STX Keep-Alive Runtime
11019
11037
  (function() {
11020
11038
  if (typeof window === 'undefined') return;
@@ -11050,7 +11068,7 @@ else {
11050
11068
 
11051
11069
  console.log('[stx] Keep-alive runtime initialized');
11052
11070
  })();
11053
- `}function RB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function AB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var BB=0;var FX={};o(FX,{useVirtualList:()=>HX,processVirtualListDirectives:()=>O6,processVirtualGridDirectives:()=>LX,processInfiniteListDirectives:()=>OX,generateVirtualListCSS:()=>jX,default:()=>NB,createVirtualList:()=>H6});function H6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],U=0,z=new Map;function B(){if(G)return _();let N=Math.max(0,Math.floor(U/Y)-Q),w=Math.ceil(X/Y),T=Math.min(W.length-1,N+w+Q*2);return{startIndex:N,endIndex:T}}function _(){let N=0,w=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(N+I>U){w=Math.max(0,M-Q);break}N+=I}N=0;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(N+=I,N>U+X){T=Math.min(W.length-1,M+Q);break}}return{startIndex:w,endIndex:T}}function j(){if(G){let N=0;for(let w=0;w<W.length;w++)N+=z.get(w)||K;return N}return W.length*Y}function H(N){if(G){let w=0;for(let T=0;T<N;T++)w+=z.get(T)||K;return w}return N*Y}function L(){let{startIndex:N,endIndex:w}=B();return{startIndex:N,endIndex:w,scrollTop:U,totalHeight:j(),visibleItems:W.slice(N,w+1),itemHeights:new Map(z)}}function F(N,w="auto"){let T=H(N);O(T,w)}function O(N,w="auto"){U=Math.max(0,Math.min(N,j()-X))}function V(){B()}function R(N){W=[...N],z.clear(),V()}function A(){W=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:R,destroy:A}}function O6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(U.containerHeight/U.itemHeight),_=U.overscan||3,j=0,H=Math.min(W.length-1,B+_),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],R=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
11071
+ `}function AB($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function NB($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var _B=0;var FX={};o(FX,{useVirtualList:()=>HX,processVirtualListDirectives:()=>O6,processVirtualGridDirectives:()=>LX,processInfiniteListDirectives:()=>OX,generateVirtualListCSS:()=>jX,default:()=>wB,createVirtualList:()=>H6});function H6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],U=0,z=new Map;function B(){if(G)return _();let N=Math.max(0,Math.floor(U/Y)-Q),w=Math.ceil(X/Y),T=Math.min(W.length-1,N+w+Q*2);return{startIndex:N,endIndex:T}}function _(){let N=0,w=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(N+I>U){w=Math.max(0,M-Q);break}N+=I}N=0;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(N+=I,N>U+X){T=Math.min(W.length-1,M+Q);break}}return{startIndex:w,endIndex:T}}function j(){if(G){let N=0;for(let w=0;w<W.length;w++)N+=z.get(w)||K;return N}return W.length*Y}function H(N){if(G){let w=0;for(let T=0;T<N;T++)w+=z.get(T)||K;return w}return N*Y}function L(){let{startIndex:N,endIndex:w}=B();return{startIndex:N,endIndex:w,scrollTop:U,totalHeight:j(),visibleItems:W.slice(N,w+1),itemHeights:new Map(z)}}function F(N,w="auto"){let T=H(N);O(T,w)}function O(N,w="auto"){U=Math.max(0,Math.min(N,j()-X))}function V(){B()}function R(N){W=[...N],z.clear(),V()}function A(){W=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:R,destroy:A}}function O6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(U.containerHeight/U.itemHeight),_=U.overscan||3,j=0,H=Math.min(W.length-1,B+_),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],R=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
11054
11072
  <div class="virtual-item ${U.itemClass||""}"
11055
11073
  style="position: absolute; top: ${O*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
11056
11074
  data-index="${O}">
@@ -11263,7 +11281,7 @@ else {
11263
11281
  });
11264
11282
  })();
11265
11283
  </script>
11266
- `})}var NB;var VX=b(()=>{NB={createVirtualList:H6,processVirtualListDirectives:O6,processInfiniteListDirectives:OX,processVirtualGridDirectives:LX,generateVirtualListCSS:jX,useVirtualList:HX}});function RX(){return`<script data-stx-hydration-runtime>
11284
+ `})}var wB;var VX=b(()=>{wB={createVirtualList:H6,processVirtualListDirectives:O6,processInfiniteListDirectives:OX,processVirtualGridDirectives:LX,generateVirtualListCSS:jX,useVirtualList:HX}});function RX(){return`<script data-stx-hydration-runtime>
11267
11285
  (function() {
11268
11286
  'use strict';
11269
11287
 
@@ -11423,7 +11441,7 @@ else {
11423
11441
  stxIslands.initIslands();
11424
11442
  }
11425
11443
  })();
11426
- </script>`}function AX($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function NX($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var PX={};o(PX,{processStaticDirectives:()=>SX,processPartialHydrationDirectives:()=>TX,onHydrated:()=>bX,isHydrated:()=>kX,hydrateIsland:()=>IX,hydrateByStrategy:()=>DX,hydrateAll:()=>EX,generatePartialHydrationCSS:()=>MX,generateIslandManifest:()=>yX,default:()=>bB,createIslandRegistry:()=>wX});function wX(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function wB($){return`
11444
+ </script>`}function AX($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function NX($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var PX={};o(PX,{processStaticDirectives:()=>SX,processPartialHydrationDirectives:()=>TX,onHydrated:()=>bX,isHydrated:()=>kX,hydrateIsland:()=>IX,hydrateByStrategy:()=>DX,hydrateAll:()=>EX,generatePartialHydrationCSS:()=>MX,generateIslandManifest:()=>yX,default:()=>SB,createIslandRegistry:()=>wX});function wX(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function TB($){return`
11427
11445
  <script data-hydrate="${$}">
11428
11446
  (function() {
11429
11447
  const island = document.querySelector('[data-island="${$}"]');
@@ -11434,7 +11452,7 @@ else {
11434
11452
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
11435
11453
  })();
11436
11454
  </script>
11437
- `}function TB($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
11455
+ `}function MB($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
11438
11456
  <script data-hydrate="${$}">
11439
11457
  (function() {
11440
11458
  const island = document.querySelector('[data-island="${$}"]');
@@ -11470,7 +11488,7 @@ else {
11470
11488
  }
11471
11489
  })();
11472
11490
  </script>
11473
- `}function MB($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
11491
+ `}function IB($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
11474
11492
  <script data-hydrate="${$}">
11475
11493
  (function() {
11476
11494
  const island = document.querySelector('[data-island="${$}"]');
@@ -11503,7 +11521,7 @@ else {
11503
11521
  }
11504
11522
  })();
11505
11523
  </script>
11506
- `}function IB($,Z){let Y=Z.media||"(min-width: 768px)";return`
11524
+ `}function DB($,Z){let Y=Z.media||"(min-width: 768px)";return`
11507
11525
  <script data-hydrate="${$}">
11508
11526
  (function() {
11509
11527
  const island = document.querySelector('[data-island="${$}"]');
@@ -11532,7 +11550,7 @@ else {
11532
11550
  }
11533
11551
  })();
11534
11552
  </script>
11535
- `}function DB($){return`
11553
+ `}function EB($){return`
11536
11554
  <script data-hydrate="${$}">
11537
11555
  (function() {
11538
11556
  const island = document.querySelector('[data-island="${$}"]');
@@ -11554,7 +11572,7 @@ else {
11554
11572
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
11555
11573
  })();
11556
11574
  </script>
11557
- `}function EB($,Z){let Y=Z.event||"stx:activate";return`
11575
+ `}function kB($,Z){let Y=Z.event||"stx:activate";return`
11558
11576
  <script data-hydrate="${$}">
11559
11577
  (function() {
11560
11578
  const island = document.querySelector('[data-island="${$}"]');
@@ -11575,9 +11593,9 @@ else {
11575
11593
  });
11576
11594
  })();
11577
11595
  </script>
11578
- `}function TX($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=X5(X,"load",Z),X=X5(X,"idle",Z),X=X5(X,"visible",Z),X=X5(X,"media",Z),X=kB(X),X=X5(X,"hover",Z),X=X5(X,"event",Z),Q=J&&X!==$,Q)X+=`
11596
+ `}function TX($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=X5(X,"load",Z),X=X5(X,"idle",Z),X=X5(X,"visible",Z),X=X5(X,"media",Z),X=bB(X),X=X5(X,"hover",Z),X=X5(X,"event",Z),Q=J&&X!==$,Q)X+=`
11579
11597
  `+RX();return X}function X5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Z};if(J)try{let H=J.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=AX(G.trim()),U=NX(G.trim(),Y),z=[];if(K.rootMargin)z.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)z.push(`data-threshold="${K.threshold}"`);if(K.media)z.push(`data-media="${K.media}"`);if(K.event)z.push(`data-event="${K.event}"`);if(W)z.push(`data-component="${W}"`);let _=Object.keys(U).length>0?`
11580
- <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",j="";switch(Z){case"load":j=wB(q);break;case"idle":j=TB(q,K);break;case"visible":j=MB(q,K);break;case"media":j=IB(q,K);break;case"hover":j=DB(q);break;case"event":j=EB(q,K);break}return`
11598
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",j="";switch(Z){case"load":j=TB(q);break;case"idle":j=MB(q,K);break;case"visible":j=IB(q,K);break;case"media":j=DB(q,K);break;case"hover":j=EB(q);break;case"event":j=kB(q,K);break}return`
11581
11599
  <div data-island="${q}"
11582
11600
  data-strategy="${Z}"
11583
11601
  ${z.join(`
@@ -11587,7 +11605,7 @@ else {
11587
11605
  ${G.trim()}${_}
11588
11606
  </div>
11589
11607
  ${j}
11590
- `})}function kB($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
11608
+ `})}function bB($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
11591
11609
  <div data-island="${Q}"
11592
11610
  data-strategy="only"
11593
11611
  class="stx-island stx-client-only">
@@ -11651,7 +11669,7 @@ else {
11651
11669
  <script type="application/json" id="stx-island-manifest">
11652
11670
  ${JSON.stringify(Z)}
11653
11671
  </script>
11654
- `}var bB;var CX=b(()=>{bB={processPartialHydrationDirectives:TX,processStaticDirectives:SX,generatePartialHydrationCSS:MX,generateIslandManifest:yX,createIslandRegistry:wX,hydrateIsland:IX,hydrateByStrategy:DX,hydrateAll:EX,isHydrated:kX,onHydrated:bX}});var cX={};o(cX,{watchMultiple:()=>hX,watchEffect:()=>dX,watch:()=>gX,unref:()=>vX,toRefs:()=>xX,throttledComputed:()=>pX,stxWatchMultiple:()=>hX,stxWatchEffect:()=>dX,stxWatch:()=>gX,stxUnref:()=>vX,stxToRefs:()=>xX,stxThrottledComputed:()=>pX,stxShallowRef:()=>fX,stxRef:()=>J5,stxIsRef:()=>B1,stxDebouncedComputed:()=>lX,stxComputed:()=>l5,shallowRef:()=>fX,ref:()=>J5,processWatchDirectives:()=>uX,processComputedDirectives:()=>mX,isRef:()=>B1,default:()=>SB,debouncedComputed:()=>lX,computed:()=>l5});function J5($){let Z=$,Y=new Set,X={get value(){if(n0){let Q=u5.get(X);if(!Q)Q=new Set,u5.set(X,Q);Q.add(n0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=u5.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function B1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function vX($){return B1($)?$.value:$}function xX($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=J5($[Y]);return Z}function fX($){return J5($)}function l5($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let B=z.value;q.forEach((_)=>_(B))}};function U(){K.clear();let B=n0;n0=W,y$.push(W);try{return Y()}finally{y$.pop(),n0=B}}let z={get value(){if(n0){let B=u5.get(z);if(!B)B=new Set,u5.set(z,B);B.add(n0)}if(G){let B=U();if(!Q(J,B))J=B;G=!1}return J},set value(B){if(X)X(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function gX($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(B1($))return Q?P1($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=U();if(K!==void 0&&Object.is(K,j)&&!Q)return;let H=()=>{if(Z(j,K),K=Q?P1(j):j,G)_()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(B1($))B=$.subscribe(()=>z());else B=l5($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let _=()=>{if(q=!1,B)B(),B=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function hX($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>B1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((B)=>B1(B)?B.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(B1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,W.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function dX($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=n0;n0=G,y$.push(G);try{X=$()}finally{y$.pop(),n0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function mX($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function uX($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
11672
+ `}var SB;var CX=b(()=>{SB={processPartialHydrationDirectives:TX,processStaticDirectives:SX,generatePartialHydrationCSS:MX,generateIslandManifest:yX,createIslandRegistry:wX,hydrateIsland:IX,hydrateByStrategy:DX,hydrateAll:EX,isHydrated:kX,onHydrated:bX}});var cX={};o(cX,{watchMultiple:()=>hX,watchEffect:()=>dX,watch:()=>gX,unref:()=>vX,toRefs:()=>xX,throttledComputed:()=>pX,stxWatchMultiple:()=>hX,stxWatchEffect:()=>dX,stxWatch:()=>gX,stxUnref:()=>vX,stxToRefs:()=>xX,stxThrottledComputed:()=>pX,stxShallowRef:()=>fX,stxRef:()=>J5,stxIsRef:()=>B1,stxDebouncedComputed:()=>lX,stxComputed:()=>l5,shallowRef:()=>fX,ref:()=>J5,processWatchDirectives:()=>uX,processComputedDirectives:()=>mX,isRef:()=>B1,default:()=>yB,debouncedComputed:()=>lX,computed:()=>l5});function J5($){let Z=$,Y=new Set,X={get value(){if(n0){let Q=u5.get(X);if(!Q)Q=new Set,u5.set(X,Q);Q.add(n0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=u5.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function B1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function vX($){return B1($)?$.value:$}function xX($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=J5($[Y]);return Z}function fX($){return J5($)}function l5($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let B=z.value;q.forEach((_)=>_(B))}};function U(){K.clear();let B=n0;n0=W,y$.push(W);try{return Y()}finally{y$.pop(),n0=B}}let z={get value(){if(n0){let B=u5.get(z);if(!B)B=new Set,u5.set(z,B);B.add(n0)}if(G){let B=U();if(!Q(J,B))J=B;G=!1}return J},set value(B){if(X)X(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function gX($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(B1($))return Q?P1($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=U();if(K!==void 0&&Object.is(K,j)&&!Q)return;let H=()=>{if(Z(j,K),K=Q?P1(j):j,G)_()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(B1($))B=$.subscribe(()=>z());else B=l5($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let _=()=>{if(q=!1,B)B(),B=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function hX($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>B1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((B)=>B1(B)?B.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(B1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,W.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function dX($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=n0;n0=G,y$.push(G);try{X=$()}finally{y$.pop(),n0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function mX($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function uX($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
11655
11673
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
11656
11674
  (function() {
11657
11675
  // Watch implementation for ${J}
@@ -11663,9 +11681,9 @@ else {
11663
11681
  }
11664
11682
  })();
11665
11683
  </script>
11666
- `})}function P1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>P1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(P1(Q),P1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(P1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=P1($[Y]);return Z}function lX($,Z=100){let Y=J5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return l5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function pX($,Z=100){let Y=J5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return l5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var n0=null,y$,u5,SB;var iX=b(()=>{y$=[],u5=new WeakMap;SB={ref:J5,computed:l5,watch:gX,watchMultiple:hX,watchEffect:dX,isRef:B1,unref:vX,toRefs:xX,shallowRef:fX,debouncedComputed:lX,throttledComputed:pX,processComputedDirectives:mX,processWatchDirectives:uX}});var rX={};o(rX,{v:()=>yB,processHasErrorsDirective:()=>sX,processFormValidationDirectives:()=>CB,processErrorsDirective:()=>oX,processErrorDirective:()=>nX,defineForm:()=>PB,Validator:()=>Q5});class Q5{rules=[];defaultValue="";addRule($){let Z=new Q5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new Q5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new Q5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function PB($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function U(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function j(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)J[A]=!0;if(await U())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:U,validateField:W,reset:z,setValues:B,setFieldValue:_,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function nX($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
11684
+ `})}function P1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>P1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(P1(Q),P1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(P1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=P1($[Y]);return Z}function lX($,Z=100){let Y=J5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return l5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function pX($,Z=100){let Y=J5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return l5($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var n0=null,y$,u5,yB;var iX=b(()=>{y$=[],u5=new WeakMap;yB={ref:J5,computed:l5,watch:gX,watchMultiple:hX,watchEffect:dX,isRef:B1,unref:vX,toRefs:xX,shallowRef:fX,debouncedComputed:lX,throttledComputed:pX,processComputedDirectives:mX,processWatchDirectives:uX}});var rX={};o(rX,{v:()=>PB,processHasErrorsDirective:()=>sX,processFormValidationDirectives:()=>vB,processErrorsDirective:()=>oX,processErrorDirective:()=>nX,defineForm:()=>CB,Validator:()=>Q5});class Q5{rules=[];defaultValue="";addRule($){let Z=new Q5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new Q5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new Q5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function CB($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function U(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function j(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)J[A]=!0;if(await U())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:U,validateField:W,reset:z,setValues:B,setFieldValue:_,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function nX($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
11667
11685
  `)}catch{return""}})}function oX($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
11668
- `)}catch{return""}})}function sX($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function CB($,Z,Y){let X=$;return X=nX(X,Z,Y),X=oX(X,Z,Y),X=sX(X,Z,Y),X}var yB;var aX=b(()=>{yB=new Q5});var $J={};o($J,{processXElementDirectives:()=>vB,hasXElementDirectives:()=>eX,generateXElementRuntime:()=>tX});function tX(){return`<script data-stx-scoped>
11686
+ `)}catch{return""}})}function sX($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function vB($,Z,Y){let X=$;return X=nX(X,Z,Y),X=oX(X,Z,Y),X=sX(X,Z,Y),X}var PB;var aX=b(()=>{PB=new Q5});var $J={};o($J,{processXElementDirectives:()=>xB,hasXElementDirectives:()=>eX,generateXElementRuntime:()=>tX});function tX(){return`<script data-stx-scoped>
11669
11687
  (function() {
11670
11688
  'use strict';
11671
11689
 
@@ -11949,21 +11967,21 @@ else {
11949
11967
  // Expose for manual initialization
11950
11968
  window.XElement = XElement;
11951
11969
  })();
11952
- </script>`}function eX($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function vB($){if(!eX($))return $;let Z=tX(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
11970
+ </script>`}function eX($){return/\bx-(data|model|text|show|init|html)\b/.test($)||/\s:[a-z]/.test($)}function xB($){if(!eX($))return $;let Z=tX(),Y=$.lastIndexOf("</body>");if(Y!==-1)return $.slice(0,Y)+Z+`
11953
11971
  `+$.slice(Y);return $+`
11954
- `+Z}var ZJ={};o(ZJ,{rewriteImagesWithSiblings:()=>gB});import e0 from"path";async function gB($,Z){let Y=Z.formats??fB;if(!Z.publicDir)return $;let X=mB($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],B=z.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(uB(K.index,X))continue;G.push({idx:K.index,length:z.length,src:B[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let B=await hB(z.src,Z.publicDir,Y);return{match:z,sources:B}}));for(let{match:z,sources:B}of q){if(B.length===0)continue;let j=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${lB(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Q.length===0)return $;let W="",U=0;for(let z of Q)W+=$.slice(U,z.start),W+=z.replacement,U=z.end;return W+=$.slice(U),W}async function hB($,Z,Y){if(!dB($))return[];let X=e0.extname($).toLowerCase();if(!xB.has(X))return[];if(!$.startsWith("/"))return[];let Q=e0.join(Z,$.slice(1)),J=e0.dirname(Q),G=e0.basename(Q,X),K=e0.resolve(J),q=e0.resolve(Z);if(!K.startsWith(q))return[];let W=e0.posix.dirname($),U=Y.map(async(B)=>{let _=e0.join(J,`${G}${B.ext}`);if(!await Bun.file(_).exists())return null;return{url:e0.posix.join(W,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(U)).filter((B)=>B!==null)}function dB($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function mB($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function uB($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function lB($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var xB,fB;var YJ=b(()=>{xB=new Set([".jpg",".jpeg",".png",".gif"]),fB=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var QJ={};o(QJ,{validateClientScript:()=>b$,processOnceDirective:()=>k$,processJsonDirective:()=>E$,processDirectives:()=>F0,injectRouterScript:()=>b2});import k0 from"path";import{deriveLayoutGroup as pB}from"stx-router/layout-metadata";function XJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function cB($,Z){let Y=$.length,X=Z,Q=!0,J=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
11972
+ `+Z}var ZJ={};o(ZJ,{rewriteImagesWithSiblings:()=>hB});import e0 from"path";async function hB($,Z){let Y=Z.formats??gB;if(!Z.publicDir)return $;let X=uB($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],B=z.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(lB(K.index,X))continue;G.push({idx:K.index,length:z.length,src:B[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let B=await dB(z.src,Z.publicDir,Y);return{match:z,sources:B}}));for(let{match:z,sources:B}of q){if(B.length===0)continue;let j=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${pB(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Q.length===0)return $;let W="",U=0;for(let z of Q)W+=$.slice(U,z.start),W+=z.replacement,U=z.end;return W+=$.slice(U),W}async function dB($,Z,Y){if(!mB($))return[];let X=e0.extname($).toLowerCase();if(!fB.has(X))return[];if(!$.startsWith("/"))return[];let Q=e0.join(Z,$.slice(1)),J=e0.dirname(Q),G=e0.basename(Q,X),K=e0.resolve(J),q=e0.resolve(Z);if(!K.startsWith(q))return[];let W=e0.posix.dirname($),U=Y.map(async(B)=>{let _=e0.join(J,`${G}${B.ext}`);if(!await Bun.file(_).exists())return null;return{url:e0.posix.join(W,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(U)).filter((B)=>B!==null)}function mB($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function uB($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function lB($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function pB($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var fB,gB;var YJ=b(()=>{fB=new Set([".jpg",".jpeg",".png",".gif"]),gB=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var QJ={};o(QJ,{validateClientScript:()=>b$,processOnceDirective:()=>k$,processJsonDirective:()=>E$,processDirectives:()=>F0,injectRouterScript:()=>b2});import k0 from"path";import{deriveLayoutGroup as cB}from"stx-router/layout-metadata";function XJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function iB($,Z){let Y=$.length,X=Z,Q=!0,J=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
11955
11973
  `,X+2),X===-1)return-1;X+=1,Q=!0;continue}if(K==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,Q=!0;continue}if(K==="/"&&Q){let q=X+1,W=!1;while(q<Y){let U=$[q];if(U==="\\"){q+=2;continue}if(U==="[")W=!0;else if(U==="]")W=!1;else if(U==="/"&&!W){q++;break}else if(U===`
11956
11974
  `){q=-1;break}q++}if(q===-1){X++,Q=!1;continue}while(q<Y&&/[a-z]/.test($[q]))q++;X=q,Q=!1;continue}if(K==="'"||K==='"'){let q=K;X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
11957
- `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}if(J.length===0)Q=!1;continue}if(K==="}"&&J.length>0){J.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;X++}return-1}async function F0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!D5()&&!g4())&&Y&&Y.endsWith(".stx"))O3($,Y);try{return await E9.timeAsync("template-processing",async()=>{let G=await iB($,Z,Y,X,Q);if(J)G=B6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??A5(),U=(Z.__stx_head_raw||"").trim(),z,B=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(B)z=B[1].trim(),U=U.replace(B[0],"").trim();let _=Z.__sections?.title,j=W.title||z||_,H={...K,...j&&{title:j},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
11958
- `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=t3(G);if(G=A2(G,H),L)G=R2(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],R=pB(V);G=G.replace("<head>",`<head>
11975
+ `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}if(J.length===0)Q=!1;continue}if(K==="}"&&J.length>0){J.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;X++}return-1}async function F0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!D5()&&!g4())&&Y&&Y.endsWith(".stx"))O3($,Y);try{return await E9.timeAsync("template-processing",async()=>{let G=await nB($,Z,Y,X,Q);if(J)G=B6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??A5(),U=(Z.__stx_head_raw||"").trim(),z,B=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(B)z=B[1].trim(),U=U.replace(B[0],"").trim();let _=Z.__sections?.title,j=W.title||z||_,H={...K,...j&&{title:j},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
11976
+ `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=t3(G);if(G=A2(G,H),L)G=R2(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],R=cB(V);G=G.replace("<head>",`<head>
11959
11977
  <meta name="stx-layout" content="${XJ(V)}">
11960
11978
  <meta name="stx-layout-group" content="${XJ(R)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(J)G=V2(G);if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (r2(),s2)),q=X.storesDir,W=await K(q);if(W){let U=`<script data-stx-stores>${W}</script>`,z=G.indexOf("<script data-stx-scoped>");if(z!==-1){let B=G.indexOf("</script>",z+24);if(B!==-1){let _=B+9;G=G.slice(0,_)+`
11961
- `+U+G.slice(_)}}}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await HZ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof u4)throw G;let K=G instanceof Error?G.message:String(G),q=new M1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(m0.log(q,{filePath:Y,context:Z}),l7.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return m7.createFallbackContent("Template Processing",q)}}async function iB($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!k0.isAbsolute(X.partialsDir)?k0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!k0.isAbsolute(X.componentsDir)?k0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!k0.isAbsolute(X.layoutsDir)?k0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await sB(Y,Z),oB(Z,K),q=await n1(()=>J2(q,Z,Y,K),q,(O)=>{m0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=L5(q,F9,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,z=(O)=>U.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,R)=>U[Number(R)]??""),B="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,B),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=H2(q),q=await p2(q,Y,Q);let _={};q=s3(q,_);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let R="",A=k0.dirname(Y),N=K.layoutsDir?k0.dirname(K.layoutsDir):process.cwd();for(let w=0;w<20;w++){let T=k0.join(A,"_layout.stx");if(await i(T)){R=T;break}let M=k0.dirname(A);if(M===A||M.length<N.length)break;A=M}if(R)H=R;else if(K.layoutsDir){let w=k0.isAbsolute(K.layoutsDir)?K.layoutsDir:k0.resolve(process.cwd(),K.layoutsDir),T=k0.join(w,`${K.defaultLayout}.stx`);if(await i(T))H=T}if(H&&!V)q=`@section('content')
11979
+ `+U+G.slice(_)}}}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await HZ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof u4)throw G;let K=G instanceof Error?G.message:String(G),q=new M1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(m0.log(q,{filePath:Y,context:Z}),l7.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return m7.createFallbackContent("Template Processing",q)}}async function nB($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!k0.isAbsolute(X.partialsDir)?k0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!k0.isAbsolute(X.componentsDir)?k0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!k0.isAbsolute(X.layoutsDir)?k0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await rB(Y,Z),sB(Z,K),q=await n1(()=>J2(q,Z,Y,K),q,(O)=>{m0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=L5(q,F9,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,z=(O)=>U.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,R)=>U[Number(R)]??""),B="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,B),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=H2(q),q=await p2(q,Y,Q);let _={};q=s3(q,_);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let R="",A=k0.dirname(Y),N=K.layoutsDir?k0.dirname(K.layoutsDir):process.cwd();for(let w=0;w<20;w++){let T=k0.join(A,"_layout.stx");if(await i(T)){R=T;break}let M=k0.dirname(A);if(M===A||M.length<N.length)break;A=M}if(R)H=R;else if(K.layoutsDir){let w=k0.isAbsolute(K.layoutsDir)?K.layoutsDir:k0.resolve(process.cwd(),K.layoutsDir),T=k0.join(w,`${K.defaultLayout}.stx`);if(await i(T))H=T}if(H&&!V)q=`@section('content')
11962
11980
  ${q.trim()}
11963
11981
  @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,R)=>{return j[V]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return O;try{let A=$0(R.trim(),Z);if(A===void 0)return O;return j[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,R)=>{if(R.includes("@parent"))j[V]=R.replace("@parent",C1);else j[V]=R.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,R)=>{return j[V]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=r3(q,_),H){let O=[];if(q=q.replace(/<(script|style)\b[\s\S]*?<\/\1>/gi,(V)=>{return O.push(V),""}),O.length>0){let V=O.join(`
11964
11982
  `);j.content=j.content?`${j.content}
11965
- ${V}`:V,Z.__sections=j}}if(H)try{let O;if(k0.isAbsolute(H))O=H,Q.add(H);else O=await n1(()=>J7(H,Y,G,Q),null,()=>{throw new M1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(m0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new M1(T,Y);return q}let V=await n1(()=>Bun.file(O).text(),"",()=>{throw new M1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,C,S)=>{return T[C]=S.trim(),""});for(let[E,C]of Object.entries(T))if(j[E]&&j[E].includes(C1)){let S=j[E].indexOf(C1);j[E]=j[E].slice(0,S)+C+j[E].slice(S+C1.length)}else if(!j[E])j[E]=C;let I={...Z,__sections:j},D=`@layout('${R[1]}')${M}`;return await F0(D,I,O,G,Q)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=s3(A,_),w={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return w[M]=I.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let D=j[M];if(D.includes(C1)){let E=w[M]||"",C=D.indexOf(C1);D=D.slice(0,C)+E+D.slice(C+C1.length)}return D}return I||""}),N=nB(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=r3(N,_),Z.__originalFilePath=Y,q=await JJ(N,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
11966
- ${q}`,z(q)}catch(O){return m0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return z(await JJ(q,Z,Y,G,Q))}function nB($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function oB($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function sB($,Z){await n1(()=>U2($,Z),void 0,(Y)=>{m0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function rB($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (T5(),z4));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));m0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function aB($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (c0(),M9));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return m0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function JJ($,Z,Y,X,Q){let J=$,G=X;if(await rB(J,Z,Y),J=await aB(J,Z,Y),J=await tY(J,Z,Y),J=await eY(J,Z,Y),J=await eZ(J,Z,Y,G),d1(J))J=K6(J,Z),J=U6(J,Z);J=q6(J);let{processStreamDirectives:K}=await Promise.resolve().then(() => (H3(),j3));J=K(J,Z),J=c3(J,Z,Y,G),J=await q$(J,Z,Y,G,Q),J=await L2(J,Z,Y,G,Q),J=s6(J,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => t2);J=q(J,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => $X);J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await Promise.resolve().then(() => JX);J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => GX);J=B(J,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => KX);J=_(J,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => zX);J=j(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => _X);J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (VX(),FX));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:R}=await Promise.resolve().then(() => (CX(),PX));J=V(J,Z,Y),J=R(J);let{processComputedDirectives:A,processWatchDirectives:N}=await Promise.resolve().then(() => (iX(),cX));J=A(J,Z,Y),J=N(J,Z,Y);let{processFormValidationDirectives:w}=await Promise.resolve().then(() => (aX(),rX));J=w(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:D}=await Promise.resolve().then(() => (N5(),a$));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)D();let E=T(J);if(J=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
11983
+ ${V}`:V,Z.__sections=j}}if(H)try{let O;if(k0.isAbsolute(H))O=H,Q.add(H);else O=await n1(()=>J7(H,Y,G,Q),null,()=>{throw new M1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(m0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new M1(T,Y);return q}let V=await n1(()=>Bun.file(O).text(),"",()=>{throw new M1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(E,C,S)=>{return T[C]=S.trim(),""});for(let[E,C]of Object.entries(T))if(j[E]&&j[E].includes(C1)){let S=j[E].indexOf(C1);j[E]=j[E].slice(0,S)+C+j[E].slice(S+C1.length)}else if(!j[E])j[E]=C;let I={...Z,__sections:j},D=`@layout('${R[1]}')${M}`;return await F0(D,I,O,G,Q)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=s3(A,_),w={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return w[M]=I.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let D=j[M];if(D.includes(C1)){let E=w[M]||"",C=D.indexOf(C1);D=D.slice(0,C)+E+D.slice(C+C1.length)}return D}return I||""}),N=oB(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=r3(N,_),Z.__originalFilePath=Y,q=await JJ(N,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
11984
+ ${q}`,z(q)}catch(O){return m0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return z(await JJ(q,Z,Y,G,Q))}function oB($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function sB($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function rB($,Z){await n1(()=>U2($,Z),void 0,(Y)=>{m0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function aB($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (T5(),z4));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));m0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function tB($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (c0(),M9));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return m0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function JJ($,Z,Y,X,Q){let J=$,G=X;if(await aB(J,Z,Y),J=await tB(J,Z,Y),J=await tY(J,Z,Y),J=await eY(J,Z,Y),J=await eZ(J,Z,Y,G),d1(J))J=K6(J,Z),J=U6(J,Z);J=q6(J);let{processStreamDirectives:K}=await Promise.resolve().then(() => (H3(),j3));J=K(J,Z),J=c3(J,Z,Y,G),J=await q$(J,Z,Y,G,Q),J=await L2(J,Z,Y,G,Q),J=s6(J,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => t2);J=q(J,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => $X);J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await Promise.resolve().then(() => JX);J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => GX);J=B(J,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => KX);J=_(J,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => zX);J=j(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => _X);J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (VX(),FX));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:R}=await Promise.resolve().then(() => (CX(),PX));J=V(J,Z,Y),J=R(J);let{processComputedDirectives:A,processWatchDirectives:N}=await Promise.resolve().then(() => (iX(),cX));J=A(J,Z,Y),J=N(J,Z,Y);let{processFormValidationDirectives:w}=await Promise.resolve().then(() => (aX(),rX));J=w(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:D}=await Promise.resolve().then(() => (N5(),a$));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)D();let E=T(J);if(J=E.content,E.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${E.headContent}
11967
11985
  `;if(J=M(J,Z),J=I(J,Z),J=K2(J),J=Z3(J,Z),J=aZ(J),J=Y2(J),J=await o3(J,Z,Y,G,Q),J=await q$(J,Z,Y,G,Q),J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=B6(J),J=k1(J,Z,Y),J=Y3(J,Z),J=X3(J,Z),J=Z$(J,Z),J=JY(J,Z),J=QY(J,Z),J=await fZ(J,Z,Y,G),J=await s9(J,Z,Y),J=await WY(J,Z,Y,G),J=u6(J,Z,Y,G),J=ZZ(J,Z,Y,G),J=YZ(J,Z,Y),J=XZ(J,Z,Y,G),J=oZ(J,Z,Y,G),J=E$(J,Z),J=k$(J),J=i2(J),!G.skipEventDirectives)J=bZ(J,Z,Y);if(J=vZ(J,Z,Y),G.debug){let y=/\bx-data\s*=/.test(J),x=D$($);if(y&&x)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
11968
11986
  Both work on the same page, but they manage separate scopes.
11969
11987
  Prefer signals (state/derived/effect) for new components.`)}J=B2(J,Z),J=await p0(J,Z,Y),J=n2(J),J=o2(J),J=AZ(J);let{processXElementDirectives:C}=await Promise.resolve().then(() => $J);J=C(J);let S=Z.__originalFilePath||Y,k=j5(Z);if(J=await W6(J,G,S,k),J=await Q2(J,Z,Y,G),G.media?.image?.autoSiblings){let y=G.publicDir||"public",{rewriteImagesWithSiblings:x}=await Promise.resolve().then(() => (YJ(),ZJ));J=await x(J,{publicDir:y})}if(G.seo?.enabled)J=JZ(J,Z,G);let P=(y,x)=>{if(!x)return y;if(/<\/head>/i.test(y))return y.replace(/<\/head>/i,`${x}
@@ -11977,8 +11995,8 @@ ${LZ()}
11977
11995
  `+I0}else J=J.replace("</head>",`${x}
11978
11996
  </head>`)}else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
11979
11997
  ${x}`);else J=x+`
11980
- `+J}{let y=/<script\s+server\b[^>]*>/gi,x,u=[];while((x=y.exec(J))!==null){let l=x.index+x[0].length,Y0=cB(J,l);if(Y0===-1)continue;let q0=Y0+9;while(q0<J.length&&/\s/.test(J[q0]))q0++;u.push({start:x.index,end:q0}),y.lastIndex=q0}for(let l=u.length-1;l>=0;l--){let{start:Y0,end:q0}=u[l];J=J.substring(0,Y0)+J.substring(q0)}}let T0=q4(J,Y);if(T0.hasScoped)J=T0.html;let e=Z.__stx_event_bindings||[],M0=!1,C0=[],v=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:f}=await Promise.resolve().then(() => (z6(),m2));for(let y of f(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))C0.push({match:y.fullMatch,attrs:y.attrs,content:y.body});for(let{match:y,attrs:x,content:u}of C0){M0=!0;let l=u;b$(u,Y,X.strict);let Y0=await H5(u,{eventBindings:e,attrs:x,hasColonDirectives:v,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:k});J=J.replace(y,()=>Y0)}if(M0)Z.__stx_event_bindings=[];return J}var C1="<!--PARENT_CONTENT_PLACEHOLDER-->";var _4=b(()=>{OZ();K4();d$();FZ();NZ();TZ();l$();m$();SZ();O5();xZ();gZ();t4();sZ();tZ();ZY();t0();N5();c0();GY();zY();aY();Z2();i3();Q7();G2();l1();q2();p7();H0();W2();_2();O2();F2();r$();z6();p3();c2();_6();j6();L0();L3();_6();j6()});import Y_ from"fs";import L6 from"path";import HJ from"fs";import s0 from"path";var N6=[72,96,128,144,152,192,384,512],w6=[120,152,167,180],T6=[16,32];async function M6($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let Q=s0.isAbsolute(X.src)?X.src:s0.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Y.errors.push(`Source icon not found: ${Q}`),Y.success=!1,Y;let J=s0.resolve(Z,X.outputDir||"pwa-icons");try{HJ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||N6,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let W;try{W=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
11981
- Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let z=await W.default(Q).metadata();if(z.width&&z.width<512)Y.warnings.push(`Source icon is ${z.width}x${z.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=s0.join(J,`icon-${L}x${L}.png`);if(await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let O=s0.join(J,`icon-${L}x${L}.webp`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Y.generatedFiles.push(O)}}if(q){for(let F of w6){let O=s0.join(J,`apple-touch-icon-${F}x${F}.png`);await W.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}let L=s0.join(J,"apple-touch-icon.png");await W.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}for(let L of T6){let F=s0.join(J,`favicon-${L}x${L}.png`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let B=512,_=s0.join(J,`icon-maskable-${B}x${B}.png`),j=Math.floor(B*0.1),H=B-j*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:j,bottom:j,left:j,right:j,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(_),Y.generatedFiles.push(_)}catch(W){let U=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${U}`),Y.success=!1}return Y}function G_($){let Z=$.sizes||N6,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Z)if(J.push(`${Y}/icon-${G}x${G}.png`),X)J.push(`${Y}/icon-${G}x${G}.webp`);if(Q){J.push(`${Y}/apple-touch-icon.png`);for(let G of w6)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of T6)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function I6(){try{return await import("sharp"),!0}catch{return!1}}t5();function xJ($,Z,Y,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Y)Q.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function fJ($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function gJ($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Y}function hJ($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Y}function dJ($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function mJ($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,Q=X?.sizes||[72,96,128,144,152,192,384,512],J=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:xJ(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=fJ(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let W=gJ($);if(W)q.share_target=W;let U=hJ($);if(U)q.file_handlers=U;let z=dJ($);if(z)q.protocol_handlers=z;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function g6($){let Z=mJ($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function O_($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function L_($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${Q.join(", ")}`);let J=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!J.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import GJ from"path";async function KJ($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=GJ.isAbsolute(Z.page)?Z.page:GJ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (_4(),QJ)),Q=await Bun.file(Y).text();return await X(Q,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return tB($)}function tB($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",Q=Z?.fallbackMessage||"Please check your internet connection and try again.",J=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
11998
+ `+J}{let y=/<script\s+server\b[^>]*>/gi,x,u=[];while((x=y.exec(J))!==null){let l=x.index+x[0].length,Y0=iB(J,l);if(Y0===-1)continue;let q0=Y0+9;while(q0<J.length&&/\s/.test(J[q0]))q0++;u.push({start:x.index,end:q0}),y.lastIndex=q0}for(let l=u.length-1;l>=0;l--){let{start:Y0,end:q0}=u[l];J=J.substring(0,Y0)+J.substring(q0)}}let T0=q4(J,Y);if(T0.hasScoped)J=T0.html;let e=Z.__stx_event_bindings||[],M0=!1,C0=[],v=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:f}=await Promise.resolve().then(() => (z6(),m2));for(let y of f(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))C0.push({match:y.fullMatch,attrs:y.attrs,content:y.body});for(let{match:y,attrs:x,content:u}of C0){M0=!0;let l=u;b$(u,Y,X.strict);let Y0=await H5(u,{eventBindings:e,attrs:x,hasColonDirectives:v,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:k});J=J.replace(y,()=>Y0)}if(M0)Z.__stx_event_bindings=[];return J}var C1="<!--PARENT_CONTENT_PLACEHOLDER-->";var _4=b(()=>{OZ();K4();d$();FZ();NZ();TZ();l$();m$();SZ();O5();xZ();gZ();t4();sZ();tZ();ZY();t0();N5();c0();GY();zY();aY();Z2();i3();Q7();G2();l1();q2();p7();H0();W2();_2();O2();F2();r$();z6();p3();c2();_6();j6();L0();L3();_6();j6()});import X_ from"fs";import L6 from"path";import HJ from"fs";import s0 from"path";var N6=[72,96,128,144,152,192,384,512],w6=[120,152,167,180],T6=[16,32];async function M6($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let Q=s0.isAbsolute(X.src)?X.src:s0.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Y.errors.push(`Source icon not found: ${Q}`),Y.success=!1,Y;let J=s0.resolve(Z,X.outputDir||"pwa-icons");try{HJ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||N6,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let W;try{W=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
11999
+ Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let z=await W.default(Q).metadata();if(z.width&&z.width<512)Y.warnings.push(`Source icon is ${z.width}x${z.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=s0.join(J,`icon-${L}x${L}.png`);if(await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let O=s0.join(J,`icon-${L}x${L}.webp`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Y.generatedFiles.push(O)}}if(q){for(let F of w6){let O=s0.join(J,`apple-touch-icon-${F}x${F}.png`);await W.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}let L=s0.join(J,"apple-touch-icon.png");await W.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}for(let L of T6){let F=s0.join(J,`favicon-${L}x${L}.png`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let B=512,_=s0.join(J,`icon-maskable-${B}x${B}.png`),j=Math.floor(B*0.1),H=B-j*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:j,bottom:j,left:j,right:j,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(_),Y.generatedFiles.push(_)}catch(W){let U=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${U}`),Y.success=!1}return Y}function K_($){let Z=$.sizes||N6,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Z)if(J.push(`${Y}/icon-${G}x${G}.png`),X)J.push(`${Y}/icon-${G}x${G}.webp`);if(Q){J.push(`${Y}/apple-touch-icon.png`);for(let G of w6)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of T6)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function I6(){try{return await import("sharp"),!0}catch{return!1}}t5();function xJ($,Z,Y,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Y)Q.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function fJ($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function gJ($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Y}function hJ($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Y}function dJ($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function mJ($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,Q=X?.sizes||[72,96,128,144,152,192,384,512],J=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:xJ(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=fJ(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let W=gJ($);if(W)q.share_target=W;let U=hJ($);if(U)q.file_handlers=U;let z=dJ($);if(z)q.protocol_handlers=z;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function g6($){let Z=mJ($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function L_($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function F_($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${Q.join(", ")}`);let J=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!J.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import GJ from"path";async function KJ($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=GJ.isAbsolute(Z.page)?Z.page:GJ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (_4(),QJ)),Q=await Bun.file(Y).text();return await X(Q,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return eB($)}function eB($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",Q=Z?.fallbackMessage||"Please check your internet connection and try again.",J=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
11982
12000
  <html lang="en">
11983
12001
  <head>
11984
12002
  <meta charset="UTF-8">
@@ -12211,9 +12229,9 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
12211
12229
  }, 5000);
12212
12230
  </script>
12213
12231
  </body>
12214
- </html>`}function P$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}G5();K5();import v1 from"fs";import C$ from"path";function eB($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let Q=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:Q.length>0,message:Q.length>0?`${Q.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function $_($){let Z=[],Y=C$.join($,"manifest.json"),X=v1.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:X,message:X?"manifest.json exists":"manifest.json not found in build output"}),X)try{let U=JSON.parse(v1.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(U.icons)&&U.icons.length>0,message:U.icons?.length?`${U.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let Q=C$.join($,"sw.js"),J=v1.existsSync(Q);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:J,message:J?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=C$.join($,"offline.html"),K=v1.existsSync(G);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=C$.join($,"pwa-icons");if(v1.existsSync(q)){let U=v1.readdirSync(q).filter((z)=>z.endsWith(".png")||z.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:U.length>0,message:U.length>0?`${U.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function Z_($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),X=Z.filter((q)=>q.passed).length,Q=Y.filter((q)=>q.passed).length,J=Z.length>0?X/Z.length*70:70,G=Y.length>0?Q/Y.length*30:30;return{score:Math.round(J+G),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function OA($,Z){let Y=eB($),X=Z&&v1.existsSync(Z)?$_(Z):[];return Z_([...Y,...X])}function LA($){let Z=[];Z.push(`
12232
+ </html>`}function P$($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}G5();K5();import v1 from"fs";import C$ from"path";function $_($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let Q=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:Q.length>0,message:Q.length>0?`${Q.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function Z_($){let Z=[],Y=C$.join($,"manifest.json"),X=v1.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:X,message:X?"manifest.json exists":"manifest.json not found in build output"}),X)try{let U=JSON.parse(v1.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(U.icons)&&U.icons.length>0,message:U.icons?.length?`${U.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let Q=C$.join($,"sw.js"),J=v1.existsSync(Q);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:J,message:J?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=C$.join($,"offline.html"),K=v1.existsSync(G);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=C$.join($,"pwa-icons");if(v1.existsSync(q)){let U=v1.readdirSync(q).filter((z)=>z.endsWith(".png")||z.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:U.length>0,message:U.length>0?`${U.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function Y_($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),X=Z.filter((q)=>q.passed).length,Q=Y.filter((q)=>q.passed).length,J=Z.length>0?X/Z.length*70:70,G=Y.length>0?Q/Y.length*30:30;return{score:Math.round(J+G),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function LA($,Z){let Y=$_($),X=Z&&v1.existsSync(Z)?Z_(Z):[];return Y_([...Y,...X])}function FA($){let Z=[];Z.push(`
12215
12233
  === PWA Audit Report ===
12216
12234
  `);let Y=$.score>=90?"32":$.score>=70?"33":"31";Z.push(`Score: \x1B[${Y}m${$.score}/100\x1B[0m`),Z.push(`Passed: ${$.passed} | Failed: ${$.failed} | Warnings: ${$.warnings}
12217
12235
  `);let X=["required","recommended","optional"];for(let Q of X){let J=$.checks.filter((G)=>G.category===Q);if(J.length===0)continue;Z.push(`
12218
12236
  ${Q.toUpperCase()}:`);for(let G of J){let K=G.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(Z.push(` ${K} ${G.name}: ${G.message}`),G.details)Z.push(` ${G.details}`)}}return Z.push(""),Z.join(`
12219
- `)}g7();t5();G5();K5();async function DA($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{Y_.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=g6($);if(J){let G=L6.join(Z,"manifest.json");await Bun.write(G,J),Y.files.manifest=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate manifest.json: ${G}`),Y.success=!1}if(X.icons?.src)if(await I6()){let G=await M6($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await KJ($);if(J){let G=L6.join(Z,"offline.html");await Bun.write(G,J),Y.files.offlinePage=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate offline page: ${G}`),Y.success=!1}let Q;if(X.precache?.enabled){let J=H1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=r5($,Z);if(J){let G=f1($),K=L6.join(Z,G);await Bun.write(K,J),Y.files.serviceWorker=K}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate service worker: ${G}`),Y.success=!1}return Y}function EA($,Z){return h$($,Z)}function kA($){return $.pwa?.enabled===!0}export{L_ as validateManifest,OA as runPwaAudit,gH as registerPwaDirectives,fK as pwaUpdateDirective,hK as pwaPushDirective,gK as pwaOfflineDirective,xK as pwaInstallDirective,f7 as pwaDirectives,EA as processPwaHtml,O_ as mergeManifestConfig,x6 as isWorkboxEnabled,I6 as isSharpAvailable,kA as isPwaEnabled,h$ as injectPwaTags,f1 as getServiceWorkerFileName,G_ as getExpectedIconPaths,vJ as generateThemeColorMeta,PJ as generateSwRegistrationScript,yJ as generateServiceWorkerAuto,r5 as generateServiceWorker,a5 as generatePwaTags,M6 as generatePwaIcons,s5 as generatePrecacheManifestJs,H1 as generatePrecacheManifest,KJ as generateOfflinePage,CJ as generateManifestLink,g6 as generateManifestJson,mJ as generateManifest,E6 as formatSize,LA as formatAuditResult,Z_ as calculateAuditResult,DA as buildPwaAssets,eB as auditConfig,$_ as auditBuildOutput,T6 as FAVICON_SIZES,N6 as DEFAULT_ICON_SIZES,w6 as APPLE_TOUCH_ICON_SIZES};
12237
+ `)}g7();t5();G5();K5();async function EA($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{X_.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=g6($);if(J){let G=L6.join(Z,"manifest.json");await Bun.write(G,J),Y.files.manifest=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate manifest.json: ${G}`),Y.success=!1}if(X.icons?.src)if(await I6()){let G=await M6($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await KJ($);if(J){let G=L6.join(Z,"offline.html");await Bun.write(G,J),Y.files.offlinePage=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate offline page: ${G}`),Y.success=!1}let Q;if(X.precache?.enabled){let J=H1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=r5($,Z);if(J){let G=f1($),K=L6.join(Z,G);await Bun.write(K,J),Y.files.serviceWorker=K}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate service worker: ${G}`),Y.success=!1}return Y}function kA($,Z){return h$($,Z)}function bA($){return $.pwa?.enabled===!0}export{F_ as validateManifest,LA as runPwaAudit,hH as registerPwaDirectives,fK as pwaUpdateDirective,hK as pwaPushDirective,gK as pwaOfflineDirective,xK as pwaInstallDirective,f7 as pwaDirectives,kA as processPwaHtml,L_ as mergeManifestConfig,x6 as isWorkboxEnabled,I6 as isSharpAvailable,bA as isPwaEnabled,h$ as injectPwaTags,f1 as getServiceWorkerFileName,K_ as getExpectedIconPaths,vJ as generateThemeColorMeta,PJ as generateSwRegistrationScript,yJ as generateServiceWorkerAuto,r5 as generateServiceWorker,a5 as generatePwaTags,M6 as generatePwaIcons,s5 as generatePrecacheManifestJs,H1 as generatePrecacheManifest,KJ as generateOfflinePage,CJ as generateManifestLink,g6 as generateManifestJson,mJ as generateManifest,E6 as formatSize,FA as formatAuditResult,Y_ as calculateAuditResult,EA as buildPwaAssets,$_ as auditConfig,Z_ as auditBuildOutput,T6 as FAVICON_SIZES,N6 as DEFAULT_ICON_SIZES,w6 as APPLE_TOUCH_ICON_SIZES};