@stacksjs/stx 0.2.170 → 0.2.172

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.
Files changed (44) hide show
  1. package/dist/cli.js +1263 -1168
  2. package/dist/client-script-bundler.js +2 -1
  3. package/dist/client-script.d.ts +1 -12
  4. package/dist/client-script.js +2 -149
  5. package/dist/codemod.d.ts +1 -24
  6. package/dist/codemod.js +61 -9
  7. package/dist/compression.d.ts +11 -4
  8. package/dist/compression.js +52 -13
  9. package/dist/craft.js +489 -415
  10. package/dist/expressions.d.ts +0 -21
  11. package/dist/expressions.js +12 -1
  12. package/dist/find-body-tag.js +29 -17
  13. package/dist/index.d.ts +8 -0
  14. package/dist/index.js +2 -0
  15. package/dist/page-action.d.ts +83 -0
  16. package/dist/page-action.js +64 -0
  17. package/dist/production-builder.js +1 -0
  18. package/dist/production-server.js +10 -3
  19. package/dist/pwa.js +398 -324
  20. package/dist/reactive-tracking.d.ts +81 -0
  21. package/dist/reactive-tracking.js +49 -0
  22. package/dist/reactivity.js +29 -23
  23. package/dist/render.js +5 -18
  24. package/dist/runtime-injection.js +25 -39
  25. package/dist/script-validation.d.ts +0 -7
  26. package/dist/script-validation.js +6 -4
  27. package/dist/signals-api.d.ts +18 -0
  28. package/dist/signals-api.js +26 -41
  29. package/dist/signals.js +93 -15
  30. package/dist/ssg.d.ts +8 -0
  31. package/dist/ssg.js +515 -441
  32. package/dist/state-management.js +2 -2
  33. package/dist/strip-literals.d.ts +40 -0
  34. package/dist/strip-literals.js +149 -0
  35. package/dist/stx-virtual-ts.d.ts +103 -1
  36. package/dist/stx-virtual-ts.js +124 -7
  37. package/dist/template-compiler.js +4 -2
  38. package/dist/template-hydrator.d.ts +1 -1
  39. package/dist/template-hydrator.js +13 -1
  40. package/dist/typecheck.d.ts +2 -14
  41. package/dist/typecheck.js +133 -11
  42. package/dist/types/config-types.d.ts +10 -3
  43. package/dist/variable-extractor.js +1 -1
  44. package/package.json +5 -5
package/dist/pwa.js CHANGED
@@ -1,26 +1,26 @@
1
1
  // @bun
2
- var{defineProperty:U$,getOwnPropertyNames:FK,getOwnPropertyDescriptor:VK}=Object,AK=Object.prototype.hasOwnProperty;function RK(X){return this[X]}var h4=(X)=>{var $=(g4??=new WeakMap).get(X),Z;if($)return $;if($=U$({},"__esModule",{value:!0}),X&&typeof X==="object"||typeof X==="function"){for(var Y of FK(X))if(!AK.call($,Y))U$($,Y,{get:RK.bind(X,Y),enumerable:!(Z=VK(X,Y))||Z.enumerable})}return g4.set(X,$),$},g4;var TK=(X)=>X;function NK(X,$){this[X]=TK.bind(null,$)}var n=(X,$)=>{for(var Z in $)U$(X,Z,{get:$[Z],enumerable:!0,configurable:!0,set:NK.bind($,Z)})};var D=(X,$)=>()=>(X&&($=X(X=0)),$);var W0=import.meta.require;import a7 from"fs";import t7 from"path";function IK(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X[Z];$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(16).padStart(8,"0")}function EK(X,$){let Z=t7.basename(X);for(let Y of $)if(Y.startsWith("*.")){let J=Y.slice(1);if(Z.endsWith(J))return!0}else if(Y.includes("*")){let J=new RegExp(`^${Y.replace(/\*/g,".*")}$`);if(J.test(Z)||J.test(X))return!0}else if(Z===Y||X.includes(Y))return!0;return!1}function DK(X,$,Z){let Y=t7.extname(X).toLowerCase(),J=kK[Y],G=(Z.maxFileSizeKB||500)*1024;if($>G)return!1;if(Z.exclude&&EK(X,Z.exclude))return!1;if(Z.include&&Z.include.length>0){for(let Q of Z.include)if(Q.startsWith("*.")){if(X.endsWith(Q.slice(1)))return!0}else if(X.includes(Q))return!0}if(J&&Z[J]===!0)return!0;if(!J)return!1;return!1}function p4(X,$,Z,Y){let J=a7.readdirSync(X,{withFileTypes:!0});for(let G of J){let Q=t7.join(X,G.name);if(G.isDirectory()){if(["node_modules",".git",".stx"].includes(G.name))continue;p4(Q,$,Z,Y)}else if(G.isFile()){let q=a7.statSync(Q),K=t7.relative($,Q);if(DK(K,q.size,Z)){let U=a7.readFileSync(Q),W=IK(U),w=`/${K.replace(/\\/g,"/")}`;Y.push({url:w,revision:W,size:q.size})}}}}function f1(X,$){let Z=$.pwa?.precache,Y=[];if(!Z?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!a7.existsSync(X))return{entries:[],totalSize:0,fileCount:0};p4(X,X,Z,Y),Y.sort((G,Q)=>G.url.localeCompare(Q.url));let J=Y.reduce((G,Q)=>G+Q.size,0);return{entries:Y,totalSize:J,fileCount:Y.length}}function e7(X){if(X.entries.length===0)return"[]";return`[
2
+ var{defineProperty:U$,getOwnPropertyNames:yK,getOwnPropertyDescriptor:bK}=Object,SK=Object.prototype.hasOwnProperty;function CK(X){return this[X]}var i4=(X)=>{var $=(p4??=new WeakMap).get(X),Z;if($)return $;if($=U$({},"__esModule",{value:!0}),X&&typeof X==="object"||typeof X==="function"){for(var Y of yK(X))if(!SK.call($,Y))U$($,Y,{get:CK.bind(X,Y),enumerable:!(Z=bK(X,Y))||Z.enumerable})}return p4.set(X,$),$},p4;var PK=(X)=>X;function vK(X,$){this[X]=PK.bind(null,$)}var n=(X,$)=>{for(var Z in $)U$(X,Z,{get:$[Z],enumerable:!0,configurable:!0,set:vK.bind($,Z)})};var E=(X,$)=>()=>(X&&($=X(X=0)),$);var W0=import.meta.require;import t7 from"fs";import e7 from"path";function gK(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X[Z];$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(16).padStart(8,"0")}function hK(X,$){let Z=e7.basename(X);for(let Y of $)if(Y.startsWith("*.")){let J=Y.slice(1);if(Z.endsWith(J))return!0}else if(Y.includes("*")){let J=new RegExp(`^${Y.replace(/\*/g,".*")}$`);if(J.test(Z)||J.test(X))return!0}else if(Z===Y||X.includes(Y))return!0;return!1}function uK(X,$,Z){let Y=e7.extname(X).toLowerCase(),J=fK[Y],G=(Z.maxFileSizeKB||500)*1024;if($>G)return!1;if(Z.exclude&&hK(X,Z.exclude))return!1;if(Z.include&&Z.include.length>0){for(let Q of Z.include)if(Q.startsWith("*.")){if(X.endsWith(Q.slice(1)))return!0}else if(X.includes(Q))return!0}if(J&&Z[J]===!0)return!0;if(!J)return!1;return!1}function t4(X,$,Z,Y){let J=t7.readdirSync(X,{withFileTypes:!0});for(let G of J){let Q=e7.join(X,G.name);if(G.isDirectory()){if(["node_modules",".git",".stx"].includes(G.name))continue;t4(Q,$,Z,Y)}else if(G.isFile()){let q=t7.statSync(Q),K=e7.relative($,Q);if(uK(K,q.size,Z)){let U=t7.readFileSync(Q),W=gK(U),w=`/${K.replace(/\\/g,"/")}`;Y.push({url:w,revision:W,size:q.size})}}}}function f1(X,$){let Z=$.pwa?.precache,Y=[];if(!Z?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!t7.existsSync(X))return{entries:[],totalSize:0,fileCount:0};t4(X,X,Z,Y),Y.sort((G,Q)=>G.url.localeCompare(Q.url));let J=Y.reduce((G,Q)=>G+Q.size,0);return{entries:Y,totalSize:J,fileCount:Y.length}}function XX(X){if(X.entries.length===0)return"[]";return`[
3
3
  ${X.entries.map((Z)=>` { url: '${Z.url}', revision: '${Z.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function i4(X){if(X<1024)return`${X} B`;if(X<1048576)return`${(X/1024).toFixed(1)} KB`;return`${(X/1048576).toFixed(2)} MB`}var kK;var r5=D(()=>{kK={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function yK(X){let $={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return $[X]||$["network-first"]}function W$(X){return yK(X).className}function n4(X){let $=X.pwa;if(!$?.enabled)return"";let Z=$.routes||[],Y=$.cacheStorage,J=[];for(let G of Z){let Q=W$(G.strategy),q=[];if(G.maxAgeSeconds||G.maxEntries||Y?.maxEntries){let U=G.maxEntries||Y?.maxEntries||100,W=G.maxAgeSeconds||(Y?.maxAge?Y.maxAge*24*60*60:void 0);q.push(`new ExpirationPlugin({
5
+ ]`}function e4(X){if(X<1024)return`${X} B`;if(X<1048576)return`${(X/1024).toFixed(1)} KB`;return`${(X/1048576).toFixed(2)} MB`}var fK;var o5=E(()=>{fK={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function dK(X){let $={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return $[X]||$["network-first"]}function W$(X){return dK(X).className}function X2(X){let $=X.pwa;if(!$?.enabled)return"";let Z=$.routes||[],Y=$.cacheStorage,J=[];for(let G of Z){let Q=W$(G.strategy),q=[];if(G.maxAgeSeconds||G.maxEntries||Y?.maxEntries){let U=G.maxEntries||Y?.maxEntries||100,W=G.maxAgeSeconds||(Y?.maxAge?Y.maxAge*24*60*60:void 0);q.push(`new ExpirationPlugin({
6
6
  maxEntries: ${U},
7
7
  ${W?`maxAgeSeconds: ${W},`:""}
8
8
  purgeOnQuotaError: true,
9
9
  })`)}if(G.strategy==="network-first"||G.strategy==="stale-while-revalidate")q.push(`new CacheableResponsePlugin({
10
10
  statuses: [0, 200],
11
- })`);let K=bK(G.pattern);J.push(`
11
+ })`);let K=mK(G.pattern);J.push(`
12
12
  // ${G.pattern}
13
13
  registerRoute(
14
14
  ${K},
15
15
  new ${Q}({
16
- cacheName: '${G.cacheName||CK(G.pattern)}',
16
+ cacheName: '${G.cacheName||cK(G.pattern)}',
17
17
  ${q.length>0?`plugins: [
18
18
  ${q.join(`,
19
19
  `)}
20
20
  ],`:""}
21
21
  })
22
22
  );`)}return J.join(`
23
- `)}function bK(X){if(X.startsWith("*.")){let $=X.slice(2);return`({ request }) => request.destination === '${SK($)}'`}if(X.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${X.slice(0,-3)}')`;if(X.endsWith("/*")){let $=X.slice(0,-2);return`({ url }) => url.pathname.startsWith('${$}') && !url.pathname.slice(${$.length+1}).includes('/')`}if(X.includes("*")&&!X.startsWith("*")){let[$,Z]=X.split("*");return`({ url }) => url.pathname.startsWith('${$}') && url.pathname.endsWith('${Z}')`}if(X==="/"||!X.includes("*"))return`({ url }) => url.pathname === '${X}'`;return`new RegExp('${PK(X).replace(/\\\*/g,".*")}')`}function SK(X){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[X.toLowerCase()]||"empty"}function CK(X){return"stx-"+X.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function PK(X){return X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var a4={};n(a4,{isWorkboxEnabled:()=>s4,getServiceWorkerGenerator:()=>hK,generateWorkboxServiceWorker:()=>o4,generateWorkboxConfig:()=>r4});function r4(X,$){let Z=X.pwa;if(!Z?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let Y=Z.serviceWorker||{},J=Z.routes||[],G=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],Q=new Set;for(let U of J)Q.add(W$(U.strategy));if(Q.size>0)G.push({name:"workbox-strategies",exports:Array.from(Q)});if(J.some((U)=>U.maxAgeSeconds||U.maxEntries)||Z.cacheStorage)G.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(J.some((U)=>U.strategy==="network-first"||U.strategy==="stale-while-revalidate"))G.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Z.backgroundSync?.enabled)G.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(Y.navigationPreload)G.push({name:"workbox-navigation-preload",exports:["enable"]});let K=$?f1($,X):void 0;return{mode:"generate",modules:G,precacheManifest:K?.entries,skipWaiting:Y.skipWaiting??!0,clientsClaim:Y.clientsClaim??!0,offlineFallback:Z.offline?.enabled?"/offline.html":void 0,navigationPreload:Y.navigationPreload??!1,cacheVersion:Y.cacheVersion||"1.0.0"}}function o4(X,$){let Z=X.pwa;if(!Z?.enabled)return"";let Y=r4(X,$),J=Z.serviceWorker||{},G=Z.push,Q=Z.backgroundSync,q=$?f1($,X):null,K=q?e7(q):"[]",U=vK(Y.modules),W=n4(X);return`/**
23
+ `)}function mK(X){if(X.startsWith("*.")){let $=X.slice(2);return`({ request }) => request.destination === '${lK($)}'`}if(X.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${X.slice(0,-3)}')`;if(X.endsWith("/*")){let $=X.slice(0,-2);return`({ url }) => url.pathname.startsWith('${$}') && !url.pathname.slice(${$.length+1}).includes('/')`}if(X.includes("*")&&!X.startsWith("*")){let[$,Z]=X.split("*");return`({ url }) => url.pathname.startsWith('${$}') && url.pathname.endsWith('${Z}')`}if(X==="/"||!X.includes("*"))return`({ url }) => url.pathname === '${X}'`;return`new RegExp('${pK(X).replace(/\\\*/g,".*")}')`}function lK(X){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[X.toLowerCase()]||"empty"}function cK(X){return"stx-"+X.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function pK(X){return X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var J2={};n(J2,{isWorkboxEnabled:()=>Y2,getServiceWorkerGenerator:()=>sK,generateWorkboxServiceWorker:()=>Z2,generateWorkboxConfig:()=>$2});function $2(X,$){let Z=X.pwa;if(!Z?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let Y=Z.serviceWorker||{},J=Z.routes||[],G=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],Q=new Set;for(let U of J)Q.add(W$(U.strategy));if(Q.size>0)G.push({name:"workbox-strategies",exports:Array.from(Q)});if(J.some((U)=>U.maxAgeSeconds||U.maxEntries)||Z.cacheStorage)G.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(J.some((U)=>U.strategy==="network-first"||U.strategy==="stale-while-revalidate"))G.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Z.backgroundSync?.enabled)G.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(Y.navigationPreload)G.push({name:"workbox-navigation-preload",exports:["enable"]});let K=$?f1($,X):void 0;return{mode:"generate",modules:G,precacheManifest:K?.entries,skipWaiting:Y.skipWaiting??!0,clientsClaim:Y.clientsClaim??!0,offlineFallback:Z.offline?.enabled?"/offline.html":void 0,navigationPreload:Y.navigationPreload??!1,cacheVersion:Y.cacheVersion||"1.0.0"}}function Z2(X,$){let Z=X.pwa;if(!Z?.enabled)return"";let Y=$2(X,$),J=Z.serviceWorker||{},G=Z.push,Q=Z.backgroundSync,q=$?f1($,X):null,K=q?XX(q):"[]",U=iK(Y.modules),W=X2(X);return`/**
24
24
  * Service Worker - Generated by stx with Workbox
25
25
  * Cache Version: ${Y.cacheVersion}
26
26
  *
@@ -169,13 +169,13 @@ self.addEventListener('message', (event) => {
169
169
  }
170
170
  });
171
171
 
172
- ${G?.enabled?fK(G):"// Push notifications disabled"}
172
+ ${G?.enabled?rK(G):"// Push notifications disabled"}
173
173
 
174
- ${Q?.enabled?gK(Q):"// Background sync disabled"}
174
+ ${Q?.enabled?oK(Q):"// Background sync disabled"}
175
175
 
176
176
  console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
177
- `}function vK(X){let $=[];for(let Z of X){let Y=Z.name.replace("workbox-","");$.push(`const { ${Z.exports.join(", ")} } = workbox.${xK(Y)};`)}return $.join(`
178
- `)}function xK(X){return X.replace(/-([a-z])/g,($,Z)=>Z.toUpperCase())}function fK(X){return`
177
+ `}function iK(X){let $=[];for(let Z of X){let Y=Z.name.replace("workbox-","");$.push(`const { ${Z.exports.join(", ")} } = workbox.${nK(Y)};`)}return $.join(`
178
+ `)}function nK(X){return X.replace(/-([a-z])/g,($,Z)=>Z.toUpperCase())}function rK(X){return`
179
179
  // ============================================================================
180
180
  // Push Notifications
181
181
  // ============================================================================
@@ -244,7 +244,7 @@ self.addEventListener('notificationclick', (event) => {
244
244
  })
245
245
  );
246
246
  });
247
- `}function gK(X){return`
247
+ `}function oK(X){return`
248
248
  // ============================================================================
249
249
  // Background Sync
250
250
  // ============================================================================
@@ -306,7 +306,7 @@ self.addEventListener('message', (event) => {
306
306
  event.waitUntil(syncQueue.pushRequest({ request }));
307
307
  }
308
308
  });
309
- `}function s4(X){return X.pwa?.enabled===!0&&X.pwa?.serviceWorker?.useWorkbox===!0}function hK(X){if(s4(X))return o4;let{generateServiceWorker:$}=(o5(),h4(e4));return $}var t4=D(()=>{r5()});var e4={};n(e4,{isWorkboxEnabled:()=>X2,getServiceWorkerFileName:()=>z5,generateServiceWorkerAuto:()=>mK,generateServiceWorker:()=>XX});function XX(X,$){let Z=X.pwa;if(!Z?.enabled)return"";let Y=Z.serviceWorker||{},J=Z.routes||[],G=Y.cacheVersion||"1.0.0",Q=Z.offline,q=Q?.page?"/offline.html":"/offline.html",K=Z.push,U=Z.backgroundSync,W=Z.cacheStorage,w=$?f1($,X):null,z=w?e7(w):"[]",B=["/","/manifest.json",...Q?.enabled?[q]:[],...Q?.precacheAssets||[]];return`/**
309
+ `}function Y2(X){return X.pwa?.enabled===!0&&X.pwa?.serviceWorker?.useWorkbox===!0}function sK(X){if(Y2(X))return Z2;let{generateServiceWorker:$}=(s5(),i4(Q2));return $}var G2=E(()=>{o5()});var Q2={};n(Q2,{isWorkboxEnabled:()=>q2,getServiceWorkerFileName:()=>j5,generateServiceWorkerAuto:()=>eK,generateServiceWorker:()=>$X});function $X(X,$){let Z=X.pwa;if(!Z?.enabled)return"";let Y=Z.serviceWorker||{},J=Z.routes||[],G=Y.cacheVersion||"1.0.0",Q=Z.offline,q=Q?.page?"/offline.html":"/offline.html",K=Z.push,U=Z.backgroundSync,W=Z.cacheStorage,w=$?f1($,X):null,z=w?XX(w):"[]",B=["/","/manifest.json",...Q?.enabled?[q]:[],...Q?.precacheAssets||[]];return`/**
310
310
  * Service Worker - Auto-generated by stx
311
311
  * Cache Version: ${G}
312
312
  *
@@ -320,7 +320,7 @@ self.addEventListener('message', (event) => {
320
320
  * Additional features:
321
321
  * - Push notifications: ${K?.enabled?"enabled":"disabled"}
322
322
  * - Background sync: ${U?.enabled?"enabled":"disabled"}
323
- * - Cache limits: ${W?.maxSize?`${i4(W.maxSize*1024*1024)}`:"unlimited"}
323
+ * - Cache limits: ${W?.maxSize?`${e4(W.maxSize*1024*1024)}`:"unlimited"}
324
324
  */
325
325
 
326
326
  const CACHE_VERSION = '${G}';
@@ -501,9 +501,9 @@ self.addEventListener('message', (event) => {
501
501
  }
502
502
  });
503
503
 
504
- ${K?.enabled?uK():"// Push notifications disabled"}
504
+ ${K?.enabled?aK():"// Push notifications disabled"}
505
505
 
506
- ${U?.enabled?dK():"// Background sync disabled"}
506
+ ${U?.enabled?tK():"// Background sync disabled"}
507
507
 
508
508
  /**
509
509
  * Check if a route should be excluded from caching
@@ -868,7 +868,7 @@ async function purgeByEntryCount(entries, cache, maxEntries) {
868
868
  }
869
869
 
870
870
  console.log('[SW] Service Worker loaded - Version:', CACHE_VERSION);
871
- `}function uK(){return`
871
+ `}function aK(){return`
872
872
  /**
873
873
  * Push event - handle incoming push notifications
874
874
  */
@@ -950,7 +950,7 @@ self.addEventListener('notificationclose', (event) => {
950
950
  // Could send analytics here
951
951
  }
952
952
  });
953
- `}function dK(){return`
953
+ `}function tK(){return`
954
954
  /**
955
955
  * Background sync queue storage (IndexedDB)
956
956
  */
@@ -1132,7 +1132,7 @@ self.addEventListener('message', (event) => {
1132
1132
  event.waitUntil(registerFormSync(event.data.payload));
1133
1133
  }
1134
1134
  });
1135
- `}function z5(X){return X.pwa?.serviceWorker?.fileName||"sw.js"}function X2(X){return X.pwa?.enabled===!0&&X.pwa?.serviceWorker?.useWorkbox===!0}function mK(X,$){if(!X.pwa?.enabled)return"";if(X2(X)){let{generateWorkboxServiceWorker:Z}=(t4(),h4(a4));return Z(X,$)}return XX(X,$)}var o5=D(()=>{r5()});var $2={};n($2,{injectPwaTags:()=>z$,generateThemeColorMeta:()=>pK,generateSwRegistrationScript:()=>lK,generatePwaTags:()=>$X,generateManifestLink:()=>cK});function $X(X){let $=X.pwa;if(!$?.enabled)return"";let Z=$.manifest,Y=$.icons?.outputDir?`/${$.icons.outputDir}`:"/pwa-icons",J=z5(X),G=`
1135
+ `}function j5(X){return X.pwa?.serviceWorker?.fileName||"sw.js"}function q2(X){return X.pwa?.enabled===!0&&X.pwa?.serviceWorker?.useWorkbox===!0}function eK(X,$){if(!X.pwa?.enabled)return"";if(q2(X)){let{generateWorkboxServiceWorker:Z}=(G2(),i4(J2));return Z(X,$)}return $X(X,$)}var s5=E(()=>{o5()});var K2={};n(K2,{injectPwaTags:()=>z$,generateThemeColorMeta:()=>ZU,generateSwRegistrationScript:()=>XU,generatePwaTags:()=>ZX,generateManifestLink:()=>$U});function ZX(X){let $=X.pwa;if(!$?.enabled)return"";let Z=$.manifest,Y=$.icons?.outputDir?`/${$.icons.outputDir}`:"/pwa-icons",J=j5(X),G=`
1136
1136
  <!-- stx PWA Meta Tags -->
1137
1137
  <link rel="manifest" href="/manifest.json">
1138
1138
  <meta name="theme-color" content="${w$(Z?.themeColor||"#000000")}">
@@ -1176,12 +1176,12 @@ if ('serviceWorker' in navigator) {
1176
1176
  });
1177
1177
  }
1178
1178
  </script>
1179
- <!-- End stx PWA -->`,G}function z$(X,$){let Z=$.pwa;if(!Z?.enabled||Z.autoInject===!1)return X;if(X.includes("<!-- stx PWA Meta Tags -->"))return X;if(!X.includes("</head>")){let J=X.lastIndexOf("</body>");if(J!==-1){let G=$X($);return X.slice(0,J)+G+`
1180
- `+X.slice(J)}return X+$X($)}let Y=$X($);return X.replace("</head>",`${Y}
1181
- </head>`)}function lK(X){if(!X.pwa?.enabled)return"";return`<script>
1179
+ <!-- End stx PWA -->`,G}function z$(X,$){let Z=$.pwa;if(!Z?.enabled||Z.autoInject===!1)return X;if(X.includes("<!-- stx PWA Meta Tags -->"))return X;if(!X.includes("</head>")){let J=X.lastIndexOf("</body>");if(J!==-1){let G=ZX($);return X.slice(0,J)+G+`
1180
+ `+X.slice(J)}return X+ZX($)}let Y=ZX($);return X.replace("</head>",`${Y}
1181
+ </head>`)}function XU(X){if(!X.pwa?.enabled)return"";return`<script>
1182
1182
  if ('serviceWorker' in navigator) {
1183
1183
  window.addEventListener('load', function() {
1184
- navigator.serviceWorker.register('/${z5(X)}')
1184
+ navigator.serviceWorker.register('/${j5(X)}')
1185
1185
  .then(function(registration) {
1186
1186
  console.log('[PWA] Service Worker registered:', registration.scope);
1187
1187
  })
@@ -1190,7 +1190,7 @@ if ('serviceWorker' in navigator) {
1190
1190
  });
1191
1191
  });
1192
1192
  }
1193
- </script>`}function cK(){return'<link rel="manifest" href="/manifest.json">'}function pK(X){return`<meta name="theme-color" content="${w$(X)}">`}function w$(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var ZX=D(()=>{o5()});function Y2(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function j$(X,$){let Z={...X};for(let[Y,J]of Object.entries($))Z[Y]=Y2(J)&&Y2(Z[Y])?j$(Z[Y],J):J;return Z}function J2(X={},$={}){let Z=X.theme||{},Y=$.theme||{},{extend:J,...G}=Y,{extend:Q,...q}=Z,K=j$(q,G),U=j$(Q||{},J||{});if(Object.keys(U).length>0)K.extend=U;let W=[...X.safelist||[],...$.safelist||[]],w={...X.shortcuts||{},...$.shortcuts||{}},z=[...X.preflights||[],...$.preflights||[]];return{config:{...X,...$,theme:K,safelist:W,shortcuts:w,...z.length>0?{preflights:z}:{},content:[],output:""},safelist:W,shortcuts:w,includePreflight:$.preflight!==!1,minify:$.minify===!0}}import s5 from"path";function Q2(X){G2=X?.trim()||null}function a5(){return process.env[tK]?.trim()||G2||j5}function t5(X=process.cwd(),...$){let Z=a5();return s5.isAbsolute(Z)?s5.join(Z,...$):s5.join(X,Z,...$)}function e5(X){if(!X||s5.isAbsolute(X))return X;let $=X.replace(/\\/g,"/");if($!==j5&&!$.startsWith(`${j5}/`))return X;let Z=$.slice(j5.length+1);return Z?s5.join(a5(),Z):a5()}var j5=".stx",tK="STX_DIR",G2=null;var YX=()=>{};var V0;var q2=D(()=>{V0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function K2(X,$,Z,Y){let J=X;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,q,K)=>{let W={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[q]||"Make this element accessible";return`<!-- a11y-hint: ${K||W} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(G,(Q,q)=>{return`<span class="sr-only">${q.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,q,K)=>{return`<span id="${`desc-${q}`}" class="sr-only">${K}</span>`}),J}var U2,W2;var B$=D(()=>{U2={name:"a11y",handler:(X,$,Z,Y)=>{if(!$.length)return X;let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"",q={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${G||q} -->${X}`},hasEndTag:!1},W2={name:"screenReader",handler:(X)=>{return`<span class="sr-only">${X}</span>`},hasEndTag:!0}});function eK(X,$={}){let{duration:Z,delay:Y,ease:J,direction:G,custom:Q}={...K1,...$};if(X==="custom"&&Q)return Q;switch(X){case"fade":return`${G==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1193
+ </script>`}function $U(){return'<link rel="manifest" href="/manifest.json">'}function ZU(X){return`<meta name="theme-color" content="${w$(X)}">`}function w$(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var YX=E(()=>{s5()});function W2(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function j$(X,$){let Z={...X};for(let[Y,J]of Object.entries($))Z[Y]=W2(J)&&W2(Z[Y])?j$(Z[Y],J):J;return Z}function w2(X={},$={}){let Z=X.theme||{},Y=$.theme||{},{extend:J,...G}=Y,{extend:Q,...q}=Z,K=j$(q,G),U=j$(Q||{},J||{});if(Object.keys(U).length>0)K.extend=U;let W=[...X.safelist||[],...$.safelist||[]],w={...X.shortcuts||{},...$.shortcuts||{}},z=[...X.preflights||[],...$.preflights||[]];return{config:{...X,...$,theme:K,safelist:W,shortcuts:w,...z.length>0?{preflights:z}:{},content:[],output:""},safelist:W,shortcuts:w,includePreflight:$.preflight!==!1,minify:$.minify===!0}}import a5 from"path";function j2(X){z2=X?.trim()||null}function t5(){return process.env[UU]?.trim()||z2||B5}function e5(X=process.cwd(),...$){let Z=t5();return a5.isAbsolute(Z)?a5.join(Z,...$):a5.join(X,Z,...$)}function X7(X){if(!X||a5.isAbsolute(X))return X;let $=X.replace(/\\/g,"/");if($!==B5&&!$.startsWith(`${B5}/`))return X;let Z=$.slice(B5.length+1);return Z?a5.join(t5(),Z):t5()}var B5=".stx",UU="STX_DIR",z2=null;var JX=()=>{};var V0;var B2=E(()=>{V0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function _2(X,$,Z,Y){let J=X;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,q,K)=>{let W={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[q]||"Make this element accessible";return`<!-- a11y-hint: ${K||W} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(G,(Q,q)=>{return`<span class="sr-only">${q.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,q,K)=>{return`<span id="${`desc-${q}`}" class="sr-only">${K}</span>`}),J}var H2,O2;var B$=E(()=>{H2={name:"a11y",handler:(X,$,Z,Y)=>{if(!$.length)return X;let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"",q={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${G||q} -->${X}`},hasEndTag:!1},O2={name:"screenReader",handler:(X)=>{return`<span class="sr-only">${X}</span>`},hasEndTag:!0}});function WU(X,$={}){let{duration:Z,delay:Y,ease:J,direction:G,custom:Q}={...K1,...$};if(X==="custom"&&Q)return Q;switch(X){case"fade":return`${G==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1194
1194
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1195
1195
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${G==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1196
1196
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1200,7 +1200,7 @@ if ('serviceWorker' in navigator) {
1200
1200
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1201
1201
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${G==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1202
1202
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1203
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function XU(){return`
1203
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function wU(){return`
1204
1204
  <script data-stx-scoped data-stx-run="once">
1205
1205
  // Motion preferences handling
1206
1206
  (function() {
@@ -1228,7 +1228,7 @@ else {
1228
1228
  });
1229
1229
  })();
1230
1230
  </script>
1231
- `}function $U(X){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Z)=>Z.test(X))}function ZU(X=0.1,$="0px"){return`
1231
+ `}function zU(X){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Z)=>Z.test(X))}function jU(X=0.1,$="0px"){return`
1232
1232
  <script data-stx-scoped data-stx-run="always">
1233
1233
  // Intersection Observer for scroll animations
1234
1234
  (function() {
@@ -1271,7 +1271,7 @@ else {
1271
1271
  }
1272
1272
  })();
1273
1273
  </script>
1274
- `}function YU(){return`
1274
+ `}function BU(){return`
1275
1275
  <style id="stx-animation-base">
1276
1276
  :root {
1277
1277
  --stx-transition-duration: 300ms;
@@ -1386,7 +1386,7 @@ else {
1386
1386
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1387
1387
  }
1388
1388
  </style>
1389
- `}function JU(X,$,Z={}){let{staggerDelay:Y=50,sequence:J=!1}=Z;return`
1389
+ `}function _U(X,$,Z={}){let{staggerDelay:Y=50,sequence:J=!1}=Z;return`
1390
1390
  <script data-stx-scoped data-stx-run="always">
1391
1391
  // Animation Group: ${X}
1392
1392
  (function() {
@@ -1423,13 +1423,13 @@ else {
1423
1423
  }
1424
1424
  })();
1425
1425
  </script>
1426
- `}function _2(X,$,Z,Y){let J=X;if(Y.animation?.enabled===!1)return J;let G=Z.includes("test")&&Z.includes("animation");if(!$U(J)&&!G)return J;if(!J.includes('<style id="stx-animation-base">')){let q=YU();J=J.replace("</head>",`${q}
1427
- </head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let K=ZU(),U=J.lastIndexOf("</body>");if(U!==-1)J=J.slice(0,U)+K+`
1428
- `+J.slice(U)}}return J}var K1,w2,z2,j2,B2;var _$=D(()=>{K1={duration:300,delay:0,ease:"ease",direction:"both"};w2={name:"transition",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||K1.duration:K1.duration,Q=$.length>2?$[2]||K1.ease:K1.ease,q=$.length>3?Number.parseInt($[3],10)||K1.delay:K1.delay,K=$.length>4?$[4]||K1.direction:K1.direction,U=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=eK(J,{duration:G,delay:q,ease:Q,direction:K}),w="stx-transition",z="";if(J==="fade")z="stx-fade";else if(J==="slide")z="stx-slide";else if(J==="scale")z="stx-scale";else if(J==="flip")z="stx-flip";else if(J==="rotate")z="stx-rotate";return`<div id="${U}" class="${w} ${z} ${K==="out"?"stx-out":""}"
1429
- style="--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms;">${X}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},z2={name:"scrollAnimate",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||300:300,Q=$.length>2?$[2]||"ease":"ease",q=$.length>3?Number.parseFloat($[3])||0.2:0.2,K=$.length>4?Number.parseInt($[4],10)||0:0,U=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${K}ms; will-change: opacity, transform;`,w="stx-transition stx-observe stx-out";if(J==="fade")w+=" stx-fade";else if(J==="slide-up"||J==="slide")w+=" stx-from-bottom";else if(J==="slide-down")w+=" stx-from-top";else if(J==="slide-left")w+=" stx-from-right";else if(J==="slide-right")w+=" stx-from-left";else if(J==="scale")w+=" stx-scale";else if(J.includes("-"))w+=` stx-${J}`;else w+=` stx-${J}`;return`<div id="${U}" class="${w}" style="${W}" data-threshold="${q}">${X}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},j2={name:"animationGroup",handler:(X,$,Z,Y)=>{if($.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${X}`;let J=$[0],G=$.slice(1).map((U)=>U.startsWith("#")||U.startsWith(".")?U:`#${U}`),Q=Z.staggerDelay||50,q=Z.sequence||!0,K=JU(J,G,{staggerDelay:Q,sequence:q});return`${X}
1430
- ${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},B2={name:"motion",handler:(X,$,Z,Y)=>{let J=$.length>0?$[0].toLowerCase()==="true":!0,G=XU();return`<div data-animate="${J?"auto":"true"}">${X}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function H$(X){return X.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>X7.includes(Z))}function $7(X){return H$(X.replace(/^\//,""))}var X7;var JX=D(()=>{X7=["components","layouts","partials"]});import B5 from"fs";import Z7 from"path";function Y7(X,$){let Z=X.filter((Q)=>!$7(Q.pattern)),Y=["// Auto-generated by STX - do not edit"];if(Z.length===0)Y.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{Y.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let Q of Z){let q=[];for(let U of Q.params){let W=Q.pattern.includes(`:${U}?`)?"?":"";q.push(`${U}${W}: string`)}let K=q.join("; ");Y.push(` '${Q.pattern}': { ${K} }`)}Y.push(" }","}","","export {}","")}let J=Y.join(`
1431
- `),G=Z7.join($,"route-types.d.ts");try{if(B5.existsSync(G)&&B5.readFileSync(G,"utf8")===J)return;B5.mkdirSync($,{recursive:!0}),B5.writeFileSync(G,J)}catch{}}function J7(X,$,Z){let Y=process.cwd(),J=Z7.relative(Y,Z),G=X.filter((q)=>!$7(q.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${J||"pages"}/`,"","export const routes = ["];for(let q of G){let K=Z7.relative(Y,q.filePath).replace(/\\/g,"/"),U=JSON.stringify(q.params),W=q.layout?`, layout: '${Z7.relative(Y,q.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${q.pattern}', filePath: '${K}', isDynamic: ${q.isDynamic}, params: ${U}${W} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),B5.mkdirSync($,{recursive:!0}),B5.writeFileSync(Z7.join($,"routes.ts"),Q.join(`
1432
- `))}var O$=D(()=>{JX()});import H2 from"path";function GX(X,$){let Y=H2.relative($,X).replace(/\.(stx|md)$/,"");if(Y=Y.split(H2.sep).join("/"),Y==="index")return"/";if(Y.endsWith("/index"))Y=Y.slice(0,-6);return Y=Y.replace(/\[\[([^\]]+)\]\]/g,":$1?"),Y=Y.replace(/\[([^\]]+)\]/g,":$1"),Y=Y.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${Y}`}function G7(X){let $=[],Z="",Y=0;while(Y<X.length){let J=X.slice(Y),G=/^\/:([^/?*]+)\?/.exec(J);if(G){$.push(G[1]),Z+="(?:/([^/]+))?",Y+=G[0].length;continue}let Q=/^:([^/?*]+)\*/.exec(J);if(Q){$.push(Q[1]),Z+="(.+)",Y+=Q[0].length;continue}let q=/^:([^/?*]+)/.exec(J);if(q){$.push(q[1]),Z+="([^/]+)",Y+=q[0].length;continue}Z+=X[Y].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),Y+=1}return{regex:new RegExp(`^${Z}$`),params:$}}function QX(X,$){let Z=X===""?"/":X;for(let Y of $){let J=Z.match(Y.regex);if(J){let G={};return Y.params.forEach((Q,q)=>{G[Q]=J[q+1]}),{route:Y,params:G}}}return null}function O2(X){let $=X.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return G7($)}var L$=()=>{};import GU from"fs";import F$ from"path";function qX(X,$){let Z=[],Y=F$.dirname(X);while(Y.startsWith($)||Y===$){let J=F$.join(Y,"_layout.stx");if(GU.existsSync(J))Z.unshift(J);if(Y===$)break;Y=F$.dirname(Y)}return Z}var V$=()=>{};import A$ from"fs";import _5 from"path";function L2(X,$){let Z=[];if(!A$.existsSync(X))return Z;let Y=A$.readdirSync(X,{withFileTypes:!0});for(let J of Y){let G=_5.join(X,J.name);if(J.isDirectory()){if(J.name.startsWith("."))continue;if(X7.includes(J.name))continue;Z.push(...L2(G,$))}else if(J.isFile()){let Q=_5.extname(J.name);if($.includes(Q)){if(J.name.startsWith("_")&&J.name!=="_layout.stx")continue;if(J.name==="_layout.stx")continue;Z.push(G)}}}return Z}class H5{routes;pagesDir;pagesDirs;config;constructor(X,$={}){this.config=$;let Z=$.pagesDirs&&$.pagesDirs.length>0?$.pagesDirs:[$.pagesDir||"pages"];this.pagesDirs=Z.map((Q)=>_5.resolve(X,Q)),this.pagesDir=this.pagesDirs[0];let Y=$.extensions||[".stx"],J=new Set;this.routes=[];for(let Q of this.pagesDirs){let q=L2(Q,Y);for(let K of q){let U=GX(K,Q);if(J.has(U))continue;J.add(U);let{regex:W,params:w}=G7(U),z=$.layouts!==!1?qX(K,Q):[];this.routes.push({pattern:U,regex:W,params:w,filePath:K,isDynamic:w.length>0,layout:z.length>0?z[z.length-1]:void 0})}}this.routes.sort((Q,q)=>{if(!Q.isDynamic&&q.isDynamic)return-1;if(Q.isDynamic&&!q.isDynamic)return 1;let K=Q.pattern.split("/").length,U=q.pattern.split("/").length;if(K!==U)return U-K;return Q.pattern.localeCompare(q.pattern)});let G=_5.resolve(X,$.stateDir||process.env.STX_DIR?.trim()||".stx");Y7(this.routes,G),J7(this.routes,G,this.pagesDir)}match(X){let $=X===""?"/":X;for(let Z of this.routes){let Y=$.match(Z.regex);if(Y){let J={};return Z.params.forEach((G,Q)=>{J[G]=Y[Q+1]}),{route:Z,params:J}}}return null}resolve(X,$){let Z=this.routes.find((J)=>J.pattern===X||J.filePath.includes(X));if(!Z)return"#not-found";let Y=Z.pattern;if($)for(let[J,G]of Object.entries($))Y=Y.replace(`:${J}`,encodeURIComponent(G));return Y}addRoute(X){this.routes.push(X),this.routes.sort(($,Z)=>{if(!$.isDynamic&&Z.isDynamic)return-1;if($.isDynamic&&!Z.isDynamic)return 1;return $.pattern.localeCompare(Z.pattern)})}getLayout(X){return X.layout??null}}function F2(X,$){return new H5(X,$)}function R$(X,$){let Z=[`${$}.stx`,"error.stx"];for(let Y of Z){let J=_5.join(X,Y);if(A$.existsSync(J))return J}return null}function T$(X,$){return X.map((Z)=>{let Y=_5.relative($,Z.filePath),J=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${Y}${J}`})}var V2=D(()=>{O$();L$();V$();JX()});function N$(X){KX=X.replace(/\/$/,"")}function M$(X,$,Z={}){O5[X]={path:$,name:X,params:Z}}function k$(X){for(let[$,Z]of Object.entries(X))if(typeof Z==="string")O5[$]={path:Z,name:$};else O5[$]={...Z,name:$}}function Q7(X,$={},Z=!1){let Y=O5[X];if(!Y)return console.warn(`Route [${X}] not defined.`),"#undefined-route";let J={...Y.params,...$},G=Y.path;G=G.replace(/:(\w+)/g,(q,K)=>{let U=J[K];if(U===void 0)return console.warn(`Missing parameter [${K}] for route [${X}].`),`:${K}`;return delete J[K],encodeURIComponent(String(U))});let Q=Object.entries(J);if(Q.length>0){let q=Q.map(([K,U])=>`${encodeURIComponent(K)}=${encodeURIComponent(String(U))}`).join("&");G+=(G.includes("?")?"&":"?")+q}return Z&&KX?`${KX}${G}`:G}function I$(){for(let X of Object.keys(O5))delete O5[X];KX=""}var O5,KX="";var A2=D(()=>{O5={}});import R2 from"fs";import T2 from"path";function N2(X,$={}){return{type:"redirect",path:X,options:{replace:$.replace??!1,external:$.external??!1,redirectCode:$.redirectCode??302}}}function M2(X){return{type:"abort",error:typeof X==="string"?{statusCode:500,message:X}:X}}function k2(X,$={}){return{handler:X,mode:$.mode??"universal"}}function E$(X){let $={};if(!X)return $;let Z=X.split(";");for(let Y of Z){let[J,...G]=Y.split("=");if(J){let Q=J.trim(),q=G.join("=").trim();if(Q)$[Q]=decodeURIComponent(q)}}return $}function UX(X,$,Z={}){let Y=`${encodeURIComponent(X)}=${encodeURIComponent($)}`;if(Z.expires){let J=typeof Z.expires==="number"?new Date(Date.now()+Z.expires*1000):Z.expires;Y+=`; Expires=${J.toUTCString()}`}if(Z.path)Y+=`; Path=${Z.path}`;if(Z.domain)Y+=`; Domain=${Z.domain}`;if(Z.secure)Y+="; Secure";if(Z.httpOnly)Y+="; HttpOnly";if(Z.sameSite)Y+=`; SameSite=${Z.sameSite}`;return Y}function D$(X,$){let Z=X.headers.get("cookie")||"",Y=E$(Z);return{get(J){return Y[J]},set(J,G,Q={}){Y[J]=G,$.append("Set-Cookie",UX(J,G,Q))},delete(J){delete Y[J],$.append("Set-Cookie",UX(J,"",{expires:new Date(0),path:"/"}))},getAll(){return{...Y}}}}function y$(){return{get(X){if(typeof document>"u")return;return E$(document.cookie)[X]},set(X,$,Z={}){if(typeof document>"u")return;document.cookie=UX(X,$,Z)},delete(X){if(typeof document>"u")return;document.cookie=UX(X,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return E$(document.cookie)}}}function b$(){let X=typeof window<"u"&&typeof window.localStorage<"u";return{get($){if(!X)return null;try{return window.localStorage.getItem($)}catch{return null}},set($,Z){if(!X)return;try{window.localStorage.setItem($,Z)}catch{}},remove($){if(!X)return;try{window.localStorage.removeItem($)}catch{}},isAvailable(){return X}}}function WX(X,$){q7.set(X,$)}function S$(X){return q7.get(X)}function I2(X){return q7.has(X)}function E2(){q7.clear()}function D2(){return Array.from(q7.keys())}async function y2(X,$="middleware"){let Z=T2.resolve(X,$);if(!R2.existsSync(Z))return;let Y=R2.readdirSync(Z);for(let J of Y){if(!J.endsWith(".ts")&&!J.endsWith(".js"))continue;if(J.includes(".test.")||J.includes(".spec."))continue;let G=J.replace(/\.(ts|js)$/,""),Q=T2.join(Z,J);try{let K=(await import(Q)).default;if(K&&typeof K.handler==="function")WX(G,K);else if(typeof K==="function")WX(G,{handler:K,mode:"universal"})}catch(q){console.warn(`Failed to load middleware '${G}' from ${Q}:`,q)}}}function QU(X){let $={};if(!X)return $;let Z=new URLSearchParams(X);for(let[Y,J]of Z)$[Y]=J;return $}function b2(X,$,Z,Y=""){return{path:X,params:$,query:QU(Y),fullPath:Y?`${X}?${Y}`:X,meta:Z}}function S2(X,$,Z,Y){let J=Y?.isServer??typeof window>"u",G=!J,Q=new Headers;return{to:X,from:$,isClient:G,isServer:J,cookies:J&&Z?D$(Z,Q):y$(),storage:b$(),state:{},request:Z,responseHeaders:Q}}async function C2(X,$){let Z=Array.isArray(X)?X:[X],Y=$.isServer;for(let J of Z){let G=S$(J);if(!G)return console.error(`Route middleware '${J}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${J}' is not registered`}},state:$.state,responseHeaders:$.responseHeaders};if(G.mode==="server"&&!Y)continue;try{let Q=await G.handler($);if(Q){if(Q.type==="redirect")return{passed:!1,redirect:Q,state:$.state,responseHeaders:$.responseHeaders};if(Q.type==="abort")return{passed:!1,abort:Q,state:$.state,responseHeaders:$.responseHeaders}}}catch(Q){return console.error(`Error in middleware '${J}':`,Q),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:Q instanceof Error?Q.message:"Middleware error"}},state:$.state,responseHeaders:$.responseHeaders}}}return{passed:!0,state:$.state,responseHeaders:$.responseHeaders}}var q7;var P2=D(()=>{q7=new Map});function K7(X){let Z=X.replace(/\\/g,"/").split("/").filter(Boolean),Y=Z.lastIndexOf("layouts"),J=Y>=0?Z[Y+1]:Z.at(-1);if(!J)return"app";return J.replace(/\.stx$/i,"")||"app"}function v2(X){let $=X.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),Z=X.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),Y=X.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),J=$?.[1]||Y?.[1]||"";return{layout:J,group:Z?.[1]||K7(J)}}function qU(X){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return X}}function U7(){if(wX)return wX;return wX=qU(`
1426
+ `}function R2(X,$,Z,Y){let J=X;if(Y.animation?.enabled===!1)return J;let G=Z.includes("test")&&Z.includes("animation");if(!zU(J)&&!G)return J;if(!J.includes('<style id="stx-animation-base">')){let q=BU();J=J.replace("</head>",`${q}
1427
+ </head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let K=jU(),U=J.lastIndexOf("</body>");if(U!==-1)J=J.slice(0,U)+K+`
1428
+ `+J.slice(U)}}return J}var K1,L2,F2,V2,A2;var _$=E(()=>{K1={duration:300,delay:0,ease:"ease",direction:"both"};L2={name:"transition",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||K1.duration:K1.duration,Q=$.length>2?$[2]||K1.ease:K1.ease,q=$.length>3?Number.parseInt($[3],10)||K1.delay:K1.delay,K=$.length>4?$[4]||K1.direction:K1.direction,U=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=WU(J,{duration:G,delay:q,ease:Q,direction:K}),w="stx-transition",z="";if(J==="fade")z="stx-fade";else if(J==="slide")z="stx-slide";else if(J==="scale")z="stx-scale";else if(J==="flip")z="stx-flip";else if(J==="rotate")z="stx-rotate";return`<div id="${U}" class="${w} ${z} ${K==="out"?"stx-out":""}"
1429
+ style="--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms;">${X}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},F2={name:"scrollAnimate",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||300:300,Q=$.length>2?$[2]||"ease":"ease",q=$.length>3?Number.parseFloat($[3])||0.2:0.2,K=$.length>4?Number.parseInt($[4],10)||0:0,U=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${K}ms; will-change: opacity, transform;`,w="stx-transition stx-observe stx-out";if(J==="fade")w+=" stx-fade";else if(J==="slide-up"||J==="slide")w+=" stx-from-bottom";else if(J==="slide-down")w+=" stx-from-top";else if(J==="slide-left")w+=" stx-from-right";else if(J==="slide-right")w+=" stx-from-left";else if(J==="scale")w+=" stx-scale";else if(J.includes("-"))w+=` stx-${J}`;else w+=` stx-${J}`;return`<div id="${U}" class="${w}" style="${W}" data-threshold="${q}">${X}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},V2={name:"animationGroup",handler:(X,$,Z,Y)=>{if($.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${X}`;let J=$[0],G=$.slice(1).map((U)=>U.startsWith("#")||U.startsWith(".")?U:`#${U}`),Q=Z.staggerDelay||50,q=Z.sequence||!0,K=_U(J,G,{staggerDelay:Q,sequence:q});return`${X}
1430
+ ${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},A2={name:"motion",handler:(X,$,Z,Y)=>{let J=$.length>0?$[0].toLowerCase()==="true":!0,G=wU();return`<div data-animate="${J?"auto":"true"}">${X}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function H$(X){return X.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>$7.includes(Z))}function Z7(X){return H$(X.replace(/^\//,""))}var $7;var GX=E(()=>{$7=["components","layouts","partials","emails"]});import _5 from"fs";import Y7 from"path";function J7(X,$){let Z=X.filter((Q)=>!Z7(Q.pattern)),Y=["// Auto-generated by STX - do not edit"];if(Z.length===0)Y.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{Y.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let Q of Z){let q=[];for(let U of Q.params){let W=Q.pattern.includes(`:${U}?`)?"?":"";q.push(`${U}${W}: string`)}let K=q.join("; ");Y.push(` '${Q.pattern}': { ${K} }`)}Y.push(" }","}","","export {}","")}let J=Y.join(`
1431
+ `),G=Y7.join($,"route-types.d.ts");try{if(_5.existsSync(G)&&_5.readFileSync(G,"utf8")===J)return;_5.mkdirSync($,{recursive:!0}),_5.writeFileSync(G,J)}catch{}}function G7(X,$,Z){let Y=process.cwd(),J=Y7.relative(Y,Z),G=X.filter((q)=>!Z7(q.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${J||"pages"}/`,"","export const routes = ["];for(let q of G){let K=Y7.relative(Y,q.filePath).replace(/\\/g,"/"),U=JSON.stringify(q.params),W=q.layout?`, layout: '${Y7.relative(Y,q.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${q.pattern}', filePath: '${K}', isDynamic: ${q.isDynamic}, params: ${U}${W} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),_5.mkdirSync($,{recursive:!0}),_5.writeFileSync(Y7.join($,"routes.ts"),Q.join(`
1432
+ `))}var O$=E(()=>{GX()});import N2 from"path";function QX(X,$){let Y=N2.relative($,X).replace(/\.(stx|md)$/,"");if(Y=Y.split(N2.sep).join("/"),Y==="index")return"/";if(Y.endsWith("/index"))Y=Y.slice(0,-6);return Y=Y.replace(/\[\[([^\]]+)\]\]/g,":$1?"),Y=Y.replace(/\[([^\]]+)\]/g,":$1"),Y=Y.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${Y}`}function Q7(X){let $=[],Z="",Y=0;while(Y<X.length){let J=X.slice(Y),G=/^\/:([^/?*]+)\?/.exec(J);if(G){$.push(G[1]),Z+="(?:/([^/]+))?",Y+=G[0].length;continue}let Q=/^:([^/?*]+)\*/.exec(J);if(Q){$.push(Q[1]),Z+="(.+)",Y+=Q[0].length;continue}let q=/^:([^/?*]+)/.exec(J);if(q){$.push(q[1]),Z+="([^/]+)",Y+=q[0].length;continue}Z+=X[Y].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),Y+=1}return{regex:new RegExp(`^${Z}$`),params:$}}function qX(X,$){let Z=X===""?"/":X;for(let Y of $){let J=Z.match(Y.regex);if(J){let G={};return Y.params.forEach((Q,q)=>{G[Q]=J[q+1]}),{route:Y,params:G}}}return null}function T2(X){let $=X.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return Q7($)}var L$=()=>{};import HU from"fs";import F$ from"path";function KX(X,$){let Z=[],Y=F$.dirname(X);while(Y.startsWith($)||Y===$){let J=F$.join(Y,"_layout.stx");if(HU.existsSync(J))Z.unshift(J);if(Y===$)break;Y=F$.dirname(Y)}return Z}var V$=()=>{};import A$ from"fs";import H5 from"path";function M2(X,$){let Z=[];if(!A$.existsSync(X))return Z;let Y=A$.readdirSync(X,{withFileTypes:!0});for(let J of Y){let G=H5.join(X,J.name);if(J.isDirectory()){if(J.name.startsWith("."))continue;if($7.includes(J.name))continue;Z.push(...M2(G,$))}else if(J.isFile()){let Q=H5.extname(J.name);if($.includes(Q)){if(J.name.startsWith("_")&&J.name!=="_layout.stx")continue;if(J.name==="_layout.stx")continue;Z.push(G)}}}return Z}class O5{routes;pagesDir;pagesDirs;config;constructor(X,$={}){this.config=$;let Z=$.pagesDirs&&$.pagesDirs.length>0?$.pagesDirs:[$.pagesDir||"pages"];this.pagesDirs=Z.map((Q)=>H5.resolve(X,Q)),this.pagesDir=this.pagesDirs[0];let Y=$.extensions||[".stx"],J=new Set;this.routes=[];for(let Q of this.pagesDirs){let q=M2(Q,Y);for(let K of q){let U=QX(K,Q);if(J.has(U))continue;J.add(U);let{regex:W,params:w}=Q7(U),z=$.layouts!==!1?KX(K,Q):[];this.routes.push({pattern:U,regex:W,params:w,filePath:K,isDynamic:w.length>0,layout:z.length>0?z[z.length-1]:void 0})}}this.routes.sort((Q,q)=>{if(!Q.isDynamic&&q.isDynamic)return-1;if(Q.isDynamic&&!q.isDynamic)return 1;let K=Q.pattern.split("/").length,U=q.pattern.split("/").length;if(K!==U)return U-K;return Q.pattern.localeCompare(q.pattern)});let G=H5.resolve(X,$.stateDir||process.env.STX_DIR?.trim()||".stx");J7(this.routes,G),G7(this.routes,G,this.pagesDir)}match(X){let $=X===""?"/":X;for(let Z of this.routes){let Y=$.match(Z.regex);if(Y){let J={};return Z.params.forEach((G,Q)=>{J[G]=Y[Q+1]}),{route:Z,params:J}}}return null}resolve(X,$){let Z=this.routes.find((J)=>J.pattern===X||J.filePath.includes(X));if(!Z)return"#not-found";let Y=Z.pattern;if($)for(let[J,G]of Object.entries($))Y=Y.replace(`:${J}`,encodeURIComponent(G));return Y}addRoute(X){this.routes.push(X),this.routes.sort(($,Z)=>{if(!$.isDynamic&&Z.isDynamic)return-1;if($.isDynamic&&!Z.isDynamic)return 1;return $.pattern.localeCompare(Z.pattern)})}getLayout(X){return X.layout??null}}function k2(X,$){return new O5(X,$)}function R$(X,$){let Z=[`${$}.stx`,"error.stx"];for(let Y of Z){let J=H5.join(X,Y);if(A$.existsSync(J))return J}return null}function N$(X,$){return X.map((Z)=>{let Y=H5.relative($,Z.filePath),J=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${Y}${J}`})}var I2=E(()=>{O$();L$();V$();GX()});function T$(X){UX=X.replace(/\/$/,"")}function M$(X,$,Z={}){L5[X]={path:$,name:X,params:Z}}function k$(X){for(let[$,Z]of Object.entries(X))if(typeof Z==="string")L5[$]={path:Z,name:$};else L5[$]={...Z,name:$}}function q7(X,$={},Z=!1){let Y=L5[X];if(!Y)return console.warn(`Route [${X}] not defined.`),"#undefined-route";let J={...Y.params,...$},G=Y.path;G=G.replace(/:(\w+)/g,(q,K)=>{let U=J[K];if(U===void 0)return console.warn(`Missing parameter [${K}] for route [${X}].`),`:${K}`;return delete J[K],encodeURIComponent(String(U))});let Q=Object.entries(J);if(Q.length>0){let q=Q.map(([K,U])=>`${encodeURIComponent(K)}=${encodeURIComponent(String(U))}`).join("&");G+=(G.includes("?")?"&":"?")+q}return Z&&UX?`${UX}${G}`:G}function I$(){for(let X of Object.keys(L5))delete L5[X];UX=""}var L5,UX="";var E2=E(()=>{L5={}});import D2 from"fs";import y2 from"path";function b2(X,$={}){return{type:"redirect",path:X,options:{replace:$.replace??!1,external:$.external??!1,redirectCode:$.redirectCode??302}}}function S2(X){return{type:"abort",error:typeof X==="string"?{statusCode:500,message:X}:X}}function C2(X,$={}){return{handler:X,mode:$.mode??"universal"}}function E$(X){let $={};if(!X)return $;let Z=X.split(";");for(let Y of Z){let[J,...G]=Y.split("=");if(J){let Q=J.trim(),q=G.join("=").trim();if(Q)$[Q]=decodeURIComponent(q)}}return $}function WX(X,$,Z={}){let Y=`${encodeURIComponent(X)}=${encodeURIComponent($)}`;if(Z.expires){let J=typeof Z.expires==="number"?new Date(Date.now()+Z.expires*1000):Z.expires;Y+=`; Expires=${J.toUTCString()}`}if(Z.path)Y+=`; Path=${Z.path}`;if(Z.domain)Y+=`; Domain=${Z.domain}`;if(Z.secure)Y+="; Secure";if(Z.httpOnly)Y+="; HttpOnly";if(Z.sameSite)Y+=`; SameSite=${Z.sameSite}`;return Y}function D$(X,$){let Z=X.headers.get("cookie")||"",Y=E$(Z);return{get(J){return Y[J]},set(J,G,Q={}){Y[J]=G,$.append("Set-Cookie",WX(J,G,Q))},delete(J){delete Y[J],$.append("Set-Cookie",WX(J,"",{expires:new Date(0),path:"/"}))},getAll(){return{...Y}}}}function y$(){return{get(X){if(typeof document>"u")return;return E$(document.cookie)[X]},set(X,$,Z={}){if(typeof document>"u")return;document.cookie=WX(X,$,Z)},delete(X){if(typeof document>"u")return;document.cookie=WX(X,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return E$(document.cookie)}}}function b$(){let X=typeof window<"u"&&typeof window.localStorage<"u";return{get($){if(!X)return null;try{return window.localStorage.getItem($)}catch{return null}},set($,Z){if(!X)return;try{window.localStorage.setItem($,Z)}catch{}},remove($){if(!X)return;try{window.localStorage.removeItem($)}catch{}},isAvailable(){return X}}}function wX(X,$){K7.set(X,$)}function S$(X){return K7.get(X)}function P2(X){return K7.has(X)}function v2(){K7.clear()}function x2(){return Array.from(K7.keys())}async function f2(X,$="middleware"){let Z=y2.resolve(X,$);if(!D2.existsSync(Z))return;let Y=D2.readdirSync(Z);for(let J of Y){if(!J.endsWith(".ts")&&!J.endsWith(".js"))continue;if(J.includes(".test.")||J.includes(".spec."))continue;let G=J.replace(/\.(ts|js)$/,""),Q=y2.join(Z,J);try{let K=(await import(Q)).default;if(K&&typeof K.handler==="function")wX(G,K);else if(typeof K==="function")wX(G,{handler:K,mode:"universal"})}catch(q){console.warn(`Failed to load middleware '${G}' from ${Q}:`,q)}}}function OU(X){let $={};if(!X)return $;let Z=new URLSearchParams(X);for(let[Y,J]of Z)$[Y]=J;return $}function g2(X,$,Z,Y=""){return{path:X,params:$,query:OU(Y),fullPath:Y?`${X}?${Y}`:X,meta:Z}}function h2(X,$,Z,Y){let J=Y?.isServer??typeof window>"u",G=!J,Q=new Headers;return{to:X,from:$,isClient:G,isServer:J,cookies:J&&Z?D$(Z,Q):y$(),storage:b$(),state:{},request:Z,responseHeaders:Q}}async function u2(X,$){let Z=Array.isArray(X)?X:[X],Y=$.isServer;for(let J of Z){let G=S$(J);if(!G)return console.error(`Route middleware '${J}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${J}' is not registered`}},state:$.state,responseHeaders:$.responseHeaders};if(G.mode==="server"&&!Y)continue;try{let Q=await G.handler($);if(Q){if(Q.type==="redirect")return{passed:!1,redirect:Q,state:$.state,responseHeaders:$.responseHeaders};if(Q.type==="abort")return{passed:!1,abort:Q,state:$.state,responseHeaders:$.responseHeaders}}}catch(Q){return console.error(`Error in middleware '${J}':`,Q),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:Q instanceof Error?Q.message:"Middleware error"}},state:$.state,responseHeaders:$.responseHeaders}}}return{passed:!0,state:$.state,responseHeaders:$.responseHeaders}}var K7;var d2=E(()=>{K7=new Map});function U7(X){let Z=X.replace(/\\/g,"/").split("/").filter(Boolean),Y=Z.lastIndexOf("layouts"),J=Y>=0?Z[Y+1]:Z.at(-1);if(!J)return"app";return J.replace(/\.stx$/i,"")||"app"}function m2(X){let $=X.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),Z=X.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),Y=X.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),J=$?.[1]||Y?.[1]||"";return{layout:J,group:Z?.[1]||U7(J)}}function LU(X){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return X}}function W7(){if(zX)return zX;return zX=LU(`
1433
1433
  ;(function(){
1434
1434
  'use strict';
1435
1435
  var ROUTER_REV=7;
@@ -3079,7 +3079,7 @@ else {
3079
3079
 
3080
3080
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
3081
3081
  })();
3082
- `),wX}var wX;var x2={};n(x2,{setAppUrl:()=>N$,runMiddleware:()=>C2,route:()=>Q7,resolveLayoutChain:()=>qX,resetRoutes:()=>I$,registerMiddleware:()=>WX,patternToRegex:()=>G7,navigateTo:()=>N2,matchRoute:()=>QX,loadMiddlewareFromDirectory:()=>y2,isNonPageRoutePattern:()=>$7,isNonPageRoutePath:()=>H$,hasMiddleware:()=>I2,getRouterScript:()=>U7,getMiddlewareNames:()=>D2,getMiddleware:()=>S$,generateRouteTypes:()=>Y7,generateRouteManifest:()=>J7,formatRoutes:()=>T$,findErrorPage:()=>R$,filePathToPattern:()=>GX,extractLayoutMetadata:()=>v2,deriveLayoutGroup:()=>K7,defineRoutes:()=>k$,defineRoute:()=>M$,defineMiddleware:()=>k2,createStorageManager:()=>b$,createServerCookieManager:()=>D$,createRouter:()=>F2,createRouteLocation:()=>b2,createMiddlewareContext:()=>S2,createClientCookieManager:()=>y$,clearMiddleware:()=>E2,bracketPathToRegex:()=>O2,abortNavigation:()=>M2,Router:()=>H5,NON_PAGE_DIRS:()=>X7});var g1=D(()=>{V2();L$();A2();P2();V$();O$();JX()});var f2=D(()=>{g1();C$()});async function KU(X,$,Z,Y){let J=$[0]?.replace(/['"]/g,"")||"main",G=U7();if(J!=="main")G=G.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${G}</script>`}var g2;var C$=D(()=>{f2();g2={name:"stxRouter",handler:KU,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function h2(X){let $=X.heatmap;if(!$?.enabled)return"";let Z={...UU,...$};return`
3082
+ `),zX}var zX;var l2={};n(l2,{setAppUrl:()=>T$,runMiddleware:()=>u2,route:()=>q7,resolveLayoutChain:()=>KX,resetRoutes:()=>I$,registerMiddleware:()=>wX,patternToRegex:()=>Q7,navigateTo:()=>b2,matchRoute:()=>qX,loadMiddlewareFromDirectory:()=>f2,isNonPageRoutePattern:()=>Z7,isNonPageRoutePath:()=>H$,hasMiddleware:()=>P2,getRouterScript:()=>W7,getMiddlewareNames:()=>x2,getMiddleware:()=>S$,generateRouteTypes:()=>J7,generateRouteManifest:()=>G7,formatRoutes:()=>N$,findErrorPage:()=>R$,filePathToPattern:()=>QX,extractLayoutMetadata:()=>m2,deriveLayoutGroup:()=>U7,defineRoutes:()=>k$,defineRoute:()=>M$,defineMiddleware:()=>C2,createStorageManager:()=>b$,createServerCookieManager:()=>D$,createRouter:()=>k2,createRouteLocation:()=>g2,createMiddlewareContext:()=>h2,createClientCookieManager:()=>y$,clearMiddleware:()=>v2,bracketPathToRegex:()=>T2,abortNavigation:()=>S2,Router:()=>O5,NON_PAGE_DIRS:()=>$7});var g1=E(()=>{I2();L$();E2();d2();V$();O$();GX()});var c2=E(()=>{g1();C$()});async function FU(X,$,Z,Y){let J=$[0]?.replace(/['"]/g,"")||"main",G=W7();if(J!=="main")G=G.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${G}</script>`}var p2;var C$=E(()=>{c2();p2={name:"stxRouter",handler:FU,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function i2(X){let $=X.heatmap;if(!$?.enabled)return"";let Z={...VU,...$};return`
3083
3083
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
3084
3084
  <script>
3085
3085
  (function() {
@@ -3462,8 +3462,8 @@ else {
3462
3462
  };
3463
3463
  })();
3464
3464
  </script>
3465
- `}function u2(X,$){let Z=h2($);if(!Z)return X;let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}function WU(X){let $={},Z=X.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of Z){let[J,G]=Y.split("="),Q=G?.replace(/["']/g,"");switch(J){case"endpoint":$.endpoint=Q;break;case"samplingRate":$.samplingRate=Number.parseInt(Q,10);break;case"batchSize":$.batchSize=Number.parseInt(Q,10);break;case"trackMouse":$.trackMouse=Q==="true";break;case"trackClicks":$.trackClicks=Q==="true";break;case"trackScroll":$.trackScroll=Q==="true";break;case"honorDnt":$.honorDnt=Q==="true";break;case"debugOverlay":$.debugOverlay=Q==="true";break}}return $}var UU,d2;var P$=D(()=>{UU={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};d2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(X,$,Z,Y)=>{let J=Z.__stx_config||{};if($.length>0){let G=WU($.join(" "));J.heatmap={...J.heatmap,...G,enabled:!0}}return h2(J)}}});function L1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function m2(X){let $=X.trim().toLowerCase();return!$.startsWith("javascript:")&&!$.startsWith("vbscript:")&&!$.startsWith("data:text/html")}function l2(X){let $=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=X.match($);if(!Z)return{data:{},content:X.trim()};let Y=Z[1],J=X.slice(Z[0].length),G={};for(let Q of Y.split(`
3466
- `)){let q=Q.trim();if(!q||q.startsWith("#"))continue;let K=q.indexOf(":");if(K===-1)continue;let U=q.slice(0,K).trim(),W=q.slice(K+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}G[U]=W}return{data:G,content:J.trim()}}function W7(X,$={}){let{gfm:Z=!0,breaks:Y=!1}=$,J=X,G=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(W,w,z)=>{let B=G.length,j=w?` class="language-${L1(w)}"`:"";return G.push(`<pre><code${j}>${L1(z.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),J=J.replace(/`([^`]*)`/g,(W,w)=>`<code>${L1(w)}</code>`),J=J.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),J=J.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),J=J.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),J=J.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),J=J.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),J=J.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),J=J.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),J=J.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),J=J.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),J=J.replace(/__(.+?)__/g,"<strong>$1</strong>"),J=J.replace(/\*(.+?)\*/g,"<em>$1</em>"),J=J.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,w,z)=>{return`<img src="${m2(z)?L1(z):""}" alt="${L1(w)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,w,z)=>{return`<a href="${m2(z)?L1(z):""}">${w}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
3465
+ `}function n2(X,$){let Z=i2($);if(!Z)return X;let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}function AU(X){let $={},Z=X.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of Z){let[J,G]=Y.split("="),Q=G?.replace(/["']/g,"");switch(J){case"endpoint":$.endpoint=Q;break;case"samplingRate":$.samplingRate=Number.parseInt(Q,10);break;case"batchSize":$.batchSize=Number.parseInt(Q,10);break;case"trackMouse":$.trackMouse=Q==="true";break;case"trackClicks":$.trackClicks=Q==="true";break;case"trackScroll":$.trackScroll=Q==="true";break;case"honorDnt":$.honorDnt=Q==="true";break;case"debugOverlay":$.debugOverlay=Q==="true";break}}return $}var VU,r2;var P$=E(()=>{VU={enabled:!1,trackMouse:!0,trackClicks:!0,trackScroll:!0,samplingRate:100,honorDnt:!0,batchSize:50,maxDataPoints:1000,sessionTimeout:30,persistData:!1,storagePrefix:"stx_heatmap",captureAttributes:["data-heatmap-id","data-track"],ignoreSelectors:["[data-heatmap-ignore]",".heatmap-ignore"],debugOverlay:!1};r2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(X,$,Z,Y)=>{let J=Z.__stx_config||{};if($.length>0){let G=AU($.join(" "));J.heatmap={...J.heatmap,...G,enabled:!0}}return i2(J)}}});function L1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function o2(X){let $=X.trim().toLowerCase();return!$.startsWith("javascript:")&&!$.startsWith("vbscript:")&&!$.startsWith("data:text/html")}function s2(X){let $=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=X.match($);if(!Z)return{data:{},content:X.trim()};let Y=Z[1],J=X.slice(Z[0].length),G={};for(let Q of Y.split(`
3466
+ `)){let q=Q.trim();if(!q||q.startsWith("#"))continue;let K=q.indexOf(":");if(K===-1)continue;let U=q.slice(0,K).trim(),W=q.slice(K+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}G[U]=W}return{data:G,content:J.trim()}}function w7(X,$={}){let{gfm:Z=!0,breaks:Y=!1}=$,J=X,G=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(W,w,z)=>{let B=G.length,j=w?` class="language-${L1(w)}"`:"";return G.push(`<pre><code${j}>${L1(z.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),J=J.replace(/`([^`]*)`/g,(W,w)=>`<code>${L1(w)}</code>`),J=J.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),J=J.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),J=J.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),J=J.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),J=J.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),J=J.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),J=J.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),J=J.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),J=J.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),J=J.replace(/__(.+?)__/g,"<strong>$1</strong>"),J=J.replace(/\*(.+?)\*/g,"<em>$1</em>"),J=J.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,w,z)=>{return`<img src="${o2(z)?L1(z):""}" alt="${L1(w)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,w,z)=>{return`<a href="${o2(z)?L1(z):""}">${w}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
3467
3467
  `),J=J.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),J=J.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),J=J.replace(/<\/ul>\n<ul>/g,""),J=J.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),J=J.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),J=J.replace(/<\/ol>\n<ol>/g,""),J=J.replace(/<li data-ul>/g,"<li>"),J=J.replace(/<li data-ol>/g,"<li>"),Z)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,w,z)=>{let j=`<tr>${w.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${L1(H)}</th>`).join("")}</tr>`,_=z.trim().split(`
3468
3468
  `).map((H)=>{return`<tr>${H.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${L1(O)}</td>`).join("")}</tr>`}).join(`
3469
3469
  `);return`<table>
@@ -3480,7 +3480,7 @@ ${_}
3480
3480
  `:`
3481
3481
  `)}</p>`);if(J=q.join(`
3482
3482
  `),Y)J=J.replace(/\n/g,`<br />
3483
- `);for(let W=0;W<G.length;W++)J=J.replace(`\x00CODEBLOCK${W}\x00`,G[W]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function L5(X="const",$=[],Z){let Y=$.length?U1.filter((J)=>!$.includes(J)):U1;if(Z!==void 0)Y=Y.filter((J)=>{let G=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${X} { ${Y.join(", ")} } = window.stx;`}function v$(X){if(!X)return!1;return zU.some(($)=>new RegExp(`\\b${$}\\s*(?:<[^>]*>)?\\s*\\(`).test(X))}function x$(X){if(!X)return!1;let $=o2(X);if(jU.some((Z)=>Z.test($)))return!0;return v$($)}function p2(X){if(!X)return!1;return BU.test(o2(X))||x$(X)}function r2(){return`{${i2.map((X)=>`'${X}':1`).join(",")}}`}function o2(X){if(!X)return X;let $=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(Y,J,G)=>J??" ".repeat(G.length));return X.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var U1,c2,wU,zU,jU,BU,i2,_U,n2;var X1=D(()=>{U1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],c2=["onMount","onDestroy"];wU=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],zU=U1.filter((X)=>!wU.includes(X));jU=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],BU=/\s@[a-z][\w.:-]*\s*=/i;i2=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],_U=["x-init","x-transition","x-effect","x-on"],n2=[...i2,..._U]});function t2(X){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of X){let Y=Z.toLowerCase();if(Y==="prevent")$.prevent=!0;else if(Y==="stop")$.stop=!0;else if(Y==="once")$.once=!0;else if(Y==="capture")$.capture=!0;else if(Y==="self")$.self=!0;else if(Y==="passive")$.passive=!0;else if(HU.has(Y))$.systemKeys.push(Y);else if(Y in e2)$.mouse=Y;else if(Y in a2||/^[a-z]$/.test(Y))$.keys.push(a2[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);$.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);$.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return $}function X6(X){let $=[],Z=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec(X))!==null){let[G,Q,q]=J,K=J.index,U=K+G.length,W=`__stx_evt_${Z++}`,w=[],z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=z.exec(q))!==null){let[,_,H]=B,L=_.split("."),O=L[0];if(!s2.has(O))continue;w.push({attribute:`@${_}`,event:O,handler:H,modifiers:t2(L.slice(1)),elementId:W})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,H]=B,L=_.split("."),O=L[0];if(!s2.has(O))continue;w.push({attribute:`@${_}`,event:O,handler:H,modifiers:t2(L.slice(1)),elementId:W})}if(w.length>0)$.push({originalTag:G,elementId:W,events:w,startIndex:K,endIndex:U})}return $}function OU(X){let $=[],{modifiers:Z}=X;if(Z.self)$.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=e2[Z.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function LU(X,$){let Z=X;if($.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${$.debounce})`;else if($.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${$.throttle})`;return Z}function f$(X){let $=X.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test($))return X;return`if (typeof ${$} === 'function' && !${$}._isSignal) ${$}($event);`}function FU(X){let{modifiers:$}=X,Z=X.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=OU(X),J=LU(f$(X.handler),$),G=[];if($.once)G.push("once: true");if($.capture)G.push("capture: true");if($.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",q=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(X.event==="mounted")return`
3483
+ `);for(let W=0;W<G.length;W++)J=J.replace(`\x00CODEBLOCK${W}\x00`,G[W]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function F5(X="const",$=[],Z){let Y=$.length?U1.filter((J)=>!$.includes(J)):U1;if(Z!==void 0)Y=Y.filter((J)=>{let G=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${X} { ${Y.join(", ")} } = window.stx;`}function v$(X){if(!X)return!1;return NU.some(($)=>new RegExp(`\\b${$}\\s*(?:<[^>]*>)?\\s*\\(`).test(X))}function x$(X){if(!X)return!1;let $=Z6(X);if(TU.some((Z)=>Z.test($)))return!0;return v$($)}function t2(X){if(!X)return!1;return MU.test(Z6(X))||x$(X)}function $6(){return`{${e2.map((X)=>`'${X}':1`).join(",")}}`}function Z6(X){if(!X)return X;let $=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(Y,J,G)=>J??" ".repeat(G.length));return X.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var U1,a2,RU,NU,TU,MU,e2,kU,X6;var e0=E(()=>{U1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],a2=["onMount","onDestroy"];RU=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],NU=U1.filter((X)=>!RU.includes(X));TU=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],MU=/\s@[a-z][\w.:-]*\s*=/i;e2=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],kU=["x-init","x-transition","x-effect","x-on"],X6=[...e2,...kU]});function G6(X){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of X){let Y=Z.toLowerCase();if(Y==="prevent")$.prevent=!0;else if(Y==="stop")$.stop=!0;else if(Y==="once")$.once=!0;else if(Y==="capture")$.capture=!0;else if(Y==="self")$.self=!0;else if(Y==="passive")$.passive=!0;else if(IU.has(Y))$.systemKeys.push(Y);else if(Y in Q6)$.mouse=Y;else if(Y in J6||/^[a-z]$/.test(Y))$.keys.push(J6[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);$.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);$.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return $}function q6(X){let $=[],Z=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec(X))!==null){let[G,Q,q]=J,K=J.index,U=K+G.length,W=`__stx_evt_${Z++}`,w=[],z=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=z.exec(q))!==null){let[,_,H]=B,L=_.split("."),O=L[0];if(!Y6.has(O))continue;w.push({attribute:`@${_}`,event:O,handler:H,modifiers:G6(L.slice(1)),elementId:W})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,H]=B,L=_.split("."),O=L[0];if(!Y6.has(O))continue;w.push({attribute:`@${_}`,event:O,handler:H,modifiers:G6(L.slice(1)),elementId:W})}if(w.length>0)$.push({originalTag:G,elementId:W,events:w,startIndex:K,endIndex:U})}return $}function EU(X){let $=[],{modifiers:Z}=X;if(Z.self)$.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=Q6[Z.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function DU(X,$){let Z=X;if($.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${$.debounce})`;else if($.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${$.throttle})`;return Z}function f$(X){let $=X.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test($))return X;return`if (typeof ${$} === 'function' && !${$}._isSignal) ${$}($event);`}function yU(X){let{modifiers:$}=X,Z=X.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=EU(X),J=DU(f$(X.handler),$),G=[];if($.once)G.push("once: true");if($.capture)G.push("capture: true");if($.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",q=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(X.event==="mounted")return`
3484
3484
  (function() {
3485
3485
  var $el = document.getElementById('${Z}');
3486
3486
  if (!$el) return;
@@ -3589,44 +3589,44 @@ else {
3589
3589
  }
3590
3590
 
3591
3591
  // Event listeners
3592
- ${X.map(FU).join(`
3592
+ ${X.map(yU).join(`
3593
3593
  `)}
3594
3594
  })();
3595
- </script>`}function VU(X){let $=X6(X);if($.length===0)return{template:X,bindings:[]};let Z=X,Y=[];for(let J=$.length-1;J>=0;J--){let G=$[J],Q=G.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${G.elementId}"`);else{let q=Q.match(/id=["']([^"']+)["']/);if(q)for(let K of G.events)K.elementId=q[1]}for(let q of G.events){let K=q.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(U,""),Q=Q.replace(W,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),Y.push(...G.events)}return{template:Z,bindings:Y}}function $6(X,$,Z){if(x$(X))return X;if($.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(X))return X;let{template:q,bindings:K}=VU(X),U=$.__stx_event_bindings||[];return $.__stx_event_bindings=[...U,...K],q}let Y=X6(X);if(Y.length===0)return X;let J=X;for(let q=Y.length-1;q>=0;q--){let K=Y[q],U=K.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${K.elementId}"`);else{let W=U.match(/id=["']([^"']+)["']/);if(W)for(let w of K.events)w.elementId=W[1]}for(let W of K.events){let w=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${w}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${w}\\s*=\\s*'[^']*'`,"g");U=U.replace(z,""),U=U.replace(B,"")}J=J.slice(0,K.startIndex)+U+J.slice(K.endIndex)}let G=g$(Y.flatMap((q)=>q.events)),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
3596
- `+J.slice(Q);else J+=G;return J}var s2,a2,HU,e2;var h$=D(()=>{X1();s2=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),a2={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},HU=new Set(["ctrl","alt","shift","meta"]),e2={left:0,middle:1,right:2}});function f0(X){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;X=X.replace($,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
3595
+ </script>`}function bU(X){let $=q6(X);if($.length===0)return{template:X,bindings:[]};let Z=X,Y=[];for(let J=$.length-1;J>=0;J--){let G=$[J],Q=G.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${G.elementId}"`);else{let q=Q.match(/id=["']([^"']+)["']/);if(q)for(let K of G.events)K.elementId=q[1]}for(let q of G.events){let K=q.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(U,""),Q=Q.replace(W,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),Y.push(...G.events)}return{template:Z,bindings:Y}}function K6(X,$,Z){if(x$(X))return X;if($.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(X))return X;let{template:q,bindings:K}=bU(X),U=$.__stx_event_bindings||[];return $.__stx_event_bindings=[...U,...K],q}let Y=q6(X);if(Y.length===0)return X;let J=X;for(let q=Y.length-1;q>=0;q--){let K=Y[q],U=K.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${K.elementId}"`);else{let W=U.match(/id=["']([^"']+)["']/);if(W)for(let w of K.events)w.elementId=W[1]}for(let W of K.events){let w=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),z=new RegExp(`\\s*${w}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${w}\\s*=\\s*'[^']*'`,"g");U=U.replace(z,""),U=U.replace(B,"")}J=J.slice(0,K.startIndex)+U+J.slice(K.endIndex)}let G=g$(Y.flatMap((q)=>q.events)),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
3596
+ `+J.slice(Q);else J+=G;return J}var Y6,J6,IU,Q6;var h$=E(()=>{e0();Y6=new Set(["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","mouseover","mouseout","contextmenu","wheel","keydown","keyup","keypress","submit","reset","change","input","focus","blur","focusin","focusout","select","invalid","touchstart","touchend","touchmove","touchcancel","drag","dragstart","dragend","dragenter","dragleave","dragover","drop","scroll","resize","load","error","abort","animationstart","animationend","animationiteration","transitionstart","transitionend","transitionrun","transitioncancel","mounted","unmounted"]),J6={enter:"Enter",tab:"Tab",delete:"Delete",backspace:"Backspace",esc:"Escape",escape:"Escape",space:" ",up:"ArrowUp",down:"ArrowDown",left:"ArrowLeft",right:"ArrowRight",home:"Home",end:"End",pageup:"PageUp",pagedown:"PageDown"},IU=new Set(["ctrl","alt","shift","meta"]),Q6={left:0,middle:1,right:2}});function f0(X){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;X=X.replace($,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
3597
3597
  `});let Z=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return X=X.replace(Z,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__composables
3598
- `}),X}function zX(X){return X.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function AU(){let X=globalThis;return X[Z6]??=new Map,X[Z6]}function t(X,$){let Z=AU(),Y=`${import.meta.url}\x00${X}`,J=Z.get(Y);if(J)return J;let G=$();return Z.set(Y,G),G.catch(()=>{if(Z.get(Y)===G)Z.delete(Y)}),G}var Z6;var w7=D(()=>{Z6=Symbol.for("stx.lazy-module-promises")});function F5(X){if(!X||X.indexOf("</")===-1)return X;return X.replace(RU,"<\\/$1")}var RU;var u$=D(()=>{RU=/<\/(script)/gi});import TU from"process";function S0(X="STX_PUBLIC_"){let $={},Z={};for(let[Y,J]of Object.entries(TU.env)){if(!Y.startsWith(X)||J===void 0)continue;$[`import.meta.env.${Y}`]=JSON.stringify(J),Z[Y]=J}return $["import.meta.env"]=JSON.stringify(Z),$}var F1=()=>{};function NU(X){if(!X||typeof X!=="object")return!1;let $=X;return typeof $.message==="string"&&($.name==="BuildMessage"||$.name==="ResolveMessage"||("position"in $))}function MU(X){if(X&&typeof X==="object"&&Array.isArray(X.errors))return X.errors;return[X]}function d$(X,$){let Z=[];for(let Y of MU(X)){if(NU(Y)){let J=Y.position||void 0;Z.push({file:$||J?.file,line:J?.line,column:J?.column,message:Y.message??"",lineText:J?.lineText});continue}Z.push({file:$,message:Y instanceof Error?Y.message:String(Y)})}return Z}function Y6(X,$){return d$(X,$).map((Z)=>{let Y=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",J=Z.lineText?`
3598
+ `}),X}function jX(X){return X.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function SU(X,$){let Z=X[$],Y=$+1;while(Y<X.length){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===Z)return Y+1;Y++}return X.length}function CU(X,$){let Z=$+1;while(Z<X.length){if(X[Z]==="\\"){Z+=2;continue}if(X[Z]==="`")return Z+1;if(X[Z]==="$"&&X[Z+1]==="{"){if(Z=BX(X,Z+2),Z<X.length)Z++;continue}Z++}return X.length}function BX(X,$){let Z=1,Y=$;while(Y<X.length){let J=X[Y];if(J==="\\"){Y+=2;continue}if(J==='"'||J==="'"){Y=SU(X,Y);continue}if(J==="`"){Y=CU(X,Y);continue}if(J==="/"&&X[Y+1]==="/"){while(Y<X.length&&X[Y]!==`
3599
+ `)Y++;continue}if(J==="/"&&X[Y+1]==="*"){Y+=2;while(Y<X.length&&X.slice(Y,Y+2)!=="*/")Y++;Y+=2;continue}if(J==="{"){Z++,Y++;continue}if(J==="}"){if(Z--,Z===0)return Y;Y++;continue}Y++}return X.length}function X1(X){let $="",Z=0;while(Z<X.length){let Y=X.slice(Z,Z+2);if(Y==="//"){while(Z<X.length&&X[Z]!==`
3600
+ `)$+=" ",Z++;continue}if(Y==="/*"){while(Z<X.length&&X.slice(Z,Z+2)!=="*/")$+=X[Z]===`
3601
+ `?`
3602
+ `:" ",Z++;$+=" ",Z+=2;continue}let J=X[Z];if(J==='"'||J==="'"){let G=J;$+=" ",Z++;while(Z<X.length&&X[Z]!==G){if(X[Z]==="\\"){$+=" ",Z+=2;continue}$+=X[Z]===`
3603
+ `?`
3604
+ `:" ",Z++}$+=" ",Z++;continue}if(J==="`"){$+=" ",Z++;while(Z<X.length&&X[Z]!=="`"){if(X[Z]==="\\"){$+=" ",Z+=2;continue}if(X[Z]==="$"&&X[Z+1]==="{"){let G=Z+2,Q=BX(X,G);if($+=" ",$+=X1(X.slice(G,Q)),Q<X.length)$+=" ";Z=Q+1;continue}$+=X[Z]===`
3605
+ `?`
3606
+ `:" ",Z++}$+=" ",Z++;continue}$+=J,Z++}return $}function PU(){let X=globalThis;return X[U6]??=new Map,X[U6]}function t(X,$){let Z=PU(),Y=`${import.meta.url}\x00${X}`,J=Z.get(Y);if(J)return J;let G=$();return Z.set(Y,G),G.catch(()=>{if(Z.get(Y)===G)Z.delete(Y)}),G}var U6;var z7=E(()=>{U6=Symbol.for("stx.lazy-module-promises")});function V5(X){if(!X||X.indexOf("</")===-1)return X;return X.replace(vU,"<\\/$1")}var vU;var u$=E(()=>{vU=/<\/(script)/gi});import xU from"process";function S0(X="STX_PUBLIC_"){let $={},Z={};for(let[Y,J]of Object.entries(xU.env)){if(!Y.startsWith(X)||J===void 0)continue;$[`import.meta.env.${Y}`]=JSON.stringify(J),Z[Y]=J}return $["import.meta.env"]=JSON.stringify(Z),$}var F1=()=>{};function fU(X){if(!X||typeof X!=="object")return!1;let $=X;return typeof $.message==="string"&&($.name==="BuildMessage"||$.name==="ResolveMessage"||("position"in $))}function gU(X){if(X&&typeof X==="object"&&Array.isArray(X.errors))return X.errors;return[X]}function d$(X,$){let Z=[];for(let Y of gU(X)){if(fU(Y)){let J=Y.position||void 0;Z.push({file:$||J?.file,line:J?.line,column:J?.column,message:Y.message??"",lineText:J?.lineText});continue}Z.push({file:$,message:Y instanceof Error?Y.message:String(Y)})}return Z}function W6(X,$){return d$(X,$).map((Z)=>{let Y=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",J=Z.lineText?`
3599
3607
  ${Z.lineText.trim()}`:"";return Y?`${Y}: ${Z.message}${J}`:`${Z.message}${J}`}).join(`
3600
- `)}var z7={};n(z7,{shouldLogBundlerDiagnostics:()=>q6,setBundlerFallbackMode:()=>DU,resolveBundlerFallback:()=>U6,recordBundleFailure:()=>K6,queueClientBundleBuild:()=>W6,hasUserImports:()=>yU,getBundleFailures:()=>IU,clearBundleFailures:()=>EU,bundleClientScript:()=>SU});import _0 from"path";import C0 from"fs";function q6(X=process.env){return X.STX_DEBUG==="true"||X.STX_DEBUG==="1"}function h1(...X){if(q6())console.log("[stx:bundler]",...X)}function K6(X,$,Z){c$.push({filePath:X||"<inline>",message:$,details:Z})}function IU(){return c$.slice()}function EU(){c$.length=0}function DU(X){l$=X}function U6(){if(l$)return l$;try{return B7.strict?.bundlerFallback??"warn"}catch{return"warn"}}function yU(X){let $=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=$.exec(X))!==null){let J=Z[1];if(!J6.some((Q)=>Q.test(J)))return h1("detected user import:",J),!0}let Y=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=Y.exec(X))!==null){let J=Z[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!J6.some((Q)=>Q.test(J)))return h1("detected side-effect import:",J),!0}return!1}function bU(X,$,Z,Y){let J=(G,Q)=>{let q=G===Z?$:_0.dirname(G),K=_0.resolve(q,Q),U=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,_0.join(K,"index.ts"),_0.join(K,"index.tsx"),_0.join(K,"index.js"),_0.join(K,"index.mjs")];for(let W of U)try{if(C0.existsSync(W)&&C0.statSync(W,{throwIfNoEntry:!1})?.isFile())return W}catch{}return K};return{name:"stx-client-bundle",setup(G){G.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^\//},(Q)=>{if(C0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let q=J(Q.importer,Q.path);return Y.add(q),{path:q}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let q=_0.resolve(X,Q.path.slice(2)),K=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,_0.join(q,"index.ts"),_0.join(q,"index.tsx"),_0.join(q,"index.js"),_0.join(q,"index.mjs")];for(let U of K)if(C0.existsSync(U)&&C0.statSync(U,{throwIfNoEntry:!1})?.isFile())return h1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",U),Y.add(U),{path:U};return console.warn(`[stx:bundler] could not resolve ${Q.path[0]}/ import:`,Q.path),{path:q}}),G.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Q)=>{let q=_0.extname(Q.path).toLowerCase(),K=q===".json"?"json":q===".tsx"?"tsx":q===".jsx"?"jsx":q===".ts"||q===".mts"||q===".cts"?"ts":"js";if(Q.path!==Z)Y.add(Q.path);return{contents:C0.readFileSync(Q.path,"utf8"),loader:K}})}}}function W6(X){let $=globalThis,Y=($[G6]??Promise.resolve()).then(X,X);return $[G6]=Y.then(()=>{return},()=>{return}),Y}async function SU(X,$,Z={}){let Y=Z.projectRoot||process.cwd(),J=Z.minify??!1,G=Z.cacheDir||t5(Y,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${kU}\x00${X}\x00${$}`);let q=Q.digest("hex").slice(0,12),K=_0.join(G,`${q}.js`),U=_0.join(G,`${q}.deps.json`),W=Bun.file(K);if(await W.exists()){let B=Bun.file(U),j=!0;if(await B.exists())try{let _=JSON.parse(await B.text());if(_.metadataVersion!==Q6||!Array.isArray(_.files))j=!1;for(let H of Array.isArray(_.files)?_.files:[])try{if(C0.statSync(H.path).mtimeMs!==H.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return h1("cache hit:",q),await W.text();h1("cache invalidated by dep change:",q)}let w=m$.get(q);if(w)return await w;let z=W6(()=>CU(X,$,{projectRoot:Y,minify:J,cacheDir:G,hash:q,cachePath:K,depsPath:U}));m$.set(q,z);try{return await z}finally{m$.delete(q)}}async function CU(X,$,Z){let{projectRoot:Y,minify:J,cacheDir:G,hash:Q,cachePath:q,depsPath:K}=Z,U=t5(Y,"bundle-tmp"),W=_0.join(U,`${Q}.ts`),w=_0.join(U,"out",Q);C0.mkdirSync(U,{recursive:!0}),C0.mkdirSync(w,{recursive:!0});let z=_0.dirname($),B=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,H;while((H=j.exec(X))!==null){if(H[1])continue;if(H[2])H[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)B.push(V)});else if(H[3])B.push(H[3])}while((H=_.exec(X))!==null){if(H[1])continue;B.push(H[2])}let L=B.length>0?`
3601
- export { ${B.join(", ")} }`:"";await Bun.write(W,X+L),h1("bundling:",Q,"from:",_0.basename($));let O=new Set;try{let F=await Bun.build({entrypoints:[W],outdir:w,target:"browser",format:"esm",minify:J,plugins:[bU(Y,z,W,O)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...S0()},root:Y});if(!F.success){let I=F.logs.filter((C)=>C.level==="error").map((C)=>C.message).join(", ");return console.warn("[stx:bundler] build failed:",I),X}let V="";for(let I of F.outputs){V=await I.text();break}let A=[];for(let I of V.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let C of I[1].split(",")){let S=C.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let b=C.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))A.push([b,b])}let R=V.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];V=V.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let T=`__stxBundle_${Q}`,N=A.map(([I,C])=>`${JSON.stringify(I)}: ${C}`).join(", "),k=A.map(([I])=>`var ${I} = undefined;`).join(`
3602
- `),M=A.map(([I])=>`${I} = ${T}[${JSON.stringify(I)}];`).join(`
3608
+ `)}var j7={};n(j7,{shouldLogBundlerDiagnostics:()=>B6,setBundlerFallbackMode:()=>mU,resolveBundlerFallback:()=>H6,recordBundleFailure:()=>_6,queueClientBundleBuild:()=>O6,hasUserImports:()=>lU,getBundleFailures:()=>uU,clearBundleFailures:()=>dU,bundleClientScript:()=>pU});import _0 from"path";import C0 from"fs";function B6(X=process.env){return X.STX_DEBUG==="true"||X.STX_DEBUG==="1"}function h1(...X){if(B6())console.log("[stx:bundler]",...X)}function _6(X,$,Z){c$.push({filePath:X||"<inline>",message:$,details:Z})}function uU(){return c$.slice()}function dU(){c$.length=0}function mU(X){l$=X}function H6(){if(l$)return l$;try{let X=_7.strict;return typeof X==="object"&&X!==null?X.bundlerFallback??"warn":"warn"}catch{return"warn"}}function lU(X){let $=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=$.exec(X))!==null){let J=Z[1];if(!w6.some((Q)=>Q.test(J)))return h1("detected user import:",J),!0}let Y=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=Y.exec(X))!==null){let J=Z[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!w6.some((Q)=>Q.test(J)))return h1("detected side-effect import:",J),!0}return!1}function cU(X,$,Z,Y){let J=(G,Q)=>{let q=G===Z?$:_0.dirname(G),K=_0.resolve(q,Q),U=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,_0.join(K,"index.ts"),_0.join(K,"index.tsx"),_0.join(K,"index.js"),_0.join(K,"index.mjs")];for(let W of U)try{if(C0.existsSync(W)&&C0.statSync(W,{throwIfNoEntry:!1})?.isFile())return W}catch{}return K};return{name:"stx-client-bundle",setup(G){G.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^\//},(Q)=>{if(C0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let q=J(Q.importer,Q.path);return Y.add(q),{path:q}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let q=_0.resolve(X,Q.path.slice(2)),K=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,_0.join(q,"index.ts"),_0.join(q,"index.tsx"),_0.join(q,"index.js"),_0.join(q,"index.mjs")];for(let U of K)if(C0.existsSync(U)&&C0.statSync(U,{throwIfNoEntry:!1})?.isFile())return h1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",U),Y.add(U),{path:U};return console.warn(`[stx:bundler] could not resolve ${Q.path[0]}/ import:`,Q.path),{path:q}}),G.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Q)=>{let q=_0.extname(Q.path).toLowerCase(),K=q===".json"?"json":q===".tsx"?"tsx":q===".jsx"?"jsx":q===".ts"||q===".mts"||q===".cts"?"ts":"js";if(Q.path!==Z)Y.add(Q.path);return{contents:C0.readFileSync(Q.path,"utf8"),loader:K}})}}}function O6(X){let $=globalThis,Y=($[z6]??Promise.resolve()).then(X,X);return $[z6]=Y.then(()=>{return},()=>{return}),Y}async function pU(X,$,Z={}){let Y=Z.projectRoot||process.cwd(),J=Z.minify??!1,G=Z.cacheDir||e5(Y,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${hU}\x00${X}\x00${$}`);let q=Q.digest("hex").slice(0,12),K=_0.join(G,`${q}.js`),U=_0.join(G,`${q}.deps.json`),W=Bun.file(K);if(await W.exists()){let B=Bun.file(U),j=!0;if(await B.exists())try{let _=JSON.parse(await B.text());if(_.metadataVersion!==j6||!Array.isArray(_.files))j=!1;for(let H of Array.isArray(_.files)?_.files:[])try{if(C0.statSync(H.path).mtimeMs!==H.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return h1("cache hit:",q),await W.text();h1("cache invalidated by dep change:",q)}let w=m$.get(q);if(w)return await w;let z=O6(()=>iU(X,$,{projectRoot:Y,minify:J,cacheDir:G,hash:q,cachePath:K,depsPath:U}));m$.set(q,z);try{return await z}finally{m$.delete(q)}}async function iU(X,$,Z){let{projectRoot:Y,minify:J,cacheDir:G,hash:Q,cachePath:q,depsPath:K}=Z,U=e5(Y,"bundle-tmp"),W=_0.join(U,`${Q}.ts`),w=_0.join(U,"out",Q);C0.mkdirSync(U,{recursive:!0}),C0.mkdirSync(w,{recursive:!0});let z=_0.dirname($),B=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,H;while((H=j.exec(X))!==null){if(H[1])continue;if(H[2])H[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)B.push(V)});else if(H[3])B.push(H[3])}while((H=_.exec(X))!==null){if(H[1])continue;B.push(H[2])}let L=B.length>0?`
3609
+ export { ${B.join(", ")} }`:"";await Bun.write(W,X+L),h1("bundling:",Q,"from:",_0.basename($));let O=new Set;try{let F=await Bun.build({entrypoints:[W],outdir:w,target:"browser",format:"esm",minify:J,plugins:[cU(Y,z,W,O)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...S0()},root:Y});if(!F.success){let I=F.logs.filter((C)=>C.level==="error").map((C)=>C.message).join(", ");return console.warn("[stx:bundler] build failed:",I),X}let V="";for(let I of F.outputs){V=await I.text();break}let A=[];for(let I of V.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let C of I[1].split(",")){let S=C.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let b=C.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))A.push([b,b])}let R=V.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];V=V.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let N=`__stxBundle_${Q}`,T=A.map(([I,C])=>`${JSON.stringify(I)}: ${C}`).join(", "),k=A.map(([I])=>`var ${I} = undefined;`).join(`
3610
+ `),M=A.map(([I])=>`${I} = ${N}[${JSON.stringify(I)}];`).join(`
3603
3611
  `);if(V=`${R.join(`
3604
3612
  `)}
3605
3613
  ${k}
3606
- var ${T} = (function() {
3614
+ var ${N} = (function() {
3607
3615
  ${V}
3608
- return { ${N} };
3616
+ return { ${T} };
3609
3617
  })();
3610
- ${M}`.trim(),h1("bundled:",Q,"output:",V.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${_0.basename($)} (${Q}); serving the unbundled source and not caching this result`),X;C0.mkdirSync(G,{recursive:!0}),await Bun.write(q,V);let y=Array.from(O).map((I)=>{try{return{path:I,mtimeMs:C0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(K,JSON.stringify({metadataVersion:Q6,files:y})),V}catch(F){let V=d$(F,$||void 0),A=Y6(F,$||void 0);if(console.warn(`[stx:bundler] error: ${A}`),K6($||"",A,V),U6()==="error")throw F;return X}finally{try{C0.rmSync(W,{force:!0}),C0.rmSync(w,{recursive:!0,force:!0})}catch{}}}var kU=5,Q6=1,c$,l$,J6,m$,G6;var j7=D(()=>{F1();YX();V1();c$=[];J6=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];m$=new Map,G6=Symbol.for("stx.client-bundle-build-queue")});var F6={};n(F6,{stripCommentsAndLiterals:()=>_X,renderVendorStyleTags:()=>BX,processClientScript:()=>O7,injectBrowserCoreAutoImports:()=>V5,generateServerDataBridge:()=>HX,generateBrowserAutoImportDestructuring:()=>cU,generateAutoImportDestructuring:()=>p$,extractBridgeData:()=>H7,extractAndStripCssImports:()=>jX,STX_AUTO_IMPORTS:()=>B6});import u1 from"path";import _7 from"fs";function vU(X){if(X.startsWith(".")||X.startsWith("/"))return null;if(X.startsWith("@")){let Z=X.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let $=X.match(/^([^/]+)(\/.*)?$/);if(!$)return null;return{pkg:$[1],subpath:$[2]||""}}function xU(X,$){let Z=$;while(!0){let Y=u1.join(Z,"node_modules",X,"package.json");if(_7.existsSync(Y))return u1.dirname(Y);let J=u1.dirname(Z);if(J===Z)return null;Z=J}}function fU(X,$){if(!X||typeof X!=="object")return null;let Z=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Z(J.import);if(typeof J.default==="object")return Z(J.default)}return null};if(Object.prototype.hasOwnProperty.call(X,$))return Z(X[$]);let Y=null;for(let J of Object.keys(X)){let G=J.indexOf("*");if(G===-1)continue;let Q=J.slice(0,G),q=J.slice(G+1);if(!$.startsWith(Q)||!$.endsWith(q))continue;if($.length<Q.length+q.length)continue;if(!Y||Q.length>Y.prefix.length)Y={pattern:J,prefix:Q,suffix:q}}if(Y){let J=$.slice(Y.prefix.length,$.length-Y.suffix.length),G=Z(X[Y.pattern]);if(G)return G.replace("*",J)}return null}function gU(X,$){let Z=vU(X);if(!Z||!Z.subpath)return null;let Y=xU(Z.pkg,$);if(!Y)return null;let J;try{J=JSON.parse(_7.readFileSync(u1.join(Y,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=fU(J.exports,G);if(!Q)return null;let q=u1.resolve(Y,Q);return _7.existsSync(q)?q:null}function jX(X,$){let Z=$.filePath?u1.dirname($.filePath):$.projectRoot||process.cwd(),Y=$.projectRoot||process.cwd(),J=new Set,G=[];return{code:X.replace(PU,(q,K)=>{let U;try{if(K.startsWith("./")||K.startsWith("../")||K.startsWith("/")){if(U=K.startsWith("/")?K:u1.resolve(Z,K),!_7.existsSync(U))throw Error(`file not found: ${U}`)}else{let W=null;try{W=Bun.resolveSync(K,Y)}catch{W=gU(K,Y)}if(!W)throw Error(`could not resolve ${K} (Bun.resolveSync + exports fallback both failed)`);U=W}}catch(W){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(K)} (from ${$.filePath||"<unknown>"}): ${W?.message||W}`),""}if(J.has(U))return"";J.add(U);try{let W=_7.readFileSync(U,"utf8");G.push({source:K,resolvedPath:U,contents:W})}catch(W){console.warn(`[stx:vendor-css] could not read ${U}: ${W?.message||W}`)}return""}),styles:G}}function hU(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function BX(X){if(X.length===0)return"";return`${X.map(($)=>{return`<style data-stx-vendor="${hU($.source)}" data-stx-layer="vendor">
3618
+ ${M}`.trim(),h1("bundled:",Q,"output:",V.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${_0.basename($)} (${Q}); serving the unbundled source and not caching this result`),X;C0.mkdirSync(G,{recursive:!0}),await Bun.write(q,V);let y=Array.from(O).map((I)=>{try{return{path:I,mtimeMs:C0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(K,JSON.stringify({metadataVersion:j6,files:y})),V}catch(F){let V=d$(F,$||void 0),A=W6(F,$||void 0);if(console.warn(`[stx:bundler] error: ${A}`),_6($||"",A,V),H6()==="error")throw F;return X}finally{try{C0.rmSync(W,{force:!0}),C0.rmSync(w,{recursive:!0,force:!0})}catch{}}}var hU=5,j6=1,c$,l$,w6,m$,z6;var B7=E(()=>{F1();JX();V1();c$=[];w6=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];m$=new Map,z6=Symbol.for("stx.client-bundle-build-queue")});var M6={};n(M6,{stripCommentsAndLiterals:()=>X1,renderVendorStyleTags:()=>HX,processClientScript:()=>L7,injectBrowserCoreAutoImports:()=>A5,generateServerDataBridge:()=>OX,generateBrowserAutoImportDestructuring:()=>$W,generateAutoImportDestructuring:()=>p$,findInterpolationEnd:()=>BX,extractBridgeData:()=>O7,extractAndStripCssImports:()=>_X,STX_AUTO_IMPORTS:()=>A6});import u1 from"path";import H7 from"fs";function rU(X){if(X.startsWith(".")||X.startsWith("/"))return null;if(X.startsWith("@")){let Z=X.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let $=X.match(/^([^/]+)(\/.*)?$/);if(!$)return null;return{pkg:$[1],subpath:$[2]||""}}function oU(X,$){let Z=$;while(!0){let Y=u1.join(Z,"node_modules",X,"package.json");if(H7.existsSync(Y))return u1.dirname(Y);let J=u1.dirname(Z);if(J===Z)return null;Z=J}}function sU(X,$){if(!X||typeof X!=="object")return null;let Z=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Z(J.import);if(typeof J.default==="object")return Z(J.default)}return null};if(Object.prototype.hasOwnProperty.call(X,$))return Z(X[$]);let Y=null;for(let J of Object.keys(X)){let G=J.indexOf("*");if(G===-1)continue;let Q=J.slice(0,G),q=J.slice(G+1);if(!$.startsWith(Q)||!$.endsWith(q))continue;if($.length<Q.length+q.length)continue;if(!Y||Q.length>Y.prefix.length)Y={pattern:J,prefix:Q,suffix:q}}if(Y){let J=$.slice(Y.prefix.length,$.length-Y.suffix.length),G=Z(X[Y.pattern]);if(G)return G.replace("*",J)}return null}function aU(X,$){let Z=rU(X);if(!Z||!Z.subpath)return null;let Y=oU(Z.pkg,$);if(!Y)return null;let J;try{J=JSON.parse(H7.readFileSync(u1.join(Y,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=sU(J.exports,G);if(!Q)return null;let q=u1.resolve(Y,Q);return H7.existsSync(q)?q:null}function _X(X,$){let Z=$.filePath?u1.dirname($.filePath):$.projectRoot||process.cwd(),Y=$.projectRoot||process.cwd(),J=new Set,G=[];return{code:X.replace(nU,(q,K)=>{let U;try{if(K.startsWith("./")||K.startsWith("../")||K.startsWith("/")){if(U=K.startsWith("/")?K:u1.resolve(Z,K),!H7.existsSync(U))throw Error(`file not found: ${U}`)}else{let W=null;try{W=Bun.resolveSync(K,Y)}catch{W=aU(K,Y)}if(!W)throw Error(`could not resolve ${K} (Bun.resolveSync + exports fallback both failed)`);U=W}}catch(W){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(K)} (from ${$.filePath||"<unknown>"}): ${W?.message||W}`),""}if(J.has(U))return"";J.add(U);try{let W=H7.readFileSync(U,"utf8");G.push({source:K,resolvedPath:U,contents:W})}catch(W){console.warn(`[stx:vendor-css] could not read ${U}: ${W?.message||W}`)}return""}),styles:G}}function tU(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function HX(X){if(X.length===0)return"";return`${X.map(($)=>{return`<style data-stx-vendor="${tU($.source)}" data-stx-layer="vendor">
3611
3619
  @layer vendor {
3612
3620
  ${$.contents}
3613
3621
  }
3614
3622
  </style>`}).join(`
3615
3623
  `)}
3616
- `}function V5(X){let $=_X(X),Z=new Set;for(let q of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let K of q[1].split(",")){let U=K.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(U)Z.add(U)}let Y=new Set;for(let q of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(q[1]);for(let q of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let K of q[1].split(",")){let U=K.trim().split(/[:=]/).pop()?.trim();if(U)Y.add(U)}let J=_6.filter((q)=>{if(Z.has(q)||Y.has(q))return!1;return new RegExp(`\\b${q}\\s*\\(`).test($)}),G=O6($).filter((q)=>!Z.has(q)&&!Y.has(q));if(J.length===0&&G.length===0)return{code:X,imports:J,models:G};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
3624
+ `}function A5(X){let $=X1(X),Z=new Set;for(let q of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let K of q[1].split(",")){let U=K.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(U)Z.add(U)}let Y=new Set;for(let q of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(q[1]);for(let q of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let K of q[1].split(",")){let U=K.trim().split(/[:=]/).pop()?.trim();if(U)Y.add(U)}let J=R6.filter((q)=>{if(Z.has(q)||Y.has(q))return!1;return new RegExp(`\\b${q}\\s*\\(`).test($)}),G=N6($).filter((q)=>!Z.has(q)&&!Y.has(q));if(J.length===0&&G.length===0)return{code:X,imports:J,models:G};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
3617
3625
  `)}
3618
- ${X}`,imports:J,models:G}}function dU(X,$){let Z=X[$],Y=$+1;while(Y<X.length){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===Z)return Y+1;Y++}return X.length}function mU(X,$){let Z=$+1;while(Z<X.length){if(X[Z]==="\\"){Z+=2;continue}if(X[Z]==="`")return Z+1;if(X[Z]==="$"&&X[Z+1]==="{"){if(Z=H6(X,Z+2),Z<X.length)Z++;continue}Z++}return X.length}function H6(X,$){let Z=1,Y=$;while(Y<X.length){let J=X[Y];if(J==="\\"){Y+=2;continue}if(J==='"'||J==="'"){Y=dU(X,Y);continue}if(J==="`"){Y=mU(X,Y);continue}if(J==="/"&&X[Y+1]==="/"){while(Y<X.length&&X[Y]!==`
3619
- `)Y++;continue}if(J==="/"&&X[Y+1]==="*"){Y+=2;while(Y<X.length&&X.slice(Y,Y+2)!=="*/")Y++;Y+=2;continue}if(J==="{"){Z++,Y++;continue}if(J==="}"){if(Z--,Z===0)return Y;Y++;continue}Y++}return X.length}function _X(X){let $="",Z=0;while(Z<X.length){let Y=X.slice(Z,Z+2);if(Y==="//"){while(Z<X.length&&X[Z]!==`
3620
- `)$+=" ",Z++;continue}if(Y==="/*"){while(Z<X.length&&X.slice(Z,Z+2)!=="*/")$+=X[Z]===`
3621
- `?`
3622
- `:" ",Z++;$+=" ",Z+=2;continue}let J=X[Z];if(J==='"'||J==="'"){let G=J;$+=" ",Z++;while(Z<X.length&&X[Z]!==G){if(X[Z]==="\\"){$+=" ",Z+=2;continue}$+=X[Z]===`
3623
- `?`
3624
- `:" ",Z++}$+=" ",Z++;continue}if(J==="`"){$+=" ",Z++;while(Z<X.length&&X[Z]!=="`"){if(X[Z]==="\\"){$+=" ",Z+=2;continue}if(X[Z]==="$"&&X[Z+1]==="{"){let G=Z+2,Q=H6(X,G);if($+=" ",$+=_X(X.slice(G,Q)),Q<X.length)$+=" ";Z=Q+1;continue}$+=X[Z]===`
3625
- `?`
3626
- `:" ",Z++}$+=" ",Z++;continue}$+=J,Z++}return $}function O6(X){let $=new Set,Z=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=Z.exec(X))!==null)if(!uU.has(Y[1]))$.add(Y[1]);return Array.from($)}function lU(X){let $=new Set;for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Y of Z[1].split(",")){let J=Y.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))$.add(J)}return $}function L6(X){let $=new Set,Z=new Set,Y=X;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,G=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,Q;while((Q=G.exec(X))!==null){let U=Q[1],W=Q[2];if(Q[0].includes("import type"))continue;let w=[];for(let B of U.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let _=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let H=_[1],L=_[2]||H;if(J.add(H),J.add(L),W==="stx"||W==="@stacksjs/stx")$.add(H);else Z.add(H);if(L!==H)w.push(`${L} = ${H}`)}let z=w.length>0?`var ${w.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";Y=Y.replace(Q[0],z)}let q=lU(Y);for(let U of B6){if(J.has(U)||q.has(U))continue;if(new RegExp(`\\b${U}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(Y))$.add(U)}for(let U of _6){if(J.has(U)||q.has(U))continue;if(new RegExp(`\\b${U}\\b`,"g").test(Y))Z.add(U)}let K=O6(Y);for(let U of K)if(!J.has(U)&&!q.has(U))Z.add(U);return{code:Y,stxImports:Array.from($),browserImports:Array.from(Z)}}function p$(X,$){let Z=[];if(X.length>0)Z.push(` var { ${X.join(", ")} } = window.stx || window;`);if($.length>0)Z.push(` var { ${$.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
3626
+ ${X}`,imports:J,models:G}}function N6(X){let $=new Set,Z=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=Z.exec(X))!==null)if(!eU.has(Y[1]))$.add(Y[1]);return Array.from($)}function XW(X){let $=new Set;for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Y of Z[1].split(",")){let J=Y.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))$.add(J)}return $}function T6(X){let $=new Set,Z=new Set,Y=X;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,G=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,Q;while((Q=G.exec(X))!==null){let U=Q[1],W=Q[2];if(Q[0].includes("import type"))continue;let w=[];for(let B of U.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let _=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let H=_[1],L=_[2]||H;if(J.add(H),J.add(L),W==="stx"||W==="@stacksjs/stx")$.add(H);else Z.add(H);if(L!==H)w.push(`${L} = ${H}`)}let z=w.length>0?`var ${w.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";Y=Y.replace(Q[0],z)}let q=XW(Y);for(let U of A6){if(J.has(U)||q.has(U))continue;if(new RegExp(`\\b${U}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(Y))$.add(U)}for(let U of R6){if(J.has(U)||q.has(U))continue;if(new RegExp(`\\b${U}\\b`,"g").test(Y))Z.add(U)}let K=N6(Y);for(let U of K)if(!J.has(U)&&!q.has(U))Z.add(U);return{code:Y,stxImports:Array.from($),browserImports:Array.from(Z)}}function p$(X,$){let Z=[];if(X.length>0)Z.push(` var { ${X.join(", ")} } = window.stx || window;`);if($.length>0)Z.push(` var { ${$.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
3627
3627
  ${Z.join(`
3628
3628
  `)}
3629
- ${pU(X,$)}`;return""}function cU(X,$=[]){let{browserImports:Z}=L6(X),Y=new Set($);return p$([],Z.filter((J)=>!Y.has(J)))}function pU(X,$){let Z=[...X.map((Y)=>`['${Y}', typeof ${Y}, 'stx']`),...$.map((Y)=>`['${Y}', typeof ${Y}, '@stacksjs/browser']`)];if(Z.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
3629
+ ${ZW(X,$)}`;return""}function $W(X,$=[]){let{browserImports:Z}=T6(X),Y=new Set($);return p$([],Z.filter((J)=>!Y.has(J)))}function ZW(X,$){let Z=[...X.map((Y)=>`['${Y}', typeof ${Y}, 'stx']`),...$.map((Y)=>`['${Y}', typeof ${Y}, '@stacksjs/browser']`)];if(Z.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
3630
3630
  [${Z.join(", ")}].forEach(function (e) {
3631
3631
  if (e[1] !== 'undefined') return;
3632
3632
  console.error(
@@ -3635,10 +3635,10 @@ ${pU(X,$)}`;return""}function cU(X,$=[]){let{browserImports:Z}=L6(X),Y=new Set($
3635
3635
  + 'or it should be imported from a relative path so the bundler includes it.'
3636
3636
  );
3637
3637
  });
3638
- `}function H7(X){let $=X.__stxClientPayload;if($&&typeof $==="object"){let Y={};for(let J in $){let G=$[J];if(typeof G==="function")continue;Y[J]=G}return Y.__stxDeclaredPayload=!0,Y}let Z={};for(let Y in X){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=X[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function w6(X,$){let Z=new Set;for(let Y of X.split(",")){let J=Y.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if($){let G=J.lastIndexOf(":");if(G!==-1)J=J.slice(G+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function iU(X,$){if(new RegExp(`(?:const|let|var|function|class)\\s+${$}\\b`).test(X))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(w6(Z[1],!0).has($))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(w6(Z[1],!1).has($))return!0;return!1}function nU(X,$){return new RegExp(`(?<![.#\\w$])${$}(?![\\w$])`).test(X)}function oU(X,$){let Z=rU.test(X),Y=$.length>32768;if(!Z&&!Y)return;if(z6.has(X))return;if(z6.add(X),Z)console.warn(`[stx] server\u2192client bridge is publishing "${X}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(Y)console.warn(`[stx] server\u2192client bridge is publishing ${($.length/1024).toFixed(1)}KB under "${X}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function HX(X,$){if(!$)return"";let Z=_X(X),Y=$.__stxDeclaredPayload===!0,J=[];for(let[G,Q]of Object.entries($)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!Y&&!nU(Z,G))continue;if(iU(X,G))continue;let q;try{q=JSON.stringify(Q)}catch{continue}if(q===void 0)continue;oU(G,q),J.push(` var ${G} = ${q.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
3638
+ `}function O7(X){let $=X.__stxClientPayload;if($&&typeof $==="object"){let Y={};for(let J in $){let G=$[J];if(typeof G==="function")continue;Y[J]=G}return Y.__stxDeclaredPayload=!0,Y}let Z={};for(let Y in X){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=X[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function L6(X,$){let Z=new Set;for(let Y of X.split(",")){let J=Y.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if($){let G=J.lastIndexOf(":");if(G!==-1)J=J.slice(G+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function YW(X,$){if(new RegExp(`(?:const|let|var|function|class)\\s+${$}\\b`).test(X))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(L6(Z[1],!0).has($))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(L6(Z[1],!1).has($))return!0;return!1}function JW(X,$){return new RegExp(`(?<![.#\\w$])${$}(?![\\w$])`).test(X)}function QW(X,$){let Z=GW.test(X),Y=$.length>32768;if(!Z&&!Y)return;if(F6.has(X))return;if(F6.add(X),Z)console.warn(`[stx] server\u2192client bridge is publishing "${X}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(Y)console.warn(`[stx] server\u2192client bridge is publishing ${($.length/1024).toFixed(1)}KB under "${X}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function OX(X,$){if(!$)return"";let Z=X1(X),Y=$.__stxDeclaredPayload===!0,J=[];for(let[G,Q]of Object.entries($)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!Y&&!JW(Z,G))continue;if(YW(X,G))continue;let q;try{q=JSON.stringify(Q)}catch{continue}if(q===void 0)continue;QW(G,q),J.push(` var ${G} = ${q.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
3639
3639
  ${J.join(`
3640
3640
  `)}
3641
- `}function aU(X){let $=[];if(X.self)$.push("if ($event.target !== $el) return");for(let Z of X.systemKeys)$.push(`if (!$event.${Z}Key) return`);if(X.keys.length>0){let Z=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");$.push(`if (!(${Z})) return`)}if(X.mouse!==null){let Z=sU[X.mouse];$.push(`if ($event.button !== ${Z}) return`)}if(X.prevent)$.push("$event.preventDefault()");if(X.stop)$.push("$event.stopPropagation()");return $.join("; ")}function tU(X,$){let{elementId:Z,event:Y,modifiers:J}=X,G=f$(X.handler),Q=aU(J),q=[];if(J.once)q.push("once: true");if(J.capture)q.push("capture: true");if(J.passive)q.push("passive: true");let K=q.length>0?`, { ${q.join(", ")} }`:"",U="";if(Q)U+=`${Q}; `;let W=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),w=`var $emit = function(name, detail) {
3641
+ `}function KW(X){let $=[];if(X.self)$.push("if ($event.target !== $el) return");for(let Z of X.systemKeys)$.push(`if (!$event.${Z}Key) return`);if(X.keys.length>0){let Z=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");$.push(`if (!(${Z})) return`)}if(X.mouse!==null){let Z=qW[X.mouse];$.push(`if ($event.button !== ${Z}) return`)}if(X.prevent)$.push("$event.preventDefault()");if(X.stop)$.push("$event.stopPropagation()");return $.join("; ")}function UW(X,$){let{elementId:Z,event:Y,modifiers:J}=X,G=f$(X.handler),Q=KW(J),q=[];if(J.once)q.push("once: true");if(J.capture)q.push("capture: true");if(J.passive)q.push("passive: true");let K=q.length>0?`, { ${q.join(", ")} }`:"",U="";if(Q)U+=`${Q}; `;let W=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),w=`var $emit = function(name, detail) {
3642
3642
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
3643
3643
  };`;function z(B){if(/\$emit\s*\(/.test(B))return`${w}
3644
3644
  ${B}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -3681,25 +3681,25 @@ else {
3681
3681
  else {
3682
3682
  ${G}
3683
3683
  }
3684
- }${K})`}function eU(X){if(X.length===0)return"";return`
3684
+ }${K})`}function WW(X){if(X.length===0)return"";return`
3685
3685
  // STX: auto-generated event bindings
3686
- ${X.map((Z,Y)=>tU(Z,Y)).join(`
3687
- `)}`}function j6(X){let $=[],Z=new Set,Y=X.replace(/^\s*import\s+.*$/gm,""),J=0,G=Y.length,Q=0;while(Q<G){let q=Y[Q];if(q==="'"||q==='"'||q==="`"){let K=q;if(Q++,K==="`"){let U=0;while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]==="`"&&U===0){Q++;break}if(Y[Q]==="$"&&Y[Q+1]==="{"){U++,Q+=2;continue}if(Y[Q]==="}"&&U>0){U--,Q++;continue}Q++}}else while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]===K){Q++;break}Q++}continue}if(q==="/"&&Y[Q+1]==="/"){while(Q<G&&Y[Q]!==`
3688
- `)Q++;continue}if(q==="/"&&Y[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Y[Q]==="*"&&Y[Q+1]==="/"))Q++;Q+=2;continue}if(q==="{"){J++,Q++;continue}if(q==="}"){J--,Q++;continue}if(J===0){let K=Y.slice(Q),U=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(U){let z=U[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=U[0].length;continue}let W=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((z)=>{let B=z.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Z.has(_))$.push(_),Z.add(_)}),Q+=W[0].length;continue}let w=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(w){let z=w[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=w[0].length;continue}}Q++}return $}function $W(X){let $=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(z){let B;while((B=Z.exec(z))!==null){let j=B[0];if(!XW.has(j))$.add(j)}}let J=/\{\{([\s\S]*?)\}\}/g,G;while((G=J.exec(X))!==null)Y(G[1]);let Q=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((G=Q.exec(X))!==null)Y(G[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((G=q.exec(X))!==null)Y(G[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=K.exec(X))!==null)Y(G[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=U.exec(X))!==null)Y(G[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((G=W.exec(X))!==null)Y(G[1]);let w=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((G=w.exec(X))!==null)Y(G[1]);return $}async function O7(X,$={}){let Z=X,Y="",J=!1,G=[],Q=jX(Z,{filePath:$.filePath,projectRoot:$.projectRoot});Z=Q.code;let q=BX(Q.styles),K=V5(Z);Z=K.code,G=[...K.imports,...K.models];let{hasUserImports:U,bundleClientScript:W}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (j7(),z7)));if(U(Z))Z=await W(Z,$.filePath||"",{projectRoot:$.projectRoot,minify:$.production}),J=!0;if($.autoImports!==!1){let O=L6(Z);Z=O.code,Y=p$(O.stxImports,O.browserImports.filter((F)=>!G.includes(F)))}if(Y=`${HX(Z,$.serverData)}${Y}`,Z=f0(Z),!J&&d1($.attrs||""))Z=m1(Z);let w=eU($.eventBindings||[]),z=($.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(z)){let O=z.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${q}<script ${F}>
3689
- ${F5(`${Y}${Z}
3686
+ ${X.map((Z,Y)=>UW(Z,Y)).join(`
3687
+ `)}`}function V6(X){let $=[],Z=new Set,Y=X.replace(/^\s*import\s+.*$/gm,""),J=0,G=Y.length,Q=0;while(Q<G){let q=Y[Q];if(q==="'"||q==='"'||q==="`"){let K=q;if(Q++,K==="`"){let U=0;while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]==="`"&&U===0){Q++;break}if(Y[Q]==="$"&&Y[Q+1]==="{"){U++,Q+=2;continue}if(Y[Q]==="}"&&U>0){U--,Q++;continue}Q++}}else while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]===K){Q++;break}Q++}continue}if(q==="/"&&Y[Q+1]==="/"){while(Q<G&&Y[Q]!==`
3688
+ `)Q++;continue}if(q==="/"&&Y[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Y[Q]==="*"&&Y[Q+1]==="/"))Q++;Q+=2;continue}if(q==="{"){J++,Q++;continue}if(q==="}"){J--,Q++;continue}if(J===0){let K=Y.slice(Q),U=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(U){let z=U[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=U[0].length;continue}let W=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((z)=>{let B=z.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Z.has(_))$.push(_),Z.add(_)}),Q+=W[0].length;continue}let w=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(w){let z=w[1];if(!z.startsWith("_")&&!Z.has(z))$.push(z),Z.add(z);Q+=w[0].length;continue}}Q++}return $}function zW(X){let $=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(z){let B;while((B=Z.exec(z))!==null){let j=B[0];if(!wW.has(j))$.add(j)}}let J=/\{\{([\s\S]*?)\}\}/g,G;while((G=J.exec(X))!==null)Y(G[1]);let Q=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((G=Q.exec(X))!==null)Y(G[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((G=q.exec(X))!==null)Y(G[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=K.exec(X))!==null)Y(G[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=U.exec(X))!==null)Y(G[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((G=W.exec(X))!==null)Y(G[1]);let w=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((G=w.exec(X))!==null)Y(G[1]);return $}async function L7(X,$={}){let Z=X,Y="",J=!1,G=[],Q=_X(Z,{filePath:$.filePath,projectRoot:$.projectRoot});Z=Q.code;let q=HX(Q.styles),K=A5(Z);Z=K.code,G=[...K.imports,...K.models];let{hasUserImports:U,bundleClientScript:W}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (B7(),j7)));if(U(Z))Z=await W(Z,$.filePath||"",{projectRoot:$.projectRoot,minify:$.production}),J=!0;if($.autoImports!==!1){let O=T6(Z);Z=O.code,Y=p$(O.stxImports,O.browserImports.filter((F)=>!G.includes(F)))}if(Y=`${OX(Z,$.serverData)}${Y}`,Z=f0(Z),!J&&d1($.attrs||""))Z=m1(Z);let w=WW($.eventBindings||[]),z=($.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(z)){let O=z.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${q}<script ${F}>
3689
+ ${V5(`${Y}${Z}
3690
3690
  ${w}`)}
3691
3691
  </script>`}let j=v$(X),_=/function __stx_setup_/.test(Z),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(X);function L(O){let F=O.length>0?`
3692
3692
  return { ${O.join(", ")} };`:"";return`${q}<script data-stx-scoped data-stx-run="always">
3693
3693
  window.stx.mount(function() {
3694
3694
  'use strict';
3695
- ${F5(`${Y}${Z}
3695
+ ${V5(`${Y}${Z}
3696
3696
  ${w}${F}`)}
3697
- })</script>`}if(!H&&!_){if(j)return L(j6(X));if($.templateContent){let O=j6(X);if(O.length>0){let F=$W($.templateContent);if(O.some((A)=>F.has(A)))return L(O)}}}return`${q}<script data-stx-scoped data-stx-run="always">
3697
+ })</script>`}if(!H&&!_){if(j)return L(V6(X));if($.templateContent){let O=V6(X);if(O.length>0){let F=zW($.templateContent);if(O.some((A)=>F.has(A)))return L(O)}}}return`${q}<script data-stx-scoped data-stx-run="always">
3698
3698
  ;(function() {
3699
3699
  'use strict';
3700
- ${F5(`${Y}${Z}
3700
+ ${V5(`${Y}${Z}
3701
3701
  ${w}`)}
3702
- })()</script>`}var PU,B6,_6,uU,rU,z6,sU,XW;var L7=D(()=>{h$();A0();w7();X1();u$();PU=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;B6=U1,_6=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];uU=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);rU=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,z6=new Set;sU={left:0,middle:1,right:2};XW=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});import{createHash as ZW}from"crypto";function V6(X){let $=X[OX];return $ instanceof Map?$:null}function A6(X){X[OX]=new Map}function R6(X,$){let Z=V6(X);if(!Z)return null;let Y=ZW("sha256").update($).digest("hex").slice(0,16),J=Z.get(Y);if(J)J.instances++;else Z.set(Y,{body:$,instances:1});return Y}function T6(X,$){let Z=V6($);if(!Z?.size)return X;let Y=X;for(let[K,U]of Z){if(U.instances!==1)continue;let W=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(K)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(W,(w,z)=>`(${U.body})(${z});`)}let J=[...Z].filter(([,K])=>K.instances>1);if(J.length===0)return Y;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
3702
+ })()</script>`}var nU,A6,R6,eU,GW,F6,qW,wW;var F7=E(()=>{h$();A0();z7();e0();u$();nU=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;A6=U1,R6=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];eU=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process","Modal","Intl"]);GW=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,F6=new Set;qW={left:0,middle:1,right:2};wW=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});import{createHash as jW}from"crypto";function k6(X){let $=X[LX];return $ instanceof Map?$:null}function I6(X){X[LX]=new Map}function E6(X,$){let Z=k6(X);if(!Z)return null;let Y=jW("sha256").update($).digest("hex").slice(0,16),J=Z.get(Y);if(J)J.instances++;else Z.set(Y,{body:$,instances:1});return Y}function D6(X,$){let Z=k6($);if(!Z?.size)return X;let Y=X;for(let[K,U]of Z){if(U.instances!==1)continue;let W=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(K)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(W,(w,z)=>`(${U.body})(${z});`)}let J=[...Z].filter(([,K])=>K.instances>1);if(J.length===0)return Y;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
3703
3703
  (function() {
3704
3704
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
3705
3705
  ${J.map(([K,U])=>` try { factories[${JSON.stringify(K)}] = factories[${JSON.stringify(K)}] || ${U.body}; }
@@ -3708,7 +3708,7 @@ ${J.map(([K,U])=>` try { factories[${JSON.stringify(K)}] = factories[${JSON.str
3708
3708
  })();
3709
3709
  </script>`,q=Y.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(q<0)return`${Q}
3710
3710
  ${Y}`;return`${Y.slice(0,q)}${Q}
3711
- ${Y.slice(q)}`}var OX="__stx_component_client_factories";var i$=()=>{};function QW(X){let $="",Z=null,Y=!1;for(let J=0;J<X.length;J++){let G=X[J];if(Y){Y=!1;continue}if(G==="\\"&&Z){Y=!0;continue}if(Z){if(Z==="`"&&G==="$"&&J+1<X.length&&X[J+1]==="{"){let Q=1;J+=2;while(J<X.length&&Q>0){if(X[J]==="{")Q++;else if(X[J]==="}")Q--;if(Q>0)$+=X[J],J++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}$+=G}return $}function qW(X,$){let Z=/[$A-Z_a-z][$\w]*/g,Y;while((Y=Z.exec(X))!==null){let J=Y[0],G=X[Y.index-1];if(JW.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${$}`);if(G==="."&&I6.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${$}`)}}function KW(X){let $=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=$.exec(X))!==null){let Y=Z[2];if(!I6.has(Y))continue;let J=X.slice(0,Z.index).match(/\S(?=\s*$)/)?.[0],G=X.slice(Z.index+Z[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&G===":"))throw Error(`Potentially unsafe expression (bracket key ${Z[2]}): ${X}`)}}function LX(X){let $=X.trim(),Z=QW($);qW(Z,$),KW($);for(let Y of k6)if(Y.test(Z))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${$}`);if(!M6.allowBracketNotation&&GW.test($))throw Error(`Bracket notation with strings not allowed: ${$}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return $}function UW(X){let $={};$.Math=Math,$.JSON=JSON,$.Date=Date,$.String=String,$.Number=Number,$.Boolean=Boolean,$.Array=Array,$.parseInt=Number.parseInt,$.parseFloat=Number.parseFloat,$.isNaN=Number.isNaN,$.isFinite=Number.isFinite,$.encodeURIComponent=encodeURIComponent,$.decodeURIComponent=decodeURIComponent;for(let[Z,Y]of Object.entries(X)){if(Z.startsWith("__")||k6.some((J)=>J.test(Z)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))$[Z]=n$(Y);else $[Z]=Y}return $}function n$(X,$=0){if($>=M6.maxSanitizeDepth)return"[Object too deep]";if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Y)=>n$(Y,$+1));if(X instanceof Date||X instanceof RegExp||X instanceof Map||X instanceof Set||X instanceof Error)return X;let Z={};for(let[Y,J]of Object.entries(X)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(J&&typeof J==="object")Z[Y]=n$(J,$+1);else Z[Y]=J}return Z}function $0(X,$){try{let Z=UW($),Y=Object.keys(Z),J=Object.values(Z);return Q0(X,Y)(...J)}catch{return}}function G0(X){try{return LX(X),!0}catch{return!1}}function H0(X,$){try{let Z=$0(X,$);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function Q0(X,$){let Z=LX(X),Y=/^[A-Za-z_$][\w$]*$/,J=[],G=[];for(let U=0;U<$.length;U++){let W=$[U];if(!Y.test(W))continue;if(E6.has(W))continue;J.push(U),G.push(W)}let Q=(U)=>Function(...G,...U,`
3711
+ ${Y.slice(q)}`}var LX="__stx_component_client_factories";var i$=()=>{};function OW(X){let $="",Z=null,Y=!1;for(let J=0;J<X.length;J++){let G=X[J];if(Y){Y=!1;continue}if(G==="\\"&&Z){Y=!0;continue}if(Z){if(Z==="`"&&G==="$"&&J+1<X.length&&X[J+1]==="{"){let Q=1;J+=2;while(J<X.length&&Q>0){if(X[J]==="{")Q++;else if(X[J]==="}")Q--;if(Q>0)$+=X[J],J++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}$+=G}return $}function LW(X,$){let Z=/[$A-Z_a-z][$\w]*/g,Y;while((Y=Z.exec(X))!==null){let J=Y[0],G=X[Y.index-1];if(_W.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${$}`);if(G==="."&&C6.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${$}`)}}function FW(X){let $=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=$.exec(X))!==null){let Y=Z[2];if(!C6.has(Y))continue;let J=X.slice(0,Z.index).match(/\S(?=\s*$)/)?.[0],G=X.slice(Z.index+Z[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&G===":"))throw Error(`Potentially unsafe expression (bracket key ${Z[2]}): ${X}`)}}function FX(X){let $=X.trim(),Z=OW($);LW(Z,$),FW($);for(let Y of S6)if(Y.test(Z))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${$}`);if(!b6.allowBracketNotation&&HW.test($))throw Error(`Bracket notation with strings not allowed: ${$}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return $}function VW(X){let $={};$.Math=Math,$.JSON=JSON,$.Date=Date,$.String=String,$.Number=Number,$.Boolean=Boolean,$.Array=Array,$.parseInt=Number.parseInt,$.parseFloat=Number.parseFloat,$.isNaN=Number.isNaN,$.isFinite=Number.isFinite,$.encodeURIComponent=encodeURIComponent,$.decodeURIComponent=decodeURIComponent;for(let[Z,Y]of Object.entries(X)){if(Z.startsWith("__")||S6.some((J)=>J.test(Z)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))$[Z]=n$(Y);else $[Z]=Y}return $}function n$(X,$=0){if($>=b6.maxSanitizeDepth)return"[Object too deep]";if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Y)=>n$(Y,$+1));if(X instanceof Date||X instanceof RegExp||X instanceof Map||X instanceof Set||X instanceof Error)return X;let Z={};for(let[Y,J]of Object.entries(X)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(J&&typeof J==="object")Z[Y]=n$(J,$+1);else Z[Y]=J}return Z}function $0(X,$){try{let Z=VW($),Y=Object.keys(Z),J=Object.values(Z);return Q0(X,Y)(...J)}catch{return}}function G0(X){try{return FX(X),!0}catch{return!1}}function H0(X,$){try{let Z=$0(X,$);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function Q0(X,$){let Z=FX(X),Y=/^[A-Za-z_$][\w$]*$/,J=[],G=[];for(let U=0;U<$.length;U++){let W=$[U];if(!Y.test(W))continue;if(P6.has(W))continue;J.push(U),G.push(W)}let Q=(U)=>Function(...G,...U,`
3712
3712
  'use strict';
3713
3713
  try {
3714
3714
  return ${Z};
@@ -3719,7 +3719,7 @@ catch (e) {
3719
3719
  }
3720
3720
  throw e;
3721
3721
  }
3722
- `),q=Q([]);if(G.length===$.length)return N6(q,G,Q);return N6((...U)=>{let W=Array(J.length);for(let w=0;w<J.length;w++)W[w]=U[J[w]];return q(...W)},G,Q,(U)=>{q=Q(U)})}function N6(X,$,Z,Y){let G=/^(\w+) is not defined$/,Q=X,q=[],K=new Set($);return(...U)=>{for(let W=0;W<=8;W++)try{return Q(...U)}catch(w){let z=w instanceof Error?w.message:"",B=G.exec(z);if(!(w instanceof ReferenceError)||!B)return;let j=B[1];if(K.has(j)||E6.has(j))return;K.add(j),q.push(j),Q=Z(q),Y?.(q)}return}}function FX(X){let $=X.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of Z)if(Y.test($))return!1;return!0}var YW,M6,k6,JW,I6,GW,E6;var O0=D(()=>{YW={maxSanitizeDepth:10,allowBracketNotation:!1},M6={...YW},k6=[/\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/],JW=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"]),I6=new Set(["__proto__","constructor","prototype"]),GW=/[\w)\]]\s*\[\s*['"]/;E6=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 VX(X,$){let Z=WW++,Y=`<!--__STX_${X.toUpperCase()}_${Z}__-->`;return wW.set(Y,{type:X,expression:$}),Y}var WW=0,wW;var D6=D(()=>{wW=new Map});function P6(X,$,Z,Y){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);if(!G)return-1;return G.index+G[0].length}function A1(X,$){return P6(X,$,y6,b6)}function A5(X,$){return P6(X,$,S6,C6)}function F7(X,$){if(!X.startsWith("<!--",$))return-1;let Z=X.indexOf("-->",$+4);if(Z===-1)return-1;return Z+3}function zW(X,$){if(X.startsWith("<!--",$)){let Z=F7(X,$);return Z===-1?X.length:Z}for(let[Z,Y]of[[y6,b6],[S6,C6]]){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);return G?G.index+G[0].length:X.length}return-1}function r$(X,$){let Z=[],Y=0,J=X.length,G=!1,Q=null;while(Y<J){let q=X[Y];if(G){if(Q){if(q===Q)Q=null}else if(q==='"'||q==="'")Q=q;else if(q===">")G=!1;Y++;continue}if(q!=="<"){Y++;continue}let K=$(X,Y);if(K>Y){Z.push({start:Y,end:K,token:X.slice(Y,K)}),Y=K;continue}let U=zW(X,Y);if(U>Y){Y=U;continue}if(/^<\/?[a-zA-Z]/.test(X.slice(Y,Y+2)))G=!0;Y++}return Z}function $1(X,$,Z){let Y=r$(X,$);if(Y.length===0)return{output:X,tokens:[]};let J=Y.map((q)=>q.token),G="",Q=0;for(let q=0;q<Y.length;q++){let K=Y[q];G+=X.slice(Q,K.start),G+=Z(K.token,q),Q=K.end}return G+=X.slice(Q),{output:G,tokens:J}}function R1(X){let{output:$,tokens:Z}=$1(X,A1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:$,scripts:Z}}function V7(X,$){if($.length===0)return X;return X.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>$[+Y]??"")}var y6,b6,S6,C6;var l1=D(()=>{y6=/<script\b[^>]*>/iy,b6=/<\/script\s*>/ig,S6=/<style\b[^>]*>/iy,C6=/<\/style\s*>/ig});var d6={};n(d6,{usesSignalsInScript:()=>W1,unescapeHtml:()=>VW,registerFilters:()=>BW,registerFilter:()=>f6,processExpressions:()=>T1,interpolateScriptsInTemplate:()=>HW,interpolateScriptExpressions:()=>AX,interpolateScriptAttributes:()=>h6,getAllFilters:()=>g6,evaluateExpression:()=>P0,escapeHtml:()=>o0,defaultFilters:()=>R7,clearCustomFilters:()=>_W,applyFilters:()=>u6});function jW(X){let $=v6.get(X);if(!$){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");$=new RegExp(`:${Z}(?!\\w)`,"g"),v6.set(X,$)}return $.lastIndex=0,$}function f6(X,$){if(X in R7)console.warn(`Filter "${X}" already exists as a built-in filter. Custom filter will take precedence.`);A7[X]=$}function BW(X){for(let[$,Z]of Object.entries(X))f6($,Z)}function g6(){return{...R7,...A7}}function _W(){for(let X of Object.keys(A7))delete A7[X]}function o0(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function W1(X){let{scripts:$}=R1(X);for(let Z of $){let Y=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let J=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(X))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(X))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(X))return!0;return!1}function x6(X,$){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=X.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let U=0;U<Y.length;U++){let W=Y[U];if(!G&&W==="`"){G=!0,Q=0;continue}if(G){if(W==="`"&&Q===0){G=!1;continue}if(W==="$"&&Y[U+1]==="{"){Q++,U++,J+=" ";continue}if(W==="}"&&Q>0){Q--;continue}if(Q>0){J+=W;continue}continue}J+=W}Y=J;let q=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,K;while((K=q.exec(Y))!==null){let U=K[1];if(!Y.substring(0,K.index).trimEnd().endsWith(".")){if(!Z.includes(U)&&!(U in $))return!1}}return!0}function AX(X,$){let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=P0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=P0(J,$);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function h6(X,$){if(!X.includes("{"))return X;let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=P0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=P0(J,$);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return Y}}),Z}function HW(X,$,Z={}){let{output:Y,scripts:J}=R1(X),G=J.map((Q)=>{let q=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),K=Q.match(/^<script\b[^>]*>/i),U=Q.search(/<\/script\s*>$/i);if(!q||!K||U===-1)return Q;let W=q[1],w=q[2];if(/\bdata-raw\b/.test(W))return Q;if(Z.skipServer&&/\bserver\b/.test(W))return Q;let B=`<script${h6(W,$)}>`;if(/\bsrc\s*=/.test(W)||/\btype\s*=\s*["']application\/json["']/.test(W))return B+w+Q.slice(U);return B+AX(w,$)+Q.slice(U)});return V7(Y,G)}function T1(X,$,Z){let Y=X,J=(w,z)=>{let B=A5(w,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(w.slice(z,B))?-1:B},G=(w,z,B,j)=>{let _=B.length,{output:H,tokens:L}=$1(w,z,(O,F)=>j(_+F));return B.push(...L),H},Q=[];Y=G(Y,J,Q,(w)=>`<!--__STX_STYLE_${w}__-->`);let q=[];Y=G(Y,A1,q,(w)=>`<!--__STX_SCRIPT_EXPR_${w}__-->`);let K=$?.__stx_signals_gate===!0||W1(X),U=new Set(Array.isArray($?.__stx_client_signal_names)?$.__stx_client_signal_names:[]),W=new Set(Array.isArray($?.__stx_preserved_client_expressions)?$.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(w,z,B)=>{try{let j=P0(z,$);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return U0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${_}`,Z,X,B,w)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(w,z,B)=>{try{let j=P0(z,$);if(j===void 0&&$.__stx_buildMode==="compile")return VX("raw",z.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if($.__stx_buildMode==="compile")return VX("raw",z.trim());let _=j instanceof Error?j.message:String(j);return U0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${_}`,Z,X,B,w)}}),Y=G(Y,A1,q,(w)=>`<!--__STX_SCRIPT_EXPR_${w}__-->`),Y=G(Y,J,Q,(w)=>`<!--__STX_STYLE_${w}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(w,z,B)=>{let j=z.trim();if(W.has(j))return w;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,O=j.match(H)?.[1],F=O&&((O in $)||_.includes(O)),V=Boolean(O&&U.has(O)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=j.match(A),T=R&&!_.includes(R[1])&&!(R[1]in $);if(/^__[A-Z_]+__$/.test(j))return"";try{let N=P0(z,$);if(V)return w;if(K&&!x6(j,$))return w;if(N===void 0&&$.__stx_buildMode==="compile"&&!K)return VX("expr",j);return N!==void 0&&N!==null?o0(String(N)):""}catch(N){if(V)return w;if(K&&!x6(j,$))return w;if(T)return w;let k=N instanceof Error?N.message:String(N);return U0("Expression",`Error evaluating: {{ ${j} }}: ${k}`,Z,X,B,w)}});for(let w=0;w<q.length;w++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${w}__-->`,()=>q[w]);for(let w=0;w<Q.length;w++)Y=Y.replace(`<!--__STX_STYLE_${w}__-->`,()=>Q[w]);return Y}function u6(X,$,Z){if(!$.trim())return X;let Y=X,J=$.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let q=A7[Q]||R7[Q];if(!q)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(g6()).join(", ")}`);let K=[];if(J.startsWith(":")){let U=J.match(/^:([^|\s]+)/);if(U){let W=U[1].trim();try{let w=Number(W);K=[Number.isNaN(w)?W:w]}catch{K=[W]}J=J.substring(U[0].length).trim()}}else if(J.startsWith("(")){let U=1,W=1;while(U>0&&W<J.length){if(J[W]==="(")U++;if(J[W]===")")U--;W++}if(U===0){let w=J.substring(1,W-1).trim();if(w)try{if(w.startsWith("{")&&w.endsWith("}"))K=[P0(`(${w})`,Z,!0)];else{let z=[],B="",j=null,_=0,H=0,L=0,O=!1;for(let F=0;F<w.length;F++){let V=w[F];if(O){B+=V,O=!1;continue}if(V==="\\"){B+=V,O=!0;continue}if(j){if(B+=V,V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V,B+=V;continue}if(V==="(")_++;else if(V===")")_--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")L++;else if(V==="}")L--;if(V===","&&_===0&&H===0&&L===0){z.push(B),B="";continue}B+=V}if(B)z.push(B);K=z.map((F)=>{let V=F.trim();return P0(V,Z,!0)})}}catch{K=[w]}J=J.substring(W).trim()}}try{Y=q(Y,Z,...K)}catch(U){let W=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${Q}': ${W}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function OW(X){let $=!1,Z="",Y=0,J=0,G=0,Q=!1;for(let q=0;q<X.length;q++){let K=X[q],U=X[q+1];if($&&Q){Q=!1;continue}if($&&K==="\\"){Q=!0;continue}if(Q=!1,(K==='"'||K==="'"||K==="`")&&!Q){if(!$)$=!0,Z=K;else if(K===Z)$=!1,Z="";continue}if($&&Z==="`"&&K==="$"&&U==="{"){let W=1;q+=2;while(q<X.length&&W>0){if(X[q]==="{")W++;else if(X[q]==="}")W--;if(W>0)q++}continue}if($)continue;if(K==="(")Y++;else if(K===")")Y--;else if(K==="[")J++;else if(K==="]")J--;else if(K==="{")G++;else if(K==="}")G--;if(K==="|"&&Y===0&&J===0&&G===0){if(U==="|"){q++;continue}if(U==="="){q++;continue}return q}}return-1}function P0(X,$,Z=!1){try{let Y=X.trim(),J=OW(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),q=P0(G,$,!0);return u6(q,Q,$)}if(!G0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return $0(Y,$)}try{let G=Object.keys($),Q=Object.values($);return Q0(Y,G)(...Q)}catch{return $0(Y,$)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=LW(G,Object.keys($));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${X}`,Y);throw Y}}function LW(X,$){let Z=null;for(let J of $){if(J===X)continue;let G=FW(X,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max(X.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function FW(X,$){if(X===$)return 0;if(X.length===0)return $.length;if($.length===0)return X.length;let[Z,Y]=X.length<$.length?[X,$]:[$,X],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let q=1;q<=Z.length;q++){let K=Z[q-1]===Y[Q-1]?0:1;G[q]=Math.min(G[q-1]+1,J[q]+1,J[q-1]+K)}for(let q=0;q<=Z.length;q++)J[q]=G[q]}return J[Z.length]}function VW(X){if(!X)return"";return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var A7,v6,R7;var Z1=D(()=>{O0();A0();D6();l1();A7={},v6=new Map;R7={uppercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toUpperCase():""},lowercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toLowerCase():""},capitalize:(X,$)=>{if(X===void 0||X===null)return"";let Z=String(X);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:(X,$,Z=0)=>{if(X===void 0||X===null)return"";try{let Y=Number(X);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:(X,$,Z="en-US")=>{if(X===void 0||X===null)return"";try{let Y=Number(X);if(Number.isNaN(Y))return String(X);return Y.toLocaleString(Z)}catch{return String(X)}},join:(X,$,Z=",")=>{if(!Array.isArray(X))return"";return X.join(String(Z))},escape:(X,$)=>{if(X===void 0||X===null)return"";return o0(String(X))},translate:(X,$,Z={})=>{if(!$||!$.__translations)return X;let Y=$.__translations,J=$.__i18nConfig?.fallbackToKey??!0,G=String(X).split("."),Q=Y;for(let K of G){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return J?X:"";let q=String(Q);return Object.entries(Z).forEach(([K,U])=>{q=q.replace(jW(K),String(U))}),q},t:(X,$,Z={})=>{return R7.translate(X,$,Z)},truncate:(X,$,Z=50,Y="...")=>{if(X===void 0||X===null)return"";let J=String(X);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:(X,$,Z="short",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=X instanceof Date?X:new Date(X);if(Number.isNaN(J.getTime()))return String(X);let G={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Z==="iso")return J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String(X)}},currency:(X,$,Z="USD",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=Number(X);if(Number.isNaN(J))return String(X);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String(X)}},pluralize:(X,$,Z,Y)=>{let J=Number(X);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===1?Z:G},first:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[0];return String(X).charAt(0)},last:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[X.length-1];let Z=String(X);return Z.charAt(Z.length-1)},length:(X,$)=>{if(X===void 0||X===null)return 0;if(Array.isArray(X)||typeof X==="string")return X.length;if(X instanceof Map||X instanceof Set)return X.size;if(typeof X==="object")return Object.keys(X).length;return 0},json:(X,$,Z=!1)=>{if(X===void 0)return"undefined";if(X===null)return"null";try{return Z?JSON.stringify(X,null,2):JSON.stringify(X)}catch{return String(X)}},default:(X,$,Z="")=>{return X===void 0||X===null||X===""?Z:X},reverse:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return[...X].reverse();return String(X).split("").reverse().join("")},slice:(X,$,Z=0,Y)=>{if(X===void 0||X===null)return"";if(Array.isArray(X)||typeof X==="string")return X.slice(Z,Y);return X},replace:(X,$,Z,Y="")=>{if(X===void 0||X===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(X).replace(new RegExp(J,"g"),()=>Y)},stripTags:(X,$)=>{if(X===void 0||X===null)return"";return String(X).replace(/<[^>]*>/g,"")},urlencode:(X,$)=>{if(X===void 0||X===null)return"";return encodeURIComponent(String(X))},abs:(X,$)=>{let Z=Number(X);return Number.isNaN(Z)?0:Math.abs(Z)},round:(X,$,Z=0)=>{let Y=Number(X);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class c1{cache=new Map;maxSize;constructor(X=100){this.maxSize=X}get(X){if(!this.cache.has(X))return;let $=this.cache.get(X);return this.cache.delete(X),this.cache.set(X,$),$}set(X,$){if(this.cache.has(X))this.cache.delete(X);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set(X,$)}has(X){return this.cache.has(X)}delete(X){return this.cache.delete(X)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function T5(X,$){if($?.includes("g"))return new RegExp(X,$);let Z=`${X}:${$||""}`;if(!R5.has(Z)){if(R5.size>=AW){let Y=R5.keys().next().value;if(Y)R5.delete(Y)}R5.set(Z,new RegExp(X,$))}return R5.get(Z)}class m6{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(X){let $=Array.from(new Set(X)),Z=$.sort().join(","),Y=this.pool.find((q)=>q.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...q)=>{return(K)=>{try{let U=`${Z}:${K}`,W=J.get(U);if(!W){if(J.size>=G){let w=J.keys().next().value;if(w)J.delete(w)}W=Function(...$,`
3722
+ `),q=Q([]);if(G.length===$.length)return y6(q,G,Q);return y6((...U)=>{let W=Array(J.length);for(let w=0;w<J.length;w++)W[w]=U[J[w]];return q(...W)},G,Q,(U)=>{q=Q(U)})}function y6(X,$,Z,Y){let G=/^(\w+) is not defined$/,Q=X,q=[],K=new Set($);return(...U)=>{for(let W=0;W<=8;W++)try{return Q(...U)}catch(w){let z=w instanceof Error?w.message:"",B=G.exec(z);if(!(w instanceof ReferenceError)||!B)return;let j=B[1];if(K.has(j)||P6.has(j))return;K.add(j),q.push(j),Q=Z(q),Y?.(q)}return}}function VX(X){let $=X.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of Z)if(Y.test($))return!1;return!0}var BW,b6,S6,_W,C6,HW,P6;var O0=E(()=>{BW={maxSanitizeDepth:10,allowBracketNotation:!1},b6={...BW},S6=[/\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/],_W=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"]),C6=new Set(["__proto__","constructor","prototype"]),HW=/[\w)\]]\s*\[\s*['"]/;P6=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 AX(X,$){let Z=AW++,Y=`<!--__STX_${X.toUpperCase()}_${Z}__-->`;return RW.set(Y,{type:X,expression:$}),Y}var AW=0,RW;var v6=E(()=>{RW=new Map});function u6(X,$,Z,Y){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);if(!G)return-1;return G.index+G[0].length}function A1(X,$){return u6(X,$,x6,f6)}function R5(X,$){return u6(X,$,g6,h6)}function V7(X,$){if(!X.startsWith("<!--",$))return-1;let Z=X.indexOf("-->",$+4);if(Z===-1)return-1;return Z+3}function NW(X,$){if(X.startsWith("<!--",$)){let Z=V7(X,$);return Z===-1?X.length:Z}for(let[Z,Y]of[[x6,f6],[g6,h6]]){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);return G?G.index+G[0].length:X.length}return-1}function r$(X,$){let Z=[],Y=0,J=X.length,G=!1,Q=null;while(Y<J){let q=X[Y];if(G){if(Q){if(q===Q)Q=null}else if(q==='"'||q==="'")Q=q;else if(q===">")G=!1;Y++;continue}if(q!=="<"){Y++;continue}let K=$(X,Y);if(K>Y){Z.push({start:Y,end:K,token:X.slice(Y,K)}),Y=K;continue}let U=NW(X,Y);if(U>Y){Y=U;continue}if(/^<\/?[a-zA-Z]/.test(X.slice(Y,Y+2)))G=!0;Y++}return Z}function $1(X,$,Z){let Y=r$(X,$);if(Y.length===0)return{output:X,tokens:[]};let J=Y.map((q)=>q.token),G="",Q=0;for(let q=0;q<Y.length;q++){let K=Y[q];G+=X.slice(Q,K.start),G+=Z(K.token,q),Q=K.end}return G+=X.slice(Q),{output:G,tokens:J}}function R1(X){let{output:$,tokens:Z}=$1(X,A1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:$,scripts:Z}}function A7(X,$){if($.length===0)return X;return X.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>$[+Y]??"")}var x6,f6,g6,h6;var l1=E(()=>{x6=/<script\b[^>]*>/iy,f6=/<\/script\s*>/ig,g6=/<style\b[^>]*>/iy,h6=/<\/style\s*>/ig});var n6={};n(n6,{usesSignalsInScript:()=>W1,unescapeHtml:()=>SW,registerFilters:()=>MW,registerFilter:()=>l6,processExpressions:()=>N1,interpolateScriptsInTemplate:()=>EW,interpolateScriptExpressions:()=>RX,interpolateScriptAttributes:()=>p6,getAllFilters:()=>c6,evaluateExpression:()=>P0,escapeHtml:()=>r0,defaultFilters:()=>N7,clearCustomFilters:()=>kW,applyFilters:()=>i6});function TW(X){let $=d6.get(X);if(!$){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");$=new RegExp(`:${Z}(?!\\w)`,"g"),d6.set(X,$)}return $.lastIndex=0,$}function l6(X,$){if(X in N7)console.warn(`Filter "${X}" already exists as a built-in filter. Custom filter will take precedence.`);R7[X]=$}function MW(X){for(let[$,Z]of Object.entries(X))l6($,Z)}function c6(){return{...N7,...R7}}function kW(){for(let X of Object.keys(R7))delete R7[X]}function r0(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function W1(X){let{scripts:$}=R1(X);for(let Z of $){let Y=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let J=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(X))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(X))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(X))return!0;return!1}function m6(X,$){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=X.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let U=0;U<Y.length;U++){let W=Y[U];if(!G&&W==="`"){G=!0,Q=0;continue}if(G){if(W==="`"&&Q===0){G=!1;continue}if(W==="$"&&Y[U+1]==="{"){Q++,U++,J+=" ";continue}if(W==="}"&&Q>0){Q--;continue}if(Q>0){J+=W;continue}continue}J+=W}Y=J;let q=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,K;while((K=q.exec(Y))!==null){let U=K[1];if(!Y.substring(0,K.index).trimEnd().endsWith(".")){if(!Z.includes(U)&&!(U in $))return!1}}return!0}function IW(X,$){let Z=$.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let Y=X1(X);for(let J of Z)if(new RegExp(`(?<![.#\\w$])${J}(?![\\w$])`).test(Y))return!0;return!1}function RX(X,$){let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=P0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=P0(J,$);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function p6(X,$){if(!X.includes("{"))return X;let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=P0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=P0(J,$);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return Y}}),Z}function EW(X,$,Z={}){let{output:Y,scripts:J}=R1(X),G=J.map((Q)=>{let q=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),K=Q.match(/^<script\b[^>]*>/i),U=Q.search(/<\/script\s*>$/i);if(!q||!K||U===-1)return Q;let W=q[1],w=q[2];if(/\bdata-raw\b/.test(W))return Q;if(Z.skipServer&&/\bserver\b/.test(W))return Q;let B=`<script${p6(W,$)}>`;if(/\bsrc\s*=/.test(W)||/\btype\s*=\s*["']application\/json["']/.test(W))return B+w+Q.slice(U);return B+RX(w,$)+Q.slice(U)});return A7(Y,G)}function N1(X,$,Z){let Y=X,J=(w,z)=>{let B=R5(w,z);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(w.slice(z,B))?-1:B},G=(w,z,B,j)=>{let _=B.length,{output:H,tokens:L}=$1(w,z,(O,F)=>j(_+F));return B.push(...L),H},Q=[];Y=G(Y,J,Q,(w)=>`<!--__STX_STYLE_${w}__-->`);let q=[];Y=G(Y,A1,q,(w)=>`<!--__STX_SCRIPT_EXPR_${w}__-->`);let K=$?.__stx_signals_gate===!0||W1(X),U=new Set(Array.isArray($?.__stx_client_signal_names)?$.__stx_client_signal_names:[]),W=new Set(Array.isArray($?.__stx_preserved_client_expressions)?$.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(w,z,B)=>{try{let j=P0(z,$);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return U0("Expression",`Error evaluating: {{{ ${z.trim()}}}}: ${_}`,Z,X,B,w)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(w,z,B)=>{try{let j=P0(z,$);if(j===void 0&&$.__stx_buildMode==="compile")return AX("raw",z.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if($.__stx_buildMode==="compile")return AX("raw",z.trim());let _=j instanceof Error?j.message:String(j);return U0("Expression",`Error evaluating: {!! ${z.trim()} !!}: ${_}`,Z,X,B,w)}}),Y=G(Y,A1,q,(w)=>`<!--__STX_SCRIPT_EXPR_${w}__-->`),Y=G(Y,J,Q,(w)=>`<!--__STX_STYLE_${w}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(w,z,B)=>{let j=z.trim();if(W.has(j))return w;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,O=j.match(H)?.[1],F=O&&((O in $)||_.includes(O)),V=Boolean(O&&U.has(O)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=j.match(A),N=R&&!_.includes(R[1])&&!(R[1]in $);if(/^__[A-Z_]+__$/.test(j))return"";try{let T=P0(z,$);if(V)return w;if(K&&!m6(j,$))return w;if($.__stx_buildMode==="compile"&&!K&&(T===void 0||IW(j,$)))return AX("expr",j);return T!==void 0&&T!==null?r0(String(T)):""}catch(T){if(V)return w;if(K&&!m6(j,$))return w;if(N)return w;let k=T instanceof Error?T.message:String(T);return U0("Expression",`Error evaluating: {{ ${j} }}: ${k}`,Z,X,B,w)}});for(let w=0;w<q.length;w++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${w}__-->`,()=>q[w]);for(let w=0;w<Q.length;w++)Y=Y.replace(`<!--__STX_STYLE_${w}__-->`,()=>Q[w]);return Y}function i6(X,$,Z){if(!$.trim())return X;let Y=X,J=$.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let q=R7[Q]||N7[Q];if(!q)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(c6()).join(", ")}`);let K=[];if(J.startsWith(":")){let U=J.match(/^:([^|\s]+)/);if(U){let W=U[1].trim();try{let w=Number(W);K=[Number.isNaN(w)?W:w]}catch{K=[W]}J=J.substring(U[0].length).trim()}}else if(J.startsWith("(")){let U=1,W=1;while(U>0&&W<J.length){if(J[W]==="(")U++;if(J[W]===")")U--;W++}if(U===0){let w=J.substring(1,W-1).trim();if(w)try{if(w.startsWith("{")&&w.endsWith("}"))K=[P0(`(${w})`,Z,!0)];else{let z=[],B="",j=null,_=0,H=0,L=0,O=!1;for(let F=0;F<w.length;F++){let V=w[F];if(O){B+=V,O=!1;continue}if(V==="\\"){B+=V,O=!0;continue}if(j){if(B+=V,V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V,B+=V;continue}if(V==="(")_++;else if(V===")")_--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")L++;else if(V==="}")L--;if(V===","&&_===0&&H===0&&L===0){z.push(B),B="";continue}B+=V}if(B)z.push(B);K=z.map((F)=>{let V=F.trim();return P0(V,Z,!0)})}}catch{K=[w]}J=J.substring(W).trim()}}try{Y=q(Y,Z,...K)}catch(U){let W=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${Q}': ${W}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function DW(X){let $=!1,Z="",Y=0,J=0,G=0,Q=!1;for(let q=0;q<X.length;q++){let K=X[q],U=X[q+1];if($&&Q){Q=!1;continue}if($&&K==="\\"){Q=!0;continue}if(Q=!1,(K==='"'||K==="'"||K==="`")&&!Q){if(!$)$=!0,Z=K;else if(K===Z)$=!1,Z="";continue}if($&&Z==="`"&&K==="$"&&U==="{"){let W=1;q+=2;while(q<X.length&&W>0){if(X[q]==="{")W++;else if(X[q]==="}")W--;if(W>0)q++}continue}if($)continue;if(K==="(")Y++;else if(K===")")Y--;else if(K==="[")J++;else if(K==="]")J--;else if(K==="{")G++;else if(K==="}")G--;if(K==="|"&&Y===0&&J===0&&G===0){if(U==="|"){q++;continue}if(U==="="){q++;continue}return q}}return-1}function P0(X,$,Z=!1){try{let Y=X.trim(),J=DW(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),q=P0(G,$,!0);return i6(q,Q,$)}if(!G0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return $0(Y,$)}try{let G=Object.keys($),Q=Object.values($);return Q0(Y,G)(...Q)}catch{return $0(Y,$)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=yW(G,Object.keys($));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${X}`,Y);throw Y}}function yW(X,$){let Z=null;for(let J of $){if(J===X)continue;let G=bW(X,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max(X.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function bW(X,$){if(X===$)return 0;if(X.length===0)return $.length;if($.length===0)return X.length;let[Z,Y]=X.length<$.length?[X,$]:[$,X],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let q=1;q<=Z.length;q++){let K=Z[q-1]===Y[Q-1]?0:1;G[q]=Math.min(G[q-1]+1,J[q]+1,J[q-1]+K)}for(let q=0;q<=Z.length;q++)J[q]=G[q]}return J[Z.length]}function SW(X){if(!X)return"";return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var R7,d6,N7;var Z1=E(()=>{O0();A0();v6();l1();R7={},d6=new Map;N7={uppercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toUpperCase():""},lowercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toLowerCase():""},capitalize:(X,$)=>{if(X===void 0||X===null)return"";let Z=String(X);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:(X,$,Z=0)=>{if(X===void 0||X===null)return"";try{let Y=Number(X);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:(X,$,Z="en-US")=>{if(X===void 0||X===null)return"";try{let Y=Number(X);if(Number.isNaN(Y))return String(X);return Y.toLocaleString(Z)}catch{return String(X)}},join:(X,$,Z=",")=>{if(!Array.isArray(X))return"";return X.join(String(Z))},escape:(X,$)=>{if(X===void 0||X===null)return"";return r0(String(X))},translate:(X,$,Z={})=>{if(!$||!$.__translations)return X;let Y=$.__translations,J=$.__i18nConfig?.fallbackToKey??!0,G=String(X).split("."),Q=Y;for(let K of G){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return J?X:"";let q=String(Q);return Object.entries(Z).forEach(([K,U])=>{q=q.replace(TW(K),String(U))}),q},t:(X,$,Z={})=>{return N7.translate(X,$,Z)},truncate:(X,$,Z=50,Y="...")=>{if(X===void 0||X===null)return"";let J=String(X);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:(X,$,Z="short",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=X instanceof Date?X:new Date(X);if(Number.isNaN(J.getTime()))return String(X);let G={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Z==="iso")return J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String(X)}},currency:(X,$,Z="USD",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=Number(X);if(Number.isNaN(J))return String(X);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String(X)}},pluralize:(X,$,Z,Y)=>{let J=Number(X);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===1?Z:G},first:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[0];return String(X).charAt(0)},last:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[X.length-1];let Z=String(X);return Z.charAt(Z.length-1)},length:(X,$)=>{if(X===void 0||X===null)return 0;if(Array.isArray(X)||typeof X==="string")return X.length;if(X instanceof Map||X instanceof Set)return X.size;if(typeof X==="object")return Object.keys(X).length;return 0},json:(X,$,Z=!1)=>{if(X===void 0)return"undefined";if(X===null)return"null";try{return Z?JSON.stringify(X,null,2):JSON.stringify(X)}catch{return String(X)}},default:(X,$,Z="")=>{return X===void 0||X===null||X===""?Z:X},reverse:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return[...X].reverse();return String(X).split("").reverse().join("")},slice:(X,$,Z=0,Y)=>{if(X===void 0||X===null)return"";if(Array.isArray(X)||typeof X==="string")return X.slice(Z,Y);return X},replace:(X,$,Z,Y="")=>{if(X===void 0||X===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(X).replace(new RegExp(J,"g"),()=>Y)},stripTags:(X,$)=>{if(X===void 0||X===null)return"";return String(X).replace(/<[^>]*>/g,"")},urlencode:(X,$)=>{if(X===void 0||X===null)return"";return encodeURIComponent(String(X))},abs:(X,$)=>{let Z=Number(X);return Number.isNaN(Z)?0:Math.abs(Z)},round:(X,$,Z=0)=>{let Y=Number(X);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class c1{cache=new Map;maxSize;constructor(X=100){this.maxSize=X}get(X){if(!this.cache.has(X))return;let $=this.cache.get(X);return this.cache.delete(X),this.cache.set(X,$),$}set(X,$){if(this.cache.has(X))this.cache.delete(X);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set(X,$)}has(X){return this.cache.has(X)}delete(X){return this.cache.delete(X)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function T5(X,$){if($?.includes("g"))return new RegExp(X,$);let Z=`${X}:${$||""}`;if(!N5.has(Z)){if(N5.size>=CW){let Y=N5.keys().next().value;if(Y)N5.delete(Y)}N5.set(Z,new RegExp(X,$))}return N5.get(Z)}class r6{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(X){let $=Array.from(new Set(X)),Z=$.sort().join(","),Y=this.pool.find((q)=>q.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...q)=>{return(K)=>{try{let U=`${Z}:${K}`,W=J.get(U);if(!W){if(J.size>=G){let w=J.keys().next().value;if(w)J.delete(w)}W=Function(...$,`
3723
3723
  'use strict';
3724
3724
  try {
3725
3725
  return ${K};
@@ -3730,34 +3730,34 @@ catch (e) {
3730
3730
  }
3731
3731
  throw e;
3732
3732
  }
3733
- `),J.set(U,W)}return W(...q)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:$.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class l6{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(X){this.enabled=X}isEnabled(){return this.enabled}setBudget(X,$){this.budgets.set(X,{warnThreshold:0.8,action:"warn",...$})}setBudgets(X){for(let[$,Z]of Object.entries(X))this.setBudget($,Z)}removeBudget(X){this.budgets.delete(X)}getBudgets(){let X={};for(let[$,Z]of this.budgets.entries())X[$]=Z;return X}onViolation(X){this.violationHandlers.push(X)}offViolation(X){let $=this.violationHandlers.indexOf(X);if($!==-1)this.violationHandlers.splice($,1)}time(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=$(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}async timeAsync(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=await $(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}checkBudget(X,$){let Z=this.budgets.get(X);if(!Z)return;let Y=$/Z.maxTime*100,J=Z.warnThreshold!==void 0?$>=Z.maxTime*Z.warnThreshold&&$<Z.maxTime:!1,G=$>=Z.maxTime;if(!J&&!G)return;let Q={label:X,actualTime:$,budgetTime:Z.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let K of this.violationHandlers)try{K(Q)}catch{}let q=J?`[Performance Warning] "${X}" took ${$.toFixed(2)}ms (${Y.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${X}" took ${$.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(q);break;case"warn":console.warn(q);break;case"error":console.error(q);break;case"throw":if(G)throw Error(q);else console.warn(q);break}}recordTime(X,$){let Z=this.metrics.get(X);if(Z)Z.count++,Z.totalTime+=$,Z.maxTime=Math.max(Z.maxTime,$),Z.minTime=Math.min(Z.minTime,$);else this.metrics.set(X,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(X){if(X){let Z=this.metrics.get(X);if(!Z)return{};let Y=this.budgets.get(X);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:Y?.maxTime,budgetUtilization:Y?Z.totalTime/Z.count/Y.maxTime*100:void 0}}let $={};for(let[Z,Y]of this.metrics.entries()){let J=this.budgets.get(Z);$[Z]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}return $}getViolations(X){if(X)return this.violations.filter(($)=>$.label===X);return[...this.violations]}getViolationStats(){let X={},$=0,Z=0;for(let Y of this.violations)if(X[Y.label]=(X[Y.label]||0)+1,Y.isWarning)$++;else Z++;return{total:this.violations.length,byLabel:X,warnings:$,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function RW(){if(!o$)o$=new l6;return o$}var R5,AW=500,LV,o$=null,c6;var N5=D(()=>{R5=new Map;LV=new m6;c6=new Proxy({},{get(X,$){return RW()[$]}})});function p6(X,$=""){let Z=`${X}${$}`,Y=0;for(let J=0;J<Z.length;J++){let G=Z.charCodeAt(J);Y=(Y<<5)-Y+G,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function i6(X,$,Z={}){let{prefix:Y="",preserveHost:J=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!X.trim())return"";let q=s$(X),K=[],U=new Map;if(G)for(let W of q){let w=W.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(w){let z=w[1],B=`${$}_${z}`;U.set(z,B)}}for(let W of q){let w=n6(W,$,Y,J,U,Q);K.push(w)}return K.join(`
3733
+ `),J.set(U,W)}return W(...q)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:$.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class o6{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(X){this.enabled=X}isEnabled(){return this.enabled}setBudget(X,$){this.budgets.set(X,{warnThreshold:0.8,action:"warn",...$})}setBudgets(X){for(let[$,Z]of Object.entries(X))this.setBudget($,Z)}removeBudget(X){this.budgets.delete(X)}getBudgets(){let X={};for(let[$,Z]of this.budgets.entries())X[$]=Z;return X}onViolation(X){this.violationHandlers.push(X)}offViolation(X){let $=this.violationHandlers.indexOf(X);if($!==-1)this.violationHandlers.splice($,1)}time(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=$(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}async timeAsync(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=await $(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}checkBudget(X,$){let Z=this.budgets.get(X);if(!Z)return;let Y=$/Z.maxTime*100,J=Z.warnThreshold!==void 0?$>=Z.maxTime*Z.warnThreshold&&$<Z.maxTime:!1,G=$>=Z.maxTime;if(!J&&!G)return;let Q={label:X,actualTime:$,budgetTime:Z.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let K of this.violationHandlers)try{K(Q)}catch{}let q=J?`[Performance Warning] "${X}" took ${$.toFixed(2)}ms (${Y.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${X}" took ${$.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(q);break;case"warn":console.warn(q);break;case"error":console.error(q);break;case"throw":if(G)throw Error(q);else console.warn(q);break}}recordTime(X,$){let Z=this.metrics.get(X);if(Z)Z.count++,Z.totalTime+=$,Z.maxTime=Math.max(Z.maxTime,$),Z.minTime=Math.min(Z.minTime,$);else this.metrics.set(X,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(X){if(X){let Z=this.metrics.get(X);if(!Z)return{};let Y=this.budgets.get(X);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:Y?.maxTime,budgetUtilization:Y?Z.totalTime/Z.count/Y.maxTime*100:void 0}}let $={};for(let[Z,Y]of this.metrics.entries()){let J=this.budgets.get(Z);$[Z]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}return $}getViolations(X){if(X)return this.violations.filter(($)=>$.label===X);return[...this.violations]}getViolationStats(){let X={},$=0,Z=0;for(let Y of this.violations)if(X[Y.label]=(X[Y.label]||0)+1,Y.isWarning)$++;else Z++;return{total:this.violations.length,byLabel:X,warnings:$,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function PW(){if(!o$)o$=new o6;return o$}var N5,CW=500,PV,o$=null,s6;var M5=E(()=>{N5=new Map;PV=new r6;s6=new Proxy({},{get(X,$){return PW()[$]}})});function a6(X,$=""){let Z=`${X}${$}`,Y=0;for(let J=0;J<Z.length;J++){let G=Z.charCodeAt(J);Y=(Y<<5)-Y+G,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function t6(X,$,Z={}){let{prefix:Y="",preserveHost:J=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!X.trim())return"";let q=s$(X),K=[],U=new Map;if(G)for(let W of q){let w=W.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(w){let z=w[1],B=`${$}_${z}`;U.set(z,B)}}for(let W of q){let w=e6(W,$,Y,J,U,Q);K.push(w)}return K.join(`
3734
3734
 
3735
3735
  `)}function s$(X){let $=[],Z=X.replace(/\/\*[\s\S]*?\*\//g,""),Y=0,J="",G=!1,Q="";for(let q=0;q<Z.length;q++){let K=Z[q];if(K==="@"&&Y===0)G=!0;if(K==="{")Y++;else if(K==="}"){if(Y--,Y===0){if(G){Q+=K;let U=Q.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(U){let[,W,w,z]=U;if(W==="keyframes")$.push({selector:`@keyframes ${w.trim()}`,declarations:z.trim()});else if(W==="media"||W==="supports"||W==="container"){let B=s$(z);$.push({selector:`@${W} ${w.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
3736
- `)})}else $.push({selector:`@${W} ${w.trim()}`,declarations:z.trim()})}Q="",G=!1}else if(J.trim()){J+=K;let U=J.match(/([^{]+)\{([^}]*)\}/);if(U)$.push({selector:U[1].trim(),declarations:U[2].trim()});J=""}continue}}if(G)Q+=K;else J+=K}return $}function n6(X,$,Z,Y,J,G){let{selector:Q,declarations:q}=X;if(Q.startsWith("@")){if(Q.startsWith("@keyframes")){let W=Q.replace("@keyframes ","").trim();return`@keyframes ${J.get(W)||W} { ${q} }`}if(Q.startsWith("@media")||Q.startsWith("@supports")||Q.startsWith("@container")){let w=s$(`x { ${q} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((z)=>n6(z,$,Z,Y,J,G)).join(`
3736
+ `)})}else $.push({selector:`@${W} ${w.trim()}`,declarations:z.trim()})}Q="",G=!1}else if(J.trim()){J+=K;let U=J.match(/([^{]+)\{([^}]*)\}/);if(U)$.push({selector:U[1].trim(),declarations:U[2].trim()});J=""}continue}}if(G)Q+=K;else J+=K}return $}function e6(X,$,Z,Y,J,G){let{selector:Q,declarations:q}=X;if(Q.startsWith("@")){if(Q.startsWith("@keyframes")){let W=Q.replace("@keyframes ","").trim();return`@keyframes ${J.get(W)||W} { ${q} }`}if(Q.startsWith("@media")||Q.startsWith("@supports")||Q.startsWith("@container")){let w=s$(`x { ${q} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((z)=>e6(z,$,Z,Y,J,G)).join(`
3737
3737
  `);return`${Q} {
3738
3738
  ${w}
3739
- }`}return`${Q} { ${q} }`}let K=TW(Q,$,Z,Y),U=q;for(let[W,w]of J)U=U.replace(new RegExp(`\\b${W}\\b`,"g"),w);if(G)U=U.replace(/--([a-z-]+)/gi,`--${$}-$1`);return`${K} { ${U} }`}function TW(X,$,Z,Y){let J=X.split(",").map((Q)=>Q.trim()),G=[];for(let Q of J){if(Q.startsWith(":host")){if(Y)G.push(Q);else{let U=Q.replace(/:host(\([^)]*\))?/,`.${$}$1`);G.push(U)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${$}`);continue}let q=Z?`${Z} .${$}`:`.${$}`;G.push(`${q} ${Q}`);let K=NW(Q,$);if(K)G.push(Z?`${Z} ${K}`:K)}return G.join(", ")}function NW(X,$){let Z=0,Y=X.length;for(let K=0;K<X.length;K++){let U=X[K];if(U==="["||U==="(")Z++;else if(U==="]"||U===")")Z--;else if(Z===0&&(U===" "||U===">"||U==="+"||U==="~")){Y=K;break}}let J=X.slice(0,Y),G=X.slice(Y);if(!J)return"";let Q=J.length,q=0;for(let K=0;K<J.length;K++){let U=J[K];if(U==="["||U==="(")q++;else if(U==="]"||U===")")q--;else if(Z===0&&q===0&&U===":"){Q=K;break}}return`${J.slice(0,Q)}.${$}${J.slice(Q)}${G}`}function o6(X){let $=new Set;return X.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let Y=Z.trim();if($.has(Y))return"";return $.add(Y),Z})}function RX(X,$){if(!MW.test(X))return{html:X,hasScoped:!1};let Z=p6($),Y=`data-v-${Z}`,J=X,G=new RegExp(`<style\\s+([^>]*${a$}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(J=J.replace(G,(q,K,U)=>{Q=!0;let W=kW(U,Y),w=K.replace(new RegExp(a$,"gi"),"").trim(),z=w?` ${w}`:"";return`<style data-stx-scoped="${Z}"${z}>${W}</style>`}),!Q)return{html:X,hasScoped:!1};return J=EW(J,Y),{html:J,hasScoped:!0}}function kW(X,$){return i6(X,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${$}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${$}]`)}function EW(X,$){let Z=$1(X,(J,G)=>{let Q=A1(J,G);return Q>G?Q:A5(J,G)},(J,G)=>IW(G)),Y=DW(Z.output,$);return r6.lastIndex=0,Y.replace(r6,(J,G)=>Z.tokens[Number(G)])}function DW(X,$){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return X.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,J,G)=>{if(Z.has(J.toLowerCase()))return Y;if(Y.includes($))return Y;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return Y;if(G)return Y.replace(`<${J}${G}`,`<${J} ${$}${G}`);if(Y.endsWith("/>"))return`<${J} ${$} />`;return`<${J} ${$}>`})}var a$,MW,IW=(X)=>`\x00stx-scope-mask-${X}\x00`,r6;var t$=D(()=>{l1();a$=String.raw`(?<![\w-])scoped(?![\w-])`,MW=new RegExp(`<style\\s+[^>]*${a$}`,"i");r6=/\u0000stx-scope-mask-(\d+)\u0000/g});function bW(X){let $=X.replace(/^<template\b/i,"").replace(/>$/,"");return yW.test($)}function TX(X){T7.lastIndex=0;let $;while(($=T7.exec(X))!==null){if($[0].startsWith("</")||bW($[0]))continue;let Z=$.index,Y=T7.lastIndex,J=1,G;while((G=T7.exec(X))!==null)if(G[0].startsWith("</")){if(J--,J===0){let Q=G.index;return{start:Z,openEnd:Y,closeStart:Q,end:T7.lastIndex,content:X.slice(Y,Q)}}}else J++;return null}return null}var T7,yW;var e$=D(()=>{T7=/<\/?template\b[^>]*>/gi,yW=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var s6=()=>{};function N0(X,$,Z,Y=0){let J=0,G=Y,Q=null,q=0,K=!1;while(G<X.length){let U=X[G];if(Q&&K){K=!1,G++;continue}if(Q&&U==="\\"){K=!0,G++;continue}if(K=!1,(U==='"'||U==="'"||U==="`")&&!Q){Q=U,G++;continue}if(U===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&U==="$"&&X[G+1]==="{"){q++,G+=2;continue}if(q>0&&U==="}"){q--,G++;continue}if(U==="`"&&Q==="`"&&q===0){Q=null,G++;continue}if(Q){G++;continue}if(U===$)J++;else if(U===Z){if(J--,J===0)return G}G++}return-1}var Z9={};n(Z9,{useTitle:()=>xW,useSeoMeta:()=>a6,usePageTitle:()=>xW,useHead:()=>$9,seoMetaToHeadConfig:()=>MX,resetHead:()=>PW,renderHtmlAttrs:()=>gW,renderHead:()=>fW,renderBodyAttrs:()=>hW,processTitleDirective:()=>mW,processMetaDirective:()=>lW,processHeadDirective:()=>dW,mergeHeadConfigs:()=>M5,getPageMeta:()=>CW,getHead:()=>X9,definePageMeta:()=>vW,applyHead:()=>uW});function X9(){return N1}function CW(){return NX}function PW(){N1={},SW.length=0,NX={}}function $9(X){N1=M5(N1,X)}function M5(X,$){return{title:$.title??X.title,titleTemplate:$.titleTemplate??X.titleTemplate,base:$.base??X.base,meta:[...X.meta||[],...$.meta||[]],link:[...X.link||[],...$.link||[]],script:[...X.script||[],...$.script||[]],style:[...X.style||[],...$.style||[]],htmlAttrs:{...X.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...X.bodyAttrs,...$.bodyAttrs}}}function a6(X){$9(MX(X))}function MX(X){let $=[];if(X.description)$.push({name:"description",content:X.description});if(X.keywords){let K=Array.isArray(X.keywords)?X.keywords.join(", "):X.keywords;$.push({name:"keywords",content:K})}if(X.author)$.push({name:"author",content:X.author});if(X.robots)$.push({name:"robots",content:X.robots});let Z=X.ogTitle??X.title,Y=X.ogDescription??X.description;if(Z)$.push({property:"og:title",content:Z});if(Y)$.push({property:"og:description",content:Y});if(X.ogImage)$.push({property:"og:image",content:X.ogImage});if(X.ogUrl)$.push({property:"og:url",content:X.ogUrl});if(X.ogType)$.push({property:"og:type",content:X.ogType});if(X.ogSiteName)$.push({property:"og:site_name",content:X.ogSiteName});if(X.ogLocale)$.push({property:"og:locale",content:X.ogLocale});let J=X.twitterTitle??X.title,G=X.twitterDescription??X.description,Q=X.twitterImage??X.ogImage;if(X.twitterCard)$.push({name:"twitter:card",content:X.twitterCard});if(J)$.push({name:"twitter:title",content:J});if(G)$.push({name:"twitter:description",content:G});if(Q)$.push({name:"twitter:image",content:Q});if(X.twitterSite)$.push({name:"twitter:site",content:X.twitterSite});if(X.twitterCreator)$.push({name:"twitter:creator",content:X.twitterCreator});if(X.articleAuthor)$.push({property:"article:author",content:X.articleAuthor});if(X.articlePublishedTime)$.push({property:"article:published_time",content:X.articlePublishedTime});if(X.articleModifiedTime)$.push({property:"article:modified_time",content:X.articleModifiedTime});if(X.articleSection)$.push({property:"article:section",content:X.articleSection});if(X.articleTags)for(let K of X.articleTags)$.push({property:"article:tag",content:K});let q=[];if(X.canonical)q.push({rel:"canonical",href:X.canonical});return{title:X.title,titleTemplate:X.titleTemplate,meta:$,link:q}}function vW(X){if(NX={...NX,...X},X.title||X.description)a6({title:X.title,description:X.description})}function xW(X){let $=typeof X==="function"?X():X;$9({title:$})}function fW(X=N1){let $=[];if(X.title){let Z=X.title;if(X.titleTemplate)Z=typeof X.titleTemplate==="function"?X.titleTemplate(Z):X.titleTemplate.replace("%s",Z);$.push(`<title>${p1(Z)}</title>`)}if(X.base){let Z=Object.entries(X.base).map(([Y,J])=>`${Y}="${p1(J)}"`).join(" ");$.push(`<base ${Z}>`)}for(let Z of X.meta||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>{return`${J==="httpEquiv"?"http-equiv":J}="${p1(String(G))}"`}).join(" ");$.push(`<meta ${Y}>`)}for(let Z of X.link||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>`${J}="${p1(String(G))}"`).join(" ");$.push(`<link ${Y}>`)}for(let Z of X.script||[]){let{content:Y,...J}=Z,G=Object.entries(J).filter(([Q,q])=>q!==void 0).map(([Q,q])=>{if(typeof q==="boolean")return q?Q:"";return`${Q}="${p1(String(q))}"`}).filter(Boolean).join(" ");if(Y)$.push(`<script ${G}>${Y}</script>`);else $.push(`<script ${G}></script>`)}for(let Z of X.style||[]){let Y=Z.type?` type="${Z.type}"`:"";$.push(`<style${Y}>${Z.content}</style>`)}return $.join(`
3740
- `)}function gW(X=N1){if(!X.htmlAttrs)return"";return Object.entries(X.htmlAttrs).map(([$,Z])=>`${$}="${p1(Z)}"`).join(" ")}function hW(X=N1){if(!X.bodyAttrs)return"";return Object.entries(X.bodyAttrs).map(([$,Z])=>`${$}="${p1(Z)}"`).join(" ")}function p1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function uW(X=N1){if(typeof document>"u")return;if(X.title){let $=X.title;if(X.titleTemplate)$=typeof X.titleTemplate==="function"?X.titleTemplate($):X.titleTemplate.replace("%s",$);document.title=$}for(let $ of X.meta||[]){let Z=$.name?`meta[name="${$.name}"]`:$.property?`meta[property="${$.property}"]`:null;if(Z){let Y=document.querySelector(Z);if(!Y){if(Y=document.createElement("meta"),$.name)Y.setAttribute("name",$.name);if($.property)Y.setAttribute("property",$.property);document.head.appendChild(Y)}Y.setAttribute("content",$.content)}}for(let $ of X.link||[]){let Z=`link[rel="${$.rel}"]${$.href?`[href="${$.href}"]`:""}`,Y=document.querySelector(Z);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[J,G]of Object.entries($))if(G!==void 0)Y.setAttribute(J,String(G))}if(X.htmlAttrs)for(let[$,Z]of Object.entries(X.htmlAttrs))if($==="class")for(let Y of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add(Y);else document.documentElement.setAttribute($,Z);if(X.bodyAttrs)for(let[$,Z]of Object.entries(X.bodyAttrs))document.body.setAttribute($,Z)}function dW(X){let $="";return{content:X.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,J)=>{return $+=J.trim()+`
3741
- `,""}),headContent:$.trim()}}function mW(X,$){return X.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,Y,J,G)=>{let Q=Y?J:$[(G||"").trim()]??G,q=$.__stx_runtime_head??{};return $.__stx_runtime_head=M5(q,{title:Q}),""})}function lW(X,$){return X.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,Y,J,G,Q,q)=>{let K=G?Q:q,U=G?K:$[(K||"").trim()]??K,w=J.includes(":")?{property:J,content:U}:{name:J,content:U},z=$.__stx_runtime_head??{};return $.__stx_runtime_head=M5(z,{meta:[w]}),""})}var N1,SW,NX;var N7=D(()=>{N1={},SW=[],NX={}});var kX={};n(kX,{stripTypeScript:()=>JZ,splitDeclaration:()=>WZ,isModuleResolutionFailure:()=>GZ,isMissingBindingFailure:()=>QZ,isCompleteImport:()=>qZ,hasVariables:()=>BZ,extractVariables:()=>i1,extractScriptFromTemplate:()=>jZ,convertToCommonJS:()=>G9,STX_ENGINE_BINDING_NAMES:()=>J9});import M1 from"path";import k5 from"process";function pW(X){let $=[],Z=0,Y=X.split(`
3742
- `);for(let J of Y){let G=Z,Q=null,q=!1;for(let K=0;K<J.length;K++){let U=J[K];if(q){q=!1;continue}if(U==="\\"){q=!0;continue}if(Q){if(U===Q)Q=null;continue}if(U==="'"||U==='"'||U==="`"){Q=U;continue}if(U==="/"&&K+1<J.length&&J[K+1]==="/")break;if(U==="{")Z++;else if(U==="}")Z--}if(G===0){let K=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)$.push(K[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let U=J.match(/(?:const|let|var)\s+(\w+)/);if(U)$.push(U[1])}else{let U=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(U){let w=U[1].slice(1,-1).split(",").map((z)=>{let B=z.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((z)=>/^\w+$/.test(z));$.push(...w)}}}}return[...new Set($)]}function JZ(X){let $=X;$=$.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),$=$.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),$=$.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(Y){if(!Y.includes(":"))return Y;let J=[],G="",Q=0,q=0,K=null;for(let U=0;U<Y.length;U++){let W=Y[U];if(K){if(G+=W,W===K)K=null;continue}if(W==='"'||W==="'"||W==="`"){K=W,G+=W;continue}if(W==="<")Q++;else if(W===">"&&Q>0)Q--;else if(W==="(")q++;else if(W===")")q--;if(W===","&&Q===0&&q===0){J.push(G),G="";continue}G+=W}if(G)J.push(G);return J.map((U)=>{let W=U.trim(),w=W.startsWith("..."),z=w?W.slice(3):W,B=-1,j=0;for(let A=0;A<z.length;A++)if(z[A]==="<")j++;else if(z[A]===">")j--;else if(z[A]===":"&&j===0){B=A;break}if(B===-1)return U;let H=z.substring(0,B).trim().replace(/\?$/,""),L=z.substring(B+1),O=-1,F=0;for(let A=0;A<L.length;A++)if(L[A]==="<")F++;else if(L[A]===">")F--;else if(L[A]==="="&&F===0){O=A;break}let V=w?"...":"";if(O!==-1)return`${V}${H} = ${L.substring(O+1).trim()}`;return`${V}${H}`}).join(", ")}$=$.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;return`${J}(${Z(G)})`});{let Y=/\b(function\s+\w*\s*)\(/g,J,G=[];while((J=Y.exec($))!==null){let Q=J.index+J[0].length-1,q=1,K=Q+1,U=0,W=null;while(K<$.length&&q>0){let B=$[K];if(W){if(B===W)W=null;K++;continue}if(B==='"'||B==="'"||B==="`"){W=B,K++;continue}if(B==="<")U++;else if(B===">"&&U>0)U--;else if(U===0){if(B==="(")q++;else if(B===")")q--}if(q>0)K++}if(q!==0)continue;let w=$.substring(Q+1,K);if(!w.includes(":"))continue;let z=Z(w);G.push({start:Q+1,end:K,replacement:z})}for(let Q=G.length-1;Q>=0;Q--){let{start:q,end:K,replacement:U}=G[Q];$=$.substring(0,q)+U+$.substring(K)}}return $=$.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((Q)=>{let[q,...K]=Q.split("="),U=q.split(":")[0].trim();if(K.length>0)return`${U} = ${K.join("=").trim()}`;return U}).join(", ")}) =>`}),$=$.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),$=$.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),$=$.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),$=$.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),$=$.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),$=$.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),$=$.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),$=$.replace(/\n\s*\n\s*\n/g,`
3743
-
3744
- `),$}function GZ(X){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(X)}function QZ(X){if(!/is not defined|can't find variable/i.test(X))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(X)}async function i1(X,$,Z,Y={}){if(!X.trim())return;let J;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:S0()}),v=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=E.transformSync(v)}catch{J=JZ(X)}let G={exports:{}},Q=G.exports,q=k5.cwd(),K={},U=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((E)=>E[1]).filter((E)=>!E.startsWith("node:")&&!E.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(E));for(let E of U)try{let v=M1.resolve(q,"node_modules",E),u=M1.join(v,"package.json"),f=JSON.parse(W0("fs").readFileSync(u,"utf8")),o=f.main||"index.js";if(f.exports){let Z0=typeof f.exports==="string"?f.exports:f.exports["."];if(typeof Z0==="string")o=Z0;else if(Z0?.bun)o=Z0.bun;else if(Z0?.import)o=Z0.import;else if(Z0?.default)o=Z0.default}K[E]=await import(M1.resolve(v,o))}catch{}let W=(E)=>{if(K[E])return K[E];return W0(E)},w=$.props||{},z=(E)=>{if(!E)return w;let v={};for(let[u,f]of Object.entries(E)){let o=w[u];if(o!==void 0)v[u]=o;else if(typeof f==="function")v[u]=f();else v[u]=f}return v};for(let[E,v]of Object.entries(w))Object.defineProperty(z,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(w,E))continue;try{Object.defineProperty(z,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(E)=>{if(!E)return w;let v={...w};for(let[u,f]of Object.entries(E)){let o=f&&typeof f==="object"&&!Array.isArray(f)?f:{type:f};if(v[u]===void 0&&o.default!==void 0)v[u]=typeof o.default==="function"?o.default():o.default}return v},j=()=>$.slots||{},_=(E,v)=>{let u={...E};for(let[f,o]of Object.entries(v))if(u[f]===void 0)if(typeof o==="function")u[f]=o();else u[f]=o;return u},H=(E)=>{let v=()=>E;return v.set=(u)=>{},v.update=(u)=>{},v},L=(E)=>{let v,u=!1;return()=>{if(!u)try{v=E(),u=!0}catch{v=void 0}return v}},O=(E)=>{},F=(E)=>E(),V=(E)=>{},A=(E)=>{};function R(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)y({title:v.title,description:v.description})}function T(E){if(!E||typeof E!=="object")return;let v=$.__stxClientPayload??{};Object.assign(v,E),$.__stxClientPayload=v}let N=()=>{let E=$.__stxServeContext,v=$.__stxServeSearch??E?.search??"",u=E?.path??"",f=Object.fromEntries(new URLSearchParams(v)),o=$.query,Z0=Object.keys(f).length>0?f:o??{},n0=v||(Object.keys(Z0).length>0?`?${new URLSearchParams(Z0).toString()}`:"");return{params:$.params??{},query:Z0,path:u,name:"",fullPath:u+n0,hash:"",matched:[]}},k=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),M=(E)=>{let v=$.__stx_runtime_head||{};$.__stx_runtime_head=M5(v,E||{})},y=(E)=>{M(MX(E||{}))},I=(E)=>({value:E}),C=(E)=>E,S=(E)=>({value:typeof E==="function"?E():E}),b=(E,v)=>{},P=(E)=>{},x=(E)=>{},d=(E)=>E?E():Promise.resolve(),m=(E)=>(v,...u)=>{},Y0=(E)=>{},m0=(E,v)=>{},F0=(E,v)=>v,i0=()=>({value:"light"}),l=()=>H(!1),j0=(E)=>H(!1),l0=()=>H(!1),_1=()=>j0("(prefers-color-scheme: dark)"),U5=()=>j0("(prefers-color-scheme: light)"),W5=()=>j0("(prefers-reduced-motion: reduce)"),r=()=>j0("(prefers-contrast: more)"),a={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},K0=new Proxy(a,{get(E,v){if(v in E)return E[v];return},set(E,v,u){return E[v]=u,!0}}),T0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},J0=console;try{let E=G9(J,Z),v=new Set(Object.keys(w)),u=(i)=>/^[a-z_$][\w$]*$/i.test(i),f=Object.keys($).filter((i)=>!v.has(i)&&i!=="props"&&u(i)),o=f.map((i)=>$[i]);if(!f.includes("__stxServeContext"))f.push("__stxServeContext"),o.push(void 0);let Z0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),n0=[],b0=[];for(let[i,e0]of Object.entries(w)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(Z0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(E))continue;n0.push(i),b0.push(e0)}let r0=pW(E).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
3745
- `),w5=$.params??{},H1=[],O1=[];for(let i=0;i<f.length;i++){if(f[i]==="params")continue;H1.push(f[i]),O1.push(o[i])}let t0=await Function(...J9,...n0,...H1,`return (async () => {
3746
- ${E}
3747
- ${r0}
3739
+ }`}return`${Q} { ${q} }`}let K=vW(Q,$,Z,Y),U=q;for(let[W,w]of J)U=U.replace(new RegExp(`\\b${W}\\b`,"g"),w);if(G)U=U.replace(/--([a-z-]+)/gi,`--${$}-$1`);return`${K} { ${U} }`}function vW(X,$,Z,Y){let J=X.split(",").map((Q)=>Q.trim()),G=[];for(let Q of J){if(Q.startsWith(":host")){if(Y)G.push(Q);else{let U=Q.replace(/:host(\([^)]*\))?/,`.${$}$1`);G.push(U)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${$}`);continue}let q=Z?`${Z} .${$}`:`.${$}`;G.push(`${q} ${Q}`);let K=xW(Q,$);if(K)G.push(Z?`${Z} ${K}`:K)}return G.join(", ")}function xW(X,$){let Z=0,Y=X.length;for(let K=0;K<X.length;K++){let U=X[K];if(U==="["||U==="(")Z++;else if(U==="]"||U===")")Z--;else if(Z===0&&(U===" "||U===">"||U==="+"||U==="~")){Y=K;break}}let J=X.slice(0,Y),G=X.slice(Y);if(!J)return"";let Q=J.length,q=0;for(let K=0;K<J.length;K++){let U=J[K];if(U==="["||U==="(")q++;else if(U==="]"||U===")")q--;else if(Z===0&&q===0&&U===":"){Q=K;break}}return`${J.slice(0,Q)}.${$}${J.slice(Q)}${G}`}function $Z(X){let $=new Set;return X.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let Y=Z.trim();if($.has(Y))return"";return $.add(Y),Z})}function NX(X,$){if(!fW.test(X))return{html:X,hasScoped:!1};let Z=a6($),Y=`data-v-${Z}`,J=X,G=new RegExp(`<style\\s+([^>]*${a$}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(J=J.replace(G,(q,K,U)=>{Q=!0;let W=gW(U,Y),w=K.replace(new RegExp(a$,"gi"),"").trim(),z=w?` ${w}`:"";return`<style data-stx-scoped="${Z}"${z}>${W}</style>`}),!Q)return{html:X,hasScoped:!1};return J=uW(J,Y),{html:J,hasScoped:!0}}function gW(X,$){return t6(X,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${$}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${$}]`)}function uW(X,$){let Z=$1(X,(J,G)=>{let Q=A1(J,G);return Q>G?Q:R5(J,G)},(J,G)=>hW(G)),Y=dW(Z.output,$);return XZ.lastIndex=0,Y.replace(XZ,(J,G)=>Z.tokens[Number(G)])}function dW(X,$){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return X.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,J,G)=>{if(Z.has(J.toLowerCase()))return Y;if(Y.includes($))return Y;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return Y;if(G)return Y.replace(`<${J}${G}`,`<${J} ${$}${G}`);if(Y.endsWith("/>"))return`<${J} ${$} />`;return`<${J} ${$}>`})}var a$,fW,hW=(X)=>`\x00stx-scope-mask-${X}\x00`,XZ;var t$=E(()=>{l1();a$=String.raw`(?<![\w-])scoped(?![\w-])`,fW=new RegExp(`<style\\s+[^>]*${a$}`,"i");XZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function lW(X){let $=X.replace(/^<template\b/i,"").replace(/>$/,"");return mW.test($)}function TX(X){T7.lastIndex=0;let $;while(($=T7.exec(X))!==null){if($[0].startsWith("</")||lW($[0]))continue;let Z=$.index,Y=T7.lastIndex,J=1,G;while((G=T7.exec(X))!==null)if(G[0].startsWith("</")){if(J--,J===0){let Q=G.index;return{start:Z,openEnd:Y,closeStart:Q,end:T7.lastIndex,content:X.slice(Y,Q)}}}else J++;return null}return null}var T7,mW;var e$=E(()=>{T7=/<\/?template\b[^>]*>/gi,mW=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var ZZ=()=>{};function T0(X,$,Z,Y=0){let J=0,G=Y,Q=null,q=0,K=!1;while(G<X.length){let U=X[G];if(Q&&K){K=!1,G++;continue}if(Q&&U==="\\"){K=!0,G++;continue}if(K=!1,(U==='"'||U==="'"||U==="`")&&!Q){Q=U,G++;continue}if(U===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&U==="$"&&X[G+1]==="{"){q++,G+=2;continue}if(q>0&&U==="}"){q--,G++;continue}if(U==="`"&&Q==="`"&&q===0){Q=null,G++;continue}if(Q){G++;continue}if(U===$)J++;else if(U===Z){if(J--,J===0)return G}G++}return-1}var Z9={};n(Z9,{useTitle:()=>rW,useSeoMeta:()=>YZ,usePageTitle:()=>rW,useHead:()=>$9,seoMetaToHeadConfig:()=>kX,resetHead:()=>iW,renderHtmlAttrs:()=>sW,renderHead:()=>oW,renderBodyAttrs:()=>aW,processTitleDirective:()=>Xw,processMetaDirective:()=>$w,processHeadDirective:()=>eW,mergeHeadConfigs:()=>k5,getPageMeta:()=>pW,getHead:()=>X9,definePageMeta:()=>nW,applyHead:()=>tW});function X9(){return T1}function pW(){return MX}function iW(){T1={},cW.length=0,MX={}}function $9(X){T1=k5(T1,X)}function k5(X,$){return{title:$.title??X.title,titleTemplate:$.titleTemplate??X.titleTemplate,base:$.base??X.base,meta:[...X.meta||[],...$.meta||[]],link:[...X.link||[],...$.link||[]],script:[...X.script||[],...$.script||[]],style:[...X.style||[],...$.style||[]],htmlAttrs:{...X.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...X.bodyAttrs,...$.bodyAttrs}}}function YZ(X){$9(kX(X))}function kX(X){let $=[];if(X.description)$.push({name:"description",content:X.description});if(X.keywords){let K=Array.isArray(X.keywords)?X.keywords.join(", "):X.keywords;$.push({name:"keywords",content:K})}if(X.author)$.push({name:"author",content:X.author});if(X.robots)$.push({name:"robots",content:X.robots});let Z=X.ogTitle??X.title,Y=X.ogDescription??X.description;if(Z)$.push({property:"og:title",content:Z});if(Y)$.push({property:"og:description",content:Y});if(X.ogImage)$.push({property:"og:image",content:X.ogImage});if(X.ogUrl)$.push({property:"og:url",content:X.ogUrl});if(X.ogType)$.push({property:"og:type",content:X.ogType});if(X.ogSiteName)$.push({property:"og:site_name",content:X.ogSiteName});if(X.ogLocale)$.push({property:"og:locale",content:X.ogLocale});let J=X.twitterTitle??X.title,G=X.twitterDescription??X.description,Q=X.twitterImage??X.ogImage;if(X.twitterCard)$.push({name:"twitter:card",content:X.twitterCard});if(J)$.push({name:"twitter:title",content:J});if(G)$.push({name:"twitter:description",content:G});if(Q)$.push({name:"twitter:image",content:Q});if(X.twitterSite)$.push({name:"twitter:site",content:X.twitterSite});if(X.twitterCreator)$.push({name:"twitter:creator",content:X.twitterCreator});if(X.articleAuthor)$.push({property:"article:author",content:X.articleAuthor});if(X.articlePublishedTime)$.push({property:"article:published_time",content:X.articlePublishedTime});if(X.articleModifiedTime)$.push({property:"article:modified_time",content:X.articleModifiedTime});if(X.articleSection)$.push({property:"article:section",content:X.articleSection});if(X.articleTags)for(let K of X.articleTags)$.push({property:"article:tag",content:K});let q=[];if(X.canonical)q.push({rel:"canonical",href:X.canonical});return{title:X.title,titleTemplate:X.titleTemplate,meta:$,link:q}}function nW(X){if(MX={...MX,...X},X.title||X.description)YZ({title:X.title,description:X.description})}function rW(X){let $=typeof X==="function"?X():X;$9({title:$})}function oW(X=T1){let $=[];if(X.title){let Z=X.title;if(X.titleTemplate)Z=typeof X.titleTemplate==="function"?X.titleTemplate(Z):X.titleTemplate.replace("%s",Z);$.push(`<title>${p1(Z)}</title>`)}if(X.base){let Z=Object.entries(X.base).map(([Y,J])=>`${Y}="${p1(J)}"`).join(" ");$.push(`<base ${Z}>`)}for(let Z of X.meta||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>{return`${J==="httpEquiv"?"http-equiv":J}="${p1(String(G))}"`}).join(" ");$.push(`<meta ${Y}>`)}for(let Z of X.link||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>`${J}="${p1(String(G))}"`).join(" ");$.push(`<link ${Y}>`)}for(let Z of X.script||[]){let{content:Y,...J}=Z,G=Object.entries(J).filter(([Q,q])=>q!==void 0).map(([Q,q])=>{if(typeof q==="boolean")return q?Q:"";return`${Q}="${p1(String(q))}"`}).filter(Boolean).join(" ");if(Y)$.push(`<script ${G}>${Y}</script>`);else $.push(`<script ${G}></script>`)}for(let Z of X.style||[]){let Y=Z.type?` type="${Z.type}"`:"";$.push(`<style${Y}>${Z.content}</style>`)}return $.join(`
3740
+ `)}function sW(X=T1){if(!X.htmlAttrs)return"";return Object.entries(X.htmlAttrs).map(([$,Z])=>`${$}="${p1(Z)}"`).join(" ")}function aW(X=T1){if(!X.bodyAttrs)return"";return Object.entries(X.bodyAttrs).map(([$,Z])=>`${$}="${p1(Z)}"`).join(" ")}function p1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function tW(X=T1){if(typeof document>"u")return;if(X.title){let $=X.title;if(X.titleTemplate)$=typeof X.titleTemplate==="function"?X.titleTemplate($):X.titleTemplate.replace("%s",$);document.title=$}for(let $ of X.meta||[]){let Z=$.name?`meta[name="${$.name}"]`:$.property?`meta[property="${$.property}"]`:null;if(Z){let Y=document.querySelector(Z);if(!Y){if(Y=document.createElement("meta"),$.name)Y.setAttribute("name",$.name);if($.property)Y.setAttribute("property",$.property);document.head.appendChild(Y)}Y.setAttribute("content",$.content)}}for(let $ of X.link||[]){let Z=`link[rel="${$.rel}"]${$.href?`[href="${$.href}"]`:""}`,Y=document.querySelector(Z);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[J,G]of Object.entries($))if(G!==void 0)Y.setAttribute(J,String(G))}if(X.htmlAttrs)for(let[$,Z]of Object.entries(X.htmlAttrs))if($==="class")for(let Y of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add(Y);else document.documentElement.setAttribute($,Z);if(X.bodyAttrs)for(let[$,Z]of Object.entries(X.bodyAttrs))document.body.setAttribute($,Z)}function eW(X){let $="";return{content:X.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,J)=>{return $+=J.trim()+`
3741
+ `,""}),headContent:$.trim()}}function Xw(X,$){return X.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,Y,J,G)=>{let Q=Y?J:$[(G||"").trim()]??G,q=$.__stx_runtime_head??{};return $.__stx_runtime_head=k5(q,{title:Q}),""})}function $w(X,$){return X.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,Y,J,G,Q,q)=>{let K=G?Q:q,U=G?K:$[(K||"").trim()]??K,w=J.includes(":")?{property:J,content:U}:{name:J,content:U},z=$.__stx_runtime_head??{};return $.__stx_runtime_head=k5(z,{meta:[w]}),""})}var T1,cW,MX;var M7=E(()=>{T1={},cW=[],MX={}});var IX={};n(IX,{stripTypeScript:()=>WZ,splitDeclaration:()=>HZ,isModuleResolutionFailure:()=>wZ,isMissingBindingFailure:()=>zZ,isCompleteImport:()=>jZ,hasVariables:()=>VZ,extractVariables:()=>i1,extractScriptFromTemplate:()=>FZ,convertToCommonJS:()=>G9,STX_ENGINE_BINDING_NAMES:()=>J9});import M1 from"path";import I5 from"process";function Yw(X){let $=[],Z=0,Y=X.split(`
3742
+ `);for(let J of Y){let G=Z,Q=null,q=!1;for(let K=0;K<J.length;K++){let U=J[K];if(q){q=!1;continue}if(U==="\\"){q=!0;continue}if(Q){if(U===Q)Q=null;continue}if(U==="'"||U==='"'||U==="`"){Q=U;continue}if(U==="/"&&K+1<J.length&&J[K+1]==="/")break;if(U==="{")Z++;else if(U==="}")Z--}if(G===0){let K=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)$.push(K[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let U=J.match(/(?:const|let|var)\s+(\w+)/);if(U)$.push(U[1])}else{let U=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(U){let w=U[1].slice(1,-1).split(",").map((z)=>{let B=z.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((z)=>/^\w+$/.test(z));$.push(...w)}}}}return[...new Set($)]}function WZ(X){let $=X;$=$.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),$=$.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),$=$.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(Y){if(!Y.includes(":"))return Y;let J=[],G="",Q=0,q=0,K=null;for(let U=0;U<Y.length;U++){let W=Y[U];if(K){if(G+=W,W===K)K=null;continue}if(W==='"'||W==="'"||W==="`"){K=W,G+=W;continue}if(W==="<")Q++;else if(W===">"&&Q>0)Q--;else if(W==="(")q++;else if(W===")")q--;if(W===","&&Q===0&&q===0){J.push(G),G="";continue}G+=W}if(G)J.push(G);return J.map((U)=>{let W=U.trim(),w=W.startsWith("..."),z=w?W.slice(3):W,B=-1,j=0;for(let A=0;A<z.length;A++)if(z[A]==="<")j++;else if(z[A]===">")j--;else if(z[A]===":"&&j===0){B=A;break}if(B===-1)return U;let H=z.substring(0,B).trim().replace(/\?$/,""),L=z.substring(B+1),O=-1,F=0;for(let A=0;A<L.length;A++)if(L[A]==="<")F++;else if(L[A]===">")F--;else if(L[A]==="="&&F===0){O=A;break}let V=w?"...":"";if(O!==-1)return`${V}${H} = ${L.substring(O+1).trim()}`;return`${V}${H}`}).join(", ")}$=$.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;return`${J}(${Z(G)})`});{let Y=/\b(function\s+\w*\s*)\(/g,J,G=[];while((J=Y.exec($))!==null){let Q=J.index+J[0].length-1,q=1,K=Q+1,U=0,W=null;while(K<$.length&&q>0){let B=$[K];if(W){if(B===W)W=null;K++;continue}if(B==='"'||B==="'"||B==="`"){W=B,K++;continue}if(B==="<")U++;else if(B===">"&&U>0)U--;else if(U===0){if(B==="(")q++;else if(B===")")q--}if(q>0)K++}if(q!==0)continue;let w=$.substring(Q+1,K);if(!w.includes(":"))continue;let z=Z(w);G.push({start:Q+1,end:K,replacement:z})}for(let Q=G.length-1;Q>=0;Q--){let{start:q,end:K,replacement:U}=G[Q];$=$.substring(0,q)+U+$.substring(K)}}return $=$.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((Q)=>{let[q,...K]=Q.split("="),U=q.split(":")[0].trim();if(K.length>0)return`${U} = ${K.join("=").trim()}`;return U}).join(", ")}) =>`}),$=$.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),$=$.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),$=$.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),$=$.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),$=$.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),$=$.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),$=$.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),$=$.replace(/\n\s*\n\s*\n/g,`
3743
+
3744
+ `),$}function wZ(X){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(X)}function zZ(X){if(!/is not defined|can't find variable/i.test(X))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(X)}async function i1(X,$,Z,Y={}){if(!X.trim())return;let J;try{let D=new Bun.Transpiler({loader:"ts",target:"browser",define:S0()}),v=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=D.transformSync(v)}catch{J=WZ(X)}let G={exports:{}},Q=G.exports,q=I5.cwd(),K={},U=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((D)=>D[1]).filter((D)=>!D.startsWith("node:")&&!D.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(D));for(let D of U)try{let v=M1.resolve(q,"node_modules",D),u=M1.join(v,"package.json"),f=JSON.parse(W0("fs").readFileSync(u,"utf8")),o=f.main||"index.js";if(f.exports){let Z0=typeof f.exports==="string"?f.exports:f.exports["."];if(typeof Z0==="string")o=Z0;else if(Z0?.bun)o=Z0.bun;else if(Z0?.import)o=Z0.import;else if(Z0?.default)o=Z0.default}K[D]=await import(M1.resolve(v,o))}catch{}let W=(D)=>{if(K[D])return K[D];return W0(D)},w=$.props||{},z=(D)=>{if(!D)return w;let v={};for(let[u,f]of Object.entries(D)){let o=w[u];if(o!==void 0)v[u]=o;else if(typeof f==="function")v[u]=f();else v[u]=f}return v};for(let[D,v]of Object.entries(w))Object.defineProperty(z,D,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let D of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(w,D))continue;try{Object.defineProperty(z,D,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(D)=>{if(!D)return w;let v={...w};for(let[u,f]of Object.entries(D)){let o=f&&typeof f==="object"&&!Array.isArray(f)?f:{type:f};if(v[u]===void 0&&o.default!==void 0)v[u]=typeof o.default==="function"?o.default():o.default}return v},j=()=>$.slots||{},_=(D,v)=>{let u={...D};for(let[f,o]of Object.entries(v))if(u[f]===void 0)if(typeof o==="function")u[f]=o();else u[f]=o;return u},H=(D)=>{let v=()=>D;return v.set=(u)=>{},v.update=(u)=>{},v},L=(D)=>{let v,u=!1;return()=>{if(!u)try{v=D(),u=!0}catch{v=void 0}return v}},O=(D)=>{},F=(D)=>D(),V=(D)=>{},A=(D)=>{};function R(D){let v=D||{};if(v.title!==void 0||v.description!==void 0)y({title:v.title,description:v.description})}function N(D){if(!D||typeof D!=="object")return;let v=$.__stxClientPayload??{};Object.assign(v,D),$.__stxClientPayload=v}let T=()=>{let D=$.__stxServeContext,v=$.__stxServeSearch??D?.search??"",u=D?.path??"",f=Object.fromEntries(new URLSearchParams(v)),o=$.query,Z0=Object.keys(f).length>0?f:o??{},i0=v||(Object.keys(Z0).length>0?`?${new URLSearchParams(Z0).toString()}`:"");return{params:$.params??{},query:Z0,path:u,name:"",fullPath:u+i0,hash:"",matched:[]}},k=()=>({push:(D)=>{},replace:(D)=>{},back:()=>{},forward:()=>{},go:(D)=>{}}),M=(D)=>{let v=$.__stx_runtime_head||{};$.__stx_runtime_head=k5(v,D||{})},y=(D)=>{M(kX(D||{}))},I=(D)=>({value:D}),C=(D)=>D,S=(D)=>({value:typeof D==="function"?D():D}),b=(D,v)=>{},P=(D)=>{},x=(D)=>{},d=(D)=>D?D():Promise.resolve(),m=(D)=>(v,...u)=>{},Y0=(D)=>{},d0=(D,v)=>{},F0=(D,v)=>v,p0=()=>({value:"light"}),l=()=>H(!1),j0=(D)=>H(!1),m0=()=>H(!1),_1=()=>j0("(prefers-color-scheme: dark)"),W5=()=>j0("(prefers-color-scheme: light)"),w5=()=>j0("(prefers-reduced-motion: reduce)"),r=()=>j0("(prefers-contrast: more)"),a={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},K0=new Proxy(a,{get(D,v){if(v in D)return D[v];return},set(D,v,u){return D[v]=u,!0}}),N0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},J0=console;try{let D=G9(J,Z),v=new Set(Object.keys(w)),u=(i)=>/^[a-z_$][\w$]*$/i.test(i),f=Object.keys($).filter((i)=>!v.has(i)&&i!=="props"&&u(i)),o=f.map((i)=>$[i]);if(!f.includes("__stxServeContext"))f.push("__stxServeContext"),o.push(void 0);let Z0=new Set(["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","function","if","import","in","instanceof","let","new","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","enum","await","async","module","exports","require","params","window","document","console","state","derived","effect"]),i0=[],b0=[];for(let[i,t0]of Object.entries(w)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(Z0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(D))continue;i0.push(i),b0.push(t0)}let n0=Yw(D).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
3745
+ `),z5=$.params??{},H1=[],O1=[];for(let i=0;i<f.length;i++){if(f[i]==="params")continue;H1.push(f[i]),O1.push(o[i])}let a0=await Function(...J9,...i0,...H1,`return (async () => {
3746
+ ${D}
3747
+ ${n0}
3748
3748
  return module.exports
3749
- })()`)(G,Q,W,w,z,B,_,T,H,L,O,F,V,A,R,N,k,M,y,I,C,S,b,P,x,d,m,Y0,j,m0,F0,i0,l,j0,l0,_1,U5,W5,r,K0,T0,J0,a.confirm,a.alert,a.fetch,w5,...b0,...O1);if(Y.preserveExisting){for(let[i,e0]of Object.entries(t0))if(!(i in $)||$[i]===void 0)$[i]=e0}else Object.assign($,t0);for(let[i,e0]of Object.entries(w))if(!(i in $))$[i]=e0}catch(E){let v=E instanceof Error?E.message:String(E);if(GZ(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(QZ(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(k5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await aW(J,$,Z)}catch(u){if(k5.env.STX_DEBUG){let f=u instanceof Error?u.message:String(u);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${f}`)}}}}function qZ(X){let $=0,Z=null,Y=!1,J=!1;for(let G=0;G<X.length;G++){let Q=X[G];if(Z){if(Q===Z){if(Z=null,Y||$===0)J=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")$++;else if(Q==="}")$--;else if(X.startsWith("from",G)&&$===0)Y=!0}return Z===null&&$===0&&J}function G9(X,$){let Z=$?M1.dirname($):k5.cwd(),Y=k5.cwd(),J=X.split(`
3749
+ })()`)(G,Q,W,w,z,B,_,N,H,L,O,F,V,A,R,T,k,M,y,I,C,S,b,P,x,d,m,Y0,j,d0,F0,p0,l,j0,m0,_1,W5,w5,r,K0,N0,J0,a.confirm,a.alert,a.fetch,z5,...b0,...O1);if(Y.preserveExisting){for(let[i,t0]of Object.entries(a0))if(!(i in $)||$[i]===void 0)$[i]=t0}else Object.assign($,a0);for(let[i,t0]of Object.entries(w))if(!(i in $))$[i]=t0}catch(D){let v=D instanceof Error?D.message:String(D);if(wZ(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(zZ(v))console.warn(`[stx] server <script> in ${Z??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${v}`);else if(I5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await Uw(J,$,Z)}catch(u){if(I5.env.STX_DEBUG){let f=u instanceof Error?u.message:String(u);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${f}`)}}}}function jZ(X){let $=0,Z=null,Y=!1,J=!1;for(let G=0;G<X.length;G++){let Q=X[G];if(Z){if(Q===Z){if(Z=null,Y||$===0)J=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")$++;else if(Q==="}")$--;else if(X.startsWith("from",G)&&$===0)Y=!0}return Z===null&&$===0&&J}function G9(X,$){let Z=$?M1.dirname($):I5.cwd(),Y=I5.cwd(),J=X.split(`
3750
3750
  `),G=[],Q=0;while(Q<J.length){let q=J[Q].trim();if(q.startsWith("interface ")||q.startsWith("export interface ")||q.startsWith("type ")||q.startsWith("export type ")){if(q.includes("{")&&!q.includes("}")){let K=0;for(;Q<J.length;Q++){for(let U of J[Q])if(U==="{")K++;else if(U==="}")K--;if(K<=0)break}}Q++;continue}if(q.startsWith("definePageMeta(")){let K=0,U=!1,W=Q;for(let B=Q;B<J.length&&!U;B++){let j=null,_=!1,H=J[B];for(let L=0;L<H.length;L++){let O=H[L];if(_){_=!1;continue}if(O==="\\"){_=!0;continue}if(j){if(O===j)j=null;continue}if(O==='"'||O==="'"||O==="`"){j=O;continue}if(O==="(")K++;else if(O===")"){if(K--,K===0){Q=B+1,U=!0;break}}}}if(!U)Q=J.length;let w=J.slice(W,Q).join(`
3751
- `),z=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(w);if(j)z.push(`${B}: ${JSON.stringify(j[2])}`)}if(z.length>0)G.push(`useSeoMeta({ ${z.join(", ")} });`);continue}if(q.startsWith("import ")||q==="import"||q.startsWith("import{")){let K=q,U=0;while(!qZ(K)&&Q+U+1<J.length)U++,K=`${K} ${J[Q+U].trim()}`;Q+=U;let W=K.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),w=K.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),z=K.match(/^import\s+['"](.+?)['"]/),B=K,j=(_)=>{if(_.startsWith("."))return M1.resolve(Z,_);if(_.startsWith("~/")||_.startsWith("@/"))return M1.resolve(Y,_.slice(2));return _};if(W){let[,_,H]=W,L=j(H);G.push(`const ${_} = await import('${L}')`),G.push(`module.exports.${_} = ${_};`)}else if(w){let[,_,H]=w,L=j(H),O=[],F=[],V=cW.has(H);for(let A of _.split(",")){let R=A.trim();if(!R)continue;let T=R.split(/\s+as\s+/);if(T.length===2){let[N,k]=[T[0].trim(),T[1].trim()];if(V&&t6.has(N)){G.push(`const ${k} = ${N};`),F.push(k);continue}O.push(`${N}: ${k}`),F.push(k)}else{if(V&&t6.has(R)){F.push(R);continue}O.push(R),F.push(R)}}if(O.length>0)G.push(`const { ${O.join(", ")} } = await import('${L}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(z){let _=j(z[1]);G.push(`await import('${_}')`)}else G.push(B);Q++;continue}if(iW.test(q))G.push(J[Q]),Q++;else if(q.startsWith("export const ")||q.startsWith("export let ")||q.startsWith("export var ")){let K=XZ(J,Q),{type:U,name:W,value:w}=K;G.push(`${U} ${W} = ${w};`),G.push(`module.exports.${W} = ${W};`),Q=K.nextIndex}else if(q.startsWith("export function ")||q.startsWith("export async function ")){let K=Y9(J,Q);G.push(K.functionCode),G.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(q.startsWith("const ")||q.startsWith("let ")||q.startsWith("var ")){let K=XZ(J,Q),{type:U,name:W,value:w}=K;G.push(`${U} ${W} = ${w};`),G.push(`module.exports.${W} = ${W};`),Q=K.nextIndex}else if(q.startsWith("function ")||q.startsWith("async function ")){let K=Y9(J,Q);G.push(K.functionCode),G.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(q.startsWith("export default function ")||q.startsWith("export default async function ")){let K=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),U=[...J];U[Q]=K;let W=Y9(U,Q);if(G.push(W.functionCode),W.name)G.push(`module.exports.default = ${W.name};`);Q=W.nextIndex}else if(q.startsWith("export default ")){let K=q.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${K};`),Q++}else if(q.startsWith("class ")||q.startsWith("export class ")){let K=q.match(/(?:export\s+)?class\s+(\w+)/);if(K){let U=K[1],W=J[Q].replace(/^export\s+/,""),w=0,z=Q;for(;z<J.length;z++){let B=J[z];for(let j of B)if(j==="{")w++;else if(j==="}")w--;if(z>Q)W+=`
3752
- `+B;if(w<=0&&z>=Q)break}G.push(W),G.push(`module.exports.${U} = ${U};`),Q=z+1}else G.push(q),Q++}else if(q.includes("module.exports"))G.push(q),Q++;else if(q.trim()&&!q.startsWith("//"))G.push(q),Q++;else Q++}return nW(G.join(`
3753
- `),Z,Y)}function nW(X,$,Z){let Y=X.length,J="",G=0,Q=null,q=!1,K=!1,U=0;while(G<Y){let W=X[G],w=X[G+1];if(q){if(J+=W,W===`
3754
- `)q=!1;G++;continue}if(K){if(J+=W,W==="*"&&w==="/"){J+=w,G+=2,K=!1;continue}G++;continue}if(!Q&&W==="/"&&w==="/"){q=!0,J+=W,G++;continue}if(!Q&&W==="/"&&w==="*"){K=!0,J+=W,G++;continue}if(Q){if(J+=W,W==="\\"){J+=w,G+=2;continue}if(W===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(W==="$"&&w==="{"){U++,J+=w,G+=2;continue}if(W==="`"){Q=null,G++;continue}}G++;continue}if(U>0){if(W==="{")U++;else if(W==="}")U--}if(W==='"'||W==="'"||W==="`"){Q=W,J+=W,G++;continue}if(W==="a"&&X.startsWith("await",G)){let z=rW(X,G);if(z){let{quote:B,path:j,end:_}=z;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let H=j.startsWith(".")?M1.resolve($,j):M1.resolve(Z,j.slice(2));J+=`await import(${B}${H}${B})`,G=_;continue}}}J+=W,G++}return J}function rW(X,$){let Z=$+5;if(Z>=X.length)return null;if(!/\s/.test(X[Z]))return null;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(!X.startsWith("import",Z))return null;Z+=6;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return null;Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;let Y=X[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=Z;while(Z<X.length&&X[Z]!==Y)if(X[Z]==="\\")Z+=2;else Z++;if(Z>=X.length)return null;let G=X.slice(J,Z);Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!==")")return null;return{quote:Y,path:G,end:Z+1}}function KZ(X,$){let Z=X[$];if(Z!=="{"&&Z!=="[")return null;let J=N0(X,Z,Z==="{"?"}":"]",$);if(J===-1)return null;return{pattern:X.slice($,J+1),endPos:J+1}}function UZ(X){let $=[],Z=X.slice(1,-1).trim();if(!Z)return $;let Y=0,J=0,G="";while(Y<Z.length){let Q=Z[Y];if(Q==="{"||Q==="["){let q=J===0?KZ(Z,Y):null;if(q){$.push(...UZ(q.pattern)),Y=q.endPos,G="";continue}J++}else if(Q==="}"||Q==="]")J--;if(J>0){Y++;continue}if(Q===","){if(G.trim())$.push(G.trim());G="",Y++;continue}if(Q===":"){G="",Y++;continue}if(Q==="="){if(G.trim())$.push(G.trim());G="",Y++;while(Y<Z.length&&Z[Y]!==","&&J===0){if(Z[Y]==="{"||Z[Y]==="[")J++;else if(Z[Y]==="}"||Z[Y]==="]")J--;Y++}continue}if(/[\w$]/.test(Q))G+=Q;Y++}if(G.trim())$.push(G.trim());return $}function WZ(X){let $=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(X);if(!$)return null;let Z=$[0].length,Y=(J)=>J===" "||J==="\t";while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]===":"){let J=0,G=null;Z++;for(;Z<X.length;Z++){let Q=X[Z];if(G){if(Q==="\\"){Z++;continue}if(Q===G)G=null;continue}if(Q==="'"||Q==='"'||Q==="`"){G=Q;continue}if(Q==="("||Q==="["||Q==="{"||Q==="<"){J++;continue}if(Q===")"||Q==="]"||Q==="}"||Q===">"){J--;continue}if(Q==="="&&J<=0){let q=X[Z+1],K=X[Z-1];if(q!=="="&&q!==">"&&K!=="="&&K!=="!"&&K!=="<"&&K!==">")break}}if(X[Z]!=="=")return null}while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]!=="=")return null;return{type:$[1],name:$[2],value:X.slice(Z+1).trim()}}function e6(X,$,Z,Y){let J=null,G=!1;for(let Q of X){if(G){G=!1;continue}if(Q==="\\"){G=!0;continue}if(J){if(Q===J)J=null;continue}if(Q==="'"||Q==='"'||Q==="`"){J=Q;continue}if(Q===$)Y++;else if(Q===Z)Y--}return Y}function XZ(X,$){let Z=X[$].trim(),Y=WZ(Z),J=Y?[Z,Y.type,Y.name,Y.value]:null;if(!J){let W=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let w=Z.slice(W[0].length),z=$;if(w.startsWith("{")||w.startsWith("[")){let j=w[0],_=j==="{"?"}":"]",H=e6(w,j,_,0),L=w;for(let O=$+1;O<X.length&&H>0;O++)L+=` ${X[O].trim()}`,z=O,H=e6(X[O],j,_,H);if(H>0)L=w,z=$;w=L}let B=KZ(w,0);if(B){let j=W[1],_=B.pattern,H=w.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),O=L,F=Math.max(z,$);if($Z(L)){let T=ZZ(X,F,L);O=T.value,F=T.nextIndex}else F=F+1;O=O.trim().replace(/;$/,"");let V=UZ(_),A=`__stx_src_${$}`,R=V.map((T)=>`module.exports.${T} = ${T};`).join(`
3751
+ `),z=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(w);if(j)z.push(`${B}: ${JSON.stringify(j[2])}`)}if(z.length>0)G.push(`useSeoMeta({ ${z.join(", ")} });`);continue}if(q.startsWith("import ")||q==="import"||q.startsWith("import{")){let K=q,U=0;while(!jZ(K)&&Q+U+1<J.length)U++,K=`${K} ${J[Q+U].trim()}`;Q+=U;let W=K.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),w=K.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),z=K.match(/^import\s+['"](.+?)['"]/),B=K,j=(_)=>{if(_.startsWith("."))return M1.resolve(Z,_);if(_.startsWith("~/")||_.startsWith("@/"))return M1.resolve(Y,_.slice(2));return _};if(W){let[,_,H]=W,L=j(H);G.push(`const ${_} = (await import('${L}')).default`),G.push(`module.exports.${_} = ${_};`)}else if(w){let[,_,H]=w,L=j(H),O=[],F=[],V=Zw.has(H);for(let A of _.split(",")){let R=A.trim();if(!R)continue;let N=R.split(/\s+as\s+/);if(N.length===2){let[T,k]=[N[0].trim(),N[1].trim()];if(V&&JZ.has(T)){G.push(`const ${k} = ${T};`),F.push(k);continue}O.push(`${T}: ${k}`),F.push(k)}else{if(V&&JZ.has(R)){F.push(R);continue}O.push(R),F.push(R)}}if(O.length>0)G.push(`const { ${O.join(", ")} } = await import('${L}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(z){let _=j(z[1]);G.push(`await import('${_}')`)}else G.push(B);Q++;continue}if(Jw.test(q))G.push(J[Q]),Q++;else if(q.startsWith("export const ")||q.startsWith("export let ")||q.startsWith("export var ")){let K=QZ(J,Q),{type:U,name:W,value:w}=K;G.push(`${U} ${W} = ${w};`),G.push(`module.exports.${W} = ${W};`),Q=K.nextIndex}else if(q.startsWith("export function ")||q.startsWith("export async function ")){let K=Y9(J,Q);G.push(K.functionCode),G.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(q.startsWith("const ")||q.startsWith("let ")||q.startsWith("var ")){let K=QZ(J,Q),{type:U,name:W,value:w}=K;G.push(`${U} ${W} = ${w};`),G.push(`module.exports.${W} = ${W};`),Q=K.nextIndex}else if(q.startsWith("function ")||q.startsWith("async function ")){let K=Y9(J,Q);G.push(K.functionCode),G.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(q.startsWith("export default function ")||q.startsWith("export default async function ")){let K=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),U=[...J];U[Q]=K;let W=Y9(U,Q);if(G.push(W.functionCode),W.name)G.push(`module.exports.default = ${W.name};`);Q=W.nextIndex}else if(q.startsWith("export default ")){let K=q.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${K};`),Q++}else if(q.startsWith("class ")||q.startsWith("export class ")){let K=q.match(/(?:export\s+)?class\s+(\w+)/);if(K){let U=K[1],W=J[Q].replace(/^export\s+/,""),w=0,z=Q;for(;z<J.length;z++){let B=J[z];for(let j of B)if(j==="{")w++;else if(j==="}")w--;if(z>Q)W+=`
3752
+ `+B;if(w<=0&&z>=Q)break}G.push(W),G.push(`module.exports.${U} = ${U};`),Q=z+1}else G.push(q),Q++}else if(q.includes("module.exports"))G.push(q),Q++;else if(q.trim()&&!q.startsWith("//"))G.push(q),Q++;else Q++}return Gw(G.join(`
3753
+ `),Z,Y)}function Gw(X,$,Z){let Y=X.length,J="",G=0,Q=null,q=!1,K=!1,U=0;while(G<Y){let W=X[G],w=X[G+1];if(q){if(J+=W,W===`
3754
+ `)q=!1;G++;continue}if(K){if(J+=W,W==="*"&&w==="/"){J+=w,G+=2,K=!1;continue}G++;continue}if(!Q&&W==="/"&&w==="/"){q=!0,J+=W,G++;continue}if(!Q&&W==="/"&&w==="*"){K=!0,J+=W,G++;continue}if(Q){if(J+=W,W==="\\"){J+=w,G+=2;continue}if(W===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(W==="$"&&w==="{"){U++,J+=w,G+=2;continue}if(W==="`"){Q=null,G++;continue}}G++;continue}if(U>0){if(W==="{")U++;else if(W==="}")U--}if(W==='"'||W==="'"||W==="`"){Q=W,J+=W,G++;continue}if(W==="a"&&X.startsWith("await",G)){let z=Qw(X,G);if(z){let{quote:B,path:j,end:_}=z;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let H=j.startsWith(".")?M1.resolve($,j):M1.resolve(Z,j.slice(2));J+=`await import(${B}${H}${B})`,G=_;continue}}}J+=W,G++}return J}function Qw(X,$){let Z=$+5;if(Z>=X.length)return null;if(!/\s/.test(X[Z]))return null;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(!X.startsWith("import",Z))return null;Z+=6;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return null;Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;let Y=X[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=Z;while(Z<X.length&&X[Z]!==Y)if(X[Z]==="\\")Z+=2;else Z++;if(Z>=X.length)return null;let G=X.slice(J,Z);Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!==")")return null;return{quote:Y,path:G,end:Z+1}}function BZ(X,$){let Z=X[$];if(Z!=="{"&&Z!=="[")return null;let J=T0(X,Z,Z==="{"?"}":"]",$);if(J===-1)return null;return{pattern:X.slice($,J+1),endPos:J+1}}function _Z(X){let $=[],Z=X.slice(1,-1).trim();if(!Z)return $;let Y=0,J=0,G="";while(Y<Z.length){let Q=Z[Y];if(Q==="{"||Q==="["){let q=J===0?BZ(Z,Y):null;if(q){$.push(..._Z(q.pattern)),Y=q.endPos,G="";continue}J++}else if(Q==="}"||Q==="]")J--;if(J>0){Y++;continue}if(Q===","){if(G.trim())$.push(G.trim());G="",Y++;continue}if(Q===":"){G="",Y++;continue}if(Q==="="){if(G.trim())$.push(G.trim());G="",Y++;while(Y<Z.length&&Z[Y]!==","&&J===0){if(Z[Y]==="{"||Z[Y]==="[")J++;else if(Z[Y]==="}"||Z[Y]==="]")J--;Y++}continue}if(/[\w$]/.test(Q))G+=Q;Y++}if(G.trim())$.push(G.trim());return $}function HZ(X){let $=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(X);if(!$)return null;let Z=$[0].length,Y=(J)=>J===" "||J==="\t";while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]===":"){let J=0,G=null;Z++;for(;Z<X.length;Z++){let Q=X[Z];if(G){if(Q==="\\"){Z++;continue}if(Q===G)G=null;continue}if(Q==="'"||Q==='"'||Q==="`"){G=Q;continue}if(Q==="("||Q==="["||Q==="{"||Q==="<"){J++;continue}if(Q===")"||Q==="]"||Q==="}"||Q===">"){J--;continue}if(Q==="="&&J<=0){let q=X[Z+1],K=X[Z-1];if(q!=="="&&q!==">"&&K!=="="&&K!=="!"&&K!=="<"&&K!==">")break}}if(X[Z]!=="=")return null}while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]!=="=")return null;return{type:$[1],name:$[2],value:X.slice(Z+1).trim()}}function GZ(X,$,Z,Y){let J=null,G=!1;for(let Q of X){if(G){G=!1;continue}if(Q==="\\"){G=!0;continue}if(J){if(Q===J)J=null;continue}if(Q==="'"||Q==='"'||Q==="`"){J=Q;continue}if(Q===$)Y++;else if(Q===Z)Y--}return Y}function QZ(X,$){let Z=X[$].trim(),Y=HZ(Z),J=Y?[Z,Y.type,Y.name,Y.value]:null;if(!J){let W=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let w=Z.slice(W[0].length),z=$;if(w.startsWith("{")||w.startsWith("[")){let j=w[0],_=j==="{"?"}":"]",H=GZ(w,j,_,0),L=w;for(let O=$+1;O<X.length&&H>0;O++)L+=` ${X[O].trim()}`,z=O,H=GZ(X[O],j,_,H);if(H>0)L=w,z=$;w=L}let B=BZ(w,0);if(B){let j=W[1],_=B.pattern,H=w.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),O=L,F=Math.max(z,$);if(qZ(L)){let N=KZ(X,F,L);O=N.value,F=N.nextIndex}else F=F+1;O=O.trim().replace(/;$/,"");let V=_Z(_),A=`__stx_src_${$}`,R=V.map((N)=>`module.exports.${N} = ${N};`).join(`
3755
3755
  `);return{type:j,name:A,value:`${O}; ${j} ${_} = ${A};
3756
- ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,q]=J,K=q,U=$;if($Z(q)){let W=ZZ(X,$,q);K=W.value,U=W.nextIndex}else U=$+1;while(U<X.length){let W=X[U].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
3757
- ${X[U]}`,U++;else break}return K=K.trim().replace(/;$/,""),{type:G,name:Q,value:K,nextIndex:U}}function Y9(X,$){let Z=X[$].trim(),Y=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${Z}`);let[,J]=Y,G=Z.replace(/^export\s+/,""),Q=$;if(oW(Z)){let q=sW(X,$,G);G=q.functionCode,Q=q.nextIndex}else Q=$+1;return{name:J,functionCode:G,nextIndex:Q}}function $Z(X){let $=X.trim();if($.startsWith("{"))return N0($,"{","}",0)===-1;if($.startsWith("["))return N0($,"[","]",0)===-1;return!wZ($)}function wZ(X){let $={paren:0,bracket:0,brace:0},Z=null,Y=0;for(let J=0;J<X.length;J++){let G=X[J];if((J>0?X[J-1]:"")==="\\"&&Z)continue;if((G==='"'||G==="'")&&!Z){Z=G;continue}if(G===Z&&Z!=="`"){Z=null;continue}if(G==="`"&&!Z){Z="`";continue}if(G==="`"&&Z==="`"&&Y===0){Z=null;continue}if(Z==="`"&&G==="$"&&X[J+1]==="{"){Y++,J++;continue}if(Y>0&&G==="{"){Y++;continue}if(Y>0&&G==="}"){Y--;continue}if(Z)continue;if(G==="(")$.paren++;else if(G===")")$.paren--;else if(G==="[")$.bracket++;else if(G==="]")$.bracket--;else if(G==="{")$.brace++;else if(G==="}")$.brace--}return $.paren===0&&$.bracket===0&&$.brace===0&&Z===null}function zZ(X){let $=X.indexOf("(");if($===-1)return X.indexOf("{");let Z=N0(X,"(",")",$);if(Z===-1)return-1;return X.indexOf("{",Z)}function oW(X){let $=zZ(X);if($===-1)return!0;return N0(X,"{","}",$)===-1}function ZZ(X,$,Z){let Y=Z,J=$+1;while(J<X.length&&!wZ(Y)){let G=X[J];Y+=`
3756
+ ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,q]=J,K=q,U=$;if(qZ(q)){let W=KZ(X,$,q);K=W.value,U=W.nextIndex}else U=$+1;while(U<X.length){let W=X[U].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
3757
+ ${X[U]}`,U++;else break}return K=K.trim().replace(/;$/,""),{type:G,name:Q,value:K,nextIndex:U}}function Y9(X,$){let Z=X[$].trim(),Y=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${Z}`);let[,J]=Y,G=Z.replace(/^export\s+/,""),Q=$;if(qw(Z)){let q=Kw(X,$,G);G=q.functionCode,Q=q.nextIndex}else Q=$+1;return{name:J,functionCode:G,nextIndex:Q}}function qZ(X){let $=X.trim();if($.startsWith("{"))return T0($,"{","}",0)===-1;if($.startsWith("["))return T0($,"[","]",0)===-1;return!OZ($)}function OZ(X){let $={paren:0,bracket:0,brace:0},Z=null,Y=0;for(let J=0;J<X.length;J++){let G=X[J];if((J>0?X[J-1]:"")==="\\"&&Z)continue;if((G==='"'||G==="'")&&!Z){Z=G;continue}if(G===Z&&Z!=="`"){Z=null;continue}if(G==="`"&&!Z){Z="`";continue}if(G==="`"&&Z==="`"&&Y===0){Z=null;continue}if(Z==="`"&&G==="$"&&X[J+1]==="{"){Y++,J++;continue}if(Y>0&&G==="{"){Y++;continue}if(Y>0&&G==="}"){Y--;continue}if(Z)continue;if(G==="(")$.paren++;else if(G===")")$.paren--;else if(G==="[")$.bracket++;else if(G==="]")$.bracket--;else if(G==="{")$.brace++;else if(G==="}")$.brace--}return $.paren===0&&$.bracket===0&&$.brace===0&&Z===null}function LZ(X){let $=X.indexOf("(");if($===-1)return X.indexOf("{");let Z=T0(X,"(",")",$);if(Z===-1)return-1;return X.indexOf("{",Z)}function qw(X){let $=LZ(X);if($===-1)return!0;return T0(X,"{","}",$)===-1}function KZ(X,$,Z){let Y=Z,J=$+1;while(J<X.length&&!OZ(Y)){let G=X[J];Y+=`
3758
3758
  ${G}`,J++}while(J<X.length){let G=X[J].trim();if(G.startsWith(".")||G.startsWith("?."))Y+=`
3759
- ${X[J]}`,J++;else break}return{value:Y,nextIndex:J}}function sW(X,$,Z){let Y=Z,J=$+1;while(J<X.length){let G=zZ(Y);if(G!==-1){if(N0(Y,"{","}",G)!==-1)break}let Q=X[J];Y+=`
3760
- ${Q}`,J++}return{functionCode:Y,nextIndex:J}}function YZ(X,$){let Z=$0(X,$)??$0(`(${X})`,$);if(Z!==void 0)return Z;if(!/\bprocess\b/.test(X))return;let Y={...$,process:Object.freeze({env:{...k5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${X});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${X};`)(...Object.values(Y))}catch{return}}}async function aW(X,$,Z){let Y=X.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of Y){let[,,Q,q]=G;try{let K=q.trim().replace(/;$/,""),U=YZ(K,$);if(U!==void 0)$[Q]=U}catch(K){console.warn(`Failed to parse export ${Q} in fallback:`,K)}}let J=X.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of J){let[,,Q,q]=G;if(!(Q in $))try{let K=q.trim().replace(/;$/,""),U=YZ(K,$);if(U!==void 0)$[Q]=U}catch{}}}function jZ(X){let $=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=$?$[1]:"",Y=$?X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):X;return{scriptContent:Z,templateWithoutScript:Y}}function BZ(X){let $=X.trim();if(!$)return!1;return/(?:const|let|var|function)\s+\w+/.test($)}var J9,t6,cW,iW;var M7=D(()=>{N7();F1();O0();J9=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],t6=new Set(J9),cW=new Set(["stx","@stacksjs/stx"]);iW=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var Q9={};n(Q9,{renderSlot:()=>HZ,processSlots:()=>LZ,parseSlots:()=>_Z,parseSlotElement:()=>Zw,extractSlotContent:()=>Gw,applySlots:()=>Qw});function tW(X,$){let Z=1,Y=$,J="<template",G="</template";while(Y<X.length&&Z>0){let Q=X.indexOf("<",Y);if(Q===-1)break;if(Y=Q,X.startsWith(J,Y)&&(Y+J.length>=X.length||/[\s>\/]/.test(X[Y+J.length]))){Z++,Y+=J.length;continue}if(X.startsWith(G,Y)){let q=X.indexOf(">",Y+G.length);if(q!==-1){if(Z--,Z===0)return q+1;Y=q+1;continue}}Y++}return Z===0?Y:-1}function Xw(X,$){let Z=null;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"){Z=J;continue}if(J===">")return Y+1}return-1}function $w(X){let $=[],Z=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;if(X.startsWith("<!--",G)){let z=X.indexOf("-->",G+4);J=z===-1?X.length:z+3;continue}let Q=Xw(X,G+1);if(Q===-1)break;let q=X.slice(G,Q),K=q.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!K){J=Q;continue}let U=K[1]==="/",W=K[2].toLowerCase();if(U){let z=Z.lastIndexOf(W);if(z!==-1)Z.splice(z);J=Q;continue}if(W==="template"&&Z.length===0){let z=q.match(Y);if(z){let B=tW(X,Q);if(B!==-1){let j=z[1]||z[2]||z[3];$.push({start:G,end:B,slotName:j,content:X.slice(Q,B-11).trim(),propsBinding:z[4]||void 0}),J=B;continue}}}if(!/\/\s*>$/.test(q)&&!eW.has(W)){if(Z.push(W),W==="script"||W==="style"){let z=X.toLowerCase().indexOf(`</${W}>`,Q);if(z!==-1){J=z;continue}}}J=Q}return $}function _Z(X){let $={default:"",named:new Map},Z=X,Y=$w(X);for(let K of Y)$.named.set(K.slotName,{name:K.slotName,content:K.content,propsBinding:K.propsBinding});Y.sort((K,U)=>U.start-K.start);for(let K of Y)Z=Z.slice(0,K.start)+Z.slice(K.end);let J=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[K,U,W,w,z,B]=Q,j=W.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(j+_).trim(),L=`<${U}${H?" "+H:""}>${B}</${U}>`;J.push({start:Q.index,end:Q.index+K.length,slotName:w,element:L})}let q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=q.exec(Z))!==null){let[K,U,W,w,z]=Q,B=W.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(B+j).trim(),H=`<${U}${_?" "+_:""} />`;J.push({start:Q.index,end:Q.index+K.length,slotName:w,element:H})}J.sort((K,U)=>U.start-K.start);for(let K of J){let U=$.named.get(K.slotName);if(U)U.content+=K.element;else $.named.set(K.slotName,{name:K.slotName,content:K.element});Z=Z.slice(0,K.start)+Z.slice(K.end)}return $.default=Z.trim(),$}function Zw(X){let $=X.match(/name\s*=\s*["']([^"']+)["']/),Z=$?$[1]:"",Y={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=J.exec(X))!==null)Y[G[1]]=G[2];let Q=X.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),q=Q?Q[1].trim():"";return{name:Z,props:Y,defaultContent:q}}async function HZ(X,$,Z,Y){if(!X)return Z;let J=X.content;if(X.propsBinding&&Object.keys($).length>0){let G=X.propsBinding.trim(),Q={...Y};if(G.startsWith("{")&&G.endsWith("}")){let q=G.slice(1,-1).split(",").map((K)=>K.trim()).filter(Boolean);for(let K of q){let[U,W]=K.split(":").map((z)=>z.trim()),w=W||U;if($[U]!==void 0)Q[w]=$[U]}}else Q[G]=$;J=Yw(J,Q)}return J}function Yw(X,$){return X.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,Y)=>{try{let J=Y.trim(),G=OZ(J,$);return o0(String(G??""))}catch{return`{{ ${Y} }}`}})}function OZ(X,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(X)){let Y=X.split("."),J=$;for(let G of Y)if(J&&typeof J==="object"&&G in J)J=J[G];else return;return J}let Z=X.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,Y,J,G]=Z,Q=$[Y],q=parseInt(G,10);if(typeof Q==="number")switch(J){case"+":return Q+q;case"-":return Q-q;case"*":return Q*q;case"/":return Q/q}}try{if(!G0(X))return;return Q0(X,Object.keys($))(...Object.values($))}catch{return}}async function LZ(X,$,Z){let Y=X;Y=await Jw(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,q,K,U)=>{let W=$.named.get(q),w=U?.trim()||"",z=K||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=j.exec(z))!==null){let H=_[1],L=_[2];B[H]=OZ(L,Z)}return await HZ(W,B,w,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(G,(Q,q)=>{if(Q.includes("name="))return Q;let K=q?.trim()||"";return $.default||K}),Y}async function Jw(X,$,Z){let Y=[],J=[];X.replace($,(q,...K)=>{let U=K[K.length-2];return J.push({match:q,index:U}),Y.push(Z(q,...K.slice(0,-2))),q});let G=await Promise.all(Y),Q=X;for(let q=J.length-1;q>=0;q--){let{match:K,index:U}=J[q];Q=Q.slice(0,U)+G[q]+Q.slice(U+K.length)}return Q}function Gw(X){let $=_Z(X);return{defaultSlot:$.default,namedSlots:$.named}}async function Qw(X,$,Z,Y){return await LZ(X,{default:$,named:Z},Y)}var eW;var q9=D(()=>{Z1();O0();eW=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function k1(X,$){let Z=qw(X,$);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function qw(X,$){let Z=$;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let Y=N0(X,"(",")",Z);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:X.slice(Z+1,Y),endPos:Y+1}}function Kw(X,$){let Z=X.lastIndexOf("<",$);if(Z===-1)return!1;return Z>X.lastIndexOf(">",$)}function n1(X,$,Z,Y){let J=1,G=Y,Q=new RegExp(`@${$}\\s*\\(`,"g"),q=new RegExp(`@${Z}(?![a-z])`,"g");while(G<X.length&&J>0){Q.lastIndex=G,q.lastIndex=G;let K=Q.exec(X),U=q.exec(X),W=K?K.index:1/0,w=U?U.index:1/0;if(W<w)J++,G=W+K[0].length;else if(w<1/0){if(J--,J===0)return w;G=w+U[0].length}else break}return-1}function FZ(X,$){let Z=X.slice($).match(/^@if\s*/);if(!Z)return null;let Y=$+Z[0].length,J=k1(X,Y);if(!J)return null;let G=J.endPos,Q=n1(X,"if","endif",G);if(Q===-1)return null;let q=X.slice(G,Q),K=[],U=0,W="if",w=J.expression,z=0,B=0;while(U<q.length){let j=q.indexOf("@",U);if(j===-1)break;U=j;let _=q.substring(j);if(Kw(q,j)){U++;continue}if(/^@if\s*\(/.test(_)){B++,U++;continue}if(/^@endif(?![a-z])/.test(_)){B--,U+=6;continue}if(B===0){let H=_.match(/^@elseif\s*/);if(H){K.push({type:W,condition:w,content:q.substring(z,U),start:G+z,end:G+U});let L=U+H[0].length,O=k1(q,L);if(!O){U++;continue}W="elseif",w=O.expression,U=O.endPos,z=U;continue}else if(/^@else(?![a-z])/.test(_)){K.push({type:W,condition:w,content:q.substring(z,U),start:G+z,end:G+U}),W="else",w=void 0,U+=5,z=U;continue}}U++}return K.push({type:W,condition:w,content:q.slice(z),start:G+z,end:G+q.length}),{fullMatch:X.slice($,Q+6),branches:K,start:$,end:Q+6}}function k7(X){let $=[],Z=/@if\s*\(/g,Y=Z.exec(X);while(Y!==null){if($.some((Q)=>Y.index>Q.start&&Y.index<Q.end)){Y=Z.exec(X);continue}let G=FZ(X,Y.index);if(G)$.push(G),Z.lastIndex=G.end;Y=Z.exec(X)}return $}function IX(X,$,Z){let Y=[],J=new RegExp(`@${$}\\s*\\(`,"g"),G=J.exec(X);while(G!==null){if(Y.some((_)=>G.index>_.start&&G.index<_.end)){G=J.exec(X);continue}let q=G.index,K=q+G[0].length-1,U=N0(X,"(",")",K);if(U===-1){G=J.exec(X);continue}let W=X.slice(K+1,U),w=U+1,z=n1(X,$,Z,w);if(z===-1){G=J.exec(X);continue}let B=X.slice(w,z),j=z+`@${Z}`.length;Y.push({fullMatch:X.slice(q,j),name:$,params:W,content:B,start:q,end:j}),J.lastIndex=j,G=J.exec(X)}return Y}function K9(X,$){let Z=X.slice($).match(/^@switch\s*/);if(!Z)return null;let Y=$+Z[0].length,J=k1(X,Y);if(!J)return null;let G=J.endPos,Q=n1(X,"switch","endswitch",G);if(Q===-1)return null;let q=X.slice(G,Q),K=[],U=0,W=null,w=0;while(U<q.length){let z=q.slice(U),B=z.match(/^@switch\s*\(/),j=z.match(/^@endswitch(?![a-z])/);if(B){if(w++,W)W.content+=B[0];U+=B[0].length;continue}if(j){if(w--,W)W.content+=j[0];U+=j[0].length;continue}if(w>0){if(W)W.content+=q[U];U++;continue}let _=z.match(/^@case\s*/),H=z.match(/^@default(?![a-z])/),L=z.match(/^@break(?![a-z])/);if(_&&z.startsWith("@case")){if(W)K.push(W);let O=U+_[0].length,F=k1(q,O);if(!F){U++;continue}W={type:"case",value:F.expression,content:""},U=F.endPos}else if(H&&z.startsWith("@default")){if(W)K.push(W);W={type:"default",content:""},U+=H[0].length}else if(L&&z.startsWith("@break"))U+=L[0].length;else{if(W)W.content+=q[U];U++}}if(W)K.push(W);return{fullMatch:X.slice($,Q+10),expression:J.expression,cases:K,start:$,end:Q+10}}var VZ=()=>{};var AZ=()=>{};var EX=D(()=>{VZ();AZ()});function RZ(X,$={}){return new H5(X,$).routes}var TZ=D(()=>{g1();g1()});async function MZ(X){let $=X;if(!$)try{$=(await I1())?.pagesDir||"pages"}catch{$="pages"}let Z=$,Y=NZ.get(Z);if(Y)return Y;let J=[];try{J=RZ(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{J=[]}return NZ.set(Z,J),J}var NZ;var kZ=D(()=>{TZ();V1();NZ=new Map});function zw(X){return X.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function IZ(X){return zw(JSON.stringify(X))}function DX(X){let $=0;while($<X.length){let Z=X.slice($),Y=/<body\b([^>]*)>/i.exec(Z);if(!Y)return null;let J=$+Y.index,G=-1,Q="";for(let K of jw){let U=K.open.exec(Z);if(!U)continue;let W=$+U.index;if(W<J&&(G===-1||W<G))G=W,Q=K.close}if(G===-1)return{index:J,tag:Y[0],attrs:Y[1]??""};let q=X.toLowerCase().indexOf(Q,G);if(q===-1)return null;$=q+Q.length}return null}function U9(X,$){let Z=DX(X);if(!Z)return X;return X.slice(0,Z.index)+$(Z.tag,Z.attrs)+X.slice(Z.index+Z.tag.length)}var jw;var W9=D(()=>{jw=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function E1(X){let $=X,Z=new Set,Y=new Set,J=()=>{if(g0)Y.add(g0);return $};return J.set=(G)=>{if(!Object.is(G,$)){let Q=$;if($=G,Z.forEach((q)=>q($,Q)),I7)Y.forEach((q)=>bX.add(q));else Y.forEach((q)=>q())}},J.update=(G)=>{J.set(G($))},J.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(G)=>J.set(G),configurable:!0}),J}function CX(X){let $,Z=!0,Y=new Set,J=()=>{if(!Z)if(Z=!0,I7)Y.forEach((Q)=>bX.add(Q));else Y.forEach((Q)=>Q())},G=()=>{if(g0)Y.add(g0);if(Z){let Q=g0;g0=J,yX.push(J);try{$=X()}finally{yX.pop(),g0=Q}Z=!1}return $};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function PX(X,$={}){let Z,Y=!1,J=()=>{if(Y)return;if(Z)Z(),Z=void 0;let G=g0;g0=J,yX.push(J);try{let Q=X();Z=typeof Q==="function"?Q:void 0}finally{yX.pop(),g0=G}};if($.immediate!==!1)J();return()=>{if(Y=!0,Z)Z()}}function z9(X){if(I7){X();return}I7=!0;try{X()}finally{I7=!1,bX.forEach(($)=>$()),bX.clear()}}function j9(X){w9.push(X)}function B9(X){SX.push(X)}function Bw(){EZ(w9,"onMount",SX)}function _w(){EZ(SX,"onDestroy")}function EZ(X,$,Z){let Y=X.splice(0,X.length);for(let J of Y)try{let G=J();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${$} callback threw:`,G)}}function Hw(){return{mount:w9.length,destroy:SX.length}}function vX(X){return typeof X==="function"&&X._isSignal===!0}function xX(X){return typeof X==="function"&&X._isDerived===!0}function _9(X){if(vX(X)||xX(X))return X();return X}function fX(X){let $=g0;g0=null;try{return X()}finally{g0=$}}function Ow(X,$){let Z=typeof X==="function"?X:()=>X,Y=E1([]),J=CX(()=>Y().reduce((q,K)=>$(q,K.action),Z())),G=!1;return PX(()=>{if(Z(),!G){G=!0;return}if(fX(()=>Y().length))Y.set([])}),[J,(q,K)=>{let U={action:q};Y.set([...Y(),U]);let W=()=>{let w=Y().filter((z)=>z!==U);if(w.length!==Y().length)Y.set(w)};if(K&&typeof K.then==="function")Promise.resolve(K).then(W,W);return W}]}var g0=null,yX,I7=!1,bX,w9,SX;var gX=D(()=>{yX=[],bX=new Set,w9=[],SX=[]});var yZ={};n(yZ,{useOptimistic:()=>Ow,untrack:()=>_9,state:()=>E1,runMountCallbacks:()=>Bw,runDestroyCallbacks:()=>_w,pendingLifecycleCounts:()=>Hw,peek:()=>fX,onMount:()=>j9,onDestroy:()=>B9,isSignal:()=>vX,isDerived:()=>xX,generateSignalsRuntimeDev:()=>H9,generateSignalsRuntime:()=>DZ,effect:()=>PX,derived:()=>CX,default:()=>Fw,batch:()=>z9});function DZ(){let X=Lw(H9());try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X);return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return X}}function Lw(X){let $=[],Z=0,Y="console.log(";while(Z<X.length){let J=X.indexOf(Y,Z);if(J===-1){$.push(X.slice(Z));break}$.push(X.slice(Z,J));let G=1,Q=J+Y.length;while(Q<X.length&&G>0){let q=X[Q];if(q==='"'||q==="'"||q==="`"){let K=q;Q++;while(Q<X.length&&X[Q]!==K){if(X[Q]==="\\")Q++;Q++}Q++;continue}if(q==="(")G++;else if(q===")")G--;Q++}$.push("0"),Z=Q}return $.join("")}function H9(){return`
3759
+ ${X[J]}`,J++;else break}return{value:Y,nextIndex:J}}function Kw(X,$,Z){let Y=Z,J=$+1;while(J<X.length){let G=LZ(Y);if(G!==-1){if(T0(Y,"{","}",G)!==-1)break}let Q=X[J];Y+=`
3760
+ ${Q}`,J++}return{functionCode:Y,nextIndex:J}}function UZ(X,$){let Z=$0(X,$)??$0(`(${X})`,$);if(Z!==void 0)return Z;if(!/\bprocess\b/.test(X))return;let Y={...$,process:Object.freeze({env:{...I5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${X});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${X};`)(...Object.values(Y))}catch{return}}}async function Uw(X,$,Z){let Y=X.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of Y){let[,,Q,q]=G;try{let K=q.trim().replace(/;$/,""),U=UZ(K,$);if(U!==void 0)$[Q]=U}catch(K){console.warn(`Failed to parse export ${Q} in fallback:`,K)}}let J=X.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of J){let[,,Q,q]=G;if(!(Q in $))try{let K=q.trim().replace(/;$/,""),U=UZ(K,$);if(U!==void 0)$[Q]=U}catch{}}}function FZ(X){let $=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=$?$[1]:"",Y=$?X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):X;return{scriptContent:Z,templateWithoutScript:Y}}function VZ(X){let $=X.trim();if(!$)return!1;return/(?:const|let|var|function)\s+\w+/.test($)}var J9,JZ,Zw,Jw;var k7=E(()=>{M7();F1();O0();J9=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],JZ=new Set(J9),Zw=new Set(["stx","@stacksjs/stx"]);Jw=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var Q9={};n(Q9,{renderSlot:()=>RZ,processSlots:()=>TZ,parseSlots:()=>AZ,parseSlotElement:()=>Bw,extractSlotContent:()=>Ow,applySlots:()=>Lw});function Ww(X,$){let Z=1,Y=$,J="<template",G="</template";while(Y<X.length&&Z>0){let Q=X.indexOf("<",Y);if(Q===-1)break;if(Y=Q,X.startsWith(J,Y)&&(Y+J.length>=X.length||/[\s>\/]/.test(X[Y+J.length]))){Z++,Y+=J.length;continue}if(X.startsWith(G,Y)){let q=X.indexOf(">",Y+G.length);if(q!==-1){if(Z--,Z===0)return q+1;Y=q+1;continue}}Y++}return Z===0?Y:-1}function zw(X,$){let Z=null;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"){Z=J;continue}if(J===">")return Y+1}return-1}function jw(X){let $=[],Z=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;if(X.startsWith("<!--",G)){let z=X.indexOf("-->",G+4);J=z===-1?X.length:z+3;continue}let Q=zw(X,G+1);if(Q===-1)break;let q=X.slice(G,Q),K=q.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!K){J=Q;continue}let U=K[1]==="/",W=K[2].toLowerCase();if(U){let z=Z.lastIndexOf(W);if(z!==-1)Z.splice(z);J=Q;continue}if(W==="template"&&Z.length===0){let z=q.match(Y);if(z){let B=Ww(X,Q);if(B!==-1){let j=z[1]||z[2]||z[3];$.push({start:G,end:B,slotName:j,content:X.slice(Q,B-11).trim(),propsBinding:z[4]||void 0}),J=B;continue}}}if(!/\/\s*>$/.test(q)&&!ww.has(W)){if(Z.push(W),W==="script"||W==="style"){let z=X.toLowerCase().indexOf(`</${W}>`,Q);if(z!==-1){J=z;continue}}}J=Q}return $}function AZ(X){let $={default:"",named:new Map},Z=X,Y=jw(X);for(let K of Y)$.named.set(K.slotName,{name:K.slotName,content:K.content,propsBinding:K.propsBinding});Y.sort((K,U)=>U.start-K.start);for(let K of Y)Z=Z.slice(0,K.start)+Z.slice(K.end);let J=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[K,U,W,w,z,B]=Q,j=W.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(j+_).trim(),L=`<${U}${H?" "+H:""}>${B}</${U}>`;J.push({start:Q.index,end:Q.index+K.length,slotName:w,element:L})}let q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=q.exec(Z))!==null){let[K,U,W,w,z]=Q,B=W.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(B+j).trim(),H=`<${U}${_?" "+_:""} />`;J.push({start:Q.index,end:Q.index+K.length,slotName:w,element:H})}J.sort((K,U)=>U.start-K.start);for(let K of J){let U=$.named.get(K.slotName);if(U)U.content+=K.element;else $.named.set(K.slotName,{name:K.slotName,content:K.element});Z=Z.slice(0,K.start)+Z.slice(K.end)}return $.default=Z.trim(),$}function Bw(X){let $=X.match(/name\s*=\s*["']([^"']+)["']/),Z=$?$[1]:"",Y={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=J.exec(X))!==null)Y[G[1]]=G[2];let Q=X.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),q=Q?Q[1].trim():"";return{name:Z,props:Y,defaultContent:q}}async function RZ(X,$,Z,Y){if(!X)return Z;let J=X.content;if(X.propsBinding&&Object.keys($).length>0){let G=X.propsBinding.trim(),Q={...Y};if(G.startsWith("{")&&G.endsWith("}")){let q=G.slice(1,-1).split(",").map((K)=>K.trim()).filter(Boolean);for(let K of q){let[U,W]=K.split(":").map((z)=>z.trim()),w=W||U;if($[U]!==void 0)Q[w]=$[U]}}else Q[G]=$;J=_w(J,Q)}return J}function _w(X,$){return X.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,Y)=>{try{let J=Y.trim(),G=NZ(J,$);return r0(String(G??""))}catch{return`{{ ${Y} }}`}})}function NZ(X,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(X)){let Y=X.split("."),J=$;for(let G of Y)if(J&&typeof J==="object"&&G in J)J=J[G];else return;return J}let Z=X.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,Y,J,G]=Z,Q=$[Y],q=parseInt(G,10);if(typeof Q==="number")switch(J){case"+":return Q+q;case"-":return Q-q;case"*":return Q*q;case"/":return Q/q}}try{if(!G0(X))return;return Q0(X,Object.keys($))(...Object.values($))}catch{return}}async function TZ(X,$,Z){let Y=X;Y=await Hw(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,q,K,U)=>{let W=$.named.get(q),w=U?.trim()||"",z=K||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=j.exec(z))!==null){let H=_[1],L=_[2];B[H]=NZ(L,Z)}return await RZ(W,B,w,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(G,(Q,q)=>{if(Q.includes("name="))return Q;let K=q?.trim()||"";return $.default||K}),Y}async function Hw(X,$,Z){let Y=[],J=[];X.replace($,(q,...K)=>{let U=K[K.length-2];return J.push({match:q,index:U}),Y.push(Z(q,...K.slice(0,-2))),q});let G=await Promise.all(Y),Q=X;for(let q=J.length-1;q>=0;q--){let{match:K,index:U}=J[q];Q=Q.slice(0,U)+G[q]+Q.slice(U+K.length)}return Q}function Ow(X){let $=AZ(X);return{defaultSlot:$.default,namedSlots:$.named}}async function Lw(X,$,Z,Y){return await TZ(X,{default:$,named:Z},Y)}var ww;var q9=E(()=>{Z1();O0();ww=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function k1(X,$){let Z=Fw(X,$);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function Fw(X,$){let Z=$;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let Y=T0(X,"(",")",Z);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:X.slice(Z+1,Y),endPos:Y+1}}function Vw(X,$){let Z=X.lastIndexOf("<",$);if(Z===-1)return!1;return Z>X.lastIndexOf(">",$)}function n1(X,$,Z,Y){let J=1,G=Y,Q=new RegExp(`@${$}\\s*\\(`,"g"),q=new RegExp(`@${Z}(?![a-z])`,"g");while(G<X.length&&J>0){Q.lastIndex=G,q.lastIndex=G;let K=Q.exec(X),U=q.exec(X),W=K?K.index:1/0,w=U?U.index:1/0;if(W<w)J++,G=W+K[0].length;else if(w<1/0){if(J--,J===0)return w;G=w+U[0].length}else break}return-1}function MZ(X,$){let Z=X.slice($).match(/^@if\s*/);if(!Z)return null;let Y=$+Z[0].length,J=k1(X,Y);if(!J)return null;let G=J.endPos,Q=n1(X,"if","endif",G);if(Q===-1)return null;let q=X.slice(G,Q),K=[],U=0,W="if",w=J.expression,z=0,B=0;while(U<q.length){let j=q.indexOf("@",U);if(j===-1)break;U=j;let _=q.substring(j);if(Vw(q,j)){U++;continue}if(/^@if\s*\(/.test(_)){B++,U++;continue}if(/^@endif(?![a-z])/.test(_)){B--,U+=6;continue}if(B===0){let H=_.match(/^@elseif\s*/);if(H){K.push({type:W,condition:w,content:q.substring(z,U),start:G+z,end:G+U});let L=U+H[0].length,O=k1(q,L);if(!O){U++;continue}W="elseif",w=O.expression,U=O.endPos,z=U;continue}else if(/^@else(?![a-z])/.test(_)){K.push({type:W,condition:w,content:q.substring(z,U),start:G+z,end:G+U}),W="else",w=void 0,U+=5,z=U;continue}}U++}return K.push({type:W,condition:w,content:q.slice(z),start:G+z,end:G+q.length}),{fullMatch:X.slice($,Q+6),branches:K,start:$,end:Q+6}}function I7(X){let $=[],Z=/@if\s*\(/g,Y=Z.exec(X);while(Y!==null){if($.some((Q)=>Y.index>Q.start&&Y.index<Q.end)){Y=Z.exec(X);continue}let G=MZ(X,Y.index);if(G)$.push(G),Z.lastIndex=G.end;Y=Z.exec(X)}return $}function EX(X,$,Z){let Y=[],J=new RegExp(`@${$}\\s*\\(`,"g"),G=J.exec(X);while(G!==null){if(Y.some((_)=>G.index>_.start&&G.index<_.end)){G=J.exec(X);continue}let q=G.index,K=q+G[0].length-1,U=T0(X,"(",")",K);if(U===-1){G=J.exec(X);continue}let W=X.slice(K+1,U),w=U+1,z=n1(X,$,Z,w);if(z===-1){G=J.exec(X);continue}let B=X.slice(w,z),j=z+`@${Z}`.length;Y.push({fullMatch:X.slice(q,j),name:$,params:W,content:B,start:q,end:j}),J.lastIndex=j,G=J.exec(X)}return Y}function K9(X,$){let Z=X.slice($).match(/^@switch\s*/);if(!Z)return null;let Y=$+Z[0].length,J=k1(X,Y);if(!J)return null;let G=J.endPos,Q=n1(X,"switch","endswitch",G);if(Q===-1)return null;let q=X.slice(G,Q),K=[],U=0,W=null,w=0;while(U<q.length){let z=q.slice(U),B=z.match(/^@switch\s*\(/),j=z.match(/^@endswitch(?![a-z])/);if(B){if(w++,W)W.content+=B[0];U+=B[0].length;continue}if(j){if(w--,W)W.content+=j[0];U+=j[0].length;continue}if(w>0){if(W)W.content+=q[U];U++;continue}let _=z.match(/^@case\s*/),H=z.match(/^@default(?![a-z])/),L=z.match(/^@break(?![a-z])/);if(_&&z.startsWith("@case")){if(W)K.push(W);let O=U+_[0].length,F=k1(q,O);if(!F){U++;continue}W={type:"case",value:F.expression,content:""},U=F.endPos}else if(H&&z.startsWith("@default")){if(W)K.push(W);W={type:"default",content:""},U+=H[0].length}else if(L&&z.startsWith("@break"))U+=L[0].length;else{if(W)W.content+=q[U];U++}}if(W)K.push(W);return{fullMatch:X.slice($,Q+10),expression:J.expression,cases:K,start:$,end:Q+10}}var kZ=()=>{};var IZ=()=>{};var DX=E(()=>{kZ();IZ()});function EZ(X,$={}){return new O5(X,$).routes}var DZ=E(()=>{g1();g1()});async function bZ(X){let $=X;if(!$)try{$=(await I1())?.pagesDir||"pages"}catch{$="pages"}let Z=$,Y=yZ.get(Z);if(Y)return Y;let J=[];try{J=EZ(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{J=[]}return yZ.set(Z,J),J}var yZ;var SZ=E(()=>{DZ();V1();yZ=new Map});function Tw(X){return X.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function CZ(X){return Tw(JSON.stringify(X))}function E7(X){let $=0,Z,Y=U9.map(()=>{return});while($<X.length){if(Z===void 0||Z!==null&&Z.index<$)PZ.lastIndex=$,Z=PZ.exec(X);if(!Z)return null;let J=Z.index,G=-1,Q=null;for(let K=0;K<U9.length;K++){let U=U9[K],W=Y[K];if(W===void 0||W!==null&&W.index<$)U.open.lastIndex=$,W=U.open.exec(X),Y[K]=W;if(!W)continue;if(W.index<J&&(G===-1||W.index<G))G=W.index,Q=U.close}if(G===-1||!Q)return{index:J,tag:Z[0],attrs:Z[1]??""};Q.lastIndex=G;let q=Q.exec(X);if(!q)return null;$=q.index+q[0].length}return null}function yX(X,$){let Z=E7(X);if(!Z)return X;return X.slice(0,Z.index)+$(Z.tag,Z.attrs)+X.slice(Z.index+Z.tag.length)}var U9,PZ;var W9=E(()=>{U9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],PZ=/<body\b([^>]*)>/gi});function z9(){return r1}function j9(X){let $=r1;return vZ.push(X),r1=X,$}function B9(X){vZ.pop(),r1=X}function _9(){return bX>0}function H9(X){w9.add(X)}function xZ(X){bX++;try{X()}finally{if(bX--,bX===0){let $=[...w9];w9.clear();for(let Z of $)Z()}}}function fZ(X){let $=r1;r1=null;try{return X()}finally{r1=$}}var r1=null,vZ,bX=0,w9;var gZ=E(()=>{vZ=[],w9=new Set});function E1(X){let $=X,Z=new Set,Y=new Set,J=()=>{let G=z9();if(G)Y.add(G);return $};return J.set=(G)=>{if(!Object.is(G,$)){let Q=$;if($=G,Z.forEach((q)=>q($,Q)),_9())Y.forEach((q)=>H9(q));else Y.forEach((q)=>q())}},J.update=(G)=>{J.set(G($))},J.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(G)=>J.set(G),configurable:!0}),J}function CX(X){let $,Z=!0,Y=new Set,J=()=>{if(!Z)if(Z=!0,_9())Y.forEach((Q)=>H9(Q));else Y.forEach((Q)=>Q())},G=()=>{let Q=z9();if(Q)Y.add(Q);if(Z){let q=j9(J);try{$=X()}finally{B9(q)}Z=!1}return $};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function PX(X,$={}){let Z,Y=!1,J=()=>{if(Y)return;if(Z)Z(),Z=void 0;let G=j9(J);try{let Q=X();Z=typeof Q==="function"?Q:void 0}finally{B9(G)}};if($.immediate!==!1)J();return()=>{if(Y=!0,Z)Z()}}function L9(X){xZ(X)}function F9(X){O9.push(X)}function V9(X){SX.push(X)}function Mw(){hZ(O9,"onMount",SX)}function kw(){hZ(SX,"onDestroy")}function hZ(X,$,Z){let Y=X.splice(0,X.length);for(let J of Y)try{let G=J();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${$} callback threw:`,G)}}function Iw(){return{mount:O9.length,destroy:SX.length}}function vX(X){return typeof X==="function"&&X._isSignal===!0}function xX(X){return typeof X==="function"&&X._isDerived===!0}function A9(X){if(vX(X)||xX(X))return X();return X}function fX(X){return fZ(X)}function Ew(X,$){let Z=typeof X==="function"?X:()=>X,Y=E1([]),J=CX(()=>Y().reduce((q,K)=>$(q,K.action),Z())),G=!1;return PX(()=>{if(Z(),!G){G=!0;return}if(fX(()=>Y().length))Y.set([])}),[J,(q,K)=>{let U={action:q};Y.set([...Y(),U]);let W=()=>{let w=Y().filter((z)=>z!==U);if(w.length!==Y().length)Y.set(w)};if(K&&typeof K.then==="function")Promise.resolve(K).then(W,W);return W}]}var O9,SX;var gX=E(()=>{gZ();O9=[],SX=[]});var dZ={};n(dZ,{useOptimistic:()=>Ew,untrack:()=>A9,state:()=>E1,runMountCallbacks:()=>Mw,runDestroyCallbacks:()=>kw,pendingLifecycleCounts:()=>Iw,peek:()=>fX,onMount:()=>F9,onDestroy:()=>V9,isSignal:()=>vX,isDerived:()=>xX,generateSignalsRuntimeDev:()=>R9,generateSignalsRuntime:()=>uZ,effect:()=>PX,derived:()=>CX,default:()=>yw,batch:()=>L9});function uZ(){let X=Dw(R9());try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X);return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return X}}function Dw(X){let $=[],Z=0,Y="console.log(";while(Z<X.length){let J=X.indexOf(Y,Z);if(J===-1){$.push(X.slice(Z));break}$.push(X.slice(Z,J));let G=1,Q=J+Y.length;while(Q<X.length&&G>0){let q=X[Q];if(q==='"'||q==="'"||q==="`"){let K=q;Q++;while(Q<X.length&&X[Q]!==K){if(X[Q]==="\\")Q++;Q++}Q++;continue}if(q==="(")G++;else if(q===")")G--;Q++}$.push("0"),Z=Q}return $.join("")}function R9(){return`
3761
3761
  // STX Signals Runtime (Development Build)
3762
3762
  console.log('[stx] signals runtime loading');
3763
3763
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -6307,7 +6307,7 @@ catch (e2) {
6307
6307
  // :attr still works for backward compat but is reserved for structural directives.
6308
6308
  // x-text, x-html, x-model, x-show, x-if, x-for, x-cloak, x-ref, x-data are
6309
6309
  // handled by their own code paths below \u2014 exclude them here.
6310
- var X_HANDLED = ${r2()};
6310
+ var X_HANDLED = ${$6()};
6311
6311
  if (name.startsWith('@bind:') || name.startsWith('x-bind:')
6312
6312
  || (name.startsWith(':') && !name.startsWith('::') && !DIRECTIVE_NAMES[name.slice(1).split('.')[0]] && !EVENT_RE.test(name.slice(1)))
6313
6313
  || (name.startsWith('x-') && !X_HANDLED[name.split('.')[0]] && !X_HANDLED[name])) {
@@ -9345,6 +9345,36 @@ catch (e) {} }
9345
9345
  }, 300);
9346
9346
  }
9347
9347
 
9348
+ /*
9349
+ * Is the APP in dark mode, not just the OS?
9350
+ *
9351
+ * stx's own color-mode boot writes a class (default 'dark') and/or an
9352
+ * attribute (data-theme / data-color-mode) onto <html>, so an app pinned to
9353
+ * light on a dark OS must not get a dark overlay over a light page. An
9354
+ * explicit override wins over both, and the media query is the last resort.
9355
+ *
9356
+ * One function rather than the resolution inlined per surface. #1875 fixed
9357
+ * this at the two dialog call sites, and toast kept the OS-only version and
9358
+ * shipped the exact bug #1875 describes; that is what a per-call-site fix
9359
+ * costs. See #1912.
9360
+ */
9361
+ function _resolveDark(override) {
9362
+ if (override != null)
9363
+ return !!override;
9364
+
9365
+ var root = document.documentElement;
9366
+ if (root.classList.contains('dark'))
9367
+ return true;
9368
+
9369
+ var attr = root.getAttribute('data-theme') || root.getAttribute('data-color-mode');
9370
+ if (attr === 'dark')
9371
+ return true;
9372
+ if (attr === 'light')
9373
+ return false;
9374
+
9375
+ return !!(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
9376
+ }
9377
+
9348
9378
  function addToast(type, message, options) {
9349
9379
  var container = _getToastContainer();
9350
9380
  if (!container) {
@@ -9356,6 +9386,26 @@ catch (e) {} }
9356
9386
  var id = ++_toastId;
9357
9387
  var maxToasts = parseInt(container.getAttribute('data-stx-toast-max') || '5', 10);
9358
9388
 
9389
+ /*
9390
+ * A semantic id replaces its own toast in place (stacksjs/stx#1913).
9391
+ *
9392
+ * Without it, a persistent 'Publishing...' toast and the call that clears
9393
+ * it on completion have to thread the numeric return value between two
9394
+ * different functions by hand, which is the state management the primitive
9395
+ * exists to remove. With an id of 'publish' the second call simply replaces
9396
+ * the first, and toast.dismiss('publish') ends it.
9397
+ */
9398
+ var key = opts.id != null ? String(opts.id) : '';
9399
+ if (key) {
9400
+ var prior = container.querySelector('[data-stx-toast-key="' + key.replace(/"/g, '') + '"]');
9401
+ // Removed outright rather than through removeToast, which animates for
9402
+ // 300ms first. This is a REPLACEMENT, not a dismissal: animating the old
9403
+ // one out while the new one animates in shows both at once, in the same
9404
+ // slot, which is exactly the flicker a keyed toast exists to avoid.
9405
+ if (prior && prior.parentNode)
9406
+ prior.parentNode.removeChild(prior);
9407
+ }
9408
+
9359
9409
  // Enforce max toasts \u2014 remove oldest
9360
9410
  var existing = container.querySelectorAll('[data-stx-toast]');
9361
9411
  while (existing.length >= maxToasts && existing.length > 0) {
@@ -9367,7 +9417,7 @@ catch (e) {} }
9367
9417
  var anims = _getToastAnimClass(container);
9368
9418
  var borderColor = _toastColors[type] || _toastColors.info;
9369
9419
  var icon = _toastIcons[type] || _toastIcons.info;
9370
- var isDark = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches;
9420
+ var isDark = _resolveDark(opts.dark);
9371
9421
  var bg = isDark ? '#1f2937' : '#ffffff';
9372
9422
  var textColor = isDark ? '#f3f4f6' : '#1f2937';
9373
9423
  var shadow = isDark ? '0 4px 12px rgba(0,0,0,0.4)' : '0 4px 12px rgba(0,0,0,0.15)';
@@ -9375,6 +9425,8 @@ catch (e) {} }
9375
9425
  var el = document.createElement('div');
9376
9426
  el.id = 'stx-toast-' + id;
9377
9427
  el.setAttribute('data-stx-toast', String(id));
9428
+ if (key)
9429
+ el.setAttribute('data-stx-toast-key', key);
9378
9430
  el.setAttribute('role', 'alert');
9379
9431
  el.setAttribute('aria-live', 'assertive');
9380
9432
  el.style.cssText = 'pointer-events:auto;display:flex;align-items:flex-start;gap:0.75rem;padding:0.875rem 1rem;border-radius:0.5rem;border-left:4px solid ' + borderColor + ';background:' + bg + ';color:' + textColor + ';box-shadow:' + shadow + ';animation:' + anims.inAnim + ' 0.3s ease;font-family:system-ui,-apple-system,sans-serif;font-size:0.875rem;line-height:1.4;max-width:100%';
@@ -9383,9 +9435,32 @@ catch (e) {} }
9383
9435
  iconSpan.style.cssText = 'flex-shrink:0;display:flex;align-items:center;margin-top:1px';
9384
9436
  iconSpan.innerHTML = icon;
9385
9437
 
9386
- var msgSpan = document.createElement('span');
9438
+ /*
9439
+ * Title above message, when one is given (#1913).
9440
+ *
9441
+ * Collapsing the two into one string loses the hierarchy that makes a toast
9442
+ * scannable, and every one of the 16 call sites in the reporting app passed
9443
+ * a title. A wrapper is used only when there IS a title, so the untitled
9444
+ * shape renders exactly as it did.
9445
+ */
9446
+ var msgSpan = document.createElement(opts.title ? 'div' : 'span');
9387
9447
  msgSpan.style.cssText = 'flex:1;word-wrap:break-word';
9388
- msgSpan.textContent = message;
9448
+
9449
+ if (opts.title) {
9450
+ var titleEl = document.createElement('div');
9451
+ titleEl.setAttribute('data-stx-toast-title', '');
9452
+ titleEl.style.cssText = 'font-weight:600;margin-bottom:0.125rem';
9453
+ titleEl.textContent = opts.title;
9454
+ msgSpan.appendChild(titleEl);
9455
+
9456
+ var bodyEl = document.createElement('div');
9457
+ bodyEl.style.cssText = 'opacity:0.9';
9458
+ bodyEl.textContent = message;
9459
+ msgSpan.appendChild(bodyEl);
9460
+ }
9461
+ else {
9462
+ msgSpan.textContent = message;
9463
+ }
9389
9464
 
9390
9465
  var closeBtn = document.createElement('button');
9391
9466
  closeBtn.type = 'button';
@@ -9412,7 +9487,20 @@ catch (e) {} }
9412
9487
  info: function(message, options) { return addToast('info', message, options); },
9413
9488
  warning: function(message, options) { return addToast('warning', message, options); },
9414
9489
  dismiss: function(id) {
9415
- if (id !== undefined) { removeToast(id); return; }
9490
+ if (id !== undefined) {
9491
+ // A string id is the semantic key the caller passed; a number is the
9492
+ // handle addToast returned. Both dismiss, so a caller does not have to
9493
+ // know which kind it is holding (#1913).
9494
+ if (typeof id === 'string') {
9495
+ var c = _getToastContainer();
9496
+ var match = c && c.querySelector('[data-stx-toast-key="' + id.replace(/"/g, '') + '"]');
9497
+ if (match)
9498
+ removeToast(match.getAttribute('data-stx-toast'));
9499
+ return;
9500
+ }
9501
+ removeToast(id);
9502
+ return;
9503
+ }
9416
9504
  var container = _getToastContainer();
9417
9505
  if (!container) return;
9418
9506
  var all = container.querySelectorAll('[data-stx-toast]');
@@ -9490,17 +9578,7 @@ catch (e) {} }
9490
9578
  // (e.g. data-theme) onto <html>, so an app pinned to light on a dark OS used
9491
9579
  // to get a dark dialog over a light page. An explicit opts.dark wins over
9492
9580
  // both, and the media query stays as the last resort. See #1875.
9493
- var _root = document.documentElement;
9494
- var _attrTheme = _root.getAttribute('data-theme') || _root.getAttribute('data-color-mode');
9495
- var isDark = opts.dark != null
9496
- ? !!opts.dark
9497
- : _root.classList.contains('dark')
9498
- ? true
9499
- : _attrTheme === 'dark'
9500
- ? true
9501
- : _attrTheme === 'light'
9502
- ? false
9503
- : !!(window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches);
9581
+ var isDark = _resolveDark(opts.dark);
9504
9582
  var bg = isDark ? '#1f2937' : '#ffffff';
9505
9583
  var textColor = isDark ? '#f3f4f6' : '#1f2937';
9506
9584
  var subColor = isDark ? '#9ca3af' : '#6b7280';
@@ -11518,45 +11596,40 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
11518
11596
  }
11519
11597
  }
11520
11598
  })();
11521
- `}var Fw;var bZ=D(()=>{gX();X1();gX();Fw={state:E1,derived:CX,effect:PX,batch:z9,onMount:j9,onDestroy:B9,isSignal:vX,isDerived:xX,untrack:_9,peek:fX,generateSignalsRuntime:DZ,generateSignalsRuntimeDev:H9}});var O9={};n(O9,{templateCache:()=>SZ,readFileCached:()=>Vw,invalidateFileCacheByDir:()=>Rw,invalidateFileCache:()=>Aw,hashFilePath:()=>E7,getCachedSignalsRuntime:()=>Mw,getCachedRouterScript:()=>kw,clearDevCaches:()=>Iw,checkCache:()=>Ew,cacheTemplate:()=>Dw,__setSignalsGeneratorsForTest:()=>Nw});import D1 from"fs";import I5 from"path";async function Vw(X){let Z;for(let Y=0;Y<3;Y++)try{let G=(await D1.promises.stat(X)).mtime.getTime(),Q=r1.get(X);if(Q&&Q.mtime===G)return Q.content;let q=await Bun.file(X).text(),U=(await D1.promises.stat(X)).mtime.getTime();if(U!==G)continue;return r1.set(X,{content:q,mtime:U}),q}catch(J){Z=J;break}throw r1.delete(X),Error(`File not found: ${X}${Z?` (${Z.message})`:""}`)}function Aw(X){r1.delete(X)}function Rw(X){for(let $ of r1.keys())if($.startsWith(X))r1.delete($)}function Nw(X){CZ=X}async function Mw(X=!1){let $=CZ??await Promise.resolve().then(() => (bZ(),yZ));if(X)return $.generateSignalsRuntimeDev();if(hX===null)hX=$.generateSignalsRuntime();return hX}async function kw(){if(uX===null){let{getRouterScript:X}=await Promise.resolve().then(() => (g1(),x2));uX=X()}return uX}function Iw(){r1.clear(),vZ(),hX=null,Tw=null,uX=null}function PZ(X){let $={debug:X.debug===!0,middleware:(X.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:(X.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify($)).digest("hex")}async function Ew(X,$){try{if(!$.cachePath)return null;let Z=I5.resolve($.cachePath),Y=I5.join(Z,`${E7(X)}.html`),J=I5.join(Z,`${E7(X)}.meta.json`);if(!await p(Y)||!await p(J))return null;let G=await Bun.file(J).text(),Q=JSON.parse(G);if(Q.cacheVersion!==$.cacheVersion)return null;if(Q.optionsSignature!==PZ($))return null;if((await D1.promises.stat(X)).mtime.getTime()>Q.mtime)return null;for(let K of Q.dependencies)if(await p(K)){if((await D1.promises.stat(K)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(Y).text()}catch(Z){return console.warn(`Cache error for ${X}:`,Z),null}}async function Dw(X,$,Z,Y){try{if(!Y.cachePath)return;let J=I5.resolve(Y.cachePath);await D1.promises.mkdir(J,{recursive:!0});let G=I5.join(J,`${E7(X)}.html`),Q=I5.join(J,`${E7(X)}.meta.json`),q=await D1.promises.stat(X);await Bun.write(G,$);let K={sourcePath:X,mtime:q.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:Y.cacheVersion,optionsSignature:PZ(Y),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(K,null,2)),SZ.set(X,{output:$,mtime:q.mtime.getTime(),dependencies:Z})}catch(J){console.warn(`Failed to cache template ${X}:`,J)}}function E7(X){return new Bun.CryptoHasher("sha1").update(X).digest("hex").substring(0,yw)}var SZ,r1,hX=null,Tw=null,CZ=null,uX=null,yw=16;var L9=D(()=>{A0();SZ=new Map,r1=new Map});function xZ(X){return X.includes("data-stx-runtime")}function fZ(X){let $=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=$.exec(X);Z!==null;Z=$.exec(X)){let Y=X.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}async function dX(X,$){if(X.includes("data-stx-runtime")||X.includes("window.stx.state")||X.includes("STX Signals Runtime"))return X;if($.buildMode==="serve"){let q=X.indexOf("<script");if(q!==-1)return X.slice(0,q)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
11522
- `+X.slice(q);if(X.includes("</head>")){let K=X.indexOf("</head>");return X.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
11523
- `+X.slice(K)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
11524
- `+X}if($.buildMode==="compile"){let q=X.indexOf("<script");if(q!==-1)return X.slice(0,q)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
11525
- `+X.slice(q);if(X.includes("</head>")){let K=X.indexOf("</head>");return X.slice(0,K)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
11526
- `+X.slice(K)}return`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
11527
- `+X}let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (L9(),O9)),J=`<script data-stx-scoped data-stx-runtime>${await Z($.debug)}</script>`,G=X.indexOf("<script");if(G!==-1)return X.slice(0,G)+J+`
11528
- `+X.slice(G);if(X.includes("</head>")){let Q=X.indexOf("</head>");return X.slice(0,Q)+J+`
11529
- `+X.slice(Q)}if(X.includes("<body")){let Q=X.indexOf("<body"),q=X.indexOf(">",Q);return X.slice(0,q+1)+`
11530
- `+J+X.slice(q+1)}return J+`
11531
- `+X}async function gZ(X,$){if(!X.includes("</body>"))return X;if(X.includes("data-stx-router")||X.includes("__stxRouter)return")||X.includes("__stxRouter=true"))return X;let Z=$?.router,Y="";{let q={};if(Z){if(Z.container)q.container=Z.container;if(Z.interceptAllLinks!==void 0)q.interceptAllLinks=Z.interceptAllLinks;if(Z.progress!==void 0)q.progress=Z.progress;if(Z.viewTransitions!==void 0)q.viewTransitions=Z.viewTransitions;if(Z.viewTransitionDuration!==void 0)q.viewTransitionDuration=Z.viewTransitionDuration;if(Z.viewTransitionEasing!==void 0)q.viewTransitionEasing=Z.viewTransitionEasing;if(Z.scrollToTop!==void 0)q.scrollToTop=Z.scrollToTop;if(Z.prefetch!==void 0)q.prefetch=Z.prefetch;if(Z.cache!==void 0)q.cache=Z.cache;if(Z.progressColor!==void 0)q.progressColor=Z.progressColor;if(Z.progressHeight!==void 0)q.progressHeight=Z.progressHeight}try{let K=await MZ($?.pagesDir);if(K.length>0)q.ownedRoutes=K}catch{}if(Object.keys(q).length>0)Y=`<script>window.__stxRouterConfig=${IZ(q)};</script>
11532
- `}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (L9(),O9)),G=$?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':$?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await J()}</script>`,Q=X.lastIndexOf("</body>");return X.slice(0,Q)+Y+G+`
11533
- </body>`+X.slice(Q+7)}var mX=D(()=>{kZ();W9()});var iX={};n(iX,{scanScriptTags:()=>pZ,rewriteStxImportSpecifiers:()=>oZ,processSignals:()=>T9,processScriptSetup:()=>nZ,preEvalLiteralReactiveIfs:()=>A9,parseLoopExpression:()=>iZ,hasSignalsSyntax:()=>pX,findMarkupIndexOutsideScripts:()=>cX,extractExports:()=>rZ,convertSignalLoopsToAttributes:()=>R9,convertSignalDirectivesToAttributes:()=>V9});function pZ(X,$={}){let Z=[];for(let Y of r$(X,A1)){let J=Y.token.match(/^<script\b([^>]*)>/i),G=Y.token.match(/<\/script\s*>$/i);if(!J||!G)continue;let Q=J[1];if($.skipAttrs){if($.skipAttrs.lastIndex=0,$.skipAttrs.test(Q))continue}let q=J[0].length,K=Y.token.length-G[0].length;Z.push({fullMatch:Y.token,attrs:Q,body:Y.token.slice(q,K),start:Y.start,end:Y.end})}return Z}function iZ(X){let $=X.trim(),Z=$.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let J=Z[1].trim(),G=Z[2].trim(),{itemVar:Q,indexVar:q}=uZ(G);if(Q)return{style:"as",iterable:J,itemVar:Q,indexVar:q}}let Y=$.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let J=Y[1].trim(),G=Y[2].trim(),{itemVar:Q,indexVar:q}=uZ(J);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function uZ(X){let $=X.trim(),Z=$.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let Y=$.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let J=$.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let G=$.match(/^(\w+)$/);if(G)return{itemVar:G[1],indexVar:null};return{itemVar:null,indexVar:null}}function pX(X){return p2(X)}function Sw(X){let $=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,Y;while((Y=$.exec(X))!==null){let J=Y[1];if(J.startsWith("if"))Z++;else if(J==="endif")Z--;else if(Z===0)return!0}return!1}function Cw(X){let $=new Set,Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=Z.exec(X))!==null){let G=J[1],Q;while((Q=Y.exec(G))!==null)$.add(Q[1])}return $}function Pw(X){return X.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function mZ(X,$,Z){if(!X)return!1;let Y=Pw(X),J=!1,G=!1,Q=!1,q=/([a-zA-Z_$][\w$]*)/g,K;while((K=q.exec(Y))!==null){let z=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(dZ.has(z))continue;if($.has(z))J=!0;else if(Z&&z in Z)G=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,W;while((W=U.exec(Y))!==null){let z=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(dZ.has(z)||Z&&z in Z)continue;Q=!0}return(J||Q)&&!G}function lX(X,$,Z){let Y=Z===void 0?` ${$}`:` ${$}="${Z.replace(/"/g,"&quot;")}"`,J=X.trim(),G=J.match(cZ);if(G&&vw(G[3],G[1])){let[,Q,q,K]=G;return`<${Q}${q}${Y}>${K}</${Q}>`}return`<template${Y}>${J}</template>`}function vw(X,$){let Z=new RegExp(`<(/)?${$}(?=[\\s/>])`,"gi"),Y=0,J;while((J=Z.exec(X))!==null)if(J[1]){if(Y--,Y<0)return!1}else Y++;return!0}function V9(X,$){let Z=Cw(X);function Y(J){let G=J,Q=/@if\s*\(/g,q,K=[];while((q=Q.exec(G))!==null){let U=q.index,W=U+q[0].length,w=1,z=W;while(z<G.length&&w>0){if(G[z]==="(")w++;else if(G[z]===")")w--;z++}if(w!==0)continue;let B=G.substring(W,z-1).trim(),j=z,_=1,H=j,L=/@(if\s*\(|endif)/g;L.lastIndex=j;let O;while((O=L.exec(G))!==null)if(O[1].startsWith("if"))_++;else if(O[1]==="endif"){if(_--,_===0){H=O.index+O[0].length;break}}if(_!==0)continue;let F=G.substring(j,H-6).trim(),V;if(Sw(F)){let A=k7(G.substring(U,H));if(A.length===0)continue;let R=A[0].branches.filter((k)=>k.type!=="else");if(!(R.length>0&&R.every((k)=>mZ(k.condition,Z,$))))continue;V=A[0].branches.map((k)=>{let M=Y(k.content);if(k.type==="elseif")return lX(M,"@else-if",k.condition??"");if(k.type==="else")return lX(M,"@else");return lX(M,"@if",k.condition??"")}).join(`
11534
- `)}else{if(!mZ(B,Z,$))continue;V=lX(Y(F),"@if",B)}K.push({start:U,end:H,replacement:V}),Q.lastIndex=H}for(let U=K.length-1;U>=0;U--){let{start:W,end:w,replacement:z}=K[U];G=G.substring(0,W)+z+G.substring(w)}return G}return Y(X)}function xw(X){let $=X.trim();if($==="")return;if($==="true")return!0;if($==="false")return!1;if($==="null")return!1;if($==="undefined")return!1;if($==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test($)){let J=Number($);return J!==0&&!Number.isNaN(J)}let Z=$.match(/^'((?:\\.|[^'\\])*)'$/);if(Z)return Z[1].length>0;let Y=$.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}function fw(X,$,Z,Y){if(F9.has(Z.toLowerCase()))return Y;let J=Z.toLowerCase(),G=X.toLowerCase(),Q=X.length,q=1,K=Y;while(K<Q){let U=X.indexOf("<",K);if(U===-1)return-1;if(K=U,X.startsWith("<!--",K)){let B=X.indexOf("-->",K+4);if(B===-1)return-1;K=B+3;continue}let W=/^<(script|style)\b/i.exec(X.slice(K,K+8));if(W){let B=X.indexOf(">",K);if(B===-1)return-1;if(X[B-1]==="/"){K=B+1;continue}let j=G.indexOf(`</${W[1].toLowerCase()}`,K);if(j===-1)return-1;let _=X.indexOf(">",j);if(_===-1)return-1;K=_+1;continue}if(X[K+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec(X.slice(K,K+64));if(!B){K++;continue}if(B[1].toLowerCase()===J){if(q--,K+=B[0].length,q===0)return K;continue}K+=B[0].length;continue}let w=/^<([a-z][\w-]*)\b/i.exec(X.slice(K,K+64));if(!w){K++;continue}let z=X.indexOf(">",K);if(z===-1)return-1;if(w[1].toLowerCase()===J){let B=X.slice(K,z+1);if(!(/\/\s*>$/.test(B)||F9.has(J)))q++}K=z+1}return-1}function hw(X,$){let Z=$,Y=X.length;for(;;){while(Z<Y&&X[Z]!=="<")Z++;if(Z>=Y)return!1;if(X.startsWith("<!--",Z)){let Q=X.indexOf("-->",Z+4);if(Q===-1)return!1;Z=Q+3;continue}break}if(X[Z+1]==="/")return!1;let J=X.indexOf(">",Z);if(J===-1)return!1;let G=X.slice(Z,J+1);return gw.test(G)}function A9(X){if(!X.includes(":if")&&!X.includes(":show")&&!X.includes("x-if")&&!X.includes("x-show")&&!X.includes("@if=")&&!X.includes("@show="))return X;let $=[],Z=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);let J=(w)=>$.some(([z,B])=>w>=z&&w<B),G=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,Q=[],q;while((q=G.exec(X))!==null){if(J(q.index))continue;let[w,z,B,j,_,H,L]=q,O=xw(_);if(O===void 0)continue;let F=q.index,V=F+w.length,T=!!L||/\/\s*>$/.test(w)||F9.has(z.toLowerCase())?V:fw(X,F,z,V);if(T===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&hw(X,T)){G.lastIndex=V;continue}if(O===!0){let k=`<${z}${B}${H}${L}>`;Q.push({start:F,end:V,replacement:k});continue}Q.push({start:F,end:T,replacement:""}),G.lastIndex=T}if(Q.length===0)return X;Q.sort((w,z)=>w.start-z.start);let K=[],U=-1;for(let w of Q){if(w.start<U)continue;K.push(w),U=w.end}let W=X;for(let w=K.length-1;w>=0;w--){let{start:z,end:B,replacement:j}=K[w];W=W.substring(0,z)+j+W.substring(B)}return W}function R9(X,$){let Z=X,Y=/@(for|foreach)\s*\(/g,J,G=[],Q=[];while((J=Y.exec(Z))!==null){let q=J[1],K=J.index,U=K+J[0].length,W=1,w=U;while(w<Z.length&&W>0){if(Z[w]==="(")W++;else if(Z[w]===")")W--;w++}if(W!==0)continue;let z=Z.substring(U,w-1).trim(),B=w,j=iZ(z),_=q==="for"?"@endfor":"@endforeach",H=1,L=B,O=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");O.lastIndex=B;let F;while((F=O.exec(Z))!==null)if(F[1].startsWith(q))H++;else if(H--,H===0){L=F.index+F[0].length;break}if(H!==0)continue;let V=()=>{let N=[j.itemVar,j.indexVar].filter(Boolean);if(N.length)Q.push({start:K,end:L,vars:N})};if(j.iterable){let N=j.iterable.trim();if(N.startsWith("[")||N.startsWith("{")||N.startsWith("'")||N.startsWith('"')||N.startsWith("`")||/^-?\d/.test(N)){V();continue}let k=N.split(/[.[(]/)[0].trim(),M=$?k in $:!1,y=Q.some((I)=>K>I.start&&K<I.end&&I.vars.includes(k));if(k&&(M||y)){V();continue}}if(j.style==="as")z=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let A=Z.substring(B,L-_.length).trim(),R=A.match(cZ),T;if(R){let[,N,k,M]=R;T=`<${N}${k} @for="${z}">${M}</${N}>`}else T=`<template @for="${z}">${A}</template>`;G.push({start:K,end:L,replacement:T})}for(let q=G.length-1;q>=0;q--){let{start:K,end:U,replacement:W}=G[q];Z=Z.substring(0,K)+W+Z.substring(U)}return Z}function uw(X){let $=new Set,Z=[],Y=0,J=0,G=X.length,Q=(W)=>{let w=Y+1;while(w<G){let z=X[w];if(z==="\\"){w+=2;continue}if(z===W)return w+1;w++}return G},q=()=>{let W=Y+2;while(W<G&&X[W]!==`
11599
+ `}var yw;var mZ=E(()=>{gX();e0();gX();yw={state:E1,derived:CX,effect:PX,batch:L9,onMount:F9,onDestroy:V9,isSignal:vX,isDerived:xX,untrack:A9,peek:fX,generateSignalsRuntime:uZ,generateSignalsRuntimeDev:R9}});var N9={};n(N9,{templateCache:()=>lZ,readFileCached:()=>bw,invalidateFileCacheByDir:()=>Cw,invalidateFileCache:()=>Sw,hashFilePath:()=>D7,getCachedSignalsRuntime:()=>xw,getCachedRouterScript:()=>fw,clearDevCaches:()=>gw,checkCache:()=>hw,cacheTemplate:()=>uw,__setSignalsGeneratorsForTest:()=>vw});import D1 from"fs";import E5 from"path";async function bw(X){let Z;for(let Y=0;Y<3;Y++)try{let G=(await D1.promises.stat(X)).mtime.getTime(),Q=o1.get(X);if(Q&&Q.mtime===G)return Q.content;let q=await Bun.file(X).text(),U=(await D1.promises.stat(X)).mtime.getTime();if(U!==G)continue;return o1.set(X,{content:q,mtime:U}),q}catch(J){Z=J;break}throw o1.delete(X),Error(`File not found: ${X}${Z?` (${Z.message})`:""}`)}function Sw(X){o1.delete(X)}function Cw(X){for(let $ of o1.keys())if($.startsWith(X))o1.delete($)}function vw(X){cZ=X}async function xw(X=!1){let $=cZ??await Promise.resolve().then(() => (mZ(),dZ));if(X)return $.generateSignalsRuntimeDev();if(hX===null)hX=$.generateSignalsRuntime();return hX}async function fw(){if(uX===null){let{getRouterScript:X}=await Promise.resolve().then(() => (g1(),l2));uX=X()}return uX}function gw(){o1.clear(),iZ(),hX=null,Pw=null,uX=null}function pZ(X){let $={debug:X.debug===!0,middleware:(X.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:(X.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify($)).digest("hex")}async function hw(X,$){try{if(!$.cachePath)return null;let Z=E5.resolve($.cachePath),Y=E5.join(Z,`${D7(X)}.html`),J=E5.join(Z,`${D7(X)}.meta.json`);if(!await p(Y)||!await p(J))return null;let G=await Bun.file(J).text(),Q=JSON.parse(G);if(Q.cacheVersion!==$.cacheVersion)return null;if(Q.optionsSignature!==pZ($))return null;if((await D1.promises.stat(X)).mtime.getTime()>Q.mtime)return null;for(let K of Q.dependencies)if(await p(K)){if((await D1.promises.stat(K)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(Y).text()}catch(Z){return console.warn(`Cache error for ${X}:`,Z),null}}async function uw(X,$,Z,Y){try{if(!Y.cachePath)return;let J=E5.resolve(Y.cachePath);await D1.promises.mkdir(J,{recursive:!0});let G=E5.join(J,`${D7(X)}.html`),Q=E5.join(J,`${D7(X)}.meta.json`),q=await D1.promises.stat(X);await Bun.write(G,$);let K={sourcePath:X,mtime:q.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:Y.cacheVersion,optionsSignature:pZ(Y),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(K,null,2)),lZ.set(X,{output:$,mtime:q.mtime.getTime(),dependencies:Z})}catch(J){console.warn(`Failed to cache template ${X}:`,J)}}function D7(X){return new Bun.CryptoHasher("sha1").update(X).digest("hex").substring(0,dw)}var lZ,o1,hX=null,Pw=null,cZ=null,uX=null,dw=16;var T9=E(()=>{A0();lZ=new Map,o1=new Map});function nZ(X){return X.includes("data-stx-runtime")}function rZ(X){let $=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=$.exec(X);Z!==null;Z=$.exec(X)){let Y=X.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}function M9(X,$){let Z=X.indexOf("<script"),Y=X.search(/<!doctype\b/i);if(Z!==-1&&(Y===-1||Z>Y))return X.slice(0,Z)+$+`
11600
+ `+X.slice(Z);let J=/<head\b[^>]*>/i.exec(X);if(J){let Q=J.index+J[0].length;return`${X.slice(0,Q)}
11601
+ ${$}${X.slice(Q)}`}if(X.includes("</head>")){let Q=X.indexOf("</head>");return X.slice(0,Q)+$+`
11602
+ `+X.slice(Q)}if(E7(X))return yX(X,(Q)=>`${Q}
11603
+ ${$}`);return`${$}
11604
+ ${X}`}async function dX(X,$){if(X.includes("data-stx-runtime")||X.includes("window.stx.state")||X.includes("STX Signals Runtime"))return X;if($.buildMode==="serve")return M9(X,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if($.buildMode==="compile")return M9(X,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (T9(),N9)),Y=await Z($.debug);return M9(X,`<script data-stx-scoped data-stx-runtime>${Y}</script>`)}async function oZ(X,$){if(!X.includes("</body>"))return X;if(X.includes("data-stx-router")||X.includes("__stxRouter)return")||X.includes("__stxRouter=true"))return X;let Z=$?.router,Y="";{let q={};if(Z){if(Z.container)q.container=Z.container;if(Z.interceptAllLinks!==void 0)q.interceptAllLinks=Z.interceptAllLinks;if(Z.progress!==void 0)q.progress=Z.progress;if(Z.viewTransitions!==void 0)q.viewTransitions=Z.viewTransitions;if(Z.viewTransitionDuration!==void 0)q.viewTransitionDuration=Z.viewTransitionDuration;if(Z.viewTransitionEasing!==void 0)q.viewTransitionEasing=Z.viewTransitionEasing;if(Z.scrollToTop!==void 0)q.scrollToTop=Z.scrollToTop;if(Z.prefetch!==void 0)q.prefetch=Z.prefetch;if(Z.cache!==void 0)q.cache=Z.cache;if(Z.progressColor!==void 0)q.progressColor=Z.progressColor;if(Z.progressHeight!==void 0)q.progressHeight=Z.progressHeight}try{let K=await bZ($?.pagesDir);if(K.length>0)q.ownedRoutes=K}catch{}if(Object.keys(q).length>0)Y=`<script>window.__stxRouterConfig=${CZ(q)};</script>
11605
+ `}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (T9(),N9)),G=$?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':$?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await J()}</script>`,Q=X.lastIndexOf("</body>");return X.slice(0,Q)+Y+G+`
11606
+ </body>`+X.slice(Q+7)}var mX=E(()=>{SZ();W9()});var iX={};n(iX,{scanScriptTags:()=>ZY,rewriteStxImportSpecifiers:()=>QY,processSignals:()=>y9,processScriptSetup:()=>JY,preEvalLiteralReactiveIfs:()=>E9,parseLoopExpression:()=>YY,hasSignalsSyntax:()=>pX,findMarkupIndexOutsideScripts:()=>cX,extractExports:()=>GY,convertSignalLoopsToAttributes:()=>D9,convertSignalDirectivesToAttributes:()=>I9});function ZY(X,$={}){let Z=[];for(let Y of r$(X,A1)){let J=Y.token.match(/^<script\b([^>]*)>/i),G=Y.token.match(/<\/script\s*>$/i);if(!J||!G)continue;let Q=J[1];if($.skipAttrs){if($.skipAttrs.lastIndex=0,$.skipAttrs.test(Q))continue}let q=J[0].length,K=Y.token.length-G[0].length;Z.push({fullMatch:Y.token,attrs:Q,body:Y.token.slice(q,K),start:Y.start,end:Y.end})}return Z}function YY(X){let $=X.trim(),Z=$.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let J=Z[1].trim(),G=Z[2].trim(),{itemVar:Q,indexVar:q}=aZ(G);if(Q)return{style:"as",iterable:J,itemVar:Q,indexVar:q}}let Y=$.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let J=Y[1].trim(),G=Y[2].trim(),{itemVar:Q,indexVar:q}=aZ(J);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function aZ(X){let $=X.trim(),Z=$.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let Y=$.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let J=$.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let G=$.match(/^(\w+)$/);if(G)return{itemVar:G[1],indexVar:null};return{itemVar:null,indexVar:null}}function pX(X){return t2(X)}function lw(X){let $=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,Y;while((Y=$.exec(X))!==null){let J=Y[1];if(J.startsWith("if"))Z++;else if(J==="endif")Z--;else if(Z===0)return!0}return!1}function cw(X){let $=new Set,Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=Z.exec(X))!==null){let G=J[1],Q;while((Q=Y.exec(G))!==null)$.add(Q[1])}return $}function pw(X){return X.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function eZ(X,$,Z){if(!X)return!1;let Y=pw(X),J=!1,G=!1,Q=!1,q=/([a-zA-Z_$][\w$]*)/g,K;while((K=q.exec(Y))!==null){let z=K[1];if(Y.slice(0,K.index).trimEnd().endsWith("."))continue;if(tZ.has(z))continue;if($.has(z))J=!0;else if(Z&&z in Z)G=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,W;while((W=U.exec(Y))!==null){let z=W[1];if(Y.slice(0,W.index).trimEnd().endsWith("."))continue;if(tZ.has(z)||Z&&z in Z)continue;Q=!0}return(J||Q)&&!G}function lX(X,$,Z){let Y=Z===void 0?` ${$}`:` ${$}="${Z.replace(/"/g,"&quot;")}"`,J=X.trim(),G=J.match($Y);if(G&&iw(G[3],G[1])){let[,Q,q,K]=G;return`<${Q}${q}${Y}>${K}</${Q}>`}return`<template${Y}>${J}</template>`}function iw(X,$){let Z=new RegExp(`<(/)?${$}(?=[\\s/>])`,"gi"),Y=0,J;while((J=Z.exec(X))!==null)if(J[1]){if(Y--,Y<0)return!1}else Y++;return!0}function I9(X,$){let Z=cw(X);function Y(J){let G=J,Q=/@if\s*\(/g,q,K=[];while((q=Q.exec(G))!==null){let U=q.index,W=U+q[0].length,w=1,z=W;while(z<G.length&&w>0){if(G[z]==="(")w++;else if(G[z]===")")w--;z++}if(w!==0)continue;let B=G.substring(W,z-1).trim(),j=z,_=1,H=j,L=/@(if\s*\(|endif)/g;L.lastIndex=j;let O;while((O=L.exec(G))!==null)if(O[1].startsWith("if"))_++;else if(O[1]==="endif"){if(_--,_===0){H=O.index+O[0].length;break}}if(_!==0)continue;let F=G.substring(j,H-6).trim(),V;if(lw(F)){let A=I7(G.substring(U,H));if(A.length===0)continue;let R=A[0].branches.filter((k)=>k.type!=="else");if(!(R.length>0&&R.every((k)=>eZ(k.condition,Z,$))))continue;V=A[0].branches.map((k)=>{let M=Y(k.content);if(k.type==="elseif")return lX(M,"@else-if",k.condition??"");if(k.type==="else")return lX(M,"@else");return lX(M,"@if",k.condition??"")}).join(`
11607
+ `)}else{if(!eZ(B,Z,$))continue;V=lX(Y(F),"@if",B)}K.push({start:U,end:H,replacement:V}),Q.lastIndex=H}for(let U=K.length-1;U>=0;U--){let{start:W,end:w,replacement:z}=K[U];G=G.substring(0,W)+z+G.substring(w)}return G}return Y(X)}function nw(X){let $=X.trim();if($==="")return;if($==="true")return!0;if($==="false")return!1;if($==="null")return!1;if($==="undefined")return!1;if($==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test($)){let J=Number($);return J!==0&&!Number.isNaN(J)}let Z=$.match(/^'((?:\\.|[^'\\])*)'$/);if(Z)return Z[1].length>0;let Y=$.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}function rw(X,$,Z,Y){if(k9.has(Z.toLowerCase()))return Y;let J=Z.toLowerCase(),G=X.toLowerCase(),Q=X.length,q=1,K=Y;while(K<Q){let U=X.indexOf("<",K);if(U===-1)return-1;if(K=U,X.startsWith("<!--",K)){let B=X.indexOf("-->",K+4);if(B===-1)return-1;K=B+3;continue}let W=/^<(script|style)\b/i.exec(X.slice(K,K+8));if(W){let B=X.indexOf(">",K);if(B===-1)return-1;if(X[B-1]==="/"){K=B+1;continue}let j=G.indexOf(`</${W[1].toLowerCase()}`,K);if(j===-1)return-1;let _=X.indexOf(">",j);if(_===-1)return-1;K=_+1;continue}if(X[K+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec(X.slice(K,K+64));if(!B){K++;continue}if(B[1].toLowerCase()===J){if(q--,K+=B[0].length,q===0)return K;continue}K+=B[0].length;continue}let w=/^<([a-z][\w-]*)\b/i.exec(X.slice(K,K+64));if(!w){K++;continue}let z=X.indexOf(">",K);if(z===-1)return-1;if(w[1].toLowerCase()===J){let B=X.slice(K,z+1);if(!(/\/\s*>$/.test(B)||k9.has(J)))q++}K=z+1}return-1}function sw(X,$){let Z=$,Y=X.length;for(;;){while(Z<Y&&X[Z]!=="<")Z++;if(Z>=Y)return!1;if(X.startsWith("<!--",Z)){let Q=X.indexOf("-->",Z+4);if(Q===-1)return!1;Z=Q+3;continue}break}if(X[Z+1]==="/")return!1;let J=X.indexOf(">",Z);if(J===-1)return!1;let G=X.slice(Z,J+1);return ow.test(G)}function E9(X){if(!X.includes(":if")&&!X.includes(":show")&&!X.includes("x-if")&&!X.includes("x-show")&&!X.includes("@if=")&&!X.includes("@show="))return X;let $=[],Z=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);let J=(w)=>$.some(([z,B])=>w>=z&&w<B),G=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,Q=[],q;while((q=G.exec(X))!==null){if(J(q.index))continue;let[w,z,B,j,_,H,L]=q,O=nw(_);if(O===void 0)continue;let F=q.index,V=F+w.length,N=!!L||/\/\s*>$/.test(w)||k9.has(z.toLowerCase())?V:rw(X,F,z,V);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&sw(X,N)){G.lastIndex=V;continue}if(O===!0){let k=`<${z}${B}${H}${L}>`;Q.push({start:F,end:V,replacement:k});continue}Q.push({start:F,end:N,replacement:""}),G.lastIndex=N}if(Q.length===0)return X;Q.sort((w,z)=>w.start-z.start);let K=[],U=-1;for(let w of Q){if(w.start<U)continue;K.push(w),U=w.end}let W=X;for(let w=K.length-1;w>=0;w--){let{start:z,end:B,replacement:j}=K[w];W=W.substring(0,z)+j+W.substring(B)}return W}function D9(X,$){let Z=X,Y=/@(for|foreach)\s*\(/g,J,G=[],Q=[];while((J=Y.exec(Z))!==null){let q=J[1],K=J.index,U=K+J[0].length,W=1,w=U;while(w<Z.length&&W>0){if(Z[w]==="(")W++;else if(Z[w]===")")W--;w++}if(W!==0)continue;let z=Z.substring(U,w-1).trim(),B=w,j=YY(z),_=q==="for"?"@endfor":"@endforeach",H=1,L=B,O=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");O.lastIndex=B;let F;while((F=O.exec(Z))!==null)if(F[1].startsWith(q))H++;else if(H--,H===0){L=F.index+F[0].length;break}if(H!==0)continue;let V=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)Q.push({start:K,end:L,vars:T})};if(j.iterable){let T=j.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){V();continue}let k=T.split(/[.[(]/)[0].trim(),M=$?k in $:!1,y=Q.some((I)=>K>I.start&&K<I.end&&I.vars.includes(k));if(k&&(M||y)){V();continue}}if(j.style==="as")z=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let A=Z.substring(B,L-_.length).trim(),R=A.match($Y),N;if(R){let[,T,k,M]=R;N=`<${T}${k} @for="${z}">${M}</${T}>`}else N=`<template @for="${z}">${A}</template>`;G.push({start:K,end:L,replacement:N})}for(let q=G.length-1;q>=0;q--){let{start:K,end:U,replacement:W}=G[q];Z=Z.substring(0,K)+W+Z.substring(U)}return Z}function aw(X){let $=new Set,Z=[],Y=0,J=0,G=X.length,Q=(W)=>{let w=Y+1;while(w<G){let z=X[w];if(z==="\\"){w+=2;continue}if(z===W)return w+1;w++}return G},q=()=>{let W=Y+2;while(W<G&&X[W]!==`
11535
11608
  `)W++;return W},K=()=>{let W=Y+2;while(W<G-1){if(X[W]==="*"&&X[W+1]==="/")return W+2;W++}return G},U=(W)=>{let w=W,z=0;while(w<G){let B=X[w];if(B==="/"&&X[w+1]==="/"){let j=w+2;while(j<G&&X[j]!==`
11536
- `)j++;w=j;continue}if(B==="/"&&X[w+1]==="*"){let j=w+2;while(j<G-1&&!(X[j]==="*"&&X[j+1]==="/"))j++;w=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=w+1;while(j<G){if(X[j]==="\\"){j+=2;continue}if(X[j]===B){j++;break}j++}w=j;continue}if(B==="("||B==="["||B==="{"){z++,w++;continue}if(B===")"||B==="]"||B==="}"){z--,w++;continue}if(B===";"&&z===0)return w+1;w++}return G};while(Y<G){let W=X[Y];if(W==="/"&&X[Y+1]==="/"){let w=q();Z.push(X.slice(Y,w)),Y=w;continue}if(W==="/"&&X[Y+1]==="*"){let w=K();Z.push(X.slice(Y,w)),Y=w;continue}if(W==='"'||W==="'"||W==="`"){let w=Q(W);Z.push(X.slice(Y,w)),Y=w;continue}if(W==="{"){J++,Z.push(W),Y++;continue}if(W==="}"){J--,Z.push(W),Y++;continue}if(J===0){let w=Y>0?X[Y-1]:"";if(w===""||/\s/.test(w)||w===";"||w==="}"||w==="{"){let B=X.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=U(Y+B[0].length);if($.has(j)){Z.push(`/* stx: deduped const ${j} */`),Y=_;continue}$.add(j),Z.push(X.slice(Y,_)),Y=_;continue}}}Z.push(W),Y++}return Z.join("")}async function nZ(X,$,Z){let Y=pZ(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,G=[];for(let H of Y){let L=H.body;if(d1(H.attrs))L=m1(L);if(J.test(L))G.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(G.length===0)return{output:X,setupCode:null};let Q=`__stx_setup_${Date.now()}_${bw++}`,{hasUserImports:q,bundleClientScript:K}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (j7(),z7))),U=[];for(let H=0;H<G.length;H++){let L=G[H].content;if(L=V5(L).code,q(L))L=await K(L,$||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,V)=>oZ(V));let O=f0(L);U.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
11609
+ `)j++;w=j;continue}if(B==="/"&&X[w+1]==="*"){let j=w+2;while(j<G-1&&!(X[j]==="*"&&X[j+1]==="/"))j++;w=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=w+1;while(j<G){if(X[j]==="\\"){j+=2;continue}if(X[j]===B){j++;break}j++}w=j;continue}if(B==="("||B==="["||B==="{"){z++,w++;continue}if(B===")"||B==="]"||B==="}"){z--,w++;continue}if(B===";"&&z===0)return w+1;w++}return G};while(Y<G){let W=X[Y];if(W==="/"&&X[Y+1]==="/"){let w=q();Z.push(X.slice(Y,w)),Y=w;continue}if(W==="/"&&X[Y+1]==="*"){let w=K();Z.push(X.slice(Y,w)),Y=w;continue}if(W==='"'||W==="'"||W==="`"){let w=Q(W);Z.push(X.slice(Y,w)),Y=w;continue}if(W==="{"){J++,Z.push(W),Y++;continue}if(W==="}"){J--,Z.push(W),Y++;continue}if(J===0){let w=Y>0?X[Y-1]:"";if(w===""||/\s/.test(w)||w===";"||w==="}"||w==="{"){let B=X.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=U(Y+B[0].length);if($.has(j)){Z.push(`/* stx: deduped const ${j} */`),Y=_;continue}$.add(j),Z.push(X.slice(Y,_)),Y=_;continue}}}Z.push(W),Y++}return Z.join("")}async function JY(X,$,Z){let Y=ZY(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,G=[];for(let H of Y){let L=H.body;if(d1(H.attrs))L=m1(L);if(J.test(L))G.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(G.length===0)return{output:X,setupCode:null};let Q=`__stx_setup_${Date.now()}_${mw++}`,{hasUserImports:q,bundleClientScript:K}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (B7(),j7))),U=[];for(let H=0;H<G.length;H++){let L=G[H].content;if(L=A5(L).code,q(L))L=await K(L,$||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,V)=>QY(V));let O=f0(L);U.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
11537
11610
  ${O}`)}let W=U.join(`
11538
11611
 
11539
- `);W=uw(W);let w=rZ(W),z=w.split(",").map((H)=>H.trim()).filter(Boolean),B=HX(W,Z),j=`
11612
+ `);W=aw(W);let w=GY(W),z=w.split(",").map((H)=>H.trim()).filter(Boolean),B=OX(W,Z),j=`
11540
11613
  <script data-stx-scoped>
11541
11614
  function ${Q}() {
11542
- ${L5("const",z)}
11543
- ${F5(`${B}${W}`)}
11615
+ ${F5("const",z)}
11616
+ ${V5(`${B}${W}`)}
11544
11617
  return { ${w} };
11545
11618
  }
11546
11619
  window.__stx_latestSetup=${Q};
11547
11620
  if(window.stx)window.stx._latestSetup=${Q};
11548
- </script>`,_=X;for(let H of G)_=_.split(H.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${hZ})>`),`<body$1 data-stx="${Q}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${hZ})>`,"gi"),(O,F,V)=>{if(L||H.includes(F.toLowerCase()))return O;return L=!0,`<${F}${V} data-stx="${Q}">`})}return{output:_,setupCode:j}}function rZ(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,q="",K=()=>{G++;let j=!1;while(G<Q){let _=$[G];if(_==="\\"){G+=2;continue}if(_==="["&&!j){j=!0,G++;continue}if(_==="]"&&j){j=!1,G++;continue}if(_==="/"&&!j){G++;while(G<Q&&/[gimsuyd]/.test($[G]))G++;return}if(_===`
11621
+ </script>`,_=X;for(let H of G)_=_.split(H.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${sZ})>`),`<body$1 data-stx="${Q}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${sZ})>`,"gi"),(O,F,V)=>{if(L||H.includes(F.toLowerCase()))return O;return L=!0,`<${F}${V} data-stx="${Q}">`})}return{output:_,setupCode:j}}function GY(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,q="",K=()=>{G++;let j=!1;while(G<Q){let _=$[G];if(_==="\\"){G+=2;continue}if(_==="["&&!j){j=!0,G++;continue}if(_==="]"&&j){j=!1,G++;continue}if(_==="/"&&!j){G++;while(G<Q&&/[gimsuyd]/.test($[G]))G++;return}if(_===`
11549
11622
  `)return;G++}},U=()=>{if(!q)return!0;if(/[\w)\]]/.test(q))return!1;return!0},W=(j)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===j){G++;return}G++}},w=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let j=1;while(G<Q&&j>0)if($[G]==="{")j++,G++;else if($[G]==="}")j--,G++;else if($[G]==="'"||$[G]==='"')W($[G]);else if($[G]==="`")w();else G++;continue}G++}},z=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
11550
- `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},B=()=>{if(J!==0)return;let j=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let F=j[2];if(!Y.has(F))Z.push(F),Y.add(F);return}let _=$.slice(G).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((F)=>{let V=F.trim();if(!V)return;let A=V.indexOf(":"),T=(A>=0?V.slice(A+1).trim():V).split(/[\s=]/)[0];if(T&&!Y.has(T))Z.push(T),Y.add(T)});return}let H=$.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((F)=>{let V=F.trim().replace(/^\.\.\./,"");if(!V)return;let A=V.split(/[\s=]/)[0];if(A&&!Y.has(A))Z.push(A),Y.add(A)});return}let L=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!Y.has(F))Z.push(F),Y.add(F);return}let O=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!Y.has(F))Z.push(F),Y.add(F)}};while(G<Q){if(z())continue;if($[G]==="'"||$[G]==='"'){W($[G]),q=$[G-1];continue}if($[G]==="`"){w(),q="`";continue}if($[G]==="/"&&$[G+1]!=="/"&&$[G+1]!=="*"&&U()){K(),q="/";continue}if($[G]==="{"){J++,q="{",G++;continue}if($[G]==="}"){J--,q="}",G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))B();if(!/\s/.test($[G]))q=$[G];G++}return Z.join(", ")}async function T9(X,$,Z,Y){if(!pX(X))return X;let J=X;if($.skipSignalsRuntime)return J;let{output:G,setupCode:Q}=await nZ(J,Z,Y);if(J=G,J=await dX(J,$),Q){let W=cX(J,/<\/head>/i),w=W===-1?cX(J,/<body[^>]*>/i):-1;if(W!==-1)J=`${J.slice(0,W)}${Q}
11623
+ `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},B=()=>{if(J!==0)return;let j=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let F=j[2];if(!Y.has(F))Z.push(F),Y.add(F);return}let _=$.slice(G).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((F)=>{let V=F.trim();if(!V)return;let A=V.indexOf(":"),N=(A>=0?V.slice(A+1).trim():V).split(/[\s=]/)[0];if(N&&!Y.has(N))Z.push(N),Y.add(N)});return}let H=$.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((F)=>{let V=F.trim().replace(/^\.\.\./,"");if(!V)return;let A=V.split(/[\s=]/)[0];if(A&&!Y.has(A))Z.push(A),Y.add(A)});return}let L=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!Y.has(F))Z.push(F),Y.add(F);return}let O=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!Y.has(F))Z.push(F),Y.add(F)}};while(G<Q){if(z())continue;if($[G]==="'"||$[G]==='"'){W($[G]),q=$[G-1];continue}if($[G]==="`"){w(),q="`";continue}if($[G]==="/"&&$[G+1]!=="/"&&$[G+1]!=="*"&&U()){K(),q="/";continue}if($[G]==="{"){J++,q="{",G++;continue}if($[G]==="}"){J--,q="}",G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))B();if(!/\s/.test($[G]))q=$[G];G++}return Z.join(", ")}async function y9(X,$,Z,Y){if(!pX(X))return X;let J=X;if($.skipSignalsRuntime)return J;let{output:G,setupCode:Q}=await JY(J,Z,Y);if(J=G,J=await dX(J,$),Q){let W=cX(J,/<\/head>/i),w=W===-1?cX(J,/<body[^>]*>/i):-1;if(W!==-1)J=`${J.slice(0,W)}${Q}
11551
11624
  ${J.slice(W)}`;else if(w!==-1){let z=/<body[^>]*>/i.exec(J.slice(w))[0],B=w+z.length;J=`${J.slice(0,B)}
11552
11625
  ${Q}${J.slice(B)}`}else J=`${J}
11553
- ${Q}`}let K=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),U=K&&/data-stx/.test(K[1]);if(!Q&&!U&&K&&!/data-stx-auto/.test(K[1])){let W=/<body[^>]*>/i,w=cX(J,W);if(w!==-1){let z=J.slice(0,w),B=J.slice(w).replace(W,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=z+B}}return J}function cX(X,$){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec(X))!==null)Y.push([J.index,J.index+J[0].length]);let G=new RegExp($.source,$.flags.replace(/[gy]/g,"")),Q=0;while(Q<X.length){let q=G.exec(X.slice(Q));if(!q)return-1;let K=Q+q.index;if(!Y.some(([W,w])=>K>=W&&K<w))return K;Q=K+Math.max(q[0].length,1)}return-1}function oZ(X){let $=[];for(let Z of X.split(",")){let Y=Z.trim();if(!Y||Y.startsWith("type "))continue;let J=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])$.push(`${J[2]} = ${J[1]}`)}if($.length===0)return lZ;return`var ${$.join(", ")}; ${lZ}`}var bw=0,hZ=`(?:"[^"]*"|'[^']*'|[^>"'])*`,cZ,dZ,F9,gw,lZ="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var D7=D(()=>{L7();EX();X1();u$();A0();mX();l1();w7();cZ=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;dZ=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"]);F9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);gw=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import dw from"fs";import g from"path";function lw(X){let $=new WeakSet;try{let Z=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if($.has(Y))throw TypeError("Circular component input");if($.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(Z);let J={};for(let G of Object.keys(Y).sort())J[G]=Z(Y[G]);return J};return JSON.stringify(Z(X))}catch{return null}}function sZ(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function cw(X){return/\bjs\b/.test(X)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(X)}function d1(X){return!cw(X)}function m1(X){try{let $=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");$=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];$=$.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:S0()}).transformSync($);for(let G=0;G<Z.length;G++)J=J.replace(`"__STX_EXPR_${G}__"`,Z[G]),J=J.replace(`'__STX_EXPR_${G}__'`,Z[G]);return J}catch($){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",$);return X}}function pw(X){let $=[],Z=new Set,Y=0,J=0,G=X.length,Q=(W)=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]===W){J++;return}J++}},q=()=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]==="`"){J++;return}if(X[J]==="$"&&X[J+1]==="{"){J+=2;let W=1;while(J<G&&W>0)if(X[J]==="{")W++,J++;else if(X[J]==="}")W--,J++;else if(X[J]==="'"||X[J]==='"')Q(X[J]);else if(X[J]==="`")q();else J++;continue}J++}},K=()=>{if(X[J]==="/"&&X[J+1]==="/"){while(J<G&&X[J]!==`
11554
- `)J++;return!0}if(X[J]==="/"&&X[J+1]==="*"){J+=2;while(J<G-1&&!(X[J]==="*"&&X[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Y!==0)return;let W=X.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let j=W[2].split(",").map((_)=>{let H=_.trim().split(":");return H[H.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Z.has(_))$.push(_),Z.add(_);return}let w=X.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(w){let j=w[2];if(!Z.has(j))$.push(j),Z.add(j);return}let z=X.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let j=z[1];if(!Z.has(j))$.push(j),Z.add(j);return}let B=X.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Z.has(j))$.push(j),Z.add(j)}};while(J<G){if(K())continue;if(X[J]==="'"||X[J]==='"'){Q(X[J]);continue}if(X[J]==="`"){q();continue}if(X[J]==="{"){Y++,J++;continue}if(X[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test(X[J])&&(J===0||/\s|[;{}()]/.test(X[J-1])))U();J++}return $}function iw(X){let $=[],Z=0,Y=0,J=null;for(let G=0;G<X.length;G++){let Q=X[G];if(J){if(Q==="\\"){G++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)$.push(X.slice(Y,G)),Y=G+1}if(Y<X.length)$.push(X.slice(Y));return $}function nw(X){let $=0,Z=null;for(let Y=0;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}if(J==="("||J==="["||J==="{")$++;else if(J===")"||J==="]"||J==="}")$--;else if(J==="="&&$===0){let G=X[Y-1],Q=X[Y+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return Y}}return-1}function rw(X,$){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(X);if(!Z)return;let Y=Z.index-1;while(Y>=0&&/\s/.test(X[Y]))Y--;if(X[Y]!=="}")return;let J=Y,G=0,Q=-1;for(;Y>=0;Y--){let K=X[Y];if(K==="}")G++;else if(K==="{"){if(G--,G===0){Q=Y;break}}}if(Q===-1)return;let q=X.slice(Q+1,J);for(let K of iw(q)){let U=K.trim();if(!U||U.startsWith("..."))continue;let W=nw(U);if(W===-1)continue;let w=U.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(w))continue;if($[w]!==void 0)continue;let z=U.slice(W+1).trim();if(!z)continue;try{let B=Object.keys($),j=Function(...B,`"use strict"; return (${z});`);$[w]=j(...B.map((_)=>$[_]))}catch{}}}catch{}}async function oX(X,$,Z,Y,J){let G=X.endsWith(".stx")?X.slice(0,-4):X,Q=(H)=>H.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""),q=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=Z.__importedComponents;if(K){for(let H of[G,G.toLowerCase(),Q(G),q(G)])if(K.has(H))return!0}let U=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${q(G)}.stx`])],W=typeof J.root==="string"?g.resolve(J.root):void 0,w=W??g.dirname(Y),z=[],B=(H)=>{if(H&&!z.includes(H))z.push(H)},j=Z.__originalFilePath;if(j)B(g.join(g.dirname(j),"components"));B($),B(J._rootComponentsDir),B(g.join(g.dirname(Y),"components")),B(J.componentsDir);let _=J._pluginComponentDirs;if(Array.isArray(_))for(let H of _)B(typeof H==="string"?H:null);if(W)B(g.resolve(W,"resources/views/components")),B(g.resolve(W,"resources/components")),B(g.resolve(W,"src/components")),B(g.resolve(W,"components"));if(G.startsWith("./")||G.startsWith("../"))return p(g.resolve(g.dirname(Y),`${G}.stx`));for(let H of z){let L=g.isAbsolute(H)?H:g.resolve(w,H);for(let O of U)if(await p(g.join(L,O)))return!0}return!1}function ow(X){return X==="visible"||X==="idle"||X==="interaction"||X.startsWith("media:")}function sw(X){if(!X)return!1;let $=X.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test($)}function aw(X){let $=new Set,Z=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let Y of X){let J;while((J=Z.exec(Y))!==null)$.add(J[1]);Z.lastIndex=0}return[...$]}async function o1(X,$,Z,Y,J,G,Q,q=new Set,K){let{extractVariables:U}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (M7(),kX))),W=q??new Set;if(W.has(X))return`[Circular component reference: ${X}]`;let w=new Set(W);w.add(X);let z=typeof $.client==="string"?$.client.trim():"";if("client"in $)delete $.client;let B=z&&z!=="load"&&ow(z)?z:"";try{let j=(E)=>E.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),_=(E)=>E.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=X.endsWith(".stx")?X.slice(0,-4):X,L=null,O=J.__importedComponents;if(O){let E=[H,H.toLowerCase(),j(H),_(H)];for(let v of E)if(O.has(v)){L=O.get(v);break}}let F=[];if(!L){let E=[`${H}.stx`,`${j(H)}.stx`,`${_(H)}.stx`],v=[...new Set(E)],u=J.__originalFilePath,f=[];if(u){let w0=g.join(g.dirname(u),"components");f.push(w0)}if(Y)f.push(Y);let o=Q._rootComponentsDir;if(typeof o==="string"&&!f.includes(o))f.push(o);let Z0=g.join(g.dirname(G),"components");if(!f.includes(Z0))f.push(Z0);if(Q.componentsDir&&Q.componentsDir!==Y&&!f.includes(Q.componentsDir))f.push(Q.componentsDir);let n0=Q._pluginComponentDirs;if(Array.isArray(n0)){for(let w0 of n0)if(typeof w0==="string"&&!f.includes(w0))f.push(w0)}let b0=typeof Q.root==="string"?g.resolve(Q.root):void 0,x0=b0??g.dirname(G),r0=[];if(b0)r0.push(g.resolve(b0,"resources/views/components")),r0.push(g.resolve(b0,"resources/components")),r0.push(g.resolve(b0,"src/components")),r0.push(g.resolve(b0,"components"));r0.push(g.resolve(import.meta.dir,"components"));for(let w0 of r0)if(!f.includes(w0))f.push(w0);let w5=[...new Set(f.map((w0)=>{if(!w0)return w0;return g.isAbsolute(w0)?w0:g.resolve(x0,w0)}))];f.length=0,f.push(...w5);let H1=`${H}\x00${G}\x00${w5.join("\x00")}`,O1=rX.get(H1);if(O1)if(await p(O1))L=O1;else rX.delete(H1);if(!L&&(H.startsWith("./")||H.startsWith("../")))L=g.resolve(g.dirname(G),`${H}.stx`),F.push(L);else if(!L)for(let w0 of f){if(!w0)continue;for(let t0 of v){let i=g.join(w0,t0);if(F.push(i),await p(i)){L=i;break}}if(L)break;if(!L)try{let t0=await import("fs");if(!t0.statSync(w0,{throwIfNoEntry:!1})?.isDirectory())continue;let e0=8,x1=[{path:w0,depth:0}];while(x1.length>0&&!L){let Q1=x1.pop();if(Q1.depth>=e0)continue;let o7;try{o7=t0.readdirSync(Q1.path,{withFileTypes:!0})}catch{continue}for(let s7 of o7){if(!s7.isDirectory())continue;if(s7.name==="node_modules"||s7.name.startsWith("."))continue;let f4=g.join(Q1.path,s7.name);for(let LK of v){let K$=g.join(f4,LK);if(F.push(K$),await p(K$)){L=K$;break}}if(L)break;x1.push({path:f4,depth:Q1.depth+1})}}}catch{}if(L)break}if(L)rX.set(H1,L)}if(!L||!await p(L)){let E=F.length>0?`
11626
+ ${Q}`}let K=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),U=K&&/data-stx/.test(K[1]);if(!Q&&!U&&K&&!/data-stx-auto/.test(K[1])){let W=/<body[^>]*>/i,w=cX(J,W);if(w!==-1){let z=J.slice(0,w),B=J.slice(w).replace(W,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=z+B}}return J}function cX(X,$){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec(X))!==null)Y.push([J.index,J.index+J[0].length]);let G=new RegExp($.source,$.flags.replace(/[gy]/g,"")),Q=0;while(Q<X.length){let q=G.exec(X.slice(Q));if(!q)return-1;let K=Q+q.index;if(!Y.some(([W,w])=>K>=W&&K<w))return K;Q=K+Math.max(q[0].length,1)}return-1}function QY(X){let $=[];for(let Z of X.split(",")){let Y=Z.trim();if(!Y||Y.startsWith("type "))continue;let J=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])$.push(`${J[2]} = ${J[1]}`)}if($.length===0)return XY;return`var ${$.join(", ")}; ${XY}`}var mw=0,sZ=`(?:"[^"]*"|'[^']*'|[^>"'])*`,$Y,tZ,k9,ow,XY="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var y7=E(()=>{F7();DX();e0();u$();A0();mX();l1();z7();$Y=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;tZ=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"]);k9=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);ow=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import tw from"fs";import g from"path";function Xz(X){let $=new WeakSet;try{let Z=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if($.has(Y))throw TypeError("Circular component input");if($.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(Z);let J={};for(let G of Object.keys(Y).sort())J[G]=Z(Y[G]);return J};return JSON.stringify(Z(X))}catch{return null}}function qY(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function $z(X){return/\bjs\b/.test(X)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(X)}function d1(X){return!$z(X)}function m1(X){try{let $=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");$=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];$=$.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:S0()}).transformSync($);for(let G=0;G<Z.length;G++)J=J.replace(`"__STX_EXPR_${G}__"`,Z[G]),J=J.replace(`'__STX_EXPR_${G}__'`,Z[G]);return J}catch($){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",$);return X}}function Zz(X){let $=[],Z=new Set,Y=0,J=0,G=X.length,Q=(W)=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]===W){J++;return}J++}},q=()=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]==="`"){J++;return}if(X[J]==="$"&&X[J+1]==="{"){J+=2;let W=1;while(J<G&&W>0)if(X[J]==="{")W++,J++;else if(X[J]==="}")W--,J++;else if(X[J]==="'"||X[J]==='"')Q(X[J]);else if(X[J]==="`")q();else J++;continue}J++}},K=()=>{if(X[J]==="/"&&X[J+1]==="/"){while(J<G&&X[J]!==`
11627
+ `)J++;return!0}if(X[J]==="/"&&X[J+1]==="*"){J+=2;while(J<G-1&&!(X[J]==="*"&&X[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Y!==0)return;let W=X.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let j=W[2].split(",").map((_)=>{let H=_.trim().split(":");return H[H.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Z.has(_))$.push(_),Z.add(_);return}let w=X.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(w){let j=w[2];if(!Z.has(j))$.push(j),Z.add(j);return}let z=X.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let j=z[1];if(!Z.has(j))$.push(j),Z.add(j);return}let B=X.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Z.has(j))$.push(j),Z.add(j)}};while(J<G){if(K())continue;if(X[J]==="'"||X[J]==='"'){Q(X[J]);continue}if(X[J]==="`"){q();continue}if(X[J]==="{"){Y++,J++;continue}if(X[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test(X[J])&&(J===0||/\s|[;{}()]/.test(X[J-1])))U();J++}return $}function Yz(X){let $=[],Z=0,Y=0,J=null;for(let G=0;G<X.length;G++){let Q=X[G];if(J){if(Q==="\\"){G++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)$.push(X.slice(Y,G)),Y=G+1}if(Y<X.length)$.push(X.slice(Y));return $}function Jz(X){let $=0,Z=null;for(let Y=0;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}if(J==="("||J==="["||J==="{")$++;else if(J===")"||J==="]"||J==="}")$--;else if(J==="="&&$===0){let G=X[Y-1],Q=X[Y+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return Y}}return-1}function Gz(X,$){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(X);if(!Z)return;let Y=Z.index-1;while(Y>=0&&/\s/.test(X[Y]))Y--;if(X[Y]!=="}")return;let J=Y,G=0,Q=-1;for(;Y>=0;Y--){let K=X[Y];if(K==="}")G++;else if(K==="{"){if(G--,G===0){Q=Y;break}}}if(Q===-1)return;let q=X.slice(Q+1,J);for(let K of Yz(q)){let U=K.trim();if(!U||U.startsWith("..."))continue;let W=Jz(U);if(W===-1)continue;let w=U.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(w))continue;if($[w]!==void 0)continue;let z=U.slice(W+1).trim();if(!z)continue;try{let B=Object.keys($),j=Function(...B,`"use strict"; return (${z});`);$[w]=j(...B.map((_)=>$[_]))}catch{}}}catch{}}async function oX(X,$,Z,Y,J){let G=X.endsWith(".stx")?X.slice(0,-4):X,Q=(H)=>H.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""),q=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=Z.__importedComponents;if(K){for(let H of[G,G.toLowerCase(),Q(G),q(G)])if(K.has(H))return!0}let U=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${q(G)}.stx`])],W=typeof J.root==="string"?g.resolve(J.root):void 0,w=W??g.dirname(Y),z=[],B=(H)=>{if(H&&!z.includes(H))z.push(H)},j=Z.__originalFilePath;if(j)B(g.join(g.dirname(j),"components"));B($),B(J._rootComponentsDir),B(g.join(g.dirname(Y),"components")),B(J.componentsDir);let _=J._pluginComponentDirs;if(Array.isArray(_))for(let H of _)B(typeof H==="string"?H:null);if(W)B(g.resolve(W,"resources/views/components")),B(g.resolve(W,"resources/components")),B(g.resolve(W,"src/components")),B(g.resolve(W,"components"));if(G.startsWith("./")||G.startsWith("../"))return p(g.resolve(g.dirname(Y),`${G}.stx`));for(let H of z){let L=g.isAbsolute(H)?H:g.resolve(w,H);for(let O of U)if(await p(g.join(L,O)))return!0}return!1}function Qz(X){return X==="visible"||X==="idle"||X==="interaction"||X.startsWith("media:")}function qz(X){if(!X)return!1;let $=X.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test($)}function Kz(X){let $=new Set,Z=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let Y of X){let J;while((J=Z.exec(Y))!==null)$.add(J[1]);Z.lastIndex=0}return[...$]}async function s1(X,$,Z,Y,J,G,Q,q=new Set,K){let{extractVariables:U}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (k7(),IX))),W=q??new Set;if(W.has(X))return`[Circular component reference: ${X}]`;let w=new Set(W);w.add(X);let z=typeof $.client==="string"?$.client.trim():"";if("client"in $)delete $.client;let B=z&&z!=="load"&&Qz(z)?z:"";try{let j=(D)=>D.split("-").map((v)=>v.charAt(0).toUpperCase()+v.slice(1)).join(""),_=(D)=>D.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=X.endsWith(".stx")?X.slice(0,-4):X,L=null,O=J.__importedComponents;if(O){let D=[H,H.toLowerCase(),j(H),_(H)];for(let v of D)if(O.has(v)){L=O.get(v);break}}let F=[];if(!L){let D=[`${H}.stx`,`${j(H)}.stx`,`${_(H)}.stx`],v=[...new Set(D)],u=J.__originalFilePath,f=[];if(u){let w0=g.join(g.dirname(u),"components");f.push(w0)}if(Y)f.push(Y);let o=Q._rootComponentsDir;if(typeof o==="string"&&!f.includes(o))f.push(o);let Z0=g.join(g.dirname(G),"components");if(!f.includes(Z0))f.push(Z0);if(Q.componentsDir&&Q.componentsDir!==Y&&!f.includes(Q.componentsDir))f.push(Q.componentsDir);let i0=Q._pluginComponentDirs;if(Array.isArray(i0)){for(let w0 of i0)if(typeof w0==="string"&&!f.includes(w0))f.push(w0)}let b0=typeof Q.root==="string"?g.resolve(Q.root):void 0,x0=b0??g.dirname(G),n0=[];if(b0)n0.push(g.resolve(b0,"resources/views/components")),n0.push(g.resolve(b0,"resources/components")),n0.push(g.resolve(b0,"src/components")),n0.push(g.resolve(b0,"components"));n0.push(g.resolve(import.meta.dir,"components"));for(let w0 of n0)if(!f.includes(w0))f.push(w0);let z5=[...new Set(f.map((w0)=>{if(!w0)return w0;return g.isAbsolute(w0)?w0:g.resolve(x0,w0)}))];f.length=0,f.push(...z5);let H1=`${H}\x00${G}\x00${z5.join("\x00")}`,O1=rX.get(H1);if(O1)if(await p(O1))L=O1;else rX.delete(H1);if(!L&&(H.startsWith("./")||H.startsWith("../")))L=g.resolve(g.dirname(G),`${H}.stx`),F.push(L);else if(!L)for(let w0 of f){if(!w0)continue;for(let a0 of v){let i=g.join(w0,a0);if(F.push(i),await p(i)){L=i;break}}if(L)break;if(!L)try{let a0=await import("fs");if(!a0.statSync(w0,{throwIfNoEntry:!1})?.isDirectory())continue;let t0=8,x1=[{path:w0,depth:0}];while(x1.length>0&&!L){let Q1=x1.pop();if(Q1.depth>=t0)continue;let s7;try{s7=a0.readdirSync(Q1.path,{withFileTypes:!0})}catch{continue}for(let a7 of s7){if(!a7.isDirectory())continue;if(a7.name==="node_modules"||a7.name.startsWith("."))continue;let c4=g.join(Q1.path,a7.name);for(let DK of v){let K$=g.join(c4,DK);if(F.push(K$),await p(K$)){L=K$;break}}if(L)break;x1.push({path:c4,depth:Q1.depth+1})}}}catch{}if(L)break}if(L)rX.set(H1,L)}if(!L||!await p(L)){let D=F.length>0?`
11555
11628
  Searched paths:
11556
11629
  ${F.map((v)=>` - ${v}`).join(`
11557
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${X}']${E}`}K.add(L);let V;if(nX.has(L))V=nX.get(L);else try{V=await Bun.file(L).text(),nX.set(L,V)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let A=new Set(["__originalFilePath","__importedComponents",OX]),R={};for(let[E,v]of Object.entries(J))if(!E.startsWith("__")||A.has(E))R[E]=v;let{extractSlotContent:T}=await t("stx/slots",()=>Promise.resolve().then(() => (q9(),Q9))),N=T(Z),k={};if(N.defaultSlot?.trim())k.default=N.defaultSlot;for(let[E,v]of N.namedSlots)k[E]=v.content;let M={...R,...$,props:$,slot:Z,$slots:k,__processedComponents:w,__sections:{},__stx_signals_gate:W1(V)||sw(Z)};rw(V,M);let y=V,I=TX(y);if(I)y=I.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...V.matchAll(C)],b=[],P=S.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&S.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,d=null;if(P){let E=lw({props:$,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(E!==null){x=`${L}\x00${E}`;let v=N9.get(x);if(v){for(let u of v.dependencies)K.add(u);return v.output}d=new Set(K)}}for(let E of S){let v=E[1]||"",u=E[2]||"",f=v.includes("server");if(d1(v)&&u.trim())u=m1(u);if(f&&u)try{await U(u,M,L)}catch(Z0){}if(!f){let Z0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),n0=Z0.includes("{{")&&Z0.includes("}}"),b0=Z0.includes("{!!")&&Z0.includes("!!}");if(n0||b0)Z0=AX(Z0,M);let x0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${x0}>${Z0}</script>`)}}let m=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Y0=m?m[1]:"",m0=m?m[2]:"",F0="",i0=Y0&&/\bscoped\b/i.test(Y0);if(m)F0=`<style${Y0}>${m0}</style>`;let l=y;if(l=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),m)l=l.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(l=l.replace(E,(u,f)=>{let o=f.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(o)v.push(`<style${o[1]}>${o[2]}</style>`);return""}),l=l.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)F0=`${F0}${v.join(`
11558
- `)}`}if(Z&&l.includes("{{ text || slot }}"))l=l.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:j0}=await t("stx/slots",()=>Promise.resolve().then(() => (q9(),Q9))),{defaultSlot:l0,namedSlots:_1}=N;l=await j0(l,l0,_1,M);let U5=b.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),W5=aw(b);if(W5.length>0)M.__stx_client_signal_names=W5;let r={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:g.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:U5||b.length===0,defaultLayout:void 0};M.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let a=await R0(l,M,L,r,K),K0=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let E of a.matchAll(/\{\{([\s\S]*?)\}\}/g))K0.add(E[1].trim());if(K0.size>0)J.__stx_preserved_client_expressions=[...K0];let T0=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++mw}_${Math.random().toString(36).slice(2,8)}`,J0=a;if(U5){let E="";if(Object.keys($).length>0)try{E=` data-stx-props="${sZ(JSON.stringify($))}"`}catch{}let v=B?` stx-hydrate="${sZ(B)}"`:"";J0=`<div data-stx-scope="${T0}"${E}${v}>${a}</div>`;let u=await Promise.all(b.map(async(f)=>{let o=f.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!o)return f;let[,Z0,n0]=o,b0=jX(n0,{filePath:L,projectRoot:process.cwd()}),x0=b0.code,r0=BX(b0.styles);x0=V5(x0).code;let{hasUserImports:w5,bundleClientScript:H1}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (j7(),z7)));if(w5(x0))x0=await H1(x0,L,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:O1}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (D7(),iX)));x0=x0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(Q1,o7)=>O1(o7));let w0=f0(x0),t0=pw(w0),i=`function(__scopeId) {
11559
- ${L5("const",[...c2,...t0],w0)}
11630
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${X}']${D}`}K.add(L);let V;if(nX.has(L))V=nX.get(L);else try{V=await Bun.file(L).text(),nX.set(L,V)}catch(D){return`[Error loading component: ${D instanceof Error?D.message:String(D)}]`}let A=new Set(["__originalFilePath","__importedComponents",LX]),R={};for(let[D,v]of Object.entries(J))if(!D.startsWith("__")||A.has(D))R[D]=v;let{extractSlotContent:N}=await t("stx/slots",()=>Promise.resolve().then(() => (q9(),Q9))),T=N(Z),k={};if(T.defaultSlot?.trim())k.default=T.defaultSlot;for(let[D,v]of T.namedSlots)k[D]=v.content;let M={...R,...$,props:$,slot:Z,$slots:k,__processedComponents:w,__sections:{},__stx_signals_gate:W1(V)||qz(Z)};Gz(V,M);let y=V,I=TX(y);if(I)y=I.content.trim();let C=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...V.matchAll(C)],b=[],P=S.some((D)=>/\bserver\b/.test(D[1]||"")&&/\bcache\b/.test(D[1]||""))&&S.every((D)=>/\bserver\b/.test(D[1]||"")),x=null,d=null;if(P){let D=Xz({props:$,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(D!==null){x=`${L}\x00${D}`;let v=b9.get(x);if(v){for(let u of v.dependencies)K.add(u);return v.output}d=new Set(K)}}for(let D of S){let v=D[1]||"",u=D[2]||"",f=v.includes("server");if(d1(v)&&u.trim())u=m1(u);if(f&&u)try{await U(u,M,L)}catch(Z0){}if(!f){let Z0=u.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),i0=Z0.includes("{{")&&Z0.includes("}}"),b0=Z0.includes("{!!")&&Z0.includes("!!}");if(i0||b0)Z0=RX(Z0,M);let x0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${x0}>${Z0}</script>`)}}let m=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),Y0=m?m[1]:"",d0=m?m[2]:"",F0="",p0=Y0&&/\bscoped\b/i.test(Y0);if(m)F0=`<style${Y0}>${d0}</style>`;let l=y;if(l=l.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),m)l=l.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let D=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(l=l.replace(D,(u,f)=>{let o=f.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(o)v.push(`<style${o[1]}>${o[2]}</style>`);return""}),l=l.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)F0=`${F0}${v.join(`
11631
+ `)}`}if(Z&&l.includes("{{ text || slot }}"))l=l.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:j0}=await t("stx/slots",()=>Promise.resolve().then(() => (q9(),Q9))),{defaultSlot:m0,namedSlots:_1}=T;l=await j0(l,m0,_1,M);let W5=b.some((D)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(D)),w5=Kz(b);if(w5.length>0)M.__stx_client_signal_names=w5;let r={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:g.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:W5||b.length===0,defaultLayout:void 0};M.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let a=await R0(l,M,L,r,K),K0=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let D of a.matchAll(/\{\{([\s\S]*?)\}\}/g))K0.add(D[1].trim());if(K0.size>0)J.__stx_preserved_client_expressions=[...K0];let N0=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++ew}_${Math.random().toString(36).slice(2,8)}`,J0=a;if(W5){let D="";if(Object.keys($).length>0)try{D=` data-stx-props="${qY(JSON.stringify($))}"`}catch{}let v=B?` stx-hydrate="${qY(B)}"`:"";J0=`<div data-stx-scope="${N0}"${D}${v}>${a}</div>`;let u=await Promise.all(b.map(async(f)=>{let o=f.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!o)return f;let[,Z0,i0]=o,b0=_X(i0,{filePath:L,projectRoot:process.cwd()}),x0=b0.code,n0=HX(b0.styles);x0=A5(x0).code;let{hasUserImports:z5,bundleClientScript:H1}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (B7(),j7)));if(z5(x0))x0=await H1(x0,L,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:O1}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (y7(),iX)));x0=x0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(Q1,s7)=>O1(s7));let w0=f0(x0),a0=Zz(w0),i=`function(__scopeId) {
11632
+ ${F5("const",[...a2,...a0],w0)}
11560
11633
  const __scope = window.stx._scopes = window.stx._scopes || {};
11561
11634
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
11562
11635
  const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
@@ -11574,7 +11647,7 @@ ${w0}
11574
11647
  // Register all defined signals and functions in this scope
11575
11648
  const __localVars = {};
11576
11649
  try {
11577
- ${t0.map((Q1)=>`if (typeof ${Q1} !== 'undefined') __localVars['${Q1}'] = ${Q1};`).join(`
11650
+ ${a0.map((Q1)=>`if (typeof ${Q1} !== 'undefined') __localVars['${Q1}'] = ${Q1};`).join(`
11578
11651
  `)}
11579
11652
  }
11580
11653
  catch (e) {}
@@ -11583,15 +11656,15 @@ catch (e) {}
11583
11656
  finally {
11584
11657
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
11585
11658
  }
11586
- }`,e0=B?null:R6(J,i),x1=e0?`window.__stxComponentFactories[${JSON.stringify(e0)}](${JSON.stringify(T0)});`:`(${i})(${JSON.stringify(T0)});`;if(B)return`${r0}<script type="stx/island" data-stx-island="${T0}" data-stx-scoped${Z0}>${x1}</script>`;return`${r0}<script data-stx-scoped data-stx-run="always"${Z0}>${x1}</script>`}));if(J0=J0+`
11659
+ }`,t0=B?null:E6(J,i),x1=t0?`window.__stxComponentFactories[${JSON.stringify(t0)}](${JSON.stringify(N0)});`:`(${i})(${JSON.stringify(N0)});`;if(B)return`${n0}<script type="stx/island" data-stx-island="${N0}" data-stx-scoped${Z0}>${x1}</script>`;return`${n0}<script data-stx-scoped data-stx-run="always"${Z0}>${x1}</script>`}));if(J0=J0+`
11587
11660
  `+u.join(`
11588
11661
  `),F0)J0+=`
11589
11662
  `+F0}else{if(F0)J0+=`
11590
- `+F0;if(b.length>0){let E=M.__stx_event_bindings||[],v=H7(M),u=await Promise.all(b.map(async(f)=>{let o=f.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!o)return f;return await O7(o[1],{eventBindings:E,templateContent:J0,filePath:L,projectRoot:process.cwd(),serverData:v})}));J0+=`
11663
+ `+F0;if(b.length>0){let D=M.__stx_event_bindings||[],v=O7(M),u=await Promise.all(b.map(async(f)=>{let o=f.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!o)return f;return await L7(o[1],{eventBindings:D,templateContent:J0,filePath:L,projectRoot:process.cwd(),serverData:v})}));J0+=`
11591
11664
  `+u.join(`
11592
- `),M.__stx_event_bindings=[]}}if(i0){let E=RX(J0,L);if(E.hasScoped)J0=E.html}if(x&&d)N9.set(x,{output:J0,dependencies:[...K].filter((E)=>!d.has(E))});return J0}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{W.delete(X)}}async function p(X){return Bun.file(X).exists()}function M9(X,$){let Z=g.resolve($),Y=g.resolve(X),J=Z.endsWith(g.sep)?Z:Z+g.sep;if(Y===Z||Y.startsWith(J))return Y;return null}async function k9(X,$,Z,Y){let J=await tw(X,$,Z,Y);if(J===null)return null;let G=M9(J,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((q)=>typeof q==="string"&&q.length>0);for(let q of Q){let K=g.isAbsolute(q)?q:g.resolve(process.cwd(),q);if(M9(J,K))return g.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${X}, from: ${$})`),null}async function tw(X,$,Z,Y){if(Z.debug)console.log(`Resolving template path: ${X} from ${$}`);let J=g.dirname($),G=process.cwd();if(X.startsWith("/")){let z=g.join(G,X),B=M9(z,G);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${X} (from ${$})`),null;if(Z.debug)console.log(`Checking absolute path: ${B}`);if(await p(B)&&Y)Y.add(B);return B}let Q=g.join(J,X);if(await p(Q)){if(Z.debug)console.log(`Found direct path: ${Q}`);if(Y)Y.add(Q);return Q}if(!X.endsWith(".stx")&&!X.endsWith(".jsx")&&!X.endsWith(".tsx"))for(let z of[".stx",".tsx",".jsx"]){let B=`${Q}${z}`;if(await p(B)){if(Z.debug)console.log(`Found direct path with extension: ${B}`);if(Y)Y.add(B);return B}}let q="",K=g.resolve(J),U=process.cwd();for(let z=0;z<10;z++){let B=g.join(K,"layouts"),j=!1;try{j=dw.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){q=B;break}let _=g.dirname(K);if(_===K||_.length<U.length)break;K=_}if(q){let z=X.startsWith("layouts/")?X.slice(8):X,B=g.join(q,z);if(await p(B)){if(Z.debug)console.log(`Found in current layouts dir: ${B}`);if(Y)Y.add(B);return B}if(!z.endsWith(".stx")){let j=`${B}.stx`;if(await p(j)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(Z.layoutsDir){let z=g.isAbsolute(Z.layoutsDir)?Z.layoutsDir:g.resolve(process.cwd(),Z.layoutsDir),B=X.startsWith("layouts/")?X.slice(8):X,j=g.join(z,B);if(await p(j)){if(Z.debug)console.log(`Found in options.layoutsDir: ${j}`);if(Y)Y.add(j);return j}if(!X.endsWith(".stx")){let _=`${j}.stx`;if(await p(_)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(Y)Y.add(_);return _}}}if(X.startsWith("layouts/")||X.includes("/layouts/")){let z=X.split("layouts/"),B=g.join(Z.partialsDir||J,"layouts",z[1]);if(await p(B)){if(Z.debug)console.log(`Found in layouts path: ${B}`);if(Y)Y.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await p(j)){if(Z.debug)console.log(`Found in layouts path with extension: ${j}`);if(Y)Y.add(j);return j}}}if(Z.partialsDir){if(q=g.join(Z.partialsDir,"layouts"),await p(q)){let z=g.join(q,X);if(await p(z)){if(Z.debug)console.log(`Found in partials layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let B=`${z}.stx`;if(await p(B)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}}let W=Z.partialsDir||g.join(process.cwd(),"views"),w=g.join(W,X);if(await p(w)){if(Z.debug)console.log(`Found in views path: ${w}`);if(Y)Y.add(w);return w}if(!X.endsWith(".stx")){let z=`${w}.stx`;if(await p(z)){if(Z.debug)console.log(`Found in views path with extension: ${z}`);if(Y)Y.add(z);return z}}if(J.includes("temp")){let z=g.join(g.dirname(J),"layouts",X);if(await p(z)){if(Z.debug)console.log(`Found in temp layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let B=`${z}.stx`;if(await p(B)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${X} (referenced from ${$})`);else console.warn(`Template not found: ${X} (referenced from ${$})`);return null}function aZ(X,$,Z){let Y=0,J="",G="";try{if(typeof $==="number"&&$>=0){let Q=X.split(`
11665
+ `),M.__stx_event_bindings=[]}}if(p0){let D=NX(J0,L);if(D.hasScoped)J0=D.html}if(x&&d)b9.set(x,{output:J0,dependencies:[...K].filter((D)=>!d.has(D))});return J0}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{W.delete(X)}}async function p(X){return Bun.file(X).exists()}function S9(X,$){let Z=g.resolve($),Y=g.resolve(X),J=Z.endsWith(g.sep)?Z:Z+g.sep;if(Y===Z||Y.startsWith(J))return Y;return null}async function C9(X,$,Z,Y){let J=await Uz(X,$,Z,Y);if(J===null)return null;let G=S9(J,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((q)=>typeof q==="string"&&q.length>0);for(let q of Q){let K=g.isAbsolute(q)?q:g.resolve(process.cwd(),q);if(S9(J,K))return g.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${X}, from: ${$})`),null}async function Uz(X,$,Z,Y){if(Z.debug)console.log(`Resolving template path: ${X} from ${$}`);let J=g.dirname($),G=process.cwd();if(X.startsWith("/")){let z=g.join(G,X),B=S9(z,G);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${X} (from ${$})`),null;if(Z.debug)console.log(`Checking absolute path: ${B}`);if(await p(B)&&Y)Y.add(B);return B}let Q=g.join(J,X);if(await p(Q)){if(Z.debug)console.log(`Found direct path: ${Q}`);if(Y)Y.add(Q);return Q}if(!X.endsWith(".stx")&&!X.endsWith(".jsx")&&!X.endsWith(".tsx"))for(let z of[".stx",".tsx",".jsx"]){let B=`${Q}${z}`;if(await p(B)){if(Z.debug)console.log(`Found direct path with extension: ${B}`);if(Y)Y.add(B);return B}}let q="",K=g.resolve(J),U=process.cwd();for(let z=0;z<10;z++){let B=g.join(K,"layouts"),j=!1;try{j=tw.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){q=B;break}let _=g.dirname(K);if(_===K||_.length<U.length)break;K=_}if(q){let z=X.startsWith("layouts/")?X.slice(8):X,B=g.join(q,z);if(await p(B)){if(Z.debug)console.log(`Found in current layouts dir: ${B}`);if(Y)Y.add(B);return B}if(!z.endsWith(".stx")){let j=`${B}.stx`;if(await p(j)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(Z.layoutsDir){let z=g.isAbsolute(Z.layoutsDir)?Z.layoutsDir:g.resolve(process.cwd(),Z.layoutsDir),B=X.startsWith("layouts/")?X.slice(8):X,j=g.join(z,B);if(await p(j)){if(Z.debug)console.log(`Found in options.layoutsDir: ${j}`);if(Y)Y.add(j);return j}if(!X.endsWith(".stx")){let _=`${j}.stx`;if(await p(_)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(Y)Y.add(_);return _}}}if(X.startsWith("layouts/")||X.includes("/layouts/")){let z=X.split("layouts/"),B=g.join(Z.partialsDir||J,"layouts",z[1]);if(await p(B)){if(Z.debug)console.log(`Found in layouts path: ${B}`);if(Y)Y.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await p(j)){if(Z.debug)console.log(`Found in layouts path with extension: ${j}`);if(Y)Y.add(j);return j}}}if(Z.partialsDir){if(q=g.join(Z.partialsDir,"layouts"),await p(q)){let z=g.join(q,X);if(await p(z)){if(Z.debug)console.log(`Found in partials layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let B=`${z}.stx`;if(await p(B)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}}let W=Z.partialsDir||g.join(process.cwd(),"views"),w=g.join(W,X);if(await p(w)){if(Z.debug)console.log(`Found in views path: ${w}`);if(Y)Y.add(w);return w}if(!X.endsWith(".stx")){let z=`${w}.stx`;if(await p(z)){if(Z.debug)console.log(`Found in views path with extension: ${z}`);if(Y)Y.add(z);return z}}if(J.includes("temp")){let z=g.join(g.dirname(J),"layouts",X);if(await p(z)){if(Z.debug)console.log(`Found in temp layouts dir: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let B=`${z}.stx`;if(await p(B)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${X} (referenced from ${$})`);else console.warn(`Template not found: ${X} (referenced from ${$})`);return null}function KY(X,$,Z){let Y=0,J="",G="";try{if(typeof $==="number"&&$>=0){let Q=X.split(`
11593
11666
  `),q=0;for(let K=0;K<Q.length;K++)if(q+=Q[K].length+1,q>=$){Y=K+1,J=Q[K].trim();let U=Math.max(0,K-2),W=Math.min(Q.length,K+3);G=Q.slice(U,W).map((w,z)=>{let B=U+z+1;return`${B===Y?"> ":" "}${B}: ${w}`}).join(`
11594
- `);break}}else if(Z){let Q=X.indexOf(Z);if(Q>=0)return aZ(X,Q)}}catch{}return{lineNumber:Y,lineContent:J,context:G}}function U0(X,$,Z,Y,J,G){let{lineNumber:Q,context:q}=aZ(Y,J,G),K=Z.split("/").pop(),U=0;if(typeof J==="number"&&J>=0&&Y){let w=Y.lastIndexOf(`
11667
+ `);break}}else if(Z){let Q=X.indexOf(Z);if(Q>=0)return KY(X,Q)}}catch{}return{lineNumber:Y,lineContent:J,context:G}}function U0(X,$,Z,Y,J,G){let{lineNumber:Q,context:q}=KY(Y,J,G),K=Z.split("/").pop(),U=0;if(typeof J==="number"&&J>=0&&Y){let w=Y.lastIndexOf(`
11595
11668
  `,Math.max(0,J-1));U=J-(w+1)+1}let W="";if(Q>0)W+=`
11596
11669
  ${Z}:${Q}${U>0?`:${U}`:""}: ${X.toLowerCase()} error: ${$}
11597
11670
  `;if(W+=`
@@ -11604,8 +11677,8 @@ ${e.yellow}${e.bold}Message:${e.reset} ${$}
11604
11677
  `,q)W+=`
11605
11678
  ${e.blue}${e.bold}Context:${e.reset}
11606
11679
  ${e.dim}${q}${e.reset}
11607
- `;return W}function vZ(){nX.clear(),rX.clear(),N9.clear()}var nX,rX,N9,mw=0,e;var A0=D(()=>{L7();i$();Z1();X1();N5();sX();F1();t$();e$();w7();s6();M7();nX=new c1(500),rX=new c1(1000),N9=new c1(2000);e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function tZ(X,$,Z=""){let Y=X,J=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec(X))!==null){let q=Q.index,K=Q[0].match(/@markdown\(([^)]*)\)/),U=K?K[1]:"",W=q+Q[0].length,w=1,z=W,B=-1;while(w>0&&z<X.length){let H=X.indexOf("@markdown",z),L=X.indexOf("@endmarkdown",z);if(L===-1)break;if(H!==-1&&H<L&&H!==q){let O=X[H+9];if(O==="("||O===`
11608
- `||O==="\r"||O===" "||O===void 0)w++;z=H+9}else{if(w--,w===0){B=L;break}z=L+12}}if(B===-1)continue;let j=X.slice(W,B),_=X.slice(q,B+12);J.push({fullMatch:_,options:U,content:j,index:q}),G.lastIndex=B+12}for(let{fullMatch:q,options:K,content:U,index:W}of J)try{let w={};if(K)K.split(",").forEach((j)=>{let _=j.trim();if(_)w[_]=!0});let z={gfm:w.gfm??!0,breaks:w.breaks??!1},B=W7(U.trim(),z);Y=Y.split(q).join(B)}catch(w){let z=w instanceof Error?w.message:String(w),B=U0("Markdown Directive",`Error processing markdown: ${z}`,Z,X,W,q);Y=Y.split(q).join(B)}return Y}async function eZ(X,$,Z,Y){let J={gfm:!0,breaks:!1};return $.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")J.breaks=!0;if(Q==="no-gfm")J.gfm=!1}),W7(X.trim(),J)}var I9=D(()=>{A0()});function $z(X){if(ew.set(X.name,X),X.client)Xz.set(X.name,X.client)}function aX(X){return $z(X),{name:X.name,hasEndTag:X.hasEndTag??!0,description:X.description,handler:async(Z,Y,J,G)=>{let Q=Zz(Y,X.defaults);if(X.validate){let K=X.validate(Q);if(K!==!0){let U=typeof K==="string"?K:`Invalid parameters for @${X.name}`;throw Error(U)}}let q=Z;if(X.transform)q=await X.transform(Z,Q,J,G);if(X.clientScript){let K=X.clientScript(Q);q+=`<script>${K}</script>`}if(X.css){let K=X.css(Q);q+=`<style>${K}</style>`}return q}}}function Zz(X,$){let Z={...$};for(let Y of X){let J=Y.indexOf(":"),G=Y.indexOf("="),Q=J>=0&&(G<0||J<G)?J:G;if(Q>=0){let q=Y.slice(0,Q).trim(),K=Y.slice(Q+1).trim();if(K==="true")K=!0;else if(K==="false")K=!1;else if(K==="null")K=null;else if(!Number.isNaN(Number(K)))K=Number(K);else if(typeof K==="string"&&K.startsWith("{"))try{K=JSON.parse(K)}catch{}Z[q]=K}else{let q=Object.keys(Z).filter((K)=>!$||!(K in $)).length;Z[q===0?"value":`arg${q}`]=Y}}return Z}var ew,Xz;var E9=D(()=>{ew=new Map,Xz=new Map});function D9(X,$=E5,Z={},Y){return $.sort((J,G)=>J-G).map((J)=>{return`${b7(X,{...Z,w:J,fm:Y})} ${J}w`}).join(", ")}function XY(X,$,Z=Yz,Y={},J){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round($*G);return`${b7(X,{...Y,w:Q,dpr:G,fm:J})} ${G}x`}).join(", ")}function y9(X,$="100vw"){if(!X||Object.keys(X).length===0)return $;let Y=Object.entries(X).map(([J,G])=>{let Q=/^\d+$/.test(J)?`${J}px`:J;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((J,G)=>J.numericBp-G.numericBp).map(({bp:J,size:G})=>`(max-width: ${J}) ${G}`);return Y.push($),Y.join(", ")}function b7(X,$={}){let Z=Object.entries($).filter(([,G])=>G!==void 0&&G!==null).map(([G,Q])=>{if(Array.isArray(Q))return[G,Q.join(",")];return[G,String(Q)]});if(Z.length===0)return X;let Y=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),J=X.includes("?")?"&":"?";return`${X}${J}${Y}`}function b9(X){return Jz[X]||"application/octet-stream"}var E5,Yz,y7,Jz;var S9=D(()=>{E5=[320,480,640,768,1024,1280,1536,1920,2560],Yz=[1,1.5,2,3],y7=["avif","webp","jpeg"],Jz={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function Qz(){try{return await import("ts-images")}catch{return null}}async function qz(X,$={}){let Z={...Gz,...$},Y=await Qz();if(Y)try{return await Kz(X,Z,Y)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return Uz(X,Z)}async function Kz(X,$,Z){let{generatePlaceholder:Y,generateThumbHash:J}=Z,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[$.strategy]||"blur";if($.strategy==="thumbhash")return{dataURL:(await J(X)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let q=await Y(X,{width:$.width,height:$.height,quality:$.quality,blurLevel:$.blurLevel,strategy:Q,base64Encode:!0});return{dataURL:q.dataURL,width:q.width,height:q.height,aspectRatio:q.aspectRatio,originalWidth:q.originalWidth,originalHeight:q.originalHeight,strategy:$.strategy,dominantColor:q.dominantColor,css:q.css}}function Uz(X,$){let Z=$.width||20,Y=$.height||Z,J="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}" viewBox="0 0 ${Z} ${Y}"><rect fill="#e5e7eb" width="${Z}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:Y,aspectRatio:Z/Y,originalWidth:0,originalHeight:0,strategy:$.strategy,dominantColor:"#e5e7eb"}}function $Y(X,$,Z={}){let Y=Z.transitionDuration||300,J=Z.easing||"ease-out";return`
11680
+ `;return W}function iZ(){nX.clear(),rX.clear(),b9.clear()}var nX,rX,b9,ew=0,e;var A0=E(()=>{F7();i$();Z1();e0();M5();sX();F1();t$();e$();z7();ZZ();k7();nX=new c1(500),rX=new c1(1000),b9=new c1(2000);e={reset:"\x1B[0m",bold:"\x1B[1m",dim:"\x1B[2m",red:"\x1B[31m",yellow:"\x1B[33m",blue:"\x1B[34m",cyan:"\x1B[36m",gray:"\x1B[90m",bgRed:"\x1B[41m",bgYellow:"\x1B[43m"}});async function UY(X,$,Z=""){let Y=X,J=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec(X))!==null){let q=Q.index,K=Q[0].match(/@markdown\(([^)]*)\)/),U=K?K[1]:"",W=q+Q[0].length,w=1,z=W,B=-1;while(w>0&&z<X.length){let H=X.indexOf("@markdown",z),L=X.indexOf("@endmarkdown",z);if(L===-1)break;if(H!==-1&&H<L&&H!==q){let O=X[H+9];if(O==="("||O===`
11681
+ `||O==="\r"||O===" "||O===void 0)w++;z=H+9}else{if(w--,w===0){B=L;break}z=L+12}}if(B===-1)continue;let j=X.slice(W,B),_=X.slice(q,B+12);J.push({fullMatch:_,options:U,content:j,index:q}),G.lastIndex=B+12}for(let{fullMatch:q,options:K,content:U,index:W}of J)try{let w={};if(K)K.split(",").forEach((j)=>{let _=j.trim();if(_)w[_]=!0});let z={gfm:w.gfm??!0,breaks:w.breaks??!1},B=w7(U.trim(),z);Y=Y.split(q).join(B)}catch(w){let z=w instanceof Error?w.message:String(w),B=U0("Markdown Directive",`Error processing markdown: ${z}`,Z,X,W,q);Y=Y.split(q).join(B)}return Y}async function WY(X,$,Z,Y){let J={gfm:!0,breaks:!1};return $.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")J.breaks=!0;if(Q==="no-gfm")J.gfm=!1}),w7(X.trim(),J)}var P9=E(()=>{A0()});function zz(X){if(Wz.set(X.name,X),X.client)wz.set(X.name,X.client)}function aX(X){return zz(X),{name:X.name,hasEndTag:X.hasEndTag??!0,description:X.description,handler:async(Z,Y,J,G)=>{let Q=jz(Y,X.defaults);if(X.validate){let K=X.validate(Q);if(K!==!0){let U=typeof K==="string"?K:`Invalid parameters for @${X.name}`;throw Error(U)}}let q=Z;if(X.transform)q=await X.transform(Z,Q,J,G);if(X.clientScript){let K=X.clientScript(Q);q+=`<script>${K}</script>`}if(X.css){let K=X.css(Q);q+=`<style>${K}</style>`}return q}}}function jz(X,$){let Z={...$};for(let Y of X){let J=Y.indexOf(":"),G=Y.indexOf("="),Q=J>=0&&(G<0||J<G)?J:G;if(Q>=0){let q=Y.slice(0,Q).trim(),K=Y.slice(Q+1).trim();if(K==="true")K=!0;else if(K==="false")K=!1;else if(K==="null")K=null;else if(!Number.isNaN(Number(K)))K=Number(K);else if(typeof K==="string"&&K.startsWith("{"))try{K=JSON.parse(K)}catch{}Z[q]=K}else{let q=Object.keys(Z).filter((K)=>!$||!(K in $)).length;Z[q===0?"value":`arg${q}`]=Y}}return Z}var Wz,wz;var v9=E(()=>{Wz=new Map,wz=new Map});function x9(X,$=D5,Z={},Y){return $.sort((J,G)=>J-G).map((J)=>{return`${S7(X,{...Z,w:J,fm:Y})} ${J}w`}).join(", ")}function wY(X,$,Z=Bz,Y={},J){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round($*G);return`${S7(X,{...Y,w:Q,dpr:G,fm:J})} ${G}x`}).join(", ")}function f9(X,$="100vw"){if(!X||Object.keys(X).length===0)return $;let Y=Object.entries(X).map(([J,G])=>{let Q=/^\d+$/.test(J)?`${J}px`:J;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((J,G)=>J.numericBp-G.numericBp).map(({bp:J,size:G})=>`(max-width: ${J}) ${G}`);return Y.push($),Y.join(", ")}function S7(X,$={}){let Z=Object.entries($).filter(([,G])=>G!==void 0&&G!==null).map(([G,Q])=>{if(Array.isArray(Q))return[G,Q.join(",")];return[G,String(Q)]});if(Z.length===0)return X;let Y=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),J=X.includes("?")?"&":"?";return`${X}${J}${Y}`}function g9(X){return _z[X]||"application/octet-stream"}var D5,Bz,b7,_z;var h9=E(()=>{D5=[320,480,640,768,1024,1280,1536,1920,2560],Bz=[1,1.5,2,3],b7=["avif","webp","jpeg"],_z={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function Oz(){try{return await import("ts-images")}catch{return null}}async function Lz(X,$={}){let Z={...Hz,...$},Y=await Oz();if(Y)try{return await Fz(X,Z,Y)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return Vz(X,Z)}async function Fz(X,$,Z){let{generatePlaceholder:Y,generateThumbHash:J}=Z,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[$.strategy]||"blur";if($.strategy==="thumbhash")return{dataURL:(await J(X)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let q=await Y(X,{width:$.width,height:$.height,quality:$.quality,blurLevel:$.blurLevel,strategy:Q,base64Encode:!0});return{dataURL:q.dataURL,width:q.width,height:q.height,aspectRatio:q.aspectRatio,originalWidth:q.originalWidth,originalHeight:q.originalHeight,strategy:$.strategy,dominantColor:q.dominantColor,css:q.css}}function Vz(X,$){let Z=$.width||20,Y=$.height||Z,J="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}" viewBox="0 0 ${Z} ${Y}"><rect fill="#e5e7eb" width="${Z}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:Y,aspectRatio:Z/Y,originalWidth:0,originalHeight:0,strategy:$.strategy,dominantColor:"#e5e7eb"}}function zY(X,$,Z={}){let Y=Z.transitionDuration||300,J=Z.easing||"ease-out";return`
11609
11682
  #${X} {
11610
11683
  --stx-img-transition-duration: ${Y}ms;
11611
11684
  --stx-img-transition-easing: ${J};
@@ -11622,7 +11695,7 @@ ${e.dim}${q}${e.reset}
11622
11695
  #${X}.stx-img-loaded img {
11623
11696
  opacity: 1;
11624
11697
  }
11625
- `.trim()}async function ZY(X,$={}){let Z=`${X}:${JSON.stringify($)}`;if(C9.has(Z))return C9.get(Z);let Y=await qz(X,$);return C9.set(Z,Y),Y}var Gz,P9,C9;var YY=D(()=>{Gz={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},P9=`
11698
+ `.trim()}async function jY(X,$={}){let Z=`${X}:${JSON.stringify($)}`;if(u9.has(Z))return u9.get(Z);let Y=await Lz(X,$);return u9.set(Z,Y),Y}var Hz,d9,u9;var BY=E(()=>{Hz={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},d9=`
11626
11699
  .stx-img-placeholder {
11627
11700
  position: relative;
11628
11701
  overflow: hidden;
@@ -11651,8 +11724,8 @@ ${e.dim}${q}${e.reset}
11651
11724
  filter: blur(0);
11652
11725
  transform: scale(1);
11653
11726
  }
11654
- `.trim();C9=new Map});import{createHash as GY}from"crypto";import{readFile as Wz,stat as QY}from"fs/promises";async function D0(X){try{let $=await Wz(X);return GY("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function JY(X){return GY("sha256").update(X).digest("hex").slice(0,16)}function tX(X,$){let Z=JSON.stringify($,Object.keys($).sort());return`${JY(X)}-${JY(Z)}`}async function v9(X){try{return(await QY(X)).mtimeMs}catch{return 0}}async function M0(X){try{return await QY(X),!0}catch{return!1}}var s1=()=>{};import{mkdir as wz,readFile as zz,writeFile as jz,readdir as YR,rm as Bz,stat as JR}from"fs/promises";import{join as KY,dirname as _z}from"path";async function Hz(X){try{await wz(X,{recursive:!0})}catch{}}function UY(X,$,Z){return KY(X,Z,`${$}.json`)}async function qY(X,$,Z){if((Date.now()-X.createdAt)/86400000>Z)return!1;if(await v9($)!==X.srcMtime)return!1;return!0}async function eX(X,$,Z,Y=x9){if(!Y.enabled)return null;let J=tX(X,$),G=D5.get(J);if(G){if(await qY(G,X,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;D5.delete(J)}let Q=UY(Y.directory,J,Z);if(await M0(Q))try{let q=await zz(Q,"utf-8"),K=JSON.parse(q);if(await qY(K,X,Y.maxAge))return K.lastAccessedAt=Date.now(),D5.set(J,K),K.data}catch{}return null}async function X8(X,$,Z,Y,J=x9){if(!J.enabled)return;let G=tX(X,$),Q=await D0(X),q=await v9(X),K={key:G,src:X,srcHash:Q,srcMtime:q,optionsHash:tX("",$),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};D5.set(G,K);let U=UY(J.directory,G,Y);try{await Hz(_z(U)),await jz(U,JSON.stringify(K,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function $8(X,$=x9){if(X==="all")D5.clear();else D5.clear();let Z=X==="all"?["image","video"]:[X];for(let Y of Z){let J=KY($.directory,Y);try{await Bz(J,{recursive:!0,force:!0})}catch{}}}var D5,x9;var f9=D(()=>{s1();D5=new Map,x9={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class Y8{config;constructor(X={}){this.config={...Oz,...X}}async get(X,$){return eX(X,$,"image",this.config)}async set(X,$,Z){return X8(X,$,Z,"image",this.config)}async clear(){return $8("image",this.config)}updateConfig(X){this.config={...this.config,...X}}}function g9(X){if(!Z8)Z8=new Y8(X);else if(X)Z8.updateConfig(X);return Z8}async function J8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return g9(Y).get(X,$)}async function G8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return g9(J).set(X,$,Z)}async function WY(){return g9().clear()}var Oz,Z8=null;var h9=D(()=>{f9();Oz={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as Lz,basename as Fz,extname as Vz,join as Az}from"path";import{mkdir as Rz}from"fs/promises";async function u9(){try{return await import("ts-images")}catch{return null}}function wY(X){switch(X){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 Tz(X,$){let Z=$?wY($):wY("web"),Y=X.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function zY(X,$,Z){let Y=await u9();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:X,processed:!1};let J=await J8(X,$,Z);if(J)return J;try{let G=Lz(X);if(!await M0(G))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let Q=Tz(Z,$.preset),q=Z.outputDir||"dist/images",K=Z.baseUrl||"/images";await Rz(q,{recursive:!0});let U=await D0(G),W=Fz(X,Vz(X)),w=$.outputFormat?[$.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],z={src:X,processed:!0,variants:[],hash:U},B=null;if($.transformations&&$.transformations.length>0)B=await d9(G,$.transformations,Y);for(let j of w){let _=Q[j]||{},H=`${W}-${U}.${j}`,L=Az(q,H);try{let O=await Y.optimizeImage({input:B||G,output:L,format:j,quality:_.quality,progressive:_.progressive});if(O){if(z.variants.push({path:L,url:`${K}/${H}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!z.originalWidth&&O.width)z.originalWidth=O.width,z.originalHeight=O.height}}catch(O){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${j}: ${O}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let j=await Y.generateThumbHash(G);z.placeholder=j.dataUrl}catch(j){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${j}`)}if($.useDominantColor)try{let j=await Y.generatePlaceholder(G,{strategy:"dominant-color"});z.dominantColor=j.dominantColor}catch(j){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${j}`)}return await G8(X,$,z,Z),z}catch(G){return{src:X,processed:!1,errors:[`Processing failed: ${G}`]}}}async function jY(X,$,Z,Y){let J=await u9();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:X,output:Y,format:$,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function d9(X,$,Z){let Y=Z||await u9();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode(X);for(let G of $){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var BY=D(()=>{s1();h9()});import{resolve as Nz,basename as Mz,extname as kz,join as Iz}from"path";import{mkdir as Ez}from"fs/promises";async function Dz(){try{return await import("ts-images")}catch{return null}}async function _Y(X,$,Z){let Y=await Dz();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=Nz(X);if(!await M0(J))return console.warn(`[stx-media] Source file not found: ${X}`),null;try{let G=$.responsiveWidths||Z.breakpoints||yz,Q=$.formats||Z.defaultFormats||["avif","webp","jpeg"],q=Z.outputDir||"dist/images",K=Z.baseUrl||"/images";await Ez(q,{recursive:!0});let U=await D0(J),W=Mz(X,kz(X)),w=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:X,byFormat:{},srcsets:{}};for(let j of Q){z.byFormat[j]=[];let _=[];for(let H of G){let L=`${W}-${H}w-${U}.${j}`,O=Iz(q,L),F=`${K}/${L}`;try{let V=w[j]?.quality||80;if(await M0(O)){z.byFormat[j].push({path:O,url:F,width:H,height:0,format:j,size:0}),_.push(`${F} ${H}w`);continue}let A=await Y.processImage({input:J,output:O,format:j,quality:V,resize:{width:H}});if(A)z.byFormat[j].push({path:O,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),_.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${j} at ${H}w: ${V}`)}}z.srcsets[j]=_.join(", ")}let B=$.placeholder||Z.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await Y.generateThumbHash(J);z.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await Y.generatePlaceholder(J,{strategy:B,width:20});z.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return z.sizes=$.sizes||bz(G),z}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function bz(X){let $=[...X].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<$.length-1;Y++){let J=$[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${$[$.length-1]}px`),Z.join(", ")}function HY(X,$="width"){if(!X||X.length===0)return"";if($==="dpr")return X.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return X.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var yz;var OY=D(()=>{s1();yz=[320,480,640,768,1024,1280,1536,1920]});var LY={};n(LY,{setCachedImageResult:()=>G8,processImage:()=>zY,optimizeImage:()=>jY,getCachedImageResult:()=>J8,generateSrcset:()=>HY,generateResponsiveVariants:()=>_Y,clearImageCache:()=>WY,applyTransformations:()=>d9,ImageProcessorCache:()=>Y8});var FY=D(()=>{BY();OY();h9()});async function Sz(){try{return await Promise.resolve().then(() => (FY(),LY))}catch(X){if(!VY)console.warn("[stx-media] Image processor not available, some features disabled:",X),VY=!0;return null}}async function Q8(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return xz(Y,Z)}if(Z.processedResult?.processed)return p9(X,Z.processedResult,$);if(Z.responsiveVariants)return NY(X,Z.responsiveVariants,$);let{src:J,alt:G,width:Q,height:q,sizes:K,widths:U=E5,dpr:W,formats:w=y7,quality:z=m9,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:H=!0,priority:L=!1,loading:O=L?"eager":K8,decoding:F=q8,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:T,referrerpolicy:N}=X,k=X.class,M=X.style,y=X.id,I=X.data||{},{isDev:C=!1,baseUrl:S=""}=$;if(C&&!$.optimize)return vz(X);let b,P,x=y||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!L)try{b=await ZY(J,{strategy:j,..._}),P=$Y(x,b,_)}catch{}let d=W!==void 0&&Q!==void 0,m;if(d)m=Pz(X,x,b,$);else m=await Cz(X,x,b,$);let Y0;if(L){let i0=w.includes("webp")?"webp":w[0],l=D9(J,U,{...B,q:z},i0),j0=typeof K==="object"?y9(K):K||"100vw";Y0=`<link rel="preload" as="image" imagesrcset="${l}" imagesizes="${j0}" />`}let m0=[];if(!AY&&j!=="none")m0.push(P9),AY=!0;if(P)m0.push(P);let F0=H?TY(x):void 0;return{html:m,preloadLink:Y0,css:m0.length>0?m0.join(`
11655
- `):void 0,script:F0}}async function Cz(X,$,Z,Y){let{src:J,alt:G,width:Q,height:q,sizes:K,widths:U=E5,formats:W=y7,quality:w=m9,params:z={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":K8,decoding:H=q8,fetchpriority:L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A}=X,R=X.class,T=X.style,N=X.data||{},k=typeof K==="object"?y9(K):K||"100vw",M=[];for(let C of W){let S=D9(J,U,{...z,q:w},C),b=b9(C);if(B&&!j)M.push(` <source type="${b}" data-srcset="${S}" data-sizes="${k}" />`);else M.push(` <source type="${b}" srcset="${S}" sizes="${k}" />`)}let y=l9({src:b7(J,{...z,q:w}),alt:G,width:Q,height:q,loading:j?void 0:_,decoding:H,fetchpriority:j?"high":L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A,className:RY(R,Z),style:c9(T,O,F,Z),lazy:B&&!j,data:N}),I;if(Z){let C=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${$}" class="stx-img-placeholder" style="${C}">
11727
+ `.trim();u9=new Map});import{createHash as HY}from"crypto";import{readFile as Az,stat as OY}from"fs/promises";async function D0(X){try{let $=await Az(X);return HY("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function _Y(X){return HY("sha256").update(X).digest("hex").slice(0,16)}function tX(X,$){let Z=JSON.stringify($,Object.keys($).sort());return`${_Y(X)}-${_Y(Z)}`}async function m9(X){try{return(await OY(X)).mtimeMs}catch{return 0}}async function M0(X){try{return await OY(X),!0}catch{return!1}}var a1=()=>{};import{mkdir as Rz,readFile as Nz,writeFile as Tz,readdir as AR,rm as Mz,stat as RR}from"fs/promises";import{join as FY,dirname as kz}from"path";async function Iz(X){try{await Rz(X,{recursive:!0})}catch{}}function VY(X,$,Z){return FY(X,Z,`${$}.json`)}async function LY(X,$,Z){if((Date.now()-X.createdAt)/86400000>Z)return!1;if(await m9($)!==X.srcMtime)return!1;return!0}async function eX(X,$,Z,Y=l9){if(!Y.enabled)return null;let J=tX(X,$),G=y5.get(J);if(G){if(await LY(G,X,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;y5.delete(J)}let Q=VY(Y.directory,J,Z);if(await M0(Q))try{let q=await Nz(Q,"utf-8"),K=JSON.parse(q);if(await LY(K,X,Y.maxAge))return K.lastAccessedAt=Date.now(),y5.set(J,K),K.data}catch{}return null}async function X8(X,$,Z,Y,J=l9){if(!J.enabled)return;let G=tX(X,$),Q=await D0(X),q=await m9(X),K={key:G,src:X,srcHash:Q,srcMtime:q,optionsHash:tX("",$),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};y5.set(G,K);let U=VY(J.directory,G,Y);try{await Iz(kz(U)),await Tz(U,JSON.stringify(K,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function $8(X,$=l9){if(X==="all")y5.clear();else y5.clear();let Z=X==="all"?["image","video"]:[X];for(let Y of Z){let J=FY($.directory,Y);try{await Mz(J,{recursive:!0,force:!0})}catch{}}}var y5,l9;var c9=E(()=>{a1();y5=new Map,l9={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class Y8{config;constructor(X={}){this.config={...Ez,...X}}async get(X,$){return eX(X,$,"image",this.config)}async set(X,$,Z){return X8(X,$,Z,"image",this.config)}async clear(){return $8("image",this.config)}updateConfig(X){this.config={...this.config,...X}}}function p9(X){if(!Z8)Z8=new Y8(X);else if(X)Z8.updateConfig(X);return Z8}async function J8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return p9(Y).get(X,$)}async function G8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return p9(J).set(X,$,Z)}async function AY(){return p9().clear()}var Ez,Z8=null;var i9=E(()=>{c9();Ez={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as Dz,basename as yz,extname as bz,join as Sz}from"path";import{mkdir as Cz}from"fs/promises";async function n9(){try{return await import("ts-images")}catch{return null}}function RY(X){switch(X){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 Pz(X,$){let Z=$?RY($):RY("web"),Y=X.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function NY(X,$,Z){let Y=await n9();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:X,processed:!1};let J=await J8(X,$,Z);if(J)return J;try{let G=Dz(X);if(!await M0(G))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let Q=Pz(Z,$.preset),q=Z.outputDir||"dist/images",K=Z.baseUrl||"/images";await Cz(q,{recursive:!0});let U=await D0(G),W=yz(X,bz(X)),w=$.outputFormat?[$.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],z={src:X,processed:!0,variants:[],hash:U},B=null;if($.transformations&&$.transformations.length>0)B=await r9(G,$.transformations,Y);for(let j of w){let _=Q[j]||{},H=`${W}-${U}.${j}`,L=Sz(q,H);try{let O=await Y.optimizeImage({input:B||G,output:L,format:j,quality:_.quality,progressive:_.progressive});if(O){if(z.variants.push({path:L,url:`${K}/${H}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!z.originalWidth&&O.width)z.originalWidth=O.width,z.originalHeight=O.height}}catch(O){z.errors=z.errors||[],z.errors.push(`Failed to optimize ${j}: ${O}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let j=await Y.generateThumbHash(G);z.placeholder=j.dataUrl}catch(j){z.errors=z.errors||[],z.errors.push(`Failed to generate thumbhash: ${j}`)}if($.useDominantColor)try{let j=await Y.generatePlaceholder(G,{strategy:"dominant-color"});z.dominantColor=j.dominantColor}catch(j){z.errors=z.errors||[],z.errors.push(`Failed to extract dominant color: ${j}`)}return await G8(X,$,z,Z),z}catch(G){return{src:X,processed:!1,errors:[`Processing failed: ${G}`]}}}async function TY(X,$,Z,Y){let J=await n9();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:X,output:Y,format:$,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function r9(X,$,Z){let Y=Z||await n9();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode(X);for(let G of $){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var MY=E(()=>{a1();i9()});import{resolve as vz,basename as xz,extname as fz,join as gz}from"path";import{mkdir as hz}from"fs/promises";async function uz(){try{return await import("ts-images")}catch{return null}}async function kY(X,$,Z){let Y=await uz();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=vz(X);if(!await M0(J))return console.warn(`[stx-media] Source file not found: ${X}`),null;try{let G=$.responsiveWidths||Z.breakpoints||dz,Q=$.formats||Z.defaultFormats||["avif","webp","jpeg"],q=Z.outputDir||"dist/images",K=Z.baseUrl||"/images";await hz(q,{recursive:!0});let U=await D0(J),W=xz(X,fz(X)),w=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},z={src:X,byFormat:{},srcsets:{}};for(let j of Q){z.byFormat[j]=[];let _=[];for(let H of G){let L=`${W}-${H}w-${U}.${j}`,O=gz(q,L),F=`${K}/${L}`;try{let V=w[j]?.quality||80;if(await M0(O)){z.byFormat[j].push({path:O,url:F,width:H,height:0,format:j,size:0}),_.push(`${F} ${H}w`);continue}let A=await Y.processImage({input:J,output:O,format:j,quality:V,resize:{width:H}});if(A)z.byFormat[j].push({path:O,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),_.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${j} at ${H}w: ${V}`)}}z.srcsets[j]=_.join(", ")}let B=$.placeholder||Z.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await Y.generateThumbHash(J);z.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await Y.generatePlaceholder(J,{strategy:B,width:20});z.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return z.sizes=$.sizes||mz(G),z}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function mz(X){let $=[...X].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<$.length-1;Y++){let J=$[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${$[$.length-1]}px`),Z.join(", ")}function IY(X,$="width"){if(!X||X.length===0)return"";if($==="dpr")return X.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return X.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var dz;var EY=E(()=>{a1();dz=[320,480,640,768,1024,1280,1536,1920]});var DY={};n(DY,{setCachedImageResult:()=>G8,processImage:()=>NY,optimizeImage:()=>TY,getCachedImageResult:()=>J8,generateSrcset:()=>IY,generateResponsiveVariants:()=>kY,clearImageCache:()=>AY,applyTransformations:()=>r9,ImageProcessorCache:()=>Y8});var yY=E(()=>{MY();EY();i9()});async function lz(){try{return await Promise.resolve().then(() => (yY(),DY))}catch(X){if(!bY)console.warn("[stx-media] Image processor not available, some features disabled:",X),bY=!0;return null}}async function Q8(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return nz(Y,Z)}if(Z.processedResult?.processed)return t9(X,Z.processedResult,$);if(Z.responsiveVariants)return vY(X,Z.responsiveVariants,$);let{src:J,alt:G,width:Q,height:q,sizes:K,widths:U=D5,dpr:W,formats:w=b7,quality:z=o9,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:H=!0,priority:L=!1,loading:O=L?"eager":K8,decoding:F=q8,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:T}=X,k=X.class,M=X.style,y=X.id,I=X.data||{},{isDev:C=!1,baseUrl:S=""}=$;if(C&&!$.optimize)return iz(X);let b,P,x=y||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!L)try{b=await jY(J,{strategy:j,..._}),P=zY(x,b,_)}catch{}let d=W!==void 0&&Q!==void 0,m;if(d)m=pz(X,x,b,$);else m=await cz(X,x,b,$);let Y0;if(L){let p0=w.includes("webp")?"webp":w[0],l=x9(J,U,{...B,q:z},p0),j0=typeof K==="object"?f9(K):K||"100vw";Y0=`<link rel="preload" as="image" imagesrcset="${l}" imagesizes="${j0}" />`}let d0=[];if(!SY&&j!=="none")d0.push(d9),SY=!0;if(P)d0.push(P);let F0=H?PY(x):void 0;return{html:m,preloadLink:Y0,css:d0.length>0?d0.join(`
11728
+ `):void 0,script:F0}}async function cz(X,$,Z,Y){let{src:J,alt:G,width:Q,height:q,sizes:K,widths:U=D5,formats:W=b7,quality:w=o9,params:z={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":K8,decoding:H=q8,fetchpriority:L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A}=X,R=X.class,N=X.style,T=X.data||{},k=typeof K==="object"?f9(K):K||"100vw",M=[];for(let C of W){let S=x9(J,U,{...z,q:w},C),b=g9(C);if(B&&!j)M.push(` <source type="${b}" data-srcset="${S}" data-sizes="${k}" />`);else M.push(` <source type="${b}" srcset="${S}" sizes="${k}" />`)}let y=s9({src:S7(J,{...z,q:w}),alt:G,width:Q,height:q,loading:j?void 0:_,decoding:H,fetchpriority:j?"high":L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A,className:CY(R,Z),style:a9(N,O,F,Z),lazy:B&&!j,data:T}),I;if(Z){let C=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${$}" class="stx-img-placeholder" style="${C}">
11656
11729
  <picture>
11657
11730
  ${M.join(`
11658
11731
  `)}
@@ -11662,9 +11735,9 @@ ${M.join(`
11662
11735
  ${M.join(`
11663
11736
  `)}
11664
11737
  <img ${y} />
11665
- </picture>`;return I}function Pz(X,$,Z,Y){let{src:J,alt:G,width:Q,height:q,dpr:K=[1,2,3],quality:U=m9,params:W={},lazy:w=!0,priority:z=!1,loading:B=z?"eager":K8,decoding:j=q8,fetchpriority:_,objectFit:H,objectPosition:L,crossorigin:O,referrerpolicy:F}=X,V=X.class,A=X.style,R=X.data||{},T=typeof Q==="number"?Q:Number.parseInt(String(Q),10),N=XY(J,T,K,{...W,q:U}),k=l9({src:b7(J,{...W,w:T,q:U}),alt:G,width:Q,height:q,loading:z?void 0:B,decoding:j,fetchpriority:z?"high":_,objectFit:H,objectPosition:L,crossorigin:O,referrerpolicy:F,className:RY(V,Z),style:c9(A,H,L,Z),lazy:w&&!z,data:R}),M=w&&!z?`data-srcset="${N}"`:`srcset="${N}"`;if(Z){let y=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${$}" class="stx-img-placeholder" style="${y}">
11738
+ </picture>`;return I}function pz(X,$,Z,Y){let{src:J,alt:G,width:Q,height:q,dpr:K=[1,2,3],quality:U=o9,params:W={},lazy:w=!0,priority:z=!1,loading:B=z?"eager":K8,decoding:j=q8,fetchpriority:_,objectFit:H,objectPosition:L,crossorigin:O,referrerpolicy:F}=X,V=X.class,A=X.style,R=X.data||{},N=typeof Q==="number"?Q:Number.parseInt(String(Q),10),T=wY(J,N,K,{...W,q:U}),k=s9({src:S7(J,{...W,w:N,q:U}),alt:G,width:Q,height:q,loading:z?void 0:B,decoding:j,fetchpriority:z?"high":_,objectFit:H,objectPosition:L,crossorigin:O,referrerpolicy:F,className:CY(V,Z),style:a9(A,H,L,Z),lazy:w&&!z,data:R}),M=w&&!z?`data-srcset="${T}"`:`srcset="${T}"`;if(Z){let y=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${$}" class="stx-img-placeholder" style="${y}">
11666
11739
  <img ${k} ${M} />
11667
- </div>`}return`<img ${$?`id="${$}" `:""}${k} ${M} />`}function vz(X){let{src:$,alt:Z,width:Y,height:J,loading:G=K8,decoding:Q=q8,fetchpriority:q,objectFit:K,objectPosition:U,crossorigin:W,referrerpolicy:w,priority:z=!1}=X,B=X.class,j=X.style,_=X.id,H=X.data||{};return{html:`<img ${l9({src:$,alt:Z,width:Y,height:J,loading:z?"eager":G,decoding:Q,fetchpriority:z?"high":q,objectFit:K,objectPosition:U,crossorigin:W,referrerpolicy:w,className:B,style:c9(j,K,U),id:_,data:H})} />`}}function l9(X){let $=[];if(X.lazy)$.push(`data-src="${s0(X.src)}"`),$.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else $.push(`src="${s0(X.src)}"`);if($.push(`alt="${s0(X.alt)}"`),X.width)$.push(`width="${X.width}"`);if(X.height)$.push(`height="${X.height}"`);if(X.loading)$.push(`loading="${X.loading}"`);if(X.decoding)$.push(`decoding="${X.decoding}"`);if(X.fetchpriority)$.push(`fetchpriority="${X.fetchpriority}"`);if(X.crossorigin)$.push(`crossorigin="${X.crossorigin}"`);if(X.referrerpolicy)$.push(`referrerpolicy="${X.referrerpolicy}"`);if(X.className)$.push(`class="${s0(X.className)}"`);if(X.style)$.push(`style="${s0(X.style)}"`);if(X.id)$.push(`id="${s0(X.id)}"`);if(X.data)for(let[Z,Y]of Object.entries(X.data))$.push(`data-${Z}="${s0(Y)}"`);if(X.lazy)$.push("data-stx-lazy");return $.join(" ")}function RY(X,$){let Z=[];if(X)Z.push(X);if($)Z.push("stx-img-blur");return Z.join(" ")||""}function c9(X,$,Z,Y){let J=[];if($)J.push(`object-fit: ${$}`);if(Z)J.push(`object-position: ${Z}`);if(Y)J.push("opacity: 0; transition: opacity 300ms ease-out");if(X)J.push(X);return J.join("; ")}function s0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function TY(X){return`
11740
+ </div>`}return`<img ${$?`id="${$}" `:""}${k} ${M} />`}function iz(X){let{src:$,alt:Z,width:Y,height:J,loading:G=K8,decoding:Q=q8,fetchpriority:q,objectFit:K,objectPosition:U,crossorigin:W,referrerpolicy:w,priority:z=!1}=X,B=X.class,j=X.style,_=X.id,H=X.data||{};return{html:`<img ${s9({src:$,alt:Z,width:Y,height:J,loading:z?"eager":G,decoding:Q,fetchpriority:z?"high":q,objectFit:K,objectPosition:U,crossorigin:W,referrerpolicy:w,className:B,style:a9(j,K,U),id:_,data:H})} />`}}function s9(X){let $=[];if(X.lazy)$.push(`data-src="${o0(X.src)}"`),$.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else $.push(`src="${o0(X.src)}"`);if($.push(`alt="${o0(X.alt)}"`),X.width)$.push(`width="${X.width}"`);if(X.height)$.push(`height="${X.height}"`);if(X.loading)$.push(`loading="${X.loading}"`);if(X.decoding)$.push(`decoding="${X.decoding}"`);if(X.fetchpriority)$.push(`fetchpriority="${X.fetchpriority}"`);if(X.crossorigin)$.push(`crossorigin="${X.crossorigin}"`);if(X.referrerpolicy)$.push(`referrerpolicy="${X.referrerpolicy}"`);if(X.className)$.push(`class="${o0(X.className)}"`);if(X.style)$.push(`style="${o0(X.style)}"`);if(X.id)$.push(`id="${o0(X.id)}"`);if(X.data)for(let[Z,Y]of Object.entries(X.data))$.push(`data-${Z}="${o0(Y)}"`);if(X.lazy)$.push("data-stx-lazy");return $.join(" ")}function CY(X,$){let Z=[];if(X)Z.push(X);if($)Z.push("stx-img-blur");return Z.join(" ")||""}function a9(X,$,Z,Y){let J=[];if($)J.push(`object-fit: ${$}`);if(Z)J.push(`object-position: ${Z}`);if(Y)J.push("opacity: 0; transition: opacity 300ms ease-out");if(X)J.push(X);return J.join("; ")}function o0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function PY(X){return`
11668
11741
  (function() {
11669
11742
  const container = document.getElementById('${X}');
11670
11743
  if (!container) return;
@@ -11701,22 +11774,22 @@ ${M.join(`
11701
11774
 
11702
11775
  observer.observe(container);
11703
11776
  })();
11704
- `.trim()}async function xz(X,$){let Z=await Sz();if(!Z)return Q8({...X,process:!1},$);let Y=$.tsImagesConfig;if(X.responsiveWidths&&X.responsiveWidths.length>0||X.widths&&X.widths.length>0||!X.width&&!X.dpr){let G=await Z.generateResponsiveVariants(X.src,X,Y);if(G)return NY(X,G,$)}else{let G=await Z.processImage(X.src,X,Y);if(G.processed)return p9(X,G,$)}return Q8({...X,process:!1},$)}async function p9(X,$,Z){let{alt:Y,width:J,height:G,lazy:Q=!0,priority:q=!1,objectFit:K,objectPosition:U,crossorigin:W,referrerpolicy:w}=X,z=X.class,B=X.style,j=X.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=X.data||{},H=$.variants||[],L=H.find((P)=>P.format==="jpeg")||H.find((P)=>P.format==="webp")||H[0],O=L?.url||X.src,F=H.filter((P)=>P.format===(L?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of H){if(!V.has(P.format))V.set(P.format,[]);V.get(P.format).push(P)}let A=[],R=["avif","webp","jpeg","png"];for(let P of R){let x=V.get(P);if(x&&x.length>0){let d=x.map((Y0)=>`${Y0.url} ${Y0.width}w`).join(", "),m=b9(P);if(Q&&!q)A.push(` <source type="${m}" data-srcset="${d}" />`);else A.push(` <source type="${m}" srcset="${d}" />`)}}let T=[];if(Q&&!q){if(T.push(`data-src="${s0(O)}"`),T.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)T.push(`data-srcset="${F}"`)}else if(T.push(`src="${s0(O)}"`),F)T.push(`srcset="${F}"`);T.push(`alt="${s0(Y)}"`);let N=J||$.originalWidth,k=G||$.originalHeight;if(N)T.push(`width="${N}"`);if(k)T.push(`height="${k}"`);if(!q)T.push(`loading="${Q?"lazy":"eager"}"`);if(T.push('decoding="async"'),q)T.push('fetchpriority="high"');if(W)T.push(`crossorigin="${W}"`);if(w)T.push(`referrerpolicy="${w}"`);let M=[];if(K)M.push(`object-fit: ${K}`);if(U)M.push(`object-position: ${U}`);if($.placeholder&&Q)M.push("opacity: 0; transition: opacity 300ms ease-out");if(B)M.push(B);if(M.length>0)T.push(`style="${M.join("; ")}"`);let y=[];if(z)y.push(z);if($.placeholder)y.push("stx-img-blur");if(y.length>0)T.push(`class="${y.join(" ")}"`);if(Q&&!q)T.push("data-stx-lazy");for(let[P,x]of Object.entries(_))T.push(`data-${P}="${s0(x)}"`);let I;if($.placeholder||$.dominantColor&&X.useDominantColor){let P=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;I=`<div id="${j}" class="stx-img-placeholder" style="${P}">
11777
+ `.trim()}async function nz(X,$){let Z=await lz();if(!Z)return Q8({...X,process:!1},$);let Y=$.tsImagesConfig;if(X.responsiveWidths&&X.responsiveWidths.length>0||X.widths&&X.widths.length>0||!X.width&&!X.dpr){let G=await Z.generateResponsiveVariants(X.src,X,Y);if(G)return vY(X,G,$)}else{let G=await Z.processImage(X.src,X,Y);if(G.processed)return t9(X,G,$)}return Q8({...X,process:!1},$)}async function t9(X,$,Z){let{alt:Y,width:J,height:G,lazy:Q=!0,priority:q=!1,objectFit:K,objectPosition:U,crossorigin:W,referrerpolicy:w}=X,z=X.class,B=X.style,j=X.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=X.data||{},H=$.variants||[],L=H.find((P)=>P.format==="jpeg")||H.find((P)=>P.format==="webp")||H[0],O=L?.url||X.src,F=H.filter((P)=>P.format===(L?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of H){if(!V.has(P.format))V.set(P.format,[]);V.get(P.format).push(P)}let A=[],R=["avif","webp","jpeg","png"];for(let P of R){let x=V.get(P);if(x&&x.length>0){let d=x.map((Y0)=>`${Y0.url} ${Y0.width}w`).join(", "),m=g9(P);if(Q&&!q)A.push(` <source type="${m}" data-srcset="${d}" />`);else A.push(` <source type="${m}" srcset="${d}" />`)}}let N=[];if(Q&&!q){if(N.push(`data-src="${o0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${o0(O)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${o0(Y)}"`);let T=J||$.originalWidth,k=G||$.originalHeight;if(T)N.push(`width="${T}"`);if(k)N.push(`height="${k}"`);if(!q)N.push(`loading="${Q?"lazy":"eager"}"`);if(N.push('decoding="async"'),q)N.push('fetchpriority="high"');if(W)N.push(`crossorigin="${W}"`);if(w)N.push(`referrerpolicy="${w}"`);let M=[];if(K)M.push(`object-fit: ${K}`);if(U)M.push(`object-position: ${U}`);if($.placeholder&&Q)M.push("opacity: 0; transition: opacity 300ms ease-out");if(B)M.push(B);if(M.length>0)N.push(`style="${M.join("; ")}"`);let y=[];if(z)y.push(z);if($.placeholder)y.push("stx-img-blur");if(y.length>0)N.push(`class="${y.join(" ")}"`);if(Q&&!q)N.push("data-stx-lazy");for(let[P,x]of Object.entries(_))N.push(`data-${P}="${o0(x)}"`);let I;if($.placeholder||$.dominantColor&&X.useDominantColor){let P=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;I=`<div id="${j}" class="stx-img-placeholder" style="${P}">
11705
11778
  <picture>
11706
11779
  ${A.join(`
11707
11780
  `)}
11708
- <img ${T.join(" ")} />
11781
+ <img ${N.join(" ")} />
11709
11782
  </picture>
11710
11783
  </div>`}else I=`<picture${j?` id="${j}"`:""}>
11711
11784
  ${A.join(`
11712
11785
  `)}
11713
- <img ${T.join(" ")} />
11714
- </picture>`;let C=[];if($.placeholder)C.push(P9);let S=Q?TY(j):void 0,b;if(q&&F)b=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:I,preloadLink:b,css:C.length>0?C.join(`
11715
- `):void 0,script:S}}async function NY(X,$,Z){let Y={src:$.src,processed:!0,variants:[],placeholder:$.placeholder?.dataURL,originalWidth:$.placeholder?.width,originalHeight:$.placeholder?.height};for(let[J,G]of Object.entries($.byFormat))if(G)Y.variants.push(...G);return p9(X,Y,Z)}var VY=!1,m9=80,q8="async",K8="lazy",AY=!1;var MY=D(()=>{S9();YY()});function fz(){return aX({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(X,$,Z,Y)=>{let{src:J,alt:G,options:Q}=gz(X,$,Z);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let q={src:J,alt:G||"",widths:Q.widths||E5,formats:Q.formats||y7,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},K=Z.__isDev||!1,U=await Q8(q,{isDev:K}),W=U.html;if(U.preloadLink)W=U.preloadLink+`
11786
+ <img ${N.join(" ")} />
11787
+ </picture>`;let C=[];if($.placeholder)C.push(d9);let S=Q?PY(j):void 0,b;if(q&&F)b=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:I,preloadLink:b,css:C.length>0?C.join(`
11788
+ `):void 0,script:S}}async function vY(X,$,Z){let Y={src:$.src,processed:!0,variants:[],placeholder:$.placeholder?.dataURL,originalWidth:$.placeholder?.width,originalHeight:$.placeholder?.height};for(let[J,G]of Object.entries($.byFormat))if(G)Y.variants.push(...G);return t9(X,Y,Z)}var bY=!1,o9=80,q8="async",K8="lazy",SY=!1;var xY=E(()=>{h9();BY()});function rz(){return aX({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(X,$,Z,Y)=>{let{src:J,alt:G,options:Q}=oz(X,$,Z);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let q={src:J,alt:G||"",widths:Q.widths||D5,formats:Q.formats||b7,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},K=Z.__isDev||!1,U=await Q8(q,{isDev:K}),W=U.html;if(U.preloadLink)W=U.preloadLink+`
11716
11789
  `+W;if(U.css)W+=`
11717
11790
  <style>${U.css}</style>`;if(U.script)W+=`
11718
- <script>${U.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function gz(X,$,Z){if($.src)return{src:String($.src),alt:String($.alt||""),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=hz(Y),G=i9(J[0],Z)||"",Q=i9(J[1],Z)||"",q={};if(J[2]){let K=i9(J[2],Z);if(typeof K==="object"&&K!==null)q=K;else if(typeof J[2]==="string")try{q=JSON.parse(J[2])}catch{}}return{src:G,alt:Q,options:q}}function hz(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let q=0;q<X.length;q++){let K=X[q],U=q>0?X[q-1]:"";if((K==='"'||K==="'"||K==="`")&&U!=="\\"){if(!Y)Y=!0,J=K;else if(K===J)Y=!1,J="";else Z+=K;continue}if(!Y){if(K==="{")G++;if(K==="}")G--;if(K==="[")Q++;if(K==="]")Q--;if(K===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=K}if(Z.trim())$.push(Z.trim());return $}function i9(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var kY;var IY=D(()=>{E9();MY();S9();kY=fz()});class W8{config;constructor(X={}){this.config={...uz,...X}}async get(X,$){return eX(X,$,"video",this.config)}async set(X,$,Z){return X8(X,$,Z,"video",this.config)}async clear(){return $8("video",this.config)}updateConfig(X){this.config={...this.config,...X}}}function n9(X){if(!U8)U8=new W8(X);else if(X)U8.updateConfig(X);return U8}async function w8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return n9(Y).get(X,$)}async function z8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return n9(J).set(X,$,Z)}async function EY(){return n9().clear()}var uz,U8=null;var r9=D(()=>{f9();uz={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as o9,basename as s9,extname as a9,join as j8}from"path";import{mkdir as t9}from"fs/promises";async function e9(){try{return await import("ts-videos")}catch{return null}}async function B8(X,$,Z,Y){let J=await e9();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=o9(X);if(!await M0(G))return null;await t9(Z,{recursive:!0});let Q=await D0(G),q=s9(X,a9(X)),K=$.format||"webp",U=$.timestamp||0,W=`${q}-poster-${Q}.${K}`,w=j8(Z,W),z=await J.extractThumbnails(G,{timestamps:[U],width:$.width||1280,height:$.height,format:K,quality:$.quality||85,outputDir:Z,outputPattern:W.replace(`.${K}`,"")});if(z&&z.length>0){let B=z[0];return{path:w,url:`${Y}/${W}`,width:B.width||$.width||1280,height:B.height||720,timestamp:U,size:B.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function _8(X,$,Z,Y){let J=await e9();if(!J)return[];try{let G=o9(X);if(!await M0(G))return[];await t9(Z,{recursive:!0});let Q=await D0(G),q=s9(X,a9(X)),K=$.format||"webp",w=(await new J.Input(G).getInfo()).duration||60,z=$.count||10,B=$.interval||w/z,j=[];for(let H=0;H<z&&H*B<w;H++)j.push(H*B);let _=await J.extractThumbnails(G,{timestamps:j,width:$.width||320,format:K,quality:$.quality||80,outputDir:Z,outputPattern:`${q}-thumb-${Q}`});if(_&&_.length>0)return _.map((H,L)=>({path:H.path||j8(Z,`${q}-thumb-${Q}-${L}.${K}`),url:`${Y}/${q}-thumb-${Q}-${L}.${K}`,width:H.width||$.width||320,height:H.height||180,timestamp:j[L],size:H.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function DY(X,$,Z,Y){let J=await e9();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=o9(X);if(!await M0(G))return null;await t9(Z,{recursive:!0});let Q=await D0(G),q=s9(X,a9(X)),W=(await new J.Input(G).getInfo()).duration||60,w=$.columns||10,z=$.interval||5,B=$.thumbnailWidth||160,j=$.thumbnailHeight||90,_=$.format||"jpeg",H=Math.ceil(W/z),L=Math.ceil(H/w),O=`${q}-sprite-${Q}.${_}`,F=j8(Z,O),V=[];for(let R=0;R<H;R++)V.push(R*z);let A=await J.extractThumbnails(G,{timestamps:V,width:B,height:j,format:_,quality:$.quality||70,outputDir:j8(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),T=w*B,N=L*j,k=await R.createSprite({images:A.map((M)=>M.path),columns:w,padding:0,outputPath:F,format:_,quality:$.quality||70});return{url:`${Y}/${O}`,path:F,columns:w,rows:L,thumbnailWidth:B,thumbnailHeight:j,interval:z,totalFrames:H}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(G){return console.warn(`[stx-media] Failed to generate sprite sheet: ${G}`),null}}var X3=D(()=>{s1()});import{resolve as bY,basename as SY,extname as CY,join as a1}from"path";import{mkdir as H8,writeFile as PY}from"fs/promises";async function vY(){try{return await import("ts-videos")}catch{return null}}async function O8(X,$,Z,Y,J){let G=await vY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=bY(X);if(!await M0(Q))return null;let q=await D0(Q),K=SY(X,CY(X)),U=a1(Z,`${K}-${q}-hls`);await H8(U,{recursive:!0});let W=$.length>0?$:xY,w=J?.segmentDuration||6,j=(await new G.Input(Q).getInfo()).duration||0,_=[],H=0;for(let F of W){let V=a1(U,F.label);await H8(V,{recursive:!0});let A=`${F.label}.m3u8`,R=a1(V,A);try{let T=await G.generateHLS(Q,{outputDir:V,segmentDuration:w,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(T)_.push({quality:F,url:`${Y}/${K}-${q}-hls/${F.label}/${A}`,path:R}),H+=T.segmentCount||Math.ceil(j/w)}catch(T){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${T}`)}}if(_.length===0)return null;let L=a1(U,"master.m3u8"),O=dz(_,Y,K,q);return await PY(L,O),{manifestUrl:`${Y}/${K}-${q}-hls/master.m3u8`,manifestPath:L,playlists:_,segmentCount:H,duration:j}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function dz(X,$,Z,Y){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let G of X){let{quality:Q}=G,q=Q.bitrate+(Q.audioBitrate||128000),K=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${q},RESOLUTION=${K},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return J.join(`
11719
- `)}async function L8(X,$,Z,Y,J){let G=await vY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=bY(X);if(!await M0(Q))return null;let q=await D0(Q),K=SY(X,CY(X)),U=a1(Z,`${K}-${q}-dash`);await H8(U,{recursive:!0});let W=$.length>0?$:xY,w=J?.segmentDuration||4,z=J?.minBufferTime||2,_=(await new G.Input(Q).getInfo()).duration||0,H=[],L=[];for(let A of W){let R=a1(U,A.label);await H8(R,{recursive:!0});try{if(await G.generateDASH(Q,{outputDir:R,segmentDuration:w,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(H.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${Y}/${K}-${q}-dash/${A.label}/video`}),A.audioBitrate)L.push({bandwidth:A.audioBitrate,url:`${Y}/${K}-${q}-dash/${A.label}/audio`})}}catch(T){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${T}`)}}if(H.length===0)return null;let O=a1(U,"manifest.mpd"),F=mz(H,L,_,w,z);await PY(O,F);let V=[{type:"video",representations:H}];if(L.length>0)V.push({type:"audio",representations:L});return{manifestUrl:`${Y}/${K}-${q}-dash/manifest.mpd`,manifestPath:O,adaptationSets:V,duration:_}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function mz(X,$,Z,Y,J){let G=yY(Z),Q=yY(J),q=`<?xml version="1.0" encoding="UTF-8"?>
11791
+ <script>${U.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function oz(X,$,Z){if($.src)return{src:String($.src),alt:String($.alt||""),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=sz(Y),G=e9(J[0],Z)||"",Q=e9(J[1],Z)||"",q={};if(J[2]){let K=e9(J[2],Z);if(typeof K==="object"&&K!==null)q=K;else if(typeof J[2]==="string")try{q=JSON.parse(J[2])}catch{}}return{src:G,alt:Q,options:q}}function sz(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let q=0;q<X.length;q++){let K=X[q],U=q>0?X[q-1]:"";if((K==='"'||K==="'"||K==="`")&&U!=="\\"){if(!Y)Y=!0,J=K;else if(K===J)Y=!1,J="";else Z+=K;continue}if(!Y){if(K==="{")G++;if(K==="}")G--;if(K==="[")Q++;if(K==="]")Q--;if(K===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=K}if(Z.trim())$.push(Z.trim());return $}function e9(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var fY;var gY=E(()=>{v9();xY();h9();fY=rz()});class W8{config;constructor(X={}){this.config={...az,...X}}async get(X,$){return eX(X,$,"video",this.config)}async set(X,$,Z){return X8(X,$,Z,"video",this.config)}async clear(){return $8("video",this.config)}updateConfig(X){this.config={...this.config,...X}}}function X3(X){if(!U8)U8=new W8(X);else if(X)U8.updateConfig(X);return U8}async function w8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return X3(Y).get(X,$)}async function z8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return X3(J).set(X,$,Z)}async function hY(){return X3().clear()}var az,U8=null;var $3=E(()=>{c9();az={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as Z3,basename as Y3,extname as J3,join as j8}from"path";import{mkdir as G3}from"fs/promises";async function Q3(){try{return await import("ts-videos")}catch{return null}}async function B8(X,$,Z,Y){let J=await Q3();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=Z3(X);if(!await M0(G))return null;await G3(Z,{recursive:!0});let Q=await D0(G),q=Y3(X,J3(X)),K=$.format||"webp",U=$.timestamp||0,W=`${q}-poster-${Q}.${K}`,w=j8(Z,W),z=await J.extractThumbnails(G,{timestamps:[U],width:$.width||1280,height:$.height,format:K,quality:$.quality||85,outputDir:Z,outputPattern:W.replace(`.${K}`,"")});if(z&&z.length>0){let B=z[0];return{path:w,url:`${Y}/${W}`,width:B.width||$.width||1280,height:B.height||720,timestamp:U,size:B.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function _8(X,$,Z,Y){let J=await Q3();if(!J)return[];try{let G=Z3(X);if(!await M0(G))return[];await G3(Z,{recursive:!0});let Q=await D0(G),q=Y3(X,J3(X)),K=$.format||"webp",w=(await new J.Input(G).getInfo()).duration||60,z=$.count||10,B=$.interval||w/z,j=[];for(let H=0;H<z&&H*B<w;H++)j.push(H*B);let _=await J.extractThumbnails(G,{timestamps:j,width:$.width||320,format:K,quality:$.quality||80,outputDir:Z,outputPattern:`${q}-thumb-${Q}`});if(_&&_.length>0)return _.map((H,L)=>({path:H.path||j8(Z,`${q}-thumb-${Q}-${L}.${K}`),url:`${Y}/${q}-thumb-${Q}-${L}.${K}`,width:H.width||$.width||320,height:H.height||180,timestamp:j[L],size:H.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function uY(X,$,Z,Y){let J=await Q3();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=Z3(X);if(!await M0(G))return null;await G3(Z,{recursive:!0});let Q=await D0(G),q=Y3(X,J3(X)),W=(await new J.Input(G).getInfo()).duration||60,w=$.columns||10,z=$.interval||5,B=$.thumbnailWidth||160,j=$.thumbnailHeight||90,_=$.format||"jpeg",H=Math.ceil(W/z),L=Math.ceil(H/w),O=`${q}-sprite-${Q}.${_}`,F=j8(Z,O),V=[];for(let R=0;R<H;R++)V.push(R*z);let A=await J.extractThumbnails(G,{timestamps:V,width:B,height:j,format:_,quality:$.quality||70,outputDir:j8(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=w*B,T=L*j,k=await R.createSprite({images:A.map((M)=>M.path),columns:w,padding:0,outputPath:F,format:_,quality:$.quality||70});return{url:`${Y}/${O}`,path:F,columns:w,rows:L,thumbnailWidth:B,thumbnailHeight:j,interval:z,totalFrames:H}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(G){return console.warn(`[stx-media] Failed to generate sprite sheet: ${G}`),null}}var q3=E(()=>{a1()});import{resolve as mY,basename as lY,extname as cY,join as t1}from"path";import{mkdir as H8,writeFile as pY}from"fs/promises";async function iY(){try{return await import("ts-videos")}catch{return null}}async function O8(X,$,Z,Y,J){let G=await iY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=mY(X);if(!await M0(Q))return null;let q=await D0(Q),K=lY(X,cY(X)),U=t1(Z,`${K}-${q}-hls`);await H8(U,{recursive:!0});let W=$.length>0?$:nY,w=J?.segmentDuration||6,j=(await new G.Input(Q).getInfo()).duration||0,_=[],H=0;for(let F of W){let V=t1(U,F.label);await H8(V,{recursive:!0});let A=`${F.label}.m3u8`,R=t1(V,A);try{let N=await G.generateHLS(Q,{outputDir:V,segmentDuration:w,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(N)_.push({quality:F,url:`${Y}/${K}-${q}-hls/${F.label}/${A}`,path:R}),H+=N.segmentCount||Math.ceil(j/w)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${N}`)}}if(_.length===0)return null;let L=t1(U,"master.m3u8"),O=tz(_,Y,K,q);return await pY(L,O),{manifestUrl:`${Y}/${K}-${q}-hls/master.m3u8`,manifestPath:L,playlists:_,segmentCount:H,duration:j}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function tz(X,$,Z,Y){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let G of X){let{quality:Q}=G,q=Q.bitrate+(Q.audioBitrate||128000),K=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${q},RESOLUTION=${K},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return J.join(`
11792
+ `)}async function L8(X,$,Z,Y,J){let G=await iY();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=mY(X);if(!await M0(Q))return null;let q=await D0(Q),K=lY(X,cY(X)),U=t1(Z,`${K}-${q}-dash`);await H8(U,{recursive:!0});let W=$.length>0?$:nY,w=J?.segmentDuration||4,z=J?.minBufferTime||2,_=(await new G.Input(Q).getInfo()).duration||0,H=[],L=[];for(let A of W){let R=t1(U,A.label);await H8(R,{recursive:!0});try{if(await G.generateDASH(Q,{outputDir:R,segmentDuration:w,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(H.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${Y}/${K}-${q}-dash/${A.label}/video`}),A.audioBitrate)L.push({bandwidth:A.audioBitrate,url:`${Y}/${K}-${q}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(H.length===0)return null;let O=t1(U,"manifest.mpd"),F=ez(H,L,_,w,z);await pY(O,F);let V=[{type:"video",representations:H}];if(L.length>0)V.push({type:"audio",representations:L});return{manifestUrl:`${Y}/${K}-${q}-dash/manifest.mpd`,manifestPath:O,adaptationSets:V,duration:_}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function ez(X,$,Z,Y,J){let G=dY(Z),Q=dY(J),q=`<?xml version="1.0" encoding="UTF-8"?>
11720
11793
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
11721
11794
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
11722
11795
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -11742,7 +11815,7 @@ ${A.join(`
11742
11815
  </Representation>
11743
11816
  `}q+=` </AdaptationSet>
11744
11817
  `}return q+=` </Period>
11745
- </MPD>`,q}function yY(X){let $=Math.floor(X/3600),Z=Math.floor(X%3600/60),Y=Math.floor(X%60),J="PT";if($>0)J+=`${$}H`;if(Z>0)J+=`${Z}M`;return J+=`${Y}S`,J}var xY;var $3=D(()=>{s1();xY=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as fY,basename as lz,extname as cz,join as pz}from"path";import{mkdir as iz}from"fs/promises";async function gY(){try{return await import("ts-videos")}catch{return null}}function nz(X){switch(X){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function rz(X){switch(X){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function Z3(X){let $=await gY();if(!$)return null;try{let Z=fY(X),J=await new $.Input(Z).getInfo();return{duration:J.duration||0,width:J.width||0,height:J.height||0,frameRate:J.frameRate||0,bitrate:J.bitrate||0,codec:J.videoCodec||"",audioCodec:J.audioCodec}}catch(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function hY(X,$,Z,Y){let J=await gY();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:X,processed:!1};let G=await w8(X,$,Z);if(G)return G;try{let Q=fY(X);if(!await M0(Q))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let q=Z.outputDir||"dist/videos",K=Z.baseUrl||"/videos";await iz(q,{recursive:!0});let U=await D0(Q),W=lz(X,cz(X)),w={src:X,processed:!0,hash:U};Y?.({percentage:5,stage:"analyzing"}),w.metadata=await Z3(Q)||void 0;let z={};if($.quality)z.bitrate=nz($.quality);if($.platform)Object.assign(z,rz($.platform));if($.transcode)Object.assign(z,$.transcode);if(Object.keys(z).length>0||$.process){Y?.({percentage:10,stage:"transcoding"});let B=`${W}-${U}.mp4`,j=pz(q,B);try{let _=await oz(Q,j,z,J,(H)=>Y?.({percentage:10+H*0.5,stage:"transcoding"}));if(_)w.transcoded={path:j,url:`${K}/${B}`,duration:_.duration,size:_.size,video:{codec:z.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:z.audioCodec||"aac",bitrate:z.audioBitrate||128000,sampleRate:z.sampleRate||48000,channels:z.channels||2}:void 0}}catch(_){w.errors=w.errors||[],w.errors.push(`Transcoding failed: ${_}`)}}if($.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let B=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},j=await B8(Q,B,q,K);if(j)w.poster=j}if(Z.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let B=await _8(Q,Z.thumbnails,q,K);if(B.length>0)w.thumbnails=B}if($.streaming){Y?.({percentage:80,stage:"generating-manifests"});let B=typeof $.streaming==="object"?$.streaming:Z.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let j=await O8(Q,B.qualities||Z.streaming?.defaultQualities||[],q,K);if(j)w.streaming={...w.streaming,hls:j}}if(B.format==="dash"){let j=await L8(Q,B.qualities||Z.streaming?.defaultQualities||[],q,K);if(j)w.streaming={...w.streaming,dash:j}}}if($.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await z8(X,$,w,Z),w}catch(Q){return{src:X,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function oz(X,$,Z,Y,J){try{let Q=await new Y.Conversion(X,$,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((q)=>{J?.(q.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Z.maxWidth||0,height:Q.height||Z.maxHeight||0,bitrate:Q.bitrate||Z.bitrate||0,frameRate:Q.frameRate||Z.frameRate||30,audioCodec:Q.audioCodec}}catch(G){return console.error(`[stx-media] Transcoding failed: ${G}`),null}}var uY=D(()=>{s1();r9();X3();$3()});var dY={};n(dY,{setCachedVideoResult:()=>z8,processVideo:()=>hY,getCachedVideoResult:()=>w8,generateThumbnails:()=>_8,generateSpriteSheet:()=>DY,generatePoster:()=>B8,generateHLSManifest:()=>O8,generateDASHManifest:()=>L8,clearVideoCache:()=>EY,analyzeVideo:()=>Z3,VideoProcessorCache:()=>W8});var mY=D(()=>{uY();X3();$3();r9()});async function cY(){try{return await Promise.resolve().then(() => (mY(),dY))}catch(X){if(!lY)console.warn("[stx-media] Video processor not available, some features disabled:",X),lY=!0;return null}}async function F8(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return $j(Y,Z)}if(Z.processedResult?.processed)return rY(X,Z.processedResult,$);let J;if(Y.generatePoster&&Y.src&&!X.poster)J=await Zj(Y,Z);let{src:G,sources:Q=[],poster:q,posterPlaceholder:K,controls:U=pY,autoplay:W=!1,muted:w=!1,loop:z=!1,preload:B=iY,playsinline:j=!0,lazy:_=!0,player:H="native",type:L,width:O,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=X,T=J||q,N=X.class,k=X.style,M=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(H==="ts-video")return tz(X,$);if(L&&L!=="video")return az(G||"",L,X);let y=Q.length>0?Q:G?[{src:G,type:nY(G)}]:[],I=[`id="${M}"`];if(U)I.push("controls");if(W)I.push("autoplay");if(w)I.push("muted");if(z)I.push("loop");if(j)I.push("playsinline");if(A)I.push("disablepictureinpicture");if(R)I.push("disableremoteplayback");if(V)I.push(`crossorigin="${V}"`);if(_){if(I.push(`data-preload="${B}"`),I.push('preload="none"'),T)I.push(`data-poster="${L0(T)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),T)I.push(`poster="${L0(T)}"`);if(O)I.push(`width="${O}"`);if(F)I.push(`height="${F}"`);if(N)I.push(`class="${L0(N)}"`);if(k)I.push(`style="${L0(k)}"`);let C=y.map((P)=>{return` <source ${_?`data-src="${L0(P.src)}"`:`src="${L0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
11818
+ </MPD>`,q}function dY(X){let $=Math.floor(X/3600),Z=Math.floor(X%3600/60),Y=Math.floor(X%60),J="PT";if($>0)J+=`${$}H`;if(Z>0)J+=`${Z}M`;return J+=`${Y}S`,J}var nY;var K3=E(()=>{a1();nY=[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000},{label:"360p",width:640,height:360,bitrate:600000,audioBitrate:64000}]});import{resolve as rY,basename as Xj,extname as $j,join as Zj}from"path";import{mkdir as Yj}from"fs/promises";async function oY(){try{return await import("ts-videos")}catch{return null}}function Jj(X){switch(X){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function Gj(X){switch(X){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function U3(X){let $=await oY();if(!$)return null;try{let Z=rY(X),J=await new $.Input(Z).getInfo();return{duration:J.duration||0,width:J.width||0,height:J.height||0,frameRate:J.frameRate||0,bitrate:J.bitrate||0,codec:J.videoCodec||"",audioCodec:J.audioCodec}}catch(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function sY(X,$,Z,Y){let J=await oY();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:X,processed:!1};let G=await w8(X,$,Z);if(G)return G;try{let Q=rY(X);if(!await M0(Q))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let q=Z.outputDir||"dist/videos",K=Z.baseUrl||"/videos";await Yj(q,{recursive:!0});let U=await D0(Q),W=Xj(X,$j(X)),w={src:X,processed:!0,hash:U};Y?.({percentage:5,stage:"analyzing"}),w.metadata=await U3(Q)||void 0;let z={};if($.quality)z.bitrate=Jj($.quality);if($.platform)Object.assign(z,Gj($.platform));if($.transcode)Object.assign(z,$.transcode);if(Object.keys(z).length>0||$.process){Y?.({percentage:10,stage:"transcoding"});let B=`${W}-${U}.mp4`,j=Zj(q,B);try{let _=await Qj(Q,j,z,J,(H)=>Y?.({percentage:10+H*0.5,stage:"transcoding"}));if(_)w.transcoded={path:j,url:`${K}/${B}`,duration:_.duration,size:_.size,video:{codec:z.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:z.audioCodec||"aac",bitrate:z.audioBitrate||128000,sampleRate:z.sampleRate||48000,channels:z.channels||2}:void 0}}catch(_){w.errors=w.errors||[],w.errors.push(`Transcoding failed: ${_}`)}}if($.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let B=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},j=await B8(Q,B,q,K);if(j)w.poster=j}if(Z.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let B=await _8(Q,Z.thumbnails,q,K);if(B.length>0)w.thumbnails=B}if($.streaming){Y?.({percentage:80,stage:"generating-manifests"});let B=typeof $.streaming==="object"?$.streaming:Z.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let j=await O8(Q,B.qualities||Z.streaming?.defaultQualities||[],q,K);if(j)w.streaming={...w.streaming,hls:j}}if(B.format==="dash"){let j=await L8(Q,B.qualities||Z.streaming?.defaultQualities||[],q,K);if(j)w.streaming={...w.streaming,dash:j}}}if($.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await z8(X,$,w,Z),w}catch(Q){return{src:X,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function Qj(X,$,Z,Y,J){try{let Q=await new Y.Conversion(X,$,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((q)=>{J?.(q.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Z.maxWidth||0,height:Q.height||Z.maxHeight||0,bitrate:Q.bitrate||Z.bitrate||0,frameRate:Q.frameRate||Z.frameRate||30,audioCodec:Q.audioCodec}}catch(G){return console.error(`[stx-media] Transcoding failed: ${G}`),null}}var aY=E(()=>{a1();$3();q3();K3()});var tY={};n(tY,{setCachedVideoResult:()=>z8,processVideo:()=>sY,getCachedVideoResult:()=>w8,generateThumbnails:()=>_8,generateSpriteSheet:()=>uY,generatePoster:()=>B8,generateHLSManifest:()=>O8,generateDASHManifest:()=>L8,clearVideoCache:()=>hY,analyzeVideo:()=>U3,VideoProcessorCache:()=>W8});var eY=E(()=>{aY();q3();K3();$3()});async function $J(){try{return await Promise.resolve().then(() => (eY(),tY))}catch(X){if(!XJ)console.warn("[stx-media] Video processor not available, some features disabled:",X),XJ=!0;return null}}async function F8(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return zj(Y,Z)}if(Z.processedResult?.processed)return GJ(X,Z.processedResult,$);let J;if(Y.generatePoster&&Y.src&&!X.poster)J=await jj(Y,Z);let{src:G,sources:Q=[],poster:q,posterPlaceholder:K,controls:U=ZJ,autoplay:W=!1,muted:w=!1,loop:z=!1,preload:B=YJ,playsinline:j=!0,lazy:_=!0,player:H="native",type:L,width:O,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=X,N=J||q,T=X.class,k=X.style,M=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(H==="ts-video")return Uj(X,$);if(L&&L!=="video")return Kj(G||"",L,X);let y=Q.length>0?Q:G?[{src:G,type:JJ(G)}]:[],I=[`id="${M}"`];if(U)I.push("controls");if(W)I.push("autoplay");if(w)I.push("muted");if(z)I.push("loop");if(j)I.push("playsinline");if(A)I.push("disablepictureinpicture");if(R)I.push("disableremoteplayback");if(V)I.push(`crossorigin="${V}"`);if(_){if(I.push(`data-preload="${B}"`),I.push('preload="none"'),N)I.push(`data-poster="${L0(N)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),N)I.push(`poster="${L0(N)}"`);if(O)I.push(`width="${O}"`);if(F)I.push(`height="${F}"`);if(T)I.push(`class="${L0(T)}"`);if(k)I.push(`style="${L0(k)}"`);let C=y.map((P)=>{return` <source ${_?`data-src="${L0(P.src)}"`:`src="${L0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
11746
11819
  `),S=`<video ${I.join(" ")}>
11747
11820
  ${C}
11748
11821
  Your browser does not support the video tag.
@@ -11781,9 +11854,9 @@ ${C}
11781
11854
 
11782
11855
  observer.observe(video);
11783
11856
  })();
11784
- `.trim();return{html:S,script:b}}function az(X,$,Z){let{width:Y=640,height:J=360}=Z,G=Z.class,Q=Z.style,q=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,K,U=null;switch($){case"youtube":U=ez(X),K=U?`https://www.youtube-nocookie.com/embed/${U}`:X;break;case"vimeo":U=Xj(X),K=U?`https://player.vimeo.com/video/${U}`:X;break;case"dailymotion":U=X.split("/").pop()||"",K=`https://www.dailymotion.com/embed/video/${U}`;break;case"twitch":U=X.split("/").pop()||"",K=`https://player.twitch.tv/?video=${U}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:K=X}let W=[`id="${q}"`,`src="${L0(K)}"`,`width="${Y}"`,`height="${J}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)W.push(`class="${L0(G)}"`);if(Q)W.push(`style="${L0(Q)}"`);if(Z.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
11857
+ `.trim();return{html:S,script:b}}function Kj(X,$,Z){let{width:Y=640,height:J=360}=Z,G=Z.class,Q=Z.style,q=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,K,U=null;switch($){case"youtube":U=Wj(X),K=U?`https://www.youtube-nocookie.com/embed/${U}`:X;break;case"vimeo":U=wj(X),K=U?`https://player.vimeo.com/video/${U}`:X;break;case"dailymotion":U=X.split("/").pop()||"",K=`https://www.dailymotion.com/embed/video/${U}`;break;case"twitch":U=X.split("/").pop()||"",K=`https://player.twitch.tv/?video=${U}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:K=X}let W=[`id="${q}"`,`src="${L0(K)}"`,`width="${Y}"`,`height="${J}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)W.push(`class="${L0(G)}"`);if(Q)W.push(`style="${L0(Q)}"`);if(Z.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
11785
11858
  <iframe ${W.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
11786
- </div>`}}function tz(X,$={}){let{src:Z,sources:Y=[],poster:J,controls:G=!0,autoplay:Q=!1,muted:q=!1,loop:K=!1,preload:U="metadata",playsinline:W=!0,lazy:w=!0,width:z,height:B}=X,j=X.class,_=X.style,H=X.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:Y.length>0?Y:Z,autoplay:Q,loop:K,muted:q,playsinline:W,preload:U,poster:J,controls:G,title:X.title},O=["position: relative",z?`width: ${typeof z==="number"?z+"px":z}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",_||""].filter(Boolean).join("; "),F=`
11859
+ </div>`}}function Uj(X,$={}){let{src:Z,sources:Y=[],poster:J,controls:G=!0,autoplay:Q=!1,muted:q=!1,loop:K=!1,preload:U="metadata",playsinline:W=!0,lazy:w=!0,width:z,height:B}=X,j=X.class,_=X.style,H=X.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:Y.length>0?Y:Z,autoplay:Q,loop:K,muted:q,playsinline:W,preload:U,poster:J,controls:G,title:X.title},O=["position: relative",z?`width: ${typeof z==="number"?z+"px":z}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",_||""].filter(Boolean).join("; "),F=`
11787
11860
  <div
11788
11861
  id="${H}"
11789
11862
  class="ts-video-player${j?" "+L0(j):""}"
@@ -11820,7 +11893,7 @@ ${C}
11820
11893
 
11821
11894
  // Load ts-video-player from CDN
11822
11895
  var script = document.createElement('script');
11823
- script.src = '${sz}';
11896
+ script.src = '${qj}';
11824
11897
  script.onload = initPlayer;
11825
11898
  script.onerror = function() {
11826
11899
  console.error('[stx] Failed to load ts-video-player');
@@ -11950,7 +12023,7 @@ else {
11950
12023
  .ts-video-player__play-button svg {
11951
12024
  margin-left: 4px;
11952
12025
  }
11953
- `.trim();return{html:F,script:V,css:A}}function nY(X){switch(X.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function ez(X){let $=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of $){let Y=X.match(Z);if(Y)return Y[1]}return null}function Xj(X){let $=X.match(/vimeo\.com\/(\d+)/);return $?$[1]:null}function L0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function $j(X,$){let Z=await cY();if(!Z)return F8({...X,process:!1},$);let Y=$.tsVideosConfig,J=await Z.processVideo(X.src,X,Y,X.onProcessProgress);if(J.processed)return rY(X,J,$);return F8({...X,process:!1},$)}async function Zj(X,$){let Z=await cY();if(!Z||!X.src)return;let Y=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},J=$.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster(X.src,Y,J.outputDir,J.baseUrl||"/videos"))?.url}function rY(X,$,Z){let{controls:Y=pY,autoplay:J=!1,muted:G=!1,loop:Q=!1,preload:q=iY,playsinline:K=!0,lazy:U=!0,width:W,height:w,crossorigin:z,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=X,_=X.class,H=X.style,L=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=X.src,F=nY(O);if($.transcoded)O=$.transcoded.url,F="video/mp4";let V=$.streaming?.hls||$.streaming?.dash;if(V){if($.streaming?.hls)O=$.streaming.hls.manifestUrl,F="application/x-mpegURL";else if($.streaming?.dash)O=$.streaming.dash.manifestUrl,F="application/dash+xml"}let A=$.poster?.url||X.poster,R=[`id="${L}"`];if(Y)R.push("controls");if(J)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(K)R.push("playsinline");if(B)R.push("disablepictureinpicture");if(j)R.push("disableremoteplayback");if(z)R.push(`crossorigin="${z}"`);if(U){if(R.push(`data-preload="${q}"`),R.push('preload="none"'),A)R.push(`data-poster="${L0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${q}"`),A)R.push(`poster="${L0(A)}"`);let T=W||$.metadata?.width,N=w||$.metadata?.height;if(T)R.push(`width="${T}"`);if(N)R.push(`height="${N}"`);if(_)R.push(`class="${L0(_)}"`);if(H)R.push(`style="${L0(H)}"`);let M=` <source ${U?`data-src="${L0(O)}"`:`src="${L0(O)}"`} type="${F}" />`,y=`<video ${R.join(" ")}>
12026
+ `.trim();return{html:F,script:V,css:A}}function JJ(X){switch(X.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function Wj(X){let $=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of $){let Y=X.match(Z);if(Y)return Y[1]}return null}function wj(X){let $=X.match(/vimeo\.com\/(\d+)/);return $?$[1]:null}function L0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function zj(X,$){let Z=await $J();if(!Z)return F8({...X,process:!1},$);let Y=$.tsVideosConfig,J=await Z.processVideo(X.src,X,Y,X.onProcessProgress);if(J.processed)return GJ(X,J,$);return F8({...X,process:!1},$)}async function jj(X,$){let Z=await $J();if(!Z||!X.src)return;let Y=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},J=$.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster(X.src,Y,J.outputDir,J.baseUrl||"/videos"))?.url}function GJ(X,$,Z){let{controls:Y=ZJ,autoplay:J=!1,muted:G=!1,loop:Q=!1,preload:q=YJ,playsinline:K=!0,lazy:U=!0,width:W,height:w,crossorigin:z,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=X,_=X.class,H=X.style,L=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=X.src,F=JJ(O);if($.transcoded)O=$.transcoded.url,F="video/mp4";let V=$.streaming?.hls||$.streaming?.dash;if(V){if($.streaming?.hls)O=$.streaming.hls.manifestUrl,F="application/x-mpegURL";else if($.streaming?.dash)O=$.streaming.dash.manifestUrl,F="application/dash+xml"}let A=$.poster?.url||X.poster,R=[`id="${L}"`];if(Y)R.push("controls");if(J)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(K)R.push("playsinline");if(B)R.push("disablepictureinpicture");if(j)R.push("disableremoteplayback");if(z)R.push(`crossorigin="${z}"`);if(U){if(R.push(`data-preload="${q}"`),R.push('preload="none"'),A)R.push(`data-poster="${L0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${q}"`),A)R.push(`poster="${L0(A)}"`);let N=W||$.metadata?.width,T=w||$.metadata?.height;if(N)R.push(`width="${N}"`);if(T)R.push(`height="${T}"`);if(_)R.push(`class="${L0(_)}"`);if(H)R.push(`style="${L0(H)}"`);let M=` <source ${U?`data-src="${L0(O)}"`:`src="${L0(O)}"`} type="${F}" />`,y=`<video ${R.join(" ")}>
11954
12027
  ${M}
11955
12028
  Your browser does not support the video tag.
11956
12029
  </video>`;if($.spriteSheet)y=`<div class="stx-video-wrapper" data-sprite-sheet="${L0($.spriteSheet.url)}" data-sprite-cols="${$.spriteSheet.columns}" data-sprite-interval="${$.spriteSheet.interval}">
@@ -11999,9 +12072,9 @@ ${y}
11999
12072
  width: 100%;
12000
12073
  height: auto;
12001
12074
  }
12002
- `.trim();return{html:y,script:I,css:C}}var lY=!1,pY=!0,iY="metadata",sz="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var oY=D(()=>{J3()});function sY(){return aX({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(X,$,Z,Y)=>{let{src:J,options:G}=Yj(X,$,Z);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:J,poster:G.poster,controls:G.controls!==!1,autoplay:G.autoplay||!1,muted:G.muted||!1,loop:G.loop||!1,preload:G.preload||"metadata",playsinline:G.playsinline!==!1,lazy:G.lazy!==!1,player:G.player||"native",type:G.type,width:G.width,height:G.height,class:G.class,style:G.style,id:G.id,crossorigin:G.crossorigin,disablePictureInPicture:G.disablePictureInPicture,disableRemotePlayback:G.disableRemotePlayback,title:G.title,quality:G.quality,platform:G.platform,process:G.process,generatePoster:G.generatePoster,streaming:G.streaming,transcode:G.transcode,spriteSheet:G.spriteSheet,waveform:G.waveform},K={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},U=await F8(Q,K),W=U.html;if(U.css)W+=`
12075
+ `.trim();return{html:y,script:I,css:C}}var XJ=!1,ZJ=!0,YJ="metadata",qj="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var QJ=E(()=>{w3()});function qJ(){return aX({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(X,$,Z,Y)=>{let{src:J,options:G}=Bj(X,$,Z);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:J,poster:G.poster,controls:G.controls!==!1,autoplay:G.autoplay||!1,muted:G.muted||!1,loop:G.loop||!1,preload:G.preload||"metadata",playsinline:G.playsinline!==!1,lazy:G.lazy!==!1,player:G.player||"native",type:G.type,width:G.width,height:G.height,class:G.class,style:G.style,id:G.id,crossorigin:G.crossorigin,disablePictureInPicture:G.disablePictureInPicture,disableRemotePlayback:G.disableRemotePlayback,title:G.title,quality:G.quality,platform:G.platform,process:G.process,generatePoster:G.generatePoster,streaming:G.streaming,transcode:G.transcode,spriteSheet:G.spriteSheet,waveform:G.waveform},K={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},U=await F8(Q,K),W=U.html;if(U.css)W+=`
12003
12076
  <style>${U.css}</style>`;if(U.script)W+=`
12004
- <script>${U.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Yj(X,$,Z){if($.src)return{src:String($.src),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=Jj(Y),G=aY(J[0],Z)||"",Q={};if(J[1]){let q=aY(J[1],Z);if(typeof q==="object"&&q!==null)Q=q;else if(typeof J[1]==="string")try{Q=JSON.parse(J[1])}catch{}}return{src:G,options:Q}}function Jj(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let q=0;q<X.length;q++){let K=X[q],U=q>0?X[q-1]:"";if((K==='"'||K==="'"||K==="`")&&U!=="\\"){if(!Y)Y=!0,J=K;else if(K===J)Y=!1,J="";else Z+=K;continue}if(!Y){if(K==="{")G++;if(K==="}")G--;if(K==="[")Q++;if(K==="]")Q--;if(K===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=K}if(Z.trim())$.push(Z.trim());return $}function aY(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var Y3;var J3=D(()=>{E9();oY();Y3=sY()});function Gj(X,$){let Z=$.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
12077
+ <script>${U.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function Bj(X,$,Z){if($.src)return{src:String($.src),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=_j(Y),G=KJ(J[0],Z)||"",Q={};if(J[1]){let q=KJ(J[1],Z);if(typeof q==="object"&&q!==null)Q=q;else if(typeof J[1]==="string")try{Q=JSON.parse(J[1])}catch{}}return{src:G,options:Q}}function _j(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let q=0;q<X.length;q++){let K=X[q],U=q>0?X[q-1]:"";if((K==='"'||K==="'"||K==="`")&&U!=="\\"){if(!Y)Y=!0,J=K;else if(K===J)Y=!1,J="";else Z+=K;continue}if(!Y){if(K==="{")G++;if(K==="}")G--;if(K==="[")Q++;if(K==="]")Q--;if(K===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=K}if(Z.trim())$.push(Z.trim());return $}function KJ(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var W3;var w3=E(()=>{v9();QJ();W3=qJ()});function Hj(X,$){let Z=$.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
12005
12078
  ${X}
12006
12079
  </div>
12007
12080
  <script>
@@ -12046,7 +12119,7 @@ ${y}
12046
12119
  }
12047
12120
  }
12048
12121
  })();
12049
- </script>`}function Qj(X,$){let Z=$.pwa?.updates,Y=Z?.message||"A new version is available. Reload to update?",J=Z?.autoReload||!1,G=X.trim().length>0,Q=`
12122
+ </script>`}function Oj(X,$){let Z=$.pwa?.updates,Y=Z?.message||"A new version is available. Reload to update?",J=Z?.autoReload||!1,G=X.trim().length>0,Q=`
12050
12123
  <div class="stx-pwa-update-banner" style="
12051
12124
  position: fixed;
12052
12125
  bottom: 0;
@@ -12157,7 +12230,7 @@ else {
12157
12230
  // Also listen for custom event
12158
12231
  window.addEventListener('pwa-update-available', showUpdate);
12159
12232
  })();
12160
- </script>`}function qj(X,$){let Z=X.trim().length>0,Y=`
12233
+ </script>`}function Lj(X,$){let Z=X.trim().length>0,Y=`
12161
12234
  <div class="stx-offline-indicator" style="
12162
12235
  position: fixed;
12163
12236
  top: 16px;
@@ -12218,7 +12291,7 @@ else {
12218
12291
  window.addEventListener('offline', updateStatus);
12219
12292
  updateStatus();
12220
12293
  })();
12221
- </script>`}function Kj(X,$){let Z=$.pwa?.push,Y=Z?.vapidPublicKey||"",J=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
12294
+ </script>`}function Fj(X,$){let Z=$.pwa?.push,Y=Z?.vapidPublicKey||"",J=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
12222
12295
  ${X}
12223
12296
  </div>
12224
12297
  <script>
@@ -12300,33 +12373,33 @@ catch (error) {
12300
12373
  init();
12301
12374
  }
12302
12375
  })();
12303
- </script>`}function YT(X){return[...X,...G3]}var Uj,Wj,wj,zj,G3;var Q3=D(()=>{Uj={name:"pwa.installButton",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return Gj(X,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Wj={name:"pwa.updatePrompt",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return Qj(X,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},wj={name:"pwa.offlineIndicator",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return qj(X,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},zj={name:"pwa.pushSubscribe",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return Kj(X,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},G3=[Uj,Wj,wj,zj]});function q3(X){for(let[$,Z]of Object.entries(s))if(Z===X)return $;return}var s;var V8=D(()=>{s={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function S7(){return!1}function C7(){return!S7()||process.env.STX_DEBUG==="true"}function A8(){return!1}import jj from"path";function R8(){return{...K3}}function T8(X){if(!K3.showRelativePaths||!X)return X;let $=K3.baseDir||process.cwd();try{let Z=jj.relative($,X);return Z.startsWith("..")?X:Z}catch{return X}}var Bj,K3,N8,t1,M8;var k8=D(()=>{V8();Bj={showRelativePaths:!1,enableAutoRecovery:C7(),logRecoveryWarnings:!0},K3={...Bj};N8=class N8 extends Error{code;filePath;line;column;context;numericCode;constructor(X,$,Z,Y,J,G,Q){super(X);this.code=$;this.filePath=Z;this.line=Y;this.column=J;this.context=G;if(this.name="StxError",this.numericCode=Q||s.EVALUATION_ERROR,this.filePath)this.filePath=T8(this.filePath)}};t1=class t1 extends N8{constructor(X,$,Z,Y,J,G){super(X,"stx_RUNTIME_ERROR",$,Z,Y,J,G||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};M8=class M8 extends N8{isFatal=!0;constructor(X,$,Z,Y,J,G){super(X,"stx_VALIDATION_ERROR",$,Z,Y,J,G||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function eY(X){let{type:$,message:Z,code:Y,filePath:J,line:G,column:Q,template:q,offset:K,snippet:U,suggestion:W,format:w="text"}=X,z=G,B=Q;if(!z&&q&&K!==void 0){let O=Vj(q,K);z=O.line,B=O.column}let j=J?T8(J):void 0,_=Y?q3(Y):void 0,H={type:$,code:Y,codeName:_,message:Z,filePath:j,line:z,column:B,snippet:U,suggestion:W,timestamp:new Date().toISOString()},L;switch(w){case"html":L=Hj(H);break;case"json":L=JSON.stringify(H,null,2);break;case"console":L=Oj(H,q,K);break;case"text":default:L=_j(H,q,K);break}return{formatted:L,data:H}}function _j(X,$,Z){let Y=[],J=X.code?` [${X.codeName||X.code}]`:"";if(Y.push(`[${X.type} Error${J}]`),X.filePath){let G=X.filePath;if(X.line){if(G+=`:${X.line}`,X.column)G+=`:${X.column}`}Y.push(`at ${G}`)}if(Y.push(`
12304
- ${X.message}`),$&&X.line){let G=Lj($,X.line,2);if(G)Y.push(`
12376
+ </script>`}function AN(X){return[...X,...z3]}var Vj,Aj,Rj,Nj,z3;var j3=E(()=>{Vj={name:"pwa.installButton",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return Hj(X,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},Aj={name:"pwa.updatePrompt",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return Oj(X,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},Rj={name:"pwa.offlineIndicator",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return Lj(X,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},Nj={name:"pwa.pushSubscribe",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return Fj(X,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},z3=[Vj,Aj,Rj,Nj]});function B3(X){for(let[$,Z]of Object.entries(s))if(Z===X)return $;return}var s;var V8=E(()=>{s={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function C7(){return!1}function P7(){return!C7()||process.env.STX_DEBUG==="true"}function A8(){return!1}import Tj from"path";function R8(){return{..._3}}function N8(X){if(!_3.showRelativePaths||!X)return X;let $=_3.baseDir||process.cwd();try{let Z=Tj.relative($,X);return Z.startsWith("..")?X:Z}catch{return X}}var Mj,_3,T8,e1,M8;var k8=E(()=>{V8();Mj={showRelativePaths:!1,enableAutoRecovery:P7(),logRecoveryWarnings:!0},_3={...Mj};T8=class T8 extends Error{code;filePath;line;column;context;numericCode;constructor(X,$,Z,Y,J,G,Q){super(X);this.code=$;this.filePath=Z;this.line=Y;this.column=J;this.context=G;if(this.name="StxError",this.numericCode=Q||s.EVALUATION_ERROR,this.filePath)this.filePath=N8(this.filePath)}};e1=class e1 extends T8{constructor(X,$,Z,Y,J,G){super(X,"stx_RUNTIME_ERROR",$,Z,Y,J,G||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};M8=class M8 extends T8{isFatal=!0;constructor(X,$,Z,Y,J,G){super(X,"stx_VALIDATION_ERROR",$,Z,Y,J,G||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function WJ(X){let{type:$,message:Z,code:Y,filePath:J,line:G,column:Q,template:q,offset:K,snippet:U,suggestion:W,format:w="text"}=X,z=G,B=Q;if(!z&&q&&K!==void 0){let O=bj(q,K);z=O.line,B=O.column}let j=J?N8(J):void 0,_=Y?B3(Y):void 0,H={type:$,code:Y,codeName:_,message:Z,filePath:j,line:z,column:B,snippet:U,suggestion:W,timestamp:new Date().toISOString()},L;switch(w){case"html":L=Ij(H);break;case"json":L=JSON.stringify(H,null,2);break;case"console":L=Ej(H,q,K);break;case"text":default:L=kj(H,q,K);break}return{formatted:L,data:H}}function kj(X,$,Z){let Y=[],J=X.code?` [${X.codeName||X.code}]`:"";if(Y.push(`[${X.type} Error${J}]`),X.filePath){let G=X.filePath;if(X.line){if(G+=`:${X.line}`,X.column)G+=`:${X.column}`}Y.push(`at ${G}`)}if(Y.push(`
12377
+ ${X.message}`),$&&X.line){let G=Dj($,X.line,2);if(G)Y.push(`
12305
12378
  ${G}`)}if(X.snippet)Y.push(`
12306
12379
  Snippet: ${X.snippet}`);if(X.suggestion)Y.push(`
12307
- Suggestion: ${X.suggestion}`);return Y.join(" ")}function Hj(X){let $=X.code?` [${X.code}]`:"",Z=X.filePath?` in ${X.filePath}${X.line?`:${X.line}`:""}`:"",Y=`<!-- [${X.type} Error${$}]${Z}: ${tY(X.message)}`;if(X.suggestion)Y+=` | Suggestion: ${tY(X.suggestion)}`;return Y+=" -->",Y}function Oj(X,$,Z){let U=[],W=X.code?` [${X.codeName||X.code}]`:"";if(U.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${X.type} Error${W} \u2501\u2501\u2501${"\x1B[0m"}`),X.filePath){let w=`\x1B[36m${X.filePath}\x1B[0m`;if(X.line){if(w+=`\x1B[90m:${X.line}\x1B[0m`,X.column)w+=`\x1B[90m:${X.column}\x1B[0m`}U.push(`
12380
+ Suggestion: ${X.suggestion}`);return Y.join(" ")}function Ij(X){let $=X.code?` [${X.code}]`:"",Z=X.filePath?` in ${X.filePath}${X.line?`:${X.line}`:""}`:"",Y=`<!-- [${X.type} Error${$}]${Z}: ${UJ(X.message)}`;if(X.suggestion)Y+=` | Suggestion: ${UJ(X.suggestion)}`;return Y+=" -->",Y}function Ej(X,$,Z){let U=[],W=X.code?` [${X.codeName||X.code}]`:"";if(U.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${X.type} Error${W} \u2501\u2501\u2501${"\x1B[0m"}`),X.filePath){let w=`\x1B[36m${X.filePath}\x1B[0m`;if(X.line){if(w+=`\x1B[90m:${X.line}\x1B[0m`,X.column)w+=`\x1B[90m:${X.column}\x1B[0m`}U.push(`
12308
12381
  \x1B[90mat\x1B[0m ${w}`)}if(U.push(`
12309
12382
 
12310
- ${X.message}`),$&&X.line){let w=Fj($,X.line,2);if(w)U.push(`
12383
+ ${X.message}`),$&&X.line){let w=yj($,X.line,2);if(w)U.push(`
12311
12384
 
12312
12385
  \x1B[90mContext:\x1B[0m
12313
12386
  ${w}`)}if(X.suggestion)U.push(`
12314
12387
 
12315
12388
  \x1B[33mSuggestion:\x1B[0m ${X.suggestion}`);return U.push(`
12316
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),U.join("")}function Lj(X,$,Z){let Y=X.split(`
12389
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),U.join("")}function Dj(X,$,Z){let Y=X.split(`
12317
12390
  `),J=Math.max(0,$-Z-1),G=Math.min(Y.length-1,$+Z-1),Q=[];for(let q=J;q<=G;q++){let K=(q+1).toString().padStart(4),U=q===$-1?">":" ";Q.push(`${U}${K} | ${Y[q]}`)}return Q.join(`
12318
- `)}function Fj(X,$,Z){let Y=X.split(`
12391
+ `)}function yj(X,$,Z){let Y=X.split(`
12319
12392
  `),J=Math.max(0,$-Z-1),G=Math.min(Y.length-1,$+Z-1),Q="\x1B[90m",q="\x1B[31m",K="\x1B[0m",U=[];for(let W=J;W<=G;W++){let w=(W+1).toString().padStart(4),z=W===$-1,B=z?"\x1B[31m>\x1B[0m":" ",j=z?`\x1B[31m${Y[W]}\x1B[0m`:`\x1B[90m${Y[W]}\x1B[0m`;U.push(`${B}\x1B[90m${w}\x1B[0m | ${j}`)}return U.join(`
12320
- `)}function tY(X){return X.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Vj(X,$){let Y=X.substring(0,$).split(`
12321
- `);return{line:Y.length,column:Y[Y.length-1].length}}function X0(X,$,Z){return eY({type:X,message:$,code:Z,format:"html"}).formatted}async function y5(X,$,Z){try{return await X()}catch(Y){if(Z&&Y instanceof Error)Z(Y);return $}}var XJ=D(()=>{V8();k8()});class W3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(X={}){this.maxErrors=X.maxErrors??1000,this.enableFileLogging=X.enableFileLogging??!1,this.logFilePath=X.logFilePath??".stx/errors.log",this.logFormat=X.logFormat??"json",this.maxFileSize=X.maxFileSize??10485760,this.maxLogFiles=X.maxLogFiles??5,this.minLevel=X.minLevel??"all"}configure(X){if(X.maxErrors!==void 0)this.maxErrors=X.maxErrors;if(X.enableFileLogging!==void 0)this.enableFileLogging=X.enableFileLogging;if(X.logFilePath!==void 0)this.logFilePath=X.logFilePath;if(X.logFormat!==void 0)this.logFormat=X.logFormat;if(X.maxFileSize!==void 0)this.maxFileSize=X.maxFileSize;if(X.maxLogFiles!==void 0)this.maxLogFiles=X.maxLogFiles;if(X.minLevel!==void 0)this.minLevel=X.minLevel}log(X,$,Z="error"){let Y={timestamp:new Date,error:X,context:$,level:Z};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))this.writeToFile(Y)}shouldLog(X){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return X==="error"||X==="warning";if(this.minLevel==="error")return X==="error";return!0}formatEntry(X){if(this.logFormat==="json")return JSON.stringify({timestamp:X.timestamp.toISOString(),level:X.level||"error",type:X.error.constructor.name,message:X.error.message,stack:X.error.stack,context:X.context});let $=[`[${X.timestamp.toISOString()}] [${(X.level||"error").toUpperCase()}] ${X.error.constructor.name}: ${X.error.message}`];if(X.error.stack)$.push(` Stack: ${X.error.stack.split(`
12393
+ `)}function UJ(X){return X.replace(/--/g,"- -").replace(/>/g,"&gt;")}function bj(X,$){let Y=X.substring(0,$).split(`
12394
+ `);return{line:Y.length,column:Y[Y.length-1].length}}function X0(X,$,Z){return WJ({type:X,message:$,code:Z,format:"html"}).formatted}async function b5(X,$,Z){try{return await X()}catch(Y){if(Z&&Y instanceof Error)Z(Y);return $}}var wJ=E(()=>{V8();k8()});class O3{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(X={}){this.maxErrors=X.maxErrors??1000,this.enableFileLogging=X.enableFileLogging??!1,this.logFilePath=X.logFilePath??".stx/errors.log",this.logFormat=X.logFormat??"json",this.maxFileSize=X.maxFileSize??10485760,this.maxLogFiles=X.maxLogFiles??5,this.minLevel=X.minLevel??"all"}configure(X){if(X.maxErrors!==void 0)this.maxErrors=X.maxErrors;if(X.enableFileLogging!==void 0)this.enableFileLogging=X.enableFileLogging;if(X.logFilePath!==void 0)this.logFilePath=X.logFilePath;if(X.logFormat!==void 0)this.logFormat=X.logFormat;if(X.maxFileSize!==void 0)this.maxFileSize=X.maxFileSize;if(X.maxLogFiles!==void 0)this.maxLogFiles=X.maxLogFiles;if(X.minLevel!==void 0)this.minLevel=X.minLevel}log(X,$,Z="error"){let Y={timestamp:new Date,error:X,context:$,level:Z};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))this.writeToFile(Y)}shouldLog(X){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return X==="error"||X==="warning";if(this.minLevel==="error")return X==="error";return!0}formatEntry(X){if(this.logFormat==="json")return JSON.stringify({timestamp:X.timestamp.toISOString(),level:X.level||"error",type:X.error.constructor.name,message:X.error.message,stack:X.error.stack,context:X.context});let $=[`[${X.timestamp.toISOString()}] [${(X.level||"error").toUpperCase()}] ${X.error.constructor.name}: ${X.error.message}`];if(X.error.stack)$.push(` Stack: ${X.error.stack.split(`
12322
12395
  `).slice(1).join(`
12323
12396
  `)}`);if(X.context)$.push(` Context: ${JSON.stringify(X.context)}`);return $.join(`
12324
12397
  `)}writeToFile(X){this.writeQueue=this.writeQueue.then(async()=>{try{let $=await import("fs"),Y=(await import("path")).dirname(this.logFilePath);if(!$.existsSync(Y))$.mkdirSync(Y,{recursive:!0});await this.rotateIfNeeded($);let J=`${this.formatEntry(X)}
12325
12398
  `;$.appendFileSync(this.logFilePath,J,"utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",$)}})}async rotateIfNeeded(X){try{if(!X.existsSync(this.logFilePath))return;if(X.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Z=this.maxLogFiles-1;Z>=1;Z--){let Y=`${this.logFilePath}.${Z}`,J=`${this.logFilePath}.${Z+1}`;if(X.existsSync(Y))if(Z>=this.maxLogFiles-1)X.unlinkSync(Y);else X.renameSync(Y,J)}if(this.maxLogFiles<=1)X.writeFileSync(this.logFilePath,"");else X.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",$)}}getRecentErrors(X=10){return this.errors.slice(-X)}getErrorsByType(X){return this.errors.filter(($)=>$.error.constructor.name===X)}getErrorsByLevel(X){return this.errors.filter(($)=>$.level===X)}clear(){this.errors.length=0}async clearLogFile(){try{let X=await import("fs");if(X.existsSync(this.logFilePath))X.writeFileSync(this.logFilePath,"","utf-8")}catch(X){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",X)}}getStats(){let X={},$={error:0,warning:0,info:0};for(let Z of this.errors){let Y=Z.error.constructor.name;X[Y]=(X[Y]||0)+1;let J=Z.level||"error";$[J]=($[J]||0)+1}return{total:this.errors.length,byType:X,byLevel:$}}async exportToFile(X,$="json"){let Z=await import("fs"),J=(await import("path")).dirname(X);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});if($==="json"){let G=this.errors.map((Q)=>({timestamp:Q.timestamp.toISOString(),level:Q.level||"error",type:Q.error.constructor.name,message:Q.error.message,stack:Q.error.stack,context:Q.context}));Z.writeFileSync(X,JSON.stringify(G,null,2),"utf-8")}else{let G=this.errors.map((Q)=>this.formatEntry(Q));Z.writeFileSync(X,G.join(`
12326
12399
 
12327
- `),"utf-8")}}async flush(){await this.writeQueue}}var U3,a0,w3;var $J=D(()=>{k8();U3={isEnabled(){return R8().enableAutoRecovery},fixCommonSyntaxErrors(X){let $=R8();if(!$.enableAutoRecovery)return{fixed:X,fixes:[]};let Z=X,Y=[],J=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(J>G){let q=J-G;Z+="}}".repeat(q),Y.push(`Added ${q} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let q of Q){let K=(Z.match(new RegExp(`@${q}\\b`,"g"))||[]).length,U=(Z.match(new RegExp(`@end${q}\\b`,"g"))||[]).length;if(K>U){let W=K-U;for(let w=0;w<W;w++)Z+=`
12328
- @end${q}`;Y.push(`Added ${W} missing @end${q}`)}}if(Y.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((q)=>console.warn(` - ${q}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:Y}},createFallbackContent(X,$){if(C7())return`<!-- ${X} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};a0=new W3,w3={isDevelopment(){return C7()},logDetailedError(X,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",X.message),console.error("Stack:",X.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(X,$){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${X.message}`,`Type: ${X.constructor.name}`,`Stack: ${X.stack}`];if($)Z.push(`Context: ${JSON.stringify($,null,2)}`);return Z.push("========================"),Z.join(`
12329
- `)}}});var ZJ=()=>{};var YJ=D(()=>{V8();XJ();$J();ZJ();k8()});var w1=D(()=>{YJ()});function JJ(X,$,Z,Y){let J=X;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(q,K,U)=>{if(!U&&K.includes(":")){let W=K.split(":"),w=K,z=W.length>1?W[1]:"";if(z&&$[z])U=$[z];else if(w.startsWith("og:")&&$.openGraph&&$.openGraph[W[1]])U=$.openGraph[W[1]];else U="";return U?`<meta property="${c(w)}" content="${c(U)}">`:""}return U?`<meta name="${c(K)}" content="${c(U)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(J))!==null){let q=Q.index,K=q+Q[0].length-1,U=1,W=K+1;while(W<J.length&&U>0){if(J[W]==="(")U++;else if(J[W]===")"){if(U--,U===0)break}W++}if(U!==0)break;let w=J.substring(K+1,W).trim(),z=W+1,B=(()=>{try{let j=H0(w,$);if(!j)return"";let _="<meta";if(j.name)_+=` name="${c(String(j.name))}"`;if(j.property)_+=` property="${c(String(j.property))}"`;if(j.httpEquiv)_+=` http-equiv="${c(String(j.httpEquiv))}"`;if(j.content)_+=` content="${c(String(j.content))}"`;return _+=">",_}catch(j){let _=j instanceof Error?j.message:String(j);return X0("MetaTag",_,s.EVALUATION_ERROR)}})();J=J.substring(0,q)+B+J.substring(z),G.lastIndex=0}return J}function GJ(X,$,Z){let Y=X,J=/@structuredData\s*\(/g,G;while((G=J.exec(Y))!==null){let Q=G.index,q=Q+G[0].length-1,K=1,U=q+1;while(U<Y.length&&K>0){if(Y[U]==="(")K++;else if(Y[U]===")"){if(K--,K===0)break}U++}if(K!==0)break;let W=Y.substring(q+1,U).trim(),w=U+1,z=(()=>{try{let B=H0(W,$);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return X0("StructuredData",j,s.EVALUATION_ERROR)}})();Y=Y.substring(0,Q)+z+Y.substring(w),J.lastIndex=0}return Y}function QJ(X,$,Z,Y){let J=X,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(J))!==null){let q=J.indexOf("{",Q.index+4),K=1,U=q+1,W=null,w=!1;while(U<J.length&&K>0){let L=J[U];if(w){w=!1,U++;continue}if(L==="\\"&&W){w=!0,U++;continue}if(W){if(L===W)W=null;U++;continue}if(L==='"'||L==="'"||L==="`"){W=L,U++;continue}if(L==="{")K++;else if(L==="}")K--;U++}if(K!==0)break;let z=J.substring(U).match(/^\s*\)/);if(!z)break;let B=U+z[0].length,j=J.substring(q,U),_=J.substring(Q.index,B),H=((L)=>{try{let O=H0(L,$);if(!O)return"";let F="";if(O.title)F+=`<title>${c(O.title)}</title>
12400
+ `),"utf-8")}}async flush(){await this.writeQueue}}var H3,s0,L3;var zJ=E(()=>{k8();H3={isEnabled(){return R8().enableAutoRecovery},fixCommonSyntaxErrors(X){let $=R8();if(!$.enableAutoRecovery)return{fixed:X,fixes:[]};let Z=X,Y=[],J=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(J>G){let q=J-G;Z+="}}".repeat(q),Y.push(`Added ${q} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let q of Q){let K=(Z.match(new RegExp(`@${q}\\b`,"g"))||[]).length,U=(Z.match(new RegExp(`@end${q}\\b`,"g"))||[]).length;if(K>U){let W=K-U;for(let w=0;w<W;w++)Z+=`
12401
+ @end${q}`;Y.push(`Added ${W} missing @end${q}`)}}if(Y.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((q)=>console.warn(` - ${q}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:Y}},createFallbackContent(X,$){if(P7())return`<!-- ${X} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};s0=new O3,L3={isDevelopment(){return P7()},logDetailedError(X,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",X.message),console.error("Stack:",X.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(X,$){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${X.message}`,`Type: ${X.constructor.name}`,`Stack: ${X.stack}`];if($)Z.push(`Context: ${JSON.stringify($,null,2)}`);return Z.push("========================"),Z.join(`
12402
+ `)}}});var jJ=()=>{};var BJ=E(()=>{V8();wJ();zJ();jJ();k8()});var w1=E(()=>{BJ()});function _J(X,$,Z,Y){let J=X;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(q,K,U)=>{if(!U&&K.includes(":")){let W=K.split(":"),w=K,z=W.length>1?W[1]:"";if(z&&$[z])U=$[z];else if(w.startsWith("og:")&&$.openGraph&&$.openGraph[W[1]])U=$.openGraph[W[1]];else U="";return U?`<meta property="${c(w)}" content="${c(U)}">`:""}return U?`<meta name="${c(K)}" content="${c(U)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(J))!==null){let q=Q.index,K=q+Q[0].length-1,U=1,W=K+1;while(W<J.length&&U>0){if(J[W]==="(")U++;else if(J[W]===")"){if(U--,U===0)break}W++}if(U!==0)break;let w=J.substring(K+1,W).trim(),z=W+1,B=(()=>{try{let j=H0(w,$);if(!j)return"";let _="<meta";if(j.name)_+=` name="${c(String(j.name))}"`;if(j.property)_+=` property="${c(String(j.property))}"`;if(j.httpEquiv)_+=` http-equiv="${c(String(j.httpEquiv))}"`;if(j.content)_+=` content="${c(String(j.content))}"`;return _+=">",_}catch(j){let _=j instanceof Error?j.message:String(j);return X0("MetaTag",_,s.EVALUATION_ERROR)}})();J=J.substring(0,q)+B+J.substring(z),G.lastIndex=0}return J}function HJ(X,$,Z){let Y=X,J=/@structuredData\s*\(/g,G;while((G=J.exec(Y))!==null){let Q=G.index,q=Q+G[0].length-1,K=1,U=q+1;while(U<Y.length&&K>0){if(Y[U]==="(")K++;else if(Y[U]===")"){if(K--,K===0)break}U++}if(K!==0)break;let W=Y.substring(q+1,U).trim(),w=U+1,z=(()=>{try{let B=H0(W,$);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return X0("StructuredData",j,s.EVALUATION_ERROR)}})();Y=Y.substring(0,Q)+z+Y.substring(w),J.lastIndex=0}return Y}function OJ(X,$,Z,Y){let J=X,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(J))!==null){let q=J.indexOf("{",Q.index+4),K=1,U=q+1,W=null,w=!1;while(U<J.length&&K>0){let L=J[U];if(w){w=!1,U++;continue}if(L==="\\"&&W){w=!0,U++;continue}if(W){if(L===W)W=null;U++;continue}if(L==='"'||L==="'"||L==="`"){W=L,U++;continue}if(L==="{")K++;else if(L==="}")K--;U++}if(K!==0)break;let z=J.substring(U).match(/^\s*\)/);if(!z)break;let B=U+z[0].length,j=J.substring(q,U),_=J.substring(Q.index,B),H=((L)=>{try{let O=H0(L,$);if(!O)return"";let F="";if(O.title)F+=`<title>${c(O.title)}</title>
12330
12403
  `,F+=`<meta name="title" content="${c(O.title)}">
12331
12404
  `;if(O.description)F+=`<meta name="description" content="${c(O.description)}">
12332
12405
  `;if(O.keywords){let V=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;F+=`<meta name="keywords" content="${c(V)}">
@@ -12348,7 +12421,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
12348
12421
  `}if(V.site)F+=`<meta name="twitter:site" content="${c(V.site)}">
12349
12422
  `;if(V.creator)F+=`<meta name="twitter:creator" content="${c(V.creator)}">
12350
12423
  `}if(O.structuredData){let V=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${V}</script>
12351
- `}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return X0("SEO",`Error processing @seo directive: ${F}`,s.EVALUATION_ERROR)}})(j);J=J.substring(0,Q.index)+H+J.substring(B),G.lastIndex=Q.index+H.length}return J}function qJ(X,$,Z){if(Z.seo?.enabled===!1)return X;if(X.includes("<!-- stx SEO Tags -->")||Z.skipDefaultSeoTags===!0)return X;let Y=$.__stx_runtime_head;if(!!(Y?.title||Y?.meta?.some((w)=>w.property==="og:title"||w.name==="og:title"||w.name==="twitter:title"||w.name==="description")))return X;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(X))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let G=X.includes("<title>")||X.includes("</title>"),Q="";if($.title)Q=$.title;else if($.meta&&$.meta.title)Q=$.meta.title;else if(Z.seo?.defaultConfig?.title)Q=Z.seo.defaultConfig.title;else Q=Z.defaultTitle||"stx Project";let q="";if($.description)q=$.description;else if($.meta&&$.meta.description)q=$.meta.description;else if(Z.seo?.defaultConfig?.description)q=Z.seo.defaultConfig.description;else q=Z.defaultDescription||"A website built with stx templating engine";let K="";if($.image)K=$.image;else if($.meta&&$.meta.image)K=$.meta.image;else if($.openGraph&&$.openGraph.image)K=$.openGraph.image;else if(Z.seo?.defaultImage)K=Z.seo.defaultImage;else if(Z.defaultImage)K=Z.defaultImage;let U=`
12424
+ `}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return X0("SEO",`Error processing @seo directive: ${F}`,s.EVALUATION_ERROR)}})(j);J=J.substring(0,Q.index)+H+J.substring(B),G.lastIndex=Q.index+H.length}return J}function LJ(X,$,Z){if(Z.seo?.enabled===!1)return X;if(X.includes("<!-- stx SEO Tags -->")||Z.skipDefaultSeoTags===!0)return X;let Y=$.__stx_runtime_head;if(!!(Y?.title||Y?.meta?.some((w)=>w.property==="og:title"||w.name==="og:title"||w.name==="twitter:title"||w.name==="description")))return X;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(X))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let G=X.includes("<title>")||X.includes("</title>"),Q="";if($.title)Q=$.title;else if($.meta&&$.meta.title)Q=$.meta.title;else if(Z.seo?.defaultConfig?.title)Q=Z.seo.defaultConfig.title;else Q=Z.defaultTitle||"stx Project";let q="";if($.description)q=$.description;else if($.meta&&$.meta.description)q=$.meta.description;else if(Z.seo?.defaultConfig?.description)q=Z.seo.defaultConfig.description;else q=Z.defaultDescription||"A website built with stx templating engine";let K="";if($.image)K=$.image;else if($.meta&&$.meta.image)K=$.meta.image;else if($.openGraph&&$.openGraph.image)K=$.openGraph.image;else if(Z.seo?.defaultImage)K=Z.seo.defaultImage;else if(Z.defaultImage)K=Z.defaultImage;let U=`
12352
12425
  <!-- stx SEO Tags -->
12353
12426
  <meta name="title" content="${c(Q)}">
12354
12427
  <meta name="description" content="${c(q)}">
@@ -12364,7 +12437,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
12364
12437
  `;let W=X;if(!G)W=W.replace(/<head[^>]*>/,`$&
12365
12438
  <title>${c(Q)}</title>`);return W.replace(/<head[^>]*>/,`$&
12366
12439
  ${U}
12367
- `)}function c(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var KJ,UJ;var z3=D(()=>{w1();O0();KJ={name:"meta",handler:(X,$,Z,Y)=>{if($.length<1)return X0("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"";return`<meta name="${c(J)}" content="${c(G)}">`},hasEndTag:!1},UJ={name:"structuredData",handler:(X,$,Z,Y)=>{if(X.trim()==="")return X0("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse(X);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return X0("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let G=J instanceof Error?J.message:String(J);return X0("StructuredData",G,s.EVALUATION_ERROR)}},hasEndTag:!0}});import P7 from"path";function Aj(X,$){let Z=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1].trim():"",J=$,G=[],Q=!0;if(Y){let w=Y.match(/export\s+default\s+({[\s\S]*})/);if(w)try{let z=w[1],B=z.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)J=B[1];let j=z.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)G=j[1].split(",").map((H)=>H.trim().replace(/['"`]/g,"")).filter((H)=>H.length>0);let _=z.match(/shadowDOM\s*:\s*(true|false)/);if(_)Q=_[1]==="true"}catch{}}let q=X.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),K=q?q[1].trim():"",U=X.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=U?U[1].trim():"";return{tag:J,props:G,template:K,styles:W,script:Y,shadowDOM:Q}}function Rj(X){let{tag:$,props:Z,template:Y,styles:J,shadowDOM:G}=X,Q=$.split("-").map((w)=>w.charAt(0).toUpperCase()+w.slice(1)).join(""),q=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),U=Z.map((w)=>`'${w}'`).join(", "),W=Z.map((w)=>`
12440
+ `)}function c(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var FJ,VJ;var F3=E(()=>{w1();O0();FJ={name:"meta",handler:(X,$,Z,Y)=>{if($.length<1)return X0("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"";return`<meta name="${c(J)}" content="${c(G)}">`},hasEndTag:!1},VJ={name:"structuredData",handler:(X,$,Z,Y)=>{if(X.trim()==="")return X0("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse(X);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return X0("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let G=J instanceof Error?J.message:String(J);return X0("StructuredData",G,s.EVALUATION_ERROR)}},hasEndTag:!0}});import v7 from"path";function Sj(X,$){let Z=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1].trim():"",J=$,G=[],Q=!0;if(Y){let w=Y.match(/export\s+default\s+({[\s\S]*})/);if(w)try{let z=w[1],B=z.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)J=B[1];let j=z.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)G=j[1].split(",").map((H)=>H.trim().replace(/['"`]/g,"")).filter((H)=>H.length>0);let _=z.match(/shadowDOM\s*:\s*(true|false)/);if(_)Q=_[1]==="true"}catch{}}let q=X.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),K=q?q[1].trim():"",U=X.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=U?U[1].trim():"";return{tag:J,props:G,template:K,styles:W,script:Y,shadowDOM:Q}}function Cj(X){let{tag:$,props:Z,template:Y,styles:J,shadowDOM:G}=X,Q=$.split("-").map((w)=>w.charAt(0).toUpperCase()+w.slice(1)).join(""),q=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),U=Z.map((w)=>`'${w}'`).join(", "),W=Z.map((w)=>`
12368
12441
  get ${w}() {
12369
12442
  return this.getAttribute('${w}') || '';
12370
12443
  }
@@ -12415,16 +12488,16 @@ ${W}
12415
12488
  }
12416
12489
 
12417
12490
  customElements.define('${$}', ${Q});
12418
- `}async function WJ(X,$,Z,Y){if($.length<1)return X0("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",q=[P7.join(P7.dirname(Y),Q,`${J}.stx`),P7.join(process.cwd(),Q,`${J}.stx`),P7.join(P7.dirname(Y),`${J}.stx`)],K=null;for(let w of q)if(await p(w)){K=await Bun.file(w).text();break}if(!K)return X0("WebComponent",`Component file not found: ${J}.stx`,s.FILE_NOT_FOUND);let U=Aj(K,J);return`<script type="module">
12419
- ${Rj(U)}
12420
- </script>`}var wJ=D(()=>{w1();A0()});var zJ={};n(zJ,{timingPlugin:()=>Ij,pluginManager:()=>Tj,definePlugin:()=>I8,debugPlugin:()=>kj,createVariablesPlugin:()=>Ej,createFilterPlugin:()=>Mj,createDirectivePlugin:()=>Nj,PluginManager:()=>j3});function I8(X){return X}class j3{plugins=new Map;sortedPlugins=[];initialized=!1;async register(X,$){if(this.plugins.has(X.name))throw Error(`Plugin "${X.name}" is already registered`);if(X.dependencies){for(let Z of X.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${X.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set(X.name,X),X.onRegister)await X.onRegister($);this.sortPlugins()}async unregister(X){let $=this.plugins.get(X);if(!$)return!1;for(let[Z,Y]of this.plugins)if(Y.dependencies?.includes(X))throw Error(`Cannot unregister "${X}" because "${Z}" depends on it`);if($.onUnregister)await $.onUnregister();return this.plugins.delete(X),this.sortPlugins(),!0}get(X){return this.plugins.get(X)}has(X){return this.plugins.has(X)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let X=[];for(let $ of this.sortedPlugins)if($.registerDirectives)X.push(...$.registerDirectives());return X}getAllFilters(){let X={};for(let $ of this.sortedPlugins)if($.registerFilters)Object.assign(X,$.registerFilters());return X}async runBeforeProcess(X){return this.runHooks("beforeProcess",X)}async runAfterParse(X){return this.runHooks("afterParse",X)}async runBeforeDirective(X,$){return this.runDirectiveHooks("beforeDirective",X,$)}async runAfterDirective(X,$){return this.runDirectiveHooks("afterDirective",X,$)}async runBeforeRender(X){return this.runHooks("beforeRender",X)}async runAfterRender(X){return this.runHooks("afterRender",X)}async runOnError(X){for(let $ of this.sortedPlugins)if($.onError)try{let Z=await $.onError(X);if(Z){if(Z.template!==void 0)X.template=Z.template;if(Z.context)X.context={...X.context,...Z.context};if(Z.metadata)X.metadata={...X.metadata,...Z.metadata};if(Z.skip)return X}}catch(Z){console.error(`Error in plugin "${$.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((X,$)=>(X.priority??100)-($.priority??100))}async runHooks(X,$){let Z={...$};for(let Y of this.sortedPlugins){let J=Y[X];if(J)try{let G=await J(Z);if(G){if(G.template!==void 0)Z.template=G.template;if(G.context)Z.context={...Z.context,...G.context};if(G.metadata)Z.metadata={...Z.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Y.name}" ${X} hook:`,G)}}return Z}async runDirectiveHooks(X,$,Z){let Y={...Z};for(let J of this.sortedPlugins){let G=J[X];if(G)try{let Q=await G($,Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${X} hook:`,Q)}}return Y}}function Nj(X,$,Z={}){return{name:X,...Z,registerDirectives:()=>$}}function Mj(X,$,Z={}){return{name:X,...Z,registerFilters:()=>$}}function Ej(X){return I8({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess($){return{context:{...$.context,...X}}}})}var Tj,kj,Ij;var jJ=D(()=>{Tj=new j3;kj=I8({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(X){console.log("[stx-debug] beforeProcess:",X.filePath)},afterParse(X){console.log("[stx-debug] afterParse:",X.template.length,"chars")},beforeDirective(X,$){console.log("[stx-debug] beforeDirective:",X)},afterDirective(X,$){console.log("[stx-debug] afterDirective:",X)},beforeRender(X){console.log("[stx-debug] beforeRender")},afterRender(X){console.log("[stx-debug] afterRender:",X.template.length,"chars")},onError(X){console.error("[stx-debug] onError:",X.error.message,"in phase:",X.phase)}}),Ij=I8({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(X){X.metadata.startTime=performance.now()},afterRender(X){let $=X.metadata.startTime;if($){let Z=performance.now()-$;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var OJ={};n(OJ,{validateConfig:()=>vj,resolveStxDirectories:()=>HJ,loadStxConfig:()=>I1,defineStxConfig:()=>Pj,defaultConfig:()=>e1,config:()=>B7});import E8 from"fs";import h0 from"path";import{loadConfigWithResult as Dj}from"bunfig";function yj(X,$,Z){let Y=$||"pages";if(X)return{root:X,pagesDir:Y};let J=Z||process.cwd(),G=h0.join(J,"resources","views"),Q=h0.join(J,"resources","layouts");if(E8.existsSync(G)&&E8.existsSync(Q))return{root:"resources",pagesDir:"views"};let q=h0.join(J,"resources","views","pages");if(E8.existsSync(q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function bj(X,$){let Z=$.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let Y=X.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/");return Y===J||Y.startsWith(`${J}/`)}function HJ(X,$){let Z=!X.root,Y=yj(X.root,X.pagesDir,$);if(X.root=Y.root,X.pagesDir=Y.pagesDir,Z&&Y.root!=="."){let J=`${$}::${Y.root}`;if(!BJ.has(J))BJ.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(X.root&&X.root!=="."){let J=X.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=X[G];if(typeof Q!=="string"||!Q)continue;if(h0.isAbsolute(Q)||bj(Q,J))continue;X[G]=h0.join(J,Q)}}return X}function Sj(X,$){let Z=["componentsDir","layoutsDir","partialsDir"];for(let Y of Z){let J=X[Y];if(typeof J!=="string"||!J)continue;let G=h0.isAbsolute(J)?J:h0.join($,J);if(E8.existsSync(G))continue;let Q=X.root,q=!!Q&&Q!==".";console.warn(`[stx] ${String(Y)} resolves to "${G}", which does not exist. Configured as "${J}"`+(q?`, resolved under root "${Q}".`:"."))}}function Cj(X){if(Q2(X.stateDir),X.stateDir=a5(),X.cachePath=e5(X.cachePath),X.build)X.build.cacheDir=e5(X.build.cacheDir);if(X.media?.cache)X.media.cache.directory=e5(X.media.cache.directory);if(X.story)X.story.outDir=e5(X.story.outDir)}async function I1(X){if(!X){if(b5)return b5;if(D8)return D8}let $=X?h0.resolve(X):process.cwd(),Z=_J.get($);if(Z)return Z;let Y=(async()=>{let G=(await Dj({name:"stx",alias:"ui",cwd:$,defaultConfig:e1,verbose:!1})).config;if(Cj(G),HJ(G,$),Sj(G,$),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (jJ(),zJ)),q=[],K=[];for(let U of G.plugins){let W=typeof U==="string"?U:U[0],w=typeof U==="string"?{}:U[1]||{};try{let z,B;try{z=await import(W),B=h0.dirname(W0.resolve(W))}catch{let _=h0.resolve(process.cwd(),W);z=await import(_),B=h0.dirname(_)}let j=z.default||z;if(Q.register(j,G),j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let H of _)q.push(h0.resolve(B,H))}if(j.pages){let _=h0.resolve(B,j.pages),H=w.path||"/";K.push({dir:_,prefix:H})}if(j.setup){let _={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,L)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=L},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:B,config:G};await j.setup(w,_)}console.log(`[stx] Plugin loaded: ${j.name||W}`)}catch(z){console.warn(`[stx] Failed to load plugin ${W}:`,z.message)}}G._pluginComponentDirs=q,G._pluginPageDirs=K}return G})();if(_J.set($,Y),!X)D8=Y,Y.then((J)=>{b5=J}).catch(()=>{});return Y}function Pj(X){return X}function vj(X){let $=[],Z=[];if(X.partialsDir!==void 0&&typeof X.partialsDir!=="string")$.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(X.componentsDir!==void 0&&typeof X.componentsDir!=="string")$.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(X.cache!==void 0&&typeof X.cache!=="boolean")$.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(X.debug!==void 0&&typeof X.debug!=="boolean")$.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(X.streaming){if(X.streaming.bufferSize!==void 0){if(typeof X.streaming.bufferSize!=="number"||X.streaming.bufferSize<=0)$.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(X.streaming.timeout!==void 0){if(typeof X.streaming.timeout!=="number"||X.streaming.timeout<=0)$.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(X.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes(X.streaming.strategy))$.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.i18n){if(X.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes(X.i18n.format))$.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.animation){if(X.animation.defaultDuration!==void 0){if(typeof X.animation.defaultDuration!=="number"||X.animation.defaultDuration<0)$.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(X.animation.staggerDelay!==void 0){if(typeof X.animation.staggerDelay!=="number"||X.animation.staggerDelay<0)$.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(X.a11y){if(X.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes(X.a11y.level))$.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.hydration){if(X.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes(X.hydration.mode))$.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes(X.hydration.preload))$.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.customDirectives)if(!Array.isArray(X.customDirectives))$.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else X.customDirectives.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(X.middleware)if(!Array.isArray(X.middleware))$.push({path:"middleware",message:"middleware must be an array",severity:"error"});else X.middleware.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))$.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(X.debug===!0&&X.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(X.seo?.enabled===!0&&!X.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(X.pwa){if(X.pwa.enabled===!0&&!X.pwa.manifest?.name)$.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(X.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes(X.pwa.manifest.display))$.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes(X.pwa.manifest.orientation))$.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];X.pwa.routes.forEach((J,G)=>{if(!J.pattern||typeof J.pattern!=="string")$.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(J.strategy))$.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))$.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))$.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(X.pwa.icons?.sizes){if(!Array.isArray(X.pwa.icons.sizes))$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(X.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(X.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if(X.pwa.icons.purpose.filter((G)=>!Y.includes(G)).length>0)$.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.enabled===!0&&!X.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(X.pwa.enabled===!0&&!X.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:$.length===0,errors:$,warnings:Z}}var e1,BJ,b5=null,_J,D8=null,B7;var V1=D(()=>{B$();_$();C$();P$();I9();IY();J3();Q3();z3();YX();wJ();e1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:j5,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:eZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:WJ,hasEndTag:!1,description:"Include a web component in the template"},U2,W2,KJ,UJ,w2,j2,B2,z2,g2,d2,kY,Y3,...G3],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};BJ=new Set;_J=new Map;B7=new Proxy(e1,{get(X,$){if(b5&&$ in b5)return b5[$];if(!D8)I1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return X[$]}})});import q0 from"path";import{hasLocalConfig as xj}from"bunfig";function b8(X){return Bun.hash(X).toString(16).padStart(16,"0").slice(0,16)}function _3(X,$){if(X5.has(X))X5.delete(X);else if(X5.size>=VJ)X5.delete(X5.keys().next().value);X5.set(X,$)}function fj(X){let $=b8(X);if(S5.has($))S5.delete($);else if(S5.size>=VJ)S5.delete(S5.keys().next().value);return S5.set($,X),$}async function gj(X){if(!y1)return null;try{let $=Bun.file(q0.join(y1,`cw-${b8(X)}.css`));if(!await $.exists())return null;return await $.text()}catch{return null}}async function hj(X,$){if(!y1)return;try{if(!fs.existsSync(y1))fs.mkdirSync(y1,{recursive:!0});await Bun.write(q0.join(y1,`cw-${b8(X)}.css`),$)}catch{}}async function FJ(X){try{let $=await import(X);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig,extractClasses:$.extractClasses}}catch{}return null}function uj(){let X=[],$=process.cwd();while($!==q0.dirname($))X.push(q0.join($,"node_modules","@cwcss","crosswind","dist","index.js")),X.push(q0.join($,"node_modules","@cwcss","crosswind","src","index.ts")),X.push(q0.join($,"pantry","@cwcss","crosswind","dist","index.js")),X.push(q0.join($,"pantry","@cwcss","crosswind","src","index.ts")),X.push(q0.join($,"node_modules","@stacksjs","crosswind","dist","index.js")),X.push(q0.join($,"pantry","@stacksjs","crosswind","dist","index.js")),$=q0.dirname($);return X}function dj(){let X=[],$=process.env.HOME||process.env.USERPROFILE||"";if($){let Z=[q0.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),q0.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),q0.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),q0.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),q0.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),q0.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];X.push(...Z)}return X.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),X.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),X}async function mj(){if(LJ)return z1;LJ=!0;try{let X=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await FJ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${V0.green}[Crosswind]${V0.reset} CSS engine loaded from ${q0.dirname(q0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=q0.resolve(process.env.CROSSWIND_SRC),G=await X([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return z1=G,z1}let $=await X(uj());if($)return z1=$,z1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await FJ(J);if(G){if(z1=G,!process.env.STACKS_DEV_QUIET)console.log(`${V0.green}[Crosswind]${V0.reset} CSS engine loaded`);return z1}}let Y=await X(dj());if(Y)return z1=Y,z1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${V0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${V0.reset}`),console.warn(`${V0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${V0.reset}`),null}}async function lj(X){try{if(!xj({name:"crosswind",cwd:X}))return null;let{loadConfigWithResult:$}=await import("bunfig"),Z=await $({name:"crosswind",cwd:X,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let Y=q0.relative(X,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${V0.green}[Crosswind]${V0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch($){if($ instanceof Error&&$.name==="ConfigNotFoundError")return null;return console.warn(`${V0.yellow}[Crosswind]${V0.reset} Failed to load crosswind config:`,$ instanceof Error?$.message:$),null}}function cj(X){let $=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec(X);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())$.add(Q.trim());Y=Z.exec(X)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.exec(X);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let q of Q)for(let K of q.slice(1,-1).split(/\s+/))if(K.trim())$.add(K.trim())}G=J.exec(X)}return $}async function pj(X,$){try{let Z=await mj();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses(X):cj(X);if(Y.size===0)return"";let J=$?q0.resolve($):process.cwd();if(!y1)y1=t5(J,"cache");let G=[...Y].sort().join(" "),Q=`${B3||"default"}::${G}`,q=X5.get(Q);if(q!==void 0)return _3(Q,q),q;let K=await gj(Q);if(K!==null)return _3(Q,K),K;if(!y8){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (V1(),OJ)),R=await A(J);if(R.css)if(typeof R.css==="string"){let T=q0.isAbsolute(R.css)?R.css:q0.resolve(J,R.css);if(await Bun.file(T).exists()){let N=await import(T);V=N.default||N,console.log(`${V0.green}[Crosswind]${V0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let T=q0.isAbsolute(R.css.config)?R.css.config:q0.resolve(J,R.css.config);if(await Bun.file(T).exists()){let N=await import(T);V={...N.default||N,...V}}}console.log(`${V0.green}[Crosswind]${V0.reset} Using inline CSS config from stx.config.ts`)}}catch{}y8=V||await lj(J);try{B3=b8(JSON.stringify(y8??{}))}catch{B3="unhashable"}}let U=Z.defaultConfig||Z.config,W=y8||{},w=J2(U,W),{safelist:z,includePreflight:B,minify:j}=w,_=w.config,H=new Z.CSSGenerator(_);for(let V of z)H.generate(V);for(let V of Y)H.generate(V);let L=H.toCSS(B,j),O=_.shortcuts||W.shortcuts||{};for(let[V,A]of Object.entries(O)){if(!Y.has(V)&&!z.includes(V))continue;let R=A.split(/\s+/).filter(Boolean);for(let T of R)H.generate(T)}L=H.toCSS(B,j);let F=L.split(`
12421
- `);for(let[V,A]of Object.entries(O)){if(!Y.has(V)&&!z.includes(V))continue;let R=A.split(/\s+/).filter(Boolean),T=[],N=[];for(let k of R){let M=k.startsWith("dark:"),C=`.${(M?k.slice(5):k).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let S=0;S<F.length;S++){let b=F[S].trim();if(b===`${C} {`||b.startsWith(`${C} {`)){let P=S,x="";while(P<F.length){if(x+=F[P],F[P].includes("}"))break;P++}let d=x.match(/\{([^}]+)\}/);if(d)if(M)N.push(d[1].trim());else T.push(d[1].trim());break}}}if(T.length)L+=`
12422
- .${V} { ${T.join(" ")} }`;if(N.length)L+=`
12423
- @media (prefers-color-scheme: dark) { .dark .${V} { ${N.join(" ")} } }`}return _3(Q,L),hj(Q,L),L}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function AJ(X,$,Z=!1){let Y=await pj(X,$);if(!Y)return X;let J=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${fj(Y)}.css">`:`<style data-crosswind="generated">
12491
+ `}async function AJ(X,$,Z,Y){if($.length<1)return X0("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",q=[v7.join(v7.dirname(Y),Q,`${J}.stx`),v7.join(process.cwd(),Q,`${J}.stx`),v7.join(v7.dirname(Y),`${J}.stx`)],K=null;for(let w of q)if(await p(w)){K=await Bun.file(w).text();break}if(!K)return X0("WebComponent",`Component file not found: ${J}.stx`,s.FILE_NOT_FOUND);let U=Sj(K,J);return`<script type="module">
12492
+ ${Cj(U)}
12493
+ </script>`}var RJ=E(()=>{w1();A0()});var NJ={};n(NJ,{timingPlugin:()=>gj,pluginManager:()=>Pj,definePlugin:()=>I8,debugPlugin:()=>fj,createVariablesPlugin:()=>hj,createFilterPlugin:()=>xj,createDirectivePlugin:()=>vj,PluginManager:()=>V3});function I8(X){return X}class V3{plugins=new Map;sortedPlugins=[];initialized=!1;async register(X,$){if(this.plugins.has(X.name))throw Error(`Plugin "${X.name}" is already registered`);if(X.dependencies){for(let Z of X.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${X.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set(X.name,X),X.onRegister)await X.onRegister($);this.sortPlugins()}async unregister(X){let $=this.plugins.get(X);if(!$)return!1;for(let[Z,Y]of this.plugins)if(Y.dependencies?.includes(X))throw Error(`Cannot unregister "${X}" because "${Z}" depends on it`);if($.onUnregister)await $.onUnregister();return this.plugins.delete(X),this.sortPlugins(),!0}get(X){return this.plugins.get(X)}has(X){return this.plugins.has(X)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let X=[];for(let $ of this.sortedPlugins)if($.registerDirectives)X.push(...$.registerDirectives());return X}getAllFilters(){let X={};for(let $ of this.sortedPlugins)if($.registerFilters)Object.assign(X,$.registerFilters());return X}async runBeforeProcess(X){return this.runHooks("beforeProcess",X)}async runAfterParse(X){return this.runHooks("afterParse",X)}async runBeforeDirective(X,$){return this.runDirectiveHooks("beforeDirective",X,$)}async runAfterDirective(X,$){return this.runDirectiveHooks("afterDirective",X,$)}async runBeforeRender(X){return this.runHooks("beforeRender",X)}async runAfterRender(X){return this.runHooks("afterRender",X)}async runOnError(X){for(let $ of this.sortedPlugins)if($.onError)try{let Z=await $.onError(X);if(Z){if(Z.template!==void 0)X.template=Z.template;if(Z.context)X.context={...X.context,...Z.context};if(Z.metadata)X.metadata={...X.metadata,...Z.metadata};if(Z.skip)return X}}catch(Z){console.error(`Error in plugin "${$.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((X,$)=>(X.priority??100)-($.priority??100))}async runHooks(X,$){let Z={...$};for(let Y of this.sortedPlugins){let J=Y[X];if(J)try{let G=await J(Z);if(G){if(G.template!==void 0)Z.template=G.template;if(G.context)Z.context={...Z.context,...G.context};if(G.metadata)Z.metadata={...Z.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Y.name}" ${X} hook:`,G)}}return Z}async runDirectiveHooks(X,$,Z){let Y={...Z};for(let J of this.sortedPlugins){let G=J[X];if(G)try{let Q=await G($,Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${X} hook:`,Q)}}return Y}}function vj(X,$,Z={}){return{name:X,...Z,registerDirectives:()=>$}}function xj(X,$,Z={}){return{name:X,...Z,registerFilters:()=>$}}function hj(X){return I8({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess($){return{context:{...$.context,...X}}}})}var Pj,fj,gj;var TJ=E(()=>{Pj=new V3;fj=I8({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(X){console.log("[stx-debug] beforeProcess:",X.filePath)},afterParse(X){console.log("[stx-debug] afterParse:",X.template.length,"chars")},beforeDirective(X,$){console.log("[stx-debug] beforeDirective:",X)},afterDirective(X,$){console.log("[stx-debug] afterDirective:",X)},beforeRender(X){console.log("[stx-debug] beforeRender")},afterRender(X){console.log("[stx-debug] afterRender:",X.template.length,"chars")},onError(X){console.error("[stx-debug] onError:",X.error.message,"in phase:",X.phase)}}),gj=I8({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(X){X.metadata.startTime=performance.now()},afterRender(X){let $=X.metadata.startTime;if($){let Z=performance.now()-$;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var EJ={};n(EJ,{validateConfig:()=>ij,resolveStxDirectories:()=>IJ,loadStxConfig:()=>I1,defineStxConfig:()=>pj,defaultConfig:()=>X5,config:()=>_7});import E8 from"fs";import g0 from"path";import{loadConfigWithResult as uj}from"bunfig";function dj(X,$,Z){let Y=$||"pages";if(X)return{root:X,pagesDir:Y};let J=Z||process.cwd(),G=g0.join(J,"resources","views"),Q=g0.join(J,"resources","layouts");if(E8.existsSync(G)&&E8.existsSync(Q))return{root:"resources",pagesDir:"views"};let q=g0.join(J,"resources","views","pages");if(E8.existsSync(q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function mj(X,$){let Z=$.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let Y=X.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/");return Y===J||Y.startsWith(`${J}/`)}function IJ(X,$){let Z=!X.root,Y=dj(X.root,X.pagesDir,$);if(X.root=Y.root,X.pagesDir=Y.pagesDir,Z&&Y.root!=="."){let J=`${$}::${Y.root}`;if(!MJ.has(J))MJ.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(X.root&&X.root!=="."){let J=X.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=X[G];if(typeof Q!=="string"||!Q)continue;if(g0.isAbsolute(Q)||mj(Q,J))continue;X[G]=g0.join(J,Q)}}return X}function lj(X,$){let Z=["componentsDir","layoutsDir","partialsDir"];for(let Y of Z){let J=X[Y];if(typeof J!=="string"||!J)continue;let G=g0.isAbsolute(J)?J:g0.join($,J);if(E8.existsSync(G))continue;let Q=X.root,q=!!Q&&Q!==".";console.warn(`[stx] ${String(Y)} resolves to "${G}", which does not exist. Configured as "${J}"`+(q?`, resolved under root "${Q}".`:"."))}}function cj(X){if(j2(X.stateDir),X.stateDir=t5(),X.cachePath=X7(X.cachePath),X.build)X.build.cacheDir=X7(X.build.cacheDir);if(X.media?.cache)X.media.cache.directory=X7(X.media.cache.directory);if(X.story)X.story.outDir=X7(X.story.outDir)}async function I1(X){if(!X){if(S5)return S5;if(D8)return D8}let $=X?g0.resolve(X):process.cwd(),Z=kJ.get($);if(Z)return Z;let Y=(async()=>{let G=(await uj({name:"stx",alias:"ui",cwd:$,defaultConfig:X5,verbose:!1})).config;if(cj(G),IJ(G,$),lj(G,$),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (TJ(),NJ)),q=[],K=[];for(let U of G.plugins){let W=typeof U==="string"?U:U[0],w=typeof U==="string"?{}:U[1]||{};try{let z,B;try{z=await import(W),B=g0.dirname(W0.resolve(W))}catch{let _=g0.resolve(process.cwd(),W);z=await import(_),B=g0.dirname(_)}let j=z.default||z;if(Q.register(j,G),j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let H of _)q.push(g0.resolve(B,H))}if(j.pages){let _=g0.resolve(B,j.pages),H=w.path||"/";K.push({dir:_,prefix:H})}if(j.setup){let _={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,L)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=L},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:B,config:G};await j.setup(w,_)}console.log(`[stx] Plugin loaded: ${j.name||W}`)}catch(z){console.warn(`[stx] Failed to load plugin ${W}:`,z.message)}}G._pluginComponentDirs=q,G._pluginPageDirs=K}return G})();if(kJ.set($,Y),!X)D8=Y,Y.then((J)=>{S5=J}).catch(()=>{});return Y}function pj(X){return X}function ij(X){let $=[],Z=[];if(X.partialsDir!==void 0&&typeof X.partialsDir!=="string")$.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(X.componentsDir!==void 0&&typeof X.componentsDir!=="string")$.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(X.cache!==void 0&&typeof X.cache!=="boolean")$.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(X.debug!==void 0&&typeof X.debug!=="boolean")$.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(X.streaming){if(X.streaming.bufferSize!==void 0){if(typeof X.streaming.bufferSize!=="number"||X.streaming.bufferSize<=0)$.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(X.streaming.timeout!==void 0){if(typeof X.streaming.timeout!=="number"||X.streaming.timeout<=0)$.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(X.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes(X.streaming.strategy))$.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.i18n){if(X.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes(X.i18n.format))$.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.animation){if(X.animation.defaultDuration!==void 0){if(typeof X.animation.defaultDuration!=="number"||X.animation.defaultDuration<0)$.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(X.animation.staggerDelay!==void 0){if(typeof X.animation.staggerDelay!=="number"||X.animation.staggerDelay<0)$.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(X.a11y){if(X.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes(X.a11y.level))$.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.hydration){if(X.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes(X.hydration.mode))$.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes(X.hydration.preload))$.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.customDirectives)if(!Array.isArray(X.customDirectives))$.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else X.customDirectives.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(X.middleware)if(!Array.isArray(X.middleware))$.push({path:"middleware",message:"middleware must be an array",severity:"error"});else X.middleware.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))$.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(X.debug===!0&&X.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(X.seo?.enabled===!0&&!X.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(X.pwa){if(X.pwa.enabled===!0&&!X.pwa.manifest?.name)$.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(X.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes(X.pwa.manifest.display))$.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes(X.pwa.manifest.orientation))$.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];X.pwa.routes.forEach((J,G)=>{if(!J.pattern||typeof J.pattern!=="string")$.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(J.strategy))$.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))$.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))$.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(X.pwa.icons?.sizes){if(!Array.isArray(X.pwa.icons.sizes))$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(X.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(X.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if(X.pwa.icons.purpose.filter((G)=>!Y.includes(G)).length>0)$.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.enabled===!0&&!X.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(X.pwa.enabled===!0&&!X.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:$.length===0,errors:$,warnings:Z}}var X5,MJ,S5=null,kJ,D8=null,_7;var V1=E(()=>{B$();_$();C$();P$();P9();gY();w3();j3();F3();JX();RJ();X5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:B5,cachePath:".stx/cache",cacheVersion:"1.0.0",build:{pagesDir:"pages",outputDir:"dist",baseUrl:"/",sitemap:!0,minify:!0,cache:!0,cacheDir:".stx/ssg-cache",concurrency:10,generate404:!0,publicDir:"public",trailingSlash:!1,cleanOutput:!0},customDirectives:[{name:"markdown",handler:WY,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:AJ,hasEndTag:!1,description:"Include a web component in the template"},H2,O2,FJ,VJ,L2,V2,A2,F2,p2,r2,fY,W3,...z3],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};MJ=new Set;kJ=new Map;_7=new Proxy(X5,{get(X,$){if(S5&&$ in S5)return S5[$];if(!D8)I1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return X[$]}})});import q0 from"path";import{hasLocalConfig as nj}from"bunfig";function b8(X){return Bun.hash(X).toString(16).padStart(16,"0").slice(0,16)}function R3(X,$){if($5.has(X))$5.delete(X);else if($5.size>=bJ)$5.delete($5.keys().next().value);$5.set(X,$)}function rj(X){let $=b8(X);if(C5.has($))C5.delete($);else if(C5.size>=bJ)C5.delete(C5.keys().next().value);return C5.set($,X),$}async function oj(X){if(!y1)return null;try{let $=Bun.file(q0.join(y1,`cw-${b8(X)}.css`));if(!await $.exists())return null;return await $.text()}catch{return null}}async function sj(X,$){if(!y1)return;try{if(!fs.existsSync(y1))fs.mkdirSync(y1,{recursive:!0});await Bun.write(q0.join(y1,`cw-${b8(X)}.css`),$)}catch{}}async function yJ(X){try{let $=await import(X);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig,extractClasses:$.extractClasses}}catch{}return null}function aj(){let X=[],$=process.cwd();while($!==q0.dirname($))X.push(q0.join($,"node_modules","@cwcss","crosswind","dist","index.js")),X.push(q0.join($,"node_modules","@cwcss","crosswind","src","index.ts")),X.push(q0.join($,"pantry","@cwcss","crosswind","dist","index.js")),X.push(q0.join($,"pantry","@cwcss","crosswind","src","index.ts")),X.push(q0.join($,"node_modules","@stacksjs","crosswind","dist","index.js")),X.push(q0.join($,"pantry","@stacksjs","crosswind","dist","index.js")),$=q0.dirname($);return X}function tj(){let X=[],$=process.env.HOME||process.env.USERPROFILE||"";if($){let Z=[q0.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),q0.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),q0.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),q0.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),q0.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),q0.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];X.push(...Z)}return X.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),X.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),X}async function ej(){if(DJ)return z1;DJ=!0;try{let X=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await yJ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${V0.green}[Crosswind]${V0.reset} CSS engine loaded from ${q0.dirname(q0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=q0.resolve(process.env.CROSSWIND_SRC),G=await X([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return z1=G,z1}let $=await X(aj());if($)return z1=$,z1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await yJ(J);if(G){if(z1=G,!process.env.STACKS_DEV_QUIET)console.log(`${V0.green}[Crosswind]${V0.reset} CSS engine loaded`);return z1}}let Y=await X(tj());if(Y)return z1=Y,z1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${V0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${V0.reset}`),console.warn(`${V0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${V0.reset}`),null}}async function XB(X){try{if(!nj({name:"crosswind",cwd:X}))return null;let{loadConfigWithResult:$}=await import("bunfig"),Z=await $({name:"crosswind",cwd:X,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let Y=q0.relative(X,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${V0.green}[Crosswind]${V0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch($){if($ instanceof Error&&$.name==="ConfigNotFoundError")return null;return console.warn(`${V0.yellow}[Crosswind]${V0.reset} Failed to load crosswind config:`,$ instanceof Error?$.message:$),null}}function $B(X){let $=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec(X);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())$.add(Q.trim());Y=Z.exec(X)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.exec(X);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let q of Q)for(let K of q.slice(1,-1).split(/\s+/))if(K.trim())$.add(K.trim())}G=J.exec(X)}return $}async function ZB(X,$){try{let Z=await ej();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses(X):$B(X);if(Y.size===0)return"";let J=$?q0.resolve($):process.cwd();if(!y1)y1=e5(J,"cache");let G=[...Y].sort().join(" "),Q=`${A3||"default"}::${G}`,q=$5.get(Q);if(q!==void 0)return R3(Q,q),q;let K=await oj(Q);if(K!==null)return R3(Q,K),K;if(!y8){let V=null;try{let{loadStxConfig:A}=await Promise.resolve().then(() => (V1(),EJ)),R=await A(J);if(R.css)if(typeof R.css==="string"){let N=q0.isAbsolute(R.css)?R.css:q0.resolve(J,R.css);if(await Bun.file(N).exists()){let T=await import(N);V=T.default||T,console.log(`${V0.green}[Crosswind]${V0.reset} Loaded config from stx.config.ts \u2192 ${R.css}`)}}else{if(V={...R.css,content:R.css.content||[],preflight:R.css.preflight??!0,minify:R.css.minify??!1},R.css.config){let N=q0.isAbsolute(R.css.config)?R.css.config:q0.resolve(J,R.css.config);if(await Bun.file(N).exists()){let T=await import(N);V={...T.default||T,...V}}}console.log(`${V0.green}[Crosswind]${V0.reset} Using inline CSS config from stx.config.ts`)}}catch{}y8=V||await XB(J);try{A3=b8(JSON.stringify(y8??{}))}catch{A3="unhashable"}}let U=Z.defaultConfig||Z.config,W=y8||{},w=w2(U,W),{safelist:z,includePreflight:B,minify:j}=w,_=w.config,H=new Z.CSSGenerator(_);for(let V of z)H.generate(V);for(let V of Y)H.generate(V);let L=H.toCSS(B,j),O=_.shortcuts||W.shortcuts||{};for(let[V,A]of Object.entries(O)){if(!Y.has(V)&&!z.includes(V))continue;let R=A.split(/\s+/).filter(Boolean);for(let N of R)H.generate(N)}L=H.toCSS(B,j);let F=L.split(`
12494
+ `);for(let[V,A]of Object.entries(O)){if(!Y.has(V)&&!z.includes(V))continue;let R=A.split(/\s+/).filter(Boolean),N=[],T=[];for(let k of R){let M=k.startsWith("dark:"),C=`.${(M?k.slice(5):k).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let S=0;S<F.length;S++){let b=F[S].trim();if(b===`${C} {`||b.startsWith(`${C} {`)){let P=S,x="";while(P<F.length){if(x+=F[P],F[P].includes("}"))break;P++}let d=x.match(/\{([^}]+)\}/);if(d)if(M)T.push(d[1].trim());else N.push(d[1].trim());break}}}if(N.length)L+=`
12495
+ .${V} { ${N.join(" ")} }`;if(T.length)L+=`
12496
+ @media (prefers-color-scheme: dark) { .dark .${V} { ${T.join(" ")} } }`}return R3(Q,L),sj(Q,L),L}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function SJ(X,$,Z=!1){let Y=await ZB(X,$);if(!Y)return X;let J=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${rj(Y)}.css">`:`<style data-crosswind="generated">
12424
12497
  ${Y}
12425
12498
  </style>`,G=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(G.test(X)){let Q=!1;return X.replace(G,()=>{if(Q)return"";return Q=!0,J})}if(X.includes("</head>"))return X.replace("</head>",`${J}
12426
12499
  </head>`);if(X.includes("<body"))return X.replace(/<body([^>]*)>/,`<body$1>
12427
- ${J}`);return J+X}var z1=null,LJ=!1,y8=null,VJ=256,X5,S5,y1=null,B3=null;var RJ=D(()=>{YX();q2();X5=new Map,S5=new Map});function TJ(){return`
12500
+ ${J}`);return J+X}var z1=null,DJ=!1,y8=null,bJ=256,$5,C5,y1=null,A3=null;var CJ=E(()=>{JX();B2();$5=new Map,C5=new Map});function PJ(){return`
12428
12501
  // STX Lifecycle Runtime
12429
12502
  (function() {
12430
12503
  if (typeof window === 'undefined') return;
@@ -12769,7 +12842,7 @@ else {
12769
12842
 
12770
12843
  console.log('[stx] Lifecycle runtime initialized');
12771
12844
  })();
12772
- `}function H3(X){return Symbol(X)}var VN,AN,RN;var NJ=D(()=>{VN=H3("theme"),AN=H3("router"),RN=H3("i18n")});import*as kJ from"crypto";function MJ(X){let $=/\$(\w+)\./g,Z=[],Y;while((Y=$.exec(X))!==null)if(!Z.includes(Y[1]))Z.push(Y[1]);return Z}function ij(){return`stx-${kJ.randomBytes(4).toString("hex")}`}function nj(X){return/\$\w+\./.test(X)}function rj(X){let $=[],Z=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,J=X;return J=J.replace(Y,(G,Q,q,K)=>{if(["script","style","template"].includes(Q.toLowerCase()))return G;let U=[],W=!1,w=q,z=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...q.matchAll(z)];for(let H of B){let L=H[0],O=H[1],F=H[2];if(nj(F)){W=!0;let V=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let A=V[1];if(U.push({attr:O,expr:A,fullMatch:L,originalAttr:O}),MJ(A).forEach((T)=>Z.add(T)),O==="text")w=w.replace(L,"");else if(O==="class")w=w.replace(L,'class=""');else if(O==="disabled"||O==="hidden")w=w.replace(L,"");else w=w.replace(L,`${O}=""`)}}}if(!W)return G;let j=w.match(/\bid\s*=\s*"([^"]+)"/),_;if(j)_=j[1];else _=ij(),w=` id="${_}"${w}`;for(let H of U)$.push({elementId:_,attribute:H.attr,expression:H.expr,stores:MJ(H.expr)});return`<${Q}${w}${K}`}),{html:J,bindings:$,stores:Z}}function oj(X,$){if(X.length===0)return"";let Z=Array.from($),Y=`
12845
+ `}function N3(X){return Symbol(X)}var gT,hT,uT;var vJ=E(()=>{gT=N3("theme"),hT=N3("router"),uT=N3("i18n")});import*as fJ from"crypto";function xJ(X){let $=/\$(\w+)\./g,Z=[],Y;while((Y=$.exec(X))!==null)if(!Z.includes(Y[1]))Z.push(Y[1]);return Z}function YB(){return`stx-${fJ.randomBytes(4).toString("hex")}`}function JB(X){return/\$\w+\./.test(X)}function GB(X){let $=[],Z=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,J=X;return J=J.replace(Y,(G,Q,q,K)=>{if(["script","style","template"].includes(Q.toLowerCase()))return G;let U=[],W=!1,w=q,z=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...q.matchAll(z)];for(let H of B){let L=H[0],O=H[1],F=H[2];if(JB(F)){W=!0;let V=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let A=V[1];if(U.push({attr:O,expr:A,fullMatch:L,originalAttr:O}),xJ(A).forEach((N)=>Z.add(N)),O==="text")w=w.replace(L,"");else if(O==="class")w=w.replace(L,'class=""');else if(O==="disabled"||O==="hidden")w=w.replace(L,"");else w=w.replace(L,`${O}=""`)}}}if(!W)return G;let j=w.match(/\bid\s*=\s*"([^"]+)"/),_;if(j)_=j[1];else _=YB(),w=` id="${_}"${w}`;for(let H of U)$.push({elementId:_,attribute:H.attr,expression:H.expr,stores:xJ(H.expr)});return`<${Q}${w}${K}`}),{html:J,bindings:$,stores:Z}}function QB(X,$){if(X.length===0)return"";let Z=Array.from($),Y=`
12773
12846
  <script>
12774
12847
  (function() {
12775
12848
  'use strict';
@@ -12927,10 +13000,10 @@ else {
12927
13000
  }
12928
13001
  })();
12929
13002
  </script>
12930
- `,Y}function IJ(X){let{html:$,bindings:Z,stores:Y}=rj(X);if(Z.length===0)return X;let J=oj(Z,Y),G=$.lastIndexOf("</body>");if(G!==-1)return $.slice(0,G)+J+$.slice(G);return $+J}var EJ=()=>{};function sj(X){let $=X.analytics;if(!$?.enabled)return"";switch($.driver){case"fathom":return aj($);case"google-analytics":return tj($);case"plausible":return ej($);case"self-hosted":return XB($);case"custom":return $B($);default:return""}}function aj(X){let $=X.fathom;if(!$?.siteId)return"";let Z=$.scriptUrl||"https://cdn.usefathom.com/script.js",Y=$.defer!==!1?" defer":"",J=[`data-site="${u0($.siteId)}"`];if($.honorDnt)J.push('data-honor-dnt="true"');if($.spa)J.push('data-spa="auto"');if($.canonical)J.push(`data-canonical="${u0($.canonical)}"`);if($.auto===!1)J.push('data-auto="false"');return`
13003
+ `,Y}function gJ(X){let{html:$,bindings:Z,stores:Y}=GB(X);if(Z.length===0)return X;let J=QB(Z,Y),G=$.lastIndexOf("</body>");if(G!==-1)return $.slice(0,G)+J+$.slice(G);return $+J}var hJ=()=>{};function qB(X){let $=X.analytics;if(!$?.enabled)return"";switch($.driver){case"fathom":return KB($);case"google-analytics":return UB($);case"plausible":return WB($);case"self-hosted":return wB($);case"custom":return zB($);default:return""}}function KB(X){let $=X.fathom;if(!$?.siteId)return"";let Z=$.scriptUrl||"https://cdn.usefathom.com/script.js",Y=$.defer!==!1?" defer":"",J=[`data-site="${h0($.siteId)}"`];if($.honorDnt)J.push('data-honor-dnt="true"');if($.spa)J.push('data-spa="auto"');if($.canonical)J.push(`data-canonical="${h0($.canonical)}"`);if($.auto===!1)J.push('data-auto="false"');return`
12931
13004
  <!-- Fathom Analytics -->
12932
- <script src="${u0(Z)}" ${J.join(" ")}${Y}></script>
12933
- `}function tj(X){let $=X.googleAnalytics;if(!$?.measurementId)return"";let Z=u0($.measurementId),Y=$.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
13005
+ <script src="${h0(Z)}" ${J.join(" ")}${Y}></script>
13006
+ `}function UB(X){let $=X.googleAnalytics;if(!$?.measurementId)return"";let Z=h0($.measurementId),Y=$.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
12934
13007
  <!-- Google Analytics -->
12935
13008
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Z}"></script>
12936
13009
  <script>
@@ -12940,10 +13013,10 @@ else {
12940
13013
  gtag('config', '${Z}');
12941
13014
  ${Y}
12942
13015
  </script>
12943
- `}function ej(X){let $=X.plausible;if(!$?.domain)return"";let Z=$.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${u0($.domain)}"`],J=Z,G=[];if($.trackLocalhost)G.push("local");if($.hashMode)G.push("hash");if(G.length>0&&Z==="https://plausible.io/js/script.js")J=`https://plausible.io/js/script.${G.join(".")}.js`;return`
13016
+ `}function WB(X){let $=X.plausible;if(!$?.domain)return"";let Z=$.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${h0($.domain)}"`],J=Z,G=[];if($.trackLocalhost)G.push("local");if($.hashMode)G.push("hash");if(G.length>0&&Z==="https://plausible.io/js/script.js")J=`https://plausible.io/js/script.${G.join(".")}.js`;return`
12944
13017
  <!-- Plausible Analytics -->
12945
- <script defer data-domain="${u0($.domain)}" src="${u0(J)}"></script>
12946
- `}function XB(X){let $=X.selfHosted;if(!$?.siteId||!$?.apiEndpoint)return"";let Z=u0($.siteId),Y=u0($.apiEndpoint),J=$.honorDnt?'if(n.doNotTrack==="1")return;':"",G=$.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=$.trackOutboundLinks?`
13018
+ <script defer data-domain="${h0($.domain)}" src="${h0(J)}"></script>
13019
+ `}function wB(X){let $=X.selfHosted;if(!$?.siteId||!$?.apiEndpoint)return"";let Z=h0($.siteId),Y=h0($.apiEndpoint),J=$.honorDnt?'if(n.doNotTrack==="1")return;':"",G=$.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=$.trackOutboundLinks?`
12947
13020
  d.addEventListener('click',function(e){
12948
13021
  var a=e.target.closest('a');
12949
13022
  if(a&&a.hostname!==location.hostname){
@@ -12976,15 +13049,15 @@ else {
12976
13049
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
12977
13050
  })();
12978
13051
  </script>
12979
- `}function $B(X){let $=X.custom;if(!$)return"";if($.inlineScript)return`
13052
+ `}function zB(X){let $=X.custom;if(!$)return"";if($.inlineScript)return`
12980
13053
  <!-- Custom Analytics -->
12981
13054
  <script>
12982
13055
  ${$.inlineScript}
12983
13056
  </script>
12984
- `;if(!$.scriptUrl)return"";let Z=[];if($.scriptId)Z.push(`id="${u0($.scriptId)}"`);if($.attributes)for(let[J,G]of Object.entries($.attributes))Z.push(`${u0(J)}="${u0(G)}"`);return`
13057
+ `;if(!$.scriptUrl)return"";let Z=[];if($.scriptId)Z.push(`id="${h0($.scriptId)}"`);if($.attributes)for(let[J,G]of Object.entries($.attributes))Z.push(`${h0(J)}="${h0(G)}"`);return`
12985
13058
  <!-- Custom Analytics -->
12986
- <script${Z.length>0?` ${Z.join(" ")}`:""} src="${u0($.scriptUrl)}" defer></script>
12987
- `}function DJ(X,$){let Z=sj($);if(!Z)return X;if(!X.includes("</head>")){let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}return X.replace("</head>",`${Z}</head>`)}function u0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var yJ=()=>{};function bJ(X){let $=X.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!$)return null;try{return Function(`return ${$[1]}`)()}catch{return null}}function SJ(X){let $=X?.layout;if($===!1)return!1;return typeof $==="string"&&$.trim()?$.trim():void 0}function CJ(X,$){let Z=X.match(new RegExp(`${$}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let Y=X.match(new RegExp(`${$}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function YB(X){let $=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=Z.exec(X))!==null){let[J,G,Q]=Y,q=Y.index,K=CJ(Q,"x-data");if(!K)continue;let U=`__stx_scope_${vJ++}`,W=CJ(Q,"x-init"),w=JB(X,G,q+J.length),z=X.slice(q,w.endIndex),B=GB(z);$.push({id:U,selector:`[data-stx-scope="${U}"]`,stateExpr:K,initExpr:W,bindings:[],refs:B})}return $}function JB(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s|>)`,"gi"),Q=new RegExp(`</${$}>`,"gi"),q=new RegExp(`<${$}[^>]*/\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J,q.lastIndex=J;let K=G.exec(X),U=Q.exec(X),W=q.exec(X);if(W&&W.index<(K?.index??1/0)){J=W.index+W[0].length;continue}if(!U)return{endIndex:X.length};if(K&&K.index<U.index)Y++,J=K.index+K[0].length;else{if(Y--,Y===0)return{endIndex:U.index+U[0].length};J=U.index+U[0].length}}return{endIndex:X.length}}function GB(X){let $=new Map,Z=X.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[,G,Q]=J,q=QB(G);$.set(Q,q)}return $}function QB(X){let $=X.match(/\bid\s*=\s*["']([^"']*)["']/);if($)return $[1];return`__stx_el_${ZB++}`}function qB(){return`
13059
+ <script${Z.length>0?` ${Z.join(" ")}`:""} src="${h0($.scriptUrl)}" defer></script>
13060
+ `}function uJ(X,$){let Z=qB($);if(!Z)return X;if(!X.includes("</head>")){let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}return X.replace("</head>",`${Z}</head>`)}function h0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var dJ=()=>{};function mJ(X){let $=X.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!$)return null;try{return Function(`return ${$[1]}`)()}catch{return null}}function lJ(X){let $=X?.layout;if($===!1)return!1;return typeof $==="string"&&$.trim()?$.trim():void 0}function cJ(X,$){let Z=X.match(new RegExp(`${$}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let Y=X.match(new RegExp(`${$}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function BB(X){let $=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=Z.exec(X))!==null){let[J,G,Q]=Y,q=Y.index,K=cJ(Q,"x-data");if(!K)continue;let U=`__stx_scope_${iJ++}`,W=cJ(Q,"x-init"),w=_B(X,G,q+J.length),z=X.slice(q,w.endIndex),B=HB(z);$.push({id:U,selector:`[data-stx-scope="${U}"]`,stateExpr:K,initExpr:W,bindings:[],refs:B})}return $}function _B(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s|>)`,"gi"),Q=new RegExp(`</${$}>`,"gi"),q=new RegExp(`<${$}[^>]*/\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J,q.lastIndex=J;let K=G.exec(X),U=Q.exec(X),W=q.exec(X);if(W&&W.index<(K?.index??1/0)){J=W.index+W[0].length;continue}if(!U)return{endIndex:X.length};if(K&&K.index<U.index)Y++,J=K.index+K[0].length;else{if(Y--,Y===0)return{endIndex:U.index+U[0].length};J=U.index+U[0].length}}return{endIndex:X.length}}function HB(X){let $=new Map,Z=X.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[,G,Q]=J,q=OB(G);$.set(Q,q)}return $}function OB(X){let $=X.match(/\bid\s*=\s*["']([^"']*)["']/);if($)return $[1];return`__stx_el_${jB++}`}function LB(){return`
12988
13061
  // STX Reactive Runtime - x-cloak and transition CSS
12989
13062
  (function() {
12990
13063
  var style = document.createElement('style');
@@ -13191,7 +13264,7 @@ window.__stx_reactive = (function() {
13191
13264
 
13192
13265
  return { initScope: initScope, reactive: reactive };
13193
13266
  })();
13194
- `}function PJ(X,$){let Z=X.replace(/\{!!([\s\S]*?)!!\}/g,(q,K)=>{try{let U=P0(K,$,!0);if(U===void 0)return q;return String(U)}catch{return q}}),Y="",J=0,G=null;while(J<Z.length){let q=Z[J];if(G&&q==="\\"){Y+=q+(Z[J+1]??""),J+=2;continue}if(q==="{"&&Z[J+1]==="{"){let K=Z.indexOf("}}",J+2);if(K!==-1){let U=Z.slice(J,K+2);Y+=Q(Z.slice(J+2,K),U,G),J=K+2;continue}}if(G){if(q===G)G=null}else if(q==="'"||q==='"'||q==="`")G=q;Y+=q,J++}return Y;function Q(q,K,U){let W;try{W=P0(q,$,!0)}catch{return K}if(W===void 0)return K;if(U){let w=String(W).replace(/\\/g,"\\\\").replace(new RegExp(U==="`"?"`":U,"g"),`\\${U}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return U==="`"?w.replace(/\$\{/g,"\\${"):w}if(typeof W==="string"){let w=W.trim();if(w.startsWith("{")&&w.endsWith("}")||w.startsWith("[")&&w.endsWith("]"))try{return JSON.parse(w),w}catch{}}return JSON.stringify(W)}}function KB(X,$){if(X.length===0)return"";let Z=X.map((Y)=>{let J=JSON.stringify(Object.fromEntries(Y.refs)),G=PJ(Y.stateExpr,$),Q=Y.initExpr?PJ(Y.initExpr,$):null,q=JSON.stringify(G),K=Q?JSON.stringify(Q):"null";return`
13267
+ `}function pJ(X,$){let Z=X.replace(/\{!!([\s\S]*?)!!\}/g,(q,K)=>{try{let U=P0(K,$,!0);if(U===void 0)return q;return String(U)}catch{return q}}),Y="",J=0,G=null;while(J<Z.length){let q=Z[J];if(G&&q==="\\"){Y+=q+(Z[J+1]??""),J+=2;continue}if(q==="{"&&Z[J+1]==="{"){let K=Z.indexOf("}}",J+2);if(K!==-1){let U=Z.slice(J,K+2);Y+=Q(Z.slice(J+2,K),U,G),J=K+2;continue}}if(G){if(q===G)G=null}else if(q==="'"||q==='"'||q==="`")G=q;Y+=q,J++}return Y;function Q(q,K,U){let W;try{W=P0(q,$,!0)}catch{return K}if(W===void 0)return K;if(U){let w=String(W).replace(/\\/g,"\\\\").replace(new RegExp(U==="`"?"`":U,"g"),`\\${U}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return U==="`"?w.replace(/\$\{/g,"\\${"):w}if(typeof W==="string"){let w=W.trim();if(w.startsWith("{")&&w.endsWith("}")||w.startsWith("[")&&w.endsWith("]"))try{return JSON.parse(w),w}catch{}}return JSON.stringify(W)}}function FB(X,$){if(X.length===0)return"";let Z=X.map((Y)=>{let J=JSON.stringify(Object.fromEntries(Y.refs)),G=pJ(Y.stateExpr,$),Q=Y.initExpr?pJ(Y.initExpr,$):null,q=JSON.stringify(G),K=Q?JSON.stringify(Q):"null";return`
13195
13268
  (function() {
13196
13269
  var scopeEl = document.querySelector('${Y.selector}');
13197
13270
  if (!scopeEl) return;
@@ -13200,14 +13273,14 @@ window.__stx_reactive = (function() {
13200
13273
  })();`}).join(`
13201
13274
  `);return`
13202
13275
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
13203
- ${qB()}
13276
+ ${LB()}
13204
13277
  ${Z}
13205
- </script>`}function xJ(X,$,Z){if(vJ=0,!WB(X))return X;let Y=YB(X);if(Y.length===0)return X;let J=UB(X,Y),G=KB(Y,$),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
13206
- `+J.slice(Q);else J+=G;return J}function UB(X,$){let Z=0,Y=X.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,G,Q)=>{let q=$[Z++];if(!q)return J;let K=/data-stx-scope="([^"]*)"/.exec(Q);if(K)return q.id=K[1],q.selector=`[data-stx-scope="${q.id}"]`,J;return`<${G} data-stx-scope="${q.id}"${Q}>`});return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function WB(X){return/x-data\s*=\s*["']/.test(X)}var vJ=0,ZB=0;var fJ=D(()=>{Z1()});import wB from"fs";import O3 from"path";import{createHighlighter as zB}from"ts-syntax-highlighter";async function jB(X,$={}){try{if(!await p(X))throw Error(`Markdown file not found: ${X}`);let Y=(await wB.promises.stat(X)).mtime.getTime();if($.cache&&L3.has(X)){let w=L3.get(X);if(w.updatedAt>=Y)return{content:w.content,data:w.data}}let J=await Bun.file(X).text(),{data:G,content:Q}=l2(J),q=$.markdown||B7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=W7(Q,{gfm:!0});if(q.syntaxHighlighting?.enabled&&q.syntaxHighlighting?.serverSide)U=await BB(U,q.syntaxHighlighting?.defaultTheme||"github-dark",q.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:U,data:G||{}};if($.cache)L3.set(X,{...W,updatedAt:Y});return W}catch(Z){if($.debug)console.error(`Error reading/parsing markdown file ${X}:`,Z);let Y=Z instanceof Error?Z.message:String(Z);return{content:U0("Markdown File",`Error reading/parsing markdown file: ${Y}`,X,"",0,""),data:{}}}}async function BB(X,$,Z){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!S8)try{S8=await zB({theme:$||"github-dark",cache:!0})}catch(q){return console.error("Failed to initialize ts-syntax-highlighter:",q),X}let J=async(q,K,U,W)=>{let w=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),z=U||(Z?"text":"");if(!z)return q;try{if(!S8.getSupportedLanguages().includes(z))return q;return(await S8.highlight(w,z,{theme:$})).html}catch(B){console.error(`Error highlighting code block with language ${U}:`,B)}return q},G=X,Q=X.matchAll(Y);for(let q of Q){let[K,U,W,w]=q,z=await J(K,U,W,w);G=G.replace(K,z)}return G}async function gJ(X,$,Z="",Y={}){return await _B(X,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,q,K,U)=>{try{let W=q;if(!O3.isAbsolute(q))W=O3.resolve(O3.dirname(Z),q);let w={};if(K)try{try{w=JSON.parse(K)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let O=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),T=R.startsWith('"')&&R.endsWith('"'),N=R.startsWith("'")&&R.endsWith("'");if(T||N)R=R.substring(1,R.length-1);w[A]=R}}}}catch(L){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:z,data:B}=await jB(W,Y),j={...$,...B,...w},_=z,H=/\{\{([^}]+)\}\}/g;return _=_.replace(H,(L,O)=>{let F=O.trim();return j[F]!==void 0?String(j[F]):L}),_}catch(W){let w=W instanceof Error?W.message:String(W);return U0("Markdown File",`Error including markdown file: ${w}`,Z,X,U,Q)}})}async function _B(X,$,Z){let Y=[],J;while((J=$.exec(X))!==null){let q=J[0],K=J.index,U=J;Y.push(Z(...U).then((W)=>({match:q,replacement:W,index:K})))}let G=await Promise.all(Y);G.sort((q,K)=>K.index-q.index);let Q=X;for(let{match:q,replacement:K}of G)Q=Q.replace(q,()=>K);return Q}var L3,S8=null;var hJ=D(()=>{V1();A0();L3=new Map});function b1(X,$){try{let Z=X.trim();if(G0(Z))return Q0(Z,Object.keys($))(...Object.values($));else return $0(Z,$)}catch{return!1}}var uJ=D(()=>{O0()});function HB(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,q=K9(Y,Q);if(!q)break;try{let K;if(G0(q.expression))K=Q0(q.expression,Object.keys($))(...Object.values($));else K=$0(q.expression,$);let U="",W=!1;for(let w of q.cases)if(w.type==="default"){if(!W)U=w.content.trim()}else try{let z;if(w.value&&G0(w.value))z=Q0(w.value,Object.keys($))(...Object.values($));else if(w.value)z=$0(w.value,$);if(K===z){U=w.content.trim(),W=!0;break}}catch{continue}Y=Y.substring(0,Q)+U+Y.substring(q.end),J=!0}catch(K){let U=K instanceof Error?K.message:String(K),W=X0("Switch",`Error evaluating @switch expression: ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,Q)+W+Y.substring(q.end);break}}return Y}function OB(X){let $=[];return{masked:X.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return $.push(Y),`\x00stx-script-${$.length-1}\x00`}),scripts:$}}function LB(X,$){if($.length===0)return X;return X.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,Y)=>$[Number(Y)]??Z)}function $5(X,$,Z){let{masked:Y,scripts:J}=OB(X);return LB(FB(Y,$,Z),J)}function FB(X,$,Z){let Y=X;Y=HB(Y,$,Z);{let G=!0;while(G){G=!1;let Q=Y.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let q=Q.index,K=k1(Y,q+7);if(!K)break;let U=K.endPos,W=n1(Y,"unless","endunless",U);if(W===-1){console.warn(`[stx] @unless directive at position ${q} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let w=Y.slice(U,W),z=K.expression,B=-1;{let _=0,H=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],V;while((V=H.exec(w))!==null)F.push({pos:V.index,type:"open"});while((V=L.exec(w))!==null)F.push({pos:V.index,type:"close"});while((V=O.exec(w))!==null)F.push({pos:V.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")_++;else if(A.type==="close")_--;else if(A.type==="else"&&_===0){B=A.pos;break}}let j;if(B!==-1){let _=w.slice(0,B),H=w.slice(B+5);j=`@if (${z})${H}@else ${_}@endif`}else j=`@if (!(${z}))${w}@endif`;Y=Y.substring(0,q)+j+Y.substring(W+10),G=!0}}Y=V3(Y,$,Z),Y=A3(Y,$,Z),Y=F3(Y,$);let J=()=>{let G=k7(Y);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let q=G[Q];try{let K="",U=!1;for(let W of q.branches){if(U)break;if(W.type==="else")K=W.content,U=!0;else try{let w;if(W.condition&&G0(W.condition))w=Q0(W.condition,Object.keys($))(...Object.values($));else if(W.condition)w=$0(W.condition,$);if(w)K=W.content,U=!0}catch(w){K=X0(W.type==="if"?"If":"Elseif",`Error in @${W.type}(${W.condition}): ${w instanceof Error?w.message:String(w)}`,s.EVALUATION_ERROR),U=!0}}Y=Y.substring(0,q.start)+K+Y.substring(q.end)}catch(K){let U=K instanceof Error?K.message:String(K),W=X0("If",`Error processing @if block: ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,q.start)+W+Y.substring(q.end)}}return!0};while(!0){let G=Y;if(!J())break;if(Y===G)break}return Y}function dJ(X){let $=0;while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!=="(")return null;$++;while($<X.length&&/\s/.test(X[$]))$++;let Z=X[$];if(Z!=="'"&&Z!=='"')return null;$++;let Y=[];while($<X.length){let J=X[$];if(J==="\\"&&$+1<X.length){Y.push(X[$+1]),$+=2;continue}if(J===Z){$++;break}Y.push(J),$++}while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!==")")return null;return $++,{value:Y.join(""),consumed:$}}function F3(X,$){let Z=X;function Y(q,K,U,W){let w=1,z=W,B=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${U}(?![a-z])`,"g");while(z<q.length&&w>0){B.lastIndex=z,j.lastIndex=z;let _=B.exec(q),H=j.exec(q),L=_?_.index:1/0,O=H?H.index:1/0;if(L<O)w++,z=L+_[0].length;else if(O<1/0){if(w--,w===0)return O;z=O+H[0].length}else break}return-1}function J(q,K,U){let W=0,w=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${U}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=w.exec(q))!==null)j.push({pos:_.index,type:"open"});while((_=z.exec(q))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(q))!==null)j.push({pos:_.index,type:"else"});j.sort((H,L)=>H.pos-L.pos);for(let H of j)if(H.type==="open")W++;else if(H.type==="close")W--;else if(H.type==="else"&&W===0)return H.pos;return-1}{let q=!0;while(q){q=!1;let K=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let U=K.index,W,w,z=Z.slice(U+5),B=dJ(z);if(B)W=B.value,w=U+5+B.consumed;else w=U+5;let j=Y(Z,"auth","endauth",w);if(j===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let _=Z.slice(w,j),H=J(_,"auth","endauth"),L;if(!$.auth)L=!1;else L=W?b1(`auth?.check && auth?.user?.[${W}]`,$):b1("auth?.check",$);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,U)+O+Z.substring(j+8),q=!0}}{let q=!0;while(q){q=!1;let K=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let U=K.index,W,w,z=Z.slice(U+6),B=dJ(z);if(B)W=B.value,w=U+6+B.consumed;else w=U+6;let j=Y(Z,"guest","endguest",w);if(j===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let _=Z.slice(w,j),H=J(_,"guest","endguest"),L;if(!$.auth)L=!0;else L=W?b1(`!auth?.check || !auth?.user?.[${W}]`,$):b1("!auth?.check",$);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,U)+O+Z.substring(j+9),q=!0}}function G(q,K,U){if($.userCan&&typeof $.userCan[q]==="boolean")return $.userCan[q];if($.permissions?.check&&typeof $.permissions.check==="function")try{let W=[q];if(K)W.push(K);if(U){let w=b1(U,$);W.push(w)}return $.permissions.check(...W)}catch{return!1}return!1}function Q(q){let K=q.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let q of["can","cannot"]){let K=`end${q}`,U=q==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let w=Z.match(new RegExp(`@${q}\\s*\\(`));if(!w||w.index===void 0)break;let z=w.index,B=Z.slice(z+`@${q}`.length),j=Q(B);if(!j)break;let _=z+`@${q}`.length+j.paramsEnd,H=Y(Z,q,K,_);if(H===-1){console.warn(`[stx] @${q} directive at position ${z} has no matching @${K} \u2014 the block was skipped.`);break}let L=Z.slice(_,H),O=[],F=0,V=new RegExp(`@${q}\\s*\\(`,"g"),A=new RegExp(`@${K}(?![a-z])`,"g"),R=new RegExp(`@${U}\\s*\\(`,"g"),T=/@else(?![a-z])/g,N=[],k;while((k=V.exec(L))!==null)N.push({pos:k.index,type:"open"});while((k=A.exec(L))!==null)N.push({pos:k.index,type:"close"});while((k=R.exec(L))!==null)N.push({pos:k.index,type:"elseDirective"});while((k=T.exec(L))!==null)N.push({pos:k.index,type:"else"});N.sort((b,P)=>b.pos-P.pos);for(let b of N){if(b.type==="open"){F++;continue}if(b.type==="close"){F--;continue}if(F===0)O.push(b)}let M=[],y=0;for(let b=0;b<O.length;b++){let P=O[b];if(M.push({content:L.slice(y,P.pos),ability:void 0}),P.type==="elseDirective"){let x=L.slice(P.pos+`@${U}`.length),d=Q(x);if(d){M[M.length-1]={content:L.slice(y,P.pos)},y=P.pos+`@${U}`.length+d.paramsEnd,M.push({content:"",ability:d.ability,type:d.type,id:d.id}),M.pop();let m=O[b+1],Y0=m?m.pos:L.length;M.push({content:L.slice(y,Y0),ability:d.ability,type:d.type,id:d.id}),y=Y0}}else y=P.pos+5}if(y<L.length){let b=M[M.length-1];if(O.length>0&&O[O.length-1].type==="else")M.push({content:L.slice(y),isFinalElse:!0});else if(M.length===0)M.push({content:L.slice(y)})}let I=G(j.ability,j.type,j.id),C=q==="can"?I:!I,S="";if(C)S=M[0]?.content||"";else{let b=!1;for(let P=1;P<M.length;P++){let x=M[P];if(x.isFinalElse){S=x.content,b=!0;break}if(x.ability){let d=G(x.ability,x.type,x.id);if(q==="can"?d:!d){S=x.content,b=!0;break}}}if(!b&&M.length>0){let P=M[M.length-1];if(P.isFinalElse)S=P.content}}Z=Z.substring(0,z)+S+Z.substring(H+`@${K}`.length),W=!0}}return Z}function V3(X,$,Z){let Y=X;function J(G,Q,q,K,U){let W=!0;while(W){W=!1;let w=new RegExp(`@${Q}\\s*\\(`),z=G.match(w);if(!z||z.index===void 0)break;let B=z.index,j=k1(G,B+`@${Q}`.length);if(!j)break;let _=j.endPos,H=n1(G,Q,q,_);if(H===-1){console.warn(`[stx] @${Q} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let L=G.slice(_,H),O=j.expression,F=-1,V=0,A=0;while(A<L.length){let R=L.indexOf("@",A);if(R===-1)break;let T=L.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(T)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(T)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(T)){F=R;break}A=R+1}try{let R=K(O.trim()),T;if(F!==-1){let N=L.slice(0,F),k=L.slice(F+5);T=R?N:k}else T=R?L:"";G=G.substring(0,B)+T+G.substring(H+`@${q}`.length),W=!0}catch(R){let T=R instanceof Error?R.message:String(R),N=X0(U,`Error processing @${Q} directive: ${T}`,s.EVALUATION_ERROR);G=G.substring(0,B)+N+G.substring(H+`@${q}`.length);break}}return G}return Y=J(Y,"isset","endisset",(G)=>{let Q=b1(G,$);return Q!==void 0&&Q!==null},"Isset"),Y=J(Y,"empty","endempty",(G)=>{let Q=b1(G,$);return Q===void 0||Q===null||Q===""||Q===0||Q===!1||Array.isArray(Q)&&Q.length===0||typeof Q==="object"&&Q!==null&&Object.keys(Q).length===0},"Empty"),Y}function A3(X,$,Z){let Y=X,J="development";function G(Q,q,K,U){let W=new RegExp(`@${q}(?![a-z])`,"g"),w=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`^@${q}(?![a-z])`),B=new RegExp(`^@${K}(?![a-z])`),j=Q,_=!0;while(_){_=!1,W.lastIndex=0;let H=W.exec(j);if(!H)break;let L=H.index,O=L+H[0].length;if(q==="env"){let I=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;O+=I[0].length,U=J===I[2]}let F=1,V=O,A=-1;while(F>0&&V<j.length){W.lastIndex=V,w.lastIndex=V;let I=W.exec(j),C=w.exec(j),S=I?I.index:1/0,b=C?C.index:1/0;if(S<b)F++,V=S+I[0].length;else if(b<1/0){if(F--,F===0){A=b;break}V=b+C[0].length}else break}if(A===-1){console.warn(`[stx] @${q} directive at position ${L} has no matching @${K} \u2014 the block was skipped.`);break}let R=j.substring(O,A),T=-1,N=0,k=0;while(k<R.length){let I=R.indexOf("@",k);if(I===-1)break;let C=R.substring(I);if(z.test(C)){N++,k=I+1;continue}if(B.test(C)){N--,k=I+1;continue}if(N===0&&/^@else(?![a-z])/.test(C)){T=I;break}k=I+1}let M;if(T!==-1){let I=R.slice(0,T),C=R.slice(T+5);M=U?I:C}else M=U?R:"";let y=`@${K}`.length;j=j.substring(0,L)+M+j.substring(A+y),_=!0}return j}return Y=G(Y,"env","endenv",!1),Y=G(Y,"production","endproduction",J==="production"),Y=G(Y,"development","enddevelopment",J==="development"),Y=G(Y,"staging","endstaging",J==="staging"),Y=G(Y,"testing","endtesting",J==="testing"),Y}var C8=D(()=>{uJ();w1();EX();O0()});function lJ(X=16){let $=new Uint8Array(X);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function P8(X,$){if(!X)return $?.nonceGenerator?.()??lJ();let Z=mJ.get(X);if(!Z)Z=$?.nonceGenerator?.()??lJ(),mJ.set(X,Z);return Z}function VB(X,$){let Z=[];for(let[Y,J]of Object.entries(X)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Z.push(Y);continue}if(Array.isArray(J)){let G=[...J];if($&&(Y==="script-src"||Y==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${$}'`);if(G.length>0)Z.push(`${Y} ${G.join(" ")}`)}}return Z.join("; ")}function cJ(X,$){return`<meta http-equiv="Content-Security-Policy" content="${VB(X,$).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function pJ(X,$,Z){if(!$.enabled||!$.addMetaTag)return X;if(X.includes('http-equiv="Content-Security-Policy"'))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let Y=$.useNonce?P8(Z,$):void 0,J=cJ($.directives,Y);return X.replace(/<head([^>]*)>/,`<head$1>
13207
- ${J}`)}function iJ(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<script nonce="${$}"${J}>`}),Z=Z.replace(/<style([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<style nonce="${$}"${J}>`}),Z}function nJ(X,$,Z,Y){let J=X,G=Y.csp;if(J=J.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?P8($,G):void 0;return cJ(G.directives,Q)}),J=J.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return P8($,G)}),G?.enabled&&G.useNonce)$.cspNonce=P8($,G);return J}var mJ;var rJ=D(()=>{mJ=new WeakMap});import AB from"crypto";function TB(X=RB){let $=AB.randomBytes(Math.ceil(X/2)).toString("hex").slice(0,X);return R3=$,$}function NB(){if(!R3)TB();return R3}function MB(X=oJ){let $=NB();return`<input type="hidden" name="${X}" value="${$}">`}function sJ(X){return X.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,Z,Y)=>{return MB(Y||oJ)})}var RB=40,oJ="_token",R3=null;var aJ=()=>{};async function tJ(X,$,Z,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return X;let J=X;for(let G of Y.customDirectives){if(!G.name||typeof G.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)J=await kB(J,G,$,Z,Y);else J=await IB(J,G,$,Z,Y)}return J}async function kB(X,$,Z,Y,J){let{name:G,handler:Q}=$,q=`@${G}`,K=`@end${G}`,U=X,W=T5(`${q}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),w=[],z=W.exec(U);while(z!==null){let[B,j="",_=""]=z,H=z.index||0;try{let L=j?eJ(j):[],O=_.trim(),F=await Q(O,L,Z,Y);w.push({original:B,processed:F,startIndex:H})}catch(L){let O=L instanceof Error?L.message:String(L);if(J.debug)console.error(`Error processing custom directive @${G}:`,L);w.push({original:B,processed:X0("CustomDirective",`Error in @${G}${j?`(${j})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:H})}z=W.exec(U)}for(let B=w.length-1;B>=0;B--){let{original:j,processed:_}=w[B];U=U.replace(j,_)}return U}async function IB(X,$,Z,Y,J){let{name:G,handler:Q}=$,q=X,K=T5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),U=[],W=K.exec(q);while(W!==null){let[B,j=""]=W,_=W.index||0;try{let H=eJ(j),L=await Q("",H,Z,Y);U.push({original:B,processed:L,startIndex:_})}catch(H){let L=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${G}:`,H);U.push({original:B,processed:X0("CustomDirective",`Error in @${G}(${j}): ${L}`,s.EVALUATION_ERROR),startIndex:_})}W=K.exec(q)}let w=T5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),z=w.exec(q);while(z!==null){let[B]=z,j=z.index||0;try{let _=await Q("",[],Z,Y);U.push({original:B,processed:_,startIndex:j})}catch(_){let H=_ instanceof Error?_.message:String(_);if(J.debug)console.error(`Error processing custom directive @${G}:`,_);U.push({original:B,processed:X0("CustomDirective",`Error in @${G}: ${H}`,s.EVALUATION_ERROR),startIndex:j})}z=w.exec(q)}for(let B=U.length-1;B>=0;B--){let{original:j,processed:_}=U[B];q=q.replace(j,_)}return q}function eJ(X){if(!X.trim())return[];let $=[],Z="",Y=!1,J="";for(let G=0;G<X.length;G++){let Q=X[G];if((Q==='"'||Q==="'")&&(G===0||X[G-1]!=="\\"))if(!Y)Y=!0,J=Q;else if(Q===J)Y=!1;else Z+=Q;else if(Q===","&&!Y)$.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())$.push(Z.trim());return $.map((G)=>{let Q=G.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var XG=D(()=>{w1();N5()});function Z5(X,$){if(typeof X!=="string"||X.length===0)throw Error(`@appearanceBootstrap ${$} must be a non-empty string`)}function DB(X){if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap expects an options object");let $=X,Z=$.appearance,Y=$.colorMode;if(Z5($.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(Z5(Z.key,"appearance.key"),Z5(Z.attribute,"appearance.attribute"),Z5(Z.default,"appearance.default"),Z5(Y.key,"colorMode.key"),Z5(Y.attribute,"colorMode.attribute"),Z5(Y.default,"colorMode.default"),!ZG.test(Z.key)||!ZG.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!$G.test(Z.attribute)||!$G.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Z.allowed.includes(Z.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!EB.has(Y.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:$.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:Y.key,attribute:Y.attribute,default:Y.default}}}function yB(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function bB(X){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${yB(X)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function SB(X,$){let Z=1,Y=null,J=!1;for(let G=$+1;G<X.length;G++){let Q=X[G];if(J){J=!1;continue}if(Y){if(Q==="\\")J=!0;else if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function YG(X,$){let Z=X,Y=/@appearanceBootstrap\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,Q=SB(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let q=Z.slice(G+1,Q).trim(),K=$0(`(${q})`,$),U=bB(DB(K));Z=Z.slice(0,J.index)+U+Z.slice(Q+1),Y.lastIndex=J.index+U.length}return Z}var $G,ZG,EB;var JG=D(()=>{O0();$G=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,ZG=/^[A-Za-z_$][\w$]*$/,EB=new Set(["light","dark","system"])});import CB from"crypto";function B0(X){return String(X??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function v8(X,$,Z,Y){let J=X||$;return Z?`${J} ${Y}`:J}function c0(X){return String(X).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function C5(X,$){if(/\bid\s*=/i.test(X))return"";return` id="${B0($)}"`}function T3(X,$,Z){if(!$)return"";let Y="";if(!/\baria-invalid\s*=/i.test(Z))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))Y+=` aria-describedby="${B0(`${c0(X)}-error`)}"`;return Y}function PB(){return CB.randomUUID()}function x8(X,$){let Z=X;return Z=Z.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let Y=PB();$.csrf={token:Y}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${B0($.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,J)=>{let G=J.toUpperCase();if(J&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${B0(G)}">`;return Y}),Z}function qG(X,$,Z=QG){let Y=X;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,G,Q,q,K,U="")=>{let W=G||Q||"POST",w=q||K||"",z=S1(U),B=W.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${B0(j)}" action="${B0(w)}"${z?` ${z}`:""}>`;if(_+=`
13278
+ </script>`}function nJ(X,$,Z){if(iJ=0,!AB(X))return X;let Y=BB(X);if(Y.length===0)return X;let J=VB(X,Y),G=FB(Y,$),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
13279
+ `+J.slice(Q);else J+=G;return J}function VB(X,$){let Z=0,Y=X.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,G,Q)=>{let q=$[Z++];if(!q)return J;let K=/data-stx-scope="([^"]*)"/.exec(Q);if(K)return q.id=K[1],q.selector=`[data-stx-scope="${q.id}"]`,J;return`<${G} data-stx-scope="${q.id}"${Q}>`});return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function AB(X){return/x-data\s*=\s*["']/.test(X)}var iJ=0,jB=0;var rJ=E(()=>{Z1()});import RB from"fs";import T3 from"path";import{createHighlighter as NB}from"ts-syntax-highlighter";async function TB(X,$={}){try{if(!await p(X))throw Error(`Markdown file not found: ${X}`);let Y=(await RB.promises.stat(X)).mtime.getTime();if($.cache&&M3.has(X)){let w=M3.get(X);if(w.updatedAt>=Y)return{content:w.content,data:w.data}}let J=await Bun.file(X).text(),{data:G,content:Q}=s2(J),q=$.markdown||_7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=w7(Q,{gfm:!0});if(q.syntaxHighlighting?.enabled&&q.syntaxHighlighting?.serverSide)U=await MB(U,q.syntaxHighlighting?.defaultTheme||"github-dark",q.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:U,data:G||{}};if($.cache)M3.set(X,{...W,updatedAt:Y});return W}catch(Z){if($.debug)console.error(`Error reading/parsing markdown file ${X}:`,Z);let Y=Z instanceof Error?Z.message:String(Z);return{content:U0("Markdown File",`Error reading/parsing markdown file: ${Y}`,X,"",0,""),data:{}}}}async function MB(X,$,Z){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!S8)try{S8=await NB({theme:$||"github-dark",cache:!0})}catch(q){return console.error("Failed to initialize ts-syntax-highlighter:",q),X}let J=async(q,K,U,W)=>{let w=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),z=U||(Z?"text":"");if(!z)return q;try{if(!S8.getSupportedLanguages().includes(z))return q;return(await S8.highlight(w,z,{theme:$})).html}catch(B){console.error(`Error highlighting code block with language ${U}:`,B)}return q},G=X,Q=X.matchAll(Y);for(let q of Q){let[K,U,W,w]=q,z=await J(K,U,W,w);G=G.replace(K,z)}return G}async function oJ(X,$,Z="",Y={}){return await kB(X,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,q,K,U)=>{try{let W=q;if(!T3.isAbsolute(q))W=T3.resolve(T3.dirname(Z),q);let w={};if(K)try{try{w=JSON.parse(K)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let O=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(N||T)R=R.substring(1,R.length-1);w[A]=R}}}}catch(L){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:z,data:B}=await TB(W,Y),j={...$,...B,...w},_=z,H=/\{\{([^}]+)\}\}/g;return _=_.replace(H,(L,O)=>{let F=O.trim();return j[F]!==void 0?String(j[F]):L}),_}catch(W){let w=W instanceof Error?W.message:String(W);return U0("Markdown File",`Error including markdown file: ${w}`,Z,X,U,Q)}})}async function kB(X,$,Z){let Y=[],J;while((J=$.exec(X))!==null){let q=J[0],K=J.index,U=J;Y.push(Z(...U).then((W)=>({match:q,replacement:W,index:K})))}let G=await Promise.all(Y);G.sort((q,K)=>K.index-q.index);let Q=X;for(let{match:q,replacement:K}of G)Q=Q.replace(q,()=>K);return Q}var M3,S8=null;var sJ=E(()=>{V1();A0();M3=new Map});function b1(X,$){try{let Z=X.trim();if(G0(Z))return Q0(Z,Object.keys($))(...Object.values($));else return $0(Z,$)}catch{return!1}}var aJ=E(()=>{O0()});function IB(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,q=K9(Y,Q);if(!q)break;try{let K;if(G0(q.expression))K=Q0(q.expression,Object.keys($))(...Object.values($));else K=$0(q.expression,$);let U="",W=!1;for(let w of q.cases)if(w.type==="default"){if(!W)U=w.content.trim()}else try{let z;if(w.value&&G0(w.value))z=Q0(w.value,Object.keys($))(...Object.values($));else if(w.value)z=$0(w.value,$);if(K===z){U=w.content.trim(),W=!0;break}}catch{continue}Y=Y.substring(0,Q)+U+Y.substring(q.end),J=!0}catch(K){let U=K instanceof Error?K.message:String(K),W=X0("Switch",`Error evaluating @switch expression: ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,Q)+W+Y.substring(q.end);break}}return Y}function EB(X){let $=[];return{masked:X.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return $.push(Y),`\x00stx-script-${$.length-1}\x00`}),scripts:$}}function DB(X,$){if($.length===0)return X;return X.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,Y)=>$[Number(Y)]??Z)}function Z5(X,$,Z){let{masked:Y,scripts:J}=EB(X);return DB(yB(Y,$,Z),J)}function yB(X,$,Z){let Y=X;Y=IB(Y,$,Z);{let G=!0;while(G){G=!1;let Q=Y.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let q=Q.index,K=k1(Y,q+7);if(!K)break;let U=K.endPos,W=n1(Y,"unless","endunless",U);if(W===-1){console.warn(`[stx] @unless directive at position ${q} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let w=Y.slice(U,W),z=K.expression,B=-1;{let _=0,H=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],V;while((V=H.exec(w))!==null)F.push({pos:V.index,type:"open"});while((V=L.exec(w))!==null)F.push({pos:V.index,type:"close"});while((V=O.exec(w))!==null)F.push({pos:V.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")_++;else if(A.type==="close")_--;else if(A.type==="else"&&_===0){B=A.pos;break}}let j;if(B!==-1){let _=w.slice(0,B),H=w.slice(B+5);j=`@if (${z})${H}@else ${_}@endif`}else j=`@if (!(${z}))${w}@endif`;Y=Y.substring(0,q)+j+Y.substring(W+10),G=!0}}Y=I3(Y,$,Z),Y=E3(Y,$,Z),Y=k3(Y,$);let J=()=>{let G=I7(Y);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let q=G[Q];try{let K="",U=!1;for(let W of q.branches){if(U)break;if(W.type==="else")K=W.content,U=!0;else try{let w;if(W.condition&&G0(W.condition))w=Q0(W.condition,Object.keys($))(...Object.values($));else if(W.condition)w=$0(W.condition,$);if(w)K=W.content,U=!0}catch(w){K=X0(W.type==="if"?"If":"Elseif",`Error in @${W.type}(${W.condition}): ${w instanceof Error?w.message:String(w)}`,s.EVALUATION_ERROR),U=!0}}Y=Y.substring(0,q.start)+K+Y.substring(q.end)}catch(K){let U=K instanceof Error?K.message:String(K),W=X0("If",`Error processing @if block: ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,q.start)+W+Y.substring(q.end)}}return!0};while(!0){let G=Y;if(!J())break;if(Y===G)break}return Y}function tJ(X){let $=0;while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!=="(")return null;$++;while($<X.length&&/\s/.test(X[$]))$++;let Z=X[$];if(Z!=="'"&&Z!=='"')return null;$++;let Y=[];while($<X.length){let J=X[$];if(J==="\\"&&$+1<X.length){Y.push(X[$+1]),$+=2;continue}if(J===Z){$++;break}Y.push(J),$++}while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!==")")return null;return $++,{value:Y.join(""),consumed:$}}function k3(X,$){let Z=X;function Y(q,K,U,W){let w=1,z=W,B=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${U}(?![a-z])`,"g");while(z<q.length&&w>0){B.lastIndex=z,j.lastIndex=z;let _=B.exec(q),H=j.exec(q),L=_?_.index:1/0,O=H?H.index:1/0;if(L<O)w++,z=L+_[0].length;else if(O<1/0){if(w--,w===0)return O;z=O+H[0].length}else break}return-1}function J(q,K,U){let W=0,w=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),z=new RegExp(`@${U}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=w.exec(q))!==null)j.push({pos:_.index,type:"open"});while((_=z.exec(q))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(q))!==null)j.push({pos:_.index,type:"else"});j.sort((H,L)=>H.pos-L.pos);for(let H of j)if(H.type==="open")W++;else if(H.type==="close")W--;else if(H.type==="else"&&W===0)return H.pos;return-1}{let q=!0;while(q){q=!1;let K=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let U=K.index,W,w,z=Z.slice(U+5),B=tJ(z);if(B)W=B.value,w=U+5+B.consumed;else w=U+5;let j=Y(Z,"auth","endauth",w);if(j===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let _=Z.slice(w,j),H=J(_,"auth","endauth"),L;if(!$.auth)L=!1;else L=W?b1(`auth?.check && auth?.user?.[${W}]`,$):b1("auth?.check",$);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,U)+O+Z.substring(j+8),q=!0}}{let q=!0;while(q){q=!1;let K=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let U=K.index,W,w,z=Z.slice(U+6),B=tJ(z);if(B)W=B.value,w=U+6+B.consumed;else w=U+6;let j=Y(Z,"guest","endguest",w);if(j===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let _=Z.slice(w,j),H=J(_,"guest","endguest"),L;if(!$.auth)L=!0;else L=W?b1(`!auth?.check || !auth?.user?.[${W}]`,$):b1("!auth?.check",$);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,U)+O+Z.substring(j+9),q=!0}}function G(q,K,U){if($.userCan&&typeof $.userCan[q]==="boolean")return $.userCan[q];if($.permissions?.check&&typeof $.permissions.check==="function")try{let W=[q];if(K)W.push(K);if(U){let w=b1(U,$);W.push(w)}return $.permissions.check(...W)}catch{return!1}return!1}function Q(q){let K=q.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let q of["can","cannot"]){let K=`end${q}`,U=q==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let w=Z.match(new RegExp(`@${q}\\s*\\(`));if(!w||w.index===void 0)break;let z=w.index,B=Z.slice(z+`@${q}`.length),j=Q(B);if(!j)break;let _=z+`@${q}`.length+j.paramsEnd,H=Y(Z,q,K,_);if(H===-1){console.warn(`[stx] @${q} directive at position ${z} has no matching @${K} \u2014 the block was skipped.`);break}let L=Z.slice(_,H),O=[],F=0,V=new RegExp(`@${q}\\s*\\(`,"g"),A=new RegExp(`@${K}(?![a-z])`,"g"),R=new RegExp(`@${U}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],k;while((k=V.exec(L))!==null)T.push({pos:k.index,type:"open"});while((k=A.exec(L))!==null)T.push({pos:k.index,type:"close"});while((k=R.exec(L))!==null)T.push({pos:k.index,type:"elseDirective"});while((k=N.exec(L))!==null)T.push({pos:k.index,type:"else"});T.sort((b,P)=>b.pos-P.pos);for(let b of T){if(b.type==="open"){F++;continue}if(b.type==="close"){F--;continue}if(F===0)O.push(b)}let M=[],y=0;for(let b=0;b<O.length;b++){let P=O[b];if(M.push({content:L.slice(y,P.pos),ability:void 0}),P.type==="elseDirective"){let x=L.slice(P.pos+`@${U}`.length),d=Q(x);if(d){M[M.length-1]={content:L.slice(y,P.pos)},y=P.pos+`@${U}`.length+d.paramsEnd,M.push({content:"",ability:d.ability,type:d.type,id:d.id}),M.pop();let m=O[b+1],Y0=m?m.pos:L.length;M.push({content:L.slice(y,Y0),ability:d.ability,type:d.type,id:d.id}),y=Y0}}else y=P.pos+5}if(y<L.length){let b=M[M.length-1];if(O.length>0&&O[O.length-1].type==="else")M.push({content:L.slice(y),isFinalElse:!0});else if(M.length===0)M.push({content:L.slice(y)})}let I=G(j.ability,j.type,j.id),C=q==="can"?I:!I,S="";if(C)S=M[0]?.content||"";else{let b=!1;for(let P=1;P<M.length;P++){let x=M[P];if(x.isFinalElse){S=x.content,b=!0;break}if(x.ability){let d=G(x.ability,x.type,x.id);if(q==="can"?d:!d){S=x.content,b=!0;break}}}if(!b&&M.length>0){let P=M[M.length-1];if(P.isFinalElse)S=P.content}}Z=Z.substring(0,z)+S+Z.substring(H+`@${K}`.length),W=!0}}return Z}function I3(X,$,Z){let Y=X;function J(G,Q,q,K,U){let W=!0;while(W){W=!1;let w=new RegExp(`@${Q}\\s*\\(`),z=G.match(w);if(!z||z.index===void 0)break;let B=z.index,j=k1(G,B+`@${Q}`.length);if(!j)break;let _=j.endPos,H=n1(G,Q,q,_);if(H===-1){console.warn(`[stx] @${Q} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let L=G.slice(_,H),O=j.expression,F=-1,V=0,A=0;while(A<L.length){let R=L.indexOf("@",A);if(R===-1)break;let N=L.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(N)){F=R;break}A=R+1}try{let R=K(O.trim()),N;if(F!==-1){let T=L.slice(0,F),k=L.slice(F+5);N=R?T:k}else N=R?L:"";G=G.substring(0,B)+N+G.substring(H+`@${q}`.length),W=!0}catch(R){let N=R instanceof Error?R.message:String(R),T=X0(U,`Error processing @${Q} directive: ${N}`,s.EVALUATION_ERROR);G=G.substring(0,B)+T+G.substring(H+`@${q}`.length);break}}return G}return Y=J(Y,"isset","endisset",(G)=>{let Q=b1(G,$);return Q!==void 0&&Q!==null},"Isset"),Y=J(Y,"empty","endempty",(G)=>{let Q=b1(G,$);return Q===void 0||Q===null||Q===""||Q===0||Q===!1||Array.isArray(Q)&&Q.length===0||typeof Q==="object"&&Q!==null&&Object.keys(Q).length===0},"Empty"),Y}function E3(X,$,Z){let Y=X,J="development";function G(Q,q,K,U){let W=new RegExp(`@${q}(?![a-z])`,"g"),w=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`^@${q}(?![a-z])`),B=new RegExp(`^@${K}(?![a-z])`),j=Q,_=!0;while(_){_=!1,W.lastIndex=0;let H=W.exec(j);if(!H)break;let L=H.index,O=L+H[0].length;if(q==="env"){let I=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;O+=I[0].length,U=J===I[2]}let F=1,V=O,A=-1;while(F>0&&V<j.length){W.lastIndex=V,w.lastIndex=V;let I=W.exec(j),C=w.exec(j),S=I?I.index:1/0,b=C?C.index:1/0;if(S<b)F++,V=S+I[0].length;else if(b<1/0){if(F--,F===0){A=b;break}V=b+C[0].length}else break}if(A===-1){console.warn(`[stx] @${q} directive at position ${L} has no matching @${K} \u2014 the block was skipped.`);break}let R=j.substring(O,A),N=-1,T=0,k=0;while(k<R.length){let I=R.indexOf("@",k);if(I===-1)break;let C=R.substring(I);if(z.test(C)){T++,k=I+1;continue}if(B.test(C)){T--,k=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(C)){N=I;break}k=I+1}let M;if(N!==-1){let I=R.slice(0,N),C=R.slice(N+5);M=U?I:C}else M=U?R:"";let y=`@${K}`.length;j=j.substring(0,L)+M+j.substring(A+y),_=!0}return j}return Y=G(Y,"env","endenv",!1),Y=G(Y,"production","endproduction",J==="production"),Y=G(Y,"development","enddevelopment",J==="development"),Y=G(Y,"staging","endstaging",J==="staging"),Y=G(Y,"testing","endtesting",J==="testing"),Y}var C8=E(()=>{aJ();w1();DX();O0()});function XG(X=16){let $=new Uint8Array(X);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function P8(X,$){if(!X)return $?.nonceGenerator?.()??XG();let Z=eJ.get(X);if(!Z)Z=$?.nonceGenerator?.()??XG(),eJ.set(X,Z);return Z}function bB(X,$){let Z=[];for(let[Y,J]of Object.entries(X)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Z.push(Y);continue}if(Array.isArray(J)){let G=[...J];if($&&(Y==="script-src"||Y==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${$}'`);if(G.length>0)Z.push(`${Y} ${G.join(" ")}`)}}return Z.join("; ")}function $G(X,$){return`<meta http-equiv="Content-Security-Policy" content="${bB(X,$).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function ZG(X,$,Z){if(!$.enabled||!$.addMetaTag)return X;if(X.includes('http-equiv="Content-Security-Policy"'))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let Y=$.useNonce?P8(Z,$):void 0,J=$G($.directives,Y);return X.replace(/<head([^>]*)>/,`<head$1>
13280
+ ${J}`)}function YG(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<script nonce="${$}"${J}>`}),Z=Z.replace(/<style([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<style nonce="${$}"${J}>`}),Z}function JG(X,$,Z,Y){let J=X,G=Y.csp;if(J=J.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?P8($,G):void 0;return $G(G.directives,Q)}),J=J.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return P8($,G)}),G?.enabled&&G.useNonce)$.cspNonce=P8($,G);return J}var eJ;var GG=E(()=>{eJ=new WeakMap});import SB from"crypto";function PB(X=CB){let $=SB.randomBytes(Math.ceil(X/2)).toString("hex").slice(0,X);return D3=$,$}function vB(){if(!D3)PB();return D3}function xB(X=QG){let $=vB();return`<input type="hidden" name="${X}" value="${$}">`}function qG(X){return X.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,Z,Y)=>{return xB(Y||QG)})}var CB=40,QG="_token",D3=null;var KG=()=>{};async function UG(X,$,Z,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return X;let J=X;for(let G of Y.customDirectives){if(!G.name||typeof G.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)J=await fB(J,G,$,Z,Y);else J=await gB(J,G,$,Z,Y)}return J}async function fB(X,$,Z,Y,J){let{name:G,handler:Q}=$,q=`@${G}`,K=`@end${G}`,U=X,W=T5(`${q}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),w=[],z=W.exec(U);while(z!==null){let[B,j="",_=""]=z,H=z.index||0;try{let L=j?WG(j):[],O=_.trim(),F=await Q(O,L,Z,Y);w.push({original:B,processed:F,startIndex:H})}catch(L){let O=L instanceof Error?L.message:String(L);if(J.debug)console.error(`Error processing custom directive @${G}:`,L);w.push({original:B,processed:X0("CustomDirective",`Error in @${G}${j?`(${j})`:""}: ${O}`,s.EVALUATION_ERROR),startIndex:H})}z=W.exec(U)}for(let B=w.length-1;B>=0;B--){let{original:j,processed:_}=w[B];U=U.replace(j,_)}return U}async function gB(X,$,Z,Y,J){let{name:G,handler:Q}=$,q=X,K=T5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),U=[],W=K.exec(q);while(W!==null){let[B,j=""]=W,_=W.index||0;try{let H=WG(j),L=await Q("",H,Z,Y);U.push({original:B,processed:L,startIndex:_})}catch(H){let L=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${G}:`,H);U.push({original:B,processed:X0("CustomDirective",`Error in @${G}(${j}): ${L}`,s.EVALUATION_ERROR),startIndex:_})}W=K.exec(q)}let w=T5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),z=w.exec(q);while(z!==null){let[B]=z,j=z.index||0;try{let _=await Q("",[],Z,Y);U.push({original:B,processed:_,startIndex:j})}catch(_){let H=_ instanceof Error?_.message:String(_);if(J.debug)console.error(`Error processing custom directive @${G}:`,_);U.push({original:B,processed:X0("CustomDirective",`Error in @${G}: ${H}`,s.EVALUATION_ERROR),startIndex:j})}z=w.exec(q)}for(let B=U.length-1;B>=0;B--){let{original:j,processed:_}=U[B];q=q.replace(j,_)}return q}function WG(X){if(!X.trim())return[];let $=[],Z="",Y=!1,J="";for(let G=0;G<X.length;G++){let Q=X[G];if((Q==='"'||Q==="'")&&(G===0||X[G-1]!=="\\"))if(!Y)Y=!0,J=Q;else if(Q===J)Y=!1;else Z+=Q;else if(Q===","&&!Y)$.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())$.push(Z.trim());return $.map((G)=>{let Q=G.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var wG=E(()=>{w1();M5()});function Y5(X,$){if(typeof X!=="string"||X.length===0)throw Error(`@appearanceBootstrap ${$} must be a non-empty string`)}function uB(X){if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap expects an options object");let $=X,Z=$.appearance,Y=$.colorMode;if(Y5($.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(Y5(Z.key,"appearance.key"),Y5(Z.attribute,"appearance.attribute"),Y5(Z.default,"appearance.default"),Y5(Y.key,"colorMode.key"),Y5(Y.attribute,"colorMode.attribute"),Y5(Y.default,"colorMode.default"),!jG.test(Z.key)||!jG.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!zG.test(Z.attribute)||!zG.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Z.allowed.includes(Z.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!hB.has(Y.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:$.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:Y.key,attribute:Y.attribute,default:Y.default}}}function dB(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function mB(X){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${dB(X)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function lB(X,$){let Z=1,Y=null,J=!1;for(let G=$+1;G<X.length;G++){let Q=X[G];if(J){J=!1;continue}if(Y){if(Q==="\\")J=!0;else if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function BG(X,$){let Z=X,Y=/@appearanceBootstrap\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,Q=lB(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let q=Z.slice(G+1,Q).trim(),K=$0(`(${q})`,$),U=mB(uB(K));Z=Z.slice(0,J.index)+U+Z.slice(Q+1),Y.lastIndex=J.index+U.length}return Z}var zG,jG,hB;var _G=E(()=>{O0();zG=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,jG=/^[A-Za-z_$][\w$]*$/,hB=new Set(["light","dark","system"])});import cB from"crypto";function B0(X){return String(X??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function v8(X,$,Z,Y){let J=X||$;return Z?`${J} ${Y}`:J}function l0(X){return String(X).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function P5(X,$){if(/\bid\s*=/i.test(X))return"";return` id="${B0($)}"`}function y3(X,$,Z){if(!$)return"";let Y="";if(!/\baria-invalid\s*=/i.test(Z))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))Y+=` aria-describedby="${B0(`${l0(X)}-error`)}"`;return Y}function pB(){return cB.randomUUID()}function x8(X,$){let Z=X;return Z=Z.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let Y=pB();$.csrf={token:Y}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${B0($.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,J)=>{let G=J.toUpperCase();if(J&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${B0(G)}">`;return Y}),Z}function LG(X,$,Z=OG){let Y=X;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,G,Q,q,K,U="")=>{let W=G||Q||"POST",w=q||K||"",z=S1(U),B=W.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${B0(j)}" action="${B0(w)}"${z?` ${z}`:""}>`;if(_+=`
13208
13281
  ${x8("@csrf",$)}`,!["GET","POST"].includes(B))_+=`
13209
- ${x8(`@method('${B}')`,$)}`;return _}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,q,K,U="")=>{let W=G||Q||"",w=q||K||"",z=S1(U),B=v7(W,$),j=B!==void 0&&B!==null?B:w||"",_=z.match(/type=['"]([^'"]+)['"]/i),H=_?_[1]:"text",L=x7(W,$),O=z.match(/class=['"]([^'"]+)['"]/i),F=v8(O?O[1]:"",Z.input,L,Z.inputError),V=z.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${B0(H)}" name="${B0(W)}"${C5(z,c0(W))} value="${B0(j)}" class="${F}"${T3(W,L,z)}${V?` ${V}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,G,Q="",q="")=>{let K=S1(Q),U=v7(G,$)||q.trim(),W=x7(G,$),w=K.match(/class=['"]([^'"]+)['"]/i),z=v8(w?w[1]:"",Z.input,W,Z.inputError),B=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${B0(G)}"${C5(K,c0(G))} class="${z}"${T3(G,W,K)}${B?` ${B}`:""}>${B0(U)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,G,Q="",q)=>{let K=S1(Q),U=v7(G,$),W=x7(G,$),w=K.match(/class=['"]([^'"]+)['"]/i),z=v8(w?w[1]:"",Z.input,W,Z.inputError),B=K.replace(/class=['"][^'"]+['"]/i,""),j=q;if(U!==void 0)j=q.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,H,L)=>{if((Array.isArray(U)?U.some((F)=>String(F)===L):String(U)===L)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return _});return`<select name="${B0(G)}"${C5(K,c0(G))} class="${z}"${T3(G,W,K)}${B?` ${B}`:""}>${j}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,q="")=>{let K=Q===void 0?"1":Q,U=Q===void 0?c0(G):`${c0(G)}-${c0(K)}`,W=S1(q),w=v7(G,$),z=w!==void 0&&(Array.isArray(w)?w.some((H)=>String(H)===K):w===!0||String(w)===K),B=W.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:Z.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${B0(G)}"${C5(W,U)} value="${B0(K)}" class="${j}"${z?" checked":""}${_?` ${_}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,q="")=>{let K=S1(q),U=v7(G,$),W=U!==void 0&&U===Q,w=K.match(/class=['"]([^'"]+)['"]/i),z=w?w[1]:Z.checkInput,B=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${B0(G)}"${C5(K,`${c0(G)}-${c0(Q)}`)} value="${B0(Q)}" class="${z}"${W?" checked":""}${B?` ${B}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q="")=>{let q=S1(Q),K=q.match(/accept=['"]([^'"]+)['"]/i),U=K?K[1]:"",W=q.includes("multiple"),w=x7(G,$),z=q.match(/class=['"]([^'"]+)['"]/i),B=v8(z?z[1]:"",Z.input,w,Z.inputError),j=q.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${B0(G)}"${C5(q,c0(G))}`,`class="${B}"`];if(U)_.push(`accept="${B0(U)}"`);if(W)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,G,Q="",q)=>{let K=S1(Q),U=K.match(/class=['"]([^'"]+)['"]/i),W=U?U[1]:Z.label,w=K.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${B0(c0(G))}" class="${W}"${w?` ${w}`:""}>${q}</label>`}),Y}function KG(X,$,Z=QG){return X.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,J,G)=>{try{if(x7(J,$)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(q,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return GG(J,$);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(J);return GG(J,$)}let U=K.trim();if(G0(U)){let W=$0(U,$);return W!==void 0?String(W):U}return U}catch{return K}});return`<div id="${B0(`${c0(J)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),Y}})}function x7(X,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(X);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,X);return!1}function GG(X,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(X);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,X)){let Z=$.errors[X];return Array.isArray(Z)?Z[0]:String(Z)}return""}function v7(X,$){let Z;if($.old&&typeof $.old==="function")return $.old(X);if($.old&&typeof $.old==="object")return $.old[X];if(X.endsWith("[]")){let Y=X.slice(0,-2);if(Z=$[Y],Z!==void 0)return Z}return $[X]}function S1(X){if(!X.trim())return"";let $=[],Z=X.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=Y.exec(Z))!==null){let[,G,,Q]=J;$.push(`${G}="${Q.trim()}"`)}return $.join(" ")}var QG;var UG=D(()=>{O0();QG={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import k3 from"path";async function vB(){if(f7!==void 0)return f7;try{f7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{f7=null}return f7}function xB(X,$=0){if($<=0)return!1;return Date.now()-X.loadedAt>$}async function fB(X,$){if({...D3,...$.i18n}.cache&&I3[X]){let J=I3[X],G=$.i18n?.cacheMaxAge??0;if(!xB(J,G))return J.translations}if(g7[X]?.state==="loading")return g7[X].promise;N3[X]="loading";let Y=E3(X,$).then((J)=>{return N3[X]="loaded",delete g7[X],J}).catch((J)=>{throw N3[X]="error",g7[X]={promise:Y,state:"error",error:J instanceof Error?J:Error(String(J))},J});return g7[X]={promise:Y,state:"loading"},Y}async function E3(X,$){let Z={...D3,...$.i18n},Y=k3.isAbsolute(Z.translationsDir)?Z.translationsDir:k3.resolve($.root||process.cwd(),Z.translationsDir);try{let J=await vB(),G=J?await J(X,{translationsDir:Y,defaultLocale:Z.defaultLocale,sources:mB(Z.format)}):await gB(X,Z,Y);if(G===void 0){if(X!==Z.defaultLocale)return E3(Z.defaultLocale,$);return{}}let Q=G;if(Z.cache)I3[X]={translations:Q,loadedAt:Date.now(),locale:X};return Q}catch(J){if($.debug)console.error(`Error loading translation file for locale "${X}":`,J);if(X!==Z.defaultLocale)return E3(Z.defaultLocale,$);return{}}}async function gB(X,$,Z){let Y=k3.join(Z,`${X}${hB($.format)}`);try{let J=await import(Y);return J.default||J}catch(J){try{let G=await Bun.file(Y).text();if($.format==="yaml"||$.format==="yml")return uB(G);if($.format==="json")return JSON.parse(G);throw J}catch{return}}}function hB(X){switch(X){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function uB(X){let $={},Z=X.split(`
13210
- `),Y=[{obj:$,indent:-1}];for(let J of Z){let G=J.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let q=Y[Y.length-1].obj,K=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(K){let[,,U,W]=K,w=U.trim(),z=W.trim();if(z==="")q[w]={},Y.push({obj:q[w],indent:Q});else q[w]=dB(z)}}return $}function dB(X){if(X.startsWith("'")&&X.endsWith("'")||X.startsWith('"')&&X.endsWith('"'))return X.slice(1,-1);let $=X.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let Z=Number(X);if(!Number.isNaN(Z)&&X!=="")return Z;return X}function mB(X){switch(X){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function lB(X,$){return fB(X,$)}function cB(X,$){for(let Z of X){let Y=Z.trim(),J=Y.match(/^\{(\d+)\}\s*(.*)$/);if(J){let Q=Number.parseInt(J[1],10);if($===Q)return J[2];continue}let G=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10),q=G[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(G[2],10);if($>=Q&&$<=q)return G[3];continue}}if(X.length===2)return $===1?X[0].trim():X[1].trim();if($<X.length)return X[$].trim();return X[X.length-1].trim()}function pB(X,$={}){return zG(X,$)}function zG(X,$){let Z="",Y=0;while(Y<X.length)if(X[Y]==="{"){let J=iB(X,Y);if(J===-1){Z+=X[Y],Y++;continue}let G=X.slice(Y+1,J);Z+=nB(G,$),Y=J+1}else if(X[Y]==="'"&&Y+1<X.length)if(X[Y+1]==="'")Z+="'",Y+=2;else if(X[Y+1]==="{"||X[Y+1]==="}")Z+=X[Y+1],Y+=2;else Z+=X[Y],Y++;else Z+=X[Y],Y++;return Z}function iB(X,$){let Z=0;for(let Y=$;Y<X.length;Y++)if(X[Y]==="{")Z++;else if(X[Y]==="}"){if(Z--,Z===0)return Y}return-1}function nB(X,$){let Z=rB(X);if(Z.length===0)return`{${X}}`;let Y=Z[0].trim(),J=$[Y];if(Z.length===1)return J!==void 0?String(J):`{${Y}}`;switch(Z[1].trim().toLowerCase()){case"plural":return oB(J,Z.slice(2).join(","),$);case"select":return aB(J,Z.slice(2).join(","));case"selectordinal":return tB(J,Z.slice(2).join(","));case"number":return X_(J,Z[2]?.trim());case"date":return $_(J,Z[2]?.trim());case"time":return Z_(J,Z[2]?.trim());default:return J!==void 0?String(J):`{${X}}`}}function rB(X){let $=[],Z="",Y=0;for(let J=0;J<X.length;J++){let G=X[J];if(G==="{")Y++,Z+=G;else if(G==="}")Y--,Z+=G;else if(G===","&&Y===0)$.push(Z),Z="";else Z+=G}if(Z)$.push(Z);return $}function oB(X,$,Z){let Y=Number(X)||0,J=y3($),G=`=${Y}`;if(J[G])return M3(J[G],Y,Z);let Q=sB(Y);if(J[Q])return M3(J[Q],Y,Z);if(J.other)return M3(J.other,Y,Z);return String(Y)}function M3(X,$,Z){let Y=X.replace(/#/g,String($));return zG(Y,Z)}function sB(X){let $=Math.abs(X),Z=Math.floor($),Y=String(X).includes(".")?String(X).split(".")[1].length:0;if(Z===1&&Y===0)return"one";return"other"}function aB(X,$){let Z=String(X||""),Y=y3($);if(Y[Z])return Y[Z];return Y.other||String(X)}function tB(X,$){let Z=Number(X)||0,Y=y3($),J=eB(Z);if(Y[J])return Y[J].replace(/#/g,String(Z));if(Y.other)return Y.other.replace(/#/g,String(Z));return String(Z)}function eB(X){let $=Math.abs(X),Z=$%10,Y=$%100;if(Z===1&&Y!==11)return"one";if(Z===2&&Y!==12)return"two";if(Z===3&&Y!==13)return"few";return"other"}function y3(X){let $={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=Z.exec(X);while(Y!==null)$[Y[1]]=Y[2],Y=Z.exec(X);return $}function X_(X,$){let Z=Number(X);if(Number.isNaN(Z))return String(X);switch($){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function $_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return Z.toLocaleDateString(void 0,Y)}function Z_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return Z.toLocaleTimeString(void 0,Y)}function Y_(X){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(X)}function WG(X,$,Z=!0,Y={}){let J=X.split("."),G=$;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Z?X:"";let Q=String(G);if(Y_(Q))return pB(Q,Y);if(Q.includes("|")&&"count"in Y){let q=Number(Y.count),K=Q.split("|");Q=cB(K,q)}for(let[q,K]of Object.entries(Y)){let U=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${U}`,"g"),String(K))}return Q}async function jG(X,$,Z,Y){let J=X,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...D3,...Y.i18n},q=await lB(Q.locale,Y);$.__translations=q,$.__locale=Q.locale,$.__i18nConfig=Q,J=await wG(J,G,async(W,w,z,B,j)=>{try{let _={};if(z)try{let L=[()=>JSON.parse(z),()=>{let O=`{"data":${z}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return H0(z,$)}];for(let O of L)try{if(_=O(),Object.keys(_).length>0)break}catch{}}catch(L){if(Y.debug)console.error("Error parsing parameters for @translate directive:",L)}return WG(w,q,Q.fallbackToKey,_)||B.trim()}catch(_){if(Y.debug)console.error("Error processing @translate directive:",_);return X0("Translate",`Error in @translate('${w}'): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR)}});let K=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let W=[...J.matchAll(K)];console.warn(`Found ${W.length} @translate matches`),W.forEach((w,z)=>console.warn(`Match ${z}: ${w[0]}, Key: ${w[1]}, Params: ${w[2]||"none"}`))}return J=await wG(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(W,w,z,B)=>{try{let j={};if(z)try{let _=[()=>JSON.parse(z),()=>{let H=`{"data":${z}}`,L=JSON.parse(H);return typeof L.data==="object"?L.data:{}},()=>{return H0(z,$)}];for(let H of _)try{if(j=H(),Object.keys(j).length>0)break}catch{}}catch(_){if(Y.debug)console.error("Error parsing parameters for @translate directive:",_)}return WG(w,q,Q.fallbackToKey,j)}catch(j){if(Y.debug)console.error("Error processing @translate directive:",j);return X0("Translate",`Error in @translate('${w}'): ${j instanceof Error?j.message:String(j)}`,s.EVALUATION_ERROR)}}),J}async function wG(X,$,Z){let Y=[];return X.replace($,(G,...Q)=>{let q=Z(G,...Q).then((K)=>({match:G,replacement:K}));return Y.push(q),G}),(await Promise.all(Y)).reduce((G,{match:Q,replacement:q})=>G.replace(Q,q),X)}var f7,D3,I3,g7,N3;var BG=D(()=>{w1();O0();D3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},I3={},g7={},N3={}});var C3={};n(C3,{streamingSuspenseDirective:()=>OG,streamToResponse:()=>__,streamTemplateSimple:()=>w_,streamTemplate:()=>G_,renderStreamingPage:()=>q_,registerStreamingDirectives:()=>j_,processStreamDirectives:()=>U_,processSectionDirectives:()=>B_,islandDirective:()=>LG,generateHydrationRuntime:()=>H_,extractStreamBoundaries:()=>W_,createStreamRenderer:()=>z_,buildSuspenseResolveScript:()=>S3,SUSPENSE_RESOLVER_RUNTIME:()=>HG});import f8 from"path";function J_(X){let $=[],Z=0,Y;_G.lastIndex=0;while((Y=_G.exec(X))!==null){if(Y.index>Z){let Q=X.slice(Z,Y.index);if(Q.trim())$.push({type:$.length===0?"shell":"content",content:Q})}let J=Y[1],G=Y[2];$.push({type:"suspense",name:J,content:G}),Z=Y.index+Y[0].length}if(Z<X.length){let J=X.slice(Z);if(J.trim())$.push({type:$.length===0?"shell":"content",content:J})}if($.length===0)$.push({type:"shell",content:X});return $}async function G_(X,$={},Z={}){let Y={...e1,...Z,streaming:{...b3,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),q=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),K=q?q[1]:"",U=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...$,__filename:X,__dirname:f8.dirname(X)};if(K.trim())await i1(K,W,X);let w=J_(U),z=new Set;if(!w.some((j)=>j.type==="suspense")){let j=Y.streaming?.strategy||"auto",_=new RegExp(Y5.source,"g");if(!(j!=="manual"&&_.test(U))){let L=await R0(U,W,X,Y,z);for(let O=0;O<L.length;O+=J)G.enqueue(L.slice(O,O+J)),await new Promise((F)=>setTimeout(F,0))}else{let L=[],O=new RegExp(Y5.source,"g"),F;while((F=O.exec(U))!==null)L.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of L){if(A.start>V){let T=U.slice(V,A.start);if(T.trim()){let N=await R0(T,W,X,Y,z);G.enqueue(N),await new Promise((k)=>setTimeout(k,0))}}let R=await R0(A.content,W,X,Y,z);G.enqueue(R),await new Promise((T)=>setTimeout(T,0)),V=A.end}if(V<U.length){let A=U.slice(V);if(A.trim()){let R=await R0(A,W,X,Y,z);G.enqueue(R)}}}}else{let j=new Map;for(let H of w)if(H.type==="shell"||H.type==="content"){let L=await R0(H.content,W,X,Y,z);G.enqueue(L)}else if(H.type==="suspense"&&H.name){let L=`stx-suspense-${H.name}`;G.enqueue(`<div id="${L}" data-suspense="${H.name}" style="display:contents;">
13282
+ ${x8(`@method('${B}')`,$)}`;return _}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,q,K,U="")=>{let W=G||Q||"",w=q||K||"",z=S1(U),B=x7(W,$),j=B!==void 0&&B!==null?B:w||"",_=z.match(/type=['"]([^'"]+)['"]/i),H=_?_[1]:"text",L=f7(W,$),O=z.match(/class=['"]([^'"]+)['"]/i),F=v8(O?O[1]:"",Z.input,L,Z.inputError),V=z.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${B0(H)}" name="${B0(W)}"${P5(z,l0(W))} value="${B0(j)}" class="${F}"${y3(W,L,z)}${V?` ${V}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,G,Q="",q="")=>{let K=S1(Q),U=x7(G,$)||q.trim(),W=f7(G,$),w=K.match(/class=['"]([^'"]+)['"]/i),z=v8(w?w[1]:"",Z.input,W,Z.inputError),B=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${B0(G)}"${P5(K,l0(G))} class="${z}"${y3(G,W,K)}${B?` ${B}`:""}>${B0(U)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,G,Q="",q)=>{let K=S1(Q),U=x7(G,$),W=f7(G,$),w=K.match(/class=['"]([^'"]+)['"]/i),z=v8(w?w[1]:"",Z.input,W,Z.inputError),B=K.replace(/class=['"][^'"]+['"]/i,""),j=q;if(U!==void 0)j=q.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,H,L)=>{if((Array.isArray(U)?U.some((F)=>String(F)===L):String(U)===L)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return _});return`<select name="${B0(G)}"${P5(K,l0(G))} class="${z}"${y3(G,W,K)}${B?` ${B}`:""}>${j}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,q="")=>{let K=Q===void 0?"1":Q,U=Q===void 0?l0(G):`${l0(G)}-${l0(K)}`,W=S1(q),w=x7(G,$),z=w!==void 0&&(Array.isArray(w)?w.some((H)=>String(H)===K):w===!0||String(w)===K),B=W.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:Z.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${B0(G)}"${P5(W,U)} value="${B0(K)}" class="${j}"${z?" checked":""}${_?` ${_}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,q="")=>{let K=S1(q),U=x7(G,$),W=U!==void 0&&U===Q,w=K.match(/class=['"]([^'"]+)['"]/i),z=w?w[1]:Z.checkInput,B=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${B0(G)}"${P5(K,`${l0(G)}-${l0(Q)}`)} value="${B0(Q)}" class="${z}"${W?" checked":""}${B?` ${B}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q="")=>{let q=S1(Q),K=q.match(/accept=['"]([^'"]+)['"]/i),U=K?K[1]:"",W=q.includes("multiple"),w=f7(G,$),z=q.match(/class=['"]([^'"]+)['"]/i),B=v8(z?z[1]:"",Z.input,w,Z.inputError),j=q.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${B0(G)}"${P5(q,l0(G))}`,`class="${B}"`];if(U)_.push(`accept="${B0(U)}"`);if(W)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,G,Q="",q)=>{let K=S1(Q),U=K.match(/class=['"]([^'"]+)['"]/i),W=U?U[1]:Z.label,w=K.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${B0(l0(G))}" class="${W}"${w?` ${w}`:""}>${q}</label>`}),Y}function FG(X,$,Z=OG){return X.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,J,G)=>{try{if(f7(J,$)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(q,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return HG(J,$);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(J);return HG(J,$)}let U=K.trim();if(G0(U)){let W=$0(U,$);return W!==void 0?String(W):U}return U}catch{return K}});return`<div id="${B0(`${l0(J)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),Y}})}function f7(X,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(X);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,X);return!1}function HG(X,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(X);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,X)){let Z=$.errors[X];return Array.isArray(Z)?Z[0]:String(Z)}return""}function x7(X,$){let Z;if($.old&&typeof $.old==="function")return $.old(X);if($.old&&typeof $.old==="object")return $.old[X];if(X.endsWith("[]")){let Y=X.slice(0,-2);if(Z=$[Y],Z!==void 0)return Z}return $[X]}function S1(X){if(!X.trim())return"";let $=[],Z=X.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=Y.exec(Z))!==null){let[,G,,Q]=J;$.push(`${G}="${Q.trim()}"`)}return $.join(" ")}var OG;var VG=E(()=>{O0();OG={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import C3 from"path";async function iB(){if(g7!==void 0)return g7;try{g7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{g7=null}return g7}function nB(X,$=0){if($<=0)return!1;return Date.now()-X.loadedAt>$}async function rB(X,$){if({...x3,...$.i18n}.cache&&P3[X]){let J=P3[X],G=$.i18n?.cacheMaxAge??0;if(!nB(J,G))return J.translations}if(h7[X]?.state==="loading")return h7[X].promise;b3[X]="loading";let Y=v3(X,$).then((J)=>{return b3[X]="loaded",delete h7[X],J}).catch((J)=>{throw b3[X]="error",h7[X]={promise:Y,state:"error",error:J instanceof Error?J:Error(String(J))},J});return h7[X]={promise:Y,state:"loading"},Y}async function v3(X,$){let Z={...x3,...$.i18n},Y=C3.isAbsolute(Z.translationsDir)?Z.translationsDir:C3.resolve($.root||process.cwd(),Z.translationsDir);try{let J=await iB(),G=J?await J(X,{translationsDir:Y,defaultLocale:Z.defaultLocale,sources:eB(Z.format)}):await oB(X,Z,Y);if(G===void 0){if(X!==Z.defaultLocale)return v3(Z.defaultLocale,$);return{}}let Q=G;if(Z.cache)P3[X]={translations:Q,loadedAt:Date.now(),locale:X};return Q}catch(J){if($.debug)console.error(`Error loading translation file for locale "${X}":`,J);if(X!==Z.defaultLocale)return v3(Z.defaultLocale,$);return{}}}async function oB(X,$,Z){let Y=C3.join(Z,`${X}${sB($.format)}`);try{let J=await import(Y);return J.default||J}catch(J){try{let G=await Bun.file(Y).text();if($.format==="yaml"||$.format==="yml")return aB(G);if($.format==="json")return JSON.parse(G);throw J}catch{return}}}function sB(X){switch(X){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function aB(X){let $={},Z=X.split(`
13283
+ `),Y=[{obj:$,indent:-1}];for(let J of Z){let G=J.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let q=Y[Y.length-1].obj,K=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(K){let[,,U,W]=K,w=U.trim(),z=W.trim();if(z==="")q[w]={},Y.push({obj:q[w],indent:Q});else q[w]=tB(z)}}return $}function tB(X){if(X.startsWith("'")&&X.endsWith("'")||X.startsWith('"')&&X.endsWith('"'))return X.slice(1,-1);let $=X.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let Z=Number(X);if(!Number.isNaN(Z)&&X!=="")return Z;return X}function eB(X){switch(X){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function X_(X,$){return rB(X,$)}function $_(X,$){for(let Z of X){let Y=Z.trim(),J=Y.match(/^\{(\d+)\}\s*(.*)$/);if(J){let Q=Number.parseInt(J[1],10);if($===Q)return J[2];continue}let G=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10),q=G[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(G[2],10);if($>=Q&&$<=q)return G[3];continue}}if(X.length===2)return $===1?X[0].trim():X[1].trim();if($<X.length)return X[$].trim();return X[X.length-1].trim()}function Z_(X,$={}){return NG(X,$)}function NG(X,$){let Z="",Y=0;while(Y<X.length)if(X[Y]==="{"){let J=Y_(X,Y);if(J===-1){Z+=X[Y],Y++;continue}let G=X.slice(Y+1,J);Z+=J_(G,$),Y=J+1}else if(X[Y]==="'"&&Y+1<X.length)if(X[Y+1]==="'")Z+="'",Y+=2;else if(X[Y+1]==="{"||X[Y+1]==="}")Z+=X[Y+1],Y+=2;else Z+=X[Y],Y++;else Z+=X[Y],Y++;return Z}function Y_(X,$){let Z=0;for(let Y=$;Y<X.length;Y++)if(X[Y]==="{")Z++;else if(X[Y]==="}"){if(Z--,Z===0)return Y}return-1}function J_(X,$){let Z=G_(X);if(Z.length===0)return`{${X}}`;let Y=Z[0].trim(),J=$[Y];if(Z.length===1)return J!==void 0?String(J):`{${Y}}`;switch(Z[1].trim().toLowerCase()){case"plural":return Q_(J,Z.slice(2).join(","),$);case"select":return K_(J,Z.slice(2).join(","));case"selectordinal":return U_(J,Z.slice(2).join(","));case"number":return w_(J,Z[2]?.trim());case"date":return z_(J,Z[2]?.trim());case"time":return j_(J,Z[2]?.trim());default:return J!==void 0?String(J):`{${X}}`}}function G_(X){let $=[],Z="",Y=0;for(let J=0;J<X.length;J++){let G=X[J];if(G==="{")Y++,Z+=G;else if(G==="}")Y--,Z+=G;else if(G===","&&Y===0)$.push(Z),Z="";else Z+=G}if(Z)$.push(Z);return $}function Q_(X,$,Z){let Y=Number(X)||0,J=f3($),G=`=${Y}`;if(J[G])return S3(J[G],Y,Z);let Q=q_(Y);if(J[Q])return S3(J[Q],Y,Z);if(J.other)return S3(J.other,Y,Z);return String(Y)}function S3(X,$,Z){let Y=X.replace(/#/g,String($));return NG(Y,Z)}function q_(X){let $=Math.abs(X),Z=Math.floor($),Y=String(X).includes(".")?String(X).split(".")[1].length:0;if(Z===1&&Y===0)return"one";return"other"}function K_(X,$){let Z=String(X||""),Y=f3($);if(Y[Z])return Y[Z];return Y.other||String(X)}function U_(X,$){let Z=Number(X)||0,Y=f3($),J=W_(Z);if(Y[J])return Y[J].replace(/#/g,String(Z));if(Y.other)return Y.other.replace(/#/g,String(Z));return String(Z)}function W_(X){let $=Math.abs(X),Z=$%10,Y=$%100;if(Z===1&&Y!==11)return"one";if(Z===2&&Y!==12)return"two";if(Z===3&&Y!==13)return"few";return"other"}function f3(X){let $={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=Z.exec(X);while(Y!==null)$[Y[1]]=Y[2],Y=Z.exec(X);return $}function w_(X,$){let Z=Number(X);if(Number.isNaN(Z))return String(X);switch($){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function z_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return Z.toLocaleDateString(void 0,Y)}function j_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return Z.toLocaleTimeString(void 0,Y)}function B_(X){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(X)}function AG(X,$,Z=!0,Y={}){let J=X.split("."),G=$;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Z?X:"";let Q=String(G);if(B_(Q))return Z_(Q,Y);if(Q.includes("|")&&"count"in Y){let q=Number(Y.count),K=Q.split("|");Q=$_(K,q)}for(let[q,K]of Object.entries(Y)){let U=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${U}`,"g"),String(K))}return Q}async function TG(X,$,Z,Y){let J=X,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...x3,...Y.i18n},q=await X_(Q.locale,Y);$.__translations=q,$.__locale=Q.locale,$.__i18nConfig=Q,J=await RG(J,G,async(W,w,z,B,j)=>{try{let _={};if(z)try{let L=[()=>JSON.parse(z),()=>{let O=`{"data":${z}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return H0(z,$)}];for(let O of L)try{if(_=O(),Object.keys(_).length>0)break}catch{}}catch(L){if(Y.debug)console.error("Error parsing parameters for @translate directive:",L)}return AG(w,q,Q.fallbackToKey,_)||B.trim()}catch(_){if(Y.debug)console.error("Error processing @translate directive:",_);return X0("Translate",`Error in @translate('${w}'): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR)}});let K=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let W=[...J.matchAll(K)];console.warn(`Found ${W.length} @translate matches`),W.forEach((w,z)=>console.warn(`Match ${z}: ${w[0]}, Key: ${w[1]}, Params: ${w[2]||"none"}`))}return J=await RG(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(W,w,z,B)=>{try{let j={};if(z)try{let _=[()=>JSON.parse(z),()=>{let H=`{"data":${z}}`,L=JSON.parse(H);return typeof L.data==="object"?L.data:{}},()=>{return H0(z,$)}];for(let H of _)try{if(j=H(),Object.keys(j).length>0)break}catch{}}catch(_){if(Y.debug)console.error("Error parsing parameters for @translate directive:",_)}return AG(w,q,Q.fallbackToKey,j)}catch(j){if(Y.debug)console.error("Error processing @translate directive:",j);return X0("Translate",`Error in @translate('${w}'): ${j instanceof Error?j.message:String(j)}`,s.EVALUATION_ERROR)}}),J}async function RG(X,$,Z){let Y=[];return X.replace($,(G,...Q)=>{let q=Z(G,...Q).then((K)=>({match:G,replacement:K}));return Y.push(q),G}),(await Promise.all(Y)).reduce((G,{match:Q,replacement:q})=>G.replace(Q,q),X)}var g7,x3,P3,h7,b3;var MG=E(()=>{w1();O0();x3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},P3={},h7={},b3={}});var u3={};n(u3,{streamingSuspenseDirective:()=>EG,streamToResponse:()=>k_,streamTemplateSimple:()=>R_,streamTemplate:()=>H_,renderStreamingPage:()=>L_,registerStreamingDirectives:()=>T_,processStreamDirectives:()=>V_,processSectionDirectives:()=>M_,islandDirective:()=>DG,generateHydrationRuntime:()=>I_,extractStreamBoundaries:()=>A_,createStreamRenderer:()=>N_,buildSuspenseResolveScript:()=>h3,SUSPENSE_RESOLVER_RUNTIME:()=>IG});import f8 from"path";function __(X){let $=[],Z=0,Y;kG.lastIndex=0;while((Y=kG.exec(X))!==null){if(Y.index>Z){let Q=X.slice(Z,Y.index);if(Q.trim())$.push({type:$.length===0?"shell":"content",content:Q})}let J=Y[1],G=Y[2];$.push({type:"suspense",name:J,content:G}),Z=Y.index+Y[0].length}if(Z<X.length){let J=X.slice(Z);if(J.trim())$.push({type:$.length===0?"shell":"content",content:J})}if($.length===0)$.push({type:"shell",content:X});return $}async function H_(X,$={},Z={}){let Y={...X5,...Z,streaming:{...g3,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),q=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),K=q?q[1]:"",U=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...$,__filename:X,__dirname:f8.dirname(X)};if(K.trim())await i1(K,W,X);let w=__(U),z=new Set;if(!w.some((j)=>j.type==="suspense")){let j=Y.streaming?.strategy||"auto",_=new RegExp(J5.source,"g");if(!(j!=="manual"&&_.test(U))){let L=await R0(U,W,X,Y,z);for(let O=0;O<L.length;O+=J)G.enqueue(L.slice(O,O+J)),await new Promise((F)=>setTimeout(F,0))}else{let L=[],O=new RegExp(J5.source,"g"),F;while((F=O.exec(U))!==null)L.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of L){if(A.start>V){let N=U.slice(V,A.start);if(N.trim()){let T=await R0(N,W,X,Y,z);G.enqueue(T),await new Promise((k)=>setTimeout(k,0))}}let R=await R0(A.content,W,X,Y,z);G.enqueue(R),await new Promise((N)=>setTimeout(N,0)),V=A.end}if(V<U.length){let A=U.slice(V);if(A.trim()){let R=await R0(A,W,X,Y,z);G.enqueue(R)}}}}else{let j=new Map;for(let H of w)if(H.type==="shell"||H.type==="content"){let L=await R0(H.content,W,X,Y,z);G.enqueue(L)}else if(H.type==="suspense"&&H.name){let L=`stx-suspense-${H.name}`;G.enqueue(`<div id="${L}" data-suspense="${H.name}" style="display:contents;">
13211
13284
  <template data-suspense-fallback>Loading...</template>
13212
13285
  </div>`),j.set(H.name,R0(H.content,W,X,Y,z))}G.enqueue(`
13213
13286
  <script>
@@ -13225,13 +13298,13 @@ ${J}`)}function iJ(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*
13225
13298
  }
13226
13299
  };
13227
13300
  })();
13228
- </script>`);let _=Array.from(j.entries()).map(async([H,L])=>{G.enqueue(await S3(H,L))});await Promise.all(_)}G.close()}catch(Q){G.error(Q)}}})}async function S3(X,$){try{let Y=(await $).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
13301
+ </script>`);let _=Array.from(j.entries()).map(async([H,L])=>{G.enqueue(await h3(H,L))});await Promise.all(_)}G.close()}catch(Q){G.error(Q)}}})}async function h3(X,$){try{let Y=(await $).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
13229
13302
  <script>
13230
13303
  window.__stxSuspense.resolve('${X}', \`${Y}\`);
13231
13304
  </script>`}catch(Z){let Y=Z instanceof Error?Z.message:String(Z);return`
13232
13305
  <script>
13233
- window.__stxSuspense.resolve('${X}', '<div class="stx-error">Error loading content: ${o0(Y)}</div>');
13234
- </script>`}}function Q_(X,$,Z){if(!$||$<=0)return X;let Y,J=new Promise((G,Q)=>{Y=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${$}ms`)),$)});return Promise.race([X,J]).finally(()=>clearTimeout(Y))}function q_(X,$=[],Z={}){let Y=Z.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue(X),$.length>0)J.enqueue(HG),await Promise.all($.map(async(G)=>{let Q=Q_(G.render(),Y,G.id);J.enqueue(await S3(G.id,Q))}));J.close()}catch(G){J.error(G)}}})}function U_(X,$){return X.replace(K_,(Z,Y,J)=>{let G=Y.trim(),Q=J.split(/@fallback/i),q=Q[0].trim(),K=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!$.__streamTemplates)$.__streamTemplates={};return $.__streamTemplates[G]=q,`<div data-suspense="${G}">${K}</div>`})}function W_(X){let $=X?.streamBoundaries;if(!$||typeof $!=="object")return;let Z=Object.entries($).filter(([,Y])=>typeof Y==="function");return Z.length>0?Z.map(([Y,J])=>({id:Y,render:J})):void 0}async function w_(X,$={},Z={}){let Y={...e1,...Z,streaming:{...b3,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),q=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),K=q?q[1]:"",U=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...$,__filename:X,__dirname:f8.dirname(X)};if(K.trim())await i1(K,W,X);let w=new Set,z=Y.streaming?.strategy||"auto",B=new RegExp(Y5.source,"g");if(!(z!=="manual"&&B.test(U))){let _=await R0(U,W,X,Y,w);for(let H=0;H<_.length;H+=J)G.enqueue(_.slice(H,H+J))}else{let _=[],H=new RegExp(Y5.source,"g"),L;while((L=H.exec(U))!==null)_.push({name:L[1],content:L[2],start:L.index,end:L.index+L[0].length});let O=0;for(let F of _){if(F.start>O){let A=U.slice(O,F.start);if(A.trim()){let R=await R0(A,W,X,Y,w);G.enqueue(R)}}let V=await R0(F.content,W,X,Y,w);G.enqueue(V),O=F.end}if(O<U.length){let F=U.slice(O);if(F.trim()){let V=await R0(F,W,X,Y,w);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function z_(X,$={}){let Z={...e1,...$,streaming:{...b3,...$.streaming}},Y=await Bun.file(X).text(),J=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=J?J[1]:"",Q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),q=Q,K={},U;Y5.lastIndex=0;while((U=Y5.exec(Q))!==null){let z=U[1],B=U[2];K[z]=B}let W=Q.replace(Y5,"");return{renderShell:async(z={})=>{let B={...z,__filename:X,__dirname:f8.dirname(X)};return await i1(G,B,X),R0(W,B,X,Z,new Set)},renderSection:async(z,B={})=>{try{if(!K[z])return`<div class="error-message">Section "${o0(z)}" not found in template "${o0(X)}"</div>`;let j={...B,__filename:X,__dirname:f8.dirname(X)};await i1(G,j,X);let _=new Set;return await R0(K[z],j,X,Z,_)}catch(j){let _=j instanceof Error?j.message:String(j);return U0("Expression",_,X,K[z]||"",0,K[z]||"")}},getSections:()=>{return Object.keys(K)},getTemplate:()=>{return q}}}function j_(X={}){let $=[];if(X.streaming?.enabled)$.push(OG);if(X.hydration?.enabled)$.push(LG);return $}async function B_(X,$,Z,Y={}){return X}function __(X,$={}){let Z=new TextEncoder,Y=X.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),J=new Headers($.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(Y,{...$,headers:J})}function H_(X={mode:"full"}){let{mode:$,components:Z={},dynamicImports:Y=!0}=X,J=Object.entries(Z).map(([G,Q])=>`'${G}': ${Y?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
13306
+ window.__stxSuspense.resolve('${X}', '<div class="stx-error">Error loading content: ${r0(Y)}</div>');
13307
+ </script>`}}function O_(X,$,Z){if(!$||$<=0)return X;let Y,J=new Promise((G,Q)=>{Y=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${$}ms`)),$)});return Promise.race([X,J]).finally(()=>clearTimeout(Y))}function L_(X,$=[],Z={}){let Y=Z.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue(X),$.length>0)J.enqueue(IG),await Promise.all($.map(async(G)=>{let Q=O_(G.render(),Y,G.id);J.enqueue(await h3(G.id,Q))}));J.close()}catch(G){J.error(G)}}})}function V_(X,$){return X.replace(F_,(Z,Y,J)=>{let G=Y.trim(),Q=J.split(/@fallback/i),q=Q[0].trim(),K=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!$.__streamTemplates)$.__streamTemplates={};return $.__streamTemplates[G]=q,`<div data-suspense="${G}">${K}</div>`})}function A_(X){let $=X?.streamBoundaries;if(!$||typeof $!=="object")return;let Z=Object.entries($).filter(([,Y])=>typeof Y==="function");return Z.length>0?Z.map(([Y,J])=>({id:Y,render:J})):void 0}async function R_(X,$={},Z={}){let Y={...X5,...Z,streaming:{...g3,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),q=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),K=q?q[1]:"",U=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...$,__filename:X,__dirname:f8.dirname(X)};if(K.trim())await i1(K,W,X);let w=new Set,z=Y.streaming?.strategy||"auto",B=new RegExp(J5.source,"g");if(!(z!=="manual"&&B.test(U))){let _=await R0(U,W,X,Y,w);for(let H=0;H<_.length;H+=J)G.enqueue(_.slice(H,H+J))}else{let _=[],H=new RegExp(J5.source,"g"),L;while((L=H.exec(U))!==null)_.push({name:L[1],content:L[2],start:L.index,end:L.index+L[0].length});let O=0;for(let F of _){if(F.start>O){let A=U.slice(O,F.start);if(A.trim()){let R=await R0(A,W,X,Y,w);G.enqueue(R)}}let V=await R0(F.content,W,X,Y,w);G.enqueue(V),O=F.end}if(O<U.length){let F=U.slice(O);if(F.trim()){let V=await R0(F,W,X,Y,w);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function N_(X,$={}){let Z={...X5,...$,streaming:{...g3,...$.streaming}},Y=await Bun.file(X).text(),J=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=J?J[1]:"",Q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),q=Q,K={},U;J5.lastIndex=0;while((U=J5.exec(Q))!==null){let z=U[1],B=U[2];K[z]=B}let W=Q.replace(J5,"");return{renderShell:async(z={})=>{let B={...z,__filename:X,__dirname:f8.dirname(X)};return await i1(G,B,X),R0(W,B,X,Z,new Set)},renderSection:async(z,B={})=>{try{if(!K[z])return`<div class="error-message">Section "${r0(z)}" not found in template "${r0(X)}"</div>`;let j={...B,__filename:X,__dirname:f8.dirname(X)};await i1(G,j,X);let _=new Set;return await R0(K[z],j,X,Z,_)}catch(j){let _=j instanceof Error?j.message:String(j);return U0("Expression",_,X,K[z]||"",0,K[z]||"")}},getSections:()=>{return Object.keys(K)},getTemplate:()=>{return q}}}function T_(X={}){let $=[];if(X.streaming?.enabled)$.push(EG);if(X.hydration?.enabled)$.push(DG);return $}async function M_(X,$,Z,Y={}){return X}function k_(X,$={}){let Z=new TextEncoder,Y=X.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),J=new Headers($.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(Y,{...$,headers:J})}function I_(X={mode:"full"}){let{mode:$,components:Z={},dynamicImports:Y=!0}=X,J=Object.entries(Z).map(([G,Q])=>`'${G}': ${Y?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
13235
13308
  `);if($==="loader")return`
13236
13309
  (function() {
13237
13310
  window.__stx = window.__stx || {};
@@ -13373,7 +13446,7 @@ else {
13373
13446
  else {
13374
13447
  stx.hydrate();
13375
13448
  }
13376
- })();`}var b3,Y5,_G,HG=`
13449
+ })();`}var g3,J5,kG,IG=`
13377
13450
  <script>
13378
13451
  (function(){
13379
13452
  window.__stxSuspense = window.__stxSuspense || {
@@ -13393,25 +13466,25 @@ else {
13393
13466
  }
13394
13467
  };
13395
13468
  })();
13396
- </script>`,K_,OG,LG;var P3=D(()=>{V1();Z1();sX();A0();b3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},Y5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,_G=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;K_=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;OG={name:"suspense",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Suspense directive requires a name parameter");let J=$[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${X}<!-- @endsuspense:${J} -->`}},LG={name:"island",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Island directive requires a name parameter");let J=$[0].replace(/['"`]/g,""),G=$[1]?$[1].replace(/['"`]/g,""):"lazy",Q=`island-${J}-${Math.random().toString(36).substring(2,9)}`,q=X.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),K=q?q[1].trim():"",U=q?X.replace(q[0],""):X;return`<div data-island="${J}" data-island-id="${Q}" data-priority="${G}">
13469
+ </script>`,F_,EG,DG;var d3=E(()=>{V1();Z1();sX();A0();g3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},J5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,kG=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;F_=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;EG={name:"suspense",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Suspense directive requires a name parameter");let J=$[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${X}<!-- @endsuspense:${J} -->`}},DG={name:"island",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Island directive requires a name parameter");let J=$[0].replace(/['"`]/g,""),G=$[1]?$[1].replace(/['"`]/g,""):"lazy",Q=`island-${J}-${Math.random().toString(36).substring(2,9)}`,q=X.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),K=q?q[1].trim():"",U=q?X.replace(q[0],""):X;return`<div data-island="${J}" data-island-id="${Q}" data-priority="${G}">
13397
13470
  ${U}
13398
13471
  <script type="application/json" data-island-props="${Q}">
13399
13472
  ${K?`{${K}}`:"{}"}
13400
13473
  </script>
13401
- </div>`}}});var AG={};n(AG,{warnUnbalancedTags:()=>v3,findUnbalancedTags:()=>VG});function P5(X){return X.replace(/[^\n]/g," ")}function VG(X){let $=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,P5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,P5).replace(/<!--[\s\S]*?-->/g,P5).replace(/\{\{\{[\s\S]*?\}\}\}/g,P5).replace(/\{\{[\s\S]*?\}\}/g,P5).replace(/\{!![\s\S]*?!!\}/g,P5),Z=new Map,Y=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=J.exec($))!==null){let q=G[1]==="/",K=G[2],U=G[3]==="/";if(O_.has(K.toLowerCase()))continue;if(U)continue;if(q)Y.set(K,(Y.get(K)??0)+1);else{let W=Z.get(K);if(W)W.count++;else{let w=$.slice(0,G.index).split(`
13402
- `).length;Z.set(K,{count:1,firstLine:w})}}}let Q=[];for(let q of new Set([...Z.keys(),...Y.keys()])){if(L_.has(q.toLowerCase()))continue;let K=Z.get(q)?.count??0,U=Y.get(q)??0;if(K!==U)Q.push({tag:q,opened:K,closed:U,firstOpenLine:Z.get(q)?.firstLine??0})}return Q}function v3(X,$){let Z;try{Z=VG(X)}catch{return}if(Z.length===0)return;let Y=`${$}:${X.length}`;if(FG.has(Y))return;FG.add(Y);let J=$?$.split(/[/\\]/).pop()||$:"template";for(let{tag:G,opened:Q,closed:q,firstOpenLine:K}of Z)if(Q>q){let U=K?` (first opened at line ${K})`:"";console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${q} closed \u2014 an unclosed <${G}>${U} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${q} closed \u2014 ${q-Q} stray </${G}>.`)}var O_,L_,FG;var x3=D(()=>{O_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),L_=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);FG=new Set});import p0 from"path";import f3 from"fs";function RG(X){return X.split("-").map(($)=>$.charAt(0).toUpperCase()+$.slice(1)).join("")}function TG(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class NG{builtins=new Map;registerBuiltin(X){this.builtins.set(X.name.toLowerCase(),X);for(let $ of X.aliases)this.builtins.set($.toLowerCase(),X)}isBuiltin(X){return this.builtins.has(X.toLowerCase())}getBuiltin(X){return this.builtins.get(X.toLowerCase())??null}async resolveFile(X,$,Z,Y){let J=X.endsWith(".stx")?X.slice(0,-4):X,G=Y?.__importedComponents;if(G){let B=[J,J.toLowerCase(),RG(J),TG(J)];for(let j of B)if(G.has(j))return G.get(j)}let Q=[...new Set([`${J}.stx`,`${RG(J)}.stx`,`${TG(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let B=p0.resolve(p0.dirname($),`${J}.stx`);if(await p(B))return B;return null}let q=[],K=Z.componentsDir||"",U=Y?.__originalFilePath;if(U)q.push(p0.join(p0.dirname(U),"components"));if(K)q.push(K);let W=p0.join(p0.dirname($),"components");if(!q.includes(W))q.push(W);let w=process.cwd(),z=[p0.resolve(w,"src/components"),p0.resolve(w,"components"),p0.resolve(import.meta.dir,"components")];for(let B of z)if(!q.includes(B))q.push(B);for(let B of q){if(!B)continue;for(let j of Q){let _=p0.join(B,j);if(await p(_))return _}try{if(!f3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let _=f3.readdirSync(B,{withFileTypes:!0});for(let H of _)if(H.isDirectory()){let L=p0.join(B,H.name);for(let O of Q){let F=p0.join(L,O);if(await p(F))return F}}}catch{}}return null}}var v0;var g3=D(()=>{A0();v0=new NG});function k0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function MG(X){return X.indexOf("\x00")===-1?X:X.replace(/\0/g,"")}var J5="\x00stx-boolean-attribute";function v5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.static)){if($.has(Y))continue;let G=X.staticNames?.[Y]??Y;if(typeof J==="boolean"){if(J)Z.push(k0(G));continue}if(J===J5){Z.push(k0(G));continue}Z.push(`${k0(G)}="${k0(MG(String(J)))}"`)}return Z}var g8=()=>{};function h7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function F_(X){if(X.clientReactive.to)return{value:X.clientReactive.to,reactive:!0};if(X.serverDynamic.to!==void 0)return{value:String(X.serverDynamic.to),reactive:!1};if(typeof X.static.to==="string")return{value:X.static.to,reactive:!1};return{value:"#",reactive:!1}}var h3;var u3=D(()=>{g8();h3={name:"StxLink",aliases:["stx-link"],render(X,$,Z){let Y=F_(X),J=(typeof X.static.class==="string"?X.static.class:"")||(typeof X.static.className==="string"?X.static.className:""),G=typeof X.static.activeClass==="string"?X.static.activeClass:"active",Q=typeof X.static.exactActiveClass==="string"?X.static.exactActiveClass:"exact-active",q=X.static.prefetch===!0||X.static.prefetch==="true"||X.serverDynamic.prefetch===!0,K=[];if(Y.reactive)K.push(`:href="${h7(Y.value)}"`);else K.push(`href="${h7(Y.value)}"`);if(J)K.push(`class="${h7(J)}"`);if(K.push("data-stx-link"),K.push(`data-stx-active-class="${h7(G)}"`),K.push(`data-stx-exact-active-class="${h7(Q)}"`),q)K.push("data-stx-prefetch");let U=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return K.push(...v5(X,U)),`<a ${K.join(" ")}>${$}</a>`}}});function I0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function y0(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function m3(X,$,Z=!1){let Y=X.serverDynamic[$];if(Y!==void 0)return Y!==!1&&Y!=="false";let J=X.static[$];if(J!==void 0)return J!=="false"&&J!==!1;return Z}function kG(X){if(X.includes("(")||X.includes(","))return X;let $=X.trim().split(/\s+/),Z=[];for(let Y of $)if(Y.includes(":")){let[J,G]=Y.split(":"),Q=V_[J];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let q=Number.parseInt(J);if(!Number.isNaN(q))Z.push(`(max-width: ${q}px) ${G}`)}}else Z.push(Y);return Z.join(", ")}function l3(X,$,Z,Y){return $.map((J)=>`${u7(X,J,void 0,Z,Y)} ${J}w`).join(", ")}function A_(X,$,Z,Y,J){return $.map((G)=>{let Q=Z?Z*G:void 0;return`${u7(X,Q,void 0,Y,J)} ${G}x`}).join(", ")}function u7(X,$,Z,Y,J){if(!Y||Y==="local"||Y==="static")return X;if(Y==="cloudinary"){let G=[];if($)G.push(`w_${$}`);if(Z)G.push(`h_${Z}`);if(J)G.push(`f_${J}`);G.push("q_auto");let Q=G.join(",");return X.replace("/upload/",`/upload/${Q}/`)}if(Y==="imgix"){let G=new URLSearchParams;if($)G.set("w",String($));if(Z)G.set("h",String(Z));if(J)G.set("fm",J);G.set("auto","format");let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}if(Y==="bunny"){let G=new URLSearchParams;if($)G.set("width",String($));if(Z)G.set("height",String(Z));if(J)G.set("format",J);let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}return X}function R_(X,$,Z="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${$}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var V_,d3,c3;var p3=D(()=>{g8();V_={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},d3=[320,640,768,1024,1280,1536,1920];c3={name:"StxImage",aliases:["stx-image","stx-img"],render(X,$,Z){let Y=y0(X,"src")||"",J=y0(X,"alt")||"",G=y0(X,"width"),Q=y0(X,"height"),q=y0(X,"sizes"),K=y0(X,"srcset"),U=y0(X,"densities"),W=y0(X,"format"),w=y0(X,"placeholder"),z=y0(X,"placeholderColor")||"#e5e7eb",B=y0(X,"provider"),j=y0(X,"class")||y0(X,"className")||"",_=y0(X,"style")||"",H=y0(X,"quality"),L=m3(X,"lazy",!0),O=m3(X,"preload",!1),F=m3(X,"picture",!1)||!!W,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=K||"",T="";if(!R&&q)R=l3(Y,d3,B,W),T=kG(q);else if(!R&&U){let S=U.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));R=A_(Y,S,V,B,W)}else if(q)T=kG(q);let N=[];if(_)N.push(_);if(V&&A)N.push(`aspect-ratio:${V}/${A}`);if(w==="blur"||w==="color"||w==="thumbhash"){let S=R_(V||16,A||9,z);N.push(`background-image:url(${S})`),N.push("background-size:cover"),N.push("background-repeat:no-repeat")}else if(w&&w!=="empty"&&w!=="none")N.push(`background-image:url(${I0(w)})`),N.push("background-size:cover"),N.push("background-repeat:no-repeat");let k=u7(Y,V,A,B,W),M=[];if(M.push(`src="${I0(k)}"`),M.push(`alt="${I0(J)}"`),G)M.push(`width="${I0(G)}"`);if(Q)M.push(`height="${I0(Q)}"`);if(L)M.push('loading="lazy"');if(M.push('decoding="async"'),j)M.push(`class="${I0(j)}"`);if(N.length>0)M.push(`style="${I0(N.join(";"))}"`);if(R)M.push(`srcset="${I0(R)}"`);if(T)M.push(`sizes="${I0(T)}"`);let y=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);M.push(...v5(X,y));let I=`<img ${M.join(" ")} />`,C="";if(O){let b=W==="webp"?"image/webp":W==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${I0(k)}"${b?` type="${b}"`:""}${R?` imagesrcset="${I0(R)}"`:""}${T?` imagesizes="${I0(T)}"`:""} />
13403
- `}if(F){let S=[];if(W==="avif"||W==="auto"){let b=u7(Y,V,A,B,"avif"),P=R?l3(Y,d3,B,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${I0(P)}"${T?` sizes="${I0(T)}"`:""} />`)}if(W==="webp"||W==="auto"){let b=u7(Y,V,A,B,"webp"),P=R?l3(Y,d3,B,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${I0(P)}"${T?` sizes="${I0(T)}"`:""} />`)}return`${C}<picture>
13474
+ </div>`}}});var SG={};n(SG,{warnUnbalancedTags:()=>m3,findUnbalancedTags:()=>bG});function v5(X){return X.replace(/[^\n]/g," ")}function bG(X){let $=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,v5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,v5).replace(/<!--[\s\S]*?-->/g,v5).replace(/\{\{\{[\s\S]*?\}\}\}/g,v5).replace(/\{\{[\s\S]*?\}\}/g,v5).replace(/\{!![\s\S]*?!!\}/g,v5),Z=new Map,Y=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=J.exec($))!==null){let q=G[1]==="/",K=G[2],U=G[3]==="/";if(E_.has(K.toLowerCase()))continue;if(U)continue;if(q)Y.set(K,(Y.get(K)??0)+1);else{let W=Z.get(K);if(W)W.count++;else{let w=$.slice(0,G.index).split(`
13475
+ `).length;Z.set(K,{count:1,firstLine:w})}}}let Q=[];for(let q of new Set([...Z.keys(),...Y.keys()])){if(D_.has(q.toLowerCase()))continue;let K=Z.get(q)?.count??0,U=Y.get(q)??0;if(K!==U)Q.push({tag:q,opened:K,closed:U,firstOpenLine:Z.get(q)?.firstLine??0})}return Q}function m3(X,$){let Z;try{Z=bG(X)}catch{return}if(Z.length===0)return;let Y=`${$}:${X.length}`;if(yG.has(Y))return;yG.add(Y);let J=$?$.split(/[/\\]/).pop()||$:"template";for(let{tag:G,opened:Q,closed:q,firstOpenLine:K}of Z)if(Q>q){let U=K?` (first opened at line ${K})`:"";console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${q} closed \u2014 an unclosed <${G}>${U} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${q} closed \u2014 ${q-Q} stray </${G}>.`)}var E_,D_,yG;var l3=E(()=>{E_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),D_=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);yG=new Set});import c0 from"path";import c3 from"fs";function CG(X){return X.split("-").map(($)=>$.charAt(0).toUpperCase()+$.slice(1)).join("")}function PG(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class vG{builtins=new Map;registerBuiltin(X){this.builtins.set(X.name.toLowerCase(),X);for(let $ of X.aliases)this.builtins.set($.toLowerCase(),X)}isBuiltin(X){return this.builtins.has(X.toLowerCase())}getBuiltin(X){return this.builtins.get(X.toLowerCase())??null}async resolveFile(X,$,Z,Y){let J=X.endsWith(".stx")?X.slice(0,-4):X,G=Y?.__importedComponents;if(G){let B=[J,J.toLowerCase(),CG(J),PG(J)];for(let j of B)if(G.has(j))return G.get(j)}let Q=[...new Set([`${J}.stx`,`${CG(J)}.stx`,`${PG(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let B=c0.resolve(c0.dirname($),`${J}.stx`);if(await p(B))return B;return null}let q=[],K=Z.componentsDir||"",U=Y?.__originalFilePath;if(U)q.push(c0.join(c0.dirname(U),"components"));if(K)q.push(K);let W=c0.join(c0.dirname($),"components");if(!q.includes(W))q.push(W);let w=process.cwd(),z=[c0.resolve(w,"src/components"),c0.resolve(w,"components"),c0.resolve(import.meta.dir,"components")];for(let B of z)if(!q.includes(B))q.push(B);for(let B of q){if(!B)continue;for(let j of Q){let _=c0.join(B,j);if(await p(_))return _}try{if(!c3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let _=c3.readdirSync(B,{withFileTypes:!0});for(let H of _)if(H.isDirectory()){let L=c0.join(B,H.name);for(let O of Q){let F=c0.join(L,O);if(await p(F))return F}}}catch{}}return null}}var v0;var p3=E(()=>{A0();v0=new vG});function k0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xG(X){return X.indexOf("\x00")===-1?X:X.replace(/\0/g,"")}var G5="\x00stx-boolean-attribute";function x5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.static)){if($.has(Y))continue;let G=X.staticNames?.[Y]??Y;if(typeof J==="boolean"){if(J)Z.push(k0(G));continue}if(J===G5){Z.push(k0(G));continue}Z.push(`${k0(G)}="${k0(xG(String(J)))}"`)}return Z}var g8=()=>{};function u7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function y_(X){if(X.clientReactive.to)return{value:X.clientReactive.to,reactive:!0};if(X.serverDynamic.to!==void 0)return{value:String(X.serverDynamic.to),reactive:!1};if(typeof X.static.to==="string")return{value:X.static.to,reactive:!1};return{value:"#",reactive:!1}}var i3;var n3=E(()=>{g8();i3={name:"StxLink",aliases:["stx-link"],render(X,$,Z){let Y=y_(X),J=(typeof X.static.class==="string"?X.static.class:"")||(typeof X.static.className==="string"?X.static.className:""),G=typeof X.static.activeClass==="string"?X.static.activeClass:"active",Q=typeof X.static.exactActiveClass==="string"?X.static.exactActiveClass:"exact-active",q=X.static.prefetch===!0||X.static.prefetch==="true"||X.serverDynamic.prefetch===!0,K=[];if(Y.reactive)K.push(`:href="${u7(Y.value)}"`);else K.push(`href="${u7(Y.value)}"`);if(J)K.push(`class="${u7(J)}"`);if(K.push("data-stx-link"),K.push(`data-stx-active-class="${u7(G)}"`),K.push(`data-stx-exact-active-class="${u7(Q)}"`),q)K.push("data-stx-prefetch");let U=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return K.push(...x5(X,U)),`<a ${K.join(" ")}>${$}</a>`}}});function I0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function y0(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function o3(X,$,Z=!1){let Y=X.serverDynamic[$];if(Y!==void 0)return Y!==!1&&Y!=="false";let J=X.static[$];if(J!==void 0)return J!=="false"&&J!==!1;return Z}function fG(X){if(X.includes("(")||X.includes(","))return X;let $=X.trim().split(/\s+/),Z=[];for(let Y of $)if(Y.includes(":")){let[J,G]=Y.split(":"),Q=b_[J];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let q=Number.parseInt(J);if(!Number.isNaN(q))Z.push(`(max-width: ${q}px) ${G}`)}}else Z.push(Y);return Z.join(", ")}function s3(X,$,Z,Y){return $.map((J)=>`${d7(X,J,void 0,Z,Y)} ${J}w`).join(", ")}function S_(X,$,Z,Y,J){return $.map((G)=>{let Q=Z?Z*G:void 0;return`${d7(X,Q,void 0,Y,J)} ${G}x`}).join(", ")}function d7(X,$,Z,Y,J){if(!Y||Y==="local"||Y==="static")return X;if(Y==="cloudinary"){let G=[];if($)G.push(`w_${$}`);if(Z)G.push(`h_${Z}`);if(J)G.push(`f_${J}`);G.push("q_auto");let Q=G.join(",");return X.replace("/upload/",`/upload/${Q}/`)}if(Y==="imgix"){let G=new URLSearchParams;if($)G.set("w",String($));if(Z)G.set("h",String(Z));if(J)G.set("fm",J);G.set("auto","format");let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}if(Y==="bunny"){let G=new URLSearchParams;if($)G.set("width",String($));if(Z)G.set("height",String(Z));if(J)G.set("format",J);let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}return X}function C_(X,$,Z="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${$}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var b_,r3,a3;var t3=E(()=>{g8();b_={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},r3=[320,640,768,1024,1280,1536,1920];a3={name:"StxImage",aliases:["stx-image","stx-img"],render(X,$,Z){let Y=y0(X,"src")||"",J=y0(X,"alt")||"",G=y0(X,"width"),Q=y0(X,"height"),q=y0(X,"sizes"),K=y0(X,"srcset"),U=y0(X,"densities"),W=y0(X,"format"),w=y0(X,"placeholder"),z=y0(X,"placeholderColor")||"#e5e7eb",B=y0(X,"provider"),j=y0(X,"class")||y0(X,"className")||"",_=y0(X,"style")||"",H=y0(X,"quality"),L=o3(X,"lazy",!0),O=o3(X,"preload",!1),F=o3(X,"picture",!1)||!!W,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=K||"",N="";if(!R&&q)R=s3(Y,r3,B,W),N=fG(q);else if(!R&&U){let S=U.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));R=S_(Y,S,V,B,W)}else if(q)N=fG(q);let T=[];if(_)T.push(_);if(V&&A)T.push(`aspect-ratio:${V}/${A}`);if(w==="blur"||w==="color"||w==="thumbhash"){let S=C_(V||16,A||9,z);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(w&&w!=="empty"&&w!=="none")T.push(`background-image:url(${I0(w)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let k=d7(Y,V,A,B,W),M=[];if(M.push(`src="${I0(k)}"`),M.push(`alt="${I0(J)}"`),G)M.push(`width="${I0(G)}"`);if(Q)M.push(`height="${I0(Q)}"`);if(L)M.push('loading="lazy"');if(M.push('decoding="async"'),j)M.push(`class="${I0(j)}"`);if(T.length>0)M.push(`style="${I0(T.join(";"))}"`);if(R)M.push(`srcset="${I0(R)}"`);if(N)M.push(`sizes="${I0(N)}"`);let y=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);M.push(...x5(X,y));let I=`<img ${M.join(" ")} />`,C="";if(O){let b=W==="webp"?"image/webp":W==="avif"?"image/avif":"";C=`<link rel="preload" as="image" href="${I0(k)}"${b?` type="${b}"`:""}${R?` imagesrcset="${I0(R)}"`:""}${N?` imagesizes="${I0(N)}"`:""} />
13476
+ `}if(F){let S=[];if(W==="avif"||W==="auto"){let b=d7(Y,V,A,B,"avif"),P=R?s3(Y,r3,B,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${I0(P)}"${N?` sizes="${I0(N)}"`:""} />`)}if(W==="webp"||W==="auto"){let b=d7(Y,V,A,B,"webp"),P=R?s3(Y,r3,B,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${I0(P)}"${N?` sizes="${I0(N)}"`:""} />`)}return`${C}<picture>
13404
13477
  ${S.join(`
13405
13478
  `)}
13406
13479
  ${I}
13407
- </picture>`}return`${C}${I}`}}});function d7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function x5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var IG="/images/safe-image-default.svg",T_,i3;var n3=D(()=>{g8();T_=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${IG}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,i3={name:"SafeImage",aliases:["safe-image","safe-img"],render(X,$,Z){let Y=x5(X,"src")||"",J=x5(X,"alt")||"",G=x5(X,"fallback")||IG,Q=x5(X,"class")||x5(X,"className")||"",q=x5(X,"fallbackClassName")||"",K=[];if(K.push(`src="${d7(Y)}"`),K.push(`alt="${d7(J)}"`),Q)K.push(`class="${d7(Q)}"`);if(K.push(`data-fallback="${d7(G)}"`),q)K.push(`data-fallback-class="${d7(q)}"`);K.push('onerror="window.__stxSafeImageHandler(this)"');let U=new Set(["src","alt","fallback","class","className","fallbackClassName"]);K.push(...v5(X,U));let W=`<img ${K.join(" ")} />`,w=Z.context;if(!w.__safeImageHandlerEmitted)return w.__safeImageHandlerEmitted=!0,`${T_}${W}`;return W}}});function r3(X){return X.replace(/[;{}()]/g,"").replace(/url/gi,"")}function m7(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function h8(X,$,Z){let Y=m7(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var o3;var s3=D(()=>{o3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(X,$,Z){let Y=r3(m7(X,"color")||"#6366f1"),J=r3(m7(X,"initialColor")||m7(X,"initial-color")||""),G=r3(m7(X,"height")||"3px"),Q=h8(X,"duration",2000),q=h8(X,"throttle",200),K=h8(X,"zIndex",999999)||h8(X,"z-index",999999),U=J?`linear-gradient(to right, ${J}, ${Y})`:Y;return`
13480
+ </picture>`}return`${C}${I}`}}});function m7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function f5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var gG="/images/safe-image-default.svg",P_,e3;var X4=E(()=>{g8();P_=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${gG}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,e3={name:"SafeImage",aliases:["safe-image","safe-img"],render(X,$,Z){let Y=f5(X,"src")||"",J=f5(X,"alt")||"",G=f5(X,"fallback")||gG,Q=f5(X,"class")||f5(X,"className")||"",q=f5(X,"fallbackClassName")||"",K=[];if(K.push(`src="${m7(Y)}"`),K.push(`alt="${m7(J)}"`),Q)K.push(`class="${m7(Q)}"`);if(K.push(`data-fallback="${m7(G)}"`),q)K.push(`data-fallback-class="${m7(q)}"`);K.push('onerror="window.__stxSafeImageHandler(this)"');let U=new Set(["src","alt","fallback","class","className","fallbackClassName"]);K.push(...x5(X,U));let W=`<img ${K.join(" ")} />`,w=Z.context;if(!w.__safeImageHandlerEmitted)return w.__safeImageHandlerEmitted=!0,`${P_}${W}`;return W}}});function $4(X){return X.replace(/[;{}()]/g,"").replace(/url/gi,"")}function l7(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function h8(X,$,Z){let Y=l7(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var Z4;var Y4=E(()=>{Z4={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(X,$,Z){let Y=$4(l7(X,"color")||"#6366f1"),J=$4(l7(X,"initialColor")||l7(X,"initial-color")||""),G=$4(l7(X,"height")||"3px"),Q=h8(X,"duration",2000),q=h8(X,"throttle",200),K=h8(X,"zIndex",999999)||h8(X,"z-index",999999),U=J?`linear-gradient(to right, ${J}, ${Y})`:Y;return`
13408
13481
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${G};background:${U};z-index:${K};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
13409
13482
  <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>
13410
13483
  </div>
13411
13484
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
13412
13485
  <script>
13413
13486
  (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)},${q})},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()})})();
13414
- </script>`}}});function DG(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function N_(X,$,Z){let Y=DG(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var EG,a3;var t3=D(()=>{EG={"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%)"},a3={name:"StxToast",aliases:["stx-toast"],render(X,$,Z){let Y=k0(DG(X,"position")||"top-right"),J=N_(X,"max",5),G=EG[Y]||EG["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${J}" style="position:fixed;${G};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
13487
+ </script>`}}});function uG(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function v_(X,$,Z){let Y=uG(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var hG,J4;var G4=E(()=>{hG={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},J4={name:"StxToast",aliases:["stx-toast"],render(X,$,Z){let Y=k0(uG(X,"position")||"top-right"),J=v_(X,"max",5),G=hG[Y]||hG["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${J}" style="position:fixed;${G};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
13415
13488
  <style>
13416
13489
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
13417
13490
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -13419,7 +13492,7 @@ ${I}
13419
13492
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
13420
13493
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
13421
13494
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
13422
- </style>`}}});function u8(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var yG,e3;var X4=D(()=>{yG={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},e3={name:"StxModal",aliases:["stx-modal"],render(X,$,Z){let Y=u8(X,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=k0(Y),G=u8(X,"size")||"md",Q=u8(X,"closeOnBackdrop")!=="false",q=u8(X,"closeOnEscape")!=="false",K=yG[G]||yG.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${Q}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
13495
+ </style>`}}});function u8(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var dG,Q4;var q4=E(()=>{dG={sm:"max-width:24rem",md:"max-width:32rem",lg:"max-width:42rem",xl:"max-width:56rem",full:"max-width:calc(100vw - 2rem);max-height:calc(100vh - 2rem)"},Q4={name:"StxModal",aliases:["stx-modal"],render(X,$,Z){let Y=u8(X,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=k0(Y),G=u8(X,"size")||"md",Q=u8(X,"closeOnBackdrop")!=="false",q=u8(X,"closeOnEscape")!=="false",K=dG[G]||dG.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${Q}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
13423
13496
  <div class="stx-modal-panel" style="${K};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
13424
13497
  <div style="padding:1.5rem">${$}</div>
13425
13498
  </div>
@@ -13428,7 +13501,7 @@ ${I}
13428
13501
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
13429
13502
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
13430
13503
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
13431
- </style>`}}});function f5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var bG,$4;var Z4=D(()=>{bG={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},$4={name:"StxDrawer",aliases:["stx-drawer"],render(X,$,Z){let Y=f5(X,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=k0(Y),G=f5(X,"side")||"right",Q=f5(X,"size")||"md",q=f5(X,"closeOnBackdrop")!=="false",K=f5(X,"closeOnEscape")!=="false",U=f5(X,"overlay")!=="false",W=bG[Q]||bG.md,w=G==="left",z=w?"left:0":"right:0",B=w?"translateX(-100%)":"translateX(100%)",j=w?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${J}" class="stx-drawer-backdrop" data-stx-drawer="${J}" data-close-backdrop="${q}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${U?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
13504
+ </style>`}}});function g5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var mG,K4;var U4=E(()=>{mG={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},K4={name:"StxDrawer",aliases:["stx-drawer"],render(X,$,Z){let Y=g5(X,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=k0(Y),G=g5(X,"side")||"right",Q=g5(X,"size")||"md",q=g5(X,"closeOnBackdrop")!=="false",K=g5(X,"closeOnEscape")!=="false",U=g5(X,"overlay")!=="false",W=mG[Q]||mG.md,w=G==="left",z=w?"left:0":"right:0",B=w?"translateX(-100%)":"translateX(100%)",j=w?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${J}" class="stx-drawer-backdrop" data-stx-drawer="${J}" data-close-backdrop="${q}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${U?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
13432
13505
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${z};width:${W};max-width:100vw;transform:${B};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
13433
13506
  <div style="padding:1.5rem">${$}</div>
13434
13507
  </div>
@@ -13437,18 +13510,18 @@ ${I}
13437
13510
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
13438
13511
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
13439
13512
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
13440
- </style>`}}});import{existsSync as M_,readFileSync as k_}from"fs";function I_(X){if(SG.has(X))return;SG.add(X),console.warn(`[stx] icon collection "${X}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${X}\`.`)}function E_(X){let $=process.cwd();for(let Z of[`${$}/node_modules/@iconify-json/${X}/icons.json`,`${$}/pantry/@iconify-json/${X}/icons.json`,`${$}/node_modules/@iconify/json/json/${X}.json`,`${$}/pantry/@iconify/json/json/${X}.json`])if(M_(Z))return Z;for(let Z of[`@iconify-json/${X}/icons.json`,`@iconify/json/json/${X}.json`])try{return W0.resolve(Z)}catch{}return null}function D_(X){if(d8.has(X))return d8.get(X);let $=E_(X);if(!$)return I_(X),null;try{let Z=JSON.parse(k_($,"utf8"));return d8.set(X,Z.icons),Z.icons}catch{return null}}function g5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);if(X.static[$]!==void 0)return String(X.static[$]);if(X.clientReactive[$]!==void 0)return X.clientReactive[$];return}var d8,SG,Y4;var J4=D(()=>{d8=new Map,SG=new Set;Y4={name:"Icon",aliases:["icon","stx-icon"],render(X,$,Z){let Y=g5(X,"name")??g5(X,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let J="lucide",G=Y;if(Y.includes(":")){let O=Y.split(":");J=O[0],G=O[1]}let Q=k0(g5(X,"size")||"24"),q=k0(g5(X,"color")||"currentColor"),K=k0(g5(X,"class")||""),U=k0(g5(X,"style")||""),W=d8.get(J)??D_(J);if(!W)return`<!-- Icon: collection "${J}" not loaded -->`;let w=W[G];if(!w)return`<!-- Icon: "${G}" not found in ${J} -->`;let z=w.width||24,B=w.height||24,j=`0 0 ${z} ${B}`,_=w.body;if(q!=="currentColor")_=_.replace(/currentColor/g,q);let H=K?` class="${K}"`:"",L=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${j}" fill="none"${H}${L}>${_}</svg>`}}});function CG(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}function PG(X,$){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${$}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=X.match(Z);if(!Y)return{region:null,rest:X};return{region:Y[2],rest:X.replace(Y[0],"")}}var G4;var Q4=D(()=>{G4={name:"Suspense",aliases:["suspense"],render(X,$,Z){let Y=PG($,"fallback"),J=Y.rest,G=PG(J,"error"),Q=G.rest,q=Y.region??CG(X,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',K=G.region??CG(X,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${q}</div><div data-stx-suspense-error hidden>${K}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function m8(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}var q4;var K4=D(()=>{q4={name:"TransitionGroup",aliases:["transition-group"],render(X,$,Z){let Y=(m8(X,"name")||"v").replace(/["'<>]/g,""),J=(m8(X,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=m8(X,"class"),Q=m8(X,"id"),q=[`data-stx-transition-group="${Y}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${J} ${q}>${$}</${J}>`}}});function vG(){v0.registerBuiltin(h3),v0.registerBuiltin(c3),v0.registerBuiltin(i3),v0.registerBuiltin(o3),v0.registerBuiltin(a3),v0.registerBuiltin(e3),v0.registerBuiltin($4),v0.registerBuiltin(Y4),v0.registerBuiltin(G4),v0.registerBuiltin(q4)}var xG=D(()=>{u3();p3();n3();s3();t3();X4();Z4();J4();Q4();K4();g3();u3();p3();n3();s3();t3();X4();Z4();J4();Q4();K4()});function l8(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function fG(X,$,Z){let Y=[],J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;let q=X.slice(G+1).match(new RegExp(`^(${$.source})(?![\\w.:-])`));if(!q){J=G+1;continue}let K=q[1];if(Z&&Z.has(K.toLowerCase())){let _=G+1+K.length;while(_<X.length&&X[_]!==">")_++;J=_+1;continue}let U=G+1+K.length,W=null,w=U,z=-1,B=!1;while(U<X.length){let _=X[U];if(W){if(_==="\\"&&U+1<X.length){U+=2;continue}if(_===W)W=null;U++;continue}if(_==='"'||_==="'"){W=_,U++;continue}if(_==="/"&&U+1<X.length&&X[U+1]===">"){z=U+2,B=!0;break}if(_===">"){z=U+1;break}U++}if(z===-1){J=G+1;continue}let j=X.slice(w,B?z-2:z-1).trim();if(B)Y.push({fullMatch:X.slice(G,z),tagName:K,attributes:j,content:"",startIndex:G,endIndex:z,isSelfClosing:!0}),J=z;else{let _=`<${K}`,H=`</${K}>`,L=1,O=z,F=-1;while(L>0&&O<X.length){let R=X.indexOf(_,O),T=X.indexOf(H,O);if(T===-1)break;if(R!==-1&&R<T){let N=X[R+_.length];if(N===" "||N===">"||N==="/"||N===`
13441
- `||N==="\t")L++;O=R+_.length}else{if(L--,L===0){F=T;break}O=T+H.length}}if(F===-1){J=z;continue}let V=X.slice(z,F),A=F+H.length;Y.push({fullMatch:X.slice(G,A),tagName:K,attributes:j,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function gG(X){return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function hG(X,$){try{let Z=Buffer.from(X,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=X.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if($?.debug)console.error("Error decoding __stx_ prop:",Z);return X}}var uG=D(()=>{O0();A0();l1()});var nG={};n(nG,{processESImports:()=>pG,processComponents:()=>p8});import c8 from"fs";import d0 from"path";function b_(X,$,Z){let Y={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(n2),G=(q)=>{if(!q.includes("-")||q.startsWith("@")||q.startsWith(":")||q.startsWith("x-")||q.startsWith("__"))return q;if(q.startsWith("aria-")||q.startsWith("data-"))return q;return q.replace(/-([a-z0-9])/g,(K,U)=>U.toUpperCase())},Q=(q,K)=>{let U=G(q);if(Y.static[U]=K,U!==q)Y.staticNames[U]=q};for(let[q,K]of Object.entries(X)){let U=q.startsWith("x-")&&!J.has(q)&&!q.startsWith("x-bind:")&&!q.startsWith("x-on:")?`:${q.slice(2)}`:q;if(U.startsWith("@")){Y.events[U]=K;continue}if(U.startsWith("__stx_")){let W=G(U.slice(6));Y.serverDynamic[W]=hG(K,Z);continue}if(U.startsWith(":")){let W=G(U.slice(1)),w=K===J5?W:K;if(W==="if"||W==="for"||W==="show"){Y.clientReactive[W]=w;continue}try{if(!G0(w)){if(Z.debug)console.error(`Unsafe expression in :${W} binding: ${w}`);Y.clientReactive[W]=w;continue}let z=Object.keys($),j=Q0(w,z)(...Object.values($));if(j===void 0){let _=w.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((O)=>!H.has(O)&&!z.includes(O))){Y.clientReactive[W]=w;continue}}Y.serverDynamic[W]=j}catch{Y.clientReactive[W]=w}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let W=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let w=W[1];if(G0(w)){let B=Q0(w,Object.keys($))(...Object.values($));Q(U,B!=null?String(B):"")}else{if(Z.debug)console.error(`Unsafe expression in ${U}: ${w}`);Q(U,K)}}catch(w){if(Z.debug)console.error(`Error evaluating expression for ${U}:`,w);Q(U,K)}else{let w=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(K))!==null)try{let j=B[1];if(!G0(j)){if(Z.debug)console.error(`Unsafe expression in ${U}: ${j}`);continue}let H=Q0(j,Object.keys($))(...Object.values($));w=w.replace(B[0],String(H??""))}catch(j){if(Z.debug)console.error(`Error evaluating expression in ${U}:`,j)}Q(U,w)}continue}Q(U,K===J5?"true":gG(K))}return Y}function S_(X){let $={},Z=0,Y=X.length;while(Z<Y){while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test(X[Z]))J+=X[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z<Y&&X[Z]==="="){Z++;while(Z<Y&&/\s/.test(X[Z]))Z++;let G="";if(Z<Y&&(X[Z]==='"'||X[Z]==="'")){let Q=X[Z];Z++;while(Z<Y){let q=X[Z];if(q==="\\"&&Z+1<Y){Z++,G+=X[Z],Z++;continue}if(q===Q){Z++;break}G+=q,Z++}}else while(Z<Y&&!/\s/.test(X[Z]))G+=X[Z],Z++;$[J]=G}else $[J]=J5}return $}function mG(X){return Object.entries(X).map(([$,Z])=>Z===J5?$:`${$}="${C_(Z)}"`).join(" ")}function C_(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function P_(X){let $=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1];if(v0.isBuiltin(J))$.add(J)}return[...$].sort()}function v_(X){let $=lG.get(X);if($)return $;let Z=new Map,Y=[d0.join(X,"src"),d0.join(X,"dist"),X];function J(G,Q){if(Q>6)return;let q;try{q=c8.readdirSync(G,{withFileTypes:!0})}catch{return}for(let K of q){let U=d0.join(G,K.name);if(K.isDirectory()){if(K.name==="node_modules"||K.name.startsWith("."))continue;J(U,Q+1)}else if(K.isFile()&&K.name.endsWith(".stx")){let W=K.name.slice(0,-4);if(!Z.has(W))Z.set(W,U);let w=W.toLowerCase();if(!Z.has(w))Z.set(w,U);let z=W.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(z))Z.set(z,U)}}}for(let G of Y)if(J(G,0),Z.size>0)break;return lG.set(X,Z),Z}function x_(X,$){if(X.startsWith(".")||X.startsWith("/"))return null;let Z=$;while(!0){let Y=d0.join(Z,"node_modules",X);try{if(c8.statSync(Y).isDirectory())return Y}catch{}let J=d0.dirname(Z);if(J===Z)return null;Z=J}}async function pG(X,$,Z,Y,J){if(!X.includes("import"))return X;if(!$.__importedComponents)$.__importedComponents=new Map;let G=$.__importedComponents,Q=d0.dirname(Z),q=X,K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(K,(U,W,w)=>{let z=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=w,j,_=[];while((j=z.exec(w))!==null){let[H,L,O,F]=j,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let N=d0.resolve(Q,F);if(N.endsWith(".stx"))A=N;else{let k=`${N}.stx`;try{if(c8.statSync(k).isFile())A=k}catch{try{if(c8.statSync(N).isDirectory())V=N}catch{}}}}else V=x_(F,Q);if(!V&&!A)continue;let R=!1,T=(N,k)=>{G.set(N,k),G.set(N.toLowerCase(),k);let M=N.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(M,k),J.add(k)};if(O&&A)T(O,A),R=!0;else if(L){let N=L.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let y=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y)return{source:y[1],local:y[2]};return{source:M,local:M}}),k=V?v_(V):null;for(let{source:M,local:y}of N){let I=null;if(A)I=A;else if(k)I=k.get(M)??k.get(M.toLowerCase())??k.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)T(y,I),R=!0}}if(R)_.push({start:j.index,end:j.index+H.length})}if(_.length===0)return U;for(let H=_.length-1;H>=0;H--)B=B.slice(0,_[H].start)+B.slice(_[H].end);return`<script${W}>${B}</script>`}),q}async function f_(X,$,Z,Y,J){let G=X;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,K;while((K=q.exec(G))!==null){let[U,W]=K,w=W.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of w){let B=z.split("/"),_=B[B.length-1].replace(/\.stx$/,""),H=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),L=null,O=[d0.resolve(d0.dirname(Z),`${z}.stx`),d0.resolve(d0.dirname(Z),z),d0.resolve(Y.componentsDir||"components",`${z}.stx`),d0.resolve(Y.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){L=F;break}}catch{}if(L){Q.set(H,L),Q.set(_,L),Q.set(_.toLowerCase(),L);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,L),J.add(L),Y.debug)console.log(`Imported component: ${H} -> ${L}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${z}`)}G=G.replace(U,""),q.lastIndex=0}return G}async function g_(X,$,Z,Y,J){let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let q=$.__processedComponents,K=/@component\s*\(/g,U;while((U=K.exec(G))!==null){let W=U.index,w=W+U[0].length-1,z=1,B=w+1;while(B<G.length&&z>0){if(G[B]==="(")z++;else if(G[B]===")"){if(z--,z===0)break}B++}if(z!==0)break;let j=G.substring(w+1,B),_=B+1,H=j.match(/^\s*['"]([^'"]+)['"]/);if(!H){K.lastIndex=0;continue}let L=H[1],O,F=j.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)O=F.slice(V[0].length).trim();let A={};if(O)try{A=H0(O,$)}catch(y){let I=y instanceof Error?y.message:String(y);G=G.replace(G.substring(W,_),`[Error parsing component props: ${I}]`);continue}let R="",T=_,k=G.substring(_).match(/^([\s\S]*?)@endcomponent/);if(k)R=k[1].trim(),T=_+k[0].length;let M=await o1(L,A,R,Q,$,Z,Y,q,J);G=G.substring(0,W)+M+G.substring(T),K.lastIndex=0}return G}async function h_(X,$,Z,Y,J){if(!X)return X;let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let q=$.__processedComponents,K=R1(G);return G=K.output,G=await z(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await z(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await z(G,/[a-z][a-z0-9]*/,!1,y_),G=V7(G,K.scripts),G;async function z(B,j,_,H){if(!B)return B;let L=B,O=fG(L,j,H);for(let F=O.length-1;F>=0;F--){let V=O[F],A=_?l8(V.tagName):V.tagName,R=S_(V.attributes),T=b_(R,$,Y),N=v0.getBuiltin(V.tagName),k=N?await oX(A,Q,$,Z,Y):!1;if(N&&!k){let C={context:$,filePath:Z,options:Y,dependencies:J},S=N.render(T,V.content,C);if(Object.keys(T.clientReactive).length>0)S=cG(S,T.clientReactive);if(Object.keys(T.events).length>0){let b=mG(T.events);S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}L=L.substring(0,V.startIndex)+S+L.substring(V.endIndex);continue}if(!_&&V.tagName.includes("-")&&!await oX(A,Q,$,Z,Y))continue;let M={};for(let[C,S]of Object.entries(T.static))M[C]=S;for(let[C,S]of Object.entries(T.serverDynamic))M[C]=S;let I=await o1(A,M,V.content,Q,$,Z,Y,q,J);if(Object.keys(T.clientReactive).length>0)I=cG(I,T.clientReactive);if(Object.keys(T.events).length>0){let C=iG(I);if(C){let S=mG(T.events),b=Object.keys(T.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,C.insertPos)+` data-stx-parent-events="${b}" ${S}`+I.substring(C.insertPos)}}L=L.substring(0,V.startIndex)+I+L.substring(V.endIndex)}return L}}function cG(X,$){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries($).filter(([W])=>!Z.has(W)),G=J.filter(([W])=>!Y.has(W)).map(([W])=>l8(W)).join(" "),Q=X,q=J.length>0?iG(Q):null;if(q){let W=J.map(([z,B])=>`:${l8(z)}="${B.replace(/"/g,"&quot;")}"`).join(" "),w=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,q.insertPos)+`${w} ${W}`+Q.substring(q.insertPos)}let K=$.if;if(K)Q=`<template :if="${K.replace(/"/g,"&quot;")}">${Q}</template>`;let U=$.for;if(U)Q=`<template :for="${U.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function iG(X){let $=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(X);if($)return{insertPos:$.index+1+$[1].length};let Z=0;while(Z<X.length){let Y=X.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let q=X.indexOf("-->",Z+4);if(q===-1)return null;Z=q+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let q=`</${G[1].toLowerCase()}>`,K=X.toLowerCase().indexOf(q,Z+G[0].length);if(K===-1)return null;Z=K+q.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function p8(X,$,Z,Y,J){if(!dG)vG(),dG=!0;let G=await pG(X,$,Z,Y,J);G=await f_(G,$,Z,Y,J),G=await g_(G,$,Z,Y,J);let Q=[];for(let q=0;q<3;q++){let K=$1(G,F7,(W,w)=>`\x00STX_COMPONENT_COMMENT_${Q.length+w}\x00`);Q.push(...K.tokens);let U=G;if(G=await h_(K.output,$,Z,Y,J),G===U)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,K)=>Q[Number(K)]??"");if(Y.debug){let q=P_(G);if(q.length>0)console.warn(`[stx] ${Z}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return G}var dG=!1,y_,lG;var U4=D(()=>{g3();xG();uG();l1();A0();O0();X1();y_=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);lG=new Map});var XQ={};n(XQ,{processLoops:()=>w4,parseLoopBinding:()=>W4});function m_(X,$){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index+G[0].length,q=G.index+G[0].indexOf("("),K=N0(X,"(",")",q);if(K===-1)continue;let U=X.slice(Q,K).trim();if(!U)continue;if(!Object.keys($).some((z)=>new RegExp(`(?:^|[^\\w$.])${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(U)))continue;let w;try{let z=H0(U,$);if(!z||typeof z!=="object")continue;w=JSON.stringify(z)}catch{continue}Y+=X.slice(J,Q)+w,J=K,Z.lastIndex=K}return J===0?X:Y+X.slice(J)}function l_(X,$){let Z=/@component\s*\(/g,Y=X,J,G=[];while((J=Z.exec(Y))!==null){let Q=J.index,q=Q+J[0].length-1,K=1,U=q+1;while(U<Y.length&&K>0){if(Y[U]==="(")K++;else if(Y[U]===")"){if(K--,K===0)break}U++}if(K!==0)continue;let W=Y.substring(q+1,U),w=U+1,z=W.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let B=z[1],j=W.slice(z[0].length),_=j.match(/^\s*,\s*/);if(!_)continue;let H=j.slice(_[0].length).trim();if(!H)continue;try{let L=H0(H,$),O=JSON.stringify(L),F=`@component('${B}', ${O})`;G.push({start:Q,end:w,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:q,end:K,replacement:U}=G[Q];Y=Y.substring(0,q)+U+Y.substring(K)}return Y}function i8(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=J.exec(Y))!==null){let Q=G.index,q=Q+G[0].length-1,K=1,U=q+1,W=null,w=!1;while(U<Y.length&&K>0){let j=Y[U];if(w){w=!1,U++;continue}if(j==="\\"&&W){w=!0,U++;continue}if(W){if(j===W)W=null;U++;continue}if(j==='"'||j==="'"||j==="`"){W=j,U++;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0)break}U++}if(K!==0)break;let z=Y.substring(q+1,U),B=Z(z);Y=Y.substring(0,Q)+B+Y.substring(U+1)}return Y}function c_(X,$){let Z=X;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,J)=>{if(J in $)return`:${J}="${J}"`;return Y}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,J,G)=>{try{let Q=Object.keys($),q=Object.values($);LX(G);let U=Q0(G,Q)(...q),W=JSON.stringify(U),w=Buffer.from(W,"utf8").toString("base64");return`__stx_${J}="${w}"`}catch(Q){return Y}}),Z}function p_(X,$){let Z=X;return Z=i8(Z,"@break",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(G0(G)){let q=Q0(G,Object.keys($));Q=Boolean(q(...Object.values($)))}else Q=Boolean($0(G,$));return Q?n8:""}catch{return""}}),Z=i8(Z,"@continue",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(G0(G)){let q=Q0(G,Object.keys($));Q=Boolean(q(...Object.values($)))}else Q=Boolean($0(G,$));return Q?r8:""}catch{return""}}),Z}function i_(X){let $=X;return $=$.replace(/@break(?!\()/g,n8),$=$.replace(/@continue(?!\()/g,r8),$}function rG(X){let $=X.includes(n8),Z=$?X.substring(0,X.indexOf(n8)):X;return{hasBreak:$,content:Z}}function oG(X){let $=X.includes(r8),Z=$?X.substring(0,X.indexOf(r8)):X;return{hasContinue:$,content:Z}}function aG(X){let $=X;return $=i8($,"@break",(Z)=>{let Y=Z.trim();if(!FX(Y))return"";return`\`; if (${Y}) { break; } result += \``}),$=i8($,"@continue",(Z)=>{let Y=Z.trim();if(!FX(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),$=$.replace(/@break(?!\()/g,"`; break; result += `"),$=$.replace(/@continue(?!\()/g,"`; continue; result += `"),$}function n_(X){let $=/@forelse\s*\(/g,Z,Y=[],J=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=J.exec(X))!==null)Y.push({pos:Q.index,delta:1});while((Q=G.exec(X))!==null)Y.push({pos:Q.index,delta:-1});Y.sort((W,w)=>W.pos-w.pos);let q=[],K=0;for(let W of Y)K+=W.delta,q.push({pos:W.pos,depth:K});function U(W){let w=0,z=q.length-1,B=0;while(w<=z){let j=w+z>>1;if(q[j].pos<=W)B=q[j].depth,w=j+1;else z=j-1}return B}while((Z=$.exec(X))!==null){if(U(Z.index)>0)continue;let W=Z.index,w=Z.index+Z[0].length-1,z=1,B=w+1,j=-1;while(B<X.length&&z>0){if(X[B]==="(")z++;else if(X[B]===")"){if(z--,z===0){j=B;break}}B++}if(j===-1)continue;let _=X.substring(w+1,j),H=W4(_);if(!H)continue;let{arrayExpr:L,itemVar:O}=H,F=j+1,V=1,A=F,R=/@forelse\s*\(/g,T=/@endforelse/g,N=-1;while(V>0&&A<X.length){R.lastIndex=A,T.lastIndex=A;let S=R.exec(X),b=T.exec(X);if(!b)break;if(S&&S.index<b.index)V++,A=S.index+S[0].length;else{if(V--,V===0){N=b.index;break}A=b.index+11}}if(N===-1)continue;let k=X.substring(F,N),M=N+11,y=-1,I=0,C=0;while(C<k.length){let S=k.indexOf("@",C);if(S===-1)break;let b=k.substring(S);if(/^@forelse\s*\(/.test(b))I++,C=S+1;else if(b.startsWith("@endforelse"))I--,C=S+11;else if(I===0&&b.startsWith("@empty")){if(k.length<=S+6||!/[a-z]/i.test(k[S+6])){y=S;break}C=S+1}else C=S+1}if(y===-1)continue;return{start:W,end:M,arrayExpr:L,itemVar:O,foreachContent:k.substring(0,y),emptyContent:k.substring(y+6)}}return null}function sG(X,$){let Z=X;while(!0){let Y=n_(Z);if(!Y)break;let{start:J,end:G,arrayExpr:Q,itemVar:q,foreachContent:K,emptyContent:U}=Y;try{let W;if(G0(Q))W=Q0(Q,Object.keys($))(...Object.values($));else W=$0(Q,$);let w;if(!Array.isArray(W)||W.length===0)w=U;else w=`@foreach (${Q} as ${q})${K}@endforeach`;Z=Z.substring(0,J)+w+Z.substring(G)}catch(W){let w=W instanceof Error?W.message:String(W),z=X0("Forelse",`Error in @forelse(${Q} as ${q}): ${w}`,s.EVALUATION_ERROR);Z=Z.substring(0,J)+z+Z.substring(G)}}return Z}function W4(X){let $=X.indexOf(" as ");if($!==-1){let G=X.slice(0,$).trim(),Q=X.slice($+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(X);if(!Z)return null;let Y=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Z[2].trim();return Y&&J?{arrayExpr:J,itemVar:Y}:null}function w4(X,$,Z,Y){let J=X;J=sG(J,$);function G(K){let U=/@foreach\s*\(/g,W;while((W=U.exec(K))!==null){let w=W.index,z=W.index+W[0].length-1,B=1,j=z+1,_=-1;while(j<K.length&&B>0){if(K[j]==="(")B++;else if(K[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let H=K.substring(z+1,_),L=W4(H);if(!L)continue;let O=w,{arrayExpr:F,itemVar:V}=L,A=_+1,R=1,T=A,N=/@foreach\s*\(/g,k=/@endforeach/g;while(R>0&&T<K.length){N.lastIndex=T,k.lastIndex=T;let M=N.exec(K),y=k.exec(K);if(!y)break;if(M&&M.index<y.index)R++,T=M.index+M[0].length;else{if(R--,R===0){let I=K.substring(A,y.index),C=y.index+11;return{start:O,end:C,arrayExpr:F,itemVar:V,content:I}}T=y.index+11}}}return null}function Q(K,U){let W=K;while(!0){let w=G(W);if(!w)break;let{start:z,end:B,arrayExpr:j,itemVar:_,content:H}=w;try{let L=j.trim(),O;if(G0(L))O=Q0(L,Object.keys(U))(...Object.values(U));else O=$0(L,U);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),F=!0;else{console.warn(`[stx] @foreach(${L}) in ${Z}: ${L} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let y=X0("Foreach",`Error in @foreach: ${L} is not iterable`,s.TYPE_ERROR);W=W.substring(0,z)+y+W.substring(B);continue}let V=Y?.loops?.useAltLoopVariable??d_,A=_.trim(),R=null,T,N=!1;if(A.includes("=>")){let y=A.split("=>").map((I)=>I.trim());if(y.length===2&&y[0]&&y[1])R=y[0],T=y[1];else T=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let y=A.split(",").map((I)=>I.trim());if(y.length===2&&y[0]&&y[1])T=y[0],R=y[1],N=!0;else T=A}else T=A;let k="",M=O;for(let y=0;y<M.length;y++){let I=M[y],C={index:y,iteration:y+1,first:y===0,last:y===M.length-1,count:M.length},S={...U,loop:C,$loop:C};if(T.startsWith("[")&&T.endsWith("]")){let d=T.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(I))d.forEach((m,Y0)=>{if(m)S[m]=I[Y0]});else S[T]=I}else S[T]=I;if(R)if(!N&&F&&Array.isArray(I)&&I.length===2)S[R]=I[0],S[T]=I[1];else S[R]=y;let b=p_(H,S),P=oG(b);if(P.hasContinue){k+=P.content;continue}let x=rG(b);if(x.hasBreak){k+=x.content;break}if(b=sG(b,S),b=Q(b,S),b=$5(b,S,Z),b=i_(b),x=rG(b),x.hasBreak){k+=x.content;break}if(P=oG(b),P.hasContinue){k+=P.content;continue}b=T1(b,S,Z),b=c_(b,S),b=l_(b,S),b=m_(b,S),k+=b}W=W.substring(0,z)+k+W.substring(B)}catch(L){let O=X0("Foreach",`Error in @foreach(${j.trim()} as ${_.trim()}): ${L instanceof Error?L.message:String(L)}`,s.EVALUATION_ERROR);W=W.substring(0,z)+O+W.substring(B)}}return W}J=Q(J,$),J=eG(J,$,Z,Y);let q=Y?.loops?.maxWhileIterations??u_;return J=s_(J,$,q),J}function tG(X){return FX(X)}function eG(X,$,Z,Y){let J=X,G=!0;while(G){G=!1;let Q=J.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let q=Q.index,K=q+Q[0].length-1,U=N0(J,"(",")",K);if(U===-1)break;let W=J.slice(K+1,U),w=U+1,z=IX(J.slice(q),"for","endfor");if(z.length===0)break;let B=z[0].content,j=q+z[0].end;if(!tG(W)){let _=X0("For",`Unsafe expression in @for: ${W}`,s.UNSAFE_EXPRESSION);J=J.substring(0,q)+_+J.substring(j),G=!0;continue}try{let _=r_(W),H=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&H){let R=o_({forExpr:W,content:B,iterVarNames:_,context:$,filePath:Z,options:Y});J=J.substring(0,q)+R+J.substring(j),G=!0;continue}let L=Object.keys($),O=Object.values($),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,T)=>{return`\${${T}}`});F=aG(F);let A=Function(...L,`
13513
+ </style>`}}});import{existsSync as x_,readFileSync as f_}from"fs";function g_(X){if(lG.has(X))return;lG.add(X),console.warn(`[stx] icon collection "${X}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${X}\`.`)}function h_(X){let $=process.cwd();for(let Z of[`${$}/node_modules/@iconify-json/${X}/icons.json`,`${$}/pantry/@iconify-json/${X}/icons.json`,`${$}/node_modules/@iconify/json/json/${X}.json`,`${$}/pantry/@iconify/json/json/${X}.json`])if(x_(Z))return Z;for(let Z of[`@iconify-json/${X}/icons.json`,`@iconify/json/json/${X}.json`])try{return W0.resolve(Z)}catch{}return null}function u_(X){if(d8.has(X))return d8.get(X);let $=h_(X);if(!$)return g_(X),null;try{let Z=JSON.parse(f_($,"utf8"));return d8.set(X,Z.icons),Z.icons}catch{return null}}function h5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);if(X.static[$]!==void 0)return String(X.static[$]);if(X.clientReactive[$]!==void 0)return X.clientReactive[$];return}var d8,lG,W4;var w4=E(()=>{d8=new Map,lG=new Set;W4={name:"Icon",aliases:["icon","stx-icon"],render(X,$,Z){let Y=h5(X,"name")??h5(X,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let J="lucide",G=Y;if(Y.includes(":")){let O=Y.split(":");J=O[0],G=O[1]}let Q=k0(h5(X,"size")||"24"),q=k0(h5(X,"color")||"currentColor"),K=k0(h5(X,"class")||""),U=k0(h5(X,"style")||""),W=d8.get(J)??u_(J);if(!W)return`<!-- Icon: collection "${J}" not loaded -->`;let w=W[G];if(!w)return`<!-- Icon: "${G}" not found in ${J} -->`;let z=w.width||24,B=w.height||24,j=`0 0 ${z} ${B}`,_=w.body;if(q!=="currentColor")_=_.replace(/currentColor/g,q);let H=K?` class="${K}"`:"",L=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${j}" fill="none"${H}${L}>${_}</svg>`}}});function cG(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}function pG(X,$){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${$}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=X.match(Z);if(!Y)return{region:null,rest:X};return{region:Y[2],rest:X.replace(Y[0],"")}}var z4;var j4=E(()=>{z4={name:"Suspense",aliases:["suspense"],render(X,$,Z){let Y=pG($,"fallback"),J=Y.rest,G=pG(J,"error"),Q=G.rest,q=Y.region??cG(X,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',K=G.region??cG(X,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${q}</div><div data-stx-suspense-error hidden>${K}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function m8(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}var B4;var _4=E(()=>{B4={name:"TransitionGroup",aliases:["transition-group"],render(X,$,Z){let Y=(m8(X,"name")||"v").replace(/["'<>]/g,""),J=(m8(X,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=m8(X,"class"),Q=m8(X,"id"),q=[`data-stx-transition-group="${Y}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${J} ${q}>${$}</${J}>`}}});function iG(){v0.registerBuiltin(i3),v0.registerBuiltin(a3),v0.registerBuiltin(e3),v0.registerBuiltin(Z4),v0.registerBuiltin(J4),v0.registerBuiltin(Q4),v0.registerBuiltin(K4),v0.registerBuiltin(W4),v0.registerBuiltin(z4),v0.registerBuiltin(B4)}var nG=E(()=>{n3();t3();X4();Y4();G4();q4();U4();w4();j4();_4();p3();n3();t3();X4();Y4();G4();q4();U4();w4();j4();_4()});function l8(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function rG(X,$,Z){let Y=[],J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;let q=X.slice(G+1).match(new RegExp(`^(${$.source})(?![\\w.:-])`));if(!q){J=G+1;continue}let K=q[1];if(Z&&Z.has(K.toLowerCase())){let _=G+1+K.length;while(_<X.length&&X[_]!==">")_++;J=_+1;continue}let U=G+1+K.length,W=null,w=U,z=-1,B=!1;while(U<X.length){let _=X[U];if(W){if(_==="\\"&&U+1<X.length){U+=2;continue}if(_===W)W=null;U++;continue}if(_==='"'||_==="'"){W=_,U++;continue}if(_==="/"&&U+1<X.length&&X[U+1]===">"){z=U+2,B=!0;break}if(_===">"){z=U+1;break}U++}if(z===-1){J=G+1;continue}let j=X.slice(w,B?z-2:z-1).trim();if(B)Y.push({fullMatch:X.slice(G,z),tagName:K,attributes:j,content:"",startIndex:G,endIndex:z,isSelfClosing:!0}),J=z;else{let _=`<${K}`,H=`</${K}>`,L=1,O=z,F=-1;while(L>0&&O<X.length){let R=X.indexOf(_,O),N=X.indexOf(H,O);if(N===-1)break;if(R!==-1&&R<N){let T=X[R+_.length];if(T===" "||T===">"||T==="/"||T===`
13514
+ `||T==="\t")L++;O=R+_.length}else{if(L--,L===0){F=N;break}O=N+H.length}}if(F===-1){J=z;continue}let V=X.slice(z,F),A=F+H.length;Y.push({fullMatch:X.slice(G,A),tagName:K,attributes:j,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function oG(X){return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function sG(X,$){try{let Z=Buffer.from(X,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=X.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if($?.debug)console.error("Error decoding __stx_ prop:",Z);return X}}var aG=E(()=>{O0();A0();l1()});var JQ={};n(JQ,{processESImports:()=>ZQ,processComponents:()=>p8});import c8 from"fs";import u0 from"path";function m_(X,$,Z){let Y={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(X6),G=(q)=>{if(!q.includes("-")||q.startsWith("@")||q.startsWith(":")||q.startsWith("x-")||q.startsWith("__"))return q;if(q.startsWith("aria-")||q.startsWith("data-"))return q;return q.replace(/-([a-z0-9])/g,(K,U)=>U.toUpperCase())},Q=(q,K)=>{let U=G(q);if(Y.static[U]=K,U!==q)Y.staticNames[U]=q};for(let[q,K]of Object.entries(X)){let U=q.startsWith("x-")&&!J.has(q)&&!q.startsWith("x-bind:")&&!q.startsWith("x-on:")?`:${q.slice(2)}`:q;if(U.startsWith("@")){Y.events[U]=K;continue}if(U.startsWith("__stx_")){let W=G(U.slice(6));Y.serverDynamic[W]=sG(K,Z);continue}if(U.startsWith(":")){let W=G(U.slice(1)),w=K===G5?W:K;if(W==="if"||W==="for"||W==="show"){Y.clientReactive[W]=w;continue}try{if(!G0(w)){if(Z.debug)console.error(`Unsafe expression in :${W} binding: ${w}`);Y.clientReactive[W]=w;continue}let z=Object.keys($),j=Q0(w,z)(...Object.values($));if(j===void 0){let _=w.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],H=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((O)=>!H.has(O)&&!z.includes(O))){Y.clientReactive[W]=w;continue}}Y.serverDynamic[W]=j}catch{Y.clientReactive[W]=w}continue}if(typeof K==="string"&&K.includes("{{")&&K.includes("}}")){let W=K.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(W)try{let w=W[1];if(G0(w)){let B=Q0(w,Object.keys($))(...Object.values($));Q(U,B!=null?String(B):"")}else{if(Z.debug)console.error(`Unsafe expression in ${U}: ${w}`);Q(U,K)}}catch(w){if(Z.debug)console.error(`Error evaluating expression for ${U}:`,w);Q(U,K)}else{let w=K,z=/\{\{\s*([\s\S]+?)\s*\}\}/g,B;while((B=z.exec(K))!==null)try{let j=B[1];if(!G0(j)){if(Z.debug)console.error(`Unsafe expression in ${U}: ${j}`);continue}let H=Q0(j,Object.keys($))(...Object.values($));w=w.replace(B[0],String(H??""))}catch(j){if(Z.debug)console.error(`Error evaluating expression in ${U}:`,j)}Q(U,w)}continue}Q(U,K===G5?"true":oG(K))}return Y}function l_(X){let $={},Z=0,Y=X.length;while(Z<Y){while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test(X[Z]))J+=X[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z<Y&&X[Z]==="="){Z++;while(Z<Y&&/\s/.test(X[Z]))Z++;let G="";if(Z<Y&&(X[Z]==='"'||X[Z]==="'")){let Q=X[Z];Z++;while(Z<Y){let q=X[Z];if(q==="\\"&&Z+1<Y){Z++,G+=X[Z],Z++;continue}if(q===Q){Z++;break}G+=q,Z++}}else while(Z<Y&&!/\s/.test(X[Z]))G+=X[Z],Z++;$[J]=G}else $[J]=G5}return $}function eG(X){return Object.entries(X).map(([$,Z])=>Z===G5?$:`${$}="${c_(Z)}"`).join(" ")}function c_(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function p_(X){let $=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1];if(v0.isBuiltin(J))$.add(J)}return[...$].sort()}function i_(X){let $=XQ.get(X);if($)return $;let Z=new Map,Y=[u0.join(X,"src"),u0.join(X,"dist"),X];function J(G,Q){if(Q>6)return;let q;try{q=c8.readdirSync(G,{withFileTypes:!0})}catch{return}for(let K of q){let U=u0.join(G,K.name);if(K.isDirectory()){if(K.name==="node_modules"||K.name.startsWith("."))continue;J(U,Q+1)}else if(K.isFile()&&K.name.endsWith(".stx")){let W=K.name.slice(0,-4);if(!Z.has(W))Z.set(W,U);let w=W.toLowerCase();if(!Z.has(w))Z.set(w,U);let z=W.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(z))Z.set(z,U)}}}for(let G of Y)if(J(G,0),Z.size>0)break;return XQ.set(X,Z),Z}function n_(X,$){if(X.startsWith(".")||X.startsWith("/"))return null;let Z=$;while(!0){let Y=u0.join(Z,"node_modules",X);try{if(c8.statSync(Y).isDirectory())return Y}catch{}let J=u0.dirname(Z);if(J===Z)return null;Z=J}}async function ZQ(X,$,Z,Y,J){if(!X.includes("import"))return X;if(!$.__importedComponents)$.__importedComponents=new Map;let G=$.__importedComponents,Q=u0.dirname(Z),q=X,K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(K,(U,W,w)=>{let z=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=w,j,_=[];while((j=z.exec(w))!==null){let[H,L,O,F]=j,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=u0.resolve(Q,F);if(T.endsWith(".stx"))A=T;else{let k=`${T}.stx`;try{if(c8.statSync(k).isFile())A=k}catch{try{if(c8.statSync(T).isDirectory())V=T}catch{}}}}else V=n_(F,Q);if(!V&&!A)continue;let R=!1,N=(T,k)=>{G.set(T,k),G.set(T.toLowerCase(),k);let M=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(M,k),J.add(k)};if(O&&A)N(O,A),R=!0;else if(L){let T=L.slice(1,-1).split(",").map((M)=>M.trim()).filter(Boolean).map((M)=>{let y=M.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y)return{source:y[1],local:y[2]};return{source:M,local:M}}),k=V?i_(V):null;for(let{source:M,local:y}of T){let I=null;if(A)I=A;else if(k)I=k.get(M)??k.get(M.toLowerCase())??k.get(M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(y,I),R=!0}}if(R)_.push({start:j.index,end:j.index+H.length})}if(_.length===0)return U;for(let H=_.length-1;H>=0;H--)B=B.slice(0,_[H].start)+B.slice(_[H].end);return`<script${W}>${B}</script>`}),q}async function r_(X,$,Z,Y,J){let G=X;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,K;while((K=q.exec(G))!==null){let[U,W]=K,w=W.split(",").map((z)=>z.trim().replace(/^['"]|['"]$/g,"")).filter((z)=>z.length>0);for(let z of w){let B=z.split("/"),_=B[B.length-1].replace(/\.stx$/,""),H=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),L=null,O=[u0.resolve(u0.dirname(Z),`${z}.stx`),u0.resolve(u0.dirname(Z),z),u0.resolve(Y.componentsDir||"components",`${z}.stx`),u0.resolve(Y.componentsDir||"components",z),z.endsWith(".stx")?z:`${z}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){L=F;break}}catch{}if(L){Q.set(H,L),Q.set(_,L),Q.set(_.toLowerCase(),L);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,L),J.add(L),Y.debug)console.log(`Imported component: ${H} -> ${L}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${z}`)}G=G.replace(U,""),q.lastIndex=0}return G}async function o_(X,$,Z,Y,J){let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let q=$.__processedComponents,K=/@component\s*\(/g,U;while((U=K.exec(G))!==null){let W=U.index,w=W+U[0].length-1,z=1,B=w+1;while(B<G.length&&z>0){if(G[B]==="(")z++;else if(G[B]===")"){if(z--,z===0)break}B++}if(z!==0)break;let j=G.substring(w+1,B),_=B+1,H=j.match(/^\s*['"]([^'"]+)['"]/);if(!H){K.lastIndex=0;continue}let L=H[1],O,F=j.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)O=F.slice(V[0].length).trim();let A={};if(O)try{A=H0(O,$)}catch(y){let I=y instanceof Error?y.message:String(y);G=G.replace(G.substring(W,_),`[Error parsing component props: ${I}]`);continue}let R="",N=_,k=G.substring(_).match(/^([\s\S]*?)@endcomponent/);if(k)R=k[1].trim(),N=_+k[0].length;let M=await s1(L,A,R,Q,$,Z,Y,q,J);G=G.substring(0,W)+M+G.substring(N),K.lastIndex=0}return G}async function s_(X,$,Z,Y,J){if(!X)return X;let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let q=$.__processedComponents,K=R1(G);return G=K.output,G=await z(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await z(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await z(G,/[a-z][a-z0-9]*/,!1,d_),G=A7(G,K.scripts),G;async function z(B,j,_,H){if(!B)return B;let L=B,O=rG(L,j,H);for(let F=O.length-1;F>=0;F--){let V=O[F],A=_?l8(V.tagName):V.tagName,R=l_(V.attributes),N=m_(R,$,Y),T=v0.getBuiltin(V.tagName),k=T?await oX(A,Q,$,Z,Y):!1;if(T&&!k){let C={context:$,filePath:Z,options:Y,dependencies:J},S=T.render(N,V.content,C);if(Object.keys(N.clientReactive).length>0)S=$Q(S,N.clientReactive);if(Object.keys(N.events).length>0){let b=eG(N.events);S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}L=L.substring(0,V.startIndex)+S+L.substring(V.endIndex);continue}if(!_&&V.tagName.includes("-")&&!await oX(A,Q,$,Z,Y))continue;let M={};for(let[C,S]of Object.entries(N.static))M[C]=S;for(let[C,S]of Object.entries(N.serverDynamic))M[C]=S;let I=await s1(A,M,V.content,Q,$,Z,Y,q,J);if(Object.keys(N.clientReactive).length>0)I=$Q(I,N.clientReactive);if(Object.keys(N.events).length>0){let C=YQ(I);if(C){let S=eG(N.events),b=Object.keys(N.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,C.insertPos)+` data-stx-parent-events="${b}" ${S}`+I.substring(C.insertPos)}}L=L.substring(0,V.startIndex)+I+L.substring(V.endIndex)}return L}}function $Q(X,$){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries($).filter(([W])=>!Z.has(W)),G=J.filter(([W])=>!Y.has(W)).map(([W])=>l8(W)).join(" "),Q=X,q=J.length>0?YQ(Q):null;if(q){let W=J.map(([z,B])=>`:${l8(z)}="${B.replace(/"/g,"&quot;")}"`).join(" "),w=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,q.insertPos)+`${w} ${W}`+Q.substring(q.insertPos)}let K=$.if;if(K)Q=`<template :if="${K.replace(/"/g,"&quot;")}">${Q}</template>`;let U=$.for;if(U)Q=`<template :for="${U.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function YQ(X){let $=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(X);if($)return{insertPos:$.index+1+$[1].length};let Z=0;while(Z<X.length){let Y=X.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let q=X.indexOf("-->",Z+4);if(q===-1)return null;Z=q+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let q=`</${G[1].toLowerCase()}>`,K=X.toLowerCase().indexOf(q,Z+G[0].length);if(K===-1)return null;Z=K+q.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function p8(X,$,Z,Y,J){if(!tG)iG(),tG=!0;let G=await ZQ(X,$,Z,Y,J);G=await r_(G,$,Z,Y,J),G=await o_(G,$,Z,Y,J);let Q=[];for(let q=0;q<3;q++){let K=$1(G,V7,(W,w)=>`\x00STX_COMPONENT_COMMENT_${Q.length+w}\x00`);Q.push(...K.tokens);let U=G;if(G=await s_(K.output,$,Z,Y,J),G===U)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,K)=>Q[Number(K)]??"");if(Y.debug){let q=p_(G);if(q.length>0)console.warn(`[stx] ${Z}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return G}var tG=!1,d_,XQ;var H4=E(()=>{p3();nG();aG();l1();A0();O0();e0();d_=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);XQ=new Map});var wQ={};n(wQ,{processLoops:()=>L4,parseLoopBinding:()=>O4});function e_(X,$){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index+G[0].length,q=G.index+G[0].indexOf("("),K=T0(X,"(",")",q);if(K===-1)continue;let U=X.slice(Q,K).trim();if(!U)continue;if(!Object.keys($).some((z)=>new RegExp(`(?:^|[^\\w$.])${z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(U)))continue;let w;try{let z=H0(U,$);if(!z||typeof z!=="object")continue;w=JSON.stringify(z)}catch{continue}Y+=X.slice(J,Q)+w,J=K,Z.lastIndex=K}return J===0?X:Y+X.slice(J)}function XH(X,$){let Z=/@component\s*\(/g,Y=X,J,G=[];while((J=Z.exec(Y))!==null){let Q=J.index,q=Q+J[0].length-1,K=1,U=q+1;while(U<Y.length&&K>0){if(Y[U]==="(")K++;else if(Y[U]===")"){if(K--,K===0)break}U++}if(K!==0)continue;let W=Y.substring(q+1,U),w=U+1,z=W.match(/^\s*['"]([^'"]+)['"]/);if(!z)continue;let B=z[1],j=W.slice(z[0].length),_=j.match(/^\s*,\s*/);if(!_)continue;let H=j.slice(_[0].length).trim();if(!H)continue;try{let L=H0(H,$),O=JSON.stringify(L),F=`@component('${B}', ${O})`;G.push({start:Q,end:w,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:q,end:K,replacement:U}=G[Q];Y=Y.substring(0,q)+U+Y.substring(K)}return Y}function i8(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=J.exec(Y))!==null){let Q=G.index,q=Q+G[0].length-1,K=1,U=q+1,W=null,w=!1;while(U<Y.length&&K>0){let j=Y[U];if(w){w=!1,U++;continue}if(j==="\\"&&W){w=!0,U++;continue}if(W){if(j===W)W=null;U++;continue}if(j==='"'||j==="'"||j==="`"){W=j,U++;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0)break}U++}if(K!==0)break;let z=Y.substring(q+1,U),B=Z(z);Y=Y.substring(0,Q)+B+Y.substring(U+1)}return Y}function $H(X,$){let Z=X;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,J)=>{if(J in $)return`:${J}="${J}"`;return Y}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,J,G)=>{try{let Q=Object.keys($),q=Object.values($);FX(G);let U=Q0(G,Q)(...q),W=JSON.stringify(U),w=Buffer.from(W,"utf8").toString("base64");return`__stx_${J}="${w}"`}catch(Q){return Y}}),Z}function ZH(X,$){let Z=X;return Z=i8(Z,"@break",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(G0(G)){let q=Q0(G,Object.keys($));Q=Boolean(q(...Object.values($)))}else Q=Boolean($0(G,$));return Q?n8:""}catch{return""}}),Z=i8(Z,"@continue",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(G0(G)){let q=Q0(G,Object.keys($));Q=Boolean(q(...Object.values($)))}else Q=Boolean($0(G,$));return Q?r8:""}catch{return""}}),Z}function YH(X){let $=X;return $=$.replace(/@break(?!\()/g,n8),$=$.replace(/@continue(?!\()/g,r8),$}function GQ(X){let $=X.includes(n8),Z=$?X.substring(0,X.indexOf(n8)):X;return{hasBreak:$,content:Z}}function QQ(X){let $=X.includes(r8),Z=$?X.substring(0,X.indexOf(r8)):X;return{hasContinue:$,content:Z}}function KQ(X){let $=X;return $=i8($,"@break",(Z)=>{let Y=Z.trim();if(!VX(Y))return"";return`\`; if (${Y}) { break; } result += \``}),$=i8($,"@continue",(Z)=>{let Y=Z.trim();if(!VX(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),$=$.replace(/@break(?!\()/g,"`; break; result += `"),$=$.replace(/@continue(?!\()/g,"`; continue; result += `"),$}function JH(X){let $=/@forelse\s*\(/g,Z,Y=[],J=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=J.exec(X))!==null)Y.push({pos:Q.index,delta:1});while((Q=G.exec(X))!==null)Y.push({pos:Q.index,delta:-1});Y.sort((W,w)=>W.pos-w.pos);let q=[],K=0;for(let W of Y)K+=W.delta,q.push({pos:W.pos,depth:K});function U(W){let w=0,z=q.length-1,B=0;while(w<=z){let j=w+z>>1;if(q[j].pos<=W)B=q[j].depth,w=j+1;else z=j-1}return B}while((Z=$.exec(X))!==null){if(U(Z.index)>0)continue;let W=Z.index,w=Z.index+Z[0].length-1,z=1,B=w+1,j=-1;while(B<X.length&&z>0){if(X[B]==="(")z++;else if(X[B]===")"){if(z--,z===0){j=B;break}}B++}if(j===-1)continue;let _=X.substring(w+1,j),H=O4(_);if(!H)continue;let{arrayExpr:L,itemVar:O}=H,F=j+1,V=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(V>0&&A<X.length){R.lastIndex=A,N.lastIndex=A;let S=R.exec(X),b=N.exec(X);if(!b)break;if(S&&S.index<b.index)V++,A=S.index+S[0].length;else{if(V--,V===0){T=b.index;break}A=b.index+11}}if(T===-1)continue;let k=X.substring(F,T),M=T+11,y=-1,I=0,C=0;while(C<k.length){let S=k.indexOf("@",C);if(S===-1)break;let b=k.substring(S);if(/^@forelse\s*\(/.test(b))I++,C=S+1;else if(b.startsWith("@endforelse"))I--,C=S+11;else if(I===0&&b.startsWith("@empty")){if(k.length<=S+6||!/[a-z]/i.test(k[S+6])){y=S;break}C=S+1}else C=S+1}if(y===-1)continue;return{start:W,end:M,arrayExpr:L,itemVar:O,foreachContent:k.substring(0,y),emptyContent:k.substring(y+6)}}return null}function qQ(X,$){let Z=X;while(!0){let Y=JH(Z);if(!Y)break;let{start:J,end:G,arrayExpr:Q,itemVar:q,foreachContent:K,emptyContent:U}=Y;try{let W;if(G0(Q))W=Q0(Q,Object.keys($))(...Object.values($));else W=$0(Q,$);let w;if(!Array.isArray(W)||W.length===0)w=U;else w=`@foreach (${Q} as ${q})${K}@endforeach`;Z=Z.substring(0,J)+w+Z.substring(G)}catch(W){let w=W instanceof Error?W.message:String(W),z=X0("Forelse",`Error in @forelse(${Q} as ${q}): ${w}`,s.EVALUATION_ERROR);Z=Z.substring(0,J)+z+Z.substring(G)}}return Z}function O4(X){let $=X.indexOf(" as ");if($!==-1){let G=X.slice(0,$).trim(),Q=X.slice($+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(X);if(!Z)return null;let Y=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Z[2].trim();return Y&&J?{arrayExpr:J,itemVar:Y}:null}function L4(X,$,Z,Y){let J=X;J=qQ(J,$);function G(K){let U=/@foreach\s*\(/g,W;while((W=U.exec(K))!==null){let w=W.index,z=W.index+W[0].length-1,B=1,j=z+1,_=-1;while(j<K.length&&B>0){if(K[j]==="(")B++;else if(K[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let H=K.substring(z+1,_),L=O4(H);if(!L)continue;let O=w,{arrayExpr:F,itemVar:V}=L,A=_+1,R=1,N=A,T=/@foreach\s*\(/g,k=/@endforeach/g;while(R>0&&N<K.length){T.lastIndex=N,k.lastIndex=N;let M=T.exec(K),y=k.exec(K);if(!y)break;if(M&&M.index<y.index)R++,N=M.index+M[0].length;else{if(R--,R===0){let I=K.substring(A,y.index),C=y.index+11;return{start:O,end:C,arrayExpr:F,itemVar:V,content:I}}N=y.index+11}}}return null}function Q(K,U){let W=K;while(!0){let w=G(W);if(!w)break;let{start:z,end:B,arrayExpr:j,itemVar:_,content:H}=w;try{let L=j.trim(),O;if(G0(L))O=Q0(L,Object.keys(U))(...Object.values(U));else O=$0(L,U);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),F=!0;else{console.warn(`[stx] @foreach(${L}) in ${Z}: ${L} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let y=X0("Foreach",`Error in @foreach: ${L} is not iterable`,s.TYPE_ERROR);W=W.substring(0,z)+y+W.substring(B);continue}let V=Y?.loops?.useAltLoopVariable??t_,A=_.trim(),R=null,N,T=!1;if(A.includes("=>")){let y=A.split("=>").map((I)=>I.trim());if(y.length===2&&y[0]&&y[1])R=y[0],N=y[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let y=A.split(",").map((I)=>I.trim());if(y.length===2&&y[0]&&y[1])N=y[0],R=y[1],T=!0;else N=A}else N=A;let k="",M=O;for(let y=0;y<M.length;y++){let I=M[y],C={index:y,iteration:y+1,first:y===0,last:y===M.length-1,count:M.length},S={...U,loop:C,$loop:C};if(N.startsWith("[")&&N.endsWith("]")){let d=N.slice(1,-1).split(",").map((m)=>m.trim());if(Array.isArray(I))d.forEach((m,Y0)=>{if(m)S[m]=I[Y0]});else S[N]=I}else S[N]=I;if(R)if(!T&&F&&Array.isArray(I)&&I.length===2)S[R]=I[0],S[N]=I[1];else S[R]=y;let b=ZH(H,S),P=QQ(b);if(P.hasContinue){k+=P.content;continue}let x=GQ(b);if(x.hasBreak){k+=x.content;break}if(b=qQ(b,S),b=Q(b,S),b=Z5(b,S,Z),b=YH(b),x=GQ(b),x.hasBreak){k+=x.content;break}if(P=QQ(b),P.hasContinue){k+=P.content;continue}b=N1(b,S,Z),b=$H(b,S),b=XH(b,S),b=e_(b,S),k+=b}W=W.substring(0,z)+k+W.substring(B)}catch(L){let O=X0("Foreach",`Error in @foreach(${j.trim()} as ${_.trim()}): ${L instanceof Error?L.message:String(L)}`,s.EVALUATION_ERROR);W=W.substring(0,z)+O+W.substring(B)}}return W}J=Q(J,$),J=WQ(J,$,Z,Y);let q=Y?.loops?.maxWhileIterations??a_;return J=qH(J,$,q),J}function UQ(X){return VX(X)}function WQ(X,$,Z,Y){let J=X,G=!0;while(G){G=!1;let Q=J.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let q=Q.index,K=q+Q[0].length-1,U=T0(J,"(",")",K);if(U===-1)break;let W=J.slice(K+1,U),w=U+1,z=EX(J.slice(q),"for","endfor");if(z.length===0)break;let B=z[0].content,j=q+z[0].end;if(!UQ(W)){let _=X0("For",`Unsafe expression in @for: ${W}`,s.UNSAFE_EXPRESSION);J=J.substring(0,q)+_+J.substring(j),G=!0;continue}try{let _=GH(W),H=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&H){let R=QH({forExpr:W,content:B,iterVarNames:_,context:$,filePath:Z,options:Y});J=J.substring(0,q)+R+J.substring(j),G=!0;continue}let L=Object.keys($),O=Object.values($),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=KQ(F);let A=Function(...L,`
13442
13515
  let result = '';
13443
13516
  for (${W}) {
13444
13517
  result += \`${F}\`;
13445
13518
  }
13446
13519
  return result;
13447
- `)(...O);J=J.substring(0,q)+A+J.substring(j),G=!0}catch(_){let H=X0("For",`Error in @for(${W}): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR);J=J.substring(0,q)+H+J.substring(j),G=!0}}return J}function r_(X){let $=X.trim(),Z=$.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Z){let G=Z[1];return G.slice(1,-1).split(",").map((q)=>{let K=q.trim();if(!K)return"";let U=K.indexOf(":");if(U>=0&&G.startsWith("{")){let z=K.slice(U+1).trim(),B=z.indexOf("=");return(B>=0?z.slice(0,B):z).trim()}let W=K.indexOf("="),w=(W>=0?K.slice(0,W):K).trim();return/^[A-Za-z_$][\w$]*$/.test(w)?w:""}).filter(Boolean)}let Y=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let J=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(J)return[J[1]];return[]}function o_(X){let{forExpr:$,content:Z,iterVarNames:Y,context:J,filePath:G,options:Q}=X,q=Object.keys(J),K=Object.values(J),U=Function(...q,"__pushIter",`
13520
+ `)(...O);J=J.substring(0,q)+A+J.substring(j),G=!0}catch(_){let H=X0("For",`Error in @for(${W}): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR);J=J.substring(0,q)+H+J.substring(j),G=!0}}return J}function GH(X){let $=X.trim(),Z=$.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Z){let G=Z[1];return G.slice(1,-1).split(",").map((q)=>{let K=q.trim();if(!K)return"";let U=K.indexOf(":");if(U>=0&&G.startsWith("{")){let z=K.slice(U+1).trim(),B=z.indexOf("=");return(B>=0?z.slice(0,B):z).trim()}let W=K.indexOf("="),w=(W>=0?K.slice(0,W):K).trim();return/^[A-Za-z_$][\w$]*$/.test(w)?w:""}).filter(Boolean)}let Y=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let J=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(J)return[J[1]];return[]}function QH(X){let{forExpr:$,content:Z,iterVarNames:Y,context:J,filePath:G,options:Q}=X,q=Object.keys(J),K=Object.values(J),U=Function(...q,"__pushIter",`
13448
13521
  for (${$}) {
13449
13522
  __pushIter([${Y.join(", ")}])
13450
13523
  }
13451
- `),W=[];U(...K,(B)=>{W.push(B)});let w=G??"inline.stx",z="";for(let B of W){let j={...J};Y.forEach((H,L)=>{j[H]=B[L]});let _=eG(Z,j,G,Q);_=$5(_,j,w),_=T1(_,j,w),z+=_}return z}function s_(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@while\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,q=Q+G[0].length-1,K=N0(Y,"(",")",q);if(K===-1)break;let U=Y.slice(q+1,K),W=IX(Y.slice(Q),"while","endwhile");if(W.length===0)break;let w=W[0].content,z=Q+W[0].end;if(!tG(U)){let B=X0("While",`Unsafe expression in @while: ${U}`,s.UNSAFE_EXPRESSION);Y=Y.substring(0,Q)+B+Y.substring(z),J=!0;continue}try{let B=Object.keys($),j=Object.values($),_=w.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});_=aG(_);let L=Function(...B,`
13524
+ `),W=[];U(...K,(B)=>{W.push(B)});let w=G??"inline.stx",z="";for(let B of W){let j={...J};Y.forEach((H,L)=>{j[H]=B[L]});let _=WQ(Z,j,G,Q);_=Z5(_,j,w),_=N1(_,j,w),z+=_}return z}function qH(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@while\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,q=Q+G[0].length-1,K=T0(Y,"(",")",q);if(K===-1)break;let U=Y.slice(q+1,K),W=EX(Y.slice(Q),"while","endwhile");if(W.length===0)break;let w=W[0].content,z=Q+W[0].end;if(!UQ(U)){let B=X0("While",`Unsafe expression in @while: ${U}`,s.UNSAFE_EXPRESSION);Y=Y.substring(0,Q)+B+Y.substring(z),J=!0;continue}try{let B=Object.keys($),j=Object.values($),_=w.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});_=KQ(_);let L=Function(...B,`
13452
13525
  let result = '';
13453
13526
  let maxIterations = ${Z}; // Configurable safety limit
13454
13527
  let counter = 0;
@@ -13460,21 +13533,21 @@ ${I}
13460
13533
  result += '<!-- [While Error [1104]]: Maximum iterations (${Z}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
13461
13534
  }
13462
13535
  return result;
13463
- `)(...j);Y=Y.substring(0,Q)+L+Y.substring(z),J=!0}catch(B){let j=X0("While",`Error in @while(${U}): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR);Y=Y.substring(0,Q)+j+Y.substring(z),J=!0}}return Y}var u_=1000,d_=!1,n8="<!--__STX_BREAK__-->",r8="<!--__STX_CONTINUE__-->";var z4=D(()=>{C8();w1();Z1();EX();O0()});import z0 from"path";function j4(X,$){let Z=0;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J===","&&Z===0)return Y}return-1}function a_(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=J.exec(Y);while(G){let Q=G.index,q=Q+G[0].length-1,K=1,U=q+1;while(U<Y.length&&K>0){if(Y[U]==="(")K++;else if(Y[U]===")")K--;U++}if(K!==0)break;let W=Y.substring(q+1,U-1),w=`${Z}(${W})`;Y=Y.substring(0,Q)+w+Y.substring(U),J.lastIndex=Q+w.length,G=J.exec(Y)}return Y}function t_(X){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(X)}function ZQ(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,q=(w)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===w){G++;return}G++}},K=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let w=1;while(G<Q&&w>0)if($[G]==="{")w++,G++;else if($[G]==="}")w--,G++;else if($[G]==="'"||$[G]==='"')q($[G]);else if($[G]==="`")K();else G++;continue}G++}},U=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
13464
- `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},W=()=>{if(J!==0)return;let w=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(w){let j=w[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let z=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let j=z[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(G<Q){if(U())continue;if($[G]==="'"||$[G]==='"'){q($[G]);continue}if($[G]==="`"){K();continue}if($[G]==="{"){J++,G++;continue}if($[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))W();G++}return Z.join(", ")}function YQ(X,$=""){let Z=ZQ(X).split(",").map((Y)=>Y.trim()).filter(Boolean);return`
13536
+ `)(...j);Y=Y.substring(0,Q)+L+Y.substring(z),J=!0}catch(B){let j=X0("While",`Error in @while(${U}): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR);Y=Y.substring(0,Q)+j+Y.substring(z),J=!0}}return Y}var a_=1000,t_=!1,n8="<!--__STX_BREAK__-->",r8="<!--__STX_CONTINUE__-->";var F4=E(()=>{C8();w1();Z1();DX();O0()});import z0 from"path";function V4(X,$){let Z=0;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J===","&&Z===0)return Y}return-1}function KH(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=J.exec(Y);while(G){let Q=G.index,q=Q+G[0].length-1,K=1,U=q+1;while(U<Y.length&&K>0){if(Y[U]==="(")K++;else if(Y[U]===")")K--;U++}if(K!==0)break;let W=Y.substring(q+1,U-1),w=`${Z}(${W})`;Y=Y.substring(0,Q)+w+Y.substring(U),J.lastIndex=Q+w.length,G=J.exec(Y)}return Y}function UH(X){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(X)}function jQ(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,q=(w)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===w){G++;return}G++}},K=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let w=1;while(G<Q&&w>0)if($[G]==="{")w++,G++;else if($[G]==="}")w--,G++;else if($[G]==="'"||$[G]==='"')q($[G]);else if($[G]==="`")K();else G++;continue}G++}},U=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
13537
+ `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},W=()=>{if(J!==0)return;let w=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(w){let j=w[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let z=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(z){let j=z[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(G<Q){if(U())continue;if($[G]==="'"||$[G]==='"'){q($[G]);continue}if($[G]==="`"){K();continue}if($[G]==="{"){J++,G++;continue}if($[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))W();G++}return Z.join(", ")}function BQ(X,$=""){let Z=jQ(X).split(",").map((Y)=>Y.trim()).filter(Boolean);return`
13465
13538
  (function() {
13466
- ${L5("var",Z)}
13539
+ ${F5("var",Z)}
13467
13540
  var __destroyHooks = [];
13468
13541
  var __origOnDestroy = onDestroy;
13469
13542
  onDestroy = function(fn) { __origOnDestroy(fn); __destroyHooks.push(fn); };
13470
13543
 
13471
13544
  ${X}
13472
13545
  ${$}})();
13473
- `}function JQ(X,$){return`
13546
+ `}function _Q(X,$){return`
13474
13547
  // Register scope variables for STX runtime
13475
13548
  if (!window.stx._scopes) window.stx._scopes = {};
13476
13549
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
13477
- ${ZQ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeRegistration[${JSON.stringify(G)}] = ${G}; } catch (e) { /* not actually top-level */ }`).join(`
13550
+ ${jQ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeRegistration[${JSON.stringify(G)}] = ${G}; } catch (e) { /* not actually top-level */ }`).join(`
13478
13551
  `)}
13479
13552
  // #1767: when the bundler renamed a component const that collided with an
13480
13553
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -13482,7 +13555,7 @@ ${ZQ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
13482
13555
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
13483
13556
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
13484
13557
  window.stx._scopes['${$}'] = __scopeRegistration;
13485
- `}function e_(X,$){let Z=JQ(X,$),Y=`
13558
+ `}function WH(X,$){let Z=_Q(X,$),Y=`
13486
13559
  (function() {
13487
13560
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${$}"]') : null;
13488
13561
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -13491,72 +13564,73 @@ ${ZQ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
13491
13564
  } finally {
13492
13565
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
13493
13566
  }
13494
- })();`;return Y+YQ(X,Z)+`
13567
+ })();`;return Y+BQ(X,Z)+`
13495
13568
  } finally {
13496
13569
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
13497
13570
  }
13498
- })();`}function XH(X,$){let Z=X.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let J=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:X,mergedIntoExisting:J[1]};let G=Z[1],Q=Z[2],q=Z[3];return{html:`${G}${Q} data-stx-scope="${$}"${q}${X.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:X,mergedIntoExisting:null}}function ZH(X){if(X.__onceStore instanceof Set)return X.__onceStore;return $H}async function B4(X,$,Z,Y,J,G=new Set){let Q=Y.partialsDir||z0.join(z0.dirname(Z),"partials");if(Q&&!z0.isAbsolute(Q))Q=z0.resolve(process.cwd(),Q);let q=a_(X,"@partial","@include"),K=ZH($);q=q.replace(/@once([\s\S]*?)@endonce/g,(j,_,H)=>{let L=_.trim(),O=`${Z}:${L}`;if(K.has(O))return"";return K.add(O),_});{let j=/@includeIf\s*\(/g,_;while((_=j.exec(q))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<q.length&&O>0){if(q[F]==="(")O++;else if(q[F]===")")O--;F++}if(O!==0)break;let V=q.substring(L+1,F-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=F;continue}let R=A[1],T=U(R,Q,Z),N="";if(T&&await Bun.file(T).exists())J.add(T),N=`@include(${V})`;q=q.substring(0,H)+N+q.substring(F),j.lastIndex=0}}for(let[j,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let H=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=H.exec(q))!==null){let O=L.index,F=O+L[0].length-1,V=1,A=F+1;while(A<q.length&&V>0){if(q[A]==="(")V++;else if(q[A]===")")V--;A++}if(V!==0)break;let R=q.substring(F+1,A-1),T=j4(R,0);if(T===-1){H.lastIndex=A;continue}let N=R.substring(0,T).trim(),k=R.substring(T+1).trim(),M=k.match(/^\s*['"]([^'"]+)['"]/);if(!M){H.lastIndex=A;continue}let y=M[1],I=k.substring(M[0].length),C,S=j4(I,0);if(S!==-1)C=I.substring(S+1).trim();try{let b=`Boolean(${N})`,P;if(G0(b)){let m=Q0(b,Object.keys($));P=Boolean(m(...Object.values($)))}else P=Boolean($0(b,$));let x=_?!P:P,d="";if(x){let m=U(y,Q,Z);if(m&&await Bun.file(m).exists())J.add(m);d=`@include('${y}'${C?`, ${C}`:""})`}q=q.substring(0,O)+d+q.substring(A),H.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),x=U0("Include",`Error evaluating ${j} condition: ${P}`,Z,X,O);q=q.substring(0,O)+x+q.substring(A),H.lastIndex=0}}}{let j=/@each\s*\(/g,_;while((_=j.exec(q))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<q.length&&O>0){if(q[F]==="(")O++;else if(q[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let V=q.substring(L+1,F),A=q.substring(H,F+1),R=V.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){j.lastIndex=0,q=q.replace(A,"");continue}let[,T,N,k,M]=R;try{let y,I=N.trim();if(G0(I))y=Q0(I,Object.keys($))(...Object.values($));else y=$0(I,$);let C="";if(Array.isArray(y)&&y.length>0)for(let S of y){let b={...$,[k]:S},P=await w(T,b,X,H);C+=P}else if(M)C=await w(M,{},X,H);q=q.substring(0,H)+C+q.substring(F+1),j.lastIndex=0}catch(y){let I=y instanceof Error?y.message:String(y);q=q.substring(0,H)+U0("Each",`Error in @each: ${I}`,Z,X,H)+q.substring(F+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,_;while((_=j.exec(q))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<q.length&&O>0){if(q[F]==="(")O++;else if(q[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let V=q.substring(L+1,F),A=q.substring(H,F+1),R=V.match(/^\s*(\[[^\]]+\])/);if(!R){j.lastIndex=0,q=q.replace(A,"");continue}let T=R[1],N=V.slice(R[0].length),k,M=N.match(/^\s*,\s*\{/);if(M){N=N.slice(M[0].length-1);let C=1,S=1;while(S<N.length&&C>0){if(N[S]==="{")C++;else if(N[S]==="}"){if(C--,C===0)break}S++}k=N.substring(0,S+1),N=N.slice(S+1)}let y,I=N.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(I)y=I[1];try{let C=JSON.parse(T.replace(/'/g,'"')),S={};if(k)try{S=H0(k,$)}catch(P){let x=P instanceof Error?P.message:String(P);if(Y.debug){let d=U0("Include",`Error parsing includeFirst variables: ${x}`,Z,X,H,A);q=q.replace(A,()=>d)}else q=q.replace(A,()=>y||"");continue}let b=!1;for(let P of C){let x=U(P,Q,Z);if(!x)continue;if(await p(x)){let d=await w(P,S,X,H);q=q.replace(A,()=>d),b=!0;break}}if(!b)if(y!==void 0)q=q.replace(A,()=>y);else if(Y.debug){let P=U0("Include",`None of the includeFirst paths exist: ${T}`,Z,X,H,A);q=q.replace(A,()=>P)}else q=q.replace(A,"")}catch(C){let S=C instanceof Error?C.message:String(C),b=U0("Include",`Error processing @includeFirst: ${S}`,Z,X,H,A);q=q.replace(A,()=>b)}j.lastIndex=0}}function U(j,_,H){try{let L=j;if(!j.endsWith(".stx"))L=`${j}.stx`;let O=z0.resolve(_),F=z0.resolve(z0.dirname(H)),V;if(!L.startsWith("./")&&!L.startsWith("../"))V=z0.resolve(_,L);else V=z0.resolve(F,L);let A=z0.normalize(V),R=A.startsWith(O+z0.sep)||A===O,T=A.startsWith(F+z0.sep)||A===F,N=!1,k=z0.dirname(F);if(A.startsWith(k+z0.sep)){if(!z0.relative(k,A).split(z0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))N=!0}if(!R&&!T&&!N)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${F}`),null;return A}catch(L){return console.error(`Error resolving path ${j}: ${L}`),null}}let W=z0.resolve(Z);G.add(W);async function w(j,_={},H,L){let O=U(j,Q,Z);if(!O)return U0("Include",`Could not resolve path for include: ${j}`,Z,H,L);let F=z0.resolve(O);if(G.has(F)){let V=[...G,F].map((A)=>z0.basename(A)).join(" -> ");return U0("Include",`Circular include detected: ${V}`,Z,H,L)}try{J.add(O);let V;if(!V)try{V=await Bun.file(O).text()}catch(x){let d=x instanceof Error?x.message:String(x);return U0("Include",`Error loading include file ${j}: ${d}`,Z,H,L)}if(V)V=V.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(V&&V.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (P3(),C3));V=x(V,$)}if(V&&(Y.debug||!S7()&&!A8()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (x3(),AG));x(V,O)}catch{}let A=V;try{let{processESImports:x}=await Promise.resolve().then(() => (U4(),nG));await x(V,$,O,Y,J)}catch(x){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,x instanceof Error?x.message:x)}let R=TX(A);if(R)A=R.content.trim();let N=V.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k="";if(N)k=`<style${N[1]}>${N[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let M={...$};M.__stx_signals_gate=W1(V);for(let[x,d]of Object.entries(_))M[x]=d;let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...V.matchAll(y)],C="",S=null;for(let x of I){let d=x[1]||"",m=x[2]||"",Y0=d.includes("server"),m0=d1(d),F0="";try{let{extractAndStripCssImports:l,renderVendorStyleTags:j0}=await Promise.resolve().then(() => (L7(),F6)),l0=l(m,{filePath:O,projectRoot:process.cwd()});m=l0.code,F0=j0(l0.styles)}catch(l){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,l instanceof Error?l.message:l)}if(m0&&m.trim())m=m1(m);if(!Y0)try{let{hasUserImports:l,bundleClientScript:j0}=await Promise.resolve().then(() => (j7(),z7));if(l(m))m=await j0(m,O,{projectRoot:process.cwd()})}catch(l){if(Y.debug)console.warn(`[stx] bundler skipped for ${O}:`,l instanceof Error?l.message:l)}let i0=t_(m);if(i0&&!Y0){S=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++$Q}`;let l=f0(m),j0=e_(l,S);C+=`${F0}<script data-stx-scoped data-stx-run="always">${j0}</script>
13499
- `;continue}if(Y0)try{let{extractVariables:l}=await Promise.resolve().then(() => (M7(),kX));await l(m,M,O)}catch(l){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,l)}if(!Y0&&!i0){let l=d.replace(/\bclient\b/i,"").trim();S=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++$Q}`;let j0=f0(m),l0=JQ(j0,S),_1=YQ(j0,l0);C+=`${F0}<script data-stx-scoped data-stx-run="always"${l?` ${l}`:""}>${_1}</script>
13500
- `}}if(S){let x=XH(A,S);if(A=x.html,x.mergedIntoExisting)C=C.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),S=x.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await B4(A,M,O,Y,J,G);let{processLoops:b}=await Promise.resolve().then(() => (z4(),XQ)),P=b(A,M,O);if(P=$5(P,M,O),P=T1(P,M,O),k)P+=`
13571
+ })();`}function wH(X,$){let Z=X.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let J=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:X,mergedIntoExisting:J[1]};let G=Z[1],Q=Z[2],q=Z[3];return{html:`${G}${Q} data-stx-scope="${$}"${q}${X.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:X,mergedIntoExisting:null}}function jH(X){if(X.__onceStore instanceof Set)return X.__onceStore;return zH}async function A4(X,$,Z,Y,J,G=new Set){let Q=Y.partialsDir||z0.join(z0.dirname(Z),"partials");if(Q&&!z0.isAbsolute(Q))Q=z0.resolve(process.cwd(),Q);let q=KH(X,"@partial","@include"),K=jH($);q=q.replace(/@once([\s\S]*?)@endonce/g,(j,_,H)=>{let L=_.trim(),O=`${Z}:${L}`;if(K.has(O))return"";return K.add(O),_});{let j=/@includeIf\s*\(/g,_;while((_=j.exec(q))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<q.length&&O>0){if(q[F]==="(")O++;else if(q[F]===")")O--;F++}if(O!==0)break;let V=q.substring(L+1,F-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=F;continue}let R=A[1],N=U(R,Q,Z),T="";if(N&&await Bun.file(N).exists())J.add(N),T=`@include(${V})`;q=q.substring(0,H)+T+q.substring(F),j.lastIndex=0}}for(let[j,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let H=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=H.exec(q))!==null){let O=L.index,F=O+L[0].length-1,V=1,A=F+1;while(A<q.length&&V>0){if(q[A]==="(")V++;else if(q[A]===")")V--;A++}if(V!==0)break;let R=q.substring(F+1,A-1),N=V4(R,0);if(N===-1){H.lastIndex=A;continue}let T=R.substring(0,N).trim(),k=R.substring(N+1).trim(),M=k.match(/^\s*['"]([^'"]+)['"]/);if(!M){H.lastIndex=A;continue}let y=M[1],I=k.substring(M[0].length),C,S=V4(I,0);if(S!==-1)C=I.substring(S+1).trim();try{let b=`Boolean(${T})`,P;if(G0(b)){let m=Q0(b,Object.keys($));P=Boolean(m(...Object.values($)))}else P=Boolean($0(b,$));let x=_?!P:P,d="";if(x){let m=U(y,Q,Z);if(m&&await Bun.file(m).exists())J.add(m);d=`@include('${y}'${C?`, ${C}`:""})`}q=q.substring(0,O)+d+q.substring(A),H.lastIndex=0}catch(b){let P=b instanceof Error?b.message:String(b),x=U0("Include",`Error evaluating ${j} condition: ${P}`,Z,X,O);q=q.substring(0,O)+x+q.substring(A),H.lastIndex=0}}}{let j=/@each\s*\(/g,_;while((_=j.exec(q))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<q.length&&O>0){if(q[F]==="(")O++;else if(q[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let V=q.substring(L+1,F),A=q.substring(H,F+1),R=V.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!R){j.lastIndex=0,q=q.replace(A,"");continue}let[,N,T,k,M]=R;try{let y,I=T.trim();if(G0(I))y=Q0(I,Object.keys($))(...Object.values($));else y=$0(I,$);let C="";if(Array.isArray(y)&&y.length>0)for(let S of y){let b={...$,[k]:S},P=await w(N,b,X,H);C+=P}else if(M)C=await w(M,{},X,H);q=q.substring(0,H)+C+q.substring(F+1),j.lastIndex=0}catch(y){let I=y instanceof Error?y.message:String(y);q=q.substring(0,H)+U0("Each",`Error in @each: ${I}`,Z,X,H)+q.substring(F+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,_;while((_=j.exec(q))!==null){let H=_.index,L=H+_[0].length-1,O=1,F=L+1;while(F<q.length&&O>0){if(q[F]==="(")O++;else if(q[F]===")"){if(O--,O===0)break}F++}if(O!==0)break;let V=q.substring(L+1,F),A=q.substring(H,F+1),R=V.match(/^\s*(\[[^\]]+\])/);if(!R){j.lastIndex=0,q=q.replace(A,"");continue}let N=R[1],T=V.slice(R[0].length),k,M=T.match(/^\s*,\s*\{/);if(M){T=T.slice(M[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++}k=T.substring(0,S+1),T=T.slice(S+1)}let y,I=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(I)y=I[1];try{let C=JSON.parse(N.replace(/'/g,'"')),S={};if(k)try{S=H0(k,$)}catch(P){let x=P instanceof Error?P.message:String(P);if(Y.debug){let d=U0("Include",`Error parsing includeFirst variables: ${x}`,Z,X,H,A);q=q.replace(A,()=>d)}else q=q.replace(A,()=>y||"");continue}let b=!1;for(let P of C){let x=U(P,Q,Z);if(!x)continue;if(await p(x)){let d=await w(P,S,X,H);q=q.replace(A,()=>d),b=!0;break}}if(!b)if(y!==void 0)q=q.replace(A,()=>y);else if(Y.debug){let P=U0("Include",`None of the includeFirst paths exist: ${N}`,Z,X,H,A);q=q.replace(A,()=>P)}else q=q.replace(A,"")}catch(C){let S=C instanceof Error?C.message:String(C),b=U0("Include",`Error processing @includeFirst: ${S}`,Z,X,H,A);q=q.replace(A,()=>b)}j.lastIndex=0}}function U(j,_,H){try{let L=j;if(!j.endsWith(".stx"))L=`${j}.stx`;let O=z0.resolve(_),F=z0.resolve(z0.dirname(H)),V;if(!L.startsWith("./")&&!L.startsWith("../"))V=z0.resolve(_,L);else V=z0.resolve(F,L);let A=z0.normalize(V),R=A.startsWith(O+z0.sep)||A===O,N=A.startsWith(F+z0.sep)||A===F,T=!1,k=z0.dirname(F);if(A.startsWith(k+z0.sep)){if(!z0.relative(k,A).split(z0.sep).some((C)=>C.startsWith(".")&&C!=="."&&C!==".."))T=!0}if(!R&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${F}`),null;return A}catch(L){return console.error(`Error resolving path ${j}: ${L}`),null}}let W=z0.resolve(Z);G.add(W);async function w(j,_={},H,L){let O=U(j,Q,Z);if(!O)return U0("Include",`Could not resolve path for include: ${j}`,Z,H,L);let F=z0.resolve(O);if(G.has(F)){let V=[...G,F].map((A)=>z0.basename(A)).join(" -> ");return U0("Include",`Circular include detected: ${V}`,Z,H,L)}try{J.add(O);let V;if(!V)try{V=await Bun.file(O).text()}catch(x){let d=x instanceof Error?x.message:String(x);return U0("Include",`Error loading include file ${j}: ${d}`,Z,H,L)}if(V)V=V.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(V&&V.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (d3(),u3));V=x(V,$)}if(V&&(Y.debug||!C7()&&!A8()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (l3(),SG));x(V,O)}catch{}let A=V;try{let{processESImports:x}=await Promise.resolve().then(() => (H4(),JQ));await x(V,$,O,Y,J)}catch(x){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,x instanceof Error?x.message:x)}let R=TX(A);if(R)A=R.content.trim();let T=V.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k="";if(T)k=`<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 M={...$};M.__stx_signals_gate=W1(V);for(let[x,d]of Object.entries(_))M[x]=d;let y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,I=[...V.matchAll(y)],C="",S=null;for(let x of I){let d=x[1]||"",m=x[2]||"",Y0=d.includes("server"),d0=d1(d),F0="";try{let{extractAndStripCssImports:l,renderVendorStyleTags:j0}=await Promise.resolve().then(() => (F7(),M6)),m0=l(m,{filePath:O,projectRoot:process.cwd()});m=m0.code,F0=j0(m0.styles)}catch(l){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,l instanceof Error?l.message:l)}if(d0&&m.trim())m=m1(m);if(!Y0)try{let{hasUserImports:l,bundleClientScript:j0}=await Promise.resolve().then(() => (B7(),j7));if(l(m))m=await j0(m,O,{projectRoot:process.cwd()})}catch(l){if(Y.debug)console.warn(`[stx] bundler skipped for ${O}:`,l instanceof Error?l.message:l)}let p0=UH(m);if(p0&&!Y0){S=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++zQ}`;let l=f0(m),j0=WH(l,S);C+=`${F0}<script data-stx-scoped data-stx-run="always">${j0}</script>
13572
+ `;continue}if(Y0)try{let{extractVariables:l}=await Promise.resolve().then(() => (k7(),IX));await l(m,M,O)}catch(l){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,l)}if(!Y0&&!p0){let l=d.replace(/\bclient\b/i,"").trim();S=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++zQ}`;let j0=f0(m),m0=_Q(j0,S),_1=BQ(j0,m0);C+=`${F0}<script data-stx-scoped data-stx-run="always"${l?` ${l}`:""}>${_1}</script>
13573
+ `}}if(S){let x=wH(A,S);if(A=x.html,x.mergedIntoExisting)C=C.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),S=x.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await A4(A,M,O,Y,J,G);let{processLoops:b}=await Promise.resolve().then(() => (F4(),wQ)),P=b(A,M,O);if(P=Z5(P,M,O),P=N1(P,M,O),k)P+=`
13501
13574
  `+k;if(C)P+=`
13502
- `+C;return P}catch(V){let A=V instanceof Error?V.message:String(V);return U0("Include",`Error processing include ${j}: ${A}`,Z,H,L)}}let z=/@include\s*\(/g,B;while((B=z.exec(q))!==null){let j=B.index,_=j+B[0].length-1,H=1,L=_+1;while(L<q.length&&H>0){if(q[L]==="(")H++;else if(q[L]===")")H--;L++}if(H!==0)break;let O=q.substring(j,L),F=q.substring(_+1,L-1),V=F.match(/^\s*['"]([^'"]+)['"]/);if(!V){z.lastIndex=L;continue}let A=V[1],R,T=F.substring(V[0].length),N=j4(T,0);if(N!==-1)R=T.substring(N+1).trim();let k={};if(R)try{k=H0(R,$)}catch(y){let I=y instanceof Error?y.message:String(y);q=q.replace(O,U0("Include",`Error parsing include variables for ${A}: ${I}`,Z,X,j)),z.lastIndex=0;continue}let M=await w(A,k,X,j);q=q.substring(0,j)+M+q.substring(L),z.lastIndex=0}return q}function _4(X,$){let Z=X;function Y(J,G,Q,q){let K=J,U=!0;while(U){U=!1;let W=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),w=K.match(W);if(!w||w.index===void 0)break;let z=w.index,B=w[1],j=z+w[0].length,_=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),L=1,O=j,F=-1;while(L>0&&O<K.length){let A=K.slice(O),R=A.match(_),T=A.match(H),N=R?O+R.index:1/0,k=T?O+T.index:1/0;if(N<k)L++,O=N+(R[0].length||1);else if(k<1/0){if(L--,L===0){F=k;break}O=k+Q.length+1}else break}if(F===-1)break;let V=K.slice(j,F);if(!$[B])$[B]=[];if(q)$[B].unshift(V);else $[B].push(V);K=K.substring(0,z)+K.substring(F+`@${Q}`.length),U=!0}return K}return Z=Y(Z,"push","endpush",!1),Z=Y(Z,"prepend","endprepend",!0),Z}function H4(X,$){return X.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,Y)=>{if(!$[Y]||$[Y].length===0)return"";return $[Y].join(`
13503
- `)})}var $Q=0,hk,$H;var GQ=D(()=>{e$();C8();Z1();X1();N5();O0();A0();hk=new c1(500),$H=new Set});import*as O4 from"path";async function QQ(X,$,Z=""){if(O4.basename(Z)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,X.replace(/@js[\s\S]*?@endjs/g,"");return KQ(X,$,Z,"@js","@endjs")}async function qQ(X,$,Z=""){if(O4.basename(Z)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return X.replace(/@ts[\s\S]*?@endts/g,"")}return KQ(X,$,Z,"@ts","@endts")}async function KQ(X,$,Z,Y,J){let G=X,Q=T5(`${Y}([\\s\\S]*?)${J}`,"g"),q=[],K;while((K=Q.exec(X))!==null)q.push({fullMatch:K[0],content:K[1]||"",index:K.index});for(let{fullMatch:U,content:W,index:w}of q)try{let z={...$,global:$},B=Object.keys(z),j=Object.values(z),_=W.trim();if(Y==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=L.length>0?`return { ${L.join(", ")} };`:"return {};",F=`
13575
+ `+C;return P}catch(V){let A=V instanceof Error?V.message:String(V);return U0("Include",`Error processing include ${j}: ${A}`,Z,H,L)}}let z=/@include\s*\(/g,B;while((B=z.exec(q))!==null){let j=B.index,_=j+B[0].length-1,H=1,L=_+1;while(L<q.length&&H>0){if(q[L]==="(")H++;else if(q[L]===")")H--;L++}if(H!==0)break;let O=q.substring(j,L),F=q.substring(_+1,L-1),V=F.match(/^\s*['"]([^'"]+)['"]/);if(!V){z.lastIndex=L;continue}let A=V[1],R,N=F.substring(V[0].length),T=V4(N,0);if(T!==-1)R=N.substring(T+1).trim();let k={};if(R)try{k=H0(R,$)}catch(y){let I=y instanceof Error?y.message:String(y);q=q.replace(O,U0("Include",`Error parsing include variables for ${A}: ${I}`,Z,X,j)),z.lastIndex=0;continue}let M=await w(A,k,X,j);q=q.substring(0,j)+M+q.substring(L),z.lastIndex=0}return q}function R4(X,$){let Z=X;function Y(J,G,Q,q){let K=J,U=!0;while(U){U=!1;let W=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),w=K.match(W);if(!w||w.index===void 0)break;let z=w.index,B=w[1],j=z+w[0].length,_=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),L=1,O=j,F=-1;while(L>0&&O<K.length){let A=K.slice(O),R=A.match(_),N=A.match(H),T=R?O+R.index:1/0,k=N?O+N.index:1/0;if(T<k)L++,O=T+(R[0].length||1);else if(k<1/0){if(L--,L===0){F=k;break}O=k+Q.length+1}else break}if(F===-1)break;let V=K.slice(j,F);if(!$[B])$[B]=[];if(q)$[B].unshift(V);else $[B].push(V);K=K.substring(0,z)+K.substring(F+`@${Q}`.length),U=!0}return K}return Z=Y(Z,"push","endpush",!1),Z=Y(Z,"prepend","endprepend",!0),Z}function N4(X,$){return X.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,Y)=>{if(!$[Y]||$[Y].length===0)return"";return $[Y].join(`
13576
+ `)})}var zQ=0,YI,zH;var HQ=E(()=>{e$();C8();Z1();e0();M5();O0();A0();YI=new c1(500),zH=new Set});import*as T4 from"path";async function OQ(X,$,Z=""){if(T4.basename(Z)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,X.replace(/@js[\s\S]*?@endjs/g,"");return FQ(X,$,Z,"@js","@endjs")}async function LQ(X,$,Z=""){if(T4.basename(Z)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return X.replace(/@ts[\s\S]*?@endts/g,"")}return FQ(X,$,Z,"@ts","@endts")}async function FQ(X,$,Z,Y,J){let G=X,Q=T5(`${Y}([\\s\\S]*?)${J}`,"g"),q=[],K;while((K=Q.exec(X))!==null)q.push({fullMatch:K[0],content:K[1]||"",index:K.index});for(let{fullMatch:U,content:W,index:w}of q)try{let z={...$,global:$},B=Object.keys(z),j=Object.values(z),_=W.trim();if(Y==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=L.length>0?`return { ${L.join(", ")} };`:"return {};",F=`
13504
13577
  ${_}
13505
13578
  ${O}
13506
- `,A=Function(...B,F)(...j);if(A&&typeof A==="object")Object.assign($,A);G=G.replace(U,"")}catch(z){console.error(`Error executing ${Y} code block in ${Z}:`,z);let B=z instanceof Error?z.message:String(z),j=U0(`${Y} Directive`,`Error executing code: ${B}`,Z,X,w,U);console.error(j),G=G.replace(U,"")}return G}var UQ=D(()=>{N5();A0()});function YH(X,$="_method"){let Z=X.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${$}" value="${Z}">`}function WQ(X){return X.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,($,Z,Y,J,G)=>{return YH(Y,G||"_method")})}async function wQ(X,$,Z,Y,J){if(!Y.middleware||Y.middleware.length===0)return X;let G=X,Q=Y.middleware.filter((q)=>q.timing===J);if(Q.length===0)return G;for(let q of Q){if(!q.name||typeof q.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",q);continue}try{let K=await q.handler(G,$,Z,Y);if(typeof K==="string")G=K;else if(Y.debug)console.warn(`Middleware ${q.name} did not return a string`)}catch(K){if(Y.debug)console.error(`Error in middleware ${q.name}:`,K);if(Y.debug){let U=U0("Middleware",`Error in middleware '${q.name}': ${K instanceof Error?K.message:String(K)}`,Z,X);G=G.replace(/<body[^>]*>/,`$&
13507
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${o0(U)}</div>
13508
- `)}}}return G}async function zQ(X,$,Z,Y){return wQ(X,$,Z,Y,"before")}async function jQ(X,$,Z,Y){return wQ(X,$,Z,Y,"after")}var BQ=D(()=>{Z1();A0()});function _Q(X){return X.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,($,Z,Y,J,G)=>{try{let Q=J?H0(J,{}):{};return Q7(Y,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var HQ=D(()=>{g1();g1();O0()});async function OQ(X,$){let Z=X.split("/").pop()?.split(".")[0]||"";if(l7.exact[X])for(let Y of l7.exact[X])await Promise.resolve(Y($,X));if(l7.exact[Z])for(let Y of l7.exact[Z])await Promise.resolve(Y($,X));for(let{pattern:Y,callback:J}of l7.patterns)if(Y.test(X)||Y.test(Z))await Promise.resolve(J($,X))}var l7;var LQ=D(()=>{l7={patterns:[],exact:{}}});function FQ(X){if(typeof X==="string")return X;if(Array.isArray(X))return X.filter(Boolean).map(($)=>FQ($)).join(" ");if(X&&typeof X==="object")return Object.entries(X).filter(([,$])=>$).map(([$])=>$).join(" ");return X?String(X):""}function VQ(X,$){if(!/:[\w-]+=/.test(X))return X;let Z=X,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],G;while((G=Y.exec(X))!==null)J.push([G.index,G.index+G[0].length]);function Q(U){return J.some(([W,w])=>U>=W&&U<w)}let q=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,K=[];while((G=q.exec(Z))!==null){if(Q(G.index))continue;let U=G[0],W=G[2];if(!W||!W.includes(":"))continue;let w=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,z,B=W,j=!1;while((z=w.exec(W))!==null){let _=z[1],H=z[2];if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let L=Object.keys($),O=Object.values($),F=H.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!L.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...L,`return (${H})`)(...O);if(_==="class"){let R=FQ(A);if(R){let T=B.match(/\sclass="([^"]*)"/);if(T)B=B.replace(T[0],` class="${T[1]} ${R}"`);else B=B.replace(z[0],` class="${R}"`)}else B=B.replace(z[0],"");j=!0;continue}if(JH.has(_)){if(A)B=B.replace(z[0],` ${_}`);else B=B.replace(z[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(z[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(z[0],` ${_}="${R}"`)}j=!0}catch{continue}}if(j){let _=U.endsWith("/>")?" /":"",L=`<${G[1]}${B}${_}>`;K.push({start:G.index,end:G.index+U.length,replacement:L})}}for(let U=K.length-1;U>=0;U--){let{start:W,end:w,replacement:z}=K[U];Z=Z.slice(0,W)+z+Z.slice(w)}return Z}var JH;var AQ=D(()=>{JH=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function G5(X,$){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=$;let Y=Z.exec(X);if(!Y)return null;let J=/\/\s*>$/.test(Y[0])||Y[1]===Y[1].toLowerCase()&&GH.has(Y[1]),G=J?Y[2].replace(/\/\s*$/,""):Y[2];return{full:Y[0],tag:Y[1],attrs:G,selfClosing:J,start:Y.index,end:Y.index+Y[0].length}}function qH(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${$}\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J;let q=G.exec(X),K=Q.exec(X);if(!K)return-1;if(q&&q.index<K.index)Y++,J=q.index+q[0].length;else{if(Y--,Y===0)return K.index+K[0].length;J=K.index+K[0].length}}return-1}function Y1(X,$){if($.selfClosing)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};let Z=qH(X,$.tag,$.end);if(Z===-1)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};return{outerStart:$.start,outerEnd:Z,innerHTML:X.slice($.end,Z-`</${$.tag}>`.length)}}function RQ(X,$){return new RegExp(`(?:^|\\s)${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(X)||X.includes(` ${$}=`)||X.includes(` ${$} `)||X.trimEnd().endsWith(` ${$}`)}function h5(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=X.match(new RegExp(`${Z}="([^"]*)"`,"s"))||X.match(new RegExp(`${Z}='([^']*)'`,"s"));return Y?Y[1]:null}function C1(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return X.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function P1(X,$,Z){let Y=$.selfClosing?" /":"",J=`<${$.tag}${Z}${Y}>`;return X.slice(0,$.start)+J+X.slice($.end)}function KH(X){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(X)}function UH(X){let $=X,Z=0;while(Z<$.length){let Y=G5($,Z);if(!Y)break;let J=h5(Y.attrs,"v-for");if(J===null){Z=Y.end;continue}let G=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=Y.end;continue}let Q=G[1].trim(),q=G[2].trim(),K;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),L=H[0],O=H[1];K=`${q} as ${O} => ${L}`}else K=`${q} as ${Q}`;let U=C1(Y.attrs,"v-for"),W=C1(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),w=Y1($,Y),z=$.slice(w.outerStart,w.outerEnd),B=P1(z,{...Y,start:0,end:Y.end-Y.start},W),j=`@foreach(${K})
13579
+ `,A=Function(...B,F)(...j);if(A&&typeof A==="object")Object.assign($,A);G=G.replace(U,"")}catch(z){console.error(`Error executing ${Y} code block in ${Z}:`,z);let B=z instanceof Error?z.message:String(z),j=U0(`${Y} Directive`,`Error executing code: ${B}`,Z,X,w,U);console.error(j),G=G.replace(U,"")}return G}var VQ=E(()=>{M5();A0()});function BH(X,$="_method"){let Z=X.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${$}" value="${Z}">`}function AQ(X){return X.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,($,Z,Y,J,G)=>{return BH(Y,G||"_method")})}async function RQ(X,$,Z,Y,J){if(!Y.middleware||Y.middleware.length===0)return X;let G=X,Q=Y.middleware.filter((q)=>q.timing===J);if(Q.length===0)return G;for(let q of Q){if(!q.name||typeof q.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",q);continue}try{let K=await q.handler(G,$,Z,Y);if(typeof K==="string")G=K;else if(Y.debug)console.warn(`Middleware ${q.name} did not return a string`)}catch(K){if(Y.debug)console.error(`Error in middleware ${q.name}:`,K);if(Y.debug){let U=U0("Middleware",`Error in middleware '${q.name}': ${K instanceof Error?K.message:String(K)}`,Z,X);G=G.replace(/<body[^>]*>/,`$&
13580
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${r0(U)}</div>
13581
+ `)}}}return G}async function NQ(X,$,Z,Y){return RQ(X,$,Z,Y,"before")}async function TQ(X,$,Z,Y){return RQ(X,$,Z,Y,"after")}var MQ=E(()=>{Z1();A0()});function kQ(X){return X.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,($,Z,Y,J,G)=>{try{let Q=J?H0(J,{}):{};return q7(Y,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var IQ=E(()=>{g1();g1();O0()});async function EQ(X,$){let Z=X.split("/").pop()?.split(".")[0]||"";if(c7.exact[X])for(let Y of c7.exact[X])await Promise.resolve(Y($,X));if(c7.exact[Z])for(let Y of c7.exact[Z])await Promise.resolve(Y($,X));for(let{pattern:Y,callback:J}of c7.patterns)if(Y.test(X)||Y.test(Z))await Promise.resolve(J($,X))}var c7;var DQ=E(()=>{c7={patterns:[],exact:{}}});function yQ(X){if(typeof X==="string")return X;if(Array.isArray(X))return X.filter(Boolean).map(($)=>yQ($)).join(" ");if(X&&typeof X==="object")return Object.entries(X).filter(([,$])=>$).map(([$])=>$).join(" ");return X?String(X):""}function bQ(X,$){if(!/:[\w-]+=/.test(X))return X;let Z=X,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],G;while((G=Y.exec(X))!==null)J.push([G.index,G.index+G[0].length]);function Q(U){return J.some(([W,w])=>U>=W&&U<w)}let q=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,K=[];while((G=q.exec(Z))!==null){if(Q(G.index))continue;let U=G[0],W=G[2];if(!W||!W.includes(":"))continue;let w=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,z,B=W,j=!1;while((z=w.exec(W))!==null){let _=z[1],H=z[2];if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let L=Object.keys($),O=Object.values($),F=H.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!L.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...L,`return (${H})`)(...O);if(_==="class"){let R=yQ(A);if(R){let N=B.match(/\sclass="([^"]*)"/);if(N)B=B.replace(N[0],` class="${N[1]} ${R}"`);else B=B.replace(z[0],` class="${R}"`)}else B=B.replace(z[0],"");j=!0;continue}if(_H.has(_)){if(A)B=B.replace(z[0],` ${_}`);else B=B.replace(z[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(z[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(z[0],` ${_}="${R}"`)}j=!0}catch{continue}}if(j){let _=U.endsWith("/>")?" /":"",L=`<${G[1]}${B}${_}>`;K.push({start:G.index,end:G.index+U.length,replacement:L})}}for(let U=K.length-1;U>=0;U--){let{start:W,end:w,replacement:z}=K[U];Z=Z.slice(0,W)+z+Z.slice(w)}return Z}var _H;var SQ=E(()=>{_H=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function Q5(X,$){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=$;let Y=Z.exec(X);if(!Y)return null;let J=/\/\s*>$/.test(Y[0])||Y[1]===Y[1].toLowerCase()&&HH.has(Y[1]),G=J?Y[2].replace(/\/\s*$/,""):Y[2];return{full:Y[0],tag:Y[1],attrs:G,selfClosing:J,start:Y.index,end:Y.index+Y[0].length}}function LH(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${$}\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J;let q=G.exec(X),K=Q.exec(X);if(!K)return-1;if(q&&q.index<K.index)Y++,J=q.index+q[0].length;else{if(Y--,Y===0)return K.index+K[0].length;J=K.index+K[0].length}}return-1}function Y1(X,$){if($.selfClosing)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};let Z=LH(X,$.tag,$.end);if(Z===-1)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};return{outerStart:$.start,outerEnd:Z,innerHTML:X.slice($.end,Z-`</${$.tag}>`.length)}}function CQ(X,$){return new RegExp(`(?:^|\\s)${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(X)||X.includes(` ${$}=`)||X.includes(` ${$} `)||X.trimEnd().endsWith(` ${$}`)}function u5(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=X.match(new RegExp(`${Z}="([^"]*)"`,"s"))||X.match(new RegExp(`${Z}='([^']*)'`,"s"));return Y?Y[1]:null}function C1(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return X.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function P1(X,$,Z){let Y=$.selfClosing?" /":"",J=`<${$.tag}${Z}${Y}>`;return X.slice(0,$.start)+J+X.slice($.end)}function FH(X){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(X)}function VH(X){let $=X,Z=0;while(Z<$.length){let Y=Q5($,Z);if(!Y)break;let J=u5(Y.attrs,"v-for");if(J===null){Z=Y.end;continue}let G=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=Y.end;continue}let Q=G[1].trim(),q=G[2].trim(),K;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),L=H[0],O=H[1];K=`${q} as ${O} => ${L}`}else K=`${q} as ${Q}`;let U=C1(Y.attrs,"v-for"),W=C1(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),w=Y1($,Y),z=$.slice(w.outerStart,w.outerEnd),B=P1(z,{...Y,start:0,end:Y.end-Y.start},W),j=`@foreach(${K})
13509
13582
  `,_=`${j}${B}
13510
- @endforeach`;$=$.slice(0,w.outerStart)+_+$.slice(w.outerEnd),Z=w.outerStart+j.length}return $}function WH(X){let $=X,Z=0;while(Z<$.length){let Y=G5($,Z);if(!Y)break;let J=h5(Y.attrs,"v-if");if(J===null){Z=Y.end;continue}let G=[],Q=Y1($,Y),q=C1(Y.attrs,"v-if"),K=P1($.slice(Q.outerStart,Q.outerEnd),{...Y,start:0,end:Y.end-Y.start},q);G.push({type:"if",expr:J,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:K,parsedTag:Y});let U=Q.outerEnd,W=!0;while(W){let _=$.slice(U).match(/^\s*/),H=_?_[0].length:0,L=G5($,U+H);if(!L){W=!1;break}let O=h5(L.attrs,"v-else-if"),F=RQ(L.attrs,"v-else");if(O!==null){let V=Y1($,L),A=C1(L.attrs,"v-else-if"),R=P1($.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else-if",expr:O,outerStart:U,outerEnd:V.outerEnd,element:R,parsedTag:L}),U=V.outerEnd}else if(F){let V=Y1($,L),A=C1(L.attrs,"v-else"),R=P1($.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else",outerStart:U,outerEnd:V.outerEnd,element:R,parsedTag:L}),W=!1}else W=!1}let w=[];for(let _ of G)if(_.type==="if")w.push(`@if(${_.expr})
13583
+ @endforeach`;$=$.slice(0,w.outerStart)+_+$.slice(w.outerEnd),Z=w.outerStart+j.length}return $}function AH(X){let $=X,Z=0;while(Z<$.length){let Y=Q5($,Z);if(!Y)break;let J=u5(Y.attrs,"v-if");if(J===null){Z=Y.end;continue}let G=[],Q=Y1($,Y),q=C1(Y.attrs,"v-if"),K=P1($.slice(Q.outerStart,Q.outerEnd),{...Y,start:0,end:Y.end-Y.start},q);G.push({type:"if",expr:J,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:K,parsedTag:Y});let U=Q.outerEnd,W=!0;while(W){let _=$.slice(U).match(/^\s*/),H=_?_[0].length:0,L=Q5($,U+H);if(!L){W=!1;break}let O=u5(L.attrs,"v-else-if"),F=CQ(L.attrs,"v-else");if(O!==null){let V=Y1($,L),A=C1(L.attrs,"v-else-if"),R=P1($.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else-if",expr:O,outerStart:U,outerEnd:V.outerEnd,element:R,parsedTag:L}),U=V.outerEnd}else if(F){let V=Y1($,L),A=C1(L.attrs,"v-else"),R=P1($.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else",outerStart:U,outerEnd:V.outerEnd,element:R,parsedTag:L}),W=!1}else W=!1}let w=[];for(let _ of G)if(_.type==="if")w.push(`@if(${_.expr})
13511
13584
  ${_.element}`);else if(_.type==="else-if")w.push(`@elseif(${_.expr})
13512
13585
  ${_.element}`);else w.push(`@else
13513
13586
  ${_.element}`);w.push("@endif");let z=w.join(`
13514
- `),B=G[0].outerStart,j=G[G.length-1].outerEnd;$=$.slice(0,B)+z+$.slice(j),Z=B+z.length}return $}function wH(X){return X.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function zH(X){let $=X,Z=0;while(Z<$.length){let Y=G5($,Z);if(!Y)break;let J=Y.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,q=J.match(Q);while(q){G=!0;let W=q[1],w=q[2],z=q[3];J=J.replace(q[0],""),J+=` :${W}="${z}" @update:${W}="${z} = $event"`,q=J.match(Q)}if(G){let W=Y1($,Y),w=$.slice(W.outerStart,W.outerEnd),z=P1(w,{...Y,start:0,end:Y.end-Y.start},J);$=$.slice(0,W.outerStart)+z+$.slice(W.outerEnd),Z=W.outerStart+z.length;continue}let K=h5(Y.attrs,"v-model");if(K===null){Z=Y.end;continue}if(QH.has(Y.tag)){let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${K}"`,w=Y1($,Y),z=$.slice(w.outerStart,w.outerEnd),B=P1(z,{...Y,start:0,end:Y.end-Y.start},W);$=$.slice(0,w.outerStart)+B+$.slice(w.outerEnd),Z=w.outerStart+B.length}else{let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");W+=` :modelValue="${K}" @update:modelValue="${K} = $event"`;let w=Y1($,Y),z=$.slice(w.outerStart,w.outerEnd),B=P1(z,{...Y,start:0,end:Y.end-Y.start},W);$=$.slice(0,w.outerStart)+B+$.slice(w.outerEnd),Z=w.outerStart+B.length}}return $}function jH(X){return X.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function BH(X){return X.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function _H(X){let $=X,Z=0;while(Z<$.length){let Y=G5($,Z);if(!Y)break;let J=h5(Y.attrs,"v-html");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=Y1($,Y),Q=C1(Y.attrs,"v-html"),q=Y.selfClosing?" /":"",K=`<${Y.tag}${Q}${q}>{!! ${J} !!}</${Y.tag}>`;$=$.slice(0,G.outerStart)+K+$.slice(G.outerEnd),Z=G.outerStart+K.length}return $}function HH(X){let $=X,Z=0;while(Z<$.length){let Y=G5($,Z);if(!Y)break;let J=h5(Y.attrs,"v-text");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=Y1($,Y),Q=C1(Y.attrs,"v-text"),q=Y.selfClosing?" /":"",K=`<${Y.tag}${Q}${q}>{{ ${J} }}</${Y.tag}>`;$=$.slice(0,G.outerStart)+K+$.slice(G.outerEnd),Z=G.outerStart+K.length}return $}function OH(X){return X.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 LH(X){let $=X,Z=0;while(Z<$.length){let Y=G5($,Z);if(!Y)break;if(!RQ(Y.attrs,"v-once")){Z=Y.end;continue}let J=C1(Y.attrs,"v-once"),G=Y1($,Y),Q=$.slice(G.outerStart,G.outerEnd),K=`@once
13587
+ `),B=G[0].outerStart,j=G[G.length-1].outerEnd;$=$.slice(0,B)+z+$.slice(j),Z=B+z.length}return $}function RH(X){return X.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function NH(X){let $=X,Z=0;while(Z<$.length){let Y=Q5($,Z);if(!Y)break;let J=Y.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,q=J.match(Q);while(q){G=!0;let W=q[1],w=q[2],z=q[3];J=J.replace(q[0],""),J+=` :${W}="${z}" @update:${W}="${z} = $event"`,q=J.match(Q)}if(G){let W=Y1($,Y),w=$.slice(W.outerStart,W.outerEnd),z=P1(w,{...Y,start:0,end:Y.end-Y.start},J);$=$.slice(0,W.outerStart)+z+$.slice(W.outerEnd),Z=W.outerStart+z.length;continue}let K=u5(Y.attrs,"v-model");if(K===null){Z=Y.end;continue}if(OH.has(Y.tag)){let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${K}"`,w=Y1($,Y),z=$.slice(w.outerStart,w.outerEnd),B=P1(z,{...Y,start:0,end:Y.end-Y.start},W);$=$.slice(0,w.outerStart)+B+$.slice(w.outerEnd),Z=w.outerStart+B.length}else{let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");W+=` :modelValue="${K}" @update:modelValue="${K} = $event"`;let w=Y1($,Y),z=$.slice(w.outerStart,w.outerEnd),B=P1(z,{...Y,start:0,end:Y.end-Y.start},W);$=$.slice(0,w.outerStart)+B+$.slice(w.outerEnd),Z=w.outerStart+B.length}}return $}function TH(X){return X.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function MH(X){return X.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function kH(X){let $=X,Z=0;while(Z<$.length){let Y=Q5($,Z);if(!Y)break;let J=u5(Y.attrs,"v-html");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=Y1($,Y),Q=C1(Y.attrs,"v-html"),q=Y.selfClosing?" /":"",K=`<${Y.tag}${Q}${q}>{!! ${J} !!}</${Y.tag}>`;$=$.slice(0,G.outerStart)+K+$.slice(G.outerEnd),Z=G.outerStart+K.length}return $}function IH(X){let $=X,Z=0;while(Z<$.length){let Y=Q5($,Z);if(!Y)break;let J=u5(Y.attrs,"v-text");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=Y1($,Y),Q=C1(Y.attrs,"v-text"),q=Y.selfClosing?" /":"",K=`<${Y.tag}${Q}${q}>{{ ${J} }}</${Y.tag}>`;$=$.slice(0,G.outerStart)+K+$.slice(G.outerEnd),Z=G.outerStart+K.length}return $}function EH(X){return X.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function DH(X){let $=X,Z=0;while(Z<$.length){let Y=Q5($,Z);if(!Y)break;if(!CQ(Y.attrs,"v-once")){Z=Y.end;continue}let J=C1(Y.attrs,"v-once"),G=Y1($,Y),Q=$.slice(G.outerStart,G.outerEnd),K=`@once
13515
13588
  ${P1(Q,{...Y,start:0,end:Y.end-Y.start},J)}
13516
- @endonce`;$=$.slice(0,G.outerStart)+K+$.slice(G.outerEnd),Z=G.outerStart+K.length}return $}function FH(X){return X.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function VH(X){return X.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 TQ(X){if(!KH(X))return X;let $=X;return $=UH($),$=WH($),$=LH($),$=jH($),$=BH($),$=zH($),$=wH($),$=VH($),$=_H($),$=HH($),$=OH($),$=FH($),$}var GH,QH;var NQ=D(()=>{GH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),QH=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 o8(X){return X.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function MQ(X,$){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X),Y=Z?Z[1]:X,J=$0(Y,$);if(J&&typeof J==="string")return J;let G=Y.trim();return L4.has(G)?G:null}function kQ(X){let $=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X);return $?$[1]:X}function IQ(X,$,Z){let Y=$.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=Y?`<${X} ${Y}>`:`<${X}>`;if(AH.has(X))return Y?`<${X} ${Y}>`:`<${X}>`;return`${J}${Z}</${X}>`}async function EQ(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,q=[],K;while((K=Q.exec(G))!==null)q.push({full:K[0],expr:K[1],attrs:K[2],slotContent:K[3],index:K.index});for(let U=q.length-1;U>=0;U--){let W=q[U];try{let w=MQ(W.expr,$);if(!w||typeof w!=="string"){let O=`<!-- dynamic component: could not resolve "${o8(kQ(W.expr))}" -->`;G=G.slice(0,W.index)+O+G.slice(W.index+W.full.length);continue}if(L4.has(w)){let O=IQ(w,W.attrs,W.slotContent);G=G.slice(0,W.index)+O+G.slice(W.index+W.full.length);continue}let z=W.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=j.exec(z))!==null){let O=_[1]||_[2],F=_[3];if(_[1])try{B[O]=$0(F,$)}catch{B[O]=F}else B[O]=F}let H=Y.componentsDir||"components",L=await o1(w,B,W.slotContent,H,$,Z,Y,new Set,J??new Set);G=G.slice(0,W.index)+L+G.slice(W.index+W.full.length)}catch(w){let z=w instanceof Error?w.message:String(w),B=`<!-- dynamic component error: ${o8(z)} -->`;G=G.slice(0,W.index)+B+G.slice(W.index+W.full.length)}}return G=await RH(G,$,Z,Y,J),G}async function RH(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,q=[],K;while((K=Q.exec(G))!==null)q.push({full:K[0],expr:K[1],attrs:K[2],index:K.index});for(let U=q.length-1;U>=0;U--){let W=q[U];try{let w=MQ(W.expr,$);if(!w||typeof w!=="string"){let j=`<!-- dynamic component: could not resolve "${o8(kQ(W.expr))}" -->`;G=G.slice(0,W.index)+j+G.slice(W.index+W.full.length);continue}if(L4.has(w)){let j=IQ(w,W.attrs,"");G=G.slice(0,W.index)+j+G.slice(W.index+W.full.length);continue}let z=Y.componentsDir||"components",B=await o1(w,{},"",z,$,Z,Y,new Set,J??new Set);G=G.slice(0,W.index)+B+G.slice(W.index+W.full.length)}catch(w){let z=w instanceof Error?w.message:String(w),B=`<!-- dynamic component error: ${o8(z)} -->`;G=G.slice(0,W.index)+B+G.slice(W.index+W.full.length)}}return G}var L4,AH;var DQ=D(()=>{A0();O0();L4=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),AH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function IH(X){let $=X.storageKey??"stx-color-mode",Z=X.initialMode??"auto",Y=X.darkClass===void 0?"dark":X.darkClass,J=X.attribute??null,G=X.autoValue??null;if(typeof $!=="string"||$.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!TH.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(Y!==null&&(typeof Y!=="string"||!kH.test(Y)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!MH.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(G!==null&&!NH.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(Y===null&&J===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:$,initialMode:Z==="system"?"auto":Z,darkClass:Y,attribute:J,autoValue:G}}function EH(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function V4(X={}){let $=IH(X);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${EH($)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function yQ(X,$={}){if(X.includes("data-stx-color-mode-boot"))return X;let Z=F4(X);if(Z===null)return X;let Y=V4($);return`${X.slice(0,Z)}
13517
- ${Y}${X.slice(Z)}`}function F4(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return null;let Z=$.index+$[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(X.slice(Z));if(Y)Z+=Y[0].length;return Z}function bH(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return X;let Z=$.index+$[0].length,Y=X.toLowerCase().indexOf("</head>",Z),J=X.slice(Z,Y===-1?X.length:Y),G=yH.exec(J);if(!G||J.slice(0,G.index).trim()==="")return X;let Q=J.slice(0,G.index)+J.slice(G.index+G[0].length);return X.slice(0,Z)+`
13518
- ${G[0]}`+Q+X.slice(Z+J.length)}function bQ(X){return SH(bH(X))}function SH(X){let $=DH.exec(X);if(!$)return X;let Z=F4(X);if(Z===null)return X;if($.index<=Z||X.slice(Z,$.index).trim()==="")return X;let Y=X.slice(0,$.index)+X.slice($.index+$[0].length),J=F4(Y);if(J===null)return X;return`${Y.slice(0,J)}
13519
- ${$[0]}${Y.slice(J)}`}var TH,NH,MH,kH,DH,yH;var A4=D(()=>{TH=new Set(["light","dark","auto","system"]),NH=new Set(["auto","system"]),MH=/^[a-z][\w:-]*$/i,kH=/^[\w-]+$/;DH=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),yH=/<meta\b[^>]*\bcharset\b[^>]*>/i});function CH(){if(R4===null)R4=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return R4}function SQ(X,$=CH()){if(X.includes('name="stx-build"'))return X;let Z=/<head\b[^>]*>/i.exec(X);if(!Z)return X;let Y=Z.index+Z[0].length;return`${X.slice(0,Y)}
13520
- <meta name="stx-build" content="${$}">${X.slice(Y)}`}var R4=null;function j1(X){return String(X).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function PH(X){return String(X).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function T4(X){if(X.name)return`name="${X.name}"`;if(X.property)return`property="${X.property}"`;if(X.charset!=null)return"charset=";if(X["http-equiv"])return`http-equiv="${X["http-equiv"]}"`;return""}function u5(X,$){return Object.entries(X).filter(([Z])=>!$?.(Z)).map(([Z,Y])=>`${Z}="${j1(String(Y))}"`).join(" ")}function vH(X={},$="en"){let Z=[],Y=[],J="",G=$;for(let[q,K]of Object.entries(X||{})){if(K==null)continue;let U=q.trim();if(!PQ.test(U))continue;let W=U.toLowerCase();if(W==="lang"){G=String(K);continue}if(W==="class"){J=String(K).trim();continue}Z.push(` ${U}="${j1(String(K))}"`),Y.push(U)}let Q=` lang="${j1(G)}"`;if(J)Q+=` class="${j1(J)}"`;if(Q+=Z.join(""),J)Q+=` ${a8}="${j1(J)}"`;if(Y.length)Q+=` ${s8}="${j1(Y.join(" "))}"`;return Q}function vQ(X={},$={}){let Z={...X,...$};if(X.class&&$.class){let Y=X.class.split(/\s+/).filter(Boolean);for(let J of $.class.split(/\s+/).filter(Boolean))if(!Y.includes(J))Y.push(J);Z.class=Y.join(" ")}return Z}function xQ(X,$={}){if(!$||Object.keys($).length===0)return X;let Z=X.match(/<html\b([^>]*)>/i);if(!Z)return X;let Y={},J=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let W=Q[1];if(!(W in Y))J.push(W);Y[W]=Q[2]??Q[3]??Q[4]??""}let q=[],K=[];for(let[W,w]of Object.entries($)){if(w==null)continue;let z=W.trim();if(!PQ.test(z))continue;let B=z.toLowerCase();if(B==="class"){let j=(Y.class||"").split(/\s+/).filter(Boolean);for(let _ of String(w).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),q.push(_);if(!("class"in Y))J.push("class");Y.class=j.join(" ");continue}if(!(z in Y))J.push(z);if(Y[z]=String(w),B!=="lang")K.push(z)}if(q.length){if(!(a8 in Y))J.push(a8);Y[a8]=q.join(" ")}if(K.length){if(!(s8 in Y))J.push(s8);Y[s8]=K.join(" ")}let U=J.map((W)=>` ${W}="${j1(Y[W])}"`).join("");return X.replace(Z[0],()=>`<html${U}>`)}function fQ(X){if(X.includes("data-stx-cloak"))return X;let $=X.lastIndexOf("</head>");if($===-1)return X;return`${X.slice(0,$)}${CQ}
13521
- ${X.slice($)}`}function xH(X){let $=[],Z=0;while(Z<X.length){let G=X.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let w=X.indexOf("-->",Z);if(w===-1)break;Z=w+3;continue}let q=G.match(/^<script\b[^>]*>/i);if(q){let w=X.toLowerCase().indexOf("</script>",Z+q[0].length);if(w===-1)break;Z=w+9;continue}let K=G.match(/^<link\b[^>]*>/i);if(K){$.push(K[0]),Z+=K[0].length;continue}let U=G.match(/^<meta\b[^>]*>/i);if(U){$.push(U[0]),Z+=U[0].length;continue}let W=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W){$.push(W[0]),Z+=W[0].length;continue}break}if($.length===0)return{body:X,hoisted:$};let Y="",J=0;while(J<X.length&&J<Z){let G=X.slice(J),Q=G.match(/^<link\b[^>]*>/i);if(Q&&$.includes(Q[0])){J+=Q[0].length;continue}let q=G.match(/^<meta\b[^>]*>/i);if(q&&$.includes(q[0])){J+=q[0].length;continue}let K=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K&&$.includes(K[0])){J+=K[0].length;continue}Y+=X[J],J++}return Y+=X.slice(Z),{body:Y,hoisted:$}}function fH(X,$={},Z={}){let{title:Y="stx App",lang:J="en",meta:G=[],link:Q=[],script:q=[],headRaw:K="",htmlAttrs:U={},bodyClass:W="",bodyAttrs:w={}}=$,z=Z.title||Y,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],j=new Set(G.map(T4).filter(Boolean)),H=[...B.filter((M)=>!j.has(T4(M))),...G].map((M)=>{return` <meta ${u5(M)}>`}).join(`
13522
- `),L=Q.map((M)=>{return` <link ${u5(M)}>`}).join(`
13523
- `),O=q.map((M)=>{if(M.src)return` <script ${u5(M,(y)=>y==="content")}></script>`;if(M.content)return` <script>${M.content}</script>`;return""}).filter(Boolean).join(`
13524
- `),F=vH(U,J),V=Object.entries(w).map(([M,y])=>` ${M}="${j1(String(y))}"`).join(""),A=W?` class="${j1(W)}"`:"",{body:R,hoisted:T}=xH(X),N=[H,Z.colorMode?` ${V4(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?z:PH(z)}</title>`,` ${CQ}`,L,O,K?` ${K}`:"",...(Z.styles||[]).map((M)=>` ${M}`),...T.map((M)=>` ${M}`),...(Z.headScripts||[]).map((M)=>` ${M}`),Z.headStack||""].filter(Boolean),k=[R,...(Z.bodyScripts||[]).map((M)=>M),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
13589
+ @endonce`;$=$.slice(0,G.outerStart)+K+$.slice(G.outerEnd),Z=G.outerStart+K.length}return $}function yH(X){return X.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function bH(X){return X.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 PQ(X){if(!FH(X))return X;let $=X;return $=VH($),$=AH($),$=DH($),$=TH($),$=MH($),$=NH($),$=RH($),$=bH($),$=kH($),$=IH($),$=EH($),$=yH($),$}var HH,OH;var vQ=E(()=>{HH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),OH=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function o8(X){return X.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function xQ(X,$){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X),Y=Z?Z[1]:X,J=$0(Y,$);if(J&&typeof J==="string")return J;let G=Y.trim();return M4.has(G)?G:null}function fQ(X){let $=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X);return $?$[1]:X}function gQ(X,$,Z){let Y=$.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=Y?`<${X} ${Y}>`:`<${X}>`;if(SH.has(X))return Y?`<${X} ${Y}>`:`<${X}>`;return`${J}${Z}</${X}>`}async function hQ(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,q=[],K;while((K=Q.exec(G))!==null)q.push({full:K[0],expr:K[1],attrs:K[2],slotContent:K[3],index:K.index});for(let U=q.length-1;U>=0;U--){let W=q[U];try{let w=xQ(W.expr,$);if(!w||typeof w!=="string"){let O=`<!-- dynamic component: could not resolve "${o8(fQ(W.expr))}" -->`;G=G.slice(0,W.index)+O+G.slice(W.index+W.full.length);continue}if(M4.has(w)){let O=gQ(w,W.attrs,W.slotContent);G=G.slice(0,W.index)+O+G.slice(W.index+W.full.length);continue}let z=W.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=j.exec(z))!==null){let O=_[1]||_[2],F=_[3];if(_[1])try{B[O]=$0(F,$)}catch{B[O]=F}else B[O]=F}let H=Y.componentsDir||"components",L=await s1(w,B,W.slotContent,H,$,Z,Y,new Set,J??new Set);G=G.slice(0,W.index)+L+G.slice(W.index+W.full.length)}catch(w){let z=w instanceof Error?w.message:String(w),B=`<!-- dynamic component error: ${o8(z)} -->`;G=G.slice(0,W.index)+B+G.slice(W.index+W.full.length)}}return G=await CH(G,$,Z,Y,J),G}async function CH(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,q=[],K;while((K=Q.exec(G))!==null)q.push({full:K[0],expr:K[1],attrs:K[2],index:K.index});for(let U=q.length-1;U>=0;U--){let W=q[U];try{let w=xQ(W.expr,$);if(!w||typeof w!=="string"){let j=`<!-- dynamic component: could not resolve "${o8(fQ(W.expr))}" -->`;G=G.slice(0,W.index)+j+G.slice(W.index+W.full.length);continue}if(M4.has(w)){let j=gQ(w,W.attrs,"");G=G.slice(0,W.index)+j+G.slice(W.index+W.full.length);continue}let z=Y.componentsDir||"components",B=await s1(w,{},"",z,$,Z,Y,new Set,J??new Set);G=G.slice(0,W.index)+B+G.slice(W.index+W.full.length)}catch(w){let z=w instanceof Error?w.message:String(w),B=`<!-- dynamic component error: ${o8(z)} -->`;G=G.slice(0,W.index)+B+G.slice(W.index+W.full.length)}}return G}var M4,SH;var uQ=E(()=>{A0();O0();M4=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),SH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function gH(X){let $=X.storageKey??"stx-color-mode",Z=X.initialMode??"auto",Y=X.darkClass===void 0?"dark":X.darkClass,J=X.attribute??null,G=X.autoValue??null;if(typeof $!=="string"||$.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!PH.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(Y!==null&&(typeof Y!=="string"||!fH.test(Y)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!xH.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(G!==null&&!vH.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(Y===null&&J===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:$,initialMode:Z==="system"?"auto":Z,darkClass:Y,attribute:J,autoValue:G}}function hH(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function I4(X={}){let $=gH(X);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${hH($)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function dQ(X,$={}){if(X.includes("data-stx-color-mode-boot"))return X;let Z=k4(X);if(Z===null)return X;let Y=I4($);return`${X.slice(0,Z)}
13590
+ ${Y}${X.slice(Z)}`}function k4(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return null;let Z=$.index+$[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(X.slice(Z));if(Y)Z+=Y[0].length;return Z}function mH(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return X;let Z=$.index+$[0].length,Y=X.toLowerCase().indexOf("</head>",Z),J=X.slice(Z,Y===-1?X.length:Y),G=dH.exec(J);if(!G||J.slice(0,G.index).trim()==="")return X;let Q=J.slice(0,G.index)+J.slice(G.index+G[0].length);return X.slice(0,Z)+`
13591
+ ${G[0]}`+Q+X.slice(Z+J.length)}function mQ(X){return lH(mH(X))}function lH(X){let $=uH.exec(X);if(!$)return X;let Z=k4(X);if(Z===null)return X;if($.index<=Z||X.slice(Z,$.index).trim()==="")return X;let Y=X.slice(0,$.index)+X.slice($.index+$[0].length),J=k4(Y);if(J===null)return X;return`${Y.slice(0,J)}
13592
+ ${$[0]}${Y.slice(J)}`}var PH,vH,xH,fH,uH,dH;var E4=E(()=>{PH=new Set(["light","dark","auto","system"]),vH=new Set(["auto","system"]),xH=/^[a-z][\w:-]*$/i,fH=/^[\w-]+$/;uH=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),dH=/<meta\b[^>]*\bcharset\b[^>]*>/i});function cH(){if(D4===null)D4=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return D4}function lQ(X,$=cH()){if(X.includes('name="stx-build"'))return X;let Z=/<head\b[^>]*>/i.exec(X);if(!Z)return X;let Y=Z.index+Z[0].length;return`${X.slice(0,Y)}
13593
+ <meta name="stx-build" content="${$}">${X.slice(Y)}`}var D4=null;function j1(X){return String(X).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function pH(X){return String(X).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function y4(X){if(X.name)return`name="${X.name}"`;if(X.property)return`property="${X.property}"`;if(X.charset!=null)return"charset=";if(X["http-equiv"])return`http-equiv="${X["http-equiv"]}"`;return""}function d5(X,$){return Object.entries(X).filter(([Z])=>!$?.(Z)).map(([Z,Y])=>`${Z}="${j1(String(Y))}"`).join(" ")}function iH(X={},$="en"){let Z=[],Y=[],J="",G=$;for(let[q,K]of Object.entries(X||{})){if(K==null)continue;let U=q.trim();if(!pQ.test(U))continue;let W=U.toLowerCase();if(W==="lang"){G=String(K);continue}if(W==="class"){J=String(K).trim();continue}Z.push(` ${U}="${j1(String(K))}"`),Y.push(U)}let Q=` lang="${j1(G)}"`;if(J)Q+=` class="${j1(J)}"`;if(Q+=Z.join(""),J)Q+=` ${a8}="${j1(J)}"`;if(Y.length)Q+=` ${s8}="${j1(Y.join(" "))}"`;return Q}function iQ(X={},$={}){let Z={...X,...$};if(X.class&&$.class){let Y=X.class.split(/\s+/).filter(Boolean);for(let J of $.class.split(/\s+/).filter(Boolean))if(!Y.includes(J))Y.push(J);Z.class=Y.join(" ")}return Z}function nQ(X,$={}){if(!$||Object.keys($).length===0)return X;let Z=X.match(/<html\b([^>]*)>/i);if(!Z)return X;let Y={},J=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let W=Q[1];if(!(W in Y))J.push(W);Y[W]=Q[2]??Q[3]??Q[4]??""}let q=[],K=[];for(let[W,w]of Object.entries($)){if(w==null)continue;let z=W.trim();if(!pQ.test(z))continue;let B=z.toLowerCase();if(B==="class"){let j=(Y.class||"").split(/\s+/).filter(Boolean);for(let _ of String(w).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),q.push(_);if(!("class"in Y))J.push("class");Y.class=j.join(" ");continue}if(!(z in Y))J.push(z);if(Y[z]=String(w),B!=="lang")K.push(z)}if(q.length){if(!(a8 in Y))J.push(a8);Y[a8]=q.join(" ")}if(K.length){if(!(s8 in Y))J.push(s8);Y[s8]=K.join(" ")}let U=J.map((W)=>` ${W}="${j1(Y[W])}"`).join("");return X.replace(Z[0],()=>`<html${U}>`)}function rQ(X){if(X.includes("data-stx-cloak"))return X;let $=X.lastIndexOf("</head>");if($===-1)return X;return`${X.slice(0,$)}${cQ}
13594
+ ${X.slice($)}`}function nH(X){let $=[],Z=0;while(Z<X.length){let G=X.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let w=X.indexOf("-->",Z);if(w===-1)break;Z=w+3;continue}let q=G.match(/^<script\b[^>]*>/i);if(q){let w=X.toLowerCase().indexOf("</script>",Z+q[0].length);if(w===-1)break;Z=w+9;continue}let K=G.match(/^<link\b[^>]*>/i);if(K){$.push(K[0]),Z+=K[0].length;continue}let U=G.match(/^<meta\b[^>]*>/i);if(U){$.push(U[0]),Z+=U[0].length;continue}let W=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W){$.push(W[0]),Z+=W[0].length;continue}break}if($.length===0)return{body:X,hoisted:$};let Y="",J=0;while(J<X.length&&J<Z){let G=X.slice(J),Q=G.match(/^<link\b[^>]*>/i);if(Q&&$.includes(Q[0])){J+=Q[0].length;continue}let q=G.match(/^<meta\b[^>]*>/i);if(q&&$.includes(q[0])){J+=q[0].length;continue}let K=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K&&$.includes(K[0])){J+=K[0].length;continue}Y+=X[J],J++}return Y+=X.slice(Z),{body:Y,hoisted:$}}function rH(X,$={},Z={}){let{title:Y="stx App",lang:J="en",meta:G=[],link:Q=[],script:q=[],headRaw:K="",htmlAttrs:U={},bodyClass:W="",bodyAttrs:w={}}=$,z=Z.title||Y,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],j=new Set(G.map(y4).filter(Boolean)),H=[...B.filter((M)=>!j.has(y4(M))),...G].map((M)=>{return` <meta ${d5(M)}>`}).join(`
13595
+ `),L=Q.map((M)=>{return` <link ${d5(M)}>`}).join(`
13596
+ `),O=q.map((M)=>{if(M.src)return` <script ${d5(M,(y)=>y==="content")}></script>`;if(M.content)return` <script>${M.content}</script>`;return""}).filter(Boolean).join(`
13597
+ `),F=iH(U,J),V=Object.entries(w).map(([M,y])=>` ${M}="${j1(String(y))}"`).join(""),A=W?` class="${j1(W)}"`:"",{body:R,hoisted:N}=nH(X),T=[H,Z.colorMode?` ${I4(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?z:pH(z)}</title>`,` ${cQ}`,L,O,K?` ${K}`:"",...(Z.styles||[]).map((M)=>` ${M}`),...N.map((M)=>` ${M}`),...(Z.headScripts||[]).map((M)=>` ${M}`),Z.headStack||""].filter(Boolean),k=[R,...(Z.bodyScripts||[]).map((M)=>M),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
13525
13598
  <html${F}>
13526
13599
  <head>
13527
- ${N.join(`
13600
+ ${T.join(`
13528
13601
  `)}
13529
13602
  </head>
13530
13603
  <body${A}${V}>
13531
13604
  ${k.join(`
13532
13605
  `)}
13533
13606
  </body>
13534
- </html>`}function N4(X){let $=0;while($<X.length){let Z=X.slice($),Y=Z.match(/^\s+/);if(Y){$+=Y[0].length;continue}if(Z.startsWith("<!--")){let G=X.indexOf("-->",$);if(G===-1)return!1;$=G+3;continue}let J=Z.match(/^<(script|style)\b[^>]*>/i);if(J){let G=`</${J[1].toLowerCase()}>`,Q=X.toLowerCase().indexOf(G,$+J[0].length);if(Q===-1)return!1;$=Q+G.length;continue}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}return!1}function M4(X){return N4(X)}function gQ(X,$={}){let Z=X.lastIndexOf("</head>");if(Z===-1)return X;let{meta:Y=[],link:J=[],script:G=[],headRaw:Q=""}=$,q=X.slice(0,Z),K=[];for(let U of Y){let W=T4(U);if(W&&q.includes(W))continue;K.push(` <meta ${u5(U)}>`)}for(let U of J){if(U.href&&q.includes(`href="${U.href}"`))continue;K.push(` <link ${u5(U)}>`)}for(let U of G)if(U.src){if(q.includes(`src="${U.src}"`))continue;K.push(` <script ${u5(U,(W)=>W==="content")}></script>`)}else if(U.content){if(q.includes(U.content))continue;K.push(` <script>${U.content}</script>`)}if(Q&&!q.includes(Q))K.push(` ${Q}`);if(K.length===0)return X;return`${X.slice(0,Z)}${K.join(`
13607
+ </html>`}function b4(X){let $=0;while($<X.length){let Z=X.slice($),Y=Z.match(/^\s+/);if(Y){$+=Y[0].length;continue}if(Z.startsWith("<!--")){let G=X.indexOf("-->",$);if(G===-1)return!1;$=G+3;continue}let J=Z.match(/^<(script|style)\b[^>]*>/i);if(J){let G=`</${J[1].toLowerCase()}>`,Q=X.toLowerCase().indexOf(G,$+J[0].length);if(Q===-1)return!1;$=Q+G.length;continue}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}return!1}function S4(X){return b4(X)}function oQ(X,$={}){let Z=X.lastIndexOf("</head>");if(Z===-1)return X;let{meta:Y=[],link:J=[],script:G=[],headRaw:Q=""}=$,q=X.slice(0,Z),K=[];for(let U of Y){let W=y4(U);if(W&&q.includes(W))continue;K.push(` <meta ${d5(U)}>`)}for(let U of J){if(U.href&&q.includes(`href="${U.href}"`))continue;K.push(` <link ${d5(U)}>`)}for(let U of G)if(U.src){if(q.includes(`src="${U.src}"`))continue;K.push(` <script ${d5(U,(W)=>W==="content")}></script>`)}else if(U.content){if(q.includes(U.content))continue;K.push(` <script>${U.content}</script>`)}if(Q&&!q.includes(Q))K.push(` ${Q}`);if(K.length===0)return X;return`${X.slice(0,Z)}${K.join(`
13535
13608
  `)}
13536
- ${X.slice(Z)}`}function hQ(X,$={},Z={}){if(M4(X))return X;return fH(X,$,Z)}var CQ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",s8="data-stx-html-attrs",a8="data-stx-html-class",PQ;var uQ=D(()=>{A4();PQ=/^[A-Za-z_:][\w:.-]*$/});import d5 from"path";function dQ(X){return X.startsWith("http://")||X.startsWith("https://")||X.startsWith("//")}async function mQ(X,$,Z){try{let Y;if(X.startsWith("/")){let J=$;for(let G=0;G<5;G++){let Q=d5.join(J,X);if(await Bun.file(Q).exists())return Q;J=d5.dirname(J)}Y=d5.join($,X)}else if(X.startsWith("./")||X.startsWith("../"))Y=d5.resolve($,X);else Y=d5.resolve($,X);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function lQ(X,$,Z){let Y=X,J=d5.dirname($),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(Y))!==null){let[U,W,w,z]=Q;if(dQ(w))continue;let B=await mQ(w,J,$);if(B)try{let j=await Bun.file(B).text();if(Z.add(B),w.endsWith(".ts")||w.endsWith(".tsx")){let H=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:S0()});if(H.outputs.length>0)j=await H.outputs[0].text()}let _=`<script>
13609
+ ${X.slice(Z)}`}function sQ(X,$={},Z={}){if(S4(X))return X;return rH(X,$,Z)}var cQ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",s8="data-stx-html-attrs",a8="data-stx-html-class",pQ;var aQ=E(()=>{E4();pQ=/^[A-Za-z_:][\w:.-]*$/});import m5 from"path";function tQ(X){return X.startsWith("http://")||X.startsWith("https://")||X.startsWith("//")}async function eQ(X,$,Z){try{let Y;if(X.startsWith("/")){let J=$;for(let G=0;G<5;G++){let Q=m5.join(J,X);if(await Bun.file(Q).exists())return Q;J=m5.dirname(J)}Y=m5.join($,X)}else if(X.startsWith("./")||X.startsWith("../"))Y=m5.resolve($,X);else Y=m5.resolve($,X);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function Xq(X,$,Z){let Y=X,J=m5.dirname($),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(Y))!==null){let[U,W,w,z]=Q;if(tQ(w))continue;let B=await eQ(w,J,$);if(B)try{let j=await Bun.file(B).text();if(Z.add(B),w.endsWith(".ts")||w.endsWith(".tsx")){let H=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:S0()});if(H.outputs.length>0)j=await H.outputs[0].text()}let _=`<script>
13537
13610
  // Source: ${w}
13538
13611
  ${j}
13539
- </script>`;Y=Y.replace(U,_),G.lastIndex=0}catch(j){}}let q=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,K;while((K=q.exec(Y))!==null){let[U,W,w,z]=K,B=W+z;if(dQ(w))continue;if(/rel=["']stylesheet["']/.test(B)||w.endsWith(".css")){let _=await mQ(w,J,$);if(_)try{let H=await Bun.file(_).text();Z.add(_);let L=`<style>
13612
+ </script>`;Y=Y.replace(U,_),G.lastIndex=0}catch(j){}}let q=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,K;while((K=q.exec(Y))!==null){let[U,W,w,z]=K,B=W+z;if(tQ(w))continue;if(/rel=["']stylesheet["']/.test(B)||w.endsWith(".css")){let _=await eQ(w,J,$);if(_)try{let H=await Bun.file(_).text();Z.add(_);let L=`<style>
13540
13613
  /* Source: ${w} */
13541
13614
  ${H}
13542
- </style>`;Y=Y.replace(U,L),q.lastIndex=0}catch(H){}}}return Y}var cQ=D(()=>{F1()});function t8(X,$){let Z=X,Y=/@json\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index,Q=G+J[0].length-1,q=1,K=Q+1,U=null,W=!1;while(K<Z.length&&q>0){let F=Z[K];if(W){W=!1,K++;continue}if(F==="\\"&&U){W=!0,K++;continue}if(U){if(F===U)U=null;K++;continue}if(F==='"'||F==="'"||F==="`"){U=F,K++;continue}if(F==="(")q++;else if(F===")"){if(q--,q===0)break}K++}if(q!==0)break;let w=Z.substring(Q+1,K).trim(),z=Z.substring(G,K+1),B=-1,j=0,_=null,H=!1;for(let F=0;F<w.length;F++){let V=w[F];if(H){H=!1;continue}if(V==="\\"&&_){H=!0;continue}if(_){if(V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=V;continue}if(V==="("||V==="["||V==="{")j++;else if(V===")"||V==="]"||V==="}")j--;if(V===","&&j===0){B=F;break}}let L=B>=0?w.substring(0,B).trim():w,O=B>=0?w.substring(B+1).trim():void 0;try{let F=L.trim(),V;if(G0(F))V=Q0(F,Object.keys($))(...Object.values($));else V=void 0;let A;if(O==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(K+1),Y.lastIndex=G+R.length}catch(F){a0.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),Y.lastIndex=G+z.length}}return Z}function e8(X){return X.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function pQ(X){let $=X,Z=/@memo\s*\(/g,Y,J=[];while((Y=Z.exec($))!==null){let G=Y.index,Q=G+Y[0].length,q=1,K=Q;while(K<$.length&&q>0){if($[K]==="(")q++;else if($[K]===")")q--;K++}if(q!==0)continue;let U=$.slice(Q,K-1).trim(),W=K,w=$.slice(W),z=w.indexOf("@endmemo");if(z===-1)continue;let B=w.slice(0,z),j=W+z+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=_?_[0].length:0,L=B.slice(H),O=B.match(/(\s*)$/),F=O?O[0].length:0,V=L.slice(0,L.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[T,N,k="",M]=A,y=`<${N}${k} data-stx-memo="${U}"${M}>`;R=B.slice(0,H)+y+V.slice(T.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${U}">${V}</div>${B.slice(H+V.length)}`;J.push({start:G,end:j,replacement:R}),Z.lastIndex=j}for(let G=J.length-1;G>=0;G--){let Q=J[G];$=$.slice(0,Q.start)+Q.replacement+$.slice(Q.end)}return $.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function k4(X){let $=X.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),$}function iQ(X){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index,q=Q+G[0].length,K=!1,U=!1,W=-1;while(q<X.length){let _=X[q];if(K){if(_==="'")K=!1}else if(U){if(_==='"')U=!1}else if(_==="'")K=!0;else if(_==='"')U=!0;else if(_===">"){W=q;break}q++}if(W===-1)continue;if(X.slice(Q,W+1).includes("x-cloak"))continue;let z=X.slice(W+1),B=z.indexOf("</"),j=B>=0?z.slice(0,B):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))Y+=X.slice(J,W)+" x-cloak>",J=W+1}return Y+=X.slice(J),Y}function nQ(X){let $=/<[a-z][\w-]*/gi,Z="",Y=0,J;while((J=$.exec(X))!==null){let G=J.index,Q=J[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let j=`</${Q}>`,_=X.toLowerCase().indexOf(j,G);if(_!==-1)$.lastIndex=_+j.length;continue}let q=G+J[0].length,K=!1,U=!1,W=-1;while(q<X.length){let j=X[q];if(K){if(j==="'")K=!1}else if(U){if(j==='"')U=!1}else if(j==="'")K=!0;else if(j==='"')U=!0;else if(j===">"){W=q;break}q++}if(W===-1)continue;let w=X.slice(G+J[0].length,W);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(w))continue;if(!gH.test(w))continue;let z=X[W-1]==="/",B=z?W-1:W;Z+=`${X.slice(Y,B)} x-cloak${z?" ":""}`,Y=B}return Z+=X.slice(Y),Z}var gH;var I4=D(()=>{w1();O0();gH=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function X$(X,$,Z,Y){let J=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=J.allowPatterns??[],Q=[];for(let{pattern:q,message:K,suggestion:U}of hH){if(G.some((w)=>/\w/.test(w)&&K.includes(w)))continue;q.lastIndex=0;let W=X.match(q);if(W&&W.length>0){let w=X.split(`
13543
- `),z=[];w.forEach((H,L)=>{if(q.lastIndex=0,q.test(H))z.push(L+1)});let B=z.length>0?` (script line${z.length>1?"s":""} ${z.join(", ")})`:"",j=z.slice(0,3).map((H)=>` ${H} | ${(w[H-1]??"").trim().slice(0,100)}`).join(`
13544
- `),_=j?`
13545
- ${j}`:"";Q.push(` \u2717 ${K}${B}
13546
- \u2192 ${U}${_}`)}}if(Q.length>0&&J.enabled){let q=(W)=>{let w=`${process.cwd()}/`;return W.startsWith(w)?W.slice(w.length):W},U=`[STX] DOM API violation in ${Y&&Y!==$?`${q(Y)} (composed into ${q($)})`:q($)}:
13615
+ </style>`;Y=Y.replace(U,L),q.lastIndex=0}catch(H){}}}return Y}var $q=E(()=>{F1()});function t8(X,$){let Z=X,Y=/@json\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index,Q=G+J[0].length-1,q=1,K=Q+1,U=null,W=!1;while(K<Z.length&&q>0){let F=Z[K];if(W){W=!1,K++;continue}if(F==="\\"&&U){W=!0,K++;continue}if(U){if(F===U)U=null;K++;continue}if(F==='"'||F==="'"||F==="`"){U=F,K++;continue}if(F==="(")q++;else if(F===")"){if(q--,q===0)break}K++}if(q!==0)break;let w=Z.substring(Q+1,K).trim(),z=Z.substring(G,K+1),B=-1,j=0,_=null,H=!1;for(let F=0;F<w.length;F++){let V=w[F];if(H){H=!1;continue}if(V==="\\"&&_){H=!0;continue}if(_){if(V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=V;continue}if(V==="("||V==="["||V==="{")j++;else if(V===")"||V==="]"||V==="}")j--;if(V===","&&j===0){B=F;break}}let L=B>=0?w.substring(0,B).trim():w,O=B>=0?w.substring(B+1).trim():void 0;try{let F=L.trim(),V;if(G0(F))V=Q0(F,Object.keys($))(...Object.values($));else V=void 0;let A;if(O==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(K+1),Y.lastIndex=G+R.length}catch(F){s0.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),Y.lastIndex=G+z.length}}return Z}function e8(X){return X.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Zq(X){let $=X,Z=/@memo\s*\(/g,Y,J=[];while((Y=Z.exec($))!==null){let G=Y.index,Q=G+Y[0].length,q=1,K=Q;while(K<$.length&&q>0){if($[K]==="(")q++;else if($[K]===")")q--;K++}if(q!==0)continue;let U=$.slice(Q,K-1).trim(),W=K,w=$.slice(W),z=w.indexOf("@endmemo");if(z===-1)continue;let B=w.slice(0,z),j=W+z+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=_?_[0].length:0,L=B.slice(H),O=B.match(/(\s*)$/),F=O?O[0].length:0,V=L.slice(0,L.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,T,k="",M]=A,y=`<${T}${k} data-stx-memo="${U}"${M}>`;R=B.slice(0,H)+y+V.slice(N.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${U}">${V}</div>${B.slice(H+V.length)}`;J.push({start:G,end:j,replacement:R}),Z.lastIndex=j}for(let G=J.length-1;G>=0;G--){let Q=J[G];$=$.slice(0,Q.start)+Q.replacement+$.slice(Q.end)}return $.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function C4(X){let $=X.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),$}function Yq(X){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index,q=Q+G[0].length,K=!1,U=!1,W=-1;while(q<X.length){let _=X[q];if(K){if(_==="'")K=!1}else if(U){if(_==='"')U=!1}else if(_==="'")K=!0;else if(_==='"')U=!0;else if(_===">"){W=q;break}q++}if(W===-1)continue;if(X.slice(Q,W+1).includes("x-cloak"))continue;let z=X.slice(W+1),B=z.indexOf("</"),j=B>=0?z.slice(0,B):z.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))Y+=X.slice(J,W)+" x-cloak>",J=W+1}return Y+=X.slice(J),Y}function Jq(X){let $=/<[a-z][\w-]*/gi,Z="",Y=0,J;while((J=$.exec(X))!==null){let G=J.index,Q=J[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let j=`</${Q}>`,_=X.toLowerCase().indexOf(j,G);if(_!==-1)$.lastIndex=_+j.length;continue}let q=G+J[0].length,K=!1,U=!1,W=-1;while(q<X.length){let j=X[q];if(K){if(j==="'")K=!1}else if(U){if(j==='"')U=!1}else if(j==="'")K=!0;else if(j==='"')U=!0;else if(j===">"){W=q;break}q++}if(W===-1)continue;let w=X.slice(G+J[0].length,W);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(w))continue;if(!oH.test(w))continue;let z=X[W-1]==="/",B=z?W-1:W;Z+=`${X.slice(Y,B)} x-cloak${z?" ":""}`,Y=B}return Z+=X.slice(Y),Z}var oH;var P4=E(()=>{w1();O0();oH=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function X$(X,$,Z,Y){let J=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=J.allowPatterns??[],Q=[],q=X1(X.replace(/\{\{--[\s\S]*?--\}\}/g,(K)=>K.replace(/[^\n]/g," ")));for(let{pattern:K,message:U,suggestion:W}of sH){if(G.some((z)=>/\w/.test(z)&&U.includes(z)))continue;K.lastIndex=0;let w=q.match(K);if(w&&w.length>0){let z=q.split(`
13616
+ `),B=X.split(`
13617
+ `),j=[];z.forEach((O,F)=>{if(K.lastIndex=0,K.test(O))j.push(F+1)});let _=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",H=j.slice(0,3).map((O)=>` ${O} | ${(B[O-1]??"").trim().slice(0,100)}`).join(`
13618
+ `),L=H?`
13619
+ ${H}`:"";Q.push(` \u2717 ${U}${_}
13620
+ \u2192 ${W}${L}`)}}if(Q.length>0&&J.enabled){let K=(w)=>{let z=`${process.cwd()}/`;return w.startsWith(z)?w.slice(z.length):w},W=`[STX] DOM API violation in ${Y&&Y!==$?`${K(Y)} (composed into ${K($)})`:K($)}:
13547
13621
  ${Q.join(`
13548
13622
  `)}
13549
- Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(U);else console.warn(U)}}var hH;var E4=D(()=>{hH=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import uH from"fs";function $$(X){return[...X].sort().map(($)=>{try{let Z=uH.statSync($);return`${$}:${Z.size}:${Z.mtimeMs}`}catch{return`${$}:missing`}}).join(`
13550
- `)}function Z$(X,$,Z){let Y=X.get($);return Y!==void 0&&Y.signature===Z?Y.value:void 0}function J1(X,$,Z,Y){return X.set($,{signature:Z,value:Y}),Y}var D4=()=>{};var rQ={};n(rQ,{getStoreScript:()=>mH,clearStoreCache:()=>lH});import Y$ from"path";function dH(X,$){for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let Y of(Z[1]??"").split(",")){let G=((Y.includes(":")?Y.split(":").pop():Y)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))$.add(G)}for(let Z of X.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let Y of(Z[1]??"").split(",")){let J=Y.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))$.add(J)}}async function mH(X){let $;if(X)$=Y$.resolve(X);else{let j=await I1();$=Y$.resolve(j.root||process.cwd(),j.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),Y=[];try{for await(let j of Z.scan({cwd:$,absolute:!0})){let _=Y$.basename(j,".ts");if(["index","types"].includes(_))continue;if(j.includes(".d.ts"))continue;Y.push(j)}}catch{return J1(m5,$,"",""),null}let J=$$(Y),G=Z$(m5,$,J);if(G!==void 0)return G||null;if(Y.length===0)return J1(m5,$,J,""),null;let Q=[];for(let j of Y){let _=await Bun.file(j).text();Q.push({file:j,hasUseStore:/useStore\s*\(/.test(_)})}Q.sort((j,_)=>{if(j.hasUseStore===_.hasUseStore)return 0;return j.hasUseStore?1:-1});let q=Q.map((j)=>j.file),K=[],U=new Set,W=new Bun.Transpiler({loader:"ts",target:"browser",define:S0()});for(let j of q)try{let _=await Bun.file(j).text(),H=Y$.basename(j,".ts");dH(_,U),_=f0(_),_=zX(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=W.transformSync(_),K.push(`// Store: ${H}
13551
- ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${j}:`,_)}if(K.length===0)return J1(m5,$,J,""),null;let w=K.join(`
13623
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(W);else console.warn(W)}}var sH;var v4=E(()=>{sH=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import aH from"fs";function $$(X){return[...X].sort().map(($)=>{try{let Z=aH.statSync($);return`${$}:${Z.size}:${Z.mtimeMs}`}catch{return`${$}:missing`}}).join(`
13624
+ `)}function Z$(X,$,Z){let Y=X.get($);return Y!==void 0&&Y.signature===Z?Y.value:void 0}function J1(X,$,Z,Y){return X.set($,{signature:Z,value:Y}),Y}var x4=()=>{};var Gq={};n(Gq,{getStoreScript:()=>eH,clearStoreCache:()=>XO});import Y$ from"path";function tH(X,$){for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let Y of(Z[1]??"").split(",")){let G=((Y.includes(":")?Y.split(":").pop():Y)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))$.add(G)}for(let Z of X.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let Y of(Z[1]??"").split(",")){let J=Y.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))$.add(J)}}async function eH(X){let $;if(X)$=Y$.resolve(X);else{let j=await I1();$=Y$.resolve(j.root||process.cwd(),j.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),Y=[];try{for await(let j of Z.scan({cwd:$,absolute:!0})){let _=Y$.basename(j,".ts");if(["index","types"].includes(_))continue;if(j.includes(".d.ts"))continue;Y.push(j)}}catch{return J1(l5,$,"",""),null}let J=$$(Y),G=Z$(l5,$,J);if(G!==void 0)return G||null;if(Y.length===0)return J1(l5,$,J,""),null;let Q=[];for(let j of Y){let _=await Bun.file(j).text();Q.push({file:j,hasUseStore:/useStore\s*\(/.test(_)})}Q.sort((j,_)=>{if(j.hasUseStore===_.hasUseStore)return 0;return j.hasUseStore?1:-1});let q=Q.map((j)=>j.file),K=[],U=new Set,W=new Bun.Transpiler({loader:"ts",target:"browser",define:S0()});for(let j of q)try{let _=await Bun.file(j).text(),H=Y$.basename(j,".ts");tH(_,U),_=f0(_),_=jX(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=W.transformSync(_),K.push(`// Store: ${H}
13625
+ ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${j}:`,_)}if(K.length===0)return J1(l5,$,J,""),null;let w=K.join(`
13552
13626
 
13553
13627
  `),B=`;(function(){
13554
13628
  var __stx = window.stx || {};
13555
13629
  ${U1.filter((j)=>!U.has(j)&&new RegExp(`\\b${j}\\b`).test(w)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
13556
13630
  `)}
13557
13631
  ${w}
13558
- })();`;return J1(m5,$,J,B),B}function lH(){m5.clear()}var m5;var oQ=D(()=>{V1();F1();X1();D4();m5=new Map});var y4,NI;var sQ=D(()=>{y4=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],NI=new Set(y4)});var eQ={};n(eQ,{selectComposableFiles:()=>aQ,referencedFrameworkComposables:()=>tQ,getFrameworkComposableScript:()=>nH,clearFrameworkComposableCache:()=>pH,__setRuntimeOwnedForTest:()=>rH});import J$ from"path";function pH(){c7.clear()}function aQ(X){let $=new Map;for(let Z of X){let Y=J$.basename(Z);if(Y.endsWith(".d.ts"))continue;let J=Y.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===Y)continue;let G=$.get(J);if(G&&!G.endsWith(".js"))continue;$.set(J,Z)}return[...$.values()].sort()}function iH(X,$){let Z=$.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test(X)}function tQ(X){if(!X)return[];let $=X.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Z=[];for(let Y of cH){if(b4.has(Y))continue;let J=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test($))Z.push(Y)}return Z.sort()}async function nH(X,$){let Z=tQ(X);if(Z.length===0)return null;let Y=$??J$.join(import.meta.dir,"composables"),J=`${Y}\x00${Z.join(",")}`,G=c7.get(J);if(G!==void 0)return G||null;let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:S0()}),q=new Set(Z),K=[],U=new Set,W=[];try{let j=new Bun.Glob("*.{ts,js}");for await(let _ of j.scan({cwd:Y,absolute:!0}))W.push(_)}catch{return c7.set(J,""),null}W=aQ(W);for(let j of W){let _;try{_=await Bun.file(j).text()}catch{continue}let H=[];try{H=Q.scan(_).exports.filter((L)=>L!=="default")}catch{continue}if(!H.some((L)=>q.has(L)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),K.push(`// ${J$.basename(j).replace(/\.[jt]s$/,"")}
13559
- ${Q.transformSync(_).trim()}`);for(let L of H)U.add(L)}catch(L){console.warn(`[stx] framework composable ${J$.basename(j)} could not be bundled:`,L)}}let w=Z.filter((j)=>!U.has(j)&&!iH(X,j));if(w.length>0)console.warn(`[stx] could not bundle ${w.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(K.length===0)return c7.set(J,""),null;let z=[...U].map((j)=>` try { if (!(${JSON.stringify(j)} in __s)) { __s[${JSON.stringify(j)}] = ${j}; if (!(${JSON.stringify(j)} in window)) window[${JSON.stringify(j)}] = ${j}; } } catch (e) {}`).join(`
13632
+ })();`;return J1(l5,$,J,B),B}function XO(){l5.clear()}var l5;var Qq=E(()=>{V1();F1();e0();x4();l5=new Map});var f4,lI;var qq=E(()=>{f4=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],lI=new Set(f4)});var Wq={};n(Wq,{selectComposableFiles:()=>Kq,referencedFrameworkComposables:()=>Uq,getFrameworkComposableScript:()=>JO,clearFrameworkComposableCache:()=>ZO,__setRuntimeOwnedForTest:()=>GO});import J$ from"path";function ZO(){p7.clear()}function Kq(X){let $=new Map;for(let Z of X){let Y=J$.basename(Z);if(Y.endsWith(".d.ts"))continue;let J=Y.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===Y)continue;let G=$.get(J);if(G&&!G.endsWith(".js"))continue;$.set(J,Z)}return[...$.values()].sort()}function YO(X,$){let Z=$.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test(X)}function Uq(X){if(!X)return[];let $=X.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Z=[];for(let Y of $O){if(g4.has(Y))continue;let J=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test($))Z.push(Y)}return Z.sort()}async function JO(X,$){let Z=Uq(X);if(Z.length===0)return null;let Y=$??J$.join(import.meta.dir,"composables"),J=`${Y}\x00${Z.join(",")}`,G=p7.get(J);if(G!==void 0)return G||null;let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:S0()}),q=new Set(Z),K=[],U=new Set,W=[];try{let j=new Bun.Glob("*.{ts,js}");for await(let _ of j.scan({cwd:Y,absolute:!0}))W.push(_)}catch{return p7.set(J,""),null}W=Kq(W);for(let j of W){let _;try{_=await Bun.file(j).text()}catch{continue}let H=[];try{H=Q.scan(_).exports.filter((L)=>L!=="default")}catch{continue}if(!H.some((L)=>q.has(L)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),K.push(`// ${J$.basename(j).replace(/\.[jt]s$/,"")}
13633
+ ${Q.transformSync(_).trim()}`);for(let L of H)U.add(L)}catch(L){console.warn(`[stx] framework composable ${J$.basename(j)} could not be bundled:`,L)}}let w=Z.filter((j)=>!U.has(j)&&!YO(X,j));if(w.length>0)console.warn(`[stx] could not bundle ${w.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(K.length===0)return p7.set(J,""),null;let z=[...U].map((j)=>` try { if (!(${JSON.stringify(j)} in __s)) { __s[${JSON.stringify(j)}] = ${j}; if (!(${JSON.stringify(j)} in window)) window[${JSON.stringify(j)}] = ${j}; } } catch (e) {}`).join(`
13560
13634
  `),B=`<script data-stx-framework-composables>
13561
13635
  ;(function(){
13562
13636
  var __s = window.stx = window.stx || {};
@@ -13565,8 +13639,8 @@ ${K.join(`
13565
13639
  `)}
13566
13640
  ${z}
13567
13641
  })();
13568
- </script>`;return c7.set(J,B),B}function rH(X){b4.clear();for(let $ of X)b4.add($)}var c7,b4,cH;var Xq=D(()=>{F1();sQ();c7=new Map,b4=new Set,cH=new Set(y4)});var Zq={};n(Zq,{getComposableScript:()=>tH,clearComposableCache:()=>eH});import p7 from"path";function $q(X){let $=p7.basename(X,".ts");return $==="index"||$==="types"||X.endsWith(".d.ts")}async function sH(X){if(X)return p7.resolve(X);let $=`<default>:${process.cwd()}`,Z=S4.get($);if(Z!==void 0)return Z;let Y=await aH();if(Y!==null)S4.set($,Y);return Y}async function aH(){let X=await I1(),$=X.root||process.cwd(),Z=X.composablesDir;if(Z)return p7.resolve($,Z);for(let Y of oH){let J=p7.resolve($,Y);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:J,absolute:!0}))if(!$q(Q))return J}catch{}}return null}async function tH(X){let $=await sH(X);if(!$)return null;let Z=[];try{let j=new Bun.Glob("**/*.ts");for await(let _ of j.scan({cwd:$,absolute:!0})){if($q(_))continue;Z.push(_)}}catch{return J1(l5,$,"",""),null}let Y=$$(Z),J=Z$(l5,$,Y);if(J!==void 0)return J||null;if(Z.length===0)return J1(l5,$,Y,""),null;Z.sort();let G=new Bun.Transpiler({loader:"ts",target:"browser",define:S0()}),Q=[],q=new Set,K=new Set;for(let j of Z)try{let _=await Bun.file(j).text(),H=p7.basename(j,".ts");for(let L of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of G.scan(_).exports)if(L!=="default")q.add(L)}catch{}_=f0(_),_=zX(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=G.transformSync(_),Q.push(`// Composable: ${H}
13569
- ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${j}:`,_)}if(Q.length===0||q.size===0)return J1(l5,$,Y,""),null;let U=[...q].map((j)=>` try { __c[${JSON.stringify(j)}] = ${j}; } catch (e) {}`).join(`
13642
+ </script>`;return p7.set(J,B),B}function GO(X){g4.clear();for(let $ of X)g4.add($)}var p7,g4,$O;var wq=E(()=>{F1();qq();p7=new Map,g4=new Set,$O=new Set(f4)});var jq={};n(jq,{getComposableScript:()=>UO,clearComposableCache:()=>WO});import i7 from"path";function zq(X){let $=i7.basename(X,".ts");return $==="index"||$==="types"||X.endsWith(".d.ts")}async function qO(X){if(X)return i7.resolve(X);let $=`<default>:${process.cwd()}`,Z=h4.get($);if(Z!==void 0)return Z;let Y=await KO();if(Y!==null)h4.set($,Y);return Y}async function KO(){let X=await I1(),$=X.root||process.cwd(),Z=X.composablesDir;if(Z)return i7.resolve($,Z);for(let Y of QO){let J=i7.resolve($,Y);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:J,absolute:!0}))if(!zq(Q))return J}catch{}}return null}async function UO(X){let $=await qO(X);if(!$)return null;let Z=[];try{let j=new Bun.Glob("**/*.ts");for await(let _ of j.scan({cwd:$,absolute:!0})){if(zq(_))continue;Z.push(_)}}catch{return J1(c5,$,"",""),null}let Y=$$(Z),J=Z$(c5,$,Y);if(J!==void 0)return J||null;if(Z.length===0)return J1(c5,$,Y,""),null;Z.sort();let G=new Bun.Transpiler({loader:"ts",target:"browser",define:S0()}),Q=[],q=new Set,K=new Set;for(let j of Z)try{let _=await Bun.file(j).text(),H=i7.basename(j,".ts");for(let L of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of G.scan(_).exports)if(L!=="default")q.add(L)}catch{}_=f0(_),_=jX(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=G.transformSync(_),Q.push(`// Composable: ${H}
13643
+ ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${j}:`,_)}if(Q.length===0||q.size===0)return J1(c5,$,Y,""),null;let U=[...q].map((j)=>` try { __c[${JSON.stringify(j)}] = ${j}; } catch (e) {}`).join(`
13570
13644
  `),W=JSON.stringify([...q]),w=Q.join(`
13571
13645
 
13572
13646
  `),B=`;(function(){
@@ -13590,7 +13664,7 @@ ${U}
13590
13664
  }
13591
13665
  window[__n] = __c[__n];
13592
13666
  }
13593
- })();`;return J1(l5,$,Y,B),B}function eH(){l5.clear(),S4.clear()}var l5,S4,oH;var Yq=D(()=>{V1();F1();D4();X1();l5=new Map,S4=new Map,oH=["composables","functions"]});var Gq={};n(Gq,{processDeferDirectives:()=>JO});function XO(){return`stx-defer-${++Jq}`}function $O(X){let $=X.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function ZO(X,$,Z){let{trigger:Y,value:J}=$O($),G=Z,Q,q,K,U=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(U)Q=U[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let W=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(W)q=W[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let w=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(w)K=w[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:Y,triggerValue:J,content:G,placeholder:Q,loading:q,error:K}}function YO(X,$){let{trigger:Z,triggerValue:Y}=$,J;switch(Z){case"visible":J=`
13667
+ })();`;return J1(c5,$,Y,B),B}function WO(){c5.clear(),h4.clear()}var c5,h4,QO;var Bq=E(()=>{V1();F1();x4();e0();c5=new Map,h4=new Map,QO=["composables","functions"]});var Hq={};n(Hq,{processDeferDirectives:()=>_O});function wO(){return`stx-defer-${++_q}`}function zO(X){let $=X.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function jO(X,$,Z){let{trigger:Y,value:J}=zO($),G=Z,Q,q,K,U=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(U)Q=U[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let W=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(W)q=W[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let w=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(w)K=w[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:Y,triggerValue:J,content:G,placeholder:Q,loading:q,error:K}}function BO(X,$){let{trigger:Z,triggerValue:Y}=$,J;switch(Z){case"visible":J=`
13594
13668
  const observer = new IntersectionObserver((entries) => {
13595
13669
  if (entries[0].isIntersecting) {
13596
13670
  observer.disconnect();
@@ -13663,7 +13737,7 @@ else {
13663
13737
  ${J}
13664
13738
  })();
13665
13739
  </script>
13666
- `}function JO(X,$,Z){Jq=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return X.replace(Y,(J,G,Q)=>{let q=XO(),K=ZO(J,G,Q),U=K.placeholder?`<div data-defer-placeholder>${K.placeholder}</div>`:"",W=K.loading?`<div data-defer-loading style="display: none;">${K.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',w=K.error?`<div data-defer-error style="display: none;">${K.error}</div>`:"",z=`<div data-defer-content style="display: none;">${K.content}</div>`,B=YO(q,K);return`
13740
+ `}function _O(X,$,Z){_q=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return X.replace(Y,(J,G,Q)=>{let q=wO(),K=jO(J,G,Q),U=K.placeholder?`<div data-defer-placeholder>${K.placeholder}</div>`:"",W=K.loading?`<div data-defer-loading style="display: none;">${K.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',w=K.error?`<div data-defer-error style="display: none;">${K.error}</div>`:"",z=`<div data-defer-content style="display: none;">${K.content}</div>`,B=BO(q,K);return`
13667
13741
  <div id="${q}" class="stx-defer" data-defer-trigger="${K.trigger}">
13668
13742
  ${U}
13669
13743
  ${W}
@@ -13671,7 +13745,7 @@ else {
13671
13745
  ${w}
13672
13746
  </div>
13673
13747
  ${B}
13674
- `})}var Jq=0;var qq={};n(qq,{processTeleportDirectives:()=>KO,ensureTeleportTargets:()=>UO});function GO(){return`stx-teleport-${++Qq}`}function QO(X){let $=X.split(",").map((J)=>J.trim()),Z=$[0].replace(/['"]/g,""),Y;for(let J=1;J<$.length;J++){let G=$[J].match(/disabled:\s*(.+)/);if(G)Y=G[1].trim()}return{target:Z,disabled:Y}}function qO(X,$){return`
13748
+ `})}var _q=0;var Lq={};n(Lq,{processTeleportDirectives:()=>FO,ensureTeleportTargets:()=>VO});function HO(){return`stx-teleport-${++Oq}`}function OO(X){let $=X.split(",").map((J)=>J.trim()),Z=$[0].replace(/['"]/g,""),Y;for(let J=1;J<$.length;J++){let G=$[J].match(/disabled:\s*(.+)/);if(G)Y=G[1].trim()}return{target:Z,disabled:Y}}function LO(X,$){return`
13675
13749
  <script>
13676
13750
  (function() {
13677
13751
  const source = document.getElementById('${X}');
@@ -13717,12 +13791,12 @@ else {
13717
13791
  });
13718
13792
  })();
13719
13793
  </script>
13720
- `}function KO(X,$,Z){Qq=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return X.replace(Y,(J,G,Q)=>{let q=GO(),{target:K,disabled:U}=QO(G),W=Q.trim();if(U)try{let z=!1;if(U==="true")z=!0;else if(U==="false")z=!1;else if(U in $)z=Boolean($[U]);if(z)return`<div class="stx-teleport-inline" data-teleport-disabled>${W}</div>`}catch{}let w=qO(q,K);return`
13794
+ `}function FO(X,$,Z){Oq=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return X.replace(Y,(J,G,Q)=>{let q=HO(),{target:K,disabled:U}=OO(G),W=Q.trim();if(U)try{let z=!1;if(U==="true")z=!0;else if(U==="false")z=!1;else if(U in $)z=Boolean($[U]);if(z)return`<div class="stx-teleport-inline" data-teleport-disabled>${W}</div>`}catch{}let w=LO(q,K);return`
13721
13795
  <div id="${q}" class="stx-teleport-source" style="display: none;">
13722
13796
  <template>${W}</template>
13723
13797
  </div>
13724
13798
  ${w}
13725
- `})}function UO(){return`
13799
+ `})}function VO(){return`
13726
13800
  <script>
13727
13801
  (function() {
13728
13802
  // Common teleport targets
@@ -13739,7 +13813,7 @@ else {
13739
13813
  });
13740
13814
  })();
13741
13815
  </script>
13742
- `}var Qq=0;var wq={};n(wq,{processTransitionDirectives:()=>jO,processTransitionAttributes:()=>OO,performLeave:()=>zO,performEnter:()=>wO,generateTransitionRuntime:()=>HO,generateTransitionCSS:()=>_O});function Kq(X,$={}){return{enterFrom:$.enterClass||`${X}-enter-from`,enterActive:$.enterActiveClass||`${X}-enter-active`,enterTo:$.enterToClass||`${X}-enter-to`,leaveFrom:$.leaveClass||`${X}-leave-from`,leaveActive:$.leaveActiveClass||`${X}-leave-active`,leaveTo:$.leaveToClass||`${X}-leave-to`}}function WO(X){let $=getComputedStyle(X),Z=$.transitionDuration||"0s",Y=$.animationDuration||"0s",J=(G)=>{let Q=G.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let q=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?q:q*1000};return Math.max(J(Z),J(Y))}function Uq(X,$){return new Promise((Z)=>{let Y=$??WO(X);if(Y===0){Z();return}let J=!1,G=()=>{if(J)return;J=!0,X.removeEventListener("transitionend",Q),X.removeEventListener("animationend",Q),Z()},Q=(q)=>{if(q.target===X)G()};X.addEventListener("transitionend",Q),X.addEventListener("animationend",Q),setTimeout(G,Y+50)})}function Wq(X){X.offsetHeight}async function wO(X,$={}){let Z=$.name||"stx",Y=Kq(Z,$),J=typeof $.duration==="object"?$.duration.enter:$.duration;if($.onBeforeEnter?.(X),X.classList.add(Y.enterFrom),X.classList.add(Y.enterActive),Wq(X),X.classList.remove(Y.enterFrom),X.classList.add(Y.enterTo),$.onEnter)await new Promise((G)=>{$.onEnter(X,G)});else await Uq(X,J);X.classList.remove(Y.enterActive),X.classList.remove(Y.enterTo),$.onAfterEnter?.(X)}async function zO(X,$={}){let Z=$.name||"stx",Y=Kq(Z,$),J=typeof $.duration==="object"?$.duration.leave:$.duration;if($.onBeforeLeave?.(X),X.classList.add(Y.leaveFrom),X.classList.add(Y.leaveActive),Wq(X),X.classList.remove(Y.leaveFrom),X.classList.add(Y.leaveTo),$.onLeave)await new Promise((G)=>{$.onLeave(X,G)});else await Uq(X,J);X.classList.remove(Y.leaveActive),X.classList.remove(Y.leaveTo),$.onAfterLeave?.(X)}function jO(X,$={},Z){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return X.replace(Y,(J,G,Q)=>{let q=BO(G),K=q.name||"stx",U=q.duration||300,W=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
13816
+ `}var Oq=0;var Rq={};n(Rq,{processTransitionDirectives:()=>TO,processTransitionAttributes:()=>EO,performLeave:()=>NO,performEnter:()=>RO,generateTransitionRuntime:()=>IO,generateTransitionCSS:()=>kO});function Fq(X,$={}){return{enterFrom:$.enterClass||`${X}-enter-from`,enterActive:$.enterActiveClass||`${X}-enter-active`,enterTo:$.enterToClass||`${X}-enter-to`,leaveFrom:$.leaveClass||`${X}-leave-from`,leaveActive:$.leaveActiveClass||`${X}-leave-active`,leaveTo:$.leaveToClass||`${X}-leave-to`}}function AO(X){let $=getComputedStyle(X),Z=$.transitionDuration||"0s",Y=$.animationDuration||"0s",J=(G)=>{let Q=G.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let q=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?q:q*1000};return Math.max(J(Z),J(Y))}function Vq(X,$){return new Promise((Z)=>{let Y=$??AO(X);if(Y===0){Z();return}let J=!1,G=()=>{if(J)return;J=!0,X.removeEventListener("transitionend",Q),X.removeEventListener("animationend",Q),Z()},Q=(q)=>{if(q.target===X)G()};X.addEventListener("transitionend",Q),X.addEventListener("animationend",Q),setTimeout(G,Y+50)})}function Aq(X){X.offsetHeight}async function RO(X,$={}){let Z=$.name||"stx",Y=Fq(Z,$),J=typeof $.duration==="object"?$.duration.enter:$.duration;if($.onBeforeEnter?.(X),X.classList.add(Y.enterFrom),X.classList.add(Y.enterActive),Aq(X),X.classList.remove(Y.enterFrom),X.classList.add(Y.enterTo),$.onEnter)await new Promise((G)=>{$.onEnter(X,G)});else await Vq(X,J);X.classList.remove(Y.enterActive),X.classList.remove(Y.enterTo),$.onAfterEnter?.(X)}async function NO(X,$={}){let Z=$.name||"stx",Y=Fq(Z,$),J=typeof $.duration==="object"?$.duration.leave:$.duration;if($.onBeforeLeave?.(X),X.classList.add(Y.leaveFrom),X.classList.add(Y.leaveActive),Aq(X),X.classList.remove(Y.leaveFrom),X.classList.add(Y.leaveTo),$.onLeave)await new Promise((G)=>{$.onLeave(X,G)});else await Vq(X,J);X.classList.remove(Y.leaveActive),X.classList.remove(Y.leaveTo),$.onAfterLeave?.(X)}function TO(X,$={},Z){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return X.replace(Y,(J,G,Q)=>{let q=MO(G),K=q.name||"stx",U=q.duration||300,W=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
13743
13817
  <div
13744
13818
  class="stx-transition-wrapper"
13745
13819
  data-transition="${K}"
@@ -13781,7 +13855,7 @@ else {
13781
13855
  });
13782
13856
  })();
13783
13857
  </script>
13784
- `})}function BO(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4]||Y[5];switch(J){case"name":$.name=G;break;case"duration":$.duration=parseInt(G,10);break;case"mode":$.mode=G;break;case"easing":$.easing=G;break}}return $}function _O(){return`
13858
+ `})}function MO(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4]||Y[5];switch(J){case"name":$.name=G;break;case"duration":$.duration=parseInt(G,10);break;case"mode":$.mode=G;break;case"easing":$.easing=G;break}}return $}function kO(){return`
13785
13859
  /* STX Transition Presets */
13786
13860
 
13787
13861
  /* Fade */
@@ -13968,7 +14042,7 @@ else {
13968
14042
  opacity: 1;
13969
14043
  max-height: 1000px;
13970
14044
  }
13971
- `}function HO(){return`
14045
+ `}function IO(){return`
13972
14046
  // STX Transition Runtime
13973
14047
  (function() {
13974
14048
  if (typeof window === 'undefined') return;
@@ -14057,7 +14131,7 @@ else {
14057
14131
 
14058
14132
  console.log('[stx] Transition runtime initialized');
14059
14133
  })();
14060
- `}function OO(X){let $=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return X.replace($,(Z,Y,J,G)=>{let Q=J||"300",q=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${q}"`})}var jq={};n(jq,{withErrorBoundary:()=>zq,processErrorBoundaryDirectives:()=>VO,generateErrorBoundaryRuntime:()=>MO,generateErrorBoundaryCSS:()=>NO,createErrorBoundary:()=>TO});function FO(){return`eb-${++LO}-${Date.now().toString(36)}`}function VO(X,$={},Z){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return X.replace(Y,(J,G,Q,q)=>{let K=FO(),U=AO(G||"");return RO(K,Q.trim(),q.trim(),U)})}function AO(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4];switch(J){case"id":$.id=G;break;case"logErrors":$.logErrors=G==="true";break}}return $}function RO(X,$,Z,Y){let J=Y.logErrors!==!1;return`
14134
+ `}function EO(X){let $=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return X.replace($,(Z,Y,J,G)=>{let Q=J||"300",q=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${q}"`})}var Tq={};n(Tq,{withErrorBoundary:()=>Nq,processErrorBoundaryDirectives:()=>bO,generateErrorBoundaryRuntime:()=>xO,generateErrorBoundaryCSS:()=>vO,createErrorBoundary:()=>PO});function yO(){return`eb-${++DO}-${Date.now().toString(36)}`}function bO(X,$={},Z){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return X.replace(Y,(J,G,Q,q)=>{let K=yO(),U=SO(G||"");return CO(K,Q.trim(),q.trim(),U)})}function SO(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4];switch(J){case"id":$.id=G;break;case"logErrors":$.logErrors=G==="true";break}}return $}function CO(X,$,Z,Y){let J=Y.logErrors!==!1;return`
14061
14135
  <div class="stx-error-boundary" data-boundary-id="${X}" data-has-error="false">
14062
14136
  <div class="stx-error-boundary-content" data-boundary-content="${X}">
14063
14137
  ${$}
@@ -14177,7 +14251,7 @@ else {
14177
14251
  };
14178
14252
  })();
14179
14253
  </script>
14180
- `}async function zq(X,$,Z){try{return await X()}catch(Y){if(Z)Z(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return $}}function TO(X,$={}){let Z=$.onError?(Y)=>$.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>zq(Y,X,Z)}function NO(){return`
14254
+ `}async function Nq(X,$,Z){try{return await X()}catch(Y){if(Z)Z(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return $}}function PO(X,$={}){let Z=$.onError?(Y)=>$.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>Nq(Y,X,Z)}function vO(){return`
14181
14255
  /* STX Error Boundary Styles */
14182
14256
  .stx-error-boundary {
14183
14257
  position: relative;
@@ -14221,7 +14295,7 @@ else {
14221
14295
  color: #fecaca;
14222
14296
  }
14223
14297
  }
14224
- `}function MO(){return`
14298
+ `}function xO(){return`
14225
14299
  // STX Error Boundary Runtime
14226
14300
  (function() {
14227
14301
  if (typeof window === 'undefined') return;
@@ -14286,7 +14360,7 @@ else {
14286
14360
 
14287
14361
  console.log('[stx] Error boundary runtime initialized');
14288
14362
  })();
14289
- `}var LO=0;var Bq={};n(Bq,{renderSSRSuspense:()=>SO,processSuspenseDirectives:()=>EO,generateSuspenseRuntime:()=>PO,generateSuspenseCSS:()=>CO,createSSRSuspense:()=>bO});function IO(){return`suspense-${++kO}-${Date.now().toString(36)}`}function EO(X,$={},Z){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return X.replace(Y,(J,G,Q,q)=>{let K=IO(),U=DO(G||"");return yO(K,Q.trim(),q.trim(),U)})}function DO(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"id":$.id=G;break;case"timeout":$.timeout=Q?parseInt(Q,10):void 0;break}}return $}function yO(X,$,Z,Y){let J=Y.timeout||30000,G=Y.id||X;return`
14363
+ `}var DO=0;var Mq={};n(Mq,{renderSSRSuspense:()=>lO,processSuspenseDirectives:()=>hO,generateSuspenseRuntime:()=>pO,generateSuspenseCSS:()=>cO,createSSRSuspense:()=>mO});function gO(){return`suspense-${++fO}-${Date.now().toString(36)}`}function hO(X,$={},Z){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return X.replace(Y,(J,G,Q,q)=>{let K=gO(),U=uO(G||"");return dO(K,Q.trim(),q.trim(),U)})}function uO(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"id":$.id=G;break;case"timeout":$.timeout=Q?parseInt(Q,10):void 0;break}}return $}function dO(X,$,Z,Y){let J=Y.timeout||30000,G=Y.id||X;return`
14290
14364
  <div class="stx-suspense" data-suspense-id="${X}" data-custom-id="${G}" data-status="pending">
14291
14365
  <div class="stx-suspense-fallback" data-suspense-fallback="${X}">
14292
14366
  ${Z}
@@ -14476,7 +14550,7 @@ else {
14476
14550
  }, 0);
14477
14551
  })();
14478
14552
  </script>
14479
- `}function bO(X,$,Z){return{id:X,fallback:Z,content:$}}async function SO(X){let $=X.map((Y)=>`
14553
+ `}function mO(X,$,Z){return{id:X,fallback:Z,content:$}}async function lO(X){let $=X.map((Y)=>`
14480
14554
  <div id="stx-ssr-suspense-${Y.id}" class="stx-ssr-suspense">
14481
14555
  ${Y.fallback}
14482
14556
  </div>
@@ -14501,7 +14575,7 @@ else {
14501
14575
  }
14502
14576
  })();
14503
14577
  </script>
14504
- `}}return{initial:$,streaming:Z()}}function CO(){return`
14578
+ `}}return{initial:$,streaming:Z()}}function cO(){return`
14505
14579
  /* STX Suspense Styles */
14506
14580
  .stx-suspense {
14507
14581
  position: relative;
@@ -14557,7 +14631,7 @@ else {
14557
14631
  background-size: 200% 100%;
14558
14632
  }
14559
14633
  }
14560
- `}function PO(){return`
14634
+ `}function pO(){return`
14561
14635
  // STX Suspense Runtime
14562
14636
  (function() {
14563
14637
  if (typeof window === 'undefined') return;
@@ -14624,7 +14698,7 @@ else {
14624
14698
 
14625
14699
  console.log('[stx] Suspense runtime initialized');
14626
14700
  })();
14627
- `}var kO=0;var Lq={};n(Lq,{processAsyncDirectives:()=>xO,isAsyncComponent:()=>gO,generateAsyncComponentRuntime:()=>uO,generateAsyncComponentCSS:()=>hO,defineAsyncComponent:()=>fO});function _q(){return`async-${++vO}-${Date.now().toString(36)}`}function xO(X,$={},Z){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,G=X;return G=G.replace(Y,(Q,q,K,U)=>{let W=_q(),w=Hq(q);return Oq(W,w,K.trim(),U.trim())}),G=G.replace(J,(Q,q,K)=>{let U=_q(),W=Hq(q);return Oq(U,W,K.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function Hq(X){let $={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4],q=Y[5];switch(J){case"component":$.component=G||q||"";break;case"timeout":$.timeout=Q?parseInt(Q,10):30000;break;case"delay":$.delay=Q?parseInt(Q,10):200;break;case"suspensible":$.suspensible=q==="true";break;case"retries":$.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":$.loadingComponent=G||q;break;case"errorComponent":$.errorComponent=G||q;break}}return $}function Oq(X,$,Z,Y){let{component:J,timeout:G,delay:Q,suspensible:q,retries:K}=$;return`
14701
+ `}var fO=0;var Dq={};n(Dq,{processAsyncDirectives:()=>nO,isAsyncComponent:()=>oO,generateAsyncComponentRuntime:()=>aO,generateAsyncComponentCSS:()=>sO,defineAsyncComponent:()=>rO});function kq(){return`async-${++iO}-${Date.now().toString(36)}`}function nO(X,$={},Z){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,G=X;return G=G.replace(Y,(Q,q,K,U)=>{let W=kq(),w=Iq(q);return Eq(W,w,K.trim(),U.trim())}),G=G.replace(J,(Q,q,K)=>{let U=kq(),W=Iq(q);return Eq(U,W,K.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function Iq(X){let $={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4],q=Y[5];switch(J){case"component":$.component=G||q||"";break;case"timeout":$.timeout=Q?parseInt(Q,10):30000;break;case"delay":$.delay=Q?parseInt(Q,10):200;break;case"suspensible":$.suspensible=q==="true";break;case"retries":$.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":$.loadingComponent=G||q;break;case"errorComponent":$.errorComponent=G||q;break}}return $}function Eq(X,$,Z,Y){let{component:J,timeout:G,delay:Q,suspensible:q,retries:K}=$;return`
14628
14702
  <div class="stx-async-component" data-async-id="${X}" data-component="${J}" data-status="pending">
14629
14703
  <div class="stx-async-loading" data-async-loading="${X}">
14630
14704
  ${Z}
@@ -14851,7 +14925,7 @@ catch (error) {
14851
14925
  loadComponent();
14852
14926
  })();
14853
14927
  </script>
14854
- `}function fO(X){return{__asyncComponent:!0,...typeof X==="function"?{loader:X}:X}}function gO(X){return typeof X==="object"&&X!==null&&"__asyncComponent"in X&&X.__asyncComponent===!0}function hO(){return`
14928
+ `}function rO(X){return{__asyncComponent:!0,...typeof X==="function"?{loader:X}:X}}function oO(X){return typeof X==="object"&&X!==null&&"__asyncComponent"in X&&X.__asyncComponent===!0}function sO(){return`
14855
14929
  /* STX Async Component Styles */
14856
14930
  .stx-async-component {
14857
14931
  position: relative;
@@ -14925,7 +14999,7 @@ catch (error) {
14925
14999
  background-size: 200% 100%;
14926
15000
  }
14927
15001
  }
14928
- `}function uO(){return`
15002
+ `}function aO(){return`
14929
15003
  // STX Async Component Runtime
14930
15004
  (function() {
14931
15005
  if (typeof window === 'undefined') return;
@@ -14979,7 +15053,7 @@ catch (error) {
14979
15053
 
14980
15054
  console.log('[stx] Async component runtime initialized');
14981
15055
  })();
14982
- `}var vO=0;var Vq={};n(Vq,{shouldCacheComponent:()=>iO,processKeepAliveDirectives:()=>mO,onDeactivated:()=>sO,onActivated:()=>oO,generateKeepAliveRuntime:()=>rO,generateKeepAliveCSS:()=>nO,createKeepAliveCache:()=>pO});function Fq(){return`keep-alive-${++dO}-${Date.now().toString(36)}`}function mO(X,$={},Z){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return X.replace(Y,(J,G,Q)=>{let q=Fq(),K=lO(G||"");return cO(q,Q.trim(),K)})}function lO(X){let $={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"max":$.max=Q?parseInt(Q,10):10;break;case"include":$.include=G;break;case"exclude":$.exclude=G;break;case"id":$.id=G;break}}return $}function cO(X,$,Z){let{max:Y,include:J,exclude:G}=Z,Q=Z.id||X;return`
15056
+ `}var iO=0;var bq={};n(bq,{shouldCacheComponent:()=>YL,processKeepAliveDirectives:()=>eO,onDeactivated:()=>qL,onActivated:()=>QL,generateKeepAliveRuntime:()=>GL,generateKeepAliveCSS:()=>JL,createKeepAliveCache:()=>ZL});function yq(){return`keep-alive-${++tO}-${Date.now().toString(36)}`}function eO(X,$={},Z){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return X.replace(Y,(J,G,Q)=>{let q=yq(),K=XL(G||"");return $L(q,Q.trim(),K)})}function XL(X){let $={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"max":$.max=Q?parseInt(Q,10):10;break;case"include":$.include=G;break;case"exclude":$.exclude=G;break;case"id":$.id=G;break}}return $}function $L(X,$,Z){let{max:Y,include:J,exclude:G}=Z,Q=Z.id||X;return`
14983
15057
  <div class="stx-keep-alive" data-keep-alive-id="${X}" data-custom-id="${Q}">
14984
15058
  <div class="stx-keep-alive-content" data-keep-alive-content="${X}">
14985
15059
  ${$}
@@ -15266,7 +15340,7 @@ else {
15266
15340
  });
15267
15341
  })();
15268
15342
  </script>
15269
- `}function pO(X={}){return{id:X.id||Fq(),cache:new Map,max:X.max||10,include:X.include?X.include.split(",").map((Z)=>Z.trim()):null,exclude:X.exclude?X.exclude.split(",").map((Z)=>Z.trim()):null}}function iO(X,$){if($.exclude&&$.exclude.includes(X))return!1;if($.include&&!$.include.includes(X))return!1;return!0}function nO(){return`
15343
+ `}function ZL(X={}){return{id:X.id||yq(),cache:new Map,max:X.max||10,include:X.include?X.include.split(",").map((Z)=>Z.trim()):null,exclude:X.exclude?X.exclude.split(",").map((Z)=>Z.trim()):null}}function YL(X,$){if($.exclude&&$.exclude.includes(X))return!1;if($.include&&!$.include.includes(X))return!1;return!0}function JL(){return`
15270
15344
  /* STX Keep-Alive Styles */
15271
15345
  .stx-keep-alive {
15272
15346
  position: relative;
@@ -15291,7 +15365,7 @@ else {
15291
15365
  .stx-keep-alive-content > [data-activated] {
15292
15366
  opacity: 1;
15293
15367
  }
15294
- `}function rO(){return`
15368
+ `}function GL(){return`
15295
15369
  // STX Keep-Alive Runtime
15296
15370
  (function() {
15297
15371
  if (typeof window === 'undefined') return;
@@ -15327,7 +15401,7 @@ else {
15327
15401
 
15328
15402
  console.log('[stx] Keep-alive runtime initialized');
15329
15403
  })();
15330
- `}function oO(X){if(typeof document<"u")document.addEventListener("stx:activated",($)=>{X($.detail)})}function sO(X){if(typeof document<"u")document.addEventListener("stx:deactivated",($)=>{X($.detail)})}var dO=0;var Mq={};n(Mq,{useVirtualList:()=>Rq,processVirtualListDirectives:()=>P4,processVirtualGridDirectives:()=>Nq,processInfiniteListDirectives:()=>Tq,generateVirtualListCSS:()=>Aq,default:()=>aO,createVirtualList:()=>C4});function C4(X,$){let{itemHeight:Z,containerHeight:Y,overscan:J=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:q=Z,direction:K="vertical"}=$,U=[...X],W=0,w=new Map;function z(){if(Q)return B();let R=Math.max(0,Math.floor(W/Z)-J),T=Math.ceil(Y/Z),N=Math.min(U.length-1,R+T+J*2);return{startIndex:R,endIndex:N}}function B(){let R=0,T=0,N=U.length-1;for(let k=0;k<U.length;k++){let M=w.get(k)||q;if(R+M>W){T=Math.max(0,k-J);break}R+=M}R=0;for(let k=0;k<U.length;k++){let M=w.get(k)||q;if(R+=M,R>W+Y){N=Math.min(U.length-1,k+J);break}}return{startIndex:T,endIndex:N}}function j(){if(Q){let R=0;for(let T=0;T<U.length;T++)R+=w.get(T)||q;return R}return U.length*Z}function _(R){if(Q){let T=0;for(let N=0;N<R;N++)T+=w.get(N)||q;return T}return R*Z}function H(){let{startIndex:R,endIndex:T}=z();return{startIndex:R,endIndex:T,scrollTop:W,totalHeight:j(),visibleItems:U.slice(R,T+1),itemHeights:new Map(w)}}function L(R,T="auto"){let N=_(R);O(N,T)}function O(R,T="auto"){W=Math.max(0,Math.min(R,j()-Y))}function F(){z()}function V(R){U=[...R],w.clear(),F()}function A(){U=[],w.clear()}return{scrollToIndex:L,scrollToOffset:O,getState:H,refresh:F,setItems:V,destroy:A}}function P4(X,$={},Z){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return X.replace(Y,(J,G,Q,q)=>{let K=G.trim(),U=$[K];if(!U||!Array.isArray(U))return`<!-- virtualList: items "${K}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let O=Q.trim(),F=Function(`return ${O}`)();W={...W,...F}}catch{}let w=`vlist-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(W.containerHeight/W.itemHeight),B=W.overscan||3,j=0,_=Math.min(U.length-1,z+B),H="";for(let O=j;O<=_&&O<U.length;O++){let F=U[O],V=q.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));H+=`
15404
+ `}function QL(X){if(typeof document<"u")document.addEventListener("stx:activated",($)=>{X($.detail)})}function qL(X){if(typeof document<"u")document.addEventListener("stx:deactivated",($)=>{X($.detail)})}var tO=0;var xq={};n(xq,{useVirtualList:()=>Cq,processVirtualListDirectives:()=>d4,processVirtualGridDirectives:()=>vq,processInfiniteListDirectives:()=>Pq,generateVirtualListCSS:()=>Sq,default:()=>KL,createVirtualList:()=>u4});function u4(X,$){let{itemHeight:Z,containerHeight:Y,overscan:J=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:q=Z,direction:K="vertical"}=$,U=[...X],W=0,w=new Map;function z(){if(Q)return B();let R=Math.max(0,Math.floor(W/Z)-J),N=Math.ceil(Y/Z),T=Math.min(U.length-1,R+N+J*2);return{startIndex:R,endIndex:T}}function B(){let R=0,N=0,T=U.length-1;for(let k=0;k<U.length;k++){let M=w.get(k)||q;if(R+M>W){N=Math.max(0,k-J);break}R+=M}R=0;for(let k=0;k<U.length;k++){let M=w.get(k)||q;if(R+=M,R>W+Y){T=Math.min(U.length-1,k+J);break}}return{startIndex:N,endIndex:T}}function j(){if(Q){let R=0;for(let N=0;N<U.length;N++)R+=w.get(N)||q;return R}return U.length*Z}function _(R){if(Q){let N=0;for(let T=0;T<R;T++)N+=w.get(T)||q;return N}return R*Z}function H(){let{startIndex:R,endIndex:N}=z();return{startIndex:R,endIndex:N,scrollTop:W,totalHeight:j(),visibleItems:U.slice(R,N+1),itemHeights:new Map(w)}}function L(R,N="auto"){let T=_(R);O(T,N)}function O(R,N="auto"){W=Math.max(0,Math.min(R,j()-Y))}function F(){z()}function V(R){U=[...R],w.clear(),F()}function A(){U=[],w.clear()}return{scrollToIndex:L,scrollToOffset:O,getState:H,refresh:F,setItems:V,destroy:A}}function d4(X,$={},Z){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return X.replace(Y,(J,G,Q,q)=>{let K=G.trim(),U=$[K];if(!U||!Array.isArray(U))return`<!-- virtualList: items "${K}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let O=Q.trim(),F=Function(`return ${O}`)();W={...W,...F}}catch{}let w=`vlist-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(W.containerHeight/W.itemHeight),B=W.overscan||3,j=0,_=Math.min(U.length-1,z+B),H="";for(let O=j;O<=_&&O<U.length;O++){let F=U[O],V=q.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));H+=`
15331
15405
  <div class="virtual-item ${W.itemClass||""}"
15332
15406
  style="position: absolute; top: ${O*W.itemHeight}px; height: ${W.itemHeight}px; width: 100%;"
15333
15407
  data-index="${O}">
@@ -15404,7 +15478,7 @@ else {
15404
15478
  };
15405
15479
  })();
15406
15480
  </script>
15407
- `})}function Aq(){return`
15481
+ `})}function Sq(){return`
15408
15482
  .virtual-list-container {
15409
15483
  position: relative;
15410
15484
  overflow-y: auto;
@@ -15452,7 +15526,7 @@ else {
15452
15526
  0% { background-position: 200% 0; }
15453
15527
  100% { background-position: -200% 0; }
15454
15528
  }
15455
- `}function Rq(X,$){let Z=null,Y=()=>{if(!Z)Z=C4(X(),$);return Z};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${$.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(J)=>{let G=J.target;if(Z)Z.scrollToOffset(G.scrollTop)}}),itemProps:(J)=>({style:{position:"absolute",top:`${J*$.itemHeight}px`,height:`${$.itemHeight}px`,width:"100%"},"data-index":J}),scrollToIndex:(J)=>{Y().scrollToIndex(J)}}}function Tq(X,$={},Z){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return X.replace(Y,(J,G,Q,q,K)=>{let U=G.trim(),W=$[U];if(!W||!Array.isArray(W))return`<!-- infiniteList: items "${U}" not found or not an array -->`;let w={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let j=Function(`return ${Q.trim()}`)();w={...w,...j}}catch{}let z=`ilist-${Math.random().toString(36).substring(2,9)}`,B=P4(`@virtualList(${U}, ${JSON.stringify({itemHeight:w.itemHeight,containerHeight:w.containerHeight,overscan:w.overscan,containerClass:w.containerClass})})${q}@endvirtualList`,$);return B=B.replace("</script>",`
15529
+ `}function Cq(X,$){let Z=null,Y=()=>{if(!Z)Z=u4(X(),$);return Z};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${$.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(J)=>{let G=J.target;if(Z)Z.scrollToOffset(G.scrollTop)}}),itemProps:(J)=>({style:{position:"absolute",top:`${J*$.itemHeight}px`,height:`${$.itemHeight}px`,width:"100%"},"data-index":J}),scrollToIndex:(J)=>{Y().scrollToIndex(J)}}}function Pq(X,$={},Z){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return X.replace(Y,(J,G,Q,q,K)=>{let U=G.trim(),W=$[U];if(!W||!Array.isArray(W))return`<!-- infiniteList: items "${U}" not found or not an array -->`;let w={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let j=Function(`return ${Q.trim()}`)();w={...w,...j}}catch{}let z=`ilist-${Math.random().toString(36).substring(2,9)}`,B=d4(`@virtualList(${U}, ${JSON.stringify({itemHeight:w.itemHeight,containerHeight:w.containerHeight,overscan:w.overscan,containerClass:w.containerClass})})${q}@endvirtualList`,$);return B=B.replace("</script>",`
15456
15530
  // Infinite scroll detection
15457
15531
  container.addEventListener('scroll', function() {
15458
15532
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -15470,9 +15544,9 @@ else {
15470
15544
  ${K}
15471
15545
  </div>
15472
15546
  </div>
15473
- `})}function Nq(X,$={},Z){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return X.replace(Y,(J,G,Q,q)=>{let K=G.trim(),U=$[K];if(!U||!Array.isArray(U))return`<!-- virtualGrid: items "${K}" not found or not an array -->`;let W={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let F=Function(`return ${Q.trim()}`)();W={...W,...F}}catch{}let w=`vgrid-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(U.length/W.columns),B=z*(W.rowHeight+(W.gap||0)),j=Math.ceil(W.containerHeight/(W.rowHeight+(W.gap||0))),_=W.overscan||2,H=0,L=Math.min(z-1,j+_),O="";for(let F=H;F<=L;F++)for(let V=0;V<W.columns;V++){let A=F*W.columns+V;if(A>=U.length)break;let R=U[A],T=V*(100/W.columns),N=F*(W.rowHeight+(W.gap||0)),k=q.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,y)=>{if(typeof R==="object"&&R!==null)return String(R[y]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
15547
+ `})}function vq(X,$={},Z){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return X.replace(Y,(J,G,Q,q)=>{let K=G.trim(),U=$[K];if(!U||!Array.isArray(U))return`<!-- virtualGrid: items "${K}" not found or not an array -->`;let W={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let F=Function(`return ${Q.trim()}`)();W={...W,...F}}catch{}let w=`vgrid-${Math.random().toString(36).substring(2,9)}`,z=Math.ceil(U.length/W.columns),B=z*(W.rowHeight+(W.gap||0)),j=Math.ceil(W.containerHeight/(W.rowHeight+(W.gap||0))),_=W.overscan||2,H=0,L=Math.min(z-1,j+_),O="";for(let F=H;F<=L;F++)for(let V=0;V<W.columns;V++){let A=F*W.columns+V;if(A>=U.length)break;let R=U[A],N=V*(100/W.columns),T=F*(W.rowHeight+(W.gap||0)),k=q.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(M,y)=>{if(typeof R==="object"&&R!==null)return String(R[y]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
15474
15548
  <div class="virtual-grid-item"
15475
- style="position: absolute; top: ${N}px; left: ${T}%; width: calc(${100/W.columns}% - ${W.gap||0}px); height: ${W.rowHeight}px;"
15549
+ style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/W.columns}% - ${W.gap||0}px); height: ${W.rowHeight}px;"
15476
15550
  data-index="${A}">
15477
15551
  ${k}
15478
15552
  </div>`}return`
@@ -15540,7 +15614,7 @@ else {
15540
15614
  });
15541
15615
  })();
15542
15616
  </script>
15543
- `})}var aO;var kq=D(()=>{aO={createVirtualList:C4,processVirtualListDirectives:P4,processInfiniteListDirectives:Tq,processVirtualGridDirectives:Nq,generateVirtualListCSS:Aq,useVirtualList:Rq}});function Iq(){return`<script data-stx-hydration-runtime>
15617
+ `})}var KL;var fq=E(()=>{KL={createVirtualList:u4,processVirtualListDirectives:d4,processInfiniteListDirectives:Pq,processVirtualGridDirectives:vq,generateVirtualListCSS:Sq,useVirtualList:Cq}});function gq(){return`<script data-stx-hydration-runtime>
15544
15618
  (function() {
15545
15619
  'use strict';
15546
15620
 
@@ -15700,7 +15774,7 @@ else {
15700
15774
  stxIslands.initIslands();
15701
15775
  }
15702
15776
  })();
15703
- </script>`}function Eq(X){let $=X.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if($)return $[1];let Z=X.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function Dq(X,$){let Z={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(Q in $)Z[G]=$[Q];else Z[G]=Q}return Z}var uq={};n(uq,{processStaticDirectives:()=>gq,processPartialHydrationDirectives:()=>bq,onHydrated:()=>fq,isHydrated:()=>xq,hydrateIsland:()=>Cq,hydrateByStrategy:()=>Pq,hydrateAll:()=>vq,generatePartialHydrationCSS:()=>Sq,generateIslandManifest:()=>hq,default:()=>GL,createIslandRegistry:()=>yq});function yq(){let X=new Map;return{islands:X,register($){X.set($.id,$)},get($){return X.get($)},async hydrate($){let Z=X.get($);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:$,component:Z.component}}))},async hydrateAll(){let $=Array.from(X.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all($)}}}function tO(X){return`
15777
+ </script>`}function hq(X){let $=X.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if($)return $[1];let Z=X.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function uq(X,$){let Z={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(Q in $)Z[G]=$[Q];else Z[G]=Q}return Z}var aq={};n(aq,{processStaticDirectives:()=>oq,processPartialHydrationDirectives:()=>mq,onHydrated:()=>rq,isHydrated:()=>nq,hydrateIsland:()=>cq,hydrateByStrategy:()=>pq,hydrateAll:()=>iq,generatePartialHydrationCSS:()=>lq,generateIslandManifest:()=>sq,default:()=>HL,createIslandRegistry:()=>dq});function dq(){let X=new Map;return{islands:X,register($){X.set($.id,$)},get($){return X.get($)},async hydrate($){let Z=X.get($);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:$,component:Z.component}}))},async hydrateAll(){let $=Array.from(X.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all($)}}}function UL(X){return`
15704
15778
  <script data-hydrate="${X}">
15705
15779
  (function() {
15706
15780
  const island = document.querySelector('[data-island="${X}"]');
@@ -15711,7 +15785,7 @@ else {
15711
15785
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
15712
15786
  })();
15713
15787
  </script>
15714
- `}function eO(X,$){let Z=$.timeout||2000,Y=$.priority||"low";return`
15788
+ `}function WL(X,$){let Z=$.timeout||2000,Y=$.priority||"low";return`
15715
15789
  <script data-hydrate="${X}">
15716
15790
  (function() {
15717
15791
  const island = document.querySelector('[data-island="${X}"]');
@@ -15747,7 +15821,7 @@ else {
15747
15821
  }
15748
15822
  })();
15749
15823
  </script>
15750
- `}function XL(X,$){let Z=$.rootMargin||"0px",Y=$.threshold||0;return`
15824
+ `}function wL(X,$){let Z=$.rootMargin||"0px",Y=$.threshold||0;return`
15751
15825
  <script data-hydrate="${X}">
15752
15826
  (function() {
15753
15827
  const island = document.querySelector('[data-island="${X}"]');
@@ -15780,7 +15854,7 @@ else {
15780
15854
  }
15781
15855
  })();
15782
15856
  </script>
15783
- `}function $L(X,$){let Z=$.media||"(min-width: 768px)";return`
15857
+ `}function zL(X,$){let Z=$.media||"(min-width: 768px)";return`
15784
15858
  <script data-hydrate="${X}">
15785
15859
  (function() {
15786
15860
  const island = document.querySelector('[data-island="${X}"]');
@@ -15809,7 +15883,7 @@ else {
15809
15883
  }
15810
15884
  })();
15811
15885
  </script>
15812
- `}function ZL(X){return`
15886
+ `}function jL(X){return`
15813
15887
  <script data-hydrate="${X}">
15814
15888
  (function() {
15815
15889
  const island = document.querySelector('[data-island="${X}"]');
@@ -15831,7 +15905,7 @@ else {
15831
15905
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
15832
15906
  })();
15833
15907
  </script>
15834
- `}function YL(X,$){let Z=$.event||"stx:activate";return`
15908
+ `}function BL(X,$){let Z=$.event||"stx:activate";return`
15835
15909
  <script data-hydrate="${X}">
15836
15910
  (function() {
15837
15911
  const island = document.querySelector('[data-island="${X}"]');
@@ -15852,9 +15926,9 @@ else {
15852
15926
  });
15853
15927
  })();
15854
15928
  </script>
15855
- `}function bq(X,$={},Z){let Y=X,J=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test(X);if(Y=c5(Y,"load",$),Y=c5(Y,"idle",$),Y=c5(Y,"visible",$),Y=c5(Y,"media",$),Y=JL(Y),Y=c5(Y,"hover",$),Y=c5(Y,"event",$),J=G&&Y!==X,J)Y+=`
15856
- `+Iq();return Y}function c5(X,$,Z){let Y=new RegExp(`@client:${$}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return X.replace(Y,(J,G,Q)=>{let q={strategy:$};if(G)try{let _=G.split(",").map((H)=>H.trim());for(let H of _){let[L,O]=H.split(":").map((F)=>F.trim());if(L&&O){let F=O.replace(/^['"]|['"]$/g,"");q[L]=F}}}catch{}let K=`island-${Math.random().toString(36).substring(2,9)}`,U=Eq(Q.trim()),W=Dq(Q.trim(),Z),w=[];if(q.rootMargin)w.push(`data-root-margin="${q.rootMargin}"`);if(q.threshold!==void 0)w.push(`data-threshold="${q.threshold}"`);if(q.media)w.push(`data-media="${q.media}"`);if(q.event)w.push(`data-event="${q.event}"`);if(U)w.push(`data-component="${U}"`);let B=Object.keys(W).length>0?`
15857
- <script type="application/json" data-island-props="${K}">${JSON.stringify(W)}</script>`:"",j="";switch($){case"load":j=tO(K);break;case"idle":j=eO(K,q);break;case"visible":j=XL(K,q);break;case"media":j=$L(K,q);break;case"hover":j=ZL(K);break;case"event":j=YL(K,q);break}return`
15929
+ `}function mq(X,$={},Z){let Y=X,J=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test(X);if(Y=p5(Y,"load",$),Y=p5(Y,"idle",$),Y=p5(Y,"visible",$),Y=p5(Y,"media",$),Y=_L(Y),Y=p5(Y,"hover",$),Y=p5(Y,"event",$),J=G&&Y!==X,J)Y+=`
15930
+ `+gq();return Y}function p5(X,$,Z){let Y=new RegExp(`@client:${$}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return X.replace(Y,(J,G,Q)=>{let q={strategy:$};if(G)try{let _=G.split(",").map((H)=>H.trim());for(let H of _){let[L,O]=H.split(":").map((F)=>F.trim());if(L&&O){let F=O.replace(/^['"]|['"]$/g,"");q[L]=F}}}catch{}let K=`island-${Math.random().toString(36).substring(2,9)}`,U=hq(Q.trim()),W=uq(Q.trim(),Z),w=[];if(q.rootMargin)w.push(`data-root-margin="${q.rootMargin}"`);if(q.threshold!==void 0)w.push(`data-threshold="${q.threshold}"`);if(q.media)w.push(`data-media="${q.media}"`);if(q.event)w.push(`data-event="${q.event}"`);if(U)w.push(`data-component="${U}"`);let B=Object.keys(W).length>0?`
15931
+ <script type="application/json" data-island-props="${K}">${JSON.stringify(W)}</script>`:"",j="";switch($){case"load":j=UL(K);break;case"idle":j=WL(K,q);break;case"visible":j=wL(K,q);break;case"media":j=zL(K,q);break;case"hover":j=jL(K);break;case"event":j=BL(K,q);break}return`
15858
15932
  <div data-island="${K}"
15859
15933
  data-strategy="${$}"
15860
15934
  ${w.join(`
@@ -15864,7 +15938,7 @@ else {
15864
15938
  ${Q.trim()}${B}
15865
15939
  </div>
15866
15940
  ${j}
15867
- `})}function JL(X){let $=/@client:only\s*([\s\S]*?)@endclient/gi;return X.replace($,(Z,Y)=>{let J=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
15941
+ `})}function _L(X){let $=/@client:only\s*([\s\S]*?)@endclient/gi;return X.replace($,(Z,Y)=>{let J=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
15868
15942
  <div data-island="${J}"
15869
15943
  data-strategy="only"
15870
15944
  class="stx-island stx-client-only">
@@ -15883,7 +15957,7 @@ else {
15883
15957
  }
15884
15958
  })();
15885
15959
  </script>
15886
- `})}function Sq(){return`
15960
+ `})}function lq(){return`
15887
15961
  /* Island base styles */
15888
15962
  .stx-island {
15889
15963
  display: contents;
@@ -15924,11 +15998,11 @@ else {
15924
15998
  .stx-island.hydrated {
15925
15999
  opacity: 1;
15926
16000
  }
15927
- `}function Cq(X){if(typeof window>"u")return;let $=document.querySelector(`[data-island="${X}"]`);if(!$||$.classList.contains("hydrated"))return;$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function Pq(X){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${X}"]:not(.hydrated)`).forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function vq(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach(($)=>{$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function xq(X){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${X}"]`)?.classList.contains("hydrated")??!1}function fq(X){return new Promise(($)=>{if(typeof window>"u"){$();return}let Z=document.querySelector(`[data-island="${X}"]`);if(!Z){$();return}if(Z.classList.contains("hydrated")){$();return}Z.addEventListener("stx:hydrated",()=>$(),{once:!0})})}function gq(X){return X.replace(/@static\s*([\s\S]*?)@endstatic/gi,($,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function hq(X){let $=X.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
16001
+ `}function cq(X){if(typeof window>"u")return;let $=document.querySelector(`[data-island="${X}"]`);if(!$||$.classList.contains("hydrated"))return;$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function pq(X){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${X}"]:not(.hydrated)`).forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function iq(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach(($)=>{$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function nq(X){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${X}"]`)?.classList.contains("hydrated")??!1}function rq(X){return new Promise(($)=>{if(typeof window>"u"){$();return}let Z=document.querySelector(`[data-island="${X}"]`);if(!Z){$();return}if(Z.classList.contains("hydrated")){$();return}Z.addEventListener("stx:hydrated",()=>$(),{once:!0})})}function oq(X){return X.replace(/@static\s*([\s\S]*?)@endstatic/gi,($,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function sq(X){let $=X.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
15928
16002
  <script type="application/json" id="stx-island-manifest">
15929
16003
  ${JSON.stringify($)}
15930
16004
  </script>
15931
- `}var GL;var dq=D(()=>{GL={processPartialHydrationDirectives:bq,processStaticDirectives:gq,generatePartialHydrationCSS:Sq,generateIslandManifest:hq,createIslandRegistry:yq,hydrateIsland:Cq,hydrateByStrategy:Pq,hydrateAll:vq,isHydrated:xq,onHydrated:fq}});var tq={};n(tq,{watchMultiple:()=>iq,watchEffect:()=>nq,watch:()=>pq,unref:()=>mq,toRefs:()=>lq,throttledComputed:()=>aq,stxWatchMultiple:()=>iq,stxWatchEffect:()=>nq,stxWatch:()=>pq,stxUnref:()=>mq,stxToRefs:()=>lq,stxThrottledComputed:()=>aq,stxShallowRef:()=>cq,stxRef:()=>p5,stxIsRef:()=>v1,stxDebouncedComputed:()=>sq,stxComputed:()=>n7,shallowRef:()=>cq,ref:()=>p5,processWatchDirectives:()=>oq,processComputedDirectives:()=>rq,isRef:()=>v1,default:()=>QL,debouncedComputed:()=>sq,computed:()=>n7});function p5(X){let $=X,Z=new Set,Y={get value(){if(G1){let J=i7.get(Y);if(!J)J=new Set,i7.set(Y,J);J.add(G1)}return $},set value(J){if(!Object.is($,J)){$=J,Z.forEach((Q)=>Q(J));let G=i7.get(Y);if(G)G.forEach((Q)=>Q())}},subscribe(J){return Z.add(J),()=>Z.delete(J)},peek(){return $}};return Y}function v1(X){return X!==null&&typeof X==="object"&&"value"in X&&"subscribe"in X&&"peek"in X}function mq(X){return v1(X)?X.value:X}function lq(X){let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=p5(X[Z]);return $}function cq(X){return p5(X)}function n7(X){let $=typeof X==="function",Z=$?X:X.get,Y=$?void 0:X.set,J=$?Object.is:X.equals||Object.is,G,Q=!0,q=new Set,K=new Set,U=()=>{if(Q=!0,K.size>0){let z=w.value;K.forEach((B)=>B(z))}};function W(){q.clear();let z=G1;G1=U,G$.push(U);try{return Z()}finally{G$.pop(),G1=z}}let w={get value(){if(G1){let z=i7.get(w);if(!z)z=new Set,i7.set(w,z);z.add(G1)}if(Q){let z=W();if(!J(G,z))G=z;Q=!1}return G},set value(z){if(Y)Y(z);else console.warn("Computed property is readonly")},subscribe(z){return K.add(z),()=>K.delete(z)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return q}};return w}function pq(X,$,Z={}){let{immediate:Y=!1,deep:J=!1,flush:G="pre",once:Q=!1}=Z,q,K=!0,U=!1,W=()=>{if(v1(X))return J?Q5(X.value):X.value;return X()},w=()=>{if(!K||U)return;let j=W();if(q!==void 0&&Object.is(q,j)&&!J)return;let _=()=>{if($(j,q),q=J?Q5(j):j,Q)B()};if(G==="sync")_();else if(G==="post")queueMicrotask(_);else Promise.resolve().then(_)},z=null;if(v1(X))z=X.subscribe(()=>w());else z=n7(X).subscribe(()=>w());if(Y)q=void 0,w();else q=W();let B=()=>{if(K=!1,z)z(),z=null};return B.pause=()=>{U=!0},B.resume=()=>{U=!1},B}function iq(X,$,Z={}){let{immediate:Y=!1,once:J=!1}=Z,G=X.map((w)=>v1(w)?w.value:void 0),Q=!0,q=!1,K=()=>{if(!Q||q)return;let w=X.map((z)=>v1(z)?z.value:void 0);if($(w,G),G=[...w],J)W()},U=X.map((w)=>{if(v1(w))return w.subscribe(()=>K());return()=>{}});if(Y)K();let W=()=>{Q=!1,U.forEach((w)=>w())};return W.pause=()=>{q=!0},W.resume=()=>{q=!1},W}function nq(X,$={}){let{flush:Z="pre"}=$,Y,J=!0,G=!1,Q=()=>{if(!J||G)return;if(Y)Y();let K=G1;G1=Q,G$.push(Q);try{Y=X()}finally{G$.pop(),G1=K}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let q=()=>{if(J=!1,Y)Y()};return q.pause=()=>{G=!0},q.resume=()=>{G=!1},q}function rq(X,$={},Z){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return X.replace(Y,(J,G,Q)=>{try{let K=Function(...Object.keys($),`return ${Q}`)(...Object.values($));return $[G]=K,`<!-- computed: ${G} = ${K} -->`}catch(q){return`<!-- computed error: ${G} - ${q} -->`}})}function oq(X,$={},Z){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return X.replace(Y,(J,G,Q)=>{return`
16005
+ `}var HL;var tq=E(()=>{HL={processPartialHydrationDirectives:mq,processStaticDirectives:oq,generatePartialHydrationCSS:lq,generateIslandManifest:sq,createIslandRegistry:dq,hydrateIsland:cq,hydrateByStrategy:pq,hydrateAll:iq,isHydrated:nq,onHydrated:rq}});var UK={};n(UK,{watchMultiple:()=>YK,watchEffect:()=>JK,watch:()=>ZK,unref:()=>eq,toRefs:()=>XK,throttledComputed:()=>KK,stxWatchMultiple:()=>YK,stxWatchEffect:()=>JK,stxWatch:()=>ZK,stxUnref:()=>eq,stxToRefs:()=>XK,stxThrottledComputed:()=>KK,stxShallowRef:()=>$K,stxRef:()=>i5,stxIsRef:()=>v1,stxDebouncedComputed:()=>qK,stxComputed:()=>r7,shallowRef:()=>$K,ref:()=>i5,processWatchDirectives:()=>QK,processComputedDirectives:()=>GK,isRef:()=>v1,default:()=>OL,debouncedComputed:()=>qK,computed:()=>r7});function i5(X){let $=X,Z=new Set,Y={get value(){if(G1){let J=n7.get(Y);if(!J)J=new Set,n7.set(Y,J);J.add(G1)}return $},set value(J){if(!Object.is($,J)){$=J,Z.forEach((Q)=>Q(J));let G=n7.get(Y);if(G)G.forEach((Q)=>Q())}},subscribe(J){return Z.add(J),()=>Z.delete(J)},peek(){return $}};return Y}function v1(X){return X!==null&&typeof X==="object"&&"value"in X&&"subscribe"in X&&"peek"in X}function eq(X){return v1(X)?X.value:X}function XK(X){let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=i5(X[Z]);return $}function $K(X){return i5(X)}function r7(X){let $=typeof X==="function",Z=$?X:X.get,Y=$?void 0:X.set,J=$?Object.is:X.equals||Object.is,G,Q=!0,q=new Set,K=new Set,U=()=>{if(Q=!0,K.size>0){let z=w.value;K.forEach((B)=>B(z))}};function W(){q.clear();let z=G1;G1=U,G$.push(U);try{return Z()}finally{G$.pop(),G1=z}}let w={get value(){if(G1){let z=n7.get(w);if(!z)z=new Set,n7.set(w,z);z.add(G1)}if(Q){let z=W();if(!J(G,z))G=z;Q=!1}return G},set value(z){if(Y)Y(z);else console.warn("Computed property is readonly")},subscribe(z){return K.add(z),()=>K.delete(z)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return q}};return w}function ZK(X,$,Z={}){let{immediate:Y=!1,deep:J=!1,flush:G="pre",once:Q=!1}=Z,q,K=!0,U=!1,W=()=>{if(v1(X))return J?q5(X.value):X.value;return X()},w=()=>{if(!K||U)return;let j=W();if(q!==void 0&&Object.is(q,j)&&!J)return;let _=()=>{if($(j,q),q=J?q5(j):j,Q)B()};if(G==="sync")_();else if(G==="post")queueMicrotask(_);else Promise.resolve().then(_)},z=null;if(v1(X))z=X.subscribe(()=>w());else z=r7(X).subscribe(()=>w());if(Y)q=void 0,w();else q=W();let B=()=>{if(K=!1,z)z(),z=null};return B.pause=()=>{U=!0},B.resume=()=>{U=!1},B}function YK(X,$,Z={}){let{immediate:Y=!1,once:J=!1}=Z,G=X.map((w)=>v1(w)?w.value:void 0),Q=!0,q=!1,K=()=>{if(!Q||q)return;let w=X.map((z)=>v1(z)?z.value:void 0);if($(w,G),G=[...w],J)W()},U=X.map((w)=>{if(v1(w))return w.subscribe(()=>K());return()=>{}});if(Y)K();let W=()=>{Q=!1,U.forEach((w)=>w())};return W.pause=()=>{q=!0},W.resume=()=>{q=!1},W}function JK(X,$={}){let{flush:Z="pre"}=$,Y,J=!0,G=!1,Q=()=>{if(!J||G)return;if(Y)Y();let K=G1;G1=Q,G$.push(Q);try{Y=X()}finally{G$.pop(),G1=K}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let q=()=>{if(J=!1,Y)Y()};return q.pause=()=>{G=!0},q.resume=()=>{G=!1},q}function GK(X,$={},Z){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return X.replace(Y,(J,G,Q)=>{try{let K=Function(...Object.keys($),`return ${Q}`)(...Object.values($));return $[G]=K,`<!-- computed: ${G} = ${K} -->`}catch(q){return`<!-- computed error: ${G} - ${q} -->`}})}function QK(X,$={},Z){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return X.replace(Y,(J,G,Q)=>{return`
15932
16006
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
15933
16007
  (function() {
15934
16008
  // Watch implementation for ${G}
@@ -15940,9 +16014,9 @@ else {
15940
16014
  }
15941
16015
  })();
15942
16016
  </script>
15943
- `})}function Q5(X){if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Z)=>Q5(Z));if(X instanceof Date)return new Date(X.getTime());if(X instanceof Map){let Z=new Map;return X.forEach((Y,J)=>Z.set(Q5(J),Q5(Y))),Z}if(X instanceof Set){let Z=new Set;return X.forEach((Y)=>Z.add(Q5(Y))),Z}let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=Q5(X[Z]);return $}function sq(X,$=100){let Z=p5(X()),Y=null,J=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{Z.value=X()},$)};return n7(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function aq(X,$=100){let Z=p5(X()),Y=0,J=()=>{let Q=Date.now();if(Q-Y>=$)Y=Q,Z.value=X()};return n7(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var G1=null,G$,i7,QL;var eq=D(()=>{G$=[],i7=new WeakMap;QL={ref:p5,computed:n7,watch:pq,watchMultiple:iq,watchEffect:nq,isRef:v1,unref:mq,toRefs:lq,shallowRef:cq,debouncedComputed:sq,throttledComputed:aq,processComputedDirectives:rq,processWatchDirectives:oq}});function r7(X,$){let Z={};for(let Y of X)Z[Y]=E1($(Y));return new Proxy({},{get:(Y,J)=>Z[J]?.(),set:(Y,J,G)=>{if(Z[J])Z[J].set(G);else Z[J]=E1(G);return!0},has:(Y,J)=>(J in Z),deleteProperty:(Y,J)=>{return delete Z[J],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(Y,J)=>(J in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[J]()}:void 0})}function qL(X,$){let Z={};for(let Y of $)Z[Y]=X[Y];return Z}function v4(X,$){let Z=Object.keys(X),Y=r7(Z,(O)=>$?.[O]??X[O].getDefaultValue()),J=r7(Z,()=>[]),G=r7(Z,()=>!1),Q=r7(Z,()=>!1),q=r7(Z,()=>!1),K=E1(!1);async function U(O){q[O]=!0;let F=await X[O].validate(Y[O],Y);return J[O]=F,q[O]=!1,F.length===0}async function W(){K.set(!0);let O=await Promise.all(Z.map(U));return K.set(!1),O.every(Boolean)}function w(){for(let O of Z)Y[O]=$?.[O]??X[O].getDefaultValue(),J[O]=[],G[O]=!1,Q[O]=!1}function z(O){for(let F of Z)if(F in O)Y[F]=O[F],Q[F]=!0}function B(O,F){Y[O]=F,Q[O]=!0}function j(O,F=!0){if(G[O]=F,F)U(O)}function _(O){return{value:Y[O],errors:J[O],touched:G[O],dirty:Q[O],valid:J[O].length===0,validating:q[O]}}function H(O){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await W())await O(qL(Y,Z))}}return{values:Y,errors:J,touched:G,dirty:Q,get isValid(){return Z.every((O)=>J[O].length===0)},get isValidating(){return K()||Z.some((O)=>q[O])},get isDirty(){return Z.some((O)=>Q[O])},validate:W,validateField:U,reset:w,setValues:z,setFieldValue:B,setFieldTouched:j,getFieldState:_,handleSubmit:H}}var XK;var $K=D(()=>{gX();XK=v4});var GK={};n(GK,{v:()=>KL,useForm:()=>v4,processHasErrorsDirective:()=>JK,processFormValidationDirectives:()=>UL,processErrorsDirective:()=>YK,processErrorDirective:()=>ZK,defineForm:()=>XK,Validator:()=>i5});class i5{rules=[];defaultValue="";addRule(X){let $=new i5;return $.rules=[...this.rules,X],$.defaultValue=this.defaultValue,$}required(X="This field is required"){return this.addRule({name:"required",message:X,validate:($)=>{if($===null||$===void 0)return X;if(typeof $==="string"&&$.trim()==="")return X;if(Array.isArray($)&&$.length===0)return X;return!0}})}email(X="Please enter a valid email"){return this.addRule({name:"email",message:X,validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||X}})}url(X="Please enter a valid URL"){return this.addRule({name:"url",message:X,validate:($)=>{if(!$)return!0;try{return new URL(String($)),!0}catch{return X}}})}min(X,$){let Z=$||`Must be at least ${X} characters`;return this.addRule({name:"min",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=X||Z}})}max(X,$){let Z=$||`Must be no more than ${X} characters`;return this.addRule({name:"max",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=X||Z}})}length(X,$,Z){let Y=Z||`Must be between ${X} and ${$} characters`;return this.addRule({name:"length",message:Y,validate:(J)=>{if(!J)return!0;let G=String(J).length;return G>=X&&G<=$||Y}})}pattern(X,$="Invalid format"){return this.addRule({name:"pattern",message:$,validate:(Z)=>{if(!Z)return!0;return X.test(String(Z))||$}})}hasUppercase(X="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,X)}hasLowercase(X="Must contain a lowercase letter"){return this.pattern(/[a-z]/,X)}hasNumber(X="Must contain a number"){return this.pattern(/\d/,X)}hasSpecial(X="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,X)}alphanumeric(X="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,X)}startsWithLetter(X="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,X)}noSpaces(X="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:X,validate:($)=>{if(!$)return!0;return!String($).includes(" ")||X}})}number(X="Must be a number"){let $=this.addRule({name:"number",message:X,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||X}});return $.defaultValue=0,$}integer(X="Must be a whole number"){return this.addRule({name:"integer",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number.isInteger(Number($))||X}})}positive(X="Must be a positive number"){return this.addRule({name:"positive",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)>0||X}})}negative(X="Must be a negative number"){return this.addRule({name:"negative",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)<0||X}})}minValue(X,$){let Z=$||`Must be at least ${X}`;return this.addRule({name:"minValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=X||Z}})}maxValue(X,$){let Z=$||`Must be no more than ${X}`;return this.addRule({name:"maxValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=X||Z}})}between(X,$,Z){let Y=Z||`Must be between ${X} and ${$}`;return this.addRule({name:"between",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;let G=Number(J);return G>=X&&G<=$||Y}})}matches(X,$){let Z=$||`Must match ${X}`;return this.addRule({name:"matches",message:Z,validate:(Y,J)=>{if(!J)return!0;return Y===J[X]||Z}})}oneOf(X,$){let Z=$||`Must be one of: ${X.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return X.includes(Y)||Z}})}notOneOf(X,$){let Z=$||`Cannot be one of: ${X.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return!X.includes(Y)||Z}})}date(X="Must be a valid date"){return this.addRule({name:"date",message:X,validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||X}})}before(X,$){let Z=new Date(X),Y=$||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Z||Y}})}after(X,$){let Z=new Date(X),Y=$||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Z||Y}})}custom(X,$="Invalid value"){return this.addRule({name:"custom",message:$,validate:X})}async(X,$="Invalid value"){return this.addRule({name:"async",message:$,async:!0,validate:X})}when(X,$){let Z=new i5;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let Y of $.getRules())Z.rules.push({...Y,validate:(J,G)=>{if(!X(J,G||{}))return!0;return Y.validate(J,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(X){let $=new i5;return $.rules=[...this.rules],$.defaultValue=X,$}async validate(X,$){let Z=[];for(let Y of this.rules){let J=await Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}validateSync(X,$){let Z=[];for(let Y of this.rules){if(Y.async)continue;let J=Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}}function ZK(X,$,Z){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return X.replace(Y,(J,G,Q)=>{try{let q=G.trim().split("."),K=$;for(let W of q)if(K&&typeof K==="object"&&W in K)K=K[W];else return"";let U=K;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((W)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,W)}).join(`
15944
- `)}catch{return""}})}function YK(X,$,Z){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return X.replace(Y,(J,G,Q)=>{try{let q=G.trim().split("."),K=$;for(let W of q)if(K&&typeof K==="object"&&W in K)K=K[W];else return"";let U=K;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((W)=>Q.replace(/\{\{\s*message\s*\}\}/g,W)).join(`
15945
- `)}catch{return""}})}function JK(X,$,Z){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return X.replace(Y,(J,G,Q)=>{try{let q=G.trim().split("."),K=$;for(let W of q)if(K&&typeof K==="object"&&W in K)K=K[W];else return"";let U=K;if(!U||!Array.isArray(U)||U.length===0)return"";return Q}catch{return""}})}function UL(X,$,Z){let Y=X;return Y=ZK(Y,$,Z),Y=YK(Y,$,Z),Y=JK(Y,$,Z),Y}var KL;var QK=D(()=>{$K();KL=new i5});var UK={};n(UK,{processXElementDirectives:()=>WL,hasXElementDirectives:()=>KK,generateXElementRuntime:()=>qK});function qK(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
16017
+ `})}function q5(X){if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Z)=>q5(Z));if(X instanceof Date)return new Date(X.getTime());if(X instanceof Map){let Z=new Map;return X.forEach((Y,J)=>Z.set(q5(J),q5(Y))),Z}if(X instanceof Set){let Z=new Set;return X.forEach((Y)=>Z.add(q5(Y))),Z}let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=q5(X[Z]);return $}function qK(X,$=100){let Z=i5(X()),Y=null,J=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{Z.value=X()},$)};return r7(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function KK(X,$=100){let Z=i5(X()),Y=0,J=()=>{let Q=Date.now();if(Q-Y>=$)Y=Q,Z.value=X()};return r7(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var G1=null,G$,n7,OL;var WK=E(()=>{G$=[],n7=new WeakMap;OL={ref:i5,computed:r7,watch:ZK,watchMultiple:YK,watchEffect:JK,isRef:v1,unref:eq,toRefs:XK,shallowRef:$K,debouncedComputed:qK,throttledComputed:KK,processComputedDirectives:GK,processWatchDirectives:QK}});function o7(X,$){let Z={};for(let Y of X)Z[Y]=E1($(Y));return new Proxy({},{get:(Y,J)=>Z[J]?.(),set:(Y,J,G)=>{if(Z[J])Z[J].set(G);else Z[J]=E1(G);return!0},has:(Y,J)=>(J in Z),deleteProperty:(Y,J)=>{return delete Z[J],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(Y,J)=>(J in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[J]()}:void 0})}function LL(X,$){let Z={};for(let Y of $)Z[Y]=X[Y];return Z}function m4(X,$){let Z=Object.keys(X),Y=o7(Z,(O)=>$?.[O]??X[O].getDefaultValue()),J=o7(Z,()=>[]),G=o7(Z,()=>!1),Q=o7(Z,()=>!1),q=o7(Z,()=>!1),K=E1(!1);async function U(O){q[O]=!0;let F=await X[O].validate(Y[O],Y);return J[O]=F,q[O]=!1,F.length===0}async function W(){K.set(!0);let O=await Promise.all(Z.map(U));return K.set(!1),O.every(Boolean)}function w(){for(let O of Z)Y[O]=$?.[O]??X[O].getDefaultValue(),J[O]=[],G[O]=!1,Q[O]=!1}function z(O){for(let F of Z)if(F in O)Y[F]=O[F],Q[F]=!0}function B(O,F){Y[O]=F,Q[O]=!0}function j(O,F=!0){if(G[O]=F,F)U(O)}function _(O){return{value:Y[O],errors:J[O],touched:G[O],dirty:Q[O],valid:J[O].length===0,validating:q[O]}}function H(O){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await W())await O(LL(Y,Z))}}return{values:Y,errors:J,touched:G,dirty:Q,get isValid(){return Z.every((O)=>J[O].length===0)},get isValidating(){return K()||Z.some((O)=>q[O])},get isDirty(){return Z.some((O)=>Q[O])},validate:W,validateField:U,reset:w,setValues:z,setFieldValue:B,setFieldTouched:j,getFieldState:_,handleSubmit:H}}var wK;var zK=E(()=>{gX();wK=m4});var HK={};n(HK,{v:()=>FL,useForm:()=>m4,processHasErrorsDirective:()=>_K,processFormValidationDirectives:()=>VL,processErrorsDirective:()=>BK,processErrorDirective:()=>jK,defineForm:()=>wK,Validator:()=>n5});class n5{rules=[];defaultValue="";addRule(X){let $=new n5;return $.rules=[...this.rules,X],$.defaultValue=this.defaultValue,$}required(X="This field is required"){return this.addRule({name:"required",message:X,validate:($)=>{if($===null||$===void 0)return X;if(typeof $==="string"&&$.trim()==="")return X;if(Array.isArray($)&&$.length===0)return X;return!0}})}email(X="Please enter a valid email"){return this.addRule({name:"email",message:X,validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||X}})}url(X="Please enter a valid URL"){return this.addRule({name:"url",message:X,validate:($)=>{if(!$)return!0;try{return new URL(String($)),!0}catch{return X}}})}min(X,$){let Z=$||`Must be at least ${X} characters`;return this.addRule({name:"min",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=X||Z}})}max(X,$){let Z=$||`Must be no more than ${X} characters`;return this.addRule({name:"max",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=X||Z}})}length(X,$,Z){let Y=Z||`Must be between ${X} and ${$} characters`;return this.addRule({name:"length",message:Y,validate:(J)=>{if(!J)return!0;let G=String(J).length;return G>=X&&G<=$||Y}})}pattern(X,$="Invalid format"){return this.addRule({name:"pattern",message:$,validate:(Z)=>{if(!Z)return!0;return X.test(String(Z))||$}})}hasUppercase(X="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,X)}hasLowercase(X="Must contain a lowercase letter"){return this.pattern(/[a-z]/,X)}hasNumber(X="Must contain a number"){return this.pattern(/\d/,X)}hasSpecial(X="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,X)}alphanumeric(X="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,X)}startsWithLetter(X="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,X)}noSpaces(X="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:X,validate:($)=>{if(!$)return!0;return!String($).includes(" ")||X}})}number(X="Must be a number"){let $=this.addRule({name:"number",message:X,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||X}});return $.defaultValue=0,$}integer(X="Must be a whole number"){return this.addRule({name:"integer",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number.isInteger(Number($))||X}})}positive(X="Must be a positive number"){return this.addRule({name:"positive",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)>0||X}})}negative(X="Must be a negative number"){return this.addRule({name:"negative",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)<0||X}})}minValue(X,$){let Z=$||`Must be at least ${X}`;return this.addRule({name:"minValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=X||Z}})}maxValue(X,$){let Z=$||`Must be no more than ${X}`;return this.addRule({name:"maxValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=X||Z}})}between(X,$,Z){let Y=Z||`Must be between ${X} and ${$}`;return this.addRule({name:"between",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;let G=Number(J);return G>=X&&G<=$||Y}})}matches(X,$){let Z=$||`Must match ${X}`;return this.addRule({name:"matches",message:Z,validate:(Y,J)=>{if(!J)return!0;return Y===J[X]||Z}})}oneOf(X,$){let Z=$||`Must be one of: ${X.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return X.includes(Y)||Z}})}notOneOf(X,$){let Z=$||`Cannot be one of: ${X.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return!X.includes(Y)||Z}})}date(X="Must be a valid date"){return this.addRule({name:"date",message:X,validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||X}})}before(X,$){let Z=new Date(X),Y=$||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Z||Y}})}after(X,$){let Z=new Date(X),Y=$||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Z||Y}})}custom(X,$="Invalid value"){return this.addRule({name:"custom",message:$,validate:X})}async(X,$="Invalid value"){return this.addRule({name:"async",message:$,async:!0,validate:X})}when(X,$){let Z=new n5;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let Y of $.getRules())Z.rules.push({...Y,validate:(J,G)=>{if(!X(J,G||{}))return!0;return Y.validate(J,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(X){let $=new n5;return $.rules=[...this.rules],$.defaultValue=X,$}async validate(X,$){let Z=[];for(let Y of this.rules){let J=await Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}validateSync(X,$){let Z=[];for(let Y of this.rules){if(Y.async)continue;let J=Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}}function jK(X,$,Z){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return X.replace(Y,(J,G,Q)=>{try{let q=G.trim().split("."),K=$;for(let W of q)if(K&&typeof K==="object"&&W in K)K=K[W];else return"";let U=K;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((W)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,W)}).join(`
16018
+ `)}catch{return""}})}function BK(X,$,Z){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return X.replace(Y,(J,G,Q)=>{try{let q=G.trim().split("."),K=$;for(let W of q)if(K&&typeof K==="object"&&W in K)K=K[W];else return"";let U=K;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((W)=>Q.replace(/\{\{\s*message\s*\}\}/g,W)).join(`
16019
+ `)}catch{return""}})}function _K(X,$,Z){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return X.replace(Y,(J,G,Q)=>{try{let q=G.trim().split("."),K=$;for(let W of q)if(K&&typeof K==="object"&&W in K)K=K[W];else return"";let U=K;if(!U||!Array.isArray(U)||U.length===0)return"";return Q}catch{return""}})}function VL(X,$,Z){let Y=X;return Y=jK(Y,$,Z),Y=BK(Y,$,Z),Y=_K(Y,$,Z),Y}var FL;var OK=E(()=>{zK();FL=new n5});var VK={};n(VK,{processXElementDirectives:()=>AL,hasXElementDirectives:()=>FK,generateXElementRuntime:()=>LK});function LK(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
15946
16020
  (function() {
15947
16021
  'use strict';
15948
16022
 
@@ -16226,43 +16300,43 @@ else {
16226
16300
  // Expose for manual initialization
16227
16301
  window.XElement = XElement;
16228
16302
  })();
16229
- </script>`}function KK(X){return/\bx-data(?:\s|=)/.test(X)}function WL(X){let $=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=X.match($)||[],Y=Z.length>0?X.replace($,""):X;if(!KK(Y))return Y;let J=Z[0]?.trim()||qK(),G=Y.lastIndexOf("</body>");if(G!==-1)return Y.slice(0,G)+J+`
16303
+ </script>`}function FK(X){return/\bx-data(?:\s|=)/.test(X)}function AL(X){let $=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=X.match($)||[],Y=Z.length>0?X.replace($,""):X;if(!FK(Y))return Y;let J=Z[0]?.trim()||LK(),G=Y.lastIndexOf("</body>");if(G!==-1)return Y.slice(0,G)+J+`
16230
16304
  `+Y.slice(G);return Y+`
16231
- `+J}var WK={};n(WK,{rewriteImagesWithSiblings:()=>jL});import B1 from"path";async function jL(X,$){let Z=$.formats??zL;if(!$.publicDir)return X;let Y=HL(X),J=[],G=/<img\b[^>]*?>/gi,Q=[],q;while((q=G.exec(X))!==null){let w=q[0],z=w.match(/\bsrc=["']([^"']+)["']/i);if(!z)continue;if(OL(q.index,Y))continue;Q.push({idx:q.index,length:w.length,src:z[1],raw:w})}if(Q.length===0)return X;let K=await Promise.all(Q.map(async(w)=>{let z=await BL(w.src,$.publicDir,Z);return{match:w,sources:z}}));for(let{match:w,sources:z}of K){if(z.length===0)continue;let j=`<picture>${z.map((_)=>`<source type="${_.mime}" srcset="${LL(_.url)}">`).join("")}${w.raw}</picture>`;J.push({start:w.idx,end:w.idx+w.length,replacement:j})}if(J.length===0)return X;let U="",W=0;for(let w of J)U+=X.slice(W,w.start),U+=w.replacement,W=w.end;return U+=X.slice(W),U}async function BL(X,$,Z){if(!_L(X))return[];let Y=B1.extname(X).toLowerCase();if(!wL.has(Y))return[];if(!X.startsWith("/"))return[];let J=B1.join($,X.slice(1)),G=B1.dirname(J),Q=B1.basename(J,Y),q=B1.resolve(G),K=B1.resolve($);if(!q.startsWith(K))return[];let U=B1.posix.dirname(X),W=Z.map(async(z)=>{let B=B1.join(G,`${Q}${z.ext}`);if(!await Bun.file(B).exists())return null;return{url:B1.posix.join(U,`${Q}${z.ext}`),mime:z.mime}});return(await Promise.all(W)).filter((z)=>z!==null)}function _L(X){if(!X)return!1;if(X.startsWith("http://")||X.startsWith("https://"))return!1;if(X.startsWith("//"))return!1;if(X.startsWith("data:"))return!1;return!0}function HL(X){let $=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);return $}function OL(X,$){for(let[Z,Y]of $)if(X>=Z&&X<Y)return!0;return!1}function LL(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var wL,zL;var wK=D(()=>{wL=new Set([".jpg",".jpeg",".png",".gif"]),zL=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var _K={};n(_K,{validateClientScript:()=>X$,processOnceDirective:()=>e8,processJsonDirective:()=>t8,processDirectives:()=>R0,injectRouterScript:()=>gZ});import FL from"fs";import E0 from"path";function zK(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function VL(X,$){let Z=X.length,Y=$,J=!0,G=[],Q=(q)=>q+9<=Z&&X[q]==="<"&&X[q+1]==="/"&&(X[q+2]==="s"||X[q+2]==="S")&&(X[q+3]==="c"||X[q+3]==="C")&&(X[q+4]==="r"||X[q+4]==="R")&&(X[q+5]==="i"||X[q+5]==="I")&&(X[q+6]==="p"||X[q+6]==="P")&&(X[q+7]==="t"||X[q+7]==="T")&&(X[q+8]===">"||/\s/.test(X[q+8]));while(Y<Z){let q=X[Y];if(Q(Y))return Y;if(q==="/"&&X[Y+1]==="/"){if(Y=X.indexOf(`
16305
+ `+J}var AK={};n(AK,{rewriteImagesWithSiblings:()=>TL});import B1 from"path";async function TL(X,$){let Z=$.formats??NL;if(!$.publicDir)return X;let Y=IL(X),J=[],G=/<img\b[^>]*?>/gi,Q=[],q;while((q=G.exec(X))!==null){let w=q[0],z=w.match(/\bsrc=["']([^"']+)["']/i);if(!z)continue;if(EL(q.index,Y))continue;Q.push({idx:q.index,length:w.length,src:z[1],raw:w})}if(Q.length===0)return X;let K=await Promise.all(Q.map(async(w)=>{let z=await ML(w.src,$.publicDir,Z);return{match:w,sources:z}}));for(let{match:w,sources:z}of K){if(z.length===0)continue;let j=`<picture>${z.map((_)=>`<source type="${_.mime}" srcset="${DL(_.url)}">`).join("")}${w.raw}</picture>`;J.push({start:w.idx,end:w.idx+w.length,replacement:j})}if(J.length===0)return X;let U="",W=0;for(let w of J)U+=X.slice(W,w.start),U+=w.replacement,W=w.end;return U+=X.slice(W),U}async function ML(X,$,Z){if(!kL(X))return[];let Y=B1.extname(X).toLowerCase();if(!RL.has(Y))return[];if(!X.startsWith("/"))return[];let J=B1.join($,X.slice(1)),G=B1.dirname(J),Q=B1.basename(J,Y),q=B1.resolve(G),K=B1.resolve($);if(!q.startsWith(K))return[];let U=B1.posix.dirname(X),W=Z.map(async(z)=>{let B=B1.join(G,`${Q}${z.ext}`);if(!await Bun.file(B).exists())return null;return{url:B1.posix.join(U,`${Q}${z.ext}`),mime:z.mime}});return(await Promise.all(W)).filter((z)=>z!==null)}function kL(X){if(!X)return!1;if(X.startsWith("http://")||X.startsWith("https://"))return!1;if(X.startsWith("//"))return!1;if(X.startsWith("data:"))return!1;return!0}function IL(X){let $=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);return $}function EL(X,$){for(let[Z,Y]of $)if(X>=Z&&X<Y)return!0;return!1}function DL(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var RL,NL;var RK=E(()=>{RL=new Set([".jpg",".jpeg",".png",".gif"]),NL=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var kK={};n(kK,{validateClientScript:()=>X$,processOnceDirective:()=>e8,processJsonDirective:()=>t8,processDirectives:()=>R0,injectRouterScript:()=>oZ});import yL from"fs";import E0 from"path";function NK(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bL(X,$){let Z=X.length,Y=$,J=!0,G=[],Q=(q)=>q+9<=Z&&X[q]==="<"&&X[q+1]==="/"&&(X[q+2]==="s"||X[q+2]==="S")&&(X[q+3]==="c"||X[q+3]==="C")&&(X[q+4]==="r"||X[q+4]==="R")&&(X[q+5]==="i"||X[q+5]==="I")&&(X[q+6]==="p"||X[q+6]==="P")&&(X[q+7]==="t"||X[q+7]==="T")&&(X[q+8]===">"||/\s/.test(X[q+8]));while(Y<Z){let q=X[Y];if(Q(Y))return Y;if(q==="/"&&X[Y+1]==="/"){if(Y=X.indexOf(`
16232
16306
  `,Y+2),Y===-1)return-1;Y+=1,J=!0;continue}if(q==="/"&&X[Y+1]==="*"){let K=X.indexOf("*/",Y+2);if(K===-1)return-1;Y=K+2,J=!0;continue}if(q==="/"&&J){let K=Y+1,U=!1;while(K<Z){let W=X[K];if(W==="\\"){K+=2;continue}if(W==="[")U=!0;else if(W==="]")U=!1;else if(W==="/"&&!U){K++;break}else if(W===`
16233
16307
  `){K=-1;break}K++}if(K===-1){Y++,J=!1;continue}while(K<Z&&/[a-z]/.test(X[K]))K++;Y=K,J=!1;continue}if(q==="'"||q==='"'){let K=q;Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===K){Y++;break}if(X[Y]===`
16234
- `)break;Y++}J=!1;continue}if(q==="`"){Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}if(G.length===0)J=!1;continue}if(q==="}"&&G.length>0){G.pop(),Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++,J=!1;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}continue}if(/\s/.test(q));else if(/[)\].\w$]/.test(q))J=!1;else J=!0;Y++}return-1}function n5(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec(X);if(!Y)return null;let J=Y.index+Y[0].length,G=X.indexOf("</script>",J);if(G===-1)return null;let Q=X.indexOf(">",G);if(Q===-1)return null;return{start:Y.index,end:Q+1}}function jK(X){let $=0;while($<X.length){let Z=X.indexOf("<",$);if(Z===-1)return-1;if(X.startsWith("<!--",Z)){let G=X.indexOf("-->",Z+4);$=G===-1?X.length:G+3;continue}let Y=X.slice(Z),J=/^<style\b[^>]*>/i.exec(Y);if(J){let G=X.toLowerCase().indexOf("</style>",Z+J[0].length);$=G===-1?X.length:G+8;continue}if(/^<script\b[^>]*>/i.test(Y))return Z;$=Z+1}return-1}function AL(X){let $=n5(X,"data-stx-runtime");if(!$)return X;let Z=jK(X);if(Z===-1||Z===$.start)return X;let Y=X.slice($.start,$.end),J=X.slice(0,$.start)+X.slice($.end),G=jK(J);if(G===-1)return Y+`
16308
+ `)break;Y++}J=!1;continue}if(q==="`"){Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}if(G.length===0)J=!1;continue}if(q==="}"&&G.length>0){G.pop(),Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++,J=!1;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}continue}if(/\s/.test(q));else if(/[)\].\w$]/.test(q))J=!1;else J=!0;Y++}return-1}function r5(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec(X);if(!Y)return null;let J=Y.index+Y[0].length,G=X.indexOf("</script>",J);if(G===-1)return null;let Q=X.indexOf(">",G);if(Q===-1)return null;return{start:Y.index,end:Q+1}}function TK(X){let $=0;while($<X.length){let Z=X.indexOf("<",$);if(Z===-1)return-1;if(X.startsWith("<!--",Z)){let G=X.indexOf("-->",Z+4);$=G===-1?X.length:G+3;continue}let Y=X.slice(Z),J=/^<style\b[^>]*>/i.exec(Y);if(J){let G=X.toLowerCase().indexOf("</style>",Z+J[0].length);$=G===-1?X.length:G+8;continue}if(/^<script\b[^>]*>/i.test(Y))return Z;$=Z+1}return-1}function SL(X){let $=r5(X,"data-stx-runtime");if(!$)return X;let Z=TK(X);if(Z===-1||Z===$.start)return X;let Y=X.slice($.start,$.end),J=X.slice(0,$.start)+X.slice($.end),G=TK(J);if(G===-1)return Y+`
16235
16309
  `+J;return J.slice(0,G)+Y+`
16236
- `+J.slice(G)}async function R0(X,$,Z,Y,J){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return X;if($.__stx_signals_gate===void 0)$.__stx_signals_gate=W1(X);let G=!$.__stxProcessingDepth;if(G)A6($);if(!$.__stxProcessingDepth)$.__stxProcessingDepth=0;if($.__stxProcessingDepth++,!$.__onceStore)$.__onceStore=new Set;if((Y.debug||!S7()&&!A8())&&Z&&Z.endsWith(".stx"))v3(X,Z);try{return await c6.timeAsync("template-processing",async()=>{let Q=await RL(X,$,Z,Y,J);if(G)Q=k4(Q);if(G&&Y.autoShell&&Y.buildMode!=="compile"){let q=Y.app?.head||{},U=($.__stx_runtime_head||null)??X9(),W=($.__stx_head_raw||"").trim(),w,z=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(z)w=z[1].trim(),W=W.replace(z[0],"").trim();let B=$.__sections?.title,j=U.title||w||B,_=!U.title&&(!!w||!!B),H={...q,...j&&{title:j},meta:[...q.meta||[],...U.meta||[]],link:[...q.link||[],...U.link||[]],script:[...q.script||[],...U.script||[]],headRaw:[q.headRaw,W].filter(Boolean).join(`
16237
- `),...U.htmlAttrs&&{htmlAttrs:vQ(q.htmlAttrs,U.htmlAttrs)},...U.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...U.bodyAttrs}}},L=M4(Q);if(Q=hQ(Q,H,{..._&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),L)Q=gQ(Q,q),Q=xQ(Q,H.htmlAttrs);let O=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(O&&Q.includes("<head")){let A=O[1],R=K7(A);Q=Q.replace(/<head\b[^>]*>/i,(T)=>`${T}
16238
- <meta name="stx-layout" content="${zK(A)}">
16239
- <meta name="stx-layout-group" content="${zK(R)}">`)}let F=Q.match(/function (__stx_setup_\d+_\d+)\(/),V=F?DX(Q):null;if(F&&V&&!/\bdata-stx=/.test(V.tag)){Q=U9(Q,(R,T)=>`<body${T} data-stx="${F[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${F[1]}"`,"i");Q=Q.replace(A,"$1")}}if(G){Q=fQ(Q);let q=Y.app?.colorMode;if(q)Q=yQ(Q,q);Q=SQ(Q),Q=AL(Q)}if(G)try{let{getStoreScript:q}=await t("stx/store-loader",()=>Promise.resolve().then(() => (oQ(),rQ))),K=Y.storesDir,U=await q(K);if(U){let W=`<script data-stx-stores>${U}</script>`,w=n5(Q,"data-stx-runtime");if(w)Q=Q.slice(0,w.end)+`
16240
- `+W+Q.slice(w.end)}}catch{}if(G)try{let{getFrameworkComposableScript:q}=await t("stx/framework-composables",()=>Promise.resolve().then(() => (Xq(),eQ))),K=await q(Q);if(K){let U=n5(Q,"data-stx-stores")||n5(Q,"data-stx-runtime");if(U)Q=Q.slice(0,U.end)+`
16241
- `+K+Q.slice(U.end)}}catch{}if(G)try{let{getComposableScript:q}=await t("stx/composable-loader",()=>Promise.resolve().then(() => (Yq(),Zq))),K=Y.composablesDir,U=await q(K);if(U){let W=`<script data-stx-composables>${U}</script>`,w=n5(Q,"data-stx-stores")||n5(Q,"data-stx-runtime");if(w)Q=Q.slice(0,w.end)+`
16242
- `+W+Q.slice(w.end)}}catch{}if(G)Q=bQ(Q);if(G&&$.__stx_inject_css!==!1)Q=await AJ(Q,void 0,Y.buildMode==="serve");if(G)Q=o6(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof M8)throw Q;let q=Q instanceof Error?Q.message:String(Q),K=new t1(`Template processing failed: ${q}`,Z,void 0,void 0,X.substring(0,200)+(X.length>200?"...":""));if(a0.log(K,{filePath:Z,context:$}),w3.logDetailedError(K,{filePath:Z,template:X.substring(0,500)}),Y.debug)throw K;return U3.createFallbackContent("Template Processing",K)}}async function RL(X,$,Z,Y,J){let G=process.cwd(),Q={...Y,partialsDir:Y.partialsDir&&!E0.isAbsolute(Y.partialsDir)?E0.resolve(G,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!E0.isAbsolute(Y.componentsDir)?E0.resolve(G,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!E0.isAbsolute(Y.layoutsDir)?E0.resolve(G,Y.layoutsDir):Y.layoutsDir},q=Q,K=X;await ML(Z,$),NL($,q),K=await y5(()=>zQ(K,$,Z,q),K,(F)=>{a0.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),K=K.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=$1(K,F7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);K=U.output;let W=U.tokens,w=(F)=>W.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>W[Number(A)]??""),z="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,z),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),K=TQ(K),K=await lQ(K,Z,J);let B={};K=_4(K,B);let j={...$.__sections||{}},_="",H=SJ(bJ(X)),L=/@nolayout\b/.test(K)||H===!1;if(/@nolayout\b/.test(K))K=K.replace(/@nolayout\b\s*/g,"");let O=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(_=H,!/@section\s*\(/.test(K))K=`@section('content')
16310
+ `+J.slice(G)}async function R0(X,$,Z,Y,J){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return X;if($.__stx_signals_gate===void 0)$.__stx_signals_gate=W1(X);let G=!$.__stxProcessingDepth;if(G)I6($);if(!$.__stxProcessingDepth)$.__stxProcessingDepth=0;if($.__stxProcessingDepth++,!$.__onceStore)$.__onceStore=new Set;if((Y.debug||!C7()&&!A8())&&Z&&Z.endsWith(".stx"))m3(X,Z);try{return await s6.timeAsync("template-processing",async()=>{let Q=await CL(X,$,Z,Y,J);if(G)Q=C4(Q);if(G&&Y.autoShell&&Y.buildMode!=="compile"){let q=Y.app?.head||{},U=($.__stx_runtime_head||null)??X9(),W=($.__stx_head_raw||"").trim(),w,z=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(z)w=z[1].trim(),W=W.replace(z[0],"").trim();let B=$.__sections?.title,j=U.title||w||B,_=!U.title&&(!!w||!!B),H={...q,...j&&{title:j},meta:[...q.meta||[],...U.meta||[]],link:[...q.link||[],...U.link||[]],script:[...q.script||[],...U.script||[]],headRaw:[q.headRaw,W].filter(Boolean).join(`
16311
+ `),...U.htmlAttrs&&{htmlAttrs:iQ(q.htmlAttrs,U.htmlAttrs)},...U.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...U.bodyAttrs}}},L=S4(Q);if(Q=sQ(Q,H,{..._&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),L)Q=oQ(Q,q),Q=nQ(Q,H.htmlAttrs);let O=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(O&&Q.includes("<head")){let A=O[1],R=U7(A);Q=Q.replace(/<head\b[^>]*>/i,(N)=>`${N}
16312
+ <meta name="stx-layout" content="${NK(A)}">
16313
+ <meta name="stx-layout-group" content="${NK(R)}">`)}let F=Q.match(/function (__stx_setup_\d+_\d+)\(/),V=F?E7(Q):null;if(F&&V&&!/\bdata-stx=/.test(V.tag)){Q=yX(Q,(R,N)=>`<body${N} data-stx="${F[1]}">`);let A=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${F[1]}"`,"i");Q=Q.replace(A,"$1")}}if(G){Q=rQ(Q);let q=Y.app?.colorMode;if(q)Q=dQ(Q,q);Q=lQ(Q),Q=SL(Q)}if(G)try{let{getStoreScript:q}=await t("stx/store-loader",()=>Promise.resolve().then(() => (Qq(),Gq))),K=Y.storesDir,U=await q(K);if(U){let W=`<script data-stx-stores>${U}</script>`,w=r5(Q,"data-stx-runtime");if(w)Q=Q.slice(0,w.end)+`
16314
+ `+W+Q.slice(w.end)}}catch{}if(G)try{let{getFrameworkComposableScript:q}=await t("stx/framework-composables",()=>Promise.resolve().then(() => (wq(),Wq))),K=await q(Q);if(K){let U=r5(Q,"data-stx-stores")||r5(Q,"data-stx-runtime");if(U)Q=Q.slice(0,U.end)+`
16315
+ `+K+Q.slice(U.end)}}catch{}if(G)try{let{getComposableScript:q}=await t("stx/composable-loader",()=>Promise.resolve().then(() => (Bq(),jq))),K=Y.composablesDir,U=await q(K);if(U){let W=`<script data-stx-composables>${U}</script>`,w=r5(Q,"data-stx-stores")||r5(Q,"data-stx-runtime");if(w)Q=Q.slice(0,w.end)+`
16316
+ `+W+Q.slice(w.end)}}catch{}if(G)Q=mQ(Q);if(G&&$.__stx_inject_css!==!1)Q=await SJ(Q,void 0,Y.buildMode==="serve");if(G)Q=$Z(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof M8)throw Q;let q=Q instanceof Error?Q.message:String(Q),K=new e1(`Template processing failed: ${q}`,Z,void 0,void 0,X.substring(0,200)+(X.length>200?"...":""));if(s0.log(K,{filePath:Z,context:$}),L3.logDetailedError(K,{filePath:Z,template:X.substring(0,500)}),Y.debug)throw K;return H3.createFallbackContent("Template Processing",K)}}async function CL(X,$,Z,Y,J){let G=process.cwd(),Q={...Y,partialsDir:Y.partialsDir&&!E0.isAbsolute(Y.partialsDir)?E0.resolve(G,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!E0.isAbsolute(Y.componentsDir)?E0.resolve(G,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!E0.isAbsolute(Y.layoutsDir)?E0.resolve(G,Y.layoutsDir):Y.layoutsDir},q=Q,K=X;await xL(Z,$),vL($,q),K=await b5(()=>NQ(K,$,Z,q),K,(F)=>{s0.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),K=K.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=$1(K,V7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);K=U.output;let W=U.tokens,w=(F)=>W.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>W[Number(A)]??""),z="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,z),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),K=PQ(K),K=await Xq(K,Z,J);let B={};K=R4(K,B);let j={...$.__sections||{}},_="",H=lJ(mJ(X)),L=/@nolayout\b/.test(K)||H===!1;if(/@nolayout\b/.test(K))K=K.replace(/@nolayout\b\s*/g,"");let O=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(_=H,!/@section\s*\(/.test(K))K=`@section('content')
16243
16317
  ${K.trim()}
16244
- @endsection`}if(!_&&!L&&q.defaultLayout){let F=N4(K),V=/@section\s*\(/.test(K);if(!F||V){let A="",R=E0.dirname(Z),T=q.layoutsDir?E0.dirname(q.layoutsDir):process.cwd();for(let N=0;N<20;N++){let k=E0.join(R,"_layout.stx");if(await p(k)){A=k;break}let M=E0.dirname(R);if(M===R||M.length<T.length)break;R=M}if(A)_=A;else if(q.layoutsDir){let N=E0.isAbsolute(q.layoutsDir)?q.layoutsDir:E0.resolve(process.cwd(),q.layoutsDir),k=E0.join(N,`${q.defaultLayout}.stx`);if(await p(k))_=k}if(_&&!V)K=`@section('content')
16318
+ @endsection`}if(!_&&!L&&q.defaultLayout){let F=b4(K),V=/@section\s*\(/.test(K);if(!F||V){let A="",R=E0.dirname(Z),N=q.layoutsDir?E0.dirname(q.layoutsDir):process.cwd();for(let T=0;T<20;T++){let k=E0.join(R,"_layout.stx");if(await p(k)){A=k;break}let M=E0.dirname(R);if(M===R||M.length<N.length)break;R=M}if(A)_=A;else if(q.layoutsDir){let T=E0.isAbsolute(q.layoutsDir)?q.layoutsDir:E0.resolve(process.cwd(),q.layoutsDir),k=E0.join(T,`${q.defaultLayout}.stx`);if(await p(k))_=k}if(_&&!V)K=`@section('content')
16245
16319
  ${K.trim()}
16246
- @endsection`}}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return j[V]=A,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=$0(A.trim(),$);if(R===void 0)return F;return j[V]=String(R??""),""}catch{return F}}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))j[V]=A.replace("@parent",q5);else j[V]=A.trim();return""}),$.__sections=j,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return j[V]||A||""}),!("slot"in $)||$.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(K=H4(K,B),_){let F=[],V=R1(K),A=$1(V.output,A5,(R,T)=>`\x00STX_ORPHAN_STYLE_${T}\x00`);if(K=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,T,N)=>{let k=T==="SCRIPT"?V.scripts[Number(N)]:A.tokens[Number(N)];if(k)F.push(k);return""}),F.length>0){let R=F.join(`
16320
+ @endsection`}}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return j[V]=A,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=$0(A.trim(),$);if(R===void 0)return F;return j[V]=String(R??""),""}catch{return F}}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))j[V]=A.replace("@parent",K5);else j[V]=A.trim();return""}),$.__sections=j,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return j[V]||A||""}),!("slot"in $)||$.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(K=N4(K,B),_){let F=[],V=R1(K),A=$1(V.output,R5,(R,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(K=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,N,T)=>{let k=N==="SCRIPT"?V.scripts[Number(T)]:A.tokens[Number(T)];if(k)F.push(k);return""}),F.length>0){let R=F.join(`
16247
16321
  `);j.content=j.content?`${j.content}
16248
- ${R}`:R,$.__sections=j}}if(_)try{let F;if(E0.isAbsolute(_))F=_,J.add(_);else F=await y5(()=>k9(_,Z,Q,J),null,()=>{throw new t1(`Failed to resolve layout path: ${_}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let k=[];try{let y=Q.layoutsDir;if(y){let I=E0.isAbsolute(y)?y:E0.resolve(process.cwd(),y);k=FL.readdirSync(I).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,"")).sort()}}catch{}let M=`Layout not found: ${_} (referenced from ${Z})`+(k.length>0?`. Available layouts: ${k.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if(a0.log(Error(M),{layoutPath:_,filePath:Z,available:k},"error"),console.error(`[stx] ${M}`),Q.debug)throw new t1(M,Z);return K}let V=await y5(()=>Bun.file(F).text(),"",()=>{throw new t1(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let k={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(C,S,b)=>{return k[S]=b.trim(),""});for(let[C,S]of Object.entries(k))if(j[C]&&j[C].includes(q5)){let b=j[C].indexOf(q5);j[C]=j[C].slice(0,b)+S+j[C].slice(b+q5.length)}else if(!j[C])j[C]=S;let y={...$,__sections:j},I=`@layout('${A[1]}')${M}`;return await R0(I,y,F,Q,J)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),T=_4(R,B),N={};return T=T.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,M,y)=>{return N[M]=y.trim(),`@slot('${M}')`}),T=T.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,M,y)=>{if(j[M]){let I=j[M];if(I.includes(q5)){let C=N[M]||"",S=I.indexOf(q5);I=I.slice(0,S)+C+I.slice(S+q5.length)}return I}return y||""}),T=TL(T,j),T=T.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),T=H4(T,B),$.__originalFilePath=Z,K=await BK(T,$,F,Q,J),K=`<!-- stx-layout: ${_} -->
16249
- ${K}`,w(K)}catch(F){return a0.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return w(await BK(K,$,Z,Q,J))}function TL(X,$){return X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,Y,J)=>{let G=$[Y];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return J||""})}function NL(X,$){if(X.__stx_sfc_mode=!0,X.__stx_options=$,$.buildMode)X.__stx_buildMode=$.buildMode;let Z=$.envPrefix||"STX_PUBLIC_",Y={};for(let[J,G]of Object.entries(process.env))if(J.startsWith(Z)&&G!==void 0)Y[J]=G;X.$env=Y}async function ML(X,$){await y5(()=>OQ(X,$),void 0,(Z)=>{a0.log(Z,{filePath:X,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${X}: ${Z.message}`)})}async function kL(X,$,Z){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:K}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (M7(),kX)));await K(Q,$,Z,{preserveExisting:!0})}catch(K){let U=K instanceof Error?K:Error(String(K));a0.log(U,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${U.message}`)}}}async function IL(X,$,Z){try{let{interpolateScriptsInTemplate:Y}=await t("stx/expressions",()=>Promise.resolve().then(() => (Z1(),d6)));return Y(X,$,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return a0.log(J,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${J.message}`),X}}async function BK(X,$,Z,Y,J){let G=X,Q=Y;if(await kL(G,$,Z),G=await IL(G,$,Z),G=await QQ(G,$,Z),G=await qQ(G,$,Z),G=await tJ(G,$,Z,Q),W1(G))G=V9(G,$),G=R9(G,$);G=A9(G);let{processStreamDirectives:q}=await t("stx/streaming",()=>Promise.resolve().then(() => (P3(),C3)));G=q(G,$),G=w4(G,$,Z,Q),G=await EQ(G,$,Z,Q,J),G=await p8(G,$,Z,Q,J),G=_2(G,$,Z,Q);let{processDeferDirectives:K}=await t("stx/defer",()=>Promise.resolve().then(() => Gq));G=K(G,$,Z);let{processTeleportDirectives:U}=await t("stx/teleport",()=>Promise.resolve().then(() => qq));G=U(G,$,Z);let{processTransitionDirectives:W,processTransitionAttributes:w}=await t("stx/transitions",()=>Promise.resolve().then(() => wq));G=W(G,$,Z),G=w(G);let{processErrorBoundaryDirectives:z}=await t("stx/error-boundaries",()=>Promise.resolve().then(() => jq));G=z(G,$,Z);let{processSuspenseDirectives:B}=await t("stx/suspense",()=>Promise.resolve().then(() => Bq));G=B(G,$,Z);let{processAsyncDirectives:j}=await t("stx/async-components",()=>Promise.resolve().then(() => Lq));G=j(G,$,Z);let{processKeepAliveDirectives:_}=await t("stx/keep-alive",()=>Promise.resolve().then(() => Vq));G=_(G,$,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await t("stx/virtual-scrolling",()=>Promise.resolve().then(() => (kq(),Mq)));G=H(G,$,Z),G=L(G,$,Z),G=O(G,$,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await t("stx/partial-hydration",()=>Promise.resolve().then(() => (dq(),uq)));G=F(G,$,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await t("stx/computed",()=>Promise.resolve().then(() => (eq(),tq)));G=A(G,$,Z),G=R(G,$,Z);let{processFormValidationDirectives:T}=await t("stx/forms-validation",()=>Promise.resolve().then(() => (QK(),GK)));G=T(G,$,Z);let{processHeadDirective:N,processTitleDirective:k,processMetaDirective:M,resetHead:y}=await t("stx/head",()=>Promise.resolve().then(() => (N7(),Z9)));if(!$.__stx_head_preset&&!$.__stx_runtime_head)y();let I=N(G);if(G=I.content,I.headContent)$.__stx_head_raw=`${$.__stx_head_raw||""}${I.headContent}
16250
- `;if(G=k(G,$),G=M(G,$),G=_Q(G),G=F3(G,$),G=sJ(G),G=WQ(G),G=await B4(G,$,Z,Q,J),G=await p8(G,$,Z,Q,J),$.__stxProcessingDepth===1)G=T6(G,$);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=k4(G),G=$5(G,$,Z),G=V3(G,$),G=A3(G,$),G=x8(G,$),G=qG(G,$),G=KG(G,$),G=await gJ(G,$,Z,Q),G=await tZ(G,$,Z),G=await jG(G,$,Z,Q),G=K2(G,$,Z,Q),G=JJ(G,$,Z,Q),G=GJ(G,$,Z),G=QJ(G,$,Z,Q),G=nJ(G,$,Z,Q),G=t8(G,$),G=e8(G),G=pQ(G),!Q.skipEventDirectives)G=$6(G,$,Z);if(G=xJ(G,$,Z),Q.debug){let r=/\bx-data\s*=/.test(G),a=pX(X);if(r&&a)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
16322
+ ${R}`:R,$.__sections=j}}if(_)try{let F;if(E0.isAbsolute(_))F=_,J.add(_);else F=await b5(()=>C9(_,Z,Q,J),null,()=>{throw new e1(`Failed to resolve layout path: ${_}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let k=[];try{let y=Q.layoutsDir;if(y){let I=E0.isAbsolute(y)?y:E0.resolve(process.cwd(),y);k=yL.readdirSync(I).filter((C)=>C.endsWith(".stx")).map((C)=>C.replace(/\.stx$/,"")).sort()}}catch{}let M=`Layout not found: ${_} (referenced from ${Z})`+(k.length>0?`. Available layouts: ${k.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if(s0.log(Error(M),{layoutPath:_,filePath:Z,available:k},"error"),console.error(`[stx] ${M}`),Q.debug)throw new e1(M,Z);return K}let V=await b5(()=>Bun.file(F).text(),"",()=>{throw new e1(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let k={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(C,S,b)=>{return k[S]=b.trim(),""});for(let[C,S]of Object.entries(k))if(j[C]&&j[C].includes(K5)){let b=j[C].indexOf(K5);j[C]=j[C].slice(0,b)+S+j[C].slice(b+K5.length)}else if(!j[C])j[C]=S;let y={...$,__sections:j},I=`@layout('${A[1]}')${M}`;return await R0(I,y,F,Q,J)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=R4(R,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(k,M,y)=>{return T[M]=y.trim(),`@slot('${M}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(k,M,y)=>{if(j[M]){let I=j[M];if(I.includes(K5)){let C=T[M]||"",S=I.indexOf(K5);I=I.slice(0,S)+C+I.slice(S+K5.length)}return I}return y||""}),N=PL(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=N4(N,B),$.__originalFilePath=Z,K=await MK(N,$,F,Q,J),K=`<!-- stx-layout: ${_} -->
16323
+ ${K}`,w(K)}catch(F){return s0.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return w(await MK(K,$,Z,Q,J))}function PL(X,$){return X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,Y,J)=>{let G=$[Y];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return J||""})}function vL(X,$){if(X.__stx_sfc_mode=!0,X.__stx_options=$,$.buildMode)X.__stx_buildMode=$.buildMode;let Z=$.envPrefix||"STX_PUBLIC_",Y={};for(let[J,G]of Object.entries(process.env))if(J.startsWith(Z)&&G!==void 0)Y[J]=G;X.$env=Y}async function xL(X,$){await b5(()=>EQ(X,$),void 0,(Z)=>{s0.log(Z,{filePath:X,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${X}: ${Z.message}`)})}async function fL(X,$,Z){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:K}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (k7(),IX)));await K(Q,$,Z,{preserveExisting:!0})}catch(K){let U=K instanceof Error?K:Error(String(K));s0.log(U,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${U.message}`)}}}async function gL(X,$,Z){try{let{interpolateScriptsInTemplate:Y}=await t("stx/expressions",()=>Promise.resolve().then(() => (Z1(),n6)));return Y(X,$,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return s0.log(J,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${J.message}`),X}}async function MK(X,$,Z,Y,J){let G=X,Q=Y;if(await fL(G,$,Z),G=await gL(G,$,Z),G=await OQ(G,$,Z),G=await LQ(G,$,Z),G=await UG(G,$,Z,Q),W1(G))G=I9(G,$),G=D9(G,$);G=E9(G);let{processStreamDirectives:q}=await t("stx/streaming",()=>Promise.resolve().then(() => (d3(),u3)));G=q(G,$),G=L4(G,$,Z,Q),G=await hQ(G,$,Z,Q,J),G=await p8(G,$,Z,Q,J),G=R2(G,$,Z,Q);let{processDeferDirectives:K}=await t("stx/defer",()=>Promise.resolve().then(() => Hq));G=K(G,$,Z);let{processTeleportDirectives:U}=await t("stx/teleport",()=>Promise.resolve().then(() => Lq));G=U(G,$,Z);let{processTransitionDirectives:W,processTransitionAttributes:w}=await t("stx/transitions",()=>Promise.resolve().then(() => Rq));G=W(G,$,Z),G=w(G);let{processErrorBoundaryDirectives:z}=await t("stx/error-boundaries",()=>Promise.resolve().then(() => Tq));G=z(G,$,Z);let{processSuspenseDirectives:B}=await t("stx/suspense",()=>Promise.resolve().then(() => Mq));G=B(G,$,Z);let{processAsyncDirectives:j}=await t("stx/async-components",()=>Promise.resolve().then(() => Dq));G=j(G,$,Z);let{processKeepAliveDirectives:_}=await t("stx/keep-alive",()=>Promise.resolve().then(() => bq));G=_(G,$,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await t("stx/virtual-scrolling",()=>Promise.resolve().then(() => (fq(),xq)));G=H(G,$,Z),G=L(G,$,Z),G=O(G,$,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await t("stx/partial-hydration",()=>Promise.resolve().then(() => (tq(),aq)));G=F(G,$,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await t("stx/computed",()=>Promise.resolve().then(() => (WK(),UK)));G=A(G,$,Z),G=R(G,$,Z);let{processFormValidationDirectives:N}=await t("stx/forms-validation",()=>Promise.resolve().then(() => (OK(),HK)));G=N(G,$,Z);let{processHeadDirective:T,processTitleDirective:k,processMetaDirective:M,resetHead:y}=await t("stx/head",()=>Promise.resolve().then(() => (M7(),Z9)));if(!$.__stx_head_preset&&!$.__stx_runtime_head)y();let I=T(G);if(G=I.content,I.headContent)$.__stx_head_raw=`${$.__stx_head_raw||""}${I.headContent}
16324
+ `;if(G=k(G,$),G=M(G,$),G=kQ(G),G=k3(G,$),G=qG(G),G=AQ(G),G=await A4(G,$,Z,Q,J),G=await p8(G,$,Z,Q,J),$.__stxProcessingDepth===1)G=D6(G,$);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=C4(G),G=Z5(G,$,Z),G=I3(G,$),G=E3(G,$),G=x8(G,$),G=LG(G,$),G=FG(G,$),G=await oJ(G,$,Z,Q),G=await UY(G,$,Z),G=await TG(G,$,Z,Q),G=_2(G,$,Z,Q),G=_J(G,$,Z,Q),G=HJ(G,$,Z),G=OJ(G,$,Z,Q),G=JG(G,$,Z,Q),G=t8(G,$),G=e8(G),G=Zq(G),!Q.skipEventDirectives)G=K6(G,$,Z);if(G=nJ(G,$,Z),Q.debug){let r=/\bx-data\s*=/.test(G),a=pX(X);if(r&&a)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
16251
16325
  Both work on the same page, but they manage separate scopes.
16252
- Prefer signals (state/derived/effect) for new components.`)}G=VQ(G,$),G=await T1(G,$,Z),G=iQ(G),G=nQ(G),G=IJ(G);let{processXElementDirectives:C}=await t("stx/x-element",()=>Promise.resolve().then(() => UK));G=C(G);let S=$.__originalFilePath||Z,b=H7($);if(G=await T9(G,Q,S,b),G=YG(G,$),G=await jQ(G,$,Z,Q),Q.media?.image?.autoSiblings){let r=Q.publicDir||"public",{rewriteImagesWithSiblings:a}=await t("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (wK(),WK)));G=await a(G,{publicDir:r})}if(Q.seo?.enabled)G=qJ(G,$,Q);let P=(r,a,K0=!0)=>{if(!a)return r;let T0=a.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),J0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(T0&&J0){if(K0)r=r.replace(J0[0],T0[0]);if(a=a.replace(T0[0],"").trim(),!a)return r}if(/<\/head>/i.test(r))return r.replace(/<\/head>/i,`${a}
16326
+ Prefer signals (state/derived/effect) for new components.`)}G=bQ(G,$),G=await N1(G,$,Z),G=Yq(G),G=Jq(G),G=gJ(G);let{processXElementDirectives:C}=await t("stx/x-element",()=>Promise.resolve().then(() => VK));G=C(G);let S=$.__originalFilePath||Z,b=O7($);if(G=await y9(G,Q,S,b),G=BG(G,$),G=await TQ(G,$,Z,Q),Q.media?.image?.autoSiblings){let r=Q.publicDir||"public",{rewriteImagesWithSiblings:a}=await t("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (RK(),AK)));G=await a(G,{publicDir:r})}if(Q.seo?.enabled)G=LJ(G,$,Q);let P=(r,a,K0=!0)=>{if(!a)return r;let N0=a.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),J0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(N0&&J0){if(K0)r=r.replace(J0[0],N0[0]);if(a=a.replace(N0[0],"").trim(),!a)return r}if(/<\/head>/i.test(r))return r.replace(/<\/head>/i,`${a}
16253
16327
  </head>`);if(/<head\b[^>]*>/i.test(r))return r.replace(/(<head\b[^>]*>)/i,`$1
16254
16328
  ${a}`);if(/<html\b[^>]*>/i.test(r))return r.replace(/(<html\b[^>]*>)/i,`$1
16255
16329
  <head>
16256
16330
  ${a}
16257
- </head>`);return r},{renderHead:x,getHead:d}=await t("stx/head",()=>Promise.resolve().then(() => (N7(),Z9))),Y0=$.__stx_runtime_head??d();if(Y0.title||Y0.meta?.length||Y0.link?.length){let r=x(Y0);if(r)G=P(G,r)}if(I.headContent)G=P(G,I.headContent,!Y0.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=pJ(G,Q.csp,$);if(Q.analytics?.enabled)G=DJ(G,Q);if(Q.heatmap?.enabled)G=u2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:r}=await t("stx/pwa/inject",()=>Promise.resolve().then(() => (ZX(),$2)));G=r(G,Q)}let m0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),F0=/\bSTX\.\w+/.test(G),i0=/window\.STX\s*=/.test(G);if(m0&&F0&&!i0){let a=`<script data-stx-scoped data-stx-run="once">
16258
- ${TJ()}
16259
- </script>`;if(G.includes("</head>")){let K0=G.indexOf("</head>"),J0=G.slice(0,K0).indexOf("<script");if(J0!==-1){let E=G.slice(0,J0),v=G.slice(J0);G=E+a+`
16331
+ </head>`);return r},{renderHead:x,getHead:d}=await t("stx/head",()=>Promise.resolve().then(() => (M7(),Z9))),Y0=$.__stx_runtime_head??d();if(Y0.title||Y0.meta?.length||Y0.link?.length){let r=x(Y0);if(r)G=P(G,r)}if(I.headContent)G=P(G,I.headContent,!Y0.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=ZG(G,Q.csp,$);if(Q.analytics?.enabled)G=uJ(G,Q);if(Q.heatmap?.enabled)G=n2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:r}=await t("stx/pwa/inject",()=>Promise.resolve().then(() => (YX(),K2)));G=r(G,Q)}let d0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),F0=/\bSTX\.\w+/.test(G),p0=/window\.STX\s*=/.test(G);if(d0&&F0&&!p0){let a=`<script data-stx-scoped data-stx-run="once">
16332
+ ${PJ()}
16333
+ </script>`;if(G.includes("</head>")){let K0=G.indexOf("</head>"),J0=G.slice(0,K0).indexOf("<script");if(J0!==-1){let D=G.slice(0,J0),v=G.slice(J0);G=D+a+`
16260
16334
  `+v}else G=G.replace("</head>",`${a}
16261
16335
  </head>`)}else if(G.includes("<body"))G=G.replace(/<body([^>]*)>/,`<body$1>
16262
16336
  ${a}`);else G=a+`
16263
- `+G}{let{scanScriptTags:r}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (D7(),iX))),a=[];for(let K0 of r(G)){if(!/\bserver\b/i.test(K0.attrs))continue;let T0=K0.start+K0.fullMatch.indexOf(">")+1,J0=VL(G,T0);if(J0===-1)continue;let E=J0+9;while(E<G.length&&/\s/.test(G[E]))E++;a.push({start:K0.start,end:E})}for(let K0=a.length-1;K0>=0;K0--){let{start:T0,end:J0}=a[K0];G=G.substring(0,T0)+G.substring(J0)}}let l=RX(G,Z);if(l.hasScoped)G=l.html;let j0=$.__stx_event_bindings||[],l0=!1,_1=[],U5=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:W5}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (D7(),iX)));for(let r of W5(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))_1.push({match:r.fullMatch,attrs:r.attrs,content:r.body});for(let{match:r,attrs:a,content:K0}of _1){l0=!0;let T0=K0;X$(K0,Z,Y.strict,$.__originalFilePath);let J0=await O7(K0,{eventBindings:j0,attrs:a,hasColonDirectives:U5,templateContent:X,filePath:Z,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:b});G=G.replace(r,()=>J0)}if(l0)$.__stx_event_bindings=[];if(!l0&&$.__stxProcessingDepth===1){let r=$.__stx_event_bindings||[];if(r.length>0){let a=g$(r);if(a){let K0=G.lastIndexOf("</body>");G=K0===-1?G+a:G.slice(0,K0)+a+`
16264
- `+G.slice(K0)}$.__stx_event_bindings=[]}}if(!xZ(G)&&fZ(G))G=await dX(G,Q);if(Q.csp?.enabled&&Q.csp.useNonce&&typeof $.cspNonce==="string")G=iJ(G,$.cspNonce);return G}var q5="<!--PARENT_CONTENT_PLACEHOLDER-->";var sX=D(()=>{RJ();W9();l1();B$();NJ();EJ();yJ();P$();_$();h$();L7();fJ();hJ();C8();rJ();aJ();XG();JG();w1();N7();Z1();UG();BG();GQ();UQ();z4();I9();BQ();N5();HQ();z3();A0();LQ();AQ();NQ();DQ();t$();A4();uQ();D7();U4();cQ();I4();E4();O0();x3();i$();w7();mX();mX();I4();E4()});import SL from"fs";import x4 from"path";import MK from"fs";import q1 from"path";var u4=[72,96,128,144,152,192,384,512],d4=[120,152,167,180],m4=[16,32];async function l4(X,$){let Z={success:!0,generatedFiles:[],errors:[],warnings:[]},Y=X.pwa?.icons;if(!Y?.src)return Z.errors.push("No source icon specified in pwa.icons.src"),Z.success=!1,Z;let J=q1.isAbsolute(Y.src)?Y.src:q1.resolve(process.cwd(),Y.src);if(!await Bun.file(J).exists())return Z.errors.push(`Source icon not found: ${J}`),Z.success=!1,Z;let G=q1.resolve($,Y.outputDir||"pwa-icons");try{MK.mkdirSync(G,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${G}`),Z.success=!1,Z}let Q=Y.sizes||u4,q=Y.generateWebP??!0,K=Y.generateAppleIcons??!0;try{let U;try{U=await import("sharp")}catch{return Z.errors.push(`sharp is not installed. Install it with: bun add sharp
16265
- Icon generation requires the sharp package for image processing.`),Z.success=!1,Z}let w=await U.default(J).metadata();if(w.width&&w.width<512)Z.warnings.push(`Source icon is ${w.width}x${w.height}. Recommend using at least 512x512 for best quality.`);for(let H of Q){let L=q1.join(G,`icon-${H}x${H}.png`);if(await U.default(J).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(L),Z.generatedFiles.push(L),q){let O=q1.join(G,`icon-${H}x${H}.webp`);await U.default(J).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Z.generatedFiles.push(O)}}if(K){for(let L of d4){let O=q1.join(G,`apple-touch-icon-${L}x${L}.png`);await U.default(J).resize(L,L,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Z.generatedFiles.push(O)}let H=q1.join(G,"apple-touch-icon.png");await U.default(J).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(H),Z.generatedFiles.push(H)}for(let H of m4){let L=q1.join(G,`favicon-${H}x${H}.png`);await U.default(J).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(L),Z.generatedFiles.push(L)}let z=512,B=q1.join(G,`icon-maskable-${z}x${z}.png`),j=Math.floor(z*0.1),_=z-j*2;await U.default(J).resize(_,_,{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(B),Z.generatedFiles.push(B)}catch(U){let W=U instanceof Error?U.message:String(U);Z.errors.push(`Icon generation failed: ${W}`),Z.success=!1}return Z}function xL(X){let $=X.sizes||u4,Z=X.outputDir?`/${X.outputDir}`:"/pwa-icons",Y=X.generateWebP??!0,J=X.generateAppleIcons??!0,G=[];for(let Q of $)if(G.push(`${Z}/icon-${Q}x${Q}.png`),Y)G.push(`${Z}/icon-${Q}x${Q}.webp`);if(J){G.push(`${Z}/apple-touch-icon.png`);for(let Q of d4)G.push(`${Z}/apple-touch-icon-${Q}x${Q}.png`)}for(let Q of m4)G.push(`${Z}/favicon-${Q}x${Q}.png`);return G.push(`${Z}/icon-maskable-512x512.png`),G}async function c4(){try{return await import("sharp"),!0}catch{return!1}}ZX();function iK(X,$,Z,Y){let J=[],G=Y.join(" ");for(let Q of X)if(J.push({src:`${$}/icon-${Q}x${Q}.png`,sizes:`${Q}x${Q}`,type:"image/png",purpose:G}),Z)J.push({src:`${$}/icon-${Q}x${Q}.webp`,sizes:`${Q}x${Q}`,type:"image/webp",purpose:G});return J}function nK(X){return X.map(($)=>({name:$.name,short_name:$.shortName,description:$.description,url:$.url,icons:$.icons?.map((Z)=>({src:Z.src,sizes:Z.sizes,type:Z.type}))}))}function rK(X){let $=X.pwa?.shareTarget;if(!$?.enabled)return;let Z={action:$.action||"/share",method:$.method||"POST",enctype:$.enctype||"multipart/form-data",params:{title:$.params?.title||"title",text:$.params?.text||"text",url:$.params?.url||"url"}};if($.acceptFiles&&$.acceptFiles.length>0)Z.params.files=$.acceptFiles.map((Y)=>({name:Y.name,accept:Y.accept}));return Z}function oK(X){let $=X.pwa?.fileHandlers;if(!$?.enabled||!$.accept)return;let Z=[{action:$.action||"/",accept:$.accept,launch_type:$.launchType||"single-client"}];if($.icons)Z[0].icons=$.icons.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}));return Z}function sK(X){let $=X.pwa?.protocolHandlers;if(!$||$.length===0)return;return $.map((Z)=>({protocol:Z.protocol,url:Z.url}))}function aK(X){let $=X.pwa;if(!$?.enabled||!$.manifest)return null;let{manifest:Z,icons:Y}=$,J=Y?.sizes||[72,96,128,144,152,192,384,512],G=Y?.outputDir?`/${Y.outputDir}`:"/pwa-icons",Q=Y?.generateWebP??!0,q=Y?.purpose||["any","maskable"],K={name:Z.name,short_name:Z.shortName||Z.name,description:Z.description,start_url:Z.startUrl||"/",display:Z.display||"standalone",display_override:Z.displayOverride,orientation:Z.orientation,theme_color:Z.themeColor,background_color:Z.backgroundColor,scope:Z.scope||"/",lang:Z.lang,dir:Z.dir,id:Z.id,categories:Z.categories,icons:iK(J,G,Q,q)};if(Z.shortcuts&&Z.shortcuts.length>0)K.shortcuts=nK(Z.shortcuts);if(Z.screenshots&&Z.screenshots.length>0)K.screenshots=Z.screenshots.map((z)=>({src:z.src,sizes:z.sizes,type:z.type,label:z.label,form_factor:z.platform}));let U=rK(X);if(U)K.share_target=U;let W=oK(X);if(W)K.file_handlers=W;let w=sK(X);if(w)K.protocol_handlers=w;if(Z.launchHandler)K.launch_handler={client_mode:Z.launchHandler};if(Z.handleLinks)K.handle_links=Z.handleLinks;if(Z.edgeSidePanel?.enabled)K.edge_side_panel={preferred_width:Z.edgeSidePanel.preferredWidth};return K}function Z2(X){let $=aK(X);if(!$)return"";let Z=JSON.parse(JSON.stringify($));return JSON.stringify(Z,null,2)}function iL(X,$){return{...$,...X,shortcuts:X.shortcuts||$.shortcuts,screenshots:X.screenshots||$.screenshots,categories:X.categories||$.categories}}function nL(X){let $=[],Z=X.pwa;if(!Z?.enabled)return $;let Y=Z.manifest;if(!Y)return $.push("PWA manifest configuration is missing"),$;if(!Y.name)$.push("Manifest name is required");let J=["fullscreen","standalone","minimal-ui","browser"];if(Y.display&&!J.includes(Y.display))$.push(`Invalid display mode: ${Y.display}. Must be one of: ${J.join(", ")}`);let G=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(Y.orientation&&!G.includes(Y.orientation))$.push(`Invalid orientation: ${Y.orientation}`);let Q=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(Y.themeColor&&!Q.test(Y.themeColor))$.push(`Invalid theme color: ${Y.themeColor}. Must be a valid hex color.`);if(Y.backgroundColor&&!Q.test(Y.backgroundColor))$.push(`Invalid background color: ${Y.backgroundColor}. Must be a valid hex color.`);if(Z.shareTarget?.enabled){if(!Z.shareTarget.action)$.push("Share target action URL is required")}if(Z.fileHandlers?.enabled){if(!Z.fileHandlers.accept||Object.keys(Z.fileHandlers.accept).length===0)$.push("File handlers must specify accepted MIME types")}if(Z.protocolHandlers)for(let q of Z.protocolHandlers){if(!q.protocol)$.push("Protocol handler missing protocol");if(!q.url||!q.url.includes("%s"))$.push(`Protocol handler URL must contain %s placeholder: ${q.protocol}`)}return $}import HK from"path";async function OK(X){let $=X.pwa?.offline;if(!$?.enabled)return"";if($.page){let Z=HK.isAbsolute($.page)?$.page:HK.resolve(process.cwd(),$.page);if(await Bun.file(Z).exists())try{let{processDirectives:Y}=await Promise.resolve().then(() => (sX(),_K)),J=await Bun.file(Z).text();return await Y(J,{},Z,X,new Set)}catch(Y){console.warn(`[PWA] Failed to process custom offline page: ${Y}`)}else console.warn(`[PWA] Custom offline page not found: ${Z}`)}return EL(X)}function EL(X){let $=X.pwa?.offline,Z=X.pwa?.manifest,Y=$?.fallbackTitle||"You are offline",J=$?.fallbackMessage||"Please check your internet connection and try again.",G=Z?.themeColor||"#4f46e5",Q=Z?.shortName||Z?.name||"App";return`<!DOCTYPE html>
16337
+ `+G}{let{scanScriptTags:r}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (y7(),iX))),a=[];for(let K0 of r(G)){if(!/\bserver\b/i.test(K0.attrs))continue;let N0=K0.start+K0.fullMatch.indexOf(">")+1,J0=bL(G,N0);if(J0===-1)continue;let D=J0+9;while(D<G.length&&/\s/.test(G[D]))D++;a.push({start:K0.start,end:D})}for(let K0=a.length-1;K0>=0;K0--){let{start:N0,end:J0}=a[K0];G=G.substring(0,N0)+G.substring(J0)}}let l=NX(G,Z);if(l.hasScoped)G=l.html;let j0=$.__stx_event_bindings||[],m0=!1,_1=[],W5=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:w5}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (y7(),iX)));for(let r of w5(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))_1.push({match:r.fullMatch,attrs:r.attrs,content:r.body});for(let{match:r,attrs:a,content:K0}of _1){m0=!0;let N0=K0;X$(K0,Z,Y.strict,$.__originalFilePath);let J0=await L7(K0,{eventBindings:j0,attrs:a,hasColonDirectives:W5,templateContent:X,filePath:Z,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:b});G=G.replace(r,()=>J0)}if(m0)$.__stx_event_bindings=[];if(!m0&&$.__stxProcessingDepth===1){let r=$.__stx_event_bindings||[];if(r.length>0){let a=g$(r);if(a){let K0=G.lastIndexOf("</body>");G=K0===-1?G+a:G.slice(0,K0)+a+`
16338
+ `+G.slice(K0)}$.__stx_event_bindings=[]}}if(!nZ(G)&&rZ(G))G=await dX(G,Q);if(Q.csp?.enabled&&Q.csp.useNonce&&typeof $.cspNonce==="string")G=YG(G,$.cspNonce);return G}var K5="<!--PARENT_CONTENT_PLACEHOLDER-->";var sX=E(()=>{CJ();W9();l1();B$();vJ();hJ();dJ();P$();_$();h$();F7();rJ();sJ();C8();GG();KG();wG();_G();w1();M7();Z1();VG();MG();HQ();VQ();F4();P9();MQ();M5();IQ();F3();A0();DQ();SQ();vQ();uQ();t$();E4();aQ();y7();H4();$q();P4();v4();O0();l3();i$();z7();mX();mX();P4();v4()});import lL from"fs";import l4 from"path";import xK from"fs";import q1 from"path";var n4=[72,96,128,144,152,192,384,512],r4=[120,152,167,180],o4=[16,32];async function s4(X,$){let Z={success:!0,generatedFiles:[],errors:[],warnings:[]},Y=X.pwa?.icons;if(!Y?.src)return Z.errors.push("No source icon specified in pwa.icons.src"),Z.success=!1,Z;let J=q1.isAbsolute(Y.src)?Y.src:q1.resolve(process.cwd(),Y.src);if(!await Bun.file(J).exists())return Z.errors.push(`Source icon not found: ${J}`),Z.success=!1,Z;let G=q1.resolve($,Y.outputDir||"pwa-icons");try{xK.mkdirSync(G,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${G}`),Z.success=!1,Z}let Q=Y.sizes||n4,q=Y.generateWebP??!0,K=Y.generateAppleIcons??!0;try{let U;try{U=await import("sharp")}catch{return Z.errors.push(`sharp is not installed. Install it with: bun add sharp
16339
+ Icon generation requires the sharp package for image processing.`),Z.success=!1,Z}let w=await U.default(J).metadata();if(w.width&&w.width<512)Z.warnings.push(`Source icon is ${w.width}x${w.height}. Recommend using at least 512x512 for best quality.`);for(let H of Q){let L=q1.join(G,`icon-${H}x${H}.png`);if(await U.default(J).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(L),Z.generatedFiles.push(L),q){let O=q1.join(G,`icon-${H}x${H}.webp`);await U.default(J).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Z.generatedFiles.push(O)}}if(K){for(let L of r4){let O=q1.join(G,`apple-touch-icon-${L}x${L}.png`);await U.default(J).resize(L,L,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Z.generatedFiles.push(O)}let H=q1.join(G,"apple-touch-icon.png");await U.default(J).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(H),Z.generatedFiles.push(H)}for(let H of o4){let L=q1.join(G,`favicon-${H}x${H}.png`);await U.default(J).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(L),Z.generatedFiles.push(L)}let z=512,B=q1.join(G,`icon-maskable-${z}x${z}.png`),j=Math.floor(z*0.1),_=z-j*2;await U.default(J).resize(_,_,{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(B),Z.generatedFiles.push(B)}catch(U){let W=U instanceof Error?U.message:String(U);Z.errors.push(`Icon generation failed: ${W}`),Z.success=!1}return Z}function nL(X){let $=X.sizes||n4,Z=X.outputDir?`/${X.outputDir}`:"/pwa-icons",Y=X.generateWebP??!0,J=X.generateAppleIcons??!0,G=[];for(let Q of $)if(G.push(`${Z}/icon-${Q}x${Q}.png`),Y)G.push(`${Z}/icon-${Q}x${Q}.webp`);if(J){G.push(`${Z}/apple-touch-icon.png`);for(let Q of r4)G.push(`${Z}/apple-touch-icon-${Q}x${Q}.png`)}for(let Q of o4)G.push(`${Z}/favicon-${Q}x${Q}.png`);return G.push(`${Z}/icon-maskable-512x512.png`),G}async function a4(){try{return await import("sharp"),!0}catch{return!1}}YX();function YU(X,$,Z,Y){let J=[],G=Y.join(" ");for(let Q of X)if(J.push({src:`${$}/icon-${Q}x${Q}.png`,sizes:`${Q}x${Q}`,type:"image/png",purpose:G}),Z)J.push({src:`${$}/icon-${Q}x${Q}.webp`,sizes:`${Q}x${Q}`,type:"image/webp",purpose:G});return J}function JU(X){return X.map(($)=>({name:$.name,short_name:$.shortName,description:$.description,url:$.url,icons:$.icons?.map((Z)=>({src:Z.src,sizes:Z.sizes,type:Z.type}))}))}function GU(X){let $=X.pwa?.shareTarget;if(!$?.enabled)return;let Z={action:$.action||"/share",method:$.method||"POST",enctype:$.enctype||"multipart/form-data",params:{title:$.params?.title||"title",text:$.params?.text||"text",url:$.params?.url||"url"}};if($.acceptFiles&&$.acceptFiles.length>0)Z.params.files=$.acceptFiles.map((Y)=>({name:Y.name,accept:Y.accept}));return Z}function QU(X){let $=X.pwa?.fileHandlers;if(!$?.enabled||!$.accept)return;let Z=[{action:$.action||"/",accept:$.accept,launch_type:$.launchType||"single-client"}];if($.icons)Z[0].icons=$.icons.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}));return Z}function qU(X){let $=X.pwa?.protocolHandlers;if(!$||$.length===0)return;return $.map((Z)=>({protocol:Z.protocol,url:Z.url}))}function KU(X){let $=X.pwa;if(!$?.enabled||!$.manifest)return null;let{manifest:Z,icons:Y}=$,J=Y?.sizes||[72,96,128,144,152,192,384,512],G=Y?.outputDir?`/${Y.outputDir}`:"/pwa-icons",Q=Y?.generateWebP??!0,q=Y?.purpose||["any","maskable"],K={name:Z.name,short_name:Z.shortName||Z.name,description:Z.description,start_url:Z.startUrl||"/",display:Z.display||"standalone",display_override:Z.displayOverride,orientation:Z.orientation,theme_color:Z.themeColor,background_color:Z.backgroundColor,scope:Z.scope||"/",lang:Z.lang,dir:Z.dir,id:Z.id,categories:Z.categories,icons:YU(J,G,Q,q)};if(Z.shortcuts&&Z.shortcuts.length>0)K.shortcuts=JU(Z.shortcuts);if(Z.screenshots&&Z.screenshots.length>0)K.screenshots=Z.screenshots.map((z)=>({src:z.src,sizes:z.sizes,type:z.type,label:z.label,form_factor:z.platform}));let U=GU(X);if(U)K.share_target=U;let W=QU(X);if(W)K.file_handlers=W;let w=qU(X);if(w)K.protocol_handlers=w;if(Z.launchHandler)K.launch_handler={client_mode:Z.launchHandler};if(Z.handleLinks)K.handle_links=Z.handleLinks;if(Z.edgeSidePanel?.enabled)K.edge_side_panel={preferred_width:Z.edgeSidePanel.preferredWidth};return K}function U2(X){let $=KU(X);if(!$)return"";let Z=JSON.parse(JSON.stringify($));return JSON.stringify(Z,null,2)}function YF(X,$){return{...$,...X,shortcuts:X.shortcuts||$.shortcuts,screenshots:X.screenshots||$.screenshots,categories:X.categories||$.categories}}function JF(X){let $=[],Z=X.pwa;if(!Z?.enabled)return $;let Y=Z.manifest;if(!Y)return $.push("PWA manifest configuration is missing"),$;if(!Y.name)$.push("Manifest name is required");let J=["fullscreen","standalone","minimal-ui","browser"];if(Y.display&&!J.includes(Y.display))$.push(`Invalid display mode: ${Y.display}. Must be one of: ${J.join(", ")}`);let G=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(Y.orientation&&!G.includes(Y.orientation))$.push(`Invalid orientation: ${Y.orientation}`);let Q=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(Y.themeColor&&!Q.test(Y.themeColor))$.push(`Invalid theme color: ${Y.themeColor}. Must be a valid hex color.`);if(Y.backgroundColor&&!Q.test(Y.backgroundColor))$.push(`Invalid background color: ${Y.backgroundColor}. Must be a valid hex color.`);if(Z.shareTarget?.enabled){if(!Z.shareTarget.action)$.push("Share target action URL is required")}if(Z.fileHandlers?.enabled){if(!Z.fileHandlers.accept||Object.keys(Z.fileHandlers.accept).length===0)$.push("File handlers must specify accepted MIME types")}if(Z.protocolHandlers)for(let q of Z.protocolHandlers){if(!q.protocol)$.push("Protocol handler missing protocol");if(!q.url||!q.url.includes("%s"))$.push(`Protocol handler URL must contain %s placeholder: ${q.protocol}`)}return $}import IK from"path";async function EK(X){let $=X.pwa?.offline;if(!$?.enabled)return"";if($.page){let Z=IK.isAbsolute($.page)?$.page:IK.resolve(process.cwd(),$.page);if(await Bun.file(Z).exists())try{let{processDirectives:Y}=await Promise.resolve().then(() => (sX(),kK)),J=await Bun.file(Z).text();return await Y(J,{},Z,X,new Set)}catch(Y){console.warn(`[PWA] Failed to process custom offline page: ${Y}`)}else console.warn(`[PWA] Custom offline page not found: ${Z}`)}return hL(X)}function hL(X){let $=X.pwa?.offline,Z=X.pwa?.manifest,Y=$?.fallbackTitle||"You are offline",J=$?.fallbackMessage||"Please check your internet connection and try again.",G=Z?.themeColor||"#4f46e5",Q=Z?.shortName||Z?.name||"App";return`<!DOCTYPE html>
16266
16340
  <html lang="en">
16267
16341
  <head>
16268
16342
  <meta charset="UTF-8">
@@ -16495,9 +16569,9 @@ Icon generation requires the sharp package for image processing.`),Z.success=!1,
16495
16569
  }, 5000);
16496
16570
  </script>
16497
16571
  </body>
16498
- </html>`}function Q$(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}r5();o5();import K5 from"fs";import q$ from"path";function DL(X){let $=[],Z=X.pwa;if($.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Z?.enabled===!0,message:Z?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Z?.enabled)return $;$.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Z.manifest?.name),message:Z.manifest?.name?`App name: "${Z.manifest.name}"`:"Missing required manifest name"}),$.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Z.manifest?.shortName),message:Z.manifest?.shortName?`Short name: "${Z.manifest.shortName}"`:"Short name not set (will use full name)"}),$.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Z.manifest?.description),message:Z.manifest?.description?"Description is set":"App description not provided"}),$.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Z.manifest?.themeColor),message:Z.manifest?.themeColor?`Theme color: ${Z.manifest.themeColor}`:"Theme color not set"}),$.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Z.manifest?.backgroundColor),message:Z.manifest?.backgroundColor?`Background color: ${Z.manifest.backgroundColor}`:"Background color not set"}),$.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Z.manifest?.display||""),message:Z.manifest?.display?`Display mode: ${Z.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),$.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Z.manifest?.startUrl),message:Z.manifest?.startUrl?`Start URL: ${Z.manifest.startUrl}`:"Start URL not set"}),$.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Z.icons?.src),message:Z.icons?.src?`Icon source: ${Z.icons.src}`:"No icon source configured"});let Y=Z.icons?.sizes||[];$.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:Y.includes(192),message:Y.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),$.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:Y.includes(512),message:Y.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),$.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Z.icons?.purpose?.includes("maskable")||!1,message:Z.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),$.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Z.serviceWorker),message:Z.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),$.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Z.serviceWorker?.cacheVersion),message:Z.serviceWorker?.cacheVersion?`Cache version: ${Z.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),$.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Z.offline?.enabled===!0,message:Z.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let J=Z.routes||[];return $.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:J.length>0,message:J.length>0?`${J.length} route caching strategies configured`:"No custom caching strategies defined"}),$.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Z.push?.enabled||Boolean(Z.push?.vapidPublicKey),message:Z.push?.enabled?Z.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),$.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Z.shareTarget?.enabled?`Share target enabled at ${Z.shareTarget.action}`:"Share target not enabled"}),$.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Z.autoInject!==!1,message:Z.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),$}function yL(X){let $=[],Z=q$.join(X,"manifest.json"),Y=K5.existsSync(Z);if($.push({id:"build-manifest",name:"Manifest File",category:"required",passed:Y,message:Y?"manifest.json exists":"manifest.json not found in build output"}),Y)try{let W=JSON.parse(K5.readFileSync(Z,"utf-8"));$.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),$.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(W.icons)&&W.icons.length>0,message:W.icons?.length?`${W.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{$.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let J=q$.join(X,"sw.js"),G=K5.existsSync(J);$.push({id:"build-sw",name:"Service Worker File",category:"required",passed:G,message:G?"Service worker (sw.js) exists":"Service worker not found in build output"});let Q=q$.join(X,"offline.html"),q=K5.existsSync(Q);$.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:q,message:q?"Offline page exists":"No offline.html found"});let K=q$.join(X,"pwa-icons");if(K5.existsSync(K)){let W=K5.readdirSync(K).filter((w)=>w.endsWith(".png")||w.endsWith(".webp"));$.push({id:"build-icons",name:"Generated Icons",category:"required",passed:W.length>0,message:W.length>0?`${W.length} icon files generated`:"No icon files found"})}else $.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return $}function bL(X){let $=X.filter((K)=>K.category==="required"),Z=X.filter((K)=>K.category==="recommended"),Y=$.filter((K)=>K.passed).length,J=Z.filter((K)=>K.passed).length,G=$.length>0?Y/$.length*70:70,Q=Z.length>0?J/Z.length*30:30;return{score:Math.round(G+Q),passed:X.filter((K)=>K.passed).length,failed:X.filter((K)=>!K.passed&&K.category==="required").length,warnings:X.filter((K)=>!K.passed&&K.category!=="required").length,checks:X}}function aE(X,$){let Z=DL(X),Y=$&&K5.existsSync($)?yL($):[];return bL([...Z,...Y])}function tE(X){let $=[];$.push(`
16572
+ </html>`}function Q$(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}o5();s5();import U5 from"fs";import q$ from"path";function uL(X){let $=[],Z=X.pwa;if($.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Z?.enabled===!0,message:Z?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Z?.enabled)return $;$.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Z.manifest?.name),message:Z.manifest?.name?`App name: "${Z.manifest.name}"`:"Missing required manifest name"}),$.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Z.manifest?.shortName),message:Z.manifest?.shortName?`Short name: "${Z.manifest.shortName}"`:"Short name not set (will use full name)"}),$.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Z.manifest?.description),message:Z.manifest?.description?"Description is set":"App description not provided"}),$.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Z.manifest?.themeColor),message:Z.manifest?.themeColor?`Theme color: ${Z.manifest.themeColor}`:"Theme color not set"}),$.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Z.manifest?.backgroundColor),message:Z.manifest?.backgroundColor?`Background color: ${Z.manifest.backgroundColor}`:"Background color not set"}),$.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Z.manifest?.display||""),message:Z.manifest?.display?`Display mode: ${Z.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),$.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Z.manifest?.startUrl),message:Z.manifest?.startUrl?`Start URL: ${Z.manifest.startUrl}`:"Start URL not set"}),$.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Z.icons?.src),message:Z.icons?.src?`Icon source: ${Z.icons.src}`:"No icon source configured"});let Y=Z.icons?.sizes||[];$.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:Y.includes(192),message:Y.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),$.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:Y.includes(512),message:Y.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),$.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Z.icons?.purpose?.includes("maskable")||!1,message:Z.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),$.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Z.serviceWorker),message:Z.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),$.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Z.serviceWorker?.cacheVersion),message:Z.serviceWorker?.cacheVersion?`Cache version: ${Z.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),$.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Z.offline?.enabled===!0,message:Z.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let J=Z.routes||[];return $.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:J.length>0,message:J.length>0?`${J.length} route caching strategies configured`:"No custom caching strategies defined"}),$.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Z.push?.enabled||Boolean(Z.push?.vapidPublicKey),message:Z.push?.enabled?Z.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),$.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Z.shareTarget?.enabled?`Share target enabled at ${Z.shareTarget.action}`:"Share target not enabled"}),$.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Z.autoInject!==!1,message:Z.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),$}function dL(X){let $=[],Z=q$.join(X,"manifest.json"),Y=U5.existsSync(Z);if($.push({id:"build-manifest",name:"Manifest File",category:"required",passed:Y,message:Y?"manifest.json exists":"manifest.json not found in build output"}),Y)try{let W=JSON.parse(U5.readFileSync(Z,"utf-8"));$.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),$.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(W.icons)&&W.icons.length>0,message:W.icons?.length?`${W.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{$.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let J=q$.join(X,"sw.js"),G=U5.existsSync(J);$.push({id:"build-sw",name:"Service Worker File",category:"required",passed:G,message:G?"Service worker (sw.js) exists":"Service worker not found in build output"});let Q=q$.join(X,"offline.html"),q=U5.existsSync(Q);$.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:q,message:q?"Offline page exists":"No offline.html found"});let K=q$.join(X,"pwa-icons");if(U5.existsSync(K)){let W=U5.readdirSync(K).filter((w)=>w.endsWith(".png")||w.endsWith(".webp"));$.push({id:"build-icons",name:"Generated Icons",category:"required",passed:W.length>0,message:W.length>0?`${W.length} icon files generated`:"No icon files found"})}else $.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return $}function mL(X){let $=X.filter((K)=>K.category==="required"),Z=X.filter((K)=>K.category==="recommended"),Y=$.filter((K)=>K.passed).length,J=Z.filter((K)=>K.passed).length,G=$.length>0?Y/$.length*70:70,Q=Z.length>0?J/Z.length*30:30;return{score:Math.round(G+Q),passed:X.filter((K)=>K.passed).length,failed:X.filter((K)=>!K.passed&&K.category==="required").length,warnings:X.filter((K)=>!K.passed&&K.category!=="required").length,checks:X}}function HD(X,$){let Z=uL(X),Y=$&&U5.existsSync($)?dL($):[];return mL([...Z,...Y])}function OD(X){let $=[];$.push(`
16499
16573
  === PWA Audit Report ===
16500
16574
  `);let Z=X.score>=90?"32":X.score>=70?"33":"31";$.push(`Score: \x1B[${Z}m${X.score}/100\x1B[0m`),$.push(`Passed: ${X.passed} | Failed: ${X.failed} | Warnings: ${X.warnings}
16501
16575
  `);let Y=["required","recommended","optional"];for(let J of Y){let G=X.checks.filter((Q)=>Q.category===J);if(G.length===0)continue;$.push(`
16502
16576
  ${J.toUpperCase()}:`);for(let Q of G){let q=Q.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if($.push(` ${q} ${Q.name}: ${Q.message}`),Q.details)$.push(` ${Q.details}`)}}return $.push(""),$.join(`
16503
- `)}Q3();ZX();r5();o5();async function KD(X,$){let Z={success:!0,files:{icons:[]},errors:[],warnings:[]},Y=X.pwa;if(!Y?.enabled)return Z;try{SL.mkdirSync($,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${$}`),Z.success=!1,Z}try{let G=Z2(X);if(G){let Q=x4.join($,"manifest.json");await Bun.write(Q,G),Z.files.manifest=Q}}catch(G){let Q=G instanceof Error?G.message:String(G);Z.errors.push(`Failed to generate manifest.json: ${Q}`),Z.success=!1}if(Y.icons?.src)if(await c4()){let Q=await l4(X,$);if(Z.files.icons=Q.generatedFiles,Z.warnings.push(...Q.warnings),!Q.success)Z.errors.push(...Q.errors),Z.success=!1}else Z.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(Y.offline?.enabled)try{let G=await OK(X);if(G){let Q=x4.join($,"offline.html");await Bun.write(Q,G),Z.files.offlinePage=Q}}catch(G){let Q=G instanceof Error?G.message:String(G);Z.errors.push(`Failed to generate offline page: ${Q}`),Z.success=!1}let J;if(Y.precache?.enabled){let G=f1($,X);J={fileCount:G.fileCount,totalSize:G.totalSize},Z.precacheStats=J}try{let G=XX(X,$);if(G){let Q=z5(X),q=x4.join($,Q);await Bun.write(q,G),Z.files.serviceWorker=q}}catch(G){let Q=G instanceof Error?G.message:String(G);Z.errors.push(`Failed to generate service worker: ${Q}`),Z.success=!1}return Z}function UD(X,$){return z$(X,$)}function WD(X){return X.pwa?.enabled===!0}export{nL as validateManifest,aE as runPwaAudit,YT as registerPwaDirectives,Wj as pwaUpdateDirective,zj as pwaPushDirective,wj as pwaOfflineDirective,Uj as pwaInstallDirective,G3 as pwaDirectives,UD as processPwaHtml,iL as mergeManifestConfig,X2 as isWorkboxEnabled,c4 as isSharpAvailable,WD as isPwaEnabled,z$ as injectPwaTags,z5 as getServiceWorkerFileName,xL as getExpectedIconPaths,pK as generateThemeColorMeta,lK as generateSwRegistrationScript,mK as generateServiceWorkerAuto,XX as generateServiceWorker,$X as generatePwaTags,l4 as generatePwaIcons,e7 as generatePrecacheManifestJs,f1 as generatePrecacheManifest,OK as generateOfflinePage,cK as generateManifestLink,Z2 as generateManifestJson,aK as generateManifest,i4 as formatSize,tE as formatAuditResult,bL as calculateAuditResult,KD as buildPwaAssets,DL as auditConfig,yL as auditBuildOutput,m4 as FAVICON_SIZES,u4 as DEFAULT_ICON_SIZES,d4 as APPLE_TOUCH_ICON_SIZES};
16577
+ `)}j3();YX();o5();s5();async function ID(X,$){let Z={success:!0,files:{icons:[]},errors:[],warnings:[]},Y=X.pwa;if(!Y?.enabled)return Z;try{lL.mkdirSync($,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${$}`),Z.success=!1,Z}try{let G=U2(X);if(G){let Q=l4.join($,"manifest.json");await Bun.write(Q,G),Z.files.manifest=Q}}catch(G){let Q=G instanceof Error?G.message:String(G);Z.errors.push(`Failed to generate manifest.json: ${Q}`),Z.success=!1}if(Y.icons?.src)if(await a4()){let Q=await s4(X,$);if(Z.files.icons=Q.generatedFiles,Z.warnings.push(...Q.warnings),!Q.success)Z.errors.push(...Q.errors),Z.success=!1}else Z.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(Y.offline?.enabled)try{let G=await EK(X);if(G){let Q=l4.join($,"offline.html");await Bun.write(Q,G),Z.files.offlinePage=Q}}catch(G){let Q=G instanceof Error?G.message:String(G);Z.errors.push(`Failed to generate offline page: ${Q}`),Z.success=!1}let J;if(Y.precache?.enabled){let G=f1($,X);J={fileCount:G.fileCount,totalSize:G.totalSize},Z.precacheStats=J}try{let G=$X(X,$);if(G){let Q=j5(X),q=l4.join($,Q);await Bun.write(q,G),Z.files.serviceWorker=q}}catch(G){let Q=G instanceof Error?G.message:String(G);Z.errors.push(`Failed to generate service worker: ${Q}`),Z.success=!1}return Z}function ED(X,$){return z$(X,$)}function DD(X){return X.pwa?.enabled===!0}export{JF as validateManifest,HD as runPwaAudit,AN as registerPwaDirectives,Aj as pwaUpdateDirective,Nj as pwaPushDirective,Rj as pwaOfflineDirective,Vj as pwaInstallDirective,z3 as pwaDirectives,ED as processPwaHtml,YF as mergeManifestConfig,q2 as isWorkboxEnabled,a4 as isSharpAvailable,DD as isPwaEnabled,z$ as injectPwaTags,j5 as getServiceWorkerFileName,nL as getExpectedIconPaths,ZU as generateThemeColorMeta,XU as generateSwRegistrationScript,eK as generateServiceWorkerAuto,$X as generateServiceWorker,ZX as generatePwaTags,s4 as generatePwaIcons,XX as generatePrecacheManifestJs,f1 as generatePrecacheManifest,EK as generateOfflinePage,$U as generateManifestLink,U2 as generateManifestJson,KU as generateManifest,e4 as formatSize,OD as formatAuditResult,mL as calculateAuditResult,ID as buildPwaAssets,uL as auditConfig,dL as auditBuildOutput,o4 as FAVICON_SIZES,n4 as DEFAULT_ICON_SIZES,r4 as APPLE_TOUCH_ICON_SIZES};