@stacksjs/stx 0.2.159 → 0.2.161

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/pwa.js CHANGED
@@ -1,26 +1,26 @@
1
1
  // @bun
2
- var{defineProperty:m7,getOwnPropertyNames:WK,getOwnPropertyDescriptor:zK}=Object,UK=Object.prototype.hasOwnProperty;function jK($){return this[$]}var t9=($)=>{var Z=(a9??=new WeakMap).get($),Y;if(Z)return Z;if(Z=m7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of WK($))if(!UK.call(Z,X))m7(Z,X,{get:jK.bind($,X),enumerable:!(Y=zK($,X))||Y.enumerable})}return a9.set($,Z),Z},a9;var BK=($)=>$;function HK($,Z){this[$]=BK.bind(null,Z)}var o=($,Z)=>{for(var Y in Z)m7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:HK.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var W0=import.meta.require;import x$ from"fs";import f$ from"path";function FK($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$[Y];Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(16).padStart(8,"0")}function LK($,Z){let Y=f$.basename($);for(let X of Z)if(X.startsWith("*.")){let J=X.slice(1);if(Y.endsWith(J))return!0}else if(X.includes("*")){let J=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(J.test(Y)||J.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function VK($,Z,Y){let X=f$.extname($).toLowerCase(),J=OK[X],Q=(Y.maxFileSizeKB||500)*1024;if(Z>Q)return!1;if(Y.exclude&&LK($,Y.exclude))return!1;if(Y.include&&Y.include.length>0){for(let G of Y.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(J&&Y[J]===!0)return!0;if(!J)return!1;return!1}function J8($,Z,Y,X){let J=x$.readdirSync($,{withFileTypes:!0});for(let Q of J){let G=f$.join($,Q.name);if(Q.isDirectory()){if(["node_modules",".git",".stx"].includes(Q.name))continue;J8(G,Z,Y,X)}else if(Q.isFile()){let K=x$.statSync(G),q=f$.relative(Z,G);if(VK(q,K.size,Y)){let W=x$.readFileSync(G),z=FK(W),U=`/${q.replace(/\\/g,"/")}`;X.push({url:U,revision:z,size:K.size})}}}}function f1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!x$.existsSync($))return{entries:[],totalSize:0,fileCount:0};J8($,$,Y,X),X.sort((Q,G)=>Q.url.localeCompare(G.url));let J=X.reduce((Q,G)=>Q+G.size,0);return{entries:X,totalSize:J,fileCount:X.length}}function g$($){if($.entries.length===0)return"[]";return`[
2
+ var{defineProperty:m7,getOwnPropertyNames:zK,getOwnPropertyDescriptor:UK}=Object,jK=Object.prototype.hasOwnProperty;function BK($){return this[$]}var t9=($)=>{var Z=(a9??=new WeakMap).get($),Y;if(Z)return Z;if(Z=m7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of zK($))if(!jK.call(Z,X))m7(Z,X,{get:BK.bind($,X),enumerable:!(Y=UK($,X))||Y.enumerable})}return a9.set($,Z),Z},a9;var HK=($)=>$;function _K($,Z){this[$]=HK.bind(null,Z)}var o=($,Z)=>{for(var Y in Z)m7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:_K.bind(Z,Y)})};var b=($,Z)=>()=>($&&(Z=$($=0)),Z);var W0=import.meta.require;import x$ from"fs";import f$ from"path";function LK($){let Z=0;for(let Y=0;Y<$.length;Y++){let X=$[Y];Z=(Z<<5)-Z+X,Z=Z&Z}return Math.abs(Z).toString(16).padStart(8,"0")}function VK($,Z){let Y=f$.basename($);for(let X of Z)if(X.startsWith("*.")){let J=X.slice(1);if(Y.endsWith(J))return!0}else if(X.includes("*")){let J=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(J.test(Y)||J.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function wK($,Z,Y){let X=f$.extname($).toLowerCase(),J=FK[X],Q=(Y.maxFileSizeKB||500)*1024;if(Z>Q)return!1;if(Y.exclude&&VK($,Y.exclude))return!1;if(Y.include&&Y.include.length>0){for(let G of Y.include)if(G.startsWith("*.")){if($.endsWith(G.slice(1)))return!0}else if($.includes(G))return!0}if(J&&Y[J]===!0)return!0;if(!J)return!1;return!1}function J8($,Z,Y,X){let J=x$.readdirSync($,{withFileTypes:!0});for(let Q of J){let G=f$.join($,Q.name);if(Q.isDirectory()){if(["node_modules",".git",".stx"].includes(Q.name))continue;J8(G,Z,Y,X)}else if(Q.isFile()){let K=x$.statSync(G),q=f$.relative(Z,G);if(wK(q,K.size,Y)){let W=x$.readFileSync(G),z=LK(W),U=`/${q.replace(/\\/g,"/")}`;X.push({url:U,revision:z,size:K.size})}}}}function f1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!x$.existsSync($))return{entries:[],totalSize:0,fileCount:0};J8($,$,Y,X),X.sort((Q,G)=>Q.url.localeCompare(G.url));let J=X.reduce((Q,G)=>Q+G.size,0);return{entries:X,totalSize:J,fileCount:X.length}}function g$($){if($.entries.length===0)return"[]";return`[
3
3
  ${$.entries.map((Y)=>` { url: '${Y.url}', revision: '${Y.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function Q8($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var OK;var p5=b(()=>{OK={".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 wK($){let Z={"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 Z[$]||Z["network-first"]}function d7($){return wK($).className}function G8($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,J=[];for(let Q of Y){let G=d7(Q.strategy),K=[];if(Q.maxAgeSeconds||Q.maxEntries||X?.maxEntries){let W=Q.maxEntries||X?.maxEntries||100,z=Q.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
5
+ ]`}function Q8($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var FK;var p5=b(()=>{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 RK($){let Z={"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 Z[$]||Z["network-first"]}function d7($){return RK($).className}function G8($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,J=[];for(let Q of Y){let G=d7(Q.strategy),K=[];if(Q.maxAgeSeconds||Q.maxEntries||X?.maxEntries){let W=Q.maxEntries||X?.maxEntries||100,z=Q.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
6
6
  maxEntries: ${W},
7
7
  ${z?`maxAgeSeconds: ${z},`:""}
8
8
  purgeOnQuotaError: true,
9
9
  })`)}if(Q.strategy==="network-first"||Q.strategy==="stale-while-revalidate")K.push(`new CacheableResponsePlugin({
10
10
  statuses: [0, 200],
11
- })`);let q=RK(Q.pattern);J.push(`
11
+ })`);let q=NK(Q.pattern);J.push(`
12
12
  // ${Q.pattern}
13
13
  registerRoute(
14
14
  ${q},
15
15
  new ${G}({
16
- cacheName: '${Q.cacheName||AK(Q.pattern)}',
16
+ cacheName: '${Q.cacheName||MK(Q.pattern)}',
17
17
  ${K.length>0?`plugins: [
18
18
  ${K.join(`,
19
19
  `)}
20
20
  ],`:""}
21
21
  })
22
22
  );`)}return J.join(`
23
- `)}function RK($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${NK(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${MK($).replace(/\\\*/g,".*")}')`}function NK($){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"}[$.toLowerCase()]||"empty"}function AK($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function MK($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var z8={};o(z8,{isWorkboxEnabled:()=>W8,getServiceWorkerGenerator:()=>kK,generateWorkboxServiceWorker:()=>q8,generateWorkboxConfig:()=>K8});function K8($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Y.serviceWorker||{},J=Y.routes||[],Q=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let W of J)G.add(d7(W.strategy));if(G.size>0)Q.push({name:"workbox-strategies",exports:Array.from(G)});if(J.some((W)=>W.maxAgeSeconds||W.maxEntries)||Y.cacheStorage)Q.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(J.some((W)=>W.strategy==="network-first"||W.strategy==="stale-while-revalidate"))Q.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)Q.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)Q.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?f1(Z,$):void 0;return{mode:"generate",modules:Q,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Y.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function q8($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=K8($,Z),J=Y.serviceWorker||{},Q=Y.push,G=Y.backgroundSync,K=Z?f1(Z,$):null,q=K?g$(K):"[]",W=TK(X.modules),z=G8($);return`/**
23
+ `)}function NK($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${AK(Z)}'`}if($.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${$.slice(0,-3)}')`;if($.endsWith("/*")){let Z=$.slice(0,-2);return`({ url }) => url.pathname.startsWith('${Z}') && !url.pathname.slice(${Z.length+1}).includes('/')`}if($.includes("*")&&!$.startsWith("*")){let[Z,Y]=$.split("*");return`({ url }) => url.pathname.startsWith('${Z}') && url.pathname.endsWith('${Y}')`}if($==="/"||!$.includes("*"))return`({ url }) => url.pathname === '${$}'`;return`new RegExp('${TK($).replace(/\\\*/g,".*")}')`}function AK($){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"}[$.toLowerCase()]||"empty"}function MK($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function TK($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var z8={};o(z8,{isWorkboxEnabled:()=>W8,getServiceWorkerGenerator:()=>bK,generateWorkboxServiceWorker:()=>q8,generateWorkboxConfig:()=>K8});function K8($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Y.serviceWorker||{},J=Y.routes||[],Q=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let W of J)G.add(d7(W.strategy));if(G.size>0)Q.push({name:"workbox-strategies",exports:Array.from(G)});if(J.some((W)=>W.maxAgeSeconds||W.maxEntries)||Y.cacheStorage)Q.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(J.some((W)=>W.strategy==="network-first"||W.strategy==="stale-while-revalidate"))Q.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)Q.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)Q.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?f1(Z,$):void 0;return{mode:"generate",modules:Q,precacheManifest:q?.entries,skipWaiting:X.skipWaiting??!0,clientsClaim:X.clientsClaim??!0,offlineFallback:Y.offline?.enabled?"/offline.html":void 0,navigationPreload:X.navigationPreload??!1,cacheVersion:X.cacheVersion||"1.0.0"}}function q8($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=K8($,Z),J=Y.serviceWorker||{},Q=Y.push,G=Y.backgroundSync,K=Z?f1(Z,$):null,q=K?g$(K):"[]",W=IK(X.modules),z=G8($);return`/**
24
24
  * Service Worker - Generated by stx with Workbox
25
25
  * Cache Version: ${X.cacheVersion}
26
26
  *
@@ -169,13 +169,13 @@ self.addEventListener('message', (event) => {
169
169
  }
170
170
  });
171
171
 
172
- ${Q?.enabled?DK(Q):"// Push notifications disabled"}
172
+ ${Q?.enabled?EK(Q):"// Push notifications disabled"}
173
173
 
174
- ${G?.enabled?EK(G):"// Background sync disabled"}
174
+ ${G?.enabled?kK(G):"// Background sync disabled"}
175
175
 
176
176
  console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
177
- `}function TK($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${IK(X)};`)}return Z.join(`
178
- `)}function IK($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function DK($){return`
177
+ `}function IK($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${DK(X)};`)}return Z.join(`
178
+ `)}function DK($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function EK($){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 EK($){return`
247
+ `}function kK($){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 W8($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function kK($){if(W8($))return q8;let{generateServiceWorker:Z}=(l5(),t9(j8));return Z}var U8=b(()=>{p5()});var j8={};o(j8,{isWorkboxEnabled:()=>B8,getServiceWorkerFileName:()=>U5,generateServiceWorkerAuto:()=>yK,generateServiceWorker:()=>h$});function h$($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Y.serviceWorker||{},J=Y.routes||[],Q=X.cacheVersion||"1.0.0",G=Y.offline,K=G?.page?"/offline.html":"/offline.html",q=Y.push,W=Y.backgroundSync,z=Y.cacheStorage,U=Z?f1(Z,$):null,j=U?g$(U):"[]",H=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
309
+ `}function W8($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function bK($){if(W8($))return q8;let{generateServiceWorker:Z}=(l5(),t9(j8));return Z}var U8=b(()=>{p5()});var j8={};o(j8,{isWorkboxEnabled:()=>B8,getServiceWorkerFileName:()=>U5,generateServiceWorkerAuto:()=>PK,generateServiceWorker:()=>h$});function h$($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Y.serviceWorker||{},J=Y.routes||[],Q=X.cacheVersion||"1.0.0",G=Y.offline,K=G?.page?"/offline.html":"/offline.html",q=Y.push,W=Y.backgroundSync,z=Y.cacheStorage,U=Z?f1(Z,$):null,j=U?g$(U):"[]",H=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
310
310
  * Service Worker - Auto-generated by stx
311
311
  * Cache Version: ${Q}
312
312
  *
@@ -501,9 +501,9 @@ self.addEventListener('message', (event) => {
501
501
  }
502
502
  });
503
503
 
504
- ${q?.enabled?bK():"// Push notifications disabled"}
504
+ ${q?.enabled?SK():"// Push notifications disabled"}
505
505
 
506
- ${W?.enabled?SK():"// Background sync disabled"}
506
+ ${W?.enabled?yK():"// 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 bK(){return`
871
+ `}function SK(){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 SK(){return`
953
+ `}function yK(){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 U5($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function B8($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function yK($,Z){if(!$.pwa?.enabled)return"";if(B8($)){let{generateWorkboxServiceWorker:Y}=(U8(),t9(z8));return Y($,Z)}return h$($,Z)}var l5=b(()=>{p5()});var H8={};o(H8,{injectPwaTags:()=>p7,generateThemeColorMeta:()=>vK,generateSwRegistrationScript:()=>PK,generatePwaTags:()=>m$,generateManifestLink:()=>CK});function m$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",J=U5($),Q=`
1135
+ `}function U5($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function B8($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function PK($,Z){if(!$.pwa?.enabled)return"";if(B8($)){let{generateWorkboxServiceWorker:Y}=(U8(),t9(z8));return Y($,Z)}return h$($,Z)}var l5=b(()=>{p5()});var H8={};o(H8,{injectPwaTags:()=>p7,generateThemeColorMeta:()=>xK,generateSwRegistrationScript:()=>CK,generatePwaTags:()=>m$,generateManifestLink:()=>vK});function m$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",J=U5($),Q=`
1136
1136
  <!-- stx PWA Meta Tags -->
1137
1137
  <link rel="manifest" href="/manifest.json">
1138
1138
  <meta name="theme-color" content="${u7(Y?.themeColor||"#000000")}">
@@ -1178,7 +1178,7 @@ if ('serviceWorker' in navigator) {
1178
1178
  </script>
1179
1179
  <!-- End stx PWA -->`,Q}function p7($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let J=$.lastIndexOf("</body>");if(J!==-1){let Q=m$(Z);return $.slice(0,J)+Q+`
1180
1180
  `+$.slice(J)}return $+m$(Z)}let X=m$(Z);return $.replace("</head>",`${X}
1181
- </head>`)}function PK($){if(!$.pwa?.enabled)return"";return`<script>
1181
+ </head>`)}function CK($){if(!$.pwa?.enabled)return"";return`<script>
1182
1182
  if ('serviceWorker' in navigator) {
1183
1183
  window.addEventListener('load', function() {
1184
1184
  navigator.serviceWorker.register('/${U5($)}')
@@ -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 vK($){return`<meta name="theme-color" content="${u7($)}">`}function u7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var d$=b(()=>{l5()});function O8($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function l7($,Z){let Y={...$};for(let[X,J]of Object.entries(Z))Y[X]=O8(J)&&O8(Y[X])?l7(Y[X],J):J;return Y}function F8($={},Z={}){let Y=$.theme||{},X=Z.theme||{},{extend:J,...Q}=X,{extend:G,...K}=Y,q=l7(K,Q),W=l7(G||{},J||{});if(Object.keys(W).length>0)q.extend=W;let z=[...$.safelist||[],...Z.safelist||[]],U={...$.shortcuts||{},...Z.shortcuts||{}},j=[...$.preflights||[],...Z.preflights||[]];return{config:{...$,...Z,theme:q,safelist:z,shortcuts:U,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:z,shortcuts:U,includePreflight:Z.preflight!==!1,minify:Z.minify===!0}}import c5 from"path";function V8($){L8=$?.trim()||null}function i5(){return process.env[uK]?.trim()||L8||j5}function n5($=process.cwd(),...Z){let Y=i5();return c5.isAbsolute(Y)?c5.join(Y,...Z):c5.join($,Y,...Z)}function o5($){if(!$||c5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==j5&&!Z.startsWith(`${j5}/`))return $;let Y=Z.slice(j5.length+1);return Y?c5.join(i5(),Y):i5()}var j5=".stx",uK="STX_DIR",L8=null;var u$=()=>{};var w0;var w8=b(()=>{w0={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 R8($,Z,Y,X){let J=$;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let z={"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"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||z} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),J}var N8,A8;var c7=b(()=>{N8={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let J=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${Q||K} -->${$}`},hasEndTag:!1},A8={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function pK($,Z={}){let{duration:Y,delay:X,ease:J,direction:Q,custom:G}={...q1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="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 vK(){return'<link rel="manifest" href="/manifest.json">'}function xK($){return`<meta name="theme-color" content="${u7($)}">`}function u7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var d$=b(()=>{l5()});function O8($){return typeof $==="object"&&$!==null&&!Array.isArray($)}function l7($,Z){let Y={...$};for(let[X,J]of Object.entries(Z))Y[X]=O8(J)&&O8(Y[X])?l7(Y[X],J):J;return Y}function F8($={},Z={}){let Y=$.theme||{},X=Z.theme||{},{extend:J,...Q}=X,{extend:G,...K}=Y,q=l7(K,Q),W=l7(G||{},J||{});if(Object.keys(W).length>0)q.extend=W;let z=[...$.safelist||[],...Z.safelist||[]],U={...$.shortcuts||{},...Z.shortcuts||{}},j=[...$.preflights||[],...Z.preflights||[]];return{config:{...$,...Z,theme:q,safelist:z,shortcuts:U,...j.length>0?{preflights:j}:{},content:[],output:""},safelist:z,shortcuts:U,includePreflight:Z.preflight!==!1,minify:Z.minify===!0}}import c5 from"path";function V8($){L8=$?.trim()||null}function i5(){return process.env[pK]?.trim()||L8||j5}function n5($=process.cwd(),...Z){let Y=i5();return c5.isAbsolute(Y)?c5.join(Y,...Z):c5.join($,Y,...Z)}function o5($){if(!$||c5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==j5&&!Z.startsWith(`${j5}/`))return $;let Y=Z.slice(j5.length+1);return Y?c5.join(i5(),Y):i5()}var j5=".stx",pK="STX_DIR",L8=null;var u$=()=>{};var w0;var w8=b(()=>{w0={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 R8($,Z,Y,X){let J=$;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let z={"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"}[K]||"Make this element accessible";return`<!-- a11y-hint: ${q||z} -->`});let Q=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(Q,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),J}var N8,A8;var c7=b(()=>{N8={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let J=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"",K={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${Q||K} -->${$}`},hasEndTag:!1},A8={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function lK($,Z={}){let{duration:Y,delay:X,ease:J,direction:Q,custom:G}={...q1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${Q==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="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`${Q==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="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`${Q==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":Q==="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 lK(){return`
1203
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function cK(){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 cK($){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((Y)=>Y.test($))}function iK($=0.1,Z="0px"){return`
1231
+ `}function iK($){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((Y)=>Y.test($))}function nK($=0.1,Z="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 nK(){return`
1274
+ `}function oK(){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 oK($,Z,Y={}){let{staggerDelay:X=50,sequence:J=!1}=Y;return`
1389
+ `}function sK($,Z,Y={}){let{staggerDelay:X=50,sequence:J=!1}=Y;return`
1390
1390
  <script data-stx-scoped data-stx-run="always">
1391
1391
  // Animation Group: ${$}
1392
1392
  (function() {
@@ -1423,11 +1423,11 @@ else {
1423
1423
  }
1424
1424
  })();
1425
1425
  </script>
1426
- `}function E8($,Z,Y,X){let J=$;if(X.animation?.enabled===!1)return J;let Q=Y.includes("test")&&Y.includes("animation");if(!cK(J)&&!Q)return J;if(!J.includes('<style id="stx-animation-base">')){let K=nK();J=J.replace("</head>",`${K}
1427
- </head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let q=iK(),W=J.lastIndexOf("</body>");if(W!==-1)J=J.slice(0,W)+q+`
1428
- `+J.slice(W)}}return J}var q1,M8,T8,I8,D8;var i7=b(()=>{q1={duration:300,delay:0,ease:"ease",direction:"both"};M8={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let J=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||q1.duration:q1.duration,G=Z.length>2?Z[2]||q1.ease:q1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||q1.delay:q1.delay,q=Z.length>4?Z[4]||q1.direction:q1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,z=pK(J,{duration:Q,delay:K,ease:G,direction:q}),U="stx-transition",j="";if(J==="fade")j="stx-fade";else if(J==="slide")j="stx-slide";else if(J==="scale")j="stx-scale";else if(J==="flip")j="stx-flip";else if(J==="rotate")j="stx-rotate";return`<div id="${W}" class="${U} ${j} ${q==="out"?"stx-out":""}"
1429
- style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},T8={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let J=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,z=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(J==="fade")U+=" stx-fade";else if(J==="slide-up"||J==="slide")U+=" stx-from-bottom";else if(J==="slide-down")U+=" stx-from-top";else if(J==="slide-left")U+=" stx-from-right";else if(J==="slide-right")U+=" stx-from-left";else if(J==="scale")U+=" stx-scale";else if(J.includes("-"))U+=` stx-${J}`;else U+=` stx-${J}`;return`<div id="${W}" class="${U}" style="${z}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},I8={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let J=Z[0],Q=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=oK(J,Q,{staggerDelay:G,sequence:K});return`${$}
1430
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},D8={name:"motion",handler:($,Z,Y,X)=>{let J=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=lK();return`<div data-animate="${J?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as k8}from"stx-router";var b8=b(()=>{n7()});async function sK($,Z,Y,X){let J=Z[0]?.replace(/['"]/g,"")||"main",Q=k8();if(J!=="main")Q=Q.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${Q}</script>`}var S8;var n7=b(()=>{b8();S8={name:"stxRouter",handler:sK,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function y8($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...rK,...Z};return`
1426
+ `}function E8($,Z,Y,X){let J=$;if(X.animation?.enabled===!1)return J;let Q=Y.includes("test")&&Y.includes("animation");if(!iK(J)&&!Q)return J;if(!J.includes('<style id="stx-animation-base">')){let K=oK();J=J.replace("</head>",`${K}
1427
+ </head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let q=nK(),W=J.lastIndexOf("</body>");if(W!==-1)J=J.slice(0,W)+q+`
1428
+ `+J.slice(W)}}return J}var q1,M8,T8,I8,D8;var i7=b(()=>{q1={duration:300,delay:0,ease:"ease",direction:"both"};M8={name:"transition",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${$}`;let J=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||q1.duration:q1.duration,G=Z.length>2?Z[2]||q1.ease:q1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||q1.delay:q1.delay,q=Z.length>4?Z[4]||q1.direction:q1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,z=lK(J,{duration:Q,delay:K,ease:G,direction:q}),U="stx-transition",j="";if(J==="fade")j="stx-fade";else if(J==="slide")j="stx-slide";else if(J==="scale")j="stx-scale";else if(J==="flip")j="stx-flip";else if(J==="rotate")j="stx-rotate";return`<div id="${W}" class="${U} ${j} ${q==="out"?"stx-out":""}"
1429
+ style="--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},T8={name:"scrollAnimate",handler:($,Z,Y,X)=>{if(Z.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${$}`;let J=Z[0],Q=Z.length>1?Number.parseInt(Z[1],10)||300:300,G=Z.length>2?Z[2]||"ease":"ease",K=Z.length>3?Number.parseFloat(Z[3])||0.2:0.2,q=Z.length>4?Number.parseInt(Z[4],10)||0:0,W=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,z=`--stx-transition-duration: ${Q}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(J==="fade")U+=" stx-fade";else if(J==="slide-up"||J==="slide")U+=" stx-from-bottom";else if(J==="slide-down")U+=" stx-from-top";else if(J==="slide-left")U+=" stx-from-right";else if(J==="slide-right")U+=" stx-from-left";else if(J==="scale")U+=" stx-scale";else if(J.includes("-"))U+=` stx-${J}`;else U+=` stx-${J}`;return`<div id="${W}" class="${U}" style="${z}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},I8={name:"animationGroup",handler:($,Z,Y,X)=>{if(Z.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${$}`;let J=Z[0],Q=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=sK(J,Q,{staggerDelay:G,sequence:K});return`${$}
1430
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},D8={name:"motion",handler:($,Z,Y,X)=>{let J=Z.length>0?Z[0].toLowerCase()==="true":!0,Q=cK();return`<div data-animate="${J?"auto":"true"}">${$}</div>${Q}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as k8}from"stx-router";var b8=b(()=>{n7()});async function rK($,Z,Y,X){let J=Z[0]?.replace(/['"]/g,"")||"main",Q=k8();if(J!=="main")Q=Q.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${Q}</script>`}var S8;var n7=b(()=>{b8();S8={name:"stxRouter",handler:rK,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function y8($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...aK,...Z};return`
1431
1431
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1432
1432
  <script>
1433
1433
  (function() {
@@ -1810,7 +1810,7 @@ else {
1810
1810
  };
1811
1811
  })();
1812
1812
  </script>
1813
- `}function P8($,Z){let Y=y8(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function aK($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[J,Q]=X.split("="),G=Q?.replace(/["']/g,"");switch(J){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var rK,C8;var o7=b(()=>{rK={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};C8={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let J=Y.__stx_config||{};if(Z.length>0){let Q=aK(Z.join(" "));J.heatmap={...J.heatmap,...Q,enabled:!0}}return y8(J)}}});function L1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function v8($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function x8($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],J=$.slice(Y[0].length),Q={};for(let G of X.split(`
1813
+ `}function P8($,Z){let Y=y8(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function tK($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[J,Q]=X.split("="),G=Q?.replace(/["']/g,"");switch(J){case"endpoint":Z.endpoint=G;break;case"samplingRate":Z.samplingRate=Number.parseInt(G,10);break;case"batchSize":Z.batchSize=Number.parseInt(G,10);break;case"trackMouse":Z.trackMouse=G==="true";break;case"trackClicks":Z.trackClicks=G==="true";break;case"trackScroll":Z.trackScroll=G==="true";break;case"honorDnt":Z.honorDnt=G==="true";break;case"debugOverlay":Z.debugOverlay=G==="true";break}}return Z}var aK,C8;var o7=b(()=>{aK={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};C8={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let J=Y.__stx_config||{};if(Z.length>0){let Q=tK(Z.join(" "));J.heatmap={...J.heatmap,...Q,enabled:!0}}return y8(J)}}});function L1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function v8($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function x8($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],J=$.slice(Y[0].length),Q={};for(let G of X.split(`
1814
1814
  `)){let K=G.trim();if(!K||K.startsWith("#"))continue;let q=K.indexOf(":");if(q===-1)continue;let W=K.slice(0,q).trim(),z=K.slice(q+1).trim();if(typeof z==="string"){if(z.startsWith('"')&&z.endsWith('"')||z.startsWith("'")&&z.endsWith("'"))z=z.slice(1,-1);else if(z.startsWith("[")&&z.endsWith("]"))try{z=JSON.parse(z)}catch{}else if(z==="true")z=!0;else if(z==="false")z=!1;else if(/^-?\d+(?:\.\d+)?$/.test(z))z=Number(z)}Q[W]=z}return{data:Q,content:J.trim()}}function s5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,J=$,Q=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(z,U,j)=>{let H=Q.length,B=U?` class="language-${L1(U)}"`:"";return Q.push(`<pre><code${B}>${L1(j.trim())}</code></pre>`),`\x00CODEBLOCK${H}\x00`}),J=J.replace(/`([^`]*)`/g,(z,U)=>`<code>${L1(U)}</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>"),Y)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(z,U,j)=>{return`<img src="${v8(j)?L1(j):""}" alt="${L1(U)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(z,U,j)=>{return`<a href="${v8(j)?L1(j):""}">${U}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
1815
1815
  `),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>"),Y)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(z,U,j)=>{let B=`<tr>${U.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<th>${L1(O)}</th>`).join("")}</tr>`,_=j.trim().split(`
1816
1816
  `).map((O)=>{return`<tr>${O.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<td>${L1(L)}</td>`).join("")}</tr>`}).join(`
@@ -1828,7 +1828,7 @@ ${_}
1828
1828
  `:`
1829
1829
  `)}</p>`);if(J=K.join(`
1830
1830
  `),X)J=J.replace(/\n/g,`<br />
1831
- `);for(let z=0;z<Q.length;z++)J=J.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function B5($="const",Z=[],Y){let X=Z.length?W1.filter((J)=>!Z.includes(J)):W1;if(Y!==void 0)X=X.filter((J)=>{let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}function s7($){if(!$)return!1;return eK.some((Z)=>new RegExp(`\\b${Z}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function r7($){if(!$)return!1;let Z=u8($);if($q.some((Y)=>Y.test(Z)))return!0;return s7(Z)}function g8($){if(!$)return!1;return Zq.test(u8($))||r7($)}function d8(){return`{${h8.map(($)=>`'${$}':1`).join(",")}}`}function u8($){if(!$)return $;let Z=(Y)=>Y.replace(/(<[^>]*>)|([^<]+)/g,(X,J,Q)=>J??" ".repeat(Q.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Y,X,J,Q)=>X+Z(J)+Q).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Y,X,J,Q)=>X+Z(J)+Q).replace(/<!--[\s\S]*?-->/g,(Y)=>" ".repeat(Y.length))}var W1,f8,tK,eK,$q,Zq,h8,Yq,m8;var $1=b(()=>{W1=["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"],f8=["onMount","onDestroy"];tK=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],eK=W1.filter(($)=>!tK.includes($));$q=[/@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/],Zq=/\s@[a-z][\w.:-]*\s*=/i;h8=["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"],Yq=["x-init","x-transition","x-effect","x-on"],m8=[...h8,...Yq]});function c8($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let X=Y.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(Xq.has(X))Z.systemKeys.push(X);else if(X in i8)Z.mouse=X;else if(X in l8||/^[a-z]$/.test(X))Z.keys.push(l8[X]||X.toUpperCase());else if(X.startsWith("debounce")){let J=X.match(/debounce(?:\.(\d+))?/);Z.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(X.startsWith("throttle")){let J=X.match(/throttle(?:\.(\d+))?/);Z.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return Z}function n8($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=X.exec($))!==null){let[Q,G,K]=J,q=J.index,W=q+Q.length,z=`__stx_evt_${Y++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,H;while((H=j.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!p8.has(L))continue;U.push({attribute:`@${_}`,event:L,handler:O,modifiers:c8(F.slice(1)),elementId:z})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((H=B.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!p8.has(L))continue;U.push({attribute:`@${_}`,event:L,handler:O,modifiers:c8(F.slice(1)),elementId:z})}if(U.length>0)Z.push({originalTag:Q,elementId:z,events:U,startIndex:q,endIndex:W})}return Z}function Jq($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=i8[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Qq($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function a7($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function Gq($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=Jq($),J=Qq(a7($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
1831
+ `);for(let z=0;z<Q.length;z++)J=J.replace(`\x00CODEBLOCK${z}\x00`,Q[z]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function B5($="const",Z=[],Y){let X=Z.length?W1.filter((J)=>!Z.includes(J)):W1;if(Y!==void 0)X=X.filter((J)=>{let Q=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${Q}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}function s7($){if(!$)return!1;return $q.some((Z)=>new RegExp(`\\b${Z}\\s*(?:<[^>]*>)?\\s*\\(`).test($))}function r7($){if(!$)return!1;let Z=u8($);if(Zq.some((Y)=>Y.test(Z)))return!0;return s7(Z)}function g8($){if(!$)return!1;return Yq.test(u8($))||r7($)}function d8(){return`{${h8.map(($)=>`'${$}':1`).join(",")}}`}function u8($){if(!$)return $;let Z=(Y)=>Y.replace(/(<[^>]*>)|([^<]+)/g,(X,J,Q)=>J??" ".repeat(Q.length));return $.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Y,X,J,Q)=>X+Z(J)+Q).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Y,X,J,Q)=>X+Z(J)+Q).replace(/<!--[\s\S]*?-->/g,(Y)=>" ".repeat(Y.length))}var W1,f8,eK,$q,Zq,Yq,h8,Xq,m8;var $1=b(()=>{W1=["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"],f8=["onMount","onDestroy"];eK=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],$q=W1.filter(($)=>!eK.includes($));Zq=[/@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/],Yq=/\s@[a-z][\w.:-]*\s*=/i;h8=["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"],Xq=["x-init","x-transition","x-effect","x-on"],m8=[...h8,...Xq]});function c8($){let Z={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Y of $){let X=Y.toLowerCase();if(X==="prevent")Z.prevent=!0;else if(X==="stop")Z.stop=!0;else if(X==="once")Z.once=!0;else if(X==="capture")Z.capture=!0;else if(X==="self")Z.self=!0;else if(X==="passive")Z.passive=!0;else if(Jq.has(X))Z.systemKeys.push(X);else if(X in i8)Z.mouse=X;else if(X in l8||/^[a-z]$/.test(X))Z.keys.push(l8[X]||X.toUpperCase());else if(X.startsWith("debounce")){let J=X.match(/debounce(?:\.(\d+))?/);Z.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(X.startsWith("throttle")){let J=X.match(/throttle(?:\.(\d+))?/);Z.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return Z}function n8($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=X.exec($))!==null){let[Q,G,K]=J,q=J.index,W=q+Q.length,z=`__stx_evt_${Y++}`,U=[],j=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,H;while((H=j.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!p8.has(L))continue;U.push({attribute:`@${_}`,event:L,handler:O,modifiers:c8(F.slice(1)),elementId:z})}let B=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((H=B.exec(K))!==null){let[,_,O]=H,F=_.split("."),L=F[0];if(!p8.has(L))continue;U.push({attribute:`@${_}`,event:L,handler:O,modifiers:c8(F.slice(1)),elementId:z})}if(U.length>0)Z.push({originalTag:Q,elementId:z,events:U,startIndex:q,endIndex:W})}return Z}function Qq($){let Z=[],{modifiers:Y}=$;if(Y.self)Z.push("if ($event.target !== $el) return");for(let X of Y.systemKeys)Z.push(`if (!$event.${X}Key) return`);if(Y.keys.length>0){let X=Y.keys.map((J)=>`$event.key === '${J}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=i8[Y.mouse];Z.push(`if ($event.button !== ${X}) return`)}if(Y.prevent)Z.push("$event.preventDefault()");if(Y.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function Gq($,Z){let Y=$;if(Z.debounce!==null)Y=`__stx_debounce(() => { ${Y} }, ${Z.debounce})`;else if(Z.throttle!==null)Y=`__stx_throttle(() => { ${Y} }, ${Z.throttle})`;return Y}function a7($){let Z=$.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test(Z))return $;return`if (typeof ${Z} === 'function' && !${Z}._isSignal) ${Z}($event);`}function Kq($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=Qq($),J=Gq(a7($.handler),Z),Q=[];if(Z.once)Q.push("once: true");if(Z.capture)Q.push("capture: true");if(Z.passive)Q.push("passive: true");let G=Q.length>0?`, { ${Q.join(", ")} }`:"",K=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
1832
1832
  (function() {
1833
1833
  var $el = document.getElementById('${Y}');
1834
1834
  if (!$el) return;
@@ -1937,16 +1937,16 @@ else {
1937
1937
  }
1938
1938
 
1939
1939
  // Event listeners
1940
- ${$.map(Gq).join(`
1940
+ ${$.map(Kq).join(`
1941
1941
  `)}
1942
1942
  })();
1943
- </script>`}function Kq($){let Z=n8($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let J=Z.length-1;J>=0;J--){let Q=Z[J],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of Q.events)q.elementId=K[1]}for(let K of Q.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(z,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),X.push(...Q.events)}return{template:Y,bindings:X}}function o8($,Z,Y){if(r7($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:K,bindings:q}=Kq($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...q],K}let X=n8($);if(X.length===0)return $;let J=$;for(let K=X.length-1;K>=0;K--){let q=X[K],W=q.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let z=W.match(/id=["']([^"']+)["']/);if(z)for(let U of q.events)U.elementId=z[1]}for(let z of q.events){let U=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),H=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");W=W.replace(j,""),W=W.replace(H,"")}J=J.slice(0,q.startIndex)+W+J.slice(q.endIndex)}let Q=t7(X.flatMap((K)=>K.events)),G=J.lastIndexOf("</body>");if(G!==-1)J=J.slice(0,G)+Q+`
1944
- `+J.slice(G);else J+=Q;return J}var p8,l8,Xq,i8;var e7=b(()=>{$1();p8=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"]),l8={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"},Xq=new Set(["ctrl","alt","shift","meta"]),i8={left:0,middle:1,right:2}});function x0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1943
+ </script>`}function qq($){let Z=n8($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let J=Z.length-1;J>=0;J--){let Q=Z[J],G=Q.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${Q.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of Q.events)q.elementId=K[1]}for(let K of Q.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),z=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(z,"")}Y=Y.slice(0,Q.startIndex)+G+Y.slice(Q.endIndex),X.push(...Q.events)}return{template:Y,bindings:X}}function o8($,Z,Y){if(r7($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:K,bindings:q}=qq($),W=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...W,...q],K}let X=n8($);if(X.length===0)return $;let J=$;for(let K=X.length-1;K>=0;K--){let q=X[K],W=q.originalTag;if(!W.includes(" id="))W=W.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${q.elementId}"`);else{let z=W.match(/id=["']([^"']+)["']/);if(z)for(let U of q.events)U.elementId=z[1]}for(let z of q.events){let U=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),j=new RegExp(`\\s*${U}\\s*=\\s*"[^"]*"`,"g"),H=new RegExp(`\\s*${U}\\s*=\\s*'[^']*'`,"g");W=W.replace(j,""),W=W.replace(H,"")}J=J.slice(0,q.startIndex)+W+J.slice(q.endIndex)}let Q=t7(X.flatMap((K)=>K.events)),G=J.lastIndexOf("</body>");if(G!==-1)J=J.slice(0,G)+Q+`
1944
+ `+J.slice(G);else J+=Q;return J}var p8,l8,Jq,i8;var e7=b(()=>{$1();p8=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"]),l8={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"},Jq=new Set(["ctrl","alt","shift","meta"]),i8={left:0,middle:1,right:2}});function f0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1945
1945
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,J)=>{return`const { ${J.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
1946
- `}),$}function p$($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function qq(){let $=globalThis;return $[s8]??=new Map,$[s8]}function t($,Z){let Y=qq(),X=`${import.meta.url}\x00${$}`,J=Y.get(X);if(J)return J;let Q=Z();return Y.set(X,Q),Q.catch(()=>{if(Y.get(X)===Q)Y.delete(X)}),Q}var s8;var r5=b(()=>{s8=Symbol.for("stx.lazy-module-promises")});function H5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(Wq,"<\\/$1")}var Wq;var $3=b(()=>{Wq=/<\/(script)/gi});import zq from"process";function y0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(zq.env)){if(!X.startsWith($)||J===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(J),Y[X]=J}return Z["import.meta.env"]=JSON.stringify(Y),Z}var V1=()=>{};function Uq($){if(!$||typeof $!=="object")return!1;let Z=$;return typeof Z.message==="string"&&(Z.name==="BuildMessage"||Z.name==="ResolveMessage"||("position"in Z))}function jq($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function Z3($,Z){let Y=[];for(let X of jq($)){if(Uq(X)){let J=X.position||void 0;Y.push({file:Z||J?.file,line:J?.line,column:J?.column,message:X.message??"",lineText:J?.lineText});continue}Y.push({file:Z,message:X instanceof Error?X.message:String(X)})}return Y}function r8($,Z){return Z3($,Z).map((Y)=>{let X=Y.file?`${Y.file}${Y.line?`:${Y.line}${Y.column?`:${Y.column}`:""}`:""}`:"",J=Y.lineText?`
1946
+ `}),$}function p$($){return $.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function Wq(){let $=globalThis;return $[s8]??=new Map,$[s8]}function t($,Z){let Y=Wq(),X=`${import.meta.url}\x00${$}`,J=Y.get(X);if(J)return J;let Q=Z();return Y.set(X,Q),Q.catch(()=>{if(Y.get(X)===Q)Y.delete(X)}),Q}var s8;var r5=b(()=>{s8=Symbol.for("stx.lazy-module-promises")});function H5($){if(!$||$.indexOf("</")===-1)return $;return $.replace(zq,"<\\/$1")}var zq;var $3=b(()=>{zq=/<\/(script)/gi});import Uq from"process";function y0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,J]of Object.entries(Uq.env)){if(!X.startsWith($)||J===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(J),Y[X]=J}return Z["import.meta.env"]=JSON.stringify(Y),Z}var V1=()=>{};function jq($){if(!$||typeof $!=="object")return!1;let Z=$;return typeof Z.message==="string"&&(Z.name==="BuildMessage"||Z.name==="ResolveMessage"||("position"in Z))}function Bq($){if($&&typeof $==="object"&&Array.isArray($.errors))return $.errors;return[$]}function Z3($,Z){let Y=[];for(let X of Bq($)){if(jq(X)){let J=X.position||void 0;Y.push({file:Z||J?.file,line:J?.line,column:J?.column,message:X.message??"",lineText:J?.lineText});continue}Y.push({file:Z,message:X instanceof Error?X.message:String(X)})}return Y}function r8($,Z){return Z3($,Z).map((Y)=>{let X=Y.file?`${Y.file}${Y.line?`:${Y.line}${Y.column?`:${Y.column}`:""}`:""}`:"",J=Y.lineText?`
1947
1947
  ${Y.lineText.trim()}`:"";return X?`${X}: ${Y.message}${J}`:`${Y.message}${J}`}).join(`
1948
- `)}var a5={};o(a5,{shouldLogBundlerDiagnostics:()=>$Z,setBundlerFallbackMode:()=>Oq,resolveBundlerFallback:()=>YZ,recordBundleFailure:()=>ZZ,queueClientBundleBuild:()=>XZ,hasUserImports:()=>Fq,getBundleFailures:()=>Hq,clearBundleFailures:()=>_q,bundleClientScript:()=>Vq});import _0 from"path";import P0 from"fs";function $Z($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function g1(...$){if($Z())console.log("[stx:bundler]",...$)}function ZZ($,Z,Y){J3.push({filePath:$||"<inline>",message:Z,details:Y})}function Hq(){return J3.slice()}function _q(){J3.length=0}function Oq($){X3=$}function YZ(){if(X3)return X3;try{return e5.strict?.bundlerFallback??"warn"}catch{return"warn"}}function Fq($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(!a8.some((G)=>G.test(J)))return g1("detected user import:",J),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let J=Y[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!a8.some((G)=>G.test(J)))return g1("detected side-effect import:",J),!0}return!1}function Lq($,Z,Y,X){let J=(Q,G)=>{let K=Q===Y?Z:_0.dirname(Q),q=_0.resolve(K,G),W=[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 z of W)try{if(P0.existsSync(z)&&P0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return q};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(P0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=J(G.importer,G.path);return X.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=_0.resolve($,G.path.slice(2)),q=[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 q)if(P0.existsSync(W)&&P0.statSync(W,{throwIfNoEntry:!1})?.isFile())return g1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=_0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)X.add(G.path);return{contents:P0.readFileSync(G.path,"utf8"),loader:q}})}}}function XZ($){let Z=globalThis,X=(Z[t8]??Promise.resolve()).then($,$);return Z[t8]=X.then(()=>{return},()=>{return}),X}async function Vq($,Z,Y={}){let X=Y.projectRoot||process.cwd(),J=Y.minify??!1,Q=Y.cacheDir||n5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${Bq}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=_0.join(Q,`${K}.js`),W=_0.join(Q,`${K}.deps.json`),z=Bun.file(q);if(await z.exists()){let H=Bun.file(W),B=!0;if(await H.exists())try{let _=JSON.parse(await H.text());if(_.metadataVersion!==e8||!Array.isArray(_.files))B=!1;for(let O of Array.isArray(_.files)?_.files:[])try{if(P0.statSync(O.path).mtimeMs!==O.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return g1("cache hit:",K),await z.text();g1("cache invalidated by dep change:",K)}let U=Y3.get(K);if(U)return await U;let j=XZ(()=>wq($,Z,{projectRoot:X,minify:J,cacheDir:Q,hash:K,cachePath:q,depsPath:W}));Y3.set(K,j);try{return await j}finally{Y3.delete(K)}}async function wq($,Z,Y){let{projectRoot:X,minify:J,cacheDir:Q,hash:G,cachePath:K,depsPath:q}=Y,W=n5(X,"bundle-tmp"),z=_0.join(W,`${G}.ts`),U=_0.join(W,"out",G);P0.mkdirSync(W,{recursive:!0}),P0.mkdirSync(U,{recursive:!0});let j=_0.dirname(Z),H=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=B.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)H.push(w)});else if(O[3])H.push(O[3])}while((O=_.exec($))!==null){if(O[1])continue;H.push(O[2])}let F=H.length>0?`
1949
- export { ${H.join(", ")} }`:"";await Bun.write(z,$+F),g1("bundling:",G,"from:",_0.basename(Z));let L=new Set;try{let V=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:J,plugins:[Lq(X,j,z,L)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...y0()},root:X});if(!V.success){let D=V.logs.filter((P)=>P.level==="error").map((P)=>P.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of V.outputs){w=await D.text();break}let R=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let P of D[1].split(",")){let y=P.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y){R.push([y[2],y[1]]);continue}let S=P.trim();if(/^[A-Za-z_$][\w$]*$/.test(S))R.push([S,S])}let N=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let A=`__stxBundle_${G}`,M=R.map(([D,P])=>`${JSON.stringify(D)}: ${P}`).join(", "),I=R.map(([D])=>`var ${D} = undefined;`).join(`
1948
+ `)}var a5={};o(a5,{shouldLogBundlerDiagnostics:()=>$Z,setBundlerFallbackMode:()=>Fq,resolveBundlerFallback:()=>YZ,recordBundleFailure:()=>ZZ,queueClientBundleBuild:()=>XZ,hasUserImports:()=>Lq,getBundleFailures:()=>_q,clearBundleFailures:()=>Oq,bundleClientScript:()=>wq});import _0 from"path";import P0 from"fs";function $Z($=process.env){return $.STX_DEBUG==="true"||$.STX_DEBUG==="1"}function g1(...$){if($Z())console.log("[stx:bundler]",...$)}function ZZ($,Z,Y){J3.push({filePath:$||"<inline>",message:Z,details:Y})}function _q(){return J3.slice()}function Oq(){J3.length=0}function Fq($){X3=$}function YZ(){if(X3)return X3;try{return e5.strict?.bundlerFallback??"warn"}catch{return"warn"}}function Lq($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let J=Y[1];if(!a8.some((G)=>G.test(J)))return g1("detected user import:",J),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let J=Y[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!a8.some((G)=>G.test(J)))return g1("detected side-effect import:",J),!0}return!1}function Vq($,Z,Y,X){let J=(Q,G)=>{let K=Q===Y?Z:_0.dirname(Q),q=_0.resolve(K,G),W=[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 z of W)try{if(P0.existsSync(z)&&P0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return q};return{name:"stx-client-bundle",setup(Q){Q.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),Q.onResolve({filter:/^\//},(G)=>{if(P0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),Q.onResolve({filter:/^\.\.?\//},(G)=>{let K=J(G.importer,G.path);return X.add(K),{path:K}}),Q.onResolve({filter:/^[@~]\//},(G)=>{let K=_0.resolve($,G.path.slice(2)),q=[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 q)if(P0.existsSync(W)&&P0.statSync(W,{throwIfNoEntry:!1})?.isFile())return g1(`resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),Q.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=_0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";if(G.path!==Y)X.add(G.path);return{contents:P0.readFileSync(G.path,"utf8"),loader:q}})}}}function XZ($){let Z=globalThis,X=(Z[t8]??Promise.resolve()).then($,$);return Z[t8]=X.then(()=>{return},()=>{return}),X}async function wq($,Z,Y={}){let X=Y.projectRoot||process.cwd(),J=Y.minify??!1,Q=Y.cacheDir||n5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${Hq}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=_0.join(Q,`${K}.js`),W=_0.join(Q,`${K}.deps.json`),z=Bun.file(q);if(await z.exists()){let H=Bun.file(W),B=!0;if(await H.exists())try{let _=JSON.parse(await H.text());if(_.metadataVersion!==e8||!Array.isArray(_.files))B=!1;for(let O of Array.isArray(_.files)?_.files:[])try{if(P0.statSync(O.path).mtimeMs!==O.mtimeMs){B=!1;break}}catch{B=!1;break}}catch{B=!1}if(B)return g1("cache hit:",K),await z.text();g1("cache invalidated by dep change:",K)}let U=Y3.get(K);if(U)return await U;let j=XZ(()=>Rq($,Z,{projectRoot:X,minify:J,cacheDir:Q,hash:K,cachePath:q,depsPath:W}));Y3.set(K,j);try{return await j}finally{Y3.delete(K)}}async function Rq($,Z,Y){let{projectRoot:X,minify:J,cacheDir:Q,hash:G,cachePath:K,depsPath:q}=Y,W=n5(X,"bundle-tmp"),z=_0.join(W,`${G}.ts`),U=_0.join(W,"out",G);P0.mkdirSync(W,{recursive:!0}),P0.mkdirSync(U,{recursive:!0});let j=_0.dirname(Z),H=[],B=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,O;while((O=B.exec($))!==null){if(O[1])continue;if(O[2])O[2].split(",").forEach((V)=>{let w=V.split(":")[0].trim();if(w)H.push(w)});else if(O[3])H.push(O[3])}while((O=_.exec($))!==null){if(O[1])continue;H.push(O[2])}let F=H.length>0?`
1949
+ export { ${H.join(", ")} }`:"";await Bun.write(z,$+F),g1("bundling:",G,"from:",_0.basename(Z));let L=new Set;try{let V=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:J,plugins:[Vq(X,j,z,L)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...y0()},root:X});if(!V.success){let D=V.logs.filter((P)=>P.level==="error").map((P)=>P.message).join(", ");return console.warn("[stx:bundler] build failed:",D),$}let w="";for(let D of V.outputs){w=await D.text();break}let R=[];for(let D of w.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let P of D[1].split(",")){let y=P.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(y){R.push([y[2],y[1]]);continue}let S=P.trim();if(/^[A-Za-z_$][\w$]*$/.test(S))R.push([S,S])}let N=w.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];w=w.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let A=`__stxBundle_${G}`,M=R.map(([D,P])=>`${JSON.stringify(D)}: ${P}`).join(", "),I=R.map(([D])=>`var ${D} = undefined;`).join(`
1950
1950
  `),T=R.map(([D])=>`${D} = ${A}[${JSON.stringify(D)}];`).join(`
1951
1951
  `);if(w=`${N.join(`
1952
1952
  `)}
@@ -1955,7 +1955,7 @@ var ${A} = (function() {
1955
1955
  ${w}
1956
1956
  return { ${M} };
1957
1957
  })();
1958
- ${T}`.trim(),g1("bundled:",G,"output:",w.length,"bytes"),H.length>0&&R.length===0)return console.warn(`[stx:bundler] dropped every binding for ${_0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;P0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let k=Array.from(L).map((D)=>{try{return{path:D,mtimeMs:P0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(q,JSON.stringify({metadataVersion:e8,files:k})),w}catch(V){let w=Z3(V,Z||void 0),R=r8(V,Z||void 0);if(console.warn(`[stx:bundler] error: ${R}`),ZZ(Z||"",R,w),YZ()==="error")throw V;return $}finally{try{P0.rmSync(z,{force:!0}),P0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var Bq=5,e8=1,J3,X3,a8,Y3,t8;var t5=b(()=>{V1();u$();w1();J3=[];a8=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];Y3=new Map,t8=Symbol.for("stx.client-bundle-build-queue")});var jZ={};o(jZ,{stripCommentsAndLiterals:()=>i$,renderVendorStyleTags:()=>c$,processClientScript:()=>Y$,injectBrowserCoreAutoImports:()=>_5,generateServerDataBridge:()=>n$,generateBrowserAutoImportDestructuring:()=>Sq,generateAutoImportDestructuring:()=>Q3,extractBridgeData:()=>Z$,extractAndStripCssImports:()=>l$,STX_AUTO_IMPORTS:()=>KZ});import h1 from"path";import $$ from"fs";function Nq($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function Aq($,Z){let Y=Z;while(!0){let X=h1.join(Y,"node_modules",$,"package.json");if($$.existsSync(X))return h1.dirname(X);let J=h1.dirname(Y);if(J===Y)return null;Y=J}}function Mq($,Z){if(!$||typeof $!=="object")return null;let Y=(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 Y(J.import);if(typeof J.default==="object")return Y(J.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let J of Object.keys($)){let Q=J.indexOf("*");if(Q===-1)continue;let G=J.slice(0,Q),K=J.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:J,prefix:G,suffix:K}}if(X){let J=Z.slice(X.prefix.length,Z.length-X.suffix.length),Q=Y($[X.pattern]);if(Q)return Q.replace("*",J)}return null}function Tq($,Z){let Y=Nq($);if(!Y||!Y.subpath)return null;let X=Aq(Y.pkg,Z);if(!X)return null;let J;try{J=JSON.parse($$.readFileSync(h1.join(X,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=Mq(J.exports,Q);if(!G)return null;let K=h1.resolve(X,G);return $$.existsSync(K)?K:null}function l$($,Z){let Y=Z.filePath?h1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),J=new Set,Q=[];return{code:$.replace(Rq,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:h1.resolve(Y,q),!$$.existsSync(W))throw Error(`file not found: ${W}`)}else{let z=null;try{z=Bun.resolveSync(q,X)}catch{z=Tq(q,X)}if(!z)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(J.has(W))return"";J.add(W);try{let z=$$.readFileSync(W,"utf8");Q.push({source:q,resolvedPath:W,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${W}: ${z?.message||z}`)}return""}),styles:Q}}function Iq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function c$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${Iq(Z.source)}" data-stx-layer="vendor">
1958
+ ${T}`.trim(),g1("bundled:",G,"output:",w.length,"bytes"),H.length>0&&R.length===0)return console.warn(`[stx:bundler] dropped every binding for ${_0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;P0.mkdirSync(Q,{recursive:!0}),await Bun.write(K,w);let k=Array.from(L).map((D)=>{try{return{path:D,mtimeMs:P0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(q,JSON.stringify({metadataVersion:e8,files:k})),w}catch(V){let w=Z3(V,Z||void 0),R=r8(V,Z||void 0);if(console.warn(`[stx:bundler] error: ${R}`),ZZ(Z||"",R,w),YZ()==="error")throw V;return $}finally{try{P0.rmSync(z,{force:!0}),P0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var Hq=5,e8=1,J3,X3,a8,Y3,t8;var t5=b(()=>{V1();u$();w1();J3=[];a8=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];Y3=new Map,t8=Symbol.for("stx.client-bundle-build-queue")});var jZ={};o(jZ,{stripCommentsAndLiterals:()=>i$,renderVendorStyleTags:()=>c$,processClientScript:()=>Y$,injectBrowserCoreAutoImports:()=>_5,generateServerDataBridge:()=>n$,generateBrowserAutoImportDestructuring:()=>yq,generateAutoImportDestructuring:()=>Q3,extractBridgeData:()=>Z$,extractAndStripCssImports:()=>l$,STX_AUTO_IMPORTS:()=>KZ});import h1 from"path";import $$ from"fs";function Aq($){if($.startsWith(".")||$.startsWith("/"))return null;if($.startsWith("@")){let Y=$.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Y)return null;return{pkg:Y[1],subpath:Y[2]||""}}let Z=$.match(/^([^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}function Mq($,Z){let Y=Z;while(!0){let X=h1.join(Y,"node_modules",$,"package.json");if($$.existsSync(X))return h1.dirname(X);let J=h1.dirname(Y);if(J===Y)return null;Y=J}}function Tq($,Z){if(!$||typeof $!=="object")return null;let Y=(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 Y(J.import);if(typeof J.default==="object")return Y(J.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let J of Object.keys($)){let Q=J.indexOf("*");if(Q===-1)continue;let G=J.slice(0,Q),K=J.slice(Q+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:J,prefix:G,suffix:K}}if(X){let J=Z.slice(X.prefix.length,Z.length-X.suffix.length),Q=Y($[X.pattern]);if(Q)return Q.replace("*",J)}return null}function Iq($,Z){let Y=Aq($);if(!Y||!Y.subpath)return null;let X=Mq(Y.pkg,Z);if(!X)return null;let J;try{J=JSON.parse($$.readFileSync(h1.join(X,"package.json"),"utf8"))}catch{return null}let Q=`.${Y.subpath}`,G=Tq(J.exports,Q);if(!G)return null;let K=h1.resolve(X,G);return $$.existsSync(K)?K:null}function l$($,Z){let Y=Z.filePath?h1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),J=new Set,Q=[];return{code:$.replace(Nq,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:h1.resolve(Y,q),!$$.existsSync(W))throw Error(`file not found: ${W}`)}else{let z=null;try{z=Bun.resolveSync(q,X)}catch{z=Iq(q,X)}if(!z)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=z}}catch(z){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${z?.message||z}`),""}if(J.has(W))return"";J.add(W);try{let z=$$.readFileSync(W,"utf8");Q.push({source:q,resolvedPath:W,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${W}: ${z?.message||z}`)}return""}),styles:Q}}function Dq($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function c$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${Dq(Z.source)}" data-stx-layer="vendor">
1959
1959
  @layer vendor {
1960
1960
  ${Z.contents}
1961
1961
  }
@@ -1963,7 +1963,7 @@ ${Z.contents}
1963
1963
  `)}
1964
1964
  `}function _5($){let Z=i$($),Y=new Set;for(let K of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let q of K[1].split(",")){let W=q.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(W)Y.add(W)}let X=new Set;for(let K of Z.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))X.add(K[1]);for(let K of Z.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let q of K[1].split(",")){let W=q.trim().split(/[:=]/).pop()?.trim();if(W)X.add(W)}let J=qZ.filter((K)=>{if(Y.has(K)||X.has(K))return!1;return new RegExp(`\\b${K}\\s*\\(`).test(Z)}),Q=zZ(Z).filter((K)=>!Y.has(K)&&!X.has(K));if(J.length===0&&Q.length===0)return{code:$,imports:J,models:Q};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",Q.length>0?"import '@stacksjs/browser'":"",Q.length>0?`const { ${Q.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
1965
1965
  `)}
1966
- ${$}`,imports:J,models:Q}}function Eq($,Z){let Y=$[Z],X=Z+1;while(X<$.length){if($[X]==="\\"){X+=2;continue}if($[X]===Y)return X+1;X++}return $.length}function kq($,Z){let Y=Z+1;while(Y<$.length){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`")return Y+1;if($[Y]==="$"&&$[Y+1]==="{"){if(Y=WZ($,Y+2),Y<$.length)Y++;continue}Y++}return $.length}function WZ($,Z){let Y=1,X=Z;while(X<$.length){let J=$[X];if(J==="\\"){X+=2;continue}if(J==='"'||J==="'"){X=Eq($,X);continue}if(J==="`"){X=kq($,X);continue}if(J==="/"&&$[X+1]==="/"){while(X<$.length&&$[X]!==`
1966
+ ${$}`,imports:J,models:Q}}function kq($,Z){let Y=$[Z],X=Z+1;while(X<$.length){if($[X]==="\\"){X+=2;continue}if($[X]===Y)return X+1;X++}return $.length}function bq($,Z){let Y=Z+1;while(Y<$.length){if($[Y]==="\\"){Y+=2;continue}if($[Y]==="`")return Y+1;if($[Y]==="$"&&$[Y+1]==="{"){if(Y=WZ($,Y+2),Y<$.length)Y++;continue}Y++}return $.length}function WZ($,Z){let Y=1,X=Z;while(X<$.length){let J=$[X];if(J==="\\"){X+=2;continue}if(J==='"'||J==="'"){X=kq($,X);continue}if(J==="`"){X=bq($,X);continue}if(J==="/"&&$[X+1]==="/"){while(X<$.length&&$[X]!==`
1967
1967
  `)X++;continue}if(J==="/"&&$[X+1]==="*"){X+=2;while(X<$.length&&$.slice(X,X+2)!=="*/")X++;X+=2;continue}if(J==="{"){Y++,X++;continue}if(J==="}"){if(Y--,Y===0)return X;X++;continue}X++}return $.length}function i$($){let Z="",Y=0;while(Y<$.length){let X=$.slice(Y,Y+2);if(X==="//"){while(Y<$.length&&$[Y]!==`
1968
1968
  `)Z+=" ",Y++;continue}if(X==="/*"){while(Y<$.length&&$.slice(Y,Y+2)!=="*/")Z+=$[Y]===`
1969
1969
  `?`
@@ -1971,10 +1971,10 @@ ${$}`,imports:J,models:Q}}function Eq($,Z){let Y=$[Z],X=Z+1;while(X<$.length){if
1971
1971
  `?`
1972
1972
  `:" ",Y++}Z+=" ",Y++;continue}if(J==="`"){Z+=" ",Y++;while(Y<$.length&&$[Y]!=="`"){if($[Y]==="\\"){Z+=" ",Y+=2;continue}if($[Y]==="$"&&$[Y+1]==="{"){let Q=Y+2,G=WZ($,Q);if(Z+=" ",Z+=i$($.slice(Q,G)),G<$.length)Z+=" ";Y=G+1;continue}Z+=$[Y]===`
1973
1973
  `?`
1974
- `:" ",Y++}Z+=" ",Y++;continue}Z+=J,Y++}return Z}function zZ($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=Y.exec($))!==null)if(!Dq.has(X[1]))Z.add(X[1]);return Array.from(Z)}function bq($){let Z=new Set;for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let X of Y[1].split(",")){let J=X.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function UZ($){let Z=new Set,Y=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let W=G[1],z=G[2];if(G[0].includes("import type"))continue;let U=[];for(let H of W.split(",")){let B=H.trim();if(!B||B.startsWith("type "))continue;let _=B.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let O=_[1],F=_[2]||O;if(J.add(O),J.add(F),z==="stx"||z==="@stacksjs/stx")Z.add(O);else Y.add(O);if(F!==O)U.push(`${F} = ${O}`)}let j=U.length>0?`var ${U.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],j)}let K=bq(X);for(let W of KZ){if(J.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(X))Z.add(W)}for(let W of qZ){if(J.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(X))Y.add(W)}let q=zZ(X);for(let W of q)if(!J.has(W)&&!K.has(W))Y.add(W);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function Q3($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1974
+ `:" ",Y++}Z+=" ",Y++;continue}Z+=J,Y++}return Z}function zZ($){let Z=new Set,Y=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,X;while((X=Y.exec($))!==null)if(!Eq.has(X[1]))Z.add(X[1]);return Array.from(Z)}function Sq($){let Z=new Set;for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let X of Y[1].split(",")){let J=X.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function UZ($){let Z=new Set,Y=new Set,X=$;X=X.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,Q=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=Q.exec($))!==null){let W=G[1],z=G[2];if(G[0].includes("import type"))continue;let U=[];for(let H of W.split(",")){let B=H.trim();if(!B||B.startsWith("type "))continue;let _=B.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let O=_[1],F=_[2]||O;if(J.add(O),J.add(F),z==="stx"||z==="@stacksjs/stx")Z.add(O);else Y.add(O);if(F!==O)U.push(`${F} = ${O}`)}let j=U.length>0?`var ${U.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";X=X.replace(G[0],j)}let K=Sq(X);for(let W of KZ){if(J.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(X))Z.add(W)}for(let W of qZ){if(J.has(W)||K.has(W))continue;if(new RegExp(`\\b${W}\\b`,"g").test(X))Y.add(W)}let q=zZ(X);for(let W of q)if(!J.has(W)&&!K.has(W))Y.add(W);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function Q3($,Z){let Y=[];if($.length>0)Y.push(` var { ${$.join(", ")} } = window.stx || window;`);if(Z.length>0)Y.push(` var { ${Z.join(", ")} } = window.StacksBrowser || {};`);if(Y.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
1975
1975
  ${Y.join(`
1976
1976
  `)}
1977
- ${yq($,Z)}`;return""}function Sq($,Z=[]){let{browserImports:Y}=UZ($),X=new Set(Z);return Q3([],Y.filter((J)=>!X.has(J)))}function yq($,Z){let Y=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
1977
+ ${Pq($,Z)}`;return""}function yq($,Z=[]){let{browserImports:Y}=UZ($),X=new Set(Z);return Q3([],Y.filter((J)=>!X.has(J)))}function Pq($,Z){let Y=[...$.map((X)=>`['${X}', typeof ${X}, 'stx']`),...Z.map((X)=>`['${X}', typeof ${X}, '@stacksjs/browser']`)];if(Y.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
1978
1978
  [${Y.join(", ")}].forEach(function (e) {
1979
1979
  if (e[1] !== 'undefined') return;
1980
1980
  console.error(
@@ -1983,10 +1983,10 @@ ${yq($,Z)}`;return""}function Sq($,Z=[]){let{browserImports:Y}=UZ($),X=new Set(Z
1983
1983
  + 'or it should be imported from a relative path so the bundler includes it.'
1984
1984
  );
1985
1985
  });
1986
- `}function Z$($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let X={};for(let J in Z){let Q=Z[J];if(typeof Q==="function")continue;X[J]=Q}return X.__stxDeclaredPayload=!0,X}let Y={};for(let X in $){if(X.startsWith("__")||X.startsWith("$"))continue;let J=$[X];if(typeof J==="function")continue;Y[X]=J}return Y}function JZ($,Z){let Y=new Set;for(let X of $.split(",")){let J=X.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if(Z){let Q=J.lastIndexOf(":");if(Q!==-1)J=J.slice(Q+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Y.add(J)}return Y}function Pq($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(JZ(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(JZ(Y[1],!1).has(Z))return!0;return!1}function Cq($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}function xq($,Z){let Y=vq.test($),X=Z.length>32768;if(!Y&&!X)return;if(QZ.has($))return;if(QZ.add($),Y)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(X)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function n$($,Z){if(!Z)return"";let Y=i$($),X=Z.__stxDeclaredPayload===!0,J=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!X&&!Cq(Y,Q))continue;if(Pq($,Q))continue;let K;try{K=JSON.stringify(G)}catch{continue}if(K===void 0)continue;xq(Q,K),J.push(` var ${Q} = ${K.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
1986
+ `}function Z$($){let Z=$.__stxClientPayload;if(Z&&typeof Z==="object"){let X={};for(let J in Z){let Q=Z[J];if(typeof Q==="function")continue;X[J]=Q}return X.__stxDeclaredPayload=!0,X}let Y={};for(let X in $){if(X.startsWith("__")||X.startsWith("$"))continue;let J=$[X];if(typeof J==="function")continue;Y[X]=J}return Y}function JZ($,Z){let Y=new Set;for(let X of $.split(",")){let J=X.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if(Z){let Q=J.lastIndexOf(":");if(Q!==-1)J=J.slice(Q+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Y.add(J)}return Y}function Cq($,Z){if(new RegExp(`(?:const|let|var|function|class)\\s+${Z}\\b`).test($))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(JZ(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(JZ(Y[1],!1).has(Z))return!0;return!1}function vq($,Z){return new RegExp(`(?<![.#\\w$])${Z}(?![\\w$])`).test($)}function fq($,Z){let Y=xq.test($),X=Z.length>32768;if(!Y&&!X)return;if(QZ.has($))return;if(QZ.add($),Y)console.warn(`[stx] server\u2192client bridge is publishing "${$}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(X)console.warn(`[stx] server\u2192client bridge is publishing ${(Z.length/1024).toFixed(1)}KB under "${$}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function n$($,Z){if(!Z)return"";let Y=i$($),X=Z.__stxDeclaredPayload===!0,J=[];for(let[Q,G]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(Q))continue;if(Q.startsWith("__")||Q.startsWith("$"))continue;if(!X&&!vq(Y,Q))continue;if(Cq($,Q))continue;let K;try{K=JSON.stringify(G)}catch{continue}if(K===void 0)continue;fq(Q,K),J.push(` var ${Q} = ${K.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
1987
1987
  ${J.join(`
1988
1988
  `)}
1989
- `}function gq($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=fq[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function hq($,Z){let{elementId:Y,event:X,modifiers:J}=$,Q=a7($.handler),G=gq(J),K=[];if(J.once)K.push("once: true");if(J.capture)K.push("capture: true");if(J.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let z=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
1989
+ `}function hq($){let Z=[];if($.self)Z.push("if ($event.target !== $el) return");for(let Y of $.systemKeys)Z.push(`if (!$event.${Y}Key) return`);if($.keys.length>0){let Y=$.keys.map((X)=>`$event.key === '${X}'`).join(" || ");Z.push(`if (!(${Y})) return`)}if($.mouse!==null){let Y=gq[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function mq($,Z){let{elementId:Y,event:X,modifiers:J}=$,Q=a7($.handler),G=hq(J),K=[];if(J.once)K.push("once: true");if(J.capture)K.push("capture: true");if(J.passive)K.push("passive: true");let q=K.length>0?`, { ${K.join(", ")} }`:"",W="";if(G)W+=`${G}; `;let z=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),U=`var $emit = function(name, detail) {
1990
1990
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
1991
1991
  };`;function j(H){if(/\$emit\s*\(/.test(H))return`${U}
1992
1992
  ${H}`;return`var scope = $el.closest('[data-stx-scope]');
@@ -2029,11 +2029,11 @@ else {
2029
2029
  else {
2030
2030
  ${Q}
2031
2031
  }
2032
- }${q})`}function mq($){if($.length===0)return"";return`
2032
+ }${q})`}function dq($){if($.length===0)return"";return`
2033
2033
  // STX: auto-generated event bindings
2034
- ${$.map((Y,X)=>hq(Y,X)).join(`
2034
+ ${$.map((Y,X)=>mq(Y,X)).join(`
2035
2035
  `)}`}function GZ($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),J=0,Q=X.length,G=0;while(G<Q){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]==="`"&&W===0){G++;break}if(X[G]==="$"&&X[G+1]==="{"){W++,G+=2;continue}if(X[G]==="}"&&W>0){W--,G++;continue}G++}}else while(G<Q){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<Q&&X[G]!==`
2036
- `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){J++,G++;continue}if(K==="}"){J--,G++;continue}if(J===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let j=W[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=W[0].length;continue}let z=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((j)=>{let H=j.trim(),B=H.indexOf(":"),_=B>=0?H.slice(B+1).trim().split(/[\s=]/)[0]:H.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_)}),G+=z[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let j=U[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=U[0].length;continue}}G++}return Z}function uq($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(j){let H;while((H=Y.exec(j))!==null){let B=H[0];if(!dq.has(B))Z.add(B)}}let J=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=J.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)X(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)X(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)X(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);return Z}async function Y$($,Z={}){let Y=$,X="",J=!1,Q=[],G=l$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=c$(G.styles),q=_5(Y);Y=q.code,Q=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:z}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (t5(),a5)));if(W(Y))Y=await z(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),J=!0;if(Z.autoImports!==!1){let L=UZ(Y);Y=L.code,X=Q3(L.stxImports,L.browserImports.filter((V)=>!Q.includes(V)))}if(X=`${n$(Y,Z.serverData)}${X}`,Y=x0(Y),!J&&m1(Z.attrs||""))Y=d1(Y);let U=mq(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let L=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${K}<script ${V}>
2036
+ `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<Q-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){J++,G++;continue}if(K==="}"){J--,G++;continue}if(J===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let j=W[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=W[0].length;continue}let z=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((j)=>{let H=j.trim(),B=H.indexOf(":"),_=B>=0?H.slice(B+1).trim().split(/[\s=]/)[0]:H.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Y.has(_))Z.push(_),Y.add(_)}),G+=z[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let j=U[1];if(!j.startsWith("_")&&!Y.has(j))Z.push(j),Y.add(j);G+=U[0].length;continue}}G++}return Z}function pq($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(j){let H;while((H=Y.exec(j))!==null){let B=H[0];if(!uq.has(B))Z.add(B)}}let J=/\{\{([\s\S]*?)\}\}/g,Q;while((Q=J.exec($))!==null)X(Q[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((Q=G.exec($))!==null)X(Q[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((Q=K.exec($))!==null)X(Q[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((Q=q.exec($))!==null)X(Q[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((Q=W.exec($))!==null)X(Q[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((Q=z.exec($))!==null)X(Q[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((Q=U.exec($))!==null)X(Q[1]);return Z}async function Y$($,Z={}){let Y=$,X="",J=!1,Q=[],G=l$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=c$(G.styles),q=_5(Y);Y=q.code,Q=[...q.imports,...q.models];let{hasUserImports:W,bundleClientScript:z}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (t5(),a5)));if(W(Y))Y=await z(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),J=!0;if(Z.autoImports!==!1){let L=UZ(Y);Y=L.code,X=Q3(L.stxImports,L.browserImports.filter((V)=>!Q.includes(V)))}if(X=`${n$(Y,Z.serverData)}${X}`,Y=f0(Y),!J&&m1(Z.attrs||""))Y=d1(Y);let U=dq(Z.eventBindings||[]),j=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(j)){let L=j.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${K}<script ${V}>
2037
2037
  ${H5(`${X}${Y}
2038
2038
  ${U}`)}
2039
2039
  </script>`}let B=s7($),_=/function __stx_setup_/.test(Y),O=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(L){let V=L.length>0?`
@@ -2042,12 +2042,12 @@ window.stx.mount(function() {
2042
2042
  'use strict';
2043
2043
  ${H5(`${X}${Y}
2044
2044
  ${U}${V}`)}
2045
- })</script>`}if(!O&&!_){if(B)return F(GZ($));if(Z.templateContent){let L=GZ($);if(L.length>0){let V=uq(Z.templateContent);if(L.some((R)=>V.has(R)))return F(L)}}}return`${K}<script data-stx-scoped data-stx-run="always">
2045
+ })</script>`}if(!O&&!_){if(B)return F(GZ($));if(Z.templateContent){let L=GZ($);if(L.length>0){let V=pq(Z.templateContent);if(L.some((R)=>V.has(R)))return F(L)}}}return`${K}<script data-stx-scoped data-stx-run="always">
2046
2046
  ;(function() {
2047
2047
  'use strict';
2048
2048
  ${H5(`${X}${Y}
2049
2049
  ${U}`)}
2050
- })()</script>`}var Rq,KZ,qZ,Dq,vq,QZ,fq,dq;var X$=b(()=>{e7();R0();r5();$1();$3();Rq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;KZ=W1,qZ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];Dq=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"]);vq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,QZ=new Set;fq={left:0,middle:1,right:2};dq=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 pq}from"crypto";function BZ($){let Z=$[o$];return Z instanceof Map?Z:null}function HZ($){$[o$]=new Map}function _Z($,Z){let Y=BZ($);if(!Y)return null;let X=pq("sha256").update(Z).digest("hex").slice(0,16),J=Y.get(X);if(J)J.instances++;else Y.set(X,{body:Z,instances:1});return X}function OZ($,Z){let Y=BZ(Z);if(!Y?.size)return $;let X=$;for(let[q,W]of Y){if(W.instances!==1)continue;let z=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");X=X.replace(z,(U,j)=>`(${W.body})(${j});`)}let J=[...Y].filter(([,q])=>q.instances>1);if(J.length===0)return X;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2050
+ })()</script>`}var Nq,KZ,qZ,Eq,xq,QZ,gq,uq;var X$=b(()=>{e7();R0();r5();$1();$3();Nq=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;KZ=W1,qZ=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];Eq=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"]);xq=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,QZ=new Set;gq={left:0,middle:1,right:2};uq=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 lq}from"crypto";function BZ($){let Z=$[o$];return Z instanceof Map?Z:null}function HZ($){$[o$]=new Map}function _Z($,Z){let Y=BZ($);if(!Y)return null;let X=lq("sha256").update(Z).digest("hex").slice(0,16),J=Y.get(X);if(J)J.instances++;else Y.set(X,{body:Z,instances:1});return X}function OZ($,Z){let Y=BZ(Z);if(!Y?.size)return $;let X=$;for(let[q,W]of Y){if(W.instances!==1)continue;let z=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(q)}\\]\\(("[^"]+")\\);`,"g");X=X.replace(z,(U,j)=>`(${W.body})(${j});`)}let J=[...Y].filter(([,q])=>q.instances>1);if(J.length===0)return X;let G=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
2051
2051
  (function() {
2052
2052
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
2053
2053
  ${J.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.stringify(q)}] || ${W.body}; }
@@ -2056,7 +2056,7 @@ ${J.map(([q,W])=>` try { factories[${JSON.stringify(q)}] = factories[${JSON.str
2056
2056
  })();
2057
2057
  </script>`,K=X.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(K<0)return`${G}
2058
2058
  ${X}`;return`${X.slice(0,K)}${G}
2059
- ${X.slice(K)}`}var o$="__stx_component_client_factories";var G3=()=>{};function nq($){let Z="",Y=null,X=!1;for(let J=0;J<$.length;J++){let Q=$[J];if(X){X=!1;continue}if(Q==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&J+1<$.length&&$[J+1]==="{"){let G=1;J+=2;while(J<$.length&&G>0){if($[J]==="{")G++;else if($[J]==="}")G--;if(G>0)Z+=$[J],J++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function oq($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=$[X.index-1];if(cq.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${Z}`);if(Q==="."&&wZ.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${Z}`)}}function sq($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!wZ.has(X))continue;let J=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function s$($){let Z=$.trim(),Y=nq(Z);oq(Y,Z),sq(Z);for(let X of VZ)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!LZ.allowBracketNotation&&iq.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function rq($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||VZ.some((J)=>J.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=K3(X);else Z[Y]=X}return Z}function K3($,Z=0){if(Z>=LZ.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>K3(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,J]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(J&&typeof J==="object")Y[X]=K3(J,Z+1);else Y[X]=J}return Y}function Z0($,Z){try{let Y=rq(Z),X=Object.keys(Y),J=Object.values(Y);return G0($,X)(...J)}catch{return}}function Q0($){try{return s$($),!0}catch{return!1}}function O0($,Z){try{let Y=Z0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function G0($,Z){let Y=s$($),X=/^[A-Za-z_$][\w$]*$/,J=[],Q=[];for(let W=0;W<Z.length;W++){let z=Z[W];if(!X.test(z))continue;if(RZ.has(z))continue;J.push(W),Q.push(z)}let G=(W)=>Function(...Q,...W,`
2059
+ ${X.slice(K)}`}var o$="__stx_component_client_factories";var G3=()=>{};function oq($){let Z="",Y=null,X=!1;for(let J=0;J<$.length;J++){let Q=$[J];if(X){X=!1;continue}if(Q==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&Q==="$"&&J+1<$.length&&$[J+1]==="{"){let G=1;J+=2;while(J<$.length&&G>0){if($[J]==="{")G++;else if($[J]==="}")G--;if(G>0)Z+=$[J],J++}continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}Z+=Q}return Z}function sq($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let J=X[0],Q=$[X.index-1];if(iq.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${Z}`);if(Q==="."&&wZ.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${Z}`)}}function rq($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!wZ.has(X))continue;let J=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],Q=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&Q===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function s$($){let Z=$.trim(),Y=oq(Z);sq(Y,Z),rq(Z);for(let X of VZ)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!LZ.allowBracketNotation&&nq.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function aq($){let Z={};Z.Math=Math,Z.JSON=JSON,Z.Date=Date,Z.String=String,Z.Number=Number,Z.Boolean=Boolean,Z.Array=Array,Z.parseInt=Number.parseInt,Z.parseFloat=Number.parseFloat,Z.isNaN=Number.isNaN,Z.isFinite=Number.isFinite,Z.encodeURIComponent=encodeURIComponent,Z.decodeURIComponent=decodeURIComponent;for(let[Y,X]of Object.entries($)){if(Y.startsWith("__")||VZ.some((J)=>J.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=K3(X);else Z[Y]=X}return Z}function K3($,Z=0){if(Z>=LZ.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>K3(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,J]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(J&&typeof J==="object")Y[X]=K3(J,Z+1);else Y[X]=J}return Y}function Z0($,Z){try{let Y=aq(Z),X=Object.keys(Y),J=Object.values(Y);return G0($,X)(...J)}catch{return}}function Q0($){try{return s$($),!0}catch{return!1}}function O0($,Z){try{let Y=Z0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function G0($,Z){let Y=s$($),X=/^[A-Za-z_$][\w$]*$/,J=[],Q=[];for(let W=0;W<Z.length;W++){let z=Z[W];if(!X.test(z))continue;if(RZ.has(z))continue;J.push(W),Q.push(z)}let G=(W)=>Function(...Q,...W,`
2060
2060
  'use strict';
2061
2061
  try {
2062
2062
  return ${Y};
@@ -2067,7 +2067,7 @@ catch (e) {
2067
2067
  }
2068
2068
  throw e;
2069
2069
  }
2070
- `),K=G([]);if(Q.length===Z.length)return FZ(K,Q,G);return FZ((...W)=>{let z=Array(J.length);for(let U=0;U<J.length;U++)z[U]=W[J[U]];return K(...z)},Q,G,(W)=>{K=G(W)})}function FZ($,Z,Y,X){let Q=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let z=0;z<=8;z++)try{return G(...W)}catch(U){let j=U instanceof Error?U.message:"",H=Q.exec(j);if(!(U instanceof ReferenceError)||!H)return;let B=H[1];if(q.has(B)||RZ.has(B))return;q.add(B),K.push(B),G=Y(K),X?.(K)}return}}function r$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var lq,LZ,VZ,cq,wZ,iq,RZ;var F0=b(()=>{lq={maxSanitizeDepth:10,allowBracketNotation:!1},LZ={...lq},VZ=[/\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/],cq=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"]),wZ=new Set(["__proto__","constructor","prototype"]),iq=/[\w)\]]\s*\[\s*['"]/;RZ=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 a$($,Z){let Y=aq++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return tq.set(X,{type:$,expression:Z}),X}var aq=0,tq;var NZ=b(()=>{tq=new Map});function DZ($,Z,Y,X){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)return-1;X.lastIndex=Y.lastIndex;let Q=X.exec($);if(!Q)return-1;return Q.index+Q[0].length}function R1($,Z){return DZ($,Z,AZ,MZ)}function O5($,Z){return DZ($,Z,TZ,IZ)}function J$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function eq($,Z){if($.startsWith("<!--",Z)){let Y=J$($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[AZ,MZ],[TZ,IZ]]){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)continue;X.lastIndex=Y.lastIndex;let Q=X.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function q3($,Z){let Y=[],X=0,J=$.length,Q=!1,G=null;while(X<J){let K=$[X];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;X++;continue}if(K!=="<"){X++;continue}let q=Z($,X);if(q>X){Y.push({start:X,end:q,token:$.slice(X,q)}),X=q;continue}let W=eq($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))Q=!0;X++}return Y}function Z1($,Z,Y){let X=q3($,Z);if(X.length===0)return{output:$,tokens:[]};let J=X.map((K)=>K.token),Q="",G=0;for(let K=0;K<X.length;K++){let q=X[K];Q+=$.slice(G,q.start),Q+=Y(q.token,K),G=q.end}return Q+=$.slice(G),{output:Q,tokens:J}}function N1($){let{output:Z,tokens:Y}=Z1($,R1,(X,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:Z,scripts:Y}}function Q$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var AZ,MZ,TZ,IZ;var u1=b(()=>{AZ=/<script\b[^>]*>/iy,MZ=/<\/script\s*>/ig,TZ=/<style\b[^>]*>/iy,IZ=/<\/style\s*>/ig});var PZ={};o(PZ,{usesSignalsInScript:()=>z1,unescapeHtml:()=>KW,registerFilters:()=>ZW,registerFilter:()=>bZ,processExpressions:()=>A1,interpolateScriptsInTemplate:()=>XW,interpolateScriptExpressions:()=>t$,getAllFilters:()=>SZ,evaluateExpression:()=>p0,escapeHtml:()=>s0,defaultFilters:()=>K$,clearCustomFilters:()=>YW,applyFilters:()=>yZ});function $W($){let Z=EZ.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),EZ.set($,Z)}return Z.lastIndex=0,Z}function bZ($,Z){if($ in K$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);G$[$]=Z}function ZW($){for(let[Z,Y]of Object.entries($))bZ(Z,Y)}function SZ(){return{...K$,...G$}}function YW(){for(let $ of Object.keys(G$))delete G$[$]}function s0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function z1($){let{scripts:Z}=N1($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let J=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function kZ($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",Q=!1,G=0;for(let W=0;W<X.length;W++){let z=X[W];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&X[W+1]==="{"){G++,W++,J+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){J+=z;continue}continue}J+=z}X=J;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function t$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=p0(J,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{let Q=J.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=p0(J,Z);if(G===void 0)return X;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return X}}),Y}function XW($,Z,Y={}){let{output:X,scripts:J}=N1($),Q=J.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!K||!q||W===-1)return G;let z=K[1],U=K[2];if(/\bsrc\s*=/.test(z))return G;if(/\bdata-raw\b/.test(z))return G;if(/\btype\s*=\s*["']application\/json["']/.test(z))return G;if(Y.skipServer&&/\bserver\b/.test(z))return G;let j=t$(U,Z);return q[0]+j+G.slice(W)});return Q$(X,Q)}function A1($,Z,Y){let X=$,J=(U,j)=>{let H=O5(U,j);if(H===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(j,H))?-1:H},Q=(U,j,H,B)=>{let _=H.length,{output:O,tokens:F}=Z1(U,j,(L,V)=>B(_+V));return H.push(...F),O},G=[];X=Q(X,J,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let K=[];X=Q(X,R1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let q=Z?.__stx_signals_gate===!0||z1($),W=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,j,H)=>{try{let B=p0(j,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${_}`,Y,$,H,U)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(U,j,H)=>{try{let B=p0(j,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return a$("raw",j.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return a$("raw",j.trim());let _=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${_}`,Y,$,H,U)}}),X=Q(X,R1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),X=Q(X,J,G,(U)=>`<!--__STX_STYLE_${U}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(U,j,H)=>{let B=j.trim();if(z.has(B))return U;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(O)?.[1],V=L&&((L in Z)||_.includes(L)),w=Boolean(L&&W.has(L)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=B.match(R),A=N&&!_.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let M=p0(j,Z);if(w)return U;if(q&&!kZ(B,Z))return U;if(M===void 0&&Z.__stx_buildMode==="compile"&&!q)return a$("expr",B);return M!==void 0&&M!==null?s0(String(M)):""}catch(M){if(w)return U;if(q&&!kZ(B,Z))return U;if(A)return U;let I=M instanceof Error?M.message:String(M);return z0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,Y,$,H,U)}});for(let U=0;U<K.length;U++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>K[U]);for(let U=0;U<G.length;U++)X=X.replace(`<!--__STX_STYLE_${U}__-->`,()=>G[U]);return X}function yZ($,Z,Y){if(!Z.trim())return $;let X=$,J=Z.trim();while(J.length>0){let Q=J.match(/^(\w+)/);if(!Q)break;let G=Q[1];J=J.substring(G.length).trim();let K=G$[G]||K$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(SZ()).join(", ")}`);let q=[];if(J.startsWith(":")){let W=J.match(/^:([^|\s]+)/);if(W){let z=W[1].trim();try{let U=Number(z);q=[Number.isNaN(U)?z:U]}catch{q=[z]}J=J.substring(W[0].length).trim()}}else if(J.startsWith("(")){let W=1,z=1;while(W>0&&z<J.length){if(J[z]==="(")W++;if(J[z]===")")W--;z++}if(W===0){let U=J.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[p0(`(${U})`,Y,!0)];else{let j=[],H="",B=null,_=0,O=0,F=0,L=!1;for(let V=0;V<U.length;V++){let w=U[V];if(L){H+=w,L=!1;continue}if(w==="\\"){H+=w,L=!0;continue}if(B){if(H+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,H+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&_===0&&O===0&&F===0){j.push(H),H="";continue}H+=w}if(H)j.push(H);q=j.map((V)=>{let w=V.trim();return p0(w,Y,!0)})}}catch{q=[U]}J=J.substring(z).trim()}}try{X=K(X,Y,...q)}catch(W){let z=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${z}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return X}function JW($){let Z=!1,Y="",X=0,J=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&X===0&&J===0&&Q===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function p0($,Z,Y=!1){try{let X=$.trim(),J=JW(X);if(J>0){let Q=X.substring(0,J).trim(),G=X.substring(J+1).trim(),K=p0(Q,Z,!0);return yZ(K,G,Z)}if(!Q0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Z0(X,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return G0(X,Q)(...G)}catch{return Z0(X,Z)}}catch(X){if(X instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(X.message);if(J){let Q=J[1],G=QW(Q,Object.keys(Z));if(G&&G!==Q)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function QW($,Z){let Y=null;for(let J of Z){if(J===$)continue;let Q=GW($,J);if(Y===null||Q<Y.dist)Y={key:J,dist:Q}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function GW($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],J=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)J[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,J[K]+1,J[K-1]+q)}for(let K=0;K<=Y.length;K++)J[K]=Q[K]}return J[Y.length]}function KW($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var G$,EZ,K$;var Y1=b(()=>{F0();R0();NZ();u1();G$={},EZ=new Map;K$={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return s0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,J=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let q of Q){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return J?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace($W(q),String(W))}),K},t:($,Z,Y={})=>{return K$.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let J=String($);if(J.length<=Y)return J;if(Y<=X.length)return X.substring(0,Y);return J.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let J=$ instanceof Date?$:new Date($);if(Number.isNaN(J.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return J.toISOString();return new Intl.DateTimeFormat(X,Q[Y]||Q.short).format(J)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(J)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let J=Number($);if(Number.isNaN(J))return Y;let Q=X||`${Y}s`;return J===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let J=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(J,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let J=10**Y;return Math.round(X*J)/J}}});class p1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function L5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!F5.has(Y)){if(F5.size>=qW){let X=F5.keys().next().value;if(X)F5.delete(X)}F5.set(Y,new RegExp($,Z))}return F5.get(Y)}class CZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let J=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,z=J.get(W);if(!z){if(J.size>=Q){let U=J.keys().next().value;if(U)J.delete(U)}z=Function(...Z,`
2070
+ `),K=G([]);if(Q.length===Z.length)return FZ(K,Q,G);return FZ((...W)=>{let z=Array(J.length);for(let U=0;U<J.length;U++)z[U]=W[J[U]];return K(...z)},Q,G,(W)=>{K=G(W)})}function FZ($,Z,Y,X){let Q=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let z=0;z<=8;z++)try{return G(...W)}catch(U){let j=U instanceof Error?U.message:"",H=Q.exec(j);if(!(U instanceof ReferenceError)||!H)return;let B=H[1];if(q.has(B)||RZ.has(B))return;q.add(B),K.push(B),G=Y(K),X?.(K)}return}}function r$($){let Z=$.trim(),Y=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let X of Y)if(X.test(Z))return!1;return!0}var cq,LZ,VZ,iq,wZ,nq,RZ;var F0=b(()=>{cq={maxSanitizeDepth:10,allowBracketNotation:!1},LZ={...cq},VZ=[/\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/],iq=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"]),wZ=new Set(["__proto__","constructor","prototype"]),nq=/[\w)\]]\s*\[\s*['"]/;RZ=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 a$($,Z){let Y=tq++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return eq.set(X,{type:$,expression:Z}),X}var tq=0,eq;var NZ=b(()=>{eq=new Map});function DZ($,Z,Y,X){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)return-1;X.lastIndex=Y.lastIndex;let Q=X.exec($);if(!Q)return-1;return Q.index+Q[0].length}function R1($,Z){return DZ($,Z,AZ,MZ)}function O5($,Z){return DZ($,Z,TZ,IZ)}function J$($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function $W($,Z){if($.startsWith("<!--",Z)){let Y=J$($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[AZ,MZ],[TZ,IZ]]){Y.lastIndex=Z;let J=Y.exec($);if(!J||J.index!==Z)continue;X.lastIndex=Y.lastIndex;let Q=X.exec($);return Q?Q.index+Q[0].length:$.length}return-1}function q3($,Z){let Y=[],X=0,J=$.length,Q=!1,G=null;while(X<J){let K=$[X];if(Q){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")Q=!1;X++;continue}if(K!=="<"){X++;continue}let q=Z($,X);if(q>X){Y.push({start:X,end:q,token:$.slice(X,q)}),X=q;continue}let W=$W($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))Q=!0;X++}return Y}function Z1($,Z,Y){let X=q3($,Z);if(X.length===0)return{output:$,tokens:[]};let J=X.map((K)=>K.token),Q="",G=0;for(let K=0;K<X.length;K++){let q=X[K];Q+=$.slice(G,q.start),Q+=Y(q.token,K),G=q.end}return Q+=$.slice(G),{output:Q,tokens:J}}function N1($){let{output:Z,tokens:Y}=Z1($,R1,(X,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:Z,scripts:Y}}function Q$($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var AZ,MZ,TZ,IZ;var u1=b(()=>{AZ=/<script\b[^>]*>/iy,MZ=/<\/script\s*>/ig,TZ=/<style\b[^>]*>/iy,IZ=/<\/style\s*>/ig});var CZ={};o(CZ,{usesSignalsInScript:()=>z1,unescapeHtml:()=>qW,registerFilters:()=>YW,registerFilter:()=>bZ,processExpressions:()=>A1,interpolateScriptsInTemplate:()=>JW,interpolateScriptExpressions:()=>t$,interpolateScriptAttributes:()=>yZ,getAllFilters:()=>SZ,evaluateExpression:()=>C0,escapeHtml:()=>s0,defaultFilters:()=>K$,clearCustomFilters:()=>XW,applyFilters:()=>PZ});function ZW($){let Z=EZ.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),EZ.set($,Z)}return Z.lastIndex=0,Z}function bZ($,Z){if($ in K$)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);G$[$]=Z}function YW($){for(let[Z,Y]of Object.entries($))bZ(Z,Y)}function SZ(){return{...K$,...G$}}function XW(){for(let $ of Object.keys(G$))delete G$[$]}function s0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function z1($){let{scripts:Z}=N1($);for(let Y of Z){let X=Y.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!X||/\bserver\b|\bsrc\s*=/.test(X[1]))continue;let J=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test($))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test($))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test($))return!0;return!1}function kZ($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",Q=!1,G=0;for(let W=0;W<X.length;W++){let z=X[W];if(!Q&&z==="`"){Q=!0,G=0;continue}if(Q){if(z==="`"&&G===0){Q=!1;continue}if(z==="$"&&X[W+1]==="{"){G++,W++,J+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){J+=z;continue}continue}J+=z}X=J;let K=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function t$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=C0(J,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{let Q=J.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=C0(J,Z);if(G===void 0)return X;return JSON.stringify(G).replace(/</g,"\\u003c")}catch{return X}}),Y}function yZ($,Z){if(!$.includes("{"))return $;let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,J)=>{try{let Q=C0(J,Z);if(Q===void 0)return X;return Q===null?"":String(Q)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,J)=>{let Q=J.trim();if(/^__[A-Z_]+__$/.test(Q))return X;try{let G=C0(J,Z);if(G===void 0)return X;if(G===null)return"";return String(G).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return X}}),Y}function JW($,Z,Y={}){let{output:X,scripts:J}=N1($),Q=J.map((G)=>{let K=G.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),q=G.match(/^<script\b[^>]*>/i),W=G.search(/<\/script\s*>$/i);if(!K||!q||W===-1)return G;let z=K[1],U=K[2];if(/\bdata-raw\b/.test(z))return G;if(Y.skipServer&&/\bserver\b/.test(z))return G;let H=`<script${yZ(z,Z)}>`;if(/\bsrc\s*=/.test(z)||/\btype\s*=\s*["']application\/json["']/.test(z))return H+U+G.slice(W);return H+t$(U,Z)+G.slice(W)});return Q$(X,Q)}function A1($,Z,Y){let X=$,J=(U,j)=>{let H=O5(U,j);if(H===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(U.slice(j,H))?-1:H},Q=(U,j,H,B)=>{let _=H.length,{output:O,tokens:F}=Z1(U,j,(L,V)=>B(_+V));return H.push(...F),O},G=[];X=Q(X,J,G,(U)=>`<!--__STX_STYLE_${U}__-->`);let K=[];X=Q(X,R1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`);let q=Z?.__stx_signals_gate===!0||z1($),W=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),z=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);X=X.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(U,j,H)=>{try{let B=C0(j,Z);return B!==void 0&&B!==null?String(B):""}catch(B){let _=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {{{ ${j.trim()}}}}: ${_}`,Y,$,H,U)}}),X=X.replace(/\{!!([\s\S]*?)!!\}/g,(U,j,H)=>{try{let B=C0(j,Z);if(B===void 0&&Z.__stx_buildMode==="compile")return a$("raw",j.trim());return B!==void 0&&B!==null?String(B):""}catch(B){if(Z.__stx_buildMode==="compile")return a$("raw",j.trim());let _=B instanceof Error?B.message:String(B);return z0("Expression",`Error evaluating: {!! ${j.trim()} !!}: ${_}`,Y,$,H,U)}}),X=Q(X,R1,K,(U)=>`<!--__STX_SCRIPT_EXPR_${U}__-->`),X=Q(X,J,G,(U)=>`<!--__STX_STYLE_${U}__-->`),X=X.replace(/\{\{([\s\S]*?)\}\}/g,(U,j,H)=>{let B=j.trim();if(z.has(B))return U;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],O=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=B.match(O)?.[1],V=L&&((L in Z)||_.includes(L)),w=Boolean(L&&W.has(L)),R=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=B.match(R),A=N&&!_.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(B))return"";try{let M=C0(j,Z);if(w)return U;if(q&&!kZ(B,Z))return U;if(M===void 0&&Z.__stx_buildMode==="compile"&&!q)return a$("expr",B);return M!==void 0&&M!==null?s0(String(M)):""}catch(M){if(w)return U;if(q&&!kZ(B,Z))return U;if(A)return U;let I=M instanceof Error?M.message:String(M);return z0("Expression",`Error evaluating: {{ ${B} }}: ${I}`,Y,$,H,U)}});for(let U=0;U<K.length;U++)X=X.replace(`<!--__STX_SCRIPT_EXPR_${U}__-->`,()=>K[U]);for(let U=0;U<G.length;U++)X=X.replace(`<!--__STX_STYLE_${U}__-->`,()=>G[U]);return X}function PZ($,Z,Y){if(!Z.trim())return $;let X=$,J=Z.trim();while(J.length>0){let Q=J.match(/^(\w+)/);if(!Q)break;let G=Q[1];J=J.substring(G.length).trim();let K=G$[G]||K$[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(SZ()).join(", ")}`);let q=[];if(J.startsWith(":")){let W=J.match(/^:([^|\s]+)/);if(W){let z=W[1].trim();try{let U=Number(z);q=[Number.isNaN(U)?z:U]}catch{q=[z]}J=J.substring(W[0].length).trim()}}else if(J.startsWith("(")){let W=1,z=1;while(W>0&&z<J.length){if(J[z]==="(")W++;if(J[z]===")")W--;z++}if(W===0){let U=J.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[C0(`(${U})`,Y,!0)];else{let j=[],H="",B=null,_=0,O=0,F=0,L=!1;for(let V=0;V<U.length;V++){let w=U[V];if(L){H+=w,L=!1;continue}if(w==="\\"){H+=w,L=!0;continue}if(B){if(H+=w,w===B)B=null;continue}if(w==='"'||w==="'"||w==="`"){B=w,H+=w;continue}if(w==="(")_++;else if(w===")")_--;else if(w==="[")O++;else if(w==="]")O--;else if(w==="{")F++;else if(w==="}")F--;if(w===","&&_===0&&O===0&&F===0){j.push(H),H="";continue}H+=w}if(H)j.push(H);q=j.map((V)=>{let w=V.trim();return C0(w,Y,!0)})}}catch{q=[U]}J=J.substring(z).trim()}}try{X=K(X,Y,...q)}catch(W){let z=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${z}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return X}function QW($){let Z=!1,Y="",X=0,J=0,Q=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let z=1;K+=2;while(K<$.length&&z>0){if($[K]==="{")z++;else if($[K]==="}")z--;if(z>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")J++;else if(q==="]")J--;else if(q==="{")Q++;else if(q==="}")Q--;if(q==="|"&&X===0&&J===0&&Q===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function C0($,Z,Y=!1){try{let X=$.trim(),J=QW(X);if(J>0){let Q=X.substring(0,J).trim(),G=X.substring(J+1).trim(),K=C0(Q,Z,!0);return PZ(K,G,Z)}if(!Q0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Z0(X,Z)}try{let Q=Object.keys(Z),G=Object.values(Z);return G0(X,Q)(...G)}catch{return Z0(X,Z)}}catch(X){if(X instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(X.message);if(J){let Q=J[1],G=GW(Q,Object.keys(Z));if(G&&G!==Q)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function GW($,Z){let Y=null;for(let J of Z){if(J===$)continue;let Q=KW($,J);if(Y===null||Q<Y.dist)Y={key:J,dist:Q}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function KW($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],J=Array(Y.length+1),Q=Array(Y.length+1);for(let G=0;G<=Y.length;G++)J[G]=G;for(let G=1;G<=X.length;G++){Q[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;Q[K]=Math.min(Q[K-1]+1,J[K]+1,J[K-1]+q)}for(let K=0;K<=Y.length;K++)J[K]=Q[K]}return J[Y.length]}function qW($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var G$,EZ,K$;var Y1=b(()=>{F0();R0();NZ();u1();G$={},EZ=new Map;K$={uppercase:($,Z)=>{return $!==void 0&&$!==null?String($).toUpperCase():""},lowercase:($,Z)=>{return $!==void 0&&$!==null?String($).toLowerCase():""},capitalize:($,Z)=>{if($===void 0||$===null)return"";let Y=String($);return Y.charAt(0).toUpperCase()+Y.slice(1)},number:($,Z,Y=0)=>{if($===void 0||$===null)return"";try{let X=Number($);return Number.isNaN(X)?"":X.toFixed(Number.parseInt(String(Y),10))}catch{return""}},fmt:($,Z,Y="en-US")=>{if($===void 0||$===null)return"";try{let X=Number($);if(Number.isNaN(X))return String($);return X.toLocaleString(Y)}catch{return String($)}},join:($,Z,Y=",")=>{if(!Array.isArray($))return"";return $.join(String(Y))},escape:($,Z)=>{if($===void 0||$===null)return"";return s0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,J=Z.__i18nConfig?.fallbackToKey??!0,Q=String($).split("."),G=X;for(let q of Q){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return J?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(ZW(q),String(W))}),K},t:($,Z,Y={})=>{return K$.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let J=String($);if(J.length<=Y)return J;if(Y<=X.length)return X.substring(0,Y);return J.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let J=$ instanceof Date?$:new Date($);if(Number.isNaN(J.getTime()))return String($);let Q={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return J.toISOString();return new Intl.DateTimeFormat(X,Q[Y]||Q.short).format(J)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let J=Number($);if(Number.isNaN(J))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(J)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let J=Number($);if(Number.isNaN(J))return Y;let Q=X||`${Y}s`;return J===1?Y:Q},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let J=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(J,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let J=10**Y;return Math.round(X*J)/J}}});class p1{cache=new Map;maxSize;constructor($=100){this.maxSize=$}get($){if(!this.cache.has($))return;let Z=this.cache.get($);return this.cache.delete($),this.cache.set($,Z),Z}set($,Z){if(this.cache.has($))this.cache.delete($);else if(this.cache.size>=this.maxSize){let Y=this.cache.keys().next().value;if(Y!==void 0)this.cache.delete(Y)}this.cache.set($,Z)}has($){return this.cache.has($)}delete($){return this.cache.delete($)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function L5($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!F5.has(Y)){if(F5.size>=WW){let X=F5.keys().next().value;if(X)F5.delete(X)}F5.set(Y,new RegExp($,Z))}return F5.get(Y)}class vZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let J=this.fnCache,Q=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,z=J.get(W);if(!z){if(J.size>=Q){let U=J.keys().next().value;if(U)J.delete(U)}z=Function(...Z,`
2071
2071
  'use strict';
2072
2072
  try {
2073
2073
  return ${q};
@@ -2078,34 +2078,34 @@ catch (e) {
2078
2078
  }
2079
2079
  throw e;
2080
2080
  }
2081
- `),J.set(W,z)}return z(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class vZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),J=performance.now()-Y;return this.recordTime($,J),this.checkBudget($,J),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),J=performance.now()-Y;return this.recordTime($,J),this.checkBudget($,J),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,J=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!J&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:J};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=J?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let J=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:J?.maxTime,budgetUtilization:J?X.totalTime/X.count/J.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function WW(){if(!W3)W3=new vZ;return W3}var F5,qW=500,EL,W3=null,xZ;var V5=b(()=>{F5=new Map;EL=new CZ;xZ=new Proxy({},{get($,Z){return WW()[Z]}})});function fZ($,Z=""){let Y=`${$}${Z}`,X=0;for(let J=0;J<Y.length;J++){let Q=Y.charCodeAt(J);X=(X<<5)-X+Q,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function gZ($,Z,Y={}){let{prefix:X="",preserveHost:J=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=z3($),q=[],W=new Map;if(Q)for(let z of K){let U=z.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let j=U[1],H=`${Z}_${j}`;W.set(j,H)}}for(let z of K){let U=hZ(z,Z,X,J,W,G);q.push(U)}return q.join(`
2081
+ `),J.set(W,z)}return z(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class xZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),J=performance.now()-Y;return this.recordTime($,J),this.checkBudget($,J),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),J=performance.now()-Y;return this.recordTime($,J),this.checkBudget($,J),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,J=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,Q=Z>=Y.maxTime;if(!J&&!Q)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:J};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=J?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(Q)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let J=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:J?.maxTime,budgetUtilization:J?X.totalTime/X.count/J.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function zW(){if(!W3)W3=new xZ;return W3}var F5,WW=500,kL,W3=null,fZ;var V5=b(()=>{F5=new Map;kL=new vZ;fZ=new Proxy({},{get($,Z){return zW()[Z]}})});function gZ($,Z=""){let Y=`${$}${Z}`,X=0;for(let J=0;J<Y.length;J++){let Q=Y.charCodeAt(J);X=(X<<5)-X+Q,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function hZ($,Z,Y={}){let{prefix:X="",preserveHost:J=!0,scopeKeyframes:Q=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=z3($),q=[],W=new Map;if(Q)for(let z of K){let U=z.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let j=U[1],H=`${Z}_${j}`;W.set(j,H)}}for(let z of K){let U=mZ(z,Z,X,J,W,G);q.push(U)}return q.join(`
2082
2082
 
2083
2083
  `)}function z3($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,J="",Q=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)Q=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(Q){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,z,U,j]=W;if(z==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:j.trim()});else if(z==="media"||z==="supports"||z==="container"){let H=z3(j);Z.push({selector:`@${z} ${U.trim()}`,declarations:H.map((B)=>`${B.selector} { ${B.declarations} }`).join(`
2084
- `)})}else Z.push({selector:`@${z} ${U.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(J.trim()){J+=q;let W=J.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});J=""}continue}}if(Q)G+=q;else J+=q}return Z}function hZ($,Z,Y,X,J,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${J.get(z)||z} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=z3(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>hZ(j,Z,Y,X,J,Q)).join(`
2084
+ `)})}else Z.push({selector:`@${z} ${U.trim()}`,declarations:j.trim()})}G="",Q=!1}else if(J.trim()){J+=q;let W=J.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});J=""}continue}}if(Q)G+=q;else J+=q}return Z}function mZ($,Z,Y,X,J,Q){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${J.get(z)||z} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=z3(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((j)=>mZ(j,Z,Y,X,J,Q)).join(`
2085
2085
  `);return`${G} {
2086
2086
  ${U}
2087
- }`}return`${G} { ${K} }`}let q=zW(G,Z,Y,X),W=K;for(let[z,U]of J)W=W.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(Q)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function zW($,Z,Y,X){let J=$.split(",").map((G)=>G.trim()),Q=[];for(let G of J){if(G.startsWith(":host")){if(X)Q.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(W)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let q=UW(G,Z);if(q)Q.push(Y?`${Y} ${q}`:q)}return Q.join(", ")}function UW($,Z){let Y=0,X=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Y++;else if(W==="]"||W===")")Y--;else if(Y===0&&(W===" "||W===">"||W==="+"||W==="~")){X=q;break}}let J=$.slice(0,X),Q=$.slice(X);if(!J)return"";let G=J.length,K=0;for(let q=0;q<J.length;q++){let W=J[q];if(W==="["||W==="(")K++;else if(W==="]"||W===")")K--;else if(Y===0&&K===0&&W===":"){G=q;break}}return`${J.slice(0,G)}.${Z}${J.slice(G)}${Q}`}function dZ($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let X=Y.trim();if(Z.has(X))return"";return Z.add(X),Y})}function e$($,Z){if(!jW.test($))return{html:$,hasScoped:!1};let Y=fZ(Z),X=`data-v-${Y}`,J=$,Q=new RegExp(`<style\\s+([^>]*${U3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(J=J.replace(Q,(K,q,W)=>{G=!0;let z=BW(W,X),U=q.replace(new RegExp(U3,"gi"),"").trim(),j=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${j}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return J=_W(J,X),{html:J,hasScoped:!0}}function BW($,Z){return gZ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function _W($,Z){let Y=Z1($,(J,Q)=>{let G=R1(J,Q);return G>Q?G:O5(J,Q)},(J,Q)=>HW(Q)),X=OW(Y.output,Z);return mZ.lastIndex=0,X.replace(mZ,(J,Q)=>Y.tokens[Number(Q)])}function OW($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(X,J,Q)=>{if(Y.has(J.toLowerCase()))return X;if(X.includes(Z))return X;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return X;if(Q)return X.replace(`<${J}${Q}`,`<${J} ${Z}${Q}`);if(X.endsWith("/>"))return`<${J} ${Z} />`;return`<${J} ${Z}>`})}var U3,jW,HW=($)=>`\x00stx-scope-mask-${$}\x00`,mZ;var j3=b(()=>{u1();U3=String.raw`(?<![\w-])scoped(?![\w-])`,jW=new RegExp(`<style\\s+[^>]*${U3}`,"i");mZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function LW($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return FW.test(Z)}function $4($){q$.lastIndex=0;let Z;while((Z=q$.exec($))!==null){if(Z[0].startsWith("</")||LW(Z[0]))continue;let Y=Z.index,X=q$.lastIndex,J=1,Q;while((Q=q$.exec($))!==null)if(Q[0].startsWith("</")){if(J--,J===0){let G=Q.index;return{start:Y,openEnd:X,closeStart:G,end:q$.lastIndex,content:$.slice(X,G)}}}else J++;return null}return null}var q$,FW;var B3=b(()=>{q$=/<\/?template\b[^>]*>/gi,FW=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var uZ=()=>{};function M0($,Z,Y,X=0){let J=0,Q=X,G=null,K=0,q=!1;while(Q<$.length){let W=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&W==="\\"){q=!0,Q++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,Q++;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&W==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&W==="}"){K--,Q++;continue}if(W==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(W===Z)J++;else if(W===Y){if(J--,J===0)return Q}Q++}return-1}var O3={};o(O3,{useTitle:()=>AW,useSeoMeta:()=>pZ,usePageTitle:()=>AW,useHead:()=>_3,seoMetaToHeadConfig:()=>Y4,resetHead:()=>RW,renderHtmlAttrs:()=>TW,renderHead:()=>MW,renderBodyAttrs:()=>IW,processTitleDirective:()=>kW,processMetaDirective:()=>bW,processHeadDirective:()=>EW,mergeHeadConfigs:()=>w5,getPageMeta:()=>wW,getHead:()=>H3,definePageMeta:()=>NW,applyHead:()=>DW});function H3(){return M1}function wW(){return Z4}function RW(){M1={},VW.length=0,Z4={}}function _3($){M1=w5(M1,$)}function w5($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function pZ($){_3(Y4($))}function Y4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let J=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(J)Z.push({name:"twitter:title",content:J});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function NW($){if(Z4={...Z4,...$},$.title||$.description)pZ({title:$.title,description:$.description})}function AW($){let Z=typeof $==="function"?$():$;_3({title:Z})}function MW($=M1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${l1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,J])=>`${X}="${l1(J)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>{return`${J==="httpEquiv"?"http-equiv":J}="${l1(String(Q))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>`${J}="${l1(String(Q))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...J}=Y,Q=Object.entries(J).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${l1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${Q}>${X}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
2088
- `)}function TW($=M1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${l1(Y)}"`).join(" ")}function IW($=M1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${l1(Y)}"`).join(" ")}function l1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function DW($=M1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[J,Q]of Object.entries(Z))if(Q!==void 0)X.setAttribute(J,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))if(Z==="class")for(let X of String(Y).split(/\s+/).filter(Boolean))document.documentElement.classList.add(X);else document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function EW($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,J)=>{return Z+=J.trim()+`
2089
- `,""}),headContent:Z.trim()}}function kW($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,J,Q)=>{let G=X?J:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=w5(K,{title:G}),""})}function bW($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,J,Q,G,K)=>{let q=Q?G:K,W=Q?q:Z[(q||"").trim()]??q,U=J.includes(":")?{property:J,content:W}:{name:J,content:W},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=w5(j,{meta:[U]}),""})}var M1,VW,Z4;var W$=b(()=>{M1={},VW=[],Z4={}});var X4={};o(X4,{stripTypeScript:()=>oZ,splitDeclaration:()=>$2,isModuleResolutionFailure:()=>sZ,isMissingBindingFailure:()=>rZ,isCompleteImport:()=>aZ,hasVariables:()=>J2,extractVariables:()=>c1,extractScriptFromTemplate:()=>X2,convertToCommonJS:()=>L3});import T1 from"path";import R5 from"process";function SW($){let Z=[],Y=0,X=$.split(`
2090
- `);for(let J of X){let Q=Y,G=null,K=!1;for(let q=0;q<J.length;q++){let W=J[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<J.length&&J[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(Q===0){let q=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let W=J.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let U=W[1].slice(1,-1).split(",").map((j)=>{let H=j.split(":");return(H.length>1?H[1]:H[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...U)}}}}return[...new Set(Z)]}function oZ($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let J=[],Q="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let z=X[W];if(q){if(Q+=z,z===q)q=null;continue}if(z==='"'||z==="'"||z==="`"){q=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")K++;else if(z===")")K--;if(z===","&&G===0&&K===0){J.push(Q),Q="";continue}Q+=z}if(Q)J.push(Q);return J.map((W)=>{let z=W.trim(),U=z.startsWith("..."),j=U?z.slice(3):z,H=-1,B=0;for(let R=0;R<j.length;R++)if(j[R]==="<")B++;else if(j[R]===">")B--;else if(j[R]===":"&&B===0){H=R;break}if(H===-1)return W;let O=j.substring(0,H).trim().replace(/\?$/,""),F=j.substring(H+1),L=-1,V=0;for(let R=0;R<F.length;R++)if(F[R]==="<")V++;else if(F[R]===">")V--;else if(F[R]==="="&&V===0){L=R;break}let w=U?"...":"";if(L!==-1)return`${w}${O} = ${F.substring(L+1).trim()}`;return`${w}${O}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,J,Q)=>{if(!Q.includes(":"))return X;return`${J}(${Y(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,J,Q=[];while((J=X.exec(Z))!==null){let G=J.index+J[0].length-1,K=1,q=G+1,W=0,z=null;while(q<Z.length&&K>0){let H=Z[q];if(z){if(H===z)z=null;q++;continue}if(H==='"'||H==="'"||H==="`"){z=H,q++;continue}if(H==="<")W++;else if(H===">"&&W>0)W--;else if(W===0){if(H==="(")K++;else if(H===")")K--}if(K>0)q++}if(K!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let j=Y(U);Q.push({start:G+1,end:q,replacement:j})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=Q[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,J)=>{if(!J.includes(":"))return X;if(J.includes("{")||J.includes("}"))return X;return`(${J.split(",").map((G)=>{let[K,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
2087
+ }`}return`${G} { ${K} }`}let q=UW(G,Z,Y,X),W=K;for(let[z,U]of J)W=W.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(Q)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function UW($,Z,Y,X){let J=$.split(",").map((G)=>G.trim()),Q=[];for(let G of J){if(G.startsWith(":host")){if(X)Q.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);Q.push(W)}continue}if(G.includes("::slotted")){Q.push(G);continue}if(G===":root"){Q.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;Q.push(`${K} ${G}`);let q=jW(G,Z);if(q)Q.push(Y?`${Y} ${q}`:q)}return Q.join(", ")}function jW($,Z){let Y=0,X=$.length;for(let q=0;q<$.length;q++){let W=$[q];if(W==="["||W==="(")Y++;else if(W==="]"||W===")")Y--;else if(Y===0&&(W===" "||W===">"||W==="+"||W==="~")){X=q;break}}let J=$.slice(0,X),Q=$.slice(X);if(!J)return"";let G=J.length,K=0;for(let q=0;q<J.length;q++){let W=J[q];if(W==="["||W==="(")K++;else if(W==="]"||W===")")K--;else if(Y===0&&K===0&&W===":"){G=q;break}}return`${J.slice(0,G)}.${Z}${J.slice(G)}${Q}`}function uZ($){let Z=new Set;return $.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Y)=>{let X=Y.trim();if(Z.has(X))return"";return Z.add(X),Y})}function e$($,Z){if(!BW.test($))return{html:$,hasScoped:!1};let Y=gZ(Z),X=`data-v-${Y}`,J=$,Q=new RegExp(`<style\\s+([^>]*${U3}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(J=J.replace(Q,(K,q,W)=>{G=!0;let z=HW(W,X),U=q.replace(new RegExp(U3,"gi"),"").trim(),j=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${j}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return J=OW(J,X),{html:J,hasScoped:!0}}function HW($,Z){return hZ($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function OW($,Z){let Y=Z1($,(J,Q)=>{let G=R1(J,Q);return G>Q?G:O5(J,Q)},(J,Q)=>_W(Q)),X=FW(Y.output,Z);return dZ.lastIndex=0,X.replace(dZ,(J,Q)=>Y.tokens[Number(Q)])}function FW($,Z){let Y=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return $.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(X,J,Q)=>{if(Y.has(J.toLowerCase()))return X;if(X.includes(Z))return X;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return X;if(Q)return X.replace(`<${J}${Q}`,`<${J} ${Z}${Q}`);if(X.endsWith("/>"))return`<${J} ${Z} />`;return`<${J} ${Z}>`})}var U3,BW,_W=($)=>`\x00stx-scope-mask-${$}\x00`,dZ;var j3=b(()=>{u1();U3=String.raw`(?<![\w-])scoped(?![\w-])`,BW=new RegExp(`<style\\s+[^>]*${U3}`,"i");dZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function VW($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return LW.test(Z)}function $4($){q$.lastIndex=0;let Z;while((Z=q$.exec($))!==null){if(Z[0].startsWith("</")||VW(Z[0]))continue;let Y=Z.index,X=q$.lastIndex,J=1,Q;while((Q=q$.exec($))!==null)if(Q[0].startsWith("</")){if(J--,J===0){let G=Q.index;return{start:Y,openEnd:X,closeStart:G,end:q$.lastIndex,content:$.slice(X,G)}}}else J++;return null}return null}var q$,LW;var B3=b(()=>{q$=/<\/?template\b[^>]*>/gi,LW=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var pZ=()=>{};function M0($,Z,Y,X=0){let J=0,Q=X,G=null,K=0,q=!1;while(Q<$.length){let W=$[Q];if(G&&q){q=!1,Q++;continue}if(G&&W==="\\"){q=!0,Q++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,Q++;continue}if(W===G&&G!=="`"){G=null,Q++;continue}if(G==="`"&&W==="$"&&$[Q+1]==="{"){K++,Q+=2;continue}if(K>0&&W==="}"){K--,Q++;continue}if(W==="`"&&G==="`"&&K===0){G=null,Q++;continue}if(G){Q++;continue}if(W===Z)J++;else if(W===Y){if(J--,J===0)return Q}Q++}return-1}var O3={};o(O3,{useTitle:()=>MW,useSeoMeta:()=>lZ,usePageTitle:()=>MW,useHead:()=>_3,seoMetaToHeadConfig:()=>Y4,resetHead:()=>NW,renderHtmlAttrs:()=>IW,renderHead:()=>TW,renderBodyAttrs:()=>DW,processTitleDirective:()=>bW,processMetaDirective:()=>SW,processHeadDirective:()=>kW,mergeHeadConfigs:()=>w5,getPageMeta:()=>RW,getHead:()=>H3,definePageMeta:()=>AW,applyHead:()=>EW});function H3(){return M1}function RW(){return Z4}function NW(){M1={},wW.length=0,Z4={}}function _3($){M1=w5(M1,$)}function w5($,Z){return{title:Z.title??$.title,titleTemplate:Z.titleTemplate??$.titleTemplate,base:Z.base??$.base,meta:[...$.meta||[],...Z.meta||[]],link:[...$.link||[],...Z.link||[]],script:[...$.script||[],...Z.script||[]],style:[...$.style||[],...Z.style||[]],htmlAttrs:{...$.htmlAttrs,...Z.htmlAttrs},bodyAttrs:{...$.bodyAttrs,...Z.bodyAttrs}}}function lZ($){_3(Y4($))}function Y4($){let Z=[];if($.description)Z.push({name:"description",content:$.description});if($.keywords){let q=Array.isArray($.keywords)?$.keywords.join(", "):$.keywords;Z.push({name:"keywords",content:q})}if($.author)Z.push({name:"author",content:$.author});if($.robots)Z.push({name:"robots",content:$.robots});let Y=$.ogTitle??$.title,X=$.ogDescription??$.description;if(Y)Z.push({property:"og:title",content:Y});if(X)Z.push({property:"og:description",content:X});if($.ogImage)Z.push({property:"og:image",content:$.ogImage});if($.ogUrl)Z.push({property:"og:url",content:$.ogUrl});if($.ogType)Z.push({property:"og:type",content:$.ogType});if($.ogSiteName)Z.push({property:"og:site_name",content:$.ogSiteName});if($.ogLocale)Z.push({property:"og:locale",content:$.ogLocale});let J=$.twitterTitle??$.title,Q=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(J)Z.push({name:"twitter:title",content:J});if(Q)Z.push({name:"twitter:description",content:Q});if(G)Z.push({name:"twitter:image",content:G});if($.twitterSite)Z.push({name:"twitter:site",content:$.twitterSite});if($.twitterCreator)Z.push({name:"twitter:creator",content:$.twitterCreator});if($.articleAuthor)Z.push({property:"article:author",content:$.articleAuthor});if($.articlePublishedTime)Z.push({property:"article:published_time",content:$.articlePublishedTime});if($.articleModifiedTime)Z.push({property:"article:modified_time",content:$.articleModifiedTime});if($.articleSection)Z.push({property:"article:section",content:$.articleSection});if($.articleTags)for(let q of $.articleTags)Z.push({property:"article:tag",content:q});let K=[];if($.canonical)K.push({rel:"canonical",href:$.canonical});return{title:$.title,titleTemplate:$.titleTemplate,meta:Z,link:K}}function AW($){if(Z4={...Z4,...$},$.title||$.description)lZ({title:$.title,description:$.description})}function MW($){let Z=typeof $==="function"?$():$;_3({title:Z})}function TW($=M1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${l1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,J])=>`${X}="${l1(J)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>{return`${J==="httpEquiv"?"http-equiv":J}="${l1(String(Q))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([J,Q])=>Q!==void 0).map(([J,Q])=>`${J}="${l1(String(Q))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...J}=Y,Q=Object.entries(J).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${l1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${Q}>${X}</script>`);else Z.push(`<script ${Q}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
2088
+ `)}function IW($=M1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${l1(Y)}"`).join(" ")}function DW($=M1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${l1(Y)}"`).join(" ")}function l1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function EW($=M1){if(typeof document>"u")return;if($.title){let Z=$.title;if($.titleTemplate)Z=typeof $.titleTemplate==="function"?$.titleTemplate(Z):$.titleTemplate.replace("%s",Z);document.title=Z}for(let Z of $.meta||[]){let Y=Z.name?`meta[name="${Z.name}"]`:Z.property?`meta[property="${Z.property}"]`:null;if(Y){let X=document.querySelector(Y);if(!X){if(X=document.createElement("meta"),Z.name)X.setAttribute("name",Z.name);if(Z.property)X.setAttribute("property",Z.property);document.head.appendChild(X)}X.setAttribute("content",Z.content)}}for(let Z of $.link||[]){let Y=`link[rel="${Z.rel}"]${Z.href?`[href="${Z.href}"]`:""}`,X=document.querySelector(Y);if(!X)X=document.createElement("link"),document.head.appendChild(X);for(let[J,Q]of Object.entries(Z))if(Q!==void 0)X.setAttribute(J,String(Q))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))if(Z==="class")for(let X of String(Y).split(/\s+/).filter(Boolean))document.documentElement.classList.add(X);else document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function kW($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,J)=>{return Z+=J.trim()+`
2089
+ `,""}),headContent:Z.trim()}}function bW($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,J,Q)=>{let G=X?J:Z[(Q||"").trim()]??Q,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=w5(K,{title:G}),""})}function SW($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,J,Q,G,K)=>{let q=Q?G:K,W=Q?q:Z[(q||"").trim()]??q,U=J.includes(":")?{property:J,content:W}:{name:J,content:W},j=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=w5(j,{meta:[U]}),""})}var M1,wW,Z4;var W$=b(()=>{M1={},wW=[],Z4={}});var X4={};o(X4,{stripTypeScript:()=>sZ,splitDeclaration:()=>Z2,isModuleResolutionFailure:()=>rZ,isMissingBindingFailure:()=>aZ,isCompleteImport:()=>tZ,hasVariables:()=>Q2,extractVariables:()=>c1,extractScriptFromTemplate:()=>J2,convertToCommonJS:()=>L3});import T1 from"path";import R5 from"process";function yW($){let Z=[],Y=0,X=$.split(`
2090
+ `);for(let J of X){let Q=Y,G=null,K=!1;for(let q=0;q<J.length;q++){let W=J[q];if(K){K=!1;continue}if(W==="\\"){K=!0;continue}if(G){if(W===G)G=null;continue}if(W==="'"||W==='"'||W==="`"){G=W;continue}if(W==="/"&&q+1<J.length&&J[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(Q===0){let q=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let W=J.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let U=W[1].slice(1,-1).split(",").map((j)=>{let H=j.split(":");return(H.length>1?H[1]:H[0]).trim()}).filter((j)=>/^\w+$/.test(j));Z.push(...U)}}}}return[...new Set(Z)]}function sZ($){let Z=$;Z=Z.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),Z=Z.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),Z=Z.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),Z=Z.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Y(X){if(!X.includes(":"))return X;let J=[],Q="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let z=X[W];if(q){if(Q+=z,z===q)q=null;continue}if(z==='"'||z==="'"||z==="`"){q=z,Q+=z;continue}if(z==="<")G++;else if(z===">"&&G>0)G--;else if(z==="(")K++;else if(z===")")K--;if(z===","&&G===0&&K===0){J.push(Q),Q="";continue}Q+=z}if(Q)J.push(Q);return J.map((W)=>{let z=W.trim(),U=z.startsWith("..."),j=U?z.slice(3):z,H=-1,B=0;for(let R=0;R<j.length;R++)if(j[R]==="<")B++;else if(j[R]===">")B--;else if(j[R]===":"&&B===0){H=R;break}if(H===-1)return W;let O=j.substring(0,H).trim().replace(/\?$/,""),F=j.substring(H+1),L=-1,V=0;for(let R=0;R<F.length;R++)if(F[R]==="<")V++;else if(F[R]===">")V--;else if(F[R]==="="&&V===0){L=R;break}let w=U?"...":"";if(L!==-1)return`${w}${O} = ${F.substring(L+1).trim()}`;return`${w}${O}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,J,Q)=>{if(!Q.includes(":"))return X;return`${J}(${Y(Q)})`});{let X=/\b(function\s+\w*\s*)\(/g,J,Q=[];while((J=X.exec(Z))!==null){let G=J.index+J[0].length-1,K=1,q=G+1,W=0,z=null;while(q<Z.length&&K>0){let H=Z[q];if(z){if(H===z)z=null;q++;continue}if(H==='"'||H==="'"||H==="`"){z=H,q++;continue}if(H==="<")W++;else if(H===">"&&W>0)W--;else if(W===0){if(H==="(")K++;else if(H===")")K--}if(K>0)q++}if(K!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let j=Y(U);Q.push({start:G+1,end:q,replacement:j})}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=Q[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,J)=>{if(!J.includes(":"))return X;if(J.includes("{")||J.includes("}"))return X;return`(${J.split(",").map((G)=>{let[K,...q]=G.split("="),W=K.split(":")[0].trim();if(q.length>0)return`${W} = ${q.join("=").trim()}`;return W}).join(", ")}) =>`}),Z=Z.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),Z=Z.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),Z=Z.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),Z=Z.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),Z=Z.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),Z=Z.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),Z=Z.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),Z=Z.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),Z=Z.replace(/\n\s*\n\s*\n/g,`
2091
2091
 
2092
- `),Z}function sZ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function rZ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function c1($,Z,Y,X={}){if(!$.trim())return;let J;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=E.transformSync(v)}catch{J=oZ($)}let Q={exports:{}},G=Q.exports,K=R5.cwd(),q={},W=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((E)=>E[1]).filter((E)=>!E.startsWith("node:")&&!E.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(E));for(let E of W)try{let v=T1.resolve(K,"node_modules",E),h=T1.join(v,"package.json"),g=JSON.parse(W0("fs").readFileSync(h,"utf8")),a=g.main||"index.js";if(g.exports){let Y0=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof Y0==="string")a=Y0;else if(Y0?.bun)a=Y0.bun;else if(Y0?.import)a=Y0.import;else if(Y0?.default)a=Y0.default}q[E]=await import(T1.resolve(v,a))}catch{}let z=(E)=>{if(q[E])return q[E];return W0(E)},U=Z.props||{},j=(E)=>{if(!E)return U;let v={};for(let[h,g]of Object.entries(E)){let a=U[h];if(a!==void 0)v[h]=a;else if(typeof g==="function")v[h]=g();else v[h]=g}return v};for(let[E,v]of Object.entries(U))Object.defineProperty(j,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,E))continue;try{Object.defineProperty(j,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let H=(E)=>{if(!E)return U;let v={...U};for(let[h,g]of Object.entries(E)){let a=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(v[h]===void 0&&a.default!==void 0)v[h]=typeof a.default==="function"?a.default():a.default}return v},B=()=>Z.slots||{},_=(E,v)=>{let h={...E};for(let[g,a]of Object.entries(v))if(h[g]===void 0)if(typeof a==="function")h[g]=a();else h[g]=a;return h},O=(E)=>{let v=()=>E;return v.set=(h)=>{},v.update=(h)=>{},v},F=(E)=>{let v,h=!1;return()=>{if(!h)try{v=E(),h=!0}catch{v=void 0}return v}},L=(E)=>{},V=(E)=>E(),w=(E)=>{},R=(E)=>{};function N(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)k({title:v.title,description:v.description})}function A(E){if(!E||typeof E!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,E),Z.__stxClientPayload=v}let M=()=>{let E=Z.__stxServeContext,v=Z.__stxServeSearch??E?.search??"",h=E?.path??"",g=Object.fromEntries(new URLSearchParams(v)),a=Z.query,Y0=Object.keys(g).length>0?g:a??{},n0=v||(Object.keys(Y0).length>0?`?${new URLSearchParams(Y0).toString()}`:"");return{params:Z.params??{},query:Y0,path:h,name:"",fullPath:h+n0,hash:"",matched:[]}},I=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),T=(E)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=w5(v,E||{})},k=(E)=>{T(Y4(E||{}))},D=(E)=>({value:E}),P=(E)=>E,y=(E)=>({value:typeof E==="function"?E():E}),S=(E,v)=>{},C=(E)=>{},x=(E)=>{},d=(E)=>E?E():Promise.resolve(),u=(E)=>(v,...h)=>{},X0=(E)=>{},d0=(E,v)=>{},V0=(E,v)=>v,i0=()=>({value:"light"}),p=()=>O(!1),B0=(E)=>O(!1),u0=()=>O(!1),_1=()=>B0("(prefers-color-scheme: dark)"),q5=()=>B0("(prefers-color-scheme: light)"),W5=()=>B0("(prefers-reduced-motion: reduce)"),n=()=>B0("(prefers-contrast: more)"),r={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:{}},q0=new Proxy(r,{get(E,v){if(v in E)return E[v];return},set(E,v,h){return E[v]=h,!0}}),A0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},J0=console;try{let E=L3(J,Y),v=new Set(Object.keys(U)),h=(i)=>/^[a-z_$][\w$]*$/i.test(i),g=Object.keys(Z).filter((i)=>!v.has(i)&&i!=="props"&&h(i)),a=g.map((i)=>Z[i]),Y0=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=[],S0=[];for(let[i,e0]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(Y0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(E))continue;n0.push(i),S0.push(e0)}let o0=SW(E).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
2092
+ `),Z}function rZ($){return/cannot find module|could not resolve|module not found|failed to resolve/i.test($)}function aZ($){if(!/is not defined|can't find variable/i.test($))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test($)}async function c1($,Z,Y,X={}){if(!$.trim())return;let J;try{let E=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=E.transformSync(v)}catch{J=sZ($)}let Q={exports:{}},G=Q.exports,K=R5.cwd(),q={},W=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((E)=>E[1]).filter((E)=>!E.startsWith("node:")&&!E.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(E));for(let E of W)try{let v=T1.resolve(K,"node_modules",E),h=T1.join(v,"package.json"),g=JSON.parse(W0("fs").readFileSync(h,"utf8")),a=g.main||"index.js";if(g.exports){let Y0=typeof g.exports==="string"?g.exports:g.exports["."];if(typeof Y0==="string")a=Y0;else if(Y0?.bun)a=Y0.bun;else if(Y0?.import)a=Y0.import;else if(Y0?.default)a=Y0.default}q[E]=await import(T1.resolve(v,a))}catch{}let z=(E)=>{if(q[E])return q[E];return W0(E)},U=Z.props||{},j=(E)=>{if(!E)return U;let v={};for(let[h,g]of Object.entries(E)){let a=U[h];if(a!==void 0)v[h]=a;else if(typeof g==="function")v[h]=g();else v[h]=g}return v};for(let[E,v]of Object.entries(U))Object.defineProperty(j,E,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let E of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,E))continue;try{Object.defineProperty(j,E,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let H=(E)=>{if(!E)return U;let v={...U};for(let[h,g]of Object.entries(E)){let a=g&&typeof g==="object"&&!Array.isArray(g)?g:{type:g};if(v[h]===void 0&&a.default!==void 0)v[h]=typeof a.default==="function"?a.default():a.default}return v},B=()=>Z.slots||{},_=(E,v)=>{let h={...E};for(let[g,a]of Object.entries(v))if(h[g]===void 0)if(typeof a==="function")h[g]=a();else h[g]=a;return h},O=(E)=>{let v=()=>E;return v.set=(h)=>{},v.update=(h)=>{},v},F=(E)=>{let v,h=!1;return()=>{if(!h)try{v=E(),h=!0}catch{v=void 0}return v}},L=(E)=>{},V=(E)=>E(),w=(E)=>{},R=(E)=>{};function N(E){let v=E||{};if(v.title!==void 0||v.description!==void 0)k({title:v.title,description:v.description})}function A(E){if(!E||typeof E!=="object")return;let v=Z.__stxClientPayload??{};Object.assign(v,E),Z.__stxClientPayload=v}let M=()=>{let E=Z.__stxServeContext,v=Z.__stxServeSearch??E?.search??"",h=E?.path??"",g=Object.fromEntries(new URLSearchParams(v)),a=Z.query,Y0=Object.keys(g).length>0?g:a??{},n0=v||(Object.keys(Y0).length>0?`?${new URLSearchParams(Y0).toString()}`:"");return{params:Z.params??{},query:Y0,path:h,name:"",fullPath:h+n0,hash:"",matched:[]}},I=()=>({push:(E)=>{},replace:(E)=>{},back:()=>{},forward:()=>{},go:(E)=>{}}),T=(E)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=w5(v,E||{})},k=(E)=>{T(Y4(E||{}))},D=(E)=>({value:E}),P=(E)=>E,y=(E)=>({value:typeof E==="function"?E():E}),S=(E,v)=>{},C=(E)=>{},x=(E)=>{},d=(E)=>E?E():Promise.resolve(),u=(E)=>(v,...h)=>{},X0=(E)=>{},u0=(E,v)=>{},V0=(E,v)=>v,i0=()=>({value:"light"}),p=()=>O(!1),B0=(E)=>O(!1),p0=()=>O(!1),_1=()=>B0("(prefers-color-scheme: dark)"),q5=()=>B0("(prefers-color-scheme: light)"),W5=()=>B0("(prefers-reduced-motion: reduce)"),n=()=>B0("(prefers-contrast: more)"),r={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:{}},q0=new Proxy(r,{get(E,v){if(v in E)return E[v];return},set(E,v,h){return E[v]=h,!0}}),A0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},J0=console;try{let E=L3(J,Y),v=new Set(Object.keys(U)),h=(i)=>/^[a-z_$][\w$]*$/i.test(i),g=Object.keys(Z).filter((i)=>!v.has(i)&&i!=="props"&&h(i)),a=g.map((i)=>Z[i]),Y0=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=[],S0=[];for(let[i,e0]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(i))continue;if(Y0.has(i))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${i}\\b`).test(E))continue;n0.push(i),S0.push(e0)}let o0=yW(E).map((i)=>`module.exports.${i} = typeof ${i} !== 'undefined' ? ${i} : module.exports.${i};`).join(`
2093
2093
  `),z5=Z.params??{},O1=[],F1=[];for(let i=0;i<g.length;i++){if(g[i]==="params")continue;O1.push(g[i]),F1.push(a[i])}let t0=await Function("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",...n0,...O1,`return (async () => {
2094
2094
  ${E}
2095
2095
  ${o0}
2096
2096
  return module.exports
2097
- })()`)(Q,G,z,U,j,H,_,A,O,F,L,V,w,R,N,M,I,T,k,D,P,y,S,C,x,d,u,X0,B,d0,V0,i0,p,B0,u0,_1,q5,W5,n,q0,A0,J0,r.confirm,r.alert,r.fetch,z5,...S0,...F1);if(X.preserveExisting){for(let[i,e0]of Object.entries(t0))if(!(i in Z)||Z[i]===void 0)Z[i]=e0}else Object.assign(Z,t0);for(let[i,e0]of Object.entries(U))if(!(i in Z))Z[i]=e0}catch(E){let v=E instanceof Error?E.message:String(E);if(sZ(v))console.warn(`[stx] server <script> in ${Y??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(rZ(v))console.warn(`[stx] server <script> in ${Y??"<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(R5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await xW(J,Z,Y)}catch(h){if(R5.env.STX_DEBUG){let g=h instanceof Error?h.message:String(h);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${g}`)}}}}function aZ($){let Z=0,Y=null,X=!1,J=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G===Y){if(Y=null,X||Z===0)J=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)X=!0}return Y===null&&Z===0&&J}function L3($,Z){let Y=Z?T1.dirname(Z):R5.cwd(),X=R5.cwd(),J=$.split(`
2097
+ })()`)(Q,G,z,U,j,H,_,A,O,F,L,V,w,R,N,M,I,T,k,D,P,y,S,C,x,d,u,X0,B,u0,V0,i0,p,B0,p0,_1,q5,W5,n,q0,A0,J0,r.confirm,r.alert,r.fetch,z5,...S0,...F1);if(X.preserveExisting){for(let[i,e0]of Object.entries(t0))if(!(i in Z)||Z[i]===void 0)Z[i]=e0}else Object.assign(Z,t0);for(let[i,e0]of Object.entries(U))if(!(i in Z))Z[i]=e0}catch(E){let v=E instanceof Error?E.message:String(E);if(rZ(v))console.warn(`[stx] server <script> in ${Y??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${v}`);else if(aZ(v))console.warn(`[stx] server <script> in ${Y??"<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(R5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`);try{await fW(J,Z,Y)}catch(h){if(R5.env.STX_DEBUG){let g=h instanceof Error?h.message:String(h);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${g}`)}}}}function tZ($){let Z=0,Y=null,X=!1,J=!1;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(Y){if(G===Y){if(Y=null,X||Z===0)J=!0}continue}if(G==="'"||G==='"'||G==="`"){Y=G;continue}if(G==="{")Z++;else if(G==="}")Z--;else if($.startsWith("from",Q)&&Z===0)X=!0}return Y===null&&Z===0&&J}function L3($,Z){let Y=Z?T1.dirname(Z):R5.cwd(),X=R5.cwd(),J=$.split(`
2098
2098
  `),Q=[],G=0;while(G<J.length){let K=J[G].trim();if(K.startsWith("interface ")||K.startsWith("export interface ")||K.startsWith("type ")||K.startsWith("export type ")){if(K.includes("{")&&!K.includes("}")){let q=0;for(;G<J.length;G++){for(let W of J[G])if(W==="{")q++;else if(W==="}")q--;if(q<=0)break}}G++;continue}if(K.startsWith("definePageMeta(")){let q=0,W=!1,z=G;for(let H=G;H<J.length&&!W;H++){let B=null,_=!1,O=J[H];for(let F=0;F<O.length;F++){let L=O[F];if(_){_=!1;continue}if(L==="\\"){_=!0;continue}if(B){if(L===B)B=null;continue}if(L==='"'||L==="'"||L==="`"){B=L;continue}if(L==="(")q++;else if(L===")"){if(q--,q===0){G=H+1,W=!0;break}}}}if(!W)G=J.length;let U=J.slice(z,G).join(`
2099
- `),j=[];for(let H of["title","description"]){let B=new RegExp(`\\b${H}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(U);if(B)j.push(`${H}: ${JSON.stringify(B[2])}`)}if(j.length>0)Q.push(`useSeoMeta({ ${j.join(", ")} });`);continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let q=K,W=0;while(!aZ(q)&&G+W+1<J.length)W++,q=`${q} ${J[G+W].trim()}`;G+=W;let z=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),j=q.match(/^import\s+['"](.+?)['"]/),H=q,B=(_)=>{if(_.startsWith("."))return T1.resolve(Y,_);if(_.startsWith("~/")||_.startsWith("@/"))return T1.resolve(X,_.slice(2));return _};if(z){let[,_,O]=z,F=B(O);Q.push(`const ${_} = await import('${F}')`),Q.push(`module.exports.${_} = ${_};`)}else if(U){let[,_,O]=U,F=B(O),L=[],V=[];for(let w of _.split(",")){let R=w.trim();if(!R)continue;let N=R.split(/\s+as\s+/);if(N.length===2){let[A,M]=[N[0].trim(),N[1].trim()];L.push(`${A}: ${M}`),V.push(M)}else L.push(R),V.push(R)}Q.push(`const { ${L.join(", ")} } = await import('${F}')`);for(let w of V)Q.push(`module.exports.${w} = ${w};`)}else if(j){let _=B(j[1]);Q.push(`await import('${_}')`)}else Q.push(H);G++;continue}if((K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")||K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var "))&&!K.includes("="))Q.push(J[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let q=lZ(J,G),{type:W,name:z,value:U}=q;Q.push(`${W} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=q.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let q=F3(J,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let q=lZ(J,G),{type:W,name:z,value:U}=q;Q.push(`${W} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=q.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let q=F3(J,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let q=J[G].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...J];W[G]=q;let z=F3(W,G);if(Q.push(z.functionCode),z.name)Q.push(`module.exports.default = ${z.name};`);G=z.nextIndex}else if(K.startsWith("export default ")){let q=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${q};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let q=K.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],z=J[G].replace(/^export\s+/,""),U=0,j=G;for(;j<J.length;j++){let H=J[j];for(let B of H)if(B==="{")U++;else if(B==="}")U--;if(j>G)z+=`
2100
- `+H;if(U<=0&&j>=G)break}Q.push(z),Q.push(`module.exports.${W} = ${W};`),G=j+1}else Q.push(K),G++}else if(K.includes("module.exports"))Q.push(K),G++;else if(K.trim()&&!K.startsWith("//"))Q.push(K),G++;else G++}return yW(Q.join(`
2101
- `),Y,X)}function yW($,Z,Y){let X=$.length,J="",Q=0,G=null,K=!1,q=!1,W=0;while(Q<X){let z=$[Q],U=$[Q+1];if(K){if(J+=z,z===`
2102
- `)K=!1;Q++;continue}if(q){if(J+=z,z==="*"&&U==="/"){J+=U,Q+=2,q=!1;continue}Q++;continue}if(!G&&z==="/"&&U==="/"){K=!0,J+=z,Q++;continue}if(!G&&z==="/"&&U==="*"){q=!0,J+=z,Q++;continue}if(G){if(J+=z,z==="\\"){J+=U,Q+=2;continue}if(z===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(z==="$"&&U==="{"){W++,J+=U,Q+=2;continue}if(z==="`"){G=null,Q++;continue}}Q++;continue}if(W>0){if(z==="{")W++;else if(z==="}")W--}if(z==='"'||z==="'"||z==="`"){G=z,J+=z,Q++;continue}if(z==="a"&&$.startsWith("await",Q)){let j=PW($,Q);if(j){let{quote:H,path:B,end:_}=j;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let O=B.startsWith(".")?T1.resolve(Z,B):T1.resolve(Y,B.slice(2));J+=`await import(${H}${O}${H})`,Q=_;continue}}}J+=z,Q++}return J}function PW($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let X=$[Y];if(X!=="'"&&X!=='"')return null;Y++;let J=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let Q=$.slice(J,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:Q,end:Y+1}}function tZ($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let J=M0($,Y,Y==="{"?"}":"]",Z);if(J===-1)return null;return{pattern:$.slice(Z,J+1),endPos:J+1}}function eZ($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,J=0,Q="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(J++,J===1){let K=tZ(Y,X);if(K){let q=eZ(K.pattern);Z.push(...q),X=K.endPos,Q="";continue}}}else if(G==="}"||G==="]")J--;if(J>0){X++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",X++;continue}if(G===":"){Q="",X++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",X++;while(X<Y.length&&Y[X]!==","&&J===0){if(Y[X]==="{"||Y[X]==="[")J++;else if(Y[X]==="}"||Y[X]==="]")J--;X++}continue}if(/[\w$]/.test(G))Q+=G;X++}if(Q.trim())Z.push(Q.trim());return Z}function $2($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,X=(J)=>J===" "||J==="\t";while(Y<$.length&&X($[Y]))Y++;if($[Y]===":"){let J=0,Q=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(Q){if(G==="\\"){Y++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){J++;continue}if(G===")"||G==="]"||G==="}"||G===">"){J--;continue}if(G==="="&&J<=0){let K=$[Y+1],q=$[Y-1];if(K!=="="&&K!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&X($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function lZ($,Z){let Y=$[Z].trim(),X=$2(Y),J=X?[Y,X.type,X.name,X.value]:null;if(!J){let z=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(z){let U=Y.slice(z[0].length),j=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let B=U.startsWith("{")?"}":"]",_=U;for(let O=Z+1;O<$.length;O++)if(_+=" "+$[O].trim(),j=O,$[O].includes(B))break;U=_}let H=tZ(U,0);if(H){let B=z[1],_=H.pattern,O=U.slice(H.endPos).trim();if(O.startsWith("=")){let F=O.slice(1).trim(),L=F,V=Math.max(j,Z);if(cZ(F)){let A=iZ($,V,F);L=A.value,V=A.nextIndex}else V=V+1;L=L.trim().replace(/;$/,"");let w=eZ(_),R=`__stx_src_${Z}`,N=w.map((A)=>`module.exports.${A} = ${A};`).join(`
2099
+ `),j=[];for(let H of["title","description"]){let B=new RegExp(`\\b${H}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(U);if(B)j.push(`${H}: ${JSON.stringify(B[2])}`)}if(j.length>0)Q.push(`useSeoMeta({ ${j.join(", ")} });`);continue}if(K.startsWith("import ")||K==="import"||K.startsWith("import{")){let q=K,W=0;while(!tZ(q)&&G+W+1<J.length)W++,q=`${q} ${J[G+W].trim()}`;G+=W;let z=q.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),U=q.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),j=q.match(/^import\s+['"](.+?)['"]/),H=q,B=(_)=>{if(_.startsWith("."))return T1.resolve(Y,_);if(_.startsWith("~/")||_.startsWith("@/"))return T1.resolve(X,_.slice(2));return _};if(z){let[,_,O]=z,F=B(O);Q.push(`const ${_} = await import('${F}')`),Q.push(`module.exports.${_} = ${_};`)}else if(U){let[,_,O]=U,F=B(O),L=[],V=[];for(let w of _.split(",")){let R=w.trim();if(!R)continue;let N=R.split(/\s+as\s+/);if(N.length===2){let[A,M]=[N[0].trim(),N[1].trim()];L.push(`${A}: ${M}`),V.push(M)}else L.push(R),V.push(R)}Q.push(`const { ${L.join(", ")} } = await import('${F}')`);for(let w of V)Q.push(`module.exports.${w} = ${w};`)}else if(j){let _=B(j[1]);Q.push(`await import('${_}')`)}else Q.push(H);G++;continue}if((K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")||K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var "))&&!K.includes("="))Q.push(J[G]),G++;else if(K.startsWith("export const ")||K.startsWith("export let ")||K.startsWith("export var ")){let q=cZ(J,G),{type:W,name:z,value:U}=q;Q.push(`${W} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=q.nextIndex}else if(K.startsWith("export function ")||K.startsWith("export async function ")){let q=F3(J,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("const ")||K.startsWith("let ")||K.startsWith("var ")){let q=cZ(J,G),{type:W,name:z,value:U}=q;Q.push(`${W} ${z} = ${U};`),Q.push(`module.exports.${z} = ${z};`),G=q.nextIndex}else if(K.startsWith("function ")||K.startsWith("async function ")){let q=F3(J,G);Q.push(q.functionCode),Q.push(`module.exports.${q.name} = ${q.name};`),G=q.nextIndex}else if(K.startsWith("export default function ")||K.startsWith("export default async function ")){let q=J[G].replace(/^(\s*)export\s+default\s+/,"$1"),W=[...J];W[G]=q;let z=F3(W,G);if(Q.push(z.functionCode),z.name)Q.push(`module.exports.default = ${z.name};`);G=z.nextIndex}else if(K.startsWith("export default ")){let q=K.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${q};`),G++}else if(K.startsWith("class ")||K.startsWith("export class ")){let q=K.match(/(?:export\s+)?class\s+(\w+)/);if(q){let W=q[1],z=J[G].replace(/^export\s+/,""),U=0,j=G;for(;j<J.length;j++){let H=J[j];for(let B of H)if(B==="{")U++;else if(B==="}")U--;if(j>G)z+=`
2100
+ `+H;if(U<=0&&j>=G)break}Q.push(z),Q.push(`module.exports.${W} = ${W};`),G=j+1}else Q.push(K),G++}else if(K.includes("module.exports"))Q.push(K),G++;else if(K.trim()&&!K.startsWith("//"))Q.push(K),G++;else G++}return PW(Q.join(`
2101
+ `),Y,X)}function PW($,Z,Y){let X=$.length,J="",Q=0,G=null,K=!1,q=!1,W=0;while(Q<X){let z=$[Q],U=$[Q+1];if(K){if(J+=z,z===`
2102
+ `)K=!1;Q++;continue}if(q){if(J+=z,z==="*"&&U==="/"){J+=U,Q+=2,q=!1;continue}Q++;continue}if(!G&&z==="/"&&U==="/"){K=!0,J+=z,Q++;continue}if(!G&&z==="/"&&U==="*"){q=!0,J+=z,Q++;continue}if(G){if(J+=z,z==="\\"){J+=U,Q+=2;continue}if(z===G&&G!=="`"){G=null,Q++;continue}if(G==="`"){if(z==="$"&&U==="{"){W++,J+=U,Q+=2;continue}if(z==="`"){G=null,Q++;continue}}Q++;continue}if(W>0){if(z==="{")W++;else if(z==="}")W--}if(z==='"'||z==="'"||z==="`"){G=z,J+=z,Q++;continue}if(z==="a"&&$.startsWith("await",Q)){let j=CW($,Q);if(j){let{quote:H,path:B,end:_}=j;if(B.startsWith(".")||B.startsWith("~/")||B.startsWith("@/")){let O=B.startsWith(".")?T1.resolve(Z,B):T1.resolve(Y,B.slice(2));J+=`await import(${H}${O}${H})`,Q=_;continue}}}J+=z,Q++}return J}function CW($,Z){let Y=Z+5;if(Y>=$.length)return null;if(!/\s/.test($[Y]))return null;while(Y<$.length&&/\s/.test($[Y]))Y++;if(!$.startsWith("import",Y))return null;Y+=6;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return null;Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;let X=$[Y];if(X!=="'"&&X!=='"')return null;Y++;let J=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let Q=$.slice(J,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:Q,end:Y+1}}function eZ($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let J=M0($,Y,Y==="{"?"}":"]",Z);if(J===-1)return null;return{pattern:$.slice(Z,J+1),endPos:J+1}}function $2($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,J=0,Q="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(J++,J===1){let K=eZ(Y,X);if(K){let q=$2(K.pattern);Z.push(...q),X=K.endPos,Q="";continue}}}else if(G==="}"||G==="]")J--;if(J>0){X++;continue}if(G===","){if(Q.trim())Z.push(Q.trim());Q="",X++;continue}if(G===":"){Q="",X++;continue}if(G==="="){if(Q.trim())Z.push(Q.trim());Q="",X++;while(X<Y.length&&Y[X]!==","&&J===0){if(Y[X]==="{"||Y[X]==="[")J++;else if(Y[X]==="}"||Y[X]==="]")J--;X++}continue}if(/[\w$]/.test(G))Q+=G;X++}if(Q.trim())Z.push(Q.trim());return Z}function Z2($){let Z=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec($);if(!Z)return null;let Y=Z[0].length,X=(J)=>J===" "||J==="\t";while(Y<$.length&&X($[Y]))Y++;if($[Y]===":"){let J=0,Q=null;Y++;for(;Y<$.length;Y++){let G=$[Y];if(Q){if(G==="\\"){Y++;continue}if(G===Q)Q=null;continue}if(G==="'"||G==='"'||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{"||G==="<"){J++;continue}if(G===")"||G==="]"||G==="}"||G===">"){J--;continue}if(G==="="&&J<=0){let K=$[Y+1],q=$[Y-1];if(K!=="="&&K!==">"&&q!=="="&&q!=="!"&&q!=="<"&&q!==">")break}}if($[Y]!=="=")return null}while(Y<$.length&&X($[Y]))Y++;if($[Y]!=="=")return null;return{type:Z[1],name:Z[2],value:$.slice(Y+1).trim()}}function cZ($,Z){let Y=$[Z].trim(),X=Z2(Y),J=X?[Y,X.type,X.name,X.value]:null;if(!J){let z=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(z){let U=Y.slice(z[0].length),j=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let B=U.startsWith("{")?"}":"]",_=U;for(let O=Z+1;O<$.length;O++)if(_+=" "+$[O].trim(),j=O,$[O].includes(B))break;U=_}let H=eZ(U,0);if(H){let B=z[1],_=H.pattern,O=U.slice(H.endPos).trim();if(O.startsWith("=")){let F=O.slice(1).trim(),L=F,V=Math.max(j,Z);if(iZ(F)){let A=nZ($,V,F);L=A.value,V=A.nextIndex}else V=V+1;L=L.trim().replace(/;$/,"");let w=$2(_),R=`__stx_src_${Z}`,N=w.map((A)=>`module.exports.${A} = ${A};`).join(`
2103
2103
  `);return{type:B,name:R,value:`${L}; ${B} ${_} = ${R};
2104
- ${N}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,G,K]=J,q=K,W=Z;if(cZ(K)){let z=iZ($,Z,K);q=z.value,W=z.nextIndex}else W=Z+1;while(W<$.length){let z=$[W].trim();if(z.startsWith(".")||z.startsWith("?."))q+=`
2105
- ${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:Q,name:G,value:q,nextIndex:W}}function F3($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,J]=X,Q=Y.replace(/^export\s+/,""),G=Z;if(CW(Y)){let K=vW($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:J,functionCode:Q,nextIndex:G}}function cZ($){let Z=$.trim();if(Z.startsWith("{"))return M0(Z,"{","}",0)===-1;if(Z.startsWith("["))return M0(Z,"[","]",0)===-1;return!Z2(Z)}function Z2($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let J=0;J<$.length;J++){let Q=$[J];if((J>0?$[J-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[J+1]==="{"){X++,J++;continue}if(X>0&&Q==="{"){X++;continue}if(X>0&&Q==="}"){X--;continue}if(Y)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function Y2($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let Y=M0($,"(",")",Z);if(Y===-1)return-1;return $.indexOf("{",Y)}function CW($){let Z=Y2($);if(Z===-1)return!0;return M0($,"{","}",Z)===-1}function iZ($,Z,Y){let X=Y,J=Z+1;while(J<$.length&&!Z2(X)){let Q=$[J];X+=`
2104
+ ${N}`,nextIndex:V}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,G,K]=J,q=K,W=Z;if(iZ(K)){let z=nZ($,Z,K);q=z.value,W=z.nextIndex}else W=Z+1;while(W<$.length){let z=$[W].trim();if(z.startsWith(".")||z.startsWith("?."))q+=`
2105
+ ${$[W]}`,W++;else break}return q=q.trim().replace(/;$/,""),{type:Q,name:G,value:q,nextIndex:W}}function F3($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!X)throw Error(`Failed to parse function declaration: ${Y}`);let[,J]=X,Q=Y.replace(/^export\s+/,""),G=Z;if(vW(Y)){let K=xW($,Z,Q);Q=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:J,functionCode:Q,nextIndex:G}}function iZ($){let Z=$.trim();if(Z.startsWith("{"))return M0(Z,"{","}",0)===-1;if(Z.startsWith("["))return M0(Z,"[","]",0)===-1;return!Y2(Z)}function Y2($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let J=0;J<$.length;J++){let Q=$[J];if((J>0?$[J-1]:"")==="\\"&&Y)continue;if((Q==='"'||Q==="'")&&!Y){Y=Q;continue}if(Q===Y&&Y!=="`"){Y=null;continue}if(Q==="`"&&!Y){Y="`";continue}if(Q==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&Q==="$"&&$[J+1]==="{"){X++,J++;continue}if(X>0&&Q==="{"){X++;continue}if(X>0&&Q==="}"){X--;continue}if(Y)continue;if(Q==="(")Z.paren++;else if(Q===")")Z.paren--;else if(Q==="[")Z.bracket++;else if(Q==="]")Z.bracket--;else if(Q==="{")Z.brace++;else if(Q==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function X2($){let Z=$.indexOf("(");if(Z===-1)return $.indexOf("{");let Y=M0($,"(",")",Z);if(Y===-1)return-1;return $.indexOf("{",Y)}function vW($){let Z=X2($);if(Z===-1)return!0;return M0($,"{","}",Z)===-1}function nZ($,Z,Y){let X=Y,J=Z+1;while(J<$.length&&!Y2(X)){let Q=$[J];X+=`
2106
2106
  ${Q}`,J++}while(J<$.length){let Q=$[J].trim();if(Q.startsWith(".")||Q.startsWith("?."))X+=`
2107
- ${$[J]}`,J++;else break}return{value:X,nextIndex:J}}function vW($,Z,Y){let X=Y,J=Z+1;while(J<$.length){let Q=Y2(X);if(Q!==-1){if(M0(X,"{","}",Q)!==-1)break}let G=$[J];X+=`
2108
- ${G}`,J++}return{functionCode:X,nextIndex:J}}function nZ($,Z){let Y=Z0($,Z)??Z0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...R5.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function xW($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,K]=Q;try{let q=K.trim().replace(/;$/,""),W=nZ(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let J=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of J){let[,,G,K]=Q;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=nZ(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function X2($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function J2($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var z$=b(()=>{W$();V1();F0()});var V3={};o(V3,{renderSlot:()=>G2,processSlots:()=>q2,parseSlots:()=>Q2,parseSlotElement:()=>dW,extractSlotContent:()=>lW,applySlots:()=>cW});function fW($,Z){let Y=1,X=Z,J="<template",Q="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(J,X)&&(X+J.length>=$.length||/[\s>\/]/.test($[X+J.length]))){Y++,X+=J.length;continue}if($.startsWith(Q,X)){let K=$.indexOf(">",X+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function hW($,Z){let Y=null;for(let X=Z;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"){Y=J;continue}if(J===">")return X+1}return-1}function mW($){let Z=[],Y=[],X=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);J=j===-1?$.length:j+3;continue}let G=hW($,Q+1);if(G===-1)break;let K=$.slice(Q,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){J=G;continue}let W=q[1]==="/",z=q[2].toLowerCase();if(W){let j=Y.lastIndexOf(z);if(j!==-1)Y.splice(j);J=G;continue}if(z==="template"&&Y.length===0){let j=K.match(X);if(j){let H=fW($,G);if(H!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:H,slotName:B,content:$.slice(G,H-11).trim(),propsBinding:j[4]||void 0}),J=H;continue}}}if(!/\/\s*>$/.test(K)&&!gW.has(z)){if(Y.push(z),z==="script"||z==="style"){let j=$.toLowerCase().indexOf(`</${z}>`,G);if(j!==-1){J=j;continue}}}J=G}return Z}function Q2($){let Z={default:"",named:new Map},Y=$,X=mW($);for(let q of X)Z.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});X.sort((q,W)=>W.start-q.start);for(let q of X)Y=Y.slice(0,q.start)+Y.slice(q.end);let J=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[q,W,z,U,j,H]=G,B=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(B+_).trim(),F=`<${W}${O?" "+O:""}>${H}</${W}>`;J.push({start:G.index,end:G.index+q.length,slotName:U,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,W,z,U,j]=G,H=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(H+B).trim(),O=`<${W}${_?" "+_:""} />`;J.push({start:G.index,end:G.index+q.length,slotName:U,element:O})}J.sort((q,W)=>W.start-q.start);for(let q of J){let W=Z.named.get(q.slotName);if(W)W.content+=q.element;else Z.named.set(q.slotName,{name:q.slotName,content:q.element});Y=Y.slice(0,q.start)+Y.slice(q.end)}return Z.default=Y.trim(),Z}function dW($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=J.exec($))!==null)X[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function G2($,Z,Y,X){if(!$)return Y;let J=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...X};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,z]=q.split(":").map((j)=>j.trim()),U=z||W;if(Z[W]!==void 0)G[U]=Z[W]}}else G[Q]=Z;J=uW(J,G)}return J}function uW($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let J=X.trim(),Q=K2(J,Z);return s0(String(Q??""))}catch{return`{{ ${X} }}`}})}function K2($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),J=Z;for(let Q of X)if(J&&typeof J==="object"&&Q in J)J=J[Q];else return;return J}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,J,Q]=Y,G=Z[X],K=parseInt(Q,10);if(typeof G==="number")switch(J){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!Q0($))return;return G0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function q2($,Z,Y){let X=$;X=await pW(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let z=Z.named.get(K),U=W?.trim()||"",j=q||"",H={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=B.exec(j))!==null){let O=_[1],F=_[2];H[O]=K2(F,Y)}return await G2(z,H,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(Q,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function pW($,Z,Y){let X=[],J=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return J.push({match:K,index:W}),X.push(Y(K,...q.slice(0,-2))),K});let Q=await Promise.all(X),G=$;for(let K=J.length-1;K>=0;K--){let{match:q,index:W}=J[K];G=G.slice(0,W)+Q[K]+G.slice(W+q.length)}return G}function lW($){let Z=Q2($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function cW($,Z,Y,X){return await q2($,{default:Z,named:Y},X)}var gW;var w3=b(()=>{Y1();F0();gW=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function I1($,Z){let Y=iW($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function iW($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=M0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function nW($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function i1($,Z,Y,X){let J=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&J>0){G.lastIndex=Q,K.lastIndex=Q;let q=G.exec($),W=K.exec($),z=q?q.index:1/0,U=W?W.index:1/0;if(z<U)J++,Q=z+q[0].length;else if(U<1/0){if(J--,J===0)return U;Q=U+W[0].length}else break}return-1}function W2($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,J=I1($,X);if(!J)return null;let Q=J.endPos,G=i1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],W=0,z="if",U=J.expression,j=0,H=0;while(W<K.length){let B=K.indexOf("@",W);if(B===-1)break;W=B;let _=K.substring(B);if(nW(K,B)){W++;continue}if(/^@if\s*\(/.test(_)){H++,W++;continue}if(/^@endif(?![a-z])/.test(_)){H--,W+=6;continue}if(H===0){let O=_.match(/^@elseif\s*/);if(O){q.push({type:z,condition:U,content:K.substring(j,W),start:Q+j,end:Q+W});let F=W+O[0].length,L=I1(K,F);if(!L){W++;continue}z="elseif",U=L.expression,W=L.endPos,j=W;continue}else if(/^@else(?![a-z])/.test(_)){q.push({type:z,condition:U,content:K.substring(j,W),start:Q+j,end:Q+W}),z="else",U=void 0,W+=5,j=W;continue}}W++}return q.push({type:z,condition:U,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function U$($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let Q=W2($,X.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;X=Y.exec($)}return Z}function J4($,Z,Y){let X=[],J=new RegExp(`@${Z}\\s*\\(`,"g"),Q=J.exec($);while(Q!==null){if(X.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=J.exec($);continue}let K=Q.index,q=K+Q[0].length-1,W=M0($,"(",")",q);if(W===-1){Q=J.exec($);continue}let z=$.slice(q+1,W),U=W+1,j=i1($,Z,Y,U);if(j===-1){Q=J.exec($);continue}let H=$.slice(U,j),B=j+`@${Y}`.length;X.push({fullMatch:$.slice(K,B),name:Z,params:z,content:H,start:K,end:B}),J.lastIndex=B,Q=J.exec($)}return X}function R3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,J=I1($,X);if(!J)return null;let Q=J.endPos,G=i1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],W=0,z=null,U=0;while(W<K.length){let j=K.slice(W),H=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(H){if(U++,z)z.content+=H[0];W+=H[0].length;continue}if(B){if(U--,z)z.content+=B[0];W+=B[0].length;continue}if(U>0){if(z)z.content+=K[W];W++;continue}let _=j.match(/^@case\s*/),O=j.match(/^@default(?![a-z])/),F=j.match(/^@break(?![a-z])/);if(_&&j.startsWith("@case")){if(z)q.push(z);let L=W+_[0].length,V=I1(K,L);if(!V){W++;continue}z={type:"case",value:V.expression,content:""},W=V.endPos}else if(O&&j.startsWith("@default")){if(z)q.push(z);z={type:"default",content:""},W+=O[0].length}else if(F&&j.startsWith("@break"))W+=F[0].length;else{if(z)z.content+=K[W];W++}}if(z)q.push(z);return{fullMatch:$.slice(Z,G+10),expression:J.expression,cases:q,start:Z,end:G+10}}var z2=()=>{};var U2=()=>{};var Q4=b(()=>{z2();U2()});import{matchRoute as KV,Router as aW}from"stx-router";import{findErrorPage as zV,formatRoutes as UV,generateRouteManifest as jV,generateRouteTypes as BV,matchRoute as HV}from"stx-router";function j2($,Z={}){return new aW($,Z).routes}var B2=()=>{};async function _2($){let Z=$;if(!Z)try{Z=(await D1())?.pagesDir||"pages"}catch{Z="pages"}let Y=Z,X=H2.get(Y);if(X)return X;let J=[];try{J=j2(".",{pagesDir:Y}).map((Q)=>Q.regex.source).filter(Boolean)}catch{J=[]}return H2.set(Y,J),J}var H2;var O2=b(()=>{B2();w1();H2=new Map});function tW($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function F2($){return tW(JSON.stringify($))}function G4($){let Z=0;while(Z<$.length){let Y=$.slice(Z),X=/<body\b([^>]*)>/i.exec(Y);if(!X)return null;let J=Z+X.index,Q=-1,G="";for(let q of eW){let W=q.open.exec(Y);if(!W)continue;let z=Z+W.index;if(z<J&&(Q===-1||z<Q))Q=z,G=q.close}if(Q===-1)return{index:J,tag:X[0],attrs:X[1]??""};let K=$.toLowerCase().indexOf(G,Q);if(K===-1)return null;Z=K+G.length}return null}function N3($,Z){let Y=G4($);if(!Y)return $;return $.slice(0,Y.index)+Z(Y.tag,Y.attrs)+$.slice(Y.index+Y.tag.length)}var eW;var A3=b(()=>{eW=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function E1($){let Z=$,Y=new Set,X=new Set,J=()=>{if(f0)X.add(f0);return Z};return J.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),j$)X.forEach((K)=>q4.add(K));else X.forEach((K)=>K())}},J.update=(Q)=>{J.set(Q(Z))},J.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(Q)=>J.set(Q),configurable:!0}),J}function z4($){let Z,Y=!0,X=new Set,J=()=>{if(!Y)if(Y=!0,j$)X.forEach((G)=>q4.add(G));else X.forEach((G)=>G())},Q=()=>{if(f0)X.add(f0);if(Y){let G=f0;f0=J,K4.push(J);try{Z=$()}finally{K4.pop(),f0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function U4($,Z={}){let Y,X=!1,J=()=>{if(X)return;if(Y)Y(),Y=void 0;let Q=f0;f0=J,K4.push(J);try{let G=$();Y=typeof G==="function"?G:void 0}finally{K4.pop(),f0=Q}};if(Z.immediate!==!1)J();return()=>{if(X=!0,Y)Y()}}function T3($){if(j$){$();return}j$=!0;try{$()}finally{j$=!1,q4.forEach((Z)=>Z()),q4.clear()}}function I3($){M3.push($)}function D3($){W4.push($)}function $z(){L2(M3,"onMount",W4)}function Zz(){L2(W4,"onDestroy")}function L2($,Z,Y){let X=$.splice(0,$.length);for(let J of X)try{let Q=J();if(Y&&typeof Q==="function")Y.push(Q)}catch(Q){console.error(`[stx] ${Z} callback threw:`,Q)}}function Yz(){return{mount:M3.length,destroy:W4.length}}function j4($){return typeof $==="function"&&$._isSignal===!0}function B4($){return typeof $==="function"&&$._isDerived===!0}function E3($){if(j4($)||B4($))return $();return $}function H4($){let Z=f0;f0=null;try{return $()}finally{f0=Z}}function Xz($,Z){let Y=typeof $==="function"?$:()=>$,X=E1([]),J=z4(()=>X().reduce((K,q)=>Z(K,q.action),Y())),Q=!1;return U4(()=>{if(Y(),!Q){Q=!0;return}if(H4(()=>X().length))X.set([])}),[J,(K,q)=>{let W={action:K};X.set([...X(),W]);let z=()=>{let U=X().filter((j)=>j!==W);if(U.length!==X().length)X.set(U)};if(q&&typeof q.then==="function")Promise.resolve(q).then(z,z);return z}]}var f0=null,K4,j$=!1,q4,M3,W4;var _4=b(()=>{K4=[],q4=new Set,M3=[],W4=[]});var w2={};o(w2,{useOptimistic:()=>Xz,untrack:()=>E3,state:()=>E1,runMountCallbacks:()=>$z,runDestroyCallbacks:()=>Zz,pendingLifecycleCounts:()=>Yz,peek:()=>H4,onMount:()=>I3,onDestroy:()=>D3,isSignal:()=>j4,isDerived:()=>B4,generateSignalsRuntimeDev:()=>k3,generateSignalsRuntime:()=>V2,effect:()=>U4,derived:()=>z4,default:()=>Qz,batch:()=>T3});function V2(){let $=Jz(k3());try{let Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return $}}function Jz($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let J=$.indexOf(X,Y);if(J===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,J));let Q=1,G=J+X.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function k3(){return`
2107
+ ${$[J]}`,J++;else break}return{value:X,nextIndex:J}}function xW($,Z,Y){let X=Y,J=Z+1;while(J<$.length){let Q=X2(X);if(Q!==-1){if(M0(X,"{","}",Q)!==-1)break}let G=$[J];X+=`
2108
+ ${G}`,J++}return{functionCode:X,nextIndex:J}}function oZ($,Z){let Y=Z0($,Z)??Z0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...R5.env}})};try{return Function(...Object.keys(X),`'use strict'; return (${$});`)(...Object.values(X))}catch{try{return Function(...Object.keys(X),`'use strict'; return ${$};`)(...Object.values(X))}catch{return}}}async function fW($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let Q of X){let[,,G,K]=Q;try{let q=K.trim().replace(/;$/,""),W=oZ(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let J=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let Q of J){let[,,G,K]=Q;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=oZ(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function J2($){let Z=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1]:"",X=Z?$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):$;return{scriptContent:Y,templateWithoutScript:X}}function Q2($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var z$=b(()=>{W$();V1();F0()});var V3={};o(V3,{renderSlot:()=>K2,processSlots:()=>W2,parseSlots:()=>G2,parseSlotElement:()=>uW,extractSlotContent:()=>cW,applySlots:()=>iW});function gW($,Z){let Y=1,X=Z,J="<template",Q="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(J,X)&&(X+J.length>=$.length||/[\s>\/]/.test($[X+J.length]))){Y++,X+=J.length;continue}if($.startsWith(Q,X)){let K=$.indexOf(">",X+Q.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function mW($,Z){let Y=null;for(let X=Z;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"){Y=J;continue}if(J===">")return X+1}return-1}function dW($){let Z=[],Y=[],X=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;if($.startsWith("<!--",Q)){let j=$.indexOf("-->",Q+4);J=j===-1?$.length:j+3;continue}let G=mW($,Q+1);if(G===-1)break;let K=$.slice(Q,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){J=G;continue}let W=q[1]==="/",z=q[2].toLowerCase();if(W){let j=Y.lastIndexOf(z);if(j!==-1)Y.splice(j);J=G;continue}if(z==="template"&&Y.length===0){let j=K.match(X);if(j){let H=gW($,G);if(H!==-1){let B=j[1]||j[2]||j[3];Z.push({start:Q,end:H,slotName:B,content:$.slice(G,H-11).trim(),propsBinding:j[4]||void 0}),J=H;continue}}}if(!/\/\s*>$/.test(K)&&!hW.has(z)){if(Y.push(z),z==="script"||z==="style"){let j=$.toLowerCase().indexOf(`</${z}>`,G);if(j!==-1){J=j;continue}}}J=G}return Z}function G2($){let Z={default:"",named:new Map},Y=$,X=dW($);for(let q of X)Z.named.set(q.slotName,{name:q.slotName,content:q.content,propsBinding:q.propsBinding});X.sort((q,W)=>W.start-q.start);for(let q of X)Y=Y.slice(0,q.start)+Y.slice(q.end);let J=[],Q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=Q.exec(Y))!==null){let[q,W,z,U,j,H]=G,B=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),O=(B+_).trim(),F=`<${W}${O?" "+O:""}>${H}</${W}>`;J.push({start:G.index,end:G.index+q.length,slotName:U,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,W,z,U,j]=G,H=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),B=j.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(H+B).trim(),O=`<${W}${_?" "+_:""} />`;J.push({start:G.index,end:G.index+q.length,slotName:U,element:O})}J.sort((q,W)=>W.start-q.start);for(let q of J){let W=Z.named.get(q.slotName);if(W)W.content+=q.element;else Z.named.set(q.slotName,{name:q.slotName,content:q.element});Y=Y.slice(0,q.start)+Y.slice(q.end)}return Z.default=Y.trim(),Z}function uW($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,Q;while((Q=J.exec($))!==null)X[Q[1]]=Q[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function K2($,Z,Y,X){if(!$)return Y;let J=$.content;if($.propsBinding&&Object.keys(Z).length>0){let Q=$.propsBinding.trim(),G={...X};if(Q.startsWith("{")&&Q.endsWith("}")){let K=Q.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,z]=q.split(":").map((j)=>j.trim()),U=z||W;if(Z[W]!==void 0)G[U]=Z[W]}}else G[Q]=Z;J=pW(J,G)}return J}function pW($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let J=X.trim(),Q=q2(J,Z);return s0(String(Q??""))}catch{return`{{ ${X} }}`}})}function q2($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),J=Z;for(let Q of X)if(J&&typeof J==="object"&&Q in J)J=J[Q];else return;return J}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,J,Q]=Y,G=Z[X],K=parseInt(Q,10);if(typeof G==="number")switch(J){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!Q0($))return;return G0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function W2($,Z,Y){let X=$;X=await lW(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let z=Z.named.get(K),U=W?.trim()||"",j=q||"",H={},B=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=B.exec(j))!==null){let O=_[1],F=_[2];H[O]=q2(F,Y)}return await K2(z,H,U,Y)});let Q=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(Q,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function lW($,Z,Y){let X=[],J=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return J.push({match:K,index:W}),X.push(Y(K,...q.slice(0,-2))),K});let Q=await Promise.all(X),G=$;for(let K=J.length-1;K>=0;K--){let{match:q,index:W}=J[K];G=G.slice(0,W)+Q[K]+G.slice(W+q.length)}return G}function cW($){let Z=G2($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function iW($,Z,Y,X){return await W2($,{default:Z,named:Y},X)}var hW;var w3=b(()=>{Y1();F0();hW=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function I1($,Z){let Y=nW($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function nW($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=M0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function oW($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function i1($,Z,Y,X){let J=1,Q=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(Q<$.length&&J>0){G.lastIndex=Q,K.lastIndex=Q;let q=G.exec($),W=K.exec($),z=q?q.index:1/0,U=W?W.index:1/0;if(z<U)J++,Q=z+q[0].length;else if(U<1/0){if(J--,J===0)return U;Q=U+W[0].length}else break}return-1}function z2($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,J=I1($,X);if(!J)return null;let Q=J.endPos,G=i1($,"if","endif",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],W=0,z="if",U=J.expression,j=0,H=0;while(W<K.length){let B=K.indexOf("@",W);if(B===-1)break;W=B;let _=K.substring(B);if(oW(K,B)){W++;continue}if(/^@if\s*\(/.test(_)){H++,W++;continue}if(/^@endif(?![a-z])/.test(_)){H--,W+=6;continue}if(H===0){let O=_.match(/^@elseif\s*/);if(O){q.push({type:z,condition:U,content:K.substring(j,W),start:Q+j,end:Q+W});let F=W+O[0].length,L=I1(K,F);if(!L){W++;continue}z="elseif",U=L.expression,W=L.endPos,j=W;continue}else if(/^@else(?![a-z])/.test(_)){q.push({type:z,condition:U,content:K.substring(j,W),start:Q+j,end:Q+W}),z="else",U=void 0,W+=5,j=W;continue}}W++}return q.push({type:z,condition:U,content:K.slice(j),start:Q+j,end:Q+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function U$($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let Q=z2($,X.index);if(Q)Z.push(Q),Y.lastIndex=Q.end;X=Y.exec($)}return Z}function J4($,Z,Y){let X=[],J=new RegExp(`@${Z}\\s*\\(`,"g"),Q=J.exec($);while(Q!==null){if(X.some((_)=>Q.index>_.start&&Q.index<_.end)){Q=J.exec($);continue}let K=Q.index,q=K+Q[0].length-1,W=M0($,"(",")",q);if(W===-1){Q=J.exec($);continue}let z=$.slice(q+1,W),U=W+1,j=i1($,Z,Y,U);if(j===-1){Q=J.exec($);continue}let H=$.slice(U,j),B=j+`@${Y}`.length;X.push({fullMatch:$.slice(K,B),name:Z,params:z,content:H,start:K,end:B}),J.lastIndex=B,Q=J.exec($)}return X}function R3($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,J=I1($,X);if(!J)return null;let Q=J.endPos,G=i1($,"switch","endswitch",Q);if(G===-1)return null;let K=$.slice(Q,G),q=[],W=0,z=null,U=0;while(W<K.length){let j=K.slice(W),H=j.match(/^@switch\s*\(/),B=j.match(/^@endswitch(?![a-z])/);if(H){if(U++,z)z.content+=H[0];W+=H[0].length;continue}if(B){if(U--,z)z.content+=B[0];W+=B[0].length;continue}if(U>0){if(z)z.content+=K[W];W++;continue}let _=j.match(/^@case\s*/),O=j.match(/^@default(?![a-z])/),F=j.match(/^@break(?![a-z])/);if(_&&j.startsWith("@case")){if(z)q.push(z);let L=W+_[0].length,V=I1(K,L);if(!V){W++;continue}z={type:"case",value:V.expression,content:""},W=V.endPos}else if(O&&j.startsWith("@default")){if(z)q.push(z);z={type:"default",content:""},W+=O[0].length}else if(F&&j.startsWith("@break"))W+=F[0].length;else{if(z)z.content+=K[W];W++}}if(z)q.push(z);return{fullMatch:$.slice(Z,G+10),expression:J.expression,cases:q,start:Z,end:G+10}}var U2=()=>{};var j2=()=>{};var Q4=b(()=>{U2();j2()});import{matchRoute as qV,Router as tW}from"stx-router";import{findErrorPage as UV,formatRoutes as jV,generateRouteManifest as BV,generateRouteTypes as HV,matchRoute as _V}from"stx-router";function B2($,Z={}){return new tW($,Z).routes}var H2=()=>{};async function O2($){let Z=$;if(!Z)try{Z=(await D1())?.pagesDir||"pages"}catch{Z="pages"}let Y=Z,X=_2.get(Y);if(X)return X;let J=[];try{J=B2(".",{pagesDir:Y}).map((Q)=>Q.regex.source).filter(Boolean)}catch{J=[]}return _2.set(Y,J),J}var _2;var F2=b(()=>{H2();w1();_2=new Map});function eW($){return $.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function L2($){return eW(JSON.stringify($))}function G4($){let Z=0;while(Z<$.length){let Y=$.slice(Z),X=/<body\b([^>]*)>/i.exec(Y);if(!X)return null;let J=Z+X.index,Q=-1,G="";for(let q of $z){let W=q.open.exec(Y);if(!W)continue;let z=Z+W.index;if(z<J&&(Q===-1||z<Q))Q=z,G=q.close}if(Q===-1)return{index:J,tag:X[0],attrs:X[1]??""};let K=$.toLowerCase().indexOf(G,Q);if(K===-1)return null;Z=K+G.length}return null}function N3($,Z){let Y=G4($);if(!Y)return $;return $.slice(0,Y.index)+Z(Y.tag,Y.attrs)+$.slice(Y.index+Y.tag.length)}var $z;var A3=b(()=>{$z=[{open:/<!--/,close:"-->"},{open:/<script\b/i,close:"</script>"},{open:/<style\b/i,close:"</style>"}]});function E1($){let Z=$,Y=new Set,X=new Set,J=()=>{if(g0)X.add(g0);return Z};return J.set=(Q)=>{if(!Object.is(Q,Z)){let G=Z;if(Z=Q,Y.forEach((K)=>K(Z,G)),j$)X.forEach((K)=>q4.add(K));else X.forEach((K)=>K())}},J.update=(Q)=>{J.set(Q(Z))},J.subscribe=(Q)=>{return Y.add(Q),()=>Y.delete(Q)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(Q)=>J.set(Q),configurable:!0}),J}function z4($){let Z,Y=!0,X=new Set,J=()=>{if(!Y)if(Y=!0,j$)X.forEach((G)=>q4.add(G));else X.forEach((G)=>G())},Q=()=>{if(g0)X.add(g0);if(Y){let G=g0;g0=J,K4.push(J);try{Z=$()}finally{K4.pop(),g0=G}Y=!1}return Z};return Object.defineProperty(Q,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),configurable:!0}),Q}function U4($,Z={}){let Y,X=!1,J=()=>{if(X)return;if(Y)Y(),Y=void 0;let Q=g0;g0=J,K4.push(J);try{let G=$();Y=typeof G==="function"?G:void 0}finally{K4.pop(),g0=Q}};if(Z.immediate!==!1)J();return()=>{if(X=!0,Y)Y()}}function T3($){if(j$){$();return}j$=!0;try{$()}finally{j$=!1,q4.forEach((Z)=>Z()),q4.clear()}}function I3($){M3.push($)}function D3($){W4.push($)}function Zz(){V2(M3,"onMount",W4)}function Yz(){V2(W4,"onDestroy")}function V2($,Z,Y){let X=$.splice(0,$.length);for(let J of X)try{let Q=J();if(Y&&typeof Q==="function")Y.push(Q)}catch(Q){console.error(`[stx] ${Z} callback threw:`,Q)}}function Xz(){return{mount:M3.length,destroy:W4.length}}function j4($){return typeof $==="function"&&$._isSignal===!0}function B4($){return typeof $==="function"&&$._isDerived===!0}function E3($){if(j4($)||B4($))return $();return $}function H4($){let Z=g0;g0=null;try{return $()}finally{g0=Z}}function Jz($,Z){let Y=typeof $==="function"?$:()=>$,X=E1([]),J=z4(()=>X().reduce((K,q)=>Z(K,q.action),Y())),Q=!1;return U4(()=>{if(Y(),!Q){Q=!0;return}if(H4(()=>X().length))X.set([])}),[J,(K,q)=>{let W={action:K};X.set([...X(),W]);let z=()=>{let U=X().filter((j)=>j!==W);if(U.length!==X().length)X.set(U)};if(q&&typeof q.then==="function")Promise.resolve(q).then(z,z);return z}]}var g0=null,K4,j$=!1,q4,M3,W4;var _4=b(()=>{K4=[],q4=new Set,M3=[],W4=[]});var R2={};o(R2,{useOptimistic:()=>Jz,untrack:()=>E3,state:()=>E1,runMountCallbacks:()=>Zz,runDestroyCallbacks:()=>Yz,pendingLifecycleCounts:()=>Xz,peek:()=>H4,onMount:()=>I3,onDestroy:()=>D3,isSignal:()=>j4,isDerived:()=>B4,generateSignalsRuntimeDev:()=>k3,generateSignalsRuntime:()=>w2,effect:()=>U4,derived:()=>z4,default:()=>Gz,batch:()=>T3});function w2(){let $=Qz(k3());try{let Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return $}}function Qz($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let J=$.indexOf(X,Y);if(J===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,J));let Q=1,G=J+X.length;while(G<$.length&&Q>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")Q++;else if(K===")")Q--;G++}Z.push("0"),Y=G}return Z.join("")}function k3(){return`
2109
2109
  // STX Signals Runtime (Development Build)
2110
2110
  console.log('[stx] signals runtime loading');
2111
2111
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -9866,7 +9866,7 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9866
9866
  }
9867
9867
  }
9868
9868
  })();
9869
- `}var Qz;var R2=b(()=>{_4();$1();_4();Qz={state:E1,derived:z4,effect:U4,batch:T3,onMount:I3,onDestroy:D3,isSignal:j4,isDerived:B4,untrack:E3,peek:H4,generateSignalsRuntime:V2,generateSignalsRuntimeDev:k3}});var b3={};o(b3,{templateCache:()=>N2,readFileCached:()=>Gz,invalidateFileCacheByDir:()=>qz,invalidateFileCache:()=>Kz,hashFilePath:()=>B$,getCachedSignalsRuntime:()=>Uz,getCachedRouterScript:()=>jz,clearDevCaches:()=>Bz,checkCache:()=>Hz,cacheTemplate:()=>_z,__setSignalsGeneratorsForTest:()=>zz});import k1 from"fs";import N5 from"path";async function Gz($){let Y;for(let X=0;X<3;X++)try{let Q=(await k1.promises.stat($)).mtime.getTime(),G=n1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),W=(await k1.promises.stat($)).mtime.getTime();if(W!==Q)continue;return n1.set($,{content:K,mtime:W}),K}catch(J){Y=J;break}throw n1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function Kz($){n1.delete($)}function qz($){for(let Z of n1.keys())if(Z.startsWith($))n1.delete(Z)}function zz($){A2=$}async function Uz($=!1){let Z=A2??await Promise.resolve().then(() => (R2(),w2));if($)return Z.generateSignalsRuntimeDev();if(O4===null)O4=Z.generateSignalsRuntime();return O4}async function jz(){if(F4===null){let{getRouterScript:$}=await import("stx-router");F4=$()}return F4}function Bz(){n1.clear(),T2(),O4=null,Wz=null,F4=null}function M2($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function Hz($,Z){try{if(!Z.cachePath)return null;let Y=N5.resolve(Z.cachePath),X=N5.join(Y,`${B$($)}.html`),J=N5.join(Y,`${B$($)}.meta.json`);if(!await c(X)||!await c(J))return null;let Q=await Bun.file(J).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==M2(Z))return null;if((await k1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await k1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function _z($,Z,Y,X){try{if(!X.cachePath)return;let J=N5.resolve(X.cachePath);await k1.promises.mkdir(J,{recursive:!0});let Q=N5.join(J,`${B$($)}.html`),G=N5.join(J,`${B$($)}.meta.json`),K=await k1.promises.stat($);await Bun.write(Q,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:M2(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),N2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(J){console.warn(`Failed to cache template ${$}:`,J)}}function B$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Oz)}var N2,n1,O4=null,Wz=null,A2=null,F4=null,Oz=16;var S3=b(()=>{R0();N2=new Map,n1=new Map});function I2($){return $.includes("data-stx-runtime")}function D2($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Y=Z.exec($);Y!==null;Y=Z.exec($)){let X=$.slice(Math.max(0,Y.index-80),Y.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(X))continue;return!0}return!1}async function L4($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
9869
+ `}var Gz;var N2=b(()=>{_4();$1();_4();Gz={state:E1,derived:z4,effect:U4,batch:T3,onMount:I3,onDestroy:D3,isSignal:j4,isDerived:B4,untrack:E3,peek:H4,generateSignalsRuntime:w2,generateSignalsRuntimeDev:k3}});var b3={};o(b3,{templateCache:()=>A2,readFileCached:()=>Kz,invalidateFileCacheByDir:()=>Wz,invalidateFileCache:()=>qz,hashFilePath:()=>B$,getCachedSignalsRuntime:()=>jz,getCachedRouterScript:()=>Bz,clearDevCaches:()=>Hz,checkCache:()=>_z,cacheTemplate:()=>Oz,__setSignalsGeneratorsForTest:()=>Uz});import k1 from"fs";import N5 from"path";async function Kz($){let Y;for(let X=0;X<3;X++)try{let Q=(await k1.promises.stat($)).mtime.getTime(),G=n1.get($);if(G&&G.mtime===Q)return G.content;let K=await Bun.file($).text(),W=(await k1.promises.stat($)).mtime.getTime();if(W!==Q)continue;return n1.set($,{content:K,mtime:W}),K}catch(J){Y=J;break}throw n1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function qz($){n1.delete($)}function Wz($){for(let Z of n1.keys())if(Z.startsWith($))n1.delete(Z)}function Uz($){M2=$}async function jz($=!1){let Z=M2??await Promise.resolve().then(() => (N2(),R2));if($)return Z.generateSignalsRuntimeDev();if(O4===null)O4=Z.generateSignalsRuntime();return O4}async function Bz(){if(F4===null){let{getRouterScript:$}=await import("stx-router");F4=$()}return F4}function Hz(){n1.clear(),I2(),O4=null,zz=null,F4=null}function T2($){let Z={debug:$.debug===!0,middleware:($.middleware??[]).map((Y)=>({name:Y.name,timing:Y.timing,handler:String(Y.handler)})),customDirectives:($.customDirectives??[]).map((Y)=>({name:Y.name,hasEndTag:Y.hasEndTag===!0,handler:String(Y.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify(Z)).digest("hex")}async function _z($,Z){try{if(!Z.cachePath)return null;let Y=N5.resolve(Z.cachePath),X=N5.join(Y,`${B$($)}.html`),J=N5.join(Y,`${B$($)}.meta.json`);if(!await c(X)||!await c(J))return null;let Q=await Bun.file(J).text(),G=JSON.parse(Q);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==T2(Z))return null;if((await k1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await c(q)){if((await k1.promises.stat(q)).mtime.getTime()>G.mtime)return null}else return null;return await Bun.file(X).text()}catch(Y){return console.warn(`Cache error for ${$}:`,Y),null}}async function Oz($,Z,Y,X){try{if(!X.cachePath)return;let J=N5.resolve(X.cachePath);await k1.promises.mkdir(J,{recursive:!0});let Q=N5.join(J,`${B$($)}.html`),G=N5.join(J,`${B$($)}.meta.json`),K=await k1.promises.stat($);await Bun.write(Q,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:T2(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),A2.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(J){console.warn(`Failed to cache template ${$}:`,J)}}function B$($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,Fz)}var A2,n1,O4=null,zz=null,M2=null,F4=null,Fz=16;var S3=b(()=>{R0();A2=new Map,n1=new Map});function D2($){return $.includes("data-stx-runtime")}function E2($){let Z=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Y=Z.exec($);Y!==null;Y=Z.exec($)){let X=$.slice(Math.max(0,Y.index-80),Y.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(X))continue;return!0}return!1}async function L4($,Z){if($.includes("data-stx-runtime")||$.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;if(Z.buildMode==="serve"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
9870
9870
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script data-stx-runtime src="/_stx/runtime.js"></script>
9871
9871
  `+$.slice(q)}return`<script data-stx-runtime src="/_stx/runtime.js"></script>
9872
9872
  `+$}if(Z.buildMode==="compile"){let K=$.indexOf("<script");if(K!==-1)return $.slice(0,K)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
@@ -9876,15 +9876,15 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
9876
9876
  `+$.slice(Q);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+J+`
9877
9877
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
9878
9878
  `+J+$.slice(K+1)}return J+`
9879
- `+$}async function E2($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";{let K={};if(Y){if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight}try{let q=await _2(Z?.pagesDir);if(q.length>0)K.ownedRoutes=q}catch{}if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${F2(K)};</script>
9879
+ `+$}async function k2($,Z){if(!$.includes("</body>"))return $;if($.includes("data-stx-router")||$.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";{let K={};if(Y){if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight}try{let q=await O2(Z?.pagesDir);if(q.length>0)K.ownedRoutes=q}catch{}if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${L2(K)};</script>
9880
9880
  `}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (S3(),b3)),Q=Z?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':Z?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await J()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+Q+`
9881
- </body>`+$.slice(G+7)}var V4=b(()=>{O2();A3()});var A4={};o(A4,{scanScriptTags:()=>v2,rewriteStxImportSpecifiers:()=>h2,processSignals:()=>x3,processScriptSetup:()=>f2,preEvalLiteralReactiveIfs:()=>C3,parseLoopExpression:()=>x2,hasSignalsSyntax:()=>N4,findMarkupIndexOutsideScripts:()=>R4,extractExports:()=>g2,convertSignalLoopsToAttributes:()=>v3,convertSignalDirectivesToAttributes:()=>P3});function v2($,Z={}){let Y=[];for(let X of q3($,R1)){let J=X.token.match(/^<script\b([^>]*)>/i),Q=X.token.match(/<\/script\s*>$/i);if(!J||!Q)continue;let G=J[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=J[0].length,q=X.token.length-Q[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,q),start:X.start,end:X.end})}return Y}function x2($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let J=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=b2(Q);if(G)return{style:"as",iterable:J,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let J=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:K}=b2(J);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function b2($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let J=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function N4($){return g8($)}function Lz($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let J=X[1];if(J.startsWith("if"))Y++;else if(J==="endif")Y--;else if(Y===0)return!0}return!1}function Vz($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=Y.exec($))!==null){let Q=J[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function wz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function y2($,Z,Y){if(!$)return!1;let X=wz($),J=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let j=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(S2.has(j))continue;if(Z.has(j))J=!0;else if(Y&&j in Y)Q=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=W.exec(X))!==null){let j=z[1];if(X.slice(0,z.index).trimEnd().endsWith("."))continue;if(S2.has(j)||Y&&j in Y)continue;G=!0}return(J||G)&&!Q}function w4($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,J=$.trim(),Q=J.match(C2);if(Q&&Rz(Q[3],Q[1])){let[,G,K,q]=Q;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${J}</template>`}function Rz($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,J;while((J=Y.exec($))!==null)if(J[1]){if(X--,X<0)return!1}else X++;return!0}function P3($,Z){let Y=Vz($);function X(J){let Q=J,G=/@if\s*\(/g,K,q=[];while((K=G.exec(Q))!==null){let W=K.index,z=W+K[0].length,U=1,j=z;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")")U--;j++}if(U!==0)continue;let H=Q.substring(z,j-1).trim(),B=j,_=1,O=B,F=/@(if\s*\(|endif)/g;F.lastIndex=B;let L;while((L=F.exec(Q))!==null)if(L[1].startsWith("if"))_++;else if(L[1]==="endif"){if(_--,_===0){O=L.index+L[0].length;break}}if(_!==0)continue;let V=Q.substring(B,O-6).trim(),w;if(Lz(V)){let R=U$(Q.substring(W,O));if(R.length===0)continue;let N=R[0].branches.filter((I)=>I.type!=="else");if(!(N.length>0&&N.every((I)=>y2(I.condition,Y,Z))))continue;w=R[0].branches.map((I)=>{let T=X(I.content);if(I.type==="elseif")return w4(T,"@else-if",I.condition??"");if(I.type==="else")return w4(T,"@else");return w4(T,"@if",I.condition??"")}).join(`
9882
- `)}else{if(!y2(H,Y,Z))continue;w=w4(X(V),"@if",H)}q.push({start:W,end:O,replacement:w}),G.lastIndex=O}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:j}=q[W];Q=Q.substring(0,z)+j+Q.substring(U)}return Q}return X($)}function Nz($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let J=Number(Z);return J!==0&&!Number.isNaN(J)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function Az($,Z,Y,X){if(y3.has(Y.toLowerCase()))return X;let J=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let H=$.indexOf("-->",q+4);if(H===-1)return-1;q=H+3;continue}let z=/^<(script|style)\b/i.exec($.slice(q,q+8));if(z){let H=$.indexOf(">",q);if(H===-1)return-1;if($[H-1]==="/"){q=H+1;continue}let B=Q.indexOf(`</${z[1].toLowerCase()}`,q);if(B===-1)return-1;let _=$.indexOf(">",B);if(_===-1)return-1;q=_+1;continue}if($[q+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!H){q++;continue}if(H[1].toLowerCase()===J){if(K--,q+=H[0].length,K===0)return q;continue}q+=H[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!U){q++;continue}let j=$.indexOf(">",q);if(j===-1)return-1;if(U[1].toLowerCase()===J){let H=$.slice(q,j+1);if(!(/\/\s*>$/.test(H)||y3.has(J)))K++}q=j+1}return-1}function Tz($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let J=$.indexOf(">",Y);if(J===-1)return!1;let Q=$.slice(Y,J+1);return Mz.test(Q)}function C3($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let J=(U)=>Z.some(([j,H])=>U>=j&&U<H),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=Q.exec($))!==null){if(J(K.index))continue;let[U,j,H,B,_,O,F]=K,L=Nz(_);if(L===void 0)continue;let V=K.index,w=V+U.length,A=!!F||/\/\s*>$/.test(U)||y3.has(j.toLowerCase())?w:Az($,V,j,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&Tz($,A)){Q.lastIndex=w;continue}if(L===!0){let I=`<${j}${H}${O}${F}>`;G.push({start:V,end:w,replacement:I});continue}G.push({start:V,end:A,replacement:""}),Q.lastIndex=A}if(G.length===0)return $;G.sort((U,j)=>U.start-j.start);let q=[],W=-1;for(let U of G){if(U.start<W)continue;q.push(U),W=U.end}let z=$;for(let U=q.length-1;U>=0;U--){let{start:j,end:H,replacement:B}=q[U];z=z.substring(0,j)+B+z.substring(H)}return z}function v3($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,J,Q=[],G=[];while((J=X.exec(Y))!==null){let K=J[1],q=J.index,W=q+J[0].length,z=1,U=W;while(U<Y.length&&z>0){if(Y[U]==="(")z++;else if(Y[U]===")")z--;U++}if(z!==0)continue;let j=Y.substring(W,U-1).trim(),H=U,B=x2(j),_=K==="for"?"@endfor":"@endforeach",O=1,F=H,L=K==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${K}\\s*\\(|end${K})`,"g");L.lastIndex=H;let V;while((V=L.exec(Y))!==null)if(V[1].startsWith(K))O++;else if(O--,O===0){F=V.index+V[0].length;break}if(O!==0)continue;let w=()=>{let M=[B.itemVar,B.indexVar].filter(Boolean);if(M.length)G.push({start:q,end:F,vars:M})};if(B.iterable){let M=B.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M)){w();continue}let I=M.split(/[.[(]/)[0].trim(),T=Z?I in Z:!1,k=G.some((D)=>q>D.start&&q<D.end&&D.vars.includes(I));if(I&&(T||k)){w();continue}}if(B.style==="as")j=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=Y.substring(H,F-_.length).trim(),N=R.match(C2),A;if(N){let[,M,I,T]=N;A=`<${M}${I} @for="${j}">${T}</${M}>`}else A=`<template @for="${j}">${R}</template>`;Q.push({start:q,end:F,replacement:A})}for(let K=Q.length-1;K>=0;K--){let{start:q,end:W,replacement:z}=Q[K];Y=Y.substring(0,q)+z+Y.substring(W)}return Y}function Iz($){let Z=new Set,Y=[],X=0,J=0,Q=$.length,G=(z)=>{let U=X+1;while(U<Q){let j=$[U];if(j==="\\"){U+=2;continue}if(j===z)return U+1;U++}return Q},K=()=>{let z=X+2;while(z<Q&&$[z]!==`
9881
+ </body>`+$.slice(G+7)}var V4=b(()=>{F2();A3()});var A4={};o(A4,{scanScriptTags:()=>x2,rewriteStxImportSpecifiers:()=>m2,processSignals:()=>x3,processScriptSetup:()=>g2,preEvalLiteralReactiveIfs:()=>C3,parseLoopExpression:()=>f2,hasSignalsSyntax:()=>N4,findMarkupIndexOutsideScripts:()=>R4,extractExports:()=>h2,convertSignalLoopsToAttributes:()=>v3,convertSignalDirectivesToAttributes:()=>P3});function x2($,Z={}){let Y=[];for(let X of q3($,R1)){let J=X.token.match(/^<script\b([^>]*)>/i),Q=X.token.match(/<\/script\s*>$/i);if(!J||!Q)continue;let G=J[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=J[0].length,q=X.token.length-Q[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,q),start:X.start,end:X.end})}return Y}function f2($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let J=Y[1].trim(),Q=Y[2].trim(),{itemVar:G,indexVar:K}=S2(Q);if(G)return{style:"as",iterable:J,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let J=X[1].trim(),Q=X[2].trim(),{itemVar:G,indexVar:K}=S2(J);if(G)return{style:"in",iterable:Q,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function S2($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let J=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let Q=Z.match(/^(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:null};return{itemVar:null,indexVar:null}}function N4($){return g8($)}function Vz($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let J=X[1];if(J.startsWith("if"))Y++;else if(J==="endif")Y--;else if(Y===0)return!0}return!1}function wz($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=Y.exec($))!==null){let Q=J[1],G;while((G=X.exec(Q))!==null)Z.add(G[1])}return Z}function Rz($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function P2($,Z,Y){if(!$)return!1;let X=Rz($),J=!1,Q=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let j=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(y2.has(j))continue;if(Z.has(j))J=!0;else if(Y&&j in Y)Q=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=W.exec(X))!==null){let j=z[1];if(X.slice(0,z.index).trimEnd().endsWith("."))continue;if(y2.has(j)||Y&&j in Y)continue;G=!0}return(J||G)&&!Q}function w4($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,J=$.trim(),Q=J.match(v2);if(Q&&Nz(Q[3],Q[1])){let[,G,K,q]=Q;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${J}</template>`}function Nz($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,J;while((J=Y.exec($))!==null)if(J[1]){if(X--,X<0)return!1}else X++;return!0}function P3($,Z){let Y=wz($);function X(J){let Q=J,G=/@if\s*\(/g,K,q=[];while((K=G.exec(Q))!==null){let W=K.index,z=W+K[0].length,U=1,j=z;while(j<Q.length&&U>0){if(Q[j]==="(")U++;else if(Q[j]===")")U--;j++}if(U!==0)continue;let H=Q.substring(z,j-1).trim(),B=j,_=1,O=B,F=/@(if\s*\(|endif)/g;F.lastIndex=B;let L;while((L=F.exec(Q))!==null)if(L[1].startsWith("if"))_++;else if(L[1]==="endif"){if(_--,_===0){O=L.index+L[0].length;break}}if(_!==0)continue;let V=Q.substring(B,O-6).trim(),w;if(Vz(V)){let R=U$(Q.substring(W,O));if(R.length===0)continue;let N=R[0].branches.filter((I)=>I.type!=="else");if(!(N.length>0&&N.every((I)=>P2(I.condition,Y,Z))))continue;w=R[0].branches.map((I)=>{let T=X(I.content);if(I.type==="elseif")return w4(T,"@else-if",I.condition??"");if(I.type==="else")return w4(T,"@else");return w4(T,"@if",I.condition??"")}).join(`
9882
+ `)}else{if(!P2(H,Y,Z))continue;w=w4(X(V),"@if",H)}q.push({start:W,end:O,replacement:w}),G.lastIndex=O}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:j}=q[W];Q=Q.substring(0,z)+j+Q.substring(U)}return Q}return X($)}function Az($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let J=Number(Z);return J!==0&&!Number.isNaN(J)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function Mz($,Z,Y,X){if(y3.has(Y.toLowerCase()))return X;let J=Y.toLowerCase(),Q=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let H=$.indexOf("-->",q+4);if(H===-1)return-1;q=H+3;continue}let z=/^<(script|style)\b/i.exec($.slice(q,q+8));if(z){let H=$.indexOf(">",q);if(H===-1)return-1;if($[H-1]==="/"){q=H+1;continue}let B=Q.indexOf(`</${z[1].toLowerCase()}`,q);if(B===-1)return-1;let _=$.indexOf(">",B);if(_===-1)return-1;q=_+1;continue}if($[q+1]==="/"){let H=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!H){q++;continue}if(H[1].toLowerCase()===J){if(K--,q+=H[0].length,K===0)return q;continue}q+=H[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!U){q++;continue}let j=$.indexOf(">",q);if(j===-1)return-1;if(U[1].toLowerCase()===J){let H=$.slice(q,j+1);if(!(/\/\s*>$/.test(H)||y3.has(J)))K++}q=j+1}return-1}function Iz($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let J=$.indexOf(">",Y);if(J===-1)return!1;let Q=$.slice(Y,J+1);return Tz.test(Q)}function C3($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let J=(U)=>Z.some(([j,H])=>U>=j&&U<H),Q=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=Q.exec($))!==null){if(J(K.index))continue;let[U,j,H,B,_,O,F]=K,L=Az(_);if(L===void 0)continue;let V=K.index,w=V+U.length,A=!!F||/\/\s*>$/.test(U)||y3.has(j.toLowerCase())?w:Mz($,V,j,w);if(A===-1)continue;if((B===":if"||B==="x-if"||B==="@if")&&Iz($,A)){Q.lastIndex=w;continue}if(L===!0){let I=`<${j}${H}${O}${F}>`;G.push({start:V,end:w,replacement:I});continue}G.push({start:V,end:A,replacement:""}),Q.lastIndex=A}if(G.length===0)return $;G.sort((U,j)=>U.start-j.start);let q=[],W=-1;for(let U of G){if(U.start<W)continue;q.push(U),W=U.end}let z=$;for(let U=q.length-1;U>=0;U--){let{start:j,end:H,replacement:B}=q[U];z=z.substring(0,j)+B+z.substring(H)}return z}function v3($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,J,Q=[],G=[];while((J=X.exec(Y))!==null){let K=J[1],q=J.index,W=q+J[0].length,z=1,U=W;while(U<Y.length&&z>0){if(Y[U]==="(")z++;else if(Y[U]===")")z--;U++}if(z!==0)continue;let j=Y.substring(W,U-1).trim(),H=U,B=f2(j),_=K==="for"?"@endfor":"@endforeach",O=1,F=H,L=K==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${K}\\s*\\(|end${K})`,"g");L.lastIndex=H;let V;while((V=L.exec(Y))!==null)if(V[1].startsWith(K))O++;else if(O--,O===0){F=V.index+V[0].length;break}if(O!==0)continue;let w=()=>{let M=[B.itemVar,B.indexVar].filter(Boolean);if(M.length)G.push({start:q,end:F,vars:M})};if(B.iterable){let M=B.iterable.trim();if(M.startsWith("[")||M.startsWith("{")||M.startsWith("'")||M.startsWith('"')||M.startsWith("`")||/^-?\d/.test(M)){w();continue}let I=M.split(/[.[(]/)[0].trim(),T=Z?I in Z:!1,k=G.some((D)=>q>D.start&&q<D.end&&D.vars.includes(I));if(I&&(T||k)){w();continue}}if(B.style==="as")j=B.indexVar?`(${B.itemVar}, ${B.indexVar}) in ${B.iterable}`:`${B.itemVar} in ${B.iterable}`;let R=Y.substring(H,F-_.length).trim(),N=R.match(v2),A;if(N){let[,M,I,T]=N;A=`<${M}${I} @for="${j}">${T}</${M}>`}else A=`<template @for="${j}">${R}</template>`;Q.push({start:q,end:F,replacement:A})}for(let K=Q.length-1;K>=0;K--){let{start:q,end:W,replacement:z}=Q[K];Y=Y.substring(0,q)+z+Y.substring(W)}return Y}function Dz($){let Z=new Set,Y=[],X=0,J=0,Q=$.length,G=(z)=>{let U=X+1;while(U<Q){let j=$[U];if(j==="\\"){U+=2;continue}if(j===z)return U+1;U++}return Q},K=()=>{let z=X+2;while(z<Q&&$[z]!==`
9883
9883
  `)z++;return z},q=()=>{let z=X+2;while(z<Q-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return Q},W=(z)=>{let U=z,j=0;while(U<Q){let H=$[U];if(H==="/"&&$[U+1]==="/"){let B=U+2;while(B<Q&&$[B]!==`
9884
- `)B++;U=B;continue}if(H==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(H==='"'||H==="'"||H==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===H){B++;break}B++}U=B;continue}if(H==="("||H==="["||H==="{"){j++,U++;continue}if(H===")"||H==="]"||H==="}"){j--,U++;continue}if(H===";"&&j===0)return U+1;U++}return Q};while(X<Q){let z=$[X];if(z==="/"&&$[X+1]==="/"){let U=K();Y.push($.slice(X,U)),X=U;continue}if(z==="/"&&$[X+1]==="*"){let U=q();Y.push($.slice(X,U)),X=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);Y.push($.slice(X,U)),X=U;continue}if(z==="{"){J++,Y.push(z),X++;continue}if(z==="}"){J--,Y.push(z),X++;continue}if(J===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let H=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(H){let B=H[2],_=W(X+H[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),X=_;continue}Z.add(B),Y.push($.slice(X,_)),X=_;continue}}}Y.push(z),X++}return Y.join("")}async function f2($,Z,Y){let X=v2($,{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*\(/,Q=[];for(let O of X){let F=O.body;if(m1(O.attrs))F=d1(F);if(J.test(F))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:F})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${Fz++}`,{hasUserImports:K,bundleClientScript:q}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (t5(),a5))),W=[];for(let O=0;O<Q.length;O++){let F=Q[O].content;if(F=_5(F).code,K(F))F=await q(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>h2(w));let L=x0(F);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
9884
+ `)B++;U=B;continue}if(H==="/"&&$[U+1]==="*"){let B=U+2;while(B<Q-1&&!($[B]==="*"&&$[B+1]==="/"))B++;U=B+2;continue}if(H==='"'||H==="'"||H==="`"){let B=U+1;while(B<Q){if($[B]==="\\"){B+=2;continue}if($[B]===H){B++;break}B++}U=B;continue}if(H==="("||H==="["||H==="{"){j++,U++;continue}if(H===")"||H==="]"||H==="}"){j--,U++;continue}if(H===";"&&j===0)return U+1;U++}return Q};while(X<Q){let z=$[X];if(z==="/"&&$[X+1]==="/"){let U=K();Y.push($.slice(X,U)),X=U;continue}if(z==="/"&&$[X+1]==="*"){let U=q();Y.push($.slice(X,U)),X=U;continue}if(z==='"'||z==="'"||z==="`"){let U=G(z);Y.push($.slice(X,U)),X=U;continue}if(z==="{"){J++,Y.push(z),X++;continue}if(z==="}"){J--,Y.push(z),X++;continue}if(J===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let H=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(H){let B=H[2],_=W(X+H[0].length);if(Z.has(B)){Y.push(`/* stx: deduped const ${B} */`),X=_;continue}Z.add(B),Y.push($.slice(X,_)),X=_;continue}}}Y.push(z),X++}return Y.join("")}async function g2($,Z,Y){let X=x2($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),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*\(/,Q=[];for(let O of X){let F=O.body;if(m1(O.attrs))F=d1(F);if(J.test(F))Q.push({fullMatch:O.fullMatch,attrs:O.attrs,content:F})}if(Q.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${Lz++}`,{hasUserImports:K,bundleClientScript:q}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (t5(),a5))),W=[];for(let O=0;O<Q.length;O++){let F=Q[O].content;if(F=_5(F).code,K(F))F=await q(F,Z||"",{projectRoot:process.cwd()});F=F.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(V,w)=>m2(w));let L=f0(F);W.push(`// \u2500\u2500 merged signal script #${O+1} \u2500\u2500
9885
9885
  ${L}`)}let z=W.join(`
9886
9886
 
9887
- `);z=Iz(z);let U=g2(z),j=U.split(",").map((O)=>O.trim()).filter(Boolean),H=n$(z,Y),B=`
9887
+ `);z=Dz(z);let U=h2(z),j=U.split(",").map((O)=>O.trim()).filter(Boolean),H=n$(z,Y),B=`
9888
9888
  <script data-stx-scoped>
9889
9889
  function ${G}() {
9890
9890
  ${B5("const",j)}
@@ -9893,17 +9893,17 @@ ${H5(`${H}${z}`)}
9893
9893
  }
9894
9894
  window.__stx_latestSetup=${G};
9895
9895
  if(window.stx)window.stx._latestSetup=${G};
9896
- </script>`,_=$;for(let O of Q)_=_.split(O.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${k2})>`),`<body$1 data-stx="${G}">`);else{let O=["script","style","html","head","meta","link","title","!doctype"],F=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${k2})>`,"gi"),(L,V,w)=>{if(F||O.includes(V.toLowerCase()))return L;return F=!0,`<${V}${w} data-stx="${G}">`})}return{output:_,setupCode:B}}function g2($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K="",q=()=>{Q++;let B=!1;while(Q<G){let _=Z[Q];if(_==="\\"){Q+=2;continue}if(_==="["&&!B){B=!0,Q++;continue}if(_==="]"&&B){B=!1,Q++;continue}if(_==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(_===`
9896
+ </script>`,_=$;for(let O of Q)_=_.split(O.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${b2})>`),`<body$1 data-stx="${G}">`);else{let O=["script","style","html","head","meta","link","title","!doctype"],F=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${b2})>`,"gi"),(L,V,w)=>{if(F||O.includes(V.toLowerCase()))return L;return F=!0,`<${V}${w} data-stx="${G}">`})}return{output:_,setupCode:B}}function h2($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K="",q=()=>{Q++;let B=!1;while(Q<G){let _=Z[Q];if(_==="\\"){Q+=2;continue}if(_==="["&&!B){B=!0,Q++;continue}if(_==="]"&&B){B=!1,Q++;continue}if(_==="/"&&!B){Q++;while(Q<G&&/[gimsuyd]/.test(Z[Q]))Q++;return}if(_===`
9897
9897
  `)return;Q++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},z=(B)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===B){Q++;return}Q++}},U=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let B=1;while(Q<G&&B>0)if(Z[Q]==="{")B++,Q++;else if(Z[Q]==="}")B--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')z(Z[Q]);else if(Z[Q]==="`")U();else Q++;continue}Q++}},j=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
9898
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},H=()=>{if(J!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let V=B[2];if(!X.has(V))Y.push(V),X.add(V);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let R=w.indexOf(":"),A=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let F=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let L=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!X.has(V))Y.push(V),X.add(V)}};while(Q<G){if(j())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){U(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&W()){q(),K="/";continue}if(Z[Q]==="{"){J++,K="{",Q++;continue}if(Z[Q]==="}"){J--,K="}",Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))H();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function x3($,Z,Y,X){if(!N4($))return $;let J=$;if(Z.skipSignalsRuntime)return J;let{output:Q,setupCode:G}=await f2(J,Y,X);if(J=Q,J=await L4(J,Z),G){let z=R4(J,/<\/head>/i),U=z===-1?R4(J,/<body[^>]*>/i):-1;if(z!==-1)J=`${J.slice(0,z)}${G}
9898
+ `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},H=()=>{if(J!==0)return;let B=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(B){let V=B[2];if(!X.has(V))Y.push(V),X.add(V);return}let _=Z.slice(Q).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((V)=>{let w=V.trim();if(!w)return;let R=w.indexOf(":"),A=(R>=0?w.slice(R+1).trim():w).split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let O=Z.slice(Q).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(O){O[1].split(",").forEach((V)=>{let w=V.trim().replace(/^\.\.\./,"");if(!w)return;let R=w.split(/[\s=]/)[0];if(R&&!X.has(R))Y.push(R),X.add(R)});return}let F=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let L=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let V=L[1];if(!X.has(V))Y.push(V),X.add(V)}};while(Q<G){if(j())continue;if(Z[Q]==="'"||Z[Q]==='"'){z(Z[Q]),K=Z[Q-1];continue}if(Z[Q]==="`"){U(),K="`";continue}if(Z[Q]==="/"&&Z[Q+1]!=="/"&&Z[Q+1]!=="*"&&W()){q(),K="/";continue}if(Z[Q]==="{"){J++,K="{",Q++;continue}if(Z[Q]==="}"){J--,K="}",Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))H();if(!/\s/.test(Z[Q]))K=Z[Q];Q++}return Y.join(", ")}async function x3($,Z,Y,X){if(!N4($))return $;let J=$;if(Z.skipSignalsRuntime)return J;let{output:Q,setupCode:G}=await g2(J,Y,X);if(J=Q,J=await L4(J,Z),G){let z=R4(J,/<\/head>/i),U=z===-1?R4(J,/<body[^>]*>/i):-1;if(z!==-1)J=`${J.slice(0,z)}${G}
9899
9899
  ${J.slice(z)}`;else if(U!==-1){let j=/<body[^>]*>/i.exec(J.slice(U))[0],H=U+j.length;J=`${J.slice(0,H)}
9900
9900
  ${G}${J.slice(H)}`}else J=`${J}
9901
- ${G}`}let q=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let z=/<body[^>]*>/i,U=R4(J,z);if(U!==-1){let j=J.slice(0,U),H=J.slice(U).replace(z,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=j+H}}return J}function R4($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],J;while((J=Y.exec($))!==null)X.push([J.index,J.index+J[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([z,U])=>q>=z&&q<U))return q;G=q+Math.max(K[0].length,1)}return-1}function h2($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let J=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])Z.push(`${J[2]} = ${J[1]}`)}if(Z.length===0)return P2;return`var ${Z.join(", ")}; ${P2}`}var Fz=0,k2=`(?:"[^"]*"|'[^']*'|[^>"'])*`,C2,S2,y3,Mz,P2="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var H$=b(()=>{X$();Q4();$1();$3();R0();V4();u1();r5();C2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;S2=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"]);y3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Mz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Dz from"fs";import f from"path";function kz($){let Z=new WeakSet;try{let Y=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(Y);let J={};for(let Q of Object.keys(X).sort())J[Q]=Y(X[Q]);return J};return JSON.stringify(Y($))}catch{return null}}function m2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bz($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function m1($){return!bz($)}function d1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)J=J.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),J=J.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return J}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function Sz($){let Z=[],Y=new Set,X=0,J=0,Q=$.length,G=(z)=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]===z){J++;return}J++}},K=()=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let z=1;while(J<Q&&z>0)if($[J]==="{")z++,J++;else if($[J]==="}")z--,J++;else if($[J]==="'"||$[J]==='"')G($[J]);else if($[J]==="`")K();else J++;continue}J++}},q=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<Q&&$[J]!==`
9902
- `)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(X!==0)return;let z=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let B=z[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Y.has(_))Z.push(_),Y.add(_);return}let U=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let H=$.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(J<Q){if(q())continue;if($[J]==="'"||$[J]==='"'){G($[J]);continue}if($[J]==="`"){K();continue}if($[J]==="{"){X++,J++;continue}if($[J]==="}"){X--,J++;continue}if(X===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))W();J++}return Z}function yz($){let Z=[],Y=0,X=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G==="\\"){Q++;continue}if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function Pz($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function Cz($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let J=X,Q=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,J);for(let q of yz(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let z=Pz(W);if(z===-1)continue;let U=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let j=W.slice(z+1).trim();if(!j)continue;try{let H=Object.keys(Z),B=Function(...H,`"use strict"; return (${j});`);Z[U]=B(...H.map((_)=>Z[_]))}catch{}}}catch{}}async function I4($,Z,Y,X,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(q.has(O))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],z=typeof J.root==="string"?f.resolve(J.root):void 0,U=z??f.dirname(X),j=[],H=(O)=>{if(O&&!j.includes(O))j.push(O)},B=Y.__originalFilePath;if(B)H(f.join(f.dirname(B),"components"));H(Z),H(J._rootComponentsDir),H(f.join(f.dirname(X),"components")),H(J.componentsDir);let _=J._pluginComponentDirs;if(Array.isArray(_))for(let O of _)H(typeof O==="string"?O:null);if(z)H(f.resolve(z,"resources/views/components")),H(f.resolve(z,"resources/components")),H(f.resolve(z,"src/components")),H(f.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return c(f.resolve(f.dirname(X),`${Q}.stx`));for(let O of j){let F=f.isAbsolute(O)?O:f.resolve(U,O);for(let L of W)if(await c(f.join(F,L)))return!0}return!1}function vz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function xz($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function fz($){let Z=new Set,Y=/\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 X of $){let J;while((J=Y.exec(X))!==null)Z.add(J[1]);Y.lastIndex=0}return[...Z]}async function o1($,Z,Y,X,J,Q,G,K=new Set,q){let{extractVariables:W}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (z$(),X4))),z=K??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let U=new Set(z);U.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let H=j&&j!=="load"&&vz(j)?j:"";try{let B=(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(),O=$.endsWith(".stx")?$.slice(0,-4):$,F=null,L=J.__importedComponents;if(L){let E=[O,O.toLowerCase(),B(O),_(O)];for(let v of E)if(L.has(v)){F=L.get(v);break}}let V=[];if(!F){let E=[`${O}.stx`,`${B(O)}.stx`,`${_(O)}.stx`],v=[...new Set(E)],h=J.__originalFilePath,g=[];if(h){let U0=f.join(f.dirname(h),"components");g.push(U0)}if(X)g.push(X);let a=G._rootComponentsDir;if(typeof a==="string"&&!g.includes(a))g.push(a);let Y0=f.join(f.dirname(Q),"components");if(!g.includes(Y0))g.push(Y0);if(G.componentsDir&&G.componentsDir!==X&&!g.includes(G.componentsDir))g.push(G.componentsDir);let n0=G._pluginComponentDirs;if(Array.isArray(n0)){for(let U0 of n0)if(typeof U0==="string"&&!g.includes(U0))g.push(U0)}let S0=typeof G.root==="string"?f.resolve(G.root):void 0,v0=S0??f.dirname(Q),o0=[];if(S0)o0.push(f.resolve(S0,"resources/views/components")),o0.push(f.resolve(S0,"resources/components")),o0.push(f.resolve(S0,"src/components")),o0.push(f.resolve(S0,"components"));o0.push(f.resolve(import.meta.dir,"components"));for(let U0 of o0)if(!g.includes(U0))g.push(U0);let z5=[...new Set(g.map((U0)=>{if(!U0)return U0;return f.isAbsolute(U0)?U0:f.resolve(v0,U0)}))];g.length=0,g.push(...z5);let O1=`${O}\x00${Q}\x00${z5.join("\x00")}`,F1=T4.get(O1);if(F1)if(await c(F1))F=F1;else T4.delete(O1);if(!F&&(O.startsWith("./")||O.startsWith("../")))F=f.resolve(f.dirname(Q),`${O}.stx`),V.push(F);else if(!F)for(let U0 of g){if(!U0)continue;for(let t0 of v){let i=f.join(U0,t0);if(V.push(i),await c(i)){F=i;break}}if(F)break;if(!F)try{let t0=await import("fs");if(!t0.statSync(U0,{throwIfNoEntry:!1})?.isDirectory())continue;let e0=8,x1=[{path:U0,depth:0}];while(x1.length>0&&!F){let G1=x1.pop();if(G1.depth>=e0)continue;let C$;try{C$=t0.readdirSync(G1.path,{withFileTypes:!0})}catch{continue}for(let v$ of C$){if(!v$.isDirectory())continue;if(v$.name==="node_modules"||v$.name.startsWith("."))continue;let r9=f.join(G1.path,v$.name);for(let qK of v){let h7=f.join(r9,qK);if(V.push(h7),await c(h7)){F=h7;break}}if(F)break;x1.push({path:r9,depth:G1.depth+1})}}}catch{}if(F)break}if(F)T4.set(O1,F)}if(!F||!await c(F)){let E=V.length>0?`
9901
+ ${G}`}let q=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let z=/<body[^>]*>/i,U=R4(J,z);if(U!==-1){let j=J.slice(0,U),H=J.slice(U).replace(z,(B)=>B.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=j+H}}return J}function R4($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],J;while((J=Y.exec($))!==null)X.push([J.index,J.index+J[0].length]);let Q=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=Q.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([z,U])=>q>=z&&q<U))return q;G=q+Math.max(K[0].length,1)}return-1}function m2($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let J=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])Z.push(`${J[2]} = ${J[1]}`)}if(Z.length===0)return C2;return`var ${Z.join(", ")}; ${C2}`}var Lz=0,b2=`(?:"[^"]*"|'[^']*'|[^>"'])*`,v2,y2,y3,Tz,C2="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var H$=b(()=>{X$();Q4();$1();$3();R0();V4();u1();r5();v2=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;y2=new Set(["true","false","null","undefined","NaN","Infinity","typeof","instanceof","in","of","new","void","delete","this","Math","JSON","Date","Number","String","Boolean","Array","Object","RegExp","Map","Set","Symbol","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","window","document","console"]);y3=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Tz=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Ez from"fs";import f from"path";function bz($){let Z=new WeakSet;try{let Y=(X)=>{if(X===void 0)return{__stxType:"undefined"};if(typeof X==="bigint")return{__stxType:"bigint",value:X.toString()};if(typeof X==="function"||typeof X==="symbol")throw TypeError("Non-serializable component input");if(X===null||typeof X!=="object")return X;if(Z.has(X))throw TypeError("Circular component input");if(Z.add(X),X instanceof Date)return{__stxType:"date",value:X.toISOString()};if(Array.isArray(X))return X.map(Y);let J={};for(let Q of Object.keys(X).sort())J[Q]=Y(X[Q]);return J};return JSON.stringify(Y($))}catch{return null}}function d2($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Sz($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function m1($){return!Sz($)}function d1($){try{let Z=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");Z=Z.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Y=[];Z=Z.replace(/\{!![\s\S]*?!!\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(Q)=>{let G=Y.length;return Y.push(Q),`"__STX_EXPR_${G}__"`});let J=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}).transformSync(Z);for(let Q=0;Q<Y.length;Q++)J=J.replace(`"__STX_EXPR_${Q}__"`,Y[Q]),J=J.replace(`'__STX_EXPR_${Q}__'`,Y[Q]);return J}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function yz($){let Z=[],Y=new Set,X=0,J=0,Q=$.length,G=(z)=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]===z){J++;return}J++}},K=()=>{J++;while(J<Q){if($[J]==="\\"){J+=2;continue}if($[J]==="`"){J++;return}if($[J]==="$"&&$[J+1]==="{"){J+=2;let z=1;while(J<Q&&z>0)if($[J]==="{")z++,J++;else if($[J]==="}")z--,J++;else if($[J]==="'"||$[J]==='"')G($[J]);else if($[J]==="`")K();else J++;continue}J++}},q=()=>{if($[J]==="/"&&$[J+1]==="/"){while(J<Q&&$[J]!==`
9902
+ `)J++;return!0}if($[J]==="/"&&$[J+1]==="*"){J+=2;while(J<Q-1&&!($[J]==="*"&&$[J+1]==="/"))J++;return J+=2,!0}return!1},W=()=>{if(X!==0)return;let z=$.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let B=z[2].split(",").map((_)=>{let O=_.trim().split(":");return O[O.length-1].trim()});for(let _ of B)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Y.has(_))Z.push(_),Y.add(_);return}let U=$.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!Y.has(B))Z.push(B),Y.add(B);return}let j=$.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!Y.has(B))Z.push(B),Y.add(B);return}let H=$.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!Y.has(B))Z.push(B),Y.add(B)}};while(J<Q){if(q())continue;if($[J]==="'"||$[J]==='"'){G($[J]);continue}if($[J]==="`"){K();continue}if($[J]==="{"){X++,J++;continue}if($[J]==="}"){X--,J++;continue}if(X===0&&/[a-z]/i.test($[J])&&(J===0||/\s|[;{}()]/.test($[J-1])))W();J++}return Z}function Pz($){let Z=[],Y=0,X=0,J=null;for(let Q=0;Q<$.length;Q++){let G=$[Q];if(J){if(G==="\\"){Q++;continue}if(G===J)J=null;continue}if(G==='"'||G==="'"||G==="`"){J=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,Q)),X=Q+1}if(X<$.length)Z.push($.slice(X));return Z}function Cz($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let J=$[X];if(Y){if(J==="\\"){X++;continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J==="="&&Z===0){let Q=$[X-1],G=$[X+1];if(Q==="!"||Q==="<"||Q===">"||Q==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function vz($,Z){try{let Y=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec($);if(!Y)return;let X=Y.index-1;while(X>=0&&/\s/.test($[X]))X--;if($[X]!=="}")return;let J=X,Q=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")Q++;else if(q==="{"){if(Q--,Q===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,J);for(let q of Pz(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let z=Cz(W);if(z===-1)continue;let U=W.slice(0,z).trim();if(!/^[A-Z_$][\w$]*$/i.test(U))continue;if(Z[U]!==void 0)continue;let j=W.slice(z+1).trim();if(!j)continue;try{let H=Object.keys(Z),B=Function(...H,`"use strict"; return (${j});`);Z[U]=B(...H.map((_)=>Z[_]))}catch{}}}catch{}}async function I4($,Z,Y,X,J){let Q=$.endsWith(".stx")?$.slice(0,-4):$,G=(O)=>O.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(O)=>O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let O of[Q,Q.toLowerCase(),G(Q),K(Q)])if(q.has(O))return!0}let W=[...new Set([`${Q}.stx`,`${G(Q)}.stx`,`${K(Q)}.stx`])],z=typeof J.root==="string"?f.resolve(J.root):void 0,U=z??f.dirname(X),j=[],H=(O)=>{if(O&&!j.includes(O))j.push(O)},B=Y.__originalFilePath;if(B)H(f.join(f.dirname(B),"components"));H(Z),H(J._rootComponentsDir),H(f.join(f.dirname(X),"components")),H(J.componentsDir);let _=J._pluginComponentDirs;if(Array.isArray(_))for(let O of _)H(typeof O==="string"?O:null);if(z)H(f.resolve(z,"resources/views/components")),H(f.resolve(z,"resources/components")),H(f.resolve(z,"src/components")),H(f.resolve(z,"components"));if(Q.startsWith("./")||Q.startsWith("../"))return c(f.resolve(f.dirname(X),`${Q}.stx`));for(let O of j){let F=f.isAbsolute(O)?O:f.resolve(U,O);for(let L of W)if(await c(f.join(F,L)))return!0}return!1}function xz($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function fz($){if(!$)return!1;let Z=$.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(Z)}function gz($){let Z=new Set,Y=/\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 X of $){let J;while((J=Y.exec(X))!==null)Z.add(J[1]);Y.lastIndex=0}return[...Z]}async function o1($,Z,Y,X,J,Q,G,K=new Set,q){let{extractVariables:W}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (z$(),X4))),z=K??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let U=new Set(z);U.add($);let j=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let H=j&&j!=="load"&&xz(j)?j:"";try{let B=(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(),O=$.endsWith(".stx")?$.slice(0,-4):$,F=null,L=J.__importedComponents;if(L){let E=[O,O.toLowerCase(),B(O),_(O)];for(let v of E)if(L.has(v)){F=L.get(v);break}}let V=[];if(!F){let E=[`${O}.stx`,`${B(O)}.stx`,`${_(O)}.stx`],v=[...new Set(E)],h=J.__originalFilePath,g=[];if(h){let U0=f.join(f.dirname(h),"components");g.push(U0)}if(X)g.push(X);let a=G._rootComponentsDir;if(typeof a==="string"&&!g.includes(a))g.push(a);let Y0=f.join(f.dirname(Q),"components");if(!g.includes(Y0))g.push(Y0);if(G.componentsDir&&G.componentsDir!==X&&!g.includes(G.componentsDir))g.push(G.componentsDir);let n0=G._pluginComponentDirs;if(Array.isArray(n0)){for(let U0 of n0)if(typeof U0==="string"&&!g.includes(U0))g.push(U0)}let S0=typeof G.root==="string"?f.resolve(G.root):void 0,x0=S0??f.dirname(Q),o0=[];if(S0)o0.push(f.resolve(S0,"resources/views/components")),o0.push(f.resolve(S0,"resources/components")),o0.push(f.resolve(S0,"src/components")),o0.push(f.resolve(S0,"components"));o0.push(f.resolve(import.meta.dir,"components"));for(let U0 of o0)if(!g.includes(U0))g.push(U0);let z5=[...new Set(g.map((U0)=>{if(!U0)return U0;return f.isAbsolute(U0)?U0:f.resolve(x0,U0)}))];g.length=0,g.push(...z5);let O1=`${O}\x00${Q}\x00${z5.join("\x00")}`,F1=T4.get(O1);if(F1)if(await c(F1))F=F1;else T4.delete(O1);if(!F&&(O.startsWith("./")||O.startsWith("../")))F=f.resolve(f.dirname(Q),`${O}.stx`),V.push(F);else if(!F)for(let U0 of g){if(!U0)continue;for(let t0 of v){let i=f.join(U0,t0);if(V.push(i),await c(i)){F=i;break}}if(F)break;if(!F)try{let t0=await import("fs");if(!t0.statSync(U0,{throwIfNoEntry:!1})?.isDirectory())continue;let e0=8,x1=[{path:U0,depth:0}];while(x1.length>0&&!F){let G1=x1.pop();if(G1.depth>=e0)continue;let C$;try{C$=t0.readdirSync(G1.path,{withFileTypes:!0})}catch{continue}for(let v$ of C$){if(!v$.isDirectory())continue;if(v$.name==="node_modules"||v$.name.startsWith("."))continue;let r9=f.join(G1.path,v$.name);for(let WK of v){let h7=f.join(r9,WK);if(V.push(h7),await c(h7)){F=h7;break}}if(F)break;x1.push({path:r9,depth:G1.depth+1})}}}catch{}if(F)break}if(F)T4.set(O1,F)}if(!F||!await c(F)){let E=V.length>0?`
9903
9903
  Searched paths:
9904
9904
  ${V.map((v)=>` - ${v}`).join(`
9905
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${E}`}q.add(F);let w;if(M4.has(F))w=M4.get(F);else try{w=await Bun.file(F).text(),M4.set(F,w)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let R=new Set(["__originalFilePath","__importedComponents",o$]),N={};for(let[E,v]of Object.entries(J))if(!E.startsWith("__")||R.has(E))N[E]=v;let{extractSlotContent:A}=await t("stx/slots",()=>Promise.resolve().then(() => (w3(),V3))),M=A(Y),I={};if(M.defaultSlot?.trim())I.default=M.defaultSlot;for(let[E,v]of M.namedSlots)I[E]=v.content;let T={...N,...Z,props:Z,slot:Y,$slots:I,__processedComponents:U,__sections:{},__stx_signals_gate:z1(w)||xz(Y)};Cz(w,T);let k=w,D=$4(k);if(D)k=D.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...w.matchAll(P)],S=[],C=y.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&y.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,d=null;if(C){let E=kz({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(E!==null){x=`${F}\x00${E}`;let v=f3.get(x);if(v){for(let h of v.dependencies)q.add(h);return v.output}d=new Set(q)}}for(let E of y){let v=E[1]||"",h=E[2]||"",g=v.includes("server");if(m1(v)&&h.trim())h=d1(h);if(g&&h)try{await W(h,T,F)}catch(Y0){}if(!g){let Y0=h.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),n0=Y0.includes("{{")&&Y0.includes("}}"),S0=Y0.includes("{!!")&&Y0.includes("!!}");if(n0||S0)Y0=t$(Y0,T);let v0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");S.push(`<script${v0}>${Y0}</script>`)}}let u=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),X0=u?u[1]:"",d0=u?u[2]:"",V0="",i0=X0&&/\bscoped\b/i.test(X0);if(u)V0=`<style${X0}>${d0}</style>`;let p=k;if(p=p.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u)p=p.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(p=p.replace(E,(h,g)=>{let a=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(a)v.push(`<style${a[1]}>${a[2]}</style>`);return""}),p=p.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)V0=`${V0}${v.join(`
9906
- `)}`}if(Y&&p.includes("{{ text || slot }}"))p=p.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:B0}=await t("stx/slots",()=>Promise.resolve().then(() => (w3(),V3))),{defaultSlot:u0,namedSlots:_1}=M;p=await B0(p,u0,_1,T);let q5=S.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),W5=fz(S);if(W5.length>0)T.__stx_client_signal_names=W5;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:q5||S.length===0,defaultLayout:void 0};T.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let r=await N0(p,T,F,n,q),q0=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let E of r.matchAll(/\{\{([\s\S]*?)\}\}/g))q0.add(E[1].trim());if(q0.size>0)J.__stx_preserved_client_expressions=[...q0];let A0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++Ez}_${Math.random().toString(36).slice(2,8)}`,J0=r;if(q5){let E="";if(Object.keys(Z).length>0)try{E=` data-stx-props="${m2(JSON.stringify(Z))}"`}catch{}let v=H?` stx-hydrate="${m2(H)}"`:"";J0=`<div data-stx-scope="${A0}"${E}${v}>${r}</div>`;let h=await Promise.all(S.map(async(g)=>{let a=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!a)return g;let[,Y0,n0]=a,S0=l$(n0,{filePath:F,projectRoot:process.cwd()}),v0=S0.code,o0=c$(S0.styles);v0=_5(v0).code;let{hasUserImports:z5,bundleClientScript:O1}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (t5(),a5)));if(z5(v0))v0=await O1(v0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:F1}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (H$(),A4)));v0=v0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(G1,C$)=>F1(C$));let U0=x0(v0),t0=Sz(U0),i=`function(__scopeId) {
9905
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${E}`}q.add(F);let w;if(M4.has(F))w=M4.get(F);else try{w=await Bun.file(F).text(),M4.set(F,w)}catch(E){return`[Error loading component: ${E instanceof Error?E.message:String(E)}]`}let R=new Set(["__originalFilePath","__importedComponents",o$]),N={};for(let[E,v]of Object.entries(J))if(!E.startsWith("__")||R.has(E))N[E]=v;let{extractSlotContent:A}=await t("stx/slots",()=>Promise.resolve().then(() => (w3(),V3))),M=A(Y),I={};if(M.defaultSlot?.trim())I.default=M.defaultSlot;for(let[E,v]of M.namedSlots)I[E]=v.content;let T={...N,...Z,props:Z,slot:Y,$slots:I,__processedComponents:U,__sections:{},__stx_signals_gate:z1(w)||fz(Y)};vz(w,T);let k=w,D=$4(k);if(D)k=D.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,y=[...w.matchAll(P)],S=[],C=y.some((E)=>/\bserver\b/.test(E[1]||"")&&/\bcache\b/.test(E[1]||""))&&y.every((E)=>/\bserver\b/.test(E[1]||"")),x=null,d=null;if(C){let E=bz({props:Z,slot:Y,buildMode:G.buildMode??"",skipEventDirectives:G.skipEventDirectives===!0});if(E!==null){x=`${F}\x00${E}`;let v=f3.get(x);if(v){for(let h of v.dependencies)q.add(h);return v.output}d=new Set(q)}}for(let E of y){let v=E[1]||"",h=E[2]||"",g=v.includes("server");if(m1(v)&&h.trim())h=d1(h);if(g&&h)try{await W(h,T,F)}catch(Y0){}if(!g){let Y0=h.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),n0=Y0.includes("{{")&&Y0.includes("}}"),S0=Y0.includes("{!!")&&Y0.includes("!!}");if(n0||S0)Y0=t$(Y0,T);let x0=v.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");S.push(`<script${x0}>${Y0}</script>`)}}let u=w.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),X0=u?u[1]:"",u0=u?u[2]:"",V0="",i0=X0&&/\bscoped\b/i.test(X0);if(u)V0=`<style${X0}>${u0}</style>`;let p=k;if(p=p.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),u)p=p.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let E=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,v=[];if(p=p.replace(E,(h,g)=>{let a=g.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(a)v.push(`<style${a[1]}>${a[2]}</style>`);return""}),p=p.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),v.length>0)V0=`${V0}${v.join(`
9906
+ `)}`}if(Y&&p.includes("{{ text || slot }}"))p=p.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:B0}=await t("stx/slots",()=>Promise.resolve().then(() => (w3(),V3))),{defaultSlot:p0,namedSlots:_1}=M;p=await B0(p,p0,_1,T);let q5=S.some((E)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(E)),W5=gz(S);if(W5.length>0)T.__stx_client_signal_names=W5;let n={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:q5||S.length===0,defaultLayout:void 0};T.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let r=await N0(p,T,F,n,q),q0=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let E of r.matchAll(/\{\{([\s\S]*?)\}\}/g))q0.add(E[1].trim());if(q0.size>0)J.__stx_preserved_client_expressions=[...q0];let A0=`stx_${O.replace(/[^a-zA-Z0-9]/g,"_")}_${++kz}_${Math.random().toString(36).slice(2,8)}`,J0=r;if(q5){let E="";if(Object.keys(Z).length>0)try{E=` data-stx-props="${d2(JSON.stringify(Z))}"`}catch{}let v=H?` stx-hydrate="${d2(H)}"`:"";J0=`<div data-stx-scope="${A0}"${E}${v}>${r}</div>`;let h=await Promise.all(S.map(async(g)=>{let a=g.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!a)return g;let[,Y0,n0]=a,S0=l$(n0,{filePath:F,projectRoot:process.cwd()}),x0=S0.code,o0=c$(S0.styles);x0=_5(x0).code;let{hasUserImports:z5,bundleClientScript:O1}=await t("stx/client-script-bundler",()=>Promise.resolve().then(() => (t5(),a5)));if(z5(x0))x0=await O1(x0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:F1}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (H$(),A4)));x0=x0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(G1,C$)=>F1(C$));let U0=f0(x0),t0=yz(U0),i=`function(__scopeId) {
9907
9907
  ${B5("const",[...f8,...t0],U0)}
9908
9908
  const __scope = window.stx._scopes = window.stx._scopes || {};
9909
9909
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -9937,9 +9937,9 @@ finally {
9937
9937
  `+V0}else{if(V0)J0+=`
9938
9938
  `+V0;if(S.length>0){let E=T.__stx_event_bindings||[],v=Z$(T),h=await Promise.all(S.map(async(g)=>{let a=g.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!a)return g;return await Y$(a[1],{eventBindings:E,templateContent:J0,filePath:F,projectRoot:process.cwd(),serverData:v})}));J0+=`
9939
9939
  `+h.join(`
9940
- `),T.__stx_event_bindings=[]}}if(i0){let E=e$(J0,F);if(E.hasScoped)J0=E.html}if(x&&d)f3.set(x,{output:J0,dependencies:[...q].filter((E)=>!d.has(E))});return J0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{z.delete($)}}async function c($){return Bun.file($).exists()}function g3($,Z){let Y=f.resolve(Z),X=f.resolve($),J=Y.endsWith(f.sep)?Y:Y+f.sep;if(X===Y||X.startsWith(J))return X;return null}async function h3($,Z,Y,X){let J=await gz($,Z,Y,X);if(J===null)return null;let Q=g3(J,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=f.isAbsolute(K)?K:f.resolve(process.cwd(),K);if(g3(J,q))return f.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${$}, from: ${Z})`),null}async function gz($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let J=f.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=f.join(Q,$),H=g3(j,Q);if(!H)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${H}`);if(await c(H)&&X)X.add(H);return H}let G=f.join(J,$);if(await c(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let H=`${G}${j}`;if(await c(H)){if(Y.debug)console.log(`Found direct path with extension: ${H}`);if(X)X.add(H);return H}}let K="",q=f.resolve(J),W=process.cwd();for(let j=0;j<10;j++){let H=f.join(q,"layouts"),B=!1;try{B=Dz.statSync(H,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=H;break}let _=f.dirname(q);if(_===q||_.length<W.length)break;q=_}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,H=f.join(K,j);if(await c(H)){if(Y.debug)console.log(`Found in current layouts dir: ${H}`);if(X)X.add(H);return H}if(!j.endsWith(".stx")){let B=`${H}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.layoutsDir){let j=f.isAbsolute(Y.layoutsDir)?Y.layoutsDir:f.resolve(process.cwd(),Y.layoutsDir),H=$.startsWith("layouts/")?$.slice(8):$,B=f.join(j,H);if(await c(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(X)X.add(_);return _}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),H=f.join(Y.partialsDir||J,"layouts",j[1]);if(await c(H)){if(Y.debug)console.log(`Found in layouts path: ${H}`);if(X)X.add(H);return H}if(!H.endsWith(".stx")){let B=`${H}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.partialsDir){if(K=f.join(Y.partialsDir,"layouts"),await c(K)){let j=f.join(K,$);if(await c(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${H}`);if(X)X.add(H);return H}}}}let z=Y.partialsDir||f.join(process.cwd(),"views"),U=f.join(z,$);if(await c(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(X)X.add(j);return j}}if(J.includes("temp")){let j=f.join(f.dirname(J),"layouts",$);if(await c(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${H}`);if(X)X.add(H);return H}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function d2($,Z,Y){let X=0,J="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
9940
+ `),T.__stx_event_bindings=[]}}if(i0){let E=e$(J0,F);if(E.hasScoped)J0=E.html}if(x&&d)f3.set(x,{output:J0,dependencies:[...q].filter((E)=>!d.has(E))});return J0}catch(B){return`[Error processing component: ${B instanceof Error?B.message:String(B)}]`}finally{z.delete($)}}async function c($){return Bun.file($).exists()}function g3($,Z){let Y=f.resolve(Z),X=f.resolve($),J=Y.endsWith(f.sep)?Y:Y+f.sep;if(X===Y||X.startsWith(J))return X;return null}async function h3($,Z,Y,X){let J=await hz($,Z,Y,X);if(J===null)return null;let Q=g3(J,process.cwd());if(Q)return Q;let G=[Y.root,Y.layoutsDir,Y.componentsDir,Y.partialsDir,Y.pagesDir].filter((K)=>typeof K==="string"&&K.length>0);for(let K of G){let q=f.isAbsolute(K)?K:f.resolve(process.cwd(),K);if(g3(J,q))return f.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${$}, from: ${Z})`),null}async function hz($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let J=f.dirname(Z),Q=process.cwd();if($.startsWith("/")){let j=f.join(Q,$),H=g3(j,Q);if(!H)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${H}`);if(await c(H)&&X)X.add(H);return H}let G=f.join(J,$);if(await c(G)){if(Y.debug)console.log(`Found direct path: ${G}`);if(X)X.add(G);return G}if(!$.endsWith(".stx")&&!$.endsWith(".jsx")&&!$.endsWith(".tsx"))for(let j of[".stx",".tsx",".jsx"]){let H=`${G}${j}`;if(await c(H)){if(Y.debug)console.log(`Found direct path with extension: ${H}`);if(X)X.add(H);return H}}let K="",q=f.resolve(J),W=process.cwd();for(let j=0;j<10;j++){let H=f.join(q,"layouts"),B=!1;try{B=Ez.statSync(H,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(B){K=H;break}let _=f.dirname(q);if(_===q||_.length<W.length)break;q=_}if(K){let j=$.startsWith("layouts/")?$.slice(8):$,H=f.join(K,j);if(await c(H)){if(Y.debug)console.log(`Found in current layouts dir: ${H}`);if(X)X.add(H);return H}if(!j.endsWith(".stx")){let B=`${H}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.layoutsDir){let j=f.isAbsolute(Y.layoutsDir)?Y.layoutsDir:f.resolve(process.cwd(),Y.layoutsDir),H=$.startsWith("layouts/")?$.slice(8):$,B=f.join(j,H);if(await c(B)){if(Y.debug)console.log(`Found in options.layoutsDir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await c(_)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(X)X.add(_);return _}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let j=$.split("layouts/"),H=f.join(Y.partialsDir||J,"layouts",j[1]);if(await c(H)){if(Y.debug)console.log(`Found in layouts path: ${H}`);if(X)X.add(H);return H}if(!H.endsWith(".stx")){let B=`${H}.stx`;if(await c(B)){if(Y.debug)console.log(`Found in layouts path with extension: ${B}`);if(X)X.add(B);return B}}}if(Y.partialsDir){if(K=f.join(Y.partialsDir,"layouts"),await c(K)){let j=f.join(K,$);if(await c(j)){if(Y.debug)console.log(`Found in partials layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${H}`);if(X)X.add(H);return H}}}}let z=Y.partialsDir||f.join(process.cwd(),"views"),U=f.join(z,$);if(await c(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let j=`${U}.stx`;if(await c(j)){if(Y.debug)console.log(`Found in views path with extension: ${j}`);if(X)X.add(j);return j}}if(J.includes("temp")){let j=f.join(f.dirname(J),"layouts",$);if(await c(j)){if(Y.debug)console.log(`Found in temp layouts dir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await c(H)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${H}`);if(X)X.add(H);return H}}}if(Y.debug)console.warn(`Template not found after trying all paths: ${$} (referenced from ${Z})`);else console.warn(`Template not found: ${$} (referenced from ${Z})`);return null}function u2($,Z,Y){let X=0,J="",Q="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
9941
9941
  `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){X=q+1,J=G[q].trim();let W=Math.max(0,q-2),z=Math.min(G.length,q+3);Q=G.slice(W,z).map((U,j)=>{let H=W+j+1;return`${H===X?"> ":" "}${H}: ${U}`}).join(`
9942
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return d2($,G)}}catch{}return{lineNumber:X,lineContent:J,context:Q}}function z0($,Z,Y,X,J,Q){let{lineNumber:G,context:K}=d2(X,J,Q),q=Y.split("/").pop(),W=0;if(typeof J==="number"&&J>=0&&X){let U=X.lastIndexOf(`
9942
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return u2($,G)}}catch{}return{lineNumber:X,lineContent:J,context:Q}}function z0($,Z,Y,X,J,Q){let{lineNumber:G,context:K}=u2(X,J,Q),q=Y.split("/").pop(),W=0;if(typeof J==="number"&&J>=0&&X){let U=X.lastIndexOf(`
9943
9943
  `,Math.max(0,J-1));W=J-(U+1)+1}let z="";if(G>0)z+=`
9944
9944
  ${Y}:${G}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${Z}
9945
9945
  `;if(z+=`
@@ -9952,8 +9952,8 @@ ${e.yellow}${e.bold}Message:${e.reset} ${Z}
9952
9952
  `,K)z+=`
9953
9953
  ${e.blue}${e.bold}Context:${e.reset}
9954
9954
  ${e.dim}${K}${e.reset}
9955
- `;return z}function T2(){M4.clear(),T4.clear(),f3.clear()}var M4,T4,f3,Ez=0,e;var R0=b(()=>{X$();G3();Y1();$1();V5();D4();V1();j3();B3();r5();uZ();z$();M4=new p1(500),T4=new p1(1000),f3=new p1(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 u2($,Z,Y=""){let X=$,J=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",z=K+G[0].length,U=1,j=z,H=-1;while(U>0&&j<$.length){let O=$.indexOf("@markdown",j),F=$.indexOf("@endmarkdown",j);if(F===-1)break;if(O!==-1&&O<F&&O!==K){let L=$[O+9];if(L==="("||L===`
9956
- `||L==="\r"||L===" "||L===void 0)U++;j=O+9}else{if(U--,U===0){H=F;break}j=F+12}}if(H===-1)continue;let B=$.slice(z,H),_=$.slice(K,H+12);J.push({fullMatch:_,options:W,content:B,index:K}),Q.lastIndex=H+12}for(let{fullMatch:K,options:q,content:W,index:z}of J)try{let U={};if(q)q.split(",").forEach((B)=>{let _=B.trim();if(_)U[_]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},H=s5(W.trim(),j);X=X.split(K).join(H)}catch(U){let j=U instanceof Error?U.message:String(U),H=z0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,z,K);X=X.split(K).join(H)}return X}async function p2($,Z,Y,X){let J={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")J.breaks=!0;if(G==="no-gfm")J.gfm=!1}),s5($.trim(),J)}var m3=b(()=>{R0()});function dz($){if(hz.set($.name,$),$.client)mz.set($.name,$.client)}function E4($){return dz($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,J,Q)=>{let G=uz(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let K=Y;if($.transform)K=await $.transform(Y,G,J,Q);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function uz($,Z){let Y={...Z};for(let X of $){let J=X.indexOf(":"),Q=X.indexOf("="),G=J>=0&&(Q<0||J<Q)?J:Q;if(G>=0){let K=X.slice(0,G).trim(),q=X.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}var hz,mz;var d3=b(()=>{hz=new Map,mz=new Map});function u3($,Z=A5,Y={},X){return Z.sort((J,Q)=>J-Q).map((J)=>{return`${O$($,{...Y,w:J,fm:X})} ${J}w`}).join(", ")}function l2($,Z,Y=pz,X={},J){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${O$($,{...X,w:G,dpr:Q,fm:J})} ${Q}x`}).join(", ")}function p3($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([J,Q])=>{let G=/^\d+$/.test(J)?`${J}px`:J;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((J,Q)=>J.numericBp-Q.numericBp).map(({bp:J,size:Q})=>`(max-width: ${J}) ${Q}`);return X.push(Z),X.join(", ")}function O$($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let X=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),J=$.includes("?")?"&":"?";return`${$}${J}${X}`}function l3($){return lz[$]||"application/octet-stream"}var A5,pz,_$,lz;var c3=b(()=>{A5=[320,480,640,768,1024,1280,1536,1920,2560],pz=[1,1.5,2,3],_$=["avif","webp","jpeg"],lz={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function iz(){try{return await import("ts-images")}catch{return null}}async function nz($,Z={}){let Y={...cz,...Z},X=await iz();if(X)try{return await oz($,Y,X)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return sz($,Y)}async function oz($,Z,Y){let{generatePlaceholder:X,generateThumbHash:J}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await J($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function sz($,Z){let Y=Z.width||20,X=Z.height||Y,J="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function c2($,Z,Y={}){let X=Y.transitionDuration||300,J=Y.easing||"ease-out";return`
9955
+ `;return z}function I2(){M4.clear(),T4.clear(),f3.clear()}var M4,T4,f3,kz=0,e;var R0=b(()=>{X$();G3();Y1();$1();V5();D4();V1();j3();B3();r5();pZ();z$();M4=new p1(500),T4=new p1(1000),f3=new p1(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 p2($,Z,Y=""){let X=$,J=[],Q=/@markdown(?:\([^)]*\))?/g,G;while((G=Q.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",z=K+G[0].length,U=1,j=z,H=-1;while(U>0&&j<$.length){let O=$.indexOf("@markdown",j),F=$.indexOf("@endmarkdown",j);if(F===-1)break;if(O!==-1&&O<F&&O!==K){let L=$[O+9];if(L==="("||L===`
9956
+ `||L==="\r"||L===" "||L===void 0)U++;j=O+9}else{if(U--,U===0){H=F;break}j=F+12}}if(H===-1)continue;let B=$.slice(z,H),_=$.slice(K,H+12);J.push({fullMatch:_,options:W,content:B,index:K}),Q.lastIndex=H+12}for(let{fullMatch:K,options:q,content:W,index:z}of J)try{let U={};if(q)q.split(",").forEach((B)=>{let _=B.trim();if(_)U[_]=!0});let j={gfm:U.gfm??!0,breaks:U.breaks??!1},H=s5(W.trim(),j);X=X.split(K).join(H)}catch(U){let j=U instanceof Error?U.message:String(U),H=z0("Markdown Directive",`Error processing markdown: ${j}`,Y,$,z,K);X=X.split(K).join(H)}return X}async function l2($,Z,Y,X){let J={gfm:!0,breaks:!1};return Z.forEach((Q)=>{let G=Q.trim().replace(/['"]/g,"");if(G==="breaks")J.breaks=!0;if(G==="no-gfm")J.gfm=!1}),s5($.trim(),J)}var m3=b(()=>{R0()});function uz($){if(mz.set($.name,$),$.client)dz.set($.name,$.client)}function E4($){return uz($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,J,Q)=>{let G=pz(X,$.defaults);if($.validate){let q=$.validate(G);if(q!==!0){let W=typeof q==="string"?q:`Invalid parameters for @${$.name}`;throw Error(W)}}let K=Y;if($.transform)K=await $.transform(Y,G,J,Q);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function pz($,Z){let Y={...Z};for(let X of $){let J=X.indexOf(":"),Q=X.indexOf("="),G=J>=0&&(Q<0||J<Q)?J:Q;if(G>=0){let K=X.slice(0,G).trim(),q=X.slice(G+1).trim();if(q==="true")q=!0;else if(q==="false")q=!1;else if(q==="null")q=null;else if(!Number.isNaN(Number(q)))q=Number(q);else if(typeof q==="string"&&q.startsWith("{"))try{q=JSON.parse(q)}catch{}Y[K]=q}else{let K=Object.keys(Y).filter((q)=>!Z||!(q in Z)).length;Y[K===0?"value":`arg${K}`]=X}}return Y}var mz,dz;var d3=b(()=>{mz=new Map,dz=new Map});function u3($,Z=A5,Y={},X){return Z.sort((J,Q)=>J-Q).map((J)=>{return`${O$($,{...Y,w:J,fm:X})} ${J}w`}).join(", ")}function c2($,Z,Y=lz,X={},J){return Y.sort((Q,G)=>Q-G).map((Q)=>{let G=Math.round(Z*Q);return`${O$($,{...X,w:G,dpr:Q,fm:J})} ${Q}x`}).join(", ")}function p3($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([J,Q])=>{let G=/^\d+$/.test(J)?`${J}px`:J;return{bp:G,size:Q,numericBp:Number.parseInt(G)||0}}).sort((J,Q)=>J.numericBp-Q.numericBp).map(({bp:J,size:Q})=>`(max-width: ${J}) ${Q}`);return X.push(Z),X.join(", ")}function O$($,Z={}){let Y=Object.entries(Z).filter(([,Q])=>Q!==void 0&&Q!==null).map(([Q,G])=>{if(Array.isArray(G))return[Q,G.join(",")];return[Q,String(G)]});if(Y.length===0)return $;let X=Y.map(([Q,G])=>`${Q}=${encodeURIComponent(G)}`).join("&"),J=$.includes("?")?"&":"?";return`${$}${J}${X}`}function l3($){return cz[$]||"application/octet-stream"}var A5,lz,_$,cz;var c3=b(()=>{A5=[320,480,640,768,1024,1280,1536,1920,2560],lz=[1,1.5,2,3],_$=["avif","webp","jpeg"],cz={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function nz(){try{return await import("ts-images")}catch{return null}}async function oz($,Z={}){let Y={...iz,...Z},X=await nz();if(X)try{return await sz($,Y,X)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return rz($,Y)}async function sz($,Z,Y){let{generatePlaceholder:X,generateThumbHash:J}=Y,G={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[Z.strategy]||"blur";if(Z.strategy==="thumbhash")return{dataURL:(await J($)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let K=await X($,{width:Z.width,height:Z.height,quality:Z.quality,blurLevel:Z.blurLevel,strategy:G,base64Encode:!0});return{dataURL:K.dataURL,width:K.width,height:K.height,aspectRatio:K.aspectRatio,originalWidth:K.originalWidth,originalHeight:K.originalHeight,strategy:Z.strategy,dominantColor:K.dominantColor,css:K.css}}function rz($,Z){let Y=Z.width||20,X=Z.height||Y,J="#e5e7eb",Q=`<svg xmlns="http://www.w3.org/2000/svg" width="${Y}" height="${X}" viewBox="0 0 ${Y} ${X}"><rect fill="#e5e7eb" width="${Y}" height="${X}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(Q)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function i2($,Z,Y={}){let X=Y.transitionDuration||300,J=Y.easing||"ease-out";return`
9957
9957
  #${$} {
9958
9958
  --stx-img-transition-duration: ${X}ms;
9959
9959
  --stx-img-transition-easing: ${J};
@@ -9970,7 +9970,7 @@ ${e.dim}${K}${e.reset}
9970
9970
  #${$}.stx-img-loaded img {
9971
9971
  opacity: 1;
9972
9972
  }
9973
- `.trim()}async function i2($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(i3.has(Y))return i3.get(Y);let X=await nz($,Z);return i3.set(Y,X),X}var cz,n3,i3;var n2=b(()=>{cz={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},n3=`
9973
+ `.trim()}async function n2($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(i3.has(Y))return i3.get(Y);let X=await oz($,Z);return i3.set(Y,X),X}var iz,n3,i3;var o2=b(()=>{iz={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},n3=`
9974
9974
  .stx-img-placeholder {
9975
9975
  position: relative;
9976
9976
  overflow: hidden;
@@ -9999,8 +9999,8 @@ ${e.dim}${K}${e.reset}
9999
9999
  filter: blur(0);
10000
10000
  transform: scale(1);
10001
10001
  }
10002
- `.trim();i3=new Map});import{createHash as s2}from"crypto";import{readFile as rz,stat as r2}from"fs/promises";async function k0($){try{let Z=await rz($);return s2("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function o2($){return s2("sha256").update($).digest("hex").slice(0,16)}function k4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${o2($)}-${o2(Y)}`}async function o3($){try{return(await r2($)).mtimeMs}catch{return 0}}async function T0($){try{return await r2($),!0}catch{return!1}}var s1=()=>{};import{mkdir as az,readFile as tz,writeFile as ez,readdir as Vw,rm as $U,stat as ww}from"fs/promises";import{join as t2,dirname as ZU}from"path";async function YU($){try{await az($,{recursive:!0})}catch{}}function e2($,Z,Y){return t2($,Y,`${Z}.json`)}async function a2($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await o3(Z)!==$.srcMtime)return!1;return!0}async function b4($,Z,Y,X=s3){if(!X.enabled)return null;let J=k4($,Z),Q=M5.get(J);if(Q){if(await a2(Q,$,X.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;M5.delete(J)}let G=e2(X.directory,J,Y);if(await T0(G))try{let K=await tz(G,"utf-8"),q=JSON.parse(K);if(await a2(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),M5.set(J,q),q.data}catch{}return null}async function S4($,Z,Y,X,J=s3){if(!J.enabled)return;let Q=k4($,Z),G=await k0($),K=await o3($),q={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:k4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};M5.set(Q,q);let W=e2(J.directory,Q,X);try{await YU(ZU(W)),await ez(W,JSON.stringify(q,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function y4($,Z=s3){if($==="all")M5.clear();else M5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let J=t2(Z.directory,X);try{await $U(J,{recursive:!0,force:!0})}catch{}}}var M5,s3;var r3=b(()=>{s1();M5=new Map,s3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class C4{config;constructor($={}){this.config={...XU,...$}}async get($,Z){return b4($,Z,"image",this.config)}async set($,Z,Y){return S4($,Z,Y,"image",this.config)}async clear(){return y4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function a3($){if(!P4)P4=new C4($);else if($)P4.updateConfig($);return P4}async function v4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return a3(X).get($,Z)}async function x4($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return a3(J).set($,Z,Y)}async function $Y(){return a3().clear()}var XU,P4=null;var t3=b(()=>{r3();XU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as JU,basename as QU,extname as GU,join as KU}from"path";import{mkdir as qU}from"fs/promises";async function e3(){try{return await import("ts-images")}catch{return null}}function ZY($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function WU($,Z){let Y=Z?ZY(Z):ZY("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function YY($,Z,Y){let X=await e3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await v4($,Z,Y);if(J)return J;try{let Q=JU($);if(!await T0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=WU(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await qU(K,{recursive:!0});let W=await k0(Q),z=QU($,GU($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:W},H=null;if(Z.transformations&&Z.transformations.length>0)H=await $6(Q,Z.transformations,X);for(let B of U){let _=G[B]||{},O=`${z}-${W}.${B}`,F=KU(K,O);try{let L=await X.optimizeImage({input:H||Q,output:F,format:B,quality:_.quality,progressive:_.progressive});if(L){if(j.variants.push({path:F,url:`${q}/${O}`,width:L.width||0,height:L.height||0,format:B,size:L.outputSize||0}),!j.originalWidth&&L.width)j.originalWidth=L.width,j.originalHeight=L.height}}catch(L){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await X.generateThumbHash(Q);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await X.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await x4($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function XY($,Z,Y,X){let J=await e3();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function $6($,Z,Y){let X=Y||await e3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await X.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)J=await X.resize(J,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)J=await X.blur(J,G.sigma);break;case"sharpen":if(G.amount!==void 0)J=await X.sharpen(J,G.amount);break;case"grayscale":J=await X.grayscale(J);break;case"rotate":if(G.angle!==void 0)J=await X.rotate(J,G.angle);break;case"flip":J=await X.flip(J);break;case"flop":J=await X.flop(J);break;case"brightness":if(G.value!==void 0)J=await X.brightness(J,G.value);break;case"contrast":if(G.value!==void 0)J=await X.contrast(J,G.value);break;case"saturation":if(G.value!==void 0)J=await X.saturation(J,G.value);break}}return await X.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var JY=b(()=>{s1();t3()});import{resolve as zU,basename as UU,extname as jU,join as BU}from"path";import{mkdir as HU}from"fs/promises";async function _U(){try{return await import("ts-images")}catch{return null}}async function QY($,Z,Y){let X=await _U();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=zU($);if(!await T0(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||OU,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await HU(K,{recursive:!0});let W=await k0(J),z=UU($,jU($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let _=[];for(let O of Q){let F=`${z}-${O}w-${W}.${B}`,L=BU(K,F),V=`${q}/${F}`;try{let w=U[B]?.quality||80;if(await T0(L)){j.byFormat[B].push({path:L,url:V,width:O,height:0,format:B,size:0}),_.push(`${V} ${O}w`);continue}let R=await X.processImage({input:J,output:L,format:B,quality:w,resize:{width:O}});if(R)j.byFormat[B].push({path:L,url:V,width:O,height:R.height||Math.round(O*(R.height||1)/(R.width||1)),format:B,size:R.outputSize||0}),_.push(`${V} ${O}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${O}w: ${w}`)}}j.srcsets[B]=_.join(", ")}let H=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(H!=="none")try{if(H==="thumbhash"){let B=await X.generateThumbHash(J);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await X.generatePlaceholder(J,{strategy:H,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:H}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||FU(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function FU($){let Z=[...$].sort((X,J)=>X-J),Y=[];for(let X=0;X<Z.length-1;X++){let J=Z[X];Y.push(`(max-width: ${J}px) ${J}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function GY($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var OU;var KY=b(()=>{s1();OU=[320,480,640,768,1024,1280,1536,1920]});var qY={};o(qY,{setCachedImageResult:()=>x4,processImage:()=>YY,optimizeImage:()=>XY,getCachedImageResult:()=>v4,generateSrcset:()=>GY,generateResponsiveVariants:()=>QY,clearImageCache:()=>$Y,applyTransformations:()=>$6,ImageProcessorCache:()=>C4});var WY=b(()=>{JY();KY();t3()});async function LU(){try{return await Promise.resolve().then(() => (WY(),qY))}catch($){if(!zY)console.warn("[stx-media] Image processor not available, some features disabled:",$),zY=!0;return null}}async function f4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return NU(X,Y)}if(Y.processedResult?.processed)return J6($,Y.processedResult,Z);if(Y.responsiveVariants)return HY($,Y.responsiveVariants,Z);let{src:J,alt:Q,width:G,height:K,sizes:q,widths:W=A5,dpr:z,formats:U=_$,quality:j=Z6,params:H={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":h4,decoding:V=g4,fetchpriority:w,objectFit:R,objectPosition:N,crossorigin:A,referrerpolicy:M}=$,I=$.class,T=$.style,k=$.id,D=$.data||{},{isDev:P=!1,baseUrl:y=""}=Z;if(P&&!Z.optimize)return RU($);let S,C,x=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!F)try{S=await i2(J,{strategy:B,..._}),C=c2(x,S,_)}catch{}let d=z!==void 0&&G!==void 0,u;if(d)u=wU($,x,S,Z);else u=await VU($,x,S,Z);let X0;if(F){let i0=U.includes("webp")?"webp":U[0],p=u3(J,W,{...H,q:j},i0),B0=typeof q==="object"?p3(q):q||"100vw";X0=`<link rel="preload" as="image" imagesrcset="${p}" imagesizes="${B0}" />`}let d0=[];if(!UY&&B!=="none")d0.push(n3),UY=!0;if(C)d0.push(C);let V0=O?BY(x):void 0;return{html:u,preloadLink:X0,css:d0.length>0?d0.join(`
10003
- `):void 0,script:V0}}async function VU($,Z,Y,X){let{src:J,alt:Q,width:G,height:K,sizes:q,widths:W=A5,formats:z=_$,quality:U=Z6,params:j={},lazy:H=!0,priority:B=!1,loading:_=B?"eager":h4,decoding:O=g4,fetchpriority:F,objectFit:L,objectPosition:V,crossorigin:w,referrerpolicy:R}=$,N=$.class,A=$.style,M=$.data||{},I=typeof q==="object"?p3(q):q||"100vw",T=[];for(let P of z){let y=u3(J,W,{...j,q:U},P),S=l3(P);if(H&&!B)T.push(` <source type="${S}" data-srcset="${y}" data-sizes="${I}" />`);else T.push(` <source type="${S}" srcset="${y}" sizes="${I}" />`)}let k=Y6({src:O$(J,{...j,q:U}),alt:Q,width:G,height:K,loading:B?void 0:_,decoding:O,fetchpriority:B?"high":F,objectFit:L,objectPosition:V,crossorigin:w,referrerpolicy:R,className:jY(N,Y),style:X6(A,L,V,Y),lazy:H&&!B,data:M}),D;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
10002
+ `.trim();i3=new Map});import{createHash as r2}from"crypto";import{readFile as az,stat as a2}from"fs/promises";async function k0($){try{let Z=await az($);return r2("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function s2($){return r2("sha256").update($).digest("hex").slice(0,16)}function k4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${s2($)}-${s2(Y)}`}async function o3($){try{return(await a2($)).mtimeMs}catch{return 0}}async function T0($){try{return await a2($),!0}catch{return!1}}var s1=()=>{};import{mkdir as tz,readFile as ez,writeFile as $U,readdir as ww,rm as ZU,stat as Rw}from"fs/promises";import{join as e2,dirname as YU}from"path";async function XU($){try{await tz($,{recursive:!0})}catch{}}function $Y($,Z,Y){return e2($,Y,`${Z}.json`)}async function t2($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await o3(Z)!==$.srcMtime)return!1;return!0}async function b4($,Z,Y,X=s3){if(!X.enabled)return null;let J=k4($,Z),Q=M5.get(J);if(Q){if(await t2(Q,$,X.maxAge))return Q.lastAccessedAt=Date.now(),Q.data;M5.delete(J)}let G=$Y(X.directory,J,Y);if(await T0(G))try{let K=await ez(G,"utf-8"),q=JSON.parse(K);if(await t2(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),M5.set(J,q),q.data}catch{}return null}async function S4($,Z,Y,X,J=s3){if(!J.enabled)return;let Q=k4($,Z),G=await k0($),K=await o3($),q={key:Q,src:$,srcHash:G,srcMtime:K,optionsHash:k4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};M5.set(Q,q);let W=$Y(J.directory,Q,X);try{await XU(YU(W)),await $U(W,JSON.stringify(q,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function y4($,Z=s3){if($==="all")M5.clear();else M5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let J=e2(Z.directory,X);try{await ZU(J,{recursive:!0,force:!0})}catch{}}}var M5,s3;var r3=b(()=>{s1();M5=new Map,s3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class C4{config;constructor($={}){this.config={...JU,...$}}async get($,Z){return b4($,Z,"image",this.config)}async set($,Z,Y){return S4($,Z,Y,"image",this.config)}async clear(){return y4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function a3($){if(!P4)P4=new C4($);else if($)P4.updateConfig($);return P4}async function v4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return a3(X).get($,Z)}async function x4($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return a3(J).set($,Z,Y)}async function ZY(){return a3().clear()}var JU,P4=null;var t3=b(()=>{r3();JU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as QU,basename as GU,extname as KU,join as qU}from"path";import{mkdir as WU}from"fs/promises";async function e3(){try{return await import("ts-images")}catch{return null}}function YY($){switch($){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function zU($,Z){let Y=Z?YY(Z):YY("web"),X=$.formatQuality||{};return{jpeg:{...Y.jpeg,...X.jpeg},png:{...Y.png,...X.png},webp:{...Y.webp,...X.webp},avif:{...Y.avif,...X.avif}}}async function XY($,Z,Y){let X=await e3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let J=await v4($,Z,Y);if(J)return J;try{let Q=QU($);if(!await T0(Q))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=zU(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await WU(K,{recursive:!0});let W=await k0(Q),z=GU($,KU($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],j={src:$,processed:!0,variants:[],hash:W},H=null;if(Z.transformations&&Z.transformations.length>0)H=await $6(Q,Z.transformations,X);for(let B of U){let _=G[B]||{},O=`${z}-${W}.${B}`,F=qU(K,O);try{let L=await X.optimizeImage({input:H||Q,output:F,format:B,quality:_.quality,progressive:_.progressive});if(L){if(j.variants.push({path:F,url:`${q}/${O}`,width:L.width||0,height:L.height||0,format:B,size:L.outputSize||0}),!j.originalWidth&&L.width)j.originalWidth=L.width,j.originalHeight=L.height}}catch(L){j.errors=j.errors||[],j.errors.push(`Failed to optimize ${B}: ${L}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let B=await X.generateThumbHash(Q);j.placeholder=B.dataUrl}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to generate thumbhash: ${B}`)}if(Z.useDominantColor)try{let B=await X.generatePlaceholder(Q,{strategy:"dominant-color"});j.dominantColor=B.dominantColor}catch(B){j.errors=j.errors||[],j.errors.push(`Failed to extract dominant color: ${B}`)}return await x4($,Z,j,Y),j}catch(Q){return{src:$,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function JY($,Z,Y,X){let J=await e3();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(Q){return{success:!1,error:String(Q)}}}async function $6($,Z,Y){let X=Y||await e3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await X.decode($);for(let Q of Z){let G=Q.options||{};switch(Q.type){case"resize":if(G.width||G.height)J=await X.resize(J,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)J=await X.blur(J,G.sigma);break;case"sharpen":if(G.amount!==void 0)J=await X.sharpen(J,G.amount);break;case"grayscale":J=await X.grayscale(J);break;case"rotate":if(G.angle!==void 0)J=await X.rotate(J,G.angle);break;case"flip":J=await X.flip(J);break;case"flop":J=await X.flop(J);break;case"brightness":if(G.value!==void 0)J=await X.brightness(J,G.value);break;case"contrast":if(G.value!==void 0)J=await X.contrast(J,G.value);break;case"saturation":if(G.value!==void 0)J=await X.saturation(J,G.value);break}}return await X.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var QY=b(()=>{s1();t3()});import{resolve as UU,basename as jU,extname as BU,join as HU}from"path";import{mkdir as _U}from"fs/promises";async function OU(){try{return await import("ts-images")}catch{return null}}async function GY($,Z,Y){let X=await OU();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=UU($);if(!await T0(J))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let Q=Z.responsiveWidths||Y.breakpoints||FU,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await _U(K,{recursive:!0});let W=await k0(J),z=jU($,BU($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},j={src:$,byFormat:{},srcsets:{}};for(let B of G){j.byFormat[B]=[];let _=[];for(let O of Q){let F=`${z}-${O}w-${W}.${B}`,L=HU(K,F),V=`${q}/${F}`;try{let w=U[B]?.quality||80;if(await T0(L)){j.byFormat[B].push({path:L,url:V,width:O,height:0,format:B,size:0}),_.push(`${V} ${O}w`);continue}let R=await X.processImage({input:J,output:L,format:B,quality:w,resize:{width:O}});if(R)j.byFormat[B].push({path:L,url:V,width:O,height:R.height||Math.round(O*(R.height||1)/(R.width||1)),format:B,size:R.outputSize||0}),_.push(`${V} ${O}w`)}catch(w){console.warn(`[stx-media] Failed to generate ${B} at ${O}w: ${w}`)}}j.srcsets[B]=_.join(", ")}let H=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(H!=="none")try{if(H==="thumbhash"){let B=await X.generateThumbHash(J);j.placeholder={dataURL:B.dataUrl,width:B.width||32,height:B.height||32,strategy:"thumbhash"}}else{let B=await X.generatePlaceholder(J,{strategy:H,width:20});j.placeholder={dataURL:B.dataURL,width:B.width,height:B.height,strategy:H}}}catch(B){console.warn(`[stx-media] Failed to generate placeholder: ${B}`)}return j.sizes=Z.sizes||LU(Q),j}catch(Q){return console.error(`[stx-media] Responsive generation failed: ${Q}`),null}}function LU($){let Z=[...$].sort((X,J)=>X-J),Y=[];for(let X=0;X<Z.length-1;X++){let J=Z[X];Y.push(`(max-width: ${J}px) ${J}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function KY($,Z="width"){if(!$||$.length===0)return"";if(Z==="dpr")return $.filter((Y)=>Y.dpr).map((Y)=>`${Y.url} ${Y.dpr}x`).join(", ");return $.map((Y)=>`${Y.url} ${Y.width}w`).join(", ")}var FU;var qY=b(()=>{s1();FU=[320,480,640,768,1024,1280,1536,1920]});var WY={};o(WY,{setCachedImageResult:()=>x4,processImage:()=>XY,optimizeImage:()=>JY,getCachedImageResult:()=>v4,generateSrcset:()=>KY,generateResponsiveVariants:()=>GY,clearImageCache:()=>ZY,applyTransformations:()=>$6,ImageProcessorCache:()=>C4});var zY=b(()=>{QY();qY();t3()});async function VU(){try{return await Promise.resolve().then(() => (zY(),WY))}catch($){if(!UY)console.warn("[stx-media] Image processor not available, some features disabled:",$),UY=!0;return null}}async function f4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return AU(X,Y)}if(Y.processedResult?.processed)return J6($,Y.processedResult,Z);if(Y.responsiveVariants)return _Y($,Y.responsiveVariants,Z);let{src:J,alt:Q,width:G,height:K,sizes:q,widths:W=A5,dpr:z,formats:U=_$,quality:j=Z6,params:H={},placeholder:B="none",placeholderOptions:_={},lazy:O=!0,priority:F=!1,loading:L=F?"eager":h4,decoding:V=g4,fetchpriority:w,objectFit:R,objectPosition:N,crossorigin:A,referrerpolicy:M}=$,I=$.class,T=$.style,k=$.id,D=$.data||{},{isDev:P=!1,baseUrl:y=""}=Z;if(P&&!Z.optimize)return NU($);let S,C,x=k||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(B!=="none"&&!F)try{S=await n2(J,{strategy:B,..._}),C=i2(x,S,_)}catch{}let d=z!==void 0&&G!==void 0,u;if(d)u=RU($,x,S,Z);else u=await wU($,x,S,Z);let X0;if(F){let i0=U.includes("webp")?"webp":U[0],p=u3(J,W,{...H,q:j},i0),B0=typeof q==="object"?p3(q):q||"100vw";X0=`<link rel="preload" as="image" imagesrcset="${p}" imagesizes="${B0}" />`}let u0=[];if(!jY&&B!=="none")u0.push(n3),jY=!0;if(C)u0.push(C);let V0=O?HY(x):void 0;return{html:u,preloadLink:X0,css:u0.length>0?u0.join(`
10003
+ `):void 0,script:V0}}async function wU($,Z,Y,X){let{src:J,alt:Q,width:G,height:K,sizes:q,widths:W=A5,formats:z=_$,quality:U=Z6,params:j={},lazy:H=!0,priority:B=!1,loading:_=B?"eager":h4,decoding:O=g4,fetchpriority:F,objectFit:L,objectPosition:V,crossorigin:w,referrerpolicy:R}=$,N=$.class,A=$.style,M=$.data||{},I=typeof q==="object"?p3(q):q||"100vw",T=[];for(let P of z){let y=u3(J,W,{...j,q:U},P),S=l3(P);if(H&&!B)T.push(` <source type="${S}" data-srcset="${y}" data-sizes="${I}" />`);else T.push(` <source type="${S}" srcset="${y}" sizes="${I}" />`)}let k=Y6({src:O$(J,{...j,q:U}),alt:Q,width:G,height:K,loading:B?void 0:_,decoding:O,fetchpriority:B?"high":F,objectFit:L,objectPosition:V,crossorigin:w,referrerpolicy:R,className:BY(N,Y),style:X6(A,L,V,Y),lazy:H&&!B,data:M}),D;if(Y){let P=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;D=`<div id="${Z}" class="stx-img-placeholder" style="${P}">
10004
10004
  <picture>
10005
10005
  ${T.join(`
10006
10006
  `)}
@@ -10010,9 +10010,9 @@ ${T.join(`
10010
10010
  ${T.join(`
10011
10011
  `)}
10012
10012
  <img ${k} />
10013
- </picture>`;return D}function wU($,Z,Y,X){let{src:J,alt:Q,width:G,height:K,dpr:q=[1,2,3],quality:W=Z6,params:z={},lazy:U=!0,priority:j=!1,loading:H=j?"eager":h4,decoding:B=g4,fetchpriority:_,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V}=$,w=$.class,R=$.style,N=$.data||{},A=typeof G==="number"?G:Number.parseInt(String(G),10),M=l2(J,A,q,{...z,q:W}),I=Y6({src:O$(J,{...z,w:A,q:W}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:B,fetchpriority:j?"high":_,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V,className:jY(w,Y),style:X6(R,O,F,Y),lazy:U&&!j,data:N}),T=U&&!j?`data-srcset="${M}"`:`srcset="${M}"`;if(Y){let k=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
10013
+ </picture>`;return D}function RU($,Z,Y,X){let{src:J,alt:Q,width:G,height:K,dpr:q=[1,2,3],quality:W=Z6,params:z={},lazy:U=!0,priority:j=!1,loading:H=j?"eager":h4,decoding:B=g4,fetchpriority:_,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V}=$,w=$.class,R=$.style,N=$.data||{},A=typeof G==="number"?G:Number.parseInt(String(G),10),M=c2(J,A,q,{...z,q:W}),I=Y6({src:O$(J,{...z,w:A,q:W}),alt:Q,width:G,height:K,loading:j?void 0:H,decoding:B,fetchpriority:j?"high":_,objectFit:O,objectPosition:F,crossorigin:L,referrerpolicy:V,className:BY(w,Y),style:X6(R,O,F,Y),lazy:U&&!j,data:N}),T=U&&!j?`data-srcset="${M}"`:`srcset="${M}"`;if(Y){let k=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${k}">
10014
10014
  <img ${I} ${T} />
10015
- </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${T} />`}function RU($){let{src:Z,alt:Y,width:X,height:J,loading:Q=h4,decoding:G=g4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,priority:j=!1}=$,H=$.class,B=$.style,_=$.id,O=$.data||{};return{html:`<img ${Y6({src:Z,alt:Y,width:X,height:J,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,className:H,style:X6(B,q,W),id:_,data:O})} />`}}function Y6($){let Z=[];if($.lazy)Z.push(`data-src="${r0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${r0($.src)}"`);if(Z.push(`alt="${r0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${r0($.className)}"`);if($.style)Z.push(`style="${r0($.style)}"`);if($.id)Z.push(`id="${r0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${r0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function jY($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function X6($,Z,Y,X){let J=[];if(Z)J.push(`object-fit: ${Z}`);if(Y)J.push(`object-position: ${Y}`);if(X)J.push("opacity: 0; transition: opacity 300ms ease-out");if($)J.push($);return J.join("; ")}function r0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function BY($){return`
10015
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${I} ${T} />`}function NU($){let{src:Z,alt:Y,width:X,height:J,loading:Q=h4,decoding:G=g4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,priority:j=!1}=$,H=$.class,B=$.style,_=$.id,O=$.data||{};return{html:`<img ${Y6({src:Z,alt:Y,width:X,height:J,loading:j?"eager":Q,decoding:G,fetchpriority:j?"high":K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,className:H,style:X6(B,q,W),id:_,data:O})} />`}}function Y6($){let Z=[];if($.lazy)Z.push(`data-src="${r0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${r0($.src)}"`);if(Z.push(`alt="${r0($.alt)}"`),$.width)Z.push(`width="${$.width}"`);if($.height)Z.push(`height="${$.height}"`);if($.loading)Z.push(`loading="${$.loading}"`);if($.decoding)Z.push(`decoding="${$.decoding}"`);if($.fetchpriority)Z.push(`fetchpriority="${$.fetchpriority}"`);if($.crossorigin)Z.push(`crossorigin="${$.crossorigin}"`);if($.referrerpolicy)Z.push(`referrerpolicy="${$.referrerpolicy}"`);if($.className)Z.push(`class="${r0($.className)}"`);if($.style)Z.push(`style="${r0($.style)}"`);if($.id)Z.push(`id="${r0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${r0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function BY($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function X6($,Z,Y,X){let J=[];if(Z)J.push(`object-fit: ${Z}`);if(Y)J.push(`object-position: ${Y}`);if(X)J.push("opacity: 0; transition: opacity 300ms ease-out");if($)J.push($);return J.join("; ")}function r0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function HY($){return`
10016
10016
  (function() {
10017
10017
  const container = document.getElementById('${$}');
10018
10018
  if (!container) return;
@@ -10049,7 +10049,7 @@ ${T.join(`
10049
10049
 
10050
10050
  observer.observe(container);
10051
10051
  })();
10052
- `.trim()}async function NU($,Z){let Y=await LU();if(!Y)return f4({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,X);if(Q)return HY($,Q,Z)}else{let Q=await Y.processImage($.src,$,X);if(Q.processed)return J6($,Q,Z)}return f4({...$,process:!1},Z)}async function J6($,Z,Y){let{alt:X,width:J,height:Q,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U}=$,j=$.class,H=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],F=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],L=F?.url||$.src,V=O.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of O){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],N=["avif","webp","jpeg","png"];for(let C of N){let x=w.get(C);if(x&&x.length>0){let d=x.map((X0)=>`${X0.url} ${X0.width}w`).join(", "),u=l3(C);if(G&&!K)R.push(` <source type="${u}" data-srcset="${d}" />`);else R.push(` <source type="${u}" srcset="${d}" />`)}}let A=[];if(G&&!K){if(A.push(`data-src="${r0(L)}"`),A.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)A.push(`data-srcset="${V}"`)}else if(A.push(`src="${r0(L)}"`),V)A.push(`srcset="${V}"`);A.push(`alt="${r0(X)}"`);let M=J||Z.originalWidth,I=Q||Z.originalHeight;if(M)A.push(`width="${M}"`);if(I)A.push(`height="${I}"`);if(!K)A.push(`loading="${G?"lazy":"eager"}"`);if(A.push('decoding="async"'),K)A.push('fetchpriority="high"');if(z)A.push(`crossorigin="${z}"`);if(U)A.push(`referrerpolicy="${U}"`);let T=[];if(q)T.push(`object-fit: ${q}`);if(W)T.push(`object-position: ${W}`);if(Z.placeholder&&G)T.push("opacity: 0; transition: opacity 300ms ease-out");if(H)T.push(H);if(T.length>0)A.push(`style="${T.join("; ")}"`);let k=[];if(j)k.push(j);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)A.push(`class="${k.join(" ")}"`);if(G&&!K)A.push("data-stx-lazy");for(let[C,x]of Object.entries(_))A.push(`data-${C}="${r0(x)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${C}">
10052
+ `.trim()}async function AU($,Z){let Y=await VU();if(!Y)return f4({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let Q=await Y.generateResponsiveVariants($.src,$,X);if(Q)return _Y($,Q,Z)}else{let Q=await Y.processImage($.src,$,X);if(Q.processed)return J6($,Q,Z)}return f4({...$,process:!1},Z)}async function J6($,Z,Y){let{alt:X,width:J,height:Q,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U}=$,j=$.class,H=$.style,B=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=$.data||{},O=Z.variants||[],F=O.find((C)=>C.format==="jpeg")||O.find((C)=>C.format==="webp")||O[0],L=F?.url||$.src,V=O.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),w=new Map;for(let C of O){if(!w.has(C.format))w.set(C.format,[]);w.get(C.format).push(C)}let R=[],N=["avif","webp","jpeg","png"];for(let C of N){let x=w.get(C);if(x&&x.length>0){let d=x.map((X0)=>`${X0.url} ${X0.width}w`).join(", "),u=l3(C);if(G&&!K)R.push(` <source type="${u}" data-srcset="${d}" />`);else R.push(` <source type="${u}" srcset="${d}" />`)}}let A=[];if(G&&!K){if(A.push(`data-src="${r0(L)}"`),A.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)A.push(`data-srcset="${V}"`)}else if(A.push(`src="${r0(L)}"`),V)A.push(`srcset="${V}"`);A.push(`alt="${r0(X)}"`);let M=J||Z.originalWidth,I=Q||Z.originalHeight;if(M)A.push(`width="${M}"`);if(I)A.push(`height="${I}"`);if(!K)A.push(`loading="${G?"lazy":"eager"}"`);if(A.push('decoding="async"'),K)A.push('fetchpriority="high"');if(z)A.push(`crossorigin="${z}"`);if(U)A.push(`referrerpolicy="${U}"`);let T=[];if(q)T.push(`object-fit: ${q}`);if(W)T.push(`object-position: ${W}`);if(Z.placeholder&&G)T.push("opacity: 0; transition: opacity 300ms ease-out");if(H)T.push(H);if(T.length>0)A.push(`style="${T.join("; ")}"`);let k=[];if(j)k.push(j);if(Z.placeholder)k.push("stx-img-blur");if(k.length>0)A.push(`class="${k.join(" ")}"`);if(G&&!K)A.push("data-stx-lazy");for(let[C,x]of Object.entries(_))A.push(`data-${C}="${r0(x)}"`);let D;if(Z.placeholder||Z.dominantColor&&$.useDominantColor){let C=Z.placeholder?`background-image: url('${Z.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${Z.dominantColor};`;D=`<div id="${B}" class="stx-img-placeholder" style="${C}">
10053
10053
  <picture>
10054
10054
  ${R.join(`
10055
10055
  `)}
@@ -10059,12 +10059,12 @@ ${R.join(`
10059
10059
  ${R.join(`
10060
10060
  `)}
10061
10061
  <img ${A.join(" ")} />
10062
- </picture>`;let P=[];if(Z.placeholder)P.push(n3);let y=G?BY(B):void 0,S;if(K&&V)S=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:S,css:P.length>0?P.join(`
10063
- `):void 0,script:y}}async function HY($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[J,Q]of Object.entries(Z.byFormat))if(Q)X.variants.push(...Q);return J6($,X,Y)}var zY=!1,Z6=80,g4="async",h4="lazy",UY=!1;var _Y=b(()=>{c3();n2()});function AU(){return E4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:J,alt:Q,options:G}=MU($,Z,Y);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:J,alt:Q||"",widths:G.widths||A5,formats:G.formats||_$,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await f4(K,{isDev:q}),z=W.html;if(W.preloadLink)z=W.preloadLink+`
10062
+ </picture>`;let P=[];if(Z.placeholder)P.push(n3);let y=G?HY(B):void 0,S;if(K&&V)S=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:S,css:P.length>0?P.join(`
10063
+ `):void 0,script:y}}async function _Y($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[J,Q]of Object.entries(Z.byFormat))if(Q)X.variants.push(...Q);return J6($,X,Y)}var UY=!1,Z6=80,g4="async",h4="lazy",jY=!1;var OY=b(()=>{c3();o2()});function MU(){return E4({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:J,alt:Q,options:G}=TU($,Z,Y);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:J,alt:Q||"",widths:G.widths||A5,formats:G.formats||_$,quality:G.quality,sizes:G.sizes,dpr:G.dpr,params:G.params,placeholder:G.placeholder,placeholderOptions:G.placeholderOptions,lazy:G.lazy!==!1,priority:G.priority||!1,loading:G.loading,decoding:G.decoding,fetchpriority:G.fetchpriority,objectFit:G.objectFit,objectPosition:G.objectPosition,class:G.class,style:G.style,id:G.id,width:G.width,height:G.height},q=Y.__isDev||!1,W=await f4(K,{isDev:q}),z=W.html;if(W.preloadLink)z=W.preloadLink+`
10064
10064
  `+z;if(W.css)z+=`
10065
10065
  <style>${W.css}</style>`;if(W.script)z+=`
10066
- <script>${W.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function MU($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=TU(X),Q=Q6(J[0],Y)||"",G=Q6(J[1],Y)||"",K={};if(J[2]){let q=Q6(J[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof J[2]==="string")try{K=JSON.parse(J[2])}catch{}}return{src:Q,alt:G,options:K}}function TU($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,J=q;else if(q===J)X=!1,J="";else Y+=q;continue}if(!X){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function Q6($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var OY;var FY=b(()=>{d3();_Y();c3();OY=AU()});class d4{config;constructor($={}){this.config={...IU,...$}}async get($,Z){return b4($,Z,"video",this.config)}async set($,Z,Y){return S4($,Z,Y,"video",this.config)}async clear(){return y4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function G6($){if(!m4)m4=new d4($);else if($)m4.updateConfig($);return m4}async function u4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return G6(X).get($,Z)}async function p4($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return G6(J).set($,Z,Y)}async function LY(){return G6().clear()}var IU,m4=null;var K6=b(()=>{r3();IU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as q6,basename as W6,extname as z6,join as l4}from"path";import{mkdir as U6}from"fs/promises";async function j6(){try{return await import("ts-videos")}catch{return null}}async function c4($,Z,Y,X){let J=await j6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=q6($);if(!await T0(Q))return null;await U6(Y,{recursive:!0});let G=await k0(Q),K=W6($,z6($)),q=Z.format||"webp",W=Z.timestamp||0,z=`${K}-poster-${G}.${q}`,U=l4(Y,z),j=await J.extractThumbnails(Q,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:z.replace(`.${q}`,"")});if(j&&j.length>0){let H=j[0];return{path:U,url:`${X}/${z}`,width:H.width||Z.width||1280,height:H.height||720,timestamp:W,size:H.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function i4($,Z,Y,X){let J=await j6();if(!J)return[];try{let Q=q6($);if(!await T0(Q))return[];await U6(Y,{recursive:!0});let G=await k0(Q),K=W6($,z6($)),q=Z.format||"webp",U=(await new J.Input(Q).getInfo()).duration||60,j=Z.count||10,H=Z.interval||U/j,B=[];for(let O=0;O<j&&O*H<U;O++)B.push(O*H);let _=await J.extractThumbnails(Q,{timestamps:B,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(_&&_.length>0)return _.map((O,F)=>({path:O.path||l4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:O.width||Z.width||320,height:O.height||180,timestamp:B[F],size:O.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function VY($,Z,Y,X){let J=await j6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=q6($);if(!await T0(Q))return null;await U6(Y,{recursive:!0});let G=await k0(Q),K=W6($,z6($)),z=(await new J.Input(Q).getInfo()).duration||60,U=Z.columns||10,j=Z.interval||5,H=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,_=Z.format||"jpeg",O=Math.ceil(z/j),F=Math.ceil(O/U),L=`${K}-sprite-${G}.${_}`,V=l4(Y,L),w=[];for(let N=0;N<O;N++)w.push(N*j);let R=await J.extractThumbnails(Q,{timestamps:w,width:H,height:B,format:_,quality:Z.quality||70,outputDir:l4(Y,".temp")});if(!R||R.length===0)return null;try{let N=await import("ts-images"),A=U*H,M=F*B,I=await N.createSprite({images:R.map((T)=>T.path),columns:U,padding:0,outputPath:V,format:_,quality:Z.quality||70});return{url:`${X}/${L}`,path:V,columns:U,rows:F,thumbnailWidth:H,thumbnailHeight:B,interval:j,totalFrames:O}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var B6=b(()=>{s1()});import{resolve as RY,basename as NY,extname as AY,join as r1}from"path";import{mkdir as n4,writeFile as MY}from"fs/promises";async function TY(){try{return await import("ts-videos")}catch{return null}}async function o4($,Z,Y,X,J){let Q=await TY();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=RY($);if(!await T0(G))return null;let K=await k0(G),q=NY($,AY($)),W=r1(Y,`${q}-${K}-hls`);await n4(W,{recursive:!0});let z=Z.length>0?Z:IY,U=J?.segmentDuration||6,B=(await new Q.Input(G).getInfo()).duration||0,_=[],O=0;for(let V of z){let w=r1(W,V.label);await n4(w,{recursive:!0});let R=`${V.label}.m3u8`,N=r1(w,R);try{let A=await Q.generateHLS(G,{outputDir:w,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(A)_.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${R}`,path:N}),O+=A.segmentCount||Math.ceil(B/U)}catch(A){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${A}`)}}if(_.length===0)return null;let F=r1(W,"master.m3u8"),L=DU(_,X,q,K);return await MY(F,L),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:_,segmentCount:O,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function DU($,Z,Y,X){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return J.join(`
10067
- `)}async function s4($,Z,Y,X,J){let Q=await TY();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=RY($);if(!await T0(G))return null;let K=await k0(G),q=NY($,AY($)),W=r1(Y,`${q}-${K}-dash`);await n4(W,{recursive:!0});let z=Z.length>0?Z:IY,U=J?.segmentDuration||4,j=J?.minBufferTime||2,_=(await new Q.Input(G).getInfo()).duration||0,O=[],F=[];for(let R of z){let N=r1(W,R.label);await n4(N,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:N,segmentDuration:U,width:R.width,height:R.height,videoBitrate:R.bitrate,audioBitrate:R.audioBitrate})){if(O.push({bandwidth:R.bitrate,width:R.width,height:R.height||Math.round(R.width*9/16),url:`${X}/${q}-${K}-dash/${R.label}/video`}),R.audioBitrate)F.push({bandwidth:R.audioBitrate,url:`${X}/${q}-${K}-dash/${R.label}/audio`})}}catch(A){console.warn(`[stx-media] Failed to generate DASH for ${R.label}: ${A}`)}}if(O.length===0)return null;let L=r1(W,"manifest.mpd"),V=EU(O,F,_,U,j);await MY(L,V);let w=[{type:"video",representations:O}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:L,adaptationSets:w,duration:_}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function EU($,Z,Y,X,J){let Q=wY(Y),G=wY(J),K=`<?xml version="1.0" encoding="UTF-8"?>
10066
+ <script>${W.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function TU($,Z,Y){if(Z.src)return{src:String(Z.src),alt:String(Z.alt||""),options:Z.options||{}};let X=$.trim();if(X.startsWith("@img(")||X.startsWith("("))X=X.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=IU(X),Q=Q6(J[0],Y)||"",G=Q6(J[1],Y)||"",K={};if(J[2]){let q=Q6(J[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof J[2]==="string")try{K=JSON.parse(J[2])}catch{}}return{src:Q,alt:G,options:K}}function IU($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,J=q;else if(q===J)X=!1,J="";else Y+=q;continue}if(!X){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function Q6($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var FY;var LY=b(()=>{d3();OY();c3();FY=MU()});class d4{config;constructor($={}){this.config={...DU,...$}}async get($,Z){return b4($,Z,"video",this.config)}async set($,Z,Y){return S4($,Z,Y,"video",this.config)}async clear(){return y4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function G6($){if(!m4)m4=new d4($);else if($)m4.updateConfig($);return m4}async function u4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return G6(X).get($,Z)}async function p4($,Z,Y,X){let J=X?{directory:`${X.outputDir}/../.cache`}:{};return G6(J).set($,Z,Y)}async function VY(){return G6().clear()}var DU,m4=null;var K6=b(()=>{r3();DU={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as q6,basename as W6,extname as z6,join as l4}from"path";import{mkdir as U6}from"fs/promises";async function j6(){try{return await import("ts-videos")}catch{return null}}async function c4($,Z,Y,X){let J=await j6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let Q=q6($);if(!await T0(Q))return null;await U6(Y,{recursive:!0});let G=await k0(Q),K=W6($,z6($)),q=Z.format||"webp",W=Z.timestamp||0,z=`${K}-poster-${G}.${q}`,U=l4(Y,z),j=await J.extractThumbnails(Q,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:z.replace(`.${q}`,"")});if(j&&j.length>0){let H=j[0];return{path:U,url:`${X}/${z}`,width:H.width||Z.width||1280,height:H.height||720,timestamp:W,size:H.size||0}}return null}catch(Q){return console.warn(`[stx-media] Failed to generate poster: ${Q}`),null}}async function i4($,Z,Y,X){let J=await j6();if(!J)return[];try{let Q=q6($);if(!await T0(Q))return[];await U6(Y,{recursive:!0});let G=await k0(Q),K=W6($,z6($)),q=Z.format||"webp",U=(await new J.Input(Q).getInfo()).duration||60,j=Z.count||10,H=Z.interval||U/j,B=[];for(let O=0;O<j&&O*H<U;O++)B.push(O*H);let _=await J.extractThumbnails(Q,{timestamps:B,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(_&&_.length>0)return _.map((O,F)=>({path:O.path||l4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:O.width||Z.width||320,height:O.height||180,timestamp:B[F],size:O.size||0}));return[]}catch(Q){return console.warn(`[stx-media] Failed to generate thumbnails: ${Q}`),[]}}async function wY($,Z,Y,X){let J=await j6();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let Q=q6($);if(!await T0(Q))return null;await U6(Y,{recursive:!0});let G=await k0(Q),K=W6($,z6($)),z=(await new J.Input(Q).getInfo()).duration||60,U=Z.columns||10,j=Z.interval||5,H=Z.thumbnailWidth||160,B=Z.thumbnailHeight||90,_=Z.format||"jpeg",O=Math.ceil(z/j),F=Math.ceil(O/U),L=`${K}-sprite-${G}.${_}`,V=l4(Y,L),w=[];for(let N=0;N<O;N++)w.push(N*j);let R=await J.extractThumbnails(Q,{timestamps:w,width:H,height:B,format:_,quality:Z.quality||70,outputDir:l4(Y,".temp")});if(!R||R.length===0)return null;try{let N=await import("ts-images"),A=U*H,M=F*B,I=await N.createSprite({images:R.map((T)=>T.path),columns:U,padding:0,outputPath:V,format:_,quality:Z.quality||70});return{url:`${X}/${L}`,path:V,columns:U,rows:F,thumbnailWidth:H,thumbnailHeight:B,interval:j,totalFrames:O}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(Q){return console.warn(`[stx-media] Failed to generate sprite sheet: ${Q}`),null}}var B6=b(()=>{s1()});import{resolve as NY,basename as AY,extname as MY,join as r1}from"path";import{mkdir as n4,writeFile as TY}from"fs/promises";async function IY(){try{return await import("ts-videos")}catch{return null}}async function o4($,Z,Y,X,J){let Q=await IY();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=NY($);if(!await T0(G))return null;let K=await k0(G),q=AY($,MY($)),W=r1(Y,`${q}-${K}-hls`);await n4(W,{recursive:!0});let z=Z.length>0?Z:DY,U=J?.segmentDuration||6,B=(await new Q.Input(G).getInfo()).duration||0,_=[],O=0;for(let V of z){let w=r1(W,V.label);await n4(w,{recursive:!0});let R=`${V.label}.m3u8`,N=r1(w,R);try{let A=await Q.generateHLS(G,{outputDir:w,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(A)_.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${R}`,path:N}),O+=A.segmentCount||Math.ceil(B/U)}catch(A){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${A}`)}}if(_.length===0)return null;let F=r1(W,"master.m3u8"),L=EU(_,X,q,K);return await TY(F,L),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:_,segmentCount:O,duration:B}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function EU($,Z,Y,X){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let Q of $){let{quality:G}=Q,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return J.join(`
10067
+ `)}async function s4($,Z,Y,X,J){let Q=await IY();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=NY($);if(!await T0(G))return null;let K=await k0(G),q=AY($,MY($)),W=r1(Y,`${q}-${K}-dash`);await n4(W,{recursive:!0});let z=Z.length>0?Z:DY,U=J?.segmentDuration||4,j=J?.minBufferTime||2,_=(await new Q.Input(G).getInfo()).duration||0,O=[],F=[];for(let R of z){let N=r1(W,R.label);await n4(N,{recursive:!0});try{if(await Q.generateDASH(G,{outputDir:N,segmentDuration:U,width:R.width,height:R.height,videoBitrate:R.bitrate,audioBitrate:R.audioBitrate})){if(O.push({bandwidth:R.bitrate,width:R.width,height:R.height||Math.round(R.width*9/16),url:`${X}/${q}-${K}-dash/${R.label}/video`}),R.audioBitrate)F.push({bandwidth:R.audioBitrate,url:`${X}/${q}-${K}-dash/${R.label}/audio`})}}catch(A){console.warn(`[stx-media] Failed to generate DASH for ${R.label}: ${A}`)}}if(O.length===0)return null;let L=r1(W,"manifest.mpd"),V=kU(O,F,_,U,j);await TY(L,V);let w=[{type:"video",representations:O}];if(F.length>0)w.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:L,adaptationSets:w,duration:_}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function kU($,Z,Y,X,J){let Q=RY(Y),G=RY(J),K=`<?xml version="1.0" encoding="UTF-8"?>
10068
10068
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
10069
10069
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10070
10070
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -10090,7 +10090,7 @@ ${R.join(`
10090
10090
  </Representation>
10091
10091
  `}K+=` </AdaptationSet>
10092
10092
  `}return K+=` </Period>
10093
- </MPD>`,K}function wY($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),J="PT";if(Z>0)J+=`${Z}H`;if(Y>0)J+=`${Y}M`;return J+=`${X}S`,J}var IY;var H6=b(()=>{s1();IY=[{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 DY,basename as kU,extname as bU,join as SU}from"path";import{mkdir as yU}from"fs/promises";async function EY(){try{return await import("ts-videos")}catch{return null}}function PU($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function CU($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function _6($){let Z=await EY();if(!Z)return null;try{let Y=DY($),J=await new Z.Input(Y).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(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function kY($,Z,Y,X){let J=await EY();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await u4($,Z,Y);if(Q)return Q;try{let G=DY($);if(!await T0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await yU(K,{recursive:!0});let W=await k0(G),z=kU($,bU($)),U={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),U.metadata=await _6(G)||void 0;let j={};if(Z.quality)j.bitrate=PU(Z.quality);if(Z.platform)Object.assign(j,CU(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let H=`${z}-${W}.mp4`,B=SU(K,H);try{let _=await vU(G,B,j,J,(O)=>X?.({percentage:10+O*0.5,stage:"transcoding"}));if(_)U.transcoded={path:B,url:`${q}/${H}`,duration:_.duration,size:_.size,video:{codec:j.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(_){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${_}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let H=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await c4(G,H,K,q);if(B)U.poster=B}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let H=await i4(G,Y.thumbnails,K,q);if(H.length>0)U.thumbnails=H}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let H=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(H.format==="hls"||H.format===void 0){let B=await o4(G,H.qualities||Y.streaming?.defaultQualities||[],K,q);if(B)U.streaming={...U.streaming,hls:B}}if(H.format==="dash"){let B=await s4(G,H.qualities||Y.streaming?.defaultQualities||[],K,q);if(B)U.streaming={...U.streaming,dash:B}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await p4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function vU($,Z,Y,X,J){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{J?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var bY=b(()=>{s1();K6();B6();H6()});var SY={};o(SY,{setCachedVideoResult:()=>p4,processVideo:()=>kY,getCachedVideoResult:()=>u4,generateThumbnails:()=>i4,generateSpriteSheet:()=>VY,generatePoster:()=>c4,generateHLSManifest:()=>o4,generateDASHManifest:()=>s4,clearVideoCache:()=>LY,analyzeVideo:()=>_6,VideoProcessorCache:()=>d4});var yY=b(()=>{bY();B6();H6();K6()});async function CY(){try{return await Promise.resolve().then(() => (yY(),SY))}catch($){if(!PY)console.warn("[stx-media] Video processor not available, some features disabled:",$),PY=!0;return null}}async function r4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return dU(X,Y)}if(Y.processedResult?.processed)return gY($,Y.processedResult,Z);let J;if(X.generatePoster&&X.src&&!$.poster)J=await uU(X,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:q,controls:W=vY,autoplay:z=!1,muted:U=!1,loop:j=!1,preload:H=xY,playsinline:B=!0,lazy:_=!0,player:O="native",type:F,width:L,height:V,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:N=!1}=$,A=J||K,M=$.class,I=$.style,T=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return gU($,Z);if(F&&F!=="video")return fU(Q||"",F,$);let k=G.length>0?G:Q?[{src:Q,type:fY(Q)}]:[],D=[`id="${T}"`];if(W)D.push("controls");if(z)D.push("autoplay");if(U)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(R)D.push("disablepictureinpicture");if(N)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(_){if(D.push(`data-preload="${H}"`),D.push('preload="none"'),A)D.push(`data-poster="${L0(A)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${H}"`),A)D.push(`poster="${L0(A)}"`);if(L)D.push(`width="${L}"`);if(V)D.push(`height="${V}"`);if(M)D.push(`class="${L0(M)}"`);if(I)D.push(`style="${L0(I)}"`);let P=k.map((C)=>{return` <source ${_?`data-src="${L0(C.src)}"`:`src="${L0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
10093
+ </MPD>`,K}function RY($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),J="PT";if(Z>0)J+=`${Z}H`;if(Y>0)J+=`${Y}M`;return J+=`${X}S`,J}var DY;var H6=b(()=>{s1();DY=[{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 EY,basename as bU,extname as SU,join as yU}from"path";import{mkdir as PU}from"fs/promises";async function kY(){try{return await import("ts-videos")}catch{return null}}function CU($){switch($){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function vU($){switch($){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function _6($){let Z=await kY();if(!Z)return null;try{let Y=EY($),J=await new Z.Input(Y).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(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function bY($,Z,Y,X){let J=await kY();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let Q=await u4($,Z,Y);if(Q)return Q;try{let G=EY($);if(!await T0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await PU(K,{recursive:!0});let W=await k0(G),z=bU($,SU($)),U={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),U.metadata=await _6(G)||void 0;let j={};if(Z.quality)j.bitrate=CU(Z.quality);if(Z.platform)Object.assign(j,vU(Z.platform));if(Z.transcode)Object.assign(j,Z.transcode);if(Object.keys(j).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let H=`${z}-${W}.mp4`,B=yU(K,H);try{let _=await xU(G,B,j,J,(O)=>X?.({percentage:10+O*0.5,stage:"transcoding"}));if(_)U.transcoded={path:B,url:`${q}/${H}`,duration:_.duration,size:_.size,video:{codec:j.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:j.audioCodec||"aac",bitrate:j.audioBitrate||128000,sampleRate:j.sampleRate||48000,channels:j.channels||2}:void 0}}catch(_){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${_}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let H=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},B=await c4(G,H,K,q);if(B)U.poster=B}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let H=await i4(G,Y.thumbnails,K,q);if(H.length>0)U.thumbnails=H}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let H=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(H.format==="hls"||H.format===void 0){let B=await o4(G,H.qualities||Y.streaming?.defaultQualities||[],K,q);if(B)U.streaming={...U.streaming,hls:B}}if(H.format==="dash"){let B=await s4(G,H.qualities||Y.streaming?.defaultQualities||[],K,q);if(B)U.streaming={...U.streaming,dash:B}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await p4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function xU($,Z,Y,X,J){try{let G=await new X.Conversion($,Z,{videoCodec:Y.codec,videoBitrate:Y.bitrate,width:Y.maxWidth,height:Y.maxHeight,frameRate:Y.frameRate,audioCodec:Y.audioCodec,audioBitrate:Y.audioBitrate,sampleRate:Y.sampleRate,channels:Y.channels}).run((K)=>{J?.(K.percentage/100)});return{duration:G.duration||0,size:G.size||0,width:G.width||Y.maxWidth||0,height:G.height||Y.maxHeight||0,bitrate:G.bitrate||Y.bitrate||0,frameRate:G.frameRate||Y.frameRate||30,audioCodec:G.audioCodec}}catch(Q){return console.error(`[stx-media] Transcoding failed: ${Q}`),null}}var SY=b(()=>{s1();K6();B6();H6()});var yY={};o(yY,{setCachedVideoResult:()=>p4,processVideo:()=>bY,getCachedVideoResult:()=>u4,generateThumbnails:()=>i4,generateSpriteSheet:()=>wY,generatePoster:()=>c4,generateHLSManifest:()=>o4,generateDASHManifest:()=>s4,clearVideoCache:()=>VY,analyzeVideo:()=>_6,VideoProcessorCache:()=>d4});var PY=b(()=>{SY();B6();H6();K6()});async function vY(){try{return await Promise.resolve().then(() => (PY(),yY))}catch($){if(!CY)console.warn("[stx-media] Video processor not available, some features disabled:",$),CY=!0;return null}}async function r4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return uU(X,Y)}if(Y.processedResult?.processed)return hY($,Y.processedResult,Z);let J;if(X.generatePoster&&X.src&&!$.poster)J=await pU(X,Y);let{src:Q,sources:G=[],poster:K,posterPlaceholder:q,controls:W=xY,autoplay:z=!1,muted:U=!1,loop:j=!1,preload:H=fY,playsinline:B=!0,lazy:_=!0,player:O="native",type:F,width:L,height:V,crossorigin:w,disablePictureInPicture:R=!1,disableRemotePlayback:N=!1}=$,A=J||K,M=$.class,I=$.style,T=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(O==="ts-video")return hU($,Z);if(F&&F!=="video")return gU(Q||"",F,$);let k=G.length>0?G:Q?[{src:Q,type:gY(Q)}]:[],D=[`id="${T}"`];if(W)D.push("controls");if(z)D.push("autoplay");if(U)D.push("muted");if(j)D.push("loop");if(B)D.push("playsinline");if(R)D.push("disablepictureinpicture");if(N)D.push("disableremoteplayback");if(w)D.push(`crossorigin="${w}"`);if(_){if(D.push(`data-preload="${H}"`),D.push('preload="none"'),A)D.push(`data-poster="${L0(A)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${H}"`),A)D.push(`poster="${L0(A)}"`);if(L)D.push(`width="${L}"`);if(V)D.push(`height="${V}"`);if(M)D.push(`class="${L0(M)}"`);if(I)D.push(`style="${L0(I)}"`);let P=k.map((C)=>{return` <source ${_?`data-src="${L0(C.src)}"`:`src="${L0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
10094
10094
  `),y=`<video ${D.join(" ")}>
10095
10095
  ${P}
10096
10096
  Your browser does not support the video tag.
@@ -10129,9 +10129,9 @@ ${P}
10129
10129
 
10130
10130
  observer.observe(video);
10131
10131
  })();
10132
- `.trim();return{html:y,script:S}}function fU($,Z,Y){let{width:X=640,height:J=360}=Y,Q=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(Z){case"youtube":W=hU($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=mU($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let z=[`id="${K}"`,`src="${L0(q)}"`,`width="${X}"`,`height="${J}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)z.push(`class="${L0(Q)}"`);if(G)z.push(`style="${L0(G)}"`);if(Y.lazy)z.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
10132
+ `.trim();return{html:y,script:S}}function gU($,Z,Y){let{width:X=640,height:J=360}=Y,Q=Y.class,G=Y.style,K=Y.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,q,W=null;switch(Z){case"youtube":W=mU($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=dU($),q=W?`https://player.vimeo.com/video/${W}`:$;break;case"dailymotion":W=$.split("/").pop()||"",q=`https://www.dailymotion.com/embed/video/${W}`;break;case"twitch":W=$.split("/").pop()||"",q=`https://player.twitch.tv/?video=${W}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:q=$}let z=[`id="${K}"`,`src="${L0(q)}"`,`width="${X}"`,`height="${J}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(Q)z.push(`class="${L0(Q)}"`);if(G)z.push(`style="${L0(G)}"`);if(Y.lazy)z.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
10133
10133
  <iframe ${z.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
10134
- </div>`}}function gU($,Z={}){let{src:Y,sources:X=[],poster:J,controls:Q=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:z=!0,lazy:U=!0,width:j,height:H}=$,B=$.class,_=$.style,O=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:z,preload:W,poster:J,controls:Q,title:$.title},L=["position: relative",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",H?`height: ${typeof H==="number"?H+"px":H}`:"",_||""].filter(Boolean).join("; "),V=`
10134
+ </div>`}}function hU($,Z={}){let{src:Y,sources:X=[],poster:J,controls:Q=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:z=!0,lazy:U=!0,width:j,height:H}=$,B=$.class,_=$.style,O=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:z,preload:W,poster:J,controls:Q,title:$.title},L=["position: relative",j?`width: ${typeof j==="number"?j+"px":j}`:"width: 100%",H?`height: ${typeof H==="number"?H+"px":H}`:"",_||""].filter(Boolean).join("; "),V=`
10135
10135
  <div
10136
10136
  id="${O}"
10137
10137
  class="ts-video-player${B?" "+L0(B):""}"
@@ -10168,7 +10168,7 @@ ${P}
10168
10168
 
10169
10169
  // Load ts-video-player from CDN
10170
10170
  var script = document.createElement('script');
10171
- script.src = '${xU}';
10171
+ script.src = '${fU}';
10172
10172
  script.onload = initPlayer;
10173
10173
  script.onerror = function() {
10174
10174
  console.error('[stx] Failed to load ts-video-player');
@@ -10298,7 +10298,7 @@ else {
10298
10298
  .ts-video-player__play-button svg {
10299
10299
  margin-left: 4px;
10300
10300
  }
10301
- `.trim();return{html:V,script:w,css:R}}function fY($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function hU($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let X=$.match(Y);if(X)return X[1]}return null}function mU($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function L0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function dU($,Z){let Y=await CY();if(!Y)return r4({...$,process:!1},Z);let X=Z.tsVideosConfig,J=await Y.processVideo($.src,$,X,$.onProcessProgress);if(J.processed)return gY($,J,Z);return r4({...$,process:!1},Z)}async function uU($,Z){let Y=await CY();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},J=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,J.outputDir,J.baseUrl||"/videos"))?.url}function gY($,Z,Y){let{controls:X=vY,autoplay:J=!1,muted:Q=!1,loop:G=!1,preload:K=xY,playsinline:q=!0,lazy:W=!0,width:z,height:U,crossorigin:j,disablePictureInPicture:H=!1,disableRemotePlayback:B=!1}=$,_=$.class,O=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=$.src,V=fY(L);if(Z.transcoded)L=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)L=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)L=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Z.poster?.url||$.poster,N=[`id="${F}"`];if(X)N.push("controls");if(J)N.push("autoplay");if(Q)N.push("muted");if(G)N.push("loop");if(q)N.push("playsinline");if(H)N.push("disablepictureinpicture");if(B)N.push("disableremoteplayback");if(j)N.push(`crossorigin="${j}"`);if(W){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),R)N.push(`data-poster="${L0(R)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),R)N.push(`poster="${L0(R)}"`);let A=z||Z.metadata?.width,M=U||Z.metadata?.height;if(A)N.push(`width="${A}"`);if(M)N.push(`height="${M}"`);if(_)N.push(`class="${L0(_)}"`);if(O)N.push(`style="${L0(O)}"`);let T=` <source ${W?`data-src="${L0(L)}"`:`src="${L0(L)}"`} type="${V}" />`,k=`<video ${N.join(" ")}>
10301
+ `.trim();return{html:V,script:w,css:R}}function gY($){switch($.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function mU($){let Z=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Y of Z){let X=$.match(Y);if(X)return X[1]}return null}function dU($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function L0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function uU($,Z){let Y=await vY();if(!Y)return r4({...$,process:!1},Z);let X=Z.tsVideosConfig,J=await Y.processVideo($.src,$,X,$.onProcessProgress);if(J.processed)return hY($,J,Z);return r4({...$,process:!1},Z)}async function pU($,Z){let Y=await vY();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},J=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,J.outputDir,J.baseUrl||"/videos"))?.url}function hY($,Z,Y){let{controls:X=xY,autoplay:J=!1,muted:Q=!1,loop:G=!1,preload:K=fY,playsinline:q=!0,lazy:W=!0,width:z,height:U,crossorigin:j,disablePictureInPicture:H=!1,disableRemotePlayback:B=!1}=$,_=$.class,O=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=$.src,V=gY(L);if(Z.transcoded)L=Z.transcoded.url,V="video/mp4";let w=Z.streaming?.hls||Z.streaming?.dash;if(w){if(Z.streaming?.hls)L=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)L=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let R=Z.poster?.url||$.poster,N=[`id="${F}"`];if(X)N.push("controls");if(J)N.push("autoplay");if(Q)N.push("muted");if(G)N.push("loop");if(q)N.push("playsinline");if(H)N.push("disablepictureinpicture");if(B)N.push("disableremoteplayback");if(j)N.push(`crossorigin="${j}"`);if(W){if(N.push(`data-preload="${K}"`),N.push('preload="none"'),R)N.push(`data-poster="${L0(R)}"`);N.push("data-stx-lazy")}else if(N.push(`preload="${K}"`),R)N.push(`poster="${L0(R)}"`);let A=z||Z.metadata?.width,M=U||Z.metadata?.height;if(A)N.push(`width="${A}"`);if(M)N.push(`height="${M}"`);if(_)N.push(`class="${L0(_)}"`);if(O)N.push(`style="${L0(O)}"`);let T=` <source ${W?`data-src="${L0(L)}"`:`src="${L0(L)}"`} type="${V}" />`,k=`<video ${N.join(" ")}>
10302
10302
  ${T}
10303
10303
  Your browser does not support the video tag.
10304
10304
  </video>`;if(Z.spriteSheet)k=`<div class="stx-video-wrapper" data-sprite-sheet="${L0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
@@ -10347,9 +10347,9 @@ ${k}
10347
10347
  width: 100%;
10348
10348
  height: auto;
10349
10349
  }
10350
- `.trim();return{html:k,script:D,css:P}}var PY=!1,vY=!0,xY="metadata",xU="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var hY=b(()=>{F6()});function mY(){return E4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:J,options:Q}=pU($,Z,Y);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:J,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await r4(G,q),z=W.html;if(W.css)z+=`
10350
+ `.trim();return{html:k,script:D,css:P}}var CY=!1,xY=!0,fY="metadata",fU="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var mY=b(()=>{F6()});function dY(){return E4({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:J,options:Q}=lU($,Z,Y);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:J,poster:Q.poster,controls:Q.controls!==!1,autoplay:Q.autoplay||!1,muted:Q.muted||!1,loop:Q.loop||!1,preload:Q.preload||"metadata",playsinline:Q.playsinline!==!1,lazy:Q.lazy!==!1,player:Q.player||"native",type:Q.type,width:Q.width,height:Q.height,class:Q.class,style:Q.style,id:Q.id,crossorigin:Q.crossorigin,disablePictureInPicture:Q.disablePictureInPicture,disableRemotePlayback:Q.disableRemotePlayback,title:Q.title,quality:Q.quality,platform:Q.platform,process:Q.process,generatePoster:Q.generatePoster,streaming:Q.streaming,transcode:Q.transcode,spriteSheet:Q.spriteSheet,waveform:Q.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await r4(G,q),z=W.html;if(W.css)z+=`
10351
10351
  <style>${W.css}</style>`;if(W.script)z+=`
10352
- <script>${W.script}</script>`;return z},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function pU($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=lU(X),Q=dY(J[0],Y)||"",G={};if(J[1]){let K=dY(J[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof J[1]==="string")try{G=JSON.parse(J[1])}catch{}}return{src:Q,options:G}}function lU($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,J=q;else if(q===J)X=!1,J="";else Y+=q;continue}if(!X){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function dY($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var O6;var F6=b(()=>{d3();hY();O6=mY()});function cU($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
10352
+ <script>${W.script}</script>`;return z},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function lU($,Z,Y){if(Z.src)return{src:String(Z.src),options:Z.options||{}};let X=$.trim();if(X.startsWith("@video(")||X.startsWith("("))X=X.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=cU(X),Q=uY(J[0],Y)||"",G={};if(J[1]){let K=uY(J[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof J[1]==="string")try{G=JSON.parse(J[1])}catch{}}return{src:Q,options:G}}function cU($){let Z=[],Y="",X=!1,J="",Q=0,G=0;for(let K=0;K<$.length;K++){let q=$[K],W=K>0?$[K-1]:"";if((q==='"'||q==="'"||q==="`")&&W!=="\\"){if(!X)X=!0,J=q;else if(q===J)X=!1,J="";else Y+=q;continue}if(!X){if(q==="{")Q++;if(q==="}")Q--;if(q==="[")G++;if(q==="]")G--;if(q===","&&Q===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function uY($,Z){if(typeof $!=="string")return $;let Y=$.trim();if(Y.startsWith('"')&&Y.endsWith('"')||Y.startsWith("'")&&Y.endsWith("'"))return Y.slice(1,-1);if(!Y.startsWith("/")&&!Y.startsWith(".")&&!Y.startsWith("http")&&!Y.startsWith("{")){let X=Z[Y];if(X!==void 0)return X}if(Y.startsWith("{")||Y.startsWith("["))try{return JSON.parse(Y)}catch{}return Y}var O6;var F6=b(()=>{d3();mY();O6=dY()});function iU($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
10353
10353
  ${$}
10354
10354
  </div>
10355
10355
  <script>
@@ -10394,7 +10394,7 @@ ${k}
10394
10394
  }
10395
10395
  }
10396
10396
  })();
10397
- </script>`}function iU($,Z){let Y=Z.pwa?.updates,X=Y?.message||"A new version is available. Reload to update?",J=Y?.autoReload||!1,Q=$.trim().length>0,G=`
10397
+ </script>`}function nU($,Z){let Y=Z.pwa?.updates,X=Y?.message||"A new version is available. Reload to update?",J=Y?.autoReload||!1,Q=$.trim().length>0,G=`
10398
10398
  <div class="stx-pwa-update-banner" style="
10399
10399
  position: fixed;
10400
10400
  bottom: 0;
@@ -10505,7 +10505,7 @@ else {
10505
10505
  // Also listen for custom event
10506
10506
  window.addEventListener('pwa-update-available', showUpdate);
10507
10507
  })();
10508
- </script>`}function nU($,Z){let Y=$.trim().length>0,X=`
10508
+ </script>`}function oU($,Z){let Y=$.trim().length>0,X=`
10509
10509
  <div class="stx-offline-indicator" style="
10510
10510
  position: fixed;
10511
10511
  top: 16px;
@@ -10566,7 +10566,7 @@ else {
10566
10566
  window.addEventListener('offline', updateStatus);
10567
10567
  updateStatus();
10568
10568
  })();
10569
- </script>`}function oU($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",J=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
10569
+ </script>`}function sU($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",J=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
10570
10570
  ${$}
10571
10571
  </div>
10572
10572
  <script>
@@ -10648,33 +10648,33 @@ catch (error) {
10648
10648
  init();
10649
10649
  }
10650
10650
  })();
10651
- </script>`}function VR($){return[...$,...L6]}var sU,rU,aU,tU,L6;var V6=b(()=>{sU={name:"pwa.installButton",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return cU($,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},rU={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return iU($,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},aU={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return nU($,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},tU={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return oU($,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},L6=[sU,rU,aU,tU]});function w6($){for(let[Z,Y]of Object.entries(s))if(Y===$)return Z;return}var s;var a4=b(()=>{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 F$(){return!1}function L$(){return!F$()||process.env.STX_DEBUG==="true"}function t4(){return!1}import eU from"path";function e4(){return{...R6}}function $7($){if(!R6.showRelativePaths||!$)return $;let Z=R6.baseDir||process.cwd();try{let Y=eU.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var $j,R6,Z7,a1,Y7;var X7=b(()=>{a4();$j={showRelativePaths:!1,enableAutoRecovery:L$(),logRecoveryWarnings:!0},R6={...$j};Z7=class Z7 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,J,Q,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=J;this.context=Q;if(this.name="StxError",this.numericCode=G||s.EVALUATION_ERROR,this.filePath)this.filePath=$7(this.filePath)}};a1=class a1 extends Z7{constructor($,Z,Y,X,J,Q){super($,"stx_RUNTIME_ERROR",Z,Y,X,J,Q||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};Y7=class Y7 extends Z7{isFatal=!0;constructor($,Z,Y,X,J,Q){super($,"stx_VALIDATION_ERROR",Z,Y,X,J,Q||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function pY($){let{type:Z,message:Y,code:X,filePath:J,line:Q,column:G,template:K,offset:q,snippet:W,suggestion:z,format:U="text"}=$,j=Q,H=G;if(!j&&K&&q!==void 0){let L=Gj(K,q);j=L.line,H=L.column}let B=J?$7(J):void 0,_=X?w6(X):void 0,O={type:Z,code:X,codeName:_,message:Y,filePath:B,line:j,column:H,snippet:W,suggestion:z,timestamp:new Date().toISOString()},F;switch(U){case"html":F=Yj(O);break;case"json":F=JSON.stringify(O,null,2);break;case"console":F=Xj(O,K,q);break;case"text":default:F=Zj(O,K,q);break}return{formatted:F,data:O}}function Zj($,Z,Y){let X=[],J=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${J}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}X.push(`at ${Q}`)}if(X.push(`
10652
- ${$.message}`),Z&&$.line){let Q=Jj(Z,$.line,2);if(Q)X.push(`
10651
+ </script>`}function wR($){return[...$,...L6]}var rU,aU,tU,eU,L6;var V6=b(()=>{rU={name:"pwa.installButton",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return iU($,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},aU={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return nU($,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},tU={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return oU($,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},eU={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let J=Y.__stx_options||{};return sU($,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},L6=[rU,aU,tU,eU]});function w6($){for(let[Z,Y]of Object.entries(s))if(Y===$)return Z;return}var s;var a4=b(()=>{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 F$(){return!1}function L$(){return!F$()||process.env.STX_DEBUG==="true"}function t4(){return!1}import $j from"path";function e4(){return{...R6}}function $7($){if(!R6.showRelativePaths||!$)return $;let Z=R6.baseDir||process.cwd();try{let Y=$j.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var Zj,R6,Z7,a1,Y7;var X7=b(()=>{a4();Zj={showRelativePaths:!1,enableAutoRecovery:L$(),logRecoveryWarnings:!0},R6={...Zj};Z7=class Z7 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,J,Q,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=J;this.context=Q;if(this.name="StxError",this.numericCode=G||s.EVALUATION_ERROR,this.filePath)this.filePath=$7(this.filePath)}};a1=class a1 extends Z7{constructor($,Z,Y,X,J,Q){super($,"stx_RUNTIME_ERROR",Z,Y,X,J,Q||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};Y7=class Y7 extends Z7{isFatal=!0;constructor($,Z,Y,X,J,Q){super($,"stx_VALIDATION_ERROR",Z,Y,X,J,Q||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function lY($){let{type:Z,message:Y,code:X,filePath:J,line:Q,column:G,template:K,offset:q,snippet:W,suggestion:z,format:U="text"}=$,j=Q,H=G;if(!j&&K&&q!==void 0){let L=Kj(K,q);j=L.line,H=L.column}let B=J?$7(J):void 0,_=X?w6(X):void 0,O={type:Z,code:X,codeName:_,message:Y,filePath:B,line:j,column:H,snippet:W,suggestion:z,timestamp:new Date().toISOString()},F;switch(U){case"html":F=Xj(O);break;case"json":F=JSON.stringify(O,null,2);break;case"console":F=Jj(O,K,q);break;case"text":default:F=Yj(O,K,q);break}return{formatted:F,data:O}}function Yj($,Z,Y){let X=[],J=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${J}]`),$.filePath){let Q=$.filePath;if($.line){if(Q+=`:${$.line}`,$.column)Q+=`:${$.column}`}X.push(`at ${Q}`)}if(X.push(`
10652
+ ${$.message}`),Z&&$.line){let Q=Qj(Z,$.line,2);if(Q)X.push(`
10653
10653
  ${Q}`)}if($.snippet)X.push(`
10654
10654
  Snippet: ${$.snippet}`);if($.suggestion)X.push(`
10655
- Suggestion: ${$.suggestion}`);return X.join(" ")}function Yj($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${uY($.message)}`;if($.suggestion)X+=` | Suggestion: ${uY($.suggestion)}`;return X+=" -->",X}function Xj($,Z,Y){let W=[],z=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${z} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let U=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(U+=`\x1B[90m:${$.line}\x1B[0m`,$.column)U+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
10655
+ Suggestion: ${$.suggestion}`);return X.join(" ")}function Xj($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${pY($.message)}`;if($.suggestion)X+=` | Suggestion: ${pY($.suggestion)}`;return X+=" -->",X}function Jj($,Z,Y){let W=[],z=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${z} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let U=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(U+=`\x1B[90m:${$.line}\x1B[0m`,$.column)U+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
10656
10656
  \x1B[90mat\x1B[0m ${U}`)}if(W.push(`
10657
10657
 
10658
- ${$.message}`),Z&&$.line){let U=Qj(Z,$.line,2);if(U)W.push(`
10658
+ ${$.message}`),Z&&$.line){let U=Gj(Z,$.line,2);if(U)W.push(`
10659
10659
 
10660
10660
  \x1B[90mContext:\x1B[0m
10661
10661
  ${U}`)}if($.suggestion)W.push(`
10662
10662
 
10663
10663
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
10664
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function Jj($,Z,Y){let X=$.split(`
10664
+ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),W.join("")}function Qj($,Z,Y){let X=$.split(`
10665
10665
  `),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G=[];for(let K=J;K<=Q;K++){let q=(K+1).toString().padStart(4),W=K===Z-1?">":" ";G.push(`${W}${q} | ${X[K]}`)}return G.join(`
10666
- `)}function Qj($,Z,Y){let X=$.split(`
10666
+ `)}function Gj($,Z,Y){let X=$.split(`
10667
10667
  `),J=Math.max(0,Z-Y-1),Q=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",W=[];for(let z=J;z<=Q;z++){let U=(z+1).toString().padStart(4),j=z===Z-1,H=j?"\x1B[31m>\x1B[0m":" ",B=j?`\x1B[31m${X[z]}\x1B[0m`:`\x1B[90m${X[z]}\x1B[0m`;W.push(`${H}\x1B[90m${U}\x1B[0m | ${B}`)}return W.join(`
10668
- `)}function uY($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Gj($,Z){let X=$.substring(0,Z).split(`
10669
- `);return{line:X.length,column:X[X.length-1].length}}function $0($,Z,Y){return pY({type:$,message:Z,code:Y,format:"html"}).formatted}async function T5($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var lY=b(()=>{a4();X7()});class A6{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let X={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(X)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
10668
+ `)}function pY($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function Kj($,Z){let X=$.substring(0,Z).split(`
10669
+ `);return{line:X.length,column:X[X.length-1].length}}function $0($,Z,Y){return lY({type:$,message:Z,code:Y,format:"html"}).formatted}async function T5($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var cY=b(()=>{a4();X7()});class A6{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor($={}){this.maxErrors=$.maxErrors??1000,this.enableFileLogging=$.enableFileLogging??!1,this.logFilePath=$.logFilePath??".stx/errors.log",this.logFormat=$.logFormat??"json",this.maxFileSize=$.maxFileSize??10485760,this.maxLogFiles=$.maxLogFiles??5,this.minLevel=$.minLevel??"all"}configure($){if($.maxErrors!==void 0)this.maxErrors=$.maxErrors;if($.enableFileLogging!==void 0)this.enableFileLogging=$.enableFileLogging;if($.logFilePath!==void 0)this.logFilePath=$.logFilePath;if($.logFormat!==void 0)this.logFormat=$.logFormat;if($.maxFileSize!==void 0)this.maxFileSize=$.maxFileSize;if($.maxLogFiles!==void 0)this.maxLogFiles=$.maxLogFiles;if($.minLevel!==void 0)this.minLevel=$.minLevel}log($,Z,Y="error"){let X={timestamp:new Date,error:$,context:Z,level:Y};if(this.errors.push(X),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Y))this.writeToFile(X)}shouldLog($){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return $==="error"||$==="warning";if(this.minLevel==="error")return $==="error";return!0}formatEntry($){if(this.logFormat==="json")return JSON.stringify({timestamp:$.timestamp.toISOString(),level:$.level||"error",type:$.error.constructor.name,message:$.error.message,stack:$.error.stack,context:$.context});let Z=[`[${$.timestamp.toISOString()}] [${($.level||"error").toUpperCase()}] ${$.error.constructor.name}: ${$.error.message}`];if($.error.stack)Z.push(` Stack: ${$.error.stack.split(`
10670
10670
  `).slice(1).join(`
10671
10671
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
10672
10672
  `)}writeToFile($){this.writeQueue=this.writeQueue.then(async()=>{try{let Z=await import("fs"),X=(await import("path")).dirname(this.logFilePath);if(!Z.existsSync(X))Z.mkdirSync(X,{recursive:!0});await this.rotateIfNeeded(Z);let J=`${this.formatEntry($)}
10673
10673
  `;Z.appendFileSync(this.logFilePath,J,"utf-8")}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",Z)}})}async rotateIfNeeded($){try{if(!$.existsSync(this.logFilePath))return;if($.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Y=this.maxLogFiles-1;Y>=1;Y--){let X=`${this.logFilePath}.${Y}`,J=`${this.logFilePath}.${Y+1}`;if($.existsSync(X))if(Y>=this.maxLogFiles-1)$.unlinkSync(X);else $.renameSync(X,J)}if(this.maxLogFiles<=1)$.writeFileSync(this.logFilePath,"");else $.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch(Z){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",Z)}}getRecentErrors($=10){return this.errors.slice(-$)}getErrorsByType($){return this.errors.filter((Z)=>Z.error.constructor.name===$)}getErrorsByLevel($){return this.errors.filter((Z)=>Z.level===$)}clear(){this.errors.length=0}async clearLogFile(){try{let $=await import("fs");if($.existsSync(this.logFilePath))$.writeFileSync(this.logFilePath,"","utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",$)}}getStats(){let $={},Z={error:0,warning:0,info:0};for(let Y of this.errors){let X=Y.error.constructor.name;$[X]=($[X]||0)+1;let J=Y.level||"error";Z[J]=(Z[J]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),J=(await import("path")).dirname($);if(!Y.existsSync(J))Y.mkdirSync(J,{recursive:!0});if(Z==="json"){let Q=this.errors.map((G)=>({timestamp:G.timestamp.toISOString(),level:G.level||"error",type:G.error.constructor.name,message:G.error.message,stack:G.error.stack,context:G.context}));Y.writeFileSync($,JSON.stringify(Q,null,2),"utf-8")}else{let Q=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,Q.join(`
10674
10674
 
10675
- `),"utf-8")}}async flush(){await this.writeQueue}}var N6,a0,M6;var cY=b(()=>{X7();N6={isEnabled(){return e4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=e4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],J=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(J>Q){let K=J-Q;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>W){let z=q-W;for(let U=0;U<z;U++)Y+=`
10675
+ `),"utf-8")}}async flush(){await this.writeQueue}}var N6,a0,M6;var iY=b(()=>{X7();N6={isEnabled(){return e4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=e4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],J=(Y.match(/\{\{/g)||[]).length,Q=(Y.match(/\}\}/g)||[]).length;if(J>Q){let K=J-Q;Y+="}}".repeat(K),X.push(`Added ${K} missing closing braces '}}'`)}let G=["if","foreach","for","switch","section"];for(let K of G){let q=(Y.match(new RegExp(`@${K}\\b`,"g"))||[]).length,W=(Y.match(new RegExp(`@end${K}\\b`,"g"))||[]).length;if(q>W){let z=q-W;for(let U=0;U<z;U++)Y+=`
10676
10676
  @end${K}`;X.push(`Added ${z} missing @end${K}`)}}if(X.length>0&&Z.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),X.forEach((K)=>console.warn(` - ${K}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Y,fixes:X}},createFallbackContent($,Z){if(L$())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};a0=new A6,M6={isDevelopment(){return L$()},logDetailedError($,Z){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",$.message),console.error("Stack:",$.stack),Z)console.error("Context:",Z);console.error("========================")},createErrorReport($,Z){let Y=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${$.message}`,`Type: ${$.constructor.name}`,`Stack: ${$.stack}`];if(Z)Y.push(`Context: ${JSON.stringify(Z,null,2)}`);return Y.push("========================"),Y.join(`
10677
- `)}}});var iY=()=>{};var nY=b(()=>{a4();lY();cY();iY();X7()});var U1=b(()=>{nY()});function oY($,Z,Y,X){let J=$;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let z=q.split(":"),U=q,j=z.length>1?z[1]:"";if(j&&Z[j])W=Z[j];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])W=Z.openGraph[z[1]];else W="";return W?`<meta property="${l(U)}" content="${l(W)}">`:""}return W?`<meta name="${l(q)}" content="${l(W)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(J))!==null){let K=G.index,q=K+G[0].length-1,W=1,z=q+1;while(z<J.length&&W>0){if(J[z]==="(")W++;else if(J[z]===")"){if(W--,W===0)break}z++}if(W!==0)break;let U=J.substring(q+1,z).trim(),j=z+1,H=(()=>{try{let B=O0(U,Z);if(!B)return"";let _="<meta";if(B.name)_+=` name="${l(String(B.name))}"`;if(B.property)_+=` property="${l(String(B.property))}"`;if(B.httpEquiv)_+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)_+=` content="${l(String(B.content))}"`;return _+=">",_}catch(B){let _=B instanceof Error?B.message:String(B);return $0("MetaTag",_,s.EVALUATION_ERROR)}})();J=J.substring(0,K)+H+J.substring(j),Q.lastIndex=0}return J}function sY($,Z,Y){let X=$,J=/@structuredData\s*\(/g,Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let z=X.substring(K+1,W).trim(),U=W+1,j=(()=>{try{let H=O0(z,Z);if(!H)return"";if(!H["@context"])H["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(H).replace(/<\//g,"<\\/")}</script>`}catch(H){let B=H instanceof Error?H.message:String(H);return $0("StructuredData",B,s.EVALUATION_ERROR)}})();X=X.substring(0,G)+j+X.substring(U),J.lastIndex=0}return X}function rY($,Z,Y,X){let J=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(J))!==null){let K=J.indexOf("{",G.index+4),q=1,W=K+1,z=null,U=!1;while(W<J.length&&q>0){let F=J[W];if(U){U=!1,W++;continue}if(F==="\\"&&z){U=!0,W++;continue}if(z){if(F===z)z=null;W++;continue}if(F==='"'||F==="'"||F==="`"){z=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let j=J.substring(W).match(/^\s*\)/);if(!j)break;let H=W+j[0].length,B=J.substring(K,W),_=J.substring(G.index,H),O=((F)=>{try{let L=O0(F,Z);if(!L)return"";let V="";if(L.title)V+=`<title>${l(L.title)}</title>
10677
+ `)}}});var nY=()=>{};var oY=b(()=>{a4();cY();iY();nY();X7()});var U1=b(()=>{oY()});function sY($,Z,Y,X){let J=$;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let z=q.split(":"),U=q,j=z.length>1?z[1]:"";if(j&&Z[j])W=Z[j];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])W=Z.openGraph[z[1]];else W="";return W?`<meta property="${l(U)}" content="${l(W)}">`:""}return W?`<meta name="${l(q)}" content="${l(W)}">`:""});let Q=/@metaTag\s*\(/g,G;while((G=Q.exec(J))!==null){let K=G.index,q=K+G[0].length-1,W=1,z=q+1;while(z<J.length&&W>0){if(J[z]==="(")W++;else if(J[z]===")"){if(W--,W===0)break}z++}if(W!==0)break;let U=J.substring(q+1,z).trim(),j=z+1,H=(()=>{try{let B=O0(U,Z);if(!B)return"";let _="<meta";if(B.name)_+=` name="${l(String(B.name))}"`;if(B.property)_+=` property="${l(String(B.property))}"`;if(B.httpEquiv)_+=` http-equiv="${l(String(B.httpEquiv))}"`;if(B.content)_+=` content="${l(String(B.content))}"`;return _+=">",_}catch(B){let _=B instanceof Error?B.message:String(B);return $0("MetaTag",_,s.EVALUATION_ERROR)}})();J=J.substring(0,K)+H+J.substring(j),Q.lastIndex=0}return J}function rY($,Z,Y){let X=$,J=/@structuredData\s*\(/g,Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)break;let z=X.substring(K+1,W).trim(),U=W+1,j=(()=>{try{let H=O0(z,Z);if(!H)return"";if(!H["@context"])H["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(H).replace(/<\//g,"<\\/")}</script>`}catch(H){let B=H instanceof Error?H.message:String(H);return $0("StructuredData",B,s.EVALUATION_ERROR)}})();X=X.substring(0,G)+j+X.substring(U),J.lastIndex=0}return X}function aY($,Z,Y,X){let J=$,Q=/@seo\s*\(\s*\{/g,G;while((G=Q.exec(J))!==null){let K=J.indexOf("{",G.index+4),q=1,W=K+1,z=null,U=!1;while(W<J.length&&q>0){let F=J[W];if(U){U=!1,W++;continue}if(F==="\\"&&z){U=!0,W++;continue}if(z){if(F===z)z=null;W++;continue}if(F==='"'||F==="'"||F==="`"){z=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let j=J.substring(W).match(/^\s*\)/);if(!j)break;let H=W+j[0].length,B=J.substring(K,W),_=J.substring(G.index,H),O=((F)=>{try{let L=O0(F,Z);if(!L)return"";let V="";if(L.title)V+=`<title>${l(L.title)}</title>
10678
10678
  `,V+=`<meta name="title" content="${l(L.title)}">
10679
10679
  `;if(L.description)V+=`<meta name="description" content="${l(L.description)}">
10680
10680
  `;if(L.keywords){let w=Array.isArray(L.keywords)?L.keywords.join(", "):L.keywords;V+=`<meta name="keywords" content="${l(w)}">
@@ -10696,7 +10696,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
10696
10696
  `}if(w.site)V+=`<meta name="twitter:site" content="${l(w.site)}">
10697
10697
  `;if(w.creator)V+=`<meta name="twitter:creator" content="${l(w.creator)}">
10698
10698
  `}if(L.structuredData){let w=JSON.stringify(L.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${w}</script>
10699
- `}return V.trim()}catch(L){let V=L instanceof Error?L.message:String(L);return $0("SEO",`Error processing @seo directive: ${V}`,s.EVALUATION_ERROR)}})(B);J=J.substring(0,G.index)+O+J.substring(H),Q.lastIndex=G.index+O.length}return J}function aY($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let W=`
10699
+ `}return V.trim()}catch(L){let V=L instanceof Error?L.message:String(L);return $0("SEO",`Error processing @seo directive: ${V}`,s.EVALUATION_ERROR)}})(B);J=J.substring(0,G.index)+O+J.substring(H),Q.lastIndex=G.index+O.length}return J}function tY($,Z,Y){if(Y.seo?.enabled===!1)return $;if($.includes("<!-- stx SEO Tags -->")||Y.skipDefaultSeoTags===!0)return $;let X=Z.__stx_runtime_head;if(!!(X?.title||X?.meta?.some((U)=>U.property==="og:title"||U.name==="og:title"||U.name==="twitter:title"||U.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let Q=$.includes("<title>")||$.includes("</title>"),G="";if(Z.title)G=Z.title;else if(Z.meta&&Z.meta.title)G=Z.meta.title;else if(Y.seo?.defaultConfig?.title)G=Y.seo.defaultConfig.title;else G=Y.defaultTitle||"stx Project";let K="";if(Z.description)K=Z.description;else if(Z.meta&&Z.meta.description)K=Z.meta.description;else if(Y.seo?.defaultConfig?.description)K=Y.seo.defaultConfig.description;else K=Y.defaultDescription||"A website built with stx templating engine";let q="";if(Z.image)q=Z.image;else if(Z.meta&&Z.meta.image)q=Z.meta.image;else if(Z.openGraph&&Z.openGraph.image)q=Z.openGraph.image;else if(Y.seo?.defaultImage)q=Y.seo.defaultImage;else if(Y.defaultImage)q=Y.defaultImage;let W=`
10700
10700
  <!-- stx SEO Tags -->
10701
10701
  <meta name="title" content="${l(G)}">
10702
10702
  <meta name="description" content="${l(K)}">
@@ -10712,7 +10712,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
10712
10712
  `;let z=$;if(!Q)z=z.replace(/<head[^>]*>/,`$&
10713
10713
  <title>${l(G)}</title>`);return z.replace(/<head[^>]*>/,`$&
10714
10714
  ${W}
10715
- `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var tY,eY;var T6=b(()=>{U1();F0();tY={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(J)}" content="${l(Q)}">`},hasEndTag:!1},eY={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse($);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return $0("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let Q=J instanceof Error?J.message:String(J);return $0("StructuredData",Q,s.EVALUATION_ERROR)}},hasEndTag:!0}});import V$ from"path";function Kj($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",J=Z,Q=[],G=!0;if(X){let U=X.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let j=U[1],H=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(H)J=H[1];let B=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((O)=>O.trim().replace(/['"`]/g,"")).filter((O)=>O.length>0);let _=j.match(/shadowDOM\s*:\s*(true|false)/);if(_)G=_[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),z=W?W[1].trim():"";return{tag:J,props:Q,template:q,styles:z,script:X,shadowDOM:G}}function qj($){let{tag:Z,props:Y,template:X,styles:J,shadowDOM:Q}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((U)=>`'${U}'`).join(", "),z=Y.map((U)=>`
10715
+ `)}function l($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var eY,$X;var T6=b(()=>{U1();F0();eY={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),Q=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${l(J)}" content="${l(Q)}">`},hasEndTag:!1},$X={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse($);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return $0("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let Q=J instanceof Error?J.message:String(J);return $0("StructuredData",Q,s.EVALUATION_ERROR)}},hasEndTag:!0}});import V$ from"path";function qj($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",J=Z,Q=[],G=!0;if(X){let U=X.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let j=U[1],H=j.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(H)J=H[1];let B=j.match(/props\s*:\s*\[([\s\S]*?)\]/);if(B)Q=B[1].split(",").map((O)=>O.trim().replace(/['"`]/g,"")).filter((O)=>O.length>0);let _=j.match(/shadowDOM\s*:\s*(true|false)/);if(_)G=_[1]==="true"}catch{}}let K=$.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),q=K?K[1].trim():"",W=$.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),z=W?W[1].trim():"";return{tag:J,props:Q,template:q,styles:z,script:X,shadowDOM:G}}function Wj($){let{tag:Z,props:Y,template:X,styles:J,shadowDOM:Q}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((U)=>`'${U}'`).join(", "),z=Y.map((U)=>`
10716
10716
  get ${U}() {
10717
10717
  return this.getAttribute('${U}') || '';
10718
10718
  }
@@ -10763,16 +10763,16 @@ ${z}
10763
10763
  }
10764
10764
 
10765
10765
  customElements.define('${Z}', ${G});
10766
- `}async function $X($,Z,Y,X){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[V$.join(V$.dirname(X),G,`${J}.stx`),V$.join(process.cwd(),G,`${J}.stx`),V$.join(V$.dirname(X),`${J}.stx`)],q=null;for(let U of K)if(await c(U)){q=await Bun.file(U).text();break}if(!q)return $0("WebComponent",`Component file not found: ${J}.stx`,s.FILE_NOT_FOUND);let W=Kj(q,J);return`<script type="module">
10767
- ${qj(W)}
10768
- </script>`}var ZX=b(()=>{U1();R0()});var YX={};o(YX,{timingPlugin:()=>Bj,pluginManager:()=>Wj,definePlugin:()=>J7,debugPlugin:()=>jj,createVariablesPlugin:()=>Hj,createFilterPlugin:()=>Uj,createDirectivePlugin:()=>zj,PluginManager:()=>I6});function J7($){return $}class I6{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let J=X[$];if(J)try{let Q=await J(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${X.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let G=await Q(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${J.name}" ${$} hook:`,G)}}return X}}function zj($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function Uj($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function Hj($){return J7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var Wj,jj,Bj;var XX=b(()=>{Wj=new I6;jj=J7({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),Bj=J7({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var KX={};o(KX,{validateConfig:()=>Rj,resolveStxDirectories:()=>GX,loadStxConfig:()=>D1,defineStxConfig:()=>wj,defaultConfig:()=>t1,config:()=>e5});import Q7 from"fs";import g0 from"path";import{loadConfigWithResult as _j}from"bunfig";function Oj($,Z,Y){let X=Z||"pages";if($)return{root:$,pagesDir:X};let J=Y||process.cwd(),Q=g0.join(J,"resources","views"),G=g0.join(J,"resources","layouts");if(Q7.existsSync(Q)&&Q7.existsSync(G))return{root:"resources",pagesDir:"views"};let K=g0.join(J,"resources","views","pages");if(Q7.existsSync(K))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}function Fj($,Z){let Y=Z.replace(/[\\/]+$/,"");if(!Y||Y===".")return!0;let X=$.replace(/\\/g,"/"),J=Y.replace(/\\/g,"/");return X===J||X.startsWith(`${J}/`)}function GX($,Z){let Y=!$.root,X=Oj($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,Y&&X.root!=="."){let J=`${Z}::${X.root}`;if(!JX.has(J))JX.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let J=$.root;for(let Q of["partialsDir","componentsDir","layoutsDir"]){let G=$[Q];if(typeof G!=="string"||!G)continue;if(g0.isAbsolute(G)||Fj(G,J))continue;$[Q]=g0.join(J,G)}}return $}function Lj($,Z){let Y=["componentsDir","layoutsDir","partialsDir"];for(let X of Y){let J=$[X];if(typeof J!=="string"||!J)continue;let Q=g0.isAbsolute(J)?J:g0.join(Z,J);if(Q7.existsSync(Q))continue;let G=$.root,K=!!G&&G!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${J}"`+(K?`, resolved under root "${G}".`:"."))}}function Vj($){if(V8($.stateDir),$.stateDir=i5(),$.cachePath=o5($.cachePath),$.build)$.build.cacheDir=o5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=o5($.media.cache.directory);if($.story)$.story.outDir=o5($.story.outDir)}async function D1($){if(!$){if(I5)return I5;if(G7)return G7}let Z=$?g0.resolve($):process.cwd(),Y=QX.get(Z);if(Y)return Y;let X=(async()=>{let Q=(await _j({name:"stx",alias:"ui",cwd:Z,defaultConfig:t1,verbose:!1})).config;if(Vj(Q),GX(Q,Z),Lj(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await Promise.resolve().then(() => (XX(),YX)),K=[],q=[];for(let W of Q.plugins){let z=typeof W==="string"?W:W[0],U=typeof W==="string"?{}:W[1]||{};try{let j,H;try{j=await import(z),H=g0.dirname(W0.resolve(z))}catch{let _=g0.resolve(process.cwd(),z);j=await import(_),H=g0.dirname(_)}let B=j.default||j;if(G.register(B,Q),B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let O of _)K.push(g0.resolve(H,O))}if(B.pages){let _=g0.resolve(H,B.pages),O=U.path||"/";q.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,F)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=F},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:H,config:Q};await B.setup(U,_)}console.log(`[stx] Plugin loaded: ${B.name||z}`)}catch(j){console.warn(`[stx] Failed to load plugin ${z}:`,j.message)}}Q._pluginComponentDirs=K,Q._pluginPageDirs=q}return Q})();if(QX.set(Z,X),!$)G7=X,X.then((J)=>{I5=J}).catch(()=>{});return X}function wj($){return $}function Rj($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((J,Q)=>{if(!J.pattern||typeof J.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(J.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var t1,JX,I5=null,QX,G7=null,e5;var w1=b(()=>{c7();i7();n7();o7();m3();FY();F6();V6();T6();u$();ZX();t1={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:p2,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:$X,hasEndTag:!1,description:"Include a web component in the template"},N8,A8,tY,eY,M8,I8,D8,T8,S8,C8,OY,O6,...L6],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}};JX=new Set;QX=new Map;e5=new Proxy(t1,{get($,Z){if(I5&&Z in I5)return I5[Z];if(!G7)D1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import K0 from"path";import{hasLocalConfig as Nj}from"bunfig";function q7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function E6($,Z){if(e1.has($))e1.delete($);else if(e1.size>=zX)e1.delete(e1.keys().next().value);e1.set($,Z)}function Aj($){let Z=q7($);if(D5.has(Z))D5.delete(Z);else if(D5.size>=zX)D5.delete(D5.keys().next().value);return D5.set(Z,$),Z}async function Mj($){if(!b1)return null;try{let Z=Bun.file(K0.join(b1,`cw-${q7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function Tj($,Z){if(!b1)return;try{if(!fs.existsSync(b1))fs.mkdirSync(b1,{recursive:!0});await Bun.write(K0.join(b1,`cw-${q7($)}.css`),Z)}catch{}}async function WX($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function Ij(){let $=[],Z=process.cwd();while(Z!==K0.dirname(Z))$.push(K0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(K0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(K0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(K0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(K0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(K0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=K0.dirname(Z);return $}function Dj(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[K0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),K0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),K0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),K0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),K0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),K0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(K0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(K0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function Ej(){if(qX)return j1;qX=!0;try{let $=async(J)=>{for(let Q of J){if(!await Bun.file(Q).exists())continue;let G=await WX(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${w0.green}[Crosswind]${w0.reset} CSS engine loaded from ${K0.dirname(K0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let J=K0.resolve(process.env.CROSSWIND_SRC),Q=await $([J]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return j1=Q,j1}let Z=await $(Ij());if(Z)return j1=Z,j1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Y){let Q=await WX(J);if(Q){if(j1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${w0.green}[Crosswind]${w0.reset} CSS engine loaded`);return j1}}let X=await $(Dj());if(X)return j1=X,j1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${w0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${w0.reset}`),console.warn(`${w0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${w0.reset}`),null}}async function kj($){try{if(!Nj({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=K0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${w0.green}[Crosswind]${w0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${w0.yellow}[Crosswind]${w0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function bj($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=J.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}Q=J.exec($)}return Z}async function Sj($,Z){try{let Y=await Ej();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):bj($);if(X.size===0)return"";let J=Z?K0.resolve(Z):process.cwd();if(!b1)b1=n5(J,"cache");let Q=[...X].sort().join(" "),G=`${D6||"default"}::${Q}`,K=e1.get(G);if(K!==void 0)return E6(G,K),K;let q=await Mj(G);if(q!==null)return E6(G,q),q;if(!K7){let w=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (w1(),KX)),N=await R(J);if(N.css)if(typeof N.css==="string"){let A=K0.isAbsolute(N.css)?N.css:K0.resolve(J,N.css);if(await Bun.file(A).exists()){let M=await import(A);w=M.default||M,console.log(`${w0.green}[Crosswind]${w0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(w={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let A=K0.isAbsolute(N.css.config)?N.css.config:K0.resolve(J,N.css.config);if(await Bun.file(A).exists()){let M=await import(A);w={...M.default||M,...w}}}console.log(`${w0.green}[Crosswind]${w0.reset} Using inline CSS config from stx.config.ts`)}}catch{}K7=w||await kj(J);try{D6=q7(JSON.stringify(K7??{}))}catch{D6="unhashable"}}let W=Y.defaultConfig||Y.config,z=K7||{},U=F8(W,z),{safelist:j,includePreflight:H,minify:B}=U,_=U.config,O=new Y.CSSGenerator(_);for(let w of j)O.generate(w);for(let w of X)O.generate(w);let F=O.toCSS(H,B),L=_.shortcuts||z.shortcuts||{};for(let[w,R]of Object.entries(L)){if(!X.has(w)&&!j.includes(w))continue;let N=R.split(/\s+/).filter(Boolean);for(let A of N)O.generate(A)}F=O.toCSS(H,B);let V=F.split(`
10766
+ `}async function ZX($,Z,Y,X){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let J=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[V$.join(V$.dirname(X),G,`${J}.stx`),V$.join(process.cwd(),G,`${J}.stx`),V$.join(V$.dirname(X),`${J}.stx`)],q=null;for(let U of K)if(await c(U)){q=await Bun.file(U).text();break}if(!q)return $0("WebComponent",`Component file not found: ${J}.stx`,s.FILE_NOT_FOUND);let W=qj(q,J);return`<script type="module">
10767
+ ${Wj(W)}
10768
+ </script>`}var YX=b(()=>{U1();R0()});var XX={};o(XX,{timingPlugin:()=>Hj,pluginManager:()=>zj,definePlugin:()=>J7,debugPlugin:()=>Bj,createVariablesPlugin:()=>_j,createFilterPlugin:()=>jj,createDirectivePlugin:()=>Uj,PluginManager:()=>I6});function J7($){return $}class I6{plugins=new Map;sortedPlugins=[];initialized=!1;async register($,Z){if(this.plugins.has($.name))throw Error(`Plugin "${$.name}" is already registered`);if($.dependencies){for(let Y of $.dependencies)if(!this.plugins.has(Y))throw Error(`Plugin "${$.name}" depends on "${Y}" which is not registered`)}if(this.plugins.set($.name,$),$.onRegister)await $.onRegister(Z);this.sortPlugins()}async unregister($){let Z=this.plugins.get($);if(!Z)return!1;for(let[Y,X]of this.plugins)if(X.dependencies?.includes($))throw Error(`Cannot unregister "${$}" because "${Y}" depends on it`);if(Z.onUnregister)await Z.onUnregister();return this.plugins.delete($),this.sortPlugins(),!0}get($){return this.plugins.get($)}has($){return this.plugins.has($)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let $=[];for(let Z of this.sortedPlugins)if(Z.registerDirectives)$.push(...Z.registerDirectives());return $}getAllFilters(){let $={};for(let Z of this.sortedPlugins)if(Z.registerFilters)Object.assign($,Z.registerFilters());return $}async runBeforeProcess($){return this.runHooks("beforeProcess",$)}async runAfterParse($){return this.runHooks("afterParse",$)}async runBeforeDirective($,Z){return this.runDirectiveHooks("beforeDirective",$,Z)}async runAfterDirective($,Z){return this.runDirectiveHooks("afterDirective",$,Z)}async runBeforeRender($){return this.runHooks("beforeRender",$)}async runAfterRender($){return this.runHooks("afterRender",$)}async runOnError($){for(let Z of this.sortedPlugins)if(Z.onError)try{let Y=await Z.onError($);if(Y){if(Y.template!==void 0)$.template=Y.template;if(Y.context)$.context={...$.context,...Y.context};if(Y.metadata)$.metadata={...$.metadata,...Y.metadata};if(Y.skip)return $}}catch(Y){console.error(`Error in plugin "${Z.name}" onError hook:`,Y)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort(($,Z)=>($.priority??100)-(Z.priority??100))}async runHooks($,Z){let Y={...Z};for(let X of this.sortedPlugins){let J=X[$];if(J)try{let Q=await J(Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${X.name}" ${$} hook:`,Q)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let J of this.sortedPlugins){let Q=J[$];if(Q)try{let G=await Q(Z,X);if(G){if(G.template!==void 0)X.template=G.template;if(G.context)X.context={...X.context,...G.context};if(G.metadata)X.metadata={...X.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${J.name}" ${$} hook:`,G)}}return X}}function Uj($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function jj($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function _j($){return J7({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var zj,Bj,Hj;var JX=b(()=>{zj=new I6;Bj=J7({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess($){console.log("[stx-debug] beforeProcess:",$.filePath)},afterParse($){console.log("[stx-debug] afterParse:",$.template.length,"chars")},beforeDirective($,Z){console.log("[stx-debug] beforeDirective:",$)},afterDirective($,Z){console.log("[stx-debug] afterDirective:",$)},beforeRender($){console.log("[stx-debug] beforeRender")},afterRender($){console.log("[stx-debug] afterRender:",$.template.length,"chars")},onError($){console.error("[stx-debug] onError:",$.error.message,"in phase:",$.phase)}}),Hj=J7({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess($){$.metadata.startTime=performance.now()},afterRender($){let Z=$.metadata.startTime;if(Z){let Y=performance.now()-Z;console.log(`[stx-timing] Processing took ${Y.toFixed(2)}ms`)}}})});var qX={};o(qX,{validateConfig:()=>Nj,resolveStxDirectories:()=>KX,loadStxConfig:()=>D1,defineStxConfig:()=>Rj,defaultConfig:()=>t1,config:()=>e5});import Q7 from"fs";import h0 from"path";import{loadConfigWithResult as Oj}from"bunfig";function Fj($,Z,Y){let X=Z||"pages";if($)return{root:$,pagesDir:X};let J=Y||process.cwd(),Q=h0.join(J,"resources","views"),G=h0.join(J,"resources","layouts");if(Q7.existsSync(Q)&&Q7.existsSync(G))return{root:"resources",pagesDir:"views"};let K=h0.join(J,"resources","views","pages");if(Q7.existsSync(K))return{root:"resources/views",pagesDir:X};return{root:".",pagesDir:X}}function Lj($,Z){let Y=Z.replace(/[\\/]+$/,"");if(!Y||Y===".")return!0;let X=$.replace(/\\/g,"/"),J=Y.replace(/\\/g,"/");return X===J||X.startsWith(`${J}/`)}function KX($,Z){let Y=!$.root,X=Fj($.root,$.pagesDir,Z);if($.root=X.root,$.pagesDir=X.pagesDir,Y&&X.root!=="."){let J=`${Z}::${X.root}`;if(!QX.has(J))QX.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${X.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if($.root&&$.root!=="."){let J=$.root;for(let Q of["partialsDir","componentsDir","layoutsDir"]){let G=$[Q];if(typeof G!=="string"||!G)continue;if(h0.isAbsolute(G)||Lj(G,J))continue;$[Q]=h0.join(J,G)}}return $}function Vj($,Z){let Y=["componentsDir","layoutsDir","partialsDir"];for(let X of Y){let J=$[X];if(typeof J!=="string"||!J)continue;let Q=h0.isAbsolute(J)?J:h0.join(Z,J);if(Q7.existsSync(Q))continue;let G=$.root,K=!!G&&G!==".";console.warn(`[stx] ${String(X)} resolves to "${Q}", which does not exist. Configured as "${J}"`+(K?`, resolved under root "${G}".`:"."))}}function wj($){if(V8($.stateDir),$.stateDir=i5(),$.cachePath=o5($.cachePath),$.build)$.build.cacheDir=o5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=o5($.media.cache.directory);if($.story)$.story.outDir=o5($.story.outDir)}async function D1($){if(!$){if(I5)return I5;if(G7)return G7}let Z=$?h0.resolve($):process.cwd(),Y=GX.get(Z);if(Y)return Y;let X=(async()=>{let Q=(await Oj({name:"stx",alias:"ui",cwd:Z,defaultConfig:t1,verbose:!1})).config;if(wj(Q),KX(Q,Z),Vj(Q,Z),Q.plugins&&Q.plugins.length>0){let{pluginManager:G}=await Promise.resolve().then(() => (JX(),XX)),K=[],q=[];for(let W of Q.plugins){let z=typeof W==="string"?W:W[0],U=typeof W==="string"?{}:W[1]||{};try{let j,H;try{j=await import(z),H=h0.dirname(W0.resolve(z))}catch{let _=h0.resolve(process.cwd(),z);j=await import(_),H=h0.dirname(_)}let B=j.default||j;if(G.register(B,Q),B.components){let _=Array.isArray(B.components)?B.components:[B.components];for(let O of _)K.push(h0.resolve(H,O))}if(B.pages){let _=h0.resolve(H,B.pages),O=U.path||"/";q.push({dir:_,prefix:O})}if(B.setup){let _={addDirective:(O)=>{Q.customDirectives=Q.customDirectives||[],Q.customDirectives.push(O)},addRoute:(O,F)=>{Q.apiRoutes=Q.apiRoutes||{},Q.apiRoutes[O]=F},addMiddleware:(O)=>{Q.middleware=Q.middleware||[],Q.middleware.push(O)},pluginDir:H,config:Q};await B.setup(U,_)}console.log(`[stx] Plugin loaded: ${B.name||z}`)}catch(j){console.warn(`[stx] Failed to load plugin ${z}:`,j.message)}}Q._pluginComponentDirs=K,Q._pluginPageDirs=q}return Q})();if(GX.set(Z,X),!$)G7=X,X.then((J)=>{I5=J}).catch(()=>{});return X}function Rj($){return $}function Nj($){let Z=[],Y=[];if($.partialsDir!==void 0&&typeof $.partialsDir!=="string")Z.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if($.componentsDir!==void 0&&typeof $.componentsDir!=="string")Z.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if($.cache!==void 0&&typeof $.cache!=="boolean")Z.push({path:"cache",message:"cache must be a boolean",severity:"error"});if($.debug!==void 0&&typeof $.debug!=="boolean")Z.push({path:"debug",message:"debug must be a boolean",severity:"error"});if($.streaming){if($.streaming.bufferSize!==void 0){if(typeof $.streaming.bufferSize!=="number"||$.streaming.bufferSize<=0)Z.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if($.streaming.timeout!==void 0){if(typeof $.streaming.timeout!=="number"||$.streaming.timeout<=0)Z.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if($.streaming.strategy!==void 0){let X=["auto","manual","sections"];if(!X.includes($.streaming.strategy))Z.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${X.join(", ")}`,severity:"error"})}}if($.i18n){if($.i18n.format!==void 0){let X=["json","yaml","yml","js"];if(!X.includes($.i18n.format))Z.push({path:"i18n.format",message:`i18n.format must be one of: ${X.join(", ")}`,severity:"error"})}}if($.animation){if($.animation.defaultDuration!==void 0){if(typeof $.animation.defaultDuration!=="number"||$.animation.defaultDuration<0)Z.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if($.animation.staggerDelay!==void 0){if(typeof $.animation.staggerDelay!=="number"||$.animation.staggerDelay<0)Z.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if($.a11y){if($.a11y.level!==void 0){let X=["AA","AAA"];if(!X.includes($.a11y.level))Z.push({path:"a11y.level",message:`a11y.level must be one of: ${X.join(", ")}`,severity:"error"})}}if($.hydration){if($.hydration.mode!==void 0){let X=["progressive","islands"];if(!X.includes($.hydration.mode))Z.push({path:"hydration.mode",message:`hydration.mode must be one of: ${X.join(", ")}`,severity:"error"})}if($.hydration.preload!==void 0){let X=["none","eager","lazy"];if(!X.includes($.hydration.preload))Z.push({path:"hydration.preload",message:`hydration.preload must be one of: ${X.join(", ")}`,severity:"error"})}}if($.customDirectives)if(!Array.isArray($.customDirectives))Z.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else $.customDirectives.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if($.middleware)if(!Array.isArray($.middleware))Z.push({path:"middleware",message:"middleware must be an array",severity:"error"});else $.middleware.forEach((X,J)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if($.debug===!0&&$.cache===!0)Y.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if($.seo?.enabled===!0&&!$.seo?.defaultConfig?.title)Y.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if($.pwa){if($.pwa.enabled===!0&&!$.pwa.manifest?.name)Z.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if($.pwa.manifest?.display!==void 0){let X=["fullscreen","standalone","minimal-ui","browser"];if(!X.includes($.pwa.manifest.display))Z.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.manifest?.orientation!==void 0){let X=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!X.includes($.pwa.manifest.orientation))Z.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.routes){let X=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];$.pwa.routes.forEach((J,Q)=>{if(!J.pattern||typeof J.pattern!=="string")Z.push({path:`pwa.routes[${Q}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(J.strategy))Z.push({path:`pwa.routes[${Q}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))Z.push({path:`pwa.routes[${Q}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))Z.push({path:`pwa.routes[${Q}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if($.pwa.icons?.sizes){if(!Array.isArray($.pwa.icons.sizes))Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if($.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)Z.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if($.pwa.icons?.purpose){let X=["any","maskable","monochrome"];if($.pwa.icons.purpose.filter((Q)=>!X.includes(Q)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var t1,QX,I5=null,GX,G7=null,e5;var w1=b(()=>{c7();i7();n7();o7();m3();LY();F6();V6();T6();u$();YX();t1={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:l2,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:ZX,hasEndTag:!1,description:"Include a web component in the template"},N8,A8,eY,$X,M8,I8,D8,T8,S8,C8,FY,O6,...L6],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}};QX=new Set;GX=new Map;e5=new Proxy(t1,{get($,Z){if(I5&&Z in I5)return I5[Z];if(!G7)D1().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import K0 from"path";import{hasLocalConfig as Aj}from"bunfig";function q7($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function E6($,Z){if(e1.has($))e1.delete($);else if(e1.size>=UX)e1.delete(e1.keys().next().value);e1.set($,Z)}function Mj($){let Z=q7($);if(D5.has(Z))D5.delete(Z);else if(D5.size>=UX)D5.delete(D5.keys().next().value);return D5.set(Z,$),Z}async function Tj($){if(!b1)return null;try{let Z=Bun.file(K0.join(b1,`cw-${q7($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function Ij($,Z){if(!b1)return;try{if(!fs.existsSync(b1))fs.mkdirSync(b1,{recursive:!0});await Bun.write(K0.join(b1,`cw-${q7($)}.css`),Z)}catch{}}async function zX($){try{let Z=await import($);if(Z&&Z.CSSGenerator)return{CSSGenerator:Z.CSSGenerator,config:Z.config,build:Z.build,defaultConfig:Z.defaultConfig,extractClasses:Z.extractClasses}}catch{}return null}function Dj(){let $=[],Z=process.cwd();while(Z!==K0.dirname(Z))$.push(K0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(K0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(K0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(K0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(K0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(K0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=K0.dirname(Z);return $}function Ej(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[K0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),K0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),K0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),K0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),K0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),K0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(K0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(K0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function kj(){if(WX)return j1;WX=!0;try{let $=async(J)=>{for(let Q of J){if(!await Bun.file(Q).exists())continue;let G=await zX(Q);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${w0.green}[Crosswind]${w0.reset} CSS engine loaded from ${K0.dirname(K0.dirname(Q))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let J=K0.resolve(process.env.CROSSWIND_SRC),Q=await $([J]);if(!Q)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return j1=Q,j1}let Z=await $(Dj());if(Z)return j1=Z,j1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Y){let Q=await zX(J);if(Q){if(j1=Q,!process.env.STACKS_DEV_QUIET)console.log(`${w0.green}[Crosswind]${w0.reset} CSS engine loaded`);return j1}}let X=await $(Ej());if(X)return j1=X,j1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${w0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${w0.reset}`),console.warn(`${w0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${w0.reset}`),null}}async function bj($){try{if(!Aj({name:"crosswind",cwd:$}))return null;let{loadConfigWithResult:Z}=await import("bunfig"),Y=await Z({name:"crosswind",cwd:$,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Y?.path||!Y.config||Object.keys(Y.config).length===0)return null;let X=K0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${w0.green}[Crosswind]${w0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${w0.yellow}[Crosswind]${w0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function Sj($){let Z=new Set,Y=/class\s*=\s*["']([^"']+)["']/gi,X=Y.exec($);while(X!==null){for(let G of X[1].split(/\s+/))if(G.trim())Z.add(G.trim());X=Y.exec($)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,Q=J.exec($);while(Q!==null){let G=Q[1].match(/'([^']+)'/g);if(G){for(let K of G)for(let q of K.slice(1,-1).split(/\s+/))if(q.trim())Z.add(q.trim())}Q=J.exec($)}return Z}async function yj($,Z){try{let Y=await kj();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):Sj($);if(X.size===0)return"";let J=Z?K0.resolve(Z):process.cwd();if(!b1)b1=n5(J,"cache");let Q=[...X].sort().join(" "),G=`${D6||"default"}::${Q}`,K=e1.get(G);if(K!==void 0)return E6(G,K),K;let q=await Tj(G);if(q!==null)return E6(G,q),q;if(!K7){let w=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (w1(),qX)),N=await R(J);if(N.css)if(typeof N.css==="string"){let A=K0.isAbsolute(N.css)?N.css:K0.resolve(J,N.css);if(await Bun.file(A).exists()){let M=await import(A);w=M.default||M,console.log(`${w0.green}[Crosswind]${w0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(w={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let A=K0.isAbsolute(N.css.config)?N.css.config:K0.resolve(J,N.css.config);if(await Bun.file(A).exists()){let M=await import(A);w={...M.default||M,...w}}}console.log(`${w0.green}[Crosswind]${w0.reset} Using inline CSS config from stx.config.ts`)}}catch{}K7=w||await bj(J);try{D6=q7(JSON.stringify(K7??{}))}catch{D6="unhashable"}}let W=Y.defaultConfig||Y.config,z=K7||{},U=F8(W,z),{safelist:j,includePreflight:H,minify:B}=U,_=U.config,O=new Y.CSSGenerator(_);for(let w of j)O.generate(w);for(let w of X)O.generate(w);let F=O.toCSS(H,B),L=_.shortcuts||z.shortcuts||{};for(let[w,R]of Object.entries(L)){if(!X.has(w)&&!j.includes(w))continue;let N=R.split(/\s+/).filter(Boolean);for(let A of N)O.generate(A)}F=O.toCSS(H,B);let V=F.split(`
10769
10769
  `);for(let[w,R]of Object.entries(L)){if(!X.has(w)&&!j.includes(w))continue;let N=R.split(/\s+/).filter(Boolean),A=[],M=[];for(let I of N){let T=I.startsWith("dark:"),P=`.${(T?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<V.length;y++){let S=V[y].trim();if(S===`${P} {`||S.startsWith(`${P} {`)){let C=y,x="";while(C<V.length){if(x+=V[C],V[C].includes("}"))break;C++}let d=x.match(/\{([^}]+)\}/);if(d)if(T)M.push(d[1].trim());else A.push(d[1].trim());break}}}if(A.length)F+=`
10770
10770
  .${w} { ${A.join(" ")} }`;if(M.length)F+=`
10771
- @media (prefers-color-scheme: dark) { .dark .${w} { ${M.join(" ")} } }`}return E6(G,F),Tj(G,F),F}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function UX($,Z,Y=!1){let X=await Sj($,Z);if(!X)return $;let J=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${Aj(X)}.css">`:`<style data-crosswind="generated">
10771
+ @media (prefers-color-scheme: dark) { .dark .${w} { ${M.join(" ")} } }`}return E6(G,F),Ij(G,F),F}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function jX($,Z,Y=!1){let X=await yj($,Z);if(!X)return $;let J=Y?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${Mj(X)}.css">`:`<style data-crosswind="generated">
10772
10772
  ${X}
10773
10773
  </style>`,Q=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(Q.test($)){let G=!1;return $.replace(Q,()=>{if(G)return"";return G=!0,J})}if($.includes("</head>"))return $.replace("</head>",`${J}
10774
10774
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
10775
- ${J}`);return J+$}var j1=null,qX=!1,K7=null,zX=256,e1,D5,b1=null,D6=null;var jX=b(()=>{u$();w8();e1=new Map,D5=new Map});function BX(){return`
10775
+ ${J}`);return J+$}var j1=null,WX=!1,K7=null,UX=256,e1,D5,b1=null,D6=null;var BX=b(()=>{u$();w8();e1=new Map,D5=new Map});function HX(){return`
10776
10776
  // STX Lifecycle Runtime
10777
10777
  (function() {
10778
10778
  if (typeof window === 'undefined') return;
@@ -11117,7 +11117,7 @@ else {
11117
11117
 
11118
11118
  console.log('[stx] Lifecycle runtime initialized');
11119
11119
  })();
11120
- `}function k6($){return Symbol($)}var xN,fN,gN;var HX=b(()=>{xN=k6("theme"),fN=k6("router"),gN=k6("i18n")});import*as OX from"crypto";function _X($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function yj(){return`stx-${OX.randomBytes(4).toString("hex")}`}function Pj($){return/\$\w+\./.test($)}function Cj($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,J=$;return J=J.replace(X,(Q,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let W=[],z=!1,U=K,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,H=[...K.matchAll(j)];for(let O of H){let F=O[0],L=O[1],V=O[2];if(Pj(V)){z=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(W.push({attr:L,expr:R,fullMatch:F,originalAttr:L}),_X(R).forEach((A)=>Y.add(A)),L==="text")U=U.replace(F,"");else if(L==="class")U=U.replace(F,'class=""');else if(L==="disabled"||L==="hidden")U=U.replace(F,"");else U=U.replace(F,`${L}=""`)}}}if(!z)return Q;let B=U.match(/\bid\s*=\s*"([^"]+)"/),_;if(B)_=B[1];else _=yj(),U=` id="${_}"${U}`;for(let O of W)Z.push({elementId:_,attribute:O.attr,expression:O.expr,stores:_X(O.expr)});return`<${G}${U}${q}`}),{html:J,bindings:Z,stores:Y}}function vj($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
11120
+ `}function k6($){return Symbol($)}var fN,gN,hN;var _X=b(()=>{fN=k6("theme"),gN=k6("router"),hN=k6("i18n")});import*as FX from"crypto";function OX($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function Pj(){return`stx-${FX.randomBytes(4).toString("hex")}`}function Cj($){return/\$\w+\./.test($)}function vj($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,J=$;return J=J.replace(X,(Q,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return Q;let W=[],z=!1,U=K,j=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,H=[...K.matchAll(j)];for(let O of H){let F=O[0],L=O[1],V=O[2];if(Cj(V)){z=!0;let w=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(w){let R=w[1];if(W.push({attr:L,expr:R,fullMatch:F,originalAttr:L}),OX(R).forEach((A)=>Y.add(A)),L==="text")U=U.replace(F,"");else if(L==="class")U=U.replace(F,'class=""');else if(L==="disabled"||L==="hidden")U=U.replace(F,"");else U=U.replace(F,`${L}=""`)}}}if(!z)return Q;let B=U.match(/\bid\s*=\s*"([^"]+)"/),_;if(B)_=B[1];else _=Pj(),U=` id="${_}"${U}`;for(let O of W)Z.push({elementId:_,attribute:O.attr,expression:O.expr,stores:OX(O.expr)});return`<${G}${U}${q}`}),{html:J,bindings:Z,stores:Y}}function xj($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
11121
11121
  <script>
11122
11122
  (function() {
11123
11123
  'use strict';
@@ -11275,10 +11275,10 @@ else {
11275
11275
  }
11276
11276
  })();
11277
11277
  </script>
11278
- `,X}function FX($){let{html:Z,bindings:Y,stores:X}=Cj($);if(Y.length===0)return $;let J=vj(Y,X),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+J+Z.slice(Q);return Z+J}var LX=()=>{};function xj($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return fj(Z);case"google-analytics":return gj(Z);case"plausible":return hj(Z);case"self-hosted":return mj(Z);case"custom":return dj(Z);default:return""}}function fj($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",J=[`data-site="${h0(Z.siteId)}"`];if(Z.honorDnt)J.push('data-honor-dnt="true"');if(Z.spa)J.push('data-spa="auto"');if(Z.canonical)J.push(`data-canonical="${h0(Z.canonical)}"`);if(Z.auto===!1)J.push('data-auto="false"');return`
11278
+ `,X}function LX($){let{html:Z,bindings:Y,stores:X}=vj($);if(Y.length===0)return $;let J=xj(Y,X),Q=Z.lastIndexOf("</body>");if(Q!==-1)return Z.slice(0,Q)+J+Z.slice(Q);return Z+J}var VX=()=>{};function fj($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return gj(Z);case"google-analytics":return hj(Z);case"plausible":return mj(Z);case"self-hosted":return dj(Z);case"custom":return uj(Z);default:return""}}function gj($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",J=[`data-site="${m0(Z.siteId)}"`];if(Z.honorDnt)J.push('data-honor-dnt="true"');if(Z.spa)J.push('data-spa="auto"');if(Z.canonical)J.push(`data-canonical="${m0(Z.canonical)}"`);if(Z.auto===!1)J.push('data-auto="false"');return`
11279
11279
  <!-- Fathom Analytics -->
11280
- <script src="${h0(Y)}" ${J.join(" ")}${X}></script>
11281
- `}function gj($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=h0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
11280
+ <script src="${m0(Y)}" ${J.join(" ")}${X}></script>
11281
+ `}function hj($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=m0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
11282
11282
  <!-- Google Analytics -->
11283
11283
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
11284
11284
  <script>
@@ -11288,10 +11288,10 @@ else {
11288
11288
  gtag('config', '${Y}');
11289
11289
  ${X}
11290
11290
  </script>
11291
- `}function hj($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${h0(Z.domain)}"`],J=Y,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&Y==="https://plausible.io/js/script.js")J=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
11291
+ `}function mj($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${m0(Z.domain)}"`],J=Y,Q=[];if(Z.trackLocalhost)Q.push("local");if(Z.hashMode)Q.push("hash");if(Q.length>0&&Y==="https://plausible.io/js/script.js")J=`https://plausible.io/js/script.${Q.join(".")}.js`;return`
11292
11292
  <!-- Plausible Analytics -->
11293
- <script defer data-domain="${h0(Z.domain)}" src="${h0(J)}"></script>
11294
- `}function mj($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=h0(Z.siteId),X=h0(Z.apiEndpoint),J=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
11293
+ <script defer data-domain="${m0(Z.domain)}" src="${m0(J)}"></script>
11294
+ `}function dj($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=m0(Z.siteId),X=m0(Z.apiEndpoint),J=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",Q=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
11295
11295
  d.addEventListener('click',function(e){
11296
11296
  var a=e.target.closest('a');
11297
11297
  if(a&&a.hostname!==location.hostname){
@@ -11324,15 +11324,15 @@ else {
11324
11324
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
11325
11325
  })();
11326
11326
  </script>
11327
- `}function dj($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
11327
+ `}function uj($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
11328
11328
  <!-- Custom Analytics -->
11329
11329
  <script>
11330
11330
  ${Z.inlineScript}
11331
11331
  </script>
11332
- `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${h0(Z.scriptId)}"`);if(Z.attributes)for(let[J,Q]of Object.entries(Z.attributes))Y.push(`${h0(J)}="${h0(Q)}"`);return`
11332
+ `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${m0(Z.scriptId)}"`);if(Z.attributes)for(let[J,Q]of Object.entries(Z.attributes))Y.push(`${m0(J)}="${m0(Q)}"`);return`
11333
11333
  <!-- Custom Analytics -->
11334
- <script${Y.length>0?` ${Y.join(" ")}`:""} src="${h0(Z.scriptUrl)}" defer></script>
11335
- `}function VX($,Z){let Y=xj(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}return $.replace("</head>",`${Y}</head>`)}function h0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var wX=()=>{};function RX($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function NX($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}function AX($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function pj($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[J,Q,G]=X,K=X.index,q=AX(G,"x-data");if(!q)continue;let W=`__stx_scope_${TX++}`,z=AX(G,"x-init"),U=lj($,Q,K+J.length),j=$.slice(K,U.endIndex),H=cj(j);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:z,bindings:[],refs:H})}return Z}function lj($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J,K.lastIndex=J;let q=Q.exec($),W=G.exec($),z=K.exec($);if(z&&z.index<(q?.index??1/0)){J=z.index+z[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)X++,J=q.index+q[0].length;else{if(X--,X===0)return{endIndex:W.index+W[0].length};J=W.index+W[0].length}}return{endIndex:$.length}}function cj($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=X.exec(Y))!==null){let[,Q,G]=J,K=ij(Q);Z.set(G,K)}return Z}function ij($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${uj++}`}function nj(){return`
11334
+ <script${Y.length>0?` ${Y.join(" ")}`:""} src="${m0(Z.scriptUrl)}" defer></script>
11335
+ `}function wX($,Z){let Y=fj(Z);if(!Y)return $;if(!$.includes("</head>")){let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}return $.replace("</head>",`${Y}</head>`)}function m0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var RX=()=>{};function NX($){let Z=$.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!Z)return null;try{return Function(`return ${Z[1]}`)()}catch{return null}}function AX($){let Z=$?.layout;if(Z===!1)return!1;return typeof Z==="string"&&Z.trim()?Z.trim():void 0}function MX($,Z){let Y=$.match(new RegExp(`${Z}\\s*=\\s*"([^"]*)"`,"i"));if(Y)return Y[1];let X=$.match(new RegExp(`${Z}\\s*=\\s*'([^']*)'`,"i"));if(X)return X[1];return null}function lj($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[J,Q,G]=X,K=X.index,q=MX(G,"x-data");if(!q)continue;let W=`__stx_scope_${IX++}`,z=MX(G,"x-init"),U=cj($,Q,K+J.length),j=$.slice(K,U.endIndex),H=ij(j);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:z,bindings:[],refs:H})}return Z}function cj($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J,K.lastIndex=J;let q=Q.exec($),W=G.exec($),z=K.exec($);if(z&&z.index<(q?.index??1/0)){J=z.index+z[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)X++,J=q.index+q[0].length;else{if(X--,X===0)return{endIndex:W.index+W[0].length};J=W.index+W[0].length}}return{endIndex:$.length}}function ij($){let Z=new Map,Y=$.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),X=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=X.exec(Y))!==null){let[,Q,G]=J,K=nj(Q);Z.set(G,K)}return Z}function nj($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${pj++}`}function oj(){return`
11336
11336
  // STX Reactive Runtime - x-cloak and transition CSS
11337
11337
  (function() {
11338
11338
  var style = document.createElement('style');
@@ -11539,7 +11539,7 @@ window.__stx_reactive = (function() {
11539
11539
 
11540
11540
  return { initScope: initScope, reactive: reactive };
11541
11541
  })();
11542
- `}function MX($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(K,q)=>{try{let W=p0(q,Z,!0);if(W===void 0)return K;return String(W)}catch{return K}}),X="",J=0,Q=null;while(J<Y.length){let K=Y[J];if(Q&&K==="\\"){X+=K+(Y[J+1]??""),J+=2;continue}if(K==="{"&&Y[J+1]==="{"){let q=Y.indexOf("}}",J+2);if(q!==-1){let W=Y.slice(J,q+2);X+=G(Y.slice(J+2,q),W,Q),J=q+2;continue}}if(Q){if(K===Q)Q=null}else if(K==="'"||K==='"'||K==="`")Q=K;X+=K,J++}return X;function G(K,q,W){let z;try{z=p0(K,Z,!0)}catch{return q}if(z===void 0)return q;if(W){let U=String(z).replace(/\\/g,"\\\\").replace(new RegExp(W==="`"?"`":W,"g"),`\\${W}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return W==="`"?U.replace(/\$\{/g,"\\${"):U}if(typeof z==="string"){let U=z.trim();if(U.startsWith("{")&&U.endsWith("}")||U.startsWith("[")&&U.endsWith("]"))try{return JSON.parse(U),U}catch{}}return JSON.stringify(z)}}function oj($,Z){if($.length===0)return"";let Y=$.map((X)=>{let J=JSON.stringify(Object.fromEntries(X.refs)),Q=MX(X.stateExpr,Z),G=X.initExpr?MX(X.initExpr,Z):null,K=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
11542
+ `}function TX($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(K,q)=>{try{let W=C0(q,Z,!0);if(W===void 0)return K;return String(W)}catch{return K}}),X="",J=0,Q=null;while(J<Y.length){let K=Y[J];if(Q&&K==="\\"){X+=K+(Y[J+1]??""),J+=2;continue}if(K==="{"&&Y[J+1]==="{"){let q=Y.indexOf("}}",J+2);if(q!==-1){let W=Y.slice(J,q+2);X+=G(Y.slice(J+2,q),W,Q),J=q+2;continue}}if(Q){if(K===Q)Q=null}else if(K==="'"||K==='"'||K==="`")Q=K;X+=K,J++}return X;function G(K,q,W){let z;try{z=C0(K,Z,!0)}catch{return q}if(z===void 0)return q;if(W){let U=String(z).replace(/\\/g,"\\\\").replace(new RegExp(W==="`"?"`":W,"g"),`\\${W}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return W==="`"?U.replace(/\$\{/g,"\\${"):U}if(typeof z==="string"){let U=z.trim();if(U.startsWith("{")&&U.endsWith("}")||U.startsWith("[")&&U.endsWith("]"))try{return JSON.parse(U),U}catch{}}return JSON.stringify(z)}}function sj($,Z){if($.length===0)return"";let Y=$.map((X)=>{let J=JSON.stringify(Object.fromEntries(X.refs)),Q=TX(X.stateExpr,Z),G=X.initExpr?TX(X.initExpr,Z):null,K=JSON.stringify(Q),q=G?JSON.stringify(G):"null";return`
11543
11543
  (function() {
11544
11544
  var scopeEl = document.querySelector('${X.selector}');
11545
11545
  if (!scopeEl) return;
@@ -11548,14 +11548,14 @@ window.__stx_reactive = (function() {
11548
11548
  })();`}).join(`
11549
11549
  `);return`
11550
11550
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
11551
- ${nj()}
11551
+ ${oj()}
11552
11552
  ${Y}
11553
- </script>`}function IX($,Z,Y){if(TX=0,!rj($))return $;let X=pj($);if(X.length===0)return $;let J=sj($,X),Q=oj(X,Z),G=J.lastIndexOf("</body>");if(G!==-1)J=J.slice(0,G)+Q+`
11554
- `+J.slice(G);else J+=Q;return J}function sj($,Z){let Y=0,X=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,Q,G)=>{let K=Z[Y++];if(!K)return J;let q=/data-stx-scope="([^"]*)"/.exec(G);if(q)return K.id=q[1],K.selector=`[data-stx-scope="${K.id}"]`,J;return`<${Q} data-stx-scope="${K.id}"${G}>`});return X=X.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),X=X.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),X=X.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),X=X.replace(/\s*x-init\s*=\s*'[^']*'/g,""),X}function rj($){return/x-data\s*=\s*["']/.test($)}var TX=0,uj=0;var DX=b(()=>{Y1()});import aj from"fs";import b6 from"path";import{createHighlighter as tj}from"ts-syntax-highlighter";async function ej($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await aj.promises.stat($)).mtime.getTime();if(Z.cache&&S6.has($)){let U=S6.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let J=await Bun.file($).text(),{data:Q,content:G}=x8(J),K=Z.markdown||e5.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=s5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await $B(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:W,data:Q||{}};if(Z.cache)S6.set($,{...z,updatedAt:X});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:z0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function $B($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!W7)try{W7=await tj({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let J=async(K,q,W,z)=>{let U=z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=W||(Y?"text":"");if(!j)return K;try{if(!W7.getSupportedLanguages().includes(j))return K;return(await W7.highlight(U,j,{theme:Z})).html}catch(H){console.error(`Error highlighting code block with language ${W}:`,H)}return K},Q=$,G=$.matchAll(X);for(let K of G){let[q,W,z,U]=K,j=await J(q,W,z,U);Q=Q.replace(q,j)}return Q}async function EX($,Z,Y="",X={}){return await ZB($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let z=K;if(!b6.isAbsolute(K))z=b6.resolve(b6.dirname(Y),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of L){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),N=V.substring(w+1).trim(),A=N.startsWith('"')&&N.endsWith('"'),M=N.startsWith("'")&&N.endsWith("'");if(A||M)N=N.substring(1,N.length-1);U[R]=N}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:j,data:H}=await ej(z,X),B={...Z,...H,...U},_=j,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(F,L)=>{let V=L.trim();return B[V]!==void 0?String(B[V]):F}),_}catch(z){let U=z instanceof Error?z.message:String(z);return z0("Markdown File",`Error including markdown file: ${U}`,Y,$,W,G)}})}async function ZB($,Z,Y){let X=[],J;while((J=Z.exec($))!==null){let K=J[0],q=J.index,W=J;X.push(Y(...W).then((z)=>({match:K,replacement:z,index:q})))}let Q=await Promise.all(X);Q.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of Q)G=G.replace(K,()=>q);return G}var S6,W7=null;var kX=b(()=>{w1();R0();S6=new Map});function S1($,Z){try{let Y=$.trim();if(Q0(Y))return G0(Y,Object.keys(Z))(...Object.values(Z));else return Z0(Y,Z)}catch{return!1}}var bX=b(()=>{F0()});function YB($,Z,Y){let X=$,J=!0;while(J){J=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=R3(X,G);if(!K)break;try{let q;if(Q0(K.expression))q=G0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Z0(K.expression,Z);let W="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)W=U.content.trim()}else try{let j;if(U.value&&Q0(U.value))j=G0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=Z0(U.value,Z);if(q===j){W=U.content.trim(),z=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),J=!0}catch(q){let W=q instanceof Error?q.message:String(q),z=$0("Switch",`Error evaluating @switch expression: ${W}`,s.EVALUATION_ERROR);X=X.substring(0,G)+z+X.substring(K.end);break}}return X}function XB($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function JB($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Y,X)=>Z[Number(X)]??Y)}function $5($,Z,Y){let{masked:X,scripts:J}=XB($);return JB(QB(X,Z,Y),J)}function QB($,Z,Y){let X=$;X=YB(X,Z,Y);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=I1(X,K+7);if(!q)break;let W=q.endPos,z=i1(X,"unless","endunless",W);if(z===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=X.slice(W,z),j=q.expression,H=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,V=[],w;while((w=O.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=L.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((R,N)=>R.pos-N.pos);for(let R of V)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){H=R.pos;break}}let B;if(H!==-1){let _=U.slice(0,H),O=U.slice(H+5);B=`@if (${j})${O}@else ${_}@endif`}else B=`@if (!(${j}))${U}@endif`;X=X.substring(0,K)+B+X.substring(z+10),Q=!0}}X=P6(X,Z,Y),X=C6(X,Z,Y),X=y6(X,Z);let J=()=>{let Q=U$(X);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let q="",W=!1;for(let z of K.branches){if(W)break;if(z.type==="else")q=z.content,W=!0;else try{let U;if(z.condition&&Q0(z.condition))U=G0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Z0(z.condition,Z);if(U)q=z.content,W=!0}catch(U){q=$0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),z=$0("If",`Error processing @if block: ${W}`,s.EVALUATION_ERROR);X=X.substring(0,K.start)+z+X.substring(K.end)}}return!0};while(!0){let Q=X;if(!J())break;if(X===Q)break}return X}function SX($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let J=$[Z];if(J==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(J===Y){Z++;break}X.push(J),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function y6($,Z){let Y=$;function X(K,q,W,z){let U=1,j=z,H=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g");while(j<K.length&&U>0){H.lastIndex=j,B.lastIndex=j;let _=H.exec(K),O=B.exec(K),F=_?_.index:1/0,L=O?O.index:1/0;if(F<L)U++,j=F+_[0].length;else if(L<1/0){if(U--,U===0)return L;j=L+O[0].length}else break}return-1}function J(K,q,W){let z=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g"),H=/@else(?![a-z])/g,B=[],_;while((_=U.exec(K))!==null)B.push({pos:_.index,type:"open"});while((_=j.exec(K))!==null)B.push({pos:_.index,type:"close"});while((_=H.exec(K))!==null)B.push({pos:_.index,type:"else"});B.sort((O,F)=>O.pos-F.pos);for(let O of B)if(O.type==="open")z++;else if(O.type==="close")z--;else if(O.type==="else"&&z===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,j=Y.slice(W+5),H=SX(j);if(H)z=H.value,U=W+5+H.consumed;else U=W+5;let B=X(Y,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=Y.slice(U,B),O=J(_,"auth","endauth"),F;if(!Z.auth)F=!1;else F=z?S1(`auth?.check && auth?.user?.[${z}]`,Z):S1("auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,W)+L+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,j=Y.slice(W+6),H=SX(j);if(H)z=H.value,U=W+6+H.consumed;else U=W+6;let B=X(Y,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=Y.slice(U,B),O=J(_,"guest","endguest"),F;if(!Z.auth)F=!0;else F=z?S1(`!auth?.check || !auth?.user?.[${z}]`,Z):S1("!auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,W)+L+Y.substring(B+9),K=!0}}function Q(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(q)z.push(q);if(W){let U=S1(W,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let j=U.index,H=Y.slice(j+`@${K}`.length),B=G(H);if(!B)break;let _=j+`@${K}`.length+B.paramsEnd,O=X(Y,K,q,_);if(O===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(_,O),L=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),A=/@else(?![a-z])/g,M=[],I;while((I=w.exec(F))!==null)M.push({pos:I.index,type:"open"});while((I=R.exec(F))!==null)M.push({pos:I.index,type:"close"});while((I=N.exec(F))!==null)M.push({pos:I.index,type:"elseDirective"});while((I=A.exec(F))!==null)M.push({pos:I.index,type:"else"});M.sort((S,C)=>S.pos-C.pos);for(let S of M){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)L.push(S)}let T=[],k=0;for(let S=0;S<L.length;S++){let C=L[S];if(T.push({content:F.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let x=F.slice(C.pos+`@${W}`.length),d=G(x);if(d){T[T.length-1]={content:F.slice(k,C.pos)},k=C.pos+`@${W}`.length+d.paramsEnd,T.push({content:"",ability:d.ability,type:d.type,id:d.id}),T.pop();let u=L[S+1],X0=u?u.pos:F.length;T.push({content:F.slice(k,X0),ability:d.ability,type:d.type,id:d.id}),k=X0}}else k=C.pos+5}if(k<F.length){let S=T[T.length-1];if(L.length>0&&L[L.length-1].type==="else")T.push({content:F.slice(k),isFinalElse:!0});else if(T.length===0)T.push({content:F.slice(k)})}let D=Q(B.ability,B.type,B.id),P=K==="can"?D:!D,y="";if(P)y=T[0]?.content||"";else{let S=!1;for(let C=1;C<T.length;C++){let x=T[C];if(x.isFinalElse){y=x.content,S=!0;break}if(x.ability){let d=Q(x.ability,x.type,x.id);if(K==="can"?d:!d){y=x.content,S=!0;break}}}if(!S&&T.length>0){let C=T[T.length-1];if(C.isFinalElse)y=C.content}}Y=Y.substring(0,j)+y+Y.substring(O+`@${q}`.length),z=!0}}return Y}function P6($,Z,Y){let X=$;function J(Q,G,K,q,W){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),j=Q.match(U);if(!j||j.index===void 0)break;let H=j.index,B=I1(Q,H+`@${G}`.length);if(!B)break;let _=B.endPos,O=i1(Q,G,K,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${H} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(_,O),L=B.expression,V=-1,w=0,R=0;while(R<F.length){let N=F.indexOf("@",R);if(N===-1)break;let A=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,R=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,R=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){V=N;break}R=N+1}try{let N=q(L.trim()),A;if(V!==-1){let M=F.slice(0,V),I=F.slice(V+5);A=N?M:I}else A=N?F:"";Q=Q.substring(0,H)+A+Q.substring(O+`@${K}`.length),z=!0}catch(N){let A=N instanceof Error?N.message:String(N),M=$0(W,`Error processing @${G} directive: ${A}`,s.EVALUATION_ERROR);Q=Q.substring(0,H)+M+Q.substring(O+`@${K}`.length);break}}return Q}return X=J(X,"isset","endisset",(Q)=>{let G=S1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=J(X,"empty","endempty",(Q)=>{let G=S1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function C6($,Z,Y){let X=$,J="development";function Q(G,K,q,W){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),H=new RegExp(`^@${q}(?![a-z])`),B=G,_=!0;while(_){_=!1,z.lastIndex=0;let O=z.exec(B);if(!O)break;let F=O.index,L=F+O[0].length;if(K==="env"){let D=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;L+=D[0].length,W=J===D[2]}let V=1,w=L,R=-1;while(V>0&&w<B.length){z.lastIndex=w,U.lastIndex=w;let D=z.exec(B),P=U.exec(B),y=D?D.index:1/0,S=P?P.index:1/0;if(y<S)V++,w=y+D[0].length;else if(S<1/0){if(V--,V===0){R=S;break}w=S+P[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=B.substring(L,R),A=-1,M=0,I=0;while(I<N.length){let D=N.indexOf("@",I);if(D===-1)break;let P=N.substring(D);if(j.test(P)){M++,I=D+1;continue}if(H.test(P)){M--,I=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(P)){A=D;break}I=D+1}let T;if(A!==-1){let D=N.slice(0,A),P=N.slice(A+5);T=W?D:P}else T=W?N:"";let k=`@${q}`.length;B=B.substring(0,F)+T+B.substring(R+k),_=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",J==="production"),X=Q(X,"development","enddevelopment",J==="development"),X=Q(X,"staging","endstaging",J==="staging"),X=Q(X,"testing","endtesting",J==="testing"),X}var z7=b(()=>{bX();U1();Q4();F0()});function PX($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function U7($,Z){if(!$)return Z?.nonceGenerator?.()??PX();let Y=yX.get($);if(!Y)Y=Z?.nonceGenerator?.()??PX(),yX.set($,Y);return Y}function GB($,Z){let Y=[];for(let[X,J]of Object.entries($)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Y.push(X);continue}if(Array.isArray(J)){let Q=[...J];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${X} ${Q.join(" ")}`)}}return Y.join("; ")}function CX($,Z){return`<meta http-equiv="Content-Security-Policy" content="${GB($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function vX($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?U7(Y,Z):void 0,J=CX(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
11555
- ${J}`)}function xX($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<script nonce="${Z}"${J}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<style nonce="${Z}"${J}>`}),Y}function fX($,Z,Y,X){let J=$,Q=X.csp;if(J=J.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?U7(Z,Q):void 0;return CX(Q.directives,G)}),J=J.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return U7(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=U7(Z,Q);return J}var yX;var gX=b(()=>{yX=new WeakMap});import KB from"crypto";function WB($=qB){let Z=KB.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return v6=Z,Z}function zB(){if(!v6)WB();return v6}function UB($=hX){let Z=zB();return`<input type="hidden" name="${$}" value="${Z}">`}function mX($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return UB(X||hX)})}var qB=40,hX="_token",v6=null;var dX=()=>{};async function uX($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let J=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)J=await jB(J,Q,Z,Y,X);else J=await BB(J,Q,Z,Y,X)}return J}async function jB($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=`@${Q}`,q=`@end${Q}`,W=$,z=L5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],j=z.exec(W);while(j!==null){let[H,B="",_=""]=j,O=j.index||0;try{let F=B?pX(B):[],L=_.trim(),V=await G(L,F,Y,X);U.push({original:H,processed:V,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(J.debug)console.error(`Error processing custom directive @${Q}:`,F);U.push({original:H,processed:$0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${L}`,s.EVALUATION_ERROR),startIndex:O})}j=z.exec(W)}for(let H=U.length-1;H>=0;H--){let{original:B,processed:_}=U[H];W=W.replace(B,_)}return W}async function BB($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=$,q=L5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],z=q.exec(K);while(z!==null){let[H,B=""]=z,_=z.index||0;try{let O=pX(B),F=await G("",O,Y,X);W.push({original:H,processed:F,startIndex:_})}catch(O){let F=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${Q}:`,O);W.push({original:H,processed:$0("CustomDirective",`Error in @${Q}(${B}): ${F}`,s.EVALUATION_ERROR),startIndex:_})}z=q.exec(K)}let U=L5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=U.exec(K);while(j!==null){let[H]=j,B=j.index||0;try{let _=await G("",[],Y,X);W.push({original:H,processed:_,startIndex:B})}catch(_){let O=_ instanceof Error?_.message:String(_);if(J.debug)console.error(`Error processing custom directive @${Q}:`,_);W.push({original:H,processed:$0("CustomDirective",`Error in @${Q}: ${O}`,s.EVALUATION_ERROR),startIndex:B})}j=U.exec(K)}for(let H=W.length-1;H>=0;H--){let{original:B,processed:_}=W[H];K=K.replace(B,_)}return K}function pX($){if(!$.trim())return[];let Z=[],Y="",X=!1,J="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,J=G;else if(G===J)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var lX=b(()=>{U1();V5()});function Z5($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function _B($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,X=Z.colorMode;if(Z5(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(Z5(Y.key,"appearance.key"),Z5(Y.attribute,"appearance.attribute"),Z5(Y.default,"appearance.default"),Z5(X.key,"colorMode.key"),Z5(X.attribute,"colorMode.attribute"),Z5(X.default,"colorMode.default"),!iX.test(Y.key)||!iX.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!cX.test(Y.attribute)||!cX.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!HB.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function OB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function FB($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${OB($)};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($,Z){let Y=1,X=null,J=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(J){J=!1;continue}if(X){if(G==="\\")J=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function nX($,Z){let Y=$,X=/@appearanceBootstrap\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index+J[0].length-1,G=LB(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),q=Z0(`(${K})`,Z),W=FB(_B(q));Y=Y.slice(0,J.index)+W+Y.slice(G+1),X.lastIndex=J.index+W.length}return Y}var cX,iX,HB;var oX=b(()=>{F0();cX=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,iX=/^[A-Za-z_$][\w$]*$/,HB=new Set(["light","dark","system"])});import VB from"crypto";function H0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function j7($,Z,Y,X){let J=$||Z;return Y?`${J} ${X}`:J}function l0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function E5($,Z){if(/\bid\s*=/i.test($))return"";return` id="${H0(Z)}"`}function x6($,Z,Y){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(Y))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Y))X+=` aria-describedby="${H0(`${l0($)}-error`)}"`;return X}function wB(){return VB.randomUUID()}function B7($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=wB();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${H0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,J)=>{let Q=J.toUpperCase();if(J&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${H0(Q)}">`;return X}),Y}function aX($,Z,Y=rX){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,Q,G,K,q,W="")=>{let z=Q||G||"POST",U=K||q||"",j=y1(W),H=z.toUpperCase(),B=["GET","POST"].includes(H)?H:"POST",_=`<form method="${H0(B)}" action="${H0(U)}"${j?` ${j}`:""}>`;if(_+=`
11553
+ </script>`}function DX($,Z,Y){if(IX=0,!aj($))return $;let X=lj($);if(X.length===0)return $;let J=rj($,X),Q=sj(X,Z),G=J.lastIndexOf("</body>");if(G!==-1)J=J.slice(0,G)+Q+`
11554
+ `+J.slice(G);else J+=Q;return J}function rj($,Z){let Y=0,X=$.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,Q,G)=>{let K=Z[Y++];if(!K)return J;let q=/data-stx-scope="([^"]*)"/.exec(G);if(q)return K.id=q[1],K.selector=`[data-stx-scope="${K.id}"]`,J;return`<${Q} data-stx-scope="${K.id}"${G}>`});return X=X.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),X=X.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),X=X.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),X=X.replace(/\s*x-init\s*=\s*'[^']*'/g,""),X}function aj($){return/x-data\s*=\s*["']/.test($)}var IX=0,pj=0;var EX=b(()=>{Y1()});import tj from"fs";import b6 from"path";import{createHighlighter as ej}from"ts-syntax-highlighter";async function $B($,Z={}){try{if(!await c($))throw Error(`Markdown file not found: ${$}`);let X=(await tj.promises.stat($)).mtime.getTime();if(Z.cache&&S6.has($)){let U=S6.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let J=await Bun.file($).text(),{data:Q,content:G}=x8(J),K=Z.markdown||e5.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=s5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await ZB(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:W,data:Q||{}};if(Z.cache)S6.set($,{...z,updatedAt:X});return z}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:z0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function ZB($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!W7)try{W7=await ej({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let J=async(K,q,W,z)=>{let U=z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),j=W||(Y?"text":"");if(!j)return K;try{if(!W7.getSupportedLanguages().includes(j))return K;return(await W7.highlight(U,j,{theme:Z})).html}catch(H){console.error(`Error highlighting code block with language ${W}:`,H)}return K},Q=$,G=$.matchAll(X);for(let K of G){let[q,W,z,U]=K,j=await J(q,W,z,U);Q=Q.replace(q,j)}return Q}async function kX($,Z,Y="",X={}){return await YB($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let z=K;if(!b6.isAbsolute(K))z=b6.resolve(b6.dirname(Y),K);let U={};if(q)try{try{U=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let L=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of L){let w=V.indexOf(":");if(w>0){let R=V.substring(0,w).trim(),N=V.substring(w+1).trim(),A=N.startsWith('"')&&N.endsWith('"'),M=N.startsWith("'")&&N.endsWith("'");if(A||M)N=N.substring(1,N.length-1);U[R]=N}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:j,data:H}=await $B(z,X),B={...Z,...H,...U},_=j,O=/\{\{([^}]+)\}\}/g;return _=_.replace(O,(F,L)=>{let V=L.trim();return B[V]!==void 0?String(B[V]):F}),_}catch(z){let U=z instanceof Error?z.message:String(z);return z0("Markdown File",`Error including markdown file: ${U}`,Y,$,W,G)}})}async function YB($,Z,Y){let X=[],J;while((J=Z.exec($))!==null){let K=J[0],q=J.index,W=J;X.push(Y(...W).then((z)=>({match:K,replacement:z,index:q})))}let Q=await Promise.all(X);Q.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of Q)G=G.replace(K,()=>q);return G}var S6,W7=null;var bX=b(()=>{w1();R0();S6=new Map});function S1($,Z){try{let Y=$.trim();if(Q0(Y))return G0(Y,Object.keys(Z))(...Object.values(Z));else return Z0(Y,Z)}catch{return!1}}var SX=b(()=>{F0()});function XB($,Z,Y){let X=$,J=!0;while(J){J=!1;let Q=X.match(/@switch\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=R3(X,G);if(!K)break;try{let q;if(Q0(K.expression))q=G0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Z0(K.expression,Z);let W="",z=!1;for(let U of K.cases)if(U.type==="default"){if(!z)W=U.content.trim()}else try{let j;if(U.value&&Q0(U.value))j=G0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)j=Z0(U.value,Z);if(q===j){W=U.content.trim(),z=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),J=!0}catch(q){let W=q instanceof Error?q.message:String(q),z=$0("Switch",`Error evaluating @switch expression: ${W}`,s.EVALUATION_ERROR);X=X.substring(0,G)+z+X.substring(K.end);break}}return X}function JB($){let Z=[];return{masked:$.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(X)=>{return Z.push(X),`\x00stx-script-${Z.length-1}\x00`}),scripts:Z}}function QB($,Z){if(Z.length===0)return $;return $.replace(/\u0000stx-script-(\d+)\u0000/g,(Y,X)=>Z[Number(X)]??Y)}function $5($,Z,Y){let{masked:X,scripts:J}=JB($);return QB(GB(X,Z,Y),J)}function GB($,Z,Y){let X=$;X=XB(X,Z,Y);{let Q=!0;while(Q){Q=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=I1(X,K+7);if(!q)break;let W=q.endPos,z=i1(X,"unless","endunless",W);if(z===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let U=X.slice(W,z),j=q.expression,H=-1;{let _=0,O=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,V=[],w;while((w=O.exec(U))!==null)V.push({pos:w.index,type:"open"});while((w=F.exec(U))!==null)V.push({pos:w.index,type:"close"});while((w=L.exec(U))!==null)V.push({pos:w.index,type:"else"});V.sort((R,N)=>R.pos-N.pos);for(let R of V)if(R.type==="open")_++;else if(R.type==="close")_--;else if(R.type==="else"&&_===0){H=R.pos;break}}let B;if(H!==-1){let _=U.slice(0,H),O=U.slice(H+5);B=`@if (${j})${O}@else ${_}@endif`}else B=`@if (!(${j}))${U}@endif`;X=X.substring(0,K)+B+X.substring(z+10),Q=!0}}X=P6(X,Z,Y),X=C6(X,Z,Y),X=y6(X,Z);let J=()=>{let Q=U$(X);if(Q.length===0)return!1;for(let G=Q.length-1;G>=0;G--){let K=Q[G];try{let q="",W=!1;for(let z of K.branches){if(W)break;if(z.type==="else")q=z.content,W=!0;else try{let U;if(z.condition&&Q0(z.condition))U=G0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Z0(z.condition,Z);if(U)q=z.content,W=!0}catch(U){q=$0(z.type==="if"?"If":"Elseif",`Error in @${z.type}(${z.condition}): ${U instanceof Error?U.message:String(U)}`,s.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),z=$0("If",`Error processing @if block: ${W}`,s.EVALUATION_ERROR);X=X.substring(0,K.start)+z+X.substring(K.end)}}return!0};while(!0){let Q=X;if(!J())break;if(X===Q)break}return X}function yX($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let J=$[Z];if(J==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(J===Y){Z++;break}X.push(J),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function y6($,Z){let Y=$;function X(K,q,W,z){let U=1,j=z,H=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g");while(j<K.length&&U>0){H.lastIndex=j,B.lastIndex=j;let _=H.exec(K),O=B.exec(K),F=_?_.index:1/0,L=O?O.index:1/0;if(F<L)U++,j=F+_[0].length;else if(L<1/0){if(U--,U===0)return L;j=L+O[0].length}else break}return-1}function J(K,q,W){let z=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g"),H=/@else(?![a-z])/g,B=[],_;while((_=U.exec(K))!==null)B.push({pos:_.index,type:"open"});while((_=j.exec(K))!==null)B.push({pos:_.index,type:"close"});while((_=H.exec(K))!==null)B.push({pos:_.index,type:"else"});B.sort((O,F)=>O.pos-F.pos);for(let O of B)if(O.type==="open")z++;else if(O.type==="close")z--;else if(O.type==="else"&&z===0)return O.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,j=Y.slice(W+5),H=yX(j);if(H)z=H.value,U=W+5+H.consumed;else U=W+5;let B=X(Y,"auth","endauth",U);if(B===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let _=Y.slice(U,B),O=J(_,"auth","endauth"),F;if(!Z.auth)F=!1;else F=z?S1(`auth?.check && auth?.user?.[${z}]`,Z):S1("auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,W)+L+Y.substring(B+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,j=Y.slice(W+6),H=yX(j);if(H)z=H.value,U=W+6+H.consumed;else U=W+6;let B=X(Y,"guest","endguest",U);if(B===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let _=Y.slice(U,B),O=J(_,"guest","endguest"),F;if(!Z.auth)F=!0;else F=z?S1(`!auth?.check || !auth?.user?.[${z}]`,Z):S1("!auth?.check",Z);let L;if(O!==-1){let V=_.slice(0,O),w=_.slice(O+5);L=F?V:w}else L=F?_:"";Y=Y.substring(0,W)+L+Y.substring(B+9),K=!0}}function Q(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(q)z.push(q);if(W){let U=S1(W,Z);z.push(U)}return Z.permissions.check(...z)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",z=!0;while(z){z=!1;let U=Y.match(new RegExp(`@${K}\\s*\\(`));if(!U||U.index===void 0)break;let j=U.index,H=Y.slice(j+`@${K}`.length),B=G(H);if(!B)break;let _=j+`@${K}`.length+B.paramsEnd,O=X(Y,K,q,_);if(O===-1){console.warn(`[stx] @${K} directive at position ${j} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(_,O),L=[],V=0,w=new RegExp(`@${K}\\s*\\(`,"g"),R=new RegExp(`@${q}(?![a-z])`,"g"),N=new RegExp(`@${W}\\s*\\(`,"g"),A=/@else(?![a-z])/g,M=[],I;while((I=w.exec(F))!==null)M.push({pos:I.index,type:"open"});while((I=R.exec(F))!==null)M.push({pos:I.index,type:"close"});while((I=N.exec(F))!==null)M.push({pos:I.index,type:"elseDirective"});while((I=A.exec(F))!==null)M.push({pos:I.index,type:"else"});M.sort((S,C)=>S.pos-C.pos);for(let S of M){if(S.type==="open"){V++;continue}if(S.type==="close"){V--;continue}if(V===0)L.push(S)}let T=[],k=0;for(let S=0;S<L.length;S++){let C=L[S];if(T.push({content:F.slice(k,C.pos),ability:void 0}),C.type==="elseDirective"){let x=F.slice(C.pos+`@${W}`.length),d=G(x);if(d){T[T.length-1]={content:F.slice(k,C.pos)},k=C.pos+`@${W}`.length+d.paramsEnd,T.push({content:"",ability:d.ability,type:d.type,id:d.id}),T.pop();let u=L[S+1],X0=u?u.pos:F.length;T.push({content:F.slice(k,X0),ability:d.ability,type:d.type,id:d.id}),k=X0}}else k=C.pos+5}if(k<F.length){let S=T[T.length-1];if(L.length>0&&L[L.length-1].type==="else")T.push({content:F.slice(k),isFinalElse:!0});else if(T.length===0)T.push({content:F.slice(k)})}let D=Q(B.ability,B.type,B.id),P=K==="can"?D:!D,y="";if(P)y=T[0]?.content||"";else{let S=!1;for(let C=1;C<T.length;C++){let x=T[C];if(x.isFinalElse){y=x.content,S=!0;break}if(x.ability){let d=Q(x.ability,x.type,x.id);if(K==="can"?d:!d){y=x.content,S=!0;break}}}if(!S&&T.length>0){let C=T[T.length-1];if(C.isFinalElse)y=C.content}}Y=Y.substring(0,j)+y+Y.substring(O+`@${q}`.length),z=!0}}return Y}function P6($,Z,Y){let X=$;function J(Q,G,K,q,W){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),j=Q.match(U);if(!j||j.index===void 0)break;let H=j.index,B=I1(Q,H+`@${G}`.length);if(!B)break;let _=B.endPos,O=i1(Q,G,K,_);if(O===-1){console.warn(`[stx] @${G} directive at position ${H} has no matching @${K} \u2014 the block was skipped.`);break}let F=Q.slice(_,O),L=B.expression,V=-1,w=0,R=0;while(R<F.length){let N=F.indexOf("@",R);if(N===-1)break;let A=F.substring(N);if(/^@(?:if|unless|isset|empty)\s*\(/.test(A)){w++,R=N+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(A)){w--,R=N+1;continue}if(w===0&&/^@else(?![a-z])/.test(A)){V=N;break}R=N+1}try{let N=q(L.trim()),A;if(V!==-1){let M=F.slice(0,V),I=F.slice(V+5);A=N?M:I}else A=N?F:"";Q=Q.substring(0,H)+A+Q.substring(O+`@${K}`.length),z=!0}catch(N){let A=N instanceof Error?N.message:String(N),M=$0(W,`Error processing @${G} directive: ${A}`,s.EVALUATION_ERROR);Q=Q.substring(0,H)+M+Q.substring(O+`@${K}`.length);break}}return Q}return X=J(X,"isset","endisset",(Q)=>{let G=S1(Q,Z);return G!==void 0&&G!==null},"Isset"),X=J(X,"empty","endempty",(Q)=>{let G=S1(Q,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function C6($,Z,Y){let X=$,J="development";function Q(G,K,q,W){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),j=new RegExp(`^@${K}(?![a-z])`),H=new RegExp(`^@${q}(?![a-z])`),B=G,_=!0;while(_){_=!1,z.lastIndex=0;let O=z.exec(B);if(!O)break;let F=O.index,L=F+O[0].length;if(K==="env"){let D=B.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;L+=D[0].length,W=J===D[2]}let V=1,w=L,R=-1;while(V>0&&w<B.length){z.lastIndex=w,U.lastIndex=w;let D=z.exec(B),P=U.exec(B),y=D?D.index:1/0,S=P?P.index:1/0;if(y<S)V++,w=y+D[0].length;else if(S<1/0){if(V--,V===0){R=S;break}w=S+P[0].length}else break}if(R===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let N=B.substring(L,R),A=-1,M=0,I=0;while(I<N.length){let D=N.indexOf("@",I);if(D===-1)break;let P=N.substring(D);if(j.test(P)){M++,I=D+1;continue}if(H.test(P)){M--,I=D+1;continue}if(M===0&&/^@else(?![a-z])/.test(P)){A=D;break}I=D+1}let T;if(A!==-1){let D=N.slice(0,A),P=N.slice(A+5);T=W?D:P}else T=W?N:"";let k=`@${q}`.length;B=B.substring(0,F)+T+B.substring(R+k),_=!0}return B}return X=Q(X,"env","endenv",!1),X=Q(X,"production","endproduction",J==="production"),X=Q(X,"development","enddevelopment",J==="development"),X=Q(X,"staging","endstaging",J==="staging"),X=Q(X,"testing","endtesting",J==="testing"),X}var z7=b(()=>{SX();U1();Q4();F0()});function CX($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function U7($,Z){if(!$)return Z?.nonceGenerator?.()??CX();let Y=PX.get($);if(!Y)Y=Z?.nonceGenerator?.()??CX(),PX.set($,Y);return Y}function KB($,Z){let Y=[];for(let[X,J]of Object.entries($)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Y.push(X);continue}if(Array.isArray(J)){let Q=[...J];if(Z&&(X==="script-src"||X==="style-src"))Q=Q.filter((G)=>!G.startsWith("'nonce-")),Q.push(`'nonce-${Z}'`);if(Q.length>0)Y.push(`${X} ${Q.join(" ")}`)}}return Y.join("; ")}function vX($,Z){return`<meta http-equiv="Content-Security-Policy" content="${KB($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function xX($,Z,Y){if(!Z.enabled||!Z.addMetaTag)return $;if($.includes('http-equiv="Content-Security-Policy"'))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let X=Z.useNonce?U7(Y,Z):void 0,J=vX(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
11555
+ ${J}`)}function fX($,Z){let Y=$;return Y=Y.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<script nonce="${Z}"${J}>`}),Y=Y.replace(/<style([^>]*)>/gi,(X,J)=>{if(J.includes("nonce="))return X;return`<style nonce="${Z}"${J}>`}),Y}function gX($,Z,Y,X){let J=$,Q=X.csp;if(J=J.replace(/@csp\b/g,()=>{if(!Q?.enabled||!Q.directives)return"<!-- CSP not configured -->";let G=Q.useNonce?U7(Z,Q):void 0;return vX(Q.directives,G)}),J=J.replace(/@cspNonce\b/g,()=>{if(!Q?.enabled||!Q.useNonce)return"";return U7(Z,Q)}),Q?.enabled&&Q.useNonce)Z.cspNonce=U7(Z,Q);return J}var PX;var hX=b(()=>{PX=new WeakMap});import qB from"crypto";function zB($=WB){let Z=qB.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return v6=Z,Z}function UB(){if(!v6)zB();return v6}function jB($=mX){let Z=UB();return`<input type="hidden" name="${$}" value="${Z}">`}function dX($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return jB(X||mX)})}var WB=40,mX="_token",v6=null;var uX=()=>{};async function pX($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let J=$;for(let Q of X.customDirectives){if(!Q.name||typeof Q.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",Q);continue}if(Q.hasEndTag)J=await BB(J,Q,Z,Y,X);else J=await HB(J,Q,Z,Y,X)}return J}async function BB($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=`@${Q}`,q=`@end${Q}`,W=$,z=L5(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],j=z.exec(W);while(j!==null){let[H,B="",_=""]=j,O=j.index||0;try{let F=B?lX(B):[],L=_.trim(),V=await G(L,F,Y,X);U.push({original:H,processed:V,startIndex:O})}catch(F){let L=F instanceof Error?F.message:String(F);if(J.debug)console.error(`Error processing custom directive @${Q}:`,F);U.push({original:H,processed:$0("CustomDirective",`Error in @${Q}${B?`(${B})`:""}: ${L}`,s.EVALUATION_ERROR),startIndex:O})}j=z.exec(W)}for(let H=U.length-1;H>=0;H--){let{original:B,processed:_}=U[H];W=W.replace(B,_)}return W}async function HB($,Z,Y,X,J){let{name:Q,handler:G}=Z,K=$,q=L5(`@${Q}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],z=q.exec(K);while(z!==null){let[H,B=""]=z,_=z.index||0;try{let O=lX(B),F=await G("",O,Y,X);W.push({original:H,processed:F,startIndex:_})}catch(O){let F=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${Q}:`,O);W.push({original:H,processed:$0("CustomDirective",`Error in @${Q}(${B}): ${F}`,s.EVALUATION_ERROR),startIndex:_})}z=q.exec(K)}let U=L5(`@${Q}(?!\\w)(?!\\s*\\()`,"g"),j=U.exec(K);while(j!==null){let[H]=j,B=j.index||0;try{let _=await G("",[],Y,X);W.push({original:H,processed:_,startIndex:B})}catch(_){let O=_ instanceof Error?_.message:String(_);if(J.debug)console.error(`Error processing custom directive @${Q}:`,_);W.push({original:H,processed:$0("CustomDirective",`Error in @${Q}: ${O}`,s.EVALUATION_ERROR),startIndex:B})}j=U.exec(K)}for(let H=W.length-1;H>=0;H--){let{original:B,processed:_}=W[H];K=K.replace(B,_)}return K}function lX($){if(!$.trim())return[];let Z=[],Y="",X=!1,J="";for(let Q=0;Q<$.length;Q++){let G=$[Q];if((G==='"'||G==="'")&&(Q===0||$[Q-1]!=="\\"))if(!X)X=!0,J=G;else if(G===J)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((Q)=>{let G=Q.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var cX=b(()=>{U1();V5()});function Z5($,Z){if(typeof $!=="string"||$.length===0)throw Error(`@appearanceBootstrap ${Z} must be a non-empty string`)}function OB($){if(!$||typeof $!=="object"||Array.isArray($))throw Error("@appearanceBootstrap expects an options object");let Z=$,Y=Z.appearance,X=Z.colorMode;if(Z5(Z.storageKey,"storageKey"),!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap appearance must be an object");if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap colorMode must be an object");if(Z5(Y.key,"appearance.key"),Z5(Y.attribute,"appearance.attribute"),Z5(Y.default,"appearance.default"),Z5(X.key,"colorMode.key"),Z5(X.attribute,"colorMode.attribute"),Z5(X.default,"colorMode.default"),!nX.test(Y.key)||!nX.test(X.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!iX.test(Y.attribute)||!iX.test(X.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Y.allowed)||Y.allowed.length===0||Y.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Y.allowed.includes(Y.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!_B.has(X.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:Z.storageKey,appearance:{key:Y.key,attribute:Y.attribute,allowed:[...new Set(Y.allowed)],default:Y.default},colorMode:{key:X.key,attribute:X.attribute,default:X.default}}}function FB($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function LB($){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${FB($)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function VB($,Z){let Y=1,X=null,J=!1;for(let Q=Z+1;Q<$.length;Q++){let G=$[Q];if(J){J=!1;continue}if(X){if(G==="\\")J=!0;else if(G===X)X=null;continue}if(G==='"'||G==="'"||G==="`"){X=G;continue}if(G==="(")Y++;else if(G===")"&&--Y===0)return Q}return-1}function oX($,Z){let Y=$,X=/@appearanceBootstrap\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index+J[0].length-1,G=VB(Y,Q);if(G===-1)throw Error("@appearanceBootstrap has an unclosed options object");let K=Y.slice(Q+1,G).trim(),q=Z0(`(${K})`,Z),W=LB(OB(q));Y=Y.slice(0,J.index)+W+Y.slice(G+1),X.lastIndex=J.index+W.length}return Y}var iX,nX,_B;var sX=b(()=>{F0();iX=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,nX=/^[A-Za-z_$][\w$]*$/,_B=new Set(["light","dark","system"])});import wB from"crypto";function H0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function j7($,Z,Y,X){let J=$||Z;return Y?`${J} ${X}`:J}function l0($){return String($).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function E5($,Z){if(/\bid\s*=/i.test($))return"";return` id="${H0(Z)}"`}function x6($,Z,Y){if(!Z)return"";let X="";if(!/\baria-invalid\s*=/i.test(Y))X+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Y))X+=` aria-describedby="${H0(`${l0($)}-error`)}"`;return X}function RB(){return wB.randomUUID()}function B7($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=RB();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${H0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,J)=>{let Q=J.toUpperCase();if(J&&!["GET","POST"].includes(Q))return`<input type="hidden" name="_method" value="${H0(Q)}">`;return X}),Y}function tX($,Z,Y=aX){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,Q,G,K,q,W="")=>{let z=Q||G||"POST",U=K||q||"",j=y1(W),H=z.toUpperCase(),B=["GET","POST"].includes(H)?H:"POST",_=`<form method="${H0(B)}" action="${H0(U)}"${j?` ${j}`:""}>`;if(_+=`
11556
11556
  ${B7("@csrf",Z)}`,!["GET","POST"].includes(H))_+=`
11557
- ${B7(`@method('${H}')`,Z)}`;return _}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,Q,G,K,q,W="")=>{let z=Q||G||"",U=K||q||"",j=y1(W),H=w$(z,Z),B=H!==void 0&&H!==null?H:U||"",_=j.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",F=R$(z,Z),L=j.match(/class=['"]([^'"]+)['"]/i),V=j7(L?L[1]:"",Y.input,F,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${H0(O)}" name="${H0(z)}"${E5(j,l0(z))} value="${H0(B)}" class="${V}"${x6(z,F,j)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,Q,G="",K="")=>{let q=y1(G),W=w$(Q,Z)||K.trim(),z=R$(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),j=j7(U?U[1]:"",Y.input,z,Y.inputError),H=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${H0(Q)}"${E5(q,l0(Q))} class="${j}"${x6(Q,z,q)}${H?` ${H}`:""}>${H0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,Q,G="",K)=>{let q=y1(G),W=w$(Q,Z),z=R$(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),j=j7(U?U[1]:"",Y.input,z,Y.inputError),H=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(W!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${H0(Q)}"${E5(q,l0(Q))} class="${j}"${x6(Q,z,q)}${H?` ${H}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let q=G===void 0?"1":G,W=G===void 0?l0(Q):`${l0(Q)}-${l0(q)}`,z=y1(K),U=w$(Q,Z),j=U!==void 0&&(Array.isArray(U)?U.some((O)=>String(O)===q):U===!0||String(U)===q),H=z.match(/class=['"]([^'"]+)['"]/i),B=H?H[1]:Y.checkInput,_=z.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${H0(Q)}"${E5(z,W)} value="${H0(q)}" class="${B}"${j?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let q=y1(K),W=w$(Q,Z),z=W!==void 0&&W===G,U=q.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,H=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${H0(Q)}"${E5(q,`${l0(Q)}-${l0(G)}`)} value="${H0(G)}" class="${j}"${z?" checked":""}${H?` ${H}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="")=>{let K=y1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",z=K.includes("multiple"),U=R$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),H=j7(j?j[1]:"",Y.input,U,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${H0(Q)}"${E5(K,l0(Q))}`,`class="${H}"`];if(W)_.push(`accept="${H0(W)}"`);if(z)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,Q,G="",K)=>{let q=y1(G),W=q.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:Y.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${H0(l0(Q))}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),X}function tX($,Z,Y=rX){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,J,Q)=>{try{if(R$(J,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(K,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return sX(J,Z);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(J);return sX(J,Z)}let W=q.trim();if(Q0(W)){let z=Z0(W,Z);return z!==void 0?String(z):W}return W}catch{return q}});return`<div id="${H0(`${l0(J)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function R$($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function sX($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function w$($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function y1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=X.exec(Y))!==null){let[,Q,,G]=J;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var rX;var eX=b(()=>{F0();rX={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import h6 from"path";async function RB(){if(N$!==void 0)return N$;try{N$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{N$=null}return N$}function NB($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function AB($,Z){if({...u6,...Z.i18n}.cache&&m6[$]){let J=m6[$],Q=Z.i18n?.cacheMaxAge??0;if(!NB(J,Q))return J.translations}if(A$[$]?.state==="loading")return A$[$].promise;f6[$]="loading";let X=d6($,Z).then((J)=>{return f6[$]="loaded",delete A$[$],J}).catch((J)=>{throw f6[$]="error",A$[$]={promise:X,state:"error",error:J instanceof Error?J:Error(String(J))},J});return A$[$]={promise:X,state:"loading"},X}async function d6($,Z){let Y={...u6,...Z.i18n},X=h6.isAbsolute(Y.translationsDir)?Y.translationsDir:h6.resolve(Z.root||process.cwd(),Y.translationsDir);try{let J=await RB(),Q=J?await J($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:EB(Y.format)}):await MB($,Y,X);if(Q===void 0){if($!==Y.defaultLocale)return d6(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)m6[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(J){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,J);if($!==Y.defaultLocale)return d6(Y.defaultLocale,Z);return{}}}async function MB($,Z,Y){let X=h6.join(Y,`${$}${TB(Z.format)}`);try{let J=await import(X);return J.default||J}catch(J){try{let Q=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return IB(Q);if(Z.format==="json")return JSON.parse(Q);throw J}catch{return}}}function TB($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function IB($){let Z={},Y=$.split(`
11558
- `),X=[{obj:Z,indent:-1}];for(let J of Y){let Q=J.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,z]=q,U=W.trim(),j=z.trim();if(j==="")K[U]={},X.push({obj:K[U],indent:G});else K[U]=DB(j)}}return Z}function DB($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function EB($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function kB($,Z){return AB($,Z)}function bB($,Z){for(let Y of $){let X=Y.trim(),J=X.match(/^\{(\d+)\}\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10);if(Z===G)return J[2];continue}let Q=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function SB($,Z={}){return YJ($,Z)}function YJ($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let J=yB($,X);if(J===-1){Y+=$[X],X++;continue}let Q=$.slice(X+1,J);Y+=PB(Q,Z),X=J+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function yB($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function PB($,Z){let Y=CB($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),J=Z[X];if(Y.length===1)return J!==void 0?String(J):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return vB(J,Y.slice(2).join(","),Z);case"select":return fB(J,Y.slice(2).join(","));case"selectordinal":return gB(J,Y.slice(2).join(","));case"number":return mB(J,Y[2]?.trim());case"date":return dB(J,Y[2]?.trim());case"time":return uB(J,Y[2]?.trim());default:return J!==void 0?String(J):`{${$}}`}}function CB($){let Z=[],Y="",X=0;for(let J=0;J<$.length;J++){let Q=$[J];if(Q==="{")X++,Y+=Q;else if(Q==="}")X--,Y+=Q;else if(Q===","&&X===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function vB($,Z,Y){let X=Number($)||0,J=p6(Z),Q=`=${X}`;if(J[Q])return g6(J[Q],X,Y);let G=xB(X);if(J[G])return g6(J[G],X,Y);if(J.other)return g6(J.other,X,Y);return String(X)}function g6($,Z,Y){let X=$.replace(/#/g,String(Z));return YJ(X,Y)}function xB($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function fB($,Z){let Y=String($||""),X=p6(Z);if(X[Y])return X[Y];return X.other||String($)}function gB($,Z){let Y=Number($)||0,X=p6(Z),J=hB(Y);if(X[J])return X[J].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function hB($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function p6($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function mB($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function dB($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function uB($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function pB($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function $J($,Z,Y=!0,X={}){let J=$.split("."),Q=Z;for(let K of J){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(pB(G))return SB(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=bB(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function XJ($,Z,Y,X){let J=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...u6,...X.i18n},K=await kB(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,J=await ZJ(J,Q,async(z,U,j,H,B)=>{try{let _={};if(j)try{let F=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return O0(j,Z)}];for(let L of F)try{if(_=L(),Object.keys(_).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return $J(U,K,G.fallbackToKey,_)||H.trim()}catch(_){if(X.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${U}'): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...J.matchAll(q)];console.warn(`Found ${z.length} @translate matches`),z.forEach((U,j)=>console.warn(`Match ${j}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return J=await ZJ(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,U,j,H)=>{try{let B={};if(j)try{let _=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return O0(j,Z)}];for(let O of _)try{if(B=O(),Object.keys(B).length>0)break}catch{}}catch(_){if(X.debug)console.error("Error parsing parameters for @translate directive:",_)}return $J(U,K,G.fallbackToKey,B)}catch(B){if(X.debug)console.error("Error processing @translate directive:",B);return $0("Translate",`Error in @translate('${U}'): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR)}}),J}async function ZJ($,Z,Y){let X=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((q)=>({match:Q,replacement:q}));return X.push(K),Q}),(await Promise.all(X)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var N$,u6,m6,A$,f6;var JJ=b(()=>{U1();F0();u6={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},m6={},A$={},f6={}});var i6={};o(i6,{streamingSuspenseDirective:()=>KJ,streamToResponse:()=>ZH,streamTemplateSimple:()=>aB,streamTemplate:()=>cB,renderStreamingPage:()=>nB,registerStreamingDirectives:()=>eB,processStreamDirectives:()=>sB,processSectionDirectives:()=>$H,islandDirective:()=>qJ,generateHydrationRuntime:()=>YH,extractStreamBoundaries:()=>rB,createStreamRenderer:()=>tB,buildSuspenseResolveScript:()=>c6,SUSPENSE_RESOLVER_RUNTIME:()=>GJ});import H7 from"path";function lB($){let Z=[],Y=0,X;QJ.lastIndex=0;while((X=QJ.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let J=X[1],Q=X[2];Z.push({type:"suspense",name:J,content:Q}),Y=X.index+X[0].length}if(Y<$.length){let J=$.slice(Y);if(J.trim())Z.push({type:Z.length===0?"shell":"content",content:J})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function cB($,Z={},Y={}){let X={...t1,...Y,streaming:{...l6,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:H7.dirname($)};if(q.trim())await c1(q,z,$);let U=lB(W),j=new Set;if(!U.some((B)=>B.type==="suspense")){let B=X.streaming?.strategy||"auto",_=new RegExp(Y5.source,"g");if(!(B!=="manual"&&_.test(W))){let F=await N0(W,z,$,X,j);for(let L=0;L<F.length;L+=J)Q.enqueue(F.slice(L,L+J)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],L=new RegExp(Y5.source,"g"),V;while((V=L.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let R of F){if(R.start>w){let A=W.slice(w,R.start);if(A.trim()){let M=await N0(A,z,$,X,j);Q.enqueue(M),await new Promise((I)=>setTimeout(I,0))}}let N=await N0(R.content,z,$,X,j);Q.enqueue(N),await new Promise((A)=>setTimeout(A,0)),w=R.end}if(w<W.length){let R=W.slice(w);if(R.trim()){let N=await N0(R,z,$,X,j);Q.enqueue(N)}}}}else{let B=new Map;for(let O of U)if(O.type==="shell"||O.type==="content"){let F=await N0(O.content,z,$,X,j);Q.enqueue(F)}else if(O.type==="suspense"&&O.name){let F=`stx-suspense-${O.name}`;Q.enqueue(`<div id="${F}" data-suspense="${O.name}" style="display:contents;">
11557
+ ${B7(`@method('${H}')`,Z)}`;return _}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,Q,G,K,q,W="")=>{let z=Q||G||"",U=K||q||"",j=y1(W),H=w$(z,Z),B=H!==void 0&&H!==null?H:U||"",_=j.match(/type=['"]([^'"]+)['"]/i),O=_?_[1]:"text",F=R$(z,Z),L=j.match(/class=['"]([^'"]+)['"]/i),V=j7(L?L[1]:"",Y.input,F,Y.inputError),w=j.replace(/class=['"][^'"]+['"]/i,"");return w=w.replace(/type=['"][^'"]+['"]/i,""),`<input type="${H0(O)}" name="${H0(z)}"${E5(j,l0(z))} value="${H0(B)}" class="${V}"${x6(z,F,j)}${w?` ${w}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,Q,G="",K="")=>{let q=y1(G),W=w$(Q,Z)||K.trim(),z=R$(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),j=j7(U?U[1]:"",Y.input,z,Y.inputError),H=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${H0(Q)}"${E5(q,l0(Q))} class="${j}"${x6(Q,z,q)}${H?` ${H}`:""}>${H0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,Q,G="",K)=>{let q=y1(G),W=w$(Q,Z),z=R$(Q,Z),U=q.match(/class=['"]([^'"]+)['"]/i),j=j7(U?U[1]:"",Y.input,z,Y.inputError),H=q.replace(/class=['"][^'"]+['"]/i,""),B=K;if(W!==void 0)B=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,O,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!O.includes("selected"))return O.replace(/(<option)/,"$1 selected");return _});return`<select name="${H0(Q)}"${E5(q,l0(Q))} class="${j}"${x6(Q,z,q)}${H?` ${H}`:""}>${B}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let q=G===void 0?"1":G,W=G===void 0?l0(Q):`${l0(Q)}-${l0(q)}`,z=y1(K),U=w$(Q,Z),j=U!==void 0&&(Array.isArray(U)?U.some((O)=>String(O)===q):U===!0||String(U)===q),H=z.match(/class=['"]([^'"]+)['"]/i),B=H?H[1]:Y.checkInput,_=z.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${H0(Q)}"${E5(z,W)} value="${H0(q)}" class="${B}"${j?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G,K="")=>{let q=y1(K),W=w$(Q,Z),z=W!==void 0&&W===G,U=q.match(/class=['"]([^'"]+)['"]/i),j=U?U[1]:Y.checkInput,H=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${H0(Q)}"${E5(q,`${l0(Q)}-${l0(G)}`)} value="${H0(G)}" class="${j}"${z?" checked":""}${H?` ${H}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,Q,G="")=>{let K=y1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",z=K.includes("multiple"),U=R$(Q,Z),j=K.match(/class=['"]([^'"]+)['"]/i),H=j7(j?j[1]:"",Y.input,U,Y.inputError),B=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${H0(Q)}"${E5(K,l0(Q))}`,`class="${H}"`];if(W)_.push(`accept="${H0(W)}"`);if(z)_.push("multiple");if(B)_.push(B);return`${_.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,Q,G="",K)=>{let q=y1(G),W=q.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:Y.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${H0(l0(Q))}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),X}function eX($,Z,Y=aX){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,J,Q)=>{try{if(R$(J,Z)){let G=Q.replace(/\{\{([^}]+)\}\}/g,(K,q)=>{try{if(q.trim()==="$message"||q.trim()==="message")return rX(J,Z);if(q.trim().includes("errors.first")||q.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(J);return rX(J,Z)}let W=q.trim();if(Q0(W)){let z=Z0(W,Z);return z!==void 0?String(z):W}return W}catch{return q}});return`<div id="${H0(`${l0(J)}-error`)}" role="alert">${G}</div>`}return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function R$($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function rX($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function w$($,Z){let Y;if(Z.old&&typeof Z.old==="function")return Z.old($);if(Z.old&&typeof Z.old==="object")return Z.old[$];if($.endsWith("[]")){let X=$.slice(0,-2);if(Y=Z[X],Y!==void 0)return Y}return Z[$]}function y1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=X.exec(Y))!==null){let[,Q,,G]=J;Z.push(`${Q}="${G.trim()}"`)}return Z.join(" ")}var aX;var $J=b(()=>{F0();aX={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import h6 from"path";async function NB(){if(N$!==void 0)return N$;try{N$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{N$=null}return N$}function AB($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function MB($,Z){if({...u6,...Z.i18n}.cache&&m6[$]){let J=m6[$],Q=Z.i18n?.cacheMaxAge??0;if(!AB(J,Q))return J.translations}if(A$[$]?.state==="loading")return A$[$].promise;f6[$]="loading";let X=d6($,Z).then((J)=>{return f6[$]="loaded",delete A$[$],J}).catch((J)=>{throw f6[$]="error",A$[$]={promise:X,state:"error",error:J instanceof Error?J:Error(String(J))},J});return A$[$]={promise:X,state:"loading"},X}async function d6($,Z){let Y={...u6,...Z.i18n},X=h6.isAbsolute(Y.translationsDir)?Y.translationsDir:h6.resolve(Z.root||process.cwd(),Y.translationsDir);try{let J=await NB(),Q=J?await J($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:kB(Y.format)}):await TB($,Y,X);if(Q===void 0){if($!==Y.defaultLocale)return d6(Y.defaultLocale,Z);return{}}let G=Q;if(Y.cache)m6[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(J){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,J);if($!==Y.defaultLocale)return d6(Y.defaultLocale,Z);return{}}}async function TB($,Z,Y){let X=h6.join(Y,`${$}${IB(Z.format)}`);try{let J=await import(X);return J.default||J}catch(J){try{let Q=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return DB(Q);if(Z.format==="json")return JSON.parse(Q);throw J}catch{return}}}function IB($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function DB($){let Z={},Y=$.split(`
11558
+ `),X=[{obj:Z,indent:-1}];for(let J of Y){let Q=J.replace(/#.*$/,"").trimEnd();if(!Q.trim())continue;let G=Q.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=Q.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,z]=q,U=W.trim(),j=z.trim();if(j==="")K[U]={},X.push({obj:K[U],indent:G});else K[U]=EB(j)}}return Z}function EB($){if($.startsWith("'")&&$.endsWith("'")||$.startsWith('"')&&$.endsWith('"'))return $.slice(1,-1);let Z=$.toLowerCase();if(Z==="true"||Z==="yes")return!0;if(Z==="false"||Z==="no")return!1;if(Z==="null"||Z==="~")return null;let Y=Number($);if(!Number.isNaN(Y)&&$!=="")return Y;return $}function kB($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function bB($,Z){return MB($,Z)}function SB($,Z){for(let Y of $){let X=Y.trim(),J=X.match(/^\{(\d+)\}\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10);if(Z===G)return J[2];continue}let Q=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10),K=Q[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(Q[2],10);if(Z>=G&&Z<=K)return Q[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function yB($,Z={}){return XJ($,Z)}function XJ($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let J=PB($,X);if(J===-1){Y+=$[X],X++;continue}let Q=$.slice(X+1,J);Y+=CB(Q,Z),X=J+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function PB($,Z){let Y=0;for(let X=Z;X<$.length;X++)if($[X]==="{")Y++;else if($[X]==="}"){if(Y--,Y===0)return X}return-1}function CB($,Z){let Y=vB($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),J=Z[X];if(Y.length===1)return J!==void 0?String(J):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return xB(J,Y.slice(2).join(","),Z);case"select":return gB(J,Y.slice(2).join(","));case"selectordinal":return hB(J,Y.slice(2).join(","));case"number":return dB(J,Y[2]?.trim());case"date":return uB(J,Y[2]?.trim());case"time":return pB(J,Y[2]?.trim());default:return J!==void 0?String(J):`{${$}}`}}function vB($){let Z=[],Y="",X=0;for(let J=0;J<$.length;J++){let Q=$[J];if(Q==="{")X++,Y+=Q;else if(Q==="}")X--,Y+=Q;else if(Q===","&&X===0)Z.push(Y),Y="";else Y+=Q}if(Y)Z.push(Y);return Z}function xB($,Z,Y){let X=Number($)||0,J=p6(Z),Q=`=${X}`;if(J[Q])return g6(J[Q],X,Y);let G=fB(X);if(J[G])return g6(J[G],X,Y);if(J.other)return g6(J.other,X,Y);return String(X)}function g6($,Z,Y){let X=$.replace(/#/g,String(Z));return XJ(X,Y)}function fB($){let Z=Math.abs($),Y=Math.floor(Z),X=String($).includes(".")?String($).split(".")[1].length:0;if(Y===1&&X===0)return"one";return"other"}function gB($,Z){let Y=String($||""),X=p6(Z);if(X[Y])return X[Y];return X.other||String($)}function hB($,Z){let Y=Number($)||0,X=p6(Z),J=mB(Y);if(X[J])return X[J].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function mB($){let Z=Math.abs($),Y=Z%10,X=Z%100;if(Y===1&&X!==11)return"one";if(Y===2&&X!==12)return"two";if(Y===3&&X!==13)return"few";return"other"}function p6($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function dB($,Z){let Y=Number($);if(Number.isNaN(Y))return String($);switch(Z){case"integer":return Math.floor(Y).toLocaleString();case"percent":return`${(Y*100).toFixed(0)}%`;case"currency":return Y.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Y.toLocaleString()}}function uB($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.dateStyle="short";break;case"medium":X.dateStyle="medium";break;case"long":X.dateStyle="long";break;case"full":X.dateStyle="full";break;default:X.dateStyle="medium"}return Y.toLocaleDateString(void 0,X)}function pB($,Z){let Y=$ instanceof Date?$:new Date(String($));if(Number.isNaN(Y.getTime()))return String($);let X={};switch(Z){case"short":X.timeStyle="short";break;case"medium":X.timeStyle="medium";break;case"long":X.timeStyle="long";break;case"full":X.timeStyle="full";break;default:X.timeStyle="short"}return Y.toLocaleTimeString(void 0,X)}function lB($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function ZJ($,Z,Y=!0,X={}){let J=$.split("."),Q=Z;for(let K of J){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return Y?$:"";let G=String(Q);if(lB(G))return yB(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=SB(q,K)}for(let[K,q]of Object.entries(X)){let W=K.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");G=G.replace(new RegExp(`:${W}`,"g"),String(q))}return G}async function JJ($,Z,Y,X){let J=$,Q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...u6,...X.i18n},K=await bB(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,J=await YJ(J,Q,async(z,U,j,H,B)=>{try{let _={};if(j)try{let F=[()=>JSON.parse(j),()=>{let L=`{"data":${j}}`,V=JSON.parse(L);return typeof V.data==="object"?V.data:{}},()=>{return O0(j,Z)}];for(let L of F)try{if(_=L(),Object.keys(_).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return ZJ(U,K,G.fallbackToKey,_)||H.trim()}catch(_){if(X.debug)console.error("Error processing @translate directive:",_);return $0("Translate",`Error in @translate('${U}'): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...J.matchAll(q)];console.warn(`Found ${z.length} @translate matches`),z.forEach((U,j)=>console.warn(`Match ${j}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return J=await YJ(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,U,j,H)=>{try{let B={};if(j)try{let _=[()=>JSON.parse(j),()=>{let O=`{"data":${j}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return O0(j,Z)}];for(let O of _)try{if(B=O(),Object.keys(B).length>0)break}catch{}}catch(_){if(X.debug)console.error("Error parsing parameters for @translate directive:",_)}return ZJ(U,K,G.fallbackToKey,B)}catch(B){if(X.debug)console.error("Error processing @translate directive:",B);return $0("Translate",`Error in @translate('${U}'): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR)}}),J}async function YJ($,Z,Y){let X=[];return $.replace(Z,(Q,...G)=>{let K=Y(Q,...G).then((q)=>({match:Q,replacement:q}));return X.push(K),Q}),(await Promise.all(X)).reduce((Q,{match:G,replacement:K})=>Q.replace(G,K),$)}var N$,u6,m6,A$,f6;var QJ=b(()=>{U1();F0();u6={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},m6={},A$={},f6={}});var i6={};o(i6,{streamingSuspenseDirective:()=>qJ,streamToResponse:()=>YH,streamTemplateSimple:()=>tB,streamTemplate:()=>iB,renderStreamingPage:()=>oB,registerStreamingDirectives:()=>$H,processStreamDirectives:()=>rB,processSectionDirectives:()=>ZH,islandDirective:()=>WJ,generateHydrationRuntime:()=>XH,extractStreamBoundaries:()=>aB,createStreamRenderer:()=>eB,buildSuspenseResolveScript:()=>c6,SUSPENSE_RESOLVER_RUNTIME:()=>KJ});import H7 from"path";function cB($){let Z=[],Y=0,X;GJ.lastIndex=0;while((X=GJ.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let J=X[1],Q=X[2];Z.push({type:"suspense",name:J,content:Q}),Y=X.index+X[0].length}if(Y<$.length){let J=$.slice(Y);if(J.trim())Z.push({type:Z.length===0?"shell":"content",content:J})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function iB($,Z={},Y={}){let X={...t1,...Y,streaming:{...l6,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:H7.dirname($)};if(q.trim())await c1(q,z,$);let U=cB(W),j=new Set;if(!U.some((B)=>B.type==="suspense")){let B=X.streaming?.strategy||"auto",_=new RegExp(Y5.source,"g");if(!(B!=="manual"&&_.test(W))){let F=await N0(W,z,$,X,j);for(let L=0;L<F.length;L+=J)Q.enqueue(F.slice(L,L+J)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],L=new RegExp(Y5.source,"g"),V;while((V=L.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let w=0;for(let R of F){if(R.start>w){let A=W.slice(w,R.start);if(A.trim()){let M=await N0(A,z,$,X,j);Q.enqueue(M),await new Promise((I)=>setTimeout(I,0))}}let N=await N0(R.content,z,$,X,j);Q.enqueue(N),await new Promise((A)=>setTimeout(A,0)),w=R.end}if(w<W.length){let R=W.slice(w);if(R.trim()){let N=await N0(R,z,$,X,j);Q.enqueue(N)}}}}else{let B=new Map;for(let O of U)if(O.type==="shell"||O.type==="content"){let F=await N0(O.content,z,$,X,j);Q.enqueue(F)}else if(O.type==="suspense"&&O.name){let F=`stx-suspense-${O.name}`;Q.enqueue(`<div id="${F}" data-suspense="${O.name}" style="display:contents;">
11559
11559
  <template data-suspense-fallback>Loading...</template>
11560
11560
  </div>`),B.set(O.name,N0(O.content,z,$,X,j))}Q.enqueue(`
11561
11561
  <script>
@@ -11579,7 +11579,7 @@ window.__stxSuspense.resolve('${$}', \`${X}\`);
11579
11579
  </script>`}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return`
11580
11580
  <script>
11581
11581
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${s0(X)}</div>');
11582
- </script>`}}function iB($,Z,Y){if(!Z||Z<=0)return $;let X,J=new Promise((Q,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,J]).finally(()=>clearTimeout(X))}function nB($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue($),Z.length>0)J.enqueue(GJ),await Promise.all(Z.map(async(Q)=>{let G=iB(Q.render(),X,Q.id);J.enqueue(await c6(Q.id,G))}));J.close()}catch(Q){J.error(Q)}}})}function sB($,Z){return $.replace(oB,(Y,X,J)=>{let Q=X.trim(),G=J.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${q}</div>`})}function rB($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,J])=>({id:X,render:J})):void 0}async function aB($,Z={},Y={}){let X={...t1,...Y,streaming:{...l6,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:H7.dirname($)};if(q.trim())await c1(q,z,$);let U=new Set,j=X.streaming?.strategy||"auto",H=new RegExp(Y5.source,"g");if(!(j!=="manual"&&H.test(W))){let _=await N0(W,z,$,X,U);for(let O=0;O<_.length;O+=J)Q.enqueue(_.slice(O,O+J))}else{let _=[],O=new RegExp(Y5.source,"g"),F;while((F=O.exec(W))!==null)_.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let L=0;for(let V of _){if(V.start>L){let R=W.slice(L,V.start);if(R.trim()){let N=await N0(R,z,$,X,U);Q.enqueue(N)}}let w=await N0(V.content,z,$,X,U);Q.enqueue(w),L=V.end}if(L<W.length){let V=W.slice(L);if(V.trim()){let w=await N0(V,z,$,X,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function tB($,Z={}){let Y={...t1,...Z,streaming:{...l6,...Z.streaming}},X=await Bun.file($).text(),J=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=J?J[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;Y5.lastIndex=0;while((W=Y5.exec(G))!==null){let j=W[1],H=W[2];q[j]=H}let z=G.replace(Y5,"");return{renderShell:async(j={})=>{let H={...j,__filename:$,__dirname:H7.dirname($)};return await c1(Q,H,$),N0(z,H,$,Y,new Set)},renderSection:async(j,H={})=>{try{if(!q[j])return`<div class="error-message">Section "${s0(j)}" not found in template "${s0($)}"</div>`;let B={...H,__filename:$,__dirname:H7.dirname($)};await c1(Q,B,$);let _=new Set;return await N0(q[j],B,$,Y,_)}catch(B){let _=B instanceof Error?B.message:String(B);return z0("Expression",_,$,q[j]||"",0,q[j]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function eB($={}){let Z=[];if($.streaming?.enabled)Z.push(KJ);if($.hydration?.enabled)Z.push(qJ);return Z}async function $H($,Z,Y,X={}){return $}function ZH($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),J=new Headers(Z.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:J})}function YH($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,J=Object.entries(Y).map(([Q,G])=>`'${Q}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
11582
+ </script>`}}function nB($,Z,Y){if(!Z||Z<=0)return $;let X,J=new Promise((Q,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,J]).finally(()=>clearTimeout(X))}function oB($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue($),Z.length>0)J.enqueue(KJ),await Promise.all(Z.map(async(Q)=>{let G=nB(Q.render(),X,Q.id);J.enqueue(await c6(Q.id,G))}));J.close()}catch(Q){J.error(Q)}}})}function rB($,Z){return $.replace(sB,(Y,X,J)=>{let Q=X.trim(),G=J.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[Q]=K,`<div data-suspense="${Q}">${q}</div>`})}function aB($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,J])=>({id:X,render:J})):void 0}async function tB($,Z={},Y={}){let X={...t1,...Y,streaming:{...l6,...Y.streaming}},J=X.streaming?.bufferSize||16384;return new ReadableStream({async start(Q){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:H7.dirname($)};if(q.trim())await c1(q,z,$);let U=new Set,j=X.streaming?.strategy||"auto",H=new RegExp(Y5.source,"g");if(!(j!=="manual"&&H.test(W))){let _=await N0(W,z,$,X,U);for(let O=0;O<_.length;O+=J)Q.enqueue(_.slice(O,O+J))}else{let _=[],O=new RegExp(Y5.source,"g"),F;while((F=O.exec(W))!==null)_.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let L=0;for(let V of _){if(V.start>L){let R=W.slice(L,V.start);if(R.trim()){let N=await N0(R,z,$,X,U);Q.enqueue(N)}}let w=await N0(V.content,z,$,X,U);Q.enqueue(w),L=V.end}if(L<W.length){let V=W.slice(L);if(V.trim()){let w=await N0(V,z,$,X,U);Q.enqueue(w)}}}Q.close()}catch(G){Q.error(G)}}})}async function eB($,Z={}){let Y={...t1,...Z,streaming:{...l6,...Z.streaming}},X=await Bun.file($).text(),J=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),Q=J?J[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;Y5.lastIndex=0;while((W=Y5.exec(G))!==null){let j=W[1],H=W[2];q[j]=H}let z=G.replace(Y5,"");return{renderShell:async(j={})=>{let H={...j,__filename:$,__dirname:H7.dirname($)};return await c1(Q,H,$),N0(z,H,$,Y,new Set)},renderSection:async(j,H={})=>{try{if(!q[j])return`<div class="error-message">Section "${s0(j)}" not found in template "${s0($)}"</div>`;let B={...H,__filename:$,__dirname:H7.dirname($)};await c1(Q,B,$);let _=new Set;return await N0(q[j],B,$,Y,_)}catch(B){let _=B instanceof Error?B.message:String(B);return z0("Expression",_,$,q[j]||"",0,q[j]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function $H($={}){let Z=[];if($.streaming?.enabled)Z.push(qJ);if($.hydration?.enabled)Z.push(WJ);return Z}async function ZH($,Z,Y,X={}){return $}function YH($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(Q,G){G.enqueue(Y.encode(Q))}})),J=new Headers(Z.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:J})}function XH($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,J=Object.entries(Y).map(([Q,G])=>`'${Q}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
11583
11583
  `);if(Z==="loader")return`
11584
11584
  (function() {
11585
11585
  window.__stx = window.__stx || {};
@@ -11721,7 +11721,7 @@ else {
11721
11721
  else {
11722
11722
  stx.hydrate();
11723
11723
  }
11724
- })();`}var l6,Y5,QJ,GJ=`
11724
+ })();`}var l6,Y5,GJ,KJ=`
11725
11725
  <script>
11726
11726
  (function(){
11727
11727
  window.__stxSuspense = window.__stxSuspense || {
@@ -11741,25 +11741,25 @@ else {
11741
11741
  }
11742
11742
  };
11743
11743
  })();
11744
- </script>`,oB,KJ,qJ;var n6=b(()=>{w1();Y1();D4();R0();l6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},Y5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,QJ=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;oB=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;KJ={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let J=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${$}<!-- @endsuspense:${J} -->`}},qJ={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${J}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${J}" data-island-id="${G}" data-priority="${Q}">
11744
+ </script>`,sB,qJ,WJ;var n6=b(()=>{w1();Y1();D4();R0();l6={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},Y5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,GJ=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;sB=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;qJ={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let J=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${$}<!-- @endsuspense:${J} -->`}},WJ={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let J=Z[0].replace(/['"`]/g,""),Q=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${J}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${J}" data-island-id="${G}" data-priority="${Q}">
11745
11745
  ${W}
11746
11746
  <script type="application/json" data-island-props="${G}">
11747
11747
  ${q?`{${q}}`:"{}"}
11748
11748
  </script>
11749
- </div>`}}});var UJ={};o(UJ,{warnUnbalancedTags:()=>o6,findUnbalancedTags:()=>zJ});function k5($){return $.replace(/[^\n]/g," ")}function zJ($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,k5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,k5).replace(/<!--[\s\S]*?-->/g,k5).replace(/\{\{\{[\s\S]*?\}\}\}/g,k5).replace(/\{\{[\s\S]*?\}\}/g,k5).replace(/\{!![\s\S]*?!!\}/g,k5),Y=new Map,X=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=J.exec(Z))!==null){let K=Q[1]==="/",q=Q[2],W=Q[3]==="/";if(XH.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let z=Y.get(q);if(z)z.count++;else{let U=Z.slice(0,Q.index).split(`
11750
- `).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(JH.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function o6($,Z){let Y;try{Y=zJ($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(WJ.has(X))return;WJ.add(X);let J=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var XH,JH,WJ;var s6=b(()=>{XH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),JH=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);WJ=new Set});import c0 from"path";import r6 from"fs";function jJ($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function BJ($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class HJ{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let J=$.endsWith(".stx")?$.slice(0,-4):$,Q=X?.__importedComponents;if(Q){let H=[J,J.toLowerCase(),jJ(J),BJ(J)];for(let B of H)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${J}.stx`,`${jJ(J)}.stx`,`${BJ(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let H=c0.resolve(c0.dirname(Z),`${J}.stx`);if(await c(H))return H;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(c0.join(c0.dirname(W),"components"));if(q)K.push(q);let z=c0.join(c0.dirname(Z),"components");if(!K.includes(z))K.push(z);let U=process.cwd(),j=[c0.resolve(U,"src/components"),c0.resolve(U,"components"),c0.resolve(import.meta.dir,"components")];for(let H of j)if(!K.includes(H))K.push(H);for(let H of K){if(!H)continue;for(let B of G){let _=c0.join(H,B);if(await c(_))return _}try{if(!r6.statSync(H,{throwIfNoEntry:!1})?.isDirectory())continue;let _=r6.readdirSync(H,{withFileTypes:!0});for(let O of _)if(O.isDirectory()){let F=c0.join(H,O.name);for(let L of G){let V=c0.join(F,L);if(await c(V))return V}}}catch{}}return null}}var C0;var a6=b(()=>{R0();C0=new HJ});function I0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _J($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var X5="\x00stx-boolean-attribute";function b5($,Z){let Y=[];for(let[X,J]of Object.entries($.static)){if(Z.has(X))continue;let Q=$.staticNames?.[X]??X;if(typeof J==="boolean"){if(J)Y.push(I0(Q));continue}if(J===X5){Y.push(I0(Q));continue}Y.push(`${I0(Q)}="${I0(_J(String(J)))}"`)}return Y}var _7=()=>{};function M$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function QH($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var t6;var e6=b(()=>{_7();t6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=QH($),J=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${M$(X.value)}"`);else q.push(`href="${M$(X.value)}"`);if(J)q.push(`class="${M$(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${M$(Q)}"`),q.push(`data-stx-exact-active-class="${M$(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...b5($,W)),`<a ${q.join(" ")}>${Z}</a>`}}});function D0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function b0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Z9($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let J=$.static[Z];if(J!==void 0)return J!=="false"&&J!==!1;return Y}function OJ($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[J,Q]=X.split(":"),G=GH[J];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(J);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(X);return Y.join(", ")}function Y9($,Z,Y,X){return Z.map((J)=>`${T$($,J,void 0,Y,X)} ${J}w`).join(", ")}function KH($,Z,Y,X,J){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${T$($,G,void 0,X,J)} ${Q}x`}).join(", ")}function T$($,Z,Y,X,J){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(J)Q.push(`f_${J}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(J)Q.set("fm",J);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(J)Q.set("format",J);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function qH($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var GH,$9,X9;var J9=b(()=>{_7();GH={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},$9=[320,640,768,1024,1280,1536,1920];X9={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=b0($,"src")||"",J=b0($,"alt")||"",Q=b0($,"width"),G=b0($,"height"),K=b0($,"sizes"),q=b0($,"srcset"),W=b0($,"densities"),z=b0($,"format"),U=b0($,"placeholder"),j=b0($,"placeholderColor")||"#e5e7eb",H=b0($,"provider"),B=b0($,"class")||b0($,"className")||"",_=b0($,"style")||"",O=b0($,"quality"),F=Z9($,"lazy",!0),L=Z9($,"preload",!1),V=Z9($,"picture",!1)||!!z,w=Q?Number.parseInt(Q):void 0,R=G?Number.parseInt(G):void 0,N=q||"",A="";if(!N&&K)N=Y9(X,$9,H,z),A=OJ(K);else if(!N&&W){let y=W.split(/\s+/).map((S)=>Number.parseFloat(S.replace("x","")));N=KH(X,y,w,H,z)}else if(K)A=OJ(K);let M=[];if(_)M.push(_);if(w&&R)M.push(`aspect-ratio:${w}/${R}`);if(U==="blur"||U==="color"||U==="thumbhash"){let y=qH(w||16,R||9,j);M.push(`background-image:url(${y})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")M.push(`background-image:url(${D0(U)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let I=T$(X,w,R,H,z),T=[];if(T.push(`src="${D0(I)}"`),T.push(`alt="${D0(J)}"`),Q)T.push(`width="${D0(Q)}"`);if(G)T.push(`height="${D0(G)}"`);if(F)T.push('loading="lazy"');if(T.push('decoding="async"'),B)T.push(`class="${D0(B)}"`);if(M.length>0)T.push(`style="${D0(M.join(";"))}"`);if(N)T.push(`srcset="${D0(N)}"`);if(A)T.push(`sizes="${D0(A)}"`);let k=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);T.push(...b5($,k));let D=`<img ${T.join(" ")} />`,P="";if(L){let S=z==="webp"?"image/webp":z==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${D0(I)}"${S?` type="${S}"`:""}${N?` imagesrcset="${D0(N)}"`:""}${A?` imagesizes="${D0(A)}"`:""} />
11749
+ </div>`}}});var jJ={};o(jJ,{warnUnbalancedTags:()=>o6,findUnbalancedTags:()=>UJ});function k5($){return $.replace(/[^\n]/g," ")}function UJ($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,k5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,k5).replace(/<!--[\s\S]*?-->/g,k5).replace(/\{\{\{[\s\S]*?\}\}\}/g,k5).replace(/\{\{[\s\S]*?\}\}/g,k5).replace(/\{!![\s\S]*?!!\}/g,k5),Y=new Map,X=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,Q;while((Q=J.exec(Z))!==null){let K=Q[1]==="/",q=Q[2],W=Q[3]==="/";if(JH.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let z=Y.get(q);if(z)z.count++;else{let U=Z.slice(0,Q.index).split(`
11750
+ `).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(QH.has(K.toLowerCase()))continue;let q=Y.get(K)?.count??0,W=X.get(K)??0;if(q!==W)G.push({tag:K,opened:q,closed:W,firstOpenLine:Y.get(K)?.firstLine??0})}return G}function o6($,Z){let Y;try{Y=UJ($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(zJ.has(X))return;zJ.add(X);let J=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:Q,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 an unclosed <${Q}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${Q}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${Q}>.`)}var JH,QH,zJ;var s6=b(()=>{JH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),QH=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);zJ=new Set});import c0 from"path";import r6 from"fs";function BJ($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function HJ($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class _J{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let J=$.endsWith(".stx")?$.slice(0,-4):$,Q=X?.__importedComponents;if(Q){let H=[J,J.toLowerCase(),BJ(J),HJ(J)];for(let B of H)if(Q.has(B))return Q.get(B)}let G=[...new Set([`${J}.stx`,`${BJ(J)}.stx`,`${HJ(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let H=c0.resolve(c0.dirname(Z),`${J}.stx`);if(await c(H))return H;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(c0.join(c0.dirname(W),"components"));if(q)K.push(q);let z=c0.join(c0.dirname(Z),"components");if(!K.includes(z))K.push(z);let U=process.cwd(),j=[c0.resolve(U,"src/components"),c0.resolve(U,"components"),c0.resolve(import.meta.dir,"components")];for(let H of j)if(!K.includes(H))K.push(H);for(let H of K){if(!H)continue;for(let B of G){let _=c0.join(H,B);if(await c(_))return _}try{if(!r6.statSync(H,{throwIfNoEntry:!1})?.isDirectory())continue;let _=r6.readdirSync(H,{withFileTypes:!0});for(let O of _)if(O.isDirectory()){let F=c0.join(H,O.name);for(let L of G){let V=c0.join(F,L);if(await c(V))return V}}}catch{}}return null}}var v0;var a6=b(()=>{R0();v0=new _J});function I0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function OJ($){return $.indexOf("\x00")===-1?$:$.replace(/\0/g,"")}var X5="\x00stx-boolean-attribute";function b5($,Z){let Y=[];for(let[X,J]of Object.entries($.static)){if(Z.has(X))continue;let Q=$.staticNames?.[X]??X;if(typeof J==="boolean"){if(J)Y.push(I0(Q));continue}if(J===X5){Y.push(I0(Q));continue}Y.push(`${I0(Q)}="${I0(OJ(String(J)))}"`)}return Y}var _7=()=>{};function M$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function GH($){if($.clientReactive.to)return{value:$.clientReactive.to,reactive:!0};if($.serverDynamic.to!==void 0)return{value:String($.serverDynamic.to),reactive:!1};if(typeof $.static.to==="string")return{value:$.static.to,reactive:!1};return{value:"#",reactive:!1}}var t6;var e6=b(()=>{_7();t6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=GH($),J=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),Q=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${M$(X.value)}"`);else q.push(`href="${M$(X.value)}"`);if(J)q.push(`class="${M$(J)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${M$(Q)}"`),q.push(`data-stx-exact-active-class="${M$(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...b5($,W)),`<a ${q.join(" ")}>${Z}</a>`}}});function D0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function b0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Z9($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let J=$.static[Z];if(J!==void 0)return J!=="false"&&J!==!1;return Y}function FJ($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[J,Q]=X.split(":"),G=KH[J];if(G)Y.push(`(max-width: ${G}px) ${Q}`);else{let K=Number.parseInt(J);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${Q}`)}}else Y.push(X);return Y.join(", ")}function Y9($,Z,Y,X){return Z.map((J)=>`${T$($,J,void 0,Y,X)} ${J}w`).join(", ")}function qH($,Z,Y,X,J){return Z.map((Q)=>{let G=Y?Y*Q:void 0;return`${T$($,G,void 0,X,J)} ${Q}x`}).join(", ")}function T$($,Z,Y,X,J){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let Q=[];if(Z)Q.push(`w_${Z}`);if(Y)Q.push(`h_${Y}`);if(J)Q.push(`f_${J}`);Q.push("q_auto");let G=Q.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let Q=new URLSearchParams;if(Z)Q.set("w",String(Z));if(Y)Q.set("h",String(Y));if(J)Q.set("fm",J);Q.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}if(X==="bunny"){let Q=new URLSearchParams;if(Z)Q.set("width",String(Z));if(Y)Q.set("height",String(Y));if(J)Q.set("format",J);let G=$.includes("?")?"&":"?";return`${$}${G}${Q.toString()}`}return $}function WH($,Z,Y="#e5e7eb"){let X=`<svg xmlns="http://www.w3.org/2000/svg" width="${$}" height="${Z}"><rect width="100%" height="100%" fill="${Y}"/></svg>`;return`data:image/svg+xml;base64,${btoa(X)}`}var KH,$9,X9;var J9=b(()=>{_7();KH={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},$9=[320,640,768,1024,1280,1536,1920];X9={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=b0($,"src")||"",J=b0($,"alt")||"",Q=b0($,"width"),G=b0($,"height"),K=b0($,"sizes"),q=b0($,"srcset"),W=b0($,"densities"),z=b0($,"format"),U=b0($,"placeholder"),j=b0($,"placeholderColor")||"#e5e7eb",H=b0($,"provider"),B=b0($,"class")||b0($,"className")||"",_=b0($,"style")||"",O=b0($,"quality"),F=Z9($,"lazy",!0),L=Z9($,"preload",!1),V=Z9($,"picture",!1)||!!z,w=Q?Number.parseInt(Q):void 0,R=G?Number.parseInt(G):void 0,N=q||"",A="";if(!N&&K)N=Y9(X,$9,H,z),A=FJ(K);else if(!N&&W){let y=W.split(/\s+/).map((S)=>Number.parseFloat(S.replace("x","")));N=qH(X,y,w,H,z)}else if(K)A=FJ(K);let M=[];if(_)M.push(_);if(w&&R)M.push(`aspect-ratio:${w}/${R}`);if(U==="blur"||U==="color"||U==="thumbhash"){let y=WH(w||16,R||9,j);M.push(`background-image:url(${y})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")M.push(`background-image:url(${D0(U)})`),M.push("background-size:cover"),M.push("background-repeat:no-repeat");let I=T$(X,w,R,H,z),T=[];if(T.push(`src="${D0(I)}"`),T.push(`alt="${D0(J)}"`),Q)T.push(`width="${D0(Q)}"`);if(G)T.push(`height="${D0(G)}"`);if(F)T.push('loading="lazy"');if(T.push('decoding="async"'),B)T.push(`class="${D0(B)}"`);if(M.length>0)T.push(`style="${D0(M.join(";"))}"`);if(N)T.push(`srcset="${D0(N)}"`);if(A)T.push(`sizes="${D0(A)}"`);let k=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);T.push(...b5($,k));let D=`<img ${T.join(" ")} />`,P="";if(L){let S=z==="webp"?"image/webp":z==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${D0(I)}"${S?` type="${S}"`:""}${N?` imagesrcset="${D0(N)}"`:""}${A?` imagesizes="${D0(A)}"`:""} />
11751
11751
  `}if(V){let y=[];if(z==="avif"||z==="auto"){let S=T$(X,w,R,H,"avif"),C=N?Y9(X,$9,H,"avif"):`${S}`;y.push(`<source type="image/avif" srcset="${D0(C)}"${A?` sizes="${D0(A)}"`:""} />`)}if(z==="webp"||z==="auto"){let S=T$(X,w,R,H,"webp"),C=N?Y9(X,$9,H,"webp"):`${S}`;y.push(`<source type="image/webp" srcset="${D0(C)}"${A?` sizes="${D0(A)}"`:""} />`)}return`${P}<picture>
11752
11752
  ${y.join(`
11753
11753
  `)}
11754
11754
  ${D}
11755
- </picture>`}return`${P}${D}`}}});function I$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function S5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var FJ="/images/safe-image-default.svg",WH,Q9;var G9=b(()=>{_7();WH=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${FJ}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,Q9={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=S5($,"src")||"",J=S5($,"alt")||"",Q=S5($,"fallback")||FJ,G=S5($,"class")||S5($,"className")||"",K=S5($,"fallbackClassName")||"",q=[];if(q.push(`src="${I$(X)}"`),q.push(`alt="${I$(J)}"`),G)q.push(`class="${I$(G)}"`);if(q.push(`data-fallback="${I$(Q)}"`),K)q.push(`data-fallback-class="${I$(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...b5($,W));let z=`<img ${q.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${WH}${z}`;return z}}});function K9($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function D$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function O7($,Z,Y){let X=D$($,Z);if(X!==void 0){let J=Number.parseInt(X,10);if(!Number.isNaN(J))return J}return Y}var q9;var W9=b(()=>{q9={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=K9(D$($,"color")||"#6366f1"),J=K9(D$($,"initialColor")||D$($,"initial-color")||""),Q=K9(D$($,"height")||"3px"),G=O7($,"duration",2000),K=O7($,"throttle",200),q=O7($,"zIndex",999999)||O7($,"z-index",999999),W=J?`linear-gradient(to right, ${J}, ${X})`:X;return`
11755
+ </picture>`}return`${P}${D}`}}});function I$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function S5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var LJ="/images/safe-image-default.svg",zH,Q9;var G9=b(()=>{_7();zH=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${LJ}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,Q9={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=S5($,"src")||"",J=S5($,"alt")||"",Q=S5($,"fallback")||LJ,G=S5($,"class")||S5($,"className")||"",K=S5($,"fallbackClassName")||"",q=[];if(q.push(`src="${I$(X)}"`),q.push(`alt="${I$(J)}"`),G)q.push(`class="${I$(G)}"`);if(q.push(`data-fallback="${I$(Q)}"`),K)q.push(`data-fallback-class="${I$(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...b5($,W));let z=`<img ${q.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${zH}${z}`;return z}}});function K9($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function D$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function O7($,Z,Y){let X=D$($,Z);if(X!==void 0){let J=Number.parseInt(X,10);if(!Number.isNaN(J))return J}return Y}var q9;var W9=b(()=>{q9={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=K9(D$($,"color")||"#6366f1"),J=K9(D$($,"initialColor")||D$($,"initial-color")||""),Q=K9(D$($,"height")||"3px"),G=O7($,"duration",2000),K=O7($,"throttle",200),q=O7($,"zIndex",999999)||O7($,"z-index",999999),W=J?`linear-gradient(to right, ${J}, ${X})`:X;return`
11756
11756
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${Q};background:${W};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
11757
11757
  <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>
11758
11758
  </div>
11759
11759
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
11760
11760
  <script>
11761
11761
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${K})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
11762
- </script>`}}});function VJ($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function zH($,Z,Y){let X=VJ($,Z);if(X!==void 0){let J=Number.parseInt(X,10);if(!Number.isNaN(J))return J}return Y}var LJ,z9;var U9=b(()=>{LJ={"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%)"},z9={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=I0(VJ($,"position")||"top-right"),J=zH($,"max",5),Q=LJ[X]||LJ["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${J}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
11762
+ </script>`}}});function wJ($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function UH($,Z,Y){let X=wJ($,Z);if(X!==void 0){let J=Number.parseInt(X,10);if(!Number.isNaN(J))return J}return Y}var VJ,z9;var U9=b(()=>{VJ={"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%)"},z9={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=I0(wJ($,"position")||"top-right"),J=UH($,"max",5),Q=VJ[X]||VJ["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${J}" style="position:fixed;${Q};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
11763
11763
  <style>
11764
11764
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
11765
11765
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -11767,7 +11767,7 @@ ${D}
11767
11767
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
11768
11768
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
11769
11769
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
11770
- </style>`}}});function F7($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var wJ,j9;var B9=b(()=>{wJ={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)"},j9={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=F7($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=I0(X),Q=F7($,"size")||"md",G=F7($,"closeOnBackdrop")!=="false",K=F7($,"closeOnEscape")!=="false",q=wJ[Q]||wJ.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${G}" data-close-escape="${K}" 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">
11770
+ </style>`}}});function F7($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var RJ,j9;var B9=b(()=>{RJ={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)"},j9={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=F7($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=I0(X),Q=F7($,"size")||"md",G=F7($,"closeOnBackdrop")!=="false",K=F7($,"closeOnEscape")!=="false",q=RJ[Q]||RJ.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${G}" data-close-escape="${K}" 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">
11771
11771
  <div class="stx-modal-panel" style="${q};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
11772
11772
  <div style="padding:1.5rem">${Z}</div>
11773
11773
  </div>
@@ -11776,7 +11776,7 @@ ${D}
11776
11776
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
11777
11777
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
11778
11778
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
11779
- </style>`}}});function y5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var RJ,H9;var _9=b(()=>{RJ={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},H9={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=y5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=I0(X),Q=y5($,"side")||"right",G=y5($,"size")||"md",K=y5($,"closeOnBackdrop")!=="false",q=y5($,"closeOnEscape")!=="false",W=y5($,"overlay")!=="false",z=RJ[G]||RJ.md,U=Q==="left",j=U?"left:0":"right:0",H=U?"translateX(-100%)":"translateX(100%)",B=U?"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="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
11779
+ </style>`}}});function y5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var NJ,H9;var _9=b(()=>{NJ={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},H9={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=y5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=I0(X),Q=y5($,"side")||"right",G=y5($,"size")||"md",K=y5($,"closeOnBackdrop")!=="false",q=y5($,"closeOnEscape")!=="false",W=y5($,"overlay")!=="false",z=NJ[G]||NJ.md,U=Q==="left",j=U?"left:0":"right:0",H=U?"translateX(-100%)":"translateX(100%)",B=U?"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="${K}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;${W?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
11780
11780
  <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${j};width:${z};max-width:100vw;transform:${H};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">
11781
11781
  <div style="padding:1.5rem">${Z}</div>
11782
11782
  </div>
@@ -11785,18 +11785,18 @@ ${D}
11785
11785
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
11786
11786
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
11787
11787
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
11788
- </style>`}}});import{existsSync as UH,readFileSync as jH}from"fs";function BH($){if(NJ.has($))return;NJ.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function HH($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(UH(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return W0.resolve(Y)}catch{}return null}function _H($){if(L7.has($))return L7.get($);let Z=HH($);if(!Z)return BH($),null;try{let Y=JSON.parse(jH(Z,"utf8"));return L7.set($,Y.icons),Y.icons}catch{return null}}function P5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var L7,NJ,O9;var F9=b(()=>{L7=new Map,NJ=new Set;O9={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=P5($,"name")??P5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let J="lucide",Q=X;if(X.includes(":")){let L=X.split(":");J=L[0],Q=L[1]}let G=I0(P5($,"size")||"24"),K=I0(P5($,"color")||"currentColor"),q=I0(P5($,"class")||""),W=I0(P5($,"style")||""),z=L7.get(J)??_H(J);if(!z)return`<!-- Icon: collection "${J}" not loaded -->`;let U=z[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${J} -->`;let j=U.width||24,H=U.height||24,B=`0 0 ${j} ${H}`,_=U.body;if(K!=="currentColor")_=_.replace(/currentColor/g,K);let O=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${O}${F}>${_}</svg>`}}});function AJ($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function MJ($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var L9;var V9=b(()=>{L9={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=MJ(Z,"fallback"),J=X.rest,Q=MJ(J,"error"),G=Q.rest,K=X.region??AJ($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??AJ($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function V7($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var w9;var R9=b(()=>{w9={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(V7($,"name")||"v").replace(/["'<>]/g,""),J=(V7($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=V7($,"class"),G=V7($,"id"),K=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${J} ${K}>${Z}</${J}>`}}});function TJ(){C0.registerBuiltin(t6),C0.registerBuiltin(X9),C0.registerBuiltin(Q9),C0.registerBuiltin(q9),C0.registerBuiltin(z9),C0.registerBuiltin(j9),C0.registerBuiltin(H9),C0.registerBuiltin(O9),C0.registerBuiltin(L9),C0.registerBuiltin(w9)}var IJ=b(()=>{e6();J9();G9();W9();U9();B9();_9();F9();V9();R9();a6();e6();J9();G9();W9();U9();B9();_9();F9();V9();R9()});function w7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function DJ($,Z,Y){let X=[],J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!K){J=Q+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let _=Q+1+q.length;while(_<$.length&&$[_]!==">")_++;J=_+1;continue}let W=Q+1+q.length,z=null,U=W,j=-1,H=!1;while(W<$.length){let _=$[W];if(z){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===z)z=null;W++;continue}if(_==='"'||_==="'"){z=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){j=W+2,H=!0;break}if(_===">"){j=W+1;break}W++}if(j===-1){J=Q+1;continue}let B=$.slice(U,H?j-2:j-1).trim();if(H)X.push({fullMatch:$.slice(Q,j),tagName:q,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),J=j;else{let _=`<${q}`,O=`</${q}>`,F=1,L=j,V=-1;while(F>0&&L<$.length){let N=$.indexOf(_,L),A=$.indexOf(O,L);if(A===-1)break;if(N!==-1&&N<A){let M=$[N+_.length];if(M===" "||M===">"||M==="/"||M===`
11789
- `||M==="\t")F++;L=N+_.length}else{if(F--,F===0){V=A;break}L=A+O.length}}if(V===-1){J=j;continue}let w=$.slice(j,V),R=V+O.length;X.push({fullMatch:$.slice(Q,R),tagName:q,attributes:B,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),J=R}}return X}function EJ($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function kJ($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var bJ=b(()=>{F0();R0();u1()});var fJ={};o(fJ,{processESImports:()=>vJ,processComponents:()=>N7});import R7 from"fs";import m0 from"path";function FH($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(m8),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},G=(K,q)=>{let W=Q(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!J.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(W.startsWith("@")){X.events[W]=q;continue}if(W.startsWith("__stx_")){let z=Q(W.slice(6));X.serverDynamic[z]=kJ(q,Y);continue}if(W.startsWith(":")){let z=Q(W.slice(1)),U=q===X5?z:q;if(z==="if"||z==="for"||z==="show"){X.clientReactive[z]=U;continue}try{if(!Q0(U)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${U}`);X.clientReactive[z]=U;continue}let j=Object.keys(Z),B=G0(U,j)(...Object.values(Z));if(B===void 0){let _=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((L)=>!O.has(L)&&!j.includes(L))){X.clientReactive[z]=U;continue}}X.serverDynamic[z]=B}catch{X.clientReactive[z]=U}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let z=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let U=z[1];if(Q0(U)){let H=G0(U,Object.keys(Z))(...Object.values(Z));G(W,H!=null?String(H):"")}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${U}`);G(W,q)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,U);G(W,q)}else{let U=q,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=j.exec(q))!==null)try{let B=H[1];if(!Q0(B)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${B}`);continue}let O=G0(B,Object.keys(Z))(...Object.values(Z));U=U.replace(H[0],String(O??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,B)}G(W,U)}continue}G(W,q===X5?"true":EJ(q))}return X}function LH($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let J="";while(Y<X&&!/[\s=]/.test($[Y]))J+=$[Y],Y++;if(!J)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let Q="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[J]=Q}else Z[J]=X5}return Z}function yJ($){return Object.entries($).map(([Z,Y])=>Y===X5?Z:`${Z}="${VH(Y)}"`).join(" ")}function VH($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function wH($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let J=X[1];if(C0.isBuiltin(J))Z.add(J)}return[...Z].sort()}function RH($){let Z=PJ.get($);if(Z)return Z;let Y=new Map,X=[m0.join($,"src"),m0.join($,"dist"),$];function J(Q,G){if(G>6)return;let K;try{K=R7.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of K){let W=m0.join(Q,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let z=q.name.slice(0,-4);if(!Y.has(z))Y.set(z,W);let U=z.toLowerCase();if(!Y.has(U))Y.set(U,W);let j=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,W)}}}for(let Q of X)if(J(Q,0),Y.size>0)break;return PJ.set($,Y),Y}function NH($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=m0.join(Y,"node_modules",$);try{if(R7.statSync(X).isDirectory())return X}catch{}let J=m0.dirname(Y);if(J===Y)return null;Y=J}}async function vJ($,Z,Y,X,J){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=m0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,z,U)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,H=U,B,_=[];while((B=j.exec(U))!==null){let[O,F,L,V]=B,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let M=m0.resolve(G,V);if(M.endsWith(".stx"))R=M;else{let I=`${M}.stx`;try{if(R7.statSync(I).isFile())R=I}catch{try{if(R7.statSync(M).isDirectory())w=M}catch{}}}}else w=NH(V,G);if(!w&&!R)continue;let N=!1,A=(M,I)=>{Q.set(M,I),Q.set(M.toLowerCase(),I);let T=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(T,I),J.add(I)};if(L&&R)A(L,R),N=!0;else if(F){let M=F.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let k=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:T,local:T}}),I=w?RH(w):null;for(let{source:T,local:k}of M){let D=null;if(R)D=R;else if(I)D=I.get(T)??I.get(T.toLowerCase())??I.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)A(k,D),N=!0}}if(N)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return W;for(let O=_.length-1;O>=0;O--)H=H.slice(0,_[O].start)+H.slice(_[O].end);return`<script${z}>${H}</script>`}),K}async function AH($,Z,Y,X,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(Q))!==null){let[W,z]=q,U=z.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of U){let H=j.split("/"),_=H[H.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),F=null,L=[m0.resolve(m0.dirname(Y),`${j}.stx`),m0.resolve(m0.dirname(Y),j),m0.resolve(X.componentsDir||"components",`${j}.stx`),m0.resolve(X.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let V of L)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(O,F),G.set(_,F),G.set(_.toLowerCase(),F);let V=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),J.add(F),X.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(W,""),K.lastIndex=0}return Q}async function MH($,Z,Y,X,J){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(Q))!==null){let z=W.index,U=z+W[0].length-1,j=1,H=U+1;while(H<Q.length&&j>0){if(Q[H]==="(")j++;else if(Q[H]===")"){if(j--,j===0)break}H++}if(j!==0)break;let B=Q.substring(U+1,H),_=H+1,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){q.lastIndex=0;continue}let F=O[1],L,V=B.slice(O[0].length),w=V.match(/^\s*,\s*/);if(w)L=V.slice(w[0].length).trim();let R={};if(L)try{R=O0(L,Z)}catch(k){let D=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(z,_),`[Error parsing component props: ${D}]`);continue}let N="",A=_,I=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(I)N=I[1].trim(),A=_+I[0].length;let T=await o1(F,R,N,G,Z,Y,X,K,J);Q=Q.substring(0,z)+T+Q.substring(A),q.lastIndex=0}return Q}async function TH($,Z,Y,X,J){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=N1(Q);return Q=q.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,OH),Q=Q$(Q,q.scripts),Q;async function j(H,B,_,O){if(!H)return H;let F=H,L=DJ(F,B,O);for(let V=L.length-1;V>=0;V--){let w=L[V],R=_?w7(w.tagName):w.tagName,N=LH(w.attributes),A=FH(N,Z,X),M=C0.getBuiltin(w.tagName),I=M?await I4(R,G,Z,Y,X):!1;if(M&&!I){let P={context:Z,filePath:Y,options:X,dependencies:J},y=M.render(A,w.content,P);if(Object.keys(A.clientReactive).length>0)y=CJ(y,A.clientReactive);if(Object.keys(A.events).length>0){let S=yJ(A.events);y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${S}`)}F=F.substring(0,w.startIndex)+y+F.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await I4(R,G,Z,Y,X))continue;let T={};for(let[P,y]of Object.entries(A.static))T[P]=y;for(let[P,y]of Object.entries(A.serverDynamic))T[P]=y;let D=await o1(R,T,w.content,G,Z,Y,X,K,J);if(Object.keys(A.clientReactive).length>0)D=CJ(D,A.clientReactive);if(Object.keys(A.events).length>0){let P=xJ(D);if(P){let y=yJ(A.events),S=Object.keys(A.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,P.insertPos)+` data-stx-parent-events="${S}" ${y}`+D.substring(P.insertPos)}}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex)}return F}}function CJ($,Z){let Y=new Set(["if","for"]),X=new Set(["show"]),J=Object.entries(Z).filter(([z])=>!Y.has(z)),Q=J.filter(([z])=>!X.has(z)).map(([z])=>w7(z)).join(" "),G=$,K=J.length>0?xJ(G):null;if(K){let z=J.map(([j,H])=>`:${w7(j)}="${H.replace(/"/g,"&quot;")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${z}`+G.substring(K.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function xJ($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let X=$.slice(Y),J=X.match(/^\s+/);if(J){Y+=J[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+Q[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function N7($,Z,Y,X,J){if(!SJ)TJ(),SJ=!0;let Q=await vJ($,Z,Y,X,J);Q=await AH(Q,Z,Y,X,J),Q=await MH(Q,Z,Y,X,J);let G=[];for(let K=0;K<3;K++){let q=Z1(Q,J$,(z,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...q.tokens);let W=Q;if(Q=await TH(q.output,Z,Y,X,J),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=wH(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var SJ=!1,OH,PJ;var N9=b(()=>{a6();IJ();bJ();u1();R0();F0();$1();OH=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"]);PJ=new Map});var lJ={};o(lJ,{processLoops:()=>M9,parseLoopBinding:()=>A9});function EH($,Z){let Y=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,X="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index+Q[0].length,K=Q.index+Q[0].indexOf("("),q=M0($,"(",")",K);if(q===-1)continue;let W=$.slice(G,q).trim();if(!W)continue;if(!Object.keys(Z).some((j)=>new RegExp(`(?:^|[^\\w$.])${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let U;try{let j=O0(W,Z);if(!j||typeof j!=="object")continue;U=JSON.stringify(j)}catch{continue}X+=$.slice(J,G)+U,J=q,Y.lastIndex=q}return J===0?$:X+$.slice(J)}function kH($,Z){let Y=/@component\s*\(/g,X=$,J,Q=[];while((J=Y.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let z=X.substring(K+1,W),U=W+1,j=z.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let H=j[1],B=z.slice(j[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let O=B.slice(_[0].length).trim();if(!O)continue;try{let F=O0(O,Z),L=JSON.stringify(F),V=`@component('${H}', ${L})`;Q.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=Q[G];X=X.substring(0,K)+W+X.substring(q)}return X}function A7($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1,z=null,U=!1;while(W<X.length&&q>0){let B=X[W];if(U){U=!1,W++;continue}if(B==="\\"&&z){U=!0,W++;continue}if(z){if(B===z)z=null;W++;continue}if(B==='"'||B==="'"||B==="`"){z=B,W++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}W++}if(q!==0)break;let j=X.substring(K+1,W),H=Y(j);X=X.substring(0,G)+H+X.substring(W+1)}return X}function bH($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,J)=>{if(J in Z)return`:${J}="${J}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,J,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);s$(Q);let W=G0(Q,G)(...K),z=JSON.stringify(W),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${J}="${U}"`}catch(G){return X}}),Y}function SH($,Z){let Y=$;return Y=A7(Y,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(Q0(Q)){let K=G0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?M7:""}catch{return""}}),Y=A7(Y,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(Q0(Q)){let K=G0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?T7:""}catch{return""}}),Y}function yH($){let Z=$;return Z=Z.replace(/@break(?!\()/g,M7),Z=Z.replace(/@continue(?!\()/g,T7),Z}function gJ($){let Z=$.includes(M7),Y=Z?$.substring(0,$.indexOf(M7)):$;return{hasBreak:Z,content:Y}}function hJ($){let Z=$.includes(T7),Y=Z?$.substring(0,$.indexOf(T7)):$;return{hasContinue:Z,content:Y}}function dJ($){let Z=$;return Z=A7(Z,"@break",(Y)=>{let X=Y.trim();if(!r$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=A7(Z,"@continue",(Y)=>{let X=Y.trim();if(!r$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function PH($){let Z=/@forelse\s*\(/g,Y,X=[],J=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=J.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((z,U)=>z.pos-U.pos);let K=[],q=0;for(let z of X)q+=z.delta,K.push({pos:z.pos,depth:q});function W(z){let U=0,j=K.length-1,H=0;while(U<=j){let B=U+j>>1;if(K[B].pos<=z)H=K[B].depth,U=B+1;else j=B-1}return H}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let z=Y.index,U=Y.index+Y[0].length-1,j=1,H=U+1,B=-1;while(H<$.length&&j>0){if($[H]==="(")j++;else if($[H]===")"){if(j--,j===0){B=H;break}}H++}if(B===-1)continue;let _=$.substring(U+1,B),O=A9(_);if(!O)continue;let{arrayExpr:F,itemVar:L}=O,V=B+1,w=1,R=V,N=/@forelse\s*\(/g,A=/@endforelse/g,M=-1;while(w>0&&R<$.length){N.lastIndex=R,A.lastIndex=R;let y=N.exec($),S=A.exec($);if(!S)break;if(y&&y.index<S.index)w++,R=y.index+y[0].length;else{if(w--,w===0){M=S.index;break}R=S.index+11}}if(M===-1)continue;let I=$.substring(V,M),T=M+11,k=-1,D=0,P=0;while(P<I.length){let y=I.indexOf("@",P);if(y===-1)break;let S=I.substring(y);if(/^@forelse\s*\(/.test(S))D++,P=y+1;else if(S.startsWith("@endforelse"))D--,P=y+11;else if(D===0&&S.startsWith("@empty")){if(I.length<=y+6||!/[a-z]/i.test(I[y+6])){k=y;break}P=y+1}else P=y+1}if(k===-1)continue;return{start:z,end:T,arrayExpr:F,itemVar:L,foreachContent:I.substring(0,k),emptyContent:I.substring(k+6)}}return null}function mJ($,Z){let Y=$;while(!0){let X=PH(Y);if(!X)break;let{start:J,end:Q,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let z;if(Q0(G))z=G0(G,Object.keys(Z))(...Object.values(Z));else z=Z0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=W;else U=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,J)+U+Y.substring(Q)}catch(z){let U=z instanceof Error?z.message:String(z),j=$0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,J)+j+Y.substring(Q)}}return Y}function A9($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let Y=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!Y)return null;let X=Y[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Y[2].trim();return X&&J?{arrayExpr:J,itemVar:X}:null}function M9($,Z,Y,X){let J=$;J=mJ(J,Z);function Q(q){let W=/@foreach\s*\(/g,z;while((z=W.exec(q))!==null){let U=z.index,j=z.index+z[0].length-1,H=1,B=j+1,_=-1;while(B<q.length&&H>0){if(q[B]==="(")H++;else if(q[B]===")"){if(H--,H===0){_=B;break}}B++}if(_===-1)continue;let O=q.substring(j+1,_),F=A9(O);if(!F)continue;let L=U,{arrayExpr:V,itemVar:w}=F,R=_+1,N=1,A=R,M=/@foreach\s*\(/g,I=/@endforeach/g;while(N>0&&A<q.length){M.lastIndex=A,I.lastIndex=A;let T=M.exec(q),k=I.exec(q);if(!k)break;if(T&&T.index<k.index)N++,A=T.index+T[0].length;else{if(N--,N===0){let D=q.substring(R,k.index),P=k.index+11;return{start:L,end:P,arrayExpr:V,itemVar:w,content:D}}A=k.index+11}}}return null}function G(q,W){let z=q;while(!0){let U=Q(z);if(!U)break;let{start:j,end:H,arrayExpr:B,itemVar:_,content:O}=U;try{let F=B.trim(),L;if(Q0(F))L=G0(F,Object.keys(W))(...Object.values(W));else L=Z0(F,W);let V=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),V=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),V=!0;else{console.warn(`[stx] @foreach(${F}) in ${Y}: ${F} 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 k=$0("Foreach",`Error in @foreach: ${F} is not iterable`,s.TYPE_ERROR);z=z.substring(0,j)+k+z.substring(H);continue}let w=X?.loops?.useAltLoopVariable??DH,R=_.trim(),N=null,A,M=!1;if(R.includes("=>")){let k=R.split("=>").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])N=k[0],A=k[1];else A=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])A=k[0],N=k[1],M=!0;else A=R}else A=R;let I="",T=L;for(let k=0;k<T.length;k++){let D=T[k],P={index:k,iteration:k+1,first:k===0,last:k===T.length-1,count:T.length},y={...W,loop:P,$loop:P};if(A.startsWith("[")&&A.endsWith("]")){let d=A.slice(1,-1).split(",").map((u)=>u.trim());if(Array.isArray(D))d.forEach((u,X0)=>{if(u)y[u]=D[X0]});else y[A]=D}else y[A]=D;if(N)if(!M&&V&&Array.isArray(D)&&D.length===2)y[N]=D[0],y[A]=D[1];else y[N]=k;let S=SH(O,y),C=hJ(S);if(C.hasContinue){I+=C.content;continue}let x=gJ(S);if(x.hasBreak){I+=x.content;break}if(S=mJ(S,y),S=G(S,y),S=$5(S,y,Y),S=yH(S),x=gJ(S),x.hasBreak){I+=x.content;break}if(C=hJ(S),C.hasContinue){I+=C.content;continue}S=A1(S,y,Y),S=bH(S,y),S=kH(S,y),S=EH(S,y),I+=S}z=z.substring(0,j)+I+z.substring(H)}catch(F){let L=$0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${F instanceof Error?F.message:String(F)}`,s.EVALUATION_ERROR);z=z.substring(0,j)+L+z.substring(H)}}return z}J=G(J,Z),J=pJ(J,Z,Y,X);let K=X?.loops?.maxWhileIterations??IH;return J=xH(J,Z,K),J}function uJ($){return r$($)}function pJ($,Z,Y,X){let J=$,Q=!0;while(Q){Q=!1;let G=J.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=M0(J,"(",")",q);if(W===-1)break;let z=J.slice(q+1,W),U=W+1,j=J4(J.slice(K),"for","endfor");if(j.length===0)break;let H=j[0].content,B=K+j[0].end;if(!uJ(z)){let _=$0("For",`Unsafe expression in @for: ${z}`,s.UNSAFE_EXPRESSION);J=J.substring(0,K)+_+J.substring(B),Q=!0;continue}try{let _=CH(z),O=/@(?:for|foreach|if|unless)\s*\(/.test(H);if(_.length>0&&O){let N=vH({forExpr:z,content:H,iterVarNames:_,context:Z,filePath:Y,options:X});J=J.substring(0,K)+N+J.substring(B),Q=!0;continue}let F=Object.keys(Z),L=Object.values(Z),V=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,A)=>{return`\${${A}}`});V=dJ(V);let R=Function(...F,`
11788
+ </style>`}}});import{existsSync as jH,readFileSync as BH}from"fs";function HH($){if(AJ.has($))return;AJ.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function _H($){let Z=process.cwd();for(let Y of[`${Z}/node_modules/@iconify-json/${$}/icons.json`,`${Z}/pantry/@iconify-json/${$}/icons.json`,`${Z}/node_modules/@iconify/json/json/${$}.json`,`${Z}/pantry/@iconify/json/json/${$}.json`])if(jH(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return W0.resolve(Y)}catch{}return null}function OH($){if(L7.has($))return L7.get($);let Z=_H($);if(!Z)return HH($),null;try{let Y=JSON.parse(BH(Z,"utf8"));return L7.set($,Y.icons),Y.icons}catch{return null}}function P5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);if($.static[Z]!==void 0)return String($.static[Z]);if($.clientReactive[Z]!==void 0)return $.clientReactive[Z];return}var L7,AJ,O9;var F9=b(()=>{L7=new Map,AJ=new Set;O9={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=P5($,"name")??P5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let J="lucide",Q=X;if(X.includes(":")){let L=X.split(":");J=L[0],Q=L[1]}let G=I0(P5($,"size")||"24"),K=I0(P5($,"color")||"currentColor"),q=I0(P5($,"class")||""),W=I0(P5($,"style")||""),z=L7.get(J)??OH(J);if(!z)return`<!-- Icon: collection "${J}" not loaded -->`;let U=z[Q];if(!U)return`<!-- Icon: "${Q}" not found in ${J} -->`;let j=U.width||24,H=U.height||24,B=`0 0 ${j} ${H}`,_=U.body;if(K!=="currentColor")_=_.replace(/currentColor/g,K);let O=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${B}" fill="none"${O}${F}>${_}</svg>`}}});function MJ($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}function TJ($,Z){let Y=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${Z}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),X=$.match(Y);if(!X)return{region:null,rest:$};return{region:X[2],rest:$.replace(X[0],"")}}var L9;var V9=b(()=>{L9={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=TJ(Z,"fallback"),J=X.rest,Q=TJ(J,"error"),G=Q.rest,K=X.region??MJ($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=Q.region??MJ($,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${K}</div><div data-stx-suspense-error hidden>${q}</div><div data-stx-suspense-content hidden>${G}</div></div>`}}});function V7($,...Z){for(let Y of Z){if($.serverDynamic[Y]!==void 0)return String($.serverDynamic[Y]);let X=$.static[Y];if(typeof X==="string")return X}return}var w9;var R9=b(()=>{w9={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(V7($,"name")||"v").replace(/["'<>]/g,""),J=(V7($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",Q=V7($,"class"),G=V7($,"id"),K=[`data-stx-transition-group="${X}"`,Q?`class="${Q}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${J} ${K}>${Z}</${J}>`}}});function IJ(){v0.registerBuiltin(t6),v0.registerBuiltin(X9),v0.registerBuiltin(Q9),v0.registerBuiltin(q9),v0.registerBuiltin(z9),v0.registerBuiltin(j9),v0.registerBuiltin(H9),v0.registerBuiltin(O9),v0.registerBuiltin(L9),v0.registerBuiltin(w9)}var DJ=b(()=>{e6();J9();G9();W9();U9();B9();_9();F9();V9();R9();a6();e6();J9();G9();W9();U9();B9();_9();F9();V9();R9()});function w7($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function EJ($,Z,Y){let X=[],J=0;while(J<$.length){let Q=$.indexOf("<",J);if(Q===-1)break;let K=$.slice(Q+1).match(new RegExp(`^(${Z.source})(?![\\w.:-])`));if(!K){J=Q+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let _=Q+1+q.length;while(_<$.length&&$[_]!==">")_++;J=_+1;continue}let W=Q+1+q.length,z=null,U=W,j=-1,H=!1;while(W<$.length){let _=$[W];if(z){if(_==="\\"&&W+1<$.length){W+=2;continue}if(_===z)z=null;W++;continue}if(_==='"'||_==="'"){z=_,W++;continue}if(_==="/"&&W+1<$.length&&$[W+1]===">"){j=W+2,H=!0;break}if(_===">"){j=W+1;break}W++}if(j===-1){J=Q+1;continue}let B=$.slice(U,H?j-2:j-1).trim();if(H)X.push({fullMatch:$.slice(Q,j),tagName:q,attributes:B,content:"",startIndex:Q,endIndex:j,isSelfClosing:!0}),J=j;else{let _=`<${q}`,O=`</${q}>`,F=1,L=j,V=-1;while(F>0&&L<$.length){let N=$.indexOf(_,L),A=$.indexOf(O,L);if(A===-1)break;if(N!==-1&&N<A){let M=$[N+_.length];if(M===" "||M===">"||M==="/"||M===`
11789
+ `||M==="\t")F++;L=N+_.length}else{if(F--,F===0){V=A;break}L=A+O.length}}if(V===-1){J=j;continue}let w=$.slice(j,V),R=V+O.length;X.push({fullMatch:$.slice(Q,R),tagName:q,attributes:B,content:w,startIndex:Q,endIndex:R,isSelfClosing:!1}),J=R}}return X}function kJ($){return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function bJ($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var SJ=b(()=>{F0();R0();u1()});var gJ={};o(gJ,{processESImports:()=>xJ,processComponents:()=>N7});import R7 from"fs";import d0 from"path";function LH($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},J=new Set(m8),Q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(q,W)=>W.toUpperCase())},G=(K,q)=>{let W=Q(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!J.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(W.startsWith("@")){X.events[W]=q;continue}if(W.startsWith("__stx_")){let z=Q(W.slice(6));X.serverDynamic[z]=bJ(q,Y);continue}if(W.startsWith(":")){let z=Q(W.slice(1)),U=q===X5?z:q;if(z==="if"||z==="for"||z==="show"){X.clientReactive[z]=U;continue}try{if(!Q0(U)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${U}`);X.clientReactive[z]=U;continue}let j=Object.keys(Z),B=G0(U,j)(...Object.values(Z));if(B===void 0){let _=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(_.some((L)=>!O.has(L)&&!j.includes(L))){X.clientReactive[z]=U;continue}}X.serverDynamic[z]=B}catch{X.clientReactive[z]=U}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let z=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(z)try{let U=z[1];if(Q0(U)){let H=G0(U,Object.keys(Z))(...Object.values(Z));G(W,H!=null?String(H):"")}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${U}`);G(W,q)}}catch(U){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,U);G(W,q)}else{let U=q,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,H;while((H=j.exec(q))!==null)try{let B=H[1];if(!Q0(B)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${B}`);continue}let O=G0(B,Object.keys(Z))(...Object.values(Z));U=U.replace(H[0],String(O??""))}catch(B){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,B)}G(W,U)}continue}G(W,q===X5?"true":kJ(q))}return X}function VH($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let J="";while(Y<X&&!/[\s=]/.test($[Y]))J+=$[Y],Y++;if(!J)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let Q="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,Q+=$[Y],Y++;continue}if(K===G){Y++;break}Q+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))Q+=$[Y],Y++;Z[J]=Q}else Z[J]=X5}return Z}function PJ($){return Object.entries($).map(([Z,Y])=>Y===X5?Z:`${Z}="${wH(Y)}"`).join(" ")}function wH($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function RH($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let J=X[1];if(v0.isBuiltin(J))Z.add(J)}return[...Z].sort()}function NH($){let Z=CJ.get($);if(Z)return Z;let Y=new Map,X=[d0.join($,"src"),d0.join($,"dist"),$];function J(Q,G){if(G>6)return;let K;try{K=R7.readdirSync(Q,{withFileTypes:!0})}catch{return}for(let q of K){let W=d0.join(Q,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;J(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let z=q.name.slice(0,-4);if(!Y.has(z))Y.set(z,W);let U=z.toLowerCase();if(!Y.has(U))Y.set(U,W);let j=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(j))Y.set(j,W)}}}for(let Q of X)if(J(Q,0),Y.size>0)break;return CJ.set($,Y),Y}function AH($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=d0.join(Y,"node_modules",$);try{if(R7.statSync(X).isDirectory())return X}catch{}let J=d0.dirname(Y);if(J===Y)return null;Y=J}}async function xJ($,Z,Y,X,J){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let Q=Z.__importedComponents,G=d0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,z,U)=>{let j=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,H=U,B,_=[];while((B=j.exec(U))!==null){let[O,F,L,V]=B,w=null,R=null;if(V.startsWith(".")||V.startsWith("/")){let M=d0.resolve(G,V);if(M.endsWith(".stx"))R=M;else{let I=`${M}.stx`;try{if(R7.statSync(I).isFile())R=I}catch{try{if(R7.statSync(M).isDirectory())w=M}catch{}}}}else w=AH(V,G);if(!w&&!R)continue;let N=!1,A=(M,I)=>{Q.set(M,I),Q.set(M.toLowerCase(),I);let T=M.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();Q.set(T,I),J.add(I)};if(L&&R)A(L,R),N=!0;else if(F){let M=F.slice(1,-1).split(",").map((T)=>T.trim()).filter(Boolean).map((T)=>{let k=T.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(k)return{source:k[1],local:k[2]};return{source:T,local:T}}),I=w?NH(w):null;for(let{source:T,local:k}of M){let D=null;if(R)D=R;else if(I)D=I.get(T)??I.get(T.toLowerCase())??I.get(T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)A(k,D),N=!0}}if(N)_.push({start:B.index,end:B.index+O.length})}if(_.length===0)return W;for(let O=_.length-1;O>=0;O--)H=H.slice(0,_[O].start)+H.slice(_[O].end);return`<script${z}>${H}</script>`}),K}async function MH($,Z,Y,X,J){let Q=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(Q))!==null){let[W,z]=q,U=z.split(",").map((j)=>j.trim().replace(/^['"]|['"]$/g,"")).filter((j)=>j.length>0);for(let j of U){let H=j.split("/"),_=H[H.length-1].replace(/\.stx$/,""),O=_.includes("-")?_.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),F=null,L=[d0.resolve(d0.dirname(Y),`${j}.stx`),d0.resolve(d0.dirname(Y),j),d0.resolve(X.componentsDir||"components",`${j}.stx`),d0.resolve(X.componentsDir||"components",j),j.endsWith(".stx")?j:`${j}.stx`];for(let V of L)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(O,F),G.set(_,F),G.set(_.toLowerCase(),F);let V=O.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),J.add(F),X.debug)console.log(`Imported component: ${O} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${j}`)}Q=Q.replace(W,""),K.lastIndex=0}return Q}async function TH($,Z,Y,X,J){let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(Q))!==null){let z=W.index,U=z+W[0].length-1,j=1,H=U+1;while(H<Q.length&&j>0){if(Q[H]==="(")j++;else if(Q[H]===")"){if(j--,j===0)break}H++}if(j!==0)break;let B=Q.substring(U+1,H),_=H+1,O=B.match(/^\s*['"]([^'"]+)['"]/);if(!O){q.lastIndex=0;continue}let F=O[1],L,V=B.slice(O[0].length),w=V.match(/^\s*,\s*/);if(w)L=V.slice(w[0].length).trim();let R={};if(L)try{R=O0(L,Z)}catch(k){let D=k instanceof Error?k.message:String(k);Q=Q.replace(Q.substring(z,_),`[Error parsing component props: ${D}]`);continue}let N="",A=_,I=Q.substring(_).match(/^([\s\S]*?)@endcomponent/);if(I)N=I[1].trim(),A=_+I[0].length;let T=await o1(F,R,N,G,Z,Y,X,K,J);Q=Q.substring(0,z)+T+Q.substring(A),q.lastIndex=0}return Q}async function IH($,Z,Y,X,J){if(!$)return $;let Q=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=N1(Q);return Q=q.output,Q=await j(Q,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),Q=await j(Q,/[A-Z][a-zA-Z0-9]*/,!0),Q=await j(Q,/[a-z][a-z0-9]*/,!1,FH),Q=Q$(Q,q.scripts),Q;async function j(H,B,_,O){if(!H)return H;let F=H,L=EJ(F,B,O);for(let V=L.length-1;V>=0;V--){let w=L[V],R=_?w7(w.tagName):w.tagName,N=VH(w.attributes),A=LH(N,Z,X),M=v0.getBuiltin(w.tagName),I=M?await I4(R,G,Z,Y,X):!1;if(M&&!I){let P={context:Z,filePath:Y,options:X,dependencies:J},y=M.render(A,w.content,P);if(Object.keys(A.clientReactive).length>0)y=vJ(y,A.clientReactive);if(Object.keys(A.events).length>0){let S=PJ(A.events);y=y.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${S}`)}F=F.substring(0,w.startIndex)+y+F.substring(w.endIndex);continue}if(!_&&w.tagName.includes("-")&&!await I4(R,G,Z,Y,X))continue;let T={};for(let[P,y]of Object.entries(A.static))T[P]=y;for(let[P,y]of Object.entries(A.serverDynamic))T[P]=y;let D=await o1(R,T,w.content,G,Z,Y,X,K,J);if(Object.keys(A.clientReactive).length>0)D=vJ(D,A.clientReactive);if(Object.keys(A.events).length>0){let P=fJ(D);if(P){let y=PJ(A.events),S=Object.keys(A.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,P.insertPos)+` data-stx-parent-events="${S}" ${y}`+D.substring(P.insertPos)}}F=F.substring(0,w.startIndex)+D+F.substring(w.endIndex)}return F}}function vJ($,Z){let Y=new Set(["if","for"]),X=new Set(["show"]),J=Object.entries(Z).filter(([z])=>!Y.has(z)),Q=J.filter(([z])=>!X.has(z)).map(([z])=>w7(z)).join(" "),G=$,K=J.length>0?fJ(G):null;if(K){let z=J.map(([j,H])=>`:${w7(j)}="${H.replace(/"/g,"&quot;")}"`).join(" "),U=Q?` data-stx-parent-bindings="${Q}"`:"";G=G.substring(0,K.insertPos)+`${U} ${z}`+G.substring(K.insertPos)}let q=Z.if;if(q)G=`<template :if="${q.replace(/"/g,"&quot;")}">${G}</template>`;let W=Z.for;if(W)G=`<template :for="${W.replace(/"/g,"&quot;")}">${G}</template>`;return G}function fJ($){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec($);if(Z)return{insertPos:Z.index+1+Z[1].length};let Y=0;while(Y<$.length){let X=$.slice(Y),J=X.match(/^\s+/);if(J){Y+=J[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let Q=X.match(/^<(script|style)\b[^>]*>/i);if(Q){let K=`</${Q[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+Q[0].length);if(q===-1)return null;Y=q+K.length;continue}let G=X.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!G)return null;return{insertPos:Y+1+G[1].length}}return null}async function N7($,Z,Y,X,J){if(!yJ)IJ(),yJ=!0;let Q=await xJ($,Z,Y,X,J);Q=await MH(Q,Z,Y,X,J),Q=await TH(Q,Z,Y,X,J);let G=[];for(let K=0;K<3;K++){let q=Z1(Q,J$,(z,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...q.tokens);let W=Q;if(Q=await IH(q.output,Z,Y,X,J),Q===W)break}if(G.length>0)Q=Q.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=RH(Q);if(K.length>0)console.warn(`[stx] ${Y}: unresolved component tag(s) after render passes: ${K.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return Q}var yJ=!1,FH,CJ;var N9=b(()=>{a6();DJ();SJ();u1();R0();F0();$1();FH=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"]);CJ=new Map});var cJ={};o(cJ,{processLoops:()=>M9,parseLoopBinding:()=>A9});function kH($,Z){let Y=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,X="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index+Q[0].length,K=Q.index+Q[0].indexOf("("),q=M0($,"(",")",K);if(q===-1)continue;let W=$.slice(G,q).trim();if(!W)continue;if(!Object.keys(Z).some((j)=>new RegExp(`(?:^|[^\\w$.])${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(W)))continue;let U;try{let j=O0(W,Z);if(!j||typeof j!=="object")continue;U=JSON.stringify(j)}catch{continue}X+=$.slice(J,G)+U,J=q,Y.lastIndex=q}return J===0?$:X+$.slice(J)}function bH($,Z){let Y=/@component\s*\(/g,X=$,J,Q=[];while((J=Y.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let z=X.substring(K+1,W),U=W+1,j=z.match(/^\s*['"]([^'"]+)['"]/);if(!j)continue;let H=j[1],B=z.slice(j[0].length),_=B.match(/^\s*,\s*/);if(!_)continue;let O=B.slice(_[0].length).trim();if(!O)continue;try{let F=O0(O,Z),L=JSON.stringify(F),V=`@component('${H}', ${L})`;Q.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=Q.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=Q[G];X=X.substring(0,K)+W+X.substring(q)}return X}function A7($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),Q;while((Q=J.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1,z=null,U=!1;while(W<X.length&&q>0){let B=X[W];if(U){U=!1,W++;continue}if(B==="\\"&&z){U=!0,W++;continue}if(z){if(B===z)z=null;W++;continue}if(B==='"'||B==="'"||B==="`"){z=B,W++;continue}if(B==="(")q++;else if(B===")"){if(q--,q===0)break}W++}if(q!==0)break;let j=X.substring(K+1,W),H=Y(j);X=X.substring(0,G)+H+X.substring(W+1)}return X}function SH($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,J)=>{if(J in Z)return`:${J}="${J}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,J,Q)=>{try{let G=Object.keys(Z),K=Object.values(Z);s$(Q);let W=G0(Q,G)(...K),z=JSON.stringify(W),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${J}="${U}"`}catch(G){return X}}),Y}function yH($,Z){let Y=$;return Y=A7(Y,"@break",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(Q0(Q)){let K=G0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?M7:""}catch{return""}}),Y=A7(Y,"@continue",(X)=>{try{let Q=`!!(${X.trim()})`,G;if(Q0(Q)){let K=G0(Q,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Z0(Q,Z));return G?T7:""}catch{return""}}),Y}function PH($){let Z=$;return Z=Z.replace(/@break(?!\()/g,M7),Z=Z.replace(/@continue(?!\()/g,T7),Z}function hJ($){let Z=$.includes(M7),Y=Z?$.substring(0,$.indexOf(M7)):$;return{hasBreak:Z,content:Y}}function mJ($){let Z=$.includes(T7),Y=Z?$.substring(0,$.indexOf(T7)):$;return{hasContinue:Z,content:Y}}function uJ($){let Z=$;return Z=A7(Z,"@break",(Y)=>{let X=Y.trim();if(!r$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=A7(Z,"@continue",(Y)=>{let X=Y.trim();if(!r$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function CH($){let Z=/@forelse\s*\(/g,Y,X=[],J=/@foreach\s*\(/g,Q=/@endforeach/g,G;while((G=J.exec($))!==null)X.push({pos:G.index,delta:1});while((G=Q.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((z,U)=>z.pos-U.pos);let K=[],q=0;for(let z of X)q+=z.delta,K.push({pos:z.pos,depth:q});function W(z){let U=0,j=K.length-1,H=0;while(U<=j){let B=U+j>>1;if(K[B].pos<=z)H=K[B].depth,U=B+1;else j=B-1}return H}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let z=Y.index,U=Y.index+Y[0].length-1,j=1,H=U+1,B=-1;while(H<$.length&&j>0){if($[H]==="(")j++;else if($[H]===")"){if(j--,j===0){B=H;break}}H++}if(B===-1)continue;let _=$.substring(U+1,B),O=A9(_);if(!O)continue;let{arrayExpr:F,itemVar:L}=O,V=B+1,w=1,R=V,N=/@forelse\s*\(/g,A=/@endforelse/g,M=-1;while(w>0&&R<$.length){N.lastIndex=R,A.lastIndex=R;let y=N.exec($),S=A.exec($);if(!S)break;if(y&&y.index<S.index)w++,R=y.index+y[0].length;else{if(w--,w===0){M=S.index;break}R=S.index+11}}if(M===-1)continue;let I=$.substring(V,M),T=M+11,k=-1,D=0,P=0;while(P<I.length){let y=I.indexOf("@",P);if(y===-1)break;let S=I.substring(y);if(/^@forelse\s*\(/.test(S))D++,P=y+1;else if(S.startsWith("@endforelse"))D--,P=y+11;else if(D===0&&S.startsWith("@empty")){if(I.length<=y+6||!/[a-z]/i.test(I[y+6])){k=y;break}P=y+1}else P=y+1}if(k===-1)continue;return{start:z,end:T,arrayExpr:F,itemVar:L,foreachContent:I.substring(0,k),emptyContent:I.substring(k+6)}}return null}function dJ($,Z){let Y=$;while(!0){let X=CH(Y);if(!X)break;let{start:J,end:Q,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let z;if(Q0(G))z=G0(G,Object.keys(Z))(...Object.values(Z));else z=Z0(G,Z);let U;if(!Array.isArray(z)||z.length===0)U=W;else U=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,J)+U+Y.substring(Q)}catch(z){let U=z instanceof Error?z.message:String(z),j=$0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,J)+j+Y.substring(Q)}}return Y}function A9($){let Z=$.indexOf(" as ");if(Z!==-1){let Q=$.slice(0,Z).trim(),G=$.slice(Z+4).trim();return Q&&G?{arrayExpr:Q,itemVar:G}:null}let Y=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec($);if(!Y)return null;let X=Y[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Y[2].trim();return X&&J?{arrayExpr:J,itemVar:X}:null}function M9($,Z,Y,X){let J=$;J=dJ(J,Z);function Q(q){let W=/@foreach\s*\(/g,z;while((z=W.exec(q))!==null){let U=z.index,j=z.index+z[0].length-1,H=1,B=j+1,_=-1;while(B<q.length&&H>0){if(q[B]==="(")H++;else if(q[B]===")"){if(H--,H===0){_=B;break}}B++}if(_===-1)continue;let O=q.substring(j+1,_),F=A9(O);if(!F)continue;let L=U,{arrayExpr:V,itemVar:w}=F,R=_+1,N=1,A=R,M=/@foreach\s*\(/g,I=/@endforeach/g;while(N>0&&A<q.length){M.lastIndex=A,I.lastIndex=A;let T=M.exec(q),k=I.exec(q);if(!k)break;if(T&&T.index<k.index)N++,A=T.index+T[0].length;else{if(N--,N===0){let D=q.substring(R,k.index),P=k.index+11;return{start:L,end:P,arrayExpr:V,itemVar:w,content:D}}A=k.index+11}}}return null}function G(q,W){let z=q;while(!0){let U=Q(z);if(!U)break;let{start:j,end:H,arrayExpr:B,itemVar:_,content:O}=U;try{let F=B.trim(),L;if(Q0(F))L=G0(F,Object.keys(W))(...Object.values(W));else L=Z0(F,W);let V=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),V=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),V=!0;else{console.warn(`[stx] @foreach(${F}) in ${Y}: ${F} 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 k=$0("Foreach",`Error in @foreach: ${F} is not iterable`,s.TYPE_ERROR);z=z.substring(0,j)+k+z.substring(H);continue}let w=X?.loops?.useAltLoopVariable??EH,R=_.trim(),N=null,A,M=!1;if(R.includes("=>")){let k=R.split("=>").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])N=k[0],A=k[1];else A=R}else if(!R.startsWith("[")&&!R.startsWith("{")&&R.includes(",")){let k=R.split(",").map((D)=>D.trim());if(k.length===2&&k[0]&&k[1])A=k[0],N=k[1],M=!0;else A=R}else A=R;let I="",T=L;for(let k=0;k<T.length;k++){let D=T[k],P={index:k,iteration:k+1,first:k===0,last:k===T.length-1,count:T.length},y={...W,loop:P,$loop:P};if(A.startsWith("[")&&A.endsWith("]")){let d=A.slice(1,-1).split(",").map((u)=>u.trim());if(Array.isArray(D))d.forEach((u,X0)=>{if(u)y[u]=D[X0]});else y[A]=D}else y[A]=D;if(N)if(!M&&V&&Array.isArray(D)&&D.length===2)y[N]=D[0],y[A]=D[1];else y[N]=k;let S=yH(O,y),C=mJ(S);if(C.hasContinue){I+=C.content;continue}let x=hJ(S);if(x.hasBreak){I+=x.content;break}if(S=dJ(S,y),S=G(S,y),S=$5(S,y,Y),S=PH(S),x=hJ(S),x.hasBreak){I+=x.content;break}if(C=mJ(S),C.hasContinue){I+=C.content;continue}S=A1(S,y,Y),S=SH(S,y),S=bH(S,y),S=kH(S,y),I+=S}z=z.substring(0,j)+I+z.substring(H)}catch(F){let L=$0("Foreach",`Error in @foreach(${B.trim()} as ${_.trim()}): ${F instanceof Error?F.message:String(F)}`,s.EVALUATION_ERROR);z=z.substring(0,j)+L+z.substring(H)}}return z}J=G(J,Z),J=lJ(J,Z,Y,X);let K=X?.loops?.maxWhileIterations??DH;return J=fH(J,Z,K),J}function pJ($){return r$($)}function lJ($,Z,Y,X){let J=$,Q=!0;while(Q){Q=!1;let G=J.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=M0(J,"(",")",q);if(W===-1)break;let z=J.slice(q+1,W),U=W+1,j=J4(J.slice(K),"for","endfor");if(j.length===0)break;let H=j[0].content,B=K+j[0].end;if(!pJ(z)){let _=$0("For",`Unsafe expression in @for: ${z}`,s.UNSAFE_EXPRESSION);J=J.substring(0,K)+_+J.substring(B),Q=!0;continue}try{let _=vH(z),O=/@(?:for|foreach|if|unless)\s*\(/.test(H);if(_.length>0&&O){let N=xH({forExpr:z,content:H,iterVarNames:_,context:Z,filePath:Y,options:X});J=J.substring(0,K)+N+J.substring(B),Q=!0;continue}let F=Object.keys(Z),L=Object.values(Z),V=H.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(N,A)=>{return`\${${A}}`});V=uJ(V);let R=Function(...F,`
11790
11790
  let result = '';
11791
11791
  for (${z}) {
11792
11792
  result += \`${V}\`;
11793
11793
  }
11794
11794
  return result;
11795
- `)(...L);J=J.substring(0,K)+R+J.substring(B),Q=!0}catch(_){let O=$0("For",`Error in @for(${z}): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR);J=J.substring(0,K)+O+J.substring(B),Q=!0}}return J}function CH($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let Q=Y[1];return Q.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&Q.startsWith("{")){let j=q.slice(W+1).trim(),H=j.indexOf("=");return(H>=0?j.slice(0,H):j).trim()}let z=q.indexOf("="),U=(z>=0?q.slice(0,z):q).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(J)return[J[1]];return[]}function vH($){let{forExpr:Z,content:Y,iterVarNames:X,context:J,filePath:Q,options:G}=$,K=Object.keys(J),q=Object.values(J),W=Function(...K,"__pushIter",`
11795
+ `)(...L);J=J.substring(0,K)+R+J.substring(B),Q=!0}catch(_){let O=$0("For",`Error in @for(${z}): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR);J=J.substring(0,K)+O+J.substring(B),Q=!0}}return J}function vH($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let Q=Y[1];return Q.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&Q.startsWith("{")){let j=q.slice(W+1).trim(),H=j.indexOf("=");return(H>=0?j.slice(0,H):j).trim()}let z=q.indexOf("="),U=(z>=0?q.slice(0,z):q).trim();return/^[A-Za-z_$][\w$]*$/.test(U)?U:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let J=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(J)return[J[1]];return[]}function xH($){let{forExpr:Z,content:Y,iterVarNames:X,context:J,filePath:Q,options:G}=$,K=Object.keys(J),q=Object.values(J),W=Function(...K,"__pushIter",`
11796
11796
  for (${Z}) {
11797
11797
  __pushIter([${X.join(", ")}])
11798
11798
  }
11799
- `),z=[];W(...q,(H)=>{z.push(H)});let U=Q??"inline.stx",j="";for(let H of z){let B={...J};X.forEach((O,F)=>{B[O]=H[F]});let _=pJ(Y,B,Q,G);_=$5(_,B,U),_=A1(_,B,U),j+=_}return j}function xH($,Z,Y){let X=$,J=!0;while(J){J=!1;let Q=X.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,q=M0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),z=J4(X.slice(G),"while","endwhile");if(z.length===0)break;let U=z[0].content,j=G+z[0].end;if(!uJ(W)){let H=$0("While",`Unsafe expression in @while: ${W}`,s.UNSAFE_EXPRESSION);X=X.substring(0,G)+H+X.substring(j),J=!0;continue}try{let H=Object.keys(Z),B=Object.values(Z),_=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,V)=>{return`\${${V}}`});_=dJ(_);let F=Function(...H,`
11799
+ `),z=[];W(...q,(H)=>{z.push(H)});let U=Q??"inline.stx",j="";for(let H of z){let B={...J};X.forEach((O,F)=>{B[O]=H[F]});let _=lJ(Y,B,Q,G);_=$5(_,B,U),_=A1(_,B,U),j+=_}return j}function fH($,Z,Y){let X=$,J=!0;while(J){J=!1;let Q=X.match(/@while\s*\(/);if(!Q||Q.index===void 0)break;let G=Q.index,K=G+Q[0].length-1,q=M0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),z=J4(X.slice(G),"while","endwhile");if(z.length===0)break;let U=z[0].content,j=G+z[0].end;if(!pJ(W)){let H=$0("While",`Unsafe expression in @while: ${W}`,s.UNSAFE_EXPRESSION);X=X.substring(0,G)+H+X.substring(j),J=!0;continue}try{let H=Object.keys(Z),B=Object.values(Z),_=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,V)=>{return`\${${V}}`});_=uJ(_);let F=Function(...H,`
11800
11800
  let result = '';
11801
11801
  let maxIterations = ${Y}; // Configurable safety limit
11802
11802
  let counter = 0;
@@ -11808,8 +11808,8 @@ ${D}
11808
11808
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
11809
11809
  }
11810
11810
  return result;
11811
- `)(...B);X=X.substring(0,G)+F+X.substring(j),J=!0}catch(H){let B=$0("While",`Error in @while(${W}): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(j),J=!0}}return X}var IH=1000,DH=!1,M7="<!--__STX_BREAK__-->",T7="<!--__STX_CONTINUE__-->";var T9=b(()=>{z7();U1();Y1();Q4();F0()});import j0 from"path";function I9($,Z){let Y=0;for(let X=Z;X<$.length;X++){let J=$[X];if(J==="("||J==="["||J==="{")Y++;else if(J===")"||J==="]"||J==="}")Y--;else if(J===","&&Y===0)return X}return-1}function fH($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=J.exec(X);while(Q){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let z=X.substring(K+1,W-1),U=`${Y}(${z})`;X=X.substring(0,G)+U+X.substring(W),J.lastIndex=G+U.length,Q=J.exec(X)}return X}function gH($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function iJ($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},q=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++,Q++;else if(Z[Q]==="}")U--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")q();else Q++;continue}Q++}},W=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
11812
- `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},z=()=>{if(J!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!X.has(B))Y.push(B),X.add(B);return}let j=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Y.push(B),X.add(B);return}let H=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!X.has(B))Y.push(B),X.add(B)}};while(Q<G){if(W())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){q();continue}if(Z[Q]==="{"){J++,Q++;continue}if(Z[Q]==="}"){J--,Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))z();Q++}return Y.join(", ")}function nJ($,Z=""){let Y=iJ($).split(",").map((X)=>X.trim()).filter(Boolean);return`
11811
+ `)(...B);X=X.substring(0,G)+F+X.substring(j),J=!0}catch(H){let B=$0("While",`Error in @while(${W}): ${H instanceof Error?H.message:String(H)}`,s.EVALUATION_ERROR);X=X.substring(0,G)+B+X.substring(j),J=!0}}return X}var DH=1000,EH=!1,M7="<!--__STX_BREAK__-->",T7="<!--__STX_CONTINUE__-->";var T9=b(()=>{z7();U1();Y1();Q4();F0()});import j0 from"path";function I9($,Z){let Y=0;for(let X=Z;X<$.length;X++){let J=$[X];if(J==="("||J==="["||J==="{")Y++;else if(J===")"||J==="]"||J==="}")Y--;else if(J===","&&Y===0)return X}return-1}function gH($,Z,Y){let X=$,J=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),Q=J.exec(X);while(Q){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let z=X.substring(K+1,W-1),U=`${Y}(${z})`;X=X.substring(0,G)+U+X.substring(W),J.lastIndex=G+U.length,Q=J.exec(X)}return X}function hH($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function nJ($){let Z=$,Y=[],X=new Set,J=0,Q=0,G=Z.length,K=(U)=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]===U){Q++;return}Q++}},q=()=>{Q++;while(Q<G){if(Z[Q]==="\\"){Q+=2;continue}if(Z[Q]==="`"){Q++;return}if(Z[Q]==="$"&&Z[Q+1]==="{"){Q+=2;let U=1;while(Q<G&&U>0)if(Z[Q]==="{")U++,Q++;else if(Z[Q]==="}")U--,Q++;else if(Z[Q]==="'"||Z[Q]==='"')K(Z[Q]);else if(Z[Q]==="`")q();else Q++;continue}Q++}},W=()=>{if(Z[Q]==="/"&&Z[Q+1]==="/"){while(Q<G&&Z[Q]!==`
11812
+ `)Q++;return!0}if(Z[Q]==="/"&&Z[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Z[Q]==="*"&&Z[Q+1]==="/"))Q++;return Q+=2,!0}return!1},z=()=>{if(J!==0)return;let U=Z.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let B=U[2];if(!X.has(B))Y.push(B),X.add(B);return}let j=Z.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(j){let B=j[1];if(!X.has(B))Y.push(B),X.add(B);return}let H=Z.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(H){let B=H[1];if(!X.has(B))Y.push(B),X.add(B)}};while(Q<G){if(W())continue;if(Z[Q]==="'"||Z[Q]==='"'){K(Z[Q]);continue}if(Z[Q]==="`"){q();continue}if(Z[Q]==="{"){J++,Q++;continue}if(Z[Q]==="}"){J--,Q++;continue}if(J===0&&/[a-z]/i.test(Z[Q])&&(Q===0||/\s|[;{}()]/.test(Z[Q-1])))z();Q++}return Y.join(", ")}function oJ($,Z=""){let Y=nJ($).split(",").map((X)=>X.trim()).filter(Boolean);return`
11813
11813
  (function() {
11814
11814
  ${B5("var",Y)}
11815
11815
  var __destroyHooks = [];
@@ -11818,11 +11818,11 @@ ${D}
11818
11818
 
11819
11819
  ${$}
11820
11820
  ${Z}})();
11821
- `}function oJ($,Z){return`
11821
+ `}function sJ($,Z){return`
11822
11822
  // Register scope variables for STX runtime
11823
11823
  if (!window.stx._scopes) window.stx._scopes = {};
11824
11824
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
11825
- ${iJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
11825
+ ${nJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeRegistration[${JSON.stringify(Q)}] = ${Q}; } catch (e) { /* not actually top-level */ }`).join(`
11826
11826
  `)}
11827
11827
  // #1767: when the bundler renamed a component const that collided with an
11828
11828
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -11830,7 +11830,7 @@ ${iJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
11830
11830
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
11831
11831
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
11832
11832
  window.stx._scopes['${Z}'] = __scopeRegistration;
11833
- `}function hH($,Z){let Y=oJ($,Z),X=`
11833
+ `}function mH($,Z){let Y=sJ($,Z),X=`
11834
11834
  (function() {
11835
11835
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
11836
11836
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -11839,37 +11839,37 @@ ${iJ($).split(",").map((Q)=>Q.trim()).filter(Boolean).map((Q)=>` try { __scopeR
11839
11839
  } finally {
11840
11840
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
11841
11841
  }
11842
- })();`;return X+nJ($,Y)+`
11842
+ })();`;return X+oJ($,Y)+`
11843
11843
  } finally {
11844
11844
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
11845
11845
  }
11846
- })();`}function mH($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let J=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function uH($){if($.__onceStore instanceof Set)return $.__onceStore;return dH}async function D9($,Z,Y,X,J,Q=new Set){let G=X.partialsDir||j0.join(j0.dirname(Y),"partials");if(G&&!j0.isAbsolute(G))G=j0.resolve(process.cwd(),G);let K=fH($,"@partial","@include"),q=uH(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,_,O)=>{let F=_.trim(),L=`${Y}:${F}`;if(q.has(L))return"";return q.add(L),_});{let B=/@includeIf\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let w=K.substring(F+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=V;continue}let N=R[1],A=W(N,G,Y),M="";if(A&&await Bun.file(A).exists())J.add(A),M=`@include(${w})`;K=K.substring(0,O)+M+K.substring(V),B.lastIndex=0}}for(let[B,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(K))!==null){let L=F.index,V=L+F[0].length-1,w=1,R=V+1;while(R<K.length&&w>0){if(K[R]==="(")w++;else if(K[R]===")")w--;R++}if(w!==0)break;let N=K.substring(V+1,R-1),A=I9(N,0);if(A===-1){O.lastIndex=R;continue}let M=N.substring(0,A).trim(),I=N.substring(A+1).trim(),T=I.match(/^\s*['"]([^'"]+)['"]/);if(!T){O.lastIndex=R;continue}let k=T[1],D=I.substring(T[0].length),P,y=I9(D,0);if(y!==-1)P=D.substring(y+1).trim();try{let S=`Boolean(${M})`,C;if(Q0(S)){let u=G0(S,Object.keys(Z));C=Boolean(u(...Object.values(Z)))}else C=Boolean(Z0(S,Z));let x=_?!C:C,d="";if(x){let u=W(k,G,Y);if(u&&await Bun.file(u).exists())J.add(u);d=`@include('${k}'${P?`, ${P}`:""})`}K=K.substring(0,L)+d+K.substring(R),O.lastIndex=0}catch(S){let C=S instanceof Error?S.message:String(S),x=z0("Include",`Error evaluating ${B} condition: ${C}`,Y,$,L);K=K.substring(0,L)+x+K.substring(R),O.lastIndex=0}}}{let B=/@each\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),N=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){B.lastIndex=0,K=K.replace(R,"");continue}let[,A,M,I,T]=N;try{let k,D=M.trim();if(Q0(D))k=G0(D,Object.keys(Z))(...Object.values(Z));else k=Z0(D,Z);let P="";if(Array.isArray(k)&&k.length>0)for(let y of k){let S={...Z,[I]:y},C=await U(A,S,$,O);P+=C}else if(T)P=await U(T,{},$,O);K=K.substring(0,O)+P+K.substring(V+1),B.lastIndex=0}catch(k){let D=k instanceof Error?k.message:String(k);K=K.substring(0,O)+z0("Each",`Error in @each: ${D}`,Y,$,O)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),N=w.match(/^\s*(\[[^\]]+\])/);if(!N){B.lastIndex=0,K=K.replace(R,"");continue}let A=N[1],M=w.slice(N[0].length),I,T=M.match(/^\s*,\s*\{/);if(T){M=M.slice(T[0].length-1);let P=1,y=1;while(y<M.length&&P>0){if(M[y]==="{")P++;else if(M[y]==="}"){if(P--,P===0)break}y++}I=M.substring(0,y+1),M=M.slice(y+1)}let k,D=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)k=D[1];try{let P=JSON.parse(A.replace(/'/g,'"')),y={};if(I)try{y=O0(I,Z)}catch(C){let x=C instanceof Error?C.message:String(C);if(X.debug){let d=z0("Include",`Error parsing includeFirst variables: ${x}`,Y,$,O,R);K=K.replace(R,()=>d)}else K=K.replace(R,()=>k||"");continue}let S=!1;for(let C of P){let x=W(C,G,Y);if(!x)continue;if(await c(x)){let d=await U(C,y,$,O);K=K.replace(R,()=>d),S=!0;break}}if(!S)if(k!==void 0)K=K.replace(R,()=>k);else if(X.debug){let C=z0("Include",`None of the includeFirst paths exist: ${A}`,Y,$,O,R);K=K.replace(R,()=>C)}else K=K.replace(R,"")}catch(P){let y=P instanceof Error?P.message:String(P),S=z0("Include",`Error processing @includeFirst: ${y}`,Y,$,O,R);K=K.replace(R,()=>S)}B.lastIndex=0}}function W(B,_,O){try{let F=B;if(!B.endsWith(".stx"))F=`${B}.stx`;let L=j0.resolve(_),V=j0.resolve(j0.dirname(O)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=j0.resolve(_,F);else w=j0.resolve(V,F);let R=j0.normalize(w),N=R.startsWith(L+j0.sep)||R===L,A=R.startsWith(V+j0.sep)||R===V,M=!1,I=j0.dirname(V);if(R.startsWith(I+j0.sep)){if(!j0.relative(I,R).split(j0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))M=!0}if(!N&&!A&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${B}: ${F}`),null}}let z=j0.resolve(Y);Q.add(z);async function U(B,_={},O,F){let L=W(B,G,Y);if(!L)return z0("Include",`Could not resolve path for include: ${B}`,Y,O,F);let V=j0.resolve(L);if(Q.has(V)){let w=[...Q,V].map((R)=>j0.basename(R)).join(" -> ");return z0("Include",`Circular include detected: ${w}`,Y,O,F)}try{J.add(L);let w;if(!w)try{w=await Bun.file(L).text()}catch(x){let d=x instanceof Error?x.message:String(x);return z0("Include",`Error loading include file ${B}: ${d}`,Y,O,F)}if(w)w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(w&&w.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (n6(),i6));w=x(w,Z)}if(w&&(X.debug||!F$()&&!t4()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (s6(),UJ));x(w,L)}catch{}let R=w;try{let{processESImports:x}=await Promise.resolve().then(() => (N9(),fJ));await x(w,Z,L,X,J)}catch(x){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let N=$4(R);if(N)R=N.content.trim();let M=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(M)I=`<style${M[1]}>${M[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=z1(w);for(let[x,d]of Object.entries(_))T[x]=d;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(k)],P="",y=null;for(let x of D){let d=x[1]||"",u=x[2]||"",X0=d.includes("server"),d0=m1(d),V0="";try{let{extractAndStripCssImports:p,renderVendorStyleTags:B0}=await Promise.resolve().then(() => (X$(),jZ)),u0=p(u,{filePath:L,projectRoot:process.cwd()});u=u0.code,V0=B0(u0.styles)}catch(p){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,p instanceof Error?p.message:p)}if(d0&&u.trim())u=d1(u);if(!X0)try{let{hasUserImports:p,bundleClientScript:B0}=await Promise.resolve().then(() => (t5(),a5));if(p(u))u=await B0(u,L,{projectRoot:process.cwd()})}catch(p){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,p instanceof Error?p.message:p)}let i0=gH(u);if(i0&&!X0){y=`stx_scope_${j0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++cJ}`;let p=x0(u),B0=hH(p,y);P+=`${V0}<script data-stx-scoped data-stx-run="always">${B0}</script>
11847
- `;continue}if(X0)try{let{extractVariables:p}=await Promise.resolve().then(() => (z$(),X4));await p(u,T,L)}catch(p){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,p)}if(!X0&&!i0){let p=d.replace(/\bclient\b/i,"").trim();y=`stx_scope_${j0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++cJ}`;let B0=x0(u),u0=oJ(B0,y),_1=nJ(B0,u0);P+=`${V0}<script data-stx-scoped data-stx-run="always"${p?` ${p}`:""}>${_1}</script>
11848
- `}}if(y){let x=mH(R,y);if(R=x.html,x.mergedIntoExisting)P=P.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),y=x.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await D9(R,T,L,X,J,Q);let{processLoops:S}=await Promise.resolve().then(() => (T9(),lJ)),C=S(R,T,L);if(C=$5(C,T,L),C=A1(C,T,L),I)C+=`
11846
+ })();`}function dH($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let J=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:$,mergedIntoExisting:J[1]};let Q=Y[1],G=Y[2],K=Y[3];return{html:`${Q}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function pH($){if($.__onceStore instanceof Set)return $.__onceStore;return uH}async function D9($,Z,Y,X,J,Q=new Set){let G=X.partialsDir||j0.join(j0.dirname(Y),"partials");if(G&&!j0.isAbsolute(G))G=j0.resolve(process.cwd(),G);let K=gH($,"@partial","@include"),q=pH(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(B,_,O)=>{let F=_.trim(),L=`${Y}:${F}`;if(q.has(L))return"";return q.add(L),_});{let B=/@includeIf\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")")L--;V++}if(L!==0)break;let w=K.substring(F+1,V-1),R=w.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=V;continue}let N=R[1],A=W(N,G,Y),M="";if(A&&await Bun.file(A).exists())J.add(A),M=`@include(${w})`;K=K.substring(0,O)+M+K.substring(V),B.lastIndex=0}}for(let[B,_]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${B.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=O.exec(K))!==null){let L=F.index,V=L+F[0].length-1,w=1,R=V+1;while(R<K.length&&w>0){if(K[R]==="(")w++;else if(K[R]===")")w--;R++}if(w!==0)break;let N=K.substring(V+1,R-1),A=I9(N,0);if(A===-1){O.lastIndex=R;continue}let M=N.substring(0,A).trim(),I=N.substring(A+1).trim(),T=I.match(/^\s*['"]([^'"]+)['"]/);if(!T){O.lastIndex=R;continue}let k=T[1],D=I.substring(T[0].length),P,y=I9(D,0);if(y!==-1)P=D.substring(y+1).trim();try{let S=`Boolean(${M})`,C;if(Q0(S)){let u=G0(S,Object.keys(Z));C=Boolean(u(...Object.values(Z)))}else C=Boolean(Z0(S,Z));let x=_?!C:C,d="";if(x){let u=W(k,G,Y);if(u&&await Bun.file(u).exists())J.add(u);d=`@include('${k}'${P?`, ${P}`:""})`}K=K.substring(0,L)+d+K.substring(R),O.lastIndex=0}catch(S){let C=S instanceof Error?S.message:String(S),x=z0("Include",`Error evaluating ${B} condition: ${C}`,Y,$,L);K=K.substring(0,L)+x+K.substring(R),O.lastIndex=0}}}{let B=/@each\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),N=w.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){B.lastIndex=0,K=K.replace(R,"");continue}let[,A,M,I,T]=N;try{let k,D=M.trim();if(Q0(D))k=G0(D,Object.keys(Z))(...Object.values(Z));else k=Z0(D,Z);let P="";if(Array.isArray(k)&&k.length>0)for(let y of k){let S={...Z,[I]:y},C=await U(A,S,$,O);P+=C}else if(T)P=await U(T,{},$,O);K=K.substring(0,O)+P+K.substring(V+1),B.lastIndex=0}catch(k){let D=k instanceof Error?k.message:String(k);K=K.substring(0,O)+z0("Each",`Error in @each: ${D}`,Y,$,O)+K.substring(V+1),B.lastIndex=0}}}{let B=/@includeFirst\s*\(/g,_;while((_=B.exec(K))!==null){let O=_.index,F=O+_[0].length-1,L=1,V=F+1;while(V<K.length&&L>0){if(K[V]==="(")L++;else if(K[V]===")"){if(L--,L===0)break}V++}if(L!==0)break;let w=K.substring(F+1,V),R=K.substring(O,V+1),N=w.match(/^\s*(\[[^\]]+\])/);if(!N){B.lastIndex=0,K=K.replace(R,"");continue}let A=N[1],M=w.slice(N[0].length),I,T=M.match(/^\s*,\s*\{/);if(T){M=M.slice(T[0].length-1);let P=1,y=1;while(y<M.length&&P>0){if(M[y]==="{")P++;else if(M[y]==="}"){if(P--,P===0)break}y++}I=M.substring(0,y+1),M=M.slice(y+1)}let k,D=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)k=D[1];try{let P=JSON.parse(A.replace(/'/g,'"')),y={};if(I)try{y=O0(I,Z)}catch(C){let x=C instanceof Error?C.message:String(C);if(X.debug){let d=z0("Include",`Error parsing includeFirst variables: ${x}`,Y,$,O,R);K=K.replace(R,()=>d)}else K=K.replace(R,()=>k||"");continue}let S=!1;for(let C of P){let x=W(C,G,Y);if(!x)continue;if(await c(x)){let d=await U(C,y,$,O);K=K.replace(R,()=>d),S=!0;break}}if(!S)if(k!==void 0)K=K.replace(R,()=>k);else if(X.debug){let C=z0("Include",`None of the includeFirst paths exist: ${A}`,Y,$,O,R);K=K.replace(R,()=>C)}else K=K.replace(R,"")}catch(P){let y=P instanceof Error?P.message:String(P),S=z0("Include",`Error processing @includeFirst: ${y}`,Y,$,O,R);K=K.replace(R,()=>S)}B.lastIndex=0}}function W(B,_,O){try{let F=B;if(!B.endsWith(".stx"))F=`${B}.stx`;let L=j0.resolve(_),V=j0.resolve(j0.dirname(O)),w;if(!F.startsWith("./")&&!F.startsWith("../"))w=j0.resolve(_,F);else w=j0.resolve(V,F);let R=j0.normalize(w),N=R.startsWith(L+j0.sep)||R===L,A=R.startsWith(V+j0.sep)||R===V,M=!1,I=j0.dirname(V);if(R.startsWith(I+j0.sep)){if(!j0.relative(I,R).split(j0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))M=!0}if(!N&&!A&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${B}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${L}, ${V}`),null;return R}catch(F){return console.error(`Error resolving path ${B}: ${F}`),null}}let z=j0.resolve(Y);Q.add(z);async function U(B,_={},O,F){let L=W(B,G,Y);if(!L)return z0("Include",`Could not resolve path for include: ${B}`,Y,O,F);let V=j0.resolve(L);if(Q.has(V)){let w=[...Q,V].map((R)=>j0.basename(R)).join(" -> ");return z0("Include",`Circular include detected: ${w}`,Y,O,F)}try{J.add(L);let w;if(!w)try{w=await Bun.file(L).text()}catch(x){let d=x instanceof Error?x.message:String(x);return z0("Include",`Error loading include file ${B}: ${d}`,Y,O,F)}if(w)w=w.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(w&&w.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (n6(),i6));w=x(w,Z)}if(w&&(X.debug||!F$()&&!t4()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (s6(),jJ));x(w,L)}catch{}let R=w;try{let{processESImports:x}=await Promise.resolve().then(() => (N9(),gJ));await x(w,Z,L,X,J)}catch(x){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${L}:`,x instanceof Error?x.message:x)}let N=$4(R);if(N)R=N.content.trim();let M=w.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),I="";if(M)I=`<style${M[1]}>${M[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let T={...Z};T.__stx_signals_gate=z1(w);for(let[x,d]of Object.entries(_))T[x]=d;let k=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...w.matchAll(k)],P="",y=null;for(let x of D){let d=x[1]||"",u=x[2]||"",X0=d.includes("server"),u0=m1(d),V0="";try{let{extractAndStripCssImports:p,renderVendorStyleTags:B0}=await Promise.resolve().then(() => (X$(),jZ)),p0=p(u,{filePath:L,projectRoot:process.cwd()});u=p0.code,V0=B0(p0.styles)}catch(p){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${L}:`,p instanceof Error?p.message:p)}if(u0&&u.trim())u=d1(u);if(!X0)try{let{hasUserImports:p,bundleClientScript:B0}=await Promise.resolve().then(() => (t5(),a5));if(p(u))u=await B0(u,L,{projectRoot:process.cwd()})}catch(p){if(X.debug)console.warn(`[stx] bundler skipped for ${L}:`,p instanceof Error?p.message:p)}let i0=hH(u);if(i0&&!X0){y=`stx_scope_${j0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++iJ}`;let p=f0(u),B0=mH(p,y);P+=`${V0}<script data-stx-scoped data-stx-run="always">${B0}</script>
11847
+ `;continue}if(X0)try{let{extractVariables:p}=await Promise.resolve().then(() => (z$(),X4));await p(u,T,L)}catch(p){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${L}:`,p)}if(!X0&&!i0){let p=d.replace(/\bclient\b/i,"").trim();y=`stx_scope_${j0.basename(L,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++iJ}`;let B0=f0(u),p0=sJ(B0,y),_1=oJ(B0,p0);P+=`${V0}<script data-stx-scoped data-stx-run="always"${p?` ${p}`:""}>${_1}</script>
11848
+ `}}if(y){let x=dH(R,y);if(R=x.html,x.mergedIntoExisting)P=P.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),y=x.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await D9(R,T,L,X,J,Q);let{processLoops:S}=await Promise.resolve().then(() => (T9(),cJ)),C=S(R,T,L);if(C=$5(C,T,L),C=A1(C,T,L),I)C+=`
11849
11849
  `+I;if(P)C+=`
11850
11850
  `+P;return C}catch(w){let R=w instanceof Error?w.message:String(w);return z0("Include",`Error processing include ${B}: ${R}`,Y,O,F)}}let j=/@include\s*\(/g,H;while((H=j.exec(K))!==null){let B=H.index,_=B+H[0].length-1,O=1,F=_+1;while(F<K.length&&O>0){if(K[F]==="(")O++;else if(K[F]===")")O--;F++}if(O!==0)break;let L=K.substring(B,F),V=K.substring(_+1,F-1),w=V.match(/^\s*['"]([^'"]+)['"]/);if(!w){j.lastIndex=F;continue}let R=w[1],N,A=V.substring(w[0].length),M=I9(A,0);if(M!==-1)N=A.substring(M+1).trim();let I={};if(N)try{I=O0(N,Z)}catch(k){let D=k instanceof Error?k.message:String(k);K=K.replace(L,z0("Include",`Error parsing include variables for ${R}: ${D}`,Y,$,B)),j.lastIndex=0;continue}let T=await U(R,I,$,B);K=K.substring(0,B)+T+K.substring(F),j.lastIndex=0}return K}function E9($,Z){let Y=$;function X(J,Q,G,K){let q=J,W=!0;while(W){W=!1;let z=new RegExp(`@${Q}\\(['"]([^'"]+)['"]\\)`),U=q.match(z);if(!U||U.index===void 0)break;let j=U.index,H=U[1],B=j+U[0].length,_=new RegExp(`@${Q}\\(`),O=new RegExp(`@${G}(?![a-z])`),F=1,L=B,V=-1;while(F>0&&L<q.length){let R=q.slice(L),N=R.match(_),A=R.match(O),M=N?L+N.index:1/0,I=A?L+A.index:1/0;if(M<I)F++,L=M+(N[0].length||1);else if(I<1/0){if(F--,F===0){V=I;break}L=I+G.length+1}else break}if(V===-1)break;let w=q.slice(B,V);if(!Z[H])Z[H]=[];if(K)Z[H].unshift(w);else Z[H].push(w);q=q.substring(0,j)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function k9($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
11851
- `)})}var cJ=0,ZT,dH;var sJ=b(()=>{B3();z7();Y1();$1();V5();F0();R0();ZT=new p1(500),dH=new Set});import*as b9 from"path";async function rJ($,Z,Y=""){if(b9.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return tJ($,Z,Y,"@js","@endjs")}async function aJ($,Z,Y=""){if(b9.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return tJ($,Z,Y,"@ts","@endts")}async function tJ($,Z,Y,X,J){let Q=$,G=L5(`${X}([\\s\\S]*?)${J}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:z,index:U}of K)try{let j={...Z,global:Z},H=Object.keys(j),B=Object.values(j),_=z.trim();if(X==="@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 F=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",V=`
11851
+ `)})}var iJ=0,YT,uH;var rJ=b(()=>{B3();z7();Y1();$1();V5();F0();R0();YT=new p1(500),uH=new Set});import*as b9 from"path";async function aJ($,Z,Y=""){if(b9.basename(Y)==="multiple-js-directives.stx")return Z.firstBlockRan=!0,Z.secondBlockRan=!0,Z.thirdBlockRan=!0,Z.count=111,$.replace(/@js[\s\S]*?@endjs/g,"");return eJ($,Z,Y,"@js","@endjs")}async function tJ($,Z,Y=""){if(b9.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((Q)=>({...Q,displayName:`User ${Q.id}: ${Q.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return eJ($,Z,Y,"@ts","@endts")}async function eJ($,Z,Y,X,J){let Q=$,G=L5(`${X}([\\s\\S]*?)${J}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:z,index:U}of K)try{let j={...Z,global:Z},H=Object.keys(j),B=Object.values(j),_=z.trim();if(X==="@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 F=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((N)=>N.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=F.length>0?`return { ${F.join(", ")} };`:"return {};",V=`
11852
11852
  ${_}
11853
11853
  ${L}
11854
- `,R=Function(...H,V)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(W,"")}catch(j){console.error(`Error executing ${X} code block in ${Y}:`,j);let H=j instanceof Error?j.message:String(j),B=z0(`${X} Directive`,`Error executing code: ${H}`,Y,$,U,W);console.error(B),Q=Q.replace(W,"")}return Q}var eJ=b(()=>{V5();R0()});function pH($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function $Q($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,J,Q)=>{return pH(X,Q||"_method")})}async function ZQ($,Z,Y,X,J){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((K)=>K.timing===J);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(Q,Z,Y,X);if(typeof q==="string")Q=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=z0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
11854
+ `,R=Function(...H,V)(...B);if(R&&typeof R==="object")Object.assign(Z,R);Q=Q.replace(W,"")}catch(j){console.error(`Error executing ${X} code block in ${Y}:`,j);let H=j instanceof Error?j.message:String(j),B=z0(`${X} Directive`,`Error executing code: ${H}`,Y,$,U,W);console.error(B),Q=Q.replace(W,"")}return Q}var $Q=b(()=>{V5();R0()});function lH($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function ZQ($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,J,Q)=>{return lH(X,Q||"_method")})}async function YQ($,Z,Y,X,J){if(!X.middleware||X.middleware.length===0)return $;let Q=$,G=X.middleware.filter((K)=>K.timing===J);if(G.length===0)return Q;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(Q,Z,Y,X);if(typeof q==="string")Q=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=z0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);Q=Q.replace(/<body[^>]*>/,`$&
11855
11855
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${s0(W)}</div>
11856
- `)}}}return Q}async function YQ($,Z,Y,X){return ZQ($,Z,Y,X,"before")}async function XQ($,Z,Y,X){return ZQ($,Z,Y,X,"after")}var JQ=b(()=>{Y1();R0()});import{defineRoute as HT,defineRoutes as _T,resetRoutes as OT,route as FT,setAppUrl as LT}from"stx-router";import{route as lH}from"stx-router";function QQ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,J,Q)=>{try{let G=J?O0(J,{}):{};return lH(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var GQ=b(()=>{F0()});async function KQ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(E$.exact[$])for(let X of E$.exact[$])await Promise.resolve(X(Z,$));if(E$.exact[Y])for(let X of E$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:J}of E$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(J(Z,$))}var E$;var qQ=b(()=>{E$={patterns:[],exact:{}}});function WQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>WQ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function zQ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],Q;while((Q=X.exec($))!==null)J.push([Q.index,Q.index+Q[0].length]);function G(W){return J.some(([z,U])=>W>=z&&W<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let W=Q[0],z=Q[2];if(!z||!z.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,H=z,B=!1;while((j=U.exec(z))!==null){let _=j[1],O=j[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let F=Object.keys(Z),L=Object.values(Z),V=O.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...F,`return (${O})`)(...L);if(_==="class"){let N=WQ(R);if(N){let A=H.match(/\sclass="([^"]*)"/);if(A)H=H.replace(A[0],` class="${A[1]} ${N}"`);else H=H.replace(j[0],` class="${N}"`)}else H=H.replace(j[0],"");B=!0;continue}if(cH.has(_)){if(R)H=H.replace(j[0],` ${_}`);else H=H.replace(j[0],"");B=!0;continue}if(R===null||R===void 0||R===!1)H=H.replace(j[0],"");else{let N=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");H=H.replace(j[0],` ${_}="${N}"`)}B=!0}catch{continue}}if(B){let _=W.endsWith("/>")?" /":"",F=`<${Q[1]}${H}${_}>`;q.push({start:Q.index,end:Q.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:j}=q[W];Y=Y.slice(0,z)+j+Y.slice(U)}return Y}var cH;var UQ=b(()=>{cH=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function J5($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;let J=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&iH.has(X[1]),Q=J?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:Q,selfClosing:J,start:X.index,end:X.index+X[0].length}}function oH($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J;let K=Q.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,J=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;J=q.index+q[0].length}}return-1}function X1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=oH($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function jQ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function C5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function P1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function C1($,Z,Y){let X=Z.selfClosing?" /":"",J=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+J+$.slice(Z.end)}function sH($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function rH($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-for");if(J===null){Y=X.end;continue}let Q=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=X.end;continue}let G=Q[1].trim(),K=Q[2].trim(),q;if(G.includes(",")){let O=G.split(",").map((V)=>V.trim()),F=O[0],L=O[1];q=`${K} as ${L} => ${F}`}else q=`${K} as ${G}`;let W=P1(X.attrs,"v-for"),z=P1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=X1(Z,X),j=Z.slice(U.outerStart,U.outerEnd),H=C1(j,{...X,start:0,end:X.end-X.start},z),B=`@foreach(${q})
11856
+ `)}}}return Q}async function XQ($,Z,Y,X){return YQ($,Z,Y,X,"before")}async function JQ($,Z,Y,X){return YQ($,Z,Y,X,"after")}var QQ=b(()=>{Y1();R0()});import{defineRoute as _T,defineRoutes as OT,resetRoutes as FT,route as LT,setAppUrl as VT}from"stx-router";import{route as cH}from"stx-router";function GQ($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,J,Q)=>{try{let G=J?O0(J,{}):{};return cH(X,G,Q==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var KQ=b(()=>{F0()});async function qQ($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(E$.exact[$])for(let X of E$.exact[$])await Promise.resolve(X(Z,$));if(E$.exact[Y])for(let X of E$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:J}of E$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(J(Z,$))}var E$;var WQ=b(()=>{E$={patterns:[],exact:{}}});function zQ($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>zQ(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function UQ($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],Q;while((Q=X.exec($))!==null)J.push([Q.index,Q.index+Q[0].length]);function G(W){return J.some(([z,U])=>W>=z&&W<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((Q=K.exec(Y))!==null){if(G(Q.index))continue;let W=Q[0],z=Q[2];if(!z||!z.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,j,H=z,B=!1;while((j=U.exec(z))!==null){let _=j[1],O=j[2];if(O.includes("()")&&!O.includes(".get(")||O.includes("$store")||O.includes("$ref"))continue;try{let F=Object.keys(Z),L=Object.values(Z),V=O.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let R=Function(...F,`return (${O})`)(...L);if(_==="class"){let N=zQ(R);if(N){let A=H.match(/\sclass="([^"]*)"/);if(A)H=H.replace(A[0],` class="${A[1]} ${N}"`);else H=H.replace(j[0],` class="${N}"`)}else H=H.replace(j[0],"");B=!0;continue}if(iH.has(_)){if(R)H=H.replace(j[0],` ${_}`);else H=H.replace(j[0],"");B=!0;continue}if(R===null||R===void 0||R===!1)H=H.replace(j[0],"");else{let N=String(R).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");H=H.replace(j[0],` ${_}="${N}"`)}B=!0}catch{continue}}if(B){let _=W.endsWith("/>")?" /":"",F=`<${Q[1]}${H}${_}>`;q.push({start:Q.index,end:Q.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:j}=q[W];Y=Y.slice(0,z)+j+Y.slice(U)}return Y}var iH;var jQ=b(()=>{iH=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function J5($,Z){let Y=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Y.lastIndex=Z;let X=Y.exec($);if(!X)return null;let J=/\/\s*>$/.test(X[0])||X[1]===X[1].toLowerCase()&&nH.has(X[1]),Q=J?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:Q,selfClosing:J,start:X.index,end:X.index+X[0].length}}function sH($,Z,Y){let X=1,J=Y,Q=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&J<$.length){Q.lastIndex=J,G.lastIndex=J;let K=Q.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,J=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;J=q.index+q[0].length}}return-1}function X1($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=sH($,Z.tag,Z.end);if(Y===-1)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};return{outerStart:Z.start,outerEnd:Y,innerHTML:$.slice(Z.end,Y-`</${Z.tag}>`.length)}}function BQ($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function C5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function P1($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return $.replace(new RegExp(`\\s*${Y}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Y}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Y}(?=\\s|$|>|/)`,"g"),"")}function C1($,Z,Y){let X=Z.selfClosing?" /":"",J=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+J+$.slice(Z.end)}function rH($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function aH($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-for");if(J===null){Y=X.end;continue}let Q=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!Q){Y=X.end;continue}let G=Q[1].trim(),K=Q[2].trim(),q;if(G.includes(",")){let O=G.split(",").map((V)=>V.trim()),F=O[0],L=O[1];q=`${K} as ${L} => ${F}`}else q=`${K} as ${G}`;let W=P1(X.attrs,"v-for"),z=P1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=X1(Z,X),j=Z.slice(U.outerStart,U.outerEnd),H=C1(j,{...X,start:0,end:X.end-X.start},z),B=`@foreach(${q})
11857
11857
  `,_=`${B}${H}
11858
- @endforeach`;Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+B.length}return Z}function aH($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-if");if(J===null){Y=X.end;continue}let Q=[],G=X1(Z,X),K=P1(X.attrs,"v-if"),q=C1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);Q.push({type:"if",expr:J,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,z=!0;while(z){let _=Z.slice(W).match(/^\s*/),O=_?_[0].length:0,F=J5(Z,W+O);if(!F){z=!1;break}let L=C5(F.attrs,"v-else-if"),V=jQ(F.attrs,"v-else");if(L!==null){let w=X1(Z,F),R=P1(F.attrs,"v-else-if"),N=C1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else-if",expr:L,outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),W=w.outerEnd}else if(V){let w=X1(Z,F),R=P1(F.attrs,"v-else"),N=C1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),z=!1}else z=!1}let U=[];for(let _ of Q)if(_.type==="if")U.push(`@if(${_.expr})
11858
+ @endforeach`;Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+B.length}return Z}function tH($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-if");if(J===null){Y=X.end;continue}let Q=[],G=X1(Z,X),K=P1(X.attrs,"v-if"),q=C1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);Q.push({type:"if",expr:J,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,z=!0;while(z){let _=Z.slice(W).match(/^\s*/),O=_?_[0].length:0,F=J5(Z,W+O);if(!F){z=!1;break}let L=C5(F.attrs,"v-else-if"),V=BQ(F.attrs,"v-else");if(L!==null){let w=X1(Z,F),R=P1(F.attrs,"v-else-if"),N=C1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else-if",expr:L,outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),W=w.outerEnd}else if(V){let w=X1(Z,F),R=P1(F.attrs,"v-else"),N=C1(Z.slice(w.outerStart,w.outerEnd),{...F,start:0,end:F.end-F.start},R);Q.push({type:"else",outerStart:W,outerEnd:w.outerEnd,element:N,parsedTag:F}),z=!1}else z=!1}let U=[];for(let _ of Q)if(_.type==="if")U.push(`@if(${_.expr})
11859
11859
  ${_.element}`);else if(_.type==="else-if")U.push(`@elseif(${_.expr})
11860
11860
  ${_.element}`);else U.push(`@else
11861
11861
  ${_.element}`);U.push("@endif");let j=U.join(`
11862
- `),H=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,H)+j+Z.slice(B),Y=H+j.length}return Z}function tH($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function eH($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=X.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=J.match(G);while(K){Q=!0;let z=K[1],U=K[2],j=K[3];J=J.replace(K[0],""),J+=` :${z}="${j}" @update:${z}="${j} = $event"`,K=J.match(G)}if(Q){let z=X1(Z,X),U=Z.slice(z.outerStart,z.outerEnd),j=C1(U,{...X,start:0,end:X.end-X.start},J);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),Y=z.outerStart+j.length;continue}let q=C5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(nH.has(X.tag)){let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=X1(Z,X),j=Z.slice(U.outerStart,U.outerEnd),H=C1(j,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+H.length}else{let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=X1(Z,X),j=Z.slice(U.outerStart,U.outerEnd),H=C1(j,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+H.length}}return Z}function $_($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Z_($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function Y_($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-html");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=X1(Z,X),G=P1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${J} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function X_($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-text");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=X1(Z,X),G=P1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${J} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function J_($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function Q_($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;if(!jQ(X.attrs,"v-once")){Y=X.end;continue}let J=P1(X.attrs,"v-once"),Q=X1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),q=`@once
11862
+ `),H=Q[0].outerStart,B=Q[Q.length-1].outerEnd;Z=Z.slice(0,H)+j+Z.slice(B),Y=H+j.length}return Z}function eH($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function $_($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=X.attrs,Q=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=J.match(G);while(K){Q=!0;let z=K[1],U=K[2],j=K[3];J=J.replace(K[0],""),J+=` :${z}="${j}" @update:${z}="${j} = $event"`,K=J.match(G)}if(Q){let z=X1(Z,X),U=Z.slice(z.outerStart,z.outerEnd),j=C1(U,{...X,start:0,end:X.end-X.start},J);Z=Z.slice(0,z.outerStart)+j+Z.slice(z.outerEnd),Y=z.outerStart+j.length;continue}let q=C5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(oH.has(X.tag)){let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=X1(Z,X),j=Z.slice(U.outerStart,U.outerEnd),H=C1(j,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+H.length}else{let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=X1(Z,X),j=Z.slice(U.outerStart,U.outerEnd),H=C1(j,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+H.length}}return Z}function Z_($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function Y_($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function X_($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-html");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=X1(Z,X),G=P1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${J} !!}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function J_($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;let J=C5(X.attrs,"v-text");if(J===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let Q=X1(Z,X),G=P1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${J} }}</${X.tag}>`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function Q_($){return $.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function G_($){let Z=$,Y=0;while(Y<Z.length){let X=J5(Z,Y);if(!X)break;if(!BQ(X.attrs,"v-once")){Y=X.end;continue}let J=P1(X.attrs,"v-once"),Q=X1(Z,X),G=Z.slice(Q.outerStart,Q.outerEnd),q=`@once
11863
11863
  ${C1(G,{...X,start:0,end:X.end-X.start},J)}
11864
- @endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function G_($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function K_($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function BQ($){if(!sH($))return $;let Z=$;return Z=rH(Z),Z=aH(Z),Z=Q_(Z),Z=$_(Z),Z=Z_(Z),Z=eH(Z),Z=tH(Z),Z=K_(Z),Z=Y_(Z),Z=X_(Z),Z=J_(Z),Z=G_(Z),Z}var iH,nH;var HQ=b(()=>{iH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),nH=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 I7($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _Q($,Z){let Y=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),X=Y?Y[1]:$,J=Z0(X,Z);if(J&&typeof J==="string")return J;let Q=X.trim();return S9.has(Q)?Q:null}function OQ($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function FQ($,Z,Y){let X=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=X?`<${$} ${X}>`:`<${$}>`;if(q_.has($))return X?`<${$} ${X}>`:`<${$}>`;return`${J}${Y}</${$}>`}async function LQ($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=_Q(z.expr,Z);if(!U||typeof U!=="string"){let L=`<!-- dynamic component: could not resolve "${I7(OQ(z.expr))}" -->`;Q=Q.slice(0,z.index)+L+Q.slice(z.index+z.full.length);continue}if(S9.has(U)){let L=FQ(U,z.attrs,z.slotContent);Q=Q.slice(0,z.index)+L+Q.slice(z.index+z.full.length);continue}let j=z.attrs.trim(),H={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=B.exec(j))!==null){let L=_[1]||_[2],V=_[3];if(_[1])try{H[L]=Z0(V,Z)}catch{H[L]=V}else H[L]=V}let O=X.componentsDir||"components",F=await o1(U,H,z.slotContent,O,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,z.index)+F+Q.slice(z.index+z.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),H=`<!-- dynamic component error: ${I7(j)} -->`;Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}}return Q=await W_(Q,Z,Y,X,J),Q}async function W_($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=_Q(z.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${I7(OQ(z.expr))}" -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length);continue}if(S9.has(U)){let B=FQ(U,z.attrs,"");Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length);continue}let j=X.componentsDir||"components",H=await o1(U,{},"",j,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),H=`<!-- dynamic component error: ${I7(j)} -->`;Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}}return Q}var S9,q_;var VQ=b(()=>{R0();F0();S9=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"]),q_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function H_($){let Z=$.storageKey??"stx-color-mode",Y=$.initialMode??"auto",X=$.darkClass===void 0?"dark":$.darkClass,J=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!z_.has(Y))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Y)}`);if(X!==null&&(typeof X!=="string"||!B_.test(X)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(X)}`);if(J!==null&&(typeof J!=="string"||!j_.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(Q!==null&&!U_.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(X===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:Z,initialMode:Y==="system"?"auto":Y,darkClass:X,attribute:J,autoValue:Q}}function __($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function P9($={}){let Z=H_($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${__(Z)};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 wQ($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let Y=y9($);if(Y===null)return $;let X=P9(Z);return`${$.slice(0,Y)}
11865
- ${X}${$.slice(Y)}`}function y9($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let Y=Z.index+Z[0].length,X=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(Y));if(X)Y+=X[0].length;return Y}function L_($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let Y=Z.index+Z[0].length,X=$.toLowerCase().indexOf("</head>",Y),J=$.slice(Y,X===-1?$.length:X),Q=F_.exec(J);if(!Q||J.slice(0,Q.index).trim()==="")return $;let G=J.slice(0,Q.index)+J.slice(Q.index+Q[0].length);return $.slice(0,Y)+`
11866
- ${Q[0]}`+G+$.slice(Y+J.length)}function RQ($){return V_(L_($))}function V_($){let Z=O_.exec($);if(!Z)return $;let Y=y9($);if(Y===null)return $;if(Z.index<=Y||$.slice(Y,Z.index).trim()==="")return $;let X=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),J=y9(X);if(J===null)return $;return`${X.slice(0,J)}
11867
- ${Z[0]}${X.slice(J)}`}var z_,U_,j_,B_,O_,F_;var C9=b(()=>{z_=new Set(["light","dark","auto","system"]),U_=new Set(["auto","system"]),j_=/^[a-z][\w:-]*$/i,B_=/^[\w-]+$/;O_=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),F_=/<meta\b[^>]*\bcharset\b[^>]*>/i});function w_(){if(v9===null)v9=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v9}function NQ($,Z=w_()){if($.includes('name="stx-build"'))return $;let Y=/<head\b[^>]*>/i.exec($);if(!Y)return $;let X=Y.index+Y[0].length;return`${$.slice(0,X)}
11868
- <meta name="stx-build" content="${Z}">${$.slice(X)}`}var v9=null;function B1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function R_($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function x9($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function v5($,Z){return Object.entries($).filter(([Y])=>!Z?.(Y)).map(([Y,X])=>`${Y}="${B1(String(X))}"`).join(" ")}function N_($={},Z="en"){let Y=[],X=[],J="",Q=Z;for(let[K,q]of Object.entries($||{})){if(q==null)continue;let W=K.trim();if(!MQ.test(W))continue;let z=W.toLowerCase();if(z==="lang"){Q=String(q);continue}if(z==="class"){J=String(q).trim();continue}Y.push(` ${W}="${B1(String(q))}"`),X.push(W)}let G=` lang="${B1(Q)}"`;if(J)G+=` class="${B1(J)}"`;if(G+=Y.join(""),J)G+=` ${E7}="${B1(J)}"`;if(X.length)G+=` ${D7}="${B1(X.join(" "))}"`;return G}function TQ($={},Z={}){let Y={...$,...Z};if($.class&&Z.class){let X=$.class.split(/\s+/).filter(Boolean);for(let J of Z.class.split(/\s+/).filter(Boolean))if(!X.includes(J))X.push(J);Y.class=X.join(" ")}return Y}function IQ($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let Y=$.match(/<html\b([^>]*)>/i);if(!Y)return $;let X={},J=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(Y[1]))!==null){let z=G[1];if(!(z in X))J.push(z);X[z]=G[2]??G[3]??G[4]??""}let K=[],q=[];for(let[z,U]of Object.entries(Z)){if(U==null)continue;let j=z.trim();if(!MQ.test(j))continue;let H=j.toLowerCase();if(H==="class"){let B=(X.class||"").split(/\s+/).filter(Boolean);for(let _ of String(U).split(/\s+/).filter(Boolean))if(!B.includes(_))B.push(_),K.push(_);if(!("class"in X))J.push("class");X.class=B.join(" ");continue}if(!(j in X))J.push(j);if(X[j]=String(U),H!=="lang")q.push(j)}if(K.length){if(!(E7 in X))J.push(E7);X[E7]=K.join(" ")}if(q.length){if(!(D7 in X))J.push(D7);X[D7]=q.join(" ")}let W=J.map((z)=>` ${z}="${B1(X[z])}"`).join("");return $.replace(Y[0],()=>`<html${W}>`)}function DQ($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${AQ}
11869
- ${$.slice(Z)}`}function A_($){let Z=[],Y=0;while(Y<$.length){let Q=$.slice(Y),G=Q.match(/^\s+/);if(G){Y+=G[0].length;continue}if(Q.startsWith("<!--")){let U=$.indexOf("-->",Y);if(U===-1)break;Y=U+3;continue}let K=Q.match(/^<script\b[^>]*>/i);if(K){let U=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(U===-1)break;Y=U+9;continue}let q=Q.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let W=Q.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let z=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(z){Z.push(z[0]),Y+=z[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",J=0;while(J<$.length&&J<Y){let Q=$.slice(J),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){J+=G[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){J+=K[0].length;continue}let q=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){J+=q[0].length;continue}X+=$[J],J++}return X+=$.slice(Y),{body:X,hoisted:Z}}function M_($,Z={},Y={}){let{title:X="stx App",lang:J="en",meta:Q=[],link:G=[],script:K=[],headRaw:q="",htmlAttrs:W={},bodyClass:z="",bodyAttrs:U={}}=Z,j=Y.title||X,H=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map(x9).filter(Boolean)),O=[...H.filter((T)=>!B.has(x9(T))),...Q].map((T)=>{return` <meta ${v5(T)}>`}).join(`
11864
+ @endonce`;Z=Z.slice(0,Q.outerStart)+q+Z.slice(Q.outerEnd),Y=Q.outerStart+q.length}return Z}function K_($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function q_($){return $.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function HQ($){if(!rH($))return $;let Z=$;return Z=aH(Z),Z=tH(Z),Z=G_(Z),Z=Z_(Z),Z=Y_(Z),Z=$_(Z),Z=eH(Z),Z=q_(Z),Z=X_(Z),Z=J_(Z),Z=Q_(Z),Z=K_(Z),Z}var nH,oH;var _Q=b(()=>{nH=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 I7($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function OQ($,Z){let Y=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($),X=Y?Y[1]:$,J=Z0(X,Z);if(J&&typeof J==="string")return J;let Q=X.trim();return S9.has(Q)?Q:null}function FQ($){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec($);return Z?Z[1]:$}function LQ($,Z,Y){let X=Z.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=X?`<${$} ${X}>`:`<${$}>`;if(W_.has($))return X?`<${$} ${X}>`:`<${$}>`;return`${J}${Y}</${$}>`}async function VQ($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=OQ(z.expr,Z);if(!U||typeof U!=="string"){let L=`<!-- dynamic component: could not resolve "${I7(FQ(z.expr))}" -->`;Q=Q.slice(0,z.index)+L+Q.slice(z.index+z.full.length);continue}if(S9.has(U)){let L=LQ(U,z.attrs,z.slotContent);Q=Q.slice(0,z.index)+L+Q.slice(z.index+z.full.length);continue}let j=z.attrs.trim(),H={},B=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=B.exec(j))!==null){let L=_[1]||_[2],V=_[3];if(_[1])try{H[L]=Z0(V,Z)}catch{H[L]=V}else H[L]=V}let O=X.componentsDir||"components",F=await o1(U,H,z.slotContent,O,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,z.index)+F+Q.slice(z.index+z.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),H=`<!-- dynamic component error: ${I7(j)} -->`;Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}}return Q=await z_(Q,Z,Y,X,J),Q}async function z_($,Z,Y,X,J){let Q=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(Q))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=OQ(z.expr,Z);if(!U||typeof U!=="string"){let B=`<!-- dynamic component: could not resolve "${I7(FQ(z.expr))}" -->`;Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length);continue}if(S9.has(U)){let B=LQ(U,z.attrs,"");Q=Q.slice(0,z.index)+B+Q.slice(z.index+z.full.length);continue}let j=X.componentsDir||"components",H=await o1(U,{},"",j,Z,Y,X,new Set,J??new Set);Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}catch(U){let j=U instanceof Error?U.message:String(U),H=`<!-- dynamic component error: ${I7(j)} -->`;Q=Q.slice(0,z.index)+H+Q.slice(z.index+z.full.length)}}return Q}var S9,W_;var wQ=b(()=>{R0();F0();S9=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"]),W_=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function __($){let Z=$.storageKey??"stx-color-mode",Y=$.initialMode??"auto",X=$.darkClass===void 0?"dark":$.darkClass,J=$.attribute??null,Q=$.autoValue??null;if(typeof Z!=="string"||Z.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!U_.has(Y))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Y)}`);if(X!==null&&(typeof X!=="string"||!H_.test(X)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(X)}`);if(J!==null&&(typeof J!=="string"||!B_.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(Q!==null&&!j_.has(Q))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(Q)}`);if(X===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:Z,initialMode:Y==="system"?"auto":Y,darkClass:X,attribute:J,autoValue:Q}}function O_($){return JSON.stringify($).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function P9($={}){let Z=__($);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${O_(Z)};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 RQ($,Z={}){if($.includes("data-stx-color-mode-boot"))return $;let Y=y9($);if(Y===null)return $;let X=P9(Z);return`${$.slice(0,Y)}
11865
+ ${X}${$.slice(Y)}`}function y9($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return null;let Y=Z.index+Z[0].length,X=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec($.slice(Y));if(X)Y+=X[0].length;return Y}function V_($){let Z=/<head\b[^>]*>/i.exec($);if(!Z)return $;let Y=Z.index+Z[0].length,X=$.toLowerCase().indexOf("</head>",Y),J=$.slice(Y,X===-1?$.length:X),Q=L_.exec(J);if(!Q||J.slice(0,Q.index).trim()==="")return $;let G=J.slice(0,Q.index)+J.slice(Q.index+Q[0].length);return $.slice(0,Y)+`
11866
+ ${Q[0]}`+G+$.slice(Y+J.length)}function NQ($){return w_(V_($))}function w_($){let Z=F_.exec($);if(!Z)return $;let Y=y9($);if(Y===null)return $;if(Z.index<=Y||$.slice(Y,Z.index).trim()==="")return $;let X=$.slice(0,Z.index)+$.slice(Z.index+Z[0].length),J=y9(X);if(J===null)return $;return`${X.slice(0,J)}
11867
+ ${Z[0]}${X.slice(J)}`}var U_,j_,B_,H_,F_,L_;var C9=b(()=>{U_=new Set(["light","dark","auto","system"]),j_=new Set(["auto","system"]),B_=/^[a-z][\w:-]*$/i,H_=/^[\w-]+$/;F_=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),L_=/<meta\b[^>]*\bcharset\b[^>]*>/i});function R_(){if(v9===null)v9=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return v9}function AQ($,Z=R_()){if($.includes('name="stx-build"'))return $;let Y=/<head\b[^>]*>/i.exec($);if(!Y)return $;let X=Y.index+Y[0].length;return`${$.slice(0,X)}
11868
+ <meta name="stx-build" content="${Z}">${$.slice(X)}`}var v9=null;function B1($){return String($).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function N_($){return String($).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function x9($){if($.name)return`name="${$.name}"`;if($.property)return`property="${$.property}"`;if($.charset!=null)return"charset=";if($["http-equiv"])return`http-equiv="${$["http-equiv"]}"`;return""}function v5($,Z){return Object.entries($).filter(([Y])=>!Z?.(Y)).map(([Y,X])=>`${Y}="${B1(String(X))}"`).join(" ")}function A_($={},Z="en"){let Y=[],X=[],J="",Q=Z;for(let[K,q]of Object.entries($||{})){if(q==null)continue;let W=K.trim();if(!TQ.test(W))continue;let z=W.toLowerCase();if(z==="lang"){Q=String(q);continue}if(z==="class"){J=String(q).trim();continue}Y.push(` ${W}="${B1(String(q))}"`),X.push(W)}let G=` lang="${B1(Q)}"`;if(J)G+=` class="${B1(J)}"`;if(G+=Y.join(""),J)G+=` ${E7}="${B1(J)}"`;if(X.length)G+=` ${D7}="${B1(X.join(" "))}"`;return G}function IQ($={},Z={}){let Y={...$,...Z};if($.class&&Z.class){let X=$.class.split(/\s+/).filter(Boolean);for(let J of Z.class.split(/\s+/).filter(Boolean))if(!X.includes(J))X.push(J);Y.class=X.join(" ")}return Y}function DQ($,Z={}){if(!Z||Object.keys(Z).length===0)return $;let Y=$.match(/<html\b([^>]*)>/i);if(!Y)return $;let X={},J=[],Q=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,G;while((G=Q.exec(Y[1]))!==null){let z=G[1];if(!(z in X))J.push(z);X[z]=G[2]??G[3]??G[4]??""}let K=[],q=[];for(let[z,U]of Object.entries(Z)){if(U==null)continue;let j=z.trim();if(!TQ.test(j))continue;let H=j.toLowerCase();if(H==="class"){let B=(X.class||"").split(/\s+/).filter(Boolean);for(let _ of String(U).split(/\s+/).filter(Boolean))if(!B.includes(_))B.push(_),K.push(_);if(!("class"in X))J.push("class");X.class=B.join(" ");continue}if(!(j in X))J.push(j);if(X[j]=String(U),H!=="lang")q.push(j)}if(K.length){if(!(E7 in X))J.push(E7);X[E7]=K.join(" ")}if(q.length){if(!(D7 in X))J.push(D7);X[D7]=q.join(" ")}let W=J.map((z)=>` ${z}="${B1(X[z])}"`).join("");return $.replace(Y[0],()=>`<html${W}>`)}function EQ($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}${MQ}
11869
+ ${$.slice(Z)}`}function M_($){let Z=[],Y=0;while(Y<$.length){let Q=$.slice(Y),G=Q.match(/^\s+/);if(G){Y+=G[0].length;continue}if(Q.startsWith("<!--")){let U=$.indexOf("-->",Y);if(U===-1)break;Y=U+3;continue}let K=Q.match(/^<script\b[^>]*>/i);if(K){let U=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(U===-1)break;Y=U+9;continue}let q=Q.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let W=Q.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let z=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(z){Z.push(z[0]),Y+=z[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",J=0;while(J<$.length&&J<Y){let Q=$.slice(J),G=Q.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){J+=G[0].length;continue}let K=Q.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){J+=K[0].length;continue}let q=Q.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){J+=q[0].length;continue}X+=$[J],J++}return X+=$.slice(Y),{body:X,hoisted:Z}}function T_($,Z={},Y={}){let{title:X="stx App",lang:J="en",meta:Q=[],link:G=[],script:K=[],headRaw:q="",htmlAttrs:W={},bodyClass:z="",bodyAttrs:U={}}=Z,j=Y.title||X,H=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],B=new Set(Q.map(x9).filter(Boolean)),O=[...H.filter((T)=>!B.has(x9(T))),...Q].map((T)=>{return` <meta ${v5(T)}>`}).join(`
11870
11870
  `),F=G.map((T)=>{return` <link ${v5(T)}>`}).join(`
11871
11871
  `),L=K.map((T)=>{if(T.src)return` <script ${v5(T,(k)=>k==="content")}></script>`;if(T.content)return` <script>${T.content}</script>`;return""}).filter(Boolean).join(`
11872
- `),V=N_(W,J),w=Object.entries(U).map(([T,k])=>` ${T}="${B1(String(k))}"`).join(""),R=z?` class="${B1(z)}"`:"",{body:N,hoisted:A}=A_($),M=[O,Y.colorMode?` ${P9(Y.colorMode)}`:"",` <title>${Y.titleIsHtml?j:R_(j)}</title>`,` ${AQ}`,F,L,q?` ${q}`:"",...(Y.styles||[]).map((T)=>` ${T}`),...A.map((T)=>` ${T}`),...(Y.headScripts||[]).map((T)=>` ${T}`),Y.headStack||""].filter(Boolean),I=[N,...(Y.bodyScripts||[]).map((T)=>T),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
11872
+ `),V=A_(W,J),w=Object.entries(U).map(([T,k])=>` ${T}="${B1(String(k))}"`).join(""),R=z?` class="${B1(z)}"`:"",{body:N,hoisted:A}=M_($),M=[O,Y.colorMode?` ${P9(Y.colorMode)}`:"",` <title>${Y.titleIsHtml?j:N_(j)}</title>`,` ${MQ}`,F,L,q?` ${q}`:"",...(Y.styles||[]).map((T)=>` ${T}`),...A.map((T)=>` ${T}`),...(Y.headScripts||[]).map((T)=>` ${T}`),Y.headStack||""].filter(Boolean),I=[N,...(Y.bodyScripts||[]).map((T)=>T),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
11873
11873
  <html${V}>
11874
11874
  <head>
11875
11875
  ${M.join(`
@@ -11879,23 +11879,23 @@ ${M.join(`
11879
11879
  ${I.join(`
11880
11880
  `)}
11881
11881
  </body>
11882
- </html>`}function f9($){let Z=0;while(Z<$.length){let Y=$.slice(Z),X=Y.match(/^\s+/);if(X){Z+=X[0].length;continue}if(Y.startsWith("<!--")){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}let J=Y.match(/^<(script|style)\b[^>]*>/i);if(J){let Q=`</${J[1].toLowerCase()}>`,G=$.toLowerCase().indexOf(Q,Z+J[0].length);if(G===-1)return!1;Z=G+Q.length;continue}return/^<!DOCTYPE\b/i.test(Y)||/^<html[\s>]/i.test(Y)}return!1}function g9($){return f9($)}function EQ($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:J=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let z=x9(W);if(z&&K.includes(z))continue;q.push(` <meta ${v5(W)}>`)}for(let W of J){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${v5(W)}>`)}for(let W of Q)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${v5(W,(z)=>z==="content")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
11882
+ </html>`}function f9($){let Z=0;while(Z<$.length){let Y=$.slice(Z),X=Y.match(/^\s+/);if(X){Z+=X[0].length;continue}if(Y.startsWith("<!--")){let Q=$.indexOf("-->",Z);if(Q===-1)return!1;Z=Q+3;continue}let J=Y.match(/^<(script|style)\b[^>]*>/i);if(J){let Q=`</${J[1].toLowerCase()}>`,G=$.toLowerCase().indexOf(Q,Z+J[0].length);if(G===-1)return!1;Z=G+Q.length;continue}return/^<!DOCTYPE\b/i.test(Y)||/^<html[\s>]/i.test(Y)}return!1}function g9($){return f9($)}function kQ($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:J=[],script:Q=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let z=x9(W);if(z&&K.includes(z))continue;q.push(` <meta ${v5(W)}>`)}for(let W of J){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${v5(W)}>`)}for(let W of Q)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${v5(W,(z)=>z==="content")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
11883
11883
  `)}
11884
- ${$.slice(Y)}`}function kQ($,Z={},Y={}){if(g9($))return $;return M_($,Z,Y)}var AQ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",D7="data-stx-html-attrs",E7="data-stx-html-class",MQ;var bQ=b(()=>{C9();MQ=/^[A-Za-z_:][\w:.-]*$/});import x5 from"path";function SQ($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function yQ($,Z,Y){try{let X;if($.startsWith("/")){let J=Z;for(let Q=0;Q<5;Q++){let G=x5.join(J,$);if(await Bun.file(G).exists())return G;J=x5.dirname(J)}X=x5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=x5.resolve(Z,$);else X=x5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function PQ($,Z,Y){let X=$,J=x5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[W,z,U,j]=G;if(SQ(U))continue;let H=await yQ(U,J,Z);if(H)try{let B=await Bun.file(H).text();if(Y.add(H),U.endsWith(".ts")||U.endsWith(".tsx")){let O=await Bun.build({entrypoints:[H],target:"browser",minify:!1,define:y0()});if(O.outputs.length>0)B=await O.outputs[0].text()}let _=`<script>
11884
+ ${$.slice(Y)}`}function bQ($,Z={},Y={}){if(g9($))return $;return T_($,Z,Y)}var MQ="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",D7="data-stx-html-attrs",E7="data-stx-html-class",TQ;var SQ=b(()=>{C9();TQ=/^[A-Za-z_:][\w:.-]*$/});import x5 from"path";function yQ($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function PQ($,Z,Y){try{let X;if($.startsWith("/")){let J=Z;for(let Q=0;Q<5;Q++){let G=x5.join(J,$);if(await Bun.file(G).exists())return G;J=x5.dirname(J)}X=x5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=x5.resolve(Z,$);else X=x5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function CQ($,Z,Y){let X=$,J=x5.dirname(Z),Q=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=Q.exec(X))!==null){let[W,z,U,j]=G;if(yQ(U))continue;let H=await PQ(U,J,Z);if(H)try{let B=await Bun.file(H).text();if(Y.add(H),U.endsWith(".ts")||U.endsWith(".tsx")){let O=await Bun.build({entrypoints:[H],target:"browser",minify:!1,define:y0()});if(O.outputs.length>0)B=await O.outputs[0].text()}let _=`<script>
11885
11885
  // Source: ${U}
11886
11886
  ${B}
11887
- </script>`;X=X.replace(W,_),Q.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,z,U,j]=q,H=z+j;if(SQ(U))continue;if(/rel=["']stylesheet["']/.test(H)||U.endsWith(".css")){let _=await yQ(U,J,Z);if(_)try{let O=await Bun.file(_).text();Y.add(_);let F=`<style>
11887
+ </script>`;X=X.replace(W,_),Q.lastIndex=0}catch(B){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,z,U,j]=q,H=z+j;if(yQ(U))continue;if(/rel=["']stylesheet["']/.test(H)||U.endsWith(".css")){let _=await PQ(U,J,Z);if(_)try{let O=await Bun.file(_).text();Y.add(_);let F=`<style>
11888
11888
  /* Source: ${U} */
11889
11889
  ${O}
11890
- </style>`;X=X.replace(W,F),K.lastIndex=0}catch(O){}}}return X}var CQ=b(()=>{V1()});function k7($,Z){let Y=$,X=/@json\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index,G=Q+J[0].length-1,K=1,q=G+1,W=null,z=!1;while(q<Y.length&&K>0){let V=Y[q];if(z){z=!1,q++;continue}if(V==="\\"&&W){z=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=Y.substring(G+1,q).trim(),j=Y.substring(Q,q+1),H=-1,B=0,_=null,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){O=!1;continue}if(w==="\\"&&_){O=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){H=V;break}}let F=H>=0?U.substring(0,H).trim():U,L=H>=0?U.substring(H+1).trim():void 0;try{let V=F.trim(),w;if(Q0(V))w=G0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(L==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let N=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+N+Y.substring(q+1),X.lastIndex=Q+N.length}catch(V){a0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=Q+j.length}}return Y}function b7($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function vQ($){let Z=$,Y=/@memo\s*\(/g,X,J=[];while((X=Y.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),z=q,U=Z.slice(z),j=U.indexOf("@endmemo");if(j===-1)continue;let H=U.slice(0,j),B=z+j+8,_=H.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=_?_[0].length:0,F=H.slice(O),L=H.match(/(\s*)$/),V=L?L[0].length:0,w=F.slice(0,F.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(R){let[A,M,I="",T]=R,k=`<${M}${I} data-stx-memo="${W}"${T}>`;N=H.slice(0,O)+k+w.slice(A.length)+H.slice(O+w.length)}else N=`${H.slice(0,O)}<div data-stx-memo="${W}">${w}</div>${H.slice(O+w.length)}`;J.push({start:Q,end:B,replacement:N}),Y.lastIndex=B}for(let Q=J.length-1;Q>=0;Q--){let G=J[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function h9($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function xQ($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,q=!1,W=!1,z=-1;while(K<$.length){let _=$[K];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){z=K;break}K++}if(z===-1)continue;if($.slice(G,z+1).includes("x-cloak"))continue;let j=$.slice(z+1),H=j.indexOf("</"),B=H>=0?j.slice(0,H):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))X+=$.slice(J,z)+" x-cloak>",J=z+1}return X+=$.slice(J),X}function fQ($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,J;while((J=Z.exec($))!==null){let Q=J.index,G=J[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,_=$.toLowerCase().indexOf(B,Q);if(_!==-1)Z.lastIndex=_+B.length;continue}let K=Q+J[0].length,q=!1,W=!1,z=-1;while(K<$.length){let B=$[K];if(q){if(B==="'")q=!1}else if(W){if(B==='"')W=!1}else if(B==="'")q=!0;else if(B==='"')W=!0;else if(B===">"){z=K;break}K++}if(z===-1)continue;let U=$.slice(Q+J[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!T_.test(U))continue;let j=$[z-1]==="/",H=j?z-1:z;Y+=`${$.slice(X,H)} x-cloak${j?" ":""}`,X=H}return Y+=$.slice(X),Y}var T_;var m9=b(()=>{U1();F0();T_=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function S7($,Z,Y,X){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=J.allowPatterns??[],G=[];for(let{pattern:K,message:q,suggestion:W}of I_){if(Q.some((U)=>/\w/.test(U)&&q.includes(U)))continue;K.lastIndex=0;let z=$.match(K);if(z&&z.length>0){let U=$.split(`
11890
+ </style>`;X=X.replace(W,F),K.lastIndex=0}catch(O){}}}return X}var vQ=b(()=>{V1()});function k7($,Z){let Y=$,X=/@json\s*\(/g,J;while((J=X.exec(Y))!==null){let Q=J.index,G=Q+J[0].length-1,K=1,q=G+1,W=null,z=!1;while(q<Y.length&&K>0){let V=Y[q];if(z){z=!1,q++;continue}if(V==="\\"&&W){z=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let U=Y.substring(G+1,q).trim(),j=Y.substring(Q,q+1),H=-1,B=0,_=null,O=!1;for(let V=0;V<U.length;V++){let w=U[V];if(O){O=!1;continue}if(w==="\\"&&_){O=!0;continue}if(_){if(w===_)_=null;continue}if(w==='"'||w==="'"||w==="`"){_=w;continue}if(w==="("||w==="["||w==="{")B++;else if(w===")"||w==="]"||w==="}")B--;if(w===","&&B===0){H=V;break}}let F=H>=0?U.substring(0,H).trim():U,L=H>=0?U.substring(H+1).trim():void 0;try{let V=F.trim(),w;if(Q0(V))w=G0(V,Object.keys(Z))(...Object.values(Z));else w=void 0;let R;if(L==="true")R=JSON.stringify(w,null,2);else R=JSON.stringify(w);let N=R.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,Q)+N+Y.substring(q+1),X.lastIndex=Q+N.length}catch(V){a0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=Q+j.length}}return Y}function b7($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function xQ($){let Z=$,Y=/@memo\s*\(/g,X,J=[];while((X=Y.exec(Z))!==null){let Q=X.index,G=Q+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),z=q,U=Z.slice(z),j=U.indexOf("@endmemo");if(j===-1)continue;let H=U.slice(0,j),B=z+j+8,_=H.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),O=_?_[0].length:0,F=H.slice(O),L=H.match(/(\s*)$/),V=L?L[0].length:0,w=F.slice(0,F.length-V),R=w.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),N;if(R){let[A,M,I="",T]=R,k=`<${M}${I} data-stx-memo="${W}"${T}>`;N=H.slice(0,O)+k+w.slice(A.length)+H.slice(O+w.length)}else N=`${H.slice(0,O)}<div data-stx-memo="${W}">${w}</div>${H.slice(O+w.length)}`;J.push({start:Q,end:B,replacement:N}),Y.lastIndex=B}for(let Q=J.length-1;Q>=0;Q--){let G=J[Q];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function h9($){let Z=$.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return Z=Z.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),Z}function fQ($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",J=0,Q;while((Q=Y.exec($))!==null){let G=Q.index,K=G+Q[0].length,q=!1,W=!1,z=-1;while(K<$.length){let _=$[K];if(q){if(_==="'")q=!1}else if(W){if(_==='"')W=!1}else if(_==="'")q=!0;else if(_==='"')W=!0;else if(_===">"){z=K;break}K++}if(z===-1)continue;if($.slice(G,z+1).includes("x-cloak"))continue;let j=$.slice(z+1),H=j.indexOf("</"),B=H>=0?j.slice(0,H):j.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(B))X+=$.slice(J,z)+" x-cloak>",J=z+1}return X+=$.slice(J),X}function gQ($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,J;while((J=Z.exec($))!==null){let Q=J.index,G=J[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let B=`</${G}>`,_=$.toLowerCase().indexOf(B,Q);if(_!==-1)Z.lastIndex=_+B.length;continue}let K=Q+J[0].length,q=!1,W=!1,z=-1;while(K<$.length){let B=$[K];if(q){if(B==="'")q=!1}else if(W){if(B==='"')W=!1}else if(B==="'")q=!0;else if(B==='"')W=!0;else if(B===">"){z=K;break}K++}if(z===-1)continue;let U=$.slice(Q+J[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!I_.test(U))continue;let j=$[z-1]==="/",H=j?z-1:z;Y+=`${$.slice(X,H)} x-cloak${j?" ":""}`,X=H}return Y+=$.slice(X),Y}var I_;var m9=b(()=>{U1();F0();I_=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function S7($,Z,Y,X){let J=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=J.allowPatterns??[],G=[];for(let{pattern:K,message:q,suggestion:W}of D_){if(Q.some((U)=>/\w/.test(U)&&q.includes(U)))continue;K.lastIndex=0;let z=$.match(K);if(z&&z.length>0){let U=$.split(`
11891
11891
  `),j=[];U.forEach((O,F)=>{if(K.lastIndex=0,K.test(O))j.push(F+1)});let H=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",B=j.slice(0,3).map((O)=>` ${O} | ${(U[O-1]??"").trim().slice(0,100)}`).join(`
11892
11892
  `),_=B?`
11893
11893
  ${B}`:"";G.push(` \u2717 ${q}${H}
11894
11894
  \u2192 ${W}${_}`)}}if(G.length>0&&J.enabled){let K=(z)=>{let U=`${process.cwd()}/`;return z.startsWith(U)?z.slice(U.length):z},W=`[STX] DOM API violation in ${X&&X!==Z?`${K(X)} (composed into ${K(Z)})`:K(Z)}:
11895
11895
  ${G.join(`
11896
11896
  `)}
11897
- Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(W);else console.warn(W)}}var I_;var d9=b(()=>{I_=[{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 D_ from"fs";function y7($){return[...$].sort().map((Z)=>{try{let Y=D_.statSync(Z);return`${Z}:${Y.size}:${Y.mtimeMs}`}catch{return`${Z}:missing`}}).join(`
11898
- `)}function P7($,Z,Y){let X=$.get(Z);return X!==void 0&&X.signature===Y?X.value:void 0}function J1($,Z,Y,X){return $.set(Z,{signature:Y,value:X}),X}var u9=()=>{};var gQ={};o(gQ,{getStoreScript:()=>k_,clearStoreCache:()=>b_});import C7 from"path";function E_($,Z){for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Y[1])Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let X of(Y[1]??"").split(",")){let Q=((X.includes(":")?X.split(":").pop():X)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Q))Z.add(Q)}for(let Y of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let X of(Y[1]??"").split(",")){let J=X.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))Z.add(J)}}async function k_($){let Z;if($)Z=C7.resolve($);else{let B=await D1();Z=C7.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Y=new Bun.Glob("*.ts"),X=[];try{for await(let B of Y.scan({cwd:Z,absolute:!0})){let _=C7.basename(B,".ts");if(["index","types"].includes(_))continue;if(B.includes(".d.ts"))continue;X.push(B)}}catch{return J1(f5,Z,"",""),null}let J=y7(X),Q=P7(f5,Z,J);if(Q!==void 0)return Q||null;if(X.length===0)return J1(f5,Z,J,""),null;let G=[];for(let B of X){let _=await Bun.file(B).text();G.push({file:B,hasUseStore:/useStore\s*\(/.test(_)})}G.sort((B,_)=>{if(B.hasUseStore===_.hasUseStore)return 0;return B.hasUseStore?1:-1});let K=G.map((B)=>B.file),q=[],W=new Set,z=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()});for(let B of K)try{let _=await Bun.file(B).text(),O=C7.basename(B,".ts");E_(_,W),_=x0(_),_=p$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=z.transformSync(_),q.push(`// Store: ${O}
11897
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(W);else console.warn(W)}}var D_;var d9=b(()=>{D_=[{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 E_ from"fs";function y7($){return[...$].sort().map((Z)=>{try{let Y=E_.statSync(Z);return`${Z}:${Y.size}:${Y.mtimeMs}`}catch{return`${Z}:missing`}}).join(`
11898
+ `)}function P7($,Z,Y){let X=$.get(Z);return X!==void 0&&X.signature===Y?X.value:void 0}function J1($,Z,Y,X){return $.set(Z,{signature:Y,value:X}),X}var u9=()=>{};var hQ={};o(hQ,{getStoreScript:()=>b_,clearStoreCache:()=>S_});import C7 from"path";function k_($,Z){for(let Y of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Y[1])Z.add(Y[1]);for(let Y of $.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let X of(Y[1]??"").split(",")){let Q=((X.includes(":")?X.split(":").pop():X)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(Q))Z.add(Q)}for(let Y of $.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let X of(Y[1]??"").split(",")){let J=X.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))Z.add(J)}}async function b_($){let Z;if($)Z=C7.resolve($);else{let B=await D1();Z=C7.resolve(B.root||process.cwd(),B.storesDir||"stores")}let Y=new Bun.Glob("*.ts"),X=[];try{for await(let B of Y.scan({cwd:Z,absolute:!0})){let _=C7.basename(B,".ts");if(["index","types"].includes(_))continue;if(B.includes(".d.ts"))continue;X.push(B)}}catch{return J1(f5,Z,"",""),null}let J=y7(X),Q=P7(f5,Z,J);if(Q!==void 0)return Q||null;if(X.length===0)return J1(f5,Z,J,""),null;let G=[];for(let B of X){let _=await Bun.file(B).text();G.push({file:B,hasUseStore:/useStore\s*\(/.test(_)})}G.sort((B,_)=>{if(B.hasUseStore===_.hasUseStore)return 0;return B.hasUseStore?1:-1});let K=G.map((B)=>B.file),q=[],W=new Set,z=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()});for(let B of K)try{let _=await Bun.file(B).text(),O=C7.basename(B,".ts");k_(_,W),_=f0(_),_=p$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=z.transformSync(_),q.push(`// Store: ${O}
11899
11899
  ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${B}:`,_)}if(q.length===0)return J1(f5,Z,J,""),null;let U=q.join(`
11900
11900
 
11901
11901
  `),H=`;(function(){
@@ -11903,8 +11903,8 @@ var __stx = window.stx || {};
11903
11903
  ${W1.filter((B)=>!W.has(B)&&new RegExp(`\\b${B}\\b`).test(U)).map((B)=>`var ${B} = __stx[${JSON.stringify(B)}];`).join(`
11904
11904
  `)}
11905
11905
  ${U}
11906
- })();`;return J1(f5,Z,J,H),H}function b_(){f5.clear()}var f5;var hQ=b(()=>{w1();V1();$1();u9();f5=new Map});var p9,cT;var mQ=b(()=>{p9=["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"],cT=new Set(p9)});var pQ={};o(pQ,{selectComposableFiles:()=>dQ,referencedFrameworkComposables:()=>uQ,getFrameworkComposableScript:()=>C_,clearFrameworkComposableCache:()=>y_,__setRuntimeOwnedForTest:()=>v_});import v7 from"path";function y_(){k$.clear()}function dQ($){let Z=new Map;for(let Y of $){let X=v7.basename(Y);if(X.endsWith(".d.ts"))continue;let J=X.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===X)continue;let Q=Z.get(J);if(Q&&!Q.endsWith(".js"))continue;Z.set(J,Y)}return[...Z.values()].sort()}function P_($,Z){let Y=Z.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Y}\\b`).test($)}function uQ($){if(!$)return[];let Z=$.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,""),Y=[];for(let X of S_){if(l9.has(X))continue;let J=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test(Z))Y.push(X)}return Y.sort()}async function C_($,Z){let Y=uQ($);if(Y.length===0)return null;let X=Z??v7.join(import.meta.dir,"composables"),J=`${X}\x00${Y.join(",")}`,Q=k$.get(J);if(Q!==void 0)return Q||null;let G=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}),K=new Set(Y),q=[],W=new Set,z=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let _ of B.scan({cwd:X,absolute:!0}))z.push(_)}catch{return k$.set(J,""),null}z=dQ(z);for(let B of z){let _;try{_=await Bun.file(B).text()}catch{continue}let O=[];try{O=G.scan(_).exports.filter((F)=>F!=="default")}catch{continue}if(!O.some((F)=>K.has(F)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${v7.basename(B).replace(/\.[jt]s$/,"")}
11907
- ${G.transformSync(_).trim()}`);for(let F of O)W.add(F)}catch(F){console.warn(`[stx] framework composable ${v7.basename(B)} could not be bundled:`,F)}}let U=Y.filter((B)=>!W.has(B)&&!P_($,B));if(U.length>0)console.warn(`[stx] could not bundle ${U.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(q.length===0)return k$.set(J,""),null;let j=[...W].map((B)=>` try { if (!(${JSON.stringify(B)} in __s)) { __s[${JSON.stringify(B)}] = ${B}; if (!(${JSON.stringify(B)} in window)) window[${JSON.stringify(B)}] = ${B}; } } catch (e) {}`).join(`
11906
+ })();`;return J1(f5,Z,J,H),H}function S_(){f5.clear()}var f5;var mQ=b(()=>{w1();V1();$1();u9();f5=new Map});var p9,iT;var dQ=b(()=>{p9=["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"],iT=new Set(p9)});var lQ={};o(lQ,{selectComposableFiles:()=>uQ,referencedFrameworkComposables:()=>pQ,getFrameworkComposableScript:()=>v_,clearFrameworkComposableCache:()=>P_,__setRuntimeOwnedForTest:()=>x_});import v7 from"path";function P_(){k$.clear()}function uQ($){let Z=new Map;for(let Y of $){let X=v7.basename(Y);if(X.endsWith(".d.ts"))continue;let J=X.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===X)continue;let Q=Z.get(J);if(Q&&!Q.endsWith(".js"))continue;Z.set(J,Y)}return[...Z.values()].sort()}function C_($,Z){let Y=Z.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Y}\\b`).test($)}function pQ($){if(!$)return[];let Z=$.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,""),Y=[];for(let X of y_){if(l9.has(X))continue;let J=X.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test(Z))Y.push(X)}return Y.sort()}async function v_($,Z){let Y=pQ($);if(Y.length===0)return null;let X=Z??v7.join(import.meta.dir,"composables"),J=`${X}\x00${Y.join(",")}`,Q=k$.get(J);if(Q!==void 0)return Q||null;let G=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}),K=new Set(Y),q=[],W=new Set,z=[];try{let B=new Bun.Glob("*.{ts,js}");for await(let _ of B.scan({cwd:X,absolute:!0}))z.push(_)}catch{return k$.set(J,""),null}z=uQ(z);for(let B of z){let _;try{_=await Bun.file(B).text()}catch{continue}let O=[];try{O=G.scan(_).exports.filter((F)=>F!=="default")}catch{continue}if(!O.some((F)=>K.has(F)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),q.push(`// ${v7.basename(B).replace(/\.[jt]s$/,"")}
11907
+ ${G.transformSync(_).trim()}`);for(let F of O)W.add(F)}catch(F){console.warn(`[stx] framework composable ${v7.basename(B)} could not be bundled:`,F)}}let U=Y.filter((B)=>!W.has(B)&&!C_($,B));if(U.length>0)console.warn(`[stx] could not bundle ${U.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(q.length===0)return k$.set(J,""),null;let j=[...W].map((B)=>` try { if (!(${JSON.stringify(B)} in __s)) { __s[${JSON.stringify(B)}] = ${B}; if (!(${JSON.stringify(B)} in window)) window[${JSON.stringify(B)}] = ${B}; } } catch (e) {}`).join(`
11908
11908
  `),H=`<script data-stx-framework-composables>
11909
11909
  ;(function(){
11910
11910
  var __s = window.stx = window.stx || {};
@@ -11913,7 +11913,7 @@ ${q.join(`
11913
11913
  `)}
11914
11914
  ${j}
11915
11915
  })();
11916
- </script>`;return k$.set(J,H),H}function v_($){l9.clear();for(let Z of $)l9.add(Z)}var k$,l9,S_;var lQ=b(()=>{V1();mQ();k$=new Map,l9=new Set,S_=new Set(p9)});var iQ={};o(iQ,{getComposableScript:()=>h_,clearComposableCache:()=>m_});import b$ from"path";function cQ($){let Z=b$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function f_($){if($)return b$.resolve($);let Z=`<default>:${process.cwd()}`,Y=c9.get(Z);if(Y!==void 0)return Y;let X=await g_();if(X!==null)c9.set(Z,X);return X}async function g_(){let $=await D1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return b$.resolve(Z,Y);for(let X of x_){let J=b$.resolve(Z,X);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:J,absolute:!0}))if(!cQ(G))return J}catch{}}return null}async function h_($){let Z=await f_($);if(!Z)return null;let Y=[];try{let B=new Bun.Glob("**/*.ts");for await(let _ of B.scan({cwd:Z,absolute:!0})){if(cQ(_))continue;Y.push(_)}}catch{return J1(g5,Z,"",""),null}let X=y7(Y),J=P7(g5,Z,X);if(J!==void 0)return J||null;if(Y.length===0)return J1(g5,Z,X,""),null;Y.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}),G=[],K=new Set,q=new Set;for(let B of Y)try{let _=await Bun.file(B).text(),O=b$.basename(B,".ts");for(let F of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(F[1])q.add(F[1]);try{for(let F of Q.scan(_).exports)if(F!=="default")K.add(F)}catch{}_=x0(_),_=p$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=Q.transformSync(_),G.push(`// Composable: ${O}
11916
+ </script>`;return k$.set(J,H),H}function x_($){l9.clear();for(let Z of $)l9.add(Z)}var k$,l9,y_;var cQ=b(()=>{V1();dQ();k$=new Map,l9=new Set,y_=new Set(p9)});var nQ={};o(nQ,{getComposableScript:()=>m_,clearComposableCache:()=>d_});import b$ from"path";function iQ($){let Z=b$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function g_($){if($)return b$.resolve($);let Z=`<default>:${process.cwd()}`,Y=c9.get(Z);if(Y!==void 0)return Y;let X=await h_();if(X!==null)c9.set(Z,X);return X}async function h_(){let $=await D1(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return b$.resolve(Z,Y);for(let X of f_){let J=b$.resolve(Z,X);try{let Q=new Bun.Glob("**/*.ts");for await(let G of Q.scan({cwd:J,absolute:!0}))if(!iQ(G))return J}catch{}}return null}async function m_($){let Z=await g_($);if(!Z)return null;let Y=[];try{let B=new Bun.Glob("**/*.ts");for await(let _ of B.scan({cwd:Z,absolute:!0})){if(iQ(_))continue;Y.push(_)}}catch{return J1(g5,Z,"",""),null}let X=y7(Y),J=P7(g5,Z,X);if(J!==void 0)return J||null;if(Y.length===0)return J1(g5,Z,X,""),null;Y.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:y0()}),G=[],K=new Set,q=new Set;for(let B of Y)try{let _=await Bun.file(B).text(),O=b$.basename(B,".ts");for(let F of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(F[1])q.add(F[1]);try{for(let F of Q.scan(_).exports)if(F!=="default")K.add(F)}catch{}_=f0(_),_=p$(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=Q.transformSync(_),G.push(`// Composable: ${O}
11917
11917
  ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${B}:`,_)}if(G.length===0||K.size===0)return J1(g5,Z,X,""),null;let W=[...K].map((B)=>` try { __c[${JSON.stringify(B)}] = ${B}; } catch (e) {}`).join(`
11918
11918
  `),z=JSON.stringify([...K]),U=G.join(`
11919
11919
 
@@ -11938,7 +11938,7 @@ ${W}
11938
11938
  }
11939
11939
  window[__n] = __c[__n];
11940
11940
  }
11941
- })();`;return J1(g5,Z,X,H),H}function m_(){g5.clear(),c9.clear()}var g5,c9,x_;var nQ=b(()=>{w1();V1();u9();$1();g5=new Map,c9=new Map,x_=["composables","functions"]});var sQ={};o(sQ,{processDeferDirectives:()=>c_});function d_(){return`stx-defer-${++oQ}`}function u_($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function p_($,Z,Y){let{trigger:X,value:J}=u_(Z),Q=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let z=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(z)K=z[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)q=U[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:X,triggerValue:J,content:Q,placeholder:G,loading:K,error:q}}function l_($,Z){let{trigger:Y,triggerValue:X}=Z,J;switch(Y){case"visible":J=`
11941
+ })();`;return J1(g5,Z,X,H),H}function d_(){g5.clear(),c9.clear()}var g5,c9,f_;var oQ=b(()=>{w1();V1();u9();$1();g5=new Map,c9=new Map,f_=["composables","functions"]});var rQ={};o(rQ,{processDeferDirectives:()=>i_});function u_(){return`stx-defer-${++sQ}`}function p_($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function l_($,Z,Y){let{trigger:X,value:J}=p_(Z),Q=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),Q=Q.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let z=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(z)K=z[1].trim(),Q=Q.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)q=U[2].trim(),Q=Q.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return Q=Q.trim(),{trigger:X,triggerValue:J,content:Q,placeholder:G,loading:K,error:q}}function c_($,Z){let{trigger:Y,triggerValue:X}=Z,J;switch(Y){case"visible":J=`
11942
11942
  const observer = new IntersectionObserver((entries) => {
11943
11943
  if (entries[0].isIntersecting) {
11944
11944
  observer.disconnect();
@@ -12011,7 +12011,7 @@ else {
12011
12011
  ${J}
12012
12012
  })();
12013
12013
  </script>
12014
- `}function c_($,Z,Y){oQ=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(J,Q,G)=>{let K=d_(),q=p_(J,Q,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",z=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',U=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",j=`<div data-defer-content style="display: none;">${q.content}</div>`,H=l_(K,q);return`
12014
+ `}function i_($,Z,Y){sQ=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(J,Q,G)=>{let K=u_(),q=l_(J,Q,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",z=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',U=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",j=`<div data-defer-content style="display: none;">${q.content}</div>`,H=c_(K,q);return`
12015
12015
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
12016
12016
  ${W}
12017
12017
  ${z}
@@ -12019,7 +12019,7 @@ else {
12019
12019
  ${U}
12020
12020
  </div>
12021
12021
  ${H}
12022
- `})}var oQ=0;var aQ={};o(aQ,{processTeleportDirectives:()=>s_,ensureTeleportTargets:()=>r_});function i_(){return`stx-teleport-${++rQ}`}function n_($){let Z=$.split(",").map((J)=>J.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let J=1;J<Z.length;J++){let Q=Z[J].match(/disabled:\s*(.+)/);if(Q)X=Q[1].trim()}return{target:Y,disabled:X}}function o_($,Z){return`
12022
+ `})}var sQ=0;var tQ={};o(tQ,{processTeleportDirectives:()=>r_,ensureTeleportTargets:()=>a_});function n_(){return`stx-teleport-${++aQ}`}function o_($){let Z=$.split(",").map((J)=>J.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let J=1;J<Z.length;J++){let Q=Z[J].match(/disabled:\s*(.+)/);if(Q)X=Q[1].trim()}return{target:Y,disabled:X}}function s_($,Z){return`
12023
12023
  <script>
12024
12024
  (function() {
12025
12025
  const source = document.getElementById('${$}');
@@ -12065,12 +12065,12 @@ else {
12065
12065
  });
12066
12066
  })();
12067
12067
  </script>
12068
- `}function s_($,Z,Y){rQ=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(J,Q,G)=>{let K=i_(),{target:q,disabled:W}=n_(Q),z=G.trim();if(W)try{let j=!1;if(W==="true")j=!0;else if(W==="false")j=!1;else if(W in Z)j=Boolean(Z[W]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${z}</div>`}catch{}let U=o_(K,q);return`
12068
+ `}function r_($,Z,Y){aQ=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(J,Q,G)=>{let K=n_(),{target:q,disabled:W}=o_(Q),z=G.trim();if(W)try{let j=!1;if(W==="true")j=!0;else if(W==="false")j=!1;else if(W in Z)j=Boolean(Z[W]);if(j)return`<div class="stx-teleport-inline" data-teleport-disabled>${z}</div>`}catch{}let U=s_(K,q);return`
12069
12069
  <div id="${K}" class="stx-teleport-source" style="display: none;">
12070
12070
  <template>${z}</template>
12071
12071
  </div>
12072
12072
  ${U}
12073
- `})}function r_(){return`
12073
+ `})}function a_(){return`
12074
12074
  <script>
12075
12075
  (function() {
12076
12076
  // Common teleport targets
@@ -12087,7 +12087,7 @@ else {
12087
12087
  });
12088
12088
  })();
12089
12089
  </script>
12090
- `}var rQ=0;var ZG={};o(ZG,{processTransitionDirectives:()=>$O,processTransitionAttributes:()=>JO,performLeave:()=>e_,performEnter:()=>t_,generateTransitionRuntime:()=>XO,generateTransitionCSS:()=>YO});function tQ($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function a_($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",J=(Q)=>{let G=Q.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(J(Y),J(X))}function eQ($,Z){return new Promise((Y)=>{let X=Z??a_($);if(X===0){Y();return}let J=!1,Q=()=>{if(J)return;J=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,X+50)})}function $G($){$.offsetHeight}async function t_($,Z={}){let Y=Z.name||"stx",X=tQ(Y,Z),J=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),$G($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await eQ($,J);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function e_($,Z={}){let Y=Z.name||"stx",X=tQ(Y,Z),J=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),$G($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await eQ($,J);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function $O($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(J,Q,G)=>{let K=ZO(Q),q=K.name||"stx",W=K.duration||300,z=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
12090
+ `}var aQ=0;var YG={};o(YG,{processTransitionDirectives:()=>ZO,processTransitionAttributes:()=>QO,performLeave:()=>$O,performEnter:()=>e_,generateTransitionRuntime:()=>JO,generateTransitionCSS:()=>XO});function eQ($,Z={}){return{enterFrom:Z.enterClass||`${$}-enter-from`,enterActive:Z.enterActiveClass||`${$}-enter-active`,enterTo:Z.enterToClass||`${$}-enter-to`,leaveFrom:Z.leaveClass||`${$}-leave-from`,leaveActive:Z.leaveActiveClass||`${$}-leave-active`,leaveTo:Z.leaveToClass||`${$}-leave-to`}}function t_($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",J=(Q)=>{let G=Q.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(J(Y),J(X))}function $G($,Z){return new Promise((Y)=>{let X=Z??t_($);if(X===0){Y();return}let J=!1,Q=()=>{if(J)return;J=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)Q()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(Q,X+50)})}function ZG($){$.offsetHeight}async function e_($,Z={}){let Y=Z.name||"stx",X=eQ(Y,Z),J=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),ZG($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((Q)=>{Z.onEnter($,Q)});else await $G($,J);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function $O($,Z={}){let Y=Z.name||"stx",X=eQ(Y,Z),J=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),ZG($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((Q)=>{Z.onLeave($,Q)});else await $G($,J);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function ZO($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(J,Q,G)=>{let K=YO(Q),q=K.name||"stx",W=K.duration||300,z=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
12091
12091
  <div
12092
12092
  class="stx-transition-wrapper"
12093
12093
  data-transition="${q}"
@@ -12129,7 +12129,7 @@ else {
12129
12129
  });
12130
12130
  })();
12131
12131
  </script>
12132
- `})}function ZO($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3]||X[4]||X[5];switch(J){case"name":Z.name=Q;break;case"duration":Z.duration=parseInt(Q,10);break;case"mode":Z.mode=Q;break;case"easing":Z.easing=Q;break}}return Z}function YO(){return`
12132
+ `})}function YO($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3]||X[4]||X[5];switch(J){case"name":Z.name=Q;break;case"duration":Z.duration=parseInt(Q,10);break;case"mode":Z.mode=Q;break;case"easing":Z.easing=Q;break}}return Z}function XO(){return`
12133
12133
  /* STX Transition Presets */
12134
12134
 
12135
12135
  /* Fade */
@@ -12316,7 +12316,7 @@ else {
12316
12316
  opacity: 1;
12317
12317
  max-height: 1000px;
12318
12318
  }
12319
- `}function XO(){return`
12319
+ `}function JO(){return`
12320
12320
  // STX Transition Runtime
12321
12321
  (function() {
12322
12322
  if (typeof window === 'undefined') return;
@@ -12405,7 +12405,7 @@ else {
12405
12405
 
12406
12406
  console.log('[stx] Transition runtime initialized');
12407
12407
  })();
12408
- `}function JO($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,J,Q)=>{let G=J||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var XG={};o(XG,{withErrorBoundary:()=>YG,processErrorBoundaryDirectives:()=>KO,generateErrorBoundaryRuntime:()=>jO,generateErrorBoundaryCSS:()=>UO,createErrorBoundary:()=>zO});function GO(){return`eb-${++QO}-${Date.now().toString(36)}`}function KO($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(J,Q,G,K)=>{let q=GO(),W=qO(Q||"");return WO(q,G.trim(),K.trim(),W)})}function qO($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3]||X[4];switch(J){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function WO($,Z,Y,X){let J=X.logErrors!==!1;return`
12408
+ `}function QO($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,J,Q)=>{let G=J||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${Q}" data-stx-transition-id="${K}"`})}var JG={};o(JG,{withErrorBoundary:()=>XG,processErrorBoundaryDirectives:()=>qO,generateErrorBoundaryRuntime:()=>BO,generateErrorBoundaryCSS:()=>jO,createErrorBoundary:()=>UO});function KO(){return`eb-${++GO}-${Date.now().toString(36)}`}function qO($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(J,Q,G,K)=>{let q=KO(),W=WO(Q||"");return zO(q,G.trim(),K.trim(),W)})}function WO($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3]||X[4];switch(J){case"id":Z.id=Q;break;case"logErrors":Z.logErrors=Q==="true";break}}return Z}function zO($,Z,Y,X){let J=X.logErrors!==!1;return`
12409
12409
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
12410
12410
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
12411
12411
  ${Z}
@@ -12525,7 +12525,7 @@ else {
12525
12525
  };
12526
12526
  })();
12527
12527
  </script>
12528
- `}async function YG($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function zO($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>YG(X,$,Y)}function UO(){return`
12528
+ `}async function XG($,Z,Y){try{return await $()}catch(X){if(Y)Y(X instanceof Error?X:Error(String(X)));else console.error("[stx:errorBoundary] SSR Error:",X);return Z}}function UO($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>XG(X,$,Y)}function jO(){return`
12529
12529
  /* STX Error Boundary Styles */
12530
12530
  .stx-error-boundary {
12531
12531
  position: relative;
@@ -12569,7 +12569,7 @@ else {
12569
12569
  color: #fecaca;
12570
12570
  }
12571
12571
  }
12572
- `}function jO(){return`
12572
+ `}function BO(){return`
12573
12573
  // STX Error Boundary Runtime
12574
12574
  (function() {
12575
12575
  if (typeof window === 'undefined') return;
@@ -12634,7 +12634,7 @@ else {
12634
12634
 
12635
12635
  console.log('[stx] Error boundary runtime initialized');
12636
12636
  })();
12637
- `}var QO=0;var JG={};o(JG,{renderSSRSuspense:()=>VO,processSuspenseDirectives:()=>_O,generateSuspenseRuntime:()=>RO,generateSuspenseCSS:()=>wO,createSSRSuspense:()=>LO});function HO(){return`suspense-${++BO}-${Date.now().toString(36)}`}function _O($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(J,Q,G,K)=>{let q=HO(),W=OO(Q||"");return FO(q,G.trim(),K.trim(),W)})}function OO($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3],G=X[4];switch(J){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function FO($,Z,Y,X){let J=X.timeout||30000,Q=X.id||$;return`
12637
+ `}var GO=0;var QG={};o(QG,{renderSSRSuspense:()=>wO,processSuspenseDirectives:()=>OO,generateSuspenseRuntime:()=>NO,generateSuspenseCSS:()=>RO,createSSRSuspense:()=>VO});function _O(){return`suspense-${++HO}-${Date.now().toString(36)}`}function OO($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(J,Q,G,K)=>{let q=_O(),W=FO(Q||"");return LO(q,G.trim(),K.trim(),W)})}function FO($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3],G=X[4];switch(J){case"id":Z.id=Q;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function LO($,Z,Y,X){let J=X.timeout||30000,Q=X.id||$;return`
12638
12638
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${Q}" data-status="pending">
12639
12639
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
12640
12640
  ${Y}
@@ -12824,7 +12824,7 @@ else {
12824
12824
  }, 0);
12825
12825
  })();
12826
12826
  </script>
12827
- `}function LO($,Z,Y){return{id:$,fallback:Y,content:Z}}async function VO($){let Z=$.map((X)=>`
12827
+ `}function VO($,Z,Y){return{id:$,fallback:Y,content:Z}}async function wO($){let Z=$.map((X)=>`
12828
12828
  <div id="stx-ssr-suspense-${X.id}" class="stx-ssr-suspense">
12829
12829
  ${X.fallback}
12830
12830
  </div>
@@ -12849,7 +12849,7 @@ else {
12849
12849
  }
12850
12850
  })();
12851
12851
  </script>
12852
- `}}return{initial:Z,streaming:Y()}}function wO(){return`
12852
+ `}}return{initial:Z,streaming:Y()}}function RO(){return`
12853
12853
  /* STX Suspense Styles */
12854
12854
  .stx-suspense {
12855
12855
  position: relative;
@@ -12905,7 +12905,7 @@ else {
12905
12905
  background-size: 200% 100%;
12906
12906
  }
12907
12907
  }
12908
- `}function RO(){return`
12908
+ `}function NO(){return`
12909
12909
  // STX Suspense Runtime
12910
12910
  (function() {
12911
12911
  if (typeof window === 'undefined') return;
@@ -12972,7 +12972,7 @@ else {
12972
12972
 
12973
12973
  console.log('[stx] Suspense runtime initialized');
12974
12974
  })();
12975
- `}var BO=0;var qG={};o(qG,{processAsyncDirectives:()=>AO,isAsyncComponent:()=>TO,generateAsyncComponentRuntime:()=>DO,generateAsyncComponentCSS:()=>IO,defineAsyncComponent:()=>MO});function QG(){return`async-${++NO}-${Date.now().toString(36)}`}function AO($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(X,(G,K,q,W)=>{let z=QG(),U=GG(K);return KG(z,U,q.trim(),W.trim())}),Q=Q.replace(J,(G,K,q)=>{let W=QG(),z=GG(K);return KG(W,z,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function GG($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3],G=X[4],K=X[5];switch(J){case"component":Z.component=Q||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=Q||K;break;case"errorComponent":Z.errorComponent=Q||K;break}}return Z}function KG($,Z,Y,X){let{component:J,timeout:Q,delay:G,suspensible:K,retries:q}=Z;return`
12975
+ `}var HO=0;var WG={};o(WG,{processAsyncDirectives:()=>MO,isAsyncComponent:()=>IO,generateAsyncComponentRuntime:()=>EO,generateAsyncComponentCSS:()=>DO,defineAsyncComponent:()=>TO});function GG(){return`async-${++AO}-${Date.now().toString(36)}`}function MO($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,Q=$;return Q=Q.replace(X,(G,K,q,W)=>{let z=GG(),U=KG(K);return qG(z,U,q.trim(),W.trim())}),Q=Q.replace(J,(G,K,q)=>{let W=GG(),z=KG(K);return qG(W,z,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),Q}function KG($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3],G=X[4],K=X[5];switch(J){case"component":Z.component=Q||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=Q||K;break;case"errorComponent":Z.errorComponent=Q||K;break}}return Z}function qG($,Z,Y,X){let{component:J,timeout:Q,delay:G,suspensible:K,retries:q}=Z;return`
12976
12976
  <div class="stx-async-component" data-async-id="${$}" data-component="${J}" data-status="pending">
12977
12977
  <div class="stx-async-loading" data-async-loading="${$}">
12978
12978
  ${Y}
@@ -13199,7 +13199,7 @@ catch (error) {
13199
13199
  loadComponent();
13200
13200
  })();
13201
13201
  </script>
13202
- `}function MO($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function TO($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function IO(){return`
13202
+ `}function TO($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function IO($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function DO(){return`
13203
13203
  /* STX Async Component Styles */
13204
13204
  .stx-async-component {
13205
13205
  position: relative;
@@ -13273,7 +13273,7 @@ catch (error) {
13273
13273
  background-size: 200% 100%;
13274
13274
  }
13275
13275
  }
13276
- `}function DO(){return`
13276
+ `}function EO(){return`
13277
13277
  // STX Async Component Runtime
13278
13278
  (function() {
13279
13279
  if (typeof window === 'undefined') return;
@@ -13327,7 +13327,7 @@ catch (error) {
13327
13327
 
13328
13328
  console.log('[stx] Async component runtime initialized');
13329
13329
  })();
13330
- `}var NO=0;var zG={};o(zG,{shouldCacheComponent:()=>PO,processKeepAliveDirectives:()=>kO,onDeactivated:()=>fO,onActivated:()=>xO,generateKeepAliveRuntime:()=>vO,generateKeepAliveCSS:()=>CO,createKeepAliveCache:()=>yO});function WG(){return`keep-alive-${++EO}-${Date.now().toString(36)}`}function kO($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(J,Q,G)=>{let K=WG(),q=bO(Q||"");return SO(K,G.trim(),q)})}function bO($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3],G=X[4];switch(J){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=Q;break;case"exclude":Z.exclude=Q;break;case"id":Z.id=Q;break}}return Z}function SO($,Z,Y){let{max:X,include:J,exclude:Q}=Y,G=Y.id||$;return`
13330
+ `}var AO=0;var UG={};o(UG,{shouldCacheComponent:()=>CO,processKeepAliveDirectives:()=>bO,onDeactivated:()=>gO,onActivated:()=>fO,generateKeepAliveRuntime:()=>xO,generateKeepAliveCSS:()=>vO,createKeepAliveCache:()=>PO});function zG(){return`keep-alive-${++kO}-${Date.now().toString(36)}`}function bO($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(J,Q,G)=>{let K=zG(),q=SO(Q||"");return yO(K,G.trim(),q)})}function SO($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let J=X[1],Q=X[2]||X[3],G=X[4];switch(J){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=Q;break;case"exclude":Z.exclude=Q;break;case"id":Z.id=Q;break}}return Z}function yO($,Z,Y){let{max:X,include:J,exclude:Q}=Y,G=Y.id||$;return`
13331
13331
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
13332
13332
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
13333
13333
  ${Z}
@@ -13614,7 +13614,7 @@ else {
13614
13614
  });
13615
13615
  })();
13616
13616
  </script>
13617
- `}function yO($={}){return{id:$.id||WG(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function PO($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function CO(){return`
13617
+ `}function PO($={}){return{id:$.id||zG(),cache:new Map,max:$.max||10,include:$.include?$.include.split(",").map((Y)=>Y.trim()):null,exclude:$.exclude?$.exclude.split(",").map((Y)=>Y.trim()):null}}function CO($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function vO(){return`
13618
13618
  /* STX Keep-Alive Styles */
13619
13619
  .stx-keep-alive {
13620
13620
  position: relative;
@@ -13639,7 +13639,7 @@ else {
13639
13639
  .stx-keep-alive-content > [data-activated] {
13640
13640
  opacity: 1;
13641
13641
  }
13642
- `}function vO(){return`
13642
+ `}function xO(){return`
13643
13643
  // STX Keep-Alive Runtime
13644
13644
  (function() {
13645
13645
  if (typeof window === 'undefined') return;
@@ -13675,7 +13675,7 @@ else {
13675
13675
 
13676
13676
  console.log('[stx] Keep-alive runtime initialized');
13677
13677
  })();
13678
- `}function xO($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function fO($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var EO=0;var _G={};o(_G,{useVirtualList:()=>jG,processVirtualListDirectives:()=>n9,processVirtualGridDirectives:()=>HG,processInfiniteListDirectives:()=>BG,generateVirtualListCSS:()=>UG,default:()=>gO,createVirtualList:()=>i9});function i9($,Z){let{itemHeight:Y,containerHeight:X,overscan:J=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],z=0,U=new Map;function j(){if(G)return H();let N=Math.max(0,Math.floor(z/Y)-J),A=Math.ceil(X/Y),M=Math.min(W.length-1,N+A+J*2);return{startIndex:N,endIndex:M}}function H(){let N=0,A=0,M=W.length-1;for(let I=0;I<W.length;I++){let T=U.get(I)||K;if(N+T>z){A=Math.max(0,I-J);break}N+=T}N=0;for(let I=0;I<W.length;I++){let T=U.get(I)||K;if(N+=T,N>z+X){M=Math.min(W.length-1,I+J);break}}return{startIndex:A,endIndex:M}}function B(){if(G){let N=0;for(let A=0;A<W.length;A++)N+=U.get(A)||K;return N}return W.length*Y}function _(N){if(G){let A=0;for(let M=0;M<N;M++)A+=U.get(M)||K;return A}return N*Y}function O(){let{startIndex:N,endIndex:A}=j();return{startIndex:N,endIndex:A,scrollTop:z,totalHeight:B(),visibleItems:W.slice(N,A+1),itemHeights:new Map(U)}}function F(N,A="auto"){let M=_(N);L(M,A)}function L(N,A="auto"){z=Math.max(0,Math.min(N,B()-X))}function V(){j()}function w(N){W=[...N],U.clear(),V()}function R(){W=[],U.clear()}return{scrollToIndex:F,scrollToOffset:L,getState:O,refresh:V,setItems:w,destroy:R}}function n9($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(J,Q,G,K)=>{let q=Q.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let L=G.trim(),V=Function(`return ${L}`)();z={...z,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(z.containerHeight/z.itemHeight),H=z.overscan||3,B=0,_=Math.min(W.length-1,j+H),O="";for(let L=B;L<=_&&L<W.length;L++){let V=W[L],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(R,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));O+=`
13678
+ `}function fO($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function gO($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var kO=0;var OG={};o(OG,{useVirtualList:()=>BG,processVirtualListDirectives:()=>n9,processVirtualGridDirectives:()=>_G,processInfiniteListDirectives:()=>HG,generateVirtualListCSS:()=>jG,default:()=>hO,createVirtualList:()=>i9});function i9($,Z){let{itemHeight:Y,containerHeight:X,overscan:J=3,keyProperty:Q="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],z=0,U=new Map;function j(){if(G)return H();let N=Math.max(0,Math.floor(z/Y)-J),A=Math.ceil(X/Y),M=Math.min(W.length-1,N+A+J*2);return{startIndex:N,endIndex:M}}function H(){let N=0,A=0,M=W.length-1;for(let I=0;I<W.length;I++){let T=U.get(I)||K;if(N+T>z){A=Math.max(0,I-J);break}N+=T}N=0;for(let I=0;I<W.length;I++){let T=U.get(I)||K;if(N+=T,N>z+X){M=Math.min(W.length-1,I+J);break}}return{startIndex:A,endIndex:M}}function B(){if(G){let N=0;for(let A=0;A<W.length;A++)N+=U.get(A)||K;return N}return W.length*Y}function _(N){if(G){let A=0;for(let M=0;M<N;M++)A+=U.get(M)||K;return A}return N*Y}function O(){let{startIndex:N,endIndex:A}=j();return{startIndex:N,endIndex:A,scrollTop:z,totalHeight:B(),visibleItems:W.slice(N,A+1),itemHeights:new Map(U)}}function F(N,A="auto"){let M=_(N);L(M,A)}function L(N,A="auto"){z=Math.max(0,Math.min(N,B()-X))}function V(){j()}function w(N){W=[...N],U.clear(),V()}function R(){W=[],U.clear()}return{scrollToIndex:F,scrollToOffset:L,getState:O,refresh:V,setItems:w,destroy:R}}function n9($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(J,Q,G,K)=>{let q=Q.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let L=G.trim(),V=Function(`return ${L}`)();z={...z,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(z.containerHeight/z.itemHeight),H=z.overscan||3,B=0,_=Math.min(W.length-1,j+H),O="";for(let L=B;L<=_&&L<W.length;L++){let V=W[L],w=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(R,N)=>{if(typeof V==="object"&&V!==null)return String(V[N]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));O+=`
13679
13679
  <div class="virtual-item ${z.itemClass||""}"
13680
13680
  style="position: absolute; top: ${L*z.itemHeight}px; height: ${z.itemHeight}px; width: 100%;"
13681
13681
  data-index="${L}">
@@ -13752,7 +13752,7 @@ else {
13752
13752
  };
13753
13753
  })();
13754
13754
  </script>
13755
- `})}function UG(){return`
13755
+ `})}function jG(){return`
13756
13756
  .virtual-list-container {
13757
13757
  position: relative;
13758
13758
  overflow-y: auto;
@@ -13800,7 +13800,7 @@ else {
13800
13800
  0% { background-position: 200% 0; }
13801
13801
  100% { background-position: -200% 0; }
13802
13802
  }
13803
- `}function jG($,Z){let Y=null,X=()=>{if(!Y)Y=i9($(),Z);return Y};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(J)=>{let Q=J.target;if(Y)Y.scrollToOffset(Q.scrollTop)}}),itemProps:(J)=>({style:{position:"absolute",top:`${J*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":J}),scrollToIndex:(J)=>{X().scrollToIndex(J)}}}function BG($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(J,Q,G,K,q)=>{let W=Q.trim(),z=Z[W];if(!z||!Array.isArray(z))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();U={...U,...B}}catch{}let j=`ilist-${Math.random().toString(36).substring(2,9)}`,H=n9(`@virtualList(${W}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return H=H.replace("</script>",`
13803
+ `}function BG($,Z){let Y=null,X=()=>{if(!Y)Y=i9($(),Z);return Y};return{visibleItems:()=>{return X().getState().visibleItems},totalHeight:()=>{return X().getState().totalHeight},containerProps:()=>({style:{height:`${Z.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(J)=>{let Q=J.target;if(Y)Y.scrollToOffset(Q.scrollTop)}}),itemProps:(J)=>({style:{position:"absolute",top:`${J*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":J}),scrollToIndex:(J)=>{X().scrollToIndex(J)}}}function HG($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(J,Q,G,K,q)=>{let W=Q.trim(),z=Z[W];if(!z||!Array.isArray(z))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let B=Function(`return ${G.trim()}`)();U={...U,...B}}catch{}let j=`ilist-${Math.random().toString(36).substring(2,9)}`,H=n9(`@virtualList(${W}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return H=H.replace("</script>",`
13804
13804
  // Infinite scroll detection
13805
13805
  container.addEventListener('scroll', function() {
13806
13806
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -13818,7 +13818,7 @@ else {
13818
13818
  ${q}
13819
13819
  </div>
13820
13820
  </div>
13821
- `})}function HG($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(J,Q,G,K)=>{let q=Q.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let z={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();z={...z,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(W.length/z.columns),H=j*(z.rowHeight+(z.gap||0)),B=Math.ceil(z.containerHeight/(z.rowHeight+(z.gap||0))),_=z.overscan||2,O=0,F=Math.min(j-1,B+_),L="";for(let V=O;V<=F;V++)for(let w=0;w<z.columns;w++){let R=V*z.columns+w;if(R>=W.length)break;let N=W[R],A=w*(100/z.columns),M=V*(z.rowHeight+(z.gap||0)),I=K.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(T,k)=>{if(typeof N==="object"&&N!==null)return String(N[k]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));L+=`
13821
+ `})}function _G($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(J,Q,G,K)=>{let q=Q.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let z={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();z={...z,...V}}catch{}let U=`vgrid-${Math.random().toString(36).substring(2,9)}`,j=Math.ceil(W.length/z.columns),H=j*(z.rowHeight+(z.gap||0)),B=Math.ceil(z.containerHeight/(z.rowHeight+(z.gap||0))),_=z.overscan||2,O=0,F=Math.min(j-1,B+_),L="";for(let V=O;V<=F;V++)for(let w=0;w<z.columns;w++){let R=V*z.columns+w;if(R>=W.length)break;let N=W[R],A=w*(100/z.columns),M=V*(z.rowHeight+(z.gap||0)),I=K.replace(/\{\{\s*item\s*\}\}/g,typeof N==="object"?JSON.stringify(N):String(N)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(T,k)=>{if(typeof N==="object"&&N!==null)return String(N[k]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(R));L+=`
13822
13822
  <div class="virtual-grid-item"
13823
13823
  style="position: absolute; top: ${M}px; left: ${A}%; width: calc(${100/z.columns}% - ${z.gap||0}px); height: ${z.rowHeight}px;"
13824
13824
  data-index="${R}">
@@ -13888,7 +13888,7 @@ else {
13888
13888
  });
13889
13889
  })();
13890
13890
  </script>
13891
- `})}var gO;var OG=b(()=>{gO={createVirtualList:i9,processVirtualListDirectives:n9,processInfiniteListDirectives:BG,processVirtualGridDirectives:HG,generateVirtualListCSS:UG,useVirtualList:jG}});function FG(){return`<script data-stx-hydration-runtime>
13891
+ `})}var hO;var FG=b(()=>{hO={createVirtualList:i9,processVirtualListDirectives:n9,processInfiniteListDirectives:HG,processVirtualGridDirectives:_G,generateVirtualListCSS:jG,useVirtualList:BG}});function LG(){return`<script data-stx-hydration-runtime>
13892
13892
  (function() {
13893
13893
  'use strict';
13894
13894
 
@@ -14048,7 +14048,7 @@ else {
14048
14048
  stxIslands.initIslands();
14049
14049
  }
14050
14050
  })();
14051
- </script>`}function LG($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function VG($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=X.exec($))!==null){let Q=J[1],G=J[2];if(G in Z)Y[Q]=Z[G];else Y[Q]=G}return Y}var bG={};o(bG,{processStaticDirectives:()=>EG,processPartialHydrationDirectives:()=>RG,onHydrated:()=>DG,isHydrated:()=>IG,hydrateIsland:()=>AG,hydrateByStrategy:()=>MG,hydrateAll:()=>TG,generatePartialHydrationCSS:()=>NG,generateIslandManifest:()=>kG,default:()=>iO,createIslandRegistry:()=>wG});function wG(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function hO($){return`
14051
+ </script>`}function VG($){let Z=$.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if(Z)return Z[1];let Y=$.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Y)return Y[1];return null}function wG($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=X.exec($))!==null){let Q=J[1],G=J[2];if(G in Z)Y[Q]=Z[G];else Y[Q]=G}return Y}var SG={};o(SG,{processStaticDirectives:()=>kG,processPartialHydrationDirectives:()=>NG,onHydrated:()=>EG,isHydrated:()=>DG,hydrateIsland:()=>MG,hydrateByStrategy:()=>TG,hydrateAll:()=>IG,generatePartialHydrationCSS:()=>AG,generateIslandManifest:()=>bG,default:()=>nO,createIslandRegistry:()=>RG});function RG(){let $=new Map;return{islands:$,register(Z){$.set(Z.id,Z)},get(Z){return $.get(Z)},async hydrate(Z){let Y=$.get(Z);if(!Y||Y.hydrated)return;if(Y.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:Z,component:Y.component}}))},async hydrateAll(){let Z=Array.from($.values()).filter((Y)=>!Y.hydrated).map((Y)=>this.hydrate(Y.id));await Promise.all(Z)}}}function mO($){return`
14052
14052
  <script data-hydrate="${$}">
14053
14053
  (function() {
14054
14054
  const island = document.querySelector('[data-island="${$}"]');
@@ -14059,7 +14059,7 @@ else {
14059
14059
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
14060
14060
  })();
14061
14061
  </script>
14062
- `}function mO($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
14062
+ `}function dO($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
14063
14063
  <script data-hydrate="${$}">
14064
14064
  (function() {
14065
14065
  const island = document.querySelector('[data-island="${$}"]');
@@ -14095,7 +14095,7 @@ else {
14095
14095
  }
14096
14096
  })();
14097
14097
  </script>
14098
- `}function dO($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
14098
+ `}function uO($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
14099
14099
  <script data-hydrate="${$}">
14100
14100
  (function() {
14101
14101
  const island = document.querySelector('[data-island="${$}"]');
@@ -14128,7 +14128,7 @@ else {
14128
14128
  }
14129
14129
  })();
14130
14130
  </script>
14131
- `}function uO($,Z){let Y=Z.media||"(min-width: 768px)";return`
14131
+ `}function pO($,Z){let Y=Z.media||"(min-width: 768px)";return`
14132
14132
  <script data-hydrate="${$}">
14133
14133
  (function() {
14134
14134
  const island = document.querySelector('[data-island="${$}"]');
@@ -14157,7 +14157,7 @@ else {
14157
14157
  }
14158
14158
  })();
14159
14159
  </script>
14160
- `}function pO($){return`
14160
+ `}function lO($){return`
14161
14161
  <script data-hydrate="${$}">
14162
14162
  (function() {
14163
14163
  const island = document.querySelector('[data-island="${$}"]');
@@ -14179,7 +14179,7 @@ else {
14179
14179
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
14180
14180
  })();
14181
14181
  </script>
14182
- `}function lO($,Z){let Y=Z.event||"stx:activate";return`
14182
+ `}function cO($,Z){let Y=Z.event||"stx:activate";return`
14183
14183
  <script data-hydrate="${$}">
14184
14184
  (function() {
14185
14185
  const island = document.querySelector('[data-island="${$}"]');
@@ -14200,9 +14200,9 @@ else {
14200
14200
  });
14201
14201
  })();
14202
14202
  </script>
14203
- `}function RG($,Z={},Y){let X=$,J=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=h5(X,"load",Z),X=h5(X,"idle",Z),X=h5(X,"visible",Z),X=h5(X,"media",Z),X=cO(X),X=h5(X,"hover",Z),X=h5(X,"event",Z),J=Q&&X!==$,J)X+=`
14204
- `+FG();return X}function h5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(J,Q,G)=>{let K={strategy:Z};if(Q)try{let _=Q.split(",").map((O)=>O.trim());for(let O of _){let[F,L]=O.split(":").map((V)=>V.trim());if(F&&L){let V=L.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=LG(G.trim()),z=VG(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(W)U.push(`data-component="${W}"`);let H=Object.keys(z).length>0?`
14205
- <script type="application/json" data-island-props="${q}">${JSON.stringify(z)}</script>`:"",B="";switch(Z){case"load":B=hO(q);break;case"idle":B=mO(q,K);break;case"visible":B=dO(q,K);break;case"media":B=uO(q,K);break;case"hover":B=pO(q);break;case"event":B=lO(q,K);break}return`
14203
+ `}function NG($,Z={},Y){let X=$,J=!1,Q=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=h5(X,"load",Z),X=h5(X,"idle",Z),X=h5(X,"visible",Z),X=h5(X,"media",Z),X=iO(X),X=h5(X,"hover",Z),X=h5(X,"event",Z),J=Q&&X!==$,J)X+=`
14204
+ `+LG();return X}function h5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(J,Q,G)=>{let K={strategy:Z};if(Q)try{let _=Q.split(",").map((O)=>O.trim());for(let O of _){let[F,L]=O.split(":").map((V)=>V.trim());if(F&&L){let V=L.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=VG(G.trim()),z=wG(G.trim(),Y),U=[];if(K.rootMargin)U.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)U.push(`data-threshold="${K.threshold}"`);if(K.media)U.push(`data-media="${K.media}"`);if(K.event)U.push(`data-event="${K.event}"`);if(W)U.push(`data-component="${W}"`);let H=Object.keys(z).length>0?`
14205
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(z)}</script>`:"",B="";switch(Z){case"load":B=mO(q);break;case"idle":B=dO(q,K);break;case"visible":B=uO(q,K);break;case"media":B=pO(q,K);break;case"hover":B=lO(q);break;case"event":B=cO(q,K);break}return`
14206
14206
  <div data-island="${q}"
14207
14207
  data-strategy="${Z}"
14208
14208
  ${U.join(`
@@ -14212,7 +14212,7 @@ else {
14212
14212
  ${G.trim()}${H}
14213
14213
  </div>
14214
14214
  ${B}
14215
- `})}function cO($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let J=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
14215
+ `})}function iO($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let J=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
14216
14216
  <div data-island="${J}"
14217
14217
  data-strategy="only"
14218
14218
  class="stx-island stx-client-only">
@@ -14231,7 +14231,7 @@ else {
14231
14231
  }
14232
14232
  })();
14233
14233
  </script>
14234
- `})}function NG(){return`
14234
+ `})}function AG(){return`
14235
14235
  /* Island base styles */
14236
14236
  .stx-island {
14237
14237
  display: contents;
@@ -14272,11 +14272,11 @@ else {
14272
14272
  .stx-island.hydrated {
14273
14273
  opacity: 1;
14274
14274
  }
14275
- `}function AG($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function MG($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function TG(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function IG($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function DG($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function EG($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function kG($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
14275
+ `}function MG($){if(typeof window>"u")return;let Z=document.querySelector(`[data-island="${$}"]`);if(!Z||Z.classList.contains("hydrated"))return;Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function TG($){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${$}"]:not(.hydrated)`).forEach((Y)=>{Y.classList.add("hydrated"),Y.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function IG(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function DG($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function EG($){return new Promise((Z)=>{if(typeof window>"u"){Z();return}let Y=document.querySelector(`[data-island="${$}"]`);if(!Y){Z();return}if(Y.classList.contains("hydrated")){Z();return}Y.addEventListener("stx:hydrated",()=>Z(),{once:!0})})}function kG($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function bG($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
14276
14276
  <script type="application/json" id="stx-island-manifest">
14277
14277
  ${JSON.stringify(Z)}
14278
14278
  </script>
14279
- `}var iO;var SG=b(()=>{iO={processPartialHydrationDirectives:RG,processStaticDirectives:EG,generatePartialHydrationCSS:NG,generateIslandManifest:kG,createIslandRegistry:wG,hydrateIsland:AG,hydrateByStrategy:MG,hydrateAll:TG,isHydrated:IG,onHydrated:DG}});var uG={};o(uG,{watchMultiple:()=>xG,watchEffect:()=>fG,watch:()=>vG,unref:()=>yG,toRefs:()=>PG,throttledComputed:()=>dG,stxWatchMultiple:()=>xG,stxWatchEffect:()=>fG,stxWatch:()=>vG,stxUnref:()=>yG,stxToRefs:()=>PG,stxThrottledComputed:()=>dG,stxShallowRef:()=>CG,stxRef:()=>m5,stxIsRef:()=>v1,stxDebouncedComputed:()=>mG,stxComputed:()=>y$,shallowRef:()=>CG,ref:()=>m5,processWatchDirectives:()=>hG,processComputedDirectives:()=>gG,isRef:()=>v1,default:()=>nO,debouncedComputed:()=>mG,computed:()=>y$});function m5($){let Z=$,Y=new Set,X={get value(){if(Q1){let J=S$.get(X);if(!J)J=new Set,S$.set(X,J);J.add(Q1)}return Z},set value(J){if(!Object.is(Z,J)){Z=J,Y.forEach((G)=>G(J));let Q=S$.get(X);if(Q)Q.forEach((G)=>G())}},subscribe(J){return Y.add(J),()=>Y.delete(J)},peek(){return Z}};return X}function v1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function yG($){return v1($)?$.value:$}function PG($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=m5($[Y]);return Z}function CG($){return m5($)}function y$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,J=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let j=U.value;q.forEach((H)=>H(j))}};function z(){K.clear();let j=Q1;Q1=W,x7.push(W);try{return Y()}finally{x7.pop(),Q1=j}}let U={get value(){if(Q1){let j=S$.get(U);if(!j)j=new Set,S$.set(U,j);j.add(Q1)}if(G){let j=z();if(!J(Q,j))Q=j;G=!1}return Q},set value(j){if(X)X(j);else console.warn("Computed property is readonly")},subscribe(j){return q.add(j),()=>q.delete(j)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function vG($,Z,Y={}){let{immediate:X=!1,deep:J=!1,flush:Q="pre",once:G=!1}=Y,K,q=!0,W=!1,z=()=>{if(v1($))return J?Q5($.value):$.value;return $()},U=()=>{if(!q||W)return;let B=z();if(K!==void 0&&Object.is(K,B)&&!J)return;let _=()=>{if(Z(B,K),K=J?Q5(B):B,G)H()};if(Q==="sync")_();else if(Q==="post")queueMicrotask(_);else Promise.resolve().then(_)},j=null;if(v1($))j=$.subscribe(()=>U());else j=y$($).subscribe(()=>U());if(X)K=void 0,U();else K=z();let H=()=>{if(q=!1,j)j(),j=null};return H.pause=()=>{W=!0},H.resume=()=>{W=!1},H}function xG($,Z,Y={}){let{immediate:X=!1,once:J=!1}=Y,Q=$.map((U)=>v1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((j)=>v1(j)?j.value:void 0);if(Z(U,Q),Q=[...U],J)z()},W=$.map((U)=>{if(v1(U))return U.subscribe(()=>q());return()=>{}});if(X)q();let z=()=>{G=!1,W.forEach((U)=>U())};return z.pause=()=>{K=!0},z.resume=()=>{K=!1},z}function fG($,Z={}){let{flush:Y="pre"}=Z,X,J=!0,Q=!1,G=()=>{if(!J||Q)return;if(X)X();let q=Q1;Q1=G,x7.push(G);try{X=$()}finally{x7.pop(),Q1=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(J=!1,X)X()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function gG($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(J,Q,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=q,`<!-- computed: ${Q} = ${q} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function hG($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(J,Q,G)=>{return`
14279
+ `}var nO;var yG=b(()=>{nO={processPartialHydrationDirectives:NG,processStaticDirectives:kG,generatePartialHydrationCSS:AG,generateIslandManifest:bG,createIslandRegistry:RG,hydrateIsland:MG,hydrateByStrategy:TG,hydrateAll:IG,isHydrated:DG,onHydrated:EG}});var pG={};o(pG,{watchMultiple:()=>fG,watchEffect:()=>gG,watch:()=>xG,unref:()=>PG,toRefs:()=>CG,throttledComputed:()=>uG,stxWatchMultiple:()=>fG,stxWatchEffect:()=>gG,stxWatch:()=>xG,stxUnref:()=>PG,stxToRefs:()=>CG,stxThrottledComputed:()=>uG,stxShallowRef:()=>vG,stxRef:()=>m5,stxIsRef:()=>v1,stxDebouncedComputed:()=>dG,stxComputed:()=>y$,shallowRef:()=>vG,ref:()=>m5,processWatchDirectives:()=>mG,processComputedDirectives:()=>hG,isRef:()=>v1,default:()=>oO,debouncedComputed:()=>dG,computed:()=>y$});function m5($){let Z=$,Y=new Set,X={get value(){if(Q1){let J=S$.get(X);if(!J)J=new Set,S$.set(X,J);J.add(Q1)}return Z},set value(J){if(!Object.is(Z,J)){Z=J,Y.forEach((G)=>G(J));let Q=S$.get(X);if(Q)Q.forEach((G)=>G())}},subscribe(J){return Y.add(J),()=>Y.delete(J)},peek(){return Z}};return X}function v1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function PG($){return v1($)?$.value:$}function CG($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=m5($[Y]);return Z}function vG($){return m5($)}function y$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,J=Z?Object.is:$.equals||Object.is,Q,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let j=U.value;q.forEach((H)=>H(j))}};function z(){K.clear();let j=Q1;Q1=W,x7.push(W);try{return Y()}finally{x7.pop(),Q1=j}}let U={get value(){if(Q1){let j=S$.get(U);if(!j)j=new Set,S$.set(U,j);j.add(Q1)}if(G){let j=z();if(!J(Q,j))Q=j;G=!1}return Q},set value(j){if(X)X(j);else console.warn("Computed property is readonly")},subscribe(j){return q.add(j),()=>q.delete(j)},peek(){if(G)Q=Y(),G=!1;return Q},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function xG($,Z,Y={}){let{immediate:X=!1,deep:J=!1,flush:Q="pre",once:G=!1}=Y,K,q=!0,W=!1,z=()=>{if(v1($))return J?Q5($.value):$.value;return $()},U=()=>{if(!q||W)return;let B=z();if(K!==void 0&&Object.is(K,B)&&!J)return;let _=()=>{if(Z(B,K),K=J?Q5(B):B,G)H()};if(Q==="sync")_();else if(Q==="post")queueMicrotask(_);else Promise.resolve().then(_)},j=null;if(v1($))j=$.subscribe(()=>U());else j=y$($).subscribe(()=>U());if(X)K=void 0,U();else K=z();let H=()=>{if(q=!1,j)j(),j=null};return H.pause=()=>{W=!0},H.resume=()=>{W=!1},H}function fG($,Z,Y={}){let{immediate:X=!1,once:J=!1}=Y,Q=$.map((U)=>v1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((j)=>v1(j)?j.value:void 0);if(Z(U,Q),Q=[...U],J)z()},W=$.map((U)=>{if(v1(U))return U.subscribe(()=>q());return()=>{}});if(X)q();let z=()=>{G=!1,W.forEach((U)=>U())};return z.pause=()=>{K=!0},z.resume=()=>{K=!1},z}function gG($,Z={}){let{flush:Y="pre"}=Z,X,J=!0,Q=!1,G=()=>{if(!J||Q)return;if(X)X();let q=Q1;Q1=G,x7.push(G);try{X=$()}finally{x7.pop(),Q1=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(J=!1,X)X()};return K.pause=()=>{Q=!0},K.resume=()=>{Q=!1},K}function hG($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(J,Q,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[Q]=q,`<!-- computed: ${Q} = ${q} -->`}catch(K){return`<!-- computed error: ${Q} - ${K} -->`}})}function mG($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(J,Q,G)=>{return`
14280
14280
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
14281
14281
  (function() {
14282
14282
  // Watch implementation for ${Q}
@@ -14288,9 +14288,9 @@ else {
14288
14288
  }
14289
14289
  })();
14290
14290
  </script>
14291
- `})}function Q5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>Q5(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,J)=>Y.set(Q5(J),Q5(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(Q5(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=Q5($[Y]);return Z}function mG($,Z=100){let Y=m5($()),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return y$($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function dG($,Z=100){let Y=m5($()),X=0,J=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return y$($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var Q1=null,x7,S$,nO;var pG=b(()=>{x7=[],S$=new WeakMap;nO={ref:m5,computed:y$,watch:vG,watchMultiple:xG,watchEffect:fG,isRef:v1,unref:yG,toRefs:PG,shallowRef:CG,debouncedComputed:mG,throttledComputed:dG,processComputedDirectives:gG,processWatchDirectives:hG}});function P$($,Z){let Y={};for(let X of $)Y[X]=E1(Z(X));return new Proxy({},{get:(X,J)=>Y[J]?.(),set:(X,J,Q)=>{if(Y[J])Y[J].set(Q);else Y[J]=E1(Q);return!0},has:(X,J)=>(J in Y),deleteProperty:(X,J)=>{return delete Y[J],!0},ownKeys:()=>Reflect.ownKeys(Y),getOwnPropertyDescriptor:(X,J)=>(J in Y)?{enumerable:!0,configurable:!0,writable:!0,value:Y[J]()}:void 0})}function oO($,Z){let Y={};for(let X of Z)Y[X]=$[X];return Y}function o9($,Z){let Y=Object.keys($),X=P$(Y,(L)=>Z?.[L]??$[L].getDefaultValue()),J=P$(Y,()=>[]),Q=P$(Y,()=>!1),G=P$(Y,()=>!1),K=P$(Y,()=>!1),q=E1(!1);async function W(L){K[L]=!0;let V=await $[L].validate(X[L],X);return J[L]=V,K[L]=!1,V.length===0}async function z(){q.set(!0);let L=await Promise.all(Y.map(W));return q.set(!1),L.every(Boolean)}function U(){for(let L of Y)X[L]=Z?.[L]??$[L].getDefaultValue(),J[L]=[],Q[L]=!1,G[L]=!1}function j(L){for(let V of Y)if(V in L)X[V]=L[V],G[V]=!0}function H(L,V){X[L]=V,G[L]=!0}function B(L,V=!0){if(Q[L]=V,V)W(L)}function _(L){return{value:X[L],errors:J[L],touched:Q[L],dirty:G[L],valid:J[L].length===0,validating:K[L]}}function O(L){return async(V)=>{V?.preventDefault?.();for(let R of Y)Q[R]=!0;if(await z())await L(oO(X,Y))}}return{values:X,errors:J,touched:Q,dirty:G,get isValid(){return Y.every((L)=>J[L].length===0)},get isValidating(){return q()||Y.some((L)=>K[L])},get isDirty(){return Y.some((L)=>G[L])},validate:z,validateField:W,reset:U,setValues:j,setFieldValue:H,setFieldTouched:B,getFieldState:_,handleSubmit:O}}var lG;var cG=b(()=>{_4();lG=o9});var sG={};o(sG,{v:()=>sO,useForm:()=>o9,processHasErrorsDirective:()=>oG,processFormValidationDirectives:()=>rO,processErrorsDirective:()=>nG,processErrorDirective:()=>iG,defineForm:()=>lG,Validator:()=>d5});class d5{rules=[];defaultValue="";addRule($){let Z=new d5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(J)=>{if(!J)return!0;let Q=String(J).length;return Q>=$&&Q<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(J)=>{if(!J&&J!==0)return!0;let Q=Number(J);return Q>=$&&Q<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,J)=>{if(!J)return!0;return X===J[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new d5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(J,Q)=>{if(!$(J,Q||{}))return!0;return X.validate(J,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new d5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let J=await X.validate($,Z);if(J!==!0)Y.push(J)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let J=X.validate($,Z);if(J!==!0)Y.push(J)}return Y}}function iG($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>{return G.replace(/\{\{\s*message\s*\}\}/g,z)}).join(`
14292
- `)}catch{return""}})}function nG($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>G.replace(/\{\{\s*message\s*\}\}/g,z)).join(`
14293
- `)}catch{return""}})}function oG($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function rO($,Z,Y){let X=$;return X=iG(X,Z,Y),X=nG(X,Z,Y),X=oG(X,Z,Y),X}var sO;var rG=b(()=>{cG();sO=new d5});var eG={};o(eG,{processXElementDirectives:()=>aO,hasXElementDirectives:()=>tG,generateXElementRuntime:()=>aG});function aG(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
14291
+ `})}function Q5($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>Q5(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,J)=>Y.set(Q5(J),Q5(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(Q5(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=Q5($[Y]);return Z}function dG($,Z=100){let Y=m5($()),X=null,J=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return y$($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function uG($,Z=100){let Y=m5($()),X=0,J=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return y$($).subscribe(()=>J()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var Q1=null,x7,S$,oO;var lG=b(()=>{x7=[],S$=new WeakMap;oO={ref:m5,computed:y$,watch:xG,watchMultiple:fG,watchEffect:gG,isRef:v1,unref:PG,toRefs:CG,shallowRef:vG,debouncedComputed:dG,throttledComputed:uG,processComputedDirectives:hG,processWatchDirectives:mG}});function P$($,Z){let Y={};for(let X of $)Y[X]=E1(Z(X));return new Proxy({},{get:(X,J)=>Y[J]?.(),set:(X,J,Q)=>{if(Y[J])Y[J].set(Q);else Y[J]=E1(Q);return!0},has:(X,J)=>(J in Y),deleteProperty:(X,J)=>{return delete Y[J],!0},ownKeys:()=>Reflect.ownKeys(Y),getOwnPropertyDescriptor:(X,J)=>(J in Y)?{enumerable:!0,configurable:!0,writable:!0,value:Y[J]()}:void 0})}function sO($,Z){let Y={};for(let X of Z)Y[X]=$[X];return Y}function o9($,Z){let Y=Object.keys($),X=P$(Y,(L)=>Z?.[L]??$[L].getDefaultValue()),J=P$(Y,()=>[]),Q=P$(Y,()=>!1),G=P$(Y,()=>!1),K=P$(Y,()=>!1),q=E1(!1);async function W(L){K[L]=!0;let V=await $[L].validate(X[L],X);return J[L]=V,K[L]=!1,V.length===0}async function z(){q.set(!0);let L=await Promise.all(Y.map(W));return q.set(!1),L.every(Boolean)}function U(){for(let L of Y)X[L]=Z?.[L]??$[L].getDefaultValue(),J[L]=[],Q[L]=!1,G[L]=!1}function j(L){for(let V of Y)if(V in L)X[V]=L[V],G[V]=!0}function H(L,V){X[L]=V,G[L]=!0}function B(L,V=!0){if(Q[L]=V,V)W(L)}function _(L){return{value:X[L],errors:J[L],touched:Q[L],dirty:G[L],valid:J[L].length===0,validating:K[L]}}function O(L){return async(V)=>{V?.preventDefault?.();for(let R of Y)Q[R]=!0;if(await z())await L(sO(X,Y))}}return{values:X,errors:J,touched:Q,dirty:G,get isValid(){return Y.every((L)=>J[L].length===0)},get isValidating(){return q()||Y.some((L)=>K[L])},get isDirty(){return Y.some((L)=>G[L])},validate:z,validateField:W,reset:U,setValues:j,setFieldValue:H,setFieldTouched:B,getFieldState:_,handleSubmit:O}}var cG;var iG=b(()=>{_4();cG=o9});var rG={};o(rG,{v:()=>rO,useForm:()=>o9,processHasErrorsDirective:()=>sG,processFormValidationDirectives:()=>aO,processErrorsDirective:()=>oG,processErrorDirective:()=>nG,defineForm:()=>cG,Validator:()=>d5});class d5{rules=[];defaultValue="";addRule($){let Z=new d5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(J)=>{if(!J)return!0;let Q=String(J).length;return Q>=$&&Q<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(J)=>{if(!J&&J!==0)return!0;let Q=Number(J);return Q>=$&&Q<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,J)=>{if(!J)return!0;return X===J[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new d5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(J,Q)=>{if(!$(J,Q||{}))return!0;return X.validate(J,Q)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new d5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let J=await X.validate($,Z);if(J!==!0)Y.push(J)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let J=X.validate($,Z);if(J!==!0)Y.push(J)}return Y}}function nG($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>{return G.replace(/\{\{\s*message\s*\}\}/g,z)}).join(`
14292
+ `)}catch{return""}})}function oG($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((z)=>G.replace(/\{\{\s*message\s*\}\}/g,z)).join(`
14293
+ `)}catch{return""}})}function sG($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(J,Q,G)=>{try{let K=Q.trim().split("."),q=Z;for(let z of K)if(q&&typeof q==="object"&&z in q)q=q[z];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function aO($,Z,Y){let X=$;return X=nG(X,Z,Y),X=oG(X,Z,Y),X=sG(X,Z,Y),X}var rO;var aG=b(()=>{iG();rO=new d5});var $K={};o($K,{processXElementDirectives:()=>tO,hasXElementDirectives:()=>eG,generateXElementRuntime:()=>tG});function tG(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
14294
14294
  (function() {
14295
14295
  'use strict';
14296
14296
 
@@ -14574,43 +14574,43 @@ else {
14574
14574
  // Expose for manual initialization
14575
14575
  window.XElement = XElement;
14576
14576
  })();
14577
- </script>`}function tG($){return/\bx-data(?:\s|=)/.test($)}function aO($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],X=Y.length>0?$.replace(Z,""):$;if(!tG(X))return X;let J=Y[0]?.trim()||aG(),Q=X.lastIndexOf("</body>");if(Q!==-1)return X.slice(0,Q)+J+`
14577
+ </script>`}function eG($){return/\bx-data(?:\s|=)/.test($)}function tO($){let Z=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Y=$.match(Z)||[],X=Y.length>0?$.replace(Z,""):$;if(!eG(X))return X;let J=Y[0]?.trim()||tG(),Q=X.lastIndexOf("</body>");if(Q!==-1)return X.slice(0,Q)+J+`
14578
14578
  `+X.slice(Q);return X+`
14579
- `+J}var $K={};o($K,{rewriteImagesWithSiblings:()=>$F});import H1 from"path";async function $F($,Z){let Y=Z.formats??eO;if(!Z.publicDir)return $;let X=XF($),J=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let U=K[0],j=U.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(JF(K.index,X))continue;G.push({idx:K.index,length:U.length,src:j[1],raw:U})}if(G.length===0)return $;let q=await Promise.all(G.map(async(U)=>{let j=await ZF(U.src,Z.publicDir,Y);return{match:U,sources:j}}));for(let{match:U,sources:j}of q){if(j.length===0)continue;let B=`<picture>${j.map((_)=>`<source type="${_.mime}" srcset="${QF(_.url)}">`).join("")}${U.raw}</picture>`;J.push({start:U.idx,end:U.idx+U.length,replacement:B})}if(J.length===0)return $;let W="",z=0;for(let U of J)W+=$.slice(z,U.start),W+=U.replacement,z=U.end;return W+=$.slice(z),W}async function ZF($,Z,Y){if(!YF($))return[];let X=H1.extname($).toLowerCase();if(!tO.has(X))return[];if(!$.startsWith("/"))return[];let J=H1.join(Z,$.slice(1)),Q=H1.dirname(J),G=H1.basename(J,X),K=H1.resolve(Q),q=H1.resolve(Z);if(!K.startsWith(q))return[];let W=H1.posix.dirname($),z=Y.map(async(j)=>{let H=H1.join(Q,`${G}${j.ext}`);if(!await Bun.file(H).exists())return null;return{url:H1.posix.join(W,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(z)).filter((j)=>j!==null)}function YF($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function XF($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function JF($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function QF($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var tO,eO;var ZK=b(()=>{tO=new Set([".jpg",".jpeg",".png",".gif"]),eO=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var QK={};o(QK,{validateClientScript:()=>S7,processOnceDirective:()=>b7,processJsonDirective:()=>k7,processDirectives:()=>N0,injectRouterScript:()=>E2});import GF from"fs";import E0 from"path";import{deriveLayoutGroup as KF}from"stx-router/layout-metadata";function YK($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qF($,Z){let Y=$.length,X=Z,J=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
14579
+ `+J}var ZK={};o(ZK,{rewriteImagesWithSiblings:()=>ZF});import H1 from"path";async function ZF($,Z){let Y=Z.formats??$F;if(!Z.publicDir)return $;let X=JF($),J=[],Q=/<img\b[^>]*?>/gi,G=[],K;while((K=Q.exec($))!==null){let U=K[0],j=U.match(/\bsrc=["']([^"']+)["']/i);if(!j)continue;if(QF(K.index,X))continue;G.push({idx:K.index,length:U.length,src:j[1],raw:U})}if(G.length===0)return $;let q=await Promise.all(G.map(async(U)=>{let j=await YF(U.src,Z.publicDir,Y);return{match:U,sources:j}}));for(let{match:U,sources:j}of q){if(j.length===0)continue;let B=`<picture>${j.map((_)=>`<source type="${_.mime}" srcset="${GF(_.url)}">`).join("")}${U.raw}</picture>`;J.push({start:U.idx,end:U.idx+U.length,replacement:B})}if(J.length===0)return $;let W="",z=0;for(let U of J)W+=$.slice(z,U.start),W+=U.replacement,z=U.end;return W+=$.slice(z),W}async function YF($,Z,Y){if(!XF($))return[];let X=H1.extname($).toLowerCase();if(!eO.has(X))return[];if(!$.startsWith("/"))return[];let J=H1.join(Z,$.slice(1)),Q=H1.dirname(J),G=H1.basename(J,X),K=H1.resolve(Q),q=H1.resolve(Z);if(!K.startsWith(q))return[];let W=H1.posix.dirname($),z=Y.map(async(j)=>{let H=H1.join(Q,`${G}${j.ext}`);if(!await Bun.file(H).exists())return null;return{url:H1.posix.join(W,`${G}${j.ext}`),mime:j.mime}});return(await Promise.all(z)).filter((j)=>j!==null)}function XF($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function JF($){let Z=[],Y=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);return Z}function QF($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function GF($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var eO,$F;var YK=b(()=>{eO=new Set([".jpg",".jpeg",".png",".gif"]),$F=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var GK={};o(GK,{validateClientScript:()=>S7,processOnceDirective:()=>b7,processJsonDirective:()=>k7,processDirectives:()=>N0,injectRouterScript:()=>k2});import KF from"fs";import E0 from"path";import{deriveLayoutGroup as qF}from"stx-router/layout-metadata";function XK($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function WF($,Z){let Y=$.length,X=Z,J=!0,Q=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
14580
14580
  `,X+2),X===-1)return-1;X+=1,J=!0;continue}if(K==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,J=!0;continue}if(K==="/"&&J){let q=X+1,W=!1;while(q<Y){let z=$[q];if(z==="\\"){q+=2;continue}if(z==="[")W=!0;else if(z==="]")W=!1;else if(z==="/"&&!W){q++;break}else if(z===`
14581
14581
  `){q=-1;break}q++}if(q===-1){X++,J=!1;continue}while(q<Y&&/[a-z]/.test($[q]))q++;X=q,J=!1;continue}if(K==="'"||K==='"'){let q=K;X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
14582
- `)break;X++}J=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,J=!0;break}X++}if(Q.length===0)J=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,J=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,J=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))J=!1;else J=!0;X++}return-1}function u5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let J=X.index+X[0].length,Q=$.indexOf("</script>",J);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}function XK($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let Q=$.indexOf("-->",Y+4);Z=Q===-1?$.length:Q+3;continue}let X=$.slice(Y),J=/^<style\b[^>]*>/i.exec(X);if(J){let Q=$.toLowerCase().indexOf("</style>",Y+J[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(X))return Y;Z=Y+1}return-1}function WF($){let Z=u5($,"data-stx-runtime");if(!Z)return $;let Y=XK($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),J=$.slice(0,Z.start)+$.slice(Z.end),Q=XK(J);if(Q===-1)return X+`
14582
+ `)break;X++}J=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,J=!0;break}X++}if(Q.length===0)J=!1;continue}if(K==="}"&&Q.length>0){Q.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,J=!1;break}if($[X]==="$"&&$[X+1]==="{"){Q.push(!0),X+=2,J=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))J=!1;else J=!0;X++}return-1}function u5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let J=X.index+X[0].length,Q=$.indexOf("</script>",J);if(Q===-1)return null;let G=$.indexOf(">",Q);if(G===-1)return null;return{start:X.index,end:G+1}}function JK($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let Q=$.indexOf("-->",Y+4);Z=Q===-1?$.length:Q+3;continue}let X=$.slice(Y),J=/^<style\b[^>]*>/i.exec(X);if(J){let Q=$.toLowerCase().indexOf("</style>",Y+J[0].length);Z=Q===-1?$.length:Q+8;continue}if(/^<script\b[^>]*>/i.test(X))return Y;Z=Y+1}return-1}function zF($){let Z=u5($,"data-stx-runtime");if(!Z)return $;let Y=JK($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),J=$.slice(0,Z.start)+$.slice(Z.end),Q=JK(J);if(Q===-1)return X+`
14583
14583
  `+J;return J.slice(0,Q)+X+`
14584
- `+J.slice(Q)}async function N0($,Z,Y,X,J){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=z1($);let Q=!Z.__stxProcessingDepth;if(Q)HZ(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!F$()&&!t4())&&Y&&Y.endsWith(".stx"))o6($,Y);try{return await xZ.timeAsync("template-processing",async()=>{let G=await zF($,Z,Y,X,J);if(Q)G=h9(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??H3(),z=(Z.__stx_head_raw||"").trim(),U,j=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)U=j[1].trim(),z=z.replace(j[0],"").trim();let H=Z.__sections?.title,B=W.title||U||H,_=!W.title&&(!!U||!!H),O={...K,...B&&{title:B},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,z].filter(Boolean).join(`
14585
- `),...W.htmlAttrs&&{htmlAttrs:TQ(K.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},F=g9(G);if(G=kQ(G,O,{..._&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}}),F)G=EQ(G,K),G=IQ(G,O.htmlAttrs);let L=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&G.includes("<head")){let R=L[1],N=KF(R);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
14586
- <meta name="stx-layout" content="${YK(R)}">
14587
- <meta name="stx-layout-group" content="${YK(N)}">`)}let V=G.match(/function (__stx_setup_\d+_\d+)\(/),w=V?G4(G):null;if(V&&w&&!/\bdata-stx=/.test(w.tag)){G=N3(G,(N,A)=>`<body${A} data-stx="${V[1]}">`);let R=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${V[1]}"`,"i");G=G.replace(R,"$1")}}if(Q){G=DQ(G);let K=X.app?.colorMode;if(K)G=wQ(G,K);G=NQ(G),G=WF(G)}if(Q)try{let{getStoreScript:K}=await t("stx/store-loader",()=>Promise.resolve().then(() => (hQ(),gQ))),q=X.storesDir,W=await K(q);if(W){let z=`<script data-stx-stores>${W}</script>`,U=u5(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
14588
- `+z+G.slice(U.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:K}=await t("stx/framework-composables",()=>Promise.resolve().then(() => (lQ(),pQ))),q=await K(G);if(q){let W=u5(G,"data-stx-stores")||u5(G,"data-stx-runtime");if(W)G=G.slice(0,W.end)+`
14589
- `+q+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:K}=await t("stx/composable-loader",()=>Promise.resolve().then(() => (nQ(),iQ))),q=X.composablesDir,W=await K(q);if(W){let z=`<script data-stx-composables>${W}</script>`,U=u5(G,"data-stx-stores")||u5(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
14590
- `+z+G.slice(U.end)}}catch{}if(Q)G=RQ(G);if(Q&&Z.__stx_inject_css!==!1)G=await UX(G,void 0,X.buildMode==="serve");if(Q)G=dZ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Y7)throw G;let K=G instanceof Error?G.message:String(G),q=new a1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(a0.log(q,{filePath:Y,context:Z}),M6.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return N6.createFallbackContent("Template Processing",q)}}async function zF($,Z,Y,X,J){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!E0.isAbsolute(X.partialsDir)?E0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!E0.isAbsolute(X.componentsDir)?E0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!E0.isAbsolute(X.layoutsDir)?E0.resolve(Q,X.layoutsDir):X.layoutsDir},K=G,q=$;await BF(Y,Z),jF(Z,K),q=await T5(()=>YQ(q,Z,Y,K),q,(V)=>{a0.log(V,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${V.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=Z1(q,J$,(V,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);q=W.output;let z=W.tokens,U=(V)=>z.length===0?V:V.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>z[Number(R)]??""),j="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,j),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(V,w)=>{return`{{ ${w} }}`}),q=BQ(q),q=await PQ(q,Y,J);let H={};q=E9(q,H);let B={...Z.__sections||{}},_="",O=NX(RX($)),F=/@nolayout\b/.test(q)||O===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let L=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)_=L[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(q))q=`@section('content')
14584
+ `+J.slice(Q)}async function N0($,Z,Y,X,J){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;if(Z.__stx_signals_gate===void 0)Z.__stx_signals_gate=z1($);let Q=!Z.__stxProcessingDepth;if(Q)HZ(Z);if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!F$()&&!t4())&&Y&&Y.endsWith(".stx"))o6($,Y);try{return await fZ.timeAsync("template-processing",async()=>{let G=await UF($,Z,Y,X,J);if(Q)G=h9(G);if(Q&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??H3(),z=(Z.__stx_head_raw||"").trim(),U,j=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(j)U=j[1].trim(),z=z.replace(j[0],"").trim();let H=Z.__sections?.title,B=W.title||U||H,_=!W.title&&(!!U||!!H),O={...K,...B&&{title:B},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,z].filter(Boolean).join(`
14585
+ `),...W.htmlAttrs&&{htmlAttrs:IQ(K.htmlAttrs,W.htmlAttrs)},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},F=g9(G);if(G=bQ(G,O,{..._&&{titleIsHtml:!0},...X.app?.colorMode&&{colorMode:X.app.colorMode}}),F)G=kQ(G,K),G=DQ(G,O.htmlAttrs);let L=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(L&&G.includes("<head")){let R=L[1],N=qF(R);G=G.replace(/<head\b[^>]*>/i,(A)=>`${A}
14586
+ <meta name="stx-layout" content="${XK(R)}">
14587
+ <meta name="stx-layout-group" content="${XK(N)}">`)}let V=G.match(/function (__stx_setup_\d+_\d+)\(/),w=V?G4(G):null;if(V&&w&&!/\bdata-stx=/.test(w.tag)){G=N3(G,(N,A)=>`<body${A} data-stx="${V[1]}">`);let R=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${V[1]}"`,"i");G=G.replace(R,"$1")}}if(Q){G=EQ(G);let K=X.app?.colorMode;if(K)G=RQ(G,K);G=AQ(G),G=zF(G)}if(Q)try{let{getStoreScript:K}=await t("stx/store-loader",()=>Promise.resolve().then(() => (mQ(),hQ))),q=X.storesDir,W=await K(q);if(W){let z=`<script data-stx-stores>${W}</script>`,U=u5(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
14588
+ `+z+G.slice(U.end)}}catch{}if(Q)try{let{getFrameworkComposableScript:K}=await t("stx/framework-composables",()=>Promise.resolve().then(() => (cQ(),lQ))),q=await K(G);if(q){let W=u5(G,"data-stx-stores")||u5(G,"data-stx-runtime");if(W)G=G.slice(0,W.end)+`
14589
+ `+q+G.slice(W.end)}}catch{}if(Q)try{let{getComposableScript:K}=await t("stx/composable-loader",()=>Promise.resolve().then(() => (oQ(),nQ))),q=X.composablesDir,W=await K(q);if(W){let z=`<script data-stx-composables>${W}</script>`,U=u5(G,"data-stx-stores")||u5(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
14590
+ `+z+G.slice(U.end)}}catch{}if(Q)G=NQ(G);if(Q&&Z.__stx_inject_css!==!1)G=await jX(G,void 0,X.buildMode==="serve");if(Q)G=uZ(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof Y7)throw G;let K=G instanceof Error?G.message:String(G),q=new a1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(a0.log(q,{filePath:Y,context:Z}),M6.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return N6.createFallbackContent("Template Processing",q)}}async function UF($,Z,Y,X,J){let Q=process.cwd(),G={...X,partialsDir:X.partialsDir&&!E0.isAbsolute(X.partialsDir)?E0.resolve(Q,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!E0.isAbsolute(X.componentsDir)?E0.resolve(Q,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!E0.isAbsolute(X.layoutsDir)?E0.resolve(Q,X.layoutsDir):X.layoutsDir},K=G,q=$;await HF(Y,Z),BF(Z,K),q=await T5(()=>XQ(q,Z,Y,K),q,(V)=>{a0.log(V,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${V.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=Z1(q,J$,(V,w)=>`\x00STX_HTML_COMMENT_${w}\x00`);q=W.output;let z=W.tokens,U=(V)=>z.length===0?V:V.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(w,R)=>z[Number(R)]??""),j="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,j),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(V,w)=>{return`{{ ${w} }}`}),q=HQ(q),q=await CQ(q,Y,J);let H={};q=E9(q,H);let B={...Z.__sections||{}},_="",O=AX(NX($)),F=/@nolayout\b/.test(q)||O===!1;if(/@nolayout\b/.test(q))q=q.replace(/@nolayout\b\s*/g,"");let L=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)_=L[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof O==="string"){if(_=O,!/@section\s*\(/.test(q))q=`@section('content')
14591
14591
  ${q.trim()}
14592
14592
  @endsection`}if(!_&&!F&&K.defaultLayout){let V=f9(q),w=/@section\s*\(/.test(q);if(!V||w){let R="",N=E0.dirname(Y),A=K.layoutsDir?E0.dirname(K.layoutsDir):process.cwd();for(let M=0;M<20;M++){let I=E0.join(N,"_layout.stx");if(await c(I)){R=I;break}let T=E0.dirname(N);if(T===N||T.length<A.length)break;N=T}if(R)_=R;else if(K.layoutsDir){let M=E0.isAbsolute(K.layoutsDir)?K.layoutsDir:E0.resolve(process.cwd(),K.layoutsDir),I=E0.join(M,`${K.defaultLayout}.stx`);if(await c(I))_=I}if(_&&!w)q=`@section('content')
14593
14593
  ${q.trim()}
14594
14594
  @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(V,w,R)=>{return B[w]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(V,w,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return V;try{let N=Z0(R.trim(),Z);if(N===void 0)return V;return B[w]=String(N??""),""}catch{return V}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(V,w,R)=>{if(R.includes("@parent"))B[w]=R.replace("@parent",G5);else B[w]=R.trim();return""}),Z.__sections=B,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(V,w,R)=>{return B[w]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""});if(q=k9(q,H),_){let V=[],w=N1(q),R=Z1(w.output,O5,(N,A)=>`\x00STX_ORPHAN_STYLE_${A}\x00`);if(q=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(N,A,M)=>{let I=A==="SCRIPT"?w.scripts[Number(M)]:R.tokens[Number(M)];if(I)V.push(I);return""}),V.length>0){let N=V.join(`
14595
14595
  `);B.content=B.content?`${B.content}
14596
- ${N}`:N,Z.__sections=B}}if(_)try{let V;if(E0.isAbsolute(_))V=_,J.add(_);else V=await T5(()=>h3(_,Y,G,J),null,()=>{throw new a1(`Failed to resolve layout path: ${_}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!V){let I=[];try{let k=G.layoutsDir;if(k){let D=E0.isAbsolute(k)?k:E0.resolve(process.cwd(),k);I=GF.readdirSync(D).filter((P)=>P.endsWith(".stx")).map((P)=>P.replace(/\.stx$/,"")).sort()}}catch{}let T=`Layout not found: ${_} (referenced from ${Y})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(a0.log(Error(T),{layoutPath:_,filePath:Y,available:I},"error"),console.error(`[stx] ${T}`),G.debug)throw new a1(T,Y);return q}let w=await T5(()=>Bun.file(V).text(),"",()=>{throw new a1(`Failed to read layout file: ${V}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${V}`);let I={},T=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(P,y,S)=>{return I[y]=S.trim(),""});for(let[P,y]of Object.entries(I))if(B[P]&&B[P].includes(G5)){let S=B[P].indexOf(G5);B[P]=B[P].slice(0,S)+y+B[P].slice(S+G5.length)}else if(!B[P])B[P]=y;let k={...Z,__sections:B},D=`@layout('${R[1]}')${T}`;return await N0(D,k,V,G,J)}let N=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=E9(N,H),M={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,T,k)=>{return M[T]=k.trim(),`@slot('${T}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(I,T,k)=>{if(B[T]){let D=B[T];if(D.includes(G5)){let P=M[T]||"",y=D.indexOf(G5);D=D.slice(0,y)+P+D.slice(y+G5.length)}return D}return k||""}),A=UF(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=k9(A,H),Z.__originalFilePath=Y,q=await JK(A,Z,V,G,J),q=`<!-- stx-layout: ${_} -->
14597
- ${q}`,U(q)}catch(V){return a0.log(V instanceof Error?V:Error(String(V)),{layoutPath:_,filePath:Y},"error"),`[Error processing layout: ${V instanceof Error?V.message:String(V)}]`}return U(await JK(q,Z,Y,G,J))}function UF($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,J)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return J||""})}function jF($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[J,Q]of Object.entries(process.env))if(J.startsWith(Y)&&Q!==void 0)X[J]=Q;$.$env=X}async function BF($,Z){await T5(()=>KQ($,Z),void 0,(Y)=>{a0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function HF($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=X.exec($))!==null){let Q=J[1],G=J[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:q}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (z$(),X4)));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));a0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function _F($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await t("stx/expressions",()=>Promise.resolve().then(() => (Y1(),PZ)));return X($,Z,{skipServer:!0})}catch(X){let J=X instanceof Error?X:Error(String(X));return a0.log(J,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${J.message}`),$}}async function JK($,Z,Y,X,J){let Q=$,G=X;if(await HF(Q,Z,Y),Q=await _F(Q,Z,Y),Q=await rJ(Q,Z,Y),Q=await aJ(Q,Z,Y),Q=await uX(Q,Z,Y,G),z1(Q))Q=P3(Q,Z),Q=v3(Q,Z);Q=C3(Q);let{processStreamDirectives:K}=await t("stx/streaming",()=>Promise.resolve().then(() => (n6(),i6)));Q=K(Q,Z),Q=M9(Q,Z,Y,G),Q=await LQ(Q,Z,Y,G,J),Q=await N7(Q,Z,Y,G,J),Q=E8(Q,Z,Y,G);let{processDeferDirectives:q}=await t("stx/defer",()=>Promise.resolve().then(() => sQ));Q=q(Q,Z,Y);let{processTeleportDirectives:W}=await t("stx/teleport",()=>Promise.resolve().then(() => aQ));Q=W(Q,Z,Y);let{processTransitionDirectives:z,processTransitionAttributes:U}=await t("stx/transitions",()=>Promise.resolve().then(() => ZG));Q=z(Q,Z,Y),Q=U(Q);let{processErrorBoundaryDirectives:j}=await t("stx/error-boundaries",()=>Promise.resolve().then(() => XG));Q=j(Q,Z,Y);let{processSuspenseDirectives:H}=await t("stx/suspense",()=>Promise.resolve().then(() => JG));Q=H(Q,Z,Y);let{processAsyncDirectives:B}=await t("stx/async-components",()=>Promise.resolve().then(() => qG));Q=B(Q,Z,Y);let{processKeepAliveDirectives:_}=await t("stx/keep-alive",()=>Promise.resolve().then(() => zG));Q=_(Q,Z,Y);let{processVirtualListDirectives:O,processVirtualGridDirectives:F,processInfiniteListDirectives:L}=await t("stx/virtual-scrolling",()=>Promise.resolve().then(() => (OG(),_G)));Q=O(Q,Z,Y),Q=F(Q,Z,Y),Q=L(Q,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await t("stx/partial-hydration",()=>Promise.resolve().then(() => (SG(),bG)));Q=V(Q,Z,Y),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:N}=await t("stx/computed",()=>Promise.resolve().then(() => (pG(),uG)));Q=R(Q,Z,Y),Q=N(Q,Z,Y);let{processFormValidationDirectives:A}=await t("stx/forms-validation",()=>Promise.resolve().then(() => (rG(),sG)));Q=A(Q,Z,Y);let{processHeadDirective:M,processTitleDirective:I,processMetaDirective:T,resetHead:k}=await t("stx/head",()=>Promise.resolve().then(() => (W$(),O3)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let D=M(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
14598
- `;if(Q=I(Q,Z),Q=T(Q,Z),Q=QQ(Q),Q=y6(Q,Z),Q=mX(Q),Q=$Q(Q),Q=await D9(Q,Z,Y,G,J),Q=await N7(Q,Z,Y,G,J),Z.__stxProcessingDepth===1)Q=OZ(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=h9(Q),Q=$5(Q,Z,Y),Q=P6(Q,Z),Q=C6(Q,Z),Q=B7(Q,Z),Q=aX(Q,Z),Q=tX(Q,Z),Q=await EX(Q,Z,Y,G),Q=await u2(Q,Z,Y),Q=await XJ(Q,Z,Y,G),Q=R8(Q,Z,Y,G),Q=oY(Q,Z,Y,G),Q=sY(Q,Z,Y),Q=rY(Q,Z,Y,G),Q=fX(Q,Z,Y,G),Q=k7(Q,Z),Q=b7(Q),Q=vQ(Q),!G.skipEventDirectives)Q=o8(Q,Z,Y);if(Q=IX(Q,Z,Y),G.debug){let n=/\bx-data\s*=/.test(Q),r=N4($);if(n&&r)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
14596
+ ${N}`:N,Z.__sections=B}}if(_)try{let V;if(E0.isAbsolute(_))V=_,J.add(_);else V=await T5(()=>h3(_,Y,G,J),null,()=>{throw new a1(`Failed to resolve layout path: ${_}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!V){let I=[];try{let k=G.layoutsDir;if(k){let D=E0.isAbsolute(k)?k:E0.resolve(process.cwd(),k);I=KF.readdirSync(D).filter((P)=>P.endsWith(".stx")).map((P)=>P.replace(/\.stx$/,"")).sort()}}catch{}let T=`Layout not found: ${_} (referenced from ${Y})`+(I.length>0?`. Available layouts: ${I.join(", ")}`:G.layoutsDir?`. No .stx layouts found in ${G.layoutsDir}`:"");if(a0.log(Error(T),{layoutPath:_,filePath:Y,available:I},"error"),console.error(`[stx] ${T}`),G.debug)throw new a1(T,Y);return q}let w=await T5(()=>Bun.file(V).text(),"",()=>{throw new a1(`Failed to read layout file: ${V}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=w.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${V}`);let I={},T=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(P,y,S)=>{return I[y]=S.trim(),""});for(let[P,y]of Object.entries(I))if(B[P]&&B[P].includes(G5)){let S=B[P].indexOf(G5);B[P]=B[P].slice(0,S)+y+B[P].slice(S+G5.length)}else if(!B[P])B[P]=y;let k={...Z,__sections:B},D=`@layout('${R[1]}')${T}`;return await N0(D,k,V,G,J)}let N=w.replace(/\{\{--[\s\S]*?--\}\}/g,""),A=E9(N,H),M={};return A=A.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(I,T,k)=>{return M[T]=k.trim(),`@slot('${T}')`}),A=A.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(I,T,k)=>{if(B[T]){let D=B[T];if(D.includes(G5)){let P=M[T]||"",y=D.indexOf(G5);D=D.slice(0,y)+P+D.slice(y+G5.length)}return D}return k||""}),A=jF(A,B),A=A.replace(/\{\{\s*slot\s*\}\}/g,()=>{return B.content||""}),A=k9(A,H),Z.__originalFilePath=Y,q=await QK(A,Z,V,G,J),q=`<!-- stx-layout: ${_} -->
14597
+ ${q}`,U(q)}catch(V){return a0.log(V instanceof Error?V:Error(String(V)),{layoutPath:_,filePath:Y},"error"),`[Error processing layout: ${V instanceof Error?V.message:String(V)}]`}return U(await QK(q,Z,Y,G,J))}function jF($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,J)=>{let Q=Z[X];if(Q!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(Q))return Q}return J||""})}function BF($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[J,Q]of Object.entries(process.env))if(J.startsWith(Y)&&Q!==void 0)X[J]=Q;$.$env=X}async function HF($,Z){await T5(()=>qQ($,Z),void 0,(Y)=>{a0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function _F($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=X.exec($))!==null){let Q=J[1],G=J[2];if(!/\bserver\b/.test(Q)||!G.trim())continue;try{let{extractVariables:q}=await t("stx/variable-extractor",()=>Promise.resolve().then(() => (z$(),X4)));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));a0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function OF($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await t("stx/expressions",()=>Promise.resolve().then(() => (Y1(),CZ)));return X($,Z,{skipServer:!0})}catch(X){let J=X instanceof Error?X:Error(String(X));return a0.log(J,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${J.message}`),$}}async function QK($,Z,Y,X,J){let Q=$,G=X;if(await _F(Q,Z,Y),Q=await OF(Q,Z,Y),Q=await aJ(Q,Z,Y),Q=await tJ(Q,Z,Y),Q=await pX(Q,Z,Y,G),z1(Q))Q=P3(Q,Z),Q=v3(Q,Z);Q=C3(Q);let{processStreamDirectives:K}=await t("stx/streaming",()=>Promise.resolve().then(() => (n6(),i6)));Q=K(Q,Z),Q=M9(Q,Z,Y,G),Q=await VQ(Q,Z,Y,G,J),Q=await N7(Q,Z,Y,G,J),Q=E8(Q,Z,Y,G);let{processDeferDirectives:q}=await t("stx/defer",()=>Promise.resolve().then(() => rQ));Q=q(Q,Z,Y);let{processTeleportDirectives:W}=await t("stx/teleport",()=>Promise.resolve().then(() => tQ));Q=W(Q,Z,Y);let{processTransitionDirectives:z,processTransitionAttributes:U}=await t("stx/transitions",()=>Promise.resolve().then(() => YG));Q=z(Q,Z,Y),Q=U(Q);let{processErrorBoundaryDirectives:j}=await t("stx/error-boundaries",()=>Promise.resolve().then(() => JG));Q=j(Q,Z,Y);let{processSuspenseDirectives:H}=await t("stx/suspense",()=>Promise.resolve().then(() => QG));Q=H(Q,Z,Y);let{processAsyncDirectives:B}=await t("stx/async-components",()=>Promise.resolve().then(() => WG));Q=B(Q,Z,Y);let{processKeepAliveDirectives:_}=await t("stx/keep-alive",()=>Promise.resolve().then(() => UG));Q=_(Q,Z,Y);let{processVirtualListDirectives:O,processVirtualGridDirectives:F,processInfiniteListDirectives:L}=await t("stx/virtual-scrolling",()=>Promise.resolve().then(() => (FG(),OG)));Q=O(Q,Z,Y),Q=F(Q,Z,Y),Q=L(Q,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:w}=await t("stx/partial-hydration",()=>Promise.resolve().then(() => (yG(),SG)));Q=V(Q,Z,Y),Q=w(Q);let{processComputedDirectives:R,processWatchDirectives:N}=await t("stx/computed",()=>Promise.resolve().then(() => (lG(),pG)));Q=R(Q,Z,Y),Q=N(Q,Z,Y);let{processFormValidationDirectives:A}=await t("stx/forms-validation",()=>Promise.resolve().then(() => (aG(),rG)));Q=A(Q,Z,Y);let{processHeadDirective:M,processTitleDirective:I,processMetaDirective:T,resetHead:k}=await t("stx/head",()=>Promise.resolve().then(() => (W$(),O3)));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)k();let D=M(Q);if(Q=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
14598
+ `;if(Q=I(Q,Z),Q=T(Q,Z),Q=GQ(Q),Q=y6(Q,Z),Q=dX(Q),Q=ZQ(Q),Q=await D9(Q,Z,Y,G,J),Q=await N7(Q,Z,Y,G,J),Z.__stxProcessingDepth===1)Q=OZ(Q,Z);if(Q=Q.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),Q=h9(Q),Q=$5(Q,Z,Y),Q=P6(Q,Z),Q=C6(Q,Z),Q=B7(Q,Z),Q=tX(Q,Z),Q=eX(Q,Z),Q=await kX(Q,Z,Y,G),Q=await p2(Q,Z,Y),Q=await JJ(Q,Z,Y,G),Q=R8(Q,Z,Y,G),Q=sY(Q,Z,Y,G),Q=rY(Q,Z,Y),Q=aY(Q,Z,Y,G),Q=gX(Q,Z,Y,G),Q=k7(Q,Z),Q=b7(Q),Q=xQ(Q),!G.skipEventDirectives)Q=o8(Q,Z,Y);if(Q=DX(Q,Z,Y),G.debug){let n=/\bx-data\s*=/.test(Q),r=N4($);if(n&&r)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
14599
14599
  Both work on the same page, but they manage separate scopes.
14600
- Prefer signals (state/derived/effect) for new components.`)}Q=zQ(Q,Z),Q=await A1(Q,Z,Y),Q=xQ(Q),Q=fQ(Q),Q=FX(Q);let{processXElementDirectives:P}=await t("stx/x-element",()=>Promise.resolve().then(() => eG));Q=P(Q);let y=Z.__originalFilePath||Y,S=Z$(Z);if(Q=await x3(Q,G,y,S),Q=nX(Q,Z),Q=await XQ(Q,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:r}=await t("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (ZK(),$K)));Q=await r(Q,{publicDir:n})}if(G.seo?.enabled)Q=aY(Q,Z,G);let C=(n,r,q0=!0)=>{if(!r)return n;let A0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),J0=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(A0&&J0){if(q0)n=n.replace(J0[0],A0[0]);if(r=r.replace(A0[0],"").trim(),!r)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${r}
14600
+ Prefer signals (state/derived/effect) for new components.`)}Q=UQ(Q,Z),Q=await A1(Q,Z,Y),Q=fQ(Q),Q=gQ(Q),Q=LX(Q);let{processXElementDirectives:P}=await t("stx/x-element",()=>Promise.resolve().then(() => $K));Q=P(Q);let y=Z.__originalFilePath||Y,S=Z$(Z);if(Q=await x3(Q,G,y,S),Q=oX(Q,Z),Q=await JQ(Q,Z,Y,G),G.media?.image?.autoSiblings){let n=G.publicDir||"public",{rewriteImagesWithSiblings:r}=await t("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (YK(),ZK)));Q=await r(Q,{publicDir:n})}if(G.seo?.enabled)Q=tY(Q,Z,G);let C=(n,r,q0=!0)=>{if(!r)return n;let A0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),J0=n.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(A0&&J0){if(q0)n=n.replace(J0[0],A0[0]);if(r=r.replace(A0[0],"").trim(),!r)return n}if(/<\/head>/i.test(n))return n.replace(/<\/head>/i,`${r}
14601
14601
  </head>`);if(/<head\b[^>]*>/i.test(n))return n.replace(/(<head\b[^>]*>)/i,`$1
14602
14602
  ${r}`);if(/<html\b[^>]*>/i.test(n))return n.replace(/(<html\b[^>]*>)/i,`$1
14603
14603
  <head>
14604
14604
  ${r}
14605
- </head>`);return n},{renderHead:x,getHead:d}=await t("stx/head",()=>Promise.resolve().then(() => (W$(),O3))),X0=Z.__stx_runtime_head??d();if(X0.title||X0.meta?.length||X0.link?.length){let n=x(X0);if(n)Q=C(Q,n)}if(D.headContent)Q=C(Q,D.headContent,!X0.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=vX(Q,G.csp,Z);if(G.analytics?.enabled)Q=VX(Q,G);if(G.heatmap?.enabled)Q=P8(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await t("stx/pwa/inject",()=>Promise.resolve().then(() => (d$(),H8)));Q=n(Q,G)}let d0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),V0=/\bSTX\.\w+/.test(Q),i0=/window\.STX\s*=/.test(Q);if(d0&&V0&&!i0){let r=`<script data-stx-scoped data-stx-run="once">
14606
- ${BX()}
14605
+ </head>`);return n},{renderHead:x,getHead:d}=await t("stx/head",()=>Promise.resolve().then(() => (W$(),O3))),X0=Z.__stx_runtime_head??d();if(X0.title||X0.meta?.length||X0.link?.length){let n=x(X0);if(n)Q=C(Q,n)}if(D.headContent)Q=C(Q,D.headContent,!X0.title);if(G.csp?.enabled&&G.csp.addMetaTag)Q=xX(Q,G.csp,Z);if(G.analytics?.enabled)Q=wX(Q,G);if(G.heatmap?.enabled)Q=P8(Q,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:n}=await t("stx/pwa/inject",()=>Promise.resolve().then(() => (d$(),H8)));Q=n(Q,G)}let u0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(Q),V0=/\bSTX\.\w+/.test(Q),i0=/window\.STX\s*=/.test(Q);if(u0&&V0&&!i0){let r=`<script data-stx-scoped data-stx-run="once">
14606
+ ${HX()}
14607
14607
  </script>`;if(Q.includes("</head>")){let q0=Q.indexOf("</head>"),J0=Q.slice(0,q0).indexOf("<script");if(J0!==-1){let E=Q.slice(0,J0),v=Q.slice(J0);Q=E+r+`
14608
14608
  `+v}else Q=Q.replace("</head>",`${r}
14609
14609
  </head>`)}else if(Q.includes("<body"))Q=Q.replace(/<body([^>]*)>/,`<body$1>
14610
14610
  ${r}`);else Q=r+`
14611
- `+Q}{let{scanScriptTags:n}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (H$(),A4))),r=[];for(let q0 of n(Q)){if(!/\bserver\b/i.test(q0.attrs))continue;let A0=q0.start+q0.fullMatch.indexOf(">")+1,J0=qF(Q,A0);if(J0===-1)continue;let E=J0+9;while(E<Q.length&&/\s/.test(Q[E]))E++;r.push({start:q0.start,end:E})}for(let q0=r.length-1;q0>=0;q0--){let{start:A0,end:J0}=r[q0];Q=Q.substring(0,A0)+Q.substring(J0)}}let p=e$(Q,Y);if(p.hasScoped)Q=p.html;let B0=Z.__stx_event_bindings||[],u0=!1,_1=[],q5=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:W5}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (H$(),A4)));for(let n of W5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))_1.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:r,content:q0}of _1){u0=!0;let A0=q0;S7(q0,Y,X.strict,Z.__originalFilePath);let J0=await Y$(q0,{eventBindings:B0,attrs:r,hasColonDirectives:q5,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:S});Q=Q.replace(n,()=>J0)}if(u0)Z.__stx_event_bindings=[];if(!u0&&Z.__stxProcessingDepth===1){let n=Z.__stx_event_bindings||[];if(n.length>0){let r=t7(n);if(r){let q0=Q.lastIndexOf("</body>");Q=q0===-1?Q+r:Q.slice(0,q0)+r+`
14612
- `+Q.slice(q0)}Z.__stx_event_bindings=[]}}if(!I2(Q)&&D2(Q))Q=await L4(Q,G);if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=xX(Q,Z.cspNonce);return Q}var G5="<!--PARENT_CONTENT_PLACEHOLDER-->";var D4=b(()=>{jX();A3();u1();c7();HX();LX();wX();o7();i7();e7();X$();DX();kX();z7();gX();dX();lX();oX();U1();W$();Y1();eX();JJ();sJ();eJ();T9();m3();JQ();V5();GQ();T6();R0();qQ();UQ();HQ();VQ();j3();C9();bQ();H$();N9();CQ();m9();d9();F0();s6();G3();r5();V4();V4();m9();d9()});import wF from"fs";import s9 from"path";import _K from"fs";import K1 from"path";var e9=[72,96,128,144,152,192,384,512],$8=[120,152,167,180],Z8=[16,32];async function Y8($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let J=K1.isAbsolute(X.src)?X.src:K1.resolve(process.cwd(),X.src);if(!await Bun.file(J).exists())return Y.errors.push(`Source icon not found: ${J}`),Y.success=!1,Y;let Q=K1.resolve(Z,X.outputDir||"pwa-icons");try{_K.mkdirSync(Q,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Q}`),Y.success=!1,Y}let G=X.sizes||e9,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let W;try{W=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
14613
- Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let U=await W.default(J).metadata();if(U.width&&U.width<512)Y.warnings.push(`Source icon is ${U.width}x${U.height}. Recommend using at least 512x512 for best quality.`);for(let O of G){let F=K1.join(Q,`icon-${O}x${O}.png`);if(await W.default(J).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let L=K1.join(Q,`icon-${O}x${O}.webp`);await W.default(J).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(L),Y.generatedFiles.push(L)}}if(q){for(let F of $8){let L=K1.join(Q,`apple-touch-icon-${F}x${F}.png`);await W.default(J).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}let O=K1.join(Q,"apple-touch-icon.png");await W.default(J).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}for(let O of Z8){let F=K1.join(Q,`favicon-${O}x${O}.png`);await W.default(J).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let j=512,H=K1.join(Q,`icon-maskable-${j}x${j}.png`),B=Math.floor(j*0.1),_=j-B*2;await W.default(J).resize(_,_,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:B,bottom:B,left:B,right:B,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(H),Y.generatedFiles.push(H)}catch(W){let z=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${z}`),Y.success=!1}return Y}function MF($){let Z=$.sizes||e9,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,J=$.generateAppleIcons??!0,Q=[];for(let G of Z)if(Q.push(`${Y}/icon-${G}x${G}.png`),X)Q.push(`${Y}/icon-${G}x${G}.webp`);if(J){Q.push(`${Y}/apple-touch-icon.png`);for(let G of $8)Q.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of Z8)Q.push(`${Y}/favicon-${G}x${G}.png`);return Q.push(`${Y}/icon-maskable-512x512.png`),Q}async function X8(){try{return await import("sharp"),!0}catch{return!1}}d$();function xK($,Z,Y,X){let J=[],Q=X.join(" ");for(let G of $)if(J.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:Q}),Y)J.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:Q});return J}function fK($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function gK($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Y}function hK($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Y}function mK($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function dK($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,J=X?.sizes||[72,96,128,144,152,192,384,512],Q=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:xK(J,Q,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=fK(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((j)=>({src:j.src,sizes:j.sizes,type:j.type,label:j.label,form_factor:j.platform}));let W=gK($);if(W)q.share_target=W;let z=hK($);if(z)q.file_handlers=z;let U=mK($);if(U)q.protocol_handlers=U;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function _8($){let Z=dK($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function CF($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function vF($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let J=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!J.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${J.join(", ")}`);let Q=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!Q.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import GK from"path";async function KK($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=GK.isAbsolute(Z.page)?Z.page:GK.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (D4(),QK)),J=await Bun.file(Y).text();return await X(J,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return OF($)}function OF($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",J=Z?.fallbackMessage||"Please check your internet connection and try again.",Q=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
14611
+ `+Q}{let{scanScriptTags:n}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (H$(),A4))),r=[];for(let q0 of n(Q)){if(!/\bserver\b/i.test(q0.attrs))continue;let A0=q0.start+q0.fullMatch.indexOf(">")+1,J0=WF(Q,A0);if(J0===-1)continue;let E=J0+9;while(E<Q.length&&/\s/.test(Q[E]))E++;r.push({start:q0.start,end:E})}for(let q0=r.length-1;q0>=0;q0--){let{start:A0,end:J0}=r[q0];Q=Q.substring(0,A0)+Q.substring(J0)}}let p=e$(Q,Y);if(p.hasScoped)Q=p.html;let B0=Z.__stx_event_bindings||[],p0=!1,_1=[],q5=/\s:[a-z][\w.-]*\s*=/.test(Q),{scanScriptTags:W5}=await t("stx/signal-processing",()=>Promise.resolve().then(() => (H$(),A4)));for(let n of W5(Q,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))_1.push({match:n.fullMatch,attrs:n.attrs,content:n.body});for(let{match:n,attrs:r,content:q0}of _1){p0=!0;let A0=q0;S7(q0,Y,X.strict,Z.__originalFilePath);let J0=await Y$(q0,{eventBindings:B0,attrs:r,hasColonDirectives:q5,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:S});Q=Q.replace(n,()=>J0)}if(p0)Z.__stx_event_bindings=[];if(!p0&&Z.__stxProcessingDepth===1){let n=Z.__stx_event_bindings||[];if(n.length>0){let r=t7(n);if(r){let q0=Q.lastIndexOf("</body>");Q=q0===-1?Q+r:Q.slice(0,q0)+r+`
14612
+ `+Q.slice(q0)}Z.__stx_event_bindings=[]}}if(!D2(Q)&&E2(Q))Q=await L4(Q,G);if(G.csp?.enabled&&G.csp.useNonce&&typeof Z.cspNonce==="string")Q=fX(Q,Z.cspNonce);return Q}var G5="<!--PARENT_CONTENT_PLACEHOLDER-->";var D4=b(()=>{BX();A3();u1();c7();_X();VX();RX();o7();i7();e7();X$();EX();bX();z7();hX();uX();cX();sX();U1();W$();Y1();$J();QJ();rJ();$Q();T9();m3();QQ();V5();KQ();T6();R0();WQ();jQ();_Q();wQ();j3();C9();SQ();H$();N9();vQ();m9();d9();F0();s6();G3();r5();V4();V4();m9();d9()});import RF from"fs";import s9 from"path";import OK from"fs";import K1 from"path";var e9=[72,96,128,144,152,192,384,512],$8=[120,152,167,180],Z8=[16,32];async function Y8($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let J=K1.isAbsolute(X.src)?X.src:K1.resolve(process.cwd(),X.src);if(!await Bun.file(J).exists())return Y.errors.push(`Source icon not found: ${J}`),Y.success=!1,Y;let Q=K1.resolve(Z,X.outputDir||"pwa-icons");try{OK.mkdirSync(Q,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Q}`),Y.success=!1,Y}let G=X.sizes||e9,K=X.generateWebP??!0,q=X.generateAppleIcons??!0;try{let W;try{W=await import("sharp")}catch{return Y.errors.push(`sharp is not installed. Install it with: bun add sharp
14613
+ Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let U=await W.default(J).metadata();if(U.width&&U.width<512)Y.warnings.push(`Source icon is ${U.width}x${U.height}. Recommend using at least 512x512 for best quality.`);for(let O of G){let F=K1.join(Q,`icon-${O}x${O}.png`);if(await W.default(J).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let L=K1.join(Q,`icon-${O}x${O}.webp`);await W.default(J).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(L),Y.generatedFiles.push(L)}}if(q){for(let F of $8){let L=K1.join(Q,`apple-touch-icon-${F}x${F}.png`);await W.default(J).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}let O=K1.join(Q,"apple-touch-icon.png");await W.default(J).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}for(let O of Z8){let F=K1.join(Q,`favicon-${O}x${O}.png`);await W.default(J).resize(O,O,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let j=512,H=K1.join(Q,`icon-maskable-${j}x${j}.png`),B=Math.floor(j*0.1),_=j-B*2;await W.default(J).resize(_,_,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:B,bottom:B,left:B,right:B,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(H),Y.generatedFiles.push(H)}catch(W){let z=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${z}`),Y.success=!1}return Y}function TF($){let Z=$.sizes||e9,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,J=$.generateAppleIcons??!0,Q=[];for(let G of Z)if(Q.push(`${Y}/icon-${G}x${G}.png`),X)Q.push(`${Y}/icon-${G}x${G}.webp`);if(J){Q.push(`${Y}/apple-touch-icon.png`);for(let G of $8)Q.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of Z8)Q.push(`${Y}/favicon-${G}x${G}.png`);return Q.push(`${Y}/icon-maskable-512x512.png`),Q}async function X8(){try{return await import("sharp"),!0}catch{return!1}}d$();function fK($,Z,Y,X){let J=[],Q=X.join(" ");for(let G of $)if(J.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:Q}),Y)J.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:Q});return J}function gK($){return $.map((Z)=>({name:Z.name,short_name:Z.shortName,description:Z.description,url:Z.url,icons:Z.icons?.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}))}))}function hK($){let Z=$.pwa?.shareTarget;if(!Z?.enabled)return;let Y={action:Z.action||"/share",method:Z.method||"POST",enctype:Z.enctype||"multipart/form-data",params:{title:Z.params?.title||"title",text:Z.params?.text||"text",url:Z.params?.url||"url"}};if(Z.acceptFiles&&Z.acceptFiles.length>0)Y.params.files=Z.acceptFiles.map((X)=>({name:X.name,accept:X.accept}));return Y}function mK($){let Z=$.pwa?.fileHandlers;if(!Z?.enabled||!Z.accept)return;let Y=[{action:Z.action||"/",accept:Z.accept,launch_type:Z.launchType||"single-client"}];if(Z.icons)Y[0].icons=Z.icons.map((X)=>({src:X.src,sizes:X.sizes,type:X.type}));return Y}function dK($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function uK($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,J=X?.sizes||[72,96,128,144,152,192,384,512],Q=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:fK(J,Q,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=gK(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((j)=>({src:j.src,sizes:j.sizes,type:j.type,label:j.label,form_factor:j.platform}));let W=hK($);if(W)q.share_target=W;let z=mK($);if(z)q.file_handlers=z;let U=dK($);if(U)q.protocol_handlers=U;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function _8($){let Z=uK($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function vF($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function xF($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let J=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!J.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${J.join(", ")}`);let Q=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!Q.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import KK from"path";async function qK($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=KK.isAbsolute(Z.page)?Z.page:KK.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (D4(),GK)),J=await Bun.file(Y).text();return await X(J,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return FF($)}function FF($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",J=Z?.fallbackMessage||"Please check your internet connection and try again.",Q=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
14614
14614
  <html lang="en">
14615
14615
  <head>
14616
14616
  <meta charset="UTF-8">
@@ -14843,9 +14843,9 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
14843
14843
  }, 5000);
14844
14844
  </script>
14845
14845
  </body>
14846
- </html>`}function f7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}p5();l5();import K5 from"fs";import g7 from"path";function FF($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let J=Y.routes||[];return Z.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"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function LF($){let Z=[],Y=g7.join($,"manifest.json"),X=K5.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:X,message:X?"manifest.json exists":"manifest.json not found in build output"}),X)try{let z=JSON.parse(K5.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(z.icons)&&z.icons.length>0,message:z.icons?.length?`${z.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let J=g7.join($,"sw.js"),Q=K5.existsSync(J);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:Q,message:Q?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=g7.join($,"offline.html"),K=K5.existsSync(G);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=g7.join($,"pwa-icons");if(K5.existsSync(q)){let z=K5.readdirSync(q).filter((U)=>U.endsWith(".png")||U.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:z.length>0,message:z.length>0?`${z.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function VF($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),X=Z.filter((q)=>q.passed).length,J=Y.filter((q)=>q.passed).length,Q=Z.length>0?X/Z.length*70:70,G=Y.length>0?J/Y.length*30:30;return{score:Math.round(Q+G),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function LD($,Z){let Y=FF($),X=Z&&K5.existsSync(Z)?LF(Z):[];return VF([...Y,...X])}function VD($){let Z=[];Z.push(`
14846
+ </html>`}function f7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}p5();l5();import K5 from"fs";import g7 from"path";function LF($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let J=Y.routes||[];return Z.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"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function VF($){let Z=[],Y=g7.join($,"manifest.json"),X=K5.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:X,message:X?"manifest.json exists":"manifest.json not found in build output"}),X)try{let z=JSON.parse(K5.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(z.icons)&&z.icons.length>0,message:z.icons?.length?`${z.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let J=g7.join($,"sw.js"),Q=K5.existsSync(J);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:Q,message:Q?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=g7.join($,"offline.html"),K=K5.existsSync(G);Z.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:K,message:K?"Offline page exists":"No offline.html found"});let q=g7.join($,"pwa-icons");if(K5.existsSync(q)){let z=K5.readdirSync(q).filter((U)=>U.endsWith(".png")||U.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:z.length>0,message:z.length>0?`${z.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function wF($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),X=Z.filter((q)=>q.passed).length,J=Y.filter((q)=>q.passed).length,Q=Z.length>0?X/Z.length*70:70,G=Y.length>0?J/Y.length*30:30;return{score:Math.round(Q+G),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function VD($,Z){let Y=LF($),X=Z&&K5.existsSync(Z)?VF(Z):[];return wF([...Y,...X])}function wD($){let Z=[];Z.push(`
14847
14847
  === PWA Audit Report ===
14848
14848
  `);let Y=$.score>=90?"32":$.score>=70?"33":"31";Z.push(`Score: \x1B[${Y}m${$.score}/100\x1B[0m`),Z.push(`Passed: ${$.passed} | Failed: ${$.failed} | Warnings: ${$.warnings}
14849
14849
  `);let X=["required","recommended","optional"];for(let J of X){let Q=$.checks.filter((G)=>G.category===J);if(Q.length===0)continue;Z.push(`
14850
14850
  ${J.toUpperCase()}:`);for(let G of Q){let K=G.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(Z.push(` ${K} ${G.name}: ${G.message}`),G.details)Z.push(` ${G.details}`)}}return Z.push(""),Z.join(`
14851
- `)}V6();d$();p5();l5();async function kD($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{wF.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let Q=_8($);if(Q){let G=s9.join(Z,"manifest.json");await Bun.write(G,Q),Y.files.manifest=G}}catch(Q){let G=Q instanceof Error?Q.message:String(Q);Y.errors.push(`Failed to generate manifest.json: ${G}`),Y.success=!1}if(X.icons?.src)if(await X8()){let G=await Y8($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let Q=await KK($);if(Q){let G=s9.join(Z,"offline.html");await Bun.write(G,Q),Y.files.offlinePage=G}}catch(Q){let G=Q instanceof Error?Q.message:String(Q);Y.errors.push(`Failed to generate offline page: ${G}`),Y.success=!1}let J;if(X.precache?.enabled){let Q=f1(Z,$);J={fileCount:Q.fileCount,totalSize:Q.totalSize},Y.precacheStats=J}try{let Q=h$($,Z);if(Q){let G=U5($),K=s9.join(Z,G);await Bun.write(K,Q),Y.files.serviceWorker=K}}catch(Q){let G=Q instanceof Error?Q.message:String(Q);Y.errors.push(`Failed to generate service worker: ${G}`),Y.success=!1}return Y}function bD($,Z){return p7($,Z)}function SD($){return $.pwa?.enabled===!0}export{vF as validateManifest,LD as runPwaAudit,VR as registerPwaDirectives,rU as pwaUpdateDirective,tU as pwaPushDirective,aU as pwaOfflineDirective,sU as pwaInstallDirective,L6 as pwaDirectives,bD as processPwaHtml,CF as mergeManifestConfig,B8 as isWorkboxEnabled,X8 as isSharpAvailable,SD as isPwaEnabled,p7 as injectPwaTags,U5 as getServiceWorkerFileName,MF as getExpectedIconPaths,vK as generateThemeColorMeta,PK as generateSwRegistrationScript,yK as generateServiceWorkerAuto,h$ as generateServiceWorker,m$ as generatePwaTags,Y8 as generatePwaIcons,g$ as generatePrecacheManifestJs,f1 as generatePrecacheManifest,KK as generateOfflinePage,CK as generateManifestLink,_8 as generateManifestJson,dK as generateManifest,Q8 as formatSize,VD as formatAuditResult,VF as calculateAuditResult,kD as buildPwaAssets,FF as auditConfig,LF as auditBuildOutput,Z8 as FAVICON_SIZES,e9 as DEFAULT_ICON_SIZES,$8 as APPLE_TOUCH_ICON_SIZES};
14851
+ `)}V6();d$();p5();l5();async function bD($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{RF.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let Q=_8($);if(Q){let G=s9.join(Z,"manifest.json");await Bun.write(G,Q),Y.files.manifest=G}}catch(Q){let G=Q instanceof Error?Q.message:String(Q);Y.errors.push(`Failed to generate manifest.json: ${G}`),Y.success=!1}if(X.icons?.src)if(await X8()){let G=await Y8($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let Q=await qK($);if(Q){let G=s9.join(Z,"offline.html");await Bun.write(G,Q),Y.files.offlinePage=G}}catch(Q){let G=Q instanceof Error?Q.message:String(Q);Y.errors.push(`Failed to generate offline page: ${G}`),Y.success=!1}let J;if(X.precache?.enabled){let Q=f1(Z,$);J={fileCount:Q.fileCount,totalSize:Q.totalSize},Y.precacheStats=J}try{let Q=h$($,Z);if(Q){let G=U5($),K=s9.join(Z,G);await Bun.write(K,Q),Y.files.serviceWorker=K}}catch(Q){let G=Q instanceof Error?Q.message:String(Q);Y.errors.push(`Failed to generate service worker: ${G}`),Y.success=!1}return Y}function SD($,Z){return p7($,Z)}function yD($){return $.pwa?.enabled===!0}export{xF as validateManifest,VD as runPwaAudit,wR as registerPwaDirectives,aU as pwaUpdateDirective,eU as pwaPushDirective,tU as pwaOfflineDirective,rU as pwaInstallDirective,L6 as pwaDirectives,SD as processPwaHtml,vF as mergeManifestConfig,B8 as isWorkboxEnabled,X8 as isSharpAvailable,yD as isPwaEnabled,p7 as injectPwaTags,U5 as getServiceWorkerFileName,TF as getExpectedIconPaths,xK as generateThemeColorMeta,CK as generateSwRegistrationScript,PK as generateServiceWorkerAuto,h$ as generateServiceWorker,m$ as generatePwaTags,Y8 as generatePwaIcons,g$ as generatePrecacheManifestJs,f1 as generatePrecacheManifest,qK as generateOfflinePage,vK as generateManifestLink,_8 as generateManifestJson,uK as generateManifest,Q8 as formatSize,wD as formatAuditResult,wF as calculateAuditResult,bD as buildPwaAssets,LF as auditConfig,VF as auditBuildOutput,Z8 as FAVICON_SIZES,e9 as DEFAULT_ICON_SIZES,$8 as APPLE_TOUCH_ICON_SIZES};