@stacksjs/stx 0.2.120 → 0.2.121

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:K7,getOwnPropertyNames:rJ,getOwnPropertyDescriptor:aJ}=Object,tJ=Object.prototype.hasOwnProperty;function eJ($){return this[$]}var s6=($)=>{var Z=(o6??=new WeakMap).get($),Y;if(Z)return Z;if(Z=K7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of rJ($))if(!tJ.call(Z,X))K7(Z,X,{get:eJ.bind($,X),enumerable:!(Y=aJ($,X))||Y.enumerable})}return o6.set($,Z),Z},o6;var $Q=($)=>$;function ZQ($,Z){this[$]=$Q.bind(null,Z)}var r=($,Z)=>{for(var Y in Z)K7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:ZQ.bind(Z,Y)})};var k=($,Z)=>()=>($&&(Z=$($=0)),Z);var q0=import.meta.require;import j$ from"fs";import _$ from"path";function JQ($){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 QQ($,Z){let Y=_$.basename($);for(let X of Z)if(X.startsWith("*.")){let Q=X.slice(1);if(Y.endsWith(Q))return!0}else if(X.includes("*")){let Q=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(Q.test(Y)||Q.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function GQ($,Z,Y){let X=_$.extname($).toLowerCase(),Q=XQ[X],J=(Y.maxFileSizeKB||500)*1024;if(Z>J)return!1;if(Y.exclude&&QQ($,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(Q&&Y[Q]===!0)return!0;if(!Q)return!1;return!1}function Z9($,Z,Y,X){let Q=j$.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=_$.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;Z9(G,Z,Y,X)}else if(J.isFile()){let K=j$.statSync(G),q=_$.relative(Z,G);if(GQ(q,K.size,Y)){let W=j$.readFileSync(G),U=JQ(W),z=`/${q.replace(/\\/g,"/")}`;X.push({url:z,revision:U,size:K.size})}}}}function T1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!j$.existsSync($))return{entries:[],totalSize:0,fileCount:0};Z9($,$,Y,X),X.sort((J,G)=>J.url.localeCompare(G.url));let Q=X.reduce((J,G)=>J+G.size,0);return{entries:X,totalSize:Q,fileCount:X.length}}function H$($){if($.entries.length===0)return"[]";return`[
2
+ var{defineProperty:K7,getOwnPropertyNames:tJ,getOwnPropertyDescriptor:eJ}=Object,$Q=Object.prototype.hasOwnProperty;function ZQ($){return this[$]}var s6=($)=>{var Z=(o6??=new WeakMap).get($),Y;if(Z)return Z;if(Z=K7({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var X of tJ($))if(!$Q.call(Z,X))K7(Z,X,{get:ZQ.bind($,X),enumerable:!(Y=eJ($,X))||Y.enumerable})}return o6.set($,Z),Z},o6;var YQ=($)=>$;function XQ($,Z){this[$]=YQ.bind(null,Z)}var r=($,Z)=>{for(var Y in Z)K7($,Y,{get:Z[Y],enumerable:!0,configurable:!0,set:XQ.bind(Z,Y)})};var k=($,Z)=>()=>($&&(Z=$($=0)),Z);var q0=import.meta.require;import j$ from"fs";import _$ from"path";function GQ($){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 KQ($,Z){let Y=_$.basename($);for(let X of Z)if(X.startsWith("*.")){let Q=X.slice(1);if(Y.endsWith(Q))return!0}else if(X.includes("*")){let Q=new RegExp(`^${X.replace(/\*/g,".*")}$`);if(Q.test(Y)||Q.test($))return!0}else if(Y===X||$.includes(X))return!0;return!1}function qQ($,Z,Y){let X=_$.extname($).toLowerCase(),Q=QQ[X],J=(Y.maxFileSizeKB||500)*1024;if(Z>J)return!1;if(Y.exclude&&KQ($,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(Q&&Y[Q]===!0)return!0;if(!Q)return!1;return!1}function Z9($,Z,Y,X){let Q=j$.readdirSync($,{withFileTypes:!0});for(let J of Q){let G=_$.join($,J.name);if(J.isDirectory()){if(["node_modules",".git",".stx"].includes(J.name))continue;Z9(G,Z,Y,X)}else if(J.isFile()){let K=j$.statSync(G),q=_$.relative(Z,G);if(qQ(q,K.size,Y)){let W=j$.readFileSync(G),z=GQ(W),U=`/${q.replace(/\\/g,"/")}`;X.push({url:U,revision:z,size:K.size})}}}}function T1($,Z){let Y=Z.pwa?.precache,X=[];if(!Y?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!j$.existsSync($))return{entries:[],totalSize:0,fileCount:0};Z9($,$,Y,X),X.sort((J,G)=>J.url.localeCompare(G.url));let Q=X.reduce((J,G)=>J+G.size,0);return{entries:X,totalSize:Q,fileCount:X.length}}function H$($){if($.entries.length===0)return"[]";return`[
3
3
  ${$.entries.map((Y)=>` { url: '${Y.url}', revision: '${Y.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function Y9($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var XQ;var w5=k(()=>{XQ={".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 KQ($){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 q7($){return KQ($).className}function X9($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,Q=[];for(let J of Y){let G=q7(J.strategy),K=[];if(J.maxAgeSeconds||J.maxEntries||X?.maxEntries){let W=J.maxEntries||X?.maxEntries||100,U=J.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
5
+ ]`}function Y9($){if($<1024)return`${$} B`;if($<1048576)return`${($/1024).toFixed(1)} KB`;return`${($/1048576).toFixed(2)} MB`}var QQ;var w5=k(()=>{QQ={".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 WQ($){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 q7($){return WQ($).className}function X9($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.routes||[],X=Z.cacheStorage,Q=[];for(let J of Y){let G=q7(J.strategy),K=[];if(J.maxAgeSeconds||J.maxEntries||X?.maxEntries){let W=J.maxEntries||X?.maxEntries||100,z=J.maxAgeSeconds||(X?.maxAge?X.maxAge*24*60*60:void 0);K.push(`new ExpirationPlugin({
6
6
  maxEntries: ${W},
7
- ${U?`maxAgeSeconds: ${U},`:""}
7
+ ${z?`maxAgeSeconds: ${z},`:""}
8
8
  purgeOnQuotaError: true,
9
9
  })`)}if(J.strategy==="network-first"||J.strategy==="stale-while-revalidate")K.push(`new CacheableResponsePlugin({
10
10
  statuses: [0, 200],
11
- })`);let q=qQ(J.pattern);Q.push(`
11
+ })`);let q=zQ(J.pattern);Q.push(`
12
12
  // ${J.pattern}
13
13
  registerRoute(
14
14
  ${q},
15
15
  new ${G}({
16
- cacheName: '${J.cacheName||UQ(J.pattern)}',
16
+ cacheName: '${J.cacheName||BQ(J.pattern)}',
17
17
  ${K.length>0?`plugins: [
18
18
  ${K.join(`,
19
19
  `)}
20
20
  ],`:""}
21
21
  })
22
22
  );`)}return Q.join(`
23
- `)}function qQ($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${WQ(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('${zQ($).replace(/\\\*/g,".*")}')`}function WQ($){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 UQ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function zQ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var K9={};r(K9,{isWorkboxEnabled:()=>G9,getServiceWorkerGenerator:()=>OQ,generateWorkboxServiceWorker:()=>Q9,generateWorkboxConfig:()=>J9});function J9($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Y.serviceWorker||{},Q=Y.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let W of Q)G.add(q7(W.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((W)=>W.maxAgeSeconds||W.maxEntries)||Y.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((W)=>W.strategy==="network-first"||W.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?T1(Z,$):void 0;return{mode:"generate",modules:J,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 Q9($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=J9($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?T1(Z,$):null,q=K?H$(K):"[]",W=BQ(X.modules),U=X9($);return`/**
23
+ `)}function zQ($){if($.startsWith("*.")){let Z=$.slice(2);return`({ request }) => request.destination === '${UQ(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('${jQ($).replace(/\\\*/g,".*")}')`}function UQ($){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 BQ($){return"stx-"+$.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function jQ($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var K9={};r(K9,{isWorkboxEnabled:()=>G9,getServiceWorkerGenerator:()=>FQ,generateWorkboxServiceWorker:()=>Q9,generateWorkboxConfig:()=>J9});function J9($,Z){let Y=$.pwa;if(!Y?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let X=Y.serviceWorker||{},Q=Y.routes||[],J=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],G=new Set;for(let W of Q)G.add(q7(W.strategy));if(G.size>0)J.push({name:"workbox-strategies",exports:Array.from(G)});if(Q.some((W)=>W.maxAgeSeconds||W.maxEntries)||Y.cacheStorage)J.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(Q.some((W)=>W.strategy==="network-first"||W.strategy==="stale-while-revalidate"))J.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Y.backgroundSync?.enabled)J.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(X.navigationPreload)J.push({name:"workbox-navigation-preload",exports:["enable"]});let q=Z?T1(Z,$):void 0;return{mode:"generate",modules:J,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 Q9($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=J9($,Z),Q=Y.serviceWorker||{},J=Y.push,G=Y.backgroundSync,K=Z?T1(Z,$):null,q=K?H$(K):"[]",W=_Q(X.modules),z=X9($);return`/**
24
24
  * Service Worker - Generated by stx with Workbox
25
25
  * Cache Version: ${X.cacheVersion}
26
26
  *
@@ -79,7 +79,7 @@ enable();`:"// Navigation preload disabled"}
79
79
  // Runtime Caching
80
80
  // ============================================================================
81
81
 
82
- ${U}
82
+ ${z}
83
83
 
84
84
  // ============================================================================
85
85
  // Offline Fallback
@@ -169,13 +169,13 @@ self.addEventListener('message', (event) => {
169
169
  }
170
170
  });
171
171
 
172
- ${J?.enabled?_Q(J):"// Push notifications disabled"}
172
+ ${J?.enabled?OQ(J):"// Push notifications disabled"}
173
173
 
174
- ${G?.enabled?HQ(G):"// Background sync disabled"}
174
+ ${G?.enabled?LQ(G):"// Background sync disabled"}
175
175
 
176
176
  console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
177
- `}function BQ($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${jQ(X)};`)}return Z.join(`
178
- `)}function jQ($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function _Q($){return`
177
+ `}function _Q($){let Z=[];for(let Y of $){let X=Y.name.replace("workbox-","");Z.push(`const { ${Y.exports.join(", ")} } = workbox.${HQ(X)};`)}return Z.join(`
178
+ `)}function HQ($){return $.replace(/-([a-z])/g,(Z,Y)=>Y.toUpperCase())}function OQ($){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 HQ($){return`
247
+ `}function LQ($){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 G9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function OQ($){if(G9($))return Q9;let{generateServiceWorker:Z}=(N5(),s6(W9));return Z}var q9=k(()=>{w5()});var W9={};r(W9,{isWorkboxEnabled:()=>U9,getServiceWorkerFileName:()=>i1,generateServiceWorkerAuto:()=>VQ,generateServiceWorker:()=>O$});function O$($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Y.serviceWorker||{},Q=Y.routes||[],J=X.cacheVersion||"1.0.0",G=Y.offline,K=G?.page?"/offline.html":"/offline.html",q=Y.push,W=Y.backgroundSync,U=Y.cacheStorage,z=Z?T1(Z,$):null,B=z?H$(z):"[]",_=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
309
+ `}function G9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function FQ($){if(G9($))return Q9;let{generateServiceWorker:Z}=(N5(),s6(W9));return Z}var q9=k(()=>{w5()});var W9={};r(W9,{isWorkboxEnabled:()=>z9,getServiceWorkerFileName:()=>i1,generateServiceWorkerAuto:()=>AQ,generateServiceWorker:()=>O$});function O$($,Z){let Y=$.pwa;if(!Y?.enabled)return"";let X=Y.serviceWorker||{},Q=Y.routes||[],J=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?T1(Z,$):null,B=U?H$(U):"[]",_=["/","/manifest.json",...G?.enabled?[K]:[],...G?.precacheAssets||[]];return`/**
310
310
  * Service Worker - Auto-generated by stx
311
311
  * Cache Version: ${J}
312
312
  *
@@ -320,7 +320,7 @@ self.addEventListener('message', (event) => {
320
320
  * Additional features:
321
321
  * - Push notifications: ${q?.enabled?"enabled":"disabled"}
322
322
  * - Background sync: ${W?.enabled?"enabled":"disabled"}
323
- * - Cache limits: ${U?.maxSize?`${Y9(U.maxSize*1024*1024)}`:"unlimited"}
323
+ * - Cache limits: ${z?.maxSize?`${Y9(z.maxSize*1024*1024)}`:"unlimited"}
324
324
  */
325
325
 
326
326
  const CACHE_VERSION = '${J}';
@@ -341,10 +341,10 @@ const EXCLUDED_ROUTES = ${JSON.stringify(X.excludeRoutes||[],null,2)};
341
341
 
342
342
  // Cache storage configuration
343
343
  const CACHE_CONFIG = {
344
- maxSize: ${U?.maxSize||0} * 1024 * 1024, // Convert MB to bytes
345
- maxAge: ${U?.maxAge||0} * 24 * 60 * 60 * 1000, // Convert days to ms
346
- maxEntries: ${U?.maxEntries||0},
347
- purgeStrategy: '${U?.purgeStrategy||"lru"}',
344
+ maxSize: ${z?.maxSize||0} * 1024 * 1024, // Convert MB to bytes
345
+ maxAge: ${z?.maxAge||0} * 24 * 60 * 60 * 1000, // Convert days to ms
346
+ maxEntries: ${z?.maxEntries||0},
347
+ purgeStrategy: '${z?.purgeStrategy||"lru"}',
348
348
  };
349
349
 
350
350
  // Background sync configuration
@@ -501,9 +501,9 @@ self.addEventListener('message', (event) => {
501
501
  }
502
502
  });
503
503
 
504
- ${q?.enabled?LQ():"// Push notifications disabled"}
504
+ ${q?.enabled?VQ():"// Push notifications disabled"}
505
505
 
506
- ${W?.enabled?FQ():"// Background sync disabled"}
506
+ ${W?.enabled?RQ():"// 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 LQ(){return`
871
+ `}function VQ(){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 FQ(){return`
953
+ `}function RQ(){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 i1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function U9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function VQ($,Z){if(!$.pwa?.enabled)return"";if(U9($)){let{generateWorkboxServiceWorker:Y}=(q9(),s6(K9));return Y($,Z)}return O$($,Z)}var N5=k(()=>{w5()});var z9={};r(z9,{injectPwaTags:()=>U7,generateThemeColorMeta:()=>wQ,generateSwRegistrationScript:()=>RQ,generatePwaTags:()=>L$,generateManifestLink:()=>AQ});function L$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=i1($),J=`
1135
+ `}function i1($){return $.pwa?.serviceWorker?.fileName||"sw.js"}function z9($){return $.pwa?.enabled===!0&&$.pwa?.serviceWorker?.useWorkbox===!0}function AQ($,Z){if(!$.pwa?.enabled)return"";if(z9($)){let{generateWorkboxServiceWorker:Y}=(q9(),s6(K9));return Y($,Z)}return O$($,Z)}var N5=k(()=>{w5()});var U9={};r(U9,{injectPwaTags:()=>z7,generateThemeColorMeta:()=>TQ,generateSwRegistrationScript:()=>wQ,generatePwaTags:()=>L$,generateManifestLink:()=>NQ});function L$($){let Z=$.pwa;if(!Z?.enabled)return"";let Y=Z.manifest,X=Z.icons?.outputDir?`/${Z.icons.outputDir}`:"/pwa-icons",Q=i1($),J=`
1136
1136
  <!-- stx PWA Meta Tags -->
1137
1137
  <link rel="manifest" href="/manifest.json">
1138
1138
  <meta name="theme-color" content="${W7(Y?.themeColor||"#000000")}">
@@ -1176,9 +1176,9 @@ if ('serviceWorker' in navigator) {
1176
1176
  });
1177
1177
  }
1178
1178
  </script>
1179
- <!-- End stx PWA -->`,J}function U7($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let J=L$(Z);return $.slice(0,Q)+J+`
1179
+ <!-- End stx PWA -->`,J}function z7($,Z){let Y=Z.pwa;if(!Y?.enabled||Y.autoInject===!1)return $;if($.includes("<!-- stx PWA Meta Tags -->"))return $;if(!$.includes("</head>")){let Q=$.lastIndexOf("</body>");if(Q!==-1){let J=L$(Z);return $.slice(0,Q)+J+`
1180
1180
  `+$.slice(Q)}return $+L$(Z)}let X=L$(Z);return $.replace("</head>",`${X}
1181
- </head>`)}function RQ($){if(!$.pwa?.enabled)return"";return`<script>
1181
+ </head>`)}function wQ($){if(!$.pwa?.enabled)return"";return`<script>
1182
1182
  if ('serviceWorker' in navigator) {
1183
1183
  window.addEventListener('load', function() {
1184
1184
  navigator.serviceWorker.register('/${i1($)}')
@@ -1190,7 +1190,7 @@ if ('serviceWorker' in navigator) {
1190
1190
  });
1191
1191
  });
1192
1192
  }
1193
- </script>`}function AQ(){return'<link rel="manifest" href="/manifest.json">'}function wQ($){return`<meta name="theme-color" content="${W7($)}">`}function W7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var F$=k(()=>{N5()});import T5 from"path";function _9($){j9=$?.trim()||null}function M5(){return process.env[kQ]?.trim()||j9||n1}function I5($=process.cwd(),...Z){let Y=M5();return T5.isAbsolute(Y)?T5.join(Y,...Z):T5.join($,Y,...Z)}function D5($){if(!$||T5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==n1&&!Z.startsWith(`${n1}/`))return $;let Y=Z.slice(n1.length+1);return Y?T5.join(M5(),Y):M5()}var n1=".stx",kQ="STX_DIR",j9=null;var V$=()=>{};var H0;var H9=k(()=>{H0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function O9($,Z,Y,X){let Q=$;Q=Q.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(G,K,q)=>{let U={"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||U} -->`});let J=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(J,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var L9,F9;var z7=k(()=>{L9={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),J=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"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${J||K} -->${$}`},hasEndTag:!1},F9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function bQ($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...X1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${J==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="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 NQ(){return'<link rel="manifest" href="/manifest.json">'}function TQ($){return`<meta name="theme-color" content="${W7($)}">`}function W7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var F$=k(()=>{N5()});import T5 from"path";function _9($){j9=$?.trim()||null}function M5(){return process.env[SQ]?.trim()||j9||n1}function I5($=process.cwd(),...Z){let Y=M5();return T5.isAbsolute(Y)?T5.join(Y,...Z):T5.join($,Y,...Z)}function D5($){if(!$||T5.isAbsolute($))return $;let Z=$.replace(/\\/g,"/");if(Z!==n1&&!Z.startsWith(`${n1}/`))return $;let Y=Z.slice(n1.length+1);return Y?T5.join(M5(),Y):M5()}var n1=".stx",SQ="STX_DIR",j9=null;var V$=()=>{};var H0;var H9=k(()=>{H0={reset:"\x1B[0m",bright:"\x1B[1m",dim:"\x1B[2m",underscore:"\x1B[4m",blink:"\x1B[5m",reverse:"\x1B[7m",hidden:"\x1B[8m",black:"\x1B[30m",red:"\x1B[31m",green:"\x1B[32m",yellow:"\x1B[33m",blue:"\x1B[34m",magenta:"\x1B[35m",cyan:"\x1B[36m",white:"\x1B[37m",gray:"\x1B[90m",bgBlack:"\x1B[40m",bgRed:"\x1B[41m",bgGreen:"\x1B[42m",bgYellow:"\x1B[43m",bgBlue:"\x1B[44m",bgMagenta:"\x1B[45m",bgCyan:"\x1B[46m",bgWhite:"\x1B[47m",bgGray:"\x1B[100m"}});function O9($,Z,Y,X){let Q=$;Q=Q.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 J=/@screenReader\(([^@]*)\)@endScreenReader/g;return Q=Q.replace(J,(G,K)=>{return`<span class="sr-only">${K.trim()}</span>`}),Q=Q.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(G,K,q)=>{return`<span id="${`desc-${K}`}" class="sr-only">${q}</span>`}),Q}var L9,F9;var U7=k(()=>{L9={name:"a11y",handler:($,Z,Y,X)=>{if(!Z.length)return $;let Q=Z[0].replace(/['"]/g,""),J=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"}[Q]||"Make this element accessible";return`<!-- a11y-hint: ${J||K} -->${$}`},hasEndTag:!1},F9={name:"screenReader",handler:($)=>{return`<span class="sr-only">${$}</span>`},hasEndTag:!0}});function yQ($,Z={}){let{duration:Y,delay:X,ease:Q,direction:J,custom:G}={...X1,...Z};if($==="custom"&&G)return G;switch($){case"fade":return`${J==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="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`${J==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="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`${J==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":J==="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 SQ(){return`
1203
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function PQ(){return`
1204
1204
  <script data-stx-scoped>
1205
1205
  // Motion preferences handling
1206
1206
  (function() {
@@ -1228,7 +1228,7 @@ else {
1228
1228
  });
1229
1229
  })();
1230
1230
  </script>
1231
- `}function yQ($){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 PQ($=0.1,Z="0px"){return`
1231
+ `}function CQ($){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 vQ($=0.1,Z="0px"){return`
1232
1232
  <script data-stx-scoped>
1233
1233
  // Intersection Observer for scroll animations
1234
1234
  (function() {
@@ -1271,7 +1271,7 @@ else {
1271
1271
  }
1272
1272
  })();
1273
1273
  </script>
1274
- `}function CQ(){return`
1274
+ `}function xQ(){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 vQ($,Z,Y={}){let{staggerDelay:X=50,sequence:Q=!1}=Y;return`
1389
+ `}function fQ($,Z,Y={}){let{staggerDelay:X=50,sequence:Q=!1}=Y;return`
1390
1390
  <script data-stx-scoped>
1391
1391
  // Animation Group: ${$}
1392
1392
  (function() {
@@ -1423,11 +1423,11 @@ else {
1423
1423
  }
1424
1424
  })();
1425
1425
  </script>
1426
- `}function N9($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!yQ(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=CQ();Q=Q.replace("</head>",`${K}
1427
- </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=PQ(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
1428
- `+Q.slice(W)}}return Q}var X1,V9,R9,A9,w9;var B7=k(()=>{X1={duration:300,delay:0,ease:"ease",direction:"both"};V9={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 Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||X1.duration:X1.duration,G=Z.length>2?Z[2]||X1.ease:X1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||X1.delay:X1.delay,q=Z.length>4?Z[4]||X1.direction:X1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=bQ(Q,{duration:J,delay:K,ease:G,direction:q}),z="stx-transition",B="";if(Q==="fade")B="stx-fade";else if(Q==="slide")B="stx-slide";else if(Q==="scale")B="stx-scale";else if(Q==="flip")B="stx-flip";else if(Q==="rotate")B="stx-rotate";return`<div id="${W}" class="${z} ${B} ${q==="out"?"stx-out":""}"
1429
- style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},R9={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 Q=Z[0],J=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)}`,U=`--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(Q==="fade")z+=" stx-fade";else if(Q==="slide-up"||Q==="slide")z+=" stx-from-bottom";else if(Q==="slide-down")z+=" stx-from-top";else if(Q==="slide-left")z+=" stx-from-right";else if(Q==="slide-right")z+=" stx-from-left";else if(Q==="scale")z+=" stx-scale";else if(Q.includes("-"))z+=` stx-${Q}`;else z+=` stx-${Q}`;return`<div id="${W}" class="${z}" style="${U}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},A9={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 Q=Z[0],J=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=vQ(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
- ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},w9={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=SQ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as T9}from"stx-router";var M9=k(()=>{j7()});async function xQ($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=T9();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var I9;var j7=k(()=>{M9();I9={name:"stxRouter",handler:xQ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function D9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...fQ,...Z};return`
1426
+ `}function N9($,Z,Y,X){let Q=$;if(X.animation?.enabled===!1)return Q;let J=Y.includes("test")&&Y.includes("animation");if(!CQ(Q)&&!J)return Q;if(!Q.includes('<style id="stx-animation-base">')){let K=xQ();Q=Q.replace("</head>",`${K}
1427
+ </head>`)}if(Q.includes("stx-observe")){if(!Q.includes("Intersection Observer for scroll animations")){let q=vQ(),W=Q.lastIndexOf("</body>");if(W!==-1)Q=Q.slice(0,W)+q+`
1428
+ `+Q.slice(W)}}return Q}var X1,V9,R9,A9,w9;var B7=k(()=>{X1={duration:300,delay:0,ease:"ease",direction:"both"};V9={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 Q=Z[0],J=Z.length>1?Number.parseInt(Z[1],10)||X1.duration:X1.duration,G=Z.length>2?Z[2]||X1.ease:X1.ease,K=Z.length>3?Number.parseInt(Z[3],10)||X1.delay:X1.delay,q=Z.length>4?Z[4]||X1.direction:X1.direction,W=`stx-transition-${Math.random().toString(36).substr(2,9)}`,z=yQ(Q,{duration:J,delay:K,ease:G,direction:q}),U="stx-transition",B="";if(Q==="fade")B="stx-fade";else if(Q==="slide")B="stx-slide";else if(Q==="scale")B="stx-scale";else if(Q==="flip")B="stx-flip";else if(Q==="rotate")B="stx-rotate";return`<div id="${W}" class="${U} ${B} ${q==="out"?"stx-out":""}"
1429
+ style="--stx-transition-duration: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${K}ms;">${$}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},R9={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 Q=Z[0],J=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: ${J}ms; --stx-transition-ease: ${G}; --stx-transition-delay: ${q}ms; will-change: opacity, transform;`,U="stx-transition stx-observe stx-out";if(Q==="fade")U+=" stx-fade";else if(Q==="slide-up"||Q==="slide")U+=" stx-from-bottom";else if(Q==="slide-down")U+=" stx-from-top";else if(Q==="slide-left")U+=" stx-from-right";else if(Q==="slide-right")U+=" stx-from-left";else if(Q==="scale")U+=" stx-scale";else if(Q.includes("-"))U+=` stx-${Q}`;else U+=` stx-${Q}`;return`<div id="${W}" class="${U}" style="${z}" data-threshold="${K}">${$}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},A9={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 Q=Z[0],J=Z.slice(1).map((W)=>W.startsWith("#")||W.startsWith(".")?W:`#${W}`),G=Y.staggerDelay||50,K=Y.sequence||!0,q=fQ(Q,J,{staggerDelay:G,sequence:K});return`${$}
1430
+ ${q}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},w9={name:"motion",handler:($,Z,Y,X)=>{let Q=Z.length>0?Z[0].toLowerCase()==="true":!0,J=PQ();return`<div data-animate="${Q?"auto":"true"}">${$}</div>${J}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});import{getRouterScript as T9}from"stx-router";var M9=k(()=>{j7()});async function gQ($,Z,Y,X){let Q=Z[0]?.replace(/['"]/g,"")||"main",J=T9();if(Q!=="main")J=J.replace("container:'main'",`container:'${Q}'`);return`<script data-stx-router>${J}</script>`}var I9;var j7=k(()=>{M9();I9={name:"stxRouter",handler:gQ,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function D9($){let Z=$.heatmap;if(!Z?.enabled)return"";let Y={...hQ,...Z};return`
1431
1431
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
1432
1432
  <script>
1433
1433
  (function() {
@@ -1810,9 +1810,9 @@ else {
1810
1810
  };
1811
1811
  })();
1812
1812
  </script>
1813
- `}function E9($,Z){let Y=D9(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function gQ($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){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 fQ,k9;var _7=k(()=>{fQ={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};k9={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let Q=Y.__stx_config||{};if(Z.length>0){let J=gQ(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return D9(Q)}}});function q1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function b9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function S9($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],Q=$.slice(Y[0].length),J={};for(let G of X.split(`
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(),U=K.slice(q+1).trim();if(typeof U==="string"){if(U.startsWith('"')&&U.endsWith('"')||U.startsWith("'")&&U.endsWith("'"))U=U.slice(1,-1);else if(U.startsWith("[")&&U.endsWith("]"))try{U=JSON.parse(U)}catch{}else if(U==="true")U=!0;else if(U==="false")U=!1;else if(/^-?\d+(?:\.\d+)?$/.test(U))U=Number(U)}J[W]=U}return{data:J,content:Q.trim()}}function E5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,B)=>{let _=J.length,j=z?` class="language-${q1(z)}"`:"";return J.push(`<pre><code${j}>${q1(B.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),Q=Q.replace(/`([^`]*)`/g,(U,z)=>`<code>${q1(z)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,z,B)=>{return`<img src="${b9(B)?q1(B):""}" alt="${q1(z)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,B)=>{return`<a href="${b9(B)?q1(B):""}">${z}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
1815
- `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,z,B)=>{let j=`<tr>${z.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${q1(L)}</th>`).join("")}</tr>`,H=B.trim().split(`
1813
+ `}function E9($,Z){let Y=D9(Z);if(!Y)return $;let X=$.lastIndexOf("</body>");if(X!==-1)return $.slice(0,X)+Y+$.slice(X);return $+Y}function dQ($){let Z={},Y=$.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let X of Y){let[Q,J]=X.split("="),G=J?.replace(/["']/g,"");switch(Q){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 hQ,k9;var _7=k(()=>{hQ={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};k9={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async($,Z,Y,X)=>{let Q=Y.__stx_config||{};if(Z.length>0){let J=dQ(Z.join(" "));Q.heatmap={...Q.heatmap,...J,enabled:!0}}return D9(Q)}}});function q1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function b9($){let Z=$.trim().toLowerCase();return!Z.startsWith("javascript:")&&!Z.startsWith("vbscript:")&&!Z.startsWith("data:text/html")}function S9($){let Z=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Y=$.match(Z);if(!Y)return{data:{},content:$.trim()};let X=Y[1],Q=$.slice(Y[0].length),J={};for(let G of X.split(`
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)}J[W]=z}return{data:J,content:Q.trim()}}function E5($,Z={}){let{gfm:Y=!0,breaks:X=!1}=Z,Q=$,J=[];if(Q=Q.replace(/```(\w*)\n([\s\S]*?)```/g,(z,U,B)=>{let _=J.length,j=U?` class="language-${q1(U)}"`:"";return J.push(`<pre><code${j}>${q1(B.trim())}</code></pre>`),`\x00CODEBLOCK${_}\x00`}),Q=Q.replace(/`([^`]*)`/g,(z,U)=>`<code>${q1(U)}</code>`),Q=Q.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),Q=Q.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),Q=Q.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),Q=Q.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),Q=Q.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),Q=Q.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),Q=Q.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),Q=Q.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),Q=Q.replace(/__(.+?)__/g,"<strong>$1</strong>"),Q=Q.replace(/\*(.+?)\*/g,"<em>$1</em>"),Q=Q.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Y)Q=Q.replace(/~~(.+?)~~/g,"<del>$1</del>");if(Q=Q.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(z,U,B)=>{return`<img src="${b9(B)?q1(B):""}" alt="${q1(U)}" />`}),Q=Q.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(z,U,B)=>{return`<a href="${b9(B)?q1(B):""}">${U}</a>`}),Q=Q.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),Q=Q.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),Q=Q.replace(/<\/blockquote>\n<blockquote>/g,`
1815
+ `),Q=Q.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),Q=Q.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),Q=Q.replace(/<\/ul>\n<ul>/g,""),Q=Q.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),Q=Q.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),Q=Q.replace(/<\/ol>\n<ol>/g,""),Q=Q.replace(/<li data-ul>/g,"<li>"),Q=Q.replace(/<li data-ol>/g,"<li>"),Y)Q=Q.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(z,U,B)=>{let j=`<tr>${U.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<th>${q1(L)}</th>`).join("")}</tr>`,H=B.trim().split(`
1816
1816
  `).map((L)=>{return`<tr>${L.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${q1(O)}</td>`).join("")}</tr>`}).join(`
1817
1817
  `);return`<table>
1818
1818
  <thead>
@@ -1822,16 +1822,16 @@ ${j}
1822
1822
  ${H}
1823
1823
  </tbody>
1824
1824
  </table>`});if(Y)Q=Q.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),Q=Q.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let G=Q.split(`
1825
- `),K=[],q=!1,W=[];for(let U of G){let z=U.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(z)||/^\0CODEBLOCK\d+\0$/.test(z)||z===""){if(q&&W.length>0)K.push(`<p>${W.join(X?`<br />
1825
+ `),K=[],q=!1,W=[];for(let z of G){let U=z.trim();if(/^<(?:h[1-6]|ul|ol|li|blockquote|pre|table|thead|tbody|tr|th|td|hr|div|p)/.test(U)||/^\0CODEBLOCK\d+\0$/.test(U)||U===""){if(q&&W.length>0)K.push(`<p>${W.join(X?`<br />
1826
1826
  `:`
1827
- `)}</p>`),W=[],q=!1;K.push(U)}else q=!0,W.push(z)}if(q&&W.length>0)K.push(`<p>${W.join(X?`<br />
1827
+ `)}</p>`),W=[],q=!1;K.push(z)}else q=!0,W.push(U)}if(q&&W.length>0)K.push(`<p>${W.join(X?`<br />
1828
1828
  `:`
1829
1829
  `)}</p>`);if(Q=K.join(`
1830
1830
  `),X)Q=Q.replace(/\n/g,`<br />
1831
- `);for(let U=0;U<J.length;U++)Q=Q.replace(`\x00CODEBLOCK${U}\x00`,J[U]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function c0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1831
+ `);for(let z=0;z<J.length;z++)Q=Q.replace(`\x00CODEBLOCK${z}\x00`,J[z]);return Q=Q.replace(/<p>\s*<\/p>/g,""),Q.trim()}function c0($){let Z=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;$=$.replace(Z,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
1832
1832
  `});let Y=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return $=$.replace(Y,(X,Q)=>{return`const { ${Q.split(",").map((G)=>G.trim()).filter(Boolean).join(", ")} } = window.__composables
1833
- `}),$}import hQ from"process";function d0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(hQ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var M1=()=>{};var k5={};r(k5,{hasUserImports:()=>mQ,bundleClientScript:()=>lQ});import j0 from"path";import P0 from"fs";function mQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!y9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!y9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected side-effect import:",Q),!0}return!1}function uQ($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let U of W)try{if(P0.existsSync(U)&&P0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(P0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=j0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,j0.join(K,"index.ts"),j0.join(K,"index.tsx"),j0.join(K,"index.js"),j0.join(K,"index.mjs")];for(let W of q)if(P0.existsSync(W)&&P0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}})}}}async function lQ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||I5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${dQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=j0.join(J,`${K}.js`),W=j0.join(J,`${K}.deps.json`),U=Bun.file(q);if(await U.exists()){let _=Bun.file(W),j=!0;if(await _.exists())try{let H=JSON.parse(await _.text());if(H.metadataVersion!==P9||!Array.isArray(H.files))j=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(P0.statSync(L.path).mtimeMs!==L.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return console.log("[stx:bundler] cache hit:",K),await U.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let z=H7.get(K);if(z)return await z;let B=pQ($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W});H7.set(K,B);try{return await B}finally{H7.delete(K)}}async function pQ($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=I5(X,"bundle-tmp"),U=j0.join(W,`${G}.ts`),z=j0.join(W,"out",G);P0.mkdirSync(W,{recursive:!0}),P0.mkdirSync(z,{recursive:!0});let B=j0.dirname(Z),_=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=j.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let R=V.split(":")[0].trim();if(R)_.push(R)});else if(L[3])_.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;_.push(L[2])}let F=_.length>0?`
1834
- export { ${_.join(", ")} }`:"";await Bun.write(U,$+F),console.log("[stx:bundler] bundling:",G,"from:",j0.basename(Z));let O=new Set;try{let V=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:Q,plugins:[uQ(X,B,U,O)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...d0()},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 R="";for(let D of V.outputs){R=await D.text();break}let A=[];for(let D of R.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let P of D[1].split(",")){let S=P.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let b=P.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))A.push([b,b])}let w=R.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];R=R.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let N=`__stxBundle_${G}`,T=A.map(([D,P])=>`${JSON.stringify(D)}: ${P}`).join(", "),M=A.map(([D])=>`var ${D} = undefined;`).join(`
1833
+ `}),$}import mQ from"process";function d0($="STX_PUBLIC_"){let Z={},Y={};for(let[X,Q]of Object.entries(mQ.env)){if(!X.startsWith($)||Q===void 0)continue;Z[`import.meta.env.${X}`]=JSON.stringify(Q),Y[X]=Q}return Z["import.meta.env"]=JSON.stringify(Y),Z}var M1=()=>{};var k5={};r(k5,{queueClientBundleBuild:()=>v9,hasUserImports:()=>lQ,bundleClientScript:()=>cQ});import j0 from"path";import b0 from"fs";function lQ($){let Z=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Y;while((Y=Z.exec($))!==null){let Q=Y[1];if(!y9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected user import:",Q),!0}let X=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Y=X.exec($))!==null){let Q=Y[1];if(/\.css(?:\?.*)?$/.test(Q))continue;if(!y9.some((G)=>G.test(Q)))return console.log("[stx:bundler] detected side-effect import:",Q),!0}return!1}function pQ($,Z,Y,X){let Q=(J,G)=>{let K=J===Y?Z:j0.dirname(J),q=j0.resolve(K,G),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,j0.join(q,"index.ts"),j0.join(q,"index.tsx"),j0.join(q,"index.js"),j0.join(q,"index.mjs")];for(let z of W)try{if(b0.existsSync(z)&&b0.statSync(z,{throwIfNoEntry:!1})?.isFile())return z}catch{}return q};return{name:"stx-client-bundle",setup(J){J.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(G)=>({path:G.path,external:!0})),J.onResolve({filter:/^\//},(G)=>{if(b0.existsSync(G.path))return{path:G.path};return{path:G.path,external:!0}}),J.onResolve({filter:/^\.\.?\//},(G)=>{let K=Q(G.importer,G.path);return X.add(K),{path:K}}),J.onResolve({filter:/^[@~]\//},(G)=>{let K=j0.resolve($,G.path.slice(2)),q=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,j0.join(K,"index.ts"),j0.join(K,"index.tsx"),j0.join(K,"index.js"),j0.join(K,"index.mjs")];for(let W of q)if(b0.existsSync(W)&&b0.statSync(W,{throwIfNoEntry:!1})?.isFile())return console.log(`[stx:bundler] resolved ${G.path[0]}/ import:`,G.path,"\u2192",W),X.add(W),{path:W};return console.warn(`[stx:bundler] could not resolve ${G.path[0]}/ import:`,G.path),{path:K}}),J.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(G)=>{let K=j0.extname(G.path).toLowerCase(),q=K===".json"?"json":K===".tsx"?"tsx":K===".jsx"?"jsx":K===".ts"||K===".mts"||K===".cts"?"ts":"js";return X.add(G.path),{contents:b0.readFileSync(G.path,"utf8"),loader:q}})}}}function v9($){let Z=globalThis,X=(Z[P9]??Promise.resolve()).then($,$);return Z[P9]=X.then(()=>{return},()=>{return}),X}async function cQ($,Z,Y={}){let X=Y.projectRoot||process.cwd(),Q=Y.minify??!1,J=Y.cacheDir||I5(X,"bundle-cache"),G=new Bun.CryptoHasher("md5");G.update(`${uQ}\x00${$}\x00${Z}`);let K=G.digest("hex").slice(0,12),q=j0.join(J,`${K}.js`),W=j0.join(J,`${K}.deps.json`),z=Bun.file(q);if(await z.exists()){let _=Bun.file(W),j=!0;if(await _.exists())try{let H=JSON.parse(await _.text());if(H.metadataVersion!==C9||!Array.isArray(H.files))j=!1;for(let L of Array.isArray(H.files)?H.files:[])try{if(b0.statSync(L.path).mtimeMs!==L.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return console.log("[stx:bundler] cache hit:",K),await z.text();console.log("[stx:bundler] cache invalidated by dep change:",K)}let U=H7.get(K);if(U)return await U;let B=v9(()=>iQ($,Z,{projectRoot:X,minify:Q,cacheDir:J,hash:K,cachePath:q,depsPath:W}));H7.set(K,B);try{return await B}finally{H7.delete(K)}}async function iQ($,Z,Y){let{projectRoot:X,minify:Q,cacheDir:J,hash:G,cachePath:K,depsPath:q}=Y,W=I5(X,"bundle-tmp"),z=j0.join(W,`${G}.ts`),U=j0.join(W,"out",G);b0.mkdirSync(W,{recursive:!0}),b0.mkdirSync(U,{recursive:!0});let B=j0.dirname(Z),_=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,H=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,L;while((L=j.exec($))!==null){if(L[1])continue;if(L[2])L[2].split(",").forEach((V)=>{let R=V.split(":")[0].trim();if(R)_.push(R)});else if(L[3])_.push(L[3])}while((L=H.exec($))!==null){if(L[1])continue;_.push(L[2])}let F=_.length>0?`
1834
+ export { ${_.join(", ")} }`:"";await Bun.write(z,$+F),console.log("[stx:bundler] bundling:",G,"from:",j0.basename(Z));let O=new Set;try{let V=await Bun.build({entrypoints:[z],outdir:U,target:"browser",format:"esm",minify:Q,plugins:[pQ(X,B,z,O)],define:{"process.env.NODE_ENV":Q?'"production"':'"development"',...d0()},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 R="";for(let D of V.outputs){R=await D.text();break}let A=[];for(let D of R.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let P of D[1].split(",")){let S=P.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(S){A.push([S[2],S[1]]);continue}let b=P.trim();if(/^[A-Za-z_$][\w$]*$/.test(b))A.push([b,b])}let w=R.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];R=R.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let N=`__stxBundle_${G}`,T=A.map(([D,P])=>`${JSON.stringify(D)}: ${P}`).join(", "),M=A.map(([D])=>`var ${D} = undefined;`).join(`
1835
1835
  `),I=A.map(([D])=>`${D} = ${N}[${JSON.stringify(D)}];`).join(`
1836
1836
  `);if(R=`${w.join(`
1837
1837
  `)}
@@ -1840,19 +1840,19 @@ var ${N} = (function() {
1840
1840
  ${R}
1841
1841
  return { ${T} };
1842
1842
  })();
1843
- ${I}`.trim(),console.log("[stx:bundler] bundled:",G,"output:",R.length,"bytes"),_.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${j0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;P0.mkdirSync(J,{recursive:!0}),await Bun.write(K,R);let E=Array.from(O).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:P9,files:E})),R}catch(V){let R=V instanceof Error?V.message:String(V),A=V?.errors,w=Array.isArray(A)&&A.length>0?`
1843
+ ${I}`.trim(),console.log("[stx:bundler] bundled:",G,"output:",R.length,"bytes"),_.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${j0.basename(Z)} (${G}); serving the unbundled source and not caching this result`),$;b0.mkdirSync(J,{recursive:!0}),await Bun.write(K,R);let E=Array.from(O).map((D)=>{try{return{path:D,mtimeMs:b0.statSync(D).mtimeMs}}catch{return null}}).filter((D)=>D!==null);return await Bun.write(q,JSON.stringify({metadataVersion:C9,files:E})),R}catch(V){let R=V instanceof Error?V.message:String(V),A=V?.errors,w=Array.isArray(A)&&A.length>0?`
1844
1844
  ${A.map((N)=>`- ${N?.message??N}`).join(`
1845
- `)}`:"";return console.warn(`[stx:bundler] error: ${R}${w}`),$}finally{try{P0.rmSync(U,{force:!0}),P0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var dQ=5,P9=1,y9,H7;var b5=k(()=>{M1();V$();y9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];H7=new Map});var g9={};r(g9,{renderVendorStyleTags:()=>A$,processClientScript:()=>P5,injectBrowserCoreAutoImports:()=>o1,generateServerDataBridge:()=>w$,generateBrowserAutoImportDestructuring:()=>$G,generateAutoImportDestructuring:()=>O7,extractBridgeData:()=>y5,extractAndStripCssImports:()=>R$});import I1 from"path";import S5 from"fs";function iQ($){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 nQ($,Z){let Y=Z;while(!0){let X=I1.join(Y,"node_modules",$,"package.json");if(S5.existsSync(X))return I1.dirname(X);let Q=I1.dirname(Y);if(Q===Y)return null;Y=Q}}function oQ($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function sQ($,Z){let Y=iQ($);if(!Y||!Y.subpath)return null;let X=nQ(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(S5.readFileSync(I1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=oQ(Q.exports,J);if(!G)return null;let K=I1.resolve(X,G);return S5.existsSync(K)?K:null}function R$($,Z){let Y=Z.filePath?I1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(cQ,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:I1.resolve(Y,q),!S5.existsSync(W))throw Error(`file not found: ${W}`)}else{let U=null;try{U=Bun.resolveSync(q,X)}catch{U=sQ(q,X)}if(!U)throw Error(`could not resolve ${q} (Bun.resolveSync + exports fallback both failed)`);W=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(q)} (from ${Z.filePath||"<unknown>"}): ${U?.message||U}`),""}if(Q.has(W))return"";Q.add(W);try{let U=S5.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${W}: ${U?.message||U}`)}return""}),styles:J}}function rQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${rQ(Z.source)}" data-stx-layer="vendor">
1845
+ `)}`:"";return console.warn(`[stx:bundler] error: ${R}${w}`),$}finally{try{b0.rmSync(z,{force:!0}),b0.rmSync(U,{recursive:!0,force:!0})}catch{}}}var uQ=5,C9=1,y9,H7,P9;var b5=k(()=>{M1();V$();y9=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];H7=new Map,P9=Symbol.for("stx.client-bundle-build-queue")});var d9={};r(d9,{renderVendorStyleTags:()=>A$,processClientScript:()=>P5,injectBrowserCoreAutoImports:()=>o1,generateServerDataBridge:()=>w$,generateBrowserAutoImportDestructuring:()=>YG,generateAutoImportDestructuring:()=>O7,extractBridgeData:()=>y5,extractAndStripCssImports:()=>R$});import I1 from"path";import S5 from"fs";function oQ($){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 sQ($,Z){let Y=Z;while(!0){let X=I1.join(Y,"node_modules",$,"package.json");if(S5.existsSync(X))return I1.dirname(X);let Q=I1.dirname(Y);if(Q===Y)return null;Y=Q}}function rQ($,Z){if(!$||typeof $!=="object")return null;let Y=(Q)=>{if(typeof Q==="string")return Q;if(Q&&typeof Q==="object"){if(typeof Q.import==="string")return Q.import;if(typeof Q.default==="string")return Q.default;if(typeof Q.import==="object")return Y(Q.import);if(typeof Q.default==="object")return Y(Q.default)}return null};if(Object.prototype.hasOwnProperty.call($,Z))return Y($[Z]);let X=null;for(let Q of Object.keys($)){let J=Q.indexOf("*");if(J===-1)continue;let G=Q.slice(0,J),K=Q.slice(J+1);if(!Z.startsWith(G)||!Z.endsWith(K))continue;if(Z.length<G.length+K.length)continue;if(!X||G.length>X.prefix.length)X={pattern:Q,prefix:G,suffix:K}}if(X){let Q=Z.slice(X.prefix.length,Z.length-X.suffix.length),J=Y($[X.pattern]);if(J)return J.replace("*",Q)}return null}function aQ($,Z){let Y=oQ($);if(!Y||!Y.subpath)return null;let X=sQ(Y.pkg,Z);if(!X)return null;let Q;try{Q=JSON.parse(S5.readFileSync(I1.join(X,"package.json"),"utf8"))}catch{return null}let J=`.${Y.subpath}`,G=rQ(Q.exports,J);if(!G)return null;let K=I1.resolve(X,G);return S5.existsSync(K)?K:null}function R$($,Z){let Y=Z.filePath?I1.dirname(Z.filePath):Z.projectRoot||process.cwd(),X=Z.projectRoot||process.cwd(),Q=new Set,J=[];return{code:$.replace(nQ,(K,q)=>{let W;try{if(q.startsWith("./")||q.startsWith("../")||q.startsWith("/")){if(W=q.startsWith("/")?q:I1.resolve(Y,q),!S5.existsSync(W))throw Error(`file not found: ${W}`)}else{let z=null;try{z=Bun.resolveSync(q,X)}catch{z=aQ(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(Q.has(W))return"";Q.add(W);try{let z=S5.readFileSync(W,"utf8");J.push({source:q,resolvedPath:W,contents:z})}catch(z){console.warn(`[stx:vendor-css] could not read ${W}: ${z?.message||z}`)}return""}),styles:J}}function tQ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function A$($){if($.length===0)return"";return`${$.map((Z)=>{return`<style data-stx-vendor="${tQ(Z.source)}" data-stx-layer="vendor">
1846
1846
  @layer vendor {
1847
1847
  ${Z.contents}
1848
1848
  }
1849
1849
  </style>`}).join(`
1850
1850
  `)}
1851
- `}function o1($){let Z=new Set;for(let Q of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let J of Q[1].split(",")){let G=J.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(G)Z.add(G)}let Y=new Set;for(let Q of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(Q[1]);for(let Q of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of Q[1].split(",")){let G=J.trim().split(/[:=]/).pop()?.trim();if(G)Y.add(G)}let X=x9.filter((Q)=>{if(Z.has(Q)||Y.has(Q))return!1;return new RegExp(`\\b${Q}\\b`).test($)});if(X.length===0)return{code:$,imports:X};return{code:`import { ${X.join(", ")} } from '@stacksjs/browser'
1852
- ${$}`,imports:X}}function eQ($){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(!tQ.has(X[1]))Z.add(X[1]);return Array.from(Z)}function f9($){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 Q=new Set,J=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let q=G[1],W=G[2];if(G[0].includes("import type"))continue;q.split(",").map((z)=>z.trim().split(/\s+as\s+/)[0]).filter((z)=>z.length>0).forEach((z)=>{if(Q.add(z),W==="stx"||W==="@stacksjs/stx")Z.add(z);else Y.add(z)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of aQ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Z.add(q)}for(let q of x9){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Y.add(q)}let K=eQ(X);for(let q of K)if(!Q.has(q))Y.add(q);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function O7($,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
1851
+ `}function o1($){let Z=new Set;for(let Q of $.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let J of Q[1].split(",")){let G=J.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(G)Z.add(G)}let Y=new Set;for(let Q of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(Q[1]);for(let Q of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let J of Q[1].split(",")){let G=J.trim().split(/[:=]/).pop()?.trim();if(G)Y.add(G)}let X=g9.filter((Q)=>{if(Z.has(Q)||Y.has(Q))return!1;return new RegExp(`\\b${Q}\\b`).test($)});if(X.length===0)return{code:$,imports:X};return{code:`import { ${X.join(", ")} } from '@stacksjs/browser'
1852
+ ${$}`,imports:X}}function ZG($){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(!$G.has(X[1]))Z.add(X[1]);return Array.from(Z)}function h9($){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 Q=new Set,J=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,G;while((G=J.exec($))!==null){let q=G[1],W=G[2];if(G[0].includes("import type"))continue;q.split(",").map((U)=>U.trim().split(/\s+as\s+/)[0]).filter((U)=>U.length>0).forEach((U)=>{if(Q.add(U),W==="stx"||W==="@stacksjs/stx")Z.add(U);else Y.add(U)}),X=X.replace(G[0],"// [auto-import processed]")}for(let q of eQ){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\s*\\(`,"g").test(X))Z.add(q)}for(let q of g9){if(Q.has(q))continue;if(new RegExp(`\\b${q}\\b`,"g").test(X))Y.add(q)}let K=ZG(X);for(let q of K)if(!Q.has(q))Y.add(q);return{code:X,stxImports:Array.from(Z),browserImports:Array.from(Y)}}function O7($,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
1853
1853
  ${Y.join(`
1854
1854
  `)}
1855
- ${ZG($,Z)}`;return""}function $G($,Z=[]){let{browserImports:Y}=f9($),X=new Set(Z);return O7([],Y.filter((Q)=>!X.has(Q)))}function ZG($,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
1855
+ ${XG($,Z)}`;return""}function YG($,Z=[]){let{browserImports:Y}=h9($),X=new Set(Z);return O7([],Y.filter((Q)=>!X.has(Q)))}function XG($,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
1856
1856
  [${Y.join(", ")}].forEach(function (e) {
1857
1857
  if (e[1] !== 'undefined') return;
1858
1858
  console.error(
@@ -1861,15 +1861,15 @@ ${ZG($,Z)}`;return""}function $G($,Z=[]){let{browserImports:Y}=f9($),X=new Set(Z
1861
1861
  + 'or it should be imported from a relative path so the bundler includes it.'
1862
1862
  );
1863
1863
  });
1864
- `}function y5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let X=$[Y];if(typeof X==="function")continue;Z[Y]=X}return Z}function C9($,Z){let Y=new Set;for(let X of $.split(",")){let Q=X.trim().replace(/^\.\.\./,"").trim();if(!Q)continue;if(Z){let J=Q.lastIndexOf(":");if(J!==-1)Q=Q.slice(J+1).trim()}if(Q=Q.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Q))Y.add(Q)}return Y}function YG($,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(C9(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(C9(Y[1],!1).has(Z))return!0;return!1}function w$($,Z){if(!Z)return"";let Y=[];for(let[X,Q]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(X))continue;if(!new RegExp(`\\b${X}\\b`).test($))continue;if(YG($,X))continue;let J;try{J=JSON.stringify(Q)}catch{continue}if(J===void 0)continue;Y.push(` var ${X} = ${J.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
1864
+ `}function y5($){let Z={};for(let Y in $){if(Y.startsWith("__")||Y.startsWith("$"))continue;let X=$[Y];if(typeof X==="function")continue;Z[Y]=X}return Z}function x9($,Z){let Y=new Set;for(let X of $.split(",")){let Q=X.trim().replace(/^\.\.\./,"").trim();if(!Q)continue;if(Z){let J=Q.lastIndexOf(":");if(J!==-1)Q=Q.slice(J+1).trim()}if(Q=Q.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(Q))Y.add(Q)}return Y}function JG($,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(x9(Y[1],!0).has(Z))return!0;for(let Y of $.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(x9(Y[1],!1).has(Z))return!0;return!1}function w$($,Z){if(!Z)return"";let Y=[];for(let[X,Q]of Object.entries(Z)){if(!/^[A-Za-z_$][\w$]*$/.test(X))continue;if(!new RegExp(`\\b${X}\\b`).test($))continue;if(JG($,X))continue;let J;try{J=JSON.stringify(Q)}catch{continue}if(J===void 0)continue;Y.push(` var ${X} = ${J.replace(/</g,"\\u003c")};`)}if(Y.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
1865
1865
  ${Y.join(`
1866
1866
  `)}
1867
- `}function JG($){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=XG[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function QG($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=JG(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 U=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
1867
+ `}function GG($){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=QG[$.mouse];Z.push(`if ($event.button !== ${Y}) return`)}if($.prevent)Z.push("$event.preventDefault()");if($.stop)Z.push("$event.stopPropagation()");return Z.join("; ")}function KG($,Z){let{elementId:Y,event:X,handler:Q,modifiers:J}=$,G=GG(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) {
1868
1868
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
1869
- };`;function B(_){if(/\$emit\s*\(/.test(_))return`${z}
1869
+ };`;function B(_){if(/\$emit\s*\(/.test(_))return`${U}
1870
1870
  ${_}`;return`var scope = $el.closest('[data-stx-scope]');
1871
1871
  if (scope && scope.__stx_execute) {
1872
- scope.__stx_execute('${U}', $event, $el);
1872
+ scope.__stx_execute('${z}', $event, $el);
1873
1873
  }
1874
1874
  else {
1875
1875
  ${_}
@@ -1896,36 +1896,36 @@ else {
1896
1896
  }${q})
1897
1897
  })()`;if(/\$emit\s*\(/.test(Q))return` var $el = document.getElementById('${Y}')
1898
1898
  if ($el) $el.addEventListener('${X}', function($event) {
1899
- ${W}${z}
1899
+ ${W}${U}
1900
1900
  ${Q}
1901
1901
  }${q})`;return` var $el = document.getElementById('${Y}')
1902
1902
  if ($el) $el.addEventListener('${X}', function($event) {
1903
1903
  ${W}var scope = $el.closest('[data-stx-scope]');
1904
1904
  if (scope && scope.__stx_execute) {
1905
- scope.__stx_execute('${U}', $event, $el);
1905
+ scope.__stx_execute('${z}', $event, $el);
1906
1906
  }
1907
1907
  else {
1908
1908
  ${Q}
1909
1909
  }
1910
- }${q})`}function GG($){if($.length===0)return"";return`
1910
+ }${q})`}function qG($){if($.length===0)return"";return`
1911
1911
  // STX: auto-generated event bindings
1912
- ${$.map((Y,X)=>QG(Y,X)).join(`
1913
- `)}`}function v9($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,J=X.length,G=0;while(G<J){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<J){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<J){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<J&&X[G]!==`
1914
- `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<J-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let B=W[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=W[0].length;continue}let U=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((B)=>{let _=B.trim(),j=_.indexOf(":"),H=j>=0?_.slice(j+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=U[0].length;continue}let z=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let B=z[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=z[0].length;continue}}G++}return Z}function qG($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let _;while((_=Y.exec(B))!==null){let j=_[0];if(!KG.has(j))Z.add(j)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=W.exec($))!==null)X(J[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((J=U.exec($))!==null)X(J[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=z.exec($))!==null)X(J[1]);return Z}async function P5($,Z={}){let Y=$,X="",Q=!1,J=[],G=R$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=A$(G.styles),q=o1(Y);Y=q.code,J=q.imports;let{hasUserImports:W,bundleClientScript:U}=await Promise.resolve().then(() => (b5(),k5));if(W(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await U(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let O=f9(Y);Y=O.code,X=O7(O.stxImports,O.browserImports.filter((V)=>!J.includes(V)))}if(X=`${w$(Y,Z.serverData)}${X}`,Y=c0(Y),!Q&&D1(Z.attrs||""))Y=E1(Y);let z=GG(Z.eventBindings||[]),B=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(B)){let O=B.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${V}>
1912
+ ${$.map((Y,X)=>KG(Y,X)).join(`
1913
+ `)}`}function f9($){let Z=[],Y=new Set,X=$.replace(/^\s*import\s+.*$/gm,""),Q=0,J=X.length,G=0;while(G<J){let K=X[G];if(K==="'"||K==='"'||K==="`"){let q=K;if(G++,q==="`"){let W=0;while(G<J){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<J){if(X[G]==="\\"){G+=2;continue}if(X[G]===q){G++;break}G++}continue}if(K==="/"&&X[G+1]==="/"){while(G<J&&X[G]!==`
1914
+ `)G++;continue}if(K==="/"&&X[G+1]==="*"){G+=2;while(G<J-1&&!(X[G]==="*"&&X[G+1]==="/"))G++;G+=2;continue}if(K==="{"){Q++,G++;continue}if(K==="}"){Q--,G++;continue}if(Q===0){let q=X.slice(G),W=q.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(W){let B=W[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=W[0].length;continue}let z=q.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(z){z[1].split(",").forEach((B)=>{let _=B.trim(),j=_.indexOf(":"),H=j>=0?_.slice(j+1).trim().split(/[\s=]/)[0]:_.split(/[\s=]/)[0];if(H&&!H.startsWith("_")&&!Y.has(H))Z.push(H),Y.add(H)}),G+=z[0].length;continue}let U=q.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(U){let B=U[1];if(!B.startsWith("_")&&!Y.has(B))Z.push(B),Y.add(B);G+=U[0].length;continue}}G++}return Z}function zG($){let Z=new Set,Y=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function X(B){let _;while((_=Y.exec(B))!==null){let j=_[0];if(!WG.has(j))Z.add(j)}}let Q=/\{\{([\s\S]*?)\}\}/g,J;while((J=Q.exec($))!==null)X(J[1]);let G=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((J=G.exec($))!==null)X(J[1]);let K=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((J=K.exec($))!==null)X(J[1]);let q=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((J=q.exec($))!==null)X(J[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((J=W.exec($))!==null)X(J[1]);let z=/@model\s*=\s*["']([^"']*)["']/gi;while((J=z.exec($))!==null)X(J[1]);let U=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((J=U.exec($))!==null)X(J[1]);return Z}async function P5($,Z={}){let Y=$,X="",Q=!1,J=[],G=R$(Y,{filePath:Z.filePath,projectRoot:Z.projectRoot});Y=G.code;let K=A$(G.styles),q=o1(Y);Y=q.code,J=q.imports;let{hasUserImports:W,bundleClientScript:z}=await Promise.resolve().then(() => (b5(),k5));if(W(Y))console.log("[stx:bundler] user imports detected, bundling..."),Y=await z(Y,Z.filePath||"",{projectRoot:Z.projectRoot,minify:Z.production}),Q=!0;if(Z.autoImports!==!1){let O=h9(Y);Y=O.code,X=O7(O.stxImports,O.browserImports.filter((V)=>!J.includes(V)))}if(X=`${w$(Y,Z.serverData)}${X}`,Y=c0(Y),!Q&&D1(Z.attrs||""))Y=E1(Y);let U=qG(Z.eventBindings||[]),B=(Z.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(B)){let O=B.replace(/\btype\s*=\s*["']module["']/i,"").trim(),V=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${K}<script ${V}>
1915
1915
  ${X}${Y}
1916
- ${z}
1916
+ ${U}
1917
1917
  </script>`}let j=/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect|useLocalStorage|useSessionStorage|useRef|useEventListener|useFetch|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|onMounted|onBeforeUnmount|onUnmounted|batch|untrack|peek)\s*(?:<[^>]*>)?\s*\(/.test($),H=/function __stx_setup_/.test(Y),L=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test($);function F(O){let V=O.length>0?`
1918
1918
  return { ${O.join(", ")} };`:"";return`${K}<script data-stx-scoped>
1919
1919
  window.stx.mount(function() {
1920
1920
  'use strict';
1921
1921
  ${X}${Y}
1922
- ${z}${V}
1923
- })</script>`}if(!L&&!H){if(j)return F(v9($));if(Z.templateContent){let O=v9($);if(O.length>0){let V=qG(Z.templateContent);if(O.some((A)=>V.has(A)))return F(O)}}}return`${K}<script data-stx-scoped>
1922
+ ${U}${V}
1923
+ })</script>`}if(!L&&!H){if(j)return F(f9($));if(Z.templateContent){let O=f9($);if(O.length>0){let V=zG(Z.templateContent);if(O.some((A)=>V.has(A)))return F(O)}}}return`${K}<script data-stx-scoped>
1924
1924
  ;(function() {
1925
1925
  'use strict';
1926
1926
  ${X}${Y}
1927
- ${z}
1928
- })()</script>`}var cQ,aQ,x9,tQ,XG,KG;var C5=k(()=>{O0();cQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;aQ=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],x9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];tQ=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"]);XG={left:0,middle:1,right:2};KG=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"])});function BG($){let Z="",Y=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&J==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}Z+=J}return Z}function jG($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(UG.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&u9.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function _G($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!u9.has(X))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],J=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&J===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function N$($){let Z=$.trim(),Y=BG(Z);jG(Y,Z),_G(Z);for(let X of m9)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!d9.allowBracketNotation&&zG.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function HG($){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("__")||m9.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=L7(X);else Z[Y]=X}return Z}function L7($,Z=0){if(Z>=d9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>L7(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Y[X]=L7(Q,Z+1);else Y[X]=Q}return Y}function Y0($,Z){try{let Y=HG(Z),X=Object.keys(Y),Q=Object.values(Y);return Q0($,X)(...Q)}catch{return}}function J0($){try{return N$($),!0}catch{return!1}}function L0($,Z){try{let Y=Y0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function Q0($,Z){let Y=N$($),X=/^[A-Za-z_$][\w$]*$/,Q=[],J=[];for(let W=0;W<Z.length;W++){let U=Z[W];if(!X.test(U))continue;if(l9.has(U))continue;Q.push(W),J.push(U)}let G=(W)=>Function(...J,...W,`
1927
+ ${U}
1928
+ })()</script>`}var nQ,eQ,g9,$G,QG,WG;var C5=k(()=>{O0();nQ=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;eQ=["state","derived","effect","batch","untrack","peek","isSignal","isDerived","onMount","onDestroy","useRef","navigate","goBack","goForward","useRoute","setRouteParams","useSearchParams","useFetch","useQuery","useMutation","useOptimistic","useId","useReactiveProp","useLocalStorage","useSessionStorage","useCookie","useWebSocket","useHead","useSeoMeta","definePageMeta","useEventListener","useMeta","useDebounce","useDebouncedValue","useThrottle","useInterval","useTimeout","useToggle","useCounter","useClickOutside","useFocus","useAsync","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","ref","reactive","computed","watch","watchEffect","watchMultiple","onBeforeMount","onMounted","onBeforeUpdate","onUpdated","onBeforeUnmount","onUnmounted","defineProps","withDefaults","defineEmits","defineExpose","defineSlots","provide","inject","nextTick","getCurrentInstance","onErrorCaptured","useSlots","useAttrs","createStore","defineStore","registerStoresClient","useStore","action","createSelector","h","Fragment"],g9=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"];$G=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"]);QG={left:0,middle:1,right:2};WG=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"])});function _G($){let Z="",Y=null,X=!1;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(X){X=!1;continue}if(J==="\\"&&Y){X=!0;continue}if(Y){if(Y==="`"&&J==="$"&&Q+1<$.length&&$[Q+1]==="{"){let G=1;Q+=2;while(Q<$.length&&G>0){if($[Q]==="{")G++;else if($[Q]==="}")G--;if(G>0)Z+=$[Q],Q++}continue}if(J===Y)Y=null;continue}if(J==='"'||J==="'"||J==="`"){Y=J;continue}Z+=J}return Z}function HG($,Z){let Y=/[$A-Z_a-z][$\w]*/g,X;while((X=Y.exec($))!==null){let Q=X[0],J=$[X.index-1];if(BG.has(Q))throw Error(`Potentially unsafe expression (matched /\\b${Q}\\b/; identifier ${Q}): ${Z}`);if(J==="."&&p9.has(Q))throw Error(`Potentially unsafe expression (matched /.${Q}/; property ${Q}): ${Z}`)}}function OG($){let Z=/\[\s*(['"])(.*?)\1\s*\]/g,Y;while((Y=Z.exec($))!==null){let X=Y[2];if(!p9.has(X))continue;let Q=$.slice(0,Y.index).match(/\S(?=\s*$)/)?.[0],J=$.slice(Y.index+Y[0].length).match(/^\s*(\S)/)?.[1];if(!((Q==="{"||Q===",")&&J===":"))throw Error(`Potentially unsafe expression (bracket key ${Y[2]}): ${$}`)}}function N$($){let Z=$.trim(),Y=_G(Z);HG(Y,Z),OG(Z);for(let X of l9)if(X.test(Y))throw Error(`Potentially unsafe expression (matched /${X.source}/): ${Z}`);if(!u9.allowBracketNotation&&jG.test(Z))throw Error(`Bracket notation with strings not allowed: ${Z}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return Z}function LG($){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("__")||l9.some((Q)=>Q.test(Y)))continue;if(X&&typeof X==="object"&&!Array.isArray(X))Z[Y]=L7(X);else Z[Y]=X}return Z}function L7($,Z=0){if(Z>=u9.maxSanitizeDepth)return"[Object too deep]";if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((X)=>L7(X,Z+1));if($ instanceof Date||$ instanceof RegExp||$ instanceof Map||$ instanceof Set||$ instanceof Error)return $;let Y={};for(let[X,Q]of Object.entries($)){if(X.startsWith("__")||X==="constructor"||X==="prototype")continue;if(Q&&typeof Q==="object")Y[X]=L7(Q,Z+1);else Y[X]=Q}return Y}function Y0($,Z){try{let Y=LG(Z),X=Object.keys(Y),Q=Object.values(Y);return Q0($,X)(...Q)}catch{return}}function J0($){try{return N$($),!0}catch{return!1}}function L0($,Z){try{let Y=Y0($,Z);if(Y&&typeof Y==="object"&&!Array.isArray(Y))return Y;return{}}catch{return{}}}function Q0($,Z){let Y=N$($),X=/^[A-Za-z_$][\w$]*$/,Q=[],J=[];for(let W=0;W<Z.length;W++){let z=Z[W];if(!X.test(z))continue;if(c9.has(z))continue;Q.push(W),J.push(z)}let G=(W)=>Function(...J,...W,`
1929
1929
  'use strict';
1930
1930
  try {
1931
1931
  return ${Y};
@@ -1936,7 +1936,7 @@ catch (e) {
1936
1936
  }
1937
1937
  throw e;
1938
1938
  }
1939
- `),K=G([]);if(J.length===Z.length)return h9(K,J,G);return h9((...W)=>{let U=Array(Q.length);for(let z=0;z<Q.length;z++)U[z]=W[Q[z]];return K(...U)},J,G,(W)=>{K=G(W)})}function h9($,Z,Y,X){let J=/^(\w+) is not defined$/,G=$,K=[],q=new Set(Z);return(...W)=>{for(let U=0;U<=8;U++)try{return G(...W)}catch(z){let B=z instanceof Error?z.message:"",_=J.exec(B);if(!(z instanceof ReferenceError)||!_)return;let j=_[1];if(q.has(j)||l9.has(j))return;q.add(j),K.push(j),G=Y(K),X?.(K)}return}}function T$($){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 WG,d9,m9,UG,u9,zG,l9;var F0=k(()=>{WG={maxSanitizeDepth:10,allowBracketNotation:!1},d9={...WG},m9=[/\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/],UG=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"]),u9=new Set(["__proto__","constructor","prototype"]),zG=/[\w)\]]\s*\[\s*['"]/;l9=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 M$($,Z){let Y=OG++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return LG.set(X,{type:$,expression:Z}),X}var OG=0,LG;var p9=k(()=>{LG=new Map});function s9($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function W1($,Z){return s9($,Z,c9,i9)}function s1($,Z){return s9($,Z,n9,o9)}function v5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function FG($,Z){if($.startsWith("<!--",Z)){let Y=v5($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[c9,i9],[n9,o9]]){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)continue;X.lastIndex=Y.lastIndex;let J=X.exec($);return J?J.index+J[0].length:$.length}return-1}function F7($,Z){let Y=[],X=0,Q=$.length,J=!1,G=null;while(X<Q){let K=$[X];if(J){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")J=!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=FG($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))J=!0;X++}return Y}function r0($,Z,Y){let X=F7($,Z);if(X.length===0)return{output:$,tokens:[]};let Q=X.map((K)=>K.token),J="",G=0;for(let K=0;K<X.length;K++){let q=X[K];J+=$.slice(G,q.start),J+=Y(q.token,K),G=q.end}return J+=$.slice(G),{output:J,tokens:Q}}function U1($){let{output:Z,tokens:Y}=r0($,W1,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function x5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var c9,i9,n9,o9;var k1=k(()=>{c9=/<script\b[^>]*>/iy,i9=/<\/script\s*>/ig,n9=/<style\b[^>]*>/iy,o9=/<\/style\s*>/ig});var Z8={};r(Z8,{usesSignalsInScript:()=>r1,unescapeHtml:()=>V7,registerFilters:()=>RG,registerFilter:()=>t9,processExpressions:()=>z1,interpolateScriptsInTemplate:()=>wG,interpolateScriptExpressions:()=>I$,getAllFilters:()=>e9,evaluateExpression:()=>m0,escapeHtml:()=>i0,defaultFilters:()=>g5,clearCustomFilters:()=>AG,applyFilters:()=>$8});function VG($){let Z=r9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),r9.set($,Z)}return Z.lastIndex=0,Z}function t9($,Z){if($ in g5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);f5[$]=Z}function RG($){for(let[Z,Y]of Object.entries($))t9(Z,Y)}function e9(){return{...g5,...f5}}function AG(){for(let $ of Object.keys(f5))delete f5[$]}function i0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function r1($){let{scripts:Z}=U1($);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 Q=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Q))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 a9($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let U=X[W];if(!J&&U==="`"){J=!0,G=0;continue}if(J){if(U==="`"&&G===0){J=!1;continue}if(U==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(U==="}"&&G>0){G--;continue}if(G>0){Q+=U;continue}continue}Q+=U}X=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function I$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=m0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=m0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function wG($,Z,Y={}){let{output:X,scripts:Q}=U1($),J=Q.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 U=K[1],z=K[2];if(/\bsrc\s*=/.test(U))return G;if(/\bdata-raw\b/.test(U))return G;if(/\btype\s*=\s*["']application\/json["']/.test(U))return G;if(Y.skipServer&&/\bserver\b/.test(U))return G;let B=I$(z,Z);return q[0]+B+G.slice(W)});return x5(X,J)}function z1($,Z,Y,X){let Q=$,J=(B,_)=>{let j=s1(B,_);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(_,j))?-1:j},G=(B,_,j,H)=>{let L=j.length,{output:F,tokens:O}=r0(B,_,(V,R)=>H(L+R));return j.push(...O),F},K=[];Q=G(Q,J,K,(B)=>`<!--__STX_STYLE_${B}__-->`);let q=[];Q=G(Q,W1,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||r1($),U=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:[]);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(B,_,j)=>{try{let H=m0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return W0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,j,B)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(B,_,j)=>{try{let H=m0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return M$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return M$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return W0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,j,B)}}),Q=G(Q,W1,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),Q=G(Q,J,K,(B)=>`<!--__STX_STYLE_${B}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(B,_,j)=>{let H=_.trim();if(z.has(H))return B;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(F)?.[1],R=V&&((V in Z)||L.includes(V)),A=Boolean(V&&U.has(V)),w=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(w),T=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=m0(_,Z);if(A)return B;if(W&&!a9(H,Z))return B;if(M===void 0&&Z.__stx_buildMode==="compile"&&!W)return M$("expr",H);return M!==void 0&&M!==null?i0(String(M)):""}catch(M){if(A)return B;if(W&&!a9(H,Z))return B;if(T)return B;let I=M instanceof Error?M.message:String(M);return W0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,j,B)}});for(let B=0;B<q.length;B++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${B}__-->`,()=>q[B]);for(let B=0;B<K.length;B++)Q=Q.replace(`<!--__STX_STYLE_${B}__-->`,()=>K[B]);return Q}function $8($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=f5[G]||g5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(e9()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let U=W[1].trim();try{let z=Number(U);q=[Number.isNaN(z)?U:z]}catch{q=[U]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,U=1;while(W>0&&U<Q.length){if(Q[U]==="(")W++;if(Q[U]===")")W--;U++}if(W===0){let z=Q.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))q=[m0(`(${z})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<z.length;V++){let R=z[V];if(O){_+=R,O=!1;continue}if(R==="\\"){_+=R,O=!0;continue}if(j){if(_+=R,R===j)j=null;continue}if(R==='"'||R==="'"||R==="`"){j=R,_+=R;continue}if(R==="(")H++;else if(R===")")H--;else if(R==="[")L++;else if(R==="]")L--;else if(R==="{")F++;else if(R==="}")F--;if(R===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=R}if(_)B.push(_);q=B.map((V)=>{let R=V.trim();return m0(R,Y,!0)})}}catch{q=[z]}Q=Q.substring(U).trim()}}try{X=K(X,Y,...q)}catch(W){let U=W instanceof Error?W.message:String(W);throw Error(`Error applying filter '${G}': ${U}`)}if(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function NG($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let U=1;K+=2;while(K<$.length&&U>0){if($[K]==="{")U++;else if($[K]==="}")U--;if(U>0)K++}continue}if(Z)continue;if(q==="(")X++;else if(q===")")X--;else if(q==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function m0($,Z,Y=!1){try{let X=$.trim(),Q=NG(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=m0(J,Z,!0);return $8(K,G,Z)}if(!J0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Y0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return Q0(X,J)(...G)}catch{return Y0(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=TG(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function TG($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=MG($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function MG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function V7($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var f5,r9,g5;var a0=k(()=>{F0();O0();p9();k1();f5={},r9=new Map;g5={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 i0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(VG(q),String(W))}),K},t:($,Z,Y={})=>{return g5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});function a1($="const",Z=[],Y){let X=Z.length?D$.filter((Q)=>!Z.includes(Q)):D$;if(Y!==void 0)X=X.filter((Q)=>{let J=Q.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${J}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}var D$,Y8;var h5=k(()=>{D$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","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","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],Y8=["onMount","onDestroy"]});class d5{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 e1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!t1.has(Y)){if(t1.size>=IG){let X=t1.keys().next().value;if(X)t1.delete(X)}t1.set(Y,new RegExp($,Z))}return t1.get(Y)}class X8{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,U=Q.get(W);if(!U){if(Q.size>=J){let z=Q.keys().next().value;if(z)Q.delete(z)}U=Function(...Z,`
1939
+ `),K=G([]);if(J.length===Z.length)return m9(K,J,G);return m9((...W)=>{let z=Array(Q.length);for(let U=0;U<Q.length;U++)z[U]=W[Q[U]];return K(...z)},J,G,(W)=>{K=G(W)})}function m9($,Z,Y,X){let J=/^(\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 B=U instanceof Error?U.message:"",_=J.exec(B);if(!(U instanceof ReferenceError)||!_)return;let j=_[1];if(q.has(j)||c9.has(j))return;q.add(j),K.push(j),G=Y(K),X?.(K)}return}}function T$($){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 UG,u9,l9,BG,p9,jG,c9;var F0=k(()=>{UG={maxSanitizeDepth:10,allowBracketNotation:!1},u9={...UG},l9=[/\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/],BG=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"]),p9=new Set(["__proto__","constructor","prototype"]),jG=/[\w)\]]\s*\[\s*['"]/;c9=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 M$($,Z){let Y=FG++,X=`<!--__STX_${$.toUpperCase()}_${Y}__-->`;return VG.set(X,{type:$,expression:Z}),X}var FG=0,VG;var i9=k(()=>{VG=new Map});function a9($,Z,Y,X){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)return-1;X.lastIndex=Y.lastIndex;let J=X.exec($);if(!J)return-1;return J.index+J[0].length}function W1($,Z){return a9($,Z,n9,o9)}function s1($,Z){return a9($,Z,s9,r9)}function v5($,Z){if(!$.startsWith("<!--",Z))return-1;let Y=$.indexOf("-->",Z+4);if(Y===-1)return-1;return Y+3}function RG($,Z){if($.startsWith("<!--",Z)){let Y=v5($,Z);return Y===-1?$.length:Y}for(let[Y,X]of[[n9,o9],[s9,r9]]){Y.lastIndex=Z;let Q=Y.exec($);if(!Q||Q.index!==Z)continue;X.lastIndex=Y.lastIndex;let J=X.exec($);return J?J.index+J[0].length:$.length}return-1}function F7($,Z){let Y=[],X=0,Q=$.length,J=!1,G=null;while(X<Q){let K=$[X];if(J){if(G){if(K===G)G=null}else if(K==='"'||K==="'")G=K;else if(K===">")J=!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=RG($,X);if(W>X){X=W;continue}if(/^<\/?[a-zA-Z]/.test($.slice(X,X+2)))J=!0;X++}return Y}function r0($,Z,Y){let X=F7($,Z);if(X.length===0)return{output:$,tokens:[]};let Q=X.map((K)=>K.token),J="",G=0;for(let K=0;K<X.length;K++){let q=X[K];J+=$.slice(G,q.start),J+=Y(q.token,K),G=q.end}return J+=$.slice(G),{output:J,tokens:Q}}function z1($){let{output:Z,tokens:Y}=r0($,W1,(X,Q)=>`\x00STX_SCRIPT_${Q}\x00`);return{output:Z,scripts:Y}}function x5($,Z){if(Z.length===0)return $;return $.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Y,X)=>Z[+X]??"")}var n9,o9,s9,r9;var k1=k(()=>{n9=/<script\b[^>]*>/iy,o9=/<\/script\s*>/ig,s9=/<style\b[^>]*>/iy,r9=/<\/style\s*>/ig});var X8={};r(X8,{usesSignalsInScript:()=>r1,unescapeHtml:()=>V7,registerFilters:()=>wG,registerFilter:()=>$8,processExpressions:()=>U1,interpolateScriptsInTemplate:()=>TG,interpolateScriptExpressions:()=>I$,getAllFilters:()=>Z8,evaluateExpression:()=>m0,escapeHtml:()=>i0,defaultFilters:()=>g5,clearCustomFilters:()=>NG,applyFilters:()=>Y8});function AG($){let Z=t9.get($);if(!Z){let Y=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Z=new RegExp(`:${Y}(?!\\w)`,"g"),t9.set($,Z)}return Z.lastIndex=0,Z}function $8($,Z){if($ in g5)console.warn(`Filter "${$}" already exists as a built-in filter. Custom filter will take precedence.`);f5[$]=Z}function wG($){for(let[Z,Y]of Object.entries($))$8(Z,Y)}function Z8(){return{...g5,...f5}}function NG(){for(let $ of Object.keys(f5))delete f5[$]}function i0($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function r1($){let{scripts:Z}=z1($);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 Q=X[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(Q))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 e9($,Z){let Y=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],X=$.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),Q="",J=!1,G=0;for(let W=0;W<X.length;W++){let z=X[W];if(!J&&z==="`"){J=!0,G=0;continue}if(J){if(z==="`"&&G===0){J=!1;continue}if(z==="$"&&X[W+1]==="{"){G++,W++,Q+=" ";continue}if(z==="}"&&G>0){G--;continue}if(G>0){Q+=z;continue}continue}Q+=z}X=Q;let K=/\b([a-zA-Z_$][a-zA-Z0-9_$]*)\b/g,q;while((q=K.exec(X))!==null){let W=q[1];if(!X.substring(0,q.index).trimEnd().endsWith(".")){if(!Y.includes(W)&&!(W in Z))return!1}}return!0}function I$($,Z){let Y=$;return Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=m0(Q,Z);if(J===void 0)return X;return J===null?"":String(J)}catch{return X}}),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{let J=Q.trim();if(/^__[A-Z_]+__$/.test(J))return X;try{let G=m0(Q,Z);if(G===void 0)return X;return JSON.stringify(G)}catch{return X}}),Y}function TG($,Z,Y={}){let{output:X,scripts:Q}=z1($),J=Q.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 B=I$(U,Z);return q[0]+B+G.slice(W)});return x5(X,J)}function U1($,Z,Y,X){let Q=$,J=(B,_)=>{let j=s1(B,_);if(j===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(B.slice(_,j))?-1:j},G=(B,_,j,H)=>{let L=j.length,{output:F,tokens:O}=r0(B,_,(V,R)=>H(L+R));return j.push(...O),F},K=[];Q=G(Q,J,K,(B)=>`<!--__STX_STYLE_${B}__-->`);let q=[];Q=G(Q,W1,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`);let W=X?.forceSignals===!0||Z?.__stx_force_signals===!0||Array.isArray(Z?.__stx_client_signal_names)||r1($),z=new Set(Array.isArray(Z?.__stx_client_signal_names)?Z.__stx_client_signal_names:[]),U=new Set(Array.isArray(Z?.__stx_preserved_client_expressions)?Z.__stx_preserved_client_expressions:[]);Q=Q.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(B,_,j)=>{try{let H=m0(_,Z);return H!==void 0&&H!==null?String(H):""}catch(H){let L=H instanceof Error?H.message:String(H);return W0("Expression",`Error evaluating: {{{ ${_.trim()}}}}: ${L}`,Y,$,j,B)}}),Q=Q.replace(/\{!!([\s\S]*?)!!\}/g,(B,_,j)=>{try{let H=m0(_,Z);if(H===void 0&&Z.__stx_buildMode==="compile")return M$("raw",_.trim());return H!==void 0&&H!==null?String(H):""}catch(H){if(Z.__stx_buildMode==="compile")return M$("raw",_.trim());let L=H instanceof Error?H.message:String(H);return W0("Expression",`Error evaluating: {!! ${_.trim()} !!}: ${L}`,Y,$,j,B)}}),Q=G(Q,W1,q,(B)=>`<!--__STX_SCRIPT_EXPR_${B}__-->`),Q=G(Q,J,K,(B)=>`<!--__STX_STYLE_${B}__-->`),Q=Q.replace(/\{\{([\s\S]*?)\}\}/g,(B,_,j)=>{let H=_.trim();if(U.has(H))return B;let L=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],F=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,V=H.match(F)?.[1],R=V&&((V in Z)||L.includes(V)),A=Boolean(V&&z.has(V)),w=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,N=H.match(w),T=N&&!L.includes(N[1])&&!(N[1]in Z);if(/^__[A-Z_]+__$/.test(H))return"";try{let M=m0(_,Z);if(A)return B;if(W&&!e9(H,Z))return B;if(M===void 0&&Z.__stx_buildMode==="compile"&&!W)return M$("expr",H);return M!==void 0&&M!==null?i0(String(M)):""}catch(M){if(A)return B;if(W&&!e9(H,Z))return B;if(T)return B;let I=M instanceof Error?M.message:String(M);return W0("Expression",`Error evaluating: {{ ${H} }}: ${I}`,Y,$,j,B)}});for(let B=0;B<q.length;B++)Q=Q.replace(`<!--__STX_SCRIPT_EXPR_${B}__-->`,()=>q[B]);for(let B=0;B<K.length;B++)Q=Q.replace(`<!--__STX_STYLE_${B}__-->`,()=>K[B]);return Q}function Y8($,Z,Y){if(!Z.trim())return $;let X=$,Q=Z.trim();while(Q.length>0){let J=Q.match(/^(\w+)/);if(!J)break;let G=J[1];Q=Q.substring(G.length).trim();let K=f5[G]||g5[G];if(!K)throw Error(`Filter not found: ${G}. Available filters: ${Object.keys(Z8()).join(", ")}`);let q=[];if(Q.startsWith(":")){let W=Q.match(/^:([^|\s]+)/);if(W){let z=W[1].trim();try{let U=Number(z);q=[Number.isNaN(U)?z:U]}catch{q=[z]}Q=Q.substring(W[0].length).trim()}}else if(Q.startsWith("(")){let W=1,z=1;while(W>0&&z<Q.length){if(Q[z]==="(")W++;if(Q[z]===")")W--;z++}if(W===0){let U=Q.substring(1,z-1).trim();if(U)try{if(U.startsWith("{")&&U.endsWith("}"))q=[m0(`(${U})`,Y,!0)];else{let B=[],_="",j=null,H=0,L=0,F=0,O=!1;for(let V=0;V<U.length;V++){let R=U[V];if(O){_+=R,O=!1;continue}if(R==="\\"){_+=R,O=!0;continue}if(j){if(_+=R,R===j)j=null;continue}if(R==='"'||R==="'"||R==="`"){j=R,_+=R;continue}if(R==="(")H++;else if(R===")")H--;else if(R==="[")L++;else if(R==="]")L--;else if(R==="{")F++;else if(R==="}")F--;if(R===","&&H===0&&L===0&&F===0){B.push(_),_="";continue}_+=R}if(_)B.push(_);q=B.map((V)=>{let R=V.trim();return m0(R,Y,!0)})}}catch{q=[U]}Q=Q.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(Q.startsWith("|"))Q=Q.substring(1).trim();else break}return X}function MG($){let Z=!1,Y="",X=0,Q=0,J=0,G=!1;for(let K=0;K<$.length;K++){let q=$[K],W=$[K+1];if(Z&&G){G=!1;continue}if(Z&&q==="\\"){G=!0;continue}if(G=!1,(q==='"'||q==="'"||q==="`")&&!G){if(!Z)Z=!0,Y=q;else if(q===Y)Z=!1,Y="";continue}if(Z&&Y==="`"&&q==="$"&&W==="{"){let 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==="[")Q++;else if(q==="]")Q--;else if(q==="{")J++;else if(q==="}")J--;if(q==="|"&&X===0&&Q===0&&J===0){if(W==="|"){K++;continue}if(W==="="){K++;continue}return K}}return-1}function m0($,Z,Y=!1){try{let X=$.trim(),Q=MG(X);if(Q>0){let J=X.substring(0,Q).trim(),G=X.substring(Q+1).trim(),K=m0(J,Z,!0);return Y8(K,G,Z)}if(!J0(X)){if(!Y)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${X}`);return Y0(X,Z)}try{let J=Object.keys(Z),G=Object.values(Z);return Q0(X,J)(...G)}catch{return Y0(X,Z)}}catch(X){if(X instanceof ReferenceError){let Q=/(\b\w+)\s+is not defined/.exec(X.message);if(Q){let J=Q[1],G=IG(J,Object.keys(Z));if(G&&G!==J)X.message=`${X.message} \u2014 did you mean '${G}'?`}}if(!Y)console.error(`Error evaluating expression: ${$}`,X);throw X}}function IG($,Z){let Y=null;for(let Q of Z){if(Q===$)continue;let J=DG($,Q);if(Y===null||J<Y.dist)Y={key:Q,dist:J}}if(!Y)return null;let X=Math.max($.length,Y.key.length);if(Y.dist<=2||Y.dist/X<=0.35)return Y.key;return null}function DG($,Z){if($===Z)return 0;if($.length===0)return Z.length;if(Z.length===0)return $.length;let[Y,X]=$.length<Z.length?[$,Z]:[Z,$],Q=Array(Y.length+1),J=Array(Y.length+1);for(let G=0;G<=Y.length;G++)Q[G]=G;for(let G=1;G<=X.length;G++){J[0]=G;for(let K=1;K<=Y.length;K++){let q=Y[K-1]===X[G-1]?0:1;J[K]=Math.min(J[K-1]+1,Q[K]+1,Q[K-1]+q)}for(let K=0;K<=Y.length;K++)Q[K]=J[K]}return Q[Y.length]}function V7($){if(!$)return"";return $.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var f5,t9,g5;var a0=k(()=>{F0();O0();i9();k1();f5={},t9=new Map;g5={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 i0(String($))},translate:($,Z,Y={})=>{if(!Z||!Z.__translations)return $;let X=Z.__translations,Q=Z.__i18nConfig?.fallbackToKey??!0,J=String($).split("."),G=X;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Q?$:"";let K=String(G);return Object.entries(Y).forEach(([q,W])=>{K=K.replace(AG(q),String(W))}),K},t:($,Z,Y={})=>{return g5.translate($,Z,Y)},truncate:($,Z,Y=50,X="...")=>{if($===void 0||$===null)return"";let Q=String($);if(Q.length<=Y)return Q;if(Y<=X.length)return X.substring(0,Y);return Q.substring(0,Y-X.length)+X},date:($,Z,Y="short",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=$ instanceof Date?$:new Date($);if(Number.isNaN(Q.getTime()))return String($);let J={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Y==="iso")return Q.toISOString();return new Intl.DateTimeFormat(X,J[Y]||J.short).format(Q)}catch{return String($)}},currency:($,Z,Y="USD",X="en-US")=>{if($===void 0||$===null)return"";try{let Q=Number($);if(Number.isNaN(Q))return String($);return new Intl.NumberFormat(X,{style:"currency",currency:Y}).format(Q)}catch{return String($)}},pluralize:($,Z,Y,X)=>{let Q=Number($);if(Number.isNaN(Q))return Y;let J=X||`${Y}s`;return Q===1?Y:J},first:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[0];return String($).charAt(0)},last:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return $.length===0?"":$[$.length-1];let Y=String($);return Y.charAt(Y.length-1)},length:($,Z)=>{if($===void 0||$===null)return 0;if(Array.isArray($)||typeof $==="string")return $.length;if($ instanceof Map||$ instanceof Set)return $.size;if(typeof $==="object")return Object.keys($).length;return 0},json:($,Z,Y=!1)=>{if($===void 0)return"undefined";if($===null)return"null";try{return Y?JSON.stringify($,null,2):JSON.stringify($)}catch{return String($)}},default:($,Z,Y="")=>{return $===void 0||$===null||$===""?Y:$},reverse:($,Z)=>{if($===void 0||$===null)return"";if(Array.isArray($))return[...$].reverse();return String($).split("").reverse().join("")},slice:($,Z,Y=0,X)=>{if($===void 0||$===null)return"";if(Array.isArray($)||typeof $==="string")return $.slice(Y,X);return $},replace:($,Z,Y,X="")=>{if($===void 0||$===null)return"";let Q=Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String($).replace(new RegExp(Q,"g"),()=>X)},stripTags:($,Z)=>{if($===void 0||$===null)return"";return String($).replace(/<[^>]*>/g,"")},urlencode:($,Z)=>{if($===void 0||$===null)return"";return encodeURIComponent(String($))},abs:($,Z)=>{let Y=Number($);return Number.isNaN(Y)?0:Math.abs(Y)},round:($,Z,Y=0)=>{let X=Number($);if(Number.isNaN(X))return 0;let Q=10**Y;return Math.round(X*Q)/Q}}});function a1($="const",Z=[],Y){let X=Z.length?D$.filter((Q)=>!Z.includes(Q)):D$;if(Y!==void 0)X=X.filter((Q)=>{let J=Q.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${J}(?![\\w$])`).test(Y)});return`${$} { ${X.join(", ")} } = window.stx;`}var D$,J8;var h5=k(()=>{D$=["batch","computed","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","navigate","nextTick","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","provide","reactive","ref","registerStoresClient","state","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","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","withDefaults"],J8=["onMount","onDestroy"]});class d5{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 e1($,Z){if(Z?.includes("g"))return new RegExp($,Z);let Y=`${$}:${Z||""}`;if(!t1.has(Y)){if(t1.size>=EG){let X=t1.keys().next().value;if(X)t1.delete(X)}t1.set(Y,new RegExp($,Z))}return t1.get(Y)}class Q8{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator($){let Z=Array.from(new Set($)),Y=Z.sort().join(","),X=this.pool.find((K)=>K.context.join(",")===Y);if(X)return X.func;let Q=this.fnCache,J=this.fnCacheMaxSize,G=(...K)=>{return(q)=>{try{let W=`${Y}:${q}`,z=Q.get(W);if(!z){if(Q.size>=J){let U=Q.keys().next().value;if(U)Q.delete(U)}z=Function(...Z,`
1940
1940
  'use strict';
1941
1941
  try {
1942
1942
  return ${q};
@@ -1947,33 +1947,33 @@ catch (e) {
1947
1947
  }
1948
1948
  throw e;
1949
1949
  }
1950
- `),Q.set(W,U)}return U(...K)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:G,context:Z.slice()});return G}clear(){this.pool.length=0,this.fnCache.clear()}}class J8{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function DG(){if(!R7)R7=new J8;return R7}var t1,IG=500,e_,R7=null,Q8;var $5=k(()=>{t1=new Map;e_=new X8;Q8=new Proxy({},{get($,Z){return DG()[Z]}})});function G8($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function K8($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=A7($),q=[],W=new Map;if(J)for(let U of K){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let B=z[1],_=`${Z}_${B}`;W.set(B,_)}}for(let U of K){let z=q8(U,Z,X,Q,W,G);q.push(z)}return q.join(`
1950
+ `),Q.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 G8{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled($){this.enabled=$}isEnabled(){return this.enabled}setBudget($,Z){this.budgets.set($,{warnThreshold:0.8,action:"warn",...Z})}setBudgets($){for(let[Z,Y]of Object.entries($))this.setBudget(Z,Y)}removeBudget($){this.budgets.delete($)}getBudgets(){let $={};for(let[Z,Y]of this.budgets.entries())$[Z]=Y;return $}onViolation($){this.violationHandlers.push($)}offViolation($){let Z=this.violationHandlers.indexOf($);if(Z!==-1)this.violationHandlers.splice(Z,1)}time($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}async timeAsync($,Z){if(!this.enabled)return Z();let Y=performance.now(),X=await Z(),Q=performance.now()-Y;return this.recordTime($,Q),this.checkBudget($,Q),X}checkBudget($,Z){let Y=this.budgets.get($);if(!Y)return;let X=Z/Y.maxTime*100,Q=Y.warnThreshold!==void 0?Z>=Y.maxTime*Y.warnThreshold&&Z<Y.maxTime:!1,J=Z>=Y.maxTime;if(!Q&&!J)return;let G={label:$,actualTime:Z,budgetTime:Y.maxTime,exceedancePercent:X,timestamp:new Date,isWarning:Q};this.violations.push(G);while(this.violations.length>this.maxViolations)this.violations.shift();for(let q of this.violationHandlers)try{q(G)}catch{}let K=Q?`[Performance Warning] "${$}" took ${Z.toFixed(2)}ms (${X.toFixed(1)}% of ${Y.maxTime}ms budget)`:`[Performance Budget Exceeded] "${$}" took ${Z.toFixed(2)}ms (exceeded ${Y.maxTime}ms budget by ${(X-100).toFixed(1)}%)`;switch(Y.action){case"log":console.log(K);break;case"warn":console.warn(K);break;case"error":console.error(K);break;case"throw":if(J)throw Error(K);else console.warn(K);break}}recordTime($,Z){let Y=this.metrics.get($);if(Y)Y.count++,Y.totalTime+=Z,Y.maxTime=Math.max(Y.maxTime,Z),Y.minTime=Math.min(Y.minTime,Z);else this.metrics.set($,{count:1,totalTime:Z,maxTime:Z,minTime:Z})}getStats($){if($){let Y=this.metrics.get($);if(!Y)return{};let X=this.budgets.get($);return{count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:X?.maxTime,budgetUtilization:X?Y.totalTime/Y.count/X.maxTime*100:void 0}}let Z={};for(let[Y,X]of this.metrics.entries()){let Q=this.budgets.get(Y);Z[Y]={count:X.count,avgTime:X.totalTime/X.count,totalTime:X.totalTime,maxTime:X.maxTime,minTime:X.minTime,budget:Q?.maxTime,budgetUtilization:Q?X.totalTime/X.count/Q.maxTime*100:void 0}}return Z}getViolations($){if($)return this.violations.filter((Z)=>Z.label===$);return[...this.violations]}getViolationStats(){let $={},Z=0,Y=0;for(let X of this.violations)if($[X.label]=($[X.label]||0)+1,X.isWarning)Z++;else Y++;return{total:this.violations.length,byLabel:$,warnings:Z,errors:Y}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function kG(){if(!R7)R7=new G8;return R7}var t1,EG=500,ZH,R7=null,K8;var $5=k(()=>{t1=new Map;ZH=new Q8;K8=new Proxy({},{get($,Z){return kG()[Z]}})});function q8($,Z=""){let Y=`${$}${Z}`,X=0;for(let Q=0;Q<Y.length;Q++){let J=Y.charCodeAt(Q);X=(X<<5)-X+J,X=X&X}return`stx-${Math.abs(X).toString(36)}`}function W8($,Z,Y={}){let{prefix:X="",preserveHost:Q=!0,scopeKeyframes:J=!0,scopeCustomProperties:G=!1}=Y;if(!$.trim())return"";let K=A7($),q=[],W=new Map;if(J)for(let z of K){let U=z.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(U){let B=U[1],_=`${Z}_${B}`;W.set(B,_)}}for(let z of K){let U=z8(z,Z,X,Q,W,G);q.push(U)}return q.join(`
1951
1951
 
1952
- `)}function A7($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,U,z,B]=W;if(U==="keyframes")Z.push({selector:`@keyframes ${z.trim()}`,declarations:B.trim()});else if(U==="media"||U==="supports"||U==="container"){let _=A7(B);Z.push({selector:`@${U} ${z.trim()}`,declarations:_.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
1953
- `)})}else Z.push({selector:`@${U} ${z.trim()}`,declarations:B.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function q8($,Z,Y,X,Q,J){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let U=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(U)||U} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let z=A7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>q8(B,Z,Y,X,Q,J)).join(`
1952
+ `)}function A7($){let Z=[],Y=$.replace(/\/\*[\s\S]*?\*\//g,""),X=0,Q="",J=!1,G="";for(let K=0;K<Y.length;K++){let q=Y[K];if(q==="@"&&X===0)J=!0;if(q==="{")X++;else if(q==="}"){if(X--,X===0){if(J){G+=q;let W=G.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(W){let[,z,U,B]=W;if(z==="keyframes")Z.push({selector:`@keyframes ${U.trim()}`,declarations:B.trim()});else if(z==="media"||z==="supports"||z==="container"){let _=A7(B);Z.push({selector:`@${z} ${U.trim()}`,declarations:_.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
1953
+ `)})}else Z.push({selector:`@${z} ${U.trim()}`,declarations:B.trim()})}G="",J=!1}else if(Q.trim()){Q+=q;let W=Q.match(/([^{]+)\{([^}]*)\}/);if(W)Z.push({selector:W[1].trim(),declarations:W[2].trim()});Q=""}continue}}if(J)G+=q;else Q+=q}return Z}function z8($,Z,Y,X,Q,J){let{selector:G,declarations:K}=$;if(G.startsWith("@")){if(G.startsWith("@keyframes")){let z=G.replace("@keyframes ","").trim();return`@keyframes ${Q.get(z)||z} { ${K} }`}if(G.startsWith("@media")||G.startsWith("@supports")||G.startsWith("@container")){let U=A7(`x { ${K} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((B)=>z8(B,Z,Y,X,Q,J)).join(`
1954
1954
  `);return`${G} {
1955
- ${z}
1956
- }`}return`${G} { ${K} }`}let q=EG(G,Z,Y,X),W=K;for(let[U,z]of Q)W=W.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(J)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function EG($,Z,Y,X){let Q=$.split(",").map((G)=>G.trim()),J=[];for(let G of Q){if(G.startsWith(":host")){if(X)J.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(W)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;J.push(`${K} ${G}`);let q=kG(G,Z);if(q)J.push(Y?`${Y} ${q}`:q)}return J.join(", ")}function kG($,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 Q=$.slice(0,X),J=$.slice(X);if(!Q)return"";let G=Q.length,K=0;for(let q=0;q<Q.length;q++){let W=Q[q];if(W==="["||W==="(")K++;else if(W==="]"||W===")")K--;else if(Y===0&&K===0&&W===":"){G=q;break}}return`${Q.slice(0,G)}.${Z}${Q.slice(G)}${J}`}function E$($,Z){if(!bG.test($))return{html:$,hasScoped:!1};let Y=G8(Z),X=`data-v-${Y}`,Q=$,J=new RegExp(`<style\\s+([^>]*${w7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let U=SG(W,X),z=q.replace(new RegExp(w7,"gi"),"").trim(),B=z?` ${z}`:"";return`<style data-stx-scoped="${Y}"${B}>${U}</style>`}),!G)return{html:$,hasScoped:!1};return Q=PG(Q,X),{html:Q,hasScoped:!0}}function SG($,Z){return K8($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function PG($,Z){let Y=r0($,(Q,J)=>{let G=W1(Q,J);return G>J?G:s1(Q,J)},(Q,J)=>yG(J)),X=CG(Y.output,Z);return W8.lastIndex=0,X.replace(W8,(Q,J)=>Y.tokens[Number(J)])}function CG($,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,Q,J)=>{if(Y.has(Q.toLowerCase()))return X;if(X.includes(Z))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Z}${J}`);if(X.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var w7,bG,yG=($)=>`\x00stx-scope-mask-${$}\x00`,W8;var N7=k(()=>{k1();w7=String.raw`(?<![\w-])scoped(?![\w-])`,bG=new RegExp(`<style\\s+[^>]*${w7}`,"i");W8=/\u0000stx-scope-mask-(\d+)\u0000/g});function xG($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return vG.test(Z)}function k$($){m5.lastIndex=0;let Z;while((Z=m5.exec($))!==null){if(Z[0].startsWith("</")||xG(Z[0]))continue;let Y=Z.index,X=m5.lastIndex,Q=1,J;while((J=m5.exec($))!==null)if(J[0].startsWith("</")){if(Q--,Q===0){let G=J.index;return{start:Y,openEnd:X,closeStart:G,end:m5.lastIndex,content:$.slice(X,G)}}}else Q++;return null}return null}var m5,vG;var T7=k(()=>{m5=/<\/?template\b[^>]*>/gi,vG=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var U8=()=>{};function b0($,Z,Y,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let W=$[J];if(G&&q){q=!1,J++;continue}if(G&&W==="\\"){q=!0,J++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,J++;continue}if(W===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&W==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&W==="}"){K--,J++;continue}if(W==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return J}J++}return-1}var D7={};r(D7,{useTitle:()=>mG,useSeoMeta:()=>z8,usePageTitle:()=>mG,useHead:()=>I7,seoMetaToHeadConfig:()=>S$,resetHead:()=>hG,renderHtmlAttrs:()=>lG,renderHead:()=>uG,renderBodyAttrs:()=>pG,processTitleDirective:()=>nG,processMetaDirective:()=>oG,processHeadDirective:()=>iG,mergeHeadConfigs:()=>Z5,getPageMeta:()=>gG,getHead:()=>M7,definePageMeta:()=>dG,applyHead:()=>cG});function M7(){return B1}function gG(){return b$}function hG(){B1={},fG.length=0,b$={}}function I7($){B1=Z5(B1,$)}function Z5($,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 z8($){I7(S$($))}function S$($){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 Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});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 dG($){if(b$={...b$,...$},$.title||$.description)z8({title:$.title,description:$.description})}function mG($){let Z=typeof $==="function"?$():$;I7({title:Z})}function uG($=B1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${b1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${b1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${b1(String(J))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${b1(String(J))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...Q}=Y,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${b1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${J}>${X}</script>`);else Z.push(`<script ${J}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
1957
- `)}function lG($=B1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${b1(Y)}"`).join(" ")}function pG($=B1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${b1(Y)}"`).join(" ")}function b1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function cG($=B1){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[Q,J]of Object.entries(Z))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function iG($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1958
- `,""}),headContent:Z.trim()}}function nG($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=Z5(K,{title:G}),""})}function oG($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,W=J?q:Z[(q||"").trim()]??q,z=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W},B=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=Z5(B,{meta:[z]}),""})}var B1,fG,b$;var u5=k(()=>{B1={},fG=[],b$={}});var y$={};r(y$,{stripTypeScript:()=>O8,hasVariables:()=>A8,extractVariables:()=>S1,extractScriptFromTemplate:()=>R8,convertToCommonJS:()=>k7});import Y5 from"path";import l5 from"process";function sG($){let Z=[],Y=0,X=$.split(`
1959
- `);for(let Q of X){let J=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let W=Q[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<Q.length&&Q[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(J===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let z=W[1].slice(1,-1).split(",").map((B)=>{let _=B.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((B)=>/^\w+$/.test(B));Z.push(...z)}}}}return[...new Set(Z)]}function O8($){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 Q=[],J="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let U=X[W];if(q){if(J+=U,U===q)q=null;continue}if(U==='"'||U==="'"||U==="`"){q=U,J+=U;continue}if(U==="<")G++;else if(U===">"&&G>0)G--;else if(U==="(")K++;else if(U===")")K--;if(U===","&&G===0&&K===0){Q.push(J),J="";continue}J+=U}if(J)Q.push(J);return Q.map((W)=>{let U=W.trim(),z=U.startsWith("..."),B=z?U.slice(3):U,_=-1,j=0;for(let A=0;A<B.length;A++)if(B[A]==="<")j++;else if(B[A]===">")j--;else if(B[A]===":"&&j===0){_=A;break}if(_===-1)return W;let L=B.substring(0,_).trim().replace(/\?$/,""),F=B.substring(_+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let R=z?"...":"";if(O!==-1)return`${R}${L} = ${F.substring(O+1).trim()}`;return`${R}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Y(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,W=0,U=null;while(q<Z.length&&K>0){let _=Z[q];if(U){if(_===U)U=null;q++;continue}if(_==='"'||_==="'"||_==="`"){U=_,q++;continue}if(_==="<")W++;else if(_===">"&&W>0)W--;else if(W===0){if(_==="(")K++;else if(_===")")K--}if(K>0)q++}if(K!==0)continue;let z=Z.substring(G+1,q);if(!z.includes(":"))continue;let B=Y(z);J.push({start:G+1,end:q,replacement:B})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.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,`
1955
+ ${U}
1956
+ }`}return`${G} { ${K} }`}let q=bG(G,Z,Y,X),W=K;for(let[z,U]of Q)W=W.replace(new RegExp(`\\b${z}\\b`,"g"),U);if(J)W=W.replace(/--([a-z-]+)/gi,`--${Z}-$1`);return`${q} { ${W} }`}function bG($,Z,Y,X){let Q=$.split(",").map((G)=>G.trim()),J=[];for(let G of Q){if(G.startsWith(":host")){if(X)J.push(G);else{let W=G.replace(/:host(\([^)]*\))?/,`.${Z}$1`);J.push(W)}continue}if(G.includes("::slotted")){J.push(G);continue}if(G===":root"){J.push(`:root .${Z}`);continue}let K=Y?`${Y} .${Z}`:`.${Z}`;J.push(`${K} ${G}`);let q=SG(G,Z);if(q)J.push(Y?`${Y} ${q}`:q)}return J.join(", ")}function SG($,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 Q=$.slice(0,X),J=$.slice(X);if(!Q)return"";let G=Q.length,K=0;for(let q=0;q<Q.length;q++){let W=Q[q];if(W==="["||W==="(")K++;else if(W==="]"||W===")")K--;else if(Y===0&&K===0&&W===":"){G=q;break}}return`${Q.slice(0,G)}.${Z}${Q.slice(G)}${J}`}function E$($,Z){if(!yG.test($))return{html:$,hasScoped:!1};let Y=q8(Z),X=`data-v-${Y}`,Q=$,J=new RegExp(`<style\\s+([^>]*${w7}[^>]*)>([\\s\\S]*?)</style>`,"gi"),G=!1;if(Q=Q.replace(J,(K,q,W)=>{G=!0;let z=PG(W,X),U=q.replace(new RegExp(w7,"gi"),"").trim(),B=U?` ${U}`:"";return`<style data-stx-scoped="${Y}"${B}>${z}</style>`}),!G)return{html:$,hasScoped:!1};return Q=vG(Q,X),{html:Q,hasScoped:!0}}function PG($,Z){return W8($,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${Z}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${Z}]`)}function vG($,Z){let Y=r0($,(Q,J)=>{let G=W1(Q,J);return G>J?G:s1(Q,J)},(Q,J)=>CG(J)),X=xG(Y.output,Z);return U8.lastIndex=0,X.replace(U8,(Q,J)=>Y.tokens[Number(J)])}function xG($,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,Q,J)=>{if(Y.has(Q.toLowerCase()))return X;if(X.includes(Z))return X;if(Q.toLowerCase()==="style"||Q.toLowerCase()==="script")return X;if(J)return X.replace(`<${Q}${J}`,`<${Q} ${Z}${J}`);if(X.endsWith("/>"))return`<${Q} ${Z} />`;return`<${Q} ${Z}>`})}var w7,yG,CG=($)=>`\x00stx-scope-mask-${$}\x00`,U8;var N7=k(()=>{k1();w7=String.raw`(?<![\w-])scoped(?![\w-])`,yG=new RegExp(`<style\\s+[^>]*${w7}`,"i");U8=/\u0000stx-scope-mask-(\d+)\u0000/g});function gG($){let Z=$.replace(/^<template\b/i,"").replace(/>$/,"");return fG.test(Z)}function k$($){m5.lastIndex=0;let Z;while((Z=m5.exec($))!==null){if(Z[0].startsWith("</")||gG(Z[0]))continue;let Y=Z.index,X=m5.lastIndex,Q=1,J;while((J=m5.exec($))!==null)if(J[0].startsWith("</")){if(Q--,Q===0){let G=J.index;return{start:Y,openEnd:X,closeStart:G,end:m5.lastIndex,content:$.slice(X,G)}}}else Q++;return null}return null}var m5,fG;var T7=k(()=>{m5=/<\/?template\b[^>]*>/gi,fG=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var B8=()=>{};function S0($,Z,Y,X=0){let Q=0,J=X,G=null,K=0,q=!1;while(J<$.length){let W=$[J];if(G&&q){q=!1,J++;continue}if(G&&W==="\\"){q=!0,J++;continue}if(q=!1,(W==='"'||W==="'"||W==="`")&&!G){G=W,J++;continue}if(W===G&&G!=="`"){G=null,J++;continue}if(G==="`"&&W==="$"&&$[J+1]==="{"){K++,J+=2;continue}if(K>0&&W==="}"){K--,J++;continue}if(W==="`"&&G==="`"&&K===0){G=null,J++;continue}if(G){J++;continue}if(W===Z)Q++;else if(W===Y){if(Q--,Q===0)return J}J++}return-1}var D7={};r(D7,{useTitle:()=>lG,useSeoMeta:()=>j8,usePageTitle:()=>lG,useHead:()=>I7,seoMetaToHeadConfig:()=>S$,resetHead:()=>mG,renderHtmlAttrs:()=>cG,renderHead:()=>pG,renderBodyAttrs:()=>iG,processTitleDirective:()=>sG,processMetaDirective:()=>rG,processHeadDirective:()=>oG,mergeHeadConfigs:()=>Z5,getPageMeta:()=>dG,getHead:()=>M7,definePageMeta:()=>uG,applyHead:()=>nG});function M7(){return B1}function dG(){return b$}function mG(){B1={},hG.length=0,b$={}}function I7($){B1=Z5(B1,$)}function Z5($,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 j8($){I7(S$($))}function S$($){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 Q=$.twitterTitle??$.title,J=$.twitterDescription??$.description,G=$.twitterImage??$.ogImage;if($.twitterCard)Z.push({name:"twitter:card",content:$.twitterCard});if(Q)Z.push({name:"twitter:title",content:Q});if(J)Z.push({name:"twitter:description",content:J});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 uG($){if(b$={...b$,...$},$.title||$.description)j8({title:$.title,description:$.description})}function lG($){let Z=typeof $==="function"?$():$;I7({title:Z})}function pG($=B1){let Z=[];if($.title){let Y=$.title;if($.titleTemplate)Y=typeof $.titleTemplate==="function"?$.titleTemplate(Y):$.titleTemplate.replace("%s",Y);Z.push(`<title>${b1(Y)}</title>`)}if($.base){let Y=Object.entries($.base).map(([X,Q])=>`${X}="${b1(Q)}"`).join(" ");Z.push(`<base ${Y}>`)}for(let Y of $.meta||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>{return`${Q==="httpEquiv"?"http-equiv":Q}="${b1(String(J))}"`}).join(" ");Z.push(`<meta ${X}>`)}for(let Y of $.link||[]){let X=Object.entries(Y).filter(([Q,J])=>J!==void 0).map(([Q,J])=>`${Q}="${b1(String(J))}"`).join(" ");Z.push(`<link ${X}>`)}for(let Y of $.script||[]){let{content:X,...Q}=Y,J=Object.entries(Q).filter(([G,K])=>K!==void 0).map(([G,K])=>{if(typeof K==="boolean")return K?G:"";return`${G}="${b1(String(K))}"`}).filter(Boolean).join(" ");if(X)Z.push(`<script ${J}>${X}</script>`);else Z.push(`<script ${J}></script>`)}for(let Y of $.style||[]){let X=Y.type?` type="${Y.type}"`:"";Z.push(`<style${X}>${Y.content}</style>`)}return Z.join(`
1957
+ `)}function cG($=B1){if(!$.htmlAttrs)return"";return Object.entries($.htmlAttrs).map(([Z,Y])=>`${Z}="${b1(Y)}"`).join(" ")}function iG($=B1){if(!$.bodyAttrs)return"";return Object.entries($.bodyAttrs).map(([Z,Y])=>`${Z}="${b1(Y)}"`).join(" ")}function b1($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function nG($=B1){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[Q,J]of Object.entries(Z))if(J!==void 0)X.setAttribute(Q,String(J))}if($.htmlAttrs)for(let[Z,Y]of Object.entries($.htmlAttrs))document.documentElement.setAttribute(Z,Y);if($.bodyAttrs)for(let[Z,Y]of Object.entries($.bodyAttrs))document.body.setAttribute(Z,Y)}function oG($){let Z="";return{content:$.replace(/@head\s*([\s\S]*?)@endhead/g,(X,Q)=>{return Z+=Q.trim()+`
1958
+ `,""}),headContent:Z.trim()}}function sG($,Z){return $.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Y,X,Q,J)=>{let G=X?Q:Z[(J||"").trim()]??J,K=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=Z5(K,{title:G}),""})}function rG($,Z){return $.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Y,X,Q,J,G,K)=>{let q=J?G:K,W=J?q:Z[(q||"").trim()]??q,U=Q.includes(":")?{property:Q,content:W}:{name:Q,content:W},B=Z.__stx_runtime_head??{};return Z.__stx_runtime_head=Z5(B,{meta:[U]}),""})}var B1,hG,b$;var u5=k(()=>{B1={},hG=[],b$={}});var y$={};r(y$,{stripTypeScript:()=>F8,hasVariables:()=>N8,extractVariables:()=>S1,extractScriptFromTemplate:()=>w8,convertToCommonJS:()=>k7});import Y5 from"path";import l5 from"process";function aG($){let Z=[],Y=0,X=$.split(`
1959
+ `);for(let Q of X){let J=Y,G=null,K=!1;for(let q=0;q<Q.length;q++){let W=Q[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<Q.length&&Q[q+1]==="/")break;if(W==="{")Y++;else if(W==="}")Y--}if(J===0){let q=Q.match(/(?:const|let|var)\s+(\w+)\s*=/);if(q)Z.push(q[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(Q)){let W=Q.match(/(?:const|let|var)\s+(\w+)/);if(W)Z.push(W[1])}else{let W=Q.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(W){let U=W[1].slice(1,-1).split(",").map((B)=>{let _=B.split(":");return(_.length>1?_[1]:_[0]).trim()}).filter((B)=>/^\w+$/.test(B));Z.push(...U)}}}}return[...new Set(Z)]}function F8($){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 Q=[],J="",G=0,K=0,q=null;for(let W=0;W<X.length;W++){let z=X[W];if(q){if(J+=z,z===q)q=null;continue}if(z==='"'||z==="'"||z==="`"){q=z,J+=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){Q.push(J),J="";continue}J+=z}if(J)Q.push(J);return Q.map((W)=>{let z=W.trim(),U=z.startsWith("..."),B=U?z.slice(3):z,_=-1,j=0;for(let A=0;A<B.length;A++)if(B[A]==="<")j++;else if(B[A]===">")j--;else if(B[A]===":"&&j===0){_=A;break}if(_===-1)return W;let L=B.substring(0,_).trim().replace(/\?$/,""),F=B.substring(_+1),O=-1,V=0;for(let A=0;A<F.length;A++)if(F[A]==="<")V++;else if(F[A]===">")V--;else if(F[A]==="="&&V===0){O=A;break}let R=U?"...":"";if(O!==-1)return`${R}${L} = ${F.substring(O+1).trim()}`;return`${R}${L}`}).join(", ")}Z=Z.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(X,Q,J)=>{if(!J.includes(":"))return X;return`${Q}(${Y(J)})`});{let X=/\b(function\s+\w*\s*)\(/g,Q,J=[];while((Q=X.exec(Z))!==null){let G=Q.index+Q[0].length-1,K=1,q=G+1,W=0,z=null;while(q<Z.length&&K>0){let _=Z[q];if(z){if(_===z)z=null;q++;continue}if(_==='"'||_==="'"||_==="`"){z=_,q++;continue}if(_==="<")W++;else if(_===">"&&W>0)W--;else if(W===0){if(_==="(")K++;else if(_===")")K--}if(K>0)q++}if(K!==0)continue;let U=Z.substring(G+1,q);if(!U.includes(":"))continue;let B=Y(U);J.push({start:G+1,end:q,replacement:B})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Z=Z.substring(0,K)+W+Z.substring(q)}}return Z=Z.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(X,Q)=>{if(!Q.includes(":"))return X;if(Q.includes("{")||Q.includes("}"))return X;return`(${Q.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,`
1960
1960
 
1961
- `),Z}async function S1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let y=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=y.transformSync(v)}catch{Q=O8($)}let J={exports:{}},G=J.exports,K=l5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((y)=>y[1]).filter((y)=>!y.startsWith("node:")&&!y.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(y));for(let y of W)try{let v=Y5.resolve(K,"node_modules",y),m=Y5.join(v,"package.json"),c=JSON.parse(q0("fs").readFileSync(m,"utf8")),K0=c.main||"index.js";if(c.exports){let B0=typeof c.exports==="string"?c.exports:c.exports["."];if(typeof B0==="string")K0=B0;else if(B0?.bun)K0=B0.bun;else if(B0?.import)K0=B0.import;else if(B0?.default)K0=B0.default}q[y]=await import(Y5.resolve(v,K0))}catch{}let U=(y)=>{if(q[y])return q[y];return q0(y)},z=Z.props||{},B=(y)=>{if(!y)return z;let v={};for(let[m,c]of Object.entries(y)){let K0=z[m];if(K0!==void 0)v[m]=K0;else if(typeof c==="function")v[m]=c();else v[m]=c}return v};for(let[y,v]of Object.entries(z))Object.defineProperty(B,y,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let y of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,y))continue;try{Object.defineProperty(B,y,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(y)=>{if(!y)return z;let v={...z};for(let[m,c]of Object.entries(y)){let K0=c&&typeof c==="object"&&!Array.isArray(c)?c:{type:c};if(v[m]===void 0&&K0.default!==void 0)v[m]=typeof K0.default==="function"?K0.default():K0.default}return v},j=()=>Z.slots||{},H=(y,v)=>{let m={...y};for(let[c,K0]of Object.entries(v))if(m[c]===void 0)if(typeof K0==="function")m[c]=K0();else m[c]=K0;return m},L=(y)=>{let v=()=>y;return v.set=(m)=>{},v.update=(m)=>{},v},F=(y)=>{let v,m=!1;return()=>{if(!m)try{v=y(),m=!0}catch{v=void 0}return v}},O=(y)=>{},V=(y)=>y(),R=(y)=>{},A=(y)=>{},w=(y)=>{},N=()=>{let y=Z.__stxServeContext,v=Z.__stxServeSearch??y?.search??"",m=y?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(v)),path:m,name:"",fullPath:m+v,hash:"",matched:[]}},T=()=>({push:(y)=>{},replace:(y)=>{},back:()=>{},forward:()=>{},go:(y)=>{}}),M=(y)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=Z5(v,y||{})},I=(y)=>{M(S$(y||{}))},E=(y)=>({value:y}),D=(y)=>y,P=(y)=>({value:typeof y==="function"?y():y}),S=(y,v)=>{},b=(y)=>{},C=(y)=>{},h=(y)=>y?y():Promise.resolve(),x=(y)=>(v,...m)=>{},u=(y)=>{},t=(y,v)=>{},X0=(y,v)=>v,$1=()=>({value:"light"}),f0=()=>L(!1),T0=(y)=>L(!1),Z0=()=>L(!1),A0=()=>T0("(prefers-color-scheme: dark)"),l0=()=>T0("(prefers-color-scheme: light)"),Z1=()=>T0("(prefers-reduced-motion: reduce)"),A1=()=>T0("(prefers-contrast: more)"),l={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:{}},s=new Proxy(l,{get(y,v){if(v in y)return y[v];return},set(y,v,m){return y[v]=m,!0}}),g={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},d=console;try{let y=k7(Q,Y),v=new Set(Object.keys(z)),m=(a)=>/^[a-z_$][\w$]*$/i.test(a),c=Object.keys(Z).filter((a)=>!v.has(a)&&a!=="props"&&m(a)),K0=c.map((a)=>Z[a]),B0=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"]),M0=[],g0=[];for(let[a,s0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(B0.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(y))continue;M0.push(a),g0.push(s0)}let U0=sG(y).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
1961
+ `),Z}async function S1($,Z,Y,X={}){if(!$.trim())return;let Q;try{let y=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()}),v=$.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");v=v.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),Q=y.transformSync(v)}catch{Q=F8($)}let J={exports:{}},G=J.exports,K=l5.cwd(),q={},W=[...Q.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((y)=>y[1]).filter((y)=>!y.startsWith("node:")&&!y.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(y));for(let y of W)try{let v=Y5.resolve(K,"node_modules",y),m=Y5.join(v,"package.json"),c=JSON.parse(q0("fs").readFileSync(m,"utf8")),K0=c.main||"index.js";if(c.exports){let B0=typeof c.exports==="string"?c.exports:c.exports["."];if(typeof B0==="string")K0=B0;else if(B0?.bun)K0=B0.bun;else if(B0?.import)K0=B0.import;else if(B0?.default)K0=B0.default}q[y]=await import(Y5.resolve(v,K0))}catch{}let z=(y)=>{if(q[y])return q[y];return q0(y)},U=Z.props||{},B=(y)=>{if(!y)return U;let v={};for(let[m,c]of Object.entries(y)){let K0=U[m];if(K0!==void 0)v[m]=K0;else if(typeof c==="function")v[m]=c();else v[m]=c}return v};for(let[y,v]of Object.entries(U))Object.defineProperty(B,y,{value:v,enumerable:!0,configurable:!0,writable:!0});for(let y of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(U,y))continue;try{Object.defineProperty(B,y,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let _=(y)=>{if(!y)return U;let v={...U};for(let[m,c]of Object.entries(y)){let K0=c&&typeof c==="object"&&!Array.isArray(c)?c:{type:c};if(v[m]===void 0&&K0.default!==void 0)v[m]=typeof K0.default==="function"?K0.default():K0.default}return v},j=()=>Z.slots||{},H=(y,v)=>{let m={...y};for(let[c,K0]of Object.entries(v))if(m[c]===void 0)if(typeof K0==="function")m[c]=K0();else m[c]=K0;return m},L=(y)=>{let v=()=>y;return v.set=(m)=>{},v.update=(m)=>{},v},F=(y)=>{let v,m=!1;return()=>{if(!m)try{v=y(),m=!0}catch{v=void 0}return v}},O=(y)=>{},V=(y)=>y(),R=(y)=>{},A=(y)=>{},w=(y)=>{},N=()=>{let y=Z.__stxServeContext,v=Z.__stxServeSearch??y?.search??"",m=y?.path??"";return{params:Z.params??{},query:Object.fromEntries(new URLSearchParams(v)),path:m,name:"",fullPath:m+v,hash:"",matched:[]}},T=()=>({push:(y)=>{},replace:(y)=>{},back:()=>{},forward:()=>{},go:(y)=>{}}),M=(y)=>{let v=Z.__stx_runtime_head||{};Z.__stx_runtime_head=Z5(v,y||{})},I=(y)=>{M(S$(y||{}))},E=(y)=>({value:y}),D=(y)=>y,P=(y)=>({value:typeof y==="function"?y():y}),S=(y,v)=>{},b=(y)=>{},C=(y)=>{},h=(y)=>y?y():Promise.resolve(),x=(y)=>(v,...m)=>{},u=(y)=>{},t=(y,v)=>{},X0=(y,v)=>v,$1=()=>({value:"light"}),f0=()=>L(!1),T0=(y)=>L(!1),Z0=()=>L(!1),A0=()=>T0("(prefers-color-scheme: dark)"),l0=()=>T0("(prefers-color-scheme: light)"),Z1=()=>T0("(prefers-reduced-motion: reduce)"),A1=()=>T0("(prefers-contrast: more)"),l={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:{}},s=new Proxy(l,{get(y,v){if(v in y)return y[v];return},set(y,v,m){return y[v]=m,!0}}),g={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},d=console;try{let y=k7(Q,Y),v=new Set(Object.keys(U)),m=(a)=>/^[a-z_$][\w$]*$/i.test(a),c=Object.keys(Z).filter((a)=>!v.has(a)&&a!=="props"&&m(a)),K0=c.map((a)=>Z[a]),B0=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"]),M0=[],g0=[];for(let[a,s0]of Object.entries(U)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(B0.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(y))continue;M0.push(a),g0.push(s0)}let z0=aG(y).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
1962
1962
  `),K1=Z.params??{},p0=[],w1=[];for(let a=0;a<c.length;a++){if(c[a]==="params")continue;p0.push(c[a]),w1.push(K0[a])}let h0=await Function("module","exports","require","props","$props","defineProps","withDefaults","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params",...M0,...p0,`return (async () => {
1963
1963
  ${y}
1964
- ${U0}
1964
+ ${z0}
1965
1965
  return module.exports
1966
- })()`)(J,G,U,z,B,_,H,L,F,O,V,R,A,w,N,T,M,I,E,D,P,S,b,C,h,x,u,j,t,X0,$1,f0,T0,Z0,A0,l0,Z1,A1,s,g,d,l.confirm,l.alert,l.fetch,K1,...g0,...w1);if(X.preserveExisting){for(let[a,s0]of Object.entries(h0))if(!(a in Z)||Z[a]===void 0)Z[a]=s0}else Object.assign(Z,h0);for(let[a,s0]of Object.entries(z))if(!(a in Z))Z[a]=s0}catch(y){if(l5.env.STX_DEBUG){let v=y instanceof Error?y.message:String(y);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`)}try{await $K(Q,Z,Y)}catch(v){if(l5.env.STX_DEBUG){let m=v instanceof Error?v.message:String(v);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${m}`)}}}}function k7($,Z){let Y=Z?Y5.dirname(Z):l5.cwd(),X=$.split(`
1967
- `),Q=[],J=0;while(J<X.length){let G=X[J].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;J<X.length;J++){for(let q of X[J])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}J++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let W=J;W<X.length&&!q;W++){let U=null,z=!1,B=X[W];for(let _=0;_<B.length;_++){let j=B[_];if(z){z=!1;continue}if(j==="\\"){z=!0;continue}if(U){if(j===U)U=null;continue}if(j==='"'||j==="'"||j==="`"){U=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){J=W+1,q=!0;break}}}}if(!q)J=X.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+['"](.+)['"]/),U=(z)=>{if(z.startsWith("."))return Y5.resolve(Y,z);return z};if(K){let[,z,B]=K,_=U(B);Q.push(`const ${z} = await import('${_}')`),Q.push(`module.exports.${z} = ${z};`)}else if(q){let[,z,B]=q,_=z.trim(),j=U(B);Q.push(`const { ${_} } = await import('${j}')`);for(let H of _.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(W){let z=U(W[1]);Q.push(`await import('${z}')`)}else Q.push(G);J++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))Q.push(X[J]),J++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=B8(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=E7(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=B8(X,J),{type:q,name:W,value:U}=K;Q.push(`${q} ${W} = ${U};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=E7(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[J].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[J]=K;let W=E7(q,J);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);J=W.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),J++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=X[J].replace(/^export\s+/,""),U=0,z=J;for(;z<X.length;z++){let B=X[z];for(let _ of B)if(_==="{")U++;else if(_==="}")U--;if(z>J)W+=`
1968
- `+B;if(U<=0&&z>=J)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),J=z+1}else Q.push(G),J++}else if(G.includes("module.exports"))Q.push(G),J++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),J++;else J++}return rG(Q.join(`
1969
- `),Y)}function rG($,Z){let Y=$.length,X="",Q=0,J=null,G=!1,K=!1,q=0;while(Q<Y){let W=$[Q],U=$[Q+1];if(G){if(X+=W,W===`
1970
- `)G=!1;Q++;continue}if(K){if(X+=W,W==="*"&&U==="/"){X+=U,Q+=2,K=!1;continue}Q++;continue}if(!J&&W==="/"&&U==="/"){G=!0,X+=W,Q++;continue}if(!J&&W==="/"&&U==="*"){K=!0,X+=W,Q++;continue}if(J){if(X+=W,W==="\\"){X+=U,Q+=2;continue}if(W===J&&J!=="`"){J=null,Q++;continue}if(J==="`"){if(W==="$"&&U==="{"){q++,X+=U,Q+=2;continue}if(W==="`"){J=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){J=W,X+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let z=aG($,Q);if(z){let{quote:B,path:_,end:j}=z;if(_.startsWith(".")){let H=Y5.resolve(Z,_);X+=`await import(${B}${H}${B})`,Q=j;continue}}}X+=W,Q++}return X}function aG($,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 Q=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let J=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:J,end:Y+1}}function L8($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=b0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function F8($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,Q=0,J="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=L8(Y,X);if(K){let q=F8(K.pattern);Z.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Z.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Z.push(J.trim());J="",X++;while(X<Y.length&&Y[X]!==","&&Q===0){if(Y[X]==="{"||Y[X]==="[")Q++;else if(Y[X]==="}"||Y[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Z.push(J.trim());return Z}function B8($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!X){let W=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let U=Y.slice(W[0].length),z=Z;if((U.startsWith("{")||U.startsWith("["))&&!U.includes(U.startsWith("{")?"}":"]")){let _=U.startsWith("{")?"}":"]",j=U;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),z=H,$[H].includes(_))break;U=j}let B=L8(U,0);if(B){let _=W[1],j=B.pattern,H=U.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(z,Z);if(j8(L)){let w=_8($,O,L);F=w.value,O=w.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=F8(j),R=`__stx_src_${Z}`,A=V.map((w)=>`module.exports.${w} = ${w};`).join(`
1966
+ })()`)(J,G,z,U,B,_,H,L,F,O,V,R,A,w,N,T,M,I,E,D,P,S,b,C,h,x,u,j,t,X0,$1,f0,T0,Z0,A0,l0,Z1,A1,s,g,d,l.confirm,l.alert,l.fetch,K1,...g0,...w1);if(X.preserveExisting){for(let[a,s0]of Object.entries(h0))if(!(a in Z)||Z[a]===void 0)Z[a]=s0}else Object.assign(Z,h0);for(let[a,s0]of Object.entries(U))if(!(a in Z))Z[a]=s0}catch(y){if(l5.env.STX_DEBUG){let v=y instanceof Error?y.message:String(y);console.warn(`[stx] server <script> did not execute in ${Y??"<unknown>"} \u2014 falling back to static extraction. Cause: ${v}`)}try{await YK(Q,Z,Y)}catch(v){if(l5.env.STX_DEBUG){let m=v instanceof Error?v.message:String(v);console.warn(`[stx] fallback extraction also failed in ${Y??"<unknown>"}: ${m}`)}}}}function k7($,Z){let Y=Z?Y5.dirname(Z):l5.cwd(),X=$.split(`
1967
+ `),Q=[],J=0;while(J<X.length){let G=X[J].trim();if(G.startsWith("interface ")||G.startsWith("export interface ")||G.startsWith("type ")||G.startsWith("export type ")){if(G.includes("{")&&!G.includes("}")){let K=0;for(;J<X.length;J++){for(let q of X[J])if(q==="{")K++;else if(q==="}")K--;if(K<=0)break}}J++;continue}if(G.startsWith("definePageMeta(")){let K=0,q=!1;for(let W=J;W<X.length&&!q;W++){let z=null,U=!1,B=X[W];for(let _=0;_<B.length;_++){let j=B[_];if(U){U=!1;continue}if(j==="\\"){U=!0;continue}if(z){if(j===z)z=null;continue}if(j==='"'||j==="'"||j==="`"){z=j;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0){J=W+1,q=!0;break}}}}if(!q)J=X.length;continue}if(G.startsWith("import ")){let K=G.match(/^import\s+(\w+)\s+from\s+['"](.+)['"]/),q=G.match(/^import\s+\{([^}]+)\}\s+from\s+['"](.+)['"]/),W=G.match(/^import\s+['"](.+)['"]/),z=(U)=>{if(U.startsWith("."))return Y5.resolve(Y,U);return U};if(K){let[,U,B]=K,_=z(B);Q.push(`const ${U} = await import('${_}')`),Q.push(`module.exports.${U} = ${U};`)}else if(q){let[,U,B]=q,_=U.trim(),j=z(B);Q.push(`const { ${_} } = await import('${j}')`);for(let H of _.split(",")){let L=H.trim().split(/\s+as\s+/).pop()?.trim();if(L)Q.push(`module.exports.${L} = ${L};`)}}else if(W){let U=z(W[1]);Q.push(`await import('${U}')`)}else Q.push(G);J++;continue}if((G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")||G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var "))&&!G.includes("="))Q.push(X[J]),J++;else if(G.startsWith("export const ")||G.startsWith("export let ")||G.startsWith("export var ")){let K=_8(X,J),{type:q,name:W,value:z}=K;Q.push(`${q} ${W} = ${z};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("export function ")||G.startsWith("export async function ")){let K=E7(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("const ")||G.startsWith("let ")||G.startsWith("var ")){let K=_8(X,J),{type:q,name:W,value:z}=K;Q.push(`${q} ${W} = ${z};`),Q.push(`module.exports.${W} = ${W};`),J=K.nextIndex}else if(G.startsWith("function ")||G.startsWith("async function ")){let K=E7(X,J);Q.push(K.functionCode),Q.push(`module.exports.${K.name} = ${K.name};`),J=K.nextIndex}else if(G.startsWith("export default function ")||G.startsWith("export default async function ")){let K=X[J].replace(/^(\s*)export\s+default\s+/,"$1"),q=[...X];q[J]=K;let W=E7(q,J);if(Q.push(W.functionCode),W.name)Q.push(`module.exports.default = ${W.name};`);J=W.nextIndex}else if(G.startsWith("export default ")){let K=G.replace(/^export\s+default\s+/,"").replace(/;$/,"");Q.push(`module.exports.default = ${K};`),J++}else if(G.startsWith("class ")||G.startsWith("export class ")){let K=G.match(/(?:export\s+)?class\s+(\w+)/);if(K){let q=K[1],W=X[J].replace(/^export\s+/,""),z=0,U=J;for(;U<X.length;U++){let B=X[U];for(let _ of B)if(_==="{")z++;else if(_==="}")z--;if(U>J)W+=`
1968
+ `+B;if(z<=0&&U>=J)break}Q.push(W),Q.push(`module.exports.${q} = ${q};`),J=U+1}else Q.push(G),J++}else if(G.includes("module.exports"))Q.push(G),J++;else if(G.trim()&&!G.startsWith("//"))Q.push(G),J++;else J++}return tG(Q.join(`
1969
+ `),Y)}function tG($,Z){let Y=$.length,X="",Q=0,J=null,G=!1,K=!1,q=0;while(Q<Y){let W=$[Q],z=$[Q+1];if(G){if(X+=W,W===`
1970
+ `)G=!1;Q++;continue}if(K){if(X+=W,W==="*"&&z==="/"){X+=z,Q+=2,K=!1;continue}Q++;continue}if(!J&&W==="/"&&z==="/"){G=!0,X+=W,Q++;continue}if(!J&&W==="/"&&z==="*"){K=!0,X+=W,Q++;continue}if(J){if(X+=W,W==="\\"){X+=z,Q+=2;continue}if(W===J&&J!=="`"){J=null,Q++;continue}if(J==="`"){if(W==="$"&&z==="{"){q++,X+=z,Q+=2;continue}if(W==="`"){J=null,Q++;continue}}Q++;continue}if(q>0){if(W==="{")q++;else if(W==="}")q--}if(W==='"'||W==="'"||W==="`"){J=W,X+=W,Q++;continue}if(W==="a"&&$.startsWith("await",Q)){let U=eG($,Q);if(U){let{quote:B,path:_,end:j}=U;if(_.startsWith(".")){let H=Y5.resolve(Z,_);X+=`await import(${B}${H}${B})`,Q=j;continue}}}X+=W,Q++}return X}function eG($,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 Q=Y;while(Y<$.length&&$[Y]!==X)if($[Y]==="\\")Y+=2;else Y++;if(Y>=$.length)return null;let J=$.slice(Q,Y);Y++;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!==")")return null;return{quote:X,path:J,end:Y+1}}function V8($,Z){let Y=$[Z];if(Y!=="{"&&Y!=="[")return null;let Q=S0($,Y,Y==="{"?"}":"]",Z);if(Q===-1)return null;return{pattern:$.slice(Z,Q+1),endPos:Q+1}}function R8($){let Z=[],Y=$.slice(1,-1).trim();if(!Y)return Z;let X=0,Q=0,J="";while(X<Y.length){let G=Y[X];if(G==="{"||G==="["){if(Q++,Q===1){let K=V8(Y,X);if(K){let q=R8(K.pattern);Z.push(...q),X=K.endPos,J="";continue}}}else if(G==="}"||G==="]")Q--;if(Q>0){X++;continue}if(G===","){if(J.trim())Z.push(J.trim());J="",X++;continue}if(G===":"){J="",X++;continue}if(G==="="){if(J.trim())Z.push(J.trim());J="",X++;while(X<Y.length&&Y[X]!==","&&Q===0){if(Y[X]==="{"||Y[X]==="[")Q++;else if(Y[X]==="}"||Y[X]==="]")Q--;X++}continue}if(/[\w$]/.test(G))J+=G;X++}if(J.trim())Z.push(J.trim());return Z}function _8($,Z){let Y=$[Z].trim(),X=Y.match(/^(?:export\s+)?(const|let|var)\s+(\w+)\s*=\s*(.*)$/);if(!X){let W=Y.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let z=Y.slice(W[0].length),U=Z;if((z.startsWith("{")||z.startsWith("["))&&!z.includes(z.startsWith("{")?"}":"]")){let _=z.startsWith("{")?"}":"]",j=z;for(let H=Z+1;H<$.length;H++)if(j+=" "+$[H].trim(),U=H,$[H].includes(_))break;z=j}let B=V8(z,0);if(B){let _=W[1],j=B.pattern,H=z.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),F=L,O=Math.max(U,Z);if(H8(L)){let w=O8($,O,L);F=w.value,O=w.nextIndex}else O=O+1;F=F.trim().replace(/;$/,"");let V=R8(j),R=`__stx_src_${Z}`,A=V.map((w)=>`module.exports.${w} = ${w};`).join(`
1971
1971
  `);return{type:_,name:R,value:`${F}; ${_} ${j} = ${R};
1972
- ${A}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,J,G]=X,K=G,q=Z;if(j8(G)){let W=_8($,Z,G);K=W.value,q=W.nextIndex}else q=Z+1;while(q<$.length){let W=$[q].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
1973
- ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:J,value:K,nextIndex:q}}function E7($,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[,Q]=X,J=Y.replace(/^export\s+/,""),G=Z;if(tG(Y)){let K=eG($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function j8($){let Z=$.trim();if(Z.startsWith("{"))return b0(Z,"{","}",0)===-1;if(Z.startsWith("["))return b0(Z,"[","]",0)===-1;return!V8(Z)}function V8($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Y)continue;if((J==='"'||J==="'")&&!Y){Y=J;continue}if(J===Y&&Y!=="`"){Y=null;continue}if(J==="`"&&!Y){Y="`";continue}if(J==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Y)continue;if(J==="(")Z.paren++;else if(J===")")Z.paren--;else if(J==="[")Z.bracket++;else if(J==="]")Z.bracket--;else if(J==="{")Z.brace++;else if(J==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function tG($){let Z=$.indexOf("{");if(Z===-1)return!0;return b0($,"{","}",Z)===-1}function _8($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!V8(X)){let J=$[Q];X+=`
1972
+ ${A}`,nextIndex:O}}}}throw Error(`Failed to parse variable declaration: ${Y}`)}let[,Q,J,G]=X,K=G,q=Z;if(H8(G)){let W=O8($,Z,G);K=W.value,q=W.nextIndex}else q=Z+1;while(q<$.length){let W=$[q].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
1973
+ ${$[q]}`,q++;else break}return K=K.trim().replace(/;$/,""),{type:Q,name:J,value:K,nextIndex:q}}function E7($,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[,Q]=X,J=Y.replace(/^export\s+/,""),G=Z;if($K(Y)){let K=ZK($,Z,J);J=K.functionCode,G=K.nextIndex}else G=Z+1;return{name:Q,functionCode:J,nextIndex:G}}function H8($){let Z=$.trim();if(Z.startsWith("{"))return S0(Z,"{","}",0)===-1;if(Z.startsWith("["))return S0(Z,"[","]",0)===-1;return!A8(Z)}function A8($){let Z={paren:0,bracket:0,brace:0},Y=null,X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if((Q>0?$[Q-1]:"")==="\\"&&Y)continue;if((J==='"'||J==="'")&&!Y){Y=J;continue}if(J===Y&&Y!=="`"){Y=null;continue}if(J==="`"&&!Y){Y="`";continue}if(J==="`"&&Y==="`"&&X===0){Y=null;continue}if(Y==="`"&&J==="$"&&$[Q+1]==="{"){X++,Q++;continue}if(X>0&&J==="{"){X++;continue}if(X>0&&J==="}"){X--;continue}if(Y)continue;if(J==="(")Z.paren++;else if(J===")")Z.paren--;else if(J==="[")Z.bracket++;else if(J==="]")Z.bracket--;else if(J==="{")Z.brace++;else if(J==="}")Z.brace--}return Z.paren===0&&Z.bracket===0&&Z.brace===0&&Y===null}function $K($){let Z=$.indexOf("{");if(Z===-1)return!0;return S0($,"{","}",Z)===-1}function O8($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length&&!A8(X)){let J=$[Q];X+=`
1974
1974
  ${J}`,Q++}while(Q<$.length){let J=$[Q].trim();if(J.startsWith(".")||J.startsWith("?."))X+=`
1975
- ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function eG($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(b0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1976
- ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function H8($,Z){let Y=Y0($,Z)??Y0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...l5.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 $K($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let J of X){let[,,G,K]=J;try{let q=K.trim().replace(/;$/,""),W=H8(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let J of Q){let[,,G,K]=J;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=H8(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function R8($){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 A8($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var p5=k(()=>{u5();M1();F0()});var b7={};r(b7,{renderSlot:()=>N8,processSlots:()=>M8,parseSlots:()=>w8,parseSlotElement:()=>QK,extractSlotContent:()=>qK,applySlots:()=>WK});function ZK($,Z){let Y=1,X=Z,Q="<template",J="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Y++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function XK($,Z){let Y=null;for(let X=Z;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"){Y=Q;continue}if(Q===">")return X+1}return-1}function JK($){let Z=[],Y=[],X=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;if($.startsWith("<!--",J)){let B=$.indexOf("-->",J+4);Q=B===-1?$.length:B+3;continue}let G=XK($,J+1);if(G===-1)break;let K=$.slice(J,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){Q=G;continue}let W=q[1]==="/",U=q[2].toLowerCase();if(W){let B=Y.lastIndexOf(U);if(B!==-1)Y.splice(B);Q=G;continue}if(U==="template"&&Y.length===0){let B=K.match(X);if(B){let _=ZK($,G);if(_!==-1){let j=B[1]||B[2]||B[3];Z.push({start:J,end:_,slotName:j,content:$.slice(G,_-11).trim(),propsBinding:B[4]||void 0}),Q=_;continue}}}if(!/\/\s*>$/.test(K)&&!YK.has(U)){if(Y.push(U),U==="script"||U==="style"){let B=$.toLowerCase().indexOf(`</${U}>`,G);if(B!==-1){Q=B;continue}}}Q=G}return Z}function w8($){let Z={default:"",named:new Map},Y=$,X=JK($);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 Q=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=J.exec(Y))!==null){let[q,W,U,z,B,_]=G,j=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(j+H).trim(),F=`<${W}${L?" "+L:""}>${_}</${W}>`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:F})}let K=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((G=K.exec(Y))!==null){let[q,W,U,z,B]=G,_=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+j).trim(),L=`<${W}${H?" "+H:""} />`;Q.push({start:G.index,end:G.index+q.length,slotName:z,element:L})}Q.sort((q,W)=>W.start-q.start);for(let q of Q){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 QK($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,J;while((J=Q.exec($))!==null)X[J[1]]=J[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function N8($,Z,Y,X){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let J=$.propsBinding.trim(),G={...X};if(J.startsWith("{")&&J.endsWith("}")){let K=J.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,U]=q.split(":").map((B)=>B.trim()),z=U||W;if(Z[W]!==void 0)G[z]=Z[W]}}else G[J]=Z;Q=GK(Q,G)}return Q}function GK($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=T8(Q,Z);return i0(String(J??""))}catch{return`{{ ${X} }}`}})}function T8($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Z;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,Q,J]=Y,G=Z[X],K=parseInt(J,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!J0($))return;return Q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function M8($,Z,Y){let X=$;X=await KK(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let U=Z.named.get(K),z=W?.trim()||"",B=q||"",_={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(B))!==null){let L=H[1],F=H[2];_[L]=T8(F,Y)}return await N8(U,_,z,Y)});let J=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(J,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function KK($,Z,Y){let X=[],Q=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return Q.push({match:K,index:W}),X.push(Y(K,...q.slice(0,-2))),K});let J=await Promise.all(X),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:W}=Q[K];G=G.slice(0,W)+J[K]+G.slice(W+q.length)}return G}function qK($){let Z=w8($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function WK($,Z,Y,X){return await M8($,{default:Z,named:Y},X)}var YK;var S7=k(()=>{a0();F0();YK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function j1($,Z){let Y=UK($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function UK($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=b0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function zK($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function y1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),W=K.exec($),U=q?q.index:1/0,z=W?W.index:1/0;if(U<z)Q++,J=U+q[0].length;else if(z<1/0){if(Q--,Q===0)return z;J=z+W[0].length}else break}return-1}function I8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=j1($,X);if(!Q)return null;let J=Q.endPos,G=y1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U="if",z=Q.expression,B=0,_=0;while(W<K.length){let j=K.indexOf("@",W);if(j===-1)break;W=j;let H=K.substring(j);if(zK(K,j)){W++;continue}if(/^@if\s*\(/.test(H)){_++,W++;continue}if(/^@endif(?![a-z])/.test(H)){_--,W+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W});let F=W+L[0].length,O=j1(K,F);if(!O){W++;continue}U="elseif",z=O.expression,W=O.endPos,B=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:U,condition:z,content:K.substring(B,W),start:J+B,end:J+W}),U="else",z=void 0,W+=5,B=W;continue}}W++}return q.push({type:U,condition:z,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function c5($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let J=I8($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function P$($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,W=b0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let U=$.slice(q+1,W),z=W+1,B=y1($,Z,Y,z);if(B===-1){J=Q.exec($);continue}let _=$.slice(z,B),j=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:U,content:_,start:K,end:j}),Q.lastIndex=j,J=Q.exec($)}return X}function y7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=j1($,X);if(!Q)return null;let J=Q.endPos,G=y1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,U=null,z=0;while(W<K.length){let B=K.slice(W),_=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(_){if(z++,U)U.content+=_[0];W+=_[0].length;continue}if(j){if(z--,U)U.content+=j[0];W+=j[0].length;continue}if(z>0){if(U)U.content+=K[W];W++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(U)q.push(U);let O=W+H[0].length,V=j1(K,O);if(!V){W++;continue}U={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&B.startsWith("@default")){if(U)q.push(U);U={type:"default",content:""},W+=L[0].length}else if(F&&B.startsWith("@break"))W+=F[0].length;else{if(U)U.content+=K[W];W++}}if(U)q.push(U);return{fullMatch:$.slice(Z,G+10),expression:Q.expression,cases:q,start:Z,end:G+10}}var D8=()=>{};var E8=()=>{};var C$=k(()=>{D8();E8()});function f$($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(C0)X.add(C0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),i5)X.forEach((K)=>x$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),set:(J)=>Q.set(J),configurable:!0}),Q}function g$($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,i5)X.forEach((G)=>x$.add(G));else X.forEach((G)=>G())},J=()=>{if(C0)X.add(C0);if(Y){let G=C0;C0=Q,v$.push(Q);try{Z=$()}finally{v$.pop(),C0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),configurable:!0}),J}function h$($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=C0;C0=Q,v$.push(Q);try{Y=$()}finally{v$.pop(),C0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function P7($){if(i5){$();return}i5=!0;try{$()}finally{i5=!1,x$.forEach((Z)=>Z()),x$.clear()}}function C7($){HK.push($)}function v7($){OK.push($)}function d$($){return typeof $==="function"&&$._isSignal===!0}function m$($){return typeof $==="function"&&$._isDerived===!0}function x7($){if(d$($)||m$($))return $();return $}function u$($){let Z=C0;C0=null;try{return $()}finally{C0=Z}}function LK($,Z){let Y=typeof $==="function"?$:()=>$,X=f$([]),Q=g$(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return h$(()=>{if(Y(),!J){J=!0;return}if(u$(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let U=()=>{let z=X().filter((B)=>B!==W);if(z.length!==X().length)X.set(z)};if(q&&typeof q.then==="function")Promise.resolve(q).then(U,U);return U}]}var C0=null,v$,i5=!1,x$,HK,OK;var f7=k(()=>{v$=[],x$=new Set,HK=[],OK=[]});var b8={};r(b8,{useOptimistic:()=>LK,untrack:()=>x7,state:()=>f$,peek:()=>u$,onMount:()=>C7,onDestroy:()=>v7,isSignal:()=>d$,isDerived:()=>m$,generateSignalsRuntimeDev:()=>l$,generateSignalsRuntime:()=>k8,effect:()=>h$,derived:()=>g$,default:()=>VK,batch:()=>P7});function k8(){try{let $=FK(l$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return l$()}}function FK($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let Q=$.indexOf(X,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let J=1,G=Q+X.length;while(G<$.length&&J>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")J++;else if(K===")")J--;G++}Z.push("0"),Y=G}return Z.join("")}function l$(){return`
1975
+ ${$[Q]}`,Q++;else break}return{value:X,nextIndex:Q}}function ZK($,Z,Y){let X=Y,Q=Z+1;while(Q<$.length){let J=X.indexOf("{");if(J!==-1){if(S0(X,"{","}",J)!==-1)break}let G=$[Q];X+=`
1976
+ ${G}`,Q++}return{functionCode:X,nextIndex:Q}}function L8($,Z){let Y=Y0($,Z)??Y0(`(${$})`,Z);if(Y!==void 0)return Y;if(!/\bprocess\b/.test($))return;let X={...Z,process:Object.freeze({env:{...l5.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 YK($,Z,Y){let X=$.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let J of X){let[,,G,K]=J;try{let q=K.trim().replace(/;$/,""),W=L8(q,Z);if(W!==void 0)Z[G]=W}catch(q){console.warn(`Failed to parse export ${G} in fallback:`,q)}}let Q=$.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let J of Q){let[,,G,K]=J;if(!(G in Z))try{let q=K.trim().replace(/;$/,""),W=L8(q,Z);if(W!==void 0)Z[G]=W}catch{}}}function w8($){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 N8($){let Z=$.trim();if(!Z)return!1;return/(?:const|let|var|function)\s+\w+/.test(Z)}var p5=k(()=>{u5();M1();F0()});var b7={};r(b7,{renderSlot:()=>M8,processSlots:()=>D8,parseSlots:()=>T8,parseSlotElement:()=>KK,extractSlotContent:()=>zK,applySlots:()=>UK});function XK($,Z){let Y=1,X=Z,Q="<template",J="</template";while(X<$.length&&Y>0){let G=$.indexOf("<",X);if(G===-1)break;if(X=G,$.startsWith(Q,X)&&(X+Q.length>=$.length||/[\s>\/]/.test($[X+Q.length]))){Y++,X+=Q.length;continue}if($.startsWith(J,X)){let K=$.indexOf(">",X+J.length);if(K!==-1){if(Y--,Y===0)return K+1;X=K+1;continue}}X++}return Y===0?X:-1}function QK($,Z){let Y=null;for(let X=Z;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"){Y=Q;continue}if(Q===">")return X+1}return-1}function GK($){let Z=[],Y=[],X=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;if($.startsWith("<!--",J)){let B=$.indexOf("-->",J+4);Q=B===-1?$.length:B+3;continue}let G=QK($,J+1);if(G===-1)break;let K=$.slice(J,G),q=K.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!q){Q=G;continue}let W=q[1]==="/",z=q[2].toLowerCase();if(W){let B=Y.lastIndexOf(z);if(B!==-1)Y.splice(B);Q=G;continue}if(z==="template"&&Y.length===0){let B=K.match(X);if(B){let _=XK($,G);if(_!==-1){let j=B[1]||B[2]||B[3];Z.push({start:J,end:_,slotName:j,content:$.slice(G,_-11).trim(),propsBinding:B[4]||void 0}),Q=_;continue}}}if(!/\/\s*>$/.test(K)&&!JK.has(z)){if(Y.push(z),z==="script"||z==="style"){let B=$.toLowerCase().indexOf(`</${z}>`,G);if(B!==-1){Q=B;continue}}}Q=G}return Z}function T8($){let Z={default:"",named:new Map},Y=$,X=GK($);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 Q=[],J=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,G;while((G=J.exec(Y))!==null){let[q,W,z,U,B,_]=G,j=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),L=(j+H).trim(),F=`<${W}${L?" "+L:""}>${_}</${W}>`;Q.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,B]=G,_=z.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=B.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(_+j).trim(),L=`<${W}${H?" "+H:""} />`;Q.push({start:G.index,end:G.index+q.length,slotName:U,element:L})}Q.sort((q,W)=>W.start-q.start);for(let q of Q){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 KK($){let Z=$.match(/name\s*=\s*["']([^"']+)["']/),Y=Z?Z[1]:"",X={},Q=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,J;while((J=Q.exec($))!==null)X[J[1]]=J[2];let G=$.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),K=G?G[1].trim():"";return{name:Y,props:X,defaultContent:K}}async function M8($,Z,Y,X){if(!$)return Y;let Q=$.content;if($.propsBinding&&Object.keys(Z).length>0){let J=$.propsBinding.trim(),G={...X};if(J.startsWith("{")&&J.endsWith("}")){let K=J.slice(1,-1).split(",").map((q)=>q.trim()).filter(Boolean);for(let q of K){let[W,z]=q.split(":").map((B)=>B.trim()),U=z||W;if(Z[W]!==void 0)G[U]=Z[W]}}else G[J]=Z;Q=qK(Q,G)}return Q}function qK($,Z){return $.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Y,X)=>{try{let Q=X.trim(),J=I8(Q,Z);return i0(String(J??""))}catch{return`{{ ${X} }}`}})}function I8($,Z){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test($)){let X=$.split("."),Q=Z;for(let J of X)if(Q&&typeof Q==="object"&&J in Q)Q=Q[J];else return;return Q}let Y=$.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Y){let[,X,Q,J]=Y,G=Z[X],K=parseInt(J,10);if(typeof G==="number")switch(Q){case"+":return G+K;case"-":return G-K;case"*":return G*K;case"/":return G/K}}try{if(!J0($))return;return Q0($,Object.keys(Z))(...Object.values(Z))}catch{return}}async function D8($,Z,Y){let X=$;X=await WK(X,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(G,K,q,W)=>{let z=Z.named.get(K),U=W?.trim()||"",B=q||"",_={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,H;while((H=j.exec(B))!==null){let L=H[1],F=H[2];_[L]=I8(F,Y)}return await M8(z,_,U,Y)});let J=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return X=X.replace(J,(G,K)=>{if(G.includes("name="))return G;let q=K?.trim()||"";return Z.default||q}),X}async function WK($,Z,Y){let X=[],Q=[];$.replace(Z,(K,...q)=>{let W=q[q.length-2];return Q.push({match:K,index:W}),X.push(Y(K,...q.slice(0,-2))),K});let J=await Promise.all(X),G=$;for(let K=Q.length-1;K>=0;K--){let{match:q,index:W}=Q[K];G=G.slice(0,W)+J[K]+G.slice(W+q.length)}return G}function zK($){let Z=T8($);return{defaultSlot:Z.default,namedSlots:Z.named}}async function UK($,Z,Y,X){return await D8($,{default:Z,named:Y},X)}var JK;var S7=k(()=>{a0();F0();JK=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function j1($,Z){let Y=BK($,Z);return Y.ok?{expression:Y.expression,endPos:Y.endPos}:null}function BK($,Z){let Y=Z;while(Y<$.length&&/\s/.test($[Y]))Y++;if($[Y]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Y};let X=S0($,"(",")",Y);if(X===-1)return{ok:!1,reason:"unclosed-paren",pos:Y};return{ok:!0,expression:$.slice(Y+1,X),endPos:X+1}}function jK($,Z){let Y=$.lastIndexOf("<",Z);if(Y===-1)return!1;return Y>$.lastIndexOf(">",Z)}function y1($,Z,Y,X){let Q=1,J=X,G=new RegExp(`@${Z}\\s*\\(`,"g"),K=new RegExp(`@${Y}(?![a-z])`,"g");while(J<$.length&&Q>0){G.lastIndex=J,K.lastIndex=J;let q=G.exec($),W=K.exec($),z=q?q.index:1/0,U=W?W.index:1/0;if(z<U)Q++,J=z+q[0].length;else if(U<1/0){if(Q--,Q===0)return U;J=U+W[0].length}else break}return-1}function E8($,Z){let Y=$.slice(Z).match(/^@if\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=j1($,X);if(!Q)return null;let J=Q.endPos,G=y1($,"if","endif",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,z="if",U=Q.expression,B=0,_=0;while(W<K.length){let j=K.indexOf("@",W);if(j===-1)break;W=j;let H=K.substring(j);if(jK(K,j)){W++;continue}if(/^@if\s*\(/.test(H)){_++,W++;continue}if(/^@endif(?![a-z])/.test(H)){_--,W+=6;continue}if(_===0){let L=H.match(/^@elseif\s*/);if(L){q.push({type:z,condition:U,content:K.substring(B,W),start:J+B,end:J+W});let F=W+L[0].length,O=j1(K,F);if(!O){W++;continue}z="elseif",U=O.expression,W=O.endPos,B=W;continue}else if(/^@else(?![a-z])/.test(H)){q.push({type:z,condition:U,content:K.substring(B,W),start:J+B,end:J+W}),z="else",U=void 0,W+=5,B=W;continue}}W++}return q.push({type:z,condition:U,content:K.slice(B),start:J+B,end:J+K.length}),{fullMatch:$.slice(Z,G+6),branches:q,start:Z,end:G+6}}function c5($){let Z=[],Y=/@if\s*\(/g,X=Y.exec($);while(X!==null){if(Z.some((G)=>X.index>G.start&&X.index<G.end)){X=Y.exec($);continue}let J=E8($,X.index);if(J)Z.push(J),Y.lastIndex=J.end;X=Y.exec($)}return Z}function P$($,Z,Y){let X=[],Q=new RegExp(`@${Z}\\s*\\(`,"g"),J=Q.exec($);while(J!==null){if(X.some((H)=>J.index>H.start&&J.index<H.end)){J=Q.exec($);continue}let K=J.index,q=K+J[0].length-1,W=S0($,"(",")",q);if(W===-1){J=Q.exec($);continue}let z=$.slice(q+1,W),U=W+1,B=y1($,Z,Y,U);if(B===-1){J=Q.exec($);continue}let _=$.slice(U,B),j=B+`@${Y}`.length;X.push({fullMatch:$.slice(K,j),name:Z,params:z,content:_,start:K,end:j}),Q.lastIndex=j,J=Q.exec($)}return X}function y7($,Z){let Y=$.slice(Z).match(/^@switch\s*/);if(!Y)return null;let X=Z+Y[0].length,Q=j1($,X);if(!Q)return null;let J=Q.endPos,G=y1($,"switch","endswitch",J);if(G===-1)return null;let K=$.slice(J,G),q=[],W=0,z=null,U=0;while(W<K.length){let B=K.slice(W),_=B.match(/^@switch\s*\(/),j=B.match(/^@endswitch(?![a-z])/);if(_){if(U++,z)z.content+=_[0];W+=_[0].length;continue}if(j){if(U--,z)z.content+=j[0];W+=j[0].length;continue}if(U>0){if(z)z.content+=K[W];W++;continue}let H=B.match(/^@case\s*/),L=B.match(/^@default(?![a-z])/),F=B.match(/^@break(?![a-z])/);if(H&&B.startsWith("@case")){if(z)q.push(z);let O=W+H[0].length,V=j1(K,O);if(!V){W++;continue}z={type:"case",value:V.expression,content:""},W=V.endPos}else if(L&&B.startsWith("@default")){if(z)q.push(z);z={type:"default",content:""},W+=L[0].length}else if(F&&B.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:Q.expression,cases:q,start:Z,end:G+10}}var k8=()=>{};var b8=()=>{};var C$=k(()=>{k8();b8()});function f$($){let Z=$,Y=new Set,X=new Set,Q=()=>{if(C0)X.add(C0);return Z};return Q.set=(J)=>{if(!Object.is(J,Z)){let G=Z;if(Z=J,Y.forEach((K)=>K(Z,G)),i5)X.forEach((K)=>x$.add(K));else X.forEach((K)=>K())}},Q.update=(J)=>{Q.set(J(Z))},Q.subscribe=(J)=>{return Y.add(J),()=>Y.delete(J)},Object.defineProperty(Q,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(Q,"value",{get:()=>Q(),set:(J)=>Q.set(J),configurable:!0}),Q}function g$($){let Z,Y=!0,X=new Set,Q=()=>{if(!Y)if(Y=!0,i5)X.forEach((G)=>x$.add(G));else X.forEach((G)=>G())},J=()=>{if(C0)X.add(C0);if(Y){let G=C0;C0=Q,v$.push(Q);try{Z=$()}finally{v$.pop(),C0=G}Y=!1}return Z};return Object.defineProperty(J,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),configurable:!0}),J}function h$($,Z={}){let Y,X=!1,Q=()=>{if(X)return;if(Y)Y(),Y=void 0;let J=C0;C0=Q,v$.push(Q);try{Y=$()}finally{v$.pop(),C0=J}};if(Z.immediate!==!1)Q();return()=>{if(X=!0,Y)Y()}}function P7($){if(i5){$();return}i5=!0;try{$()}finally{i5=!1,x$.forEach((Z)=>Z()),x$.clear()}}function C7($){LK.push($)}function v7($){FK.push($)}function d$($){return typeof $==="function"&&$._isSignal===!0}function m$($){return typeof $==="function"&&$._isDerived===!0}function x7($){if(d$($)||m$($))return $();return $}function u$($){let Z=C0;C0=null;try{return $()}finally{C0=Z}}function VK($,Z){let Y=typeof $==="function"?$:()=>$,X=f$([]),Q=g$(()=>X().reduce((K,q)=>Z(K,q.action),Y())),J=!1;return h$(()=>{if(Y(),!J){J=!0;return}if(u$(()=>X().length))X.set([])}),[Q,(K,q)=>{let W={action:K};X.set([...X(),W]);let z=()=>{let U=X().filter((B)=>B!==W);if(U.length!==X().length)X.set(U)};if(q&&typeof q.then==="function")Promise.resolve(q).then(z,z);return z}]}var C0=null,v$,i5=!1,x$,LK,FK;var f7=k(()=>{v$=[],x$=new Set,LK=[],FK=[]});var y8={};r(y8,{useOptimistic:()=>VK,untrack:()=>x7,state:()=>f$,peek:()=>u$,onMount:()=>C7,onDestroy:()=>v7,isSignal:()=>d$,isDerived:()=>m$,generateSignalsRuntimeDev:()=>l$,generateSignalsRuntime:()=>S8,effect:()=>h$,derived:()=>g$,default:()=>AK,batch:()=>P7});function S8(){try{let $=RK(l$()),Y=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync($);return Y=Y.replace(/\}(var |let |const |function )/g,"};$1"),Y}catch{return l$()}}function RK($){let Z=[],Y=0,X="console.log(";while(Y<$.length){let Q=$.indexOf(X,Y);if(Q===-1){Z.push($.slice(Y));break}Z.push($.slice(Y,Q));let J=1,G=Q+X.length;while(G<$.length&&J>0){let K=$[G];if(K==='"'||K==="'"||K==="`"){let q=K;G++;while(G<$.length&&$[G]!==q){if($[G]==="\\")G++;G++}G++;continue}if(K==="(")J++;else if(K===")")J--;G++}Z.push("0"),Y=G}return Z.join("")}function l$(){return`
1977
1977
  // STX Signals Runtime (Development Build)
1978
1978
  console.log('[stx] signals runtime loading');
1979
1979
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -4339,7 +4339,8 @@ else if (name === 'ref' || name === ':ref' || name === 'x-ref' || name === 'data
4339
4339
  // handler like \`pick(option.value)\` receives the whole item.
4340
4340
  // It is not an error, so it lands silently: the wrong value is
4341
4341
  // stored and only surfaces much later.
4342
- if (v && typeof v === 'function' && v._isSignal && !v._isStxLoopItem && expressionUsesSignalApi(value, k)) {
4342
+ if (v && typeof v === 'function' && v._isSignal && !v._isStxLoopItem
4343
+ && (expressionCallsSignal(value, k) || expressionUsesSignalApi(value, k))) {
4343
4344
  return 'var ' + k + ' = __s["' + k + '"]';
4344
4345
  }
4345
4346
  return 'var ' + k + ' = __s["' + k + '"] && typeof __s["' + k + '"] === "function" && __s["' + k + '"]._isSignal ? __s["' + k + '"]() : __s["' + k + '"]';
@@ -8492,52 +8493,52 @@ catch (e) { console.warn('[stx] mount callback error:', e); }
8492
8493
  }
8493
8494
  }
8494
8495
  })();
8495
- `}var VK;var S8=k(()=>{f7();f7();VK={state:f$,derived:g$,effect:h$,batch:P7,onMount:C7,onDestroy:v7,isSignal:d$,isDerived:m$,untrack:x7,peek:u$,generateSignalsRuntime:k8,generateSignalsRuntimeDev:l$}});var g7={};r(g7,{templateCache:()=>y8,readFileCached:()=>RK,invalidateFileCacheByDir:()=>wK,invalidateFileCache:()=>AK,hashFilePath:()=>n5,getCachedSignalsRuntime:()=>MK,getCachedRouterScript:()=>IK,clearDevCaches:()=>DK,checkCache:()=>EK,cacheTemplate:()=>kK,__setSignalsGeneratorsForTest:()=>TK});import _1 from"fs";import X5 from"path";async function RK($){let Y;for(let X=0;X<3;X++)try{let J=(await _1.promises.stat($)).mtime.getTime(),G=P1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await _1.promises.stat($)).mtime.getTime();if(W!==J)continue;return P1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw P1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function AK($){P1.delete($)}function wK($){for(let Z of P1.keys())if(Z.startsWith($))P1.delete(Z)}function TK($){P8=$}async function MK($=!1){let Z=P8??await Promise.resolve().then(() => (S8(),b8));if($)return Z.generateSignalsRuntimeDev();if(p$===null)p$=Z.generateSignalsRuntime();return p$}async function IK(){if(c$===null){let{getRouterScript:$}=await import("stx-router");c$=$()}return c$}function DK(){P1.clear(),v8(),p$=null,NK=null,c$=null}function C8($){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 EK($,Z){try{if(!Z.cachePath)return null;let Y=X5.resolve(Z.cachePath),X=X5.join(Y,`${n5($)}.html`),Q=X5.join(Y,`${n5($)}.meta.json`);if(!await n(X)||!await n(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==C8(Z))return null;if((await _1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await n(q)){if((await _1.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 kK($,Z,Y,X){try{if(!X.cachePath)return;let Q=X5.resolve(X.cachePath);await _1.promises.mkdir(Q,{recursive:!0});let J=X5.join(Q,`${n5($)}.html`),G=X5.join(Q,`${n5($)}.meta.json`),K=await _1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:C8(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),y8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function n5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,bK)}var y8,P1,p$=null,NK=null,P8=null,c$=null,bK=16;var h7=k(()=>{O0();y8=new Map,P1=new Map});function x8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
8496
+ `}var AK;var P8=k(()=>{f7();f7();AK={state:f$,derived:g$,effect:h$,batch:P7,onMount:C7,onDestroy:v7,isSignal:d$,isDerived:m$,untrack:x7,peek:u$,generateSignalsRuntime:S8,generateSignalsRuntimeDev:l$}});var g7={};r(g7,{templateCache:()=>C8,readFileCached:()=>wK,invalidateFileCacheByDir:()=>TK,invalidateFileCache:()=>NK,hashFilePath:()=>n5,getCachedSignalsRuntime:()=>DK,getCachedRouterScript:()=>EK,clearDevCaches:()=>kK,checkCache:()=>bK,cacheTemplate:()=>SK,__setSignalsGeneratorsForTest:()=>IK});import _1 from"fs";import X5 from"path";async function wK($){let Y;for(let X=0;X<3;X++)try{let J=(await _1.promises.stat($)).mtime.getTime(),G=P1.get($);if(G&&G.mtime===J)return G.content;let K=await Bun.file($).text(),W=(await _1.promises.stat($)).mtime.getTime();if(W!==J)continue;return P1.set($,{content:K,mtime:W}),K}catch(Q){Y=Q;break}throw P1.delete($),Error(`File not found: ${$}${Y?` (${Y.message})`:""}`)}function NK($){P1.delete($)}function TK($){for(let Z of P1.keys())if(Z.startsWith($))P1.delete(Z)}function IK($){v8=$}async function DK($=!1){let Z=v8??await Promise.resolve().then(() => (P8(),y8));if($)return Z.generateSignalsRuntimeDev();if(p$===null)p$=Z.generateSignalsRuntime();return p$}async function EK(){if(c$===null){let{getRouterScript:$}=await import("stx-router");c$=$()}return c$}function kK(){P1.clear(),f8(),p$=null,MK=null,c$=null}function x8($){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 bK($,Z){try{if(!Z.cachePath)return null;let Y=X5.resolve(Z.cachePath),X=X5.join(Y,`${n5($)}.html`),Q=X5.join(Y,`${n5($)}.meta.json`);if(!await n(X)||!await n(Q))return null;let J=await Bun.file(Q).text(),G=JSON.parse(J);if(G.cacheVersion!==Z.cacheVersion)return null;if(G.optionsSignature!==x8(Z))return null;if((await _1.promises.stat($)).mtime.getTime()>G.mtime)return null;for(let q of G.dependencies)if(await n(q)){if((await _1.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 SK($,Z,Y,X){try{if(!X.cachePath)return;let Q=X5.resolve(X.cachePath);await _1.promises.mkdir(Q,{recursive:!0});let J=X5.join(Q,`${n5($)}.html`),G=X5.join(Q,`${n5($)}.meta.json`),K=await _1.promises.stat($);await Bun.write(J,Z);let q={sourcePath:$,mtime:K.mtime.getTime(),dependencies:Array.from(Y),cacheVersion:X.cacheVersion,optionsSignature:x8(X),generatedAt:Date.now()};await Bun.write(G,JSON.stringify(q,null,2)),C8.set($,{output:Z,mtime:K.mtime.getTime(),dependencies:Y})}catch(Q){console.warn(`Failed to cache template ${$}:`,Q)}}function n5($){return new Bun.CryptoHasher("sha1").update($).digest("hex").substring(0,yK)}var C8,P1,p$=null,MK=null,v8=null,c$=null,yK=16;var h7=k(()=>{O0();C8=new Map,P1=new Map});function g8($){if($.includes("window.StacksBrowser")||$.includes("StacksBrowser ="))return $;let Z=/<script\b(?![^>]*\bserver\b)[^>]*>([\s\S]*?)<\/script>/gi,Y="",X;while((X=Z.exec($))!==null)Y+=X[1]+`
8496
8497
  `;let Q=/\{\{([\s\S]*?)\}\}/g;while((X=Q.exec($))!==null)Y+=X[1]+`
8497
- `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"].some((B)=>{return new RegExp(`\\b${B}\\b`).test(Y)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,W,U=!1;while((W=q.exec(Y))!==null)if(!K.has(W[1])){U=!0;break}if(!G&&!U)return $;let z=`<script type="module">
8498
+ `;if(!Y.trim())return $;let G=["browserQuery","BrowserQueryBuilder","configureBrowser","createBrowserModel","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useDocumentVisibility","useIntervalFn"].some((B)=>{return new RegExp(`\\b${B}\\b`).test(Y)}),K=new Set(["Promise","Object","Array","Map","Set","Date","Error","JSON","Math","Number","String","RegExp","Symbol","WeakMap","WeakSet","Proxy","Reflect","Intl","URL","URLSearchParams","FormData","Headers","Request","Response","AbortController","EventTarget","Element","Document","Node","Window","Console","Storage","Navigator","Blob","File","FileReader","HTMLElement","SVGElement","Event","CustomEvent","DOMParser","XMLSerializer","WebSocket","Worker","SharedWorker","IntersectionObserver","MutationObserver","ResizeObserver","PerformanceObserver","Notification","Bun","Buffer","Process"]),q=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,W,z=!1;while((W=q.exec(Y))!==null)if(!K.has(W[1])){z=!0;break}if(!G&&!z)return $;let U=`<script type="module">
8498
8499
  // STX: Auto-load @stacksjs/browser (auto-initializes API and loads models)
8499
8500
  import '@stacksjs/browser'
8500
- </script>`;if($.includes("</head>")){let B=$.indexOf("</head>"),j=$.slice(0,B).indexOf("<script");if(j!==-1)return $.slice(0,j)+z+`
8501
- `+$.slice(j);return $.replace("</head>",`${z}
8501
+ </script>`;if($.includes("</head>")){let B=$.indexOf("</head>"),j=$.slice(0,B).indexOf("<script");if(j!==-1)return $.slice(0,j)+U+`
8502
+ `+$.slice(j);return $.replace("</head>",`${U}
8502
8503
  </head>`)}if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
8503
- ${z}`);return z+`
8504
- `+$}async function f8($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;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>
8504
+ ${U}`);return U+`
8505
+ `+$}async function h8($,Z){if($.includes("window.stx.state")||$.includes("STX Signals Runtime"))return $;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>
8505
8506
  `+$.slice(K);if($.includes("</head>")){let q=$.indexOf("</head>");return $.slice(0,q)+`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
8506
8507
  `+$.slice(q)}return`<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>
8507
8508
  `+$}let{getCachedSignalsRuntime:Y}=await Promise.resolve().then(() => (h7(),g7)),Q=`<script data-stx-scoped data-stx-runtime>${await Y(Z.debug)}</script>`,J=$.indexOf("<script");if(J!==-1)return $.slice(0,J)+Q+`
8508
8509
  `+$.slice(J);if($.includes("</head>")){let G=$.indexOf("</head>");return $.slice(0,G)+Q+`
8509
8510
  `+$.slice(G)}if($.includes("<body")){let G=$.indexOf("<body"),K=$.indexOf(">",G);return $.slice(0,K+1)+`
8510
8511
  `+Q+$.slice(K+1)}return Q+`
8511
- `+$}async function g8($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
8512
+ `+$}async function d8($,Z){if(!$.includes("</body>"))return $;if($.includes("__stxRouter)return")||$.includes("__stxRouter=true"))return $;let Y=Z?.router,X="";if(Y){let K={};if(Y.container)K.container=Y.container;if(Y.interceptAllLinks!==void 0)K.interceptAllLinks=Y.interceptAllLinks;if(Y.progress!==void 0)K.progress=Y.progress;if(Y.viewTransitions!==void 0)K.viewTransitions=Y.viewTransitions;if(Y.viewTransitionDuration!==void 0)K.viewTransitionDuration=Y.viewTransitionDuration;if(Y.viewTransitionEasing!==void 0)K.viewTransitionEasing=Y.viewTransitionEasing;if(Y.scrollToTop!==void 0)K.scrollToTop=Y.scrollToTop;if(Y.prefetch!==void 0)K.prefetch=Y.prefetch;if(Y.cache!==void 0)K.cache=Y.cache;if(Y.progressColor!==void 0)K.progressColor=Y.progressColor;if(Y.progressHeight!==void 0)K.progressHeight=Y.progressHeight;if(Object.keys(K).length>0)X=`<script>window.__stxRouterConfig=${JSON.stringify(K)};</script>
8512
8513
  `}let{getCachedRouterScript:Q}=await Promise.resolve().then(() => (h7(),g7)),J=Z?.buildMode==="compile"?'<script src="/__stx/router.__STX_HASH__.js"></script>':`<script>${await Q()}</script>`,G=$.lastIndexOf("</body>");return $.slice(0,G)+X+J+`
8513
- </body>`+$.slice(G+7)}var s$={};r(s$,{scanScriptTags:()=>c8,rewriteStxImportSpecifiers:()=>s8,processSignals:()=>p7,processScriptSetup:()=>n8,preEvalLiteralReactiveIfs:()=>u7,parseLoopExpression:()=>i8,hasSignalsSyntax:()=>o$,findMarkupIndexOutsideScripts:()=>n$,extractExports:()=>o8,convertSignalLoopsToAttributes:()=>l7,convertSignalDirectivesToAttributes:()=>m7});function c8($,Z={}){let Y=[];for(let X of F7($,W1)){let Q=X.token.match(/^<script\b([^>]*)>/i),J=X.token.match(/<\/script\s*>$/i);if(!Q||!J)continue;let G=Q[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=Q[0].length,q=X.token.length-J[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,q),start:X.start,end:X.end})}return Y}function i8($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=d8(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=d8(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function d8($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function o$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function yK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function PK($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function CK($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function u8($,Z,Y){if(!$)return!1;let X=CK($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let B=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(m8.has(B))continue;if(Z.has(B))Q=!0;else if(Y&&B in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,U;while((U=W.exec(X))!==null){let B=U[1];if(X.slice(0,U.index).trimEnd().endsWith("."))continue;if(m8.has(B)||Y&&B in Y)continue;G=!0}return(Q||G)&&!J}function i$($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(p8);if(J&&vK(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function vK($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function m7($,Z){let Y=PK($);function X(Q){let J=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(J))!==null){let W=K.index,U=W+K[0].length,z=1,B=U;while(B<J.length&&z>0){if(J[B]==="(")z++;else if(J[B]===")")z--;B++}if(z!==0)continue;let _=J.substring(U,B-1).trim(),j=B,H=1,L=j,F=/@(if\s*\(|endif)/g;F.lastIndex=j;let O;while((O=F.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(j,L-6).trim(),R;if(yK(V)){let A=c5(J.substring(W,L));if(A.length===0)continue;let w=A[0].branches.filter((M)=>M.type!=="else");if(!(w.length>0&&w.every((M)=>u8(M.condition,Y,Z))))continue;R=A[0].branches.map((M)=>{let I=X(M.content);if(M.type==="elseif")return i$(I,"@else-if",M.condition??"");if(M.type==="else")return i$(I,"@else");return i$(I,"@if",M.condition??"")}).join(`
8514
- `)}else{if(!u8(_,Y,Z))continue;R=i$(X(V),"@if",_)}q.push({start:W,end:L,replacement:R}),G.lastIndex=L}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:B}=q[W];J=J.substring(0,U)+B+J.substring(z)}return J}return X($)}function xK($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function fK($,Z,Y,X){if(d7.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let U=/^<(script|style)\b/i.exec($.slice(q,q+8));if(U){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let j=J.indexOf(`</${U[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===Q){if(K--,q+=_[0].length,K===0)return q;continue}q+=_[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!z){q++;continue}let B=$.indexOf(">",q);if(B===-1)return-1;if(z[1].toLowerCase()===Q){let _=$.slice(q,B+1);if(!(/\/\s*>$/.test(_)||d7.has(Q)))K++}q=B+1}return-1}function hK($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let J=$.slice(Y,Q+1);return gK.test(J)}function u7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(z)=>Z.some(([B,_])=>z>=B&&z<_),J=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=J.exec($))!==null){if(Q(K.index))continue;let[z,B,_,j,H,L,F]=K,O=xK(H);if(O===void 0)continue;let V=K.index,R=V+z.length,N=!!F||/\/\s*>$/.test(z)||d7.has(B.toLowerCase())?R:fK($,V,B,R);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&hK($,N)){J.lastIndex=R;continue}if(O===!0){let M=`<${B}${_}${L}${F}>`;G.push({start:V,end:R,replacement:M});continue}G.push({start:V,end:N,replacement:""}),J.lastIndex=N}if(G.length===0)return $;G.sort((z,B)=>z.start-B.start);let q=[],W=-1;for(let z of G){if(z.start<W)continue;q.push(z),W=z.end}let U=$;for(let z=q.length-1;z>=0;z--){let{start:B,end:_,replacement:j}=q[z];U=U.substring(0,B)+j+U.substring(_)}return U}function l7($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,U=q;while(U<Y.length&&W>0){if(Y[U]==="(")W++;else if(Y[U]===")")W--;U++}if(W!==0)continue;let z=Y.substring(q,U-1).trim(),B=U,_=i8(z);if(_.iterable){let w=_.iterable.trim();if(w.startsWith("[")||w.startsWith("{")||w.startsWith("'")||w.startsWith('"')||w.startsWith("`")||/^-?\d/.test(w))continue;if(Z){let N=w.split(/[.[(]/)[0].trim();if(N&&N in Z)continue}}if(_.style==="as")z=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=B,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=B;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(B,L-j.length).trim(),R=V.match(p8),A;if(R){let[,w,N,T]=R;A=`<${w}${N} @for="${z}">${T}</${w}>`}else A=`<template @for="${z}">${V}</template>`;J.push({start:K,end:L,replacement:A})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function dK($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(U)=>{let z=X+1;while(z<J){let B=$[z];if(B==="\\"){z+=2;continue}if(B===U)return z+1;z++}return J},K=()=>{let U=X+2;while(U<J&&$[U]!==`
8515
- `)U++;return U},q=()=>{let U=X+2;while(U<J-1){if($[U]==="*"&&$[U+1]==="/")return U+2;U++}return J},W=(U)=>{let z=U,B=0;while(z<J){let _=$[z];if(_==="/"&&$[z+1]==="/"){let j=z+2;while(j<J&&$[j]!==`
8516
- `)j++;z=j;continue}if(_==="/"&&$[z+1]==="*"){let j=z+2;while(j<J-1&&!($[j]==="*"&&$[j+1]==="/"))j++;z=j+2;continue}if(_==='"'||_==="'"||_==="`"){let j=z+1;while(j<J){if($[j]==="\\"){j+=2;continue}if($[j]===_){j++;break}j++}z=j;continue}if(_==="("||_==="["||_==="{"){B++,z++;continue}if(_===")"||_==="]"||_==="}"){B--,z++;continue}if(_===";"&&B===0)return z+1;z++}return J};while(X<J){let U=$[X];if(U==="/"&&$[X+1]==="/"){let z=K();Y.push($.slice(X,z)),X=z;continue}if(U==="/"&&$[X+1]==="*"){let z=q();Y.push($.slice(X,z)),X=z;continue}if(U==='"'||U==="'"||U==="`"){let z=G(U);Y.push($.slice(X,z)),X=z;continue}if(U==="{"){Q++,Y.push(U),X++;continue}if(U==="}"){Q--,Y.push(U),X++;continue}if(Q===0){let z=X>0?$[X-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let _=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let j=_[2],H=W(X+_[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(U),X++}return Y.join("")}async function n8($,Z,Y){let X=c8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|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*\(/,J=[];for(let L of X){let F=L.body;if(D1(L.attrs))F=E1(F);if(Q.test(F))J.push({fullMatch:L.fullMatch,attrs:L.attrs,content:F})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${SK++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (b5(),k5)),W=[];for(let L=0;L<J.length;L++){let F=J[L].content;if(F=o1(F).code,K(F))console.log("[stx:bundler] bundling signal script imports"),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,R)=>s8(R));let O=c0(F);W.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
8517
- ${O}`)}let U=W.join(`
8514
+ </body>`+$.slice(G+7)}var s$={};r(s$,{scanScriptTags:()=>n8,rewriteStxImportSpecifiers:()=>a8,processSignals:()=>p7,processScriptSetup:()=>s8,preEvalLiteralReactiveIfs:()=>u7,parseLoopExpression:()=>o8,hasSignalsSyntax:()=>o$,findMarkupIndexOutsideScripts:()=>n$,extractExports:()=>r8,convertSignalLoopsToAttributes:()=>l7,convertSignalDirectivesToAttributes:()=>m7});function n8($,Z={}){let Y=[];for(let X of F7($,W1)){let Q=X.token.match(/^<script\b([^>]*)>/i),J=X.token.match(/<\/script\s*>$/i);if(!Q||!J)continue;let G=Q[1];if(Z.skipAttrs){if(Z.skipAttrs.lastIndex=0,Z.skipAttrs.test(G))continue}let K=Q[0].length,q=X.token.length-J[0].length;Y.push({fullMatch:X.token,attrs:G,body:X.token.slice(K,q),start:X.start,end:X.end})}return Y}function o8($){let Z=$.trim(),Y=Z.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Y){let Q=Y[1].trim(),J=Y[2].trim(),{itemVar:G,indexVar:K}=u8(J);if(G)return{style:"as",iterable:Q,itemVar:G,indexVar:K}}let X=Z.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(X){let Q=X[1].trim(),J=X[2].trim(),{itemVar:G,indexVar:K}=u8(Q);if(G)return{style:"in",iterable:J,itemVar:G,indexVar:K}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function u8($){let Z=$.trim(),Y=Z.match(/^(\w+)\s*=>\s*(\w+)$/);if(Y)return{itemVar:Y[2],indexVar:Y[1]};let X=Z.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(X)return{itemVar:X[1],indexVar:X[2]||null};let Q=Z.match(/^(\w+)\s*,\s*(\w+)$/);if(Q)return{itemVar:Q[1],indexVar:Q[2]};let J=Z.match(/^(\w+)$/);if(J)return{itemVar:J[1],indexVar:null};return{itemVar:null,indexVar:null}}function o$($){return[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\buseId\s*\(/,/\buseReactiveProp\s*(?:<[^>]*>)?\s*\(/,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/].some((Y)=>Y.test($))}function CK($){let Z=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Y=0,X;while((X=Z.exec($))!==null){let Q=X[1];if(Q.startsWith("if"))Y++;else if(Q==="endif")Y--;else if(Y===0)return!0}return!1}function vK($){let Z=new Set,Y=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,X=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,Q;while((Q=Y.exec($))!==null){let J=Q[1],G;while((G=X.exec(J))!==null)Z.add(G[1])}return Z}function xK($){return $.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function p8($,Z,Y){if(!$)return!1;let X=xK($),Q=!1,J=!1,G=!1,K=/([a-zA-Z_$][\w$]*)/g,q;while((q=K.exec(X))!==null){let B=q[1];if(X.slice(0,q.index).trimEnd().endsWith("."))continue;if(l8.has(B))continue;if(Z.has(B))Q=!0;else if(Y&&B in Y)J=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=W.exec(X))!==null){let B=z[1];if(X.slice(0,z.index).trimEnd().endsWith("."))continue;if(l8.has(B)||Y&&B in Y)continue;G=!0}return(Q||G)&&!J}function i$($,Z,Y){let X=Y===void 0?` ${Z}`:` ${Z}="${Y.replace(/"/g,"&quot;")}"`,Q=$.trim(),J=Q.match(i8);if(J&&fK(J[3],J[1])){let[,G,K,q]=J;return`<${G}${K}${X}>${q}</${G}>`}return`<template${X}>${Q}</template>`}function fK($,Z){let Y=new RegExp(`<(/)?${Z}(?=[\\s/>])`,"gi"),X=0,Q;while((Q=Y.exec($))!==null)if(Q[1]){if(X--,X<0)return!1}else X++;return!0}function m7($,Z){let Y=vK($);function X(Q){let J=Q,G=/@if\s*\(/g,K,q=[];while((K=G.exec(J))!==null){let W=K.index,z=W+K[0].length,U=1,B=z;while(B<J.length&&U>0){if(J[B]==="(")U++;else if(J[B]===")")U--;B++}if(U!==0)continue;let _=J.substring(z,B-1).trim(),j=B,H=1,L=j,F=/@(if\s*\(|endif)/g;F.lastIndex=j;let O;while((O=F.exec(J))!==null)if(O[1].startsWith("if"))H++;else if(O[1]==="endif"){if(H--,H===0){L=O.index+O[0].length;break}}if(H!==0)continue;let V=J.substring(j,L-6).trim(),R;if(CK(V)){let A=c5(J.substring(W,L));if(A.length===0)continue;let w=A[0].branches.filter((M)=>M.type!=="else");if(!(w.length>0&&w.every((M)=>p8(M.condition,Y,Z))))continue;R=A[0].branches.map((M)=>{let I=X(M.content);if(M.type==="elseif")return i$(I,"@else-if",M.condition??"");if(M.type==="else")return i$(I,"@else");return i$(I,"@if",M.condition??"")}).join(`
8515
+ `)}else{if(!p8(_,Y,Z))continue;R=i$(X(V),"@if",_)}q.push({start:W,end:L,replacement:R}),G.lastIndex=L}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:B}=q[W];J=J.substring(0,z)+B+J.substring(U)}return J}return X($)}function gK($){let Z=$.trim();if(Z==="")return;if(Z==="true")return!0;if(Z==="false")return!1;if(Z==="null")return!1;if(Z==="undefined")return!1;if(Z==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test(Z)){let Q=Number(Z);return Q!==0&&!Number.isNaN(Q)}let Y=Z.match(/^'((?:\\.|[^'\\])*)'$/);if(Y)return Y[1].length>0;let X=Z.match(/^"((?:\\.|[^"\\])*)"$/);if(X)return X[1].length>0;return}function hK($,Z,Y,X){if(d7.has(Y.toLowerCase()))return X;let Q=Y.toLowerCase(),J=$.toLowerCase(),G=$.length,K=1,q=X;while(q<G){let W=$.indexOf("<",q);if(W===-1)return-1;if(q=W,$.startsWith("<!--",q)){let _=$.indexOf("-->",q+4);if(_===-1)return-1;q=_+3;continue}let z=/^<(script|style)\b/i.exec($.slice(q,q+8));if(z){let _=$.indexOf(">",q);if(_===-1)return-1;if($[_-1]==="/"){q=_+1;continue}let j=J.indexOf(`</${z[1].toLowerCase()}`,q);if(j===-1)return-1;let H=$.indexOf(">",j);if(H===-1)return-1;q=H+1;continue}if($[q+1]==="/"){let _=/^<\/([a-z][\w-]*)\s*>/i.exec($.slice(q,q+64));if(!_){q++;continue}if(_[1].toLowerCase()===Q){if(K--,q+=_[0].length,K===0)return q;continue}q+=_[0].length;continue}let U=/^<([a-z][\w-]*)\b/i.exec($.slice(q,q+64));if(!U){q++;continue}let B=$.indexOf(">",q);if(B===-1)return-1;if(U[1].toLowerCase()===Q){let _=$.slice(q,B+1);if(!(/\/\s*>$/.test(_)||d7.has(Q)))K++}q=B+1}return-1}function mK($,Z){let Y=Z,X=$.length;for(;;){while(Y<X&&$[Y]!=="<")Y++;if(Y>=X)return!1;if($.startsWith("<!--",Y)){let G=$.indexOf("-->",Y+4);if(G===-1)return!1;Y=G+3;continue}break}if($[Y+1]==="/")return!1;let Q=$.indexOf(">",Y);if(Q===-1)return!1;let J=$.slice(Y,Q+1);return dK.test(J)}function u7($){if(!$.includes(":if")&&!$.includes(":show")&&!$.includes("x-if")&&!$.includes("x-show")&&!$.includes("@if=")&&!$.includes("@show="))return $;let Z=[],Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,X;while((X=Y.exec($))!==null)Z.push([X.index,X.index+X[0].length]);let Q=(U)=>Z.some(([B,_])=>U>=B&&U<_),J=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,G=[],K;while((K=J.exec($))!==null){if(Q(K.index))continue;let[U,B,_,j,H,L,F]=K,O=gK(H);if(O===void 0)continue;let V=K.index,R=V+U.length,N=!!F||/\/\s*>$/.test(U)||d7.has(B.toLowerCase())?R:hK($,V,B,R);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&mK($,N)){J.lastIndex=R;continue}if(O===!0){let M=`<${B}${_}${L}${F}>`;G.push({start:V,end:R,replacement:M});continue}G.push({start:V,end:N,replacement:""}),J.lastIndex=N}if(G.length===0)return $;G.sort((U,B)=>U.start-B.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:B,end:_,replacement:j}=q[U];z=z.substring(0,B)+j+z.substring(_)}return z}function l7($,Z){let Y=$,X=/@(for|foreach)\s*\(/g,Q,J=[];while((Q=X.exec(Y))!==null){let G=Q[1],K=Q.index,q=K+Q[0].length,W=1,z=q;while(z<Y.length&&W>0){if(Y[z]==="(")W++;else if(Y[z]===")")W--;z++}if(W!==0)continue;let U=Y.substring(q,z-1).trim(),B=z,_=o8(U);if(_.iterable){let w=_.iterable.trim();if(w.startsWith("[")||w.startsWith("{")||w.startsWith("'")||w.startsWith('"')||w.startsWith("`")||/^-?\d/.test(w))continue;if(Z){let N=w.split(/[.[(]/)[0].trim();if(N&&N in Z)continue}}if(_.style==="as")U=_.indexVar?`(${_.itemVar}, ${_.indexVar}) in ${_.iterable}`:`${_.itemVar} in ${_.iterable}`;let j=G==="for"?"@endfor":"@endforeach",H=1,L=B,F=G==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${G}\\s*\\(|end${G})`,"g");F.lastIndex=B;let O;while((O=F.exec(Y))!==null)if(O[1].startsWith(G))H++;else if(H--,H===0){L=O.index+O[0].length;break}if(H!==0)continue;let V=Y.substring(B,L-j.length).trim(),R=V.match(i8),A;if(R){let[,w,N,T]=R;A=`<${w}${N} @for="${U}">${T}</${w}>`}else A=`<template @for="${U}">${V}</template>`;J.push({start:K,end:L,replacement:A})}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];Y=Y.substring(0,K)+W+Y.substring(q)}return Y}function uK($){let Z=new Set,Y=[],X=0,Q=0,J=$.length,G=(z)=>{let U=X+1;while(U<J){let B=$[U];if(B==="\\"){U+=2;continue}if(B===z)return U+1;U++}return J},K=()=>{let z=X+2;while(z<J&&$[z]!==`
8516
+ `)z++;return z},q=()=>{let z=X+2;while(z<J-1){if($[z]==="*"&&$[z+1]==="/")return z+2;z++}return J},W=(z)=>{let U=z,B=0;while(U<J){let _=$[U];if(_==="/"&&$[U+1]==="/"){let j=U+2;while(j<J&&$[j]!==`
8517
+ `)j++;U=j;continue}if(_==="/"&&$[U+1]==="*"){let j=U+2;while(j<J-1&&!($[j]==="*"&&$[j+1]==="/"))j++;U=j+2;continue}if(_==='"'||_==="'"||_==="`"){let j=U+1;while(j<J){if($[j]==="\\"){j+=2;continue}if($[j]===_){j++;break}j++}U=j;continue}if(_==="("||_==="["||_==="{"){B++,U++;continue}if(_===")"||_==="]"||_==="}"){B--,U++;continue}if(_===";"&&B===0)return U+1;U++}return J};while(X<J){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==="{"){Q++,Y.push(z),X++;continue}if(z==="}"){Q--,Y.push(z),X++;continue}if(Q===0){let U=X>0?$[X-1]:"";if(U===""||/\s/.test(U)||U===";"||U==="}"||U==="{"){let _=$.slice(X).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(_){let j=_[2],H=W(X+_[0].length);if(Z.has(j)){Y.push(`/* stx: deduped const ${j} */`),X=H;continue}Z.add(j),Y.push($.slice(X,H)),X=H;continue}}}Y.push(z),X++}return Y.join("")}async function s8($,Z,Y){let X=n8($,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),Q=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|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*\(/,J=[];for(let L of X){let F=L.body;if(D1(L.attrs))F=E1(F);if(Q.test(F))J.push({fullMatch:L.fullMatch,attrs:L.attrs,content:F})}if(J.length===0)return{output:$,setupCode:null};let G=`__stx_setup_${Date.now()}_${PK++}`,{hasUserImports:K,bundleClientScript:q}=await Promise.resolve().then(() => (b5(),k5)),W=[];for(let L=0;L<J.length;L++){let F=J[L].content;if(F=o1(F).code,K(F))console.log("[stx:bundler] bundling signal script imports"),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,R)=>a8(R));let O=c0(F);W.push(`// \u2500\u2500 merged signal script #${L+1} \u2500\u2500
8518
+ ${O}`)}let z=W.join(`
8518
8519
 
8519
- `);U=dK(U);let z=o8(U),B=z.split(",").map((L)=>L.trim()).filter(Boolean),_=w$(U,Y),j=`
8520
+ `);z=uK(z);let U=r8(z),B=U.split(",").map((L)=>L.trim()).filter(Boolean),_=w$(z,Y),j=`
8520
8521
  <script data-stx-scoped>
8521
8522
  function ${G}() {
8522
8523
  ${a1("const",B)}
8523
- ${_}${U}
8524
- return { ${z} };
8524
+ ${_}${z}
8525
+ return { ${U} };
8525
8526
  }
8526
8527
  window.__stx_latestSetup=${G};
8527
8528
  if(window.stx)window.stx._latestSetup=${G};
8528
- </script>`,H=$;for(let L of J)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${h8})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],F=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${h8})>`,"gi"),(O,V,R)=>{if(F||L.includes(V.toLowerCase()))return O;return F=!0,`<${V}${R} data-stx="${G}">`})}return{output:H,setupCode:j}}function o8($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let j=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!j){j=!0,J++;continue}if(H==="]"&&j){j=!1,J++;continue}if(H==="/"&&!j){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
8529
- `)return;J++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},U=(j)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===j){J++;return}J++}},z=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let j=1;while(J<G&&j>0)if(Z[J]==="{")j++,J++;else if(Z[J]==="}")j--,J++;else if(Z[J]==="'"||Z[J]==='"')U(Z[J]);else if(Z[J]==="`")z();else J++;continue}J++}},B=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
8530
- `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},_=()=>{if(Q!==0)return;let j=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let R=V.trim();if(!R)return;let A=R.indexOf(":"),N=(A>=0?R.slice(A+1).trim():R).split(/[\s=]/)[0];if(N&&!X.has(N))Y.push(N),X.add(N)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let R=V.trim().replace(/^\.\.\./,"");if(!R)return;let A=R.split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let F=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(J<G){if(B())continue;if(Z[J]==="'"||Z[J]==='"'){U(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){z(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))_();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function p7($,Z,Y,X){if(!o$($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await n8(Q,Y,X);if(Q=J,Q=await f8(Q,Z),Q=x8(Q),G){let U=n$(Q,/<\/head>/i),z=U===-1?n$(Q,/<body[^>]*>/i):-1;if(U!==-1)Q=`${Q.slice(0,U)}${G}
8531
- ${Q.slice(U)}`;else if(z!==-1){let B=/<body[^>]*>/i.exec(Q.slice(z))[0],_=z+B.length;Q=`${Q.slice(0,_)}
8529
+ </script>`,H=$;for(let L of J)H=H.split(L.fullMatch).join("");if(H.includes("<body"))H=H.replace(new RegExp(`<body(${m8})>`),`<body$1 data-stx="${G}">`);else{let L=["script","style","html","head","meta","link","title","!doctype"],F=!1;H=H.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${m8})>`,"gi"),(O,V,R)=>{if(F||L.includes(V.toLowerCase()))return O;return F=!0,`<${V}${R} data-stx="${G}">`})}return{output:H,setupCode:j}}function r8($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K="",q=()=>{J++;let j=!1;while(J<G){let H=Z[J];if(H==="\\"){J+=2;continue}if(H==="["&&!j){j=!0,J++;continue}if(H==="]"&&j){j=!1,J++;continue}if(H==="/"&&!j){J++;while(J<G&&/[gimsuyd]/.test(Z[J]))J++;return}if(H===`
8530
+ `)return;J++}},W=()=>{if(!K)return!0;if(/[\w)\]]/.test(K))return!1;return!0},z=(j)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===j){J++;return}J++}},U=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let j=1;while(J<G&&j>0)if(Z[J]==="{")j++,J++;else if(Z[J]==="}")j--,J++;else if(Z[J]==="'"||Z[J]==='"')z(Z[J]);else if(Z[J]==="`")U();else J++;continue}J++}},B=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
8531
+ `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},_=()=>{if(Q!==0)return;let j=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(j){let V=j[2];if(!X.has(V))Y.push(V),X.add(V);return}let H=Z.slice(J).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(H){H[1].split(",").forEach((V)=>{let R=V.trim();if(!R)return;let A=R.indexOf(":"),N=(A>=0?R.slice(A+1).trim():R).split(/[\s=]/)[0];if(N&&!X.has(N))Y.push(N),X.add(N)});return}let L=Z.slice(J).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(L){L[1].split(",").forEach((V)=>{let R=V.trim().replace(/^\.\.\./,"");if(!R)return;let A=R.split(/[\s=]/)[0];if(A&&!X.has(A))Y.push(A),X.add(A)});return}let F=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(F){let V=F[1];if(!X.has(V))Y.push(V),X.add(V);return}let O=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let V=O[1];if(!X.has(V))Y.push(V),X.add(V)}};while(J<G){if(B())continue;if(Z[J]==="'"||Z[J]==='"'){z(Z[J]),K=Z[J-1];continue}if(Z[J]==="`"){U(),K="`";continue}if(Z[J]==="/"&&Z[J+1]!=="/"&&Z[J+1]!=="*"&&W()){q(),K="/";continue}if(Z[J]==="{"){Q++,K="{",J++;continue}if(Z[J]==="}"){Q--,K="}",J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))_();if(!/\s/.test(Z[J]))K=Z[J];J++}return Y.join(", ")}async function p7($,Z,Y,X){if(!o$($))return $;let Q=$;if(Z.skipSignalsRuntime)return Q;let{output:J,setupCode:G}=await s8(Q,Y,X);if(Q=J,Q=await h8(Q,Z),Q=g8(Q),G){let z=n$(Q,/<\/head>/i),U=z===-1?n$(Q,/<body[^>]*>/i):-1;if(z!==-1)Q=`${Q.slice(0,z)}${G}
8532
+ ${Q.slice(z)}`;else if(U!==-1){let B=/<body[^>]*>/i.exec(Q.slice(U))[0],_=U+B.length;Q=`${Q.slice(0,_)}
8532
8533
  ${G}${Q.slice(_)}`}else Q=`${Q}
8533
- ${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let U=/<body[^>]*>/i,z=n$(Q,U);if(z!==-1){let B=Q.slice(0,z),_=Q.slice(z).replace(U,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=B+_}}return Q}function n$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=Y.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);let J=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=J.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([U,z])=>q>=U&&q<z))return q;G=q+Math.max(K[0].length,1)}return-1}function s8($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let Q=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return l8;return`var ${Z.join(", ")}; ${l8}`}var SK=0,h8=`(?:"[^"]*"|'[^']*'|[^>"'])*`,p8,m8,d7,gK,l8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var o5=k(()=>{C5();C$();h5();O0();k1();p8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;m8=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"]);d7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);gK=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import mK from"fs";import f from"path";function r8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function lK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function D1($){return!lK($)}function E1($){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,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()}).transformSync(Z);for(let J=0;J<Y.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Y[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Y[J]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function pK($){let Z=[],Y=new Set,X=0,Q=0,J=$.length,G=(U)=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]===U){Q++;return}Q++}},K=()=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let U=1;while(Q<J&&U>0)if($[Q]==="{")U++,Q++;else if($[Q]==="}")U--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
8534
- `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(X!==0)return;let U=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let j=U[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let z=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(Q<J){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function cK($){let Z=[],Y=0,X=0,Q=null;for(let J=0;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,J)),X=J+1}if(X<$.length)Z.push($.slice(X));return Z}function iK($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let J=$[X-1],G=$[X+1];if(J==="!"||J==="<"||J===">"||J==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function nK($,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 Q=X,J=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")J++;else if(q==="{"){if(J--,J===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,Q);for(let q of cK(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let U=iK(W);if(U===-1)continue;let z=W.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if(Z[z]!==void 0)continue;let B=W.slice(U+1).trim();if(!B)continue;try{let _=Object.keys(Z),j=Function(..._,`"use strict"; return (${B});`);Z[z]=j(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function a$($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[J,J.toLowerCase(),G(J),K(J)])if(q.has(L))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],U=typeof Q.root==="string"?f.resolve(Q.root):void 0,z=U??f.dirname(X),B=[],_=(L)=>{if(L&&!B.includes(L))B.push(L)},j=Y.__originalFilePath;if(j)_(f.join(f.dirname(j),"components"));_(Z),_(Q._rootComponentsDir),_(f.join(f.dirname(X),"components")),_(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(U)_(f.resolve(U,"resources/views/components")),_(f.resolve(U,"resources/components")),_(f.resolve(U,"src/components")),_(f.resolve(U,"components"));if(J.startsWith("./")||J.startsWith("../"))return n(f.resolve(f.dirname(X),`${J}.stx`));for(let L of B){let F=f.isAbsolute(L)?L:f.resolve(z,L);for(let O of W)if(await n(f.join(F,O)))return!0}return!1}function oK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function sK($){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 rK($){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 Q;while((Q=Y.exec(X))!==null)Z.add(Q[1]);Y.lastIndex=0}return[...Z]}async function C1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await Promise.resolve().then(() => (p5(),y$)),U=K??new Set;if(U.has($))return`[Circular component reference: ${$}]`;let z=new Set(U);z.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=B&&B!=="load"&&oK(B)?B:"";try{let j=(g)=>g.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),H=(g)=>g.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let g=[L,L.toLowerCase(),j(L),H(L)];for(let d of g)if(O.has(d)){F=O.get(d);break}}let V=[];if(!F){let g=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],d=[...new Set(g)],y=Q.__originalFilePath,v=[];if(y){let U0=f.join(f.dirname(y),"components");v.push(U0)}if(X)v.push(X);let m=G._rootComponentsDir;if(typeof m==="string"&&!v.includes(m))v.push(m);let c=f.join(f.dirname(J),"components");if(!v.includes(c))v.push(c);if(G.componentsDir&&G.componentsDir!==X&&!v.includes(G.componentsDir))v.push(G.componentsDir);let K0=G._pluginComponentDirs;if(Array.isArray(K0)){for(let U0 of K0)if(typeof U0==="string"&&!v.includes(U0))v.push(U0)}let B0=typeof G.root==="string"?f.resolve(G.root):void 0,M0=B0??f.dirname(J),g0=[];if(B0)g0.push(f.resolve(B0,"resources/views/components")),g0.push(f.resolve(B0,"resources/components")),g0.push(f.resolve(B0,"src/components")),g0.push(f.resolve(B0,"components"));g0.push(f.resolve(import.meta.dir,"components"));for(let U0 of g0)if(!v.includes(U0))v.push(U0);let B$=[...new Set(v.map((U0)=>{if(!U0)return U0;return f.isAbsolute(U0)?U0:f.resolve(M0,U0)}))];if(v.length=0,v.push(...B$),L.startsWith("./")||L.startsWith("../"))F=f.resolve(f.dirname(J),`${L}.stx`),V.push(F);else for(let U0 of v){if(!U0)continue;for(let K1 of d){let p0=f.join(U0,K1);if(V.push(p0),await n(p0)){F=p0;break}}if(F)break;if(!F)try{let K1=await import("fs");if(!K1.statSync(U0,{throwIfNoEntry:!1})?.isDirectory())continue;let w1=8,N1=[{path:U0,depth:0}];while(N1.length>0&&!F){let h0=N1.pop();if(h0.depth>=w1)continue;let a;try{a=K1.readdirSync(h0.path,{withFileTypes:!0})}catch{continue}for(let s0 of a){if(!s0.isDirectory())continue;if(s0.name==="node_modules"||s0.name.startsWith("."))continue;let Q7=f.join(h0.path,s0.name);for(let sJ of d){let G7=f.join(Q7,sJ);if(V.push(G7),await n(G7)){F=G7;break}}if(F)break;N1.push({path:Q7,depth:h0.depth+1})}}}catch{}if(F)break}}if(!F||!await n(F)){let g=V.length>0?`
8534
+ ${G}`}let q=Q.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),W=q&&/data-stx/.test(q[1]);if(!G&&!W&&q&&!/data-stx-auto/.test(q[1])){let z=/<body[^>]*>/i,U=n$(Q,z);if(U!==-1){let B=Q.slice(0,U),_=Q.slice(U).replace(z,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));Q=B+_}}return Q}function n$($,Z){let Y=/<(script|style)\b[\s\S]*?<\/\1>/gi,X=[],Q;while((Q=Y.exec($))!==null)X.push([Q.index,Q.index+Q[0].length]);let J=new RegExp(Z.source,Z.flags.replace(/[gy]/g,"")),G=0;while(G<$.length){let K=J.exec($.slice(G));if(!K)return-1;let q=G+K.index;if(!X.some(([z,U])=>q>=z&&q<U))return q;G=q+Math.max(K[0].length,1)}return-1}function a8($){let Z=[];for(let Y of $.split(",")){let X=Y.trim();if(!X||X.startsWith("type "))continue;let Q=X.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(Q&&Q[1]!==Q[2])Z.push(`${Q[2]} = ${Q[1]}`)}if(Z.length===0)return c8;return`var ${Z.join(", ")}; ${c8}`}var PK=0,m8=`(?:"[^"]*"|'[^']*'|[^>"'])*`,i8,l8,d7,dK,c8="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var o5=k(()=>{C5();C$();h5();O0();k1();i8=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;l8=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"]);d7=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);dK=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import lK from"fs";import f from"path";function t8($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function cK($){return/\bjs\b/.test($)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test($)}function D1($){return!cK($)}function E1($){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,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{\{[\s\S]*?\}\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`}),Z=Z.replace(/\{\{[\s\S]*?\}\}/g,(J)=>{let G=Y.length;return Y.push(J),`"__STX_EXPR_${G}__"`});let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()}).transformSync(Z);for(let J=0;J<Y.length;J++)Q=Q.replace(`"__STX_EXPR_${J}__"`,Y[J]),Q=Q.replace(`'__STX_EXPR_${J}__'`,Y[J]);return Q}catch(Z){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",Z);return $}}function iK($){let Z=[],Y=new Set,X=0,Q=0,J=$.length,G=(z)=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]===z){Q++;return}Q++}},K=()=>{Q++;while(Q<J){if($[Q]==="\\"){Q+=2;continue}if($[Q]==="`"){Q++;return}if($[Q]==="$"&&$[Q+1]==="{"){Q+=2;let z=1;while(Q<J&&z>0)if($[Q]==="{")z++,Q++;else if($[Q]==="}")z--,Q++;else if($[Q]==="'"||$[Q]==='"')G($[Q]);else if($[Q]==="`")K();else Q++;continue}Q++}},q=()=>{if($[Q]==="/"&&$[Q+1]==="/"){while(Q<J&&$[Q]!==`
8535
+ `)Q++;return!0}if($[Q]==="/"&&$[Q+1]==="*"){Q+=2;while(Q<J-1&&!($[Q]==="*"&&$[Q+1]==="/"))Q++;return Q+=2,!0}return!1},W=()=>{if(X!==0)return;let z=$.slice(Q).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(z){let j=z[2].split(",").map((H)=>{let L=H.trim().split(":");return L[L.length-1].trim()});for(let H of j)if(H&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(H)&&!Y.has(H))Z.push(H),Y.add(H);return}let U=$.slice(Q).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(Q).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let _=$.slice(Q).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(Q<J){if(q())continue;if($[Q]==="'"||$[Q]==='"'){G($[Q]);continue}if($[Q]==="`"){K();continue}if($[Q]==="{"){X++,Q++;continue}if($[Q]==="}"){X--,Q++;continue}if(X===0&&/[a-z]/i.test($[Q])&&(Q===0||/\s|[;{}()]/.test($[Q-1])))W();Q++}return Z}function nK($){let Z=[],Y=0,X=0,Q=null;for(let J=0;J<$.length;J++){let G=$[J];if(Q){if(G==="\\"){J++;continue}if(G===Q)Q=null;continue}if(G==='"'||G==="'"||G==="`"){Q=G;continue}if(G==="("||G==="["||G==="{")Y++;else if(G===")"||G==="]"||G==="}")Y--;else if(G===","&&Y===0)Z.push($.slice(X,J)),X=J+1}if(X<$.length)Z.push($.slice(X));return Z}function oK($){let Z=0,Y=null;for(let X=0;X<$.length;X++){let Q=$[X];if(Y){if(Q==="\\"){X++;continue}if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q==="="&&Z===0){let J=$[X-1],G=$[X+1];if(J==="!"||J==="<"||J===">"||J==="=")continue;if(G==="="||G===">")continue;return X}}return-1}function sK($,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 Q=X,J=0,G=-1;for(;X>=0;X--){let q=$[X];if(q==="}")J++;else if(q==="{"){if(J--,J===0){G=X;break}}}if(G===-1)return;let K=$.slice(G+1,Q);for(let q of nK(K)){let W=q.trim();if(!W||W.startsWith("..."))continue;let z=oK(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 B=W.slice(z+1).trim();if(!B)continue;try{let _=Object.keys(Z),j=Function(..._,`"use strict"; return (${B});`);Z[U]=j(..._.map((H)=>Z[H]))}catch{}}}catch{}}async function a$($,Z,Y,X,Q){let J=$.endsWith(".stx")?$.slice(0,-4):$,G=(L)=>L.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""),K=(L)=>L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),q=Y.__importedComponents;if(q){for(let L of[J,J.toLowerCase(),G(J),K(J)])if(q.has(L))return!0}let W=[...new Set([`${J}.stx`,`${G(J)}.stx`,`${K(J)}.stx`])],z=typeof Q.root==="string"?f.resolve(Q.root):void 0,U=z??f.dirname(X),B=[],_=(L)=>{if(L&&!B.includes(L))B.push(L)},j=Y.__originalFilePath;if(j)_(f.join(f.dirname(j),"components"));_(Z),_(Q._rootComponentsDir),_(f.join(f.dirname(X),"components")),_(Q.componentsDir);let H=Q._pluginComponentDirs;if(Array.isArray(H))for(let L of H)_(typeof L==="string"?L:null);if(z)_(f.resolve(z,"resources/views/components")),_(f.resolve(z,"resources/components")),_(f.resolve(z,"src/components")),_(f.resolve(z,"components"));if(J.startsWith("./")||J.startsWith("../"))return n(f.resolve(f.dirname(X),`${J}.stx`));for(let L of B){let F=f.isAbsolute(L)?L:f.resolve(U,L);for(let O of W)if(await n(f.join(F,O)))return!0}return!1}function rK($){return $==="visible"||$==="idle"||$==="interaction"||$.startsWith("media:")}function aK($){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 tK($){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 Q;while((Q=Y.exec(X))!==null)Z.add(Q[1]);Y.lastIndex=0}return[...Z]}async function C1($,Z,Y,X,Q,J,G,K=new Set,q){let{extractVariables:W}=await Promise.resolve().then(() => (p5(),y$)),z=K??new Set;if(z.has($))return`[Circular component reference: ${$}]`;let U=new Set(z);U.add($);let B=typeof Z.client==="string"?Z.client.trim():"";if("client"in Z)delete Z.client;let _=B&&B!=="load"&&rK(B)?B:"";try{let j=(g)=>g.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),H=(g)=>g.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),L=$.endsWith(".stx")?$.slice(0,-4):$,F=null,O=Q.__importedComponents;if(O){let g=[L,L.toLowerCase(),j(L),H(L)];for(let d of g)if(O.has(d)){F=O.get(d);break}}let V=[];if(!F){let g=[`${L}.stx`,`${j(L)}.stx`,`${H(L)}.stx`],d=[...new Set(g)],y=Q.__originalFilePath,v=[];if(y){let z0=f.join(f.dirname(y),"components");v.push(z0)}if(X)v.push(X);let m=G._rootComponentsDir;if(typeof m==="string"&&!v.includes(m))v.push(m);let c=f.join(f.dirname(J),"components");if(!v.includes(c))v.push(c);if(G.componentsDir&&G.componentsDir!==X&&!v.includes(G.componentsDir))v.push(G.componentsDir);let K0=G._pluginComponentDirs;if(Array.isArray(K0)){for(let z0 of K0)if(typeof z0==="string"&&!v.includes(z0))v.push(z0)}let B0=typeof G.root==="string"?f.resolve(G.root):void 0,M0=B0??f.dirname(J),g0=[];if(B0)g0.push(f.resolve(B0,"resources/views/components")),g0.push(f.resolve(B0,"resources/components")),g0.push(f.resolve(B0,"src/components")),g0.push(f.resolve(B0,"components"));g0.push(f.resolve(import.meta.dir,"components"));for(let z0 of g0)if(!v.includes(z0))v.push(z0);let B$=[...new Set(v.map((z0)=>{if(!z0)return z0;return f.isAbsolute(z0)?z0:f.resolve(M0,z0)}))];if(v.length=0,v.push(...B$),L.startsWith("./")||L.startsWith("../"))F=f.resolve(f.dirname(J),`${L}.stx`),V.push(F);else for(let z0 of v){if(!z0)continue;for(let K1 of d){let p0=f.join(z0,K1);if(V.push(p0),await n(p0)){F=p0;break}}if(F)break;if(!F)try{let K1=await import("fs");if(!K1.statSync(z0,{throwIfNoEntry:!1})?.isDirectory())continue;let w1=8,N1=[{path:z0,depth:0}];while(N1.length>0&&!F){let h0=N1.pop();if(h0.depth>=w1)continue;let a;try{a=K1.readdirSync(h0.path,{withFileTypes:!0})}catch{continue}for(let s0 of a){if(!s0.isDirectory())continue;if(s0.name==="node_modules"||s0.name.startsWith("."))continue;let Q7=f.join(h0.path,s0.name);for(let aJ of d){let G7=f.join(Q7,aJ);if(V.push(G7),await n(G7)){F=G7;break}}if(F)break;N1.push({path:Q7,depth:h0.depth+1})}}}catch{}if(F)break}}if(!F||!await n(F)){let g=V.length>0?`
8535
8536
  Searched paths:
8536
8537
  ${V.map((d)=>` - ${d}`).join(`
8537
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${g}`}q.add(F);let R;if(r$.has(F))R=r$.get(F);else try{R=await Bun.file(F).text(),r$.set(F,R)}catch(g){return`[Error loading component: ${g instanceof Error?g.message:String(g)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),w={};for(let[g,d]of Object.entries(Q))if(!g.startsWith("__")||A.has(g))w[g]=d;let{extractSlotContent:N}=await Promise.resolve().then(() => (S7(),b7)),T=N(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[g,d]of T.namedSlots)M[g]=d.content;let I={...w,...Z,props:Z,slot:Y,$slots:M,__processedComponents:z,__sections:{},...sK(Y)&&{__stx_force_signals:!0}};nK(R,I);let E=R,D=k$(E);if(D)E=D.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...R.matchAll(P)],b=[];for(let g of S){let d=g[1]||"",y=g[2]||"",v=d.includes("server");if(D1(d)&&y.trim())y=E1(y);if(v&&y)try{await W(y,I,F)}catch(c){}if(!v){let c=y.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),K0=c.includes("{{")&&c.includes("}}"),B0=c.includes("{!!")&&c.includes("!!}");if(K0||B0)c=I$(c,I);let M0=d.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${M0}>${c}</script>`)}}let C=R.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),h=C?C[1]:"",x=C?C[2]:"",u="",t=h&&/\bscoped\b/i.test(h);if(C)u=`<style${h}>${x}</style>`;let X0=E;if(X0=X0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),C)X0=X0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let g=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,d=[];if(X0=X0.replace(g,(y,v)=>{let m=v.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(m)d.push(`<style${m[1]}>${m[2]}</style>`);return""}),X0=X0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),d.length>0)u=`${u}${d.join(`
8538
- `)}`}if(Y&&X0.includes("{{ text || slot }}"))X0=X0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:$1}=await Promise.resolve().then(() => (S7(),b7)),{defaultSlot:f0,namedSlots:T0}=T;X0=await $1(X0,f0,T0,I);for(let[g,d]of Object.entries(I))if(typeof d==="string"){if(d.includes("<")&&d.includes(">")||d.includes("&lt;")||d.includes("&quot;")){let y=V7(d);I[g]=y}}let Z0=b.some((g)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(g)),A0=rK(b);if(A0.length>0)I.__stx_client_signal_names=A0;let l0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:Z0||b.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let Z1=await V0(X0,I,F,l0,q),A1=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let g of Z1.matchAll(/\{\{([\s\S]*?)\}\}/g))A1.add(g[1].trim());if(A1.size>0)Q.__stx_preserved_client_expressions=[...A1];let l=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++uK}_${Math.random().toString(36).slice(2,8)}`,s=Z1;if(Z0){let g="";if(Object.keys(Z).length>0)try{g=` data-stx-props="${r8(JSON.stringify(Z))}"`}catch{}let d=_?` stx-hydrate="${r8(_)}"`:"";s=`<div data-stx-scope="${l}"${g}${d}>${Z1}</div>`;let y=await Promise.all(b.map(async(v)=>{let m=v.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!m)return v;let[,c,K0]=m,B0=R$(K0,{filePath:F,projectRoot:process.cwd()}),M0=B0.code,g0=A$(B0.styles);M0=o1(M0).code;let{hasUserImports:B$,bundleClientScript:U0}=await Promise.resolve().then(() => (b5(),k5));if(B$(M0))M0=await U0(M0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:K1}=await Promise.resolve().then(() => (o5(),s$));M0=M0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(h0,a)=>K1(a));let p0=c0(M0),w1=pK(p0),N1=`
8538
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${$}']${g}`}q.add(F);let R;if(r$.has(F))R=r$.get(F);else try{R=await Bun.file(F).text(),r$.set(F,R)}catch(g){return`[Error loading component: ${g instanceof Error?g.message:String(g)}]`}let A=new Set(["__originalFilePath","__importedComponents"]),w={};for(let[g,d]of Object.entries(Q))if(!g.startsWith("__")||A.has(g))w[g]=d;let{extractSlotContent:N}=await Promise.resolve().then(() => (S7(),b7)),T=N(Y),M={};if(T.defaultSlot?.trim())M.default=T.defaultSlot;for(let[g,d]of T.namedSlots)M[g]=d.content;let I={...w,...Z,props:Z,slot:Y,$slots:M,__processedComponents:U,__sections:{},...aK(Y)&&{__stx_force_signals:!0}};sK(R,I);let E=R,D=k$(E);if(D)E=D.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...R.matchAll(P)],b=[];for(let g of S){let d=g[1]||"",y=g[2]||"",v=d.includes("server");if(D1(d)&&y.trim())y=E1(y);if(v&&y)try{await W(y,I,F)}catch(c){}if(!v){let c=y.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),K0=c.includes("{{")&&c.includes("}}"),B0=c.includes("{!!")&&c.includes("!!}");if(K0||B0)c=I$(c,I);let M0=d.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");b.push(`<script${M0}>${c}</script>`)}}let C=R.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),h=C?C[1]:"",x=C?C[2]:"",u="",t=h&&/\bscoped\b/i.test(h);if(C)u=`<style${h}>${x}</style>`;let X0=E;if(X0=X0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),C)X0=X0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let g=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,d=[];if(X0=X0.replace(g,(y,v)=>{let m=v.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(m)d.push(`<style${m[1]}>${m[2]}</style>`);return""}),X0=X0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),d.length>0)u=`${u}${d.join(`
8539
+ `)}`}if(Y&&X0.includes("{{ text || slot }}"))X0=X0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Y);let{applySlots:$1}=await Promise.resolve().then(() => (S7(),b7)),{defaultSlot:f0,namedSlots:T0}=T;X0=await $1(X0,f0,T0,I);for(let[g,d]of Object.entries(I))if(typeof d==="string"){if(d.includes("<")&&d.includes(">")||d.includes("&lt;")||d.includes("&quot;")){let y=V7(d);I[g]=y}}let Z0=b.some((g)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(g)),A0=tK(b);if(A0.length>0)I.__stx_client_signal_names=A0;let l0={...G,_rootComponentsDir:G._rootComponentsDir||G.componentsDir,componentsDir:f.dirname(F),skipSignalsRuntime:!0,skipEventDirectives:Z0||b.length===0,defaultLayout:void 0};I.__stxProcessingDepth=(Q.__stxProcessingDepth||0)+1;let Z1=await V0(X0,I,F,l0,q),A1=new Set(Array.isArray(Q.__stx_preserved_client_expressions)?Q.__stx_preserved_client_expressions:[]);for(let g of Z1.matchAll(/\{\{([\s\S]*?)\}\}/g))A1.add(g[1].trim());if(A1.size>0)Q.__stx_preserved_client_expressions=[...A1];let l=`stx_${L.replace(/[^a-zA-Z0-9]/g,"_")}_${++pK}_${Math.random().toString(36).slice(2,8)}`,s=Z1;if(Z0){let g="";if(Object.keys(Z).length>0)try{g=` data-stx-props="${t8(JSON.stringify(Z))}"`}catch{}let d=_?` stx-hydrate="${t8(_)}"`:"";s=`<div data-stx-scope="${l}"${g}${d}>${Z1}</div>`;let y=await Promise.all(b.map(async(v)=>{let m=v.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!m)return v;let[,c,K0]=m,B0=R$(K0,{filePath:F,projectRoot:process.cwd()}),M0=B0.code,g0=A$(B0.styles);M0=o1(M0).code;let{hasUserImports:B$,bundleClientScript:z0}=await Promise.resolve().then(() => (b5(),k5));if(B$(M0))M0=await z0(M0,F,{projectRoot:process.cwd(),minify:G.buildMode==="compile"});let{rewriteStxImportSpecifiers:K1}=await Promise.resolve().then(() => (o5(),s$));M0=M0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(h0,a)=>K1(a));let p0=c0(M0),w1=iK(p0),N1=`
8539
8540
  (function() {
8540
- ${a1("const",[...Y8,...w1],p0)}
8541
+ ${a1("const",[...J8,...w1],p0)}
8541
8542
  const __scope = window.stx._scopes = window.stx._scopes || {};
8542
8543
  const __scopeVars = __scope['${l}'] = __scope['${l}'] || {};
8543
8544
  const __previousCurrentElement = window.__STX_CURRENT_ELEMENT__;
@@ -8570,23 +8571,23 @@ finally {
8570
8571
  `+u}else{if(u)s+=`
8571
8572
  `+u;if(b.length>0){let g=I.__stx_event_bindings||[],d=y5(I),y=await Promise.all(b.map(async(v)=>{let m=v.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!m)return v;return await P5(m[1],{eventBindings:g,templateContent:s,filePath:F,projectRoot:process.cwd(),serverData:d})}));s+=`
8572
8573
  `+y.join(`
8573
- `),I.__stx_event_bindings=[]}}if(t){let g=E$(s,F);if(g.hasScoped)s=g.html}return s}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{U.delete($)}}async function n($){return Bun.file($).exists()}function c7($,Z){let Y=f.resolve(Z),X=f.resolve($),Q=Y.endsWith(f.sep)?Y:Y+f.sep;if(X===Y||X.startsWith(Q))return X;return null}async function i7($,Z,Y,X){let Q=await aK($,Z,Y,X);if(Q===null)return null;let J=c7(Q,process.cwd());if(J)return J;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(c7(Q,q))return f.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function aK($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=f.dirname(Z),J=process.cwd();if($.startsWith("/")){let B=f.join(J,$),_=c7(B,J);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await n(_)&&X)X.add(_);return _}let G=f.join(Q,$);if(await n(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 B of[".stx",".tsx",".jsx"]){let _=`${G}${B}`;if(await n(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(X)X.add(_);return _}}let K="",q=f.resolve(Q),W=process.cwd();for(let B=0;B<10;B++){let _=f.join(q,"layouts"),j=!1;try{j=mK.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=_;break}let H=f.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,_=f.join(K,B);if(await n(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(X)X.add(_);return _}if(!B.endsWith(".stx")){let j=`${_}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let B=f.isAbsolute(Y.layoutsDir)?Y.layoutsDir:f.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,j=f.join(B,_);if(await n(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await n(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),_=f.join(Y.partialsDir||Q,"layouts",B[1]);if(await n(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(X)X.add(_);return _}if(!_.endsWith(".stx")){let j=`${_}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=f.join(Y.partialsDir,"layouts"),await n(K)){let B=f.join(K,$);if(await n(B)){if(Y.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await n(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}}let U=Y.partialsDir||f.join(process.cwd(),"views"),z=f.join(U,$);if(await n(z)){if(Y.debug)console.log(`Found in views path: ${z}`);if(X)X.add(z);return z}if(!$.endsWith(".stx")){let B=`${z}.stx`;if(await n(B)){if(Y.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(Q.includes("temp")){let B=f.join(f.dirname(Q),"layouts",$);if(await n(B)){if(Y.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await n(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}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 a8($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
8574
- `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){X=q+1,Q=G[q].trim();let W=Math.max(0,q-2),U=Math.min(G.length,q+3);J=G.slice(W,U).map((z,B)=>{let _=W+B+1;return`${_===X?"> ":" "}${_}: ${z}`}).join(`
8575
- `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return a8($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function W0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=a8(X,Q,J),q=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&X){let z=X.lastIndexOf(`
8576
- `,Math.max(0,Q-1));W=Q-(z+1)+1}let U="";if(G>0)U+=`
8574
+ `),I.__stx_event_bindings=[]}}if(t){let g=E$(s,F);if(g.hasScoped)s=g.html}return s}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{z.delete($)}}async function n($){return Bun.file($).exists()}function c7($,Z){let Y=f.resolve(Z),X=f.resolve($),Q=Y.endsWith(f.sep)?Y:Y+f.sep;if(X===Y||X.startsWith(Q))return X;return null}async function i7($,Z,Y,X){let Q=await eK($,Z,Y,X);if(Q===null)return null;let J=c7(Q,process.cwd());if(J)return J;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(c7(Q,q))return f.resolve(Q)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${Q} (template: ${$}, from: ${Z})`),null}async function eK($,Z,Y,X){if(Y.debug)console.log(`Resolving template path: ${$} from ${Z}`);let Q=f.dirname(Z),J=process.cwd();if($.startsWith("/")){let B=f.join(J,$),_=c7(B,J);if(!_)return console.warn(`[stx] rejected template path that escapes project root: ${$} (from ${Z})`),null;if(Y.debug)console.log(`Checking absolute path: ${_}`);if(await n(_)&&X)X.add(_);return _}let G=f.join(Q,$);if(await n(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 B of[".stx",".tsx",".jsx"]){let _=`${G}${B}`;if(await n(_)){if(Y.debug)console.log(`Found direct path with extension: ${_}`);if(X)X.add(_);return _}}let K="",q=f.resolve(Q),W=process.cwd();for(let B=0;B<10;B++){let _=f.join(q,"layouts"),j=!1;try{j=lK.statSync(_,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){K=_;break}let H=f.dirname(q);if(H===q||H.length<W.length)break;q=H}if(K){let B=$.startsWith("layouts/")?$.slice(8):$,_=f.join(K,B);if(await n(_)){if(Y.debug)console.log(`Found in current layouts dir: ${_}`);if(X)X.add(_);return _}if(!B.endsWith(".stx")){let j=`${_}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.layoutsDir){let B=f.isAbsolute(Y.layoutsDir)?Y.layoutsDir:f.resolve(process.cwd(),Y.layoutsDir),_=$.startsWith("layouts/")?$.slice(8):$,j=f.join(B,_);if(await n(j)){if(Y.debug)console.log(`Found in options.layoutsDir: ${j}`);if(X)X.add(j);return j}if(!$.endsWith(".stx")){let H=`${j}.stx`;if(await n(H)){if(Y.debug)console.log(`Found in options.layoutsDir with extension: ${H}`);if(X)X.add(H);return H}}}if($.startsWith("layouts/")||$.includes("/layouts/")){let B=$.split("layouts/"),_=f.join(Y.partialsDir||Q,"layouts",B[1]);if(await n(_)){if(Y.debug)console.log(`Found in layouts path: ${_}`);if(X)X.add(_);return _}if(!_.endsWith(".stx")){let j=`${_}.stx`;if(await n(j)){if(Y.debug)console.log(`Found in layouts path with extension: ${j}`);if(X)X.add(j);return j}}}if(Y.partialsDir){if(K=f.join(Y.partialsDir,"layouts"),await n(K)){let B=f.join(K,$);if(await n(B)){if(Y.debug)console.log(`Found in partials layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await n(_)){if(Y.debug)console.log(`Found in partials layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}}let z=Y.partialsDir||f.join(process.cwd(),"views"),U=f.join(z,$);if(await n(U)){if(Y.debug)console.log(`Found in views path: ${U}`);if(X)X.add(U);return U}if(!$.endsWith(".stx")){let B=`${U}.stx`;if(await n(B)){if(Y.debug)console.log(`Found in views path with extension: ${B}`);if(X)X.add(B);return B}}if(Q.includes("temp")){let B=f.join(f.dirname(Q),"layouts",$);if(await n(B)){if(Y.debug)console.log(`Found in temp layouts dir: ${B}`);if(X)X.add(B);return B}if(!$.endsWith(".stx")){let _=`${B}.stx`;if(await n(_)){if(Y.debug)console.log(`Found in temp layouts dir with extension: ${_}`);if(X)X.add(_);return _}}}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 e8($,Z,Y){let X=0,Q="",J="";try{if(typeof Z==="number"&&Z>=0){let G=$.split(`
8575
+ `),K=0;for(let q=0;q<G.length;q++)if(K+=G[q].length+1,K>=Z){X=q+1,Q=G[q].trim();let W=Math.max(0,q-2),z=Math.min(G.length,q+3);J=G.slice(W,z).map((U,B)=>{let _=W+B+1;return`${_===X?"> ":" "}${_}: ${U}`}).join(`
8576
+ `);break}}else if(Y){let G=$.indexOf(Y);if(G>=0)return e8($,G)}}catch{}return{lineNumber:X,lineContent:Q,context:J}}function W0($,Z,Y,X,Q,J){let{lineNumber:G,context:K}=e8(X,Q,J),q=Y.split("/").pop(),W=0;if(typeof Q==="number"&&Q>=0&&X){let U=X.lastIndexOf(`
8577
+ `,Math.max(0,Q-1));W=Q-(U+1)+1}let z="";if(G>0)z+=`
8577
8578
  ${Y}:${G}${W>0?`:${W}`:""}: ${$.toLowerCase()} error: ${Z}
8578
- `;if(U+=`
8579
+ `;if(z+=`
8579
8580
  ${e.bold}${e.red}\u256D\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256E${e.reset}
8580
- `,U+=`${e.bold}${e.red}\u2502${e.reset} ${e.bold}${e.bgRed} ERROR ${e.reset} ${e.red}${$} Error${e.reset}${" ".repeat(Math.max(0,43-$.length))}${e.bold}${e.red}\u2502${e.reset}
8581
- `,U+=`${e.bold}${e.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${e.reset}
8582
- `,U+=`
8583
- ${e.cyan}${e.bold}File:${e.reset} ${e.dim}${q}${e.reset}`,G>0)U+=` ${e.gray}(line ${G}${W>0?`, col ${W}`:""})${e.reset}`;if(U+=`
8581
+ `,z+=`${e.bold}${e.red}\u2502${e.reset} ${e.bold}${e.bgRed} ERROR ${e.reset} ${e.red}${$} Error${e.reset}${" ".repeat(Math.max(0,43-$.length))}${e.bold}${e.red}\u2502${e.reset}
8582
+ `,z+=`${e.bold}${e.red}\u2570\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u256F${e.reset}
8583
+ `,z+=`
8584
+ ${e.cyan}${e.bold}File:${e.reset} ${e.dim}${q}${e.reset}`,G>0)z+=` ${e.gray}(line ${G}${W>0?`, col ${W}`:""})${e.reset}`;if(z+=`
8584
8585
  ${e.yellow}${e.bold}Message:${e.reset} ${Z}
8585
- `,K)U+=`
8586
+ `,K)z+=`
8586
8587
  ${e.blue}${e.bold}Context:${e.reset}
8587
8588
  ${e.dim}${K}${e.reset}
8588
- `;return U}function v8(){r$.clear()}var r$,uK=0,e;var O0=k(()=>{C5();a0();h5();$5();t$();M1();N7();T7();U8();p5();r$=new d5(500);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 t8($,Z,Y=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",U=K+G[0].length,z=1,B=U,_=-1;while(z>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
8589
- `||O==="\r"||O===" "||O===void 0)z++;B=L+9}else{if(z--,z===0){_=F;break}B=F+12}}if(_===-1)continue;let j=$.slice(U,_),H=$.slice(K,_+12);Q.push({fullMatch:H,options:W,content:j,index:K}),J.lastIndex=_+12}for(let{fullMatch:K,options:q,content:W,index:U}of Q)try{let z={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)z[H]=!0});let B={gfm:z.gfm??!0,breaks:z.breaks??!1},_=E5(W.trim(),B);X=X.split(K).join(_)}catch(z){let B=z instanceof Error?z.message:String(z),_=W0("Markdown Directive",`Error processing markdown: ${B}`,Y,$,U,K);X=X.split(K).join(_)}return X}async function e8($,Z,Y,X){let Q={gfm:!0,breaks:!1};return Z.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),E5($.trim(),Q)}var n7=k(()=>{O0()});function $q($){if(tK.set($.name,$),$.client)eK.set($.name,$.client)}function e$($){return $q($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=Zq(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,Q,J);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function Zq($,Z){let Y={...Z};for(let X of $){let Q=X.indexOf(":"),J=X.indexOf("="),G=Q>=0&&(J<0||Q<J)?Q:J;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 tK,eK;var o7=k(()=>{tK=new Map,eK=new Map});function s7($,Z=J5,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${r5($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function $Z($,Z,Y=Yq,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${r5($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function r7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Q,J])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:J,numericBp:Number.parseInt(G)||0}}).sort((Q,J)=>Q.numericBp-J.numericBp).map(({bp:Q,size:J})=>`(max-width: ${Q}) ${J}`);return X.push(Z),X.join(", ")}function r5($,Z={}){let Y=Object.entries(Z).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Y.length===0)return $;let X=Y.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function a7($){return Xq[$]||"application/octet-stream"}var J5,Yq,s5,Xq;var t7=k(()=>{J5=[320,480,640,768,1024,1280,1536,1920,2560],Yq=[1,1.5,2,3],s5=["avif","webp","jpeg"],Xq={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function Qq(){try{return await import("ts-images")}catch{return null}}async function Gq($,Z={}){let Y={...Jq,...Z},X=await Qq();if(X)try{return await Kq($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return qq($,Y)}async function Kq($,Z,Y){let{generatePlaceholder:X,generateThumbHash:Q}=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 Q($)).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 qq($,Z){let Y=Z.width||20,X=Z.height||Y,Q="#e5e7eb",J=`<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(J)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function ZZ($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
8589
+ `;return z}function f8(){r$.clear()}var r$,pK=0,e;var O0=k(()=>{C5();a0();h5();$5();t$();M1();N7();T7();B8();p5();r$=new d5(500);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 $Z($,Z,Y=""){let X=$,Q=[],J=/@markdown(?:\([^)]*\))?/g,G;while((G=J.exec($))!==null){let K=G.index,q=G[0].match(/@markdown\(([^)]*)\)/),W=q?q[1]:"",z=K+G[0].length,U=1,B=z,_=-1;while(U>0&&B<$.length){let L=$.indexOf("@markdown",B),F=$.indexOf("@endmarkdown",B);if(F===-1)break;if(L!==-1&&L<F&&L!==K){let O=$[L+9];if(O==="("||O===`
8590
+ `||O==="\r"||O===" "||O===void 0)U++;B=L+9}else{if(U--,U===0){_=F;break}B=F+12}}if(_===-1)continue;let j=$.slice(z,_),H=$.slice(K,_+12);Q.push({fullMatch:H,options:W,content:j,index:K}),J.lastIndex=_+12}for(let{fullMatch:K,options:q,content:W,index:z}of Q)try{let U={};if(q)q.split(",").forEach((j)=>{let H=j.trim();if(H)U[H]=!0});let B={gfm:U.gfm??!0,breaks:U.breaks??!1},_=E5(W.trim(),B);X=X.split(K).join(_)}catch(U){let B=U instanceof Error?U.message:String(U),_=W0("Markdown Directive",`Error processing markdown: ${B}`,Y,$,z,K);X=X.split(K).join(_)}return X}async function ZZ($,Z,Y,X){let Q={gfm:!0,breaks:!1};return Z.forEach((J)=>{let G=J.trim().replace(/['"]/g,"");if(G==="breaks")Q.breaks=!0;if(G==="no-gfm")Q.gfm=!1}),E5($.trim(),Q)}var n7=k(()=>{O0()});function Yq($){if($q.set($.name,$),$.client)Zq.set($.name,$.client)}function e$($){return Yq($),{name:$.name,hasEndTag:$.hasEndTag??!0,description:$.description,handler:async(Y,X,Q,J)=>{let G=Xq(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,Q,J);if($.clientScript){let q=$.clientScript(G);K+=`<script>${q}</script>`}if($.css){let q=$.css(G);K+=`<style>${q}</style>`}return K}}}function Xq($,Z){let Y={...Z};for(let X of $){let Q=X.indexOf(":"),J=X.indexOf("="),G=Q>=0&&(J<0||Q<J)?Q:J;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 $q,Zq;var o7=k(()=>{$q=new Map,Zq=new Map});function s7($,Z=J5,Y={},X){return Z.sort((Q,J)=>Q-J).map((Q)=>{return`${r5($,{...Y,w:Q,fm:X})} ${Q}w`}).join(", ")}function YZ($,Z,Y=Jq,X={},Q){return Y.sort((J,G)=>J-G).map((J)=>{let G=Math.round(Z*J);return`${r5($,{...X,w:G,dpr:J,fm:Q})} ${J}x`}).join(", ")}function r7($,Z="100vw"){if(!$||Object.keys($).length===0)return Z;let X=Object.entries($).map(([Q,J])=>{let G=/^\d+$/.test(Q)?`${Q}px`:Q;return{bp:G,size:J,numericBp:Number.parseInt(G)||0}}).sort((Q,J)=>Q.numericBp-J.numericBp).map(({bp:Q,size:J})=>`(max-width: ${Q}) ${J}`);return X.push(Z),X.join(", ")}function r5($,Z={}){let Y=Object.entries(Z).filter(([,J])=>J!==void 0&&J!==null).map(([J,G])=>{if(Array.isArray(G))return[J,G.join(",")];return[J,String(G)]});if(Y.length===0)return $;let X=Y.map(([J,G])=>`${J}=${encodeURIComponent(G)}`).join("&"),Q=$.includes("?")?"&":"?";return`${$}${Q}${X}`}function a7($){return Qq[$]||"application/octet-stream"}var J5,Jq,s5,Qq;var t7=k(()=>{J5=[320,480,640,768,1024,1280,1536,1920,2560],Jq=[1,1.5,2,3],s5=["avif","webp","jpeg"],Qq={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function Kq(){try{return await import("ts-images")}catch{return null}}async function qq($,Z={}){let Y={...Gq,...Z},X=await Kq();if(X)try{return await Wq($,Y,X)}catch(Q){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${Q}`)}return zq($,Y)}async function Wq($,Z,Y){let{generatePlaceholder:X,generateThumbHash:Q}=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 Q($)).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 zq($,Z){let Y=Z.width||20,X=Z.height||Y,Q="#e5e7eb",J=`<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(J)}`,width:Y,height:X,aspectRatio:Y/X,originalWidth:0,originalHeight:0,strategy:Z.strategy,dominantColor:"#e5e7eb"}}function XZ($,Z,Y={}){let X=Y.transitionDuration||300,Q=Y.easing||"ease-out";return`
8590
8591
  #${$} {
8591
8592
  --stx-img-transition-duration: ${X}ms;
8592
8593
  --stx-img-transition-easing: ${Q};
@@ -8603,7 +8604,7 @@ ${e.dim}${K}${e.reset}
8603
8604
  #${$}.stx-img-loaded img {
8604
8605
  opacity: 1;
8605
8606
  }
8606
- `.trim()}async function YZ($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(e7.has(Y))return e7.get(Y);let X=await Gq($,Z);return e7.set(Y,X),X}var Jq,$3,e7;var XZ=k(()=>{Jq={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},$3=`
8607
+ `.trim()}async function JZ($,Z={}){let Y=`${$}:${JSON.stringify(Z)}`;if(e7.has(Y))return e7.get(Y);let X=await qq($,Z);return e7.set(Y,X),X}var Gq,$3,e7;var QZ=k(()=>{Gq={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},$3=`
8607
8608
  .stx-img-placeholder {
8608
8609
  position: relative;
8609
8610
  overflow: hidden;
@@ -8632,8 +8633,8 @@ ${e.dim}${K}${e.reset}
8632
8633
  filter: blur(0);
8633
8634
  transform: scale(1);
8634
8635
  }
8635
- `.trim();e7=new Map});import{createHash as QZ}from"crypto";import{readFile as Wq,stat as GZ}from"fs/promises";async function I0($){try{let Z=await Wq($);return QZ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function JZ($){return QZ("sha256").update($).digest("hex").slice(0,16)}function $4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${JZ($)}-${JZ(Y)}`}async function Z3($){try{return(await GZ($)).mtimeMs}catch{return 0}}async function w0($){try{return await GZ($),!0}catch{return!1}}var v1=()=>{};import{mkdir as Uq,readFile as zq,writeFile as Bq,readdir as AO,rm as jq,stat as wO}from"fs/promises";import{join as qZ,dirname as _q}from"path";async function Hq($){try{await Uq($,{recursive:!0})}catch{}}function WZ($,Z,Y){return qZ($,Y,`${Z}.json`)}async function KZ($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await Z3(Z)!==$.srcMtime)return!1;return!0}async function Z4($,Z,Y,X=Y3){if(!X.enabled)return null;let Q=$4($,Z),J=Q5.get(Q);if(J){if(await KZ(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;Q5.delete(Q)}let G=WZ(X.directory,Q,Y);if(await w0(G))try{let K=await zq(G,"utf-8"),q=JSON.parse(K);if(await KZ(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),Q5.set(Q,q),q.data}catch{}return null}async function Y4($,Z,Y,X,Q=Y3){if(!Q.enabled)return;let J=$4($,Z),G=await I0($),K=await Z3($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:$4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};Q5.set(J,q);let W=WZ(Q.directory,J,X);try{await Hq(_q(W)),await Bq(W,JSON.stringify(q,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function X4($,Z=Y3){if($==="all")Q5.clear();else Q5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=qZ(Z.directory,X);try{await jq(Q,{recursive:!0,force:!0})}catch{}}}var Q5,Y3;var X3=k(()=>{v1();Q5=new Map,Y3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class Q4{config;constructor($={}){this.config={...Oq,...$}}async get($,Z){return Z4($,Z,"image",this.config)}async set($,Z,Y){return Y4($,Z,Y,"image",this.config)}async clear(){return X4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function J3($){if(!J4)J4=new Q4($);else if($)J4.updateConfig($);return J4}async function G4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return J3(X).get($,Z)}async function K4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return J3(Q).set($,Z,Y)}async function UZ(){return J3().clear()}var Oq,J4=null;var Q3=k(()=>{X3();Oq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as Lq,basename as Fq,extname as Vq,join as Rq}from"path";import{mkdir as Aq}from"fs/promises";async function G3(){try{return await import("ts-images")}catch{return null}}function zZ($){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 wq($,Z){let Y=Z?zZ(Z):zZ("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 BZ($,Z,Y){let X=await G3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await G4($,Z,Y);if(Q)return Q;try{let J=Lq($);if(!await w0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=wq(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await Aq(K,{recursive:!0});let W=await I0(J),U=Fq($,Vq($)),z=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:W},_=null;if(Z.transformations&&Z.transformations.length>0)_=await K3(J,Z.transformations,X);for(let j of z){let H=G[j]||{},L=`${U}-${W}.${j}`,F=Rq(K,L);try{let O=await X.optimizeImage({input:_||J,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(J);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await K4($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function jZ($,Z,Y,X){let Q=await G3();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function K3($,Z,Y){let X=Y||await G3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var _Z=k(()=>{v1();Q3()});import{resolve as Nq,basename as Tq,extname as Mq,join as Iq}from"path";import{mkdir as Dq}from"fs/promises";async function Eq(){try{return await import("ts-images")}catch{return null}}async function HZ($,Z,Y){let X=await Eq();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=Nq($);if(!await w0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||kq,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await Dq(K,{recursive:!0});let W=await I0(Q),U=Tq($,Mq($)),z=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of J){let F=`${U}-${L}w-${W}.${j}`,O=Iq(K,F),V=`${q}/${F}`;try{let R=z[j]?.quality||80;if(await w0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await X.processImage({input:Q,output:O,format:j,quality:R,resize:{width:L}});if(A)B.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(R){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${R}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await X.generateThumbHash(Q);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(Q,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||bq(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function bq($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function OZ($,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 kq;var LZ=k(()=>{v1();kq=[320,480,640,768,1024,1280,1536,1920]});var FZ={};r(FZ,{setCachedImageResult:()=>K4,processImage:()=>BZ,optimizeImage:()=>jZ,getCachedImageResult:()=>G4,generateSrcset:()=>OZ,generateResponsiveVariants:()=>HZ,clearImageCache:()=>UZ,applyTransformations:()=>K3,ImageProcessorCache:()=>Q4});var VZ=k(()=>{_Z();LZ();Q3()});async function Sq(){try{return await Promise.resolve().then(() => (VZ(),FZ))}catch($){if(!RZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),RZ=!0;return null}}async function q4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return vq(X,Y)}if(Y.processedResult?.processed)return z3($,Y.processedResult,Z);if(Y.responsiveVariants)return TZ($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=J5,dpr:U,formats:z=s5,quality:B=q3,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":U4,decoding:V=W4,fetchpriority:R,objectFit:A,objectPosition:w,crossorigin:N,referrerpolicy:T}=$,M=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:P=!1,baseUrl:S=""}=Z;if(P&&!Z.optimize)return Cq($);let b,C,h=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{b=await YZ(Q,{strategy:j,...H}),C=ZZ(h,b,H)}catch{}let x=U!==void 0&&G!==void 0,u;if(x)u=Pq($,h,b,Z);else u=await yq($,h,b,Z);let t;if(F){let f0=z.includes("webp")?"webp":z[0],T0=s7(Q,W,{..._,q:B},f0),Z0=typeof q==="object"?r7(q):q||"100vw";t=`<link rel="preload" as="image" imagesrcset="${T0}" imagesizes="${Z0}" />`}let X0=[];if(!AZ&&j!=="none")X0.push($3),AZ=!0;if(C)X0.push(C);let $1=L?NZ(h):void 0;return{html:u,preloadLink:t,css:X0.length>0?X0.join(`
8636
- `):void 0,script:$1}}async function yq($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=J5,formats:U=s5,quality:z=q3,params:B={},lazy:_=!0,priority:j=!1,loading:H=j?"eager":U4,decoding:L=W4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:R,referrerpolicy:A}=$,w=$.class,N=$.style,T=$.data||{},M=typeof q==="object"?r7(q):q||"100vw",I=[];for(let P of U){let S=s7(Q,W,{...B,q:z},P),b=a7(P);if(_&&!j)I.push(` <source type="${b}" data-srcset="${S}" data-sizes="${M}" />`);else I.push(` <source type="${b}" srcset="${S}" sizes="${M}" />`)}let E=W3({src:r5(Q,{...B,q:z}),alt:J,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:R,referrerpolicy:A,className:wZ(w,Y),style:U3(N,O,V,Y),lazy:_&&!j,data:T}),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}">
8636
+ `.trim();e7=new Map});import{createHash as KZ}from"crypto";import{readFile as Uq,stat as qZ}from"fs/promises";async function I0($){try{let Z=await Uq($);return KZ("sha256").update(Z).digest("hex").slice(0,16)}catch{return""}}function GZ($){return KZ("sha256").update($).digest("hex").slice(0,16)}function $4($,Z){let Y=JSON.stringify(Z,Object.keys(Z).sort());return`${GZ($)}-${GZ(Y)}`}async function Z3($){try{return(await qZ($)).mtimeMs}catch{return 0}}async function w0($){try{return await qZ($),!0}catch{return!1}}var v1=()=>{};import{mkdir as Bq,readFile as jq,writeFile as _q,readdir as NO,rm as Hq,stat as TO}from"fs/promises";import{join as zZ,dirname as Oq}from"path";async function Lq($){try{await Bq($,{recursive:!0})}catch{}}function UZ($,Z,Y){return zZ($,Y,`${Z}.json`)}async function WZ($,Z,Y){if((Date.now()-$.createdAt)/86400000>Y)return!1;if(await Z3(Z)!==$.srcMtime)return!1;return!0}async function Z4($,Z,Y,X=Y3){if(!X.enabled)return null;let Q=$4($,Z),J=Q5.get(Q);if(J){if(await WZ(J,$,X.maxAge))return J.lastAccessedAt=Date.now(),J.data;Q5.delete(Q)}let G=UZ(X.directory,Q,Y);if(await w0(G))try{let K=await jq(G,"utf-8"),q=JSON.parse(K);if(await WZ(q,$,X.maxAge))return q.lastAccessedAt=Date.now(),Q5.set(Q,q),q.data}catch{}return null}async function Y4($,Z,Y,X,Q=Y3){if(!Q.enabled)return;let J=$4($,Z),G=await I0($),K=await Z3($),q={key:J,src:$,srcHash:G,srcMtime:K,optionsHash:$4("",Z),data:Y,createdAt:Date.now(),lastAccessedAt:Date.now()};Q5.set(J,q);let W=UZ(Q.directory,J,X);try{await Lq(Oq(W)),await _q(W,JSON.stringify(q,null,2))}catch(z){console.warn(`[stx-media] Failed to write cache: ${z}`)}}async function X4($,Z=Y3){if($==="all")Q5.clear();else Q5.clear();let Y=$==="all"?["image","video"]:[$];for(let X of Y){let Q=zZ(Z.directory,X);try{await Hq(Q,{recursive:!0,force:!0})}catch{}}}var Q5,Y3;var X3=k(()=>{v1();Q5=new Map,Y3={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class Q4{config;constructor($={}){this.config={...Fq,...$}}async get($,Z){return Z4($,Z,"image",this.config)}async set($,Z,Y){return Y4($,Z,Y,"image",this.config)}async clear(){return X4("image",this.config)}updateConfig($){this.config={...this.config,...$}}}function J3($){if(!J4)J4=new Q4($);else if($)J4.updateConfig($);return J4}async function G4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return J3(X).get($,Z)}async function K4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return J3(Q).set($,Z,Y)}async function BZ(){return J3().clear()}var Fq,J4=null;var Q3=k(()=>{X3();Fq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as Vq,basename as Rq,extname as Aq,join as wq}from"path";import{mkdir as Nq}from"fs/promises";async function G3(){try{return await import("ts-images")}catch{return null}}function jZ($){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 Tq($,Z){let Y=Z?jZ(Z):jZ("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 _Z($,Z,Y){let X=await G3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:$,processed:!1};let Q=await G4($,Z,Y);if(Q)return Q;try{let J=Vq($);if(!await w0(J))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let G=Tq(Y,Z.preset),K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await Nq(K,{recursive:!0});let W=await I0(J),z=Rq($,Aq($)),U=Z.outputFormat?[Z.outputFormat]:Y.defaultFormats||["avif","webp","jpeg"],B={src:$,processed:!0,variants:[],hash:W},_=null;if(Z.transformations&&Z.transformations.length>0)_=await K3(J,Z.transformations,X);for(let j of U){let H=G[j]||{},L=`${z}-${W}.${j}`,F=wq(K,L);try{let O=await X.optimizeImage({input:_||J,output:F,format:j,quality:H.quality,progressive:H.progressive});if(O){if(B.variants.push({path:F,url:`${q}/${L}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!B.originalWidth&&O.width)B.originalWidth=O.width,B.originalHeight=O.height}}catch(O){B.errors=B.errors||[],B.errors.push(`Failed to optimize ${j}: ${O}`)}}if(Z.embedThumbhash||Z.placeholder==="thumbhash")try{let j=await X.generateThumbHash(J);B.placeholder=j.dataUrl}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to generate thumbhash: ${j}`)}if(Z.useDominantColor)try{let j=await X.generatePlaceholder(J,{strategy:"dominant-color"});B.dominantColor=j.dominantColor}catch(j){B.errors=B.errors||[],B.errors.push(`Failed to extract dominant color: ${j}`)}return await K4($,Z,B,Y),B}catch(J){return{src:$,processed:!1,errors:[`Processing failed: ${J}`]}}}async function HZ($,Z,Y,X){let Q=await G3();if(!Q)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await Q.optimizeImage({input:$,output:X,format:Z,quality:Y}))?.outputSize}}catch(J){return{success:!1,error:String(J)}}}async function K3($,Z,Y){let X=Y||await G3();if(!X)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let Q=await X.decode($);for(let J of Z){let G=J.options||{};switch(J.type){case"resize":if(G.width||G.height)Q=await X.resize(Q,{width:G.width,height:G.height,fit:G.fit});break;case"blur":if(G.sigma!==void 0)Q=await X.blur(Q,G.sigma);break;case"sharpen":if(G.amount!==void 0)Q=await X.sharpen(Q,G.amount);break;case"grayscale":Q=await X.grayscale(Q);break;case"rotate":if(G.angle!==void 0)Q=await X.rotate(Q,G.angle);break;case"flip":Q=await X.flip(Q);break;case"flop":Q=await X.flop(Q);break;case"brightness":if(G.value!==void 0)Q=await X.brightness(Q,G.value);break;case"contrast":if(G.value!==void 0)Q=await X.contrast(Q,G.value);break;case"saturation":if(G.value!==void 0)Q=await X.saturation(Q,G.value);break}}return await X.encode(Q,"png")}catch(Q){return console.error(`[stx-media] Transformation failed: ${Q}`),null}}var OZ=k(()=>{v1();Q3()});import{resolve as Mq,basename as Iq,extname as Dq,join as Eq}from"path";import{mkdir as kq}from"fs/promises";async function bq(){try{return await import("ts-images")}catch{return null}}async function LZ($,Z,Y){let X=await bq();if(!X)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let Q=Mq($);if(!await w0(Q))return console.warn(`[stx-media] Source file not found: ${$}`),null;try{let J=Z.responsiveWidths||Y.breakpoints||Sq,G=Z.formats||Y.defaultFormats||["avif","webp","jpeg"],K=Y.outputDir||"dist/images",q=Y.baseUrl||"/images";await kq(K,{recursive:!0});let W=await I0(Q),z=Iq($,Dq($)),U=Y.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},B={src:$,byFormat:{},srcsets:{}};for(let j of G){B.byFormat[j]=[];let H=[];for(let L of J){let F=`${z}-${L}w-${W}.${j}`,O=Eq(K,F),V=`${q}/${F}`;try{let R=U[j]?.quality||80;if(await w0(O)){B.byFormat[j].push({path:O,url:V,width:L,height:0,format:j,size:0}),H.push(`${V} ${L}w`);continue}let A=await X.processImage({input:Q,output:O,format:j,quality:R,resize:{width:L}});if(A)B.byFormat[j].push({path:O,url:V,width:L,height:A.height||Math.round(L*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),H.push(`${V} ${L}w`)}catch(R){console.warn(`[stx-media] Failed to generate ${j} at ${L}w: ${R}`)}}B.srcsets[j]=H.join(", ")}let _=Z.placeholder||Y.placeholderStrategy||"thumbhash";if(_!=="none")try{if(_==="thumbhash"){let j=await X.generateThumbHash(Q);B.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await X.generatePlaceholder(Q,{strategy:_,width:20});B.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:_}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return B.sizes=Z.sizes||yq(J),B}catch(J){return console.error(`[stx-media] Responsive generation failed: ${J}`),null}}function yq($){let Z=[...$].sort((X,Q)=>X-Q),Y=[];for(let X=0;X<Z.length-1;X++){let Q=Z[X];Y.push(`(max-width: ${Q}px) ${Q}px`)}return Y.push(`${Z[Z.length-1]}px`),Y.join(", ")}function FZ($,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 Sq;var VZ=k(()=>{v1();Sq=[320,480,640,768,1024,1280,1536,1920]});var RZ={};r(RZ,{setCachedImageResult:()=>K4,processImage:()=>_Z,optimizeImage:()=>HZ,getCachedImageResult:()=>G4,generateSrcset:()=>FZ,generateResponsiveVariants:()=>LZ,clearImageCache:()=>BZ,applyTransformations:()=>K3,ImageProcessorCache:()=>Q4});var AZ=k(()=>{OZ();VZ();Q3()});async function Pq(){try{return await Promise.resolve().then(() => (AZ(),RZ))}catch($){if(!wZ)console.warn("[stx-media] Image processor not available, some features disabled:",$),wZ=!0;return null}}async function q4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipOptimization){if(Y.tsImagesConfig?.enabled&&!Y.isDev)return fq(X,Y)}if(Y.processedResult?.processed)return U3($,Y.processedResult,Z);if(Y.responsiveVariants)return IZ($,Y.responsiveVariants,Z);let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=J5,dpr:z,formats:U=s5,quality:B=q3,params:_={},placeholder:j="none",placeholderOptions:H={},lazy:L=!0,priority:F=!1,loading:O=F?"eager":z4,decoding:V=W4,fetchpriority:R,objectFit:A,objectPosition:w,crossorigin:N,referrerpolicy:T}=$,M=$.class,I=$.style,E=$.id,D=$.data||{},{isDev:P=!1,baseUrl:S=""}=Z;if(P&&!Z.optimize)return xq($);let b,C,h=E||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!F)try{b=await JZ(Q,{strategy:j,...H}),C=XZ(h,b,H)}catch{}let x=z!==void 0&&G!==void 0,u;if(x)u=vq($,h,b,Z);else u=await Cq($,h,b,Z);let t;if(F){let f0=U.includes("webp")?"webp":U[0],T0=s7(Q,W,{..._,q:B},f0),Z0=typeof q==="object"?r7(q):q||"100vw";t=`<link rel="preload" as="image" imagesrcset="${T0}" imagesizes="${Z0}" />`}let X0=[];if(!NZ&&j!=="none")X0.push($3),NZ=!0;if(C)X0.push(C);let $1=L?MZ(h):void 0;return{html:u,preloadLink:t,css:X0.length>0?X0.join(`
8637
+ `):void 0,script:$1}}async function Cq($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,sizes:q,widths:W=J5,formats:z=s5,quality:U=q3,params:B={},lazy:_=!0,priority:j=!1,loading:H=j?"eager":z4,decoding:L=W4,fetchpriority:F,objectFit:O,objectPosition:V,crossorigin:R,referrerpolicy:A}=$,w=$.class,N=$.style,T=$.data||{},M=typeof q==="object"?r7(q):q||"100vw",I=[];for(let P of z){let S=s7(Q,W,{...B,q:U},P),b=a7(P);if(_&&!j)I.push(` <source type="${b}" data-srcset="${S}" data-sizes="${M}" />`);else I.push(` <source type="${b}" srcset="${S}" sizes="${M}" />`)}let E=W3({src:r5(Q,{...B,q:U}),alt:J,width:G,height:K,loading:j?void 0:H,decoding:L,fetchpriority:j?"high":F,objectFit:O,objectPosition:V,crossorigin:R,referrerpolicy:A,className:TZ(w,Y),style:z3(N,O,V,Y),lazy:_&&!j,data:T}),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}">
8637
8638
  <picture>
8638
8639
  ${I.join(`
8639
8640
  `)}
@@ -8643,9 +8644,9 @@ ${I.join(`
8643
8644
  ${I.join(`
8644
8645
  `)}
8645
8646
  <img ${E} />
8646
- </picture>`;return D}function Pq($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=q3,params:U={},lazy:z=!0,priority:B=!1,loading:_=B?"eager":U4,decoding:j=W4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,R=$.class,A=$.style,w=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=$Z(Q,N,q,{...U,q:W}),M=W3({src:r5(Q,{...U,w:N,q:W}),alt:J,width:G,height:K,loading:B?void 0:_,decoding:j,fetchpriority:B?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:wZ(R,Y),style:U3(A,L,F,Y),lazy:z&&!B,data:w}),I=z&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let E=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
8647
+ </picture>`;return D}function vq($,Z,Y,X){let{src:Q,alt:J,width:G,height:K,dpr:q=[1,2,3],quality:W=q3,params:z={},lazy:U=!0,priority:B=!1,loading:_=B?"eager":z4,decoding:j=W4,fetchpriority:H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V}=$,R=$.class,A=$.style,w=$.data||{},N=typeof G==="number"?G:Number.parseInt(String(G),10),T=YZ(Q,N,q,{...z,q:W}),M=W3({src:r5(Q,{...z,w:N,q:W}),alt:J,width:G,height:K,loading:B?void 0:_,decoding:j,fetchpriority:B?"high":H,objectFit:L,objectPosition:F,crossorigin:O,referrerpolicy:V,className:TZ(R,Y),style:z3(A,L,F,Y),lazy:U&&!B,data:w}),I=U&&!B?`data-srcset="${T}"`:`srcset="${T}"`;if(Y){let E=`background-image: url('${Y.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${Z}" class="stx-img-placeholder" style="${E}">
8647
8648
  <img ${M} ${I} />
8648
- </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function Cq($){let{src:Z,alt:Y,width:X,height:Q,loading:J=U4,decoding:G=W4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,priority:B=!1}=$,_=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${W3({src:Z,alt:Y,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z,className:_,style:U3(j,q,W),id:H,data:L})} />`}}function W3($){let Z=[];if($.lazy)Z.push(`data-src="${n0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${n0($.src)}"`);if(Z.push(`alt="${n0($.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="${n0($.className)}"`);if($.style)Z.push(`style="${n0($.style)}"`);if($.id)Z.push(`id="${n0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${n0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function wZ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function U3($,Z,Y,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function n0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function NZ($){return`
8649
+ </div>`}return`<img ${Z?`id="${Z}" `:""}${M} ${I} />`}function xq($){let{src:Z,alt:Y,width:X,height:Q,loading:J=z4,decoding:G=W4,fetchpriority:K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,priority:B=!1}=$,_=$.class,j=$.style,H=$.id,L=$.data||{};return{html:`<img ${W3({src:Z,alt:Y,width:X,height:Q,loading:B?"eager":J,decoding:G,fetchpriority:B?"high":K,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U,className:_,style:z3(j,q,W),id:H,data:L})} />`}}function W3($){let Z=[];if($.lazy)Z.push(`data-src="${n0($.src)}"`),Z.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else Z.push(`src="${n0($.src)}"`);if(Z.push(`alt="${n0($.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="${n0($.className)}"`);if($.style)Z.push(`style="${n0($.style)}"`);if($.id)Z.push(`id="${n0($.id)}"`);if($.data)for(let[Y,X]of Object.entries($.data))Z.push(`data-${Y}="${n0(X)}"`);if($.lazy)Z.push("data-stx-lazy");return Z.join(" ")}function TZ($,Z){let Y=[];if($)Y.push($);if(Z)Y.push("stx-img-blur");return Y.join(" ")||""}function z3($,Z,Y,X){let Q=[];if(Z)Q.push(`object-fit: ${Z}`);if(Y)Q.push(`object-position: ${Y}`);if(X)Q.push("opacity: 0; transition: opacity 300ms ease-out");if($)Q.push($);return Q.join("; ")}function n0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function MZ($){return`
8649
8650
  (function() {
8650
8651
  const container = document.getElementById('${$}');
8651
8652
  if (!container) return;
@@ -8682,7 +8683,7 @@ ${I.join(`
8682
8683
 
8683
8684
  observer.observe(container);
8684
8685
  })();
8685
- `.trim()}async function vq($,Z){let Y=await Sq();if(!Y)return q4({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Y.generateResponsiveVariants($.src,$,X);if(J)return TZ($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return z3($,J,Z)}return q4({...$,process:!1},Z)}async function z3($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:U,referrerpolicy:z}=$,B=$.class,_=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((C)=>C.format==="jpeg")||L.find((C)=>C.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),R=new Map;for(let C of L){if(!R.has(C.format))R.set(C.format,[]);R.get(C.format).push(C)}let A=[],w=["avif","webp","jpeg","png"];for(let C of w){let h=R.get(C);if(h&&h.length>0){let x=h.map((t)=>`${t.url} ${t.width}w`).join(", "),u=a7(C);if(G&&!K)A.push(` <source type="${u}" data-srcset="${x}" />`);else A.push(` <source type="${u}" srcset="${x}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${n0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)N.push(`data-srcset="${V}"`)}else if(N.push(`src="${n0(O)}"`),V)N.push(`srcset="${V}"`);N.push(`alt="${n0(X)}"`);let T=Q||Z.originalWidth,M=J||Z.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(U)N.push(`crossorigin="${U}"`);if(z)N.push(`referrerpolicy="${z}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)N.push(`style="${I.join("; ")}"`);let E=[];if(B)E.push(B);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)N.push(`class="${E.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[C,h]of Object.entries(H))N.push(`data-${C}="${n0(h)}"`);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="${j}" class="stx-img-placeholder" style="${C}">
8686
+ `.trim()}async function fq($,Z){let Y=await Pq();if(!Y)return q4({...$,process:!1},Z);let X=Z.tsImagesConfig;if($.responsiveWidths&&$.responsiveWidths.length>0||$.widths&&$.widths.length>0||!$.width&&!$.dpr){let J=await Y.generateResponsiveVariants($.src,$,X);if(J)return IZ($,J,Z)}else{let J=await Y.processImage($.src,$,X);if(J.processed)return U3($,J,Z)}return q4({...$,process:!1},Z)}async function U3($,Z,Y){let{alt:X,width:Q,height:J,lazy:G=!0,priority:K=!1,objectFit:q,objectPosition:W,crossorigin:z,referrerpolicy:U}=$,B=$.class,_=$.style,j=$.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,H=$.data||{},L=Z.variants||[],F=L.find((C)=>C.format==="jpeg")||L.find((C)=>C.format==="webp")||L[0],O=F?.url||$.src,V=L.filter((C)=>C.format===(F?.format||"jpeg")).map((C)=>`${C.url} ${C.width}w`).join(", "),R=new Map;for(let C of L){if(!R.has(C.format))R.set(C.format,[]);R.get(C.format).push(C)}let A=[],w=["avif","webp","jpeg","png"];for(let C of w){let h=R.get(C);if(h&&h.length>0){let x=h.map((t)=>`${t.url} ${t.width}w`).join(", "),u=a7(C);if(G&&!K)A.push(` <source type="${u}" data-srcset="${x}" />`);else A.push(` <source type="${u}" srcset="${x}" />`)}}let N=[];if(G&&!K){if(N.push(`data-src="${n0(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),V)N.push(`data-srcset="${V}"`)}else if(N.push(`src="${n0(O)}"`),V)N.push(`srcset="${V}"`);N.push(`alt="${n0(X)}"`);let T=Q||Z.originalWidth,M=J||Z.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);if(!K)N.push(`loading="${G?"lazy":"eager"}"`);if(N.push('decoding="async"'),K)N.push('fetchpriority="high"');if(z)N.push(`crossorigin="${z}"`);if(U)N.push(`referrerpolicy="${U}"`);let I=[];if(q)I.push(`object-fit: ${q}`);if(W)I.push(`object-position: ${W}`);if(Z.placeholder&&G)I.push("opacity: 0; transition: opacity 300ms ease-out");if(_)I.push(_);if(I.length>0)N.push(`style="${I.join("; ")}"`);let E=[];if(B)E.push(B);if(Z.placeholder)E.push("stx-img-blur");if(E.length>0)N.push(`class="${E.join(" ")}"`);if(G&&!K)N.push("data-stx-lazy");for(let[C,h]of Object.entries(H))N.push(`data-${C}="${n0(h)}"`);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="${j}" class="stx-img-placeholder" style="${C}">
8686
8687
  <picture>
8687
8688
  ${A.join(`
8688
8689
  `)}
@@ -8692,12 +8693,12 @@ ${A.join(`
8692
8693
  ${A.join(`
8693
8694
  `)}
8694
8695
  <img ${N.join(" ")} />
8695
- </picture>`;let P=[];if(Z.placeholder)P.push($3);let S=G?NZ(j):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:b,css:P.length>0?P.join(`
8696
- `):void 0,script:S}}async function TZ($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,J]of Object.entries(Z.byFormat))if(J)X.variants.push(...J);return z3($,X,Y)}var RZ=!1,q3=80,W4="async",U4="lazy",AZ=!1;var MZ=k(()=>{t7();XZ()});function xq(){return e$({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:Q,alt:J,options:G}=fq($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||J5,formats:G.formats||s5,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 q4(K,{isDev:q}),U=W.html;if(W.preloadLink)U=W.preloadLink+`
8697
- `+U;if(W.css)U+=`
8698
- <style>${W.css}</style>`;if(W.script)U+=`
8699
- <script>${W.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function fq($,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 Q=gq(X),J=B3(Q[0],Y)||"",G=B3(Q[1],Y)||"",K={};if(Q[2]){let q=B3(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:J,alt:G,options:K}}function gq($){let Z=[],Y="",X=!1,Q="",J=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,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function B3($,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 IZ;var DZ=k(()=>{o7();MZ();t7();IZ=xq()});class B4{config;constructor($={}){this.config={...hq,...$}}async get($,Z){return Z4($,Z,"video",this.config)}async set($,Z,Y){return Y4($,Z,Y,"video",this.config)}async clear(){return X4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function j3($){if(!z4)z4=new B4($);else if($)z4.updateConfig($);return z4}async function j4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return j3(X).get($,Z)}async function _4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return j3(Q).set($,Z,Y)}async function EZ(){return j3().clear()}var hq,z4=null;var _3=k(()=>{X3();hq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as H3,basename as O3,extname as L3,join as H4}from"path";import{mkdir as F3}from"fs/promises";async function V3(){try{return await import("ts-videos")}catch{return null}}async function O4($,Z,Y,X){let Q=await V3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=H3($);if(!await w0(J))return null;await F3(Y,{recursive:!0});let G=await I0(J),K=O3($,L3($)),q=Z.format||"webp",W=Z.timestamp||0,U=`${K}-poster-${G}.${q}`,z=H4(Y,U),B=await Q.extractThumbnails(J,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:U.replace(`.${q}`,"")});if(B&&B.length>0){let _=B[0];return{path:z,url:`${X}/${U}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:W,size:_.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function L4($,Z,Y,X){let Q=await V3();if(!Q)return[];try{let J=H3($);if(!await w0(J))return[];await F3(Y,{recursive:!0});let G=await I0(J),K=O3($,L3($)),q=Z.format||"webp",z=(await new Q.Input(J).getInfo()).duration||60,B=Z.count||10,_=Z.interval||z/B,j=[];for(let L=0;L<B&&L*_<z;L++)j.push(L*_);let H=await Q.extractThumbnails(J,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||H4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function kZ($,Z,Y,X){let Q=await V3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=H3($);if(!await w0(J))return null;await F3(Y,{recursive:!0});let G=await I0(J),K=O3($,L3($)),U=(await new Q.Input(J).getInfo()).duration||60,z=Z.columns||10,B=Z.interval||5,_=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(U/B),F=Math.ceil(L/z),O=`${K}-sprite-${G}.${H}`,V=H4(Y,O),R=[];for(let w=0;w<L;w++)R.push(w*B);let A=await Q.extractThumbnails(J,{timestamps:R,width:_,height:j,format:H,quality:Z.quality||70,outputDir:H4(Y,".temp")});if(!A||A.length===0)return null;try{let w=await import("ts-images"),N=z*_,T=F*j,M=await w.createSprite({images:A.map((I)=>I.path),columns:z,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:z,rows:F,thumbnailWidth:_,thumbnailHeight:j,interval:B,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var R3=k(()=>{v1()});import{resolve as SZ,basename as yZ,extname as PZ,join as x1}from"path";import{mkdir as F4,writeFile as CZ}from"fs/promises";async function vZ(){try{return await import("ts-videos")}catch{return null}}async function V4($,Z,Y,X,Q){let J=await vZ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=SZ($);if(!await w0(G))return null;let K=await I0(G),q=yZ($,PZ($)),W=x1(Y,`${q}-${K}-hls`);await F4(W,{recursive:!0});let U=Z.length>0?Z:xZ,z=Q?.segmentDuration||6,j=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of U){let R=x1(W,V.label);await F4(R,{recursive:!0});let A=`${V.label}.m3u8`,w=x1(R,A);try{let N=await J.generateHLS(G,{outputDir:R,segmentDuration:z,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(N)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${A}`,path:w}),L+=N.segmentCount||Math.ceil(j/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${N}`)}}if(H.length===0)return null;let F=x1(W,"master.m3u8"),O=dq(H,X,q,K);return await CZ(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function dq($,Z,Y,X){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let J of $){let{quality:G}=J,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
8700
- `)}async function R4($,Z,Y,X,Q){let J=await vZ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=SZ($);if(!await w0(G))return null;let K=await I0(G),q=yZ($,PZ($)),W=x1(Y,`${q}-${K}-dash`);await F4(W,{recursive:!0});let U=Z.length>0?Z:xZ,z=Q?.segmentDuration||4,B=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of U){let w=x1(W,A.label);await F4(w,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:w,segmentDuration:z,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${X}/${q}-${K}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${X}/${q}-${K}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(L.length===0)return null;let O=x1(W,"manifest.mpd"),V=mq(L,F,H,z,B);await CZ(O,V);let R=[{type:"video",representations:L}];if(F.length>0)R.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:R,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function mq($,Z,Y,X,Q){let J=bZ(Y),G=bZ(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
8696
+ </picture>`;let P=[];if(Z.placeholder)P.push($3);let S=G?MZ(j):void 0,b;if(K&&V)b=`<link rel="preload" as="image" imagesrcset="${V}" />`;return{html:D,preloadLink:b,css:P.length>0?P.join(`
8697
+ `):void 0,script:S}}async function IZ($,Z,Y){let X={src:Z.src,processed:!0,variants:[],placeholder:Z.placeholder?.dataURL,originalWidth:Z.placeholder?.width,originalHeight:Z.placeholder?.height};for(let[Q,J]of Object.entries(Z.byFormat))if(J)X.variants.push(...J);return U3($,X,Y)}var wZ=!1,q3=80,W4="async",z4="lazy",NZ=!1;var DZ=k(()=>{t7();QZ()});function gq(){return e$({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async($,Z,Y,X)=>{let{src:Q,alt:J,options:G}=hq($,Z,Y);if(!Q)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let K={src:Q,alt:J||"",widths:G.widths||J5,formats:G.formats||s5,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 q4(K,{isDev:q}),z=W.html;if(W.preloadLink)z=W.preloadLink+`
8698
+ `+z;if(W.css)z+=`
8699
+ <style>${W.css}</style>`;if(W.script)z+=`
8700
+ <script>${W.script}</script>`;return z},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function hq($,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 Q=dq(X),J=B3(Q[0],Y)||"",G=B3(Q[1],Y)||"",K={};if(Q[2]){let q=B3(Q[2],Y);if(typeof q==="object"&&q!==null)K=q;else if(typeof Q[2]==="string")try{K=JSON.parse(Q[2])}catch{}}return{src:J,alt:G,options:K}}function dq($){let Z=[],Y="",X=!1,Q="",J=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,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function B3($,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 EZ;var kZ=k(()=>{o7();DZ();t7();EZ=gq()});class B4{config;constructor($={}){this.config={...mq,...$}}async get($,Z){return Z4($,Z,"video",this.config)}async set($,Z,Y){return Y4($,Z,Y,"video",this.config)}async clear(){return X4("video",this.config)}updateConfig($){this.config={...this.config,...$}}}function j3($){if(!U4)U4=new B4($);else if($)U4.updateConfig($);return U4}async function j4($,Z,Y){let X=Y?{directory:`${Y.outputDir}/../.cache`}:{};return j3(X).get($,Z)}async function _4($,Z,Y,X){let Q=X?{directory:`${X.outputDir}/../.cache`}:{};return j3(Q).set($,Z,Y)}async function bZ(){return j3().clear()}var mq,U4=null;var _3=k(()=>{X3();mq={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as H3,basename as O3,extname as L3,join as H4}from"path";import{mkdir as F3}from"fs/promises";async function V3(){try{return await import("ts-videos")}catch{return null}}async function O4($,Z,Y,X){let Q=await V3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let J=H3($);if(!await w0(J))return null;await F3(Y,{recursive:!0});let G=await I0(J),K=O3($,L3($)),q=Z.format||"webp",W=Z.timestamp||0,z=`${K}-poster-${G}.${q}`,U=H4(Y,z),B=await Q.extractThumbnails(J,{timestamps:[W],width:Z.width||1280,height:Z.height,format:q,quality:Z.quality||85,outputDir:Y,outputPattern:z.replace(`.${q}`,"")});if(B&&B.length>0){let _=B[0];return{path:U,url:`${X}/${z}`,width:_.width||Z.width||1280,height:_.height||720,timestamp:W,size:_.size||0}}return null}catch(J){return console.warn(`[stx-media] Failed to generate poster: ${J}`),null}}async function L4($,Z,Y,X){let Q=await V3();if(!Q)return[];try{let J=H3($);if(!await w0(J))return[];await F3(Y,{recursive:!0});let G=await I0(J),K=O3($,L3($)),q=Z.format||"webp",U=(await new Q.Input(J).getInfo()).duration||60,B=Z.count||10,_=Z.interval||U/B,j=[];for(let L=0;L<B&&L*_<U;L++)j.push(L*_);let H=await Q.extractThumbnails(J,{timestamps:j,width:Z.width||320,format:q,quality:Z.quality||80,outputDir:Y,outputPattern:`${K}-thumb-${G}`});if(H&&H.length>0)return H.map((L,F)=>({path:L.path||H4(Y,`${K}-thumb-${G}-${F}.${q}`),url:`${X}/${K}-thumb-${G}-${F}.${q}`,width:L.width||Z.width||320,height:L.height||180,timestamp:j[F],size:L.size||0}));return[]}catch(J){return console.warn(`[stx-media] Failed to generate thumbnails: ${J}`),[]}}async function SZ($,Z,Y,X){let Q=await V3();if(!Q)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let J=H3($);if(!await w0(J))return null;await F3(Y,{recursive:!0});let G=await I0(J),K=O3($,L3($)),z=(await new Q.Input(J).getInfo()).duration||60,U=Z.columns||10,B=Z.interval||5,_=Z.thumbnailWidth||160,j=Z.thumbnailHeight||90,H=Z.format||"jpeg",L=Math.ceil(z/B),F=Math.ceil(L/U),O=`${K}-sprite-${G}.${H}`,V=H4(Y,O),R=[];for(let w=0;w<L;w++)R.push(w*B);let A=await Q.extractThumbnails(J,{timestamps:R,width:_,height:j,format:H,quality:Z.quality||70,outputDir:H4(Y,".temp")});if(!A||A.length===0)return null;try{let w=await import("ts-images"),N=U*_,T=F*j,M=await w.createSprite({images:A.map((I)=>I.path),columns:U,padding:0,outputPath:V,format:H,quality:Z.quality||70});return{url:`${X}/${O}`,path:V,columns:U,rows:F,thumbnailWidth:_,thumbnailHeight:j,interval:B,totalFrames:L}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(J){return console.warn(`[stx-media] Failed to generate sprite sheet: ${J}`),null}}var R3=k(()=>{v1()});import{resolve as PZ,basename as CZ,extname as vZ,join as x1}from"path";import{mkdir as F4,writeFile as xZ}from"fs/promises";async function fZ(){try{return await import("ts-videos")}catch{return null}}async function V4($,Z,Y,X,Q){let J=await fZ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let G=PZ($);if(!await w0(G))return null;let K=await I0(G),q=CZ($,vZ($)),W=x1(Y,`${q}-${K}-hls`);await F4(W,{recursive:!0});let z=Z.length>0?Z:gZ,U=Q?.segmentDuration||6,j=(await new J.Input(G).getInfo()).duration||0,H=[],L=0;for(let V of z){let R=x1(W,V.label);await F4(R,{recursive:!0});let A=`${V.label}.m3u8`,w=x1(R,A);try{let N=await J.generateHLS(G,{outputDir:R,segmentDuration:U,width:V.width,height:V.height,videoBitrate:V.bitrate,audioBitrate:V.audioBitrate,playlistName:V.label});if(N)H.push({quality:V,url:`${X}/${q}-${K}-hls/${V.label}/${A}`,path:w}),L+=N.segmentCount||Math.ceil(j/U)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${V.label}: ${N}`)}}if(H.length===0)return null;let F=x1(W,"master.m3u8"),O=uq(H,X,q,K);return await xZ(F,O),{manifestUrl:`${X}/${q}-${K}-hls/master.m3u8`,manifestPath:F,playlists:H,segmentCount:L,duration:j}}catch(G){return console.warn(`[stx-media] Failed to generate HLS manifest: ${G}`),null}}function uq($,Z,Y,X){let Q=["#EXTM3U","#EXT-X-VERSION:3"];for(let J of $){let{quality:G}=J,K=G.bitrate+(G.audioBitrate||128000),q=`${G.width}x${G.height||Math.round(G.width*9/16)}`;Q.push(`#EXT-X-STREAM-INF:BANDWIDTH=${K},RESOLUTION=${q},NAME="${G.label}"`,`${G.label}/${G.label}.m3u8`)}return Q.join(`
8701
+ `)}async function R4($,Z,Y,X,Q){let J=await fZ();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let G=PZ($);if(!await w0(G))return null;let K=await I0(G),q=CZ($,vZ($)),W=x1(Y,`${q}-${K}-dash`);await F4(W,{recursive:!0});let z=Z.length>0?Z:gZ,U=Q?.segmentDuration||4,B=Q?.minBufferTime||2,H=(await new J.Input(G).getInfo()).duration||0,L=[],F=[];for(let A of z){let w=x1(W,A.label);await F4(w,{recursive:!0});try{if(await J.generateDASH(G,{outputDir:w,segmentDuration:U,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(L.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${X}/${q}-${K}-dash/${A.label}/video`}),A.audioBitrate)F.push({bandwidth:A.audioBitrate,url:`${X}/${q}-${K}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(L.length===0)return null;let O=x1(W,"manifest.mpd"),V=lq(L,F,H,U,B);await xZ(O,V);let R=[{type:"video",representations:L}];if(F.length>0)R.push({type:"audio",representations:F});return{manifestUrl:`${X}/${q}-${K}-dash/manifest.mpd`,manifestPath:O,adaptationSets:R,duration:H}}catch(G){return console.warn(`[stx-media] Failed to generate DASH manifest: ${G}`),null}}function lq($,Z,Y,X,Q){let J=yZ(Y),G=yZ(Q),K=`<?xml version="1.0" encoding="UTF-8"?>
8701
8702
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
8702
8703
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
8703
8704
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -8723,7 +8724,7 @@ ${A.join(`
8723
8724
  </Representation>
8724
8725
  `}K+=` </AdaptationSet>
8725
8726
  `}return K+=` </Period>
8726
- </MPD>`,K}function bZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${X}S`,Q}var xZ;var A3=k(()=>{v1();xZ=[{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 fZ,basename as uq,extname as lq,join as pq}from"path";import{mkdir as cq}from"fs/promises";async function gZ(){try{return await import("ts-videos")}catch{return null}}function iq($){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 nq($){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 w3($){let Z=await gZ();if(!Z)return null;try{let Y=fZ($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function hZ($,Z,Y,X){let Q=await gZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await j4($,Z,Y);if(J)return J;try{let G=fZ($);if(!await w0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await cq(K,{recursive:!0});let W=await I0(G),U=uq($,lq($)),z={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),z.metadata=await w3(G)||void 0;let B={};if(Z.quality)B.bitrate=iq(Z.quality);if(Z.platform)Object.assign(B,nq(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${U}-${W}.mp4`,j=pq(K,_);try{let H=await oq(G,j,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)z.transcoded={path:j,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await O4(G,_,K,q);if(j)z.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await L4(G,Y.thumbnails,K,q);if(_.length>0)z.thumbnails=_}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let j=await V4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,hls:j}}if(_.format==="dash"){let j=await R4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)z.streaming={...z.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await _4($,Z,z,Y),z}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function oq($,Z,Y,X,Q){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)=>{Q?.(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(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var dZ=k(()=>{v1();_3();R3();A3()});var mZ={};r(mZ,{setCachedVideoResult:()=>_4,processVideo:()=>hZ,getCachedVideoResult:()=>j4,generateThumbnails:()=>L4,generateSpriteSheet:()=>kZ,generatePoster:()=>O4,generateHLSManifest:()=>V4,generateDASHManifest:()=>R4,clearVideoCache:()=>EZ,analyzeVideo:()=>w3,VideoProcessorCache:()=>B4});var uZ=k(()=>{dZ();R3();A3();_3()});async function pZ(){try{return await Promise.resolve().then(() => (uZ(),mZ))}catch($){if(!lZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),lZ=!0;return null}}async function A4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return $W(X,Y)}if(Y.processedResult?.processed)return oZ($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await ZW(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=cZ,autoplay:U=!1,muted:z=!1,loop:B=!1,preload:_=iZ,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:R,disablePictureInPicture:A=!1,disableRemotePlayback:w=!1}=$,N=Q||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return aq($,Z);if(F&&F!=="video")return rq(J||"",F,$);let E=G.length>0?G:J?[{src:J,type:nZ(J)}]:[],D=[`id="${I}"`];if(W)D.push("controls");if(U)D.push("autoplay");if(z)D.push("muted");if(B)D.push("loop");if(j)D.push("playsinline");if(A)D.push("disablepictureinpicture");if(w)D.push("disableremoteplayback");if(R)D.push(`crossorigin="${R}"`);if(H){if(D.push(`data-preload="${_}"`),D.push('preload="none"'),N)D.push(`data-poster="${_0(N)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${_}"`),N)D.push(`poster="${_0(N)}"`);if(O)D.push(`width="${O}"`);if(V)D.push(`height="${V}"`);if(T)D.push(`class="${_0(T)}"`);if(M)D.push(`style="${_0(M)}"`);let P=E.map((C)=>{return` <source ${H?`data-src="${_0(C.src)}"`:`src="${_0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
8727
+ </MPD>`,K}function yZ($){let Z=Math.floor($/3600),Y=Math.floor($%3600/60),X=Math.floor($%60),Q="PT";if(Z>0)Q+=`${Z}H`;if(Y>0)Q+=`${Y}M`;return Q+=`${X}S`,Q}var gZ;var A3=k(()=>{v1();gZ=[{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 hZ,basename as pq,extname as cq,join as iq}from"path";import{mkdir as nq}from"fs/promises";async function dZ(){try{return await import("ts-videos")}catch{return null}}function oq($){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 sq($){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 w3($){let Z=await dZ();if(!Z)return null;try{let Y=hZ($),Q=await new Z.Input(Y).getInfo();return{duration:Q.duration||0,width:Q.width||0,height:Q.height||0,frameRate:Q.frameRate||0,bitrate:Q.bitrate||0,codec:Q.videoCodec||"",audioCodec:Q.audioCodec}}catch(Y){return console.warn(`[stx-media] Failed to analyze video: ${Y}`),null}}async function mZ($,Z,Y,X){let Q=await dZ();if(!Q)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:$,processed:!1};let J=await j4($,Z,Y);if(J)return J;try{let G=hZ($);if(!await w0(G))return{src:$,processed:!1,errors:[`Source file not found: ${$}`]};let K=Y.outputDir||"dist/videos",q=Y.baseUrl||"/videos";await nq(K,{recursive:!0});let W=await I0(G),z=pq($,cq($)),U={src:$,processed:!0,hash:W};X?.({percentage:5,stage:"analyzing"}),U.metadata=await w3(G)||void 0;let B={};if(Z.quality)B.bitrate=oq(Z.quality);if(Z.platform)Object.assign(B,sq(Z.platform));if(Z.transcode)Object.assign(B,Z.transcode);if(Object.keys(B).length>0||Z.process){X?.({percentage:10,stage:"transcoding"});let _=`${z}-${W}.mp4`,j=iq(K,_);try{let H=await rq(G,j,B,Q,(L)=>X?.({percentage:10+L*0.5,stage:"transcoding"}));if(H)U.transcoded={path:j,url:`${q}/${_}`,duration:H.duration,size:H.size,video:{codec:B.codec||"h264",width:H.width,height:H.height,bitrate:H.bitrate,frameRate:H.frameRate},audio:H.audioCodec?{codec:B.audioCodec||"aac",bitrate:B.audioBitrate||128000,sampleRate:B.sampleRate||48000,channels:B.channels||2}:void 0}}catch(H){U.errors=U.errors||[],U.errors.push(`Transcoding failed: ${H}`)}}if(Z.generatePoster){X?.({percentage:65,stage:"generating-poster"});let _=typeof Z.generatePoster==="object"?Z.generatePoster:{timestamp:0},j=await O4(G,_,K,q);if(j)U.poster=j}if(Y.thumbnails?.enabled){X?.({percentage:70,stage:"generating-thumbnails"});let _=await L4(G,Y.thumbnails,K,q);if(_.length>0)U.thumbnails=_}if(Z.streaming){X?.({percentage:80,stage:"generating-manifests"});let _=typeof Z.streaming==="object"?Z.streaming:Y.streaming||{format:"hls"};if(_.format==="hls"||_.format===void 0){let j=await V4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,hls:j}}if(_.format==="dash"){let j=await R4(G,_.qualities||Y.streaming?.defaultQualities||[],K,q);if(j)U.streaming={...U.streaming,dash:j}}}if(Z.spriteSheet)X?.({percentage:90,stage:"generating-sprite-sheet"});return X?.({percentage:100,stage:"complete"}),await _4($,Z,U,Y),U}catch(G){return{src:$,processed:!1,errors:[`Processing failed: ${G}`]}}}async function rq($,Z,Y,X,Q){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)=>{Q?.(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(J){return console.error(`[stx-media] Transcoding failed: ${J}`),null}}var uZ=k(()=>{v1();_3();R3();A3()});var lZ={};r(lZ,{setCachedVideoResult:()=>_4,processVideo:()=>mZ,getCachedVideoResult:()=>j4,generateThumbnails:()=>L4,generateSpriteSheet:()=>SZ,generatePoster:()=>O4,generateHLSManifest:()=>V4,generateDASHManifest:()=>R4,clearVideoCache:()=>bZ,analyzeVideo:()=>w3,VideoProcessorCache:()=>B4});var pZ=k(()=>{uZ();R3();A3();_3()});async function iZ(){try{return await Promise.resolve().then(() => (pZ(),lZ))}catch($){if(!cZ)console.warn("[stx-media] Video processor not available, some features disabled:",$),cZ=!0;return null}}async function A4($,Z={}){let Y=Z,X=$;if(X.process&&!X.skipProcessing){if(Y.tsVideosConfig?.enabled&&!Y.isDev)return YW(X,Y)}if(Y.processedResult?.processed)return rZ($,Y.processedResult,Z);let Q;if(X.generatePoster&&X.src&&!$.poster)Q=await XW(X,Y);let{src:J,sources:G=[],poster:K,posterPlaceholder:q,controls:W=nZ,autoplay:z=!1,muted:U=!1,loop:B=!1,preload:_=oZ,playsinline:j=!0,lazy:H=!0,player:L="native",type:F,width:O,height:V,crossorigin:R,disablePictureInPicture:A=!1,disableRemotePlayback:w=!1}=$,N=Q||K,T=$.class,M=$.style,I=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(L==="ts-video")return eq($,Z);if(F&&F!=="video")return tq(J||"",F,$);let E=G.length>0?G:J?[{src:J,type:sZ(J)}]:[],D=[`id="${I}"`];if(W)D.push("controls");if(z)D.push("autoplay");if(U)D.push("muted");if(B)D.push("loop");if(j)D.push("playsinline");if(A)D.push("disablepictureinpicture");if(w)D.push("disableremoteplayback");if(R)D.push(`crossorigin="${R}"`);if(H){if(D.push(`data-preload="${_}"`),D.push('preload="none"'),N)D.push(`data-poster="${_0(N)}"`);D.push("data-stx-lazy")}else if(D.push(`preload="${_}"`),N)D.push(`poster="${_0(N)}"`);if(O)D.push(`width="${O}"`);if(V)D.push(`height="${V}"`);if(T)D.push(`class="${_0(T)}"`);if(M)D.push(`style="${_0(M)}"`);let P=E.map((C)=>{return` <source ${H?`data-src="${_0(C.src)}"`:`src="${_0(C.src)}"`} type="${C.type}"${C.media?` media="${C.media}"`:""} />`}).join(`
8727
8728
  `),S=`<video ${D.join(" ")}>
8728
8729
  ${P}
8729
8730
  Your browser does not support the video tag.
@@ -8762,16 +8763,16 @@ ${P}
8762
8763
 
8763
8764
  observer.observe(video);
8764
8765
  })();
8765
- `.trim();return{html:S,script:b}}function rq($,Z,Y){let{width:X=640,height:Q=360}=Y,J=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=tq($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=eq($),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 U=[`id="${K}"`,`src="${_0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)U.push(`class="${_0(J)}"`);if(G)U.push(`style="${_0(G)}"`);if(Y.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
8766
- <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
8767
- </div>`}}function aq($,Z={}){let{src:Y,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:U=!0,lazy:z=!0,width:B,height:_}=$,j=$.class,H=$.style,L=$.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,F={src:X.length>0?X:Y,autoplay:G,loop:q,muted:K,playsinline:U,preload:W,poster:Q,controls:J,title:$.title},O=["position: relative",B?`width: ${typeof B==="number"?B+"px":B}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),V=`
8766
+ `.trim();return{html:S,script:b}}function tq($,Z,Y){let{width:X=640,height:Q=360}=Y,J=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=$W($),q=W?`https://www.youtube-nocookie.com/embed/${W}`:$;break;case"vimeo":W=ZW($),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="${_0(q)}"`,`width="${X}"`,`height="${Q}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(J)z.push(`class="${_0(J)}"`);if(G)z.push(`style="${_0(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;">
8767
+ <iframe ${z.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
8768
+ </div>`}}function eq($,Z={}){let{src:Y,sources:X=[],poster:Q,controls:J=!0,autoplay:G=!1,muted:K=!1,loop:q=!1,preload:W="metadata",playsinline:z=!0,lazy:U=!0,width:B,height:_}=$,j=$.class,H=$.style,L=$.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:Q,controls:J,title:$.title},O=["position: relative",B?`width: ${typeof B==="number"?B+"px":B}`:"width: 100%",_?`height: ${typeof _==="number"?_+"px":_}`:"",H||""].filter(Boolean).join("; "),V=`
8768
8769
  <div
8769
8770
  id="${L}"
8770
8771
  class="ts-video-player${j?" "+_0(j):""}"
8771
8772
  style="${O}"
8772
8773
  data-ts-video-player
8773
8774
  data-config='${JSON.stringify(F)}'
8774
- ${z?"data-lazy":""}
8775
+ ${U?"data-lazy":""}
8775
8776
  >
8776
8777
  <div class="ts-video-player__container">
8777
8778
  ${Q?`
@@ -8801,7 +8802,7 @@ ${P}
8801
8802
 
8802
8803
  // Load ts-video-player from CDN
8803
8804
  var script = document.createElement('script');
8804
- script.src = '${sq}';
8805
+ script.src = '${aq}';
8805
8806
  script.onload = initPlayer;
8806
8807
  script.onerror = function() {
8807
8808
  console.error('[stx] Failed to load ts-video-player');
@@ -8931,7 +8932,7 @@ else {
8931
8932
  .ts-video-player__play-button svg {
8932
8933
  margin-left: 4px;
8933
8934
  }
8934
- `.trim();return{html:V,script:R,css:A}}function nZ($){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 tq($){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 eq($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function _0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function $W($,Z){let Y=await pZ();if(!Y)return A4({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return oZ($,Q,Z);return A4({...$,process:!1},Z)}async function ZW($,Z){let Y=await pZ();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function oZ($,Z,Y){let{controls:X=cZ,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=iZ,playsinline:q=!0,lazy:W=!0,width:U,height:z,crossorigin:B,disablePictureInPicture:_=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=nZ(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let R=Z.streaming?.hls||Z.streaming?.dash;if(R){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,w=[`id="${F}"`];if(X)w.push("controls");if(Q)w.push("autoplay");if(J)w.push("muted");if(G)w.push("loop");if(q)w.push("playsinline");if(_)w.push("disablepictureinpicture");if(j)w.push("disableremoteplayback");if(B)w.push(`crossorigin="${B}"`);if(W){if(w.push(`data-preload="${K}"`),w.push('preload="none"'),A)w.push(`data-poster="${_0(A)}"`);w.push("data-stx-lazy")}else if(w.push(`preload="${K}"`),A)w.push(`poster="${_0(A)}"`);let N=U||Z.metadata?.width,T=z||Z.metadata?.height;if(N)w.push(`width="${N}"`);if(T)w.push(`height="${T}"`);if(H)w.push(`class="${_0(H)}"`);if(L)w.push(`style="${_0(L)}"`);let I=` <source ${W?`data-src="${_0(O)}"`:`src="${_0(O)}"`} type="${V}" />`,E=`<video ${w.join(" ")}>
8935
+ `.trim();return{html:V,script:R,css:A}}function sZ($){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 $W($){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 ZW($){let Z=$.match(/vimeo\.com\/(\d+)/);return Z?Z[1]:null}function _0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function YW($,Z){let Y=await iZ();if(!Y)return A4({...$,process:!1},Z);let X=Z.tsVideosConfig,Q=await Y.processVideo($.src,$,X,$.onProcessProgress);if(Q.processed)return rZ($,Q,Z);return A4({...$,process:!1},Z)}async function XW($,Z){let Y=await iZ();if(!Y||!$.src)return;let X=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},Q=Z.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Y.generatePoster($.src,X,Q.outputDir,Q.baseUrl||"/videos"))?.url}function rZ($,Z,Y){let{controls:X=nZ,autoplay:Q=!1,muted:J=!1,loop:G=!1,preload:K=oZ,playsinline:q=!0,lazy:W=!0,width:z,height:U,crossorigin:B,disablePictureInPicture:_=!1,disableRemotePlayback:j=!1}=$,H=$.class,L=$.style,F=$.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=$.src,V=sZ(O);if(Z.transcoded)O=Z.transcoded.url,V="video/mp4";let R=Z.streaming?.hls||Z.streaming?.dash;if(R){if(Z.streaming?.hls)O=Z.streaming.hls.manifestUrl,V="application/x-mpegURL";else if(Z.streaming?.dash)O=Z.streaming.dash.manifestUrl,V="application/dash+xml"}let A=Z.poster?.url||$.poster,w=[`id="${F}"`];if(X)w.push("controls");if(Q)w.push("autoplay");if(J)w.push("muted");if(G)w.push("loop");if(q)w.push("playsinline");if(_)w.push("disablepictureinpicture");if(j)w.push("disableremoteplayback");if(B)w.push(`crossorigin="${B}"`);if(W){if(w.push(`data-preload="${K}"`),w.push('preload="none"'),A)w.push(`data-poster="${_0(A)}"`);w.push("data-stx-lazy")}else if(w.push(`preload="${K}"`),A)w.push(`poster="${_0(A)}"`);let N=z||Z.metadata?.width,T=U||Z.metadata?.height;if(N)w.push(`width="${N}"`);if(T)w.push(`height="${T}"`);if(H)w.push(`class="${_0(H)}"`);if(L)w.push(`style="${_0(L)}"`);let I=` <source ${W?`data-src="${_0(O)}"`:`src="${_0(O)}"`} type="${V}" />`,E=`<video ${w.join(" ")}>
8935
8936
  ${I}
8936
8937
  Your browser does not support the video tag.
8937
8938
  </video>`;if(Z.spriteSheet)E=`<div class="stx-video-wrapper" data-sprite-sheet="${_0(Z.spriteSheet.url)}" data-sprite-cols="${Z.spriteSheet.columns}" data-sprite-interval="${Z.spriteSheet.interval}">
@@ -8980,9 +8981,9 @@ ${E}
8980
8981
  width: 100%;
8981
8982
  height: auto;
8982
8983
  }
8983
- `.trim();return{html:E,script:D,css:P}}var lZ=!1,cZ=!0,iZ="metadata",sq="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var sZ=k(()=>{T3()});function rZ(){return e$({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:Q,options:J}=YW($,Z,Y);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:J.poster,controls:J.controls!==!1,autoplay:J.autoplay||!1,muted:J.muted||!1,loop:J.loop||!1,preload:J.preload||"metadata",playsinline:J.playsinline!==!1,lazy:J.lazy!==!1,player:J.player||"native",type:J.type,width:J.width,height:J.height,class:J.class,style:J.style,id:J.id,crossorigin:J.crossorigin,disablePictureInPicture:J.disablePictureInPicture,disableRemotePlayback:J.disableRemotePlayback,title:J.title,quality:J.quality,platform:J.platform,process:J.process,generatePoster:J.generatePoster,streaming:J.streaming,transcode:J.transcode,spriteSheet:J.spriteSheet,waveform:J.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await A4(G,q),U=W.html;if(W.css)U+=`
8984
- <style>${W.css}</style>`;if(W.script)U+=`
8985
- <script>${W.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function YW($,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 Q=XW(X),J=aZ(Q[0],Y)||"",G={};if(Q[1]){let K=aZ(Q[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:J,options:G}}function XW($){let Z=[],Y="",X=!1,Q="",J=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,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function aZ($,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 N3;var T3=k(()=>{o7();sZ();N3=rZ()});function JW($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
8984
+ `.trim();return{html:E,script:D,css:P}}var cZ=!1,nZ=!0,oZ="metadata",aq="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var aZ=k(()=>{T3()});function tZ(){return e$({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async($,Z,Y,X)=>{let{src:Q,options:J}=JW($,Z,Y);if(!Q)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let G={src:Q,poster:J.poster,controls:J.controls!==!1,autoplay:J.autoplay||!1,muted:J.muted||!1,loop:J.loop||!1,preload:J.preload||"metadata",playsinline:J.playsinline!==!1,lazy:J.lazy!==!1,player:J.player||"native",type:J.type,width:J.width,height:J.height,class:J.class,style:J.style,id:J.id,crossorigin:J.crossorigin,disablePictureInPicture:J.disablePictureInPicture,disableRemotePlayback:J.disableRemotePlayback,title:J.title,quality:J.quality,platform:J.platform,process:J.process,generatePoster:J.generatePoster,streaming:J.streaming,transcode:J.transcode,spriteSheet:J.spriteSheet,waveform:J.waveform},q={isDev:Y.__isDev||!1,tsVideosConfig:Y.__tsVideosConfig},W=await A4(G,q),z=W.html;if(W.css)z+=`
8985
+ <style>${W.css}</style>`;if(W.script)z+=`
8986
+ <script>${W.script}</script>`;return z},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function JW($,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 Q=QW(X),J=eZ(Q[0],Y)||"",G={};if(Q[1]){let K=eZ(Q[1],Y);if(typeof K==="object"&&K!==null)G=K;else if(typeof Q[1]==="string")try{G=JSON.parse(Q[1])}catch{}}return{src:J,options:G}}function QW($){let Z=[],Y="",X=!1,Q="",J=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,Q=q;else if(q===Q)X=!1,Q="";else Y+=q;continue}if(!X){if(q==="{")J++;if(q==="}")J--;if(q==="[")G++;if(q==="]")G--;if(q===","&&J===0&&G===0){Z.push(Y.trim()),Y="";continue}}Y+=q}if(Y.trim())Z.push(Y.trim());return Z}function eZ($,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 N3;var T3=k(()=>{o7();aZ();N3=tZ()});function GW($,Z){let Y=Z.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
8986
8987
  ${$}
8987
8988
  </div>
8988
8989
  <script>
@@ -9027,7 +9028,7 @@ ${E}
9027
9028
  }
9028
9029
  }
9029
9030
  })();
9030
- </script>`}function QW($,Z){let Y=Z.pwa?.updates,X=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,J=$.trim().length>0,G=`
9031
+ </script>`}function KW($,Z){let Y=Z.pwa?.updates,X=Y?.message||"A new version is available. Reload to update?",Q=Y?.autoReload||!1,J=$.trim().length>0,G=`
9031
9032
  <div class="stx-pwa-update-banner" style="
9032
9033
  position: fixed;
9033
9034
  bottom: 0;
@@ -9138,7 +9139,7 @@ else {
9138
9139
  // Also listen for custom event
9139
9140
  window.addEventListener('pwa-update-available', showUpdate);
9140
9141
  })();
9141
- </script>`}function GW($,Z){let Y=$.trim().length>0,X=`
9142
+ </script>`}function qW($,Z){let Y=$.trim().length>0,X=`
9142
9143
  <div class="stx-offline-indicator" style="
9143
9144
  position: fixed;
9144
9145
  top: 16px;
@@ -9199,7 +9200,7 @@ else {
9199
9200
  window.addEventListener('offline', updateStatus);
9200
9201
  updateStatus();
9201
9202
  })();
9202
- </script>`}function KW($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
9203
+ </script>`}function WW($,Z){let Y=Z.pwa?.push,X=Y?.vapidPublicKey||"",Q=Y?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
9203
9204
  ${$}
9204
9205
  </div>
9205
9206
  <script>
@@ -9281,33 +9282,33 @@ catch (error) {
9281
9282
  init();
9282
9283
  }
9283
9284
  })();
9284
- </script>`}function AL($){return[...$,...M3]}var qW,WW,UW,zW,M3;var I3=k(()=>{qW={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return JW($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},WW={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return QW($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},UW={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return GW($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},zW={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return KW($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},M3=[qW,WW,UW,zW]});function D3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var w4=k(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function a5(){return!1}function t5(){return!a5()||process.env.STX_DEBUG==="true"}function N4(){return!1}import BW from"path";function T4(){return{...E3}}function M4($){if(!E3.showRelativePaths||!$)return $;let Z=E3.baseDir||process.cwd();try{let Y=BW.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var jW,E3,I4,f1,D4;var E4=k(()=>{w4();jW={showRelativePaths:!1,enableAutoRecovery:t5(),logRecoveryWarnings:!0},E3={...jW};I4=class I4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=M4(this.filePath)}};f1=class f1 extends I4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};D4=class D4 extends I4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function eZ($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:U,format:z="text"}=$,B=J,_=G;if(!B&&K&&q!==void 0){let O=VW(K,q);B=O.line,_=O.column}let j=Q?M4(Q):void 0,H=X?D3(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:j,line:B,column:_,snippet:W,suggestion:U,timestamp:new Date().toISOString()},F;switch(z){case"html":F=HW(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=OW(L,K,q);break;case"text":default:F=_W(L,K,q);break}return{formatted:F,data:L}}function _W($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
9285
- ${$.message}`),Z&&$.line){let J=LW(Z,$.line,2);if(J)X.push(`
9285
+ </script>`}function NL($){return[...$,...M3]}var zW,UW,BW,jW,M3;var I3=k(()=>{zW={name:"pwa.installButton",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return GW($,Q)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},UW={name:"pwa.updatePrompt",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return KW($,Q)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},BW={name:"pwa.offlineIndicator",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return qW($,Q)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},jW={name:"pwa.pushSubscribe",handler:($,Z,Y,X)=>{let Q=Y.__stx_options||{};return WW($,Q)},hasEndTag:!0,description:"Renders a push notification subscription button"},M3=[zW,UW,BW,jW]});function D3($){for(let[Z,Y]of Object.entries(o))if(Y===$)return Z;return}var o;var w4=k(()=>{o={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function a5(){return!1}function t5(){return!a5()||process.env.STX_DEBUG==="true"}function N4(){return!1}import _W from"path";function T4(){return{...E3}}function M4($){if(!E3.showRelativePaths||!$)return $;let Z=E3.baseDir||process.cwd();try{let Y=_W.relative(Z,$);return Y.startsWith("..")?$:Y}catch{return $}}var HW,E3,I4,f1,D4;var E4=k(()=>{w4();HW={showRelativePaths:!1,enableAutoRecovery:t5(),logRecoveryWarnings:!0},E3={...HW};I4=class I4 extends Error{code;filePath;line;column;context;numericCode;constructor($,Z,Y,X,Q,J,G){super($);this.code=Z;this.filePath=Y;this.line=X;this.column=Q;this.context=J;if(this.name="StxError",this.numericCode=G||o.EVALUATION_ERROR,this.filePath)this.filePath=M4(this.filePath)}};f1=class f1 extends I4{constructor($,Z,Y,X,Q,J){super($,"stx_RUNTIME_ERROR",Z,Y,X,Q,J||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};D4=class D4 extends I4{isFatal=!0;constructor($,Z,Y,X,Q,J){super($,"stx_VALIDATION_ERROR",Z,Y,X,Q,J||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function Z2($){let{type:Z,message:Y,code:X,filePath:Q,line:J,column:G,template:K,offset:q,snippet:W,suggestion:z,format:U="text"}=$,B=J,_=G;if(!B&&K&&q!==void 0){let O=AW(K,q);B=O.line,_=O.column}let j=Q?M4(Q):void 0,H=X?D3(X):void 0,L={type:Z,code:X,codeName:H,message:Y,filePath:j,line:B,column:_,snippet:W,suggestion:z,timestamp:new Date().toISOString()},F;switch(U){case"html":F=LW(L);break;case"json":F=JSON.stringify(L,null,2);break;case"console":F=FW(L,K,q);break;case"text":default:F=OW(L,K,q);break}return{formatted:F,data:L}}function OW($,Z,Y){let X=[],Q=$.code?` [${$.codeName||$.code}]`:"";if(X.push(`[${$.type} Error${Q}]`),$.filePath){let J=$.filePath;if($.line){if(J+=`:${$.line}`,$.column)J+=`:${$.column}`}X.push(`at ${J}`)}if(X.push(`
9286
+ ${$.message}`),Z&&$.line){let J=VW(Z,$.line,2);if(J)X.push(`
9286
9287
  ${J}`)}if($.snippet)X.push(`
9287
9288
  Snippet: ${$.snippet}`);if($.suggestion)X.push(`
9288
- Suggestion: ${$.suggestion}`);return X.join(" ")}function HW($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${tZ($.message)}`;if($.suggestion)X+=` | Suggestion: ${tZ($.suggestion)}`;return X+=" -->",X}function OW($,Z,Y){let W=[],U=$.code?` [${$.codeName||$.code}]`:"";if(W.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${$.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),$.filePath){let z=`\x1B[36m${$.filePath}\x1B[0m`;if($.line){if(z+=`\x1B[90m:${$.line}\x1B[0m`,$.column)z+=`\x1B[90m:${$.column}\x1B[0m`}W.push(`
9289
- \x1B[90mat\x1B[0m ${z}`)}if(W.push(`
9289
+ Suggestion: ${$.suggestion}`);return X.join(" ")}function LW($){let Z=$.code?` [${$.code}]`:"",Y=$.filePath?` in ${$.filePath}${$.line?`:${$.line}`:""}`:"",X=`<!-- [${$.type} Error${Z}]${Y}: ${$2($.message)}`;if($.suggestion)X+=` | Suggestion: ${$2($.suggestion)}`;return X+=" -->",X}function FW($,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(`
9290
+ \x1B[90mat\x1B[0m ${U}`)}if(W.push(`
9290
9291
 
9291
- ${$.message}`),Z&&$.line){let z=FW(Z,$.line,2);if(z)W.push(`
9292
+ ${$.message}`),Z&&$.line){let U=RW(Z,$.line,2);if(U)W.push(`
9292
9293
 
9293
9294
  \x1B[90mContext:\x1B[0m
9294
- ${z}`)}if($.suggestion)W.push(`
9295
+ ${U}`)}if($.suggestion)W.push(`
9295
9296
 
9296
9297
  \x1B[33mSuggestion:\x1B[0m ${$.suggestion}`);return W.push(`
9297
- ${"\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 LW($,Z,Y){let X=$.split(`
9298
+ ${"\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 VW($,Z,Y){let X=$.split(`
9298
9299
  `),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G=[];for(let K=Q;K<=J;K++){let q=(K+1).toString().padStart(4),W=K===Z-1?">":" ";G.push(`${W}${q} | ${X[K]}`)}return G.join(`
9299
- `)}function FW($,Z,Y){let X=$.split(`
9300
- `),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",W=[];for(let U=Q;U<=J;U++){let z=(U+1).toString().padStart(4),B=U===Z-1,_=B?"\x1B[31m>\x1B[0m":" ",j=B?`\x1B[31m${X[U]}\x1B[0m`:`\x1B[90m${X[U]}\x1B[0m`;W.push(`${_}\x1B[90m${z}\x1B[0m | ${j}`)}return W.join(`
9301
- `)}function tZ($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function VW($,Z){let X=$.substring(0,Z).split(`
9302
- `);return{line:X.length,column:X[X.length-1].length}}function $0($,Z,Y){return eZ({type:$,message:Z,code:Y,format:"html"}).formatted}async function G5($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var $2=k(()=>{w4();E4()});class b3{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(`
9300
+ `)}function RW($,Z,Y){let X=$.split(`
9301
+ `),Q=Math.max(0,Z-Y-1),J=Math.min(X.length-1,Z+Y-1),G="\x1B[90m",K="\x1B[31m",q="\x1B[0m",W=[];for(let z=Q;z<=J;z++){let U=(z+1).toString().padStart(4),B=z===Z-1,_=B?"\x1B[31m>\x1B[0m":" ",j=B?`\x1B[31m${X[z]}\x1B[0m`:`\x1B[90m${X[z]}\x1B[0m`;W.push(`${_}\x1B[90m${U}\x1B[0m | ${j}`)}return W.join(`
9302
+ `)}function $2($){return $.replace(/--/g,"- -").replace(/>/g,"&gt;")}function AW($,Z){let X=$.substring(0,Z).split(`
9303
+ `);return{line:X.length,column:X[X.length-1].length}}function $0($,Z,Y){return Z2({type:$,message:Z,code:Y,format:"html"}).formatted}async function G5($,Z,Y){try{return await $()}catch(X){if(Y&&X instanceof Error)Y(X);return Z}}var Y2=k(()=>{w4();E4()});class b3{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(`
9303
9304
  `).slice(1).join(`
9304
9305
  `)}`);if($.context)Z.push(` Context: ${JSON.stringify($.context)}`);return Z.join(`
9305
9306
  `)}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 Q=`${this.formatEntry($)}
9306
9307
  `;Z.appendFileSync(this.logFilePath,Q,"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}`,Q=`${this.logFilePath}.${Y+1}`;if($.existsSync(X))if(Y>=this.maxLogFiles-1)$.unlinkSync(X);else $.renameSync(X,Q)}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 Q=Y.level||"error";Z[Q]=(Z[Q]||0)+1}return{total:this.errors.length,byType:$,byLevel:Z}}async exportToFile($,Z="json"){let Y=await import("fs"),Q=(await import("path")).dirname($);if(!Y.existsSync(Q))Y.mkdirSync(Q,{recursive:!0});if(Z==="json"){let J=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(J,null,2),"utf-8")}else{let J=this.errors.map((G)=>this.formatEntry(G));Y.writeFileSync($,J.join(`
9307
9308
 
9308
- `),"utf-8")}}async flush(){await this.writeQueue}}var k3,o0,S3;var Z2=k(()=>{E4();k3={isEnabled(){return T4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=T4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],Q=(Y.match(/\{\{/g)||[]).length,J=(Y.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;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 U=q-W;for(let z=0;z<U;z++)Y+=`
9309
- @end${K}`;X.push(`Added ${U} 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(t5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};o0=new b3,S3={isDevelopment(){return t5()},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(`
9310
- `)}}});var Y2=()=>{};var X2=k(()=>{w4();$2();Z2();Y2();E4()});var J1=k(()=>{X2()});function J2($,Z,Y,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let U=q.split(":"),z=q,B=U.length>1?U[1]:"";if(B&&Z[B])W=Z[B];else if(z.startsWith("og:")&&Z.openGraph&&Z.openGraph[U[1]])W=Z.openGraph[U[1]];else W="";return W?`<meta property="${p(z)}" content="${p(W)}">`:""}return W?`<meta name="${p(q)}" content="${p(W)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,W=1,U=q+1;while(U<Q.length&&W>0){if(Q[U]==="(")W++;else if(Q[U]===")"){if(W--,W===0)break}U++}if(W!==0)break;let z=Q.substring(q+1,U).trim(),B=U+1,_=(()=>{try{let j=L0(z,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${p(String(j.name))}"`;if(j.property)H+=` property="${p(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${p(String(j.httpEquiv))}"`;if(j.content)H+=` content="${p(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return $0("MetaTag",H,o.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+_+Q.substring(B),J.lastIndex=0}return Q}function Q2($,Z,Y){let X=$,Q=/@structuredData\s*\(/g,J;while((J=Q.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)break;let U=X.substring(K+1,W).trim(),z=W+1,B=(()=>{try{let _=L0(U,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let j=_ instanceof Error?_.message:String(_);return $0("StructuredData",j,o.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(z),Q.lastIndex=0}return X}function G2($,Z,Y,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,W=K+1,U=null,z=!1;while(W<Q.length&&q>0){let F=Q[W];if(z){z=!1,W++;continue}if(F==="\\"&&U){z=!0,W++;continue}if(U){if(F===U)U=null;W++;continue}if(F==='"'||F==="'"||F==="`"){U=F,W++;continue}if(F==="{")q++;else if(F==="}")q--;W++}if(q!==0)break;let B=Q.substring(W).match(/^\s*\)/);if(!B)break;let _=W+B[0].length,j=Q.substring(K,W),H=Q.substring(G.index,_),L=((F)=>{try{let O=L0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${p(O.title)}</title>
9309
+ `),"utf-8")}}async flush(){await this.writeQueue}}var k3,o0,S3;var X2=k(()=>{E4();k3={isEnabled(){return T4().enableAutoRecovery},fixCommonSyntaxErrors($){let Z=T4();if(!Z.enableAutoRecovery)return{fixed:$,fixes:[]};let Y=$,X=[],Q=(Y.match(/\{\{/g)||[]).length,J=(Y.match(/\}\}/g)||[]).length;if(Q>J){let K=Q-J;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+=`
9310
+ @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(t5())return`<!-- ${$} failed: ${Z.message} -->`;return"<!-- stx rendering error -->"}};o0=new b3,S3={isDevelopment(){return t5()},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(`
9311
+ `)}}});var J2=()=>{};var Q2=k(()=>{w4();Y2();X2();J2();E4()});var J1=k(()=>{Q2()});function G2($,Z,Y,X){let Q=$;Q=Q.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(K,q,W)=>{if(!W&&q.includes(":")){let z=q.split(":"),U=q,B=z.length>1?z[1]:"";if(B&&Z[B])W=Z[B];else if(U.startsWith("og:")&&Z.openGraph&&Z.openGraph[z[1]])W=Z.openGraph[z[1]];else W="";return W?`<meta property="${p(U)}" content="${p(W)}">`:""}return W?`<meta name="${p(q)}" content="${p(W)}">`:""});let J=/@metaTag\s*\(/g,G;while((G=J.exec(Q))!==null){let K=G.index,q=K+G[0].length-1,W=1,z=q+1;while(z<Q.length&&W>0){if(Q[z]==="(")W++;else if(Q[z]===")"){if(W--,W===0)break}z++}if(W!==0)break;let U=Q.substring(q+1,z).trim(),B=z+1,_=(()=>{try{let j=L0(U,Z);if(!j)return"";let H="<meta";if(j.name)H+=` name="${p(String(j.name))}"`;if(j.property)H+=` property="${p(String(j.property))}"`;if(j.httpEquiv)H+=` http-equiv="${p(String(j.httpEquiv))}"`;if(j.content)H+=` content="${p(String(j.content))}"`;return H+=">",H}catch(j){let H=j instanceof Error?j.message:String(j);return $0("MetaTag",H,o.EVALUATION_ERROR)}})();Q=Q.substring(0,K)+_+Q.substring(B),J.lastIndex=0}return Q}function K2($,Z,Y){let X=$,Q=/@structuredData\s*\(/g,J;while((J=Q.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)break;let z=X.substring(K+1,W).trim(),U=W+1,B=(()=>{try{let _=L0(z,Z);if(!_)return"";if(!_["@context"])_["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(_).replace(/<\//g,"<\\/")}</script>`}catch(_){let j=_ instanceof Error?_.message:String(_);return $0("StructuredData",j,o.EVALUATION_ERROR)}})();X=X.substring(0,G)+B+X.substring(U),Q.lastIndex=0}return X}function q2($,Z,Y,X){let Q=$,J=/@seo\s*\(\s*\{/g,G;while((G=J.exec(Q))!==null){let K=Q.indexOf("{",G.index+4),q=1,W=K+1,z=null,U=!1;while(W<Q.length&&q>0){let F=Q[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 B=Q.substring(W).match(/^\s*\)/);if(!B)break;let _=W+B[0].length,j=Q.substring(K,W),H=Q.substring(G.index,_),L=((F)=>{try{let O=L0(F,Z);if(!O)return"";let V="";if(O.title)V+=`<title>${p(O.title)}</title>
9311
9312
  `,V+=`<meta name="title" content="${p(O.title)}">
9312
9313
  `;if(O.description)V+=`<meta name="description" content="${p(O.description)}">
9313
9314
  `;if(O.keywords){let R=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;V+=`<meta name="keywords" content="${p(R)}">
@@ -9329,7 +9330,7 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
9329
9330
  `}if(R.site)V+=`<meta name="twitter:site" content="${p(R.site)}">
9330
9331
  `;if(R.creator)V+=`<meta name="twitter:creator" content="${p(R.creator)}">
9331
9332
  `}if(O.structuredData){let R=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");V+=`<script type="application/ld+json">${R}</script>
9332
- `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return $0("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(j);Q=Q.substring(0,G.index)+L+Q.substring(_),J.lastIndex=G.index+L.length}return Q}function K2($,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((z)=>z.property==="og:title"||z.name==="og:title"||z.name==="twitter:title"||z.name==="description")))return $;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test($)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test($))return $;if(!$.includes("<head>")&&!$.includes("<head "))return $;let J=$.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=`
9333
+ `}return V.trim()}catch(O){let V=O instanceof Error?O.message:String(O);return $0("SEO",`Error processing @seo directive: ${V}`,o.EVALUATION_ERROR)}})(j);Q=Q.substring(0,G.index)+L+Q.substring(_),J.lastIndex=G.index+L.length}return Q}function W2($,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 J=$.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=`
9333
9334
  <!-- stx SEO Tags -->
9334
9335
  <meta name="title" content="${p(G)}">
9335
9336
  <meta name="description" content="${p(K)}">
@@ -9342,19 +9343,19 @@ ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\
9342
9343
  `;if(q)W+=`
9343
9344
  <meta property="og:image" content="${p(q)}">
9344
9345
  <meta name="twitter:image" content="${p(q)}">
9345
- `;let U=$;if(!J)U=U.replace(/<head[^>]*>/,`$&
9346
- <title>${p(G)}</title>`);return U.replace(/<head[^>]*>/,`$&
9346
+ `;let z=$;if(!J)z=z.replace(/<head[^>]*>/,`$&
9347
+ <title>${p(G)}</title>`);return z.replace(/<head[^>]*>/,`$&
9347
9348
  ${W}
9348
- `)}function p($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var q2,W2;var y3=k(()=>{J1();F0();q2={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${p(Q)}" content="${p(J)}">`},hasEndTag:!1},W2={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return $0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return $0("StructuredData",J,o.EVALUATION_ERROR)}},hasEndTag:!0}});import e5 from"path";function RW($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",Q=Z,J=[],G=!0;if(X){let z=X.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let B=z[1],_=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)Q=_[1];let j=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)J=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=B.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[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),U=W?W[1].trim():"";return{tag:Q,props:J,template:q,styles:U,script:X,shadowDOM:G}}function AW($){let{tag:Z,props:Y,template:X,styles:Q,shadowDOM:J}=$,G=Z.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((z)=>`'${z}'`).join(", "),U=Y.map((z)=>`
9349
- get ${z}() {
9350
- return this.getAttribute('${z}') || '';
9349
+ `)}function p($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var z2,U2;var y3=k(()=>{J1();F0();z2={name:"meta",handler:($,Z,Y,X)=>{if(Z.length<1)return $0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),J=Z.length>1?Z[1].replace(/['"]/g,""):"";return`<meta name="${p(Q)}" content="${p(J)}">`},hasEndTag:!1},U2={name:"structuredData",handler:($,Z,Y,X)=>{if($.trim()==="")return $0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let Q=JSON.parse($);if(!Q["@context"])Q["@context"]="https://schema.org";if(!Q["@type"])return $0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(Q)}</script>`}catch(Q){let J=Q instanceof Error?Q.message:String(Q);return $0("StructuredData",J,o.EVALUATION_ERROR)}},hasEndTag:!0}});import e5 from"path";function wW($,Z){let Y=$.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),X=Y?Y[1].trim():"",Q=Z,J=[],G=!0;if(X){let U=X.match(/export\s+default\s+({[\s\S]*})/);if(U)try{let B=U[1],_=B.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(_)Q=_[1];let j=B.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)J=j[1].split(",").map((L)=>L.trim().replace(/['"`]/g,"")).filter((L)=>L.length>0);let H=B.match(/shadowDOM\s*:\s*(true|false)/);if(H)G=H[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:Q,props:J,template:q,styles:z,script:X,shadowDOM:G}}function NW($){let{tag:Z,props:Y,template:X,styles:Q,shadowDOM:J}=$,G=Z.split("-").map((U)=>U.charAt(0).toUpperCase()+U.slice(1)).join(""),K=X.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),q=Q.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),W=Y.map((U)=>`'${U}'`).join(", "),z=Y.map((U)=>`
9350
+ get ${U}() {
9351
+ return this.getAttribute('${U}') || '';
9351
9352
  }
9352
- set ${z}(value) {
9353
+ set ${U}(value) {
9353
9354
  if (value) {
9354
- this.setAttribute('${z}', value);
9355
+ this.setAttribute('${U}', value);
9355
9356
  }
9356
9357
  else {
9357
- this.removeAttribute('${z}');
9358
+ this.removeAttribute('${U}');
9358
9359
  }
9359
9360
  }`).join(`
9360
9361
  `);return`/**
@@ -9377,7 +9378,7 @@ class ${G} extends HTMLElement {
9377
9378
  this._render();
9378
9379
  }
9379
9380
  }
9380
- ${U}
9381
+ ${z}
9381
9382
 
9382
9383
  _render() {
9383
9384
  const template = \`${q?`<style>${q}</style>`:""}${K}\`;
@@ -9396,16 +9397,16 @@ ${U}
9396
9397
  }
9397
9398
 
9398
9399
  customElements.define('${Z}', ${G});
9399
- `}async function U2($,Z,Y,X){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[e5.join(e5.dirname(X),G,`${Q}.stx`),e5.join(process.cwd(),G,`${Q}.stx`),e5.join(e5.dirname(X),`${Q}.stx`)],q=null;for(let z of K)if(await n(z)){q=await Bun.file(z).text();break}if(!q)return $0("WebComponent",`Component file not found: ${Q}.stx`,o.FILE_NOT_FOUND);let W=RW(q,Q);return`<script type="module">
9400
- ${AW(W)}
9401
- </script>`}var z2=k(()=>{J1();O0()});var B2={};r(B2,{timingPlugin:()=>IW,pluginManager:()=>wW,definePlugin:()=>k4,debugPlugin:()=>MW,createVariablesPlugin:()=>DW,createFilterPlugin:()=>TW,createDirectivePlugin:()=>NW,PluginManager:()=>P3});function k4($){return $}class P3{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 Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(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 "${Q.name}" ${$} hook:`,G)}}return X}}function NW($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function TW($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function DW($){return k4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var wW,MW,IW;var j2=k(()=>{wW=new P3;MW=k4({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)}}),IW=k4({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 H2={};r(H2,{validateConfig:()=>yW,loadStxConfig:()=>q5,defineStxConfig:()=>SW,defaultConfig:()=>g1,config:()=>v3});import C3 from"fs";import D0 from"path";import{loadConfigWithResult as EW}from"bunfig";function kW($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=D0.join(process.cwd(),"resources","views"),Q=D0.join(process.cwd(),"resources","layouts");if(C3.existsSync(X)&&C3.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=D0.join(process.cwd(),"resources","views","pages");if(C3.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function bW($){if(_9($.stateDir),$.stateDir=M5(),$.cachePath=D5($.cachePath),$.build)$.build.cacheDir=D5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=D5($.media.cache.directory);if($.story)$.story.outDir=D5($.story.outDir)}async function q5($){if(!$){if(K5)return K5;if(b4)return b4}let Z=$?D0.resolve($):process.cwd(),Y=_2.get(Z);if(Y)return Y;let X=(async()=>{let J=(await EW({name:"stx",alias:"ui",cwd:Z,defaultConfig:g1,verbose:!1})).config;bW(J);let G=kW(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!D0.isAbsolute(J.partialsDir))J.partialsDir=D0.join(K,J.partialsDir);if(J.componentsDir&&!D0.isAbsolute(J.componentsDir))J.componentsDir=D0.join(K,J.componentsDir);if(J.layoutsDir&&!D0.isAbsolute(J.layoutsDir))J.layoutsDir=D0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (j2(),B2)),q=[],W=[];for(let U of J.plugins){let z=typeof U==="string"?U:U[0],B=typeof U==="string"?{}:U[1]||{};try{let _,j;try{_=await import(z),j=D0.dirname(q0.resolve(z))}catch{let L=D0.resolve(process.cwd(),z);_=await import(L),j=D0.dirname(L)}let H=_.default||_;if(K.register(H,J),H.components){let L=D0.resolve(j,H.components);q.push(L)}if(H.pages){let L=D0.resolve(j,H.pages),F=B.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:j,config:J};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||z}`)}catch(_){console.warn(`[stx] Failed to load plugin ${z}:`,_.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if(_2.set(Z,X),!$)b4=X,X.then((Q)=>{K5=Q}).catch(()=>{});return X}function SW($){return $}function yW($){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,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].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,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].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((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].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((Q)=>typeof Q!=="number"||Q<16||Q>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((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var g1,K5=null,_2,b4=null,v3;var W5=k(()=>{z7();B7();j7();_7();n7();DZ();T3();I3();y3();V$();z2();g1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:n1,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:e8,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:U2,hasEndTag:!1,description:"Include a web component in the template"},L9,F9,q2,W2,V9,A9,w9,R9,I9,k9,IZ,N3,...M3],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};_2=new Map;v3=new Proxy(g1,{get($,Z){if(K5&&Z in K5)return K5[Z];if(!b4)q5().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import G0 from"path";import{hasLocalConfig as PW}from"bunfig/discovery";function g3($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function f3($,Z){if(h1.has($))h1.delete($);else if(h1.size>=CW)h1.delete(h1.keys().next().value);h1.set($,Z)}async function vW($){if(!H1)return null;try{let Z=Bun.file(G0.join(H1,`cw-${g3($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function xW($,Z){if(!H1)return;try{if(!fs.existsSync(H1))fs.mkdirSync(H1,{recursive:!0});await Bun.write(G0.join(H1,`cw-${g3($)}.css`),Z)}catch{}}async function L2($){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 fW(){let $=[],Z=process.cwd();while(Z!==G0.dirname(Z))$.push(G0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=G0.dirname(Z);return $}function gW(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[G0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function hW(){if(O2)return Q1;O2=!0;try{let $=async(Q)=>{for(let J of Q){if(!await Bun.file(J).exists())continue;let G=await L2(J);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded from ${G0.dirname(G0.dirname(J))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let Q=G0.resolve(process.env.CROSSWIND_SRC),J=await $([Q]);if(!J)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Q}`);return Q1=J,Q1}let Z=await $(fW());if(Z)return Q1=Z,Q1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Q of Y){let J=await L2(Q);if(J){if(Q1=J,!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded`);return Q1}}let X=await $(gW());if(X)return Q1=X,Q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${H0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${H0.reset}`),console.warn(`${H0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${H0.reset}`),null}}async function dW($){try{if(!PW({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=G0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${H0.yellow}[Crosswind]${H0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function mW($){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 Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[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())}J=Q.exec($)}return Z}async function uW($,Z){try{let Y=await hW();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):mW($);if(X.size===0)return"";let Q=Z?G0.resolve(Z):process.cwd();if(!H1)H1=I5(Q,"cache");let J=[...X].sort().join(" "),G=`${x3||"default"}::${J}`,K=h1.get(G);if(K!==void 0)return f3(G,K),K;let q=await vW(G);if(q!==null)return f3(G,q),q;if(!S4){let A=null;try{let{loadStxConfig:w}=await Promise.resolve().then(() => (W5(),H2)),N=await w(Q);if(N.css)if(typeof N.css==="string"){let T=G0.isAbsolute(N.css)?N.css:G0.resolve(Q,N.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(A={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let T=G0.isAbsolute(N.css.config)?N.css.config:G0.resolve(Q,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${H0.green}[Crosswind]${H0.reset} Using inline CSS config from stx.config.ts`)}}catch{}S4=A||await dW(Q);try{x3=g3(JSON.stringify(S4??{}))}catch{x3="unhashable"}}let W=Y.defaultConfig||Y.config,U=S4||{},z=W.theme||{},_=(U.theme||{}).extend||{},j={...z};if(Object.keys(_).length>0)j.extend=_;let H=[...W.safelist||[],...U.safelist||[]],L={...W,...U,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of X)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||U.shortcuts||{};for(let[A,w]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let N=w.split(/\s+/).filter(Boolean);for(let T of N)F.generate(T)}O=F.toCSS(!0,!1);let R=O.split(`
9400
+ `}async function B2($,Z,Y,X){if(Z.length<1)return $0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let Q=Z[0].replace(/['"]/g,""),G=(Y.__stx_options||{}).componentsDir||"components",K=[e5.join(e5.dirname(X),G,`${Q}.stx`),e5.join(process.cwd(),G,`${Q}.stx`),e5.join(e5.dirname(X),`${Q}.stx`)],q=null;for(let U of K)if(await n(U)){q=await Bun.file(U).text();break}if(!q)return $0("WebComponent",`Component file not found: ${Q}.stx`,o.FILE_NOT_FOUND);let W=wW(q,Q);return`<script type="module">
9401
+ ${NW(W)}
9402
+ </script>`}var j2=k(()=>{J1();O0()});var _2={};r(_2,{timingPlugin:()=>EW,pluginManager:()=>TW,definePlugin:()=>k4,debugPlugin:()=>DW,createVariablesPlugin:()=>kW,createFilterPlugin:()=>IW,createDirectivePlugin:()=>MW,PluginManager:()=>P3});function k4($){return $}class P3{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 Q=X[$];if(Q)try{let J=await Q(Y);if(J){if(J.template!==void 0)Y.template=J.template;if(J.context)Y.context={...Y.context,...J.context};if(J.metadata)Y.metadata={...Y.metadata,...J.metadata};if(J.skip)break}}catch(J){console.error(`Error in plugin "${X.name}" ${$} hook:`,J)}}return Y}async runDirectiveHooks($,Z,Y){let X={...Y};for(let Q of this.sortedPlugins){let J=Q[$];if(J)try{let G=await J(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 "${Q.name}" ${$} hook:`,G)}}return X}}function MW($,Z,Y={}){return{name:$,...Y,registerDirectives:()=>Z}}function IW($,Z,Y={}){return{name:$,...Y,registerFilters:()=>Z}}function kW($){return k4({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess(Z){return{context:{...Z.context,...$}}}})}var TW,DW,EW;var H2=k(()=>{TW=new P3;DW=k4({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)}}),EW=k4({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 L2={};r(L2,{validateConfig:()=>CW,loadStxConfig:()=>q5,defineStxConfig:()=>PW,defaultConfig:()=>g1,config:()=>v3});import C3 from"fs";import D0 from"path";import{loadConfigWithResult as bW}from"bunfig";function SW($,Z){let Y=Z||"pages";if($)return{root:$,pagesDir:Y};let X=D0.join(process.cwd(),"resources","views"),Q=D0.join(process.cwd(),"resources","layouts");if(C3.existsSync(X)&&C3.existsSync(Q))return{root:"resources",pagesDir:"views"};let J=D0.join(process.cwd(),"resources","views","pages");if(C3.existsSync(J))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function yW($){if(_9($.stateDir),$.stateDir=M5(),$.cachePath=D5($.cachePath),$.build)$.build.cacheDir=D5($.build.cacheDir);if($.media?.cache)$.media.cache.directory=D5($.media.cache.directory);if($.story)$.story.outDir=D5($.story.outDir)}async function q5($){if(!$){if(K5)return K5;if(b4)return b4}let Z=$?D0.resolve($):process.cwd(),Y=O2.get(Z);if(Y)return Y;let X=(async()=>{let J=(await bW({name:"stx",alias:"ui",cwd:Z,defaultConfig:g1,verbose:!1})).config;yW(J);let G=SW(J.root,J.pagesDir);if(J.root=G.root,J.pagesDir=G.pagesDir,J.root&&J.root!=="."){let K=J.root;if(J.partialsDir&&!D0.isAbsolute(J.partialsDir))J.partialsDir=D0.join(K,J.partialsDir);if(J.componentsDir&&!D0.isAbsolute(J.componentsDir))J.componentsDir=D0.join(K,J.componentsDir);if(J.layoutsDir&&!D0.isAbsolute(J.layoutsDir))J.layoutsDir=D0.join(K,J.layoutsDir)}if(J.plugins&&J.plugins.length>0){let{pluginManager:K}=await Promise.resolve().then(() => (H2(),_2)),q=[],W=[];for(let z of J.plugins){let U=typeof z==="string"?z:z[0],B=typeof z==="string"?{}:z[1]||{};try{let _,j;try{_=await import(U),j=D0.dirname(q0.resolve(U))}catch{let L=D0.resolve(process.cwd(),U);_=await import(L),j=D0.dirname(L)}let H=_.default||_;if(K.register(H,J),H.components){let L=D0.resolve(j,H.components);q.push(L)}if(H.pages){let L=D0.resolve(j,H.pages),F=B.path||"/";W.push({dir:L,prefix:F})}if(H.setup){let L={addDirective:(F)=>{J.customDirectives=J.customDirectives||[],J.customDirectives.push(F)},addRoute:(F,O)=>{J.apiRoutes=J.apiRoutes||{},J.apiRoutes[F]=O},addMiddleware:(F)=>{J.middleware=J.middleware||[],J.middleware.push(F)},pluginDir:j,config:J};await H.setup(B,L)}console.log(`[stx] Plugin loaded: ${H.name||U}`)}catch(_){console.warn(`[stx] Failed to load plugin ${U}:`,_.message)}}J._pluginComponentDirs=q,J._pluginPageDirs=W}return J})();if(O2.set(Z,X),!$)b4=X,X.then((Q)=>{K5=Q}).catch(()=>{});return X}function PW($){return $}function CW($){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,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`customDirectives[${Q}].name`,message:"Custom directive must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`customDirectives[${Q}].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,Q)=>{if(!X.name||typeof X.name!=="string")Z.push({path:`middleware[${Q}].name`,message:"Middleware must have a name string",severity:"error"});if(!X.handler||typeof X.handler!=="function")Z.push({path:`middleware[${Q}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!X.timing||!["before","after"].includes(X.timing))Z.push({path:`middleware[${Q}].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((Q,J)=>{if(!Q.pattern||typeof Q.pattern!=="string")Z.push({path:`pwa.routes[${J}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!X.includes(Q.strategy))Z.push({path:`pwa.routes[${J}].strategy`,message:`PWA route strategy must be one of: ${X.join(", ")}`,severity:"error"});if(Q.maxAgeSeconds!==void 0&&(typeof Q.maxAgeSeconds!=="number"||Q.maxAgeSeconds<0))Z.push({path:`pwa.routes[${J}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(Q.maxEntries!==void 0&&(typeof Q.maxEntries!=="number"||Q.maxEntries<1))Z.push({path:`pwa.routes[${J}].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((Q)=>typeof Q!=="number"||Q<16||Q>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((J)=>!X.includes(J)).length>0)Z.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${X.join(", ")}`,severity:"error"})}if($.pwa.enabled===!0&&!$.pwa.icons?.src)Y.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if($.pwa.enabled===!0&&!$.pwa.manifest?.themeColor)Y.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:Z.length===0,errors:Z,warnings:Y}}var g1,K5=null,O2,b4=null,v3;var W5=k(()=>{U7();B7();j7();_7();n7();kZ();T3();I3();y3();V$();j2();g1={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:n1,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:ZZ,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:B2,hasEndTag:!1,description:"Include a web component in the template"},L9,F9,z2,U2,V9,A9,w9,R9,I9,k9,EZ,N3,...M3],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"#app-content",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};O2=new Map;v3=new Proxy(g1,{get($,Z){if(K5&&Z in K5)return K5[Z];if(!b4)q5().catch((Y)=>{console.warn("[stx] Failed to load config file:",Y?.message||Y)});return $[Z]}})});import G0 from"path";import{hasLocalConfig as vW}from"bunfig/discovery";function g3($){return Bun.hash($).toString(16).padStart(16,"0").slice(0,16)}function f3($,Z){if(h1.has($))h1.delete($);else if(h1.size>=xW)h1.delete(h1.keys().next().value);h1.set($,Z)}async function fW($){if(!H1)return null;try{let Z=Bun.file(G0.join(H1,`cw-${g3($)}.css`));if(!await Z.exists())return null;return await Z.text()}catch{return null}}async function gW($,Z){if(!H1)return;try{if(!fs.existsSync(H1))fs.mkdirSync(H1,{recursive:!0});await Bun.write(G0.join(H1,`cw-${g3($)}.css`),Z)}catch{}}async function V2($){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 hW(){let $=[],Z=process.cwd();while(Z!==G0.dirname(Z))$.push(G0.join(Z,"node_modules","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"node_modules","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@cwcss","crosswind","src","index.ts")),$.push(G0.join(Z,"node_modules","@stacksjs","crosswind","dist","index.js")),$.push(G0.join(Z,"pantry","@stacksjs","crosswind","dist","index.js")),Z=G0.dirname(Z);return $}function dW(){let $=[],Z=process.env.HOME||process.env.USERPROFILE||"";if(Z){let Y=[G0.join(Z,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),G0.join(Z,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),G0.join(Z,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];$.push(...Y)}return $.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),$.push(G0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),$}async function mW(){if(F2)return Q1;F2=!0;try{let $=async(Q)=>{for(let J of Q){if(!await Bun.file(J).exists())continue;let G=await V2(J);if(G){if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded from ${G0.dirname(G0.dirname(J))}`);return G}}return null};if(process.env.CROSSWIND_SRC){let Q=G0.resolve(process.env.CROSSWIND_SRC),J=await $([Q]);if(!J)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${Q}`);return Q1=J,Q1}let Z=await $(hW());if(Z)return Q1=Z,Q1;let Y=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let Q of Y){let J=await V2(Q);if(J){if(Q1=J,!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} CSS engine loaded`);return Q1}}let X=await $(dW());if(X)return Q1=X,Q1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${H0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${H0.reset}`),console.warn(`${H0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${H0.reset}`),null}}async function uW($){try{if(!vW({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=G0.relative($,Y.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from ${X||Y.path}`);return Y.config}catch(Z){if(Z instanceof Error&&Z.name==="ConfigNotFoundError")return null;return console.warn(`${H0.yellow}[Crosswind]${H0.reset} Failed to load crosswind config:`,Z instanceof Error?Z.message:Z),null}}function lW($){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 Q=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,J=Q.exec($);while(J!==null){let G=J[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())}J=Q.exec($)}return Z}async function pW($,Z){try{let Y=await mW();if(!Y)return"";let X=typeof Y.extractClasses==="function"?Y.extractClasses($):lW($);if(X.size===0)return"";let Q=Z?G0.resolve(Z):process.cwd();if(!H1)H1=I5(Q,"cache");let J=[...X].sort().join(" "),G=`${x3||"default"}::${J}`,K=h1.get(G);if(K!==void 0)return f3(G,K),K;let q=await fW(G);if(q!==null)return f3(G,q),q;if(!S4){let A=null;try{let{loadStxConfig:w}=await Promise.resolve().then(() => (W5(),L2)),N=await w(Q);if(N.css)if(typeof N.css==="string"){let T=G0.isAbsolute(N.css)?N.css:G0.resolve(Q,N.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${H0.green}[Crosswind]${H0.reset} Loaded config from stx.config.ts \u2192 ${N.css}`)}}else{if(A={...N.css,content:N.css.content||[],preflight:N.css.preflight??!0,minify:N.css.minify??!1},N.css.config){let T=G0.isAbsolute(N.css.config)?N.css.config:G0.resolve(Q,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${H0.green}[Crosswind]${H0.reset} Using inline CSS config from stx.config.ts`)}}catch{}S4=A||await uW(Q);try{x3=g3(JSON.stringify(S4??{}))}catch{x3="unhashable"}}let W=Y.defaultConfig||Y.config,z=S4||{},U=W.theme||{},_=(z.theme||{}).extend||{},j={...U};if(Object.keys(_).length>0)j.extend=_;let H=[...W.safelist||[],...z.safelist||[]],L={...W,...z,content:[],output:"",preflight:!0,minify:!1,theme:j,safelist:H},F=new Y.CSSGenerator(L);for(let A of H)F.generate(A);for(let A of X)F.generate(A);let O=F.toCSS(!0,!1),V=L.shortcuts||z.shortcuts||{};for(let[A,w]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let N=w.split(/\s+/).filter(Boolean);for(let T of N)F.generate(T)}O=F.toCSS(!0,!1);let R=O.split(`
9402
9403
  `);for(let[A,w]of Object.entries(V)){if(!X.has(A)&&!H.includes(A))continue;let N=w.split(/\s+/).filter(Boolean),T=[],M=[];for(let I of N){let E=I.startsWith("dark:"),S=`.${(E?I.slice(5):I).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let b=0;b<R.length;b++){let C=R[b].trim();if(C===`${S} {`||C.startsWith(`${S} {`)){let h=b,x="";while(h<R.length){if(x+=R[h],R[h].includes("}"))break;h++}let u=x.match(/\{([^}]+)\}/);if(u)if(E)M.push(u[1].trim());else T.push(u[1].trim());break}}}if(T.length)O+=`
9403
9404
  .${A} { ${T.join(" ")} }`;if(M.length)O+=`
9404
- @media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return f3(G,O),xW(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function F2($,Z){let Y=await uW($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
9405
+ @media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return f3(G,O),gW(G,O),O}catch(Y){return console.warn("Failed to generate Crosswind CSS:",Y),""}}async function R2($,Z){let Y=await pW($,Z);if(!Y)return $;let X=`<style data-crosswind="generated">
9405
9406
  ${Y}
9406
9407
  </style>`,Q=/<style data-crosswind="generated">[\s\S]*?<\/style>/g;if(Q.test($)){let J=!1;return $.replace(Q,()=>{if(J)return"";return J=!0,X})}if($.includes("</head>"))return $.replace("</head>",`${X}
9407
9408
  </head>`);if($.includes("<body"))return $.replace(/<body([^>]*)>/,`<body$1>
9408
- ${X}`);return X+$}var Q1=null,O2=!1,S4=null,CW=256,h1,H1=null,x3=null;var V2=k(()=>{V$();H9();h1=new Map});function R2(){return`
9409
+ ${X}`);return X+$}var Q1=null,F2=!1,S4=null,xW=256,h1,H1=null,x3=null;var A2=k(()=>{V$();H9();h1=new Map});function w2(){return`
9409
9410
  // STX Lifecycle Runtime
9410
9411
  (function() {
9411
9412
  if (typeof window === 'undefined') return;
@@ -9750,7 +9751,7 @@ else {
9750
9751
 
9751
9752
  console.log('[stx] Lifecycle runtime initialized');
9752
9753
  })();
9753
- `}function h3($){return Symbol($)}var fF,gF,hF;var A2=k(()=>{fF=h3("theme"),gF=h3("router"),hF=h3("i18n")});import*as N2 from"crypto";function w2($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function lW(){return`stx-${N2.randomBytes(4).toString("hex")}`}function pW($){return/\$\w+\./.test($)}function cW($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],U=!1,z=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(pW(V)){U=!0;let R=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(R){let A=R[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),w2(A).forEach((N)=>Y.add(N)),O==="text")z=z.replace(F,"");else if(O==="class")z=z.replace(F,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(F,"");else z=z.replace(F,`${O}=""`)}}}if(!U)return J;let j=z.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=lW(),z=` id="${H}"${z}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:w2(L.expr)});return`<${G}${z}${q}`}),{html:Q,bindings:Z,stores:Y}}function iW($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
9754
+ `}function h3($){return Symbol($)}var hF,dF,mF;var N2=k(()=>{hF=h3("theme"),dF=h3("router"),mF=h3("i18n")});import*as M2 from"crypto";function T2($){let Z=/\$(\w+)\./g,Y=[],X;while((X=Z.exec($))!==null)if(!Y.includes(X[1]))Y.push(X[1]);return Y}function cW(){return`stx-${M2.randomBytes(4).toString("hex")}`}function iW($){return/\$\w+\./.test($)}function nW($){let Z=[],Y=new Set,X=/<(\w+)([^>]*?)(\s*\/?>)/g,Q=$;return Q=Q.replace(X,(J,G,K,q)=>{if(["script","style","template"].includes(G.toLowerCase()))return J;let W=[],z=!1,U=K,B=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,_=[...K.matchAll(B)];for(let L of _){let F=L[0],O=L[1],V=L[2];if(iW(V)){z=!0;let R=V.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(R){let A=R[1];if(W.push({attr:O,expr:A,fullMatch:F,originalAttr:O}),T2(A).forEach((N)=>Y.add(N)),O==="text")U=U.replace(F,"");else if(O==="class")U=U.replace(F,'class=""');else if(O==="disabled"||O==="hidden")U=U.replace(F,"");else U=U.replace(F,`${O}=""`)}}}if(!z)return J;let j=U.match(/\bid\s*=\s*"([^"]+)"/),H;if(j)H=j[1];else H=cW(),U=` id="${H}"${U}`;for(let L of W)Z.push({elementId:H,attribute:L.attr,expression:L.expr,stores:T2(L.expr)});return`<${G}${U}${q}`}),{html:Q,bindings:Z,stores:Y}}function oW($,Z){if($.length===0)return"";let Y=Array.from(Z),X=`
9754
9755
  <script>
9755
9756
  (function() {
9756
9757
  'use strict';
@@ -9908,10 +9909,10 @@ else {
9908
9909
  }
9909
9910
  })();
9910
9911
  </script>
9911
- `,X}function T2($){let{html:Z,bindings:Y,stores:X}=cW($);if(Y.length===0)return $;let Q=iW(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var M2=()=>{};function nW($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return oW(Z);case"google-analytics":return sW(Z);case"plausible":return rW(Z);case"self-hosted":return aW(Z);case"custom":return tW(Z);default:return""}}function oW($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Q=[`data-site="${v0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${v0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
9912
+ `,X}function I2($){let{html:Z,bindings:Y,stores:X}=nW($);if(Y.length===0)return $;let Q=oW(Y,X),J=Z.lastIndexOf("</body>");if(J!==-1)return Z.slice(0,J)+Q+Z.slice(J);return Z+Q}var D2=()=>{};function sW($){let Z=$.analytics;if(!Z?.enabled)return"";switch(Z.driver){case"fathom":return rW(Z);case"google-analytics":return aW(Z);case"plausible":return tW(Z);case"self-hosted":return eW(Z);case"custom":return $z(Z);default:return""}}function rW($){let Z=$.fathom;if(!Z?.siteId)return"";let Y=Z.scriptUrl||"https://cdn.usefathom.com/script.js",X=Z.defer!==!1?" defer":"",Q=[`data-site="${v0(Z.siteId)}"`];if(Z.honorDnt)Q.push('data-honor-dnt="true"');if(Z.spa)Q.push('data-spa="auto"');if(Z.canonical)Q.push(`data-canonical="${v0(Z.canonical)}"`);if(Z.auto===!1)Q.push('data-auto="false"');return`
9912
9913
  <!-- Fathom Analytics -->
9913
9914
  <script src="${v0(Y)}" ${Q.join(" ")}${X}></script>
9914
- `}function sW($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=v0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
9915
+ `}function aW($){let Z=$.googleAnalytics;if(!Z?.measurementId)return"";let Y=v0(Z.measurementId),X=Z.debug?`gtag('config', '${Y}', { 'debug_mode': true });`:"";return`
9915
9916
  <!-- Google Analytics -->
9916
9917
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Y}"></script>
9917
9918
  <script>
@@ -9921,10 +9922,10 @@ else {
9921
9922
  gtag('config', '${Y}');
9922
9923
  ${X}
9923
9924
  </script>
9924
- `}function rW($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${v0(Z.domain)}"`],Q=Y,J=[];if(Z.trackLocalhost)J.push("local");if(Z.hashMode)J.push("hash");if(J.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${J.join(".")}.js`;return`
9925
+ `}function tW($){let Z=$.plausible;if(!Z?.domain)return"";let Y=Z.scriptUrl||"https://plausible.io/js/script.js",X=[`data-domain="${v0(Z.domain)}"`],Q=Y,J=[];if(Z.trackLocalhost)J.push("local");if(Z.hashMode)J.push("hash");if(J.length>0&&Y==="https://plausible.io/js/script.js")Q=`https://plausible.io/js/script.${J.join(".")}.js`;return`
9925
9926
  <!-- Plausible Analytics -->
9926
9927
  <script defer data-domain="${v0(Z.domain)}" src="${v0(Q)}"></script>
9927
- `}function aW($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=v0(Z.siteId),X=v0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
9928
+ `}function eW($){let Z=$.selfHosted;if(!Z?.siteId||!Z?.apiEndpoint)return"";let Y=v0(Z.siteId),X=v0(Z.apiEndpoint),Q=Z.honorDnt?'if(n.doNotTrack==="1")return;':"",J=Z.trackHashChanges?"w.addEventListener('hashchange',pv);":"",G=Z.trackOutboundLinks?`
9928
9929
  d.addEventListener('click',function(e){
9929
9930
  var a=e.target.closest('a');
9930
9931
  if(a&&a.hostname!==location.hostname){
@@ -9957,7 +9958,7 @@ else {
9957
9958
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
9958
9959
  })();
9959
9960
  </script>
9960
- `}function tW($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
9961
+ `}function $z($){let Z=$.custom;if(!Z)return"";if(Z.inlineScript)return`
9961
9962
  <!-- Custom Analytics -->
9962
9963
  <script>
9963
9964
  ${Z.inlineScript}
@@ -9965,7 +9966,7 @@ ${Z.inlineScript}
9965
9966
  `;if(!Z.scriptUrl)return"";let Y=[];if(Z.scriptId)Y.push(`id="${v0(Z.scriptId)}"`);if(Z.attributes)for(let[Q,J]of Object.entries(Z.attributes))Y.push(`${v0(Q)}="${v0(J)}"`);return`
9966
9967
  <!-- Custom Analytics -->
9967
9968
  <script${Y.length>0?` ${Y.join(" ")}`:""} src="${v0(Z.scriptUrl)}" defer></script>
9968
- `}function I2($,Z){let Y=nW(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 v0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var D2=()=>{};function b2($){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(eW.has(X))Z.systemKeys.push(X);else if(X in S2)Z.mouse=X;else if(X in k2||/^[a-z]$/.test(X))Z.keys.push(k2[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function y2($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[J,G,K]=Q,q=Q.index,W=q+J.length,U=`__stx_evt_${Y++}`,z=[],B=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=B.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!E2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:b2(F.slice(1)),elementId:U})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=j.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!E2.has(O))continue;z.push({attribute:`@${H}`,event:O,handler:L,modifiers:b2(F.slice(1)),elementId:U})}if(z.length>0)Z.push({originalTag:J,elementId:U,events:z,startIndex:q,endIndex:W})}return Z}function $U($){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((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=S2[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 ZU($,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 YU($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=$U($),Q=ZU($.handler,Z),J=[];if(Z.once)J.push("once: true");if(Z.capture)J.push("capture: true");if(Z.passive)J.push("passive: true");let G=J.length>0?`, { ${J.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
9969
+ `}function E2($,Z){let Y=sW(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 v0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var k2=()=>{};function y2($){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(Zz.has(X))Z.systemKeys.push(X);else if(X in P2)Z.mouse=X;else if(X in S2||/^[a-z]$/.test(X))Z.keys.push(S2[X]||X.toUpperCase());else if(X.startsWith("debounce")){let Q=X.match(/debounce(?:\.(\d+))?/);Z.debounce=Q?.[1]?Number.parseInt(Q[1],10):300}else if(X.startsWith("throttle")){let Q=X.match(/throttle(?:\.(\d+))?/);Z.throttle=Q?.[1]?Number.parseInt(Q[1],10):300}}return Z}function C2($){let Z=[],Y=0,X=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,Q;while((Q=X.exec($))!==null){let[J,G,K]=Q,q=Q.index,W=q+J.length,z=`__stx_evt_${Y++}`,U=[],B=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,_;while((_=B.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!b2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:y2(F.slice(1)),elementId:z})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((_=j.exec(K))!==null){let[,H,L]=_,F=H.split("."),O=F[0];if(!b2.has(O))continue;U.push({attribute:`@${H}`,event:O,handler:L,modifiers:y2(F.slice(1)),elementId:z})}if(U.length>0)Z.push({originalTag:J,elementId:z,events:U,startIndex:q,endIndex:W})}return Z}function Yz($){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((Q)=>`$event.key === '${Q}'`).join(" || ");Z.push(`if (!(${X})) return`)}if(Y.mouse!==null){let X=P2[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 Xz($,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 Jz($){let{modifiers:Z}=$,Y=$.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),X=Yz($),Q=Xz($.handler,Z),J=[];if(Z.once)J.push("once: true");if(Z.capture)J.push("capture: true");if(Z.passive)J.push("passive: true");let G=J.length>0?`, { ${J.join(", ")} }`:"",K=Q.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if($.event==="mounted")return`
9969
9970
  (function() {
9970
9971
  var $el = document.getElementById('${Y}');
9971
9972
  if (!$el) return;
@@ -10019,7 +10020,7 @@ else {
10019
10020
  __stx_runHandler('${K}', $event, $el);
10020
10021
  }
10021
10022
  }${G});
10022
- })();`}function XU($){if($.length===0)return"";return`
10023
+ })();`}function Qz($){if($.length===0)return"";return`
10023
10024
  <script data-stx-events>
10024
10025
  (function() {
10025
10026
  'use strict';
@@ -10067,11 +10068,11 @@ else {
10067
10068
  }
10068
10069
 
10069
10070
  // Event listeners
10070
- ${$.flatMap((Y)=>Y.events).map(YU).join(`
10071
+ ${$.flatMap((Y)=>Y.events).map(Jz).join(`
10071
10072
  `)}
10072
10073
  })();
10073
- </script>`}function JU($){let Z=y2($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let Q=Z.length-1;Q>=0;Q--){let J=Z[Q],G=J.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${J.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of J.events)q.elementId=K[1]}for(let K of J.events){let q=K.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),W=new RegExp(`\\s*${q}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${q}\\s*=\\s*'[^']*'`,"g");G=G.replace(W,""),G=G.replace(U,"")}Y=Y.slice(0,J.startIndex)+G+Y.slice(J.endIndex),X.push(...J.events)}return{template:Y,bindings:X}}function P2($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=JU($),U=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...U,...W],q}let Q=y2($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let W=Q[q],U=W.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let z=U.match(/id=["']([^"']+)["']/);if(z)for(let B of W.events)B.elementId=z[1]}for(let z of W.events){let B=z.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");U=U.replace(_,""),U=U.replace(j,"")}J=J.slice(0,W.startIndex)+U+J.slice(W.endIndex)}let G=XU(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
10074
- `+J.slice(K);else J+=G;return J}var E2,k2,eW,S2;var C2=k(()=>{E2=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"]),k2={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"},eW=new Set(["ctrl","alt","shift","meta"]),S2={left:0,middle:1,right:2}});function y4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function v2($,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 GU($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[Q,J,G]=X,K=X.index,q=v2(G,"x-data");if(!q)continue;let W=`__stx_scope_${f2++}`,U=v2(G,"x-init"),z=KU($,J,K+Q.length),B=$.slice(K,z.endIndex),_=qU(B);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:U,bindings:[],refs:_})}return Z}function KU($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),W=G.exec($),U=K.exec($);if(U&&U.index<(q?.index??1/0)){Q=U.index+U[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:W.index+W[0].length};Q=W.index+W[0].length}}return{endIndex:$.length}}function qU($){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,Q;while((Q=X.exec(Y))!==null){let[,J,G]=Q,K=WU(J);Z.set(G,K)}return Z}function WU($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${QU++}`}function UU(){return`
10074
+ </script>`}function Gz($){let Z=C2($);if(Z.length===0)return{template:$,bindings:[]};let Y=$,X=[];for(let Q=Z.length-1;Q>=0;Q--){let J=Z[Q],G=J.originalTag;if(!G.includes(" id="))G=G.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${J.elementId}"`);else{let K=G.match(/id=["']([^"']+)["']/);if(K)for(let q of J.events)q.elementId=K[1]}for(let K of J.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,J.startIndex)+G+Y.slice(J.endIndex),X.push(...J.events)}return{template:Y,bindings:X}}function v2($,Z,Y){if(/\b(?:state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)||/@(?:model|show|for|if)\s*=/.test($)||/data-stx(?:-auto)?(?![-\w])/.test($))return $;if(Z.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test($))return $;let{template:q,bindings:W}=Gz($),z=Z.__stx_event_bindings||[];return Z.__stx_event_bindings=[...z,...W],q}let Q=C2($);if(Q.length===0)return $;let J=$;for(let q=Q.length-1;q>=0;q--){let W=Q[q],z=W.originalTag;if(!z.includes(" id="))z=z.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let U=z.match(/id=["']([^"']+)["']/);if(U)for(let B of W.events)B.elementId=U[1]}for(let U of W.events){let B=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),_=new RegExp(`\\s*${B}\\s*=\\s*"[^"]*"`,"g"),j=new RegExp(`\\s*${B}\\s*=\\s*'[^']*'`,"g");z=z.replace(_,""),z=z.replace(j,"")}J=J.slice(0,W.startIndex)+z+J.slice(W.endIndex)}let G=Qz(Q),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+G+`
10075
+ `+J.slice(K);else J+=G;return J}var b2,S2,Zz,P2;var x2=k(()=>{b2=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"]),S2={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"},Zz=new Set(["ctrl","alt","shift","meta"]),P2={left:0,middle:1,right:2}});function y4($){return $.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function f2($,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 qz($){let Z=[],Y=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,X;while((X=Y.exec($))!==null){let[Q,J,G]=X,K=X.index,q=f2(G,"x-data");if(!q)continue;let W=`__stx_scope_${h2++}`,z=f2(G,"x-init"),U=Wz($,J,K+Q.length),B=$.slice(K,U.endIndex),_=zz(B);Z.push({id:W,selector:`[data-stx-scope="${W}"]`,stateExpr:q,initExpr:z,bindings:[],refs:_})}return Z}function Wz($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s|>)`,"gi"),G=new RegExp(`</${Z}>`,"gi"),K=new RegExp(`<${Z}[^>]*/\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q,K.lastIndex=Q;let q=J.exec($),W=G.exec($),z=K.exec($);if(z&&z.index<(q?.index??1/0)){Q=z.index+z[0].length;continue}if(!W)return{endIndex:$.length};if(q&&q.index<W.index)X++,Q=q.index+q[0].length;else{if(X--,X===0)return{endIndex:W.index+W[0].length};Q=W.index+W[0].length}}return{endIndex:$.length}}function zz($){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,Q;while((Q=X.exec(Y))!==null){let[,J,G]=Q,K=Uz(J);Z.set(G,K)}return Z}function Uz($){let Z=$.match(/\bid\s*=\s*["']([^"']*)["']/);if(Z)return Z[1];return`__stx_el_${Kz++}`}function Bz(){return`
10075
10076
  // STX Reactive Runtime - x-cloak and transition CSS
10076
10077
  (function() {
10077
10078
  var style = document.createElement('style');
@@ -10278,7 +10279,7 @@ window.__stx_reactive = (function() {
10278
10279
 
10279
10280
  return { initScope: initScope, reactive: reactive };
10280
10281
  })();
10281
- `}function x2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=m0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=m0(Q,Z,!0);if(J===void 0)return X;if(typeof J==="string"){let G=J.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(J)}catch{return X}}),Y}function zU($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=x2(X.stateExpr,Z),G=X.initExpr?x2(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
10282
+ `}function g2($,Z){let Y=$.replace(/\{!!([\s\S]*?)!!\}/g,(X,Q)=>{try{let J=m0(Q,Z,!0);if(J===void 0)return X;return String(J)}catch{return X}});return Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(X,Q)=>{try{let J=m0(Q,Z,!0);if(J===void 0)return X;if(typeof J==="string"){let G=J.trim();if(G.startsWith("{")&&G.endsWith("}")||G.startsWith("[")&&G.endsWith("]"))try{return JSON.parse(G),G}catch{}}return JSON.stringify(J)}catch{return X}}),Y}function jz($,Z){if($.length===0)return"";let Y=$.map((X)=>{let Q=JSON.stringify(Object.fromEntries(X.refs)),J=g2(X.stateExpr,Z),G=X.initExpr?g2(X.initExpr,Z):null,K=JSON.stringify(J),q=G?JSON.stringify(G):"null";return`
10282
10283
  (function() {
10283
10284
  var scopeEl = document.querySelector('${X.selector}');
10284
10285
  if (!scopeEl) return;
@@ -10287,16 +10288,16 @@ window.__stx_reactive = (function() {
10287
10288
  })();`}).join(`
10288
10289
  `);return`
10289
10290
  <script data-stx-scoped data-stx-reactive>
10290
- ${UU()}
10291
+ ${Bz()}
10291
10292
  ${Y}
10292
- </script>`}function g2($,Z,Y){if(f2=0,!jU($))return $;let X=GU($);if(X.length===0)return $;let Q=BU($,X),J=zU(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
10293
- `+Q.slice(G);else Q+=J;return Q}function BU($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${y4(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${y4(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${y4(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${y4(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function jU($){return/x-data\s*=\s*["']/.test($)}var f2=0,QU=0;var h2=k(()=>{a0()});import _U from"fs";import d3 from"path";import{createHighlighter as HU}from"ts-syntax-highlighter";async function OU($,Z={}){try{if(!await n($))throw Error(`Markdown file not found: ${$}`);let X=(await _U.promises.stat($)).mtime.getTime();if(Z.cache&&m3.has($)){let z=m3.get($);if(z.updatedAt>=X)return{content:z.content,data:z.data}}let Q=await Bun.file($).text(),{data:J,content:G}=S9(Q),K=Z.markdown||v3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=E5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await LU(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:W,data:J||{}};if(Z.cache)m3.set($,{...U,updatedAt:X});return U}catch(Y){if(Z.debug)console.error(`Error reading/parsing markdown file ${$}:`,Y);let X=Y instanceof Error?Y.message:String(Y);return{content:W0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function LU($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!P4)try{P4=await HU({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=W||(Y?"text":"");if(!B)return K;try{if(!P4.getSupportedLanguages().includes(B))return K;return(await P4.highlight(z,B,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,U,z]=K,B=await Q(q,W,U,z);J=J.replace(q,B)}return J}async function d2($,Z,Y="",X={}){return await FU($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let U=K;if(!d3.isAbsolute(K))U=d3.resolve(d3.dirname(Y),K);let z={};if(q)try{try{z=JSON.parse(q)}catch{if(X.debug)console.warn("Using safer alternative for parsing JS object literal");let O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let R=V.indexOf(":");if(R>0){let A=V.substring(0,R).trim(),w=V.substring(R+1).trim(),N=w.startsWith('"')&&w.endsWith('"'),T=w.startsWith("'")&&w.endsWith("'");if(N||T)w=w.substring(1,w.length-1);z[A]=w}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:_}=await OU(U,X),j={...Z,..._,...z},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(U){let z=U instanceof Error?U.message:String(U);return W0("Markdown File",`Error including markdown file: ${z}`,Y,$,W,G)}})}async function FU($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).then((U)=>({match:K,replacement:U,index:q})))}let J=await Promise.all(X);J.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of J)G=G.replace(K,()=>q);return G}var m3,P4=null;var m2=k(()=>{W5();O0();m3=new Map});function O1($,Z){try{let Y=$.trim();if(J0(Y))return Q0(Y,Object.keys(Z))(...Object.values(Z));else return Y0(Y,Z)}catch{return!1}}var u2=k(()=>{F0()});function VU($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=y7(X,G);if(!K)break;try{let q;if(J0(K.expression))q=Q0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Y0(K.expression,Z);let W="",U=!1;for(let z of K.cases)if(z.type==="default"){if(!U)W=z.content.trim()}else try{let B;if(z.value&&J0(z.value))B=Q0(z.value,Object.keys(Z))(...Object.values(Z));else if(z.value)B=Y0(z.value,Z);if(q===B){W=z.content.trim(),U=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,G)+U+X.substring(K.end);break}}return X}function d1($,Z,Y){let X=$;X=VU(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=j1(X,K+7);if(!q)break;let W=q.endPos,U=y1(X,"unless","endunless",W);if(U===-1){console.warn(`[stx] @unless directive at position ${K} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=X.slice(W,U),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],R;while((R=L.exec(z))!==null)V.push({pos:R.index,type:"open"});while((R=F.exec(z))!==null)V.push({pos:R.index,type:"close"});while((R=O.exec(z))!==null)V.push({pos:R.index,type:"else"});V.sort((A,w)=>A.pos-w.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){_=A.pos;break}}let j;if(_!==-1){let H=z.slice(0,_),L=z.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${z}@endif`;X=X.substring(0,K)+j+X.substring(U+10),J=!0}}X=l3(X,Z,Y),X=p3(X,Z,Y),X=u3(X,Z);let Q=()=>{let J=c5(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let U of K.branches){if(W)break;if(U.type==="else")q=U.content,W=!0;else try{let z;if(U.condition&&J0(U.condition))z=Q0(U.condition,Object.keys(Z))(...Object.values(Z));else if(U.condition)z=Y0(U.condition,Z);if(z)q=U.content,W=!0}catch(z){q=$0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),W=!0}}X=X.substring(0,K.start)+q+X.substring(K.end)}catch(q){let W=q instanceof Error?q.message:String(q),U=$0("If",`Error processing @if block: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,K.start)+U+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function l2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function u3($,Z){let Y=$;function X(K,q,W,U){let z=1,B=U,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(B<K.length&&z>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)z++,B=F+H[0].length;else if(O<1/0){if(z--,z===0)return O;B=O+L[0].length}else break}return-1}function Q(K,q,W){let U=0,z=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=z.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")U++;else if(L.type==="close")U--;else if(L.type==="else"&&U===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+5),_=l2(B);if(_)U=_.value,z=W+5+_.consumed;else z=W+5;let j=X(Y,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=U?O1(`auth?.check && auth?.user?.[${U}]`,Z):O1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,U,z,B=Y.slice(W+6),_=l2(B);if(_)U=_.value,z=W+6+_.consumed;else z=W+6;let j=X(Y,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(z,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=U?O1(`!auth?.check || !auth?.user?.[${U}]`,Z):O1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function J(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let U=[K];if(q)U.push(q);if(W){let z=O1(W,Z);U.push(z)}return Z.permissions.check(...U)}catch{return!1}return!1}function G(K){let q=K.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!q)return null;return{ability:q[1],type:q[2],id:q[3]?.trim(),paramsEnd:q[0].length}}for(let K of["can","cannot"]){let q=`end${K}`,W=K==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Y.match(new RegExp(`@${K}\\s*\\(`));if(!z||z.index===void 0)break;let B=z.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,R=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),w=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=R.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=w.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((b,C)=>b.pos-C.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)O.push(b)}let I=[],E=0;for(let b=0;b<O.length;b++){let C=O[b];if(I.push({content:F.slice(E,C.pos),ability:void 0}),C.type==="elseDirective"){let h=F.slice(C.pos+`@${W}`.length),x=G(h);if(x){I[I.length-1]={content:F.slice(E,C.pos)},E=C.pos+`@${W}`.length+x.paramsEnd,I.push({content:"",ability:x.ability,type:x.type,id:x.id}),I.pop();let u=O[b+1],t=u?u.pos:F.length;I.push({content:F.slice(E,t),ability:x.ability,type:x.type,id:x.id}),E=t}}else E=C.pos+5}if(E<F.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(E)})}let D=J(j.ability,j.type,j.id),P=K==="can"?D:!D,S="";if(P)S=I[0]?.content||"";else{let b=!1;for(let C=1;C<I.length;C++){let h=I[C];if(h.isFinalElse){S=h.content,b=!0;break}if(h.ability){let x=J(h.ability,h.type,h.id);if(K==="can"?x:!x){S=h.content,b=!0;break}}}if(!b&&I.length>0){let C=I[I.length-1];if(C.isFinalElse)S=C.content}}Y=Y.substring(0,B)+S+Y.substring(L+`@${q}`.length),U=!0}}return Y}function l3($,Z,Y){let X=$;function Q(J,G,K,q,W){let U=!0;while(U){U=!1;let z=new RegExp(`@${G}\\s*\\(`),B=J.match(z);if(!B||B.index===void 0)break;let _=B.index,j=j1(J,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=y1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=j.expression,V=-1,R=0,A=0;while(A<F.length){let w=F.indexOf("@",A);if(w===-1)break;let N=F.substring(w);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){R++,A=w+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){R--,A=w+1;continue}if(R===0&&/^@else(?![a-z])/.test(N)){V=w;break}A=w+1}try{let w=q(O.trim()),N;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);N=w?T:M}else N=w?F:"";J=J.substring(0,_)+N+J.substring(L+`@${K}`.length),U=!0}catch(w){let N=w instanceof Error?w.message:String(w),T=$0(W,`Error processing @${G} directive: ${N}`,o.EVALUATION_ERROR);J=J.substring(0,_)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=O1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=O1(J,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function p3($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let U=new RegExp(`@${K}(?![a-z])`,"g"),z=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,U.lastIndex=0;let L=U.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let D=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,W=Q===D[2]}let V=1,R=O,A=-1;while(V>0&&R<j.length){U.lastIndex=R,z.lastIndex=R;let D=U.exec(j),P=z.exec(j),S=D?D.index:1/0,b=P?P.index:1/0;if(S<b)V++,R=S+D[0].length;else if(b<1/0){if(V--,V===0){A=b;break}R=b+P[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let w=j.substring(O,A),N=-1,T=0,M=0;while(M<w.length){let D=w.indexOf("@",M);if(D===-1)break;let P=w.substring(D);if(B.test(P)){T++,M=D+1;continue}if(_.test(P)){T--,M=D+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){N=D;break}M=D+1}let I;if(N!==-1){let D=w.slice(0,N),P=w.slice(N+5);I=W?D:P}else I=W?w:"";let E=`@${q}`.length;j=j.substring(0,F)+I+j.substring(A+E),H=!0}return j}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var C4=k(()=>{u2();J1();C$();F0()});function c2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function v4($,Z){if(!$)return Z?.nonceGenerator?.()??c2();let Y=p2.get($);if(!Y)Y=Z?.nonceGenerator?.()??c2(),p2.set($,Y);return Y}function RU($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function i2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${RU($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function n2($,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?v4(Y,Z):void 0,Q=i2(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
10294
- ${Q}`)}function o2($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?v4(Z,J):void 0;return i2(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return v4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=v4(Z,J);return Q}var p2;var s2=k(()=>{p2=new WeakMap});import AU from"crypto";function NU($=wU){let Z=AU.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return c3=Z,Z}function TU(){if(!c3)NU();return c3}function MU($=r2){let Z=TU();return`<input type="hidden" name="${$}" value="${Z}">`}function a2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return MU(X||r2)})}var wU=40,r2="_token",c3=null;var t2=()=>{};async function e2($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await IU(Q,J,Z,Y,X);else Q=await DU(Q,J,Z,Y,X)}return Q}async function IU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,U=e1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),z=[],B=U.exec(W);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?$Y(j):[],O=H.trim(),V=await G(O,F,Y,X);z.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);z.push({original:_,processed:$0("CustomDirective",`Error in @${J}${j?`(${j})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:L})}B=U.exec(W)}for(let _=z.length-1;_>=0;_--){let{original:j,processed:H}=z[_];W=W.replace(j,H)}return W}async function DU($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=e1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],U=q.exec(K);while(U!==null){let[_,j=""]=U,H=U.index||0;try{let L=$Y(j),F=await G("",L,Y,X);W.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:_,processed:$0("CustomDirective",`Error in @${J}(${j}): ${F}`,o.EVALUATION_ERROR),startIndex:H})}U=q.exec(K)}let z=e1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=z.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,X);W.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:_,processed:$0("CustomDirective",`Error in @${J}: ${L}`,o.EVALUATION_ERROR),startIndex:j})}B=z.exec(K)}for(let _=W.length-1;_>=0;_--){let{original:j,processed:H}=W[_];K=K.replace(j,H)}return K}function $Y($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var ZY=k(()=>{J1();$5()});import EU from"crypto";function R0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function x4($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function kU(){return EU.randomUUID()}function f4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=kU();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${R0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${R0(J)}">`;return X}),Y}function JY($,Z,Y=XY){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"POST",z=K||q||"",B=L1(W),_=U.toUpperCase(),j=["GET","POST"].includes(_)?_:"POST",H=`<form method="${R0(j)}" action="${R0(z)}"${B?` ${B}`:""}>`;if(H+=`
10293
+ </script>`}function d2($,Z,Y){if(h2=0,!Hz($))return $;let X=qz($);if(X.length===0)return $;let Q=_z($,X),J=jz(X,Z),G=Q.lastIndexOf("</body>");if(G!==-1)Q=Q.slice(0,G)+J+`
10294
+ `+Q.slice(G);else Q+=J;return Q}function _z($,Z){let Y=$;for(let X of Z){let J=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*data-stx-scope="([^"]*)"[^>]*x-data\\s*=\\s*["']${y4(X.stateExpr)}["']`,"gi").exec(Y);if(J)X.id=J[1],X.selector=`[data-stx-scope="${X.id}"]`;else{let K=new RegExp(`<[a-z][a-z0-9-]*\\s+[^>]*x-data\\s*=\\s*["']${y4(X.stateExpr)}["'][^>]*data-stx-scope="([^"]*)"`,"gi").exec(Y);if(K)X.id=K[1],X.selector=`[data-stx-scope="${X.id}"]`;else Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*"${y4(X.stateExpr)}")([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`),Y=Y.replace(new RegExp(`(<[a-z][a-z0-9-]*\\s+)([^>]*)(x-data\\s*=\\s*'${y4(X.stateExpr)}')([^>]*>)`,"gi"),`$1data-stx-scope="${X.id}" $2$3$4`)}}return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"[^"]*"/g,""),Y=Y.replace(/\s*x-init\s*=\s*'[^']*'/g,""),Y}function Hz($){return/x-data\s*=\s*["']/.test($)}var h2=0,Kz=0;var m2=k(()=>{a0()});import Oz from"fs";import d3 from"path";import{createHighlighter as Lz}from"ts-syntax-highlighter";async function Fz($,Z={}){try{if(!await n($))throw Error(`Markdown file not found: ${$}`);let X=(await Oz.promises.stat($)).mtime.getTime();if(Z.cache&&m3.has($)){let U=m3.get($);if(U.updatedAt>=X)return{content:U.content,data:U.data}}let Q=await Bun.file($).text(),{data:J,content:G}=S9(Q),K=Z.markdown||v3.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},W=E5(G,{gfm:!0});if(K.syntaxHighlighting?.enabled&&K.syntaxHighlighting?.serverSide)W=await Vz(W,K.syntaxHighlighting?.defaultTheme||"github-dark",K.syntaxHighlighting?.highlightUnknownLanguages||!1);let z={content:W,data:J||{}};if(Z.cache)m3.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:W0("Markdown File",`Error reading/parsing markdown file: ${X}`,$,"",0,""),data:{}}}}async function Vz($,Z,Y){let X=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!P4)try{P4=await Lz({theme:Z||"github-dark",cache:!0})}catch(K){return console.error("Failed to initialize ts-syntax-highlighter:",K),$}let Q=async(K,q,W,z)=>{let U=z.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),B=W||(Y?"text":"");if(!B)return K;try{if(!P4.getSupportedLanguages().includes(B))return K;return(await P4.highlight(U,B,{theme:Z})).html}catch(_){console.error(`Error highlighting code block with language ${W}:`,_)}return K},J=$,G=$.matchAll(X);for(let K of G){let[q,W,z,U]=K,B=await Q(q,W,z,U);J=J.replace(q,B)}return J}async function u2($,Z,Y="",X={}){return await Rz($,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(G,K,q,W)=>{try{let z=K;if(!d3.isAbsolute(K))z=d3.resolve(d3.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 O=q.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let V of O){let R=V.indexOf(":");if(R>0){let A=V.substring(0,R).trim(),w=V.substring(R+1).trim(),N=w.startsWith('"')&&w.endsWith('"'),T=w.startsWith("'")&&w.endsWith("'");if(N||T)w=w.substring(1,w.length-1);U[A]=w}}}}catch(F){if(X.debug)console.error("Error parsing context in @markdown-file directive:",F)}let{content:B,data:_}=await Fz(z,X),j={...Z,..._,...U},H=B,L=/\{\{([^}]+)\}\}/g;return H=H.replace(L,(F,O)=>{let V=O.trim();return j[V]!==void 0?String(j[V]):F}),H}catch(z){let U=z instanceof Error?z.message:String(z);return W0("Markdown File",`Error including markdown file: ${U}`,Y,$,W,G)}})}async function Rz($,Z,Y){let X=[],Q;while((Q=Z.exec($))!==null){let K=Q[0],q=Q.index,W=Q;X.push(Y(...W).then((z)=>({match:K,replacement:z,index:q})))}let J=await Promise.all(X);J.sort((K,q)=>q.index-K.index);let G=$;for(let{match:K,replacement:q}of J)G=G.replace(K,()=>q);return G}var m3,P4=null;var l2=k(()=>{W5();O0();m3=new Map});function O1($,Z){try{let Y=$.trim();if(J0(Y))return Q0(Y,Object.keys(Z))(...Object.values(Z));else return Y0(Y,Z)}catch{return!1}}var p2=k(()=>{F0()});function Az($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@switch\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=y7(X,G);if(!K)break;try{let q;if(J0(K.expression))q=Q0(K.expression,Object.keys(Z))(...Object.values(Z));else q=Y0(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 B;if(U.value&&J0(U.value))B=Q0(U.value,Object.keys(Z))(...Object.values(Z));else if(U.value)B=Y0(U.value,Z);if(q===B){W=U.content.trim(),z=!0;break}}catch{continue}X=X.substring(0,G)+W+X.substring(K.end),Q=!0}catch(q){let W=q instanceof Error?q.message:String(q),z=$0("Switch",`Error evaluating @switch expression: ${W}`,o.EVALUATION_ERROR);X=X.substring(0,G)+z+X.substring(K.end);break}}return X}function d1($,Z,Y){let X=$;X=Az(X,Z,Y);{let J=!0;while(J){J=!1;let G=X.match(/@unless\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=j1(X,K+7);if(!q)break;let W=q.endPos,z=y1(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),B=q.expression,_=-1;{let H=0,L=/@(?:if|unless)\s*\(/g,F=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,V=[],R;while((R=L.exec(U))!==null)V.push({pos:R.index,type:"open"});while((R=F.exec(U))!==null)V.push({pos:R.index,type:"close"});while((R=O.exec(U))!==null)V.push({pos:R.index,type:"else"});V.sort((A,w)=>A.pos-w.pos);for(let A of V)if(A.type==="open")H++;else if(A.type==="close")H--;else if(A.type==="else"&&H===0){_=A.pos;break}}let j;if(_!==-1){let H=U.slice(0,_),L=U.slice(_+5);j=`@if (${B})${L}@else ${H}@endif`}else j=`@if (!(${B}))${U}@endif`;X=X.substring(0,K)+j+X.substring(z+10),J=!0}}X=l3(X,Z,Y),X=p3(X,Z,Y),X=u3(X,Z);let Q=()=>{let J=c5(X);if(J.length===0)return!1;for(let G=J.length-1;G>=0;G--){let K=J[G];try{let q="",W=!1;for(let z of K.branches){if(W)break;if(z.type==="else")q=z.content,W=!0;else try{let U;if(z.condition&&J0(z.condition))U=Q0(z.condition,Object.keys(Z))(...Object.values(Z));else if(z.condition)U=Y0(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)}`,o.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}`,o.EVALUATION_ERROR);X=X.substring(0,K.start)+z+X.substring(K.end)}}return!0};while(!0){let J=X;if(!Q())break;if(X===J)break}return X}function c2($){let Z=0;while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!=="(")return null;Z++;while(Z<$.length&&/\s/.test($[Z]))Z++;let Y=$[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let X=[];while(Z<$.length){let Q=$[Z];if(Q==="\\"&&Z+1<$.length){X.push($[Z+1]),Z+=2;continue}if(Q===Y){Z++;break}X.push(Q),Z++}while(Z<$.length&&/\s/.test($[Z]))Z++;if($[Z]!==")")return null;return Z++,{value:X.join(""),consumed:Z}}function u3($,Z){let Y=$;function X(K,q,W,z){let U=1,B=z,_=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${W}(?![a-z])`,"g");while(B<K.length&&U>0){_.lastIndex=B,j.lastIndex=B;let H=_.exec(K),L=j.exec(K),F=H?H.index:1/0,O=L?L.index:1/0;if(F<O)U++,B=F+H[0].length;else if(O<1/0){if(U--,U===0)return O;B=O+L[0].length}else break}return-1}function Q(K,q,W){let z=0,U=new RegExp(`@${q}(?:\\s*\\(|\\s|$)`,"g"),B=new RegExp(`@${W}(?![a-z])`,"g"),_=/@else(?![a-z])/g,j=[],H;while((H=U.exec(K))!==null)j.push({pos:H.index,type:"open"});while((H=B.exec(K))!==null)j.push({pos:H.index,type:"close"});while((H=_.exec(K))!==null)j.push({pos:H.index,type:"else"});j.sort((L,F)=>L.pos-F.pos);for(let L of j)if(L.type==="open")z++;else if(L.type==="close")z--;else if(L.type==="else"&&z===0)return L.pos;return-1}{let K=!0;while(K){K=!1;let q=Y.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,B=Y.slice(W+5),_=c2(B);if(_)z=_.value,U=W+5+_.consumed;else U=W+5;let j=X(Y,"auth","endauth",U);if(j===-1){console.warn(`[stx] @auth directive at position ${W} has no matching @endauth \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"auth","endauth"),F;if(!Z.auth)F=!1;else F=z?O1(`auth?.check && auth?.user?.[${z}]`,Z):O1("auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+8),K=!0}}{let K=!0;while(K){K=!1;let q=Y.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!q||q.index===void 0)break;let W=q.index,z,U,B=Y.slice(W+6),_=c2(B);if(_)z=_.value,U=W+6+_.consumed;else U=W+6;let j=X(Y,"guest","endguest",U);if(j===-1){console.warn(`[stx] @guest directive at position ${W} has no matching @endguest \u2014 the block was skipped.`);break}let H=Y.slice(U,j),L=Q(H,"guest","endguest"),F;if(!Z.auth)F=!0;else F=z?O1(`!auth?.check || !auth?.user?.[${z}]`,Z):O1("!auth?.check",Z);let O;if(L!==-1){let V=H.slice(0,L),R=H.slice(L+5);O=F?V:R}else O=F?H:"";Y=Y.substring(0,W)+O+Y.substring(j+9),K=!0}}function J(K,q,W){if(Z.userCan&&typeof Z.userCan[K]==="boolean")return Z.userCan[K];if(Z.permissions?.check&&typeof Z.permissions.check==="function")try{let z=[K];if(q)z.push(q);if(W){let U=O1(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 B=U.index,_=Y.slice(B+`@${K}`.length),j=G(_);if(!j)break;let H=B+`@${K}`.length+j.paramsEnd,L=X(Y,K,q,H);if(L===-1){console.warn(`[stx] @${K} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let F=Y.slice(H,L),O=[],V=0,R=new RegExp(`@${K}\\s*\\(`,"g"),A=new RegExp(`@${q}(?![a-z])`,"g"),w=new RegExp(`@${W}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=R.exec(F))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(F))!==null)T.push({pos:M.index,type:"close"});while((M=w.exec(F))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(F))!==null)T.push({pos:M.index,type:"else"});T.sort((b,C)=>b.pos-C.pos);for(let b of T){if(b.type==="open"){V++;continue}if(b.type==="close"){V--;continue}if(V===0)O.push(b)}let I=[],E=0;for(let b=0;b<O.length;b++){let C=O[b];if(I.push({content:F.slice(E,C.pos),ability:void 0}),C.type==="elseDirective"){let h=F.slice(C.pos+`@${W}`.length),x=G(h);if(x){I[I.length-1]={content:F.slice(E,C.pos)},E=C.pos+`@${W}`.length+x.paramsEnd,I.push({content:"",ability:x.ability,type:x.type,id:x.id}),I.pop();let u=O[b+1],t=u?u.pos:F.length;I.push({content:F.slice(E,t),ability:x.ability,type:x.type,id:x.id}),E=t}}else E=C.pos+5}if(E<F.length){let b=I[I.length-1];if(O.length>0&&O[O.length-1].type==="else")I.push({content:F.slice(E),isFinalElse:!0});else if(I.length===0)I.push({content:F.slice(E)})}let D=J(j.ability,j.type,j.id),P=K==="can"?D:!D,S="";if(P)S=I[0]?.content||"";else{let b=!1;for(let C=1;C<I.length;C++){let h=I[C];if(h.isFinalElse){S=h.content,b=!0;break}if(h.ability){let x=J(h.ability,h.type,h.id);if(K==="can"?x:!x){S=h.content,b=!0;break}}}if(!b&&I.length>0){let C=I[I.length-1];if(C.isFinalElse)S=C.content}}Y=Y.substring(0,B)+S+Y.substring(L+`@${q}`.length),z=!0}}return Y}function l3($,Z,Y){let X=$;function Q(J,G,K,q,W){let z=!0;while(z){z=!1;let U=new RegExp(`@${G}\\s*\\(`),B=J.match(U);if(!B||B.index===void 0)break;let _=B.index,j=j1(J,_+`@${G}`.length);if(!j)break;let H=j.endPos,L=y1(J,G,K,H);if(L===-1){console.warn(`[stx] @${G} directive at position ${_} has no matching @${K} \u2014 the block was skipped.`);break}let F=J.slice(H,L),O=j.expression,V=-1,R=0,A=0;while(A<F.length){let w=F.indexOf("@",A);if(w===-1)break;let N=F.substring(w);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){R++,A=w+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){R--,A=w+1;continue}if(R===0&&/^@else(?![a-z])/.test(N)){V=w;break}A=w+1}try{let w=q(O.trim()),N;if(V!==-1){let T=F.slice(0,V),M=F.slice(V+5);N=w?T:M}else N=w?F:"";J=J.substring(0,_)+N+J.substring(L+`@${K}`.length),z=!0}catch(w){let N=w instanceof Error?w.message:String(w),T=$0(W,`Error processing @${G} directive: ${N}`,o.EVALUATION_ERROR);J=J.substring(0,_)+T+J.substring(L+`@${K}`.length);break}}return J}return X=Q(X,"isset","endisset",(J)=>{let G=O1(J,Z);return G!==void 0&&G!==null},"Isset"),X=Q(X,"empty","endempty",(J)=>{let G=O1(J,Z);return G===void 0||G===null||G===""||G===0||G===!1||Array.isArray(G)&&G.length===0||typeof G==="object"&&G!==null&&Object.keys(G).length===0},"Empty"),X}function p3($,Z,Y){let X=$,Q="development";function J(G,K,q,W){let z=new RegExp(`@${K}(?![a-z])`,"g"),U=new RegExp(`@${q}(?![a-z])`,"g"),B=new RegExp(`^@${K}(?![a-z])`),_=new RegExp(`^@${q}(?![a-z])`),j=G,H=!0;while(H){H=!1,z.lastIndex=0;let L=z.exec(j);if(!L)break;let F=L.index,O=F+L[0].length;if(K==="env"){let D=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!D)break;O+=D[0].length,W=Q===D[2]}let V=1,R=O,A=-1;while(V>0&&R<j.length){z.lastIndex=R,U.lastIndex=R;let D=z.exec(j),P=U.exec(j),S=D?D.index:1/0,b=P?P.index:1/0;if(S<b)V++,R=S+D[0].length;else if(b<1/0){if(V--,V===0){A=b;break}R=b+P[0].length}else break}if(A===-1){console.warn(`[stx] @${K} directive at position ${F} has no matching @${q} \u2014 the block was skipped.`);break}let w=j.substring(O,A),N=-1,T=0,M=0;while(M<w.length){let D=w.indexOf("@",M);if(D===-1)break;let P=w.substring(D);if(B.test(P)){T++,M=D+1;continue}if(_.test(P)){T--,M=D+1;continue}if(T===0&&/^@else(?![a-z])/.test(P)){N=D;break}M=D+1}let I;if(N!==-1){let D=w.slice(0,N),P=w.slice(N+5);I=W?D:P}else I=W?w:"";let E=`@${q}`.length;j=j.substring(0,F)+I+j.substring(A+E),H=!0}return j}return X=J(X,"env","endenv",!1),X=J(X,"production","endproduction",Q==="production"),X=J(X,"development","enddevelopment",Q==="development"),X=J(X,"staging","endstaging",Q==="staging"),X=J(X,"testing","endtesting",Q==="testing"),X}var C4=k(()=>{p2();J1();C$();F0()});function n2($=16){let Z=new Uint8Array($);return crypto.getRandomValues(Z),btoa(String.fromCharCode(...Z))}function v4($,Z){if(!$)return Z?.nonceGenerator?.()??n2();let Y=i2.get($);if(!Y)Y=Z?.nonceGenerator?.()??n2(),i2.set($,Y);return Y}function wz($,Z){let Y=[];for(let[X,Q]of Object.entries($)){if(Q===void 0||Q===null)continue;if(typeof Q==="boolean"){if(Q)Y.push(X);continue}if(Array.isArray(Q)){let J=[...Q];if(Z&&(X==="script-src"||X==="style-src"))J=J.filter((G)=>!G.startsWith("'nonce-")),J.push(`'nonce-${Z}'`);if(J.length>0)Y.push(`${X} ${J.join(" ")}`)}}return Y.join("; ")}function o2($,Z){return`<meta http-equiv="Content-Security-Policy" content="${wz($,Z).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function s2($,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?v4(Y,Z):void 0,Q=o2(Z.directives,X);return $.replace(/<head([^>]*)>/,`<head$1>
10295
+ ${Q}`)}function r2($,Z,Y,X){let Q=$,J=X.csp;if(Q=Q.replace(/@csp\b/g,()=>{if(!J?.enabled||!J.directives)return"<!-- CSP not configured -->";let G=J.useNonce?v4(Z,J):void 0;return o2(J.directives,G)}),Q=Q.replace(/@cspNonce\b/g,()=>{if(!J?.enabled||!J.useNonce)return"";return v4(Z,J)}),J?.enabled&&J.useNonce)Z.cspNonce=v4(Z,J);return Q}var i2;var a2=k(()=>{i2=new WeakMap});import Nz from"crypto";function Mz($=Tz){let Z=Nz.randomBytes(Math.ceil($/2)).toString("hex").slice(0,$);return c3=Z,Z}function Iz(){if(!c3)Mz();return c3}function Dz($=t2){let Z=Iz();return`<input type="hidden" name="${$}" value="${Z}">`}function e2($){return $.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,(Z,Y,X)=>{return Dz(X||t2)})}var Tz=40,t2="_token",c3=null;var $Y=()=>{};async function ZY($,Z,Y,X){if(!X.customDirectives||X.customDirectives.length===0)return $;let Q=$;for(let J of X.customDirectives){if(!J.name||typeof J.handler!=="function"){if(X.debug)console.warn("Invalid custom directive:",J);continue}if(J.hasEndTag)Q=await Ez(Q,J,Z,Y,X);else Q=await kz(Q,J,Z,Y,X)}return Q}async function Ez($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=`@${J}`,q=`@end${J}`,W=$,z=e1(`${K}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${q}`,"g"),U=[],B=z.exec(W);while(B!==null){let[_,j="",H=""]=B,L=B.index||0;try{let F=j?YY(j):[],O=H.trim(),V=await G(O,F,Y,X);U.push({original:_,processed:V,startIndex:L})}catch(F){let O=F instanceof Error?F.message:String(F);if(Q.debug)console.error(`Error processing custom directive @${J}:`,F);U.push({original:_,processed:$0("CustomDirective",`Error in @${J}${j?`(${j})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:L})}B=z.exec(W)}for(let _=U.length-1;_>=0;_--){let{original:j,processed:H}=U[_];W=W.replace(j,H)}return W}async function kz($,Z,Y,X,Q){let{name:J,handler:G}=Z,K=$,q=e1(`@${J}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),W=[],z=q.exec(K);while(z!==null){let[_,j=""]=z,H=z.index||0;try{let L=YY(j),F=await G("",L,Y,X);W.push({original:_,processed:F,startIndex:H})}catch(L){let F=L instanceof Error?L.message:String(L);if(Q.debug)console.error(`Error processing custom directive @${J}:`,L);W.push({original:_,processed:$0("CustomDirective",`Error in @${J}(${j}): ${F}`,o.EVALUATION_ERROR),startIndex:H})}z=q.exec(K)}let U=e1(`@${J}(?!\\w)(?!\\s*\\()`,"g"),B=U.exec(K);while(B!==null){let[_]=B,j=B.index||0;try{let H=await G("",[],Y,X);W.push({original:_,processed:H,startIndex:j})}catch(H){let L=H instanceof Error?H.message:String(H);if(Q.debug)console.error(`Error processing custom directive @${J}:`,H);W.push({original:_,processed:$0("CustomDirective",`Error in @${J}: ${L}`,o.EVALUATION_ERROR),startIndex:j})}B=U.exec(K)}for(let _=W.length-1;_>=0;_--){let{original:j,processed:H}=W[_];K=K.replace(j,H)}return K}function YY($){if(!$.trim())return[];let Z=[],Y="",X=!1,Q="";for(let J=0;J<$.length;J++){let G=$[J];if((G==='"'||G==="'")&&(J===0||$[J-1]!=="\\"))if(!X)X=!0,Q=G;else if(G===Q)X=!1;else Y+=G;else if(G===","&&!X)Z.push(Y.trim()),Y="";else Y+=G}if(Y.trim())Z.push(Y.trim());return Z.map((J)=>{let G=J.trim();if(G.startsWith('"')&&G.endsWith('"')||G.startsWith("'")&&G.endsWith("'"))return G.substring(1,G.length-1);return G})}var XY=k(()=>{J1();$5()});import bz from"crypto";function R0($){return String($??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function x4($,Z,Y,X){let Q=$||Z;return Y?`${Q} ${X}`:Q}function Sz(){return bz.randomUUID()}function f4($,Z){let Y=$;return Y=Y.replace(/@csrf/g,()=>{if(!Z.csrf||typeof Z.csrf!=="object"){let X=Sz();Z.csrf={token:X}}if(Z.csrf.field)return Z.csrf.field;if(Z.csrf.token)return`<input type="hidden" name="_token" value="${R0(Z.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Y=Y.replace(/@method\(['"]([^'"]+)['"]\)/g,(X,Q)=>{let J=Q.toUpperCase();if(Q&&!["GET","POST"].includes(J))return`<input type="hidden" name="_method" value="${R0(J)}">`;return X}),Y}function GY($,Z,Y=QY){let X=$;return X=X.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(Q,J,G,K,q,W="")=>{let z=J||G||"POST",U=K||q||"",B=L1(W),_=z.toUpperCase(),j=["GET","POST"].includes(_)?_:"POST",H=`<form method="${R0(j)}" action="${R0(U)}"${B?` ${B}`:""}>`;if(H+=`
10295
10296
  ${f4("@csrf",Z)}`,!["GET","POST"].includes(_))H+=`
10296
- ${f4(`@method('${_}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let U=J||G||"",z=K||q||"",B=L1(W),_=$$(U,Z),j=_!==void 0&&_!==null?_:z||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=Z$(U,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=x4(O?O[1]:"",Y.input,F,Y.inputError),R=B.replace(/class=['"][^'"]+['"]/i,"");return R=R.replace(/type=['"][^'"]+['"]/i,""),`<input type="${R0(L)}" name="${R0(U)}" value="${R0(j)}" class="${V}"${R?` ${R}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=L1(G),W=$$(J,Z)||K.trim(),U=Z$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=x4(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${R0(J)}" class="${B}"${_?` ${_}`:""}>${R0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=L1(G),W=$$(J,Z),U=Z$(J,Z),z=q.match(/class=['"]([^'"]+)['"]/i),B=x4(z?z[1]:"",Y.input,U,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(W!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${R0(J)}" class="${B}"${_?` ${_}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=L1(K),W=$$(J,Z),U=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${R0(J)}" value="${R0(G)}" class="${B}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=L1(K),W=$$(J,Z),U=W!==void 0&&W===G,z=q.match(/class=['"]([^'"]+)['"]/i),B=z?z[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${R0(J)}" value="${R0(G)}" class="${B}"${U?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=L1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",U=K.includes("multiple"),z=Z$(J,Z),B=K.match(/class=['"]([^'"]+)['"]/i),_=x4(B?B[1]:"",Y.input,z,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${R0(J)}"`,`class="${_}"`];if(W)H.push(`accept="${R0(W)}"`);if(U)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=L1(G),W=q.match(/class=['"]([^'"]+)['"]/i),U=W?W[1]:Y.label,z=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${R0(J)}" class="${U}"${z?` ${z}`:""}>${K}</label>`}),X}function QY($,Z,Y=XY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(Z$(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return YY(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return YY(Q,Z)}let q=K.trim();if(J0(q)){let W=Y0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function Z$($,Z){if(!Z.errors)return!1;if(typeof Z.errors.has==="function")return Z.errors.has($);if(typeof Z.errors==="object")return Object.prototype.hasOwnProperty.call(Z.errors,$);return!1}function YY($,Z){if(!Z.errors)return"";if(typeof Z.errors.get==="function")return Z.errors.get($);if(typeof Z.errors==="object"&&Object.prototype.hasOwnProperty.call(Z.errors,$)){let Y=Z.errors[$];return Array.isArray(Y)?Y[0]:String(Y)}return""}function $$($,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 L1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var XY;var GY=k(()=>{F0();XY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import o3 from"path";async function bU(){if(Y$!==void 0)return Y$;try{Y$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{Y$=null}return Y$}function SU($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function yU($,Z){if({...a3,...Z.i18n}.cache&&s3[$]){let Q=s3[$],J=Z.i18n?.cacheMaxAge??0;if(!SU(Q,J))return Q.translations}if(X$[$]?.state==="loading")return X$[$].promise;i3[$]="loading";let X=r3($,Z).then((Q)=>{return i3[$]="loaded",delete X$[$],Q}).catch((Q)=>{throw i3[$]="error",X$[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return X$[$]={promise:X,state:"loading"},X}async function r3($,Z){let Y={...a3,...Z.i18n},X=o3.isAbsolute(Y.translationsDir)?Y.translationsDir:o3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await bU(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:fU(Y.format)}):await PU($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return r3(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)s3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return r3(Y.defaultLocale,Z);return{}}}async function PU($,Z,Y){let X=o3.join(Y,`${$}${CU(Z.format)}`);try{let Q=await import(X);return Q.default||Q}catch(Q){try{let J=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return vU(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function CU($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function vU($){let Z={},Y=$.split(`
10297
- `),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,U]=q,z=W.trim(),B=U.trim();if(B==="")K[z]={},X.push({obj:K[z],indent:G});else K[z]=xU(B)}}return Z}function xU($){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 fU($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function gU($,Z){return yU($,Z)}function hU($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function dU($,Z={}){return WY($,Z)}function WY($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=mU($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=uU(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function mU($,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 uU($,Z){let Y=lU($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return pU(Q,Y.slice(2).join(","),Z);case"select":return iU(Q,Y.slice(2).join(","));case"selectordinal":return nU(Q,Y.slice(2).join(","));case"number":return sU(Q,Y[2]?.trim());case"date":return rU(Q,Y[2]?.trim());case"time":return aU(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function lU($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function pU($,Z,Y){let X=Number($)||0,Q=t3(Z),J=`=${X}`;if(Q[J])return n3(Q[J],X,Y);let G=cU(X);if(Q[G])return n3(Q[G],X,Y);if(Q.other)return n3(Q.other,X,Y);return String(X)}function n3($,Z,Y){let X=$.replace(/#/g,String(Z));return WY(X,Y)}function cU($){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 iU($,Z){let Y=String($||""),X=t3(Z);if(X[Y])return X[Y];return X.other||String($)}function nU($,Z){let Y=Number($)||0,X=t3(Z),Q=oU(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function oU($){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 t3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function sU($,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 rU($,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 aU($,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 tU($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function KY($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if(tU(G))return dU(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=hU(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 UY($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...a3,...X.i18n},K=await gU(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await qY(Q,J,async(U,z,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return L0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return KY(z,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return $0("Translate",`Error in @translate('${z}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...Q.matchAll(q)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,B)=>console.warn(`Match ${B}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return Q=await qY(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return L0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return KY(z,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),Q}async function qY($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var Y$,a3,s3,X$,i3;var zY=k(()=>{J1();F0();a3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},s3={},X$={},i3={}});var Z6={};r(Z6,{streamingSuspenseDirective:()=>_Y,streamToResponse:()=>Uz,streamTemplateSimple:()=>Gz,streamTemplate:()=>$z,renderStreamingPage:()=>Yz,registerStreamingDirectives:()=>qz,processStreamDirectives:()=>Jz,processSectionDirectives:()=>Wz,islandDirective:()=>HY,generateHydrationRuntime:()=>zz,extractStreamBoundaries:()=>Qz,createStreamRenderer:()=>Kz,buildSuspenseResolveScript:()=>$6,SUSPENSE_RESOLVER_RUNTIME:()=>jY});import g4 from"path";function eU($){let Z=[],Y=0,X;BY.lastIndex=0;while((X=BY.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=X[1],J=X[2];Z.push({type:"suspense",name:Q,content:J}),Y=X.index+X[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function $z($,Z={},Y={}){let X={...g1,...Y,streaming:{...e3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:g4.dirname($)};if(q.trim())await S1(q,U,$);let z=eU(W),B=new Set;if(!z.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(m1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await V0(W,U,$,X,B);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(m1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let R=0;for(let A of F){if(A.start>R){let N=W.slice(R,A.start);if(N.trim()){let T=await V0(N,U,$,X,B);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let w=await V0(A.content,U,$,X,B);J.enqueue(w),await new Promise((N)=>setTimeout(N,0)),R=A.end}if(R<W.length){let A=W.slice(R);if(A.trim()){let w=await V0(A,U,$,X,B);J.enqueue(w)}}}}else{let j=new Map;for(let L of z)if(L.type==="shell"||L.type==="content"){let F=await V0(L.content,U,$,X,B);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
10297
+ ${f4(`@method('${_}')`,Z)}`;return H}),X=X.replace(/@endform/g,"</form>"),X=X.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(Q,J,G,K,q,W="")=>{let z=J||G||"",U=K||q||"",B=L1(W),_=$$(z,Z),j=_!==void 0&&_!==null?_:U||"",H=B.match(/type=['"]([^'"]+)['"]/i),L=H?H[1]:"text",F=Z$(z,Z),O=B.match(/class=['"]([^'"]+)['"]/i),V=x4(O?O[1]:"",Y.input,F,Y.inputError),R=B.replace(/class=['"][^'"]+['"]/i,"");return R=R.replace(/type=['"][^'"]+['"]/i,""),`<input type="${R0(L)}" name="${R0(z)}" value="${R0(j)}" class="${V}"${R?` ${R}`:""}>`}),X=X.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(Q,J,G="",K="")=>{let q=L1(G),W=$$(J,Z)||K.trim(),z=Z$(J,Z),U=q.match(/class=['"]([^'"]+)['"]/i),B=x4(U?U[1]:"",Y.input,z,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${R0(J)}" class="${B}"${_?` ${_}`:""}>${R0(W)}</textarea>`}),X=X.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(Q,J,G="",K)=>{let q=L1(G),W=$$(J,Z),z=Z$(J,Z),U=q.match(/class=['"]([^'"]+)['"]/i),B=x4(U?U[1]:"",Y.input,z,Y.inputError),_=q.replace(/class=['"][^'"]+['"]/i,""),j=K;if(W!==void 0)j=K.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(H,L,F)=>{if((Array.isArray(W)?W.some((V)=>String(V)===F):String(W)===F)&&!L.includes("selected"))return L.replace(/(<option)/,"$1 selected");return H});return`<select name="${R0(J)}" class="${B}"${_?` ${_}`:""}>${j}</select>`}),X=X.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="1",K="")=>{let q=L1(K),W=$$(J,Z),z=W!==void 0&&(Array.isArray(W)?W.some((j)=>String(j)===G):W===!0||String(W)===G),U=q.match(/class=['"]([^'"]+)['"]/i),B=U?U[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${R0(J)}" value="${R0(G)}" class="${B}"${z?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G,K="")=>{let q=L1(K),W=$$(J,Z),z=W!==void 0&&W===G,U=q.match(/class=['"]([^'"]+)['"]/i),B=U?U[1]:Y.checkInput,_=q.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${R0(J)}" value="${R0(G)}" class="${B}"${z?" checked":""}${_?` ${_}`:""}>`}),X=X.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(Q,J,G="")=>{let K=L1(G),q=K.match(/accept=['"]([^'"]+)['"]/i),W=q?q[1]:"",z=K.includes("multiple"),U=Z$(J,Z),B=K.match(/class=['"]([^'"]+)['"]/i),_=x4(B?B[1]:"",Y.input,U,Y.inputError),j=K.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),H=[`<input type="file" name="${R0(J)}"`,`class="${_}"`];if(W)H.push(`accept="${R0(W)}"`);if(z)H.push("multiple");if(j)H.push(j);return`${H.join(" ")}>`}),X=X.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(Q,J,G="",K)=>{let q=L1(G),W=q.match(/class=['"]([^'"]+)['"]/i),z=W?W[1]:Y.label,U=q.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${R0(J)}" class="${z}"${U?` ${U}`:""}>${K}</label>`}),X}function KY($,Z,Y=QY){return $.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(X,Q,J)=>{try{if(Z$(Q,Z))return J.replace(/\{\{([^}]+)\}\}/g,(G,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return JY(Q,Z);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof Z.errors?.first==="function")return Z.errors.first(Q);return JY(Q,Z)}let q=K.trim();if(J0(q)){let W=Y0(q,Z);return W!==void 0?String(W):q}return q}catch{return K}});return""}catch(G){return console.error("Error processing @error directive:",G),X}})}function Z$($,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 JY($,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 $$($,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 L1($){if(!$.trim())return"";let Z=[],Y=$.trim(),X=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,Q;while((Q=X.exec(Y))!==null){let[,J,,G]=Q;Z.push(`${J}="${G.trim()}"`)}return Z.join(" ")}var QY;var qY=k(()=>{F0();QY={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import o3 from"path";async function yz(){if(Y$!==void 0)return Y$;try{Y$=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{Y$=null}return Y$}function Pz($,Z=0){if(Z<=0)return!1;return Date.now()-$.loadedAt>Z}async function Cz($,Z){if({...a3,...Z.i18n}.cache&&s3[$]){let Q=s3[$],J=Z.i18n?.cacheMaxAge??0;if(!Pz(Q,J))return Q.translations}if(X$[$]?.state==="loading")return X$[$].promise;i3[$]="loading";let X=r3($,Z).then((Q)=>{return i3[$]="loaded",delete X$[$],Q}).catch((Q)=>{throw i3[$]="error",X$[$]={promise:X,state:"error",error:Q instanceof Error?Q:Error(String(Q))},Q});return X$[$]={promise:X,state:"loading"},X}async function r3($,Z){let Y={...a3,...Z.i18n},X=o3.isAbsolute(Y.translationsDir)?Y.translationsDir:o3.resolve(Z.root||process.cwd(),Y.translationsDir);try{let Q=await yz(),J=Q?await Q($,{translationsDir:X,defaultLocale:Y.defaultLocale,sources:hz(Y.format)}):await vz($,Y,X);if(J===void 0){if($!==Y.defaultLocale)return r3(Y.defaultLocale,Z);return{}}let G=J;if(Y.cache)s3[$]={translations:G,loadedAt:Date.now(),locale:$};return G}catch(Q){if(Z.debug)console.error(`Error loading translation file for locale "${$}":`,Q);if($!==Y.defaultLocale)return r3(Y.defaultLocale,Z);return{}}}async function vz($,Z,Y){let X=o3.join(Y,`${$}${xz(Z.format)}`);try{let Q=await import(X);return Q.default||Q}catch(Q){try{let J=await Bun.file(X).text();if(Z.format==="yaml"||Z.format==="yml")return fz(J);if(Z.format==="json")return JSON.parse(J);throw Q}catch{return}}}function xz($){switch($){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function fz($){let Z={},Y=$.split(`
10298
+ `),X=[{obj:Z,indent:-1}];for(let Q of Y){let J=Q.replace(/#.*$/,"").trimEnd();if(!J.trim())continue;let G=J.search(/\S/);if(G===-1)continue;while(X.length>1&&X[X.length-1].indent>=G)X.pop();let K=X[X.length-1].obj,q=J.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(q){let[,,W,z]=q,U=W.trim(),B=z.trim();if(B==="")K[U]={},X.push({obj:K[U],indent:G});else K[U]=gz(B)}}return Z}function gz($){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 hz($){switch($){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function dz($,Z){return Cz($,Z)}function mz($,Z){for(let Y of $){let X=Y.trim(),Q=X.match(/^\{(\d+)\}\s*(.*)$/);if(Q){let G=Number.parseInt(Q[1],10);if(Z===G)return Q[2];continue}let J=X.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(J){let G=Number.parseInt(J[1],10),K=J[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(J[2],10);if(Z>=G&&Z<=K)return J[3];continue}}if($.length===2)return Z===1?$[0].trim():$[1].trim();if(Z<$.length)return $[Z].trim();return $[$.length-1].trim()}function uz($,Z={}){return UY($,Z)}function UY($,Z){let Y="",X=0;while(X<$.length)if($[X]==="{"){let Q=lz($,X);if(Q===-1){Y+=$[X],X++;continue}let J=$.slice(X+1,Q);Y+=pz(J,Z),X=Q+1}else if($[X]==="'"&&X+1<$.length)if($[X+1]==="'")Y+="'",X+=2;else if($[X+1]==="{"||$[X+1]==="}")Y+=$[X+1],X+=2;else Y+=$[X],X++;else Y+=$[X],X++;return Y}function lz($,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 pz($,Z){let Y=cz($);if(Y.length===0)return`{${$}}`;let X=Y[0].trim(),Q=Z[X];if(Y.length===1)return Q!==void 0?String(Q):`{${X}}`;switch(Y[1].trim().toLowerCase()){case"plural":return iz(Q,Y.slice(2).join(","),Z);case"select":return oz(Q,Y.slice(2).join(","));case"selectordinal":return sz(Q,Y.slice(2).join(","));case"number":return az(Q,Y[2]?.trim());case"date":return tz(Q,Y[2]?.trim());case"time":return ez(Q,Y[2]?.trim());default:return Q!==void 0?String(Q):`{${$}}`}}function cz($){let Z=[],Y="",X=0;for(let Q=0;Q<$.length;Q++){let J=$[Q];if(J==="{")X++,Y+=J;else if(J==="}")X--,Y+=J;else if(J===","&&X===0)Z.push(Y),Y="";else Y+=J}if(Y)Z.push(Y);return Z}function iz($,Z,Y){let X=Number($)||0,Q=t3(Z),J=`=${X}`;if(Q[J])return n3(Q[J],X,Y);let G=nz(X);if(Q[G])return n3(Q[G],X,Y);if(Q.other)return n3(Q.other,X,Y);return String(X)}function n3($,Z,Y){let X=$.replace(/#/g,String(Z));return UY(X,Y)}function nz($){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 oz($,Z){let Y=String($||""),X=t3(Z);if(X[Y])return X[Y];return X.other||String($)}function sz($,Z){let Y=Number($)||0,X=t3(Z),Q=rz(Y);if(X[Q])return X[Q].replace(/#/g,String(Y));if(X.other)return X.other.replace(/#/g,String(Y));return String(Y)}function rz($){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 t3($){let Z={},Y=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,X=Y.exec($);while(X!==null)Z[X[1]]=X[2],X=Y.exec($);return Z}function az($,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 tz($,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 ez($,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 $U($){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test($)}function WY($,Z,Y=!0,X={}){let Q=$.split("."),J=Z;for(let K of Q){if(J===void 0||J===null)break;J=J[K]}if(J===void 0||J===null)return Y?$:"";let G=String(J);if($U(G))return uz(G,X);if(G.includes("|")&&"count"in X){let K=Number(X.count),q=G.split("|");G=mz(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 BY($,Z,Y,X){let Q=$,J=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,G={...a3,...X.i18n},K=await dz(G.locale,X);Z.__translations=K,Z.__locale=G.locale,Z.__i18nConfig=G,Q=await zY(Q,J,async(z,U,B,_,j)=>{try{let H={};if(B)try{let F=[()=>JSON.parse(B),()=>{let O=`{"data":${B}}`,V=JSON.parse(O);return typeof V.data==="object"?V.data:{}},()=>{return L0(B,Z)}];for(let O of F)try{if(H=O(),Object.keys(H).length>0)break}catch{}}catch(F){if(X.debug)console.error("Error parsing parameters for @translate directive:",F)}return WY(U,K,G.fallbackToKey,H)||_.trim()}catch(H){if(X.debug)console.error("Error processing @translate directive:",H);return $0("Translate",`Error in @translate('${U}'): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR)}});let q=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(X.debug){console.warn(`Processing translations in template. Sections: ${Q.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let z=[...Q.matchAll(q)];console.warn(`Found ${z.length} @translate matches`),z.forEach((U,B)=>console.warn(`Match ${B}: ${U[0]}, Key: ${U[1]}, Params: ${U[2]||"none"}`))}return Q=await zY(Q,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(z,U,B,_)=>{try{let j={};if(B)try{let H=[()=>JSON.parse(B),()=>{let L=`{"data":${B}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return L0(B,Z)}];for(let L of H)try{if(j=L(),Object.keys(j).length>0)break}catch{}}catch(H){if(X.debug)console.error("Error parsing parameters for @translate directive:",H)}return WY(U,K,G.fallbackToKey,j)}catch(j){if(X.debug)console.error("Error processing @translate directive:",j);return $0("Translate",`Error in @translate('${U}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),Q}async function zY($,Z,Y){let X=[];return $.replace(Z,(J,...G)=>{let K=Y(J,...G).then((q)=>({match:J,replacement:q}));return X.push(K),J}),(await Promise.all(X)).reduce((J,{match:G,replacement:K})=>J.replace(G,K),$)}var Y$,a3,s3,X$,i3;var jY=k(()=>{J1();F0();a3={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},s3={},X$={},i3={}});var Z6={};r(Z6,{streamingSuspenseDirective:()=>OY,streamToResponse:()=>BU,streamTemplateSimple:()=>qU,streamTemplate:()=>YU,renderStreamingPage:()=>JU,registerStreamingDirectives:()=>zU,processStreamDirectives:()=>GU,processSectionDirectives:()=>UU,islandDirective:()=>LY,generateHydrationRuntime:()=>jU,extractStreamBoundaries:()=>KU,createStreamRenderer:()=>WU,buildSuspenseResolveScript:()=>$6,SUSPENSE_RESOLVER_RUNTIME:()=>HY});import g4 from"path";function ZU($){let Z=[],Y=0,X;_Y.lastIndex=0;while((X=_Y.exec($))!==null){if(X.index>Y){let G=$.slice(Y,X.index);if(G.trim())Z.push({type:Z.length===0?"shell":"content",content:G})}let Q=X[1],J=X[2];Z.push({type:"suspense",name:Q,content:J}),Y=X.index+X[0].length}if(Y<$.length){let Q=$.slice(Y);if(Q.trim())Z.push({type:Z.length===0?"shell":"content",content:Q})}if(Z.length===0)Z.push({type:"shell",content:$});return Z}async function YU($,Z={},Y={}){let X={...g1,...Y,streaming:{...e3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:g4.dirname($)};if(q.trim())await S1(q,z,$);let U=ZU(W),B=new Set;if(!U.some((j)=>j.type==="suspense")){let j=X.streaming?.strategy||"auto",H=new RegExp(m1.source,"g");if(!(j!=="manual"&&H.test(W))){let F=await V0(W,z,$,X,B);for(let O=0;O<F.length;O+=Q)J.enqueue(F.slice(O,O+Q)),await new Promise((V)=>setTimeout(V,0))}else{let F=[],O=new RegExp(m1.source,"g"),V;while((V=O.exec(W))!==null)F.push({name:V[1],content:V[2],start:V.index,end:V.index+V[0].length});let R=0;for(let A of F){if(A.start>R){let N=W.slice(R,A.start);if(N.trim()){let T=await V0(N,z,$,X,B);J.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let w=await V0(A.content,z,$,X,B);J.enqueue(w),await new Promise((N)=>setTimeout(N,0)),R=A.end}if(R<W.length){let A=W.slice(R);if(A.trim()){let w=await V0(A,z,$,X,B);J.enqueue(w)}}}}else{let j=new Map;for(let L of U)if(L.type==="shell"||L.type==="content"){let F=await V0(L.content,z,$,X,B);J.enqueue(F)}else if(L.type==="suspense"&&L.name){let F=`stx-suspense-${L.name}`;J.enqueue(`<div id="${F}" data-suspense="${L.name}" style="display:contents;">
10298
10299
  <template data-suspense-fallback>Loading...</template>
10299
- </div>`),j.set(L.name,V0(L.content,U,$,X,B))}J.enqueue(`
10300
+ </div>`),j.set(L.name,V0(L.content,z,$,X,B))}J.enqueue(`
10300
10301
  <script>
10301
10302
  (function() {
10302
10303
  window.__stxSuspense = window.__stxSuspense || {
@@ -10318,7 +10319,7 @@ window.__stxSuspense.resolve('${$}', \`${X}\`);
10318
10319
  </script>`}catch(Y){let X=Y instanceof Error?Y.message:String(Y);return`
10319
10320
  <script>
10320
10321
  window.__stxSuspense.resolve('${$}', '<div class="stx-error">Error loading content: ${i0(X)}</div>');
10321
- </script>`}}function Zz($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function Yz($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(jY),await Promise.all(Z.map(async(J)=>{let G=Zz(J.render(),X,J.id);Q.enqueue(await $6(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function Jz($,Z){return $.replace(Xz,(Y,X,Q)=>{let J=X.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[J]=K,`<div data-suspense="${J}">${q}</div>`})}function Qz($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,Q])=>({id:X,render:Q})):void 0}async function Gz($,Z={},Y={}){let X={...g1,...Y,streaming:{...e3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...Z,__filename:$,__dirname:g4.dirname($)};if(q.trim())await S1(q,U,$);let z=new Set,B=X.streaming?.strategy||"auto",_=new RegExp(m1.source,"g");if(!(B!=="manual"&&_.test(W))){let H=await V0(W,U,$,X,z);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(m1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=W.slice(O,V.start);if(A.trim()){let w=await V0(A,U,$,X,z);J.enqueue(w)}}let R=await V0(V.content,U,$,X,z);J.enqueue(R),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let R=await V0(V,U,$,X,z);J.enqueue(R)}}}J.close()}catch(G){J.error(G)}}})}async function Kz($,Z={}){let Y={...g1,...Z,streaming:{...e3,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;m1.lastIndex=0;while((W=m1.exec(G))!==null){let B=W[1],_=W[2];q[B]=_}let U=G.replace(m1,"");return{renderShell:async(B={})=>{let _={...B,__filename:$,__dirname:g4.dirname($)};return await S1(J,_,$),V0(U,_,$,Y,new Set)},renderSection:async(B,_={})=>{try{if(!q[B])return`<div class="error-message">Section "${i0(B)}" not found in template "${i0($)}"</div>`;let j={..._,__filename:$,__dirname:g4.dirname($)};await S1(J,j,$);let H=new Set;return await V0(q[B],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return W0("Expression",H,$,q[B]||"",0,q[B]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function qz($={}){let Z=[];if($.streaming?.enabled)Z.push(_Y);if($.hydration?.enabled)Z.push(HY);return Z}async function Wz($,Z,Y,X={}){return $}function Uz($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(J,G){G.enqueue(Y.encode(J))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:Q})}function zz($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
10322
+ </script>`}}function XU($,Z,Y){if(!Z||Z<=0)return $;let X,Q=new Promise((J,G)=>{X=setTimeout(()=>G(Error(`streaming boundary "${Y}" timed out after ${Z}ms`)),Z)});return Promise.race([$,Q]).finally(()=>clearTimeout(X))}function JU($,Z=[],Y={}){let X=Y.timeoutMs??0;return new ReadableStream({async start(Q){try{if(Q.enqueue($),Z.length>0)Q.enqueue(HY),await Promise.all(Z.map(async(J)=>{let G=XU(J.render(),X,J.id);Q.enqueue(await $6(J.id,G))}));Q.close()}catch(J){Q.error(J)}}})}function GU($,Z){return $.replace(QU,(Y,X,Q)=>{let J=X.trim(),G=Q.split(/@fallback/i),K=G[0].trim(),q=G.length>1?G.slice(1).join("@fallback").trim():"";if(!Z.__streamTemplates)Z.__streamTemplates={};return Z.__streamTemplates[J]=K,`<div data-suspense="${J}">${q}</div>`})}function KU($){let Z=$?.streamBoundaries;if(!Z||typeof Z!=="object")return;let Y=Object.entries(Z).filter(([,X])=>typeof X==="function");return Y.length>0?Y.map(([X,Q])=>({id:X,render:Q})):void 0}async function qU($,Z={},Y={}){let X={...g1,...Y,streaming:{...e3,...Y.streaming}},Q=X.streaming?.bufferSize||16384;return new ReadableStream({async start(J){try{let G=await Bun.file($).text(),K=G.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),q=K?K[1]:"",W=G.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),z={...Z,__filename:$,__dirname:g4.dirname($)};if(q.trim())await S1(q,z,$);let U=new Set,B=X.streaming?.strategy||"auto",_=new RegExp(m1.source,"g");if(!(B!=="manual"&&_.test(W))){let H=await V0(W,z,$,X,U);for(let L=0;L<H.length;L+=Q)J.enqueue(H.slice(L,L+Q))}else{let H=[],L=new RegExp(m1.source,"g"),F;while((F=L.exec(W))!==null)H.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let O=0;for(let V of H){if(V.start>O){let A=W.slice(O,V.start);if(A.trim()){let w=await V0(A,z,$,X,U);J.enqueue(w)}}let R=await V0(V.content,z,$,X,U);J.enqueue(R),O=V.end}if(O<W.length){let V=W.slice(O);if(V.trim()){let R=await V0(V,z,$,X,U);J.enqueue(R)}}}J.close()}catch(G){J.error(G)}}})}async function WU($,Z={}){let Y={...g1,...Z,streaming:{...e3,...Z.streaming}},X=await Bun.file($).text(),Q=X.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),J=Q?Q[1]:"",G=X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),K=G,q={},W;m1.lastIndex=0;while((W=m1.exec(G))!==null){let B=W[1],_=W[2];q[B]=_}let z=G.replace(m1,"");return{renderShell:async(B={})=>{let _={...B,__filename:$,__dirname:g4.dirname($)};return await S1(J,_,$),V0(z,_,$,Y,new Set)},renderSection:async(B,_={})=>{try{if(!q[B])return`<div class="error-message">Section "${i0(B)}" not found in template "${i0($)}"</div>`;let j={..._,__filename:$,__dirname:g4.dirname($)};await S1(J,j,$);let H=new Set;return await V0(q[B],j,$,Y,H)}catch(j){let H=j instanceof Error?j.message:String(j);return W0("Expression",H,$,q[B]||"",0,q[B]||"")}},getSections:()=>{return Object.keys(q)},getTemplate:()=>{return K}}}function zU($={}){let Z=[];if($.streaming?.enabled)Z.push(OY);if($.hydration?.enabled)Z.push(LY);return Z}async function UU($,Z,Y,X={}){return $}function BU($,Z={}){let Y=new TextEncoder,X=$.pipeThrough(new TransformStream({transform(J,G){G.enqueue(Y.encode(J))}})),Q=new Headers(Z.headers);if(!Q.has("Content-Type"))Q.set("Content-Type","text/html; charset=utf-8");if(!Q.has("Transfer-Encoding"))Q.set("Transfer-Encoding","chunked");if(!Q.has("X-Content-Type-Options"))Q.set("X-Content-Type-Options","nosniff");if(!Q.has("X-Accel-Buffering"))Q.set("X-Accel-Buffering","no");return new Response(X,{...Z,headers:Q})}function jU($={mode:"full"}){let{mode:Z,components:Y={},dynamicImports:X=!0}=$,Q=Object.entries(Y).map(([J,G])=>`'${J}': ${X?`() => import('${G}')`:`require('${G}')`}`).join(`,
10322
10323
  `);if(Z==="loader")return`
10323
10324
  (function() {
10324
10325
  window.__stx = window.__stx || {};
@@ -10460,7 +10461,7 @@ else {
10460
10461
  else {
10461
10462
  stx.hydrate();
10462
10463
  }
10463
- })();`}var e3,m1,BY,jY=`
10464
+ })();`}var e3,m1,_Y,HY=`
10464
10465
  <script>
10465
10466
  (function(){
10466
10467
  window.__stxSuspense = window.__stxSuspense || {
@@ -10480,25 +10481,25 @@ else {
10480
10481
  }
10481
10482
  };
10482
10483
  })();
10483
- </script>`,Xz,_Y,HY;var Y6=k(()=>{W5();a0();t$();O0();e3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},m1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,BY=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;Xz=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;_Y={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},HY={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),J=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
10484
+ </script>`,QU,OY,LY;var Y6=k(()=>{W5();a0();t$();O0();e3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},m1=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,_Y=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;QU=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;OY={name:"suspense",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Suspense directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,"");return`<!-- @suspense:${Q} -->${$}<!-- @endsuspense:${Q} -->`}},LY={name:"island",hasEndTag:!0,handler:($,Z,Y,X)=>{if(!Z||Z.length===0)throw Error("Island directive requires a name parameter");let Q=Z[0].replace(/['"`]/g,""),J=Z[1]?Z[1].replace(/['"`]/g,""):"lazy",G=`island-${Q}-${Math.random().toString(36).substring(2,9)}`,K=$.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),q=K?K[1].trim():"",W=K?$.replace(K[0],""):$;return`<div data-island="${Q}" data-island-id="${G}" data-priority="${J}">
10484
10485
  ${W}
10485
10486
  <script type="application/json" data-island-props="${G}">
10486
10487
  ${q?`{${q}}`:"{}"}
10487
10488
  </script>
10488
- </div>`}}});var FY={};r(FY,{warnUnbalancedTags:()=>X6,findUnbalancedTags:()=>LY});function U5($){return $.replace(/[^\n]/g," ")}function LY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,U5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,U5).replace(/<!--[\s\S]*?-->/g,U5).replace(/\{\{\{[\s\S]*?\}\}\}/g,U5).replace(/\{\{[\s\S]*?\}\}/g,U5).replace(/\{!![\s\S]*?!!\}/g,U5),Y=new Map,X=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,J;while((J=Q.exec(Z))!==null){let K=J[1]==="/",q=J[2],W=J[3]==="/";if(Bz.has(q.toLowerCase()))continue;if(W)continue;if(K)X.set(q,(X.get(q)??0)+1);else{let U=Y.get(q);if(U)U.count++;else{let z=Z.slice(0,J.index).split(`
10489
- `).length;Y.set(q,{count:1,firstLine:z})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(jz.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 X6($,Z){let Y;try{Y=LY($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(OY.has(X))return;OY.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var Bz,jz,OY;var J6=k(()=>{Bz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),jz=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);OY=new Set});import u0 from"path";import Q6 from"fs";function VY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function RY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class AY{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let _=[Q,Q.toLowerCase(),VY(Q),RY(Q)];for(let j of _)if(J.has(j))return J.get(j)}let G=[...new Set([`${Q}.stx`,`${VY(Q)}.stx`,`${RY(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=u0.resolve(u0.dirname(Z),`${Q}.stx`);if(await n(_))return _;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(u0.join(u0.dirname(W),"components"));if(q)K.push(q);let U=u0.join(u0.dirname(Z),"components");if(!K.includes(U))K.push(U);let z=process.cwd(),B=[u0.resolve(z,"src/components"),u0.resolve(z,"components"),u0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=u0.join(_,j);if(await n(H))return H}try{if(!Q6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=Q6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=u0.join(_,L.name);for(let O of G){let V=u0.join(F,O);if(await n(V))return V}}}catch{}}return null}}var S0;var G6=k(()=>{O0();S0=new AY});function E0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function z5($,Z){let Y=[];for(let[X,Q]of Object.entries($.static)){if(Z.has(X))continue;let J=$.staticNames?.[X]??X;if(typeof Q==="boolean"){if(Q)Y.push(E0(J));continue}Y.push(`${E0(J)}="${E0(Q)}"`)}return Y}var h4=()=>{};function J$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function _z($){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 K6;var q6=k(()=>{h4();K6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=_z($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),J=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${J$(X.value)}"`);else q.push(`href="${J$(X.value)}"`);if(Q)q.push(`class="${J$(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${J$(J)}"`),q.push(`data-stx-exact-active-class="${J$(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...z5($,W)),`<a ${q.join(" ")}>${Z}</a>`}}});function N0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function k0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function U6($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function wY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=Hz[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function z6($,Z,Y,X){return Z.map((Q)=>`${Q$($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function Oz($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${Q$($,G,void 0,X,Q)} ${J}x`}).join(", ")}function Q$($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function Lz($,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 Hz,W6,B6;var j6=k(()=>{h4();Hz={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},W6=[320,640,768,1024,1280,1536,1920];B6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=k0($,"src")||"",Q=k0($,"alt")||"",J=k0($,"width"),G=k0($,"height"),K=k0($,"sizes"),q=k0($,"srcset"),W=k0($,"densities"),U=k0($,"format"),z=k0($,"placeholder"),B=k0($,"placeholderColor")||"#e5e7eb",_=k0($,"provider"),j=k0($,"class")||k0($,"className")||"",H=k0($,"style")||"",L=k0($,"quality"),F=U6($,"lazy",!0),O=U6($,"preload",!1),V=U6($,"picture",!1)||!!U,R=J?Number.parseInt(J):void 0,A=G?Number.parseInt(G):void 0,w=q||"",N="";if(!w&&K)w=z6(X,W6,_,U),N=wY(K);else if(!w&&W){let S=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));w=Oz(X,S,R,_,U)}else if(K)N=wY(K);let T=[];if(H)T.push(H);if(R&&A)T.push(`aspect-ratio:${R}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let S=Lz(R||16,A||9,B);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${N0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=Q$(X,R,A,_,U),I=[];if(I.push(`src="${N0(M)}"`),I.push(`alt="${N0(Q)}"`),J)I.push(`width="${N0(J)}"`);if(G)I.push(`height="${N0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${N0(j)}"`);if(T.length>0)I.push(`style="${N0(T.join(";"))}"`);if(w)I.push(`srcset="${N0(w)}"`);if(N)I.push(`sizes="${N0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...z5($,E));let D=`<img ${I.join(" ")} />`,P="";if(O){let b=U==="webp"?"image/webp":U==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${N0(M)}"${b?` type="${b}"`:""}${w?` imagesrcset="${N0(w)}"`:""}${N?` imagesizes="${N0(N)}"`:""} />
10490
- `}if(V){let S=[];if(U==="avif"||U==="auto"){let b=Q$(X,R,A,_,"avif"),C=w?z6(X,W6,_,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${N0(C)}"${N?` sizes="${N0(N)}"`:""} />`)}if(U==="webp"||U==="auto"){let b=Q$(X,R,A,_,"webp"),C=w?z6(X,W6,_,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${N0(C)}"${N?` sizes="${N0(N)}"`:""} />`)}return`${P}<picture>
10489
+ </div>`}}});var RY={};r(RY,{warnUnbalancedTags:()=>X6,findUnbalancedTags:()=>VY});function z5($){return $.replace(/[^\n]/g," ")}function VY($){let Z=$.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,z5).replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,z5).replace(/<!--[\s\S]*?-->/g,z5).replace(/\{\{\{[\s\S]*?\}\}\}/g,z5).replace(/\{\{[\s\S]*?\}\}/g,z5).replace(/\{!![\s\S]*?!!\}/g,z5),Y=new Map,X=new Map,Q=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,J;while((J=Q.exec(Z))!==null){let K=J[1]==="/",q=J[2],W=J[3]==="/";if(_U.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,J.index).split(`
10490
+ `).length;Y.set(q,{count:1,firstLine:U})}}}let G=[];for(let K of new Set([...Y.keys(),...X.keys()])){if(HU.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 X6($,Z){let Y;try{Y=VY($)}catch{return}if(Y.length===0)return;let X=`${Z}:${$.length}`;if(FY.has(X))return;FY.add(X);let Q=Z?Z.split(/[/\\]/).pop()||Z:"template";for(let{tag:J,opened:G,closed:K,firstOpenLine:q}of Y)if(G>K){let W=q?` (first opened at line ${q})`:"";console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 an unclosed <${J}>${W} may swallow the content that follows it.`)}else console.warn(`[stx] ${Q}: <${J}> ${G} opened, ${K} closed \u2014 ${K-G} stray </${J}>.`)}var _U,HU,FY;var J6=k(()=>{_U=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),HU=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);FY=new Set});import u0 from"path";import Q6 from"fs";function AY($){return $.split("-").map((Z)=>Z.charAt(0).toUpperCase()+Z.slice(1)).join("")}function wY($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class NY{builtins=new Map;registerBuiltin($){this.builtins.set($.name.toLowerCase(),$);for(let Z of $.aliases)this.builtins.set(Z.toLowerCase(),$)}isBuiltin($){return this.builtins.has($.toLowerCase())}getBuiltin($){return this.builtins.get($.toLowerCase())??null}async resolveFile($,Z,Y,X){let Q=$.endsWith(".stx")?$.slice(0,-4):$,J=X?.__importedComponents;if(J){let _=[Q,Q.toLowerCase(),AY(Q),wY(Q)];for(let j of _)if(J.has(j))return J.get(j)}let G=[...new Set([`${Q}.stx`,`${AY(Q)}.stx`,`${wY(Q)}.stx`])];if(Q.startsWith("./")||Q.startsWith("../")){let _=u0.resolve(u0.dirname(Z),`${Q}.stx`);if(await n(_))return _;return null}let K=[],q=Y.componentsDir||"",W=X?.__originalFilePath;if(W)K.push(u0.join(u0.dirname(W),"components"));if(q)K.push(q);let z=u0.join(u0.dirname(Z),"components");if(!K.includes(z))K.push(z);let U=process.cwd(),B=[u0.resolve(U,"src/components"),u0.resolve(U,"components"),u0.resolve(import.meta.dir,"components")];for(let _ of B)if(!K.includes(_))K.push(_);for(let _ of K){if(!_)continue;for(let j of G){let H=u0.join(_,j);if(await n(H))return H}try{if(!Q6.statSync(_,{throwIfNoEntry:!1})?.isDirectory())continue;let H=Q6.readdirSync(_,{withFileTypes:!0});for(let L of H)if(L.isDirectory()){let F=u0.join(_,L.name);for(let O of G){let V=u0.join(F,O);if(await n(V))return V}}}catch{}}return null}}var y0;var G6=k(()=>{O0();y0=new NY});function E0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function U5($,Z){let Y=[];for(let[X,Q]of Object.entries($.static)){if(Z.has(X))continue;let J=$.staticNames?.[X]??X;if(typeof Q==="boolean"){if(Q)Y.push(E0(J));continue}Y.push(`${E0(J)}="${E0(Q)}"`)}return Y}var h4=()=>{};function J$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function OU($){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 K6;var q6=k(()=>{h4();K6={name:"StxLink",aliases:["stx-link"],render($,Z,Y){let X=OU($),Q=(typeof $.static.class==="string"?$.static.class:"")||(typeof $.static.className==="string"?$.static.className:""),J=typeof $.static.activeClass==="string"?$.static.activeClass:"active",G=typeof $.static.exactActiveClass==="string"?$.static.exactActiveClass:"exact-active",K=$.static.prefetch===!0||$.static.prefetch==="true"||$.serverDynamic.prefetch===!0,q=[];if(X.reactive)q.push(`:href="${J$(X.value)}"`);else q.push(`href="${J$(X.value)}"`);if(Q)q.push(`class="${J$(Q)}"`);if(q.push("data-stx-link"),q.push(`data-stx-active-class="${J$(J)}"`),q.push(`data-stx-exact-active-class="${J$(G)}"`),K)q.push("data-stx-prefetch");let W=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return q.push(...U5($,W)),`<a ${q.join(" ")}>${Z}</a>`}}});function N0($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function k0($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function z6($,Z,Y=!1){let X=$.serverDynamic[Z];if(X!==void 0)return X!==!1&&X!=="false";let Q=$.static[Z];if(Q!==void 0)return Q!=="false"&&Q!==!1;return Y}function TY($){if($.includes("(")||$.includes(","))return $;let Z=$.trim().split(/\s+/),Y=[];for(let X of Z)if(X.includes(":")){let[Q,J]=X.split(":"),G=LU[Q];if(G)Y.push(`(max-width: ${G}px) ${J}`);else{let K=Number.parseInt(Q);if(!Number.isNaN(K))Y.push(`(max-width: ${K}px) ${J}`)}}else Y.push(X);return Y.join(", ")}function U6($,Z,Y,X){return Z.map((Q)=>`${Q$($,Q,void 0,Y,X)} ${Q}w`).join(", ")}function FU($,Z,Y,X,Q){return Z.map((J)=>{let G=Y?Y*J:void 0;return`${Q$($,G,void 0,X,Q)} ${J}x`}).join(", ")}function Q$($,Z,Y,X,Q){if(!X||X==="local"||X==="static")return $;if(X==="cloudinary"){let J=[];if(Z)J.push(`w_${Z}`);if(Y)J.push(`h_${Y}`);if(Q)J.push(`f_${Q}`);J.push("q_auto");let G=J.join(",");return $.replace("/upload/",`/upload/${G}/`)}if(X==="imgix"){let J=new URLSearchParams;if(Z)J.set("w",String(Z));if(Y)J.set("h",String(Y));if(Q)J.set("fm",Q);J.set("auto","format");let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}if(X==="bunny"){let J=new URLSearchParams;if(Z)J.set("width",String(Z));if(Y)J.set("height",String(Y));if(Q)J.set("format",Q);let G=$.includes("?")?"&":"?";return`${$}${G}${J.toString()}`}return $}function VU($,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 LU,W6,B6;var j6=k(()=>{h4();LU={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},W6=[320,640,768,1024,1280,1536,1920];B6={name:"StxImage",aliases:["stx-image","stx-img"],render($,Z,Y){let X=k0($,"src")||"",Q=k0($,"alt")||"",J=k0($,"width"),G=k0($,"height"),K=k0($,"sizes"),q=k0($,"srcset"),W=k0($,"densities"),z=k0($,"format"),U=k0($,"placeholder"),B=k0($,"placeholderColor")||"#e5e7eb",_=k0($,"provider"),j=k0($,"class")||k0($,"className")||"",H=k0($,"style")||"",L=k0($,"quality"),F=z6($,"lazy",!0),O=z6($,"preload",!1),V=z6($,"picture",!1)||!!z,R=J?Number.parseInt(J):void 0,A=G?Number.parseInt(G):void 0,w=q||"",N="";if(!w&&K)w=U6(X,W6,_,z),N=TY(K);else if(!w&&W){let S=W.split(/\s+/).map((b)=>Number.parseFloat(b.replace("x","")));w=FU(X,S,R,_,z)}else if(K)N=TY(K);let T=[];if(H)T.push(H);if(R&&A)T.push(`aspect-ratio:${R}/${A}`);if(U==="blur"||U==="color"||U==="thumbhash"){let S=VU(R||16,A||9,B);T.push(`background-image:url(${S})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(U&&U!=="empty"&&U!=="none")T.push(`background-image:url(${N0(U)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=Q$(X,R,A,_,z),I=[];if(I.push(`src="${N0(M)}"`),I.push(`alt="${N0(Q)}"`),J)I.push(`width="${N0(J)}"`);if(G)I.push(`height="${N0(G)}"`);if(F)I.push('loading="lazy"');if(I.push('decoding="async"'),j)I.push(`class="${N0(j)}"`);if(T.length>0)I.push(`style="${N0(T.join(";"))}"`);if(w)I.push(`srcset="${N0(w)}"`);if(N)I.push(`sizes="${N0(N)}"`);let E=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);I.push(...U5($,E));let D=`<img ${I.join(" ")} />`,P="";if(O){let b=z==="webp"?"image/webp":z==="avif"?"image/avif":"";P=`<link rel="preload" as="image" href="${N0(M)}"${b?` type="${b}"`:""}${w?` imagesrcset="${N0(w)}"`:""}${N?` imagesizes="${N0(N)}"`:""} />
10491
+ `}if(V){let S=[];if(z==="avif"||z==="auto"){let b=Q$(X,R,A,_,"avif"),C=w?U6(X,W6,_,"avif"):`${b}`;S.push(`<source type="image/avif" srcset="${N0(C)}"${N?` sizes="${N0(N)}"`:""} />`)}if(z==="webp"||z==="auto"){let b=Q$(X,R,A,_,"webp"),C=w?U6(X,W6,_,"webp"):`${b}`;S.push(`<source type="image/webp" srcset="${N0(C)}"${N?` sizes="${N0(N)}"`:""} />`)}return`${P}<picture>
10491
10492
  ${S.join(`
10492
10493
  `)}
10493
10494
  ${D}
10494
- </picture>`}return`${P}${D}`}}});function G$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function B5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var NY="/images/safe-image-default.svg",Fz,_6;var H6=k(()=>{h4();Fz=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${NY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,_6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=B5($,"src")||"",Q=B5($,"alt")||"",J=B5($,"fallback")||NY,G=B5($,"class")||B5($,"className")||"",K=B5($,"fallbackClassName")||"",q=[];if(q.push(`src="${G$(X)}"`),q.push(`alt="${G$(Q)}"`),G)q.push(`class="${G$(G)}"`);if(q.push(`data-fallback="${G$(J)}"`),K)q.push(`data-fallback-class="${G$(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...z5($,W));let U=`<img ${q.join(" ")} />`,z=Y.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${Fz}${U}`;return U}}});function O6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function K$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function d4($,Z,Y){let X=K$($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var L6;var F6=k(()=>{L6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=O6(K$($,"color")||"#6366f1"),Q=O6(K$($,"initialColor")||K$($,"initial-color")||""),J=O6(K$($,"height")||"3px"),G=d4($,"duration",2000),K=d4($,"throttle",200),q=d4($,"zIndex",999999)||d4($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
10495
+ </picture>`}return`${P}${D}`}}});function G$($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function B5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var MY="/images/safe-image-default.svg",RU,_6;var H6=k(()=>{h4();RU=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${MY}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,_6={name:"SafeImage",aliases:["safe-image","safe-img"],render($,Z,Y){let X=B5($,"src")||"",Q=B5($,"alt")||"",J=B5($,"fallback")||MY,G=B5($,"class")||B5($,"className")||"",K=B5($,"fallbackClassName")||"",q=[];if(q.push(`src="${G$(X)}"`),q.push(`alt="${G$(Q)}"`),G)q.push(`class="${G$(G)}"`);if(q.push(`data-fallback="${G$(J)}"`),K)q.push(`data-fallback-class="${G$(K)}"`);q.push('onerror="window.__stxSafeImageHandler(this)"');let W=new Set(["src","alt","fallback","class","className","fallbackClassName"]);q.push(...U5($,W));let z=`<img ${q.join(" ")} />`,U=Y.context;if(!U.__safeImageHandlerEmitted)return U.__safeImageHandlerEmitted=!0,`${RU}${z}`;return z}}});function O6($){return $.replace(/[;{}()]/g,"").replace(/url/gi,"")}function K$($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function d4($,Z,Y){let X=K$($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var L6;var F6=k(()=>{L6={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render($,Z,Y){let X=O6(K$($,"color")||"#6366f1"),Q=O6(K$($,"initialColor")||K$($,"initial-color")||""),J=O6(K$($,"height")||"3px"),G=d4($,"duration",2000),K=d4($,"throttle",200),q=d4($,"zIndex",999999)||d4($,"z-index",999999),W=Q?`linear-gradient(to right, ${Q}, ${X})`:X;return`
10495
10496
  <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${J};background:${W};z-index:${q};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
10496
10497
  <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>
10497
10498
  </div>
10498
10499
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
10499
10500
  <script>
10500
10501
  (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()})})();
10501
- </script>`}}});function MY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function Vz($,Z,Y){let X=MY($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var TY,V6;var R6=k(()=>{TY={"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%)"},V6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=E0(MY($,"position")||"top-right"),Q=Vz($,"max",5),J=TY[X]||TY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${J};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
10502
+ </script>`}}});function DY($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}function AU($,Z,Y){let X=DY($,Z);if(X!==void 0){let Q=Number.parseInt(X,10);if(!Number.isNaN(Q))return Q}return Y}var IY,V6;var R6=k(()=>{IY={"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%)"},V6={name:"StxToast",aliases:["stx-toast"],render($,Z,Y){let X=E0(DY($,"position")||"top-right"),Q=AU($,"max",5),J=IY[X]||IY["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${X}" data-stx-toast-max="${Q}" style="position:fixed;${J};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
10502
10503
  <style>
10503
10504
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
10504
10505
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -10506,7 +10507,7 @@ ${D}
10506
10507
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
10507
10508
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
10508
10509
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
10509
- </style>`}}});function m4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var IY,A6;var w6=k(()=>{IY={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)"},A6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=m4($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=E0(X),J=m4($,"size")||"md",G=m4($,"closeOnBackdrop")!=="false",K=m4($,"closeOnEscape")!=="false",q=IY[J]||IY.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" 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">
10510
+ </style>`}}});function m4($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var EY,A6;var w6=k(()=>{EY={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)"},A6={name:"StxModal",aliases:["stx-modal"],render($,Z,Y){let X=m4($,"id");if(!X)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let Q=E0(X),J=m4($,"size")||"md",G=m4($,"closeOnBackdrop")!=="false",K=m4($,"closeOnEscape")!=="false",q=EY[J]||EY.md;return`<div id="stx-modal-${Q}" class="stx-modal-backdrop" data-stx-modal="${Q}" 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">
10510
10511
  <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)">
10511
10512
  <div style="padding:1.5rem">${Z}</div>
10512
10513
  </div>
@@ -10515,8 +10516,8 @@ ${D}
10515
10516
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
10516
10517
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
10517
10518
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
10518
- </style>`}}});function j5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var DY,N6;var T6=k(()=>{DY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},N6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=j5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=E0(X),J=j5($,"side")||"right",G=j5($,"size")||"md",K=j5($,"closeOnBackdrop")!=="false",q=j5($,"closeOnEscape")!=="false",W=j5($,"overlay")!=="false",U=DY[G]||DY.md,z=J==="left",B=z?"left:0":"right:0",_=z?"translateX(-100%)":"translateX(100%)",j=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" 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">
10519
- <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${B};width:${U};max-width:100vw;transform:${_};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">
10519
+ </style>`}}});function j5($,Z){if($.serverDynamic[Z]!==void 0)return String($.serverDynamic[Z]);let Y=$.static[Z];if(typeof Y==="string")return Y;return}var kY,N6;var T6=k(()=>{kY={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},N6={name:"StxDrawer",aliases:["stx-drawer"],render($,Z,Y){let X=j5($,"id");if(!X)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let Q=E0(X),J=j5($,"side")||"right",G=j5($,"size")||"md",K=j5($,"closeOnBackdrop")!=="false",q=j5($,"closeOnEscape")!=="false",W=j5($,"overlay")!=="false",z=kY[G]||kY.md,U=J==="left",B=U?"left:0":"right:0",_=U?"translateX(-100%)":"translateX(100%)",j=U?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${Q}" class="stx-drawer-backdrop" data-stx-drawer="${Q}" 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">
10520
+ <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${B};width:${z};max-width:100vw;transform:${_};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">
10520
10521
  <div style="padding:1.5rem">${Z}</div>
10521
10522
  </div>
10522
10523
  </div>
@@ -10524,18 +10525,18 @@ ${D}
10524
10525
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
10525
10526
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
10526
10527
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
10527
- </style>`}}});import{existsSync as Rz,readFileSync as Az}from"fs";function wz($){if(EY.has($))return;EY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function Nz($){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(Rz(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return q0.resolve(Y)}catch{}return null}function Tz($){if(u4.has($))return u4.get($);let Z=Nz($);if(!Z)return wz($),null;try{let Y=JSON.parse(Az(Z,"utf8"));return u4.set($,Y.icons),Y.icons}catch{return null}}function _5($,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 u4,EY,M6;var I6=k(()=>{u4=new Map,EY=new Set;M6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=_5($,"name")??_5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=E0(_5($,"size")||"24"),K=E0(_5($,"color")||"currentColor"),q=E0(_5($,"class")||""),W=E0(_5($,"style")||""),U=u4.get(Q)??Tz(Q);if(!U)return`<!-- Icon: collection "${Q}" not loaded -->`;let z=U[J];if(!z)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=z.width||24,_=z.height||24,j=`0 0 ${B} ${_}`,H=z.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function kY($,...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 bY($,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 D6;var E6=k(()=>{D6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=bY(Z,"fallback"),Q=X.rest,J=bY(Q,"error"),G=J.rest,K=X.region??kY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??kY($,"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 l4($,...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 k6;var b6=k(()=>{k6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(l4($,"name")||"v").replace(/["'<>]/g,""),Q=(l4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=l4($,"class"),G=l4($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function SY(){S0.registerBuiltin(K6),S0.registerBuiltin(B6),S0.registerBuiltin(_6),S0.registerBuiltin(L6),S0.registerBuiltin(V6),S0.registerBuiltin(A6),S0.registerBuiltin(N6),S0.registerBuiltin(M6),S0.registerBuiltin(D6),S0.registerBuiltin(k6)}var yY=k(()=>{q6();j6();H6();F6();R6();w6();T6();I6();E6();b6();G6();q6();j6();H6();F6();R6();w6();T6();I6();E6();b6()});function p4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function PY($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,U=null,z=W,B=-1,_=!1;while(W<$.length){let H=$[W];if(U){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===U)U=null;W++;continue}if(H==='"'||H==="'"){U=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){B=W+2,_=!0;break}if(H===">"){B=W+1;break}W++}if(B===-1){Q=J+1;continue}let j=$.slice(z,_?B-2:B-1).trim();if(_)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:j,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let w=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(w!==-1&&w<N){let T=$[w+H.length];if(T===" "||T===">"||T==="/"||T===`
10528
- `||T==="\t")F++;O=w+H.length}else{if(F--,F===0){V=N;break}O=N+L.length}}if(V===-1){Q=B;continue}let R=$.slice(B,V),A=V+L.length;X.push({fullMatch:$.slice(J,A),tagName:q,attributes:j,content:R,startIndex:J,endIndex:A,isSelfClosing:!1}),Q=A}}return X}function CY($,Z){try{let Y=Buffer.from($,"base64").toString("utf8");return JSON.parse(Y)}catch{}try{let Y=$.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Y)}catch(Y){if(Z?.debug)console.error("Error decoding __stx_ prop:",Y);return $}}var vY=k(()=>{F0();O0();k1()});var uY={};r(uY,{processESImports:()=>dY,processComponents:()=>i4});import c4 from"fs";import x0 from"path";function Iz($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(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=J(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!Q.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 U=J(W.slice(6));X.serverDynamic[U]=CY(q,Y);continue}if(W.startsWith(":")){let U=J(W.slice(1)),z=q===S6?U:q;try{if(!J0(z)){if(Y.debug)console.error(`Unsafe expression in :${U} binding: ${z}`);X.clientReactive[U]=z;continue}let B=Object.keys(Z),j=Q0(z,B)(...Object.values(Z));if(j===void 0){let H=z.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!B.includes(O))){X.clientReactive[U]=z;continue}}X.serverDynamic[U]=j}catch{X.clientReactive[U]=z}continue}if(typeof q==="string"&&q.includes("{{")&&q.includes("}}")){let U=q.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(U)try{let z=U[1];if(J0(z)){let _=Q0(z,Object.keys(Z))(...Object.values(Z));G(W,_!=null?String(_):"")}else{if(Y.debug)console.error(`Unsafe expression in ${W}: ${z}`);G(W,q)}}catch(z){if(Y.debug)console.error(`Error evaluating expression for ${W}:`,z);G(W,q)}else{let z=q,B=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=B.exec(q))!==null)try{let j=_[1];if(!J0(j)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${j}`);continue}let L=Q0(j,Object.keys(Z))(...Object.values(Z));z=z.replace(_[0],String(L??""))}catch(j){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,j)}G(W,z)}continue}G(W,q===S6?"true":q)}return X}function Dz($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]=S6}return Z}function fY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ez($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(S0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function kz($){let Z=gY.get($);if(Z)return Z;let Y=new Map,X=[x0.join($,"src"),x0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=c4.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=x0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let U=q.name.slice(0,-4);if(!Y.has(U))Y.set(U,W);let z=U.toLowerCase();if(!Y.has(z))Y.set(z,W);let B=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return gY.set($,Y),Y}function bz($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=x0.join(Y,"node_modules",$);try{if(c4.statSync(X).isDirectory())return X}catch{}let Q=x0.dirname(Y);if(Q===Y)return null;Y=Q}}async function dY($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=x0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,U,z)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=z,j,H=[];while((j=B.exec(z))!==null){let[L,F,O,V]=j,R=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=x0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(c4.statSync(M).isFile())A=M}catch{try{if(c4.statSync(T).isDirectory())R=T}catch{}}}}else R=bz(V,G);if(!R&&!A)continue;let w=!1,N=(T,M)=>{J.set(T,M),J.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,M),Q.add(M)};if(O&&A)N(O,A),w=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),M=R?kz(R):null;for(let{source:I,local:E}of T){let D=null;if(A)D=A;else if(M)D=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)N(E,D),w=!0}}if(w)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${U}>${_}</script>`}),K}async function Sz($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,U]=q,z=U.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of z){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[x0.resolve(x0.dirname(Y),`${B}.stx`),x0.resolve(x0.dirname(Y),B),x0.resolve(X.componentsDir||"components",`${B}.stx`),x0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function yz($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let U=W.index,z=U+W[0].length-1,B=1,_=z+1;while(_<J.length&&B>0){if(J[_]==="(")B++;else if(J[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=J.substring(z+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),R=V.match(/^\s*,\s*/);if(R)O=V.slice(R[0].length).trim();let A={};if(O)try{A=L0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);J=J.replace(J.substring(U,H),`[Error parsing component props: ${D}]`);continue}let w="",N=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)w=M[1].trim(),N=H+M[0].length;let I=await C1(F,A,w,G,Z,Y,X,K,Q);J=J.substring(0,U)+I+J.substring(N),q.lastIndex=0}return J}async function Pz($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=U1(J);return J=q.output,J=await B(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await B(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await B(J,/[a-z][a-z0-9]*/,!1,Mz),J=x5(J,q.scripts),J;async function B(_,j,H,L){if(!_)return _;let F=_,O=PY(F,j,L);for(let V=O.length-1;V>=0;V--){let R=O[V],A=H?p4(R.tagName):R.tagName,w=Dz(R.attributes),N=Iz(w,Z,X),T=S0.getBuiltin(R.tagName),M=T?await a$(A,G,Z,Y,X):!1;if(T&&!M){let P={context:Z,filePath:Y,options:X,dependencies:Q},S=T.render(N,R.content,P);if(Object.keys(N.clientReactive).length>0)S=hY(S,N.clientReactive);if(Object.keys(N.events).length>0){let b=Object.entries(N.events).map(([C,h])=>`${C}="${fY(h)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,R.startIndex)+S+F.substring(R.endIndex);continue}if(!H&&R.tagName.includes("-")&&!await a$(A,G,Z,Y,X))continue;let I={};for(let[P,S]of Object.entries(N.static))I[P]=S;for(let[P,S]of Object.entries(N.serverDynamic))I[P]=S;let D=await C1(A,I,R.content,G,Z,Y,X,K,Q);if(Object.keys(N.clientReactive).length>0)D=hY(D,N.clientReactive);if(Object.keys(N.events).length>0){let P=mY(D);if(P){let S=Object.entries(N.events).map(([C,h])=>`${C}="${fY(h)}"`).join(" "),b=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,P.insertPos)+` data-stx-parent-events="${b}" ${S}`+D.substring(P.insertPos)}}F=F.substring(0,R.startIndex)+D+F.substring(R.endIndex)}return F}}function hY($,Z){let Y=mY($);if(!Y)return $;let X=new Set(["if","for","show"]),Q=Object.entries(Z).map(([K,q])=>`:${p4(K)}="${q.replace(/"/g,"&quot;")}"`).join(" "),J=Object.keys(Z).filter((K)=>!X.has(K)).map((K)=>p4(K)).join(" "),G=J?` data-stx-parent-bindings="${J}"`:"";return $.substring(0,Y.insertPos)+`${G} ${Q}`+$.substring(Y.insertPos)}function mY($){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),Q=X.match(/^\s+/);if(Q){Y+=Q[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let J=X.match(/^<(script|style)\b[^>]*>/i);if(J){let K=`</${J[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+J[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 i4($,Z,Y,X,Q){if(!xY)SY(),xY=!0;let J=await dY($,Z,Y,X,Q);J=await Sz(J,Z,Y,X,Q),J=await yz(J,Z,Y,X,Q);let G=[];for(let K=0;K<3;K++){let q=r0(J,v5,(U,z)=>`\x00STX_COMPONENT_COMMENT_${G.length+z}\x00`);G.push(...q.tokens);let W=J;if(J=await Pz(q.output,Z,Y,X,Q),J===W)break}if(G.length>0)J=J.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=Ez(J);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 J}var xY=!1,S6="\x00stx-boolean-attribute",Mz,gY;var y6=k(()=>{G6();yY();vY();k1();O0();F0();Mz=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);gY=new Map});var sY={};r(sY,{processLoops:()=>P6});function xz($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let U=X.substring(K+1,W),z=W+1,B=U.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=U.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=L0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;J.push({start:G,end:z,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function n4($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,U=null,z=!1;while(W<X.length&&q>0){let j=X[W];if(z){z=!1,W++;continue}if(j==="\\"&&U){z=!0,W++;continue}if(U){if(j===U)U=null;W++;continue}if(j==='"'||j==="'"||j==="`"){U=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let B=X.substring(K+1,W),_=Y(B);X=X.substring(0,G)+_+X.substring(W+1)}return X}function fz($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);N$(J);let W=Q0(J,G)(...K),U=JSON.stringify(W),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${Q}="${z}"`}catch(G){return X}}),Y}function gz($,Z){let Y=$;return Y=n4(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(J0(J)){let K=Q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(J,Z));return G?o4:""}catch{return""}}),Y=n4(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(J0(J)){let K=Q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(J,Z));return G?s4:""}catch{return""}}),Y}function hz($){let Z=$;return Z=Z.replace(/@break(?!\()/g,o4),Z=Z.replace(/@continue(?!\()/g,s4),Z}function lY($){let Z=$.includes(o4),Y=Z?$.substring(0,$.indexOf(o4)):$;return{hasBreak:Z,content:Y}}function pY($){let Z=$.includes(s4),Y=Z?$.substring(0,$.indexOf(s4)):$;return{hasContinue:Z,content:Y}}function iY($){let Z=$;return Z=n4(Z,"@break",(Y)=>{let X=Y.trim();if(!T$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=n4(Z,"@continue",(Y)=>{let X=Y.trim();if(!T$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function dz($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((U,z)=>U.pos-z.pos);let K=[],q=0;for(let U of X)q+=U.delta,K.push({pos:U.pos,depth:q});function W(U){let z=0,B=K.length-1,_=0;while(z<=B){let j=z+B>>1;if(K[j].pos<=U)_=K[j].depth,z=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let U=Y.index,z=Y.index+Y[0].length-1,B=1,_=z+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(z+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,R=1,A=V,w=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(R>0&&A<$.length){w.lastIndex=A,N.lastIndex=A;let S=w.exec($),b=N.exec($);if(!b)break;if(S&&S.index<b.index)R++,A=S.index+S[0].length;else{if(R--,R===0){T=b.index;break}A=b.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,E=-1,D=0,P=0;while(P<M.length){let S=M.indexOf("@",P);if(S===-1)break;let b=M.substring(S);if(/^@forelse\s*\(/.test(b))D++,P=S+1;else if(b.startsWith("@endforelse"))D--,P=S+11;else if(D===0&&b.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){E=S;break}P=S+1}else P=S+1}if(E===-1)continue;return{start:U,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,E),emptyContent:M.substring(E+6)}}return null}function cY($,Z){let Y=$;while(!0){let X=dz(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let U;if(J0(G))U=Q0(G,Object.keys(Z))(...Object.values(Z));else U=Y0(G,Z);let z;if(!Array.isArray(U)||U.length===0)z=W;else z=`@foreach (${G} as ${K})${q}@endforeach`;Y=Y.substring(0,Q)+z+Y.substring(J)}catch(U){let z=U instanceof Error?U.message:String(U),B=$0("Forelse",`Error in @forelse(${G} as ${K}): ${z}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function P6($,Z,Y,X){let Q=$;Q=cY(Q,Z);function J(q){let W=/@foreach\s*\(/g,U;while((U=W.exec(q))!==null){let z=U.index,B=U.index+U[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=z,V=L.substring(0,F),R=L.substring(F+4),A=H+1,w=1,N=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(w>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let I=T.exec(q),E=M.exec(q);if(!E)break;if(I&&I.index<E.index)w++,N=I.index+I[0].length;else{if(w--,w===0){let D=q.substring(A,E.index),P=E.index+11;return{start:O,end:P,arrayExpr:V,itemVar:R,content:D}}N=E.index+11}}}return null}function G(q,W){let U=q;while(!0){let z=J(U);if(!z)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=z;try{let F=j.trim(),O;if(J0(F))O=Q0(F,Object.keys(W))(...Object.values(W));else O=Y0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let E=$0("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);U=U.substring(0,B)+E+U.substring(_);continue}let R=X?.loops?.useAltLoopVariable??vz,A=H.trim(),w=null,N,T=!1;if(A.includes("=>")){let E=A.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])w=E[0],N=E[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],w=E[1],T=!0;else N=A}else N=A;let M="",I=O;for(let E=0;E<I.length;E++){let D=I[E],P={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...W,loop:P,$loop:P};if(N.startsWith("[")&&N.endsWith("]")){let x=N.slice(1,-1).split(",").map((u)=>u.trim());if(Array.isArray(D))x.forEach((u,t)=>{if(u)S[u]=D[t]});else S[N]=D}else S[N]=D;if(w)if(!T&&V&&Array.isArray(D)&&D.length===2)S[w]=D[0],S[N]=D[1];else S[w]=E;let b=gz(L,S),C=pY(b);if(C.hasContinue){M+=C.content;continue}let h=lY(b);if(h.hasBreak){M+=h.content;break}if(b=cY(b,S),b=G(b,S),b=d1(b,S,Y),b=hz(b),h=lY(b),h.hasBreak){M+=h.content;break}if(C=pY(b),C.hasContinue){M+=C.content;continue}b=z1(b,S,Y),b=fz(b,S),b=xz(b,S),M+=b}U=U.substring(0,B)+M+U.substring(_)}catch(F){let O=$0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);U=U.substring(0,B)+O+U.substring(_)}}return U}Q=G(Q,Z),Q=oY(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??Cz;return Q=lz(Q,Z,K),Q}function nY($){return T$($)}function oY($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=b0(Q,"(",")",q);if(W===-1)break;let U=Q.slice(q+1,W),z=W+1,B=P$(Q.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!nY(U)){let H=$0("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),J=!0;continue}try{let H=mz(U),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let w=uz({forExpr:U,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+w+Q.substring(j),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(w,N)=>{return`\${${N}}`});V=iY(V);let A=Function(...F,`
10528
+ </style>`}}});import{existsSync as wU,readFileSync as NU}from"fs";function TU($){if(bY.has($))return;bY.add($),console.warn(`[stx] icon collection "${$}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${$}\`.`)}function MU($){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(wU(Y))return Y;for(let Y of[`@iconify-json/${$}/icons.json`,`@iconify/json/json/${$}.json`])try{return q0.resolve(Y)}catch{}return null}function IU($){if(u4.has($))return u4.get($);let Z=MU($);if(!Z)return TU($),null;try{let Y=JSON.parse(NU(Z,"utf8"));return u4.set($,Y.icons),Y.icons}catch{return null}}function _5($,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 u4,bY,M6;var I6=k(()=>{u4=new Map,bY=new Set;M6={name:"Icon",aliases:["icon","stx-icon"],render($,Z,Y){let X=_5($,"name")??_5($,"icon");if(!X)return"<!-- Icon: missing name/icon prop -->";let Q="lucide",J=X;if(X.includes(":")){let O=X.split(":");Q=O[0],J=O[1]}let G=E0(_5($,"size")||"24"),K=E0(_5($,"color")||"currentColor"),q=E0(_5($,"class")||""),W=E0(_5($,"style")||""),z=u4.get(Q)??IU(Q);if(!z)return`<!-- Icon: collection "${Q}" not loaded -->`;let U=z[J];if(!U)return`<!-- Icon: "${J}" not found in ${Q} -->`;let B=U.width||24,_=U.height||24,j=`0 0 ${B} ${_}`,H=U.body;if(K!=="currentColor")H=H.replace(/currentColor/g,K);let L=q?` class="${q}"`:"",F=W?` style="${W}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${G}" height="${G}" viewBox="${j}" fill="none"${L}${F}>${H}</svg>`}}});function SY($,...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 yY($,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 D6;var E6=k(()=>{D6={name:"Suspense",aliases:["suspense"],render($,Z,Y){let X=yY(Z,"fallback"),Q=X.rest,J=yY(Q,"error"),G=J.rest,K=X.region??SY($,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',q=J.region??SY($,"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 l4($,...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 k6;var b6=k(()=>{k6={name:"TransitionGroup",aliases:["transition-group"],render($,Z,Y){let X=(l4($,"name")||"v").replace(/["'<>]/g,""),Q=(l4($,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",J=l4($,"class"),G=l4($,"id"),K=[`data-stx-transition-group="${X}"`,J?`class="${J}"`:"",G?`id="${G}"`:""].filter(Boolean).join(" ");return`<${Q} ${K}>${Z}</${Q}>`}}});function PY(){y0.registerBuiltin(K6),y0.registerBuiltin(B6),y0.registerBuiltin(_6),y0.registerBuiltin(L6),y0.registerBuiltin(V6),y0.registerBuiltin(A6),y0.registerBuiltin(N6),y0.registerBuiltin(M6),y0.registerBuiltin(D6),y0.registerBuiltin(k6)}var CY=k(()=>{q6();j6();H6();F6();R6();w6();T6();I6();E6();b6();G6();q6();j6();H6();F6();R6();w6();T6();I6();E6();b6()});function p4($){return $.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function vY($,Z,Y){let X=[],Q=0;while(Q<$.length){let J=$.indexOf("<",Q);if(J===-1)break;let K=$.slice(J+1).match(new RegExp(`^(${Z.source})`));if(!K){Q=J+1;continue}let q=K[1];if(Y&&Y.has(q.toLowerCase())){let H=J+1+q.length;while(H<$.length&&$[H]!==">")H++;Q=H+1;continue}let W=J+1+q.length,z=null,U=W,B=-1,_=!1;while(W<$.length){let H=$[W];if(z){if(H==="\\"&&W+1<$.length){W+=2;continue}if(H===z)z=null;W++;continue}if(H==='"'||H==="'"){z=H,W++;continue}if(H==="/"&&W+1<$.length&&$[W+1]===">"){B=W+2,_=!0;break}if(H===">"){B=W+1;break}W++}if(B===-1){Q=J+1;continue}let j=$.slice(U,_?B-2:B-1).trim();if(_)X.push({fullMatch:$.slice(J,B),tagName:q,attributes:j,content:"",startIndex:J,endIndex:B,isSelfClosing:!0}),Q=B;else{let H=`<${q}`,L=`</${q}>`,F=1,O=B,V=-1;while(F>0&&O<$.length){let w=$.indexOf(H,O),N=$.indexOf(L,O);if(N===-1)break;if(w!==-1&&w<N){let T=$[w+H.length];if(T===" "||T===">"||T==="/"||T===`
10529
+ `||T==="\t")F++;O=w+H.length}else{if(F--,F===0){V=N;break}O=N+L.length}}if(V===-1){Q=B;continue}let R=$.slice(B,V),A=V+L.length;X.push({fullMatch:$.slice(J,A),tagName:q,attributes:j,content:R,startIndex:J,endIndex:A,isSelfClosing:!1}),Q=A}}return X}function xY($,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 fY=k(()=>{F0();O0();k1()});var pY={};r(pY,{processESImports:()=>uY,processComponents:()=>i4});import c4 from"fs";import x0 from"path";function EU($,Z,Y){let X={static:{},staticNames:{},serverDynamic:{},clientReactive:{},events:{}},Q=new Set(["x-cloak","x-show","x-if","x-for","x-data","x-init","x-transition","x-ref","x-effect","x-model","x-text","x-html","x-class","x-style","x-on","x-bind"]),J=(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=J(K);if(X.static[W]=q,W!==K)X.staticNames[W]=K};for(let[K,q]of Object.entries($)){let W=K.startsWith("x-")&&!Q.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=J(W.slice(6));X.serverDynamic[z]=xY(q,Y);continue}if(W.startsWith(":")){let z=J(W.slice(1)),U=q===S6?z:q;try{if(!J0(U)){if(Y.debug)console.error(`Unsafe expression in :${z} binding: ${U}`);X.clientReactive[z]=U;continue}let B=Object.keys(Z),j=Q0(U,B)(...Object.values(Z));if(j===void 0){let H=U.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],L=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(H.some((O)=>!L.has(O)&&!B.includes(O))){X.clientReactive[z]=U;continue}}X.serverDynamic[z]=j}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(J0(U)){let _=Q0(U,Object.keys(Z))(...Object.values(Z));G(W,_!=null?String(_):"")}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,B=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=B.exec(q))!==null)try{let j=_[1];if(!J0(j)){if(Y.debug)console.error(`Unsafe expression in ${W}: ${j}`);continue}let L=Q0(j,Object.keys(Z))(...Object.values(Z));U=U.replace(_[0],String(L??""))}catch(j){if(Y.debug)console.error(`Error evaluating expression in ${W}:`,j)}G(W,U)}continue}G(W,q===S6?"true":q)}return X}function kU($){let Z={},Y=0,X=$.length;while(Y<X){while(Y<X&&/\s/.test($[Y]))Y++;if(Y>=X)break;let Q="";while(Y<X&&!/[\s=]/.test($[Y]))Q+=$[Y],Y++;if(!Q)break;while(Y<X&&/\s/.test($[Y]))Y++;if(Y<X&&$[Y]==="="){Y++;while(Y<X&&/\s/.test($[Y]))Y++;let J="";if(Y<X&&($[Y]==='"'||$[Y]==="'")){let G=$[Y];Y++;while(Y<X){let K=$[Y];if(K==="\\"&&Y+1<X){Y++,J+=$[Y],Y++;continue}if(K===G){Y++;break}J+=K,Y++}}else while(Y<X&&!/\s/.test($[Y]))J+=$[Y],Y++;Z[Q]=J}else Z[Q]=S6}return Z}function hY($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function bU($){let Z=new Set,Y=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,X;while((X=Y.exec($))!==null){let Q=X[1];if(y0.isBuiltin(Q))Z.add(Q)}return[...Z].sort()}function SU($){let Z=dY.get($);if(Z)return Z;let Y=new Map,X=[x0.join($,"src"),x0.join($,"dist"),$];function Q(J,G){if(G>6)return;let K;try{K=c4.readdirSync(J,{withFileTypes:!0})}catch{return}for(let q of K){let W=x0.join(J,q.name);if(q.isDirectory()){if(q.name==="node_modules"||q.name.startsWith("."))continue;Q(W,G+1)}else if(q.isFile()&&q.name.endsWith(".stx")){let 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 B=z.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Y.has(B))Y.set(B,W)}}}for(let J of X)if(Q(J,0),Y.size>0)break;return dY.set($,Y),Y}function yU($,Z){if($.startsWith(".")||$.startsWith("/"))return null;let Y=Z;while(!0){let X=x0.join(Y,"node_modules",$);try{if(c4.statSync(X).isDirectory())return X}catch{}let Q=x0.dirname(Y);if(Q===Y)return null;Y=Q}}async function uY($,Z,Y,X,Q){if(!$.includes("import"))return $;if(!Z.__importedComponents)Z.__importedComponents=new Map;let J=Z.__importedComponents,G=x0.dirname(Y),K=$,q=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return K=K.replace(q,(W,z,U)=>{let B=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,_=U,j,H=[];while((j=B.exec(U))!==null){let[L,F,O,V]=j,R=null,A=null;if(V.startsWith(".")||V.startsWith("/")){let T=x0.resolve(G,V);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if(c4.statSync(M).isFile())A=M}catch{try{if(c4.statSync(T).isDirectory())R=T}catch{}}}}else R=yU(V,G);if(!R&&!A)continue;let w=!1,N=(T,M)=>{J.set(T,M),J.set(T.toLowerCase(),M);let I=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();J.set(I,M),Q.add(M)};if(O&&A)N(O,A),w=!0;else if(F){let T=F.slice(1,-1).split(",").map((I)=>I.trim()).filter(Boolean).map((I)=>{let E=I.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(E)return{source:E[1],local:E[2]};return{source:I,local:I}}),M=R?SU(R):null;for(let{source:I,local:E}of T){let D=null;if(A)D=A;else if(M)D=M.get(I)??M.get(I.toLowerCase())??M.get(I.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(D)N(E,D),w=!0}}if(w)H.push({start:j.index,end:j.index+L.length})}if(H.length===0)return W;for(let L=H.length-1;L>=0;L--)_=_.slice(0,H[L].start)+_.slice(H[L].end);return`<script${z}>${_}</script>`}),K}async function PU($,Z,Y,X,Q){let J=$;if(!Z.__importedComponents)Z.__importedComponents=new Map;let G=Z.__importedComponents,K=/@import\s*\(\s*([^)]+)\s*\)/g,q;while((q=K.exec(J))!==null){let[W,z]=q,U=z.split(",").map((B)=>B.trim().replace(/^['"]|['"]$/g,"")).filter((B)=>B.length>0);for(let B of U){let _=B.split("/"),H=_[_.length-1].replace(/\.stx$/,""),L=H.includes("-")?H.split("-").map((V)=>V.charAt(0).toUpperCase()+V.slice(1)).join(""):H.charAt(0).toUpperCase()+H.slice(1),F=null,O=[x0.resolve(x0.dirname(Y),`${B}.stx`),x0.resolve(x0.dirname(Y),B),x0.resolve(X.componentsDir||"components",`${B}.stx`),x0.resolve(X.componentsDir||"components",B),B.endsWith(".stx")?B:`${B}.stx`];for(let V of O)try{if(await Bun.file(V).exists()){F=V;break}}catch{}if(F){G.set(L,F),G.set(H,F),G.set(H.toLowerCase(),F);let V=L.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(G.set(V,F),Q.add(F),X.debug)console.log(`Imported component: ${L} -> ${F}`)}else if(X.debug)console.warn(`Could not resolve imported component: ${B}`)}J=J.replace(W,""),K.lastIndex=0}return J}async function CU($,Z,Y,X,Q){let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=/@component\s*\(/g,W;while((W=q.exec(J))!==null){let z=W.index,U=z+W[0].length-1,B=1,_=U+1;while(_<J.length&&B>0){if(J[_]==="(")B++;else if(J[_]===")"){if(B--,B===0)break}_++}if(B!==0)break;let j=J.substring(U+1,_),H=_+1,L=j.match(/^\s*['"]([^'"]+)['"]/);if(!L){q.lastIndex=0;continue}let F=L[1],O,V=j.slice(L[0].length),R=V.match(/^\s*,\s*/);if(R)O=V.slice(R[0].length).trim();let A={};if(O)try{A=L0(O,Z)}catch(E){let D=E instanceof Error?E.message:String(E);J=J.replace(J.substring(z,H),`[Error parsing component props: ${D}]`);continue}let w="",N=H,M=J.substring(H).match(/^([\s\S]*?)@endcomponent/);if(M)w=M[1].trim(),N=H+M[0].length;let I=await C1(F,A,w,G,Z,Y,X,K,Q);J=J.substring(0,z)+I+J.substring(N),q.lastIndex=0}return J}async function vU($,Z,Y,X,Q){if(!$)return $;let J=$,G=X.componentsDir||"components";if(!Z.__processedComponents)Z.__processedComponents=new Set;let K=Z.__processedComponents,q=z1(J);return J=q.output,J=await B(J,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),J=await B(J,/[A-Z][a-zA-Z0-9]*/,!0),J=await B(J,/[a-z][a-z0-9]*/,!1,DU),J=x5(J,q.scripts),J;async function B(_,j,H,L){if(!_)return _;let F=_,O=vY(F,j,L);for(let V=O.length-1;V>=0;V--){let R=O[V],A=H?p4(R.tagName):R.tagName,w=kU(R.attributes),N=EU(w,Z,X),T=y0.getBuiltin(R.tagName),M=T?await a$(A,G,Z,Y,X):!1;if(T&&!M){let P={context:Z,filePath:Y,options:X,dependencies:Q},S=T.render(N,R.content,P);if(Object.keys(N.clientReactive).length>0)S=mY(S,N.clientReactive);if(Object.keys(N.events).length>0){let b=Object.entries(N.events).map(([C,h])=>`${C}="${hY(h)}"`).join(" ");S=S.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${b}`)}F=F.substring(0,R.startIndex)+S+F.substring(R.endIndex);continue}if(!H&&R.tagName.includes("-")&&!await a$(A,G,Z,Y,X))continue;let I={};for(let[P,S]of Object.entries(N.static))I[P]=S;for(let[P,S]of Object.entries(N.serverDynamic))I[P]=S;let D=await C1(A,I,R.content,G,Z,Y,X,K,Q);if(Object.keys(N.clientReactive).length>0)D=mY(D,N.clientReactive);if(Object.keys(N.events).length>0){let P=lY(D);if(P){let S=Object.entries(N.events).map(([C,h])=>`${C}="${hY(h)}"`).join(" "),b=Object.keys(N.events).map((C)=>C.replace(/^@/,"").split(".")[0]).join(" ");D=D.substring(0,P.insertPos)+` data-stx-parent-events="${b}" ${S}`+D.substring(P.insertPos)}}F=F.substring(0,R.startIndex)+D+F.substring(R.endIndex)}return F}}function mY($,Z){let Y=lY($);if(!Y)return $;let X=new Set(["if","for","show"]),Q=Object.entries(Z).map(([K,q])=>`:${p4(K)}="${q.replace(/"/g,"&quot;")}"`).join(" "),J=Object.keys(Z).filter((K)=>!X.has(K)).map((K)=>p4(K)).join(" "),G=J?` data-stx-parent-bindings="${J}"`:"";return $.substring(0,Y.insertPos)+`${G} ${Q}`+$.substring(Y.insertPos)}function lY($){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),Q=X.match(/^\s+/);if(Q){Y+=Q[0].length;continue}if(X.startsWith("<!--")){let K=$.indexOf("-->",Y+4);if(K===-1)return null;Y=K+3;continue}let J=X.match(/^<(script|style)\b[^>]*>/i);if(J){let K=`</${J[1].toLowerCase()}>`,q=$.toLowerCase().indexOf(K,Y+J[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 i4($,Z,Y,X,Q){if(!gY)PY(),gY=!0;let J=await uY($,Z,Y,X,Q);J=await PU(J,Z,Y,X,Q),J=await CU(J,Z,Y,X,Q);let G=[];for(let K=0;K<3;K++){let q=r0(J,v5,(z,U)=>`\x00STX_COMPONENT_COMMENT_${G.length+U}\x00`);G.push(...q.tokens);let W=J;if(J=await vU(q.output,Z,Y,X,Q),J===W)break}if(G.length>0)J=J.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(K,q)=>G[Number(q)]??"");if(X.debug){let K=bU(J);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 J}var gY=!1,S6="\x00stx-boolean-attribute",DU,dY;var y6=k(()=>{G6();CY();fY();k1();O0();F0();DU=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);dY=new Map});var aY={};r(aY,{processLoops:()=>P6});function gU($,Z){let Y=/@component\s*\(/g,X=$,Q,J=[];while((Q=Y.exec(X))!==null){let G=Q.index,K=G+Q[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")"){if(q--,q===0)break}W++}if(q!==0)continue;let z=X.substring(K+1,W),U=W+1,B=z.match(/^\s*['"]([^'"]+)['"]/);if(!B)continue;let _=B[1],j=z.slice(B[0].length),H=j.match(/^\s*,\s*/);if(!H)continue;let L=j.slice(H[0].length).trim();if(!L)continue;try{let F=L0(L,Z),O=JSON.stringify(F),V=`@component('${_}', ${O})`;J.push({start:G,end:U,replacement:V})}catch{continue}}for(let G=J.length-1;G>=0;G--){let{start:K,end:q,replacement:W}=J[G];X=X.substring(0,K)+W+X.substring(q)}return X}function n4($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),J;while((J=Q.exec(X))!==null){let G=J.index,K=G+J[0].length-1,q=1,W=K+1,z=null,U=!1;while(W<X.length&&q>0){let j=X[W];if(U){U=!1,W++;continue}if(j==="\\"&&z){U=!0,W++;continue}if(z){if(j===z)z=null;W++;continue}if(j==='"'||j==="'"||j==="`"){z=j,W++;continue}if(j==="(")q++;else if(j===")"){if(q--,q===0)break}W++}if(q!==0)break;let B=X.substring(K+1,W),_=Y(B);X=X.substring(0,G)+_+X.substring(W+1)}return X}function hU($,Z){let Y=$;return Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(X,Q)=>{if(Q in Z)return`:${Q}="${Q}"`;return X}),Y=Y.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(X,Q,J)=>{try{let G=Object.keys(Z),K=Object.values(Z);N$(J);let W=Q0(J,G)(...K),z=JSON.stringify(W),U=Buffer.from(z,"utf8").toString("base64");return`__stx_${Q}="${U}"`}catch(G){return X}}),Y}function dU($,Z){let Y=$;return Y=n4(Y,"@break",(X)=>{try{let J=`!!(${X.trim()})`,G;if(J0(J)){let K=Q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(J,Z));return G?o4:""}catch{return""}}),Y=n4(Y,"@continue",(X)=>{try{let J=`!!(${X.trim()})`,G;if(J0(J)){let K=Q0(J,Object.keys(Z));G=Boolean(K(...Object.values(Z)))}else G=Boolean(Y0(J,Z));return G?s4:""}catch{return""}}),Y}function mU($){let Z=$;return Z=Z.replace(/@break(?!\()/g,o4),Z=Z.replace(/@continue(?!\()/g,s4),Z}function cY($){let Z=$.includes(o4),Y=Z?$.substring(0,$.indexOf(o4)):$;return{hasBreak:Z,content:Y}}function iY($){let Z=$.includes(s4),Y=Z?$.substring(0,$.indexOf(s4)):$;return{hasContinue:Z,content:Y}}function oY($){let Z=$;return Z=n4(Z,"@break",(Y)=>{let X=Y.trim();if(!T$(X))return"";return`\`; if (${X}) { break; } result += \``}),Z=n4(Z,"@continue",(Y)=>{let X=Y.trim();if(!T$(X))return"";return`\`; if (${X}) { continue; } result += \``}),Z=Z.replace(/@break(?!\()/g,"`; break; result += `"),Z=Z.replace(/@continue(?!\()/g,"`; continue; result += `"),Z}function uU($){let Z=/@forelse\s*\(/g,Y,X=[],Q=/@foreach\s*\(/g,J=/@endforeach/g,G;while((G=Q.exec($))!==null)X.push({pos:G.index,delta:1});while((G=J.exec($))!==null)X.push({pos:G.index,delta:-1});X.sort((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,B=K.length-1,_=0;while(U<=B){let j=U+B>>1;if(K[j].pos<=z)_=K[j].depth,U=j+1;else B=j-1}return _}while((Y=Z.exec($))!==null){if(W(Y.index)>0)continue;let z=Y.index,U=Y.index+Y[0].length-1,B=1,_=U+1,j=-1;while(_<$.length&&B>0){if($[_]==="(")B++;else if($[_]===")"){if(B--,B===0){j=_;break}}_++}if(j===-1)continue;let H=$.substring(U+1,j),L=H.indexOf(" as ");if(L===-1)continue;let F=H.substring(0,L).trim(),O=H.substring(L+4).trim(),V=j+1,R=1,A=V,w=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(R>0&&A<$.length){w.lastIndex=A,N.lastIndex=A;let S=w.exec($),b=N.exec($);if(!b)break;if(S&&S.index<b.index)R++,A=S.index+S[0].length;else{if(R--,R===0){T=b.index;break}A=b.index+11}}if(T===-1)continue;let M=$.substring(V,T),I=T+11,E=-1,D=0,P=0;while(P<M.length){let S=M.indexOf("@",P);if(S===-1)break;let b=M.substring(S);if(/^@forelse\s*\(/.test(b))D++,P=S+1;else if(b.startsWith("@endforelse"))D--,P=S+11;else if(D===0&&b.startsWith("@empty")){if(M.length<=S+6||!/[a-z]/i.test(M[S+6])){E=S;break}P=S+1}else P=S+1}if(E===-1)continue;return{start:z,end:I,arrayExpr:F,itemVar:O,foreachContent:M.substring(0,E),emptyContent:M.substring(E+6)}}return null}function nY($,Z){let Y=$;while(!0){let X=uU(Y);if(!X)break;let{start:Q,end:J,arrayExpr:G,itemVar:K,foreachContent:q,emptyContent:W}=X;try{let z;if(J0(G))z=Q0(G,Object.keys(Z))(...Object.values(Z));else z=Y0(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,Q)+U+Y.substring(J)}catch(z){let U=z instanceof Error?z.message:String(z),B=$0("Forelse",`Error in @forelse(${G} as ${K}): ${U}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+B+Y.substring(J)}}return Y}function P6($,Z,Y,X){let Q=$;Q=nY(Q,Z);function J(q){let W=/@foreach\s*\(/g,z;while((z=W.exec(q))!==null){let U=z.index,B=z.index+z[0].length-1,_=1,j=B+1,H=-1;while(j<q.length&&_>0){if(q[j]==="(")_++;else if(q[j]===")"){if(_--,_===0){H=j;break}}j++}if(H===-1)continue;let L=q.substring(B+1,H),F=L.indexOf(" as ");if(F===-1)continue;let O=U,V=L.substring(0,F),R=L.substring(F+4),A=H+1,w=1,N=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(w>0&&N<q.length){T.lastIndex=N,M.lastIndex=N;let I=T.exec(q),E=M.exec(q);if(!E)break;if(I&&I.index<E.index)w++,N=I.index+I[0].length;else{if(w--,w===0){let D=q.substring(A,E.index),P=E.index+11;return{start:O,end:P,arrayExpr:V,itemVar:R,content:D}}N=E.index+11}}}return null}function G(q,W){let z=q;while(!0){let U=J(z);if(!U)break;let{start:B,end:_,arrayExpr:j,itemVar:H,content:L}=U;try{let F=j.trim(),O;if(J0(F))O=Q0(F,Object.keys(W))(...Object.values(W));else O=Y0(F,W);let V=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),V=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),V=!0;else{let E=$0("Foreach",`Error in @foreach: ${F} is not iterable`,o.TYPE_ERROR);z=z.substring(0,B)+E+z.substring(_);continue}let R=X?.loops?.useAltLoopVariable??fU,A=H.trim(),w=null,N,T=!1;if(A.includes("=>")){let E=A.split("=>").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])w=E[0],N=E[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let E=A.split(",").map((D)=>D.trim());if(E.length===2&&E[0]&&E[1])N=E[0],w=E[1],T=!0;else N=A}else N=A;let M="",I=O;for(let E=0;E<I.length;E++){let D=I[E],P={index:E,iteration:E+1,first:E===0,last:E===I.length-1,count:I.length},S={...W,loop:P,$loop:P};if(N.startsWith("[")&&N.endsWith("]")){let x=N.slice(1,-1).split(",").map((u)=>u.trim());if(Array.isArray(D))x.forEach((u,t)=>{if(u)S[u]=D[t]});else S[N]=D}else S[N]=D;if(w)if(!T&&V&&Array.isArray(D)&&D.length===2)S[w]=D[0],S[N]=D[1];else S[w]=E;let b=dU(L,S),C=iY(b);if(C.hasContinue){M+=C.content;continue}let h=cY(b);if(h.hasBreak){M+=h.content;break}if(b=nY(b,S),b=G(b,S),b=d1(b,S,Y),b=mU(b),h=cY(b),h.hasBreak){M+=h.content;break}if(C=iY(b),C.hasContinue){M+=C.content;continue}b=U1(b,S,Y),b=hU(b,S),b=gU(b,S),M+=b}z=z.substring(0,B)+M+z.substring(_)}catch(F){let O=$0("Foreach",`Error in @foreach(${j.trim()} as ${H.trim()}): ${F instanceof Error?F.message:String(F)}`,o.EVALUATION_ERROR);z=z.substring(0,B)+O+z.substring(_)}}return z}Q=G(Q,Z),Q=rY(Q,Z,Y,X);let K=X?.loops?.maxWhileIterations??xU;return Q=cU(Q,Z,K),Q}function sY($){return T$($)}function rY($,Z,Y,X){let Q=$,J=!0;while(J){J=!1;let G=Q.match(/@for\s*\(/);if(!G||G.index===void 0)break;let K=G.index,q=K+G[0].length-1,W=S0(Q,"(",")",q);if(W===-1)break;let z=Q.slice(q+1,W),U=W+1,B=P$(Q.slice(K),"for","endfor");if(B.length===0)break;let _=B[0].content,j=K+B[0].end;if(!sY(z)){let H=$0("For",`Unsafe expression in @for: ${z}`,o.UNSAFE_EXPRESSION);Q=Q.substring(0,K)+H+Q.substring(j),J=!0;continue}try{let H=lU(z),L=/@(?:for|foreach|if|unless)\s*\(/.test(_);if(H.length>0&&L){let w=pU({forExpr:z,content:_,iterVarNames:H,context:Z,filePath:Y,options:X});Q=Q.substring(0,K)+w+Q.substring(j),J=!0;continue}let F=Object.keys(Z),O=Object.values(Z),V=_.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(w,N)=>{return`\${${N}}`});V=oY(V);let A=Function(...F,`
10529
10530
  let result = '';
10530
- for (${U}) {
10531
+ for (${z}) {
10531
10532
  result += \`${V}\`;
10532
10533
  }
10533
10534
  return result;
10534
- `)(...O);Q=Q.substring(0,K)+A+Q.substring(j),J=!0}catch(H){let L=$0("For",`Error in @for(${U}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(j),J=!0}}return Q}function mz($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let B=q.slice(W+1).trim(),_=B.indexOf("=");return(_>=0?B.slice(0,_):B).trim()}let U=q.indexOf("="),z=(U>=0?q.slice(0,U):q).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let X=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(X)return[X[1]];let Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function uz($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
10535
+ `)(...O);Q=Q.substring(0,K)+A+Q.substring(j),J=!0}catch(H){let L=$0("For",`Error in @for(${z}): ${H instanceof Error?H.message:String(H)}`,o.EVALUATION_ERROR);Q=Q.substring(0,K)+L+Q.substring(j),J=!0}}return Q}function lU($){let Z=$.trim(),Y=Z.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Y){let J=Y[1];return J.slice(1,-1).split(",").map((K)=>{let q=K.trim();if(!q)return"";let W=q.indexOf(":");if(W>=0&&J.startsWith("{")){let B=q.slice(W+1).trim(),_=B.indexOf("=");return(_>=0?B.slice(0,_):B).trim()}let 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 Q=Z.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(Q)return[Q[1]];return[]}function pU($){let{forExpr:Z,content:Y,iterVarNames:X,context:Q,filePath:J,options:G}=$,K=Object.keys(Q),q=Object.values(Q),W=Function(...K,"__pushIter",`
10535
10536
  for (${Z}) {
10536
10537
  __pushIter([${X.join(", ")}])
10537
10538
  }
10538
- `),U=[];W(...q,(_)=>{U.push(_)});let z=J??"inline.stx",B="";for(let _ of U){let j={...Q};X.forEach((L,F)=>{j[L]=_[F]});let H=oY(Y,j,J,G);H=d1(H,j,z),H=z1(H,j,z),B+=H}return B}function lz($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=b0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),U=P$(X.slice(G),"while","endwhile");if(U.length===0)break;let z=U[0].content,B=G+U[0].end;if(!nY(W)){let _=$0("While",`Unsafe expression in @while: ${W}`,o.UNSAFE_EXPRESSION);X=X.substring(0,G)+_+X.substring(B),Q=!0;continue}try{let _=Object.keys(Z),j=Object.values(Z),H=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=iY(H);let F=Function(..._,`
10539
+ `),z=[];W(...q,(_)=>{z.push(_)});let U=J??"inline.stx",B="";for(let _ of z){let j={...Q};X.forEach((L,F)=>{j[L]=_[F]});let H=rY(Y,j,J,G);H=d1(H,j,U),H=U1(H,j,U),B+=H}return B}function cU($,Z,Y){let X=$,Q=!0;while(Q){Q=!1;let J=X.match(/@while\s*\(/);if(!J||J.index===void 0)break;let G=J.index,K=G+J[0].length-1,q=S0(X,"(",")",K);if(q===-1)break;let W=X.slice(K+1,q),z=P$(X.slice(G),"while","endwhile");if(z.length===0)break;let U=z[0].content,B=G+z[0].end;if(!sY(W)){let _=$0("While",`Unsafe expression in @while: ${W}`,o.UNSAFE_EXPRESSION);X=X.substring(0,G)+_+X.substring(B),Q=!0;continue}try{let _=Object.keys(Z),j=Object.values(Z),H=U.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,V)=>{return`\${${V}}`});H=oY(H);let F=Function(..._,`
10539
10540
  let result = '';
10540
10541
  let maxIterations = ${Y}; // Configurable safety limit
10541
10542
  let counter = 0;
@@ -10547,8 +10548,8 @@ ${D}
10547
10548
  result += '<!-- [While Error [1104]]: Maximum iterations (${Y}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
10548
10549
  }
10549
10550
  return result;
10550
- `)(...j);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(_){let j=$0("While",`Error in @while(${W}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(B),Q=!0}}return X}var Cz=1000,vz=!1,o4="<!--__STX_BREAK__-->",s4="<!--__STX_CONTINUE__-->";var C6=k(()=>{C4();J1();a0();C$();F0()});import z0 from"path";function v6($,Z){let Y=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return X}return-1}function pz($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let U=X.substring(K+1,W-1),z=`${Y}(${U})`;X=X.substring(0,G)+z+X.substring(W),Q.lastIndex=G+z.length,J=Q.exec(X)}return X}function cz($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function aY($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(z)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===z){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let z=1;while(J<G&&z>0)if(Z[J]==="{")z++,J++;else if(Z[J]==="}")z--,J++;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},W=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
10551
- `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Q!==0)return;let z=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!X.has(j))Y.push(j),X.add(j);return}let B=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Y.push(j),X.add(j);return}let _=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!X.has(j))Y.push(j),X.add(j)}};while(J<G){if(W())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))U();J++}return Y.join(", ")}function tY($,Z=""){let Y=aY($).split(",").map((X)=>X.trim()).filter(Boolean);return`
10551
+ `)(...j);X=X.substring(0,G)+F+X.substring(B),Q=!0}catch(_){let j=$0("While",`Error in @while(${W}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);X=X.substring(0,G)+j+X.substring(B),Q=!0}}return X}var xU=1000,fU=!1,o4="<!--__STX_BREAK__-->",s4="<!--__STX_CONTINUE__-->";var C6=k(()=>{C4();J1();a0();C$();F0()});import U0 from"path";function v6($,Z){let Y=0;for(let X=Z;X<$.length;X++){let Q=$[X];if(Q==="("||Q==="["||Q==="{")Y++;else if(Q===")"||Q==="]"||Q==="}")Y--;else if(Q===","&&Y===0)return X}return-1}function iU($,Z,Y){let X=$,Q=new RegExp(`${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),J=Q.exec(X);while(J){let G=J.index,K=G+J[0].length-1,q=1,W=K+1;while(W<X.length&&q>0){if(X[W]==="(")q++;else if(X[W]===")")q--;W++}if(q!==0)break;let z=X.substring(K+1,W-1),U=`${Y}(${z})`;X=X.substring(0,G)+U+X.substring(W),Q.lastIndex=G+U.length,J=Q.exec(X)}return X}function nU($){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test($)}function eY($){let Z=$,Y=[],X=new Set,Q=0,J=0,G=Z.length,K=(U)=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]===U){J++;return}J++}},q=()=>{J++;while(J<G){if(Z[J]==="\\"){J+=2;continue}if(Z[J]==="`"){J++;return}if(Z[J]==="$"&&Z[J+1]==="{"){J+=2;let U=1;while(J<G&&U>0)if(Z[J]==="{")U++,J++;else if(Z[J]==="}")U--,J++;else if(Z[J]==="'"||Z[J]==='"')K(Z[J]);else if(Z[J]==="`")q();else J++;continue}J++}},W=()=>{if(Z[J]==="/"&&Z[J+1]==="/"){while(J<G&&Z[J]!==`
10552
+ `)J++;return!0}if(Z[J]==="/"&&Z[J+1]==="*"){J+=2;while(J<G-1&&!(Z[J]==="*"&&Z[J+1]==="/"))J++;return J+=2,!0}return!1},z=()=>{if(Q!==0)return;let U=Z.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(U){let j=U[2];if(!X.has(j))Y.push(j),X.add(j);return}let B=Z.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!X.has(j))Y.push(j),X.add(j);return}let _=Z.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(_){let j=_[1];if(!X.has(j))Y.push(j),X.add(j)}};while(J<G){if(W())continue;if(Z[J]==="'"||Z[J]==='"'){K(Z[J]);continue}if(Z[J]==="`"){q();continue}if(Z[J]==="{"){Q++,J++;continue}if(Z[J]==="}"){Q--,J++;continue}if(Q===0&&/[a-z]/i.test(Z[J])&&(J===0||/\s|[;{}()]/.test(Z[J-1])))z();J++}return Y.join(", ")}function $X($,Z=""){let Y=eY($).split(",").map((X)=>X.trim()).filter(Boolean);return`
10552
10553
  (function() {
10553
10554
  ${a1("var",Y)}
10554
10555
  var __destroyHooks = [];
@@ -10557,11 +10558,11 @@ ${D}
10557
10558
 
10558
10559
  ${$}
10559
10560
  ${Z}})();
10560
- `}function eY($,Z){return`
10561
+ `}function ZX($,Z){return`
10561
10562
  // Register scope variables for STX runtime
10562
10563
  if (!window.stx._scopes) window.stx._scopes = {};
10563
10564
  var __scopeRegistration = { __destroyCallbacks: __destroyHooks };
10564
- ${aY($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeRegistration[${JSON.stringify(J)}] = ${J}; } catch (e) { /* not actually top-level */ }`).join(`
10565
+ ${eY($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeRegistration[${JSON.stringify(J)}] = ${J}; } catch (e) { /* not actually top-level */ }`).join(`
10565
10566
  `)}
10566
10567
  // #1767: when the bundler renamed a component const that collided with an
10567
10568
  // inlined import (foo -> foo2), rebind the ORIGINAL template name to the
@@ -10569,7 +10570,7 @@ ${aY($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeR
10569
10570
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
10570
10571
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
10571
10572
  window.stx._scopes['${Z}'] = __scopeRegistration;
10572
- `}function iz($,Z){let Y=eY($,Z),X=`
10573
+ `}function oU($,Z){let Y=ZX($,Z),X=`
10573
10574
  (function() {
10574
10575
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${Z}"]') : null;
10575
10576
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -10578,33 +10579,33 @@ ${aY($).split(",").map((J)=>J.trim()).filter(Boolean).map((J)=>` try { __scopeR
10578
10579
  } finally {
10579
10580
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
10580
10581
  }
10581
- })();`;return X+tY($,Y)+`
10582
+ })();`;return X+$X($,Y)+`
10582
10583
  } finally {
10583
10584
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
10584
10585
  }
10585
- })();`}function nz($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function sz($){if($.__onceStore instanceof Set)return $.__onceStore;return oz}async function x6($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||z0.join(z0.dirname(Y),"partials");if(G&&!z0.isAbsolute(G))G=z0.resolve(process.cwd(),G);let K=pz($,"@partial","@include"),q=sz(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let R=K.substring(F+1,V-1),A=R.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let w=A[1],N=W(w,G,Y),T="";if(N&&await Bun.file(N).exists())Q.add(N),T=`@include(${R})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,R=1,A=V+1;while(A<K.length&&R>0){if(K[A]==="(")R++;else if(K[A]===")")R--;A++}if(R!==0)break;let w=K.substring(V+1,A-1),N=v6(w,0);if(N===-1){L.lastIndex=A;continue}let T=w.substring(0,N).trim(),M=w.substring(N+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let E=I[1],D=M.substring(I[0].length),P,S=v6(D,0);if(S!==-1)P=D.substring(S+1).trim();try{let b=`Boolean(${T})`,C;if(J0(b)){let u=Q0(b,Object.keys(Z));C=Boolean(u(...Object.values(Z)))}else C=Boolean(Y0(b,Z));let h=H?!C:C,x="";if(h){let u=W(E,G,Y);if(u&&await Bun.file(u).exists())Q.add(u);x=`@include('${E}'${P?`, ${P}`:""})`}K=K.substring(0,O)+x+K.substring(A),L.lastIndex=0}catch(b){let C=b instanceof Error?b.message:String(b),h=W0("Include",`Error evaluating ${j} condition: ${C}`,Y,$,O);K=K.substring(0,O)+h+K.substring(A),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),A=K.substring(L,V+1),w=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!w){j.lastIndex=0,K=K.replace(A,"");continue}let[,N,T,M,I]=w;try{let E,D=T.trim();if(J0(D))E=Q0(D,Object.keys(Z))(...Object.values(Z));else E=Y0(D,Z);let P="";if(Array.isArray(E)&&E.length>0)for(let S of E){let b={...Z,[M]:S},C=await z(N,b,$,L);P+=C}else if(I)P=await z(I,{},$,L);K=K.substring(0,L)+P+K.substring(V+1),j.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+W0("Each",`Error in @each: ${D}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),A=K.substring(L,V+1),w=R.match(/^\s*(\[[^\]]+\])/);if(!w){j.lastIndex=0,K=K.replace(A,"");continue}let N=w[1],T=R.slice(w[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let P=1,S=1;while(S<T.length&&P>0){if(T[S]==="{")P++;else if(T[S]==="}"){if(P--,P===0)break}S++}M=T.substring(0,S+1),T=T.slice(S+1)}let E,D=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let P=JSON.parse(N.replace(/'/g,'"')),S={};if(M)try{S=L0(M,Z)}catch(C){let h=C instanceof Error?C.message:String(C);if(X.debug){let x=W0("Include",`Error parsing includeFirst variables: ${h}`,Y,$,L,A);K=K.replace(A,()=>x)}else K=K.replace(A,()=>E||"");continue}let b=!1;for(let C of P){let h=W(C,G,Y);if(!h)continue;if(await n(h)){let x=await z(C,S,$,L);K=K.replace(A,()=>x),b=!0;break}}if(!b)if(E!==void 0)K=K.replace(A,()=>E);else if(X.debug){let C=W0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,A);K=K.replace(A,()=>C)}else K=K.replace(A,"")}catch(P){let S=P instanceof Error?P.message:String(P),b=W0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);K=K.replace(A,()=>b)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=z0.resolve(H),V=z0.resolve(z0.dirname(L)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=z0.resolve(H,F);else R=z0.resolve(V,F);let A=z0.normalize(R),w=A.startsWith(O+z0.sep)||A===O,N=A.startsWith(V+z0.sep)||A===V,T=!1,M=z0.dirname(V);if(A.startsWith(M+z0.sep)){if(!z0.relative(M,A).split(z0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))T=!0}if(!w&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let U=z0.resolve(Y);J.add(U);async function z(j,H={},L,F){let O=W(j,G,Y);if(!O)return W0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=z0.resolve(O);if(J.has(V)){let R=[...J,V].map((A)=>z0.basename(A)).join(" -> ");return W0("Include",`Circular include detected: ${R}`,Y,L,F)}try{Q.add(O);let R;if(!R)try{R=await Bun.file(O).text()}catch(x){let u=x instanceof Error?x.message:String(x);return W0("Include",`Error loading include file ${j}: ${u}`,Y,L,F)}if(R&&R.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (Y6(),Z6));R=x(R,Z)}if(R&&(X.debug||!a5()&&!N4()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (J6(),FY));x(R,O)}catch{}let A=R;try{let{processESImports:x}=await Promise.resolve().then(() => (y6(),uY));await x(R,Z,O,X,Q)}catch(x){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,x instanceof Error?x.message:x)}let w=k$(A);if(w)A=w.content.trim();let T=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[x,u]of Object.entries(H))I[x]=u;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...R.matchAll(E)],P="",S=null;for(let x of D){let u=x[1]||"",t=x[2]||"",X0=u.includes("server"),$1=D1(u),f0="";try{let{extractAndStripCssImports:Z0,renderVendorStyleTags:A0}=await Promise.resolve().then(() => (C5(),g9)),l0=Z0(t,{filePath:O,projectRoot:process.cwd()});t=l0.code,f0=A0(l0.styles)}catch(Z0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,Z0 instanceof Error?Z0.message:Z0)}if($1&&t.trim())t=E1(t);if(!X0)try{let{hasUserImports:Z0,bundleClientScript:A0}=await Promise.resolve().then(() => (b5(),k5));if(Z0(t))t=await A0(t,O,{projectRoot:process.cwd()})}catch(Z0){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,Z0 instanceof Error?Z0.message:Z0)}let T0=cz(t);if(T0&&!X0){S=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++rY}`;let Z0=c0(t),A0=iz(Z0,S);P+=`${f0}<script data-stx-scoped>${A0}</script>
10586
- `;continue}if(X0)try{let{extractVariables:Z0}=await Promise.resolve().then(() => (p5(),y$));await Z0(t,I,O)}catch(Z0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,Z0)}if(!X0&&!T0){let Z0=u.replace(/\bclient\b/i,"").trim();S=`stx_scope_${z0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++rY}`;let A0=c0(t),l0=eY(A0,S),Z1=tY(A0,l0);P+=`${f0}<script data-stx-scoped${Z0?` ${Z0}`:""}>${Z1}</script>
10587
- `}}if(S){let x=nz(A,S);if(A=x.html,x.mergedIntoExisting)P=P.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),S=x.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await x6(A,I,O,X,Q,J);let{processLoops:b}=await Promise.resolve().then(() => (C6(),sY)),C=b(A,I,O);C=d1(C,I,O);let h=r1(R);if(C=z1(C,I,O,{forceSignals:h}),M)C+=`
10586
+ })();`}function sU($,Z){let Y=$.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Y){let Q=(Y[2]+Y[3]).match(/data-stx-scope="([^"]*)"/);if(Q)return{html:$,mergedIntoExisting:Q[1]};let J=Y[1],G=Y[2],K=Y[3];return{html:`${J}${G} data-stx-scope="${Z}"${K}${$.slice(Y[0].length)}`,mergedIntoExisting:null}}return{html:$,mergedIntoExisting:null}}function aU($){if($.__onceStore instanceof Set)return $.__onceStore;return rU}async function x6($,Z,Y,X,Q,J=new Set){let G=X.partialsDir||U0.join(U0.dirname(Y),"partials");if(G&&!U0.isAbsolute(G))G=U0.resolve(process.cwd(),G);let K=iU($,"@partial","@include"),q=aU(Z);K=K.replace(/@once([\s\S]*?)@endonce/g,(j,H,L)=>{let F=H.trim(),O=`${Y}:${F}`;if(q.has(O))return"";return q.add(O),H});{let j=/@includeIf\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")")O--;V++}if(O!==0)break;let R=K.substring(F+1,V-1),A=R.match(/^\s*['"]([^'"]+)['"]/);if(!A){j.lastIndex=V;continue}let w=A[1],N=W(w,G,Y),T="";if(N&&await Bun.file(N).exists())Q.add(N),T=`@include(${R})`;K=K.substring(0,L)+T+K.substring(V),j.lastIndex=0}}for(let[j,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${j.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),F;while((F=L.exec(K))!==null){let O=F.index,V=O+F[0].length-1,R=1,A=V+1;while(A<K.length&&R>0){if(K[A]==="(")R++;else if(K[A]===")")R--;A++}if(R!==0)break;let w=K.substring(V+1,A-1),N=v6(w,0);if(N===-1){L.lastIndex=A;continue}let T=w.substring(0,N).trim(),M=w.substring(N+1).trim(),I=M.match(/^\s*['"]([^'"]+)['"]/);if(!I){L.lastIndex=A;continue}let E=I[1],D=M.substring(I[0].length),P,S=v6(D,0);if(S!==-1)P=D.substring(S+1).trim();try{let b=`Boolean(${T})`,C;if(J0(b)){let u=Q0(b,Object.keys(Z));C=Boolean(u(...Object.values(Z)))}else C=Boolean(Y0(b,Z));let h=H?!C:C,x="";if(h){let u=W(E,G,Y);if(u&&await Bun.file(u).exists())Q.add(u);x=`@include('${E}'${P?`, ${P}`:""})`}K=K.substring(0,O)+x+K.substring(A),L.lastIndex=0}catch(b){let C=b instanceof Error?b.message:String(b),h=W0("Include",`Error evaluating ${j} condition: ${C}`,Y,$,O);K=K.substring(0,O)+h+K.substring(A),L.lastIndex=0}}}{let j=/@each\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),A=K.substring(L,V+1),w=R.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!w){j.lastIndex=0,K=K.replace(A,"");continue}let[,N,T,M,I]=w;try{let E,D=T.trim();if(J0(D))E=Q0(D,Object.keys(Z))(...Object.values(Z));else E=Y0(D,Z);let P="";if(Array.isArray(E)&&E.length>0)for(let S of E){let b={...Z,[M]:S},C=await U(N,b,$,L);P+=C}else if(I)P=await U(I,{},$,L);K=K.substring(0,L)+P+K.substring(V+1),j.lastIndex=0}catch(E){let D=E instanceof Error?E.message:String(E);K=K.substring(0,L)+W0("Each",`Error in @each: ${D}`,Y,$,L)+K.substring(V+1),j.lastIndex=0}}}{let j=/@includeFirst\s*\(/g,H;while((H=j.exec(K))!==null){let L=H.index,F=L+H[0].length-1,O=1,V=F+1;while(V<K.length&&O>0){if(K[V]==="(")O++;else if(K[V]===")"){if(O--,O===0)break}V++}if(O!==0)break;let R=K.substring(F+1,V),A=K.substring(L,V+1),w=R.match(/^\s*(\[[^\]]+\])/);if(!w){j.lastIndex=0,K=K.replace(A,"");continue}let N=w[1],T=R.slice(w[0].length),M,I=T.match(/^\s*,\s*\{/);if(I){T=T.slice(I[0].length-1);let P=1,S=1;while(S<T.length&&P>0){if(T[S]==="{")P++;else if(T[S]==="}"){if(P--,P===0)break}S++}M=T.substring(0,S+1),T=T.slice(S+1)}let E,D=T.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(D)E=D[1];try{let P=JSON.parse(N.replace(/'/g,'"')),S={};if(M)try{S=L0(M,Z)}catch(C){let h=C instanceof Error?C.message:String(C);if(X.debug){let x=W0("Include",`Error parsing includeFirst variables: ${h}`,Y,$,L,A);K=K.replace(A,()=>x)}else K=K.replace(A,()=>E||"");continue}let b=!1;for(let C of P){let h=W(C,G,Y);if(!h)continue;if(await n(h)){let x=await U(C,S,$,L);K=K.replace(A,()=>x),b=!0;break}}if(!b)if(E!==void 0)K=K.replace(A,()=>E);else if(X.debug){let C=W0("Include",`None of the includeFirst paths exist: ${N}`,Y,$,L,A);K=K.replace(A,()=>C)}else K=K.replace(A,"")}catch(P){let S=P instanceof Error?P.message:String(P),b=W0("Include",`Error processing @includeFirst: ${S}`,Y,$,L,A);K=K.replace(A,()=>b)}j.lastIndex=0}}function W(j,H,L){try{let F=j;if(!j.endsWith(".stx"))F=`${j}.stx`;let O=U0.resolve(H),V=U0.resolve(U0.dirname(L)),R;if(!F.startsWith("./")&&!F.startsWith("../"))R=U0.resolve(H,F);else R=U0.resolve(V,F);let A=U0.normalize(R),w=A.startsWith(O+U0.sep)||A===O,N=A.startsWith(V+U0.sep)||A===V,T=!1,M=U0.dirname(V);if(A.startsWith(M+U0.sep)){if(!U0.relative(M,A).split(U0.sep).some((P)=>P.startsWith(".")&&P!=="."&&P!==".."))T=!0}if(!w&&!N&&!T)return console.error(`Security: Path traversal attempt blocked for include path: ${j}`),console.error(` Resolved to: ${A}`),console.error(` Allowed dirs: ${O}, ${V}`),null;return A}catch(F){return console.error(`Error resolving path ${j}: ${F}`),null}}let z=U0.resolve(Y);J.add(z);async function U(j,H={},L,F){let O=W(j,G,Y);if(!O)return W0("Include",`Could not resolve path for include: ${j}`,Y,L,F);let V=U0.resolve(O);if(J.has(V)){let R=[...J,V].map((A)=>U0.basename(A)).join(" -> ");return W0("Include",`Circular include detected: ${R}`,Y,L,F)}try{Q.add(O);let R;if(!R)try{R=await Bun.file(O).text()}catch(x){let u=x instanceof Error?x.message:String(x);return W0("Include",`Error loading include file ${j}: ${u}`,Y,L,F)}if(R&&R.includes("@stream")){let{processStreamDirectives:x}=await Promise.resolve().then(() => (Y6(),Z6));R=x(R,Z)}if(R&&(X.debug||!a5()&&!N4()))try{let{warnUnbalancedTags:x}=await Promise.resolve().then(() => (J6(),RY));x(R,O)}catch{}let A=R;try{let{processESImports:x}=await Promise.resolve().then(() => (y6(),pY));await x(R,Z,O,X,Q)}catch(x){if(X.debug)console.warn(`[stx] partial ES import extraction skipped for ${O}:`,x instanceof Error?x.message:x)}let w=k$(A);if(w)A=w.content.trim();let T=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),M="";if(T)M=`<style${T[1]}>${T[2]}</style>`;A=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),A=A.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let I={...Z};for(let[x,u]of Object.entries(H))I[x]=u;let E=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,D=[...R.matchAll(E)],P="",S=null;for(let x of D){let u=x[1]||"",t=x[2]||"",X0=u.includes("server"),$1=D1(u),f0="";try{let{extractAndStripCssImports:Z0,renderVendorStyleTags:A0}=await Promise.resolve().then(() => (C5(),d9)),l0=Z0(t,{filePath:O,projectRoot:process.cwd()});t=l0.code,f0=A0(l0.styles)}catch(Z0){if(X.debug)console.warn(`[stx] vendor-css extractor skipped for ${O}:`,Z0 instanceof Error?Z0.message:Z0)}if($1&&t.trim())t=E1(t);if(!X0)try{let{hasUserImports:Z0,bundleClientScript:A0}=await Promise.resolve().then(() => (b5(),k5));if(Z0(t))t=await A0(t,O,{projectRoot:process.cwd()})}catch(Z0){if(X.debug)console.warn(`[stx] bundler skipped for ${O}:`,Z0 instanceof Error?Z0.message:Z0)}let T0=nU(t);if(T0&&!X0){S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++tY}`;let Z0=c0(t),A0=oU(Z0,S);P+=`${f0}<script data-stx-scoped>${A0}</script>
10587
+ `;continue}if(X0)try{let{extractVariables:Z0}=await Promise.resolve().then(() => (p5(),y$));await Z0(t,I,O)}catch(Z0){if(X.debug)console.warn(`Warning: Could not extract variables from server script in ${O}:`,Z0)}if(!X0&&!T0){let Z0=u.replace(/\bclient\b/i,"").trim();S=`stx_scope_${U0.basename(O,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++tY}`;let A0=c0(t),l0=ZX(A0,S),Z1=$X(A0,l0);P+=`${f0}<script data-stx-scoped${Z0?` ${Z0}`:""}>${Z1}</script>
10588
+ `}}if(S){let x=sU(A,S);if(A=x.html,x.mergedIntoExisting)P=P.replace(`window.stx._scopes['${S}']`,`window.stx._scopes['${x.mergedIntoExisting}']`),S=x.mergedIntoExisting}if(A.includes("@include")||A.includes("@partial"))A=await x6(A,I,O,X,Q,J);let{processLoops:b}=await Promise.resolve().then(() => (C6(),aY)),C=b(A,I,O);C=d1(C,I,O);let h=r1(R);if(C=U1(C,I,O,{forceSignals:h}),M)C+=`
10588
10589
  `+M;if(P)C+=`
10589
- `+P;return C}catch(R){let A=R instanceof Error?R.message:String(R);return W0("Include",`Error processing include ${j}: ${A}`,Y,L,F)}}let B=/@include\s*\(/g,_;while((_=B.exec(K))!==null){let j=_.index,H=j+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),R=V.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let A=R[1],w,N=V.substring(R[0].length),T=v6(N,0);if(T!==-1)w=N.substring(T+1).trim();let M={};if(w)try{M=L0(w,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(O,W0("Include",`Error parsing include variables for ${A}: ${D}`,Y,$,j)),B.lastIndex=0;continue}let I=await z(A,M,$,j);K=K.substring(0,j)+I+K.substring(F),B.lastIndex=0}return K}function f6($,Z){let Y=$;function X(Q,J,G,K){let q=Q,W=!0;while(W){W=!1;let U=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),z=q.match(U);if(!z||z.index===void 0)break;let B=z.index,_=z[1],j=B+z[0].length,H=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let A=q.slice(O),w=A.match(H),N=A.match(L),T=w?O+w.index:1/0,M=N?O+N.index:1/0;if(T<M)F++,O=T+(w[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let R=q.slice(j,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(R);else Z[_].push(R);q=q.substring(0,B)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function g6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
10590
- `)})}var rY=0,rR,oz;var $X=k(()=>{T7();C4();a0();h5();$5();F0();O0();rR=new d5(500),oz=new Set});import*as h6 from"path";async function ZX($,Z,Y=""){if(h6.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 XX($,Z,Y,"@js","@endjs")}async function YX($,Z,Y=""){if(h6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return XX($,Z,Y,"@ts","@endts")}async function XX($,Z,Y,X,Q){let J=$,G=e1(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:U,index:z}of K)try{let B=Object.keys(Z),_=Object.values(Z),j=U.trim();if(X==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
10590
+ `+P;return C}catch(R){let A=R instanceof Error?R.message:String(R);return W0("Include",`Error processing include ${j}: ${A}`,Y,L,F)}}let B=/@include\s*\(/g,_;while((_=B.exec(K))!==null){let j=_.index,H=j+_[0].length-1,L=1,F=H+1;while(F<K.length&&L>0){if(K[F]==="(")L++;else if(K[F]===")")L--;F++}if(L!==0)break;let O=K.substring(j,F),V=K.substring(H+1,F-1),R=V.match(/^\s*['"]([^'"]+)['"]/);if(!R){B.lastIndex=F;continue}let A=R[1],w,N=V.substring(R[0].length),T=v6(N,0);if(T!==-1)w=N.substring(T+1).trim();let M={};if(w)try{M=L0(w,Z)}catch(E){let D=E instanceof Error?E.message:String(E);K=K.replace(O,W0("Include",`Error parsing include variables for ${A}: ${D}`,Y,$,j)),B.lastIndex=0;continue}let I=await U(A,M,$,j);K=K.substring(0,j)+I+K.substring(F),B.lastIndex=0}return K}function f6($,Z){let Y=$;function X(Q,J,G,K){let q=Q,W=!0;while(W){W=!1;let z=new RegExp(`@${J}\\(['"]([^'"]+)['"]\\)`),U=q.match(z);if(!U||U.index===void 0)break;let B=U.index,_=U[1],j=B+U[0].length,H=new RegExp(`@${J}\\(`),L=new RegExp(`@${G}(?![a-z])`),F=1,O=j,V=-1;while(F>0&&O<q.length){let A=q.slice(O),w=A.match(H),N=A.match(L),T=w?O+w.index:1/0,M=N?O+N.index:1/0;if(T<M)F++,O=T+(w[0].length||1);else if(M<1/0){if(F--,F===0){V=M;break}O=M+G.length+1}else break}if(V===-1)break;let R=q.slice(j,V);if(!Z[_])Z[_]=[];if(K)Z[_].unshift(R);else Z[_].push(R);q=q.substring(0,B)+q.substring(V+`@${G}`.length),W=!0}return q}return Y=X(Y,"push","endpush",!1),Y=X(Y,"prepend","endprepend",!0),Y}function g6($,Z){return $.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Y,X)=>{if(!Z[X]||Z[X].length===0)return"";return Z[X].join(`
10591
+ `)})}var tY=0,tR,rU;var YX=k(()=>{T7();C4();a0();h5();$5();F0();O0();tR=new d5(500),rU=new Set});import*as h6 from"path";async function XX($,Z,Y=""){if(h6.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 QX($,Z,Y,"@js","@endjs")}async function JX($,Z,Y=""){if(h6.basename(Y)==="ts-directive.stx"){if(Z.users&&Array.isArray(Z.users))Z.processedUsers=Z.users.map((J)=>({...J,displayName:`User ${J.id}: ${J.name}`})),Z.processedOutput=JSON.stringify(Z.processedUsers);return $.replace(/@ts[\s\S]*?@endts/g,"")}return QX($,Z,Y,"@ts","@endts")}async function QX($,Z,Y,X,Q){let J=$,G=e1(`${X}([\\s\\S]*?)${Q}`,"g"),K=[],q;while((q=G.exec($))!==null)K.push({fullMatch:q[0],content:q[1]||"",index:q.index});for(let{fullMatch:W,content:z,index:U}of K)try{let B=Object.keys(Z),_=Object.values(Z),j=z.trim();if(X==="@ts")j=j.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(j.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((A)=>A.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),F=L.length>0?`return { ${L.join(", ")} };`:"return {};",O=`
10591
10592
  ${j}
10592
10593
  ${F}
10593
- `,R=Function(...B,O)(..._);if(R&&typeof R==="object")Object.assign(Z,R);J=J.replace(W,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let _=B instanceof Error?B.message:String(B),j=W0(`${X} Directive`,`Error executing code: ${_}`,Y,$,z,W);console.error(j),J=J.replace(W,"")}return J}var JX=k(()=>{$5();O0()});function rz($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function QX($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return rz(X,J||"_method")})}async function GX($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=W0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
10594
+ `,R=Function(...B,O)(..._);if(R&&typeof R==="object")Object.assign(Z,R);J=J.replace(W,"")}catch(B){console.error(`Error executing ${X} code block in ${Y}:`,B);let _=B instanceof Error?B.message:String(B),j=W0(`${X} Directive`,`Error executing code: ${_}`,Y,$,U,W);console.error(j),J=J.replace(W,"")}return J}var GX=k(()=>{$5();O0()});function tU($,Z="_method"){let Y=$.toUpperCase();if(Y==="GET"||Y==="POST")return"";return`<input type="hidden" name="${Z}" value="${Y}">`}function KX($){return $.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,(Z,Y,X,Q,J)=>{return tU(X,J||"_method")})}async function qX($,Z,Y,X,Q){if(!X.middleware||X.middleware.length===0)return $;let J=$,G=X.middleware.filter((K)=>K.timing===Q);if(G.length===0)return J;for(let K of G){if(!K.name||typeof K.handler!=="function"){if(X.debug)console.warn("Invalid middleware:",K);continue}try{let q=await K.handler(J,Z,Y,X);if(typeof q==="string")J=q;else if(X.debug)console.warn(`Middleware ${K.name} did not return a string`)}catch(q){if(X.debug)console.error(`Error in middleware ${K.name}:`,q);if(X.debug){let W=W0("Middleware",`Error in middleware '${K.name}': ${q instanceof Error?q.message:String(q)}`,Y,$);J=J.replace(/<body[^>]*>/,`$&
10594
10595
  <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${i0(W)}</div>
10595
- `)}}}return J}async function KX($,Z,Y,X){return GX($,Z,Y,X,"before")}async function qX($,Z,Y,X){return GX($,Z,Y,X,"after")}var WX=k(()=>{a0();O0()});import{defineRoute as WA,defineRoutes as UA,resetRoutes as zA,route as BA,setAppUrl as jA}from"stx-router";import{route as az}from"stx-router";function UX($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?L0(Q,{}):{};return az(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var zX=k(()=>{F0()});async function BX($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(q$.exact[$])for(let X of q$.exact[$])await Promise.resolve(X(Z,$));if(q$.exact[Y])for(let X of q$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of q$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var q$;var jX=k(()=>{q$={patterns:[],exact:{}}});function _X($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>_X(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function HX($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([U,z])=>W>=U&&W<z)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],U=J[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=U,j=!1;while((B=z.exec(U))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let A=Function(...F,`return (${L})`)(...O);if(H==="class"){let w=_X(A);if(w){let N=_.match(/\sclass="([^"]*)"/);if(N)_=_.replace(N[0],` class="${N[1]} ${w}"`);else _=_.replace(B[0],` class="${w}"`)}else _=_.replace(B[0],"");j=!0;continue}if(tz.has(H)){if(A)_=_.replace(B[0],` ${H}`);else _=_.replace(B[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(B[0],"");else{let w=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(B[0],` ${H}="${w}"`)}j=!0}catch{continue}}if(j){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${_}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:U,end:z,replacement:B}=q[W];Y=Y.slice(0,U)+B+Y.slice(z)}return Y}var tz;var OX=k(()=>{tz=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function u1($,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 Q=/\/\s*>$/.test(X[0])||ez.has(X[1].toLowerCase()),J=Q?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:J,selfClosing:Q,start:X.index,end:X.index+X[0].length}}function ZB($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function t0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=ZB($,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 LX($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function H5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function F1($,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 V1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function YB($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function XB($){let Z=$,Y=0;while(Y<Z.length){let X=u1(Z,Y);if(!X)break;let Q=H5(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=F1(X.attrs,"v-for"),U=F1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=t0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=V1(B,{...X,start:0,end:X.end-X.start},U),j=`@foreach(${q})
10596
+ `)}}}return J}async function WX($,Z,Y,X){return qX($,Z,Y,X,"before")}async function zX($,Z,Y,X){return qX($,Z,Y,X,"after")}var UX=k(()=>{a0();O0()});import{defineRoute as UA,defineRoutes as BA,resetRoutes as jA,route as _A,setAppUrl as HA}from"stx-router";import{route as eU}from"stx-router";function BX($){return $.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,(Z,Y,X,Q,J)=>{try{let G=Q?L0(Q,{}):{};return eU(X,G,J==="true")}catch(G){return console.error(`Error processing @route directive: ${G}`),"#route-error"}})}var jX=k(()=>{F0()});async function _X($,Z){let Y=$.split("/").pop()?.split(".")[0]||"";if(q$.exact[$])for(let X of q$.exact[$])await Promise.resolve(X(Z,$));if(q$.exact[Y])for(let X of q$.exact[Y])await Promise.resolve(X(Z,$));for(let{pattern:X,callback:Q}of q$.patterns)if(X.test($)||X.test(Y))await Promise.resolve(Q(Z,$))}var q$;var HX=k(()=>{q$={patterns:[],exact:{}}});function OX($){if(typeof $==="string")return $;if(Array.isArray($))return $.filter(Boolean).map((Z)=>OX(Z)).join(" ");if($&&typeof $==="object")return Object.entries($).filter(([,Z])=>Z).map(([Z])=>Z).join(" ");return $?String($):""}function LX($,Z){if(!/:[\w-]+=/.test($))return $;let Y=$,X=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,Q=[],J;while((J=X.exec($))!==null)Q.push([J.index,J.index+J[0].length]);function G(W){return Q.some(([z,U])=>W>=z&&W<U)}let K=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*'))*)\s*\/?>/g,q=[];while((J=K.exec(Y))!==null){if(G(J.index))continue;let W=J[0],z=J[2];if(!z||!z.includes(":"))continue;let U=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,B,_=z,j=!1;while((B=U.exec(z))!==null){let H=B[1],L=B[2];if(L.includes("()")&&!L.includes(".get(")||L.includes("$store")||L.includes("$ref"))continue;try{let F=Object.keys(Z),O=Object.values(Z),V=L.match(/^([a-zA-Z_$][\w$]*)/);if(V&&!F.includes(V[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(V[1]))continue;let A=Function(...F,`return (${L})`)(...O);if(H==="class"){let w=OX(A);if(w){let N=_.match(/\sclass="([^"]*)"/);if(N)_=_.replace(N[0],` class="${N[1]} ${w}"`);else _=_.replace(B[0],` class="${w}"`)}else _=_.replace(B[0],"");j=!0;continue}if($B.has(H)){if(A)_=_.replace(B[0],` ${H}`);else _=_.replace(B[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)_=_.replace(B[0],"");else{let w=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");_=_.replace(B[0],` ${H}="${w}"`)}j=!0}catch{continue}}if(j){let H=W.endsWith("/>")?" /":"",F=`<${J[1]}${_}${H}>`;q.push({start:J.index,end:J.index+W.length,replacement:F})}}for(let W=q.length-1;W>=0;W--){let{start:z,end:U,replacement:B}=q[W];Y=Y.slice(0,z)+B+Y.slice(U)}return Y}var $B;var FX=k(()=>{$B=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"])});function u1($,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 Q=/\/\s*>$/.test(X[0])||ZB.has(X[1].toLowerCase()),J=Q?X[2].replace(/\/\s*$/,""):X[2];return{full:X[0],tag:X[1],attrs:J,selfClosing:Q,start:X.index,end:X.index+X[0].length}}function XB($,Z,Y){let X=1,Q=Y,J=new RegExp(`<${Z}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),G=new RegExp(`</${Z}\\s*>`,"gi");while(X>0&&Q<$.length){J.lastIndex=Q,G.lastIndex=Q;let K=J.exec($),q=G.exec($);if(!q)return-1;if(K&&K.index<q.index)X++,Q=K.index+K[0].length;else{if(X--,X===0)return q.index+q[0].length;Q=q.index+q[0].length}}return-1}function t0($,Z){if(Z.selfClosing)return{outerStart:Z.start,outerEnd:Z.end,innerHTML:""};let Y=XB($,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 VX($,Z){return new RegExp(`(?:^|\\s)${Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test($)||$.includes(` ${Z}=`)||$.includes(` ${Z} `)||$.trimEnd().endsWith(` ${Z}`)}function H5($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=$.match(new RegExp(`${Y}="([^"]*)"`,"s"))||$.match(new RegExp(`${Y}='([^']*)'`,"s"));return X?X[1]:null}function F1($,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 V1($,Z,Y){let X=Z.selfClosing?" /":"",Q=`<${Z.tag}${Y}${X}>`;return $.slice(0,Z.start)+Q+$.slice(Z.end)}function JB($){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test($)}function QB($){let Z=$,Y=0;while(Y<Z.length){let X=u1(Z,Y);if(!X)break;let Q=H5(X.attrs,"v-for");if(Q===null){Y=X.end;continue}let J=Q.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!J){Y=X.end;continue}let G=J[1].trim(),K=J[2].trim(),q;if(G.includes(",")){let L=G.split(",").map((V)=>V.trim()),F=L[0],O=L[1];q=`${K} as ${O} => ${F}`}else q=`${K} as ${G}`;let W=F1(X.attrs,"v-for"),z=F1(W,":key").replace(/\s*v-bind:key="[^"]*"/g,""),U=t0(Z,X),B=Z.slice(U.outerStart,U.outerEnd),_=V1(B,{...X,start:0,end:X.end-X.start},z),j=`@foreach(${q})
10596
10597
  `,H=`${j}${_}
10597
- @endforeach`;Z=Z.slice(0,z.outerStart)+H+Z.slice(z.outerEnd),Y=z.outerStart+j.length}return Z}function JB($){let Z=$,Y=0;while(Y<Z.length){let X=u1(Z,Y);if(!X)break;let Q=H5(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=t0(Z,X),K=F1(X.attrs,"v-if"),q=V1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,U=!0;while(U){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=u1(Z,W+L);if(!F){U=!1;break}let O=H5(F.attrs,"v-else-if"),V=LX(F.attrs,"v-else");if(O!==null){let R=t0(Z,F),A=F1(F.attrs,"v-else-if"),w=V1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:R.outerEnd,element:w,parsedTag:F}),W=R.outerEnd}else if(V){let R=t0(Z,F),A=F1(F.attrs,"v-else"),w=V1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else",outerStart:W,outerEnd:R.outerEnd,element:w,parsedTag:F}),U=!1}else U=!1}let z=[];for(let H of J)if(H.type==="if")z.push(`@if(${H.expr})
10598
- ${H.element}`);else if(H.type==="else-if")z.push(`@elseif(${H.expr})
10599
- ${H.element}`);else z.push(`@else
10600
- ${H.element}`);z.push("@endif");let B=z.join(`
10601
- `),_=J[0].outerStart,j=J[J.length-1].outerEnd;Z=Z.slice(0,_)+B+Z.slice(j),Y=_+B.length}return Z}function QB($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function GB($){let Z=$,Y=0;while(Y<Z.length){let X=u1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let U=K[1],z=K[2],B=K[3];Q=Q.replace(K[0],""),Q+=` :${U}="${B}" @update:${U}="${B} = $event"`,K=Q.match(G)}if(J){let U=t0(Z,X),z=Z.slice(U.outerStart,U.outerEnd),B=V1(z,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,U.outerStart)+B+Z.slice(U.outerEnd),Y=U.outerStart+B.length;continue}let q=H5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if($B.has(X.tag.toLowerCase())){let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,z=t0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=V1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}else{let U=X.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let z=t0(Z,X),B=Z.slice(z.outerStart,z.outerEnd),_=V1(B,{...X,start:0,end:X.end-X.start},U);Z=Z.slice(0,z.outerStart)+_+Z.slice(z.outerEnd),Y=z.outerStart+_.length}}return Z}function KB($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function qB($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function WB($){let Z=$,Y=0;while(Y<Z.length){let X=u1(Z,Y);if(!X)break;let Q=H5(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=t0(Z,X),G=F1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function UB($){let Z=$,Y=0;while(Y<Z.length){let X=u1(Z,Y);if(!X)break;let Q=H5(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=t0(Z,X),G=F1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function zB($){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 BB($){let Z=$,Y=0;while(Y<Z.length){let X=u1(Z,Y);if(!X)break;if(!LX(X.attrs,"v-once")){Y=X.end;continue}let Q=F1(X.attrs,"v-once"),J=t0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
10598
+ @endforeach`;Z=Z.slice(0,U.outerStart)+H+Z.slice(U.outerEnd),Y=U.outerStart+j.length}return Z}function GB($){let Z=$,Y=0;while(Y<Z.length){let X=u1(Z,Y);if(!X)break;let Q=H5(X.attrs,"v-if");if(Q===null){Y=X.end;continue}let J=[],G=t0(Z,X),K=F1(X.attrs,"v-if"),q=V1(Z.slice(G.outerStart,G.outerEnd),{...X,start:0,end:X.end-X.start},K);J.push({type:"if",expr:Q,outerStart:G.outerStart,outerEnd:G.outerEnd,element:q,parsedTag:X});let W=G.outerEnd,z=!0;while(z){let H=Z.slice(W).match(/^\s*/),L=H?H[0].length:0,F=u1(Z,W+L);if(!F){z=!1;break}let O=H5(F.attrs,"v-else-if"),V=VX(F.attrs,"v-else");if(O!==null){let R=t0(Z,F),A=F1(F.attrs,"v-else-if"),w=V1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else-if",expr:O,outerStart:W,outerEnd:R.outerEnd,element:w,parsedTag:F}),W=R.outerEnd}else if(V){let R=t0(Z,F),A=F1(F.attrs,"v-else"),w=V1(Z.slice(R.outerStart,R.outerEnd),{...F,start:0,end:F.end-F.start},A);J.push({type:"else",outerStart:W,outerEnd:R.outerEnd,element:w,parsedTag:F}),z=!1}else z=!1}let U=[];for(let H of J)if(H.type==="if")U.push(`@if(${H.expr})
10599
+ ${H.element}`);else if(H.type==="else-if")U.push(`@elseif(${H.expr})
10600
+ ${H.element}`);else U.push(`@else
10601
+ ${H.element}`);U.push("@endif");let B=U.join(`
10602
+ `),_=J[0].outerStart,j=J[J.length-1].outerEnd;Z=Z.slice(0,_)+B+Z.slice(j),Y=_+B.length}return Z}function KB($){return $.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function qB($){let Z=$,Y=0;while(Y<Z.length){let X=u1(Z,Y);if(!X)break;let Q=X.attrs,J=!1,G=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,K=Q.match(G);while(K){J=!0;let z=K[1],U=K[2],B=K[3];Q=Q.replace(K[0],""),Q+=` :${z}="${B}" @update:${z}="${B} = $event"`,K=Q.match(G)}if(J){let z=t0(Z,X),U=Z.slice(z.outerStart,z.outerEnd),B=V1(U,{...X,start:0,end:X.end-X.start},Q);Z=Z.slice(0,z.outerStart)+B+Z.slice(z.outerEnd),Y=z.outerStart+B.length;continue}let q=H5(X.attrs,"v-model");if(q===null){Y=X.end;continue}if(YB.has(X.tag.toLowerCase())){let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${q}"`,U=t0(Z,X),B=Z.slice(U.outerStart,U.outerEnd),_=V1(B,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}else{let z=X.attrs.replace(/\s*v-model="[^"]*"/g,"");z+=` :modelValue="${q}" @update:modelValue="${q} = $event"`;let U=t0(Z,X),B=Z.slice(U.outerStart,U.outerEnd),_=V1(B,{...X,start:0,end:X.end-X.start},z);Z=Z.slice(0,U.outerStart)+_+Z.slice(U.outerEnd),Y=U.outerStart+_.length}}return Z}function WB($){return $.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function zB($){return $.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function UB($){let Z=$,Y=0;while(Y<Z.length){let X=u1(Z,Y);if(!X)break;let Q=H5(X.attrs,"v-html");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=t0(Z,X),G=F1(X.attrs,"v-html"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{!! ${Q} !!}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function BB($){let Z=$,Y=0;while(Y<Z.length){let X=u1(Z,Y);if(!X)break;let Q=H5(X.attrs,"v-text");if(Q===null){Y=X.end;continue}if(X.selfClosing){Y=X.end;continue}let J=t0(Z,X),G=F1(X.attrs,"v-text"),K=X.selfClosing?" /":"",q=`<${X.tag}${G}${K}>{{ ${Q} }}</${X.tag}>`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function jB($){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 _B($){let Z=$,Y=0;while(Y<Z.length){let X=u1(Z,Y);if(!X)break;if(!VX(X.attrs,"v-once")){Y=X.end;continue}let Q=F1(X.attrs,"v-once"),J=t0(Z,X),G=Z.slice(J.outerStart,J.outerEnd),q=`@once
10602
10603
  ${V1(G,{...X,start:0,end:X.end-X.start},Q)}
10603
- @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function jB($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function _B($){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 FX($){if(!YB($))return $;let Z=$;return Z=XB(Z),Z=JB(Z),Z=BB(Z),Z=KB(Z),Z=qB(Z),Z=GB(Z),Z=QB(Z),Z=_B(Z),Z=WB(Z),Z=UB(Z),Z=zB(Z),Z=jB(Z),Z}var ez,$B;var VX=k(()=>{ez=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),$B=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 r4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function RX($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=Y0(U.expr,Z);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${r4(U.expr)}" -->`;J=J.slice(0,U.index)+O+J.slice(U.index+U.full.length);continue}let B=U.attrs.trim(),_={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(B))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=Y0(V,Z)}catch{_[O]=V}else _[O]=V}let L=X.componentsDir||"components",F=await C1(z,_,U.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+F+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${r4(B)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J=await HB(J,Z,Y,X,Q),J}async function HB($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let U=K[W];try{let z=Y0(U.expr,Z);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${r4(U.expr)}" -->`;J=J.slice(0,U.index)+j+J.slice(U.index+U.full.length);continue}let B=X.componentsDir||"components",_=await C1(z,{},"",B,Z,Y,X,new Set,Q??new Set);J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}catch(z){let B=z instanceof Error?z.message:String(z),_=`<!-- dynamic component error: ${r4(B)} -->`;J=J.slice(0,U.index)+_+J.slice(U.index+U.full.length)}}return J}var AX=k(()=>{O0();F0()});function wX($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
10604
- ${$.slice(Z)}`}function OB($){let Z=[],Y=0;while(Y<$.length){let J=$.slice(Y),G=J.match(/^\s+/);if(G){Y+=G[0].length;continue}if(J.startsWith("<!--")){let z=$.indexOf("-->",Y);if(z===-1)break;Y=z+3;continue}let K=J.match(/^<script\b[^>]*>/i);if(K){let z=$.toLowerCase().indexOf("</script>",Y+K[0].length);if(z===-1)break;Y=z+9;continue}let q=J.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let W=J.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let U=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){Z.push(U[0]),Y+=U[0].length;continue}break}if(Z.length===0)return{body:$,hoisted:Z};let X="",Q=0;while(Q<$.length&&Q<Y){let J=$.slice(Q),G=J.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Q+=G[0].length;continue}let K=J.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){Q+=K[0].length;continue}let q=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Q+=q[0].length;continue}X+=$[Q],Q++}return X+=$.slice(Y),{body:X,hoisted:Z}}function LB($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:U={}}=Z,z=Y.title||X,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((N)=>{return` <meta ${Object.entries(N).map(([M,I])=>`${M}="${I}"`).join(" ")}>`}).join(`
10604
+ @endonce`;Z=Z.slice(0,J.outerStart)+q+Z.slice(J.outerEnd),Y=J.outerStart+q.length}return Z}function HB($){return $.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function OB($){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 RX($){if(!JB($))return $;let Z=$;return Z=QB(Z),Z=GB(Z),Z=_B(Z),Z=WB(Z),Z=zB(Z),Z=qB(Z),Z=KB(Z),Z=OB(Z),Z=UB(Z),Z=BB(Z),Z=jB(Z),Z=HB(Z),Z}var ZB,YB;var AX=k(()=>{ZB=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),YB=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 r4($){return $.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}async function wX($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],slotContent:q[3],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=Y0(z.expr,Z);if(!U||typeof U!=="string"){let O=`<!-- dynamic component: could not resolve "${r4(z.expr)}" -->`;J=J.slice(0,z.index)+O+J.slice(z.index+z.full.length);continue}let B=z.attrs.trim(),_={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,H;while((H=j.exec(B))!==null){let O=H[1]||H[2],V=H[3];if(H[1])try{_[O]=Y0(V,Z)}catch{_[O]=V}else _[O]=V}let L=X.componentsDir||"components",F=await C1(U,_,z.slotContent,L,Z,Y,X,new Set,Q??new Set);J=J.slice(0,z.index)+F+J.slice(z.index+z.full.length)}catch(U){let B=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${r4(B)} -->`;J=J.slice(0,z.index)+_+J.slice(z.index+z.full.length)}}return J=await LB(J,Z,Y,X,Q),J}async function LB($,Z,Y,X,Q){let J=$,G=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,K=[],q;while((q=G.exec(J))!==null)K.push({full:q[0],expr:q[1],attrs:q[2],index:q.index});for(let W=K.length-1;W>=0;W--){let z=K[W];try{let U=Y0(z.expr,Z);if(!U||typeof U!=="string"){let j=`<!-- dynamic component: could not resolve "${r4(z.expr)}" -->`;J=J.slice(0,z.index)+j+J.slice(z.index+z.full.length);continue}let B=X.componentsDir||"components",_=await C1(U,{},"",B,Z,Y,X,new Set,Q??new Set);J=J.slice(0,z.index)+_+J.slice(z.index+z.full.length)}catch(U){let B=U instanceof Error?U.message:String(U),_=`<!-- dynamic component error: ${r4(B)} -->`;J=J.slice(0,z.index)+_+J.slice(z.index+z.full.length)}}return J}var NX=k(()=>{O0();F0()});function TX($){if($.includes("data-stx-cloak"))return $;let Z=$.lastIndexOf("</head>");if(Z===-1)return $;return`${$.slice(0,Z)}<style data-stx-cloak>[x-cloak]{display:none !important}</style>
10605
+ ${$.slice(Z)}`}function FB($){let Z=[],Y=0;while(Y<$.length){let J=$.slice(Y),G=J.match(/^\s+/);if(G){Y+=G[0].length;continue}if(J.startsWith("<!--")){let U=$.indexOf("-->",Y);if(U===-1)break;Y=U+3;continue}let K=J.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=J.match(/^<link\b[^>]*>/i);if(q){Z.push(q[0]),Y+=q[0].length;continue}let W=J.match(/^<meta\b[^>]*>/i);if(W){Z.push(W[0]),Y+=W[0].length;continue}let z=J.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="",Q=0;while(Q<$.length&&Q<Y){let J=$.slice(Q),G=J.match(/^<link\b[^>]*>/i);if(G&&Z.includes(G[0])){Q+=G[0].length;continue}let K=J.match(/^<meta\b[^>]*>/i);if(K&&Z.includes(K[0])){Q+=K[0].length;continue}let q=J.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(q&&Z.includes(q[0])){Q+=q[0].length;continue}X+=$[Q],Q++}return X+=$.slice(Y),{body:X,hoisted:Z}}function VB($,Z={},Y={}){let{title:X="stx App",lang:Q="en",meta:J=[],link:G=[],script:K=[],headRaw:q="",bodyClass:W="",bodyAttrs:z={}}=Z,U=Y.title||X,j=[...[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],...J].map((N)=>{return` <meta ${Object.entries(N).map(([M,I])=>`${M}="${I}"`).join(" ")}>`}).join(`
10605
10606
  `),H=G.map((N)=>{return` <link ${Object.entries(N).map(([M,I])=>`${M}="${I}"`).join(" ")}>`}).join(`
10606
10607
  `),L=K.map((N)=>{if(N.src)return` <script ${Object.entries(N).filter(([M])=>M!=="content").map(([M,I])=>`${M}="${I}"`).join(" ")}></script>`;if(N.content)return` <script>${N.content}</script>`;return""}).filter(Boolean).join(`
10607
- `),F=Object.entries(U).map(([N,T])=>` ${N}="${T}"`).join(""),O=W?` class="${W}"`:"",{body:V,hoisted:R}=OB($),A=[j,` <title>${z}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((N)=>` ${N}`),...R.map((N)=>` ${N}`),...(Y.headScripts||[]).map((N)=>` ${N}`),Y.headStack||""].filter(Boolean),w=[V,...(Y.bodyScripts||[]).map((N)=>N),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
10608
+ `),F=Object.entries(z).map(([N,T])=>` ${N}="${T}"`).join(""),O=W?` class="${W}"`:"",{body:V,hoisted:R}=FB($),A=[j,` <title>${U}</title>`," <style data-stx-cloak>[x-cloak]{display:none !important}</style>",H,L,q?` ${q}`:"",...(Y.styles||[]).map((N)=>` ${N}`),...R.map((N)=>` ${N}`),...(Y.headScripts||[]).map((N)=>` ${N}`),Y.headStack||""].filter(Boolean),w=[V,...(Y.bodyScripts||[]).map((N)=>N),Y.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
10608
10609
  <html lang="${Q}">
10609
10610
  <head>
10610
10611
  ${A.join(`
@@ -10614,35 +10615,35 @@ ${A.join(`
10614
10615
  ${w.join(`
10615
10616
  `)}
10616
10617
  </body>
10617
- </html>`}function d6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function NX($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:Q=[],script:J=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let U=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(U&&K.includes(U))continue;q.push(` <meta ${Object.entries(W).map(([z,B])=>`${z}="${B}"`).join(" ")}>`)}for(let W of Q){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([U,z])=>`${U}="${z}"`).join(" ")}>`)}for(let W of J)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([U])=>U!=="content").map(([U,z])=>`${U}="${z}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
10618
+ </html>`}function d6($){return/<!DOCTYPE\b/i.test($)||/<html[\s>]/i.test($)}function MX($,Z={}){let Y=$.lastIndexOf("</head>");if(Y===-1)return $;let{meta:X=[],link:Q=[],script:J=[],headRaw:G=""}=Z,K=$.slice(0,Y),q=[];for(let W of X){let z=W.name?`name="${W.name}"`:W.property?`property="${W.property}"`:W.charset!=null?"charset=":W["http-equiv"]?`http-equiv="${W["http-equiv"]}"`:"";if(z&&K.includes(z))continue;q.push(` <meta ${Object.entries(W).map(([U,B])=>`${U}="${B}"`).join(" ")}>`)}for(let W of Q){if(W.href&&K.includes(`href="${W.href}"`))continue;q.push(` <link ${Object.entries(W).map(([z,U])=>`${z}="${U}"`).join(" ")}>`)}for(let W of J)if(W.src){if(K.includes(`src="${W.src}"`))continue;q.push(` <script ${Object.entries(W).filter(([z])=>z!=="content").map(([z,U])=>`${z}="${U}"`).join(" ")}></script>`)}else if(W.content){if(K.includes(W.content))continue;q.push(` <script>${W.content}</script>`)}if(G&&!K.includes(G))q.push(` ${G}`);if(q.length===0)return $;return`${$.slice(0,Y)}${q.join(`
10618
10619
  `)}
10619
- ${$.slice(Y)}`}function TX($,Z={},Y={}){if(d6($))return $;return LB($,Z,Y)}import O5 from"path";function MX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function IX($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=O5.join(Q,$);if(await Bun.file(G).exists())return G;Q=O5.dirname(Q)}X=O5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=O5.resolve(Z,$);else X=O5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function DX($,Z,Y){let X=$,Q=O5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,U,z,B]=G;if(MX(z))continue;let _=await IX(z,Q,Z);if(_)try{let j=await Bun.file(_).text();if(Y.add(_),z.endsWith(".ts")||z.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:d0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
10620
- // Source: ${z}
10620
+ ${$.slice(Y)}`}function IX($,Z={},Y={}){if(d6($))return $;return VB($,Z,Y)}import O5 from"path";function DX($){return $.startsWith("http://")||$.startsWith("https://")||$.startsWith("//")}async function EX($,Z,Y){try{let X;if($.startsWith("/")){let Q=Z;for(let J=0;J<5;J++){let G=O5.join(Q,$);if(await Bun.file(G).exists())return G;Q=O5.dirname(Q)}X=O5.join(Z,$)}else if($.startsWith("./")||$.startsWith("../"))X=O5.resolve(Z,$);else X=O5.resolve(Z,$);if(await Bun.file(X).exists())return X;return null}catch{return null}}async function kX($,Z,Y){let X=$,Q=O5.dirname(Z),J=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,G;while((G=J.exec(X))!==null){let[W,z,U,B]=G;if(DX(U))continue;let _=await EX(U,Q,Z);if(_)try{let j=await Bun.file(_).text();if(Y.add(_),U.endsWith(".ts")||U.endsWith(".tsx")){let L=await Bun.build({entrypoints:[_],target:"browser",minify:!1,define:d0()});if(L.outputs.length>0)j=await L.outputs[0].text()}let H=`<script>
10621
+ // Source: ${U}
10621
10622
  ${j}
10622
- </script>`;X=X.replace(W,H),J.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,U,z,B]=q,_=U+B;if(MX(z))continue;if(/rel=["']stylesheet["']/.test(_)||z.endsWith(".css")){let H=await IX(z,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
10623
- /* Source: ${z} */
10623
+ </script>`;X=X.replace(W,H),J.lastIndex=0}catch(j){}}let K=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,q;while((q=K.exec(X))!==null){let[W,z,U,B]=q,_=z+B;if(DX(U))continue;if(/rel=["']stylesheet["']/.test(_)||U.endsWith(".css")){let H=await EX(U,Q,Z);if(H)try{let L=await Bun.file(H).text();Y.add(H);let F=`<style>
10624
+ /* Source: ${U} */
10624
10625
  ${L}
10625
- </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var EX=k(()=>{M1()});function a4($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,U=!1;while(q<Y.length&&K>0){let V=Y[q];if(U){U=!1,q++;continue}if(V==="\\"&&W){U=!0,q++;continue}if(W){if(V===W)W=null;q++;continue}if(V==='"'||V==="'"||V==="`"){W=V,q++;continue}if(V==="(")K++;else if(V===")"){if(K--,K===0)break}q++}if(K!==0)break;let z=Y.substring(G+1,q).trim(),B=Y.substring(J,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<z.length;V++){let R=z[V];if(L){L=!1;continue}if(R==="\\"&&H){L=!0;continue}if(H){if(R===H)H=null;continue}if(R==='"'||R==="'"||R==="`"){H=R;continue}if(R==="("||R==="["||R==="{")j++;else if(R===")"||R==="]"||R==="}")j--;if(R===","&&j===0){_=V;break}}let F=_>=0?z.substring(0,_).trim():z,O=_>=0?z.substring(_+1).trim():void 0;try{let V=F.trim(),R;if(J0(V))R=Q0(V,Object.keys(Z))(...Object.values(Z));else R=void 0;let A;if(O==="true")A=JSON.stringify(R,null,2);else A=JSON.stringify(R);let w=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+w+Y.substring(q+1),X.lastIndex=J+w.length}catch(V){o0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Y}function t4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function kX($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),U=q,z=Z.slice(U),B=z.indexOf("@endmemo");if(B===-1)continue;let _=z.slice(0,B),j=U+B+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,R=F.slice(0,F.length-V),A=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),w;if(A){let[N,T,M="",I]=A,E=`<${T}${M} data-stx-memo="${W}"${I}>`;w=_.slice(0,L)+E+R.slice(N.length)+_.slice(L+R.length)}else w=`${_.slice(0,L)}<div data-stx-memo="${W}">${R}</div>${_.slice(L+R.length)}`;Q.push({start:J,end:j,replacement:w}),Y.lastIndex=j}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function m6($){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 bX($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,U=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){U=K;break}K++}if(U===-1)continue;if($.slice(G,U+1).includes("x-cloak"))continue;let B=$.slice(U+1),_=B.indexOf("</"),j=_>=0?B.slice(0,_):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(Q,U)+" x-cloak>",Q=U+1}return X+=$.slice(Q),X}function SX($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,J);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=J+Q[0].length,q=!1,W=!1,U=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){U=K;break}K++}if(U===-1)continue;let z=$.slice(J+Q[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!FB.test(z))continue;let B=$[U-1]==="/",_=B?U-1:U;Y+=`${$.slice(X,_)} x-cloak${B?" ":""}`,X=_}return Y+=$.slice(X),Y}var FB;var u6=k(()=>{J1();F0();FB=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function e4($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of VB){if(Q.some((U)=>K.includes(U)||G.source.includes(U)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let U=$.split(`
10626
- `),z=[];U.forEach((_,j)=>{if(G.lastIndex=0,G.test(_))z.push(j+1)});let B=z.length>0?` (line${z.length>1?"s":""}: ${z.join(", ")})`:"";J.push(` \u2717 ${K}${B}
10626
+ </style>`;X=X.replace(W,F),K.lastIndex=0}catch(L){}}}return X}var bX=k(()=>{M1()});function a4($,Z){let Y=$,X=/@json\s*\(/g,Q;while((Q=X.exec(Y))!==null){let J=Q.index,G=J+Q[0].length-1,K=1,q=G+1,W=null,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(),B=Y.substring(J,q+1),_=-1,j=0,H=null,L=!1;for(let V=0;V<U.length;V++){let R=U[V];if(L){L=!1;continue}if(R==="\\"&&H){L=!0;continue}if(H){if(R===H)H=null;continue}if(R==='"'||R==="'"||R==="`"){H=R;continue}if(R==="("||R==="["||R==="{")j++;else if(R===")"||R==="]"||R==="}")j--;if(R===","&&j===0){_=V;break}}let F=_>=0?U.substring(0,_).trim():U,O=_>=0?U.substring(_+1).trim():void 0;try{let V=F.trim(),R;if(J0(V))R=Q0(V,Object.keys(Z))(...Object.values(Z));else R=void 0;let A;if(O==="true")A=JSON.stringify(R,null,2);else A=JSON.stringify(R);let w=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Y=Y.substring(0,J)+w+Y.substring(q+1),X.lastIndex=J+w.length}catch(V){o0.log(V instanceof Error?V:Error(String(V)),{directive:"@json"},"error"),X.lastIndex=J+B.length}}return Y}function t4($){return $.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function SX($){let Z=$,Y=/@memo\s*\(/g,X,Q=[];while((X=Y.exec(Z))!==null){let J=X.index,G=J+X[0].length,K=1,q=G;while(q<Z.length&&K>0){if(Z[q]==="(")K++;else if(Z[q]===")")K--;q++}if(K!==0)continue;let W=Z.slice(G,q-1).trim(),z=q,U=Z.slice(z),B=U.indexOf("@endmemo");if(B===-1)continue;let _=U.slice(0,B),j=z+B+8,H=_.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),L=H?H[0].length:0,F=_.slice(L),O=_.match(/(\s*)$/),V=O?O[0].length:0,R=F.slice(0,F.length-V),A=R.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),w;if(A){let[N,T,M="",I]=A,E=`<${T}${M} data-stx-memo="${W}"${I}>`;w=_.slice(0,L)+E+R.slice(N.length)+_.slice(L+R.length)}else w=`${_.slice(0,L)}<div data-stx-memo="${W}">${R}</div>${_.slice(L+R.length)}`;Q.push({start:J,end:j,replacement:w}),Y.lastIndex=j}for(let J=Q.length-1;J>=0;J--){let G=Q[J];Z=Z.slice(0,G.start)+G.replacement+Z.slice(G.end)}return Z.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function m6($){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 yX($){let Y=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),X="",Q=0,J;while((J=Y.exec($))!==null){let G=J.index,K=G+J[0].length,q=!1,W=!1,z=-1;while(K<$.length){let H=$[K];if(q){if(H==="'")q=!1}else if(W){if(H==='"')W=!1}else if(H==="'")q=!0;else if(H==='"')W=!0;else if(H===">"){z=K;break}K++}if(z===-1)continue;if($.slice(G,z+1).includes("x-cloak"))continue;let B=$.slice(z+1),_=B.indexOf("</"),j=_>=0?B.slice(0,_):B.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))X+=$.slice(Q,z)+" x-cloak>",Q=z+1}return X+=$.slice(Q),X}function PX($){let Z=/<[a-z][\w-]*/gi,Y="",X=0,Q;while((Q=Z.exec($))!==null){let J=Q.index,G=Q[0].slice(1).toLowerCase();if(G==="script"||G==="style"){let j=`</${G}>`,H=$.toLowerCase().indexOf(j,J);if(H!==-1)Z.lastIndex=H+j.length;continue}let K=J+Q[0].length,q=!1,W=!1,z=-1;while(K<$.length){let j=$[K];if(q){if(j==="'")q=!1}else if(W){if(j==='"')W=!1}else if(j==="'")q=!0;else if(j==='"')W=!0;else if(j===">"){z=K;break}K++}if(z===-1)continue;let U=$.slice(J+Q[0].length,z);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(U))continue;if(!RB.test(U))continue;let B=$[z-1]==="/",_=B?z-1:z;Y+=`${$.slice(X,_)} x-cloak${B?" ":""}`,X=_}return Y+=$.slice(X),Y}var RB;var u6=k(()=>{J1();F0();RB=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function e4($,Z,Y){let X=typeof Y==="boolean"?{enabled:Y,failOnViolation:Y}:Y??{enabled:!1},Q=X.allowPatterns??[],J=[];for(let{pattern:G,message:K,suggestion:q}of AB){if(Q.some((z)=>K.includes(z)||G.source.includes(z)))continue;G.lastIndex=0;let W=$.match(G);if(W&&W.length>0){let z=$.split(`
10627
+ `),U=[];z.forEach((_,j)=>{if(G.lastIndex=0,G.test(_))U.push(j+1)});let B=U.length>0?` (line${U.length>1?"s":""}: ${U.join(", ")})`:"";J.push(` \u2717 ${K}${B}
10627
10628
  \u2192 ${q}`)}}if(J.length>0&&X.enabled){let K=`[STX] DOM API violation in ${Z.split("/").pop()||Z}:
10628
10629
  ${J.join(`
10629
10630
  `)}
10630
- Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var VB;var l6=k(()=>{VB=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var yX={};r(yX,{getStoreScript:()=>RB,clearStoreCache:()=>AB});import $7 from"path";async function RB($){let Z;if($)Z=$7.resolve($);else{let U=await q5();Z=$7.resolve(U.root||process.cwd(),U.storesDir||"stores")}let Y=L5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let U of X.scan({cwd:Z,absolute:!0})){let z=$7.basename(U,".ts");if(["index","types"].includes(z))continue;if(U.includes(".d.ts"))continue;Q.push(U)}}catch{return L5.set(Z,""),null}if(Q.length===0)return L5.set(Z,""),null;let J=[];for(let U of Q){let z=await Bun.file(U).text();J.push({file:U,hasUseStore:/useStore\s*\(/.test(z)})}J.sort((U,z)=>{if(U.hasUseStore===z.hasUseStore)return 0;return U.hasUseStore?1:-1});let G=J.map((U)=>U.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()});for(let U of G)try{let z=await Bun.file(U).text(),B=$7.basename(U,".ts");z=z.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),z=z.replace(/^export\s+(default\s+)?/gm,""),z=q.transformSync(z),K.push(`// Store: ${B}
10631
- ${z.trim()}`)}catch(z){console.warn(`[stx] Failed to load store ${U}:`,z)}if(K.length===0)return L5.set(Z,""),null;let W=`;(function(){
10631
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(X.failOnViolation)throw Error(K);else console.warn(K)}}var AB;var l6=k(()=>{AB=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/window\.localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});var CX={};r(CX,{getStoreScript:()=>wB,clearStoreCache:()=>NB});import $7 from"path";async function wB($){let Z;if($)Z=$7.resolve($);else{let z=await q5();Z=$7.resolve(z.root||process.cwd(),z.storesDir||"stores")}let Y=L5.get(Z);if(Y!==void 0)return Y||null;let X=new Bun.Glob("*.ts"),Q=[];try{for await(let z of X.scan({cwd:Z,absolute:!0})){let U=$7.basename(z,".ts");if(["index","types"].includes(U))continue;if(z.includes(".d.ts"))continue;Q.push(z)}}catch{return L5.set(Z,""),null}if(Q.length===0)return L5.set(Z,""),null;let J=[];for(let z of Q){let U=await Bun.file(z).text();J.push({file:z,hasUseStore:/useStore\s*\(/.test(U)})}J.sort((z,U)=>{if(z.hasUseStore===U.hasUseStore)return 0;return z.hasUseStore?1:-1});let G=J.map((z)=>z.file),K=[],q=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()});for(let z of G)try{let U=await Bun.file(z).text(),B=$7.basename(z,".ts");U=U.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),U=U.replace(/^export\s+(default\s+)?/gm,""),U=q.transformSync(U),K.push(`// Store: ${B}
10632
+ ${U.trim()}`)}catch(U){console.warn(`[stx] Failed to load store ${z}:`,U)}if(K.length===0)return L5.set(Z,""),null;let W=`;(function(){
10632
10633
  ${K.join(`
10633
10634
 
10634
10635
  `)}
10635
- })();`;return L5.set(Z,W),W}function AB(){L5.clear()}var L5;var PX=k(()=>{W5();M1();L5=new Map});var vX={};r(vX,{getComposableScript:()=>MB,clearComposableCache:()=>IB});import W$ from"path";function CX($){let Z=W$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function NB($){if($)return W$.resolve($);let Z=`<default>:${process.cwd()}`,Y=p6.get(Z);if(Y!==void 0)return Y;let X=await TB();return p6.set(Z,X),X}async function TB(){let $=await q5(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return W$.resolve(Z,Y);for(let X of wB){let Q=W$.resolve(Z,X);try{let J=new Bun.Glob("**/*.ts");for await(let G of J.scan({cwd:Q,absolute:!0}))if(!CX(G))return Q}catch{}}return null}async function MB($){let Z=await NB($);if(!Z)return null;let Y=F5.get(Z);if(Y!==void 0)return Y||null;let X=[];try{let _=new Bun.Glob("**/*.ts");for await(let j of _.scan({cwd:Z,absolute:!0})){if(CX(j))continue;X.push(j)}}catch{return F5.set(Z,""),null}if(X.length===0)return F5.set(Z,""),null;X.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()}),J=[],G=new Set,K=new Set;for(let _ of X)try{let j=await Bun.file(_).text(),H=W$.basename(_,".ts");for(let L of j.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of Q.scan(j).exports)if(L!=="default")G.add(L)}catch{}j=c0(j),j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(default\s+)?/gm,""),j=Q.transformSync(j),J.push(`// Composable: ${H}
10636
+ })();`;return L5.set(Z,W),W}function NB(){L5.clear()}var L5;var vX=k(()=>{W5();M1();L5=new Map});var fX={};r(fX,{getComposableScript:()=>DB,clearComposableCache:()=>EB});import W$ from"path";function xX($){let Z=W$.basename($,".ts");return Z==="index"||Z==="types"||$.endsWith(".d.ts")}async function MB($){if($)return W$.resolve($);let Z=`<default>:${process.cwd()}`,Y=p6.get(Z);if(Y!==void 0)return Y;let X=await IB();return p6.set(Z,X),X}async function IB(){let $=await q5(),Z=$.root||process.cwd(),Y=$.composablesDir;if(Y)return W$.resolve(Z,Y);for(let X of TB){let Q=W$.resolve(Z,X);try{let J=new Bun.Glob("**/*.ts");for await(let G of J.scan({cwd:Q,absolute:!0}))if(!xX(G))return Q}catch{}}return null}async function DB($){let Z=await MB($);if(!Z)return null;let Y=F5.get(Z);if(Y!==void 0)return Y||null;let X=[];try{let _=new Bun.Glob("**/*.ts");for await(let j of _.scan({cwd:Z,absolute:!0})){if(xX(j))continue;X.push(j)}}catch{return F5.set(Z,""),null}if(X.length===0)return F5.set(Z,""),null;X.sort();let Q=new Bun.Transpiler({loader:"ts",target:"browser",define:d0()}),J=[],G=new Set,K=new Set;for(let _ of X)try{let j=await Bun.file(_).text(),H=W$.basename(_,".ts");for(let L of j.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])K.add(L[1]);try{for(let L of Q.scan(j).exports)if(L!=="default")G.add(L)}catch{}j=c0(j),j=j.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),j=j.replace(/^export\s+(default\s+)?/gm,""),j=Q.transformSync(j),J.push(`// Composable: ${H}
10636
10637
  ${j.trim()}`)}catch(j){console.warn(`[stx] Failed to load composable ${_}:`,j)}if(J.length===0||G.size===0)return F5.set(Z,""),null;let q=[...G].map((_)=>` try { __c[${JSON.stringify(_)}] = ${_}; } catch (e) {}`).join(`
10637
- `),W=JSON.stringify([...G]),U=J.join(`
10638
+ `),W=JSON.stringify([...G]),z=J.join(`
10638
10639
 
10639
10640
  `),B=`;(function(){
10640
10641
  window.__composables = window.__composables || {};
10641
10642
  var __c = window.__composables;
10642
10643
  var __stx = window.stx || {};
10643
- ${D$.filter((_)=>!K.has(_)&&new RegExp(`\\b${_}\\b`).test(U)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
10644
+ ${D$.filter((_)=>!K.has(_)&&new RegExp(`\\b${_}\\b`).test(z)).map((_)=>`var ${_} = __stx[${JSON.stringify(_)}];`).join(`
10644
10645
  `)}
10645
- ${U}
10646
+ ${z}
10646
10647
  ${q}
10647
10648
  var __names = ${W};
10648
10649
  for (var __i = 0; __i < __names.length; __i++) {
@@ -10657,7 +10658,7 @@ ${q}
10657
10658
  }
10658
10659
  window[__n] = __c[__n];
10659
10660
  }
10660
- })();`;return F5.set(Z,B),B}function IB(){F5.clear(),p6.clear()}var F5,p6,wB;var xX=k(()=>{W5();M1();h5();F5=new Map,p6=new Map,wB=["composables","functions"]});var gX={};r(gX,{processDeferDirectives:()=>SB});function DB(){return`stx-defer-${++fX}`}function EB($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function kB($,Z,Y){let{trigger:X,value:Q}=EB(Z),J=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)K=U[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)q=z[2].trim(),J=J.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return J=J.trim(),{trigger:X,triggerValue:Q,content:J,placeholder:G,loading:K,error:q}}function bB($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
10661
+ })();`;return F5.set(Z,B),B}function EB(){F5.clear(),p6.clear()}var F5,p6,TB;var gX=k(()=>{W5();M1();h5();F5=new Map,p6=new Map,TB=["composables","functions"]});var dX={};r(dX,{processDeferDirectives:()=>PB});function kB(){return`stx-defer-${++hX}`}function bB($){let Z=$.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if(Z)return{trigger:Z[1],value:Z[2]};return{trigger:"immediate"}}function SB($,Z,Y){let{trigger:X,value:Q}=bB(Z),J=Y,G,K,q,W=Y.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(W)G=W[1].trim(),J=J.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let z=Y.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(z)K=z[1].trim(),J=J.replace(/@loading[\s\S]*?(?=@error|$)/,"");let U=Y.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(U)q=U[2].trim(),J=J.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return J=J.trim(),{trigger:X,triggerValue:Q,content:J,placeholder:G,loading:K,error:q}}function yB($,Z){let{trigger:Y,triggerValue:X}=Z,Q;switch(Y){case"visible":Q=`
10661
10662
  const observer = new IntersectionObserver((entries) => {
10662
10663
  if (entries[0].isIntersecting) {
10663
10664
  observer.disconnect();
@@ -10730,15 +10731,15 @@ else {
10730
10731
  ${Q}
10731
10732
  })();
10732
10733
  </script>
10733
- `}function SB($,Z,Y){fX=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=DB(),q=kB(Q,J,G),W=q.placeholder?`<div data-defer-placeholder>${q.placeholder}</div>`:"",U=q.loading?`<div data-defer-loading style="display: none;">${q.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=q.error?`<div data-defer-error style="display: none;">${q.error}</div>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,_=bB(K,q);return`
10734
+ `}function PB($,Z,Y){hX=0;let X=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return $.replace(X,(Q,J,G)=>{let K=kB(),q=SB(Q,J,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>`:"",B=`<div data-defer-content style="display: none;">${q.content}</div>`,_=yB(K,q);return`
10734
10735
  <div id="${K}" class="stx-defer" data-defer-trigger="${q.trigger}">
10735
10736
  ${W}
10736
- ${U}
10737
- ${B}
10738
10737
  ${z}
10738
+ ${B}
10739
+ ${U}
10739
10740
  </div>
10740
10741
  ${_}
10741
- `})}var fX=0;var dX={};r(dX,{processTeleportDirectives:()=>vB,ensureTeleportTargets:()=>xB});function yB(){return`stx-teleport-${++hX}`}function PB($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let Q=1;Q<Z.length;Q++){let J=Z[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Y,disabled:X}}function CB($,Z){return`
10742
+ `})}var hX=0;var uX={};r(uX,{processTeleportDirectives:()=>fB,ensureTeleportTargets:()=>gB});function CB(){return`stx-teleport-${++mX}`}function vB($){let Z=$.split(",").map((Q)=>Q.trim()),Y=Z[0].replace(/['"]/g,""),X;for(let Q=1;Q<Z.length;Q++){let J=Z[Q].match(/disabled:\s*(.+)/);if(J)X=J[1].trim()}return{target:Y,disabled:X}}function xB($,Z){return`
10742
10743
  <script>
10743
10744
  (function() {
10744
10745
  const source = document.getElementById('${$}');
@@ -10784,12 +10785,12 @@ else {
10784
10785
  });
10785
10786
  })();
10786
10787
  </script>
10787
- `}function vB($,Z,Y){hX=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=yB(),{target:q,disabled:W}=PB(J),U=G.trim();if(W)try{let B=!1;if(W==="true")B=!0;else if(W==="false")B=!1;else if(W in Z)B=Boolean(Z[W]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=CB(K,q);return`
10788
+ `}function fB($,Z,Y){mX=0;let X=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return $.replace(X,(Q,J,G)=>{let K=CB(),{target:q,disabled:W}=vB(J),z=G.trim();if(W)try{let B=!1;if(W==="true")B=!0;else if(W==="false")B=!1;else if(W in Z)B=Boolean(Z[W]);if(B)return`<div class="stx-teleport-inline" data-teleport-disabled>${z}</div>`}catch{}let U=xB(K,q);return`
10788
10789
  <div id="${K}" class="stx-teleport-source" style="display: none;">
10789
- <template>${U}</template>
10790
+ <template>${z}</template>
10790
10791
  </div>
10791
- ${z}
10792
- `})}function xB(){return`
10792
+ ${U}
10793
+ `})}function gB(){return`
10793
10794
  <script>
10794
10795
  (function() {
10795
10796
  // Common teleport targets
@@ -10806,11 +10807,11 @@ else {
10806
10807
  });
10807
10808
  })();
10808
10809
  </script>
10809
- `}var hX=0;var pX={};r(pX,{processTransitionDirectives:()=>dB,processTransitionAttributes:()=>pB,performLeave:()=>hB,performEnter:()=>gB,generateTransitionRuntime:()=>lB,generateTransitionCSS:()=>uB});function mX($,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 fB($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",Q=(J)=>{let G=J.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Y),Q(X))}function uX($,Z){return new Promise((Y)=>{let X=Z??fB($);if(X===0){Y();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function lX($){$.offsetHeight}async function gB($,Z={}){let Y=Z.name||"stx",X=mX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),lX($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await uX($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function hB($,Z={}){let Y=Z.name||"stx",X=mX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),lX($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await uX($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function dB($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=mB(J),q=K.name||"stx",W=K.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
10810
+ `}var mX=0;var iX={};r(iX,{processTransitionDirectives:()=>uB,processTransitionAttributes:()=>iB,performLeave:()=>mB,performEnter:()=>dB,generateTransitionRuntime:()=>cB,generateTransitionCSS:()=>pB});function lX($,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 hB($){let Z=getComputedStyle($),Y=Z.transitionDuration||"0s",X=Z.animationDuration||"0s",Q=(J)=>{let G=J.match(/^([\d.]+)(s|ms)?$/);if(!G)return 0;let K=parseFloat(G[1]);return(G[2]||"s")==="ms"?K:K*1000};return Math.max(Q(Y),Q(X))}function pX($,Z){return new Promise((Y)=>{let X=Z??hB($);if(X===0){Y();return}let Q=!1,J=()=>{if(Q)return;Q=!0,$.removeEventListener("transitionend",G),$.removeEventListener("animationend",G),Y()},G=(K)=>{if(K.target===$)J()};$.addEventListener("transitionend",G),$.addEventListener("animationend",G),setTimeout(J,X+50)})}function cX($){$.offsetHeight}async function dB($,Z={}){let Y=Z.name||"stx",X=lX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.enter:Z.duration;if(Z.onBeforeEnter?.($),$.classList.add(X.enterFrom),$.classList.add(X.enterActive),cX($),$.classList.remove(X.enterFrom),$.classList.add(X.enterTo),Z.onEnter)await new Promise((J)=>{Z.onEnter($,J)});else await pX($,Q);$.classList.remove(X.enterActive),$.classList.remove(X.enterTo),Z.onAfterEnter?.($)}async function mB($,Z={}){let Y=Z.name||"stx",X=lX(Y,Z),Q=typeof Z.duration==="object"?Z.duration.leave:Z.duration;if(Z.onBeforeLeave?.($),$.classList.add(X.leaveFrom),$.classList.add(X.leaveActive),cX($),$.classList.remove(X.leaveFrom),$.classList.add(X.leaveTo),Z.onLeave)await new Promise((J)=>{Z.onLeave($,J)});else await pX($,Q);$.classList.remove(X.leaveActive),$.classList.remove(X.leaveTo),Z.onAfterLeave?.($)}function uB($,Z={},Y){let X=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return $.replace(X,(Q,J,G)=>{let K=lB(J),q=K.name||"stx",W=K.duration||300,z=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
10810
10811
  <div
10811
10812
  class="stx-transition-wrapper"
10812
10813
  data-transition="${q}"
10813
- data-transition-id="${U}"
10814
+ data-transition-id="${z}"
10814
10815
  data-transition-duration="${W}"
10815
10816
  ${K.mode?`data-transition-mode="${K.mode}"`:""}
10816
10817
  >
@@ -10818,7 +10819,7 @@ else {
10818
10819
  </div>
10819
10820
  <script>
10820
10821
  (function() {
10821
- const wrapper = document.querySelector('[data-transition-id="${U}"]');
10822
+ const wrapper = document.querySelector('[data-transition-id="${z}"]');
10822
10823
  if (!wrapper) return;
10823
10824
 
10824
10825
  const name = '${q}';
@@ -10848,7 +10849,7 @@ else {
10848
10849
  });
10849
10850
  })();
10850
10851
  </script>
10851
- `})}function mB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Z.name=J;break;case"duration":Z.duration=parseInt(J,10);break;case"mode":Z.mode=J;break;case"easing":Z.easing=J;break}}return Z}function uB(){return`
10852
+ `})}function lB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4]||X[5];switch(Q){case"name":Z.name=J;break;case"duration":Z.duration=parseInt(J,10);break;case"mode":Z.mode=J;break;case"easing":Z.easing=J;break}}return Z}function pB(){return`
10852
10853
  /* STX Transition Presets */
10853
10854
 
10854
10855
  /* Fade */
@@ -11035,7 +11036,7 @@ else {
11035
11036
  opacity: 1;
11036
11037
  max-height: 1000px;
11037
11038
  }
11038
- `}function lB(){return`
11039
+ `}function cB(){return`
11039
11040
  // STX Transition Runtime
11040
11041
  (function() {
11041
11042
  if (typeof window === 'undefined') return;
@@ -11124,7 +11125,7 @@ else {
11124
11125
 
11125
11126
  console.log('[stx] Transition runtime initialized');
11126
11127
  })();
11127
- `}function pB($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,Q,J)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${J}" data-stx-transition-id="${K}"`})}var iX={};r(iX,{withErrorBoundary:()=>cX,processErrorBoundaryDirectives:()=>nB,generateErrorBoundaryRuntime:()=>tB,generateErrorBoundaryCSS:()=>aB,createErrorBoundary:()=>rB});function iB(){return`eb-${++cB}-${Date.now().toString(36)}`}function nB($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=iB(),W=oB(J||"");return sB(q,G.trim(),K.trim(),W)})}function oB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Z.id=J;break;case"logErrors":Z.logErrors=J==="true";break}}return Z}function sB($,Z,Y,X){let Q=X.logErrors!==!1;return`
11128
+ `}function iB($){let Z=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return $.replace(Z,(Y,X,Q,J)=>{let G=Q||"300",K=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${X}" data-stx-transition-duration="${G}" data-stx-transition-condition="${J}" data-stx-transition-id="${K}"`})}var oX={};r(oX,{withErrorBoundary:()=>nX,processErrorBoundaryDirectives:()=>sB,generateErrorBoundaryRuntime:()=>$j,generateErrorBoundaryCSS:()=>eB,createErrorBoundary:()=>tB});function oB(){return`eb-${++nB}-${Date.now().toString(36)}`}function sB($,Z={},Y){let X=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return $.replace(X,(Q,J,G,K)=>{let q=oB(),W=rB(J||"");return aB(q,G.trim(),K.trim(),W)})}function rB($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3]||X[4];switch(Q){case"id":Z.id=J;break;case"logErrors":Z.logErrors=J==="true";break}}return Z}function aB($,Z,Y,X){let Q=X.logErrors!==!1;return`
11128
11129
  <div class="stx-error-boundary" data-boundary-id="${$}" data-has-error="false">
11129
11130
  <div class="stx-error-boundary-content" data-boundary-content="${$}">
11130
11131
  ${Z}
@@ -11244,7 +11245,7 @@ else {
11244
11245
  };
11245
11246
  })();
11246
11247
  </script>
11247
- `}async function cX($,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 rB($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>cX(X,$,Y)}function aB(){return`
11248
+ `}async function nX($,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 tB($,Z={}){let Y=Z.onError?(X)=>Z.onError(X,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(X)=>nX(X,$,Y)}function eB(){return`
11248
11249
  /* STX Error Boundary Styles */
11249
11250
  .stx-error-boundary {
11250
11251
  position: relative;
@@ -11288,7 +11289,7 @@ else {
11288
11289
  color: #fecaca;
11289
11290
  }
11290
11291
  }
11291
- `}function tB(){return`
11292
+ `}function $j(){return`
11292
11293
  // STX Error Boundary Runtime
11293
11294
  (function() {
11294
11295
  if (typeof window === 'undefined') return;
@@ -11353,7 +11354,7 @@ else {
11353
11354
 
11354
11355
  console.log('[stx] Error boundary runtime initialized');
11355
11356
  })();
11356
- `}var cB=0;var nX={};r(nX,{renderSSRSuspense:()=>Qj,processSuspenseDirectives:()=>Zj,generateSuspenseRuntime:()=>Kj,generateSuspenseCSS:()=>Gj,createSSRSuspense:()=>Jj});function $j(){return`suspense-${++eB}-${Date.now().toString(36)}`}function Zj($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=$j(),W=Yj(J||"");return Xj(q,G.trim(),K.trim(),W)})}function Yj($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function Xj($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
11357
+ `}var nB=0;var sX={};r(sX,{renderSSRSuspense:()=>Kj,processSuspenseDirectives:()=>Xj,generateSuspenseRuntime:()=>Wj,generateSuspenseCSS:()=>qj,createSSRSuspense:()=>Gj});function Yj(){return`suspense-${++Zj}-${Date.now().toString(36)}`}function Xj($,Z={},Y){let X=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return $.replace(X,(Q,J,G,K)=>{let q=Yj(),W=Jj(J||"");return Qj(q,G.trim(),K.trim(),W)})}function Jj($){let Z={},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"id":Z.id=J;break;case"timeout":Z.timeout=G?parseInt(G,10):void 0;break}}return Z}function Qj($,Z,Y,X){let Q=X.timeout||30000,J=X.id||$;return`
11357
11358
  <div class="stx-suspense" data-suspense-id="${$}" data-custom-id="${J}" data-status="pending">
11358
11359
  <div class="stx-suspense-fallback" data-suspense-fallback="${$}">
11359
11360
  ${Y}
@@ -11543,7 +11544,7 @@ else {
11543
11544
  }, 0);
11544
11545
  })();
11545
11546
  </script>
11546
- `}function Jj($,Z,Y){return{id:$,fallback:Y,content:Z}}async function Qj($){let Z=$.map((X)=>`
11547
+ `}function Gj($,Z,Y){return{id:$,fallback:Y,content:Z}}async function Kj($){let Z=$.map((X)=>`
11547
11548
  <div id="stx-ssr-suspense-${X.id}" class="stx-ssr-suspense">
11548
11549
  ${X.fallback}
11549
11550
  </div>
@@ -11568,7 +11569,7 @@ else {
11568
11569
  }
11569
11570
  })();
11570
11571
  </script>
11571
- `}}return{initial:Z,streaming:Y()}}function Gj(){return`
11572
+ `}}return{initial:Z,streaming:Y()}}function qj(){return`
11572
11573
  /* STX Suspense Styles */
11573
11574
  .stx-suspense {
11574
11575
  position: relative;
@@ -11624,7 +11625,7 @@ else {
11624
11625
  background-size: 200% 100%;
11625
11626
  }
11626
11627
  }
11627
- `}function Kj(){return`
11628
+ `}function Wj(){return`
11628
11629
  // STX Suspense Runtime
11629
11630
  (function() {
11630
11631
  if (typeof window === 'undefined') return;
@@ -11691,7 +11692,7 @@ else {
11691
11692
 
11692
11693
  console.log('[stx] Suspense runtime initialized');
11693
11694
  })();
11694
- `}var eB=0;var aX={};r(aX,{processAsyncDirectives:()=>Wj,isAsyncComponent:()=>zj,generateAsyncComponentRuntime:()=>jj,generateAsyncComponentCSS:()=>Bj,defineAsyncComponent:()=>Uj});function oX(){return`async-${++qj}-${Date.now().toString(36)}`}function Wj($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,W)=>{let U=oX(),z=sX(K);return rX(U,z,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=oX(),U=sX(K);return rX(W,U,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function sX($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function rX($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
11695
+ `}var Zj=0;var eX={};r(eX,{processAsyncDirectives:()=>Uj,isAsyncComponent:()=>jj,generateAsyncComponentRuntime:()=>Hj,generateAsyncComponentCSS:()=>_j,defineAsyncComponent:()=>Bj});function rX(){return`async-${++zj}-${Date.now().toString(36)}`}function Uj($,Z={},Y){let X=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,Q=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,J=$;return J=J.replace(X,(G,K,q,W)=>{let z=rX(),U=aX(K);return tX(z,U,q.trim(),W.trim())}),J=J.replace(Q,(G,K,q)=>{let W=rX(),z=aX(K);return tX(W,z,q.trim(),'<div class="stx-async-error">Failed to load component</div>')}),J}function aX($){let Z={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4],K=X[5];switch(Q){case"component":Z.component=J||K||"";break;case"timeout":Z.timeout=G?parseInt(G,10):30000;break;case"delay":Z.delay=G?parseInt(G,10):200;break;case"suspensible":Z.suspensible=K==="true";break;case"retries":Z.retries=G?parseInt(G,10):0;break;case"loadingComponent":Z.loadingComponent=J||K;break;case"errorComponent":Z.errorComponent=J||K;break}}return Z}function tX($,Z,Y,X){let{component:Q,timeout:J,delay:G,suspensible:K,retries:q}=Z;return`
11695
11696
  <div class="stx-async-component" data-async-id="${$}" data-component="${Q}" data-status="pending">
11696
11697
  <div class="stx-async-loading" data-async-loading="${$}">
11697
11698
  ${Y}
@@ -11918,7 +11919,7 @@ catch (error) {
11918
11919
  loadComponent();
11919
11920
  })();
11920
11921
  </script>
11921
- `}function Uj($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function zj($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function Bj(){return`
11922
+ `}function Bj($){return{__asyncComponent:!0,...typeof $==="function"?{loader:$}:$}}function jj($){return typeof $==="object"&&$!==null&&"__asyncComponent"in $&&$.__asyncComponent===!0}function _j(){return`
11922
11923
  /* STX Async Component Styles */
11923
11924
  .stx-async-component {
11924
11925
  position: relative;
@@ -11992,7 +11993,7 @@ catch (error) {
11992
11993
  background-size: 200% 100%;
11993
11994
  }
11994
11995
  }
11995
- `}function jj(){return`
11996
+ `}function Hj(){return`
11996
11997
  // STX Async Component Runtime
11997
11998
  (function() {
11998
11999
  if (typeof window === 'undefined') return;
@@ -12046,7 +12047,7 @@ catch (error) {
12046
12047
 
12047
12048
  console.log('[stx] Async component runtime initialized');
12048
12049
  })();
12049
- `}var qj=0;var eX={};r(eX,{shouldCacheComponent:()=>Vj,processKeepAliveDirectives:()=>Hj,onDeactivated:()=>Nj,onActivated:()=>wj,generateKeepAliveRuntime:()=>Aj,generateKeepAliveCSS:()=>Rj,createKeepAliveCache:()=>Fj});function tX(){return`keep-alive-${++_j}-${Date.now().toString(36)}`}function Hj($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=tX(),q=Oj(J||"");return Lj(K,G.trim(),q)})}function Oj($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function Lj($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
12050
+ `}var zj=0;var ZJ={};r(ZJ,{shouldCacheComponent:()=>Aj,processKeepAliveDirectives:()=>Lj,onDeactivated:()=>Mj,onActivated:()=>Tj,generateKeepAliveRuntime:()=>Nj,generateKeepAliveCSS:()=>wj,createKeepAliveCache:()=>Rj});function $J(){return`keep-alive-${++Oj}-${Date.now().toString(36)}`}function Lj($,Z={},Y){let X=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return $.replace(X,(Q,J,G)=>{let K=$J(),q=Fj(J||"");return Vj(K,G.trim(),q)})}function Fj($){let Z={max:10},Y=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,X;while((X=Y.exec($))!==null){let Q=X[1],J=X[2]||X[3],G=X[4];switch(Q){case"max":Z.max=G?parseInt(G,10):10;break;case"include":Z.include=J;break;case"exclude":Z.exclude=J;break;case"id":Z.id=J;break}}return Z}function Vj($,Z,Y){let{max:X,include:Q,exclude:J}=Y,G=Y.id||$;return`
12050
12051
  <div class="stx-keep-alive" data-keep-alive-id="${$}" data-custom-id="${G}">
12051
12052
  <div class="stx-keep-alive-content" data-keep-alive-content="${$}">
12052
12053
  ${Z}
@@ -12333,7 +12334,7 @@ else {
12333
12334
  });
12334
12335
  })();
12335
12336
  </script>
12336
- `}function Fj($={}){return{id:$.id||tX(),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 Vj($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function Rj(){return`
12337
+ `}function Rj($={}){return{id:$.id||$J(),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 Aj($,Z){if(Z.exclude&&Z.exclude.includes($))return!1;if(Z.include&&!Z.include.includes($))return!1;return!0}function wj(){return`
12337
12338
  /* STX Keep-Alive Styles */
12338
12339
  .stx-keep-alive {
12339
12340
  position: relative;
@@ -12358,7 +12359,7 @@ else {
12358
12359
  .stx-keep-alive-content > [data-activated] {
12359
12360
  opacity: 1;
12360
12361
  }
12361
- `}function Aj(){return`
12362
+ `}function Nj(){return`
12362
12363
  // STX Keep-Alive Runtime
12363
12364
  (function() {
12364
12365
  if (typeof window === 'undefined') return;
@@ -12394,33 +12395,33 @@ else {
12394
12395
 
12395
12396
  console.log('[stx] Keep-alive runtime initialized');
12396
12397
  })();
12397
- `}function wj($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function Nj($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var _j=0;var JJ={};r(JJ,{useVirtualList:()=>ZJ,processVirtualListDirectives:()=>i6,processVirtualGridDirectives:()=>XJ,processInfiniteListDirectives:()=>YJ,generateVirtualListCSS:()=>$J,default:()=>Tj,createVirtualList:()=>c6});function c6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],U=0,z=new Map;function B(){if(G)return _();let w=Math.max(0,Math.floor(U/Y)-Q),N=Math.ceil(X/Y),T=Math.min(W.length-1,w+N+Q*2);return{startIndex:w,endIndex:T}}function _(){let w=0,N=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(w+I>U){N=Math.max(0,M-Q);break}w+=I}w=0;for(let M=0;M<W.length;M++){let I=z.get(M)||K;if(w+=I,w>U+X){T=Math.min(W.length-1,M+Q);break}}return{startIndex:N,endIndex:T}}function j(){if(G){let w=0;for(let N=0;N<W.length;N++)w+=z.get(N)||K;return w}return W.length*Y}function H(w){if(G){let N=0;for(let T=0;T<w;T++)N+=z.get(T)||K;return N}return w*Y}function L(){let{startIndex:w,endIndex:N}=B();return{startIndex:w,endIndex:N,scrollTop:U,totalHeight:j(),visibleItems:W.slice(w,N+1),itemHeights:new Map(z)}}function F(w,N="auto"){let T=H(w);O(T,N)}function O(w,N="auto"){U=Math.max(0,Math.min(w,j()-X))}function V(){B()}function R(w){W=[...w],z.clear(),V()}function A(){W=[],z.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:R,destroy:A}}function i6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();U={...U,...V}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(U.containerHeight/U.itemHeight),_=U.overscan||3,j=0,H=Math.min(W.length-1,B+_),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],R=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,w)=>{if(typeof V==="object"&&V!==null)return String(V[w]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
12398
- <div class="virtual-item ${U.itemClass||""}"
12399
- style="position: absolute; top: ${O*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
12398
+ `}function Tj($){if(typeof document<"u")document.addEventListener("stx:activated",(Z)=>{$(Z.detail)})}function Mj($){if(typeof document<"u")document.addEventListener("stx:deactivated",(Z)=>{$(Z.detail)})}var Oj=0;var GJ={};r(GJ,{useVirtualList:()=>XJ,processVirtualListDirectives:()=>i6,processVirtualGridDirectives:()=>QJ,processInfiniteListDirectives:()=>JJ,generateVirtualListCSS:()=>YJ,default:()=>Ij,createVirtualList:()=>c6});function c6($,Z){let{itemHeight:Y,containerHeight:X,overscan:Q=3,keyProperty:J="id",dynamicHeight:G=!1,estimatedItemHeight:K=Y,direction:q="vertical"}=Z,W=[...$],z=0,U=new Map;function B(){if(G)return _();let w=Math.max(0,Math.floor(z/Y)-Q),N=Math.ceil(X/Y),T=Math.min(W.length-1,w+N+Q*2);return{startIndex:w,endIndex:T}}function _(){let w=0,N=0,T=W.length-1;for(let M=0;M<W.length;M++){let I=U.get(M)||K;if(w+I>z){N=Math.max(0,M-Q);break}w+=I}w=0;for(let M=0;M<W.length;M++){let I=U.get(M)||K;if(w+=I,w>z+X){T=Math.min(W.length-1,M+Q);break}}return{startIndex:N,endIndex:T}}function j(){if(G){let w=0;for(let N=0;N<W.length;N++)w+=U.get(N)||K;return w}return W.length*Y}function H(w){if(G){let N=0;for(let T=0;T<w;T++)N+=U.get(T)||K;return N}return w*Y}function L(){let{startIndex:w,endIndex:N}=B();return{startIndex:w,endIndex:N,scrollTop:z,totalHeight:j(),visibleItems:W.slice(w,N+1),itemHeights:new Map(U)}}function F(w,N="auto"){let T=H(w);O(T,N)}function O(w,N="auto"){z=Math.max(0,Math.min(w,j()-X))}function V(){B()}function R(w){W=[...w],U.clear(),V()}function A(){W=[],U.clear()}return{scrollToIndex:F,scrollToOffset:O,getState:L,refresh:V,setItems:R,destroy:A}}function i6($,Z={},Y){let X=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualList: items "${q}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3};if(G)try{let O=G.trim(),V=Function(`return ${O}`)();z={...z,...V}}catch{}let U=`vlist-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(z.containerHeight/z.itemHeight),_=z.overscan||3,j=0,H=Math.min(W.length-1,B+_),L="";for(let O=j;O<=H&&O<W.length;O++){let V=W[O],R=K.replace(/\{\{\s*item\s*\}\}/g,typeof V==="object"?JSON.stringify(V):String(V)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,w)=>{if(typeof V==="object"&&V!==null)return String(V[w]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));L+=`
12399
+ <div class="virtual-item ${z.itemClass||""}"
12400
+ style="position: absolute; top: ${O*z.itemHeight}px; height: ${z.itemHeight}px; width: 100%;"
12400
12401
  data-index="${O}">
12401
12402
  ${R}
12402
- </div>`}let F=W.length*U.itemHeight;return`
12403
- <div id="${z}"
12404
- class="virtual-list-container ${U.containerClass||""}"
12405
- style="position: relative; height: ${U.containerHeight}px; overflow-y: auto;"
12406
- data-item-height="${U.itemHeight}"
12403
+ </div>`}let F=W.length*z.itemHeight;return`
12404
+ <div id="${U}"
12405
+ class="virtual-list-container ${z.containerClass||""}"
12406
+ style="position: relative; height: ${z.containerHeight}px; overflow-y: auto;"
12407
+ data-item-height="${z.itemHeight}"
12407
12408
  data-total-items="${W.length}"
12408
12409
  data-overscan="${_}">
12409
- <div class="virtual-list-viewport ${U.viewportClass||""}"
12410
+ <div class="virtual-list-viewport ${z.viewportClass||""}"
12410
12411
  style="position: relative; height: ${F}px; width: 100%;">
12411
12412
  ${L}
12412
12413
  </div>
12413
12414
  </div>
12414
- <script data-virtual-list="${z}">
12415
+ <script data-virtual-list="${U}">
12415
12416
  (function() {
12416
- const container = document.getElementById('${z}');
12417
+ const container = document.getElementById('${U}');
12417
12418
  if (!container) return;
12418
12419
 
12419
12420
  const viewport = container.querySelector('.virtual-list-viewport');
12420
- const itemHeight = ${U.itemHeight};
12421
+ const itemHeight = ${z.itemHeight};
12421
12422
  const totalItems = ${W.length};
12422
12423
  const overscan = ${_};
12423
- const containerHeight = ${U.containerHeight};
12424
+ const containerHeight = ${z.containerHeight};
12424
12425
  const items = ${JSON.stringify(W)};
12425
12426
  const template = ${JSON.stringify(K.trim())};
12426
12427
 
@@ -12440,7 +12441,7 @@ else {
12440
12441
  for (let i = startIndex; i <= endIndex; i++) {
12441
12442
  const item = items[i];
12442
12443
  const div = document.createElement('div');
12443
- div.className = 'virtual-item ${U.itemClass||""}';
12444
+ div.className = 'virtual-item ${z.itemClass||""}';
12444
12445
  div.style.cssText = 'position: absolute; top: ' + (i * itemHeight) + 'px; height: ' + itemHeight + 'px; width: 100%;';
12445
12446
  div.dataset.index = i;
12446
12447
 
@@ -12471,7 +12472,7 @@ else {
12471
12472
  };
12472
12473
  })();
12473
12474
  </script>
12474
- `})}function $J(){return`
12475
+ `})}function YJ(){return`
12475
12476
  .virtual-list-container {
12476
12477
  position: relative;
12477
12478
  overflow-y: auto;
@@ -12519,11 +12520,11 @@ else {
12519
12520
  0% { background-position: 200% 0; }
12520
12521
  100% { background-position: -200% 0; }
12521
12522
  }
12522
- `}function ZJ($,Z){let Y=null,X=()=>{if(!Y)Y=c6($(),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:(Q)=>{let J=Q.target;if(Y)Y.scrollToOffset(J.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{X().scrollToIndex(Q)}}}function YJ($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(Q,J,G,K,q)=>{let W=J.trim(),U=Z[W];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${W}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(G)try{let j=Function(`return ${G.trim()}`)();z={...z,...j}}catch{}let B=`ilist-${Math.random().toString(36).substring(2,9)}`,_=i6(`@virtualList(${W}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
12523
+ `}function XJ($,Z){let Y=null,X=()=>{if(!Y)Y=c6($(),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:(Q)=>{let J=Q.target;if(Y)Y.scrollToOffset(J.scrollTop)}}),itemProps:(Q)=>({style:{position:"absolute",top:`${Q*Z.itemHeight}px`,height:`${Z.itemHeight}px`,width:"100%"},"data-index":Q}),scrollToIndex:(Q)=>{X().scrollToIndex(Q)}}}function JJ($,Z={},Y){let X=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return $.replace(X,(Q,J,G,K,q)=>{let W=J.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 j=Function(`return ${G.trim()}`)();U={...U,...j}}catch{}let B=`ilist-${Math.random().toString(36).substring(2,9)}`,_=i6(`@virtualList(${W}, ${JSON.stringify({itemHeight:U.itemHeight,containerHeight:U.containerHeight,overscan:U.overscan,containerClass:U.containerClass})})${K}@endvirtualList`,Z);return _=_.replace("</script>",`
12523
12524
  // Infinite scroll detection
12524
12525
  container.addEventListener('scroll', function() {
12525
12526
  const scrollBottom = container.scrollTop + container.clientHeight;
12526
- const threshold = ${z.threshold};
12527
+ const threshold = ${U.threshold};
12527
12528
  const totalHeight = viewport.offsetHeight;
12528
12529
 
12529
12530
  if (scrollBottom >= totalHeight - threshold) {
@@ -12537,32 +12538,32 @@ else {
12537
12538
  ${q}
12538
12539
  </div>
12539
12540
  </div>
12540
- `})}function XJ($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.trim(),W=Z[q];if(!W||!Array.isArray(W))return`<!-- virtualGrid: items "${q}" not found or not an array -->`;let U={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(G)try{let V=Function(`return ${G.trim()}`)();U={...U,...V}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,B=Math.ceil(W.length/U.columns),_=B*(U.rowHeight+(U.gap||0)),j=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),H=U.overscan||2,L=0,F=Math.min(B-1,j+H),O="";for(let V=L;V<=F;V++)for(let R=0;R<U.columns;R++){let A=V*U.columns+R;if(A>=W.length)break;let w=W[A],N=R*(100/U.columns),T=V*(U.rowHeight+(U.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof w==="object"?JSON.stringify(w):String(w)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,E)=>{if(typeof w==="object"&&w!==null)return String(w[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
12541
+ `})}function QJ($,Z={},Y){let X=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return $.replace(X,(Q,J,G,K)=>{let q=J.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)}`,B=Math.ceil(W.length/z.columns),_=B*(z.rowHeight+(z.gap||0)),j=Math.ceil(z.containerHeight/(z.rowHeight+(z.gap||0))),H=z.overscan||2,L=0,F=Math.min(B-1,j+H),O="";for(let V=L;V<=F;V++)for(let R=0;R<z.columns;R++){let A=V*z.columns+R;if(A>=W.length)break;let w=W[A],N=R*(100/z.columns),T=V*(z.rowHeight+(z.gap||0)),M=K.replace(/\{\{\s*item\s*\}\}/g,typeof w==="object"?JSON.stringify(w):String(w)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(I,E)=>{if(typeof w==="object"&&w!==null)return String(w[E]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
12541
12542
  <div class="virtual-grid-item"
12542
- style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
12543
+ style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/z.columns}% - ${z.gap||0}px); height: ${z.rowHeight}px;"
12543
12544
  data-index="${A}">
12544
12545
  ${M}
12545
12546
  </div>`}return`
12546
- <div id="${z}"
12547
+ <div id="${U}"
12547
12548
  class="virtual-grid-container"
12548
- style="position: relative; height: ${U.containerHeight}px; overflow-y: auto;">
12549
+ style="position: relative; height: ${z.containerHeight}px; overflow-y: auto;">
12549
12550
  <div class="virtual-grid-viewport"
12550
12551
  style="position: relative; height: ${_}px; width: 100%;">
12551
12552
  ${O}
12552
12553
  </div>
12553
12554
  </div>
12554
- <script data-virtual-grid="${z}">
12555
+ <script data-virtual-grid="${U}">
12555
12556
  (function() {
12556
- const container = document.getElementById('${z}');
12557
+ const container = document.getElementById('${U}');
12557
12558
  if (!container) return;
12558
12559
 
12559
12560
  const viewport = container.querySelector('.virtual-grid-viewport');
12560
- const columns = ${U.columns};
12561
- const rowHeight = ${U.rowHeight};
12562
- const gap = ${U.gap||0};
12561
+ const columns = ${z.columns};
12562
+ const rowHeight = ${z.rowHeight};
12563
+ const gap = ${z.gap||0};
12563
12564
  const totalItems = ${W.length};
12564
12565
  const overscan = ${H};
12565
- const containerHeight = ${U.containerHeight};
12566
+ const containerHeight = ${z.containerHeight};
12566
12567
  const items = ${JSON.stringify(W)};
12567
12568
  const template = ${JSON.stringify(K.trim())};
12568
12569
 
@@ -12607,7 +12608,7 @@ else {
12607
12608
  });
12608
12609
  })();
12609
12610
  </script>
12610
- `})}var Tj;var QJ=k(()=>{Tj={createVirtualList:c6,processVirtualListDirectives:i6,processInfiniteListDirectives:YJ,processVirtualGridDirectives:XJ,generateVirtualListCSS:$J,useVirtualList:ZJ}});function GJ(){return`<script data-stx-hydration-runtime>
12611
+ `})}var Ij;var KJ=k(()=>{Ij={createVirtualList:c6,processVirtualListDirectives:i6,processInfiniteListDirectives:JJ,processVirtualGridDirectives:QJ,generateVirtualListCSS:YJ,useVirtualList:XJ}});function qJ(){return`<script data-stx-hydration-runtime>
12611
12612
  (function() {
12612
12613
  'use strict';
12613
12614
 
@@ -12767,7 +12768,7 @@ else {
12767
12768
  stxIslands.initIslands();
12768
12769
  }
12769
12770
  })();
12770
- </script>`}function KJ($){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 qJ($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var VJ={};r(VJ,{processStaticDirectives:()=>LJ,processPartialHydrationDirectives:()=>UJ,onHydrated:()=>OJ,isHydrated:()=>HJ,hydrateIsland:()=>BJ,hydrateByStrategy:()=>jJ,hydrateAll:()=>_J,generatePartialHydrationCSS:()=>zJ,generateIslandManifest:()=>FJ,default:()=>yj,createIslandRegistry:()=>WJ});function WJ(){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 Mj($){return`
12771
+ </script>`}function WJ($){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 zJ($,Z){let Y={},X=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(G in Z)Y[J]=Z[G];else Y[J]=G}return Y}var AJ={};r(AJ,{processStaticDirectives:()=>VJ,processPartialHydrationDirectives:()=>BJ,onHydrated:()=>FJ,isHydrated:()=>LJ,hydrateIsland:()=>_J,hydrateByStrategy:()=>HJ,hydrateAll:()=>OJ,generatePartialHydrationCSS:()=>jJ,generateIslandManifest:()=>RJ,default:()=>Cj,createIslandRegistry:()=>UJ});function UJ(){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 Dj($){return`
12771
12772
  <script data-hydrate="${$}">
12772
12773
  (function() {
12773
12774
  const island = document.querySelector('[data-island="${$}"]');
@@ -12778,7 +12779,7 @@ else {
12778
12779
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
12779
12780
  })();
12780
12781
  </script>
12781
- `}function Ij($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
12782
+ `}function Ej($,Z){let Y=Z.timeout||2000,X=Z.priority||"low";return`
12782
12783
  <script data-hydrate="${$}">
12783
12784
  (function() {
12784
12785
  const island = document.querySelector('[data-island="${$}"]');
@@ -12814,7 +12815,7 @@ else {
12814
12815
  }
12815
12816
  })();
12816
12817
  </script>
12817
- `}function Dj($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
12818
+ `}function kj($,Z){let Y=Z.rootMargin||"0px",X=Z.threshold||0;return`
12818
12819
  <script data-hydrate="${$}">
12819
12820
  (function() {
12820
12821
  const island = document.querySelector('[data-island="${$}"]');
@@ -12847,7 +12848,7 @@ else {
12847
12848
  }
12848
12849
  })();
12849
12850
  </script>
12850
- `}function Ej($,Z){let Y=Z.media||"(min-width: 768px)";return`
12851
+ `}function bj($,Z){let Y=Z.media||"(min-width: 768px)";return`
12851
12852
  <script data-hydrate="${$}">
12852
12853
  (function() {
12853
12854
  const island = document.querySelector('[data-island="${$}"]');
@@ -12876,7 +12877,7 @@ else {
12876
12877
  }
12877
12878
  })();
12878
12879
  </script>
12879
- `}function kj($){return`
12880
+ `}function Sj($){return`
12880
12881
  <script data-hydrate="${$}">
12881
12882
  (function() {
12882
12883
  const island = document.querySelector('[data-island="${$}"]');
@@ -12898,7 +12899,7 @@ else {
12898
12899
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
12899
12900
  })();
12900
12901
  </script>
12901
- `}function bj($,Z){let Y=Z.event||"stx:activate";return`
12902
+ `}function yj($,Z){let Y=Z.event||"stx:activate";return`
12902
12903
  <script data-hydrate="${$}">
12903
12904
  (function() {
12904
12905
  const island = document.querySelector('[data-island="${$}"]');
@@ -12919,19 +12920,19 @@ else {
12919
12920
  });
12920
12921
  })();
12921
12922
  </script>
12922
- `}function UJ($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=V5(X,"load",Z),X=V5(X,"idle",Z),X=V5(X,"visible",Z),X=V5(X,"media",Z),X=Sj(X),X=V5(X,"hover",Z),X=V5(X,"event",Z),Q=J&&X!==$,Q)X+=`
12923
- `+GJ();return X}function V5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Z};if(J)try{let H=J.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=KJ(G.trim()),U=qJ(G.trim(),Y),z=[];if(K.rootMargin)z.push(`data-root-margin="${K.rootMargin}"`);if(K.threshold!==void 0)z.push(`data-threshold="${K.threshold}"`);if(K.media)z.push(`data-media="${K.media}"`);if(K.event)z.push(`data-event="${K.event}"`);if(W)z.push(`data-component="${W}"`);let _=Object.keys(U).length>0?`
12924
- <script type="application/json" data-island-props="${q}">${JSON.stringify(U)}</script>`:"",j="";switch(Z){case"load":j=Mj(q);break;case"idle":j=Ij(q,K);break;case"visible":j=Dj(q,K);break;case"media":j=Ej(q,K);break;case"hover":j=kj(q);break;case"event":j=bj(q,K);break}return`
12923
+ `}function BJ($,Z={},Y){let X=$,Q=!1,J=/@client:(load|idle|visible|media|only|hover|event)/i.test($);if(X=V5(X,"load",Z),X=V5(X,"idle",Z),X=V5(X,"visible",Z),X=V5(X,"media",Z),X=Pj(X),X=V5(X,"hover",Z),X=V5(X,"event",Z),Q=J&&X!==$,Q)X+=`
12924
+ `+qJ();return X}function V5($,Z,Y){let X=new RegExp(`@client:${Z}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return $.replace(X,(Q,J,G)=>{let K={strategy:Z};if(J)try{let H=J.split(",").map((L)=>L.trim());for(let L of H){let[F,O]=L.split(":").map((V)=>V.trim());if(F&&O){let V=O.replace(/^['"]|['"]$/g,"");K[F]=V}}}catch{}let q=`island-${Math.random().toString(36).substring(2,9)}`,W=WJ(G.trim()),z=zJ(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 _=Object.keys(z).length>0?`
12925
+ <script type="application/json" data-island-props="${q}">${JSON.stringify(z)}</script>`:"",j="";switch(Z){case"load":j=Dj(q);break;case"idle":j=Ej(q,K);break;case"visible":j=kj(q,K);break;case"media":j=bj(q,K);break;case"hover":j=Sj(q);break;case"event":j=yj(q,K);break}return`
12925
12926
  <div data-island="${q}"
12926
12927
  data-strategy="${Z}"
12927
- ${z.join(`
12928
+ ${U.join(`
12928
12929
  `)}
12929
12930
  class="stx-island"
12930
12931
  style="contents;">
12931
12932
  ${G.trim()}${_}
12932
12933
  </div>
12933
12934
  ${j}
12934
- `})}function Sj($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
12935
+ `})}function Pj($){let Z=/@client:only\s*([\s\S]*?)@endclient/gi;return $.replace(Z,(Y,X)=>{let Q=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
12935
12936
  <div data-island="${Q}"
12936
12937
  data-strategy="only"
12937
12938
  class="stx-island stx-client-only">
@@ -12950,7 +12951,7 @@ else {
12950
12951
  }
12951
12952
  })();
12952
12953
  </script>
12953
- `})}function zJ(){return`
12954
+ `})}function jJ(){return`
12954
12955
  /* Island base styles */
12955
12956
  .stx-island {
12956
12957
  display: contents;
@@ -12991,11 +12992,11 @@ else {
12991
12992
  .stx-island.hydrated {
12992
12993
  opacity: 1;
12993
12994
  }
12994
- `}function BJ($){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 jJ($){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 _J(){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 HJ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function OJ($){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 LJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function FJ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
12995
+ `}function _J($){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 HJ($){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 OJ(){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 LJ($){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${$}"]`)?.classList.contains("hydrated")??!1}function FJ($){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 VJ($){return $.replace(/@static\s*([\s\S]*?)@endstatic/gi,(Z,Y)=>{return`<div class="stx-static">${Y.trim()}</div>`})}function RJ($){let Z=$.map((Y)=>({id:Y.id,component:Y.component,strategy:Y.options.strategy,props:Y.props}));return`
12995
12996
  <script type="application/json" id="stx-island-manifest">
12996
12997
  ${JSON.stringify(Z)}
12997
12998
  </script>
12998
- `}var yj;var RJ=k(()=>{yj={processPartialHydrationDirectives:UJ,processStaticDirectives:LJ,generatePartialHydrationCSS:zJ,generateIslandManifest:FJ,createIslandRegistry:WJ,hydrateIsland:BJ,hydrateByStrategy:jJ,hydrateAll:_J,isHydrated:HJ,onHydrated:OJ}});var SJ={};r(SJ,{watchMultiple:()=>MJ,watchEffect:()=>IJ,watch:()=>TJ,unref:()=>AJ,toRefs:()=>wJ,throttledComputed:()=>bJ,stxWatchMultiple:()=>MJ,stxWatchEffect:()=>IJ,stxWatch:()=>TJ,stxUnref:()=>AJ,stxToRefs:()=>wJ,stxThrottledComputed:()=>bJ,stxShallowRef:()=>NJ,stxRef:()=>R5,stxIsRef:()=>R1,stxDebouncedComputed:()=>kJ,stxComputed:()=>z$,shallowRef:()=>NJ,ref:()=>R5,processWatchDirectives:()=>EJ,processComputedDirectives:()=>DJ,isRef:()=>R1,default:()=>Pj,debouncedComputed:()=>kJ,computed:()=>z$});function R5($){let Z=$,Y=new Set,X={get value(){if(e0){let Q=U$.get(X);if(!Q)Q=new Set,U$.set(X,Q);Q.add(e0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=U$.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function R1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function AJ($){return R1($)?$.value:$}function wJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=R5($[Y]);return Z}function NJ($){return R5($)}function z$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let B=z.value;q.forEach((_)=>_(B))}};function U(){K.clear();let B=e0;e0=W,Z7.push(W);try{return Y()}finally{Z7.pop(),e0=B}}let z={get value(){if(e0){let B=U$.get(z);if(!B)B=new Set,U$.set(z,B);B.add(e0)}if(G){let B=U();if(!Q(J,B))J=B;G=!1}return J},set value(B){if(X)X(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return z}function TJ($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,U=()=>{if(R1($))return Q?l1($.value):$.value;return $()},z=()=>{if(!q||W)return;let j=U();if(K!==void 0&&Object.is(K,j)&&!Q)return;let H=()=>{if(Z(j,K),K=Q?l1(j):j,G)_()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(R1($))B=$.subscribe(()=>z());else B=z$($).subscribe(()=>z());if(X)K=void 0,z();else K=U();let _=()=>{if(q=!1,B)B(),B=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function MJ($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((z)=>R1(z)?z.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let z=$.map((B)=>R1(B)?B.value:void 0);if(Z(z,J),J=[...z],Q)U()},W=$.map((z)=>{if(R1(z))return z.subscribe(()=>q());return()=>{}});if(X)q();let U=()=>{G=!1,W.forEach((z)=>z())};return U.pause=()=>{K=!0},U.resume=()=>{K=!1},U}function IJ($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=e0;e0=G,Z7.push(G);try{X=$()}finally{Z7.pop(),e0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function DJ($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function EJ($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
12999
+ `}var Cj;var wJ=k(()=>{Cj={processPartialHydrationDirectives:BJ,processStaticDirectives:VJ,generatePartialHydrationCSS:jJ,generateIslandManifest:RJ,createIslandRegistry:UJ,hydrateIsland:_J,hydrateByStrategy:HJ,hydrateAll:OJ,isHydrated:LJ,onHydrated:FJ}});var PJ={};r(PJ,{watchMultiple:()=>DJ,watchEffect:()=>EJ,watch:()=>IJ,unref:()=>NJ,toRefs:()=>TJ,throttledComputed:()=>yJ,stxWatchMultiple:()=>DJ,stxWatchEffect:()=>EJ,stxWatch:()=>IJ,stxUnref:()=>NJ,stxToRefs:()=>TJ,stxThrottledComputed:()=>yJ,stxShallowRef:()=>MJ,stxRef:()=>R5,stxIsRef:()=>R1,stxDebouncedComputed:()=>SJ,stxComputed:()=>U$,shallowRef:()=>MJ,ref:()=>R5,processWatchDirectives:()=>bJ,processComputedDirectives:()=>kJ,isRef:()=>R1,default:()=>vj,debouncedComputed:()=>SJ,computed:()=>U$});function R5($){let Z=$,Y=new Set,X={get value(){if(e0){let Q=z$.get(X);if(!Q)Q=new Set,z$.set(X,Q);Q.add(e0)}return Z},set value(Q){if(!Object.is(Z,Q)){Z=Q,Y.forEach((G)=>G(Q));let J=z$.get(X);if(J)J.forEach((G)=>G())}},subscribe(Q){return Y.add(Q),()=>Y.delete(Q)},peek(){return Z}};return X}function R1($){return $!==null&&typeof $==="object"&&"value"in $&&"subscribe"in $&&"peek"in $}function NJ($){return R1($)?$.value:$}function TJ($){let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=R5($[Y]);return Z}function MJ($){return R5($)}function U$($){let Z=typeof $==="function",Y=Z?$:$.get,X=Z?void 0:$.set,Q=Z?Object.is:$.equals||Object.is,J,G=!0,K=new Set,q=new Set,W=()=>{if(G=!0,q.size>0){let B=U.value;q.forEach((_)=>_(B))}};function z(){K.clear();let B=e0;e0=W,Z7.push(W);try{return Y()}finally{Z7.pop(),e0=B}}let U={get value(){if(e0){let B=z$.get(U);if(!B)B=new Set,z$.set(U,B);B.add(e0)}if(G){let B=z();if(!Q(J,B))J=B;G=!1}return J},set value(B){if(X)X(B);else console.warn("Computed property is readonly")},subscribe(B){return q.add(B),()=>q.delete(B)},peek(){if(G)J=Y(),G=!1;return J},invalidate(){G=!0},get dirty(){return G},get deps(){return K}};return U}function IJ($,Z,Y={}){let{immediate:X=!1,deep:Q=!1,flush:J="pre",once:G=!1}=Y,K,q=!0,W=!1,z=()=>{if(R1($))return Q?l1($.value):$.value;return $()},U=()=>{if(!q||W)return;let j=z();if(K!==void 0&&Object.is(K,j)&&!Q)return;let H=()=>{if(Z(j,K),K=Q?l1(j):j,G)_()};if(J==="sync")H();else if(J==="post")queueMicrotask(H);else Promise.resolve().then(H)},B=null;if(R1($))B=$.subscribe(()=>U());else B=U$($).subscribe(()=>U());if(X)K=void 0,U();else K=z();let _=()=>{if(q=!1,B)B(),B=null};return _.pause=()=>{W=!0},_.resume=()=>{W=!1},_}function DJ($,Z,Y={}){let{immediate:X=!1,once:Q=!1}=Y,J=$.map((U)=>R1(U)?U.value:void 0),G=!0,K=!1,q=()=>{if(!G||K)return;let U=$.map((B)=>R1(B)?B.value:void 0);if(Z(U,J),J=[...U],Q)z()},W=$.map((U)=>{if(R1(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 EJ($,Z={}){let{flush:Y="pre"}=Z,X,Q=!0,J=!1,G=()=>{if(!Q||J)return;if(X)X();let q=e0;e0=G,Z7.push(G);try{X=$()}finally{Z7.pop(),e0=q}};if(Y==="sync")G();else if(Y==="post")queueMicrotask(G);else Promise.resolve().then(G);let K=()=>{if(Q=!1,X)X()};return K.pause=()=>{J=!0},K.resume=()=>{J=!1},K}function kJ($,Z={},Y){let X=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return $.replace(X,(Q,J,G)=>{try{let q=Function(...Object.keys(Z),`return ${G}`)(...Object.values(Z));return Z[J]=q,`<!-- computed: ${J} = ${q} -->`}catch(K){return`<!-- computed error: ${J} - ${K} -->`}})}function bJ($,Z={},Y){let X=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return $.replace(X,(Q,J,G)=>{return`
12999
13000
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
13000
13001
  (function() {
13001
13002
  // Watch implementation for ${J}
@@ -13007,9 +13008,9 @@ else {
13007
13008
  }
13008
13009
  })();
13009
13010
  </script>
13010
- `})}function l1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>l1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(l1(Q),l1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(l1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=l1($[Y]);return Z}function kJ($,Z=100){let Y=R5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return z$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function bJ($,Z=100){let Y=R5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return z$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var e0=null,Z7,U$,Pj;var yJ=k(()=>{Z7=[],U$=new WeakMap;Pj={ref:R5,computed:z$,watch:TJ,watchMultiple:MJ,watchEffect:IJ,isRef:R1,unref:AJ,toRefs:wJ,shallowRef:NJ,debouncedComputed:kJ,throttledComputed:bJ,processComputedDirectives:DJ,processWatchDirectives:EJ}});var xJ={};r(xJ,{v:()=>Cj,processHasErrorsDirective:()=>vJ,processFormValidationDirectives:()=>xj,processErrorsDirective:()=>CJ,processErrorDirective:()=>PJ,defineForm:()=>vj,Validator:()=>A5});class A5{rules=[];defaultValue="";addRule($){let Z=new A5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new A5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new A5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function vj($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function U(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function z(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function j(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)J[A]=!0;if(await U())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:U,validateField:W,reset:z,setValues:B,setFieldValue:_,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function PJ($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>{return G.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
13011
- `)}catch{return""}})}function CJ($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return W.map((U)=>G.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
13012
- `)}catch{return""}})}function vJ($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let U of K)if(q&&typeof q==="object"&&U in q)q=q[U];else return"";let W=q;if(!W||!Array.isArray(W)||W.length===0)return"";return G}catch{return""}})}function xj($,Z,Y){let X=$;return X=PJ(X,Z,Y),X=CJ(X,Z,Y),X=vJ(X,Z,Y),X}var Cj;var fJ=k(()=>{Cj=new A5});var dJ={};r(dJ,{processXElementDirectives:()=>fj,hasXElementDirectives:()=>hJ,generateXElementRuntime:()=>gJ});function gJ(){return`<script data-stx-scoped data-stx-x-element-runtime>
13011
+ `})}function l1($){if($===null||typeof $!=="object")return $;if(Array.isArray($))return $.map((Y)=>l1(Y));if($ instanceof Date)return new Date($.getTime());if($ instanceof Map){let Y=new Map;return $.forEach((X,Q)=>Y.set(l1(Q),l1(X))),Y}if($ instanceof Set){let Y=new Set;return $.forEach((X)=>Y.add(l1(X))),Y}let Z={};for(let Y in $)if(Object.prototype.hasOwnProperty.call($,Y))Z[Y]=l1($[Y]);return Z}function SJ($,Z=100){let Y=R5($()),X=null,Q=()=>{if(X)clearTimeout(X);X=setTimeout(()=>{Y.value=$()},Z)};return U$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Debounced computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}function yJ($,Z=100){let Y=R5($()),X=0,Q=()=>{let G=Date.now();if(G-X>=Z)X=G,Y.value=$()};return U$($).subscribe(()=>Q()),{get value(){return Y.value},set value(G){console.warn("Throttled computed is readonly")},subscribe:Y.subscribe,peek:Y.peek,invalidate(){Q()},get dirty(){return!1},get deps(){return new Set}}}var e0=null,Z7,z$,vj;var CJ=k(()=>{Z7=[],z$=new WeakMap;vj={ref:R5,computed:U$,watch:IJ,watchMultiple:DJ,watchEffect:EJ,isRef:R1,unref:NJ,toRefs:TJ,shallowRef:MJ,debouncedComputed:SJ,throttledComputed:yJ,processComputedDirectives:kJ,processWatchDirectives:bJ}});var gJ={};r(gJ,{v:()=>xj,processHasErrorsDirective:()=>fJ,processFormValidationDirectives:()=>gj,processErrorsDirective:()=>xJ,processErrorDirective:()=>vJ,defineForm:()=>fj,Validator:()=>A5});class A5{rules=[];defaultValue="";addRule($){let Z=new A5;return Z.rules=[...this.rules,$],Z.defaultValue=this.defaultValue,Z}required($="This field is required"){return this.addRule({name:"required",message:$,validate:(Z)=>{if(Z===null||Z===void 0)return $;if(typeof Z==="string"&&Z.trim()==="")return $;if(Array.isArray(Z)&&Z.length===0)return $;return!0}})}email($="Please enter a valid email"){return this.addRule({name:"email",message:$,validate:(Z)=>{if(!Z)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String(Z))||$}})}url($="Please enter a valid URL"){return this.addRule({name:"url",message:$,validate:(Z)=>{if(!Z)return!0;try{return new URL(String(Z)),!0}catch{return $}}})}min($,Z){let Y=Z||`Must be at least ${$} characters`;return this.addRule({name:"min",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length>=$||Y}})}max($,Z){let Y=Z||`Must be no more than ${$} characters`;return this.addRule({name:"max",message:Y,validate:(X)=>{if(!X)return!0;return String(X).length<=$||Y}})}length($,Z,Y){let X=Y||`Must be between ${$} and ${Z} characters`;return this.addRule({name:"length",message:X,validate:(Q)=>{if(!Q)return!0;let J=String(Q).length;return J>=$&&J<=Z||X}})}pattern($,Z="Invalid format"){return this.addRule({name:"pattern",message:Z,validate:(Y)=>{if(!Y)return!0;return $.test(String(Y))||Z}})}hasUppercase($="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,$)}hasLowercase($="Must contain a lowercase letter"){return this.pattern(/[a-z]/,$)}hasNumber($="Must contain a number"){return this.pattern(/\d/,$)}hasSpecial($="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,$)}alphanumeric($="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,$)}startsWithLetter($="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,$)}noSpaces($="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:$,validate:(Z)=>{if(!Z)return!0;return!String(Z).includes(" ")||$}})}number($="Must be a number"){let Z=this.addRule({name:"number",message:$,validate:(Y)=>{if(!Y&&Y!==0)return!0;return!Number.isNaN(Number(Y))||$}});return Z.defaultValue=0,Z}integer($="Must be a whole number"){return this.addRule({name:"integer",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number.isInteger(Number(Z))||$}})}positive($="Must be a positive number"){return this.addRule({name:"positive",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)>0||$}})}negative($="Must be a negative number"){return this.addRule({name:"negative",message:$,validate:(Z)=>{if(!Z&&Z!==0)return!0;return Number(Z)<0||$}})}minValue($,Z){let Y=Z||`Must be at least ${$}`;return this.addRule({name:"minValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)>=$||Y}})}maxValue($,Z){let Y=Z||`Must be no more than ${$}`;return this.addRule({name:"maxValue",message:Y,validate:(X)=>{if(!X&&X!==0)return!0;return Number(X)<=$||Y}})}between($,Z,Y){let X=Y||`Must be between ${$} and ${Z}`;return this.addRule({name:"between",message:X,validate:(Q)=>{if(!Q&&Q!==0)return!0;let J=Number(Q);return J>=$&&J<=Z||X}})}matches($,Z){let Y=Z||`Must match ${$}`;return this.addRule({name:"matches",message:Y,validate:(X,Q)=>{if(!Q)return!0;return X===Q[$]||Y}})}oneOf($,Z){let Y=Z||`Must be one of: ${$.join(", ")}`;return this.addRule({name:"oneOf",message:Y,validate:(X)=>{if(!X)return!0;return $.includes(X)||Y}})}notOneOf($,Z){let Y=Z||`Cannot be one of: ${$.join(", ")}`;return this.addRule({name:"notOneOf",message:Y,validate:(X)=>{if(!X)return!0;return!$.includes(X)||Y}})}date($="Must be a valid date"){return this.addRule({name:"date",message:$,validate:(Z)=>{if(!Z)return!0;let Y=new Date(String(Z));return!Number.isNaN(Y.getTime())||$}})}before($,Z){let Y=new Date($),X=Z||`Must be before ${Y.toLocaleDateString()}`;return this.addRule({name:"before",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))<Y||X}})}after($,Z){let Y=new Date($),X=Z||`Must be after ${Y.toLocaleDateString()}`;return this.addRule({name:"after",message:X,validate:(Q)=>{if(!Q)return!0;return new Date(String(Q))>Y||X}})}custom($,Z="Invalid value"){return this.addRule({name:"custom",message:Z,validate:$})}async($,Z="Invalid value"){return this.addRule({name:"async",message:Z,async:!0,validate:$})}when($,Z){let Y=new A5;Y.rules=[...this.rules],Y.defaultValue=this.defaultValue;for(let X of Z.getRules())Y.rules.push({...X,validate:(Q,J)=>{if(!$(Q,J||{}))return!0;return X.validate(Q,J)}});return Y}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default($){let Z=new A5;return Z.rules=[...this.rules],Z.defaultValue=$,Z}async validate($,Z){let Y=[];for(let X of this.rules){let Q=await X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}validateSync($,Z){let Y=[];for(let X of this.rules){if(X.async)continue;let Q=X.validate($,Z);if(Q!==!0)Y.push(Q)}return Y}}function fj($,Z){let Y=Object.keys($),X={},Q={},J={},G={},K={};for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1,K[O]=!1;let q=!1;async function W(O){K[O]=!0;let V=await $[O].validate(X[O],X);return Q[O]=V,K[O]=!1,V.length===0}async function z(){q=!0;let O=await Promise.all(Y.map(W));return q=!1,O.every(Boolean)}function U(){for(let O of Y)X[O]=Z?.[O]??$[O].getDefaultValue(),Q[O]=[],J[O]=!1,G[O]=!1}function B(O){for(let V of Y)if(V in O)X[V]=O[V],G[V]=!0}function _(O,V){X[O]=V,G[O]=!0}function j(O,V=!0){if(J[O]=V,V)W(O)}function H(O){return{value:X[O],errors:Q[O],touched:J[O],dirty:G[O],valid:Q[O].length===0,validating:K[O]}}function L(O){return async(V)=>{V?.preventDefault?.();for(let A of Y)J[A]=!0;if(await z())await O(X)}}return{values:X,errors:Q,touched:J,dirty:G,get isValid(){return Y.every((O)=>Q[O].length===0)},get isValidating(){return q||Y.some((O)=>K[O])},get isDirty(){return Y.some((O)=>G[O])},validate:z,validateField:W,reset:U,setValues:B,setFieldValue:_,setFieldTouched:j,getFieldState:H,handleSubmit:L}}function vJ($,Z,Y){let X=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let 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(`
13012
+ `)}catch{return""}})}function xJ($,Z,Y){let X=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let 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(`
13013
+ `)}catch{return""}})}function fJ($,Z,Y){let X=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return $.replace(X,(Q,J,G)=>{try{let K=J.trim().split("."),q=Z;for(let 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 gj($,Z,Y){let X=$;return X=vJ(X,Z,Y),X=xJ(X,Z,Y),X=fJ(X,Z,Y),X}var xj;var hJ=k(()=>{xj=new A5});var uJ={};r(uJ,{processXElementDirectives:()=>hj,hasXElementDirectives:()=>mJ,generateXElementRuntime:()=>dJ});function dJ(){return`<script data-stx-scoped data-stx-x-element-runtime>
13013
13014
  (function() {
13014
13015
  'use strict';
13015
13016
 
@@ -13293,39 +13294,39 @@ else {
13293
13294
  // Expose for manual initialization
13294
13295
  window.XElement = XElement;
13295
13296
  })();
13296
- </script>`}function hJ($){return/\bx-data(?:\s|=)/.test($)}function fj($){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(!hJ(X))return X;let Q=Y[0]?.trim()||gJ(),J=X.lastIndexOf("</body>");if(J!==-1)return X.slice(0,J)+Q+`
13297
+ </script>`}function mJ($){return/\bx-data(?:\s|=)/.test($)}function hj($){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(!mJ(X))return X;let Q=Y[0]?.trim()||dJ(),J=X.lastIndexOf("</body>");if(J!==-1)return X.slice(0,J)+Q+`
13297
13298
  `+X.slice(J);return X+`
13298
- `+Q}var mJ={};r(mJ,{rewriteImagesWithSiblings:()=>dj});import G1 from"path";async function dj($,Z){let Y=Z.formats??hj;if(!Z.publicDir)return $;let X=lj($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let z=K[0],B=z.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(pj(K.index,X))continue;G.push({idx:K.index,length:z.length,src:B[1],raw:z})}if(G.length===0)return $;let q=await Promise.all(G.map(async(z)=>{let B=await mj(z.src,Z.publicDir,Y);return{match:z,sources:B}}));for(let{match:z,sources:B}of q){if(B.length===0)continue;let j=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${cj(H.url)}">`).join("")}${z.raw}</picture>`;Q.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(Q.length===0)return $;let W="",U=0;for(let z of Q)W+=$.slice(U,z.start),W+=z.replacement,U=z.end;return W+=$.slice(U),W}async function mj($,Z,Y){if(!uj($))return[];let X=G1.extname($).toLowerCase();if(!gj.has(X))return[];if(!$.startsWith("/"))return[];let Q=G1.join(Z,$.slice(1)),J=G1.dirname(Q),G=G1.basename(Q,X),K=G1.resolve(J),q=G1.resolve(Z);if(!K.startsWith(q))return[];let W=G1.posix.dirname($),U=Y.map(async(B)=>{let _=G1.join(J,`${G}${B.ext}`);if(!await Bun.file(_).exists())return null;return{url:G1.posix.join(W,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(U)).filter((B)=>B!==null)}function uj($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function lj($){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 pj($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function cj($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var gj,hj;var uJ=k(()=>{gj=new Set([".jpg",".jpeg",".png",".gif"]),hj=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var iJ={};r(iJ,{validateClientScript:()=>e4,processOnceDirective:()=>t4,processJsonDirective:()=>a4,processDirectives:()=>V0,injectRouterScript:()=>g8});import y0 from"path";import{deriveLayoutGroup as ij}from"stx-router/layout-metadata";function lJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function nj($,Z){let Y=$.length,X=Z,Q=!0,J=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
13299
- `,X+2),X===-1)return-1;X+=1,Q=!0;continue}if(K==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,Q=!0;continue}if(K==="/"&&Q){let q=X+1,W=!1;while(q<Y){let U=$[q];if(U==="\\"){q+=2;continue}if(U==="[")W=!0;else if(U==="]")W=!1;else if(U==="/"&&!W){q++;break}else if(U===`
13299
+ `+Q}var lJ={};r(lJ,{rewriteImagesWithSiblings:()=>uj});import G1 from"path";async function uj($,Z){let Y=Z.formats??mj;if(!Z.publicDir)return $;let X=cj($),Q=[],J=/<img\b[^>]*?>/gi,G=[],K;while((K=J.exec($))!==null){let U=K[0],B=U.match(/\bsrc=["']([^"']+)["']/i);if(!B)continue;if(ij(K.index,X))continue;G.push({idx:K.index,length:U.length,src:B[1],raw:U})}if(G.length===0)return $;let q=await Promise.all(G.map(async(U)=>{let B=await lj(U.src,Z.publicDir,Y);return{match:U,sources:B}}));for(let{match:U,sources:B}of q){if(B.length===0)continue;let j=`<picture>${B.map((H)=>`<source type="${H.mime}" srcset="${nj(H.url)}">`).join("")}${U.raw}</picture>`;Q.push({start:U.idx,end:U.idx+U.length,replacement:j})}if(Q.length===0)return $;let W="",z=0;for(let U of Q)W+=$.slice(z,U.start),W+=U.replacement,z=U.end;return W+=$.slice(z),W}async function lj($,Z,Y){if(!pj($))return[];let X=G1.extname($).toLowerCase();if(!dj.has(X))return[];if(!$.startsWith("/"))return[];let Q=G1.join(Z,$.slice(1)),J=G1.dirname(Q),G=G1.basename(Q,X),K=G1.resolve(J),q=G1.resolve(Z);if(!K.startsWith(q))return[];let W=G1.posix.dirname($),z=Y.map(async(B)=>{let _=G1.join(J,`${G}${B.ext}`);if(!await Bun.file(_).exists())return null;return{url:G1.posix.join(W,`${G}${B.ext}`),mime:B.mime}});return(await Promise.all(z)).filter((B)=>B!==null)}function pj($){if(!$)return!1;if($.startsWith("http://")||$.startsWith("https://"))return!1;if($.startsWith("//"))return!1;if($.startsWith("data:"))return!1;return!0}function cj($){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 ij($,Z){for(let[Y,X]of Z)if($>=Y&&$<X)return!0;return!1}function nj($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var dj,mj;var pJ=k(()=>{dj=new Set([".jpg",".jpeg",".png",".gif"]),mj=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var oJ={};r(oJ,{validateClientScript:()=>e4,processOnceDirective:()=>t4,processJsonDirective:()=>a4,processDirectives:()=>V0,injectRouterScript:()=>d8});import P0 from"path";import{deriveLayoutGroup as oj}from"stx-router/layout-metadata";function cJ($){return $.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function sj($,Z){let Y=$.length,X=Z,Q=!0,J=[],G=(K)=>K+9<=Y&&$[K]==="<"&&$[K+1]==="/"&&($[K+2]==="s"||$[K+2]==="S")&&($[K+3]==="c"||$[K+3]==="C")&&($[K+4]==="r"||$[K+4]==="R")&&($[K+5]==="i"||$[K+5]==="I")&&($[K+6]==="p"||$[K+6]==="P")&&($[K+7]==="t"||$[K+7]==="T")&&($[K+8]===">"||/\s/.test($[K+8]));while(X<Y){let K=$[X];if(G(X))return X;if(K==="/"&&$[X+1]==="/"){if(X=$.indexOf(`
13300
+ `,X+2),X===-1)return-1;X+=1,Q=!0;continue}if(K==="/"&&$[X+1]==="*"){let q=$.indexOf("*/",X+2);if(q===-1)return-1;X=q+2,Q=!0;continue}if(K==="/"&&Q){let q=X+1,W=!1;while(q<Y){let 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===`
13300
13301
  `){q=-1;break}q++}if(q===-1){X++,Q=!1;continue}while(q<Y&&/[a-z]/.test($[q]))q++;X=q,Q=!1;continue}if(K==="'"||K==='"'){let q=K;X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]===q){X++;break}if($[X]===`
13301
- `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}if(J.length===0)Q=!1;continue}if(K==="}"&&J.length>0){J.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;X++}return-1}function Y7($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Q=X.index+X[0].length,J=$.indexOf("</script>",Q);if(J===-1)return null;let G=$.indexOf(">",J);if(G===-1)return null;return{start:X.index,end:G+1}}function pJ($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let J=$.indexOf("-->",Y+4);Z=J===-1?$.length:J+3;continue}let X=$.slice(Y),Q=/^<style\b[^>]*>/i.exec(X);if(Q){let J=$.toLowerCase().indexOf("</style>",Y+Q[0].length);Z=J===-1?$.length:J+8;continue}if(/^<script\b[^>]*>/i.test(X))return Y;Z=Y+1}return-1}function oj($){let Z=Y7($,"data-stx-runtime");if(!Z)return $;let Y=pJ($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),Q=$.slice(0,Z.start)+$.slice(Z.end),J=pJ(Q);if(J===-1)return X+`
13302
+ `)break;X++}Q=!1;continue}if(K==="`"){X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}if(J.length===0)Q=!1;continue}if(K==="}"&&J.length>0){J.pop(),X++;while(X<Y){if($[X]==="\\"){X+=2;continue}if($[X]==="`"){X++,Q=!1;break}if($[X]==="$"&&$[X+1]==="{"){J.push(!0),X+=2,Q=!0;break}X++}continue}if(/\s/.test(K));else if(/[)\].\w$]/.test(K))Q=!1;else Q=!0;X++}return-1}function Y7($,Z){let Y=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),X=new RegExp(`<script\\b(?=[^>]*\\b${Y}(?:\\s|=|/?>))[^>]*>`,"i").exec($);if(!X)return null;let Q=X.index+X[0].length,J=$.indexOf("</script>",Q);if(J===-1)return null;let G=$.indexOf(">",J);if(G===-1)return null;return{start:X.index,end:G+1}}function iJ($){let Z=0;while(Z<$.length){let Y=$.indexOf("<",Z);if(Y===-1)return-1;if($.startsWith("<!--",Y)){let J=$.indexOf("-->",Y+4);Z=J===-1?$.length:J+3;continue}let X=$.slice(Y),Q=/^<style\b[^>]*>/i.exec(X);if(Q){let J=$.toLowerCase().indexOf("</style>",Y+Q[0].length);Z=J===-1?$.length:J+8;continue}if(/^<script\b[^>]*>/i.test(X))return Y;Z=Y+1}return-1}function rj($){let Z=Y7($,"data-stx-runtime");if(!Z)return $;let Y=iJ($);if(Y===-1||Y===Z.start)return $;let X=$.slice(Z.start,Z.end),Q=$.slice(0,Z.start)+$.slice(Z.end),J=iJ(Q);if(J===-1)return X+`
13302
13303
  `+Q;return Q.slice(0,J)+X+`
13303
- `+Q.slice(J)}async function V0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!a5()&&!N4())&&Y&&Y.endsWith(".stx"))X6($,Y);try{return await Q8.timeAsync("template-processing",async()=>{let G=await sj($,Z,Y,X,Q);if(J)G=m6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??M7(),U=(Z.__stx_head_raw||"").trim(),z,B=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(B)z=B[1].trim(),U=U.replace(B[0],"").trim();let _=Z.__sections?.title,j=W.title||z||_,H={...K,...j&&{title:j},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,U].filter(Boolean).join(`
13304
- `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=d6(G);if(G=TX(G,H),L)G=NX(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],R=ij(V);G=G.replace("<head>",`<head>
13305
- <meta name="stx-layout" content="${lJ(V)}">
13306
- <meta name="stx-layout-group" content="${lJ(R)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(J)G=wX(G),G=oj(G);if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (PX(),yX)),q=X.storesDir,W=await K(q);if(W){let U=`<script data-stx-stores>${W}</script>`,z=Y7(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
13307
- `+U+G.slice(z.end)}}catch{}if(J)try{let{getComposableScript:K}=await Promise.resolve().then(() => (xX(),vX)),q=X.composablesDir,W=await K(q);if(W){let U=`<script data-stx-composables>${W}</script>`,z=Y7(G,"data-stx-stores")||Y7(G,"data-stx-runtime");if(z)G=G.slice(0,z.end)+`
13308
- `+U+G.slice(z.end)}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await F2(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof D4)throw G;let K=G instanceof Error?G.message:String(G),q=new f1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(o0.log(q,{filePath:Y,context:Z}),S3.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return k3.createFallbackContent("Template Processing",q)}}async function sj($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!y0.isAbsolute(X.partialsDir)?y0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!y0.isAbsolute(X.componentsDir)?y0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!y0.isAbsolute(X.layoutsDir)?y0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await tj(Y,Z),aj(Z,K),q=await G5(()=>KX(q,Z,Y,K),q,(O)=>{o0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=r0(q,v5,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let U=W.tokens,z=(O)=>U.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,R)=>U[Number(R)]??""),B="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,B),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=FX(q),q=await DX(q,Y,Q);let _={};q=f6(q,_);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let R="",A=y0.dirname(Y),w=K.layoutsDir?y0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let T=y0.join(A,"_layout.stx");if(await n(T)){R=T;break}let M=y0.dirname(A);if(M===A||M.length<w.length)break;A=M}if(R)H=R;else if(K.layoutsDir){let N=y0.isAbsolute(K.layoutsDir)?K.layoutsDir:y0.resolve(process.cwd(),K.layoutsDir),T=y0.join(N,`${K.defaultLayout}.stx`);if(await n(T))H=T}if(H&&!V)q=`@section('content')
13304
+ `+Q.slice(J)}async function V0($,Z,Y,X,Q){if(X.ssr===!1&&!X.autoShell&&X.buildMode==="spa")return $;let J=!Z.__stxProcessingDepth;if(!Z.__stxProcessingDepth)Z.__stxProcessingDepth=0;if(Z.__stxProcessingDepth++,!Z.__onceStore)Z.__onceStore=new Set;if((X.debug||!a5()&&!N4())&&Y&&Y.endsWith(".stx"))X6($,Y);try{return await K8.timeAsync("template-processing",async()=>{let G=await aj($,Z,Y,X,Q);if(J)G=m6(G);if(J&&X.autoShell&&X.buildMode!=="compile"){let K=X.app?.head||{},W=(Z.__stx_runtime_head||null)??M7(),z=(Z.__stx_head_raw||"").trim(),U,B=z.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(B)U=B[1].trim(),z=z.replace(B[0],"").trim();let _=Z.__sections?.title,j=W.title||U||_,H={...K,...j&&{title:j},meta:[...K.meta||[],...W.meta||[]],link:[...K.link||[],...W.link||[]],script:[...K.script||[],...W.script||[]],headRaw:[K.headRaw,z].filter(Boolean).join(`
13305
+ `),...W.htmlAttrs&&{htmlAttrs:{...K.htmlAttrs||{},...W.htmlAttrs}},...W.bodyAttrs&&{bodyAttrs:{...K.bodyAttrs||{},...W.bodyAttrs}}},L=d6(G);if(G=IX(G,H),L)G=MX(G,K);let F=G.match(/<!-- stx-layout: ([^ ]+) -->/);if(F&&G.includes("<head")){let V=F[1],R=oj(V);G=G.replace("<head>",`<head>
13306
+ <meta name="stx-layout" content="${cJ(V)}">
13307
+ <meta name="stx-layout-group" content="${cJ(R)}">`)}let O=G.match(/function (__stx_setup_\d+_\d+)\(/);if(O&&G.includes("<body")&&!G.match(/<body[^>]*data-stx=/)){G=G.replace(/<body([^>]*)>/,`<body$1 data-stx="${O[1]}">`);let V=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${O[1]}"`,"i");G=G.replace(V,"$1")}}if(J)G=TX(G),G=rj(G);if(J)try{let{getStoreScript:K}=await Promise.resolve().then(() => (vX(),CX)),q=X.storesDir,W=await K(q);if(W){let z=`<script data-stx-stores>${W}</script>`,U=Y7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
13308
+ `+z+G.slice(U.end)}}catch{}if(J)try{let{getComposableScript:K}=await Promise.resolve().then(() => (gX(),fX)),q=X.composablesDir,W=await K(q);if(W){let z=`<script data-stx-composables>${W}</script>`,U=Y7(G,"data-stx-stores")||Y7(G,"data-stx-runtime");if(U)G=G.slice(0,U.end)+`
13309
+ `+z+G.slice(U.end)}}catch{}if(J&&Z.__stx_inject_css!==!1)G=await R2(G);return G=G.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),G})}catch(G){if(G instanceof D4)throw G;let K=G instanceof Error?G.message:String(G),q=new f1(`Template processing failed: ${K}`,Y,void 0,void 0,$.substring(0,200)+($.length>200?"...":""));if(o0.log(q,{filePath:Y,context:Z}),S3.logDetailedError(q,{filePath:Y,template:$.substring(0,500)}),X.debug)throw q;return k3.createFallbackContent("Template Processing",q)}}async function aj($,Z,Y,X,Q){let J=process.cwd(),G={...X,partialsDir:X.partialsDir&&!P0.isAbsolute(X.partialsDir)?P0.resolve(J,X.partialsDir):X.partialsDir,componentsDir:X.componentsDir&&!P0.isAbsolute(X.componentsDir)?P0.resolve(J,X.componentsDir):X.componentsDir,layoutsDir:X.layoutsDir&&!P0.isAbsolute(X.layoutsDir)?P0.resolve(J,X.layoutsDir):X.layoutsDir},K=G,q=$;await $_(Y,Z),ej(Z,K),q=await G5(()=>WX(q,Z,Y,K),q,(O)=>{o0.log(O,{filePath:Y,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Y}: ${O.message}`)}),q=q.replace(/\{\{--[\s\S]*?--\}\}/g,"");let W=r0(q,v5,(O,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);q=W.output;let z=W.tokens,U=(O)=>z.length===0?O:O.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,R)=>z[Number(R)]??""),B="\x00STX_ESCAPED_AT\x00";q=q.replace(/@@/g,B),q=q.replace(/@\{\{([\s\S]*?)\}\}/g,(O,V)=>{return`{{ ${V} }}`}),q=RX(q),q=await kX(q,Y,Q);let _={};q=f6(q,_);let j={...Z.__sections||{}},H="",L=/@nolayout\b/.test(q);if(L)q=q.replace(/@nolayout\b\s*/g,"");let F=q.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(F)H=F[1],q=q.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");if(!H&&!L&&K.defaultLayout){let O=/<!DOCTYPE\s/i.test(q),V=/@section\s*\(/.test(q);if(!O||V){let R="",A=P0.dirname(Y),w=K.layoutsDir?P0.dirname(K.layoutsDir):process.cwd();for(let N=0;N<20;N++){let T=P0.join(A,"_layout.stx");if(await n(T)){R=T;break}let M=P0.dirname(A);if(M===A||M.length<w.length)break;A=M}if(R)H=R;else if(K.layoutsDir){let N=P0.isAbsolute(K.layoutsDir)?K.layoutsDir:P0.resolve(process.cwd(),K.layoutsDir),T=P0.join(N,`${K.defaultLayout}.stx`);if(await n(T))H=T}if(H&&!V)q=`@section('content')
13309
13310
  ${q.trim()}
13310
- @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,R)=>{return j[V]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return O;try{let A=Y0(R.trim(),Z);if(A===void 0)return O;return j[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,R)=>{if(R.includes("@parent"))j[V]=R.replace("@parent",p1);else j[V]=R.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,R)=>{return j[V]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=g6(q,_),H){let O=[],V=U1(q),R=r0(V.output,s1,(A,w)=>`\x00STX_ORPHAN_STYLE_${w}\x00`);if(q=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,w,N)=>{let T=w==="SCRIPT"?V.scripts[Number(N)]:R.tokens[Number(N)];if(T)O.push(T);return""}),O.length>0){let A=O.join(`
13311
+ @endsection`}}if(q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(O,V,R)=>{return j[V]=R,""}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(O,V,R)=>{if(/^(['"]).*\1$/.test(R.trim()))return O;try{let A=Y0(R.trim(),Z);if(A===void 0)return O;return j[V]=String(A??""),""}catch{return O}}),q=q.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(O,V,R)=>{if(R.includes("@parent"))j[V]=R.replace("@parent",p1);else j[V]=R.trim();return""}),Z.__sections=j,q=q.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(O,V,R)=>{return j[V]||R||""}),!("slot"in Z)||Z.slot===void 0)q=q.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(q=g6(q,_),H){let O=[],V=z1(q),R=r0(V.output,s1,(A,w)=>`\x00STX_ORPHAN_STYLE_${w}\x00`);if(q=R.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(A,w,N)=>{let T=w==="SCRIPT"?V.scripts[Number(N)]:R.tokens[Number(N)];if(T)O.push(T);return""}),O.length>0){let A=O.join(`
13311
13312
  `);j.content=j.content?`${j.content}
13312
- ${A}`:A,Z.__sections=j}}if(H)try{let O;if(y0.isAbsolute(H))O=H,Q.add(H);else O=await G5(()=>i7(H,Y,G,Q),null,()=>{throw new f1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(o0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new f1(T,Y);return q}let V=await G5(()=>Bun.file(O).text(),"",()=>{throw new f1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,P,S)=>{return T[P]=S.trim(),""});for(let[D,P]of Object.entries(T))if(j[D]&&j[D].includes(p1)){let S=j[D].indexOf(p1);j[D]=j[D].slice(0,S)+P+j[D].slice(S+p1.length)}else if(!j[D])j[D]=P;let I={...Z,__sections:j},E=`@layout('${R[1]}')${M}`;return await V0(E,I,O,G,Q)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),w=f6(A,_),N={};return w=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return N[M]=I.trim(),`@slot('${M}')`}),w=w.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let E=j[M];if(E.includes(p1)){let D=N[M]||"",P=E.indexOf(p1);E=E.slice(0,P)+D+E.slice(P+p1.length)}return E}return I||""}),w=rj(w,j),w=w.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),w=g6(w,_),Z.__originalFilePath=Y,q=await cJ(w,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
13313
- ${q}`,z(q)}catch(O){return o0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return z(await cJ(q,Z,Y,G,Q))}function rj($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function aj($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function tj($,Z){await G5(()=>BX($,Z),void 0,(Y)=>{o0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function ej($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (p5(),y$));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));o0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function $_($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (a0(),Z8));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return o0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function cJ($,Z,Y,X,Q){let J=$,G=X;if(await ej(J,Z,Y),J=await $_(J,Z,Y),J=await ZX(J,Z,Y),J=await YX(J,Z,Y),J=await e2(J,Z,Y,G),r1(J))J=m7(J,Z),J=l7(J,Z);J=u7(J);let{processStreamDirectives:K}=await Promise.resolve().then(() => (Y6(),Z6));J=K(J,Z),J=P6(J,Z,Y,G),J=await i4(J,Z,Y,G,Q),J=await RX(J,Z,Y,G,Q),J=N9(J,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => gX);J=q(J,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => dX);J=W(J,Z,Y);let{processTransitionDirectives:U,processTransitionAttributes:z}=await Promise.resolve().then(() => pX);J=U(J,Z,Y),J=z(J);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => iX);J=B(J,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => nX);J=_(J,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => aX);J=j(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => eX);J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (QJ(),JJ));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:R}=await Promise.resolve().then(() => (RJ(),VJ));J=V(J,Z,Y),J=R(J);let{processComputedDirectives:A,processWatchDirectives:w}=await Promise.resolve().then(() => (yJ(),SJ));J=A(J,Z,Y),J=w(J,Z,Y);let{processFormValidationDirectives:N}=await Promise.resolve().then(() => (fJ(),xJ));J=N(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:E}=await Promise.resolve().then(() => (u5(),D7));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let D=T(J);if(J=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
13314
- `;if(J=M(J,Z),J=I(J,Z),J=UX(J),J=u3(J,Z),J=a2(J),J=QX(J),J=await x6(J,Z,Y,G,Q),J=await i4(J,Z,Y,G,Q),J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=m6(J),J=d1(J,Z,Y),J=l3(J,Z),J=p3(J,Z),J=f4(J,Z),J=JY(J,Z),J=QY(J,Z),J=await d2(J,Z,Y,G),J=await t8(J,Z,Y),J=await UY(J,Z,Y,G),J=O9(J,Z,Y,G),J=J2(J,Z,Y,G),J=Q2(J,Z,Y),J=G2(J,Z,Y,G),J=o2(J,Z,Y,G),J=a4(J,Z),J=t4(J),J=kX(J),!G.skipEventDirectives)J=P2(J,Z,Y);if(J=g2(J,Z,Y),G.debug){let l=/\bx-data\s*=/.test(J),s=o$($);if(l&&s)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
13313
+ ${A}`:A,Z.__sections=j}}if(H)try{let O;if(P0.isAbsolute(H))O=H,Q.add(H);else O=await G5(()=>i7(H,Y,G,Q),null,()=>{throw new f1(`Failed to resolve layout path: ${H}`,Y,void 0,void 0,`Layout referenced from ${Y}`)});if(!O){let T=`Layout not found: ${H} (referenced from ${Y})`;if(o0.log(Error(T),{layoutPath:H,filePath:Y},"warning"),G.debug)throw new f1(T,Y);return q}let V=await G5(()=>Bun.file(O).text(),"",()=>{throw new f1(`Failed to read layout file: ${O}`,Y,void 0,void 0,"Layout content could not be loaded")}),R=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(R){if(G.debug)console.log(`Found nested layout: ${R[1]} in ${O}`);let T={},M=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(D,P,S)=>{return T[P]=S.trim(),""});for(let[D,P]of Object.entries(T))if(j[D]&&j[D].includes(p1)){let S=j[D].indexOf(p1);j[D]=j[D].slice(0,S)+P+j[D].slice(S+p1.length)}else if(!j[D])j[D]=P;let I={...Z,__sections:j},E=`@layout('${R[1]}')${M}`;return await V0(E,I,O,G,Q)}let A=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),w=f6(A,_),N={};return w=w.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(T,M,I)=>{return N[M]=I.trim(),`@slot('${M}')`}),w=w.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(T,M,I)=>{if(j[M]){let E=j[M];if(E.includes(p1)){let D=N[M]||"",P=E.indexOf(p1);E=E.slice(0,P)+D+E.slice(P+p1.length)}return E}return I||""}),w=tj(w,j),w=w.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),w=g6(w,_),Z.__originalFilePath=Y,q=await nJ(w,Z,O,G,Q),q=`<!-- stx-layout: ${H} -->
13314
+ ${q}`,U(q)}catch(O){return o0.log(O instanceof Error?O:Error(String(O)),{layoutPath:H,filePath:Y},"error"),`[Error processing layout: ${O instanceof Error?O.message:String(O)}]`}return U(await nJ(q,Z,Y,G,Q))}function tj($,Z){return $.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Y,X,Q)=>{let J=Z[X];if(J!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(J))return J}return Q||""})}function ej($,Z){if($.__stx_sfc_mode=!0,$.__stx_options=Z,Z.buildMode)$.__stx_buildMode=Z.buildMode;let Y=Z.envPrefix||"STX_PUBLIC_",X={};for(let[Q,J]of Object.entries(process.env))if(Q.startsWith(Y)&&J!==void 0)X[Q]=J;$.$env=X}async function $_($,Z){await G5(()=>_X($,Z),void 0,(Y)=>{o0.log(Y,{filePath:$,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${$}: ${Y.message}`)})}async function Z_($,Z,Y){let X=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,Q;while((Q=X.exec($))!==null){let J=Q[1],G=Q[2];if(!/\bserver\b/.test(J)||!G.trim())continue;try{let{extractVariables:q}=await Promise.resolve().then(() => (p5(),y$));await q(G,Z,Y,{preserveExisting:!0})}catch(q){let W=q instanceof Error?q:Error(String(q));o0.log(W,{filePath:Y,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Y}: ${W.message}`)}}}async function Y_($,Z,Y){try{let{interpolateScriptsInTemplate:X}=await Promise.resolve().then(() => (a0(),X8));return X($,Z,{skipServer:!0})}catch(X){let Q=X instanceof Error?X:Error(String(X));return o0.log(Q,{filePath:Y,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Y}: ${Q.message}`),$}}async function nJ($,Z,Y,X,Q){let J=$,G=X;if(await Z_(J,Z,Y),J=await Y_(J,Z,Y),J=await XX(J,Z,Y),J=await JX(J,Z,Y),J=await ZY(J,Z,Y,G),r1(J))J=m7(J,Z),J=l7(J,Z);J=u7(J);let{processStreamDirectives:K}=await Promise.resolve().then(() => (Y6(),Z6));J=K(J,Z),J=P6(J,Z,Y,G),J=await i4(J,Z,Y,G,Q),J=await wX(J,Z,Y,G,Q),J=N9(J,Z,Y,G);let{processDeferDirectives:q}=await Promise.resolve().then(() => dX);J=q(J,Z,Y);let{processTeleportDirectives:W}=await Promise.resolve().then(() => uX);J=W(J,Z,Y);let{processTransitionDirectives:z,processTransitionAttributes:U}=await Promise.resolve().then(() => iX);J=z(J,Z,Y),J=U(J);let{processErrorBoundaryDirectives:B}=await Promise.resolve().then(() => oX);J=B(J,Z,Y);let{processSuspenseDirectives:_}=await Promise.resolve().then(() => sX);J=_(J,Z,Y);let{processAsyncDirectives:j}=await Promise.resolve().then(() => eX);J=j(J,Z,Y);let{processKeepAliveDirectives:H}=await Promise.resolve().then(() => ZJ);J=H(J,Z,Y);let{processVirtualListDirectives:L,processVirtualGridDirectives:F,processInfiniteListDirectives:O}=await Promise.resolve().then(() => (KJ(),GJ));J=L(J,Z,Y),J=F(J,Z,Y),J=O(J,Z,Y);let{processPartialHydrationDirectives:V,processStaticDirectives:R}=await Promise.resolve().then(() => (wJ(),AJ));J=V(J,Z,Y),J=R(J);let{processComputedDirectives:A,processWatchDirectives:w}=await Promise.resolve().then(() => (CJ(),PJ));J=A(J,Z,Y),J=w(J,Z,Y);let{processFormValidationDirectives:N}=await Promise.resolve().then(() => (hJ(),gJ));J=N(J,Z,Y);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:I,resetHead:E}=await Promise.resolve().then(() => (u5(),D7));if(!Z.__stx_head_preset&&!Z.__stx_runtime_head)E();let D=T(J);if(J=D.content,D.headContent)Z.__stx_head_raw=`${Z.__stx_head_raw||""}${D.headContent}
13315
+ `;if(J=M(J,Z),J=I(J,Z),J=BX(J),J=u3(J,Z),J=e2(J),J=KX(J),J=await x6(J,Z,Y,G,Q),J=await i4(J,Z,Y,G,Q),J=J.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),J=m6(J),J=d1(J,Z,Y),J=l3(J,Z),J=p3(J,Z),J=f4(J,Z),J=GY(J,Z),J=KY(J,Z),J=await u2(J,Z,Y,G),J=await $Z(J,Z,Y),J=await BY(J,Z,Y,G),J=O9(J,Z,Y,G),J=G2(J,Z,Y,G),J=K2(J,Z,Y),J=q2(J,Z,Y,G),J=r2(J,Z,Y,G),J=a4(J,Z),J=t4(J),J=SX(J),!G.skipEventDirectives)J=v2(J,Z,Y);if(J=d2(J,Z,Y),G.debug){let l=/\bx-data\s*=/.test(J),s=o$($);if(l&&s)console.warn(`[stx] ${Y}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
13315
13316
  Both work on the same page, but they manage separate scopes.
13316
- Prefer signals (state/derived/effect) for new components.`)}J=HX(J,Z),J=await z1(J,Z,Y),J=bX(J),J=SX(J),J=T2(J);let{processXElementDirectives:P}=await Promise.resolve().then(() => dJ);J=P(J);let S=Z.__originalFilePath||Y,b=y5(Z);if(J=await p7(J,G,S,b),J=await qX(J,Z,Y,G),G.media?.image?.autoSiblings){let l=G.publicDir||"public",{rewriteImagesWithSiblings:s}=await Promise.resolve().then(() => (uJ(),mJ));J=await s(J,{publicDir:l})}if(G.seo?.enabled)J=K2(J,Z,G);let C=(l,s,g=!0)=>{if(!s)return l;let d=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),y=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(d&&y){if(g)l=l.replace(y[0],d[0]);if(s=s.replace(d[0],"").trim(),!s)return l}if(/<\/head>/i.test(l))return l.replace(/<\/head>/i,`${s}
13317
+ Prefer signals (state/derived/effect) for new components.`)}J=LX(J,Z),J=await U1(J,Z,Y),J=yX(J),J=PX(J),J=I2(J);let{processXElementDirectives:P}=await Promise.resolve().then(() => uJ);J=P(J);let S=Z.__originalFilePath||Y,b=y5(Z);if(J=await p7(J,G,S,b),J=await zX(J,Z,Y,G),G.media?.image?.autoSiblings){let l=G.publicDir||"public",{rewriteImagesWithSiblings:s}=await Promise.resolve().then(() => (pJ(),lJ));J=await s(J,{publicDir:l})}if(G.seo?.enabled)J=W2(J,Z,G);let C=(l,s,g=!0)=>{if(!s)return l;let d=s.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),y=l.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(d&&y){if(g)l=l.replace(y[0],d[0]);if(s=s.replace(d[0],"").trim(),!s)return l}if(/<\/head>/i.test(l))return l.replace(/<\/head>/i,`${s}
13317
13318
  </head>`);if(/<head\b[^>]*>/i.test(l))return l.replace(/(<head\b[^>]*>)/i,`$1
13318
13319
  ${s}`);if(/<html\b[^>]*>/i.test(l))return l.replace(/(<html\b[^>]*>)/i,`$1
13319
13320
  <head>
13320
13321
  ${s}
13321
- </head>`);return l},{renderHead:h,getHead:x}=await Promise.resolve().then(() => (u5(),D7)),t=Z.__stx_runtime_head??x();if(t.title||t.meta?.length||t.link?.length){let l=h(t);if(l)J=C(J,l)}if(D.headContent)J=C(J,D.headContent,!t.title);if(G.csp?.enabled&&G.csp.addMetaTag)J=n2(J,G.csp,Z);if(G.analytics?.enabled)J=I2(J,G);if(G.heatmap?.enabled)J=E9(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:l}=await Promise.resolve().then(() => (F$(),z9));J=l(J,G)}let X0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),$1=/\bSTX\.\w+/.test(J),f0=/window\.STX\s*=/.test(J);if(X0&&$1&&!f0){let s=`<script data-stx-scoped>
13322
- ${R2()}
13322
+ </head>`);return l},{renderHead:h,getHead:x}=await Promise.resolve().then(() => (u5(),D7)),t=Z.__stx_runtime_head??x();if(t.title||t.meta?.length||t.link?.length){let l=h(t);if(l)J=C(J,l)}if(D.headContent)J=C(J,D.headContent,!t.title);if(G.csp?.enabled&&G.csp.addMetaTag)J=s2(J,G.csp,Z);if(G.analytics?.enabled)J=E2(J,G);if(G.heatmap?.enabled)J=E9(J,G);if(G.pwa?.enabled&&G.pwa.autoInject!==!1){let{injectPwaTags:l}=await Promise.resolve().then(() => (F$(),U9));J=l(J,G)}let X0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(J),$1=/\bSTX\.\w+/.test(J),f0=/window\.STX\s*=/.test(J);if(X0&&$1&&!f0){let s=`<script data-stx-scoped>
13323
+ ${w2()}
13323
13324
  </script>`;if(J.includes("</head>")){let g=J.indexOf("</head>"),y=J.slice(0,g).indexOf("<script");if(y!==-1){let v=J.slice(0,y),m=J.slice(y);J=v+s+`
13324
13325
  `+m}else J=J.replace("</head>",`${s}
13325
13326
  </head>`)}else if(J.includes("<body"))J=J.replace(/<body([^>]*)>/,`<body$1>
13326
13327
  ${s}`);else J=s+`
13327
- `+J}{let{scanScriptTags:l}=await Promise.resolve().then(() => (o5(),s$)),s=[];for(let g of l(J)){if(!/\bserver\b/i.test(g.attrs))continue;let d=g.start+g.fullMatch.indexOf(">")+1,y=nj(J,d);if(y===-1)continue;let v=y+9;while(v<J.length&&/\s/.test(J[v]))v++;s.push({start:g.start,end:v})}for(let g=s.length-1;g>=0;g--){let{start:d,end:y}=s[g];J=J.substring(0,d)+J.substring(y)}}let T0=E$(J,Y);if(T0.hasScoped)J=T0.html;let Z0=Z.__stx_event_bindings||[],A0=!1,l0=[],Z1=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:A1}=await Promise.resolve().then(() => (o5(),s$));for(let l of A1(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))l0.push({match:l.fullMatch,attrs:l.attrs,content:l.body});for(let{match:l,attrs:s,content:g}of l0){A0=!0;let d=g;e4(g,Y,X.strict);let y=await P5(g,{eventBindings:Z0,attrs:s,hasColonDirectives:Z1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});J=J.replace(l,()=>y)}if(A0)Z.__stx_event_bindings=[];return J}var p1="<!--PARENT_CONTENT_PLACEHOLDER-->";var t$=k(()=>{V2();k1();z7();A2();M2();D2();_7();B7();C2();C5();h2();m2();C4();s2();t2();ZY();J1();u5();a0();GY();zY();$X();JX();C6();n7();WX();$5();zX();y3();O0();jX();OX();VX();AX();N7();o5();y6();EX();u6();l6();F0();J6();u6();l6()});import Q_ from"fs";import n6 from"path";import YQ from"fs";import Y1 from"path";var r6=[72,96,128,144,152,192,384,512],a6=[120,152,167,180],t6=[16,32];async function e6($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let Q=Y1.isAbsolute(X.src)?X.src:Y1.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Y.errors.push(`Source icon not found: ${Q}`),Y.success=!1,Y;let J=Y1.resolve(Z,X.outputDir||"pwa-icons");try{YQ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||r6,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
13328
- Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let z=await W.default(Q).metadata();if(z.width&&z.width<512)Y.warnings.push(`Source icon is ${z.width}x${z.height}. Recommend using at least 512x512 for best quality.`);for(let L of G){let F=Y1.join(J,`icon-${L}x${L}.png`);if(await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let O=Y1.join(J,`icon-${L}x${L}.webp`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Y.generatedFiles.push(O)}}if(q){for(let F of a6){let O=Y1.join(J,`apple-touch-icon-${F}x${F}.png`);await W.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}let L=Y1.join(J,"apple-touch-icon.png");await W.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}for(let L of t6){let F=Y1.join(J,`favicon-${L}x${L}.png`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let B=512,_=Y1.join(J,`icon-maskable-${B}x${B}.png`),j=Math.floor(B*0.1),H=B-j*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:j,bottom:j,left:j,right:j,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(_),Y.generatedFiles.push(_)}catch(W){let U=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${U}`),Y.success=!1}return Y}function W_($){let Z=$.sizes||r6,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Z)if(J.push(`${Y}/icon-${G}x${G}.png`),X)J.push(`${Y}/icon-${G}x${G}.webp`);if(Q){J.push(`${Y}/apple-touch-icon.png`);for(let G of a6)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of t6)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function $9(){try{return await import("sharp"),!0}catch{return!1}}F$();function NQ($,Z,Y,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Y)Q.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function TQ($){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 MQ($){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 IQ($){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 DQ($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function EQ($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,Q=X?.sizes||[72,96,128,144,152,192,384,512],J=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:NQ(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=TQ(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let W=MQ($);if(W)q.share_target=W;let U=IQ($);if(U)q.file_handlers=U;let z=DQ($);if(z)q.protocol_handlers=z;if(Y.launchHandler)q.launch_handler={client_mode:Y.launchHandler};if(Y.handleLinks)q.handle_links=Y.handleLinks;if(Y.edgeSidePanel?.enabled)q.edge_side_panel={preferred_width:Y.edgeSidePanel.preferredWidth};return q}function B9($){let Z=EQ($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function V_($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function R_($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${Q.join(", ")}`);let J=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!J.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import nJ from"path";async function oJ($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=nJ.isAbsolute(Z.page)?Z.page:nJ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (t$(),iJ)),Q=await Bun.file(Y).text();return await X(Q,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return Z_($)}function Z_($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",Q=Z?.fallbackMessage||"Please check your internet connection and try again.",J=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
13328
+ `+J}{let{scanScriptTags:l}=await Promise.resolve().then(() => (o5(),s$)),s=[];for(let g of l(J)){if(!/\bserver\b/i.test(g.attrs))continue;let d=g.start+g.fullMatch.indexOf(">")+1,y=sj(J,d);if(y===-1)continue;let v=y+9;while(v<J.length&&/\s/.test(J[v]))v++;s.push({start:g.start,end:v})}for(let g=s.length-1;g>=0;g--){let{start:d,end:y}=s[g];J=J.substring(0,d)+J.substring(y)}}let T0=E$(J,Y);if(T0.hasScoped)J=T0.html;let Z0=Z.__stx_event_bindings||[],A0=!1,l0=[],Z1=/\s:[a-z][\w.-]*\s*=/.test(J),{scanScriptTags:A1}=await Promise.resolve().then(() => (o5(),s$));for(let l of A1(J,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))l0.push({match:l.fullMatch,attrs:l.attrs,content:l.body});for(let{match:l,attrs:s,content:g}of l0){A0=!0;let d=g;e4(g,Y,X.strict);let y=await P5(g,{eventBindings:Z0,attrs:s,hasColonDirectives:Z1,templateContent:$,filePath:Y,projectRoot:process.cwd(),production:X.buildMode==="compile",serverData:b});J=J.replace(l,()=>y)}if(A0)Z.__stx_event_bindings=[];return J}var p1="<!--PARENT_CONTENT_PLACEHOLDER-->";var t$=k(()=>{A2();k1();U7();N2();D2();k2();_7();B7();x2();C5();m2();l2();C4();a2();$Y();XY();J1();u5();a0();qY();jY();YX();GX();C6();n7();UX();$5();jX();y3();O0();HX();FX();AX();NX();N7();o5();y6();bX();u6();l6();F0();J6();u6();l6()});import K_ from"fs";import n6 from"path";import JQ from"fs";import Y1 from"path";var r6=[72,96,128,144,152,192,384,512],a6=[120,152,167,180],t6=[16,32];async function e6($,Z){let Y={success:!0,generatedFiles:[],errors:[],warnings:[]},X=$.pwa?.icons;if(!X?.src)return Y.errors.push("No source icon specified in pwa.icons.src"),Y.success=!1,Y;let Q=Y1.isAbsolute(X.src)?X.src:Y1.resolve(process.cwd(),X.src);if(!await Bun.file(Q).exists())return Y.errors.push(`Source icon not found: ${Q}`),Y.success=!1,Y;let J=Y1.resolve(Z,X.outputDir||"pwa-icons");try{JQ.mkdirSync(J,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${J}`),Y.success=!1,Y}let G=X.sizes||r6,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
13329
+ Icon generation requires the sharp package for image processing.`),Y.success=!1,Y}let U=await W.default(Q).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 L of G){let F=Y1.join(J,`icon-${L}x${L}.png`);if(await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F),K){let O=Y1.join(J,`icon-${L}x${L}.webp`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Y.generatedFiles.push(O)}}if(q){for(let F of a6){let O=Y1.join(J,`apple-touch-icon-${F}x${F}.png`);await W.default(Q).resize(F,F,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Y.generatedFiles.push(O)}let L=Y1.join(J,"apple-touch-icon.png");await W.default(Q).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Y.generatedFiles.push(L)}for(let L of t6){let F=Y1.join(J,`favicon-${L}x${L}.png`);await W.default(Q).resize(L,L,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(F),Y.generatedFiles.push(F)}let B=512,_=Y1.join(J,`icon-maskable-${B}x${B}.png`),j=Math.floor(B*0.1),H=B-j*2;await W.default(Q).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:j,bottom:j,left:j,right:j,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(_),Y.generatedFiles.push(_)}catch(W){let z=W instanceof Error?W.message:String(W);Y.errors.push(`Icon generation failed: ${z}`),Y.success=!1}return Y}function U_($){let Z=$.sizes||r6,Y=$.outputDir?`/${$.outputDir}`:"/pwa-icons",X=$.generateWebP??!0,Q=$.generateAppleIcons??!0,J=[];for(let G of Z)if(J.push(`${Y}/icon-${G}x${G}.png`),X)J.push(`${Y}/icon-${G}x${G}.webp`);if(Q){J.push(`${Y}/apple-touch-icon.png`);for(let G of a6)J.push(`${Y}/apple-touch-icon-${G}x${G}.png`)}for(let G of t6)J.push(`${Y}/favicon-${G}x${G}.png`);return J.push(`${Y}/icon-maskable-512x512.png`),J}async function $9(){try{return await import("sharp"),!0}catch{return!1}}F$();function MQ($,Z,Y,X){let Q=[],J=X.join(" ");for(let G of $)if(Q.push({src:`${Z}/icon-${G}x${G}.png`,sizes:`${G}x${G}`,type:"image/png",purpose:J}),Y)Q.push({src:`${Z}/icon-${G}x${G}.webp`,sizes:`${G}x${G}`,type:"image/webp",purpose:J});return Q}function IQ($){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 DQ($){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 EQ($){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 kQ($){let Z=$.pwa?.protocolHandlers;if(!Z||Z.length===0)return;return Z.map((Y)=>({protocol:Y.protocol,url:Y.url}))}function bQ($){let Z=$.pwa;if(!Z?.enabled||!Z.manifest)return null;let{manifest:Y,icons:X}=Z,Q=X?.sizes||[72,96,128,144,152,192,384,512],J=X?.outputDir?`/${X.outputDir}`:"/pwa-icons",G=X?.generateWebP??!0,K=X?.purpose||["any","maskable"],q={name:Y.name,short_name:Y.shortName||Y.name,description:Y.description,start_url:Y.startUrl||"/",display:Y.display||"standalone",display_override:Y.displayOverride,orientation:Y.orientation,theme_color:Y.themeColor,background_color:Y.backgroundColor,scope:Y.scope||"/",lang:Y.lang,dir:Y.dir,id:Y.id,categories:Y.categories,icons:MQ(Q,J,G,K)};if(Y.shortcuts&&Y.shortcuts.length>0)q.shortcuts=IQ(Y.shortcuts);if(Y.screenshots&&Y.screenshots.length>0)q.screenshots=Y.screenshots.map((B)=>({src:B.src,sizes:B.sizes,type:B.type,label:B.label,form_factor:B.platform}));let W=DQ($);if(W)q.share_target=W;let z=EQ($);if(z)q.file_handlers=z;let U=kQ($);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 B9($){let Z=bQ($);if(!Z)return"";let Y=JSON.parse(JSON.stringify(Z));return JSON.stringify(Y,null,2)}function A_($,Z){return{...Z,...$,shortcuts:$.shortcuts||Z.shortcuts,screenshots:$.screenshots||Z.screenshots,categories:$.categories||Z.categories}}function w_($){let Z=[],Y=$.pwa;if(!Y?.enabled)return Z;let X=Y.manifest;if(!X)return Z.push("PWA manifest configuration is missing"),Z;if(!X.name)Z.push("Manifest name is required");let Q=["fullscreen","standalone","minimal-ui","browser"];if(X.display&&!Q.includes(X.display))Z.push(`Invalid display mode: ${X.display}. Must be one of: ${Q.join(", ")}`);let J=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(X.orientation&&!J.includes(X.orientation))Z.push(`Invalid orientation: ${X.orientation}`);let G=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(X.themeColor&&!G.test(X.themeColor))Z.push(`Invalid theme color: ${X.themeColor}. Must be a valid hex color.`);if(X.backgroundColor&&!G.test(X.backgroundColor))Z.push(`Invalid background color: ${X.backgroundColor}. Must be a valid hex color.`);if(Y.shareTarget?.enabled){if(!Y.shareTarget.action)Z.push("Share target action URL is required")}if(Y.fileHandlers?.enabled){if(!Y.fileHandlers.accept||Object.keys(Y.fileHandlers.accept).length===0)Z.push("File handlers must specify accepted MIME types")}if(Y.protocolHandlers)for(let K of Y.protocolHandlers){if(!K.protocol)Z.push("Protocol handler missing protocol");if(!K.url||!K.url.includes("%s"))Z.push(`Protocol handler URL must contain %s placeholder: ${K.protocol}`)}return Z}import sJ from"path";async function rJ($){let Z=$.pwa?.offline;if(!Z?.enabled)return"";if(Z.page){let Y=sJ.isAbsolute(Z.page)?Z.page:sJ.resolve(process.cwd(),Z.page);if(await Bun.file(Y).exists())try{let{processDirectives:X}=await Promise.resolve().then(() => (t$(),oJ)),Q=await Bun.file(Y).text();return await X(Q,{},Y,$,new Set)}catch(X){console.warn(`[PWA] Failed to process custom offline page: ${X}`)}else console.warn(`[PWA] Custom offline page not found: ${Y}`)}return X_($)}function X_($){let Z=$.pwa?.offline,Y=$.pwa?.manifest,X=Z?.fallbackTitle||"You are offline",Q=Z?.fallbackMessage||"Please check your internet connection and try again.",J=Y?.themeColor||"#4f46e5",G=Y?.shortName||Y?.name||"App";return`<!DOCTYPE html>
13329
13330
  <html lang="en">
13330
13331
  <head>
13331
13332
  <meta charset="UTF-8">
@@ -13558,9 +13559,9 @@ Icon generation requires the sharp package for image processing.`),Y.success=!1,
13558
13559
  }, 5000);
13559
13560
  </script>
13560
13561
  </body>
13561
- </html>`}function X7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}w5();N5();import c1 from"fs";import J7 from"path";function Y_($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let Q=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:Q.length>0,message:Q.length>0?`${Q.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function X_($){let Z=[],Y=J7.join($,"manifest.json"),X=c1.existsSync(Y);if(Z.push({id:"build-manifest",name:"Manifest File",category:"required",passed:X,message:X?"manifest.json exists":"manifest.json not found in build output"}),X)try{let U=JSON.parse(c1.readFileSync(Y,"utf-8"));Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),Z.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(U.icons)&&U.icons.length>0,message:U.icons?.length?`${U.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{Z.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let Q=J7.join($,"sw.js"),J=c1.existsSync(Q);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:J,message:J?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=J7.join($,"offline.html"),K=c1.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=J7.join($,"pwa-icons");if(c1.existsSync(q)){let U=c1.readdirSync(q).filter((z)=>z.endsWith(".png")||z.endsWith(".webp"));Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:U.length>0,message:U.length>0?`${U.length} icon files generated`:"No icon files found"})}else Z.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return Z}function J_($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),X=Z.filter((q)=>q.passed).length,Q=Y.filter((q)=>q.passed).length,J=Z.length>0?X/Z.length*70:70,G=Y.length>0?Q/Y.length*30:30;return{score:Math.round(J+G),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function dw($,Z){let Y=Y_($),X=Z&&c1.existsSync(Z)?X_(Z):[];return J_([...Y,...X])}function mw($){let Z=[];Z.push(`
13562
+ </html>`}function X7($){return $.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}w5();N5();import c1 from"fs";import J7 from"path";function J_($){let Z=[],Y=$.pwa;if(Z.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Y?.enabled===!0,message:Y?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Y?.enabled)return Z;Z.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Y.manifest?.name),message:Y.manifest?.name?`App name: "${Y.manifest.name}"`:"Missing required manifest name"}),Z.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Y.manifest?.shortName),message:Y.manifest?.shortName?`Short name: "${Y.manifest.shortName}"`:"Short name not set (will use full name)"}),Z.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Y.manifest?.description),message:Y.manifest?.description?"Description is set":"App description not provided"}),Z.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Y.manifest?.themeColor),message:Y.manifest?.themeColor?`Theme color: ${Y.manifest.themeColor}`:"Theme color not set"}),Z.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Y.manifest?.backgroundColor),message:Y.manifest?.backgroundColor?`Background color: ${Y.manifest.backgroundColor}`:"Background color not set"}),Z.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Y.manifest?.display||""),message:Y.manifest?.display?`Display mode: ${Y.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),Z.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Y.manifest?.startUrl),message:Y.manifest?.startUrl?`Start URL: ${Y.manifest.startUrl}`:"Start URL not set"}),Z.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Y.icons?.src),message:Y.icons?.src?`Icon source: ${Y.icons.src}`:"No icon source configured"});let X=Y.icons?.sizes||[];Z.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:X.includes(192),message:X.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),Z.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:X.includes(512),message:X.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),Z.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Y.icons?.purpose?.includes("maskable")||!1,message:Y.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),Z.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Y.serviceWorker),message:Y.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),Z.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Y.serviceWorker?.cacheVersion),message:Y.serviceWorker?.cacheVersion?`Cache version: ${Y.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),Z.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Y.offline?.enabled===!0,message:Y.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let Q=Y.routes||[];return Z.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:Q.length>0,message:Q.length>0?`${Q.length} route caching strategies configured`:"No custom caching strategies defined"}),Z.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Y.push?.enabled||Boolean(Y.push?.vapidPublicKey),message:Y.push?.enabled?Y.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),Z.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Y.shareTarget?.enabled?`Share target enabled at ${Y.shareTarget.action}`:"Share target not enabled"}),Z.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Y.autoInject!==!1,message:Y.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),Z}function Q_($){let Z=[],Y=J7.join($,"manifest.json"),X=c1.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(c1.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 Q=J7.join($,"sw.js"),J=c1.existsSync(Q);Z.push({id:"build-sw",name:"Service Worker File",category:"required",passed:J,message:J?"Service worker (sw.js) exists":"Service worker not found in build output"});let G=J7.join($,"offline.html"),K=c1.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=J7.join($,"pwa-icons");if(c1.existsSync(q)){let z=c1.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 G_($){let Z=$.filter((q)=>q.category==="required"),Y=$.filter((q)=>q.category==="recommended"),X=Z.filter((q)=>q.passed).length,Q=Y.filter((q)=>q.passed).length,J=Z.length>0?X/Z.length*70:70,G=Y.length>0?Q/Y.length*30:30;return{score:Math.round(J+G),passed:$.filter((q)=>q.passed).length,failed:$.filter((q)=>!q.passed&&q.category==="required").length,warnings:$.filter((q)=>!q.passed&&q.category!=="required").length,checks:$}}function uw($,Z){let Y=J_($),X=Z&&c1.existsSync(Z)?Q_(Z):[];return G_([...Y,...X])}function lw($){let Z=[];Z.push(`
13562
13563
  === PWA Audit Report ===
13563
13564
  `);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}
13564
13565
  `);let X=["required","recommended","optional"];for(let Q of X){let J=$.checks.filter((G)=>G.category===Q);if(J.length===0)continue;Z.push(`
13565
13566
  ${Q.toUpperCase()}:`);for(let G of J){let K=G.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if(Z.push(` ${K} ${G.name}: ${G.message}`),G.details)Z.push(` ${G.details}`)}}return Z.push(""),Z.join(`
13566
- `)}I3();F$();w5();N5();async function aw($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{Q_.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=B9($);if(J){let G=n6.join(Z,"manifest.json");await Bun.write(G,J),Y.files.manifest=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate manifest.json: ${G}`),Y.success=!1}if(X.icons?.src)if(await $9()){let G=await e6($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await oJ($);if(J){let G=n6.join(Z,"offline.html");await Bun.write(G,J),Y.files.offlinePage=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate offline page: ${G}`),Y.success=!1}let Q;if(X.precache?.enabled){let J=T1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=O$($,Z);if(J){let G=i1($),K=n6.join(Z,G);await Bun.write(K,J),Y.files.serviceWorker=K}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate service worker: ${G}`),Y.success=!1}return Y}function tw($,Z){return U7($,Z)}function ew($){return $.pwa?.enabled===!0}export{R_ as validateManifest,dw as runPwaAudit,AL as registerPwaDirectives,WW as pwaUpdateDirective,zW as pwaPushDirective,UW as pwaOfflineDirective,qW as pwaInstallDirective,M3 as pwaDirectives,tw as processPwaHtml,V_ as mergeManifestConfig,U9 as isWorkboxEnabled,$9 as isSharpAvailable,ew as isPwaEnabled,U7 as injectPwaTags,i1 as getServiceWorkerFileName,W_ as getExpectedIconPaths,wQ as generateThemeColorMeta,RQ as generateSwRegistrationScript,VQ as generateServiceWorkerAuto,O$ as generateServiceWorker,L$ as generatePwaTags,e6 as generatePwaIcons,H$ as generatePrecacheManifestJs,T1 as generatePrecacheManifest,oJ as generateOfflinePage,AQ as generateManifestLink,B9 as generateManifestJson,EQ as generateManifest,Y9 as formatSize,mw as formatAuditResult,J_ as calculateAuditResult,aw as buildPwaAssets,Y_ as auditConfig,X_ as auditBuildOutput,t6 as FAVICON_SIZES,r6 as DEFAULT_ICON_SIZES,a6 as APPLE_TOUCH_ICON_SIZES};
13567
+ `)}I3();F$();w5();N5();async function ew($,Z){let Y={success:!0,files:{icons:[]},errors:[],warnings:[]},X=$.pwa;if(!X?.enabled)return Y;try{K_.mkdirSync(Z,{recursive:!0})}catch{return Y.errors.push(`Failed to create output directory: ${Z}`),Y.success=!1,Y}try{let J=B9($);if(J){let G=n6.join(Z,"manifest.json");await Bun.write(G,J),Y.files.manifest=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate manifest.json: ${G}`),Y.success=!1}if(X.icons?.src)if(await $9()){let G=await e6($,Z);if(Y.files.icons=G.generatedFiles,Y.warnings.push(...G.warnings),!G.success)Y.errors.push(...G.errors),Y.success=!1}else Y.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(X.offline?.enabled)try{let J=await rJ($);if(J){let G=n6.join(Z,"offline.html");await Bun.write(G,J),Y.files.offlinePage=G}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate offline page: ${G}`),Y.success=!1}let Q;if(X.precache?.enabled){let J=T1(Z,$);Q={fileCount:J.fileCount,totalSize:J.totalSize},Y.precacheStats=Q}try{let J=O$($,Z);if(J){let G=i1($),K=n6.join(Z,G);await Bun.write(K,J),Y.files.serviceWorker=K}}catch(J){let G=J instanceof Error?J.message:String(J);Y.errors.push(`Failed to generate service worker: ${G}`),Y.success=!1}return Y}function $N($,Z){return z7($,Z)}function ZN($){return $.pwa?.enabled===!0}export{w_ as validateManifest,uw as runPwaAudit,NL as registerPwaDirectives,UW as pwaUpdateDirective,jW as pwaPushDirective,BW as pwaOfflineDirective,zW as pwaInstallDirective,M3 as pwaDirectives,$N as processPwaHtml,A_ as mergeManifestConfig,z9 as isWorkboxEnabled,$9 as isSharpAvailable,ZN as isPwaEnabled,z7 as injectPwaTags,i1 as getServiceWorkerFileName,U_ as getExpectedIconPaths,TQ as generateThemeColorMeta,wQ as generateSwRegistrationScript,AQ as generateServiceWorkerAuto,O$ as generateServiceWorker,L$ as generatePwaTags,e6 as generatePwaIcons,H$ as generatePrecacheManifestJs,T1 as generatePrecacheManifest,rJ as generateOfflinePage,NQ as generateManifestLink,B9 as generateManifestJson,bQ as generateManifest,Y9 as formatSize,lw as formatAuditResult,G_ as calculateAuditResult,ew as buildPwaAssets,J_ as auditConfig,Q_ as auditBuildOutput,t6 as FAVICON_SIZES,r6 as DEFAULT_ICON_SIZES,a6 as APPLE_TOUCH_ICON_SIZES};