@stacksjs/stx 0.2.188 → 0.2.189

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:V$,getOwnPropertyNames:aK,getOwnPropertyDescriptor:tK}=Object,eK=Object.prototype.hasOwnProperty;function XU(X){return this[X]}var K6=(X)=>{var $=(q6??=new WeakMap).get(X),Z;if($)return $;if($=V$({},"__esModule",{value:!0}),X&&typeof X==="object"||typeof X==="function"){for(var Y of aK(X))if(!eK.call($,Y))V$($,Y,{get:XU.bind(X,Y),enumerable:!(Z=tK(X,Y))||Z.enumerable})}return q6.set(X,$),$},q6;var $U=(X)=>X;function ZU(X,$){this[X]=$U.bind(null,$)}var n=(X,$)=>{for(var Z in $)V$(X,Z,{get:$[Z],enumerable:!0,configurable:!0,set:ZU.bind($,Z)})};var E=(X,$)=>()=>(X&&($=X(X=0)),$);var W0=import.meta.require;import QX from"fs";import qX from"path";function GU(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X[Z];$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(16).padStart(8,"0")}function QU(X,$){let Z=qX.basename(X);for(let Y of $)if(Y.startsWith("*.")){let J=Y.slice(1);if(Z.endsWith(J))return!0}else if(Y.includes("*")){let J=new RegExp(`^${Y.replace(/\*/g,".*")}$`);if(J.test(Z)||J.test(X))return!0}else if(Z===Y||X.includes(Y))return!0;return!1}function qU(X,$,Z){let Y=qX.extname(X).toLowerCase(),J=JU[Y],G=(Z.maxFileSizeKB||500)*1024;if($>G)return!1;if(Z.exclude&&QU(X,Z.exclude))return!1;if(Z.include&&Z.include.length>0){for(let Q of Z.include)if(Q.startsWith("*.")){if(X.endsWith(Q.slice(1)))return!0}else if(X.includes(Q))return!0}if(J&&Z[J]===!0)return!0;if(!J)return!1;return!1}function B6(X,$,Z,Y){let J=QX.readdirSync(X,{withFileTypes:!0});for(let G of J){let Q=qX.join(X,G.name);if(G.isDirectory()){if(["node_modules",".git",".stx"].includes(G.name))continue;B6(Q,$,Z,Y)}else if(G.isFile()){let q=QX.statSync(Q),K=qX.relative($,Q);if(qU(K,q.size,Z)){let U=QX.readFileSync(Q),W=GU(U),z=`/${K.replace(/\\/g,"/")}`;Y.push({url:z,revision:W,size:q.size})}}}}function p1(X,$){let Z=$.pwa?.precache,Y=[];if(!Z?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!QX.existsSync(X))return{entries:[],totalSize:0,fileCount:0};B6(X,X,Z,Y),Y.sort((G,Q)=>G.url.localeCompare(Q.url));let J=Y.reduce((G,Q)=>G+Q.size,0);return{entries:Y,totalSize:J,fileCount:Y.length}}function KX(X){if(X.entries.length===0)return"[]";return`[
2
+ var{defineProperty:V$,getOwnPropertyNames:aW,getOwnPropertyDescriptor:tW}=Object,eW=Object.prototype.hasOwnProperty;function XK(X){return this[X]}var W6=(X)=>{var $=(q6??=new WeakMap).get(X),Z;if($)return $;if($=V$({},"__esModule",{value:!0}),X&&typeof X==="object"||typeof X==="function"){for(var Y of aW(X))if(!eW.call($,Y))V$($,Y,{get:XK.bind(X,Y),enumerable:!(Z=tW(X,Y))||Z.enumerable})}return q6.set(X,$),$},q6;var $K=(X)=>X;function ZK(X,$){this[X]=$K.bind(null,$)}var i=(X,$)=>{for(var Z in $)V$(X,Z,{get:$[Z],enumerable:!0,configurable:!0,set:ZK.bind($,Z)})};var E=(X,$)=>()=>(X&&($=X(X=0)),$);var U0=import.meta.require;import QX from"fs";import qX from"path";function GK(X){let $=0;for(let Z=0;Z<X.length;Z++){let Y=X[Z];$=($<<5)-$+Y,$=$&$}return Math.abs($).toString(16).padStart(8,"0")}function QK(X,$){let Z=qX.basename(X);for(let Y of $)if(Y.startsWith("*.")){let J=Y.slice(1);if(Z.endsWith(J))return!0}else if(Y.includes("*")){let J=new RegExp(`^${Y.replace(/\*/g,".*")}$`);if(J.test(Z)||J.test(X))return!0}else if(Z===Y||X.includes(Y))return!0;return!1}function qK(X,$,Z){let Y=qX.extname(X).toLowerCase(),J=JK[Y],G=(Z.maxFileSizeKB||500)*1024;if($>G)return!1;if(Z.exclude&&QK(X,Z.exclude))return!1;if(Z.include&&Z.include.length>0){for(let Q of Z.include)if(Q.startsWith("*.")){if(X.endsWith(Q.slice(1)))return!0}else if(X.includes(Q))return!0}if(J&&Z[J]===!0)return!0;if(!J)return!1;return!1}function B6(X,$,Z,Y){let J=QX.readdirSync(X,{withFileTypes:!0});for(let G of J){let Q=qX.join(X,G.name);if(G.isDirectory()){if(["node_modules",".git",".stx"].includes(G.name))continue;B6(Q,$,Z,Y)}else if(G.isFile()){let q=QX.statSync(Q),W=qX.relative($,Q);if(qK(W,q.size,Z)){let K=QX.readFileSync(Q),U=GK(K),z=`/${W.replace(/\\/g,"/")}`;Y.push({url:z,revision:U,size:q.size})}}}}function p1(X,$){let Z=$.pwa?.precache,Y=[];if(!Z?.enabled)return{entries:[],totalSize:0,fileCount:0};if(!QX.existsSync(X))return{entries:[],totalSize:0,fileCount:0};B6(X,X,Z,Y),Y.sort((G,Q)=>G.url.localeCompare(Q.url));let J=Y.reduce((G,Q)=>G+Q.size,0);return{entries:Y,totalSize:J,fileCount:Y.length}}function WX(X){if(X.entries.length===0)return"[]";return`[
3
3
  ${X.entries.map((Z)=>` { url: '${Z.url}', revision: '${Z.revision}' }`).join(`,
4
4
  `)}
5
- ]`}function _6(X){if(X<1024)return`${X} B`;if(X<1048576)return`${(X/1024).toFixed(1)} KB`;return`${(X/1048576).toFixed(2)} MB`}var JU;var Y7=E(()=>{JU={".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 KU(X){let $={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return $[X]||$["network-first"]}function A$(X){return KU(X).className}function H6(X){let $=X.pwa;if(!$?.enabled)return"";let Z=$.routes||[],Y=$.cacheStorage,J=[];for(let G of Z){let Q=A$(G.strategy),q=[];if(G.maxAgeSeconds||G.maxEntries||Y?.maxEntries){let U=G.maxEntries||Y?.maxEntries||100,W=G.maxAgeSeconds||(Y?.maxAge?Y.maxAge*24*60*60:void 0);q.push(`new ExpirationPlugin({
6
- maxEntries: ${U},
7
- ${W?`maxAgeSeconds: ${W},`:""}
5
+ ]`}function _6(X){if(X<1024)return`${X} B`;if(X<1048576)return`${(X/1024).toFixed(1)} KB`;return`${(X/1048576).toFixed(2)} MB`}var JK;var Y7=E(()=>{JK={".html":"includeHtml",".htm":"includeHtml",".js":"includeJs",".mjs":"includeJs",".css":"includeCss",".png":"includeImages",".jpg":"includeImages",".jpeg":"includeImages",".gif":"includeImages",".webp":"includeImages",".svg":"includeImages",".ico":"includeImages",".woff":"includeFonts",".woff2":"includeFonts",".ttf":"includeFonts",".eot":"includeFonts",".otf":"includeFonts"}});function WK(X){let $={"cache-first":{className:"CacheFirst",importFrom:"workbox-strategies"},"network-first":{className:"NetworkFirst",importFrom:"workbox-strategies"},"stale-while-revalidate":{className:"StaleWhileRevalidate",importFrom:"workbox-strategies"},"network-only":{className:"NetworkOnly",importFrom:"workbox-strategies"},"cache-only":{className:"CacheOnly",importFrom:"workbox-strategies"}};return $[X]||$["network-first"]}function A$(X){return WK(X).className}function H6(X){let $=X.pwa;if(!$?.enabled)return"";let Z=$.routes||[],Y=$.cacheStorage,J=[];for(let G of Z){let Q=A$(G.strategy),q=[];if(G.maxAgeSeconds||G.maxEntries||Y?.maxEntries){let K=G.maxEntries||Y?.maxEntries||100,U=G.maxAgeSeconds||(Y?.maxAge?Y.maxAge*24*60*60:void 0);q.push(`new ExpirationPlugin({
6
+ maxEntries: ${K},
7
+ ${U?`maxAgeSeconds: ${U},`:""}
8
8
  purgeOnQuotaError: true,
9
9
  })`)}if(G.strategy==="network-first"||G.strategy==="stale-while-revalidate")q.push(`new CacheableResponsePlugin({
10
10
  statuses: [0, 200],
11
- })`);let K=UU(G.pattern);J.push(`
11
+ })`);let W=KK(G.pattern);J.push(`
12
12
  // ${G.pattern}
13
13
  registerRoute(
14
- ${K},
14
+ ${W},
15
15
  new ${Q}({
16
- cacheName: '${G.cacheName||zU(G.pattern)}',
16
+ cacheName: '${G.cacheName||zK(G.pattern)}',
17
17
  ${q.length>0?`plugins: [
18
18
  ${q.join(`,
19
19
  `)}
20
20
  ],`:""}
21
21
  })
22
22
  );`)}return J.join(`
23
- `)}function UU(X){if(X.startsWith("*.")){let $=X.slice(2);return`({ request }) => request.destination === '${WU($)}'`}if(X.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${X.slice(0,-3)}')`;if(X.endsWith("/*")){let $=X.slice(0,-2);return`({ url }) => url.pathname.startsWith('${$}') && !url.pathname.slice(${$.length+1}).includes('/')`}if(X.includes("*")&&!X.startsWith("*")){let[$,Z]=X.split("*");return`({ url }) => url.pathname.startsWith('${$}') && url.pathname.endsWith('${Z}')`}if(X==="/"||!X.includes("*"))return`({ url }) => url.pathname === '${X}'`;return`new RegExp('${wU(X).replace(/\\\*/g,".*")}')`}function WU(X){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[X.toLowerCase()]||"empty"}function zU(X){return"stx-"+X.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function wU(X){return X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var V6={};n(V6,{isWorkboxEnabled:()=>F6,getServiceWorkerGenerator:()=>OU,generateWorkboxServiceWorker:()=>L6,generateWorkboxConfig:()=>O6});function O6(X,$){let Z=X.pwa;if(!Z?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let Y=Z.serviceWorker||{},J=Z.routes||[],G=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],Q=new Set;for(let U of J)Q.add(A$(U.strategy));if(Q.size>0)G.push({name:"workbox-strategies",exports:Array.from(Q)});if(J.some((U)=>U.maxAgeSeconds||U.maxEntries)||Z.cacheStorage)G.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(J.some((U)=>U.strategy==="network-first"||U.strategy==="stale-while-revalidate"))G.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Z.backgroundSync?.enabled)G.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(Y.navigationPreload)G.push({name:"workbox-navigation-preload",exports:["enable"]});let K=$?p1($,X):void 0;return{mode:"generate",modules:G,precacheManifest:K?.entries,skipWaiting:Y.skipWaiting??!0,clientsClaim:Y.clientsClaim??!0,offlineFallback:Z.offline?.enabled?"/offline.html":void 0,navigationPreload:Y.navigationPreload??!1,cacheVersion:Y.cacheVersion||"1.0.0"}}function L6(X,$){let Z=X.pwa;if(!Z?.enabled)return"";let Y=O6(X,$),J=Z.serviceWorker||{},G=Z.push,Q=Z.backgroundSync,q=$?p1($,X):null,K=q?KX(q):"[]",U=jU(Y.modules),W=H6(X);return`/**
23
+ `)}function KK(X){if(X.startsWith("*.")){let $=X.slice(2);return`({ request }) => request.destination === '${UK($)}'`}if(X.endsWith("/**"))return`({ url }) => url.pathname.startsWith('${X.slice(0,-3)}')`;if(X.endsWith("/*")){let $=X.slice(0,-2);return`({ url }) => url.pathname.startsWith('${$}') && !url.pathname.slice(${$.length+1}).includes('/')`}if(X.includes("*")&&!X.startsWith("*")){let[$,Z]=X.split("*");return`({ url }) => url.pathname.startsWith('${$}') && url.pathname.endsWith('${Z}')`}if(X==="/"||!X.includes("*"))return`({ url }) => url.pathname === '${X}'`;return`new RegExp('${wK(X).replace(/\\\*/g,".*")}')`}function UK(X){return{js:"script",mjs:"script",css:"style",html:"document",htm:"document",png:"image",jpg:"image",jpeg:"image",gif:"image",svg:"image",webp:"image",avif:"image",ico:"image",woff:"font",woff2:"font",ttf:"font",eot:"font",otf:"font"}[X.toLowerCase()]||"empty"}function zK(X){return"stx-"+X.replace(/[^\w]/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"").toLowerCase().slice(0,30)+"-cache"}function wK(X){return X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}var V6={};i(V6,{isWorkboxEnabled:()=>F6,getServiceWorkerGenerator:()=>LK,generateWorkboxServiceWorker:()=>O6,generateWorkboxConfig:()=>L6});function L6(X,$){let Z=X.pwa;if(!Z?.enabled)return{mode:"generate",modules:[],skipWaiting:!0,clientsClaim:!0};let Y=Z.serviceWorker||{},J=Z.routes||[],G=[{name:"workbox-precaching",exports:["precacheAndRoute","cleanupOutdatedCaches"]},{name:"workbox-routing",exports:["registerRoute","NavigationRoute","setDefaultHandler"]}],Q=new Set;for(let K of J)Q.add(A$(K.strategy));if(Q.size>0)G.push({name:"workbox-strategies",exports:Array.from(Q)});if(J.some((K)=>K.maxAgeSeconds||K.maxEntries)||Z.cacheStorage)G.push({name:"workbox-expiration",exports:["ExpirationPlugin"]});if(J.some((K)=>K.strategy==="network-first"||K.strategy==="stale-while-revalidate"))G.push({name:"workbox-cacheable-response",exports:["CacheableResponsePlugin"]});if(Z.backgroundSync?.enabled)G.push({name:"workbox-background-sync",exports:["BackgroundSyncPlugin","Queue"]});if(Y.navigationPreload)G.push({name:"workbox-navigation-preload",exports:["enable"]});let W=$?p1($,X):void 0;return{mode:"generate",modules:G,precacheManifest:W?.entries,skipWaiting:Y.skipWaiting??!0,clientsClaim:Y.clientsClaim??!0,offlineFallback:Z.offline?.enabled?"/offline.html":void 0,navigationPreload:Y.navigationPreload??!1,cacheVersion:Y.cacheVersion||"1.0.0"}}function O6(X,$){let Z=X.pwa;if(!Z?.enabled)return"";let Y=L6(X,$),J=Z.serviceWorker||{},G=Z.push,Q=Z.backgroundSync,q=$?p1($,X):null,W=q?WX(q):"[]",K=jK(Y.modules),U=H6(X);return`/**
24
24
  * Service Worker - Generated by stx with Workbox
25
25
  * Cache Version: ${Y.cacheVersion}
26
26
  *
@@ -42,7 +42,7 @@ importScripts('https://storage.googleapis.com/workbox-cdn/releases/7.0.0/workbox
42
42
  workbox.setConfig({ debug: true });
43
43
 
44
44
  // Extract modules from workbox global
45
- ${U}
45
+ ${K}
46
46
 
47
47
  const CACHE_VERSION = '${Y.cacheVersion}';
48
48
  const OFFLINE_PAGE = '${Y.offlineFallback||"/offline.html"}';
@@ -56,7 +56,7 @@ cleanupOutdatedCaches();
56
56
 
57
57
  // Precache static assets
58
58
  // The manifest is injected during build or defined below
59
- const PRECACHE_MANIFEST = ${K};
59
+ const PRECACHE_MANIFEST = ${W};
60
60
 
61
61
  // Add essential assets
62
62
  PRECACHE_MANIFEST.push(
@@ -79,7 +79,7 @@ enable();`:"// Navigation preload disabled"}
79
79
  // Runtime Caching
80
80
  // ============================================================================
81
81
 
82
- ${W}
82
+ ${U}
83
83
 
84
84
  // ============================================================================
85
85
  // Offline Fallback
@@ -169,13 +169,13 @@ self.addEventListener('message', (event) => {
169
169
  }
170
170
  });
171
171
 
172
- ${G?.enabled?_U(G):"// Push notifications disabled"}
172
+ ${G?.enabled?_K(G):"// Push notifications disabled"}
173
173
 
174
- ${Q?.enabled?HU(Q):"// Background sync disabled"}
174
+ ${Q?.enabled?HK(Q):"// Background sync disabled"}
175
175
 
176
176
  console.log('[Workbox SW] Service Worker loaded - Version:', CACHE_VERSION);
177
- `}function jU(X){let $=[];for(let Z of X){let Y=Z.name.replace("workbox-","");$.push(`const { ${Z.exports.join(", ")} } = workbox.${BU(Y)};`)}return $.join(`
178
- `)}function BU(X){return X.replace(/-([a-z])/g,($,Z)=>Z.toUpperCase())}function _U(X){return`
177
+ `}function jK(X){let $=[];for(let Z of X){let Y=Z.name.replace("workbox-","");$.push(`const { ${Z.exports.join(", ")} } = workbox.${BK(Y)};`)}return $.join(`
178
+ `)}function BK(X){return X.replace(/-([a-z])/g,($,Z)=>Z.toUpperCase())}function _K(X){return`
179
179
  // ============================================================================
180
180
  // Push Notifications
181
181
  // ============================================================================
@@ -244,7 +244,7 @@ self.addEventListener('notificationclick', (event) => {
244
244
  })
245
245
  );
246
246
  });
247
- `}function HU(X){return`
247
+ `}function HK(X){return`
248
248
  // ============================================================================
249
249
  // Background Sync
250
250
  // ============================================================================
@@ -306,7 +306,7 @@ self.addEventListener('message', (event) => {
306
306
  event.waitUntil(syncQueue.pushRequest({ request }));
307
307
  }
308
308
  });
309
- `}function F6(X){return X.pwa?.enabled===!0&&X.pwa?.serviceWorker?.useWorkbox===!0}function OU(X){if(F6(X))return L6;let{generateServiceWorker:$}=(J7(),K6(R6));return $}var A6=E(()=>{Y7()});var R6={};n(R6,{isWorkboxEnabled:()=>N6,getServiceWorkerFileName:()=>O5,generateServiceWorkerAuto:()=>VU,generateServiceWorker:()=>UX});function UX(X,$){let Z=X.pwa;if(!Z?.enabled)return"";let Y=Z.serviceWorker||{},J=Z.routes||[],G=Y.cacheVersion||"1.0.0",Q=Z.offline,q=Q?.page?"/offline.html":"/offline.html",K=Z.push,U=Z.backgroundSync,W=Z.cacheStorage,z=$?p1($,X):null,w=z?KX(z):"[]",B=["/","/manifest.json",...Q?.enabled?[q]:[],...Q?.precacheAssets||[]];return`/**
309
+ `}function F6(X){return X.pwa?.enabled===!0&&X.pwa?.serviceWorker?.useWorkbox===!0}function LK(X){if(F6(X))return O6;let{generateServiceWorker:$}=(J7(),W6(R6));return $}var A6=E(()=>{Y7()});var R6={};i(R6,{isWorkboxEnabled:()=>N6,getServiceWorkerFileName:()=>L5,generateServiceWorkerAuto:()=>VK,generateServiceWorker:()=>KX});function KX(X,$){let Z=X.pwa;if(!Z?.enabled)return"";let Y=Z.serviceWorker||{},J=Z.routes||[],G=Y.cacheVersion||"1.0.0",Q=Z.offline,q=Q?.page?"/offline.html":"/offline.html",W=Z.push,K=Z.backgroundSync,U=Z.cacheStorage,z=$?p1($,X):null,w=z?WX(z):"[]",B=["/","/manifest.json",...Q?.enabled?[q]:[],...Q?.precacheAssets||[]];return`/**
310
310
  * Service Worker - Auto-generated by stx
311
311
  * Cache Version: ${G}
312
312
  *
@@ -318,9 +318,9 @@ self.addEventListener('message', (event) => {
318
318
  * - cache-only: Only serve from cache
319
319
  *
320
320
  * Additional features:
321
- * - Push notifications: ${K?.enabled?"enabled":"disabled"}
322
- * - Background sync: ${U?.enabled?"enabled":"disabled"}
323
- * - Cache limits: ${W?.maxSize?`${_6(W.maxSize*1024*1024)}`:"unlimited"}
321
+ * - Push notifications: ${W?.enabled?"enabled":"disabled"}
322
+ * - Background sync: ${K?.enabled?"enabled":"disabled"}
323
+ * - Cache limits: ${U?.maxSize?`${_6(U.maxSize*1024*1024)}`:"unlimited"}
324
324
  */
325
325
 
326
326
  const CACHE_VERSION = '${G}';
@@ -341,25 +341,25 @@ const EXCLUDED_ROUTES = ${JSON.stringify(Y.excludeRoutes||[],null,2)};
341
341
 
342
342
  // Cache storage configuration
343
343
  const CACHE_CONFIG = {
344
- maxSize: ${W?.maxSize||0} * 1024 * 1024, // Convert MB to bytes
345
- maxAge: ${W?.maxAge||0} * 24 * 60 * 60 * 1000, // Convert days to ms
346
- maxEntries: ${W?.maxEntries||0},
347
- purgeStrategy: '${W?.purgeStrategy||"lru"}',
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"}',
348
348
  };
349
349
 
350
350
  // Background sync configuration
351
351
  const SYNC_CONFIG = {
352
- enabled: ${U?.enabled||!1},
353
- queueName: '${U?.queueName||"stx-sync-queue"}',
354
- maxRetries: ${U?.maxRetries||3},
355
- minInterval: ${U?.minInterval||1000},
352
+ enabled: ${K?.enabled||!1},
353
+ queueName: '${K?.queueName||"stx-sync-queue"}',
354
+ maxRetries: ${K?.maxRetries||3},
355
+ minInterval: ${K?.minInterval||1000},
356
356
  };
357
357
 
358
358
  // Push notification configuration
359
359
  const PUSH_CONFIG = {
360
- enabled: ${K?.enabled||!1},
361
- defaultIcon: '${K?.defaultIcon||"/pwa-icons/icon-192x192.png"}',
362
- defaultBadge: '${K?.defaultBadge||"/pwa-icons/icon-72x72.png"}',
360
+ enabled: ${W?.enabled||!1},
361
+ defaultIcon: '${W?.defaultIcon||"/pwa-icons/icon-192x192.png"}',
362
+ defaultBadge: '${W?.defaultBadge||"/pwa-icons/icon-72x72.png"}',
363
363
  };
364
364
 
365
365
  /**
@@ -501,9 +501,9 @@ self.addEventListener('message', (event) => {
501
501
  }
502
502
  });
503
503
 
504
- ${K?.enabled?LU():"// Push notifications disabled"}
504
+ ${W?.enabled?OK():"// Push notifications disabled"}
505
505
 
506
- ${U?.enabled?FU():"// Background sync disabled"}
506
+ ${K?.enabled?FK():"// 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 LU(){return`
871
+ `}function OK(){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 FU(){return`
953
+ `}function FK(){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 O5(X){return X.pwa?.serviceWorker?.fileName||"sw.js"}function N6(X){return X.pwa?.enabled===!0&&X.pwa?.serviceWorker?.useWorkbox===!0}function VU(X,$){if(!X.pwa?.enabled)return"";if(N6(X)){let{generateWorkboxServiceWorker:Z}=(A6(),K6(V6));return Z(X,$)}return UX(X,$)}var J7=E(()=>{Y7()});var T6={};n(T6,{injectPwaTags:()=>N$,generateThemeColorMeta:()=>NU,generateSwRegistrationScript:()=>AU,generatePwaTags:()=>WX,generateManifestLink:()=>RU});function WX(X){let $=X.pwa;if(!$?.enabled)return"";let Z=$.manifest,Y=$.icons?.outputDir?`/${$.icons.outputDir}`:"/pwa-icons",J=O5(X),G=`
1135
+ `}function L5(X){return X.pwa?.serviceWorker?.fileName||"sw.js"}function N6(X){return X.pwa?.enabled===!0&&X.pwa?.serviceWorker?.useWorkbox===!0}function VK(X,$){if(!X.pwa?.enabled)return"";if(N6(X)){let{generateWorkboxServiceWorker:Z}=(A6(),W6(V6));return Z(X,$)}return KX(X,$)}var J7=E(()=>{Y7()});var T6={};i(T6,{injectPwaTags:()=>N$,generateThemeColorMeta:()=>NK,generateSwRegistrationScript:()=>AK,generatePwaTags:()=>UX,generateManifestLink:()=>RK});function UX(X){let $=X.pwa;if(!$?.enabled)return"";let Z=$.manifest,Y=$.icons?.outputDir?`/${$.icons.outputDir}`:"/pwa-icons",J=L5(X),G=`
1136
1136
  <!-- stx PWA Meta Tags -->
1137
1137
  <link rel="manifest" href="/manifest.json">
1138
1138
  <meta name="theme-color" content="${R$(Z?.themeColor||"#000000")}">
@@ -1176,12 +1176,12 @@ if ('serviceWorker' in navigator) {
1176
1176
  });
1177
1177
  }
1178
1178
  </script>
1179
- <!-- End stx PWA -->`,G}function N$(X,$){let Z=$.pwa;if(!Z?.enabled||Z.autoInject===!1)return X;if(X.includes("<!-- stx PWA Meta Tags -->"))return X;if(!X.includes("</head>")){let J=X.lastIndexOf("</body>");if(J!==-1){let G=WX($);return X.slice(0,J)+G+`
1180
- `+X.slice(J)}return X+WX($)}let Y=WX($);return X.replace("</head>",`${Y}
1181
- </head>`)}function AU(X){if(!X.pwa?.enabled)return"";return`<script>
1179
+ <!-- End stx PWA -->`,G}function N$(X,$){let Z=$.pwa;if(!Z?.enabled||Z.autoInject===!1)return X;if(X.includes("<!-- stx PWA Meta Tags -->"))return X;if(!X.includes("</head>")){let J=X.lastIndexOf("</body>");if(J!==-1){let G=UX($);return X.slice(0,J)+G+`
1180
+ `+X.slice(J)}return X+UX($)}let Y=UX($);return X.replace("</head>",`${Y}
1181
+ </head>`)}function AK(X){if(!X.pwa?.enabled)return"";return`<script>
1182
1182
  if ('serviceWorker' in navigator) {
1183
1183
  window.addEventListener('load', function() {
1184
- navigator.serviceWorker.register('/${O5(X)}')
1184
+ navigator.serviceWorker.register('/${L5(X)}')
1185
1185
  .then(function(registration) {
1186
1186
  console.log('[PWA] Service Worker registered:', registration.scope);
1187
1187
  })
@@ -1190,8 +1190,8 @@ if ('serviceWorker' in navigator) {
1190
1190
  });
1191
1191
  });
1192
1192
  }
1193
- </script>`}function RU(){return'<link rel="manifest" href="/manifest.json">'}function NU(X){return`<meta name="theme-color" content="${R$(X)}">`}function R$(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var zX=E(()=>{J7()});function T$(X){return`--stx-${X}`}function M$(X,$){let Z=$.lastIndexOf("-");if(Z===-1)return typeof X[$]==="string"?X[$]:void 0;let Y=X[$.slice(0,Z)];if(!Y||typeof Y!=="object")return;let J=Y[$.slice(Z+1)];return typeof J==="string"?J:void 0}function I6(X){let $={};for(let[Z,Y]of Object.entries(k6)){let J=M$(X,Y.light);if(J===void 0)continue;$[Z]=`var(${T$(Z)}, ${J})`}return $}function E6(X){let $=[],Z=[];for(let[Y,J]of Object.entries(k6)){let G=M$(X,J.light),Q=M$(X,J.dark);if(G===void 0)continue;if($.push(` ${T$(Y)}: ${G};`),Q!==void 0)Z.push(` ${T$(Y)}: ${Q};`)}if($.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...$,"}",".dark {",...Z,"}",""].join(`
1194
- `)}var k6;var D6=E(()=>{k6={fg:{light:"gray-900",dark:"gray-100",description:"Primary text"},"fg-strong":{light:"gray-700",dark:"gray-300",description:"Labels, secondary headings"},"fg-muted":{light:"gray-600",dark:"gray-400",description:"Supporting text"},"fg-soft":{light:"gray-500",dark:"gray-400",description:"De-emphasised text"},"fg-subtle":{light:"gray-400",dark:"gray-500",description:"Placeholders, disabled text"},surface:{light:"gray-50",dark:"gray-800",description:"Page and panel background"},"surface-raised":{light:"gray-100",dark:"gray-700",description:"Cards, popovers"},"surface-sunken":{light:"gray-200",dark:"gray-700",description:"Wells, track backgrounds"},line:{light:"gray-200",dark:"gray-700",description:"Default border, divider"},"line-strong":{light:"gray-300",dark:"gray-600",description:"Input border, focus ring track"},accent:{light:"indigo-600",dark:"indigo-400",description:"Primary action, selected state"},info:{light:"blue-600",dark:"blue-400",description:"Informational emphasis, links"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-500",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"indigo-600",dark:"indigo-500",description:"Primary button fill"},"info-solid":{light:"blue-600",dark:"blue-500",description:"Informational fill"},"danger-solid":{light:"red-600",dark:"red-500",description:"Destructive button fill"},"success-solid":{light:"green-600",dark:"green-500",description:"Confirmation fill"}}});function y6(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function k$(X,$){let Z={...X};for(let[Y,J]of Object.entries($))Z[Y]=y6(J)&&y6(Z[Y])?k$(Z[Y],J):J;return Z}function b6(X={},$={}){let Z=X.theme||{},Y=$.theme||{},{extend:J,...G}=Y,{extend:Q,...q}=Z,K=q.colors||{};q.colors={...K,...I6(K)};let U=k$(q,G),W=k$(Q||{},J||{});if(Object.keys(W).length>0)U.extend=W;let z=[...X.safelist||[],...$.safelist||[]],w={...X.shortcuts||{},...$.shortcuts||{}},B=[...X.preflights||[],...$.preflights||[]];return{config:{...X,...$,theme:U,safelist:z,shortcuts:w,...B.length>0?{preflights:B}:{},content:[],output:""},safelist:z,shortcuts:w,includePreflight:$.preflight!==!1,minify:$.minify===!0,tokenCSS:E6(K)}}var S6=E(()=>{D6()});import G7 from"path";function P6(X){C6=X?.trim()||null}function Q7(){return process.env[yU]?.trim()||C6||L5}function q7(X=process.cwd(),...$){let Z=Q7();return G7.isAbsolute(Z)?G7.join(Z,...$):G7.join(X,Z,...$)}function K7(X){if(!X||G7.isAbsolute(X))return X;let $=X.replace(/\\/g,"/");if($!==L5&&!$.startsWith(`${L5}/`))return X;let Z=$.slice(L5.length+1);return Z?G7.join(Q7(),Z):Q7()}var L5=".stx",yU="STX_DIR",C6=null;var wX=()=>{};var k0;var v6=E(()=>{k0={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"}});var x6=()=>{};function f6(X,$,Z,Y){let J=X;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,q,K)=>{let W={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[q]||"Make this element accessible";return`<!-- a11y-hint: ${K||W} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(G,(Q,q)=>{return`<span class="sr-only">${q.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,q,K)=>{return`<span id="${`desc-${q}`}" class="sr-only">${K}</span>`}),J}var g6,h6;var I$=E(()=>{x6();g6={name:"a11y",handler:(X,$,Z,Y)=>{if(!$.length)return X;let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"",q={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${G||q} -->${X}`},hasEndTag:!1},h6={name:"screenReader",handler:(X)=>{return`<span class="sr-only">${X}</span>`},hasEndTag:!0}});function bU(X,$={}){let{duration:Z,delay:Y,ease:J,direction:G,custom:Q}={...w1,...$};if(X==="custom"&&Q)return Q;switch(X){case"fade":return`${G==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1193
+ </script>`}function RK(){return'<link rel="manifest" href="/manifest.json">'}function NK(X){return`<meta name="theme-color" content="${R$(X)}">`}function R$(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}var zX=E(()=>{J7()});function T$(X){return`--stx-${X}`}function M$(X,$){let Z=$.lastIndexOf("-");if(Z===-1)return typeof X[$]==="string"?X[$]:void 0;let Y=X[$.slice(0,Z)];if(!Y||typeof Y!=="object")return;let J=Y[$.slice(Z+1)];return typeof J==="string"?J:void 0}function I6(X){let $={};for(let[Z,Y]of Object.entries(k6)){let J=M$(X,Y.light);if(J===void 0)continue;$[Z]=`var(${T$(Z)}, ${J})`}return $}function E6(X){let $=[],Z=[];for(let[Y,J]of Object.entries(k6)){let G=M$(X,J.light),Q=M$(X,J.dark);if(G===void 0)continue;if($.push(` ${T$(Y)}: ${G};`),Q!==void 0)Z.push(` ${T$(Y)}: ${Q};`)}if($.length===0)return"";return["/* stx role tokens \u2014 override any of these to re-theme by meaning. */",":root {",...$,"}",".dark {",...Z,"}",""].join(`
1194
+ `)}var k6;var D6=E(()=>{k6={fg:{light:"gray-900",dark:"gray-100",description:"Primary text"},"fg-strong":{light:"gray-700",dark:"gray-300",description:"Labels, secondary headings"},"fg-muted":{light:"gray-600",dark:"gray-400",description:"Supporting text"},"fg-soft":{light:"gray-500",dark:"gray-400",description:"De-emphasised text"},"fg-subtle":{light:"gray-400",dark:"gray-500",description:"Placeholders, disabled text"},surface:{light:"gray-50",dark:"gray-800",description:"Page and panel background"},"surface-raised":{light:"gray-100",dark:"gray-700",description:"Cards, popovers"},"surface-sunken":{light:"gray-200",dark:"gray-700",description:"Wells, track backgrounds"},line:{light:"gray-200",dark:"gray-700",description:"Default border, divider"},"line-strong":{light:"gray-300",dark:"gray-600",description:"Input border, focus ring track"},accent:{light:"indigo-600",dark:"indigo-400",description:"Primary action, selected state"},info:{light:"blue-600",dark:"blue-400",description:"Informational emphasis, links"},danger:{light:"red-600",dark:"red-400",description:"Errors, destructive actions"},success:{light:"green-600",dark:"green-400",description:"Confirmation"},warning:{light:"yellow-500",dark:"yellow-400",description:"Caution"},"accent-solid":{light:"indigo-600",dark:"indigo-500",description:"Primary button fill"},"info-solid":{light:"blue-600",dark:"blue-500",description:"Informational fill"},"danger-solid":{light:"red-600",dark:"red-500",description:"Destructive button fill"},"success-solid":{light:"green-600",dark:"green-500",description:"Confirmation fill"}}});function y6(X){return typeof X==="object"&&X!==null&&!Array.isArray(X)}function k$(X,$){let Z={...X};for(let[Y,J]of Object.entries($))Z[Y]=y6(J)&&y6(Z[Y])?k$(Z[Y],J):J;return Z}function b6(X={},$={}){let Z=X.theme||{},Y=$.theme||{},{extend:J,...G}=Y,{extend:Q,...q}=Z,W=q.colors||{};q.colors={...W,...I6(W)};let K=k$(q,G),U=k$(Q||{},J||{});if(Object.keys(U).length>0)K.extend=U;let z=[...X.safelist||[],...$.safelist||[]],w={...X.shortcuts||{},...$.shortcuts||{}},B=[...X.preflights||[],...$.preflights||[]];return{config:{...X,...$,theme:K,safelist:z,shortcuts:w,...B.length>0?{preflights:B}:{},content:[],output:""},safelist:z,shortcuts:w,includePreflight:$.preflight!==!1,minify:$.minify===!0,tokenCSS:E6(W)}}var S6=E(()=>{D6()});import G7 from"path";function P6(X){C6=X?.trim()||null}function Q7(){return process.env[yK]?.trim()||C6||O5}function q7(X=process.cwd(),...$){let Z=Q7();return G7.isAbsolute(Z)?G7.join(Z,...$):G7.join(X,Z,...$)}function W7(X){if(!X||G7.isAbsolute(X))return X;let $=X.replace(/\\/g,"/");if($!==O5&&!$.startsWith(`${O5}/`))return X;let Z=$.slice(O5.length+1);return Z?G7.join(Q7(),Z):Q7()}var O5=".stx",yK="STX_DIR",C6=null;var wX=()=>{};var k0;var v6=E(()=>{k0={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"}});var x6=()=>{};function f6(X,$,Z,Y){let J=X;J=J.replace(/@a11y\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Q,q,W)=>{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"}[q]||"Make this element accessible";return`<!-- a11y-hint: ${W||U} -->`});let G=/@screenReader\(([^@]*)\)@endScreenReader/g;return J=J.replace(G,(Q,q)=>{return`<span class="sr-only">${q.trim()}</span>`}),J=J.replace(/@ariaDescribe\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(Q,q,W)=>{return`<span id="${`desc-${q}`}" class="sr-only">${W}</span>`}),J}var g6,h6;var I$=E(()=>{x6();g6={name:"a11y",handler:(X,$,Z,Y)=>{if(!$.length)return X;let J=$[0].replace(/['"]/g,""),G=$.length>1?$[1].replace(/['"]/g,""):"",q={"aria-label":"Ensure interactive elements have accessible labels","alt-text":"Provide alternative text for images",focus:"Ensure the element can receive keyboard focus",landmark:"Use appropriate landmark roles","heading-order":"Maintain proper heading hierarchy","color-contrast":"Ensure sufficient color contrast","keyboard-nav":"Make sure element is keyboard navigable","screen-reader":"Optimize for screen reader users"}[J]||"Make this element accessible";return`<!-- a11y-hint: ${G||q} -->${X}`},hasEndTag:!1},h6={name:"screenReader",handler:(X)=>{return`<span class="sr-only">${X}</span>`},hasEndTag:!0}});function bK(X,$={}){let{duration:Z,delay:Y,ease:J,direction:G,custom:Q}={...w1,...$};if(X==="custom"&&Q)return Q;switch(X){case"fade":return`${G==="in"?"opacity: 0; animation: fadeIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="out"?"opacity: 1; animation: fadeOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"opacity: 1; transition: opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1195
1195
  @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
1196
1196
  @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }`;case"slide":return`${G==="in"?"transform: translateY(20px); opacity: 0; animation: slideIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="out"?"transform: translateY(0); opacity: 1; animation: slideOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: translateY(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1197
1197
  @keyframes slideIn { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@@ -1201,7 +1201,7 @@ if ('serviceWorker' in navigator) {
1201
1201
  @keyframes flipIn { from { transform: perspective(400px) rotateX(-90deg); opacity: 0; } to { transform: perspective(400px) rotateX(0); opacity: 1; } }
1202
1202
  @keyframes flipOut { from { transform: perspective(400px) rotateX(0); opacity: 1; } to { transform: perspective(400px) rotateX(90deg); opacity: 0; } }`;case"rotate":return`${G==="in"?"transform: rotate(-90deg); opacity: 0; animation: rotateIn var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":G==="out"?"transform: rotate(0); opacity: 1; animation: rotateOut var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms) forwards;":"transform: rotate(0); opacity: 1; transition: transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms), opacity var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);"}
1203
1203
  @keyframes rotateIn { from { transform: rotate(-90deg); opacity: 0; } to { transform: rotate(0); opacity: 1; } }
1204
- @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function SU(){return`
1204
+ @keyframes rotateOut { from { transform: rotate(0); opacity: 1; } to { transform: rotate(90deg); opacity: 0; } }`;default:return""}}function SK(){return`
1205
1205
  <script data-stx-scoped data-stx-run="once">
1206
1206
  // Motion preferences handling
1207
1207
  (function() {
@@ -1229,7 +1229,7 @@ else {
1229
1229
  });
1230
1230
  })();
1231
1231
  </script>
1232
- `}function CU(X){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Z)=>Z.test(X))}function PU(X=0.1,$="0px"){return`
1232
+ `}function CK(X){return[/@animate\b/,/@transition\b/,/@scroll(?:Animate)?\b/,/@staggered\b/,/@sequence\b/,/@motion\b/,/@animationGroup\b/,/\bstx-transition\b/,/\bstx-(?:fade|scale|flip|rotate|slide|from-|observe)\b/,/data-animate=['"](?:auto|true|false)['"]/].some((Z)=>Z.test(X))}function PK(X=0.1,$="0px"){return`
1233
1233
  <script data-stx-scoped data-stx-run="always">
1234
1234
  // Intersection Observer for scroll animations
1235
1235
  (function() {
@@ -1272,7 +1272,7 @@ else {
1272
1272
  }
1273
1273
  })();
1274
1274
  </script>
1275
- `}function vU(){return`
1275
+ `}function vK(){return`
1276
1276
  <style id="stx-animation-base">
1277
1277
  :root {
1278
1278
  --stx-transition-duration: 300ms;
@@ -1387,7 +1387,7 @@ else {
1387
1387
  transform var(--stx-transition-duration, 300ms) var(--stx-transition-ease, ease) var(--stx-transition-delay, 0ms);
1388
1388
  }
1389
1389
  </style>
1390
- `}function xU(X,$,Z={}){let{staggerDelay:Y=50,sequence:J=!1}=Z;return`
1390
+ `}function xK(X,$,Z={}){let{staggerDelay:Y=50,sequence:J=!1}=Z;return`
1391
1391
  <script data-stx-scoped data-stx-run="always">
1392
1392
  // Animation Group: ${X}
1393
1393
  (function() {
@@ -1424,13 +1424,13 @@ else {
1424
1424
  }
1425
1425
  })();
1426
1426
  </script>
1427
- `}function c6(X,$,Z,Y){let J=X;if(Y.animation?.enabled===!1)return J;let G=Z.includes("test")&&Z.includes("animation");if(!CU(J)&&!G)return J;if(!J.includes('<style id="stx-animation-base">')){let q=vU();J=J.replace("</head>",`${q}
1428
- </head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let K=PU(),U=J.lastIndexOf("</body>");if(U!==-1)J=J.slice(0,U)+K+`
1429
- `+J.slice(U)}}return J}var w1,u6,d6,m6,l6;var E$=E(()=>{w1={duration:300,delay:0,ease:"ease",direction:"both"};u6={name:"transition",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||w1.duration:w1.duration,Q=$.length>2?$[2]||w1.ease:w1.ease,q=$.length>3?Number.parseInt($[3],10)||w1.delay:w1.delay,K=$.length>4?$[4]||w1.direction:w1.direction,U=`stx-transition-${Math.random().toString(36).substr(2,9)}`,W=bU(J,{duration:G,delay:q,ease:Q,direction:K}),z="stx-transition",w="";if(J==="fade")w="stx-fade";else if(J==="slide")w="stx-slide";else if(J==="scale")w="stx-scale";else if(J==="flip")w="stx-flip";else if(J==="rotate")w="stx-rotate";return`<div id="${U}" class="${z} ${w} ${K==="out"?"stx-out":""}"
1430
- style="--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms;">${X}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},d6={name:"scrollAnimate",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||300:300,Q=$.length>2?$[2]||"ease":"ease",q=$.length>3?Number.parseFloat($[3])||0.2:0.2,K=$.length>4?Number.parseInt($[4],10)||0:0,U=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,W=`--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${K}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(J==="fade")z+=" stx-fade";else if(J==="slide-up"||J==="slide")z+=" stx-from-bottom";else if(J==="slide-down")z+=" stx-from-top";else if(J==="slide-left")z+=" stx-from-right";else if(J==="slide-right")z+=" stx-from-left";else if(J==="scale")z+=" stx-scale";else if(J.includes("-"))z+=` stx-${J}`;else z+=` stx-${J}`;return`<div id="${U}" class="${z}" style="${W}" data-threshold="${q}">${X}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},m6={name:"animationGroup",handler:(X,$,Z,Y)=>{if($.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${X}`;let J=$[0],G=$.slice(1).map((U)=>U.startsWith("#")||U.startsWith(".")?U:`#${U}`),Q=Z.staggerDelay||50,q=Z.sequence||!0,K=xU(J,G,{staggerDelay:Q,sequence:q});return`${X}
1431
- ${K}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},l6={name:"motion",handler:(X,$,Z,Y)=>{let J=$.length>0?$[0].toLowerCase()==="true":!0,G=SU();return`<div data-animate="${J?"auto":"true"}">${X}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function D$(X){return X.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>U7.includes(Z))}function W7(X){return D$(X.replace(/^\//,""))}var U7;var jX=E(()=>{U7=["components","layouts","partials","emails"]});import F5 from"fs";import z7 from"path";function w7(X,$){let Z=X.filter((Q)=>!W7(Q.pattern)),Y=["// Auto-generated by STX - do not edit"];if(Z.length===0)Y.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{Y.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let Q of Z){let q=[];for(let U of Q.params){let W=Q.pattern.includes(`:${U}?`)?"?":"";q.push(`${U}${W}: string`)}let K=q.join("; ");Y.push(` '${Q.pattern}': { ${K} }`)}Y.push(" }","}","","export {}","")}let J=Y.join(`
1432
- `),G=z7.join($,"route-types.d.ts");try{if(F5.existsSync(G)&&F5.readFileSync(G,"utf8")===J)return;F5.mkdirSync($,{recursive:!0}),F5.writeFileSync(G,J)}catch{}}function j7(X,$,Z){let Y=process.cwd(),J=z7.relative(Y,Z),G=X.filter((q)=>!W7(q.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${J||"pages"}/`,"","export const routes = ["];for(let q of G){let K=z7.relative(Y,q.filePath).replace(/\\/g,"/"),U=JSON.stringify(q.params),W=q.layout?`, layout: '${z7.relative(Y,q.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${q.pattern}', filePath: '${K}', isDynamic: ${q.isDynamic}, params: ${U}${W} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),F5.mkdirSync($,{recursive:!0}),F5.writeFileSync(z7.join($,"routes.ts"),Q.join(`
1433
- `))}var y$=E(()=>{jX()});import p6 from"path";function BX(X,$){let Y=p6.relative($,X).replace(/\.(stx|md)$/,"");if(Y=Y.split(p6.sep).join("/"),Y==="index")return"/";if(Y.endsWith("/index"))Y=Y.slice(0,-6);return Y=Y.replace(/\[\[([^\]]+)\]\]/g,":$1?"),Y=Y.replace(/\[([^\]]+)\]/g,":$1"),Y=Y.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${Y}`}function B7(X){let $=[],Z="",Y=0;while(Y<X.length){let J=X.slice(Y),G=/^\/:([^/?*]+)\?/.exec(J);if(G){$.push(G[1]),Z+="(?:/([^/]+))?",Y+=G[0].length;continue}let Q=/^:([^/?*]+)\*/.exec(J);if(Q){$.push(Q[1]),Z+="(.+)",Y+=Q[0].length;continue}let q=/^:([^/?*]+)/.exec(J);if(q){$.push(q[1]),Z+="([^/]+)",Y+=q[0].length;continue}Z+=X[Y].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),Y+=1}return{regex:new RegExp(`^${Z}$`),params:$}}function _X(X,$){let Z=X===""?"/":X;for(let Y of $){let J=Z.match(Y.regex);if(J){let G={};return Y.params.forEach((Q,q)=>{G[Q]=J[q+1]}),{route:Y,params:G}}}return null}function i6(X){let $=X.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return B7($)}var b$=()=>{};import fU from"fs";import S$ from"path";function HX(X,$){let Z=[],Y=S$.dirname(X);while(Y.startsWith($)||Y===$){let J=S$.join(Y,"_layout.stx");if(fU.existsSync(J))Z.unshift(J);if(Y===$)break;Y=S$.dirname(Y)}return Z}var C$=()=>{};import P$ from"fs";import V5 from"path";function n6(X,$){let Z=[];if(!P$.existsSync(X))return Z;let Y=P$.readdirSync(X,{withFileTypes:!0});for(let J of Y){let G=V5.join(X,J.name);if(J.isDirectory()){if(J.name.startsWith("."))continue;if(U7.includes(J.name))continue;Z.push(...n6(G,$))}else if(J.isFile()){let Q=V5.extname(J.name);if($.includes(Q)){if(J.name.startsWith("_")&&J.name!=="_layout.stx")continue;if(J.name==="_layout.stx")continue;Z.push(G)}}}return Z}class A5{routes;pagesDir;pagesDirs;config;constructor(X,$={}){this.config=$;let Z=$.pagesDirs&&$.pagesDirs.length>0?$.pagesDirs:[$.pagesDir||"pages"];this.pagesDirs=Z.map((Q)=>V5.resolve(X,Q)),this.pagesDir=this.pagesDirs[0];let Y=$.extensions||[".stx"],J=new Set;this.routes=[];for(let Q of this.pagesDirs){let q=n6(Q,Y);for(let K of q){let U=BX(K,Q);if(J.has(U))continue;J.add(U);let{regex:W,params:z}=B7(U),w=$.layouts!==!1?HX(K,Q):[];this.routes.push({pattern:U,regex:W,params:z,filePath:K,isDynamic:z.length>0,layout:w.length>0?w[w.length-1]:void 0})}}this.routes.sort((Q,q)=>{if(!Q.isDynamic&&q.isDynamic)return-1;if(Q.isDynamic&&!q.isDynamic)return 1;let K=Q.pattern.split("/").length,U=q.pattern.split("/").length;if(K!==U)return U-K;return Q.pattern.localeCompare(q.pattern)});let G=V5.resolve(X,$.stateDir||process.env.STX_DIR?.trim()||".stx");w7(this.routes,G),j7(this.routes,G,this.pagesDir)}match(X){let $=X===""?"/":X;for(let Z of this.routes){let Y=$.match(Z.regex);if(Y){let J={};return Z.params.forEach((G,Q)=>{J[G]=Y[Q+1]}),{route:Z,params:J}}}return null}resolve(X,$){let Z=this.routes.find((J)=>J.pattern===X||J.filePath.includes(X));if(!Z)return"#not-found";let Y=Z.pattern;if($)for(let[J,G]of Object.entries($))Y=Y.replace(`:${J}`,encodeURIComponent(G));return Y}addRoute(X){this.routes.push(X),this.routes.sort(($,Z)=>{if(!$.isDynamic&&Z.isDynamic)return-1;if($.isDynamic&&!Z.isDynamic)return 1;return $.pattern.localeCompare(Z.pattern)})}getLayout(X){return X.layout??null}}function r6(X,$){return new A5(X,$)}function v$(X,$){let Z=[`${$}.stx`,"error.stx"];for(let Y of Z){let J=V5.join(X,Y);if(P$.existsSync(J))return J}return null}function x$(X,$){return X.map((Z)=>{let Y=V5.relative($,Z.filePath),J=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${Y}${J}`})}var o6=E(()=>{y$();b$();C$();jX()});function f$(X){OX=X.replace(/\/$/,"")}function g$(X,$,Z={}){R5[X]={path:$,name:X,params:Z}}function h$(X){for(let[$,Z]of Object.entries(X))if(typeof Z==="string")R5[$]={path:Z,name:$};else R5[$]={...Z,name:$}}function _7(X,$={},Z=!1){let Y=R5[X];if(!Y)return console.warn(`Route [${X}] not defined.`),"#undefined-route";let J={...Y.params,...$},G=Y.path;G=G.replace(/:(\w+)/g,(q,K)=>{let U=J[K];if(U===void 0)return console.warn(`Missing parameter [${K}] for route [${X}].`),`:${K}`;return delete J[K],encodeURIComponent(String(U))});let Q=Object.entries(J);if(Q.length>0){let q=Q.map(([K,U])=>`${encodeURIComponent(K)}=${encodeURIComponent(String(U))}`).join("&");G+=(G.includes("?")?"&":"?")+q}return Z&&OX?`${OX}${G}`:G}function u$(){for(let X of Object.keys(R5))delete R5[X];OX=""}var R5,OX="";var s6=E(()=>{R5={}});import a6 from"fs";import t6 from"path";function e6(X,$={}){return{type:"redirect",path:X,options:{replace:$.replace??!1,external:$.external??!1,redirectCode:$.redirectCode??302}}}function X2(X){return{type:"abort",error:typeof X==="string"?{statusCode:500,message:X}:X}}function $2(X,$={}){return{handler:X,mode:$.mode??"universal"}}function d$(X){let $={};if(!X)return $;let Z=X.split(";");for(let Y of Z){let[J,...G]=Y.split("=");if(J){let Q=J.trim(),q=G.join("=").trim();if(Q)$[Q]=decodeURIComponent(q)}}return $}function LX(X,$,Z={}){let Y=`${encodeURIComponent(X)}=${encodeURIComponent($)}`;if(Z.expires){let J=typeof Z.expires==="number"?new Date(Date.now()+Z.expires*1000):Z.expires;Y+=`; Expires=${J.toUTCString()}`}if(Z.path)Y+=`; Path=${Z.path}`;if(Z.domain)Y+=`; Domain=${Z.domain}`;if(Z.secure)Y+="; Secure";if(Z.httpOnly)Y+="; HttpOnly";if(Z.sameSite)Y+=`; SameSite=${Z.sameSite}`;return Y}function m$(X,$){let Z=X.headers.get("cookie")||"",Y=d$(Z);return{get(J){return Y[J]},set(J,G,Q={}){Y[J]=G,$.append("Set-Cookie",LX(J,G,Q))},delete(J){delete Y[J],$.append("Set-Cookie",LX(J,"",{expires:new Date(0),path:"/"}))},getAll(){return{...Y}}}}function l$(){return{get(X){if(typeof document>"u")return;return d$(document.cookie)[X]},set(X,$,Z={}){if(typeof document>"u")return;document.cookie=LX(X,$,Z)},delete(X){if(typeof document>"u")return;document.cookie=LX(X,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return d$(document.cookie)}}}function c$(){let X=typeof window<"u"&&typeof window.localStorage<"u";return{get($){if(!X)return null;try{return window.localStorage.getItem($)}catch{return null}},set($,Z){if(!X)return;try{window.localStorage.setItem($,Z)}catch{}},remove($){if(!X)return;try{window.localStorage.removeItem($)}catch{}},isAvailable(){return X}}}function FX(X,$){H7.set(X,$)}function p$(X){return H7.get(X)}function Z2(X){return H7.has(X)}function Y2(){H7.clear()}function J2(){return Array.from(H7.keys())}async function G2(X,$="middleware"){let Z=t6.resolve(X,$);if(!a6.existsSync(Z))return;let Y=a6.readdirSync(Z);for(let J of Y){if(!J.endsWith(".ts")&&!J.endsWith(".js"))continue;if(J.includes(".test.")||J.includes(".spec."))continue;let G=J.replace(/\.(ts|js)$/,""),Q=t6.join(Z,J);try{let K=(await import(Q)).default;if(K&&typeof K.handler==="function")FX(G,K);else if(typeof K==="function")FX(G,{handler:K,mode:"universal"})}catch(q){console.warn(`Failed to load middleware '${G}' from ${Q}:`,q)}}}function gU(X){let $={};if(!X)return $;let Z=new URLSearchParams(X);for(let[Y,J]of Z)$[Y]=J;return $}function Q2(X,$,Z,Y=""){return{path:X,params:$,query:gU(Y),fullPath:Y?`${X}?${Y}`:X,meta:Z}}function q2(X,$,Z,Y){let J=Y?.isServer??typeof window>"u",G=!J,Q=new Headers;return{to:X,from:$,isClient:G,isServer:J,cookies:J&&Z?m$(Z,Q):l$(),storage:c$(),state:{},request:Z,responseHeaders:Q}}async function K2(X,$){let Z=Array.isArray(X)?X:[X],Y=$.isServer;for(let J of Z){let G=p$(J);if(!G)return console.error(`Route middleware '${J}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${J}' is not registered`}},state:$.state,responseHeaders:$.responseHeaders};if(G.mode==="server"&&!Y)continue;try{let Q=await G.handler($);if(Q){if(Q.type==="redirect")return{passed:!1,redirect:Q,state:$.state,responseHeaders:$.responseHeaders};if(Q.type==="abort")return{passed:!1,abort:Q,state:$.state,responseHeaders:$.responseHeaders}}}catch(Q){return console.error(`Error in middleware '${J}':`,Q),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:Q instanceof Error?Q.message:"Middleware error"}},state:$.state,responseHeaders:$.responseHeaders}}}return{passed:!0,state:$.state,responseHeaders:$.responseHeaders}}var H7;var U2=E(()=>{H7=new Map});function O7(X){let Z=X.replace(/\\/g,"/").split("/").filter(Boolean),Y=Z.lastIndexOf("layouts"),J=Y>=0?Z[Y+1]:Z.at(-1);if(!J)return"app";return J.replace(/\.stx$/i,"")||"app"}function W2(X){let $=X.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),Z=X.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),Y=X.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),J=$?.[1]||Y?.[1]||"";return{layout:J,group:Z?.[1]||O7(J)}}function hU(X){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return X}}function L7(){if(VX)return VX;return VX=hU(`
1427
+ `}function c6(X,$,Z,Y){let J=X;if(Y.animation?.enabled===!1)return J;let G=Z.includes("test")&&Z.includes("animation");if(!CK(J)&&!G)return J;if(!J.includes('<style id="stx-animation-base">')){let q=vK();J=J.replace("</head>",`${q}
1428
+ </head>`)}if(J.includes("stx-observe")){if(!J.includes("Intersection Observer for scroll animations")){let W=PK(),K=J.lastIndexOf("</body>");if(K!==-1)J=J.slice(0,K)+W+`
1429
+ `+J.slice(K)}}return J}var w1,u6,d6,m6,l6;var E$=E(()=>{w1={duration:300,delay:0,ease:"ease",direction:"both"};u6={name:"transition",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@transition directive requires at least a transition type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||w1.duration:w1.duration,Q=$.length>2?$[2]||w1.ease:w1.ease,q=$.length>3?Number.parseInt($[3],10)||w1.delay:w1.delay,W=$.length>4?$[4]||w1.direction:w1.direction,K=`stx-transition-${Math.random().toString(36).substr(2,9)}`,U=bK(J,{duration:G,delay:q,ease:Q,direction:W}),z="stx-transition",w="";if(J==="fade")w="stx-fade";else if(J==="slide")w="stx-slide";else if(J==="scale")w="stx-scale";else if(J==="flip")w="stx-flip";else if(J==="rotate")w="stx-rotate";return`<div id="${K}" class="${z} ${w} ${W==="out"?"stx-out":""}"
1430
+ style="--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${q}ms;">${X}</div>`},hasEndTag:!0,description:"Applies transition effects to an element"},d6={name:"scrollAnimate",handler:(X,$,Z,Y)=>{if($.length<1)return`<div class="stx-error">@scrollAnimate directive requires at least an animation type</div>${X}`;let J=$[0],G=$.length>1?Number.parseInt($[1],10)||300:300,Q=$.length>2?$[2]||"ease":"ease",q=$.length>3?Number.parseFloat($[3])||0.2:0.2,W=$.length>4?Number.parseInt($[4],10)||0:0,K=`stx-scroll-${Math.random().toString(36).substr(2,9)}`,U=`--stx-transition-duration: ${G}ms; --stx-transition-ease: ${Q}; --stx-transition-delay: ${W}ms; will-change: opacity, transform;`,z="stx-transition stx-observe stx-out";if(J==="fade")z+=" stx-fade";else if(J==="slide-up"||J==="slide")z+=" stx-from-bottom";else if(J==="slide-down")z+=" stx-from-top";else if(J==="slide-left")z+=" stx-from-right";else if(J==="slide-right")z+=" stx-from-left";else if(J==="scale")z+=" stx-scale";else if(J.includes("-"))z+=` stx-${J}`;else z+=` stx-${J}`;return`<div id="${K}" class="${z}" style="${U}" data-threshold="${q}">${X}</div>`},hasEndTag:!0,description:"Applies animations that trigger when scrolled into view"},m6={name:"animationGroup",handler:(X,$,Z,Y)=>{if($.length<2)return`<div class="stx-error">@animationGroup directive requires a group name and at least one element selector</div>${X}`;let J=$[0],G=$.slice(1).map((K)=>K.startsWith("#")||K.startsWith(".")?K:`#${K}`),Q=Z.staggerDelay||50,q=Z.sequence||!0,W=xK(J,G,{staggerDelay:Q,sequence:q});return`${X}
1431
+ ${W}`},hasEndTag:!1,description:"Coordinates multiple animations together as a group"},l6={name:"motion",handler:(X,$,Z,Y)=>{let J=$.length>0?$[0].toLowerCase()==="true":!0,G=SK();return`<div data-animate="${J?"auto":"true"}">${X}</div>${G}`},hasEndTag:!0,description:"Controls motion and animation preferences"}});function D$(X){return X.split(/[\\/]/).filter(Boolean).slice(0,-1).some((Z)=>K7.includes(Z))}function U7(X){return D$(X.replace(/^\//,""))}var K7;var jX=E(()=>{K7=["components","layouts","partials","emails"]});import F5 from"fs";import z7 from"path";function w7(X,$){let Z=X.filter((Q)=>!U7(Q.pattern)),Y=["// Auto-generated by STX - do not edit"];if(Z.length===0)Y.push("// No page routes found \u2014 route paths stay typed as string.","export {}","");else{Y.push("declare module '@stacksjs/stx' {"," interface KnownRoutes {");for(let Q of Z){let q=[];for(let K of Q.params){let U=Q.pattern.includes(`:${K}?`)?"?":"";q.push(`${K}${U}: string`)}let W=q.join("; ");Y.push(` '${Q.pattern}': { ${W} }`)}Y.push(" }","}","","export {}","")}let J=Y.join(`
1432
+ `),G=z7.join($,"route-types.d.ts");try{if(F5.existsSync(G)&&F5.readFileSync(G,"utf8")===J)return;F5.mkdirSync($,{recursive:!0}),F5.writeFileSync(G,J)}catch{}}function j7(X,$,Z){let Y=process.cwd(),J=z7.relative(Y,Z),G=X.filter((q)=>!U7(q.pattern)),Q=["// Auto-generated by stx \u2014 do not edit",`// Source: ${J||"pages"}/`,"","export const routes = ["];for(let q of G){let W=z7.relative(Y,q.filePath).replace(/\\/g,"/"),K=JSON.stringify(q.params),U=q.layout?`, layout: '${z7.relative(Y,q.layout).replace(/\\/g,"/")}'`:"";Q.push(` { pattern: '${q.pattern}', filePath: '${W}', isDynamic: ${q.isDynamic}, params: ${K}${U} },`)}Q.push("] as const",""),Q.push("export type RouteName = typeof routes[number]['pattern']",""),F5.mkdirSync($,{recursive:!0}),F5.writeFileSync(z7.join($,"routes.ts"),Q.join(`
1433
+ `))}var y$=E(()=>{jX()});import p6 from"path";function BX(X,$){let Y=p6.relative($,X).replace(/\.(stx|md)$/,"");if(Y=Y.split(p6.sep).join("/"),Y==="index")return"/";if(Y.endsWith("/index"))Y=Y.slice(0,-6);return Y=Y.replace(/\[\[([^\]]+)\]\]/g,":$1?"),Y=Y.replace(/\[([^\]]+)\]/g,":$1"),Y=Y.replace(/:\.\.\.([^/]+)/g,":$1*"),`/${Y}`}function B7(X){let $=[],Z="",Y=0;while(Y<X.length){let J=X.slice(Y),G=/^\/:([^/?*]+)\?/.exec(J);if(G){$.push(G[1]),Z+="(?:/([^/]+))?",Y+=G[0].length;continue}let Q=/^:([^/?*]+)\*/.exec(J);if(Q){$.push(Q[1]),Z+="(.+)",Y+=Q[0].length;continue}let q=/^:([^/?*]+)/.exec(J);if(q){$.push(q[1]),Z+="([^/]+)",Y+=q[0].length;continue}Z+=X[Y].replace(/[.+^${}()|[\]\\*?]/g,"\\$&"),Y+=1}return{regex:new RegExp(`^${Z}$`),params:$}}function _X(X,$){let Z=X===""?"/":X;for(let Y of $){let J=Z.match(Y.regex);if(J){let G={};return Y.params.forEach((Q,q)=>{G[Q]=J[q+1]}),{route:Y,params:G}}}return null}function i6(X){let $=X.replace(/\[\[([^\]]+)\]\]/g,":$1?").replace(/\[([^\]]+)\]/g,":$1").replace(/:\.\.\.([^/]+)/g,":$1*");return B7($)}var b$=()=>{};import fK from"fs";import S$ from"path";function HX(X,$){let Z=[],Y=S$.dirname(X);while(Y.startsWith($)||Y===$){let J=S$.join(Y,"_layout.stx");if(fK.existsSync(J))Z.unshift(J);if(Y===$)break;Y=S$.dirname(Y)}return Z}var C$=()=>{};import P$ from"fs";import V5 from"path";function n6(X,$){let Z=[];if(!P$.existsSync(X))return Z;let Y=P$.readdirSync(X,{withFileTypes:!0});for(let J of Y){let G=V5.join(X,J.name);if(J.isDirectory()){if(J.name.startsWith("."))continue;if(K7.includes(J.name))continue;Z.push(...n6(G,$))}else if(J.isFile()){let Q=V5.extname(J.name);if($.includes(Q)){if(J.name.startsWith("_")&&J.name!=="_layout.stx")continue;if(J.name==="_layout.stx")continue;Z.push(G)}}}return Z}class A5{routes;pagesDir;pagesDirs;config;constructor(X,$={}){this.config=$;let Z=$.pagesDirs&&$.pagesDirs.length>0?$.pagesDirs:[$.pagesDir||"pages"];this.pagesDirs=Z.map((Q)=>V5.resolve(X,Q)),this.pagesDir=this.pagesDirs[0];let Y=$.extensions||[".stx"],J=new Set;this.routes=[];for(let Q of this.pagesDirs){let q=n6(Q,Y);for(let W of q){let K=BX(W,Q);if(J.has(K))continue;J.add(K);let{regex:U,params:z}=B7(K),w=$.layouts!==!1?HX(W,Q):[];this.routes.push({pattern:K,regex:U,params:z,filePath:W,isDynamic:z.length>0,layout:w.length>0?w[w.length-1]:void 0})}}this.routes.sort((Q,q)=>{if(!Q.isDynamic&&q.isDynamic)return-1;if(Q.isDynamic&&!q.isDynamic)return 1;let W=Q.pattern.split("/").length,K=q.pattern.split("/").length;if(W!==K)return K-W;return Q.pattern.localeCompare(q.pattern)});let G=V5.resolve(X,$.stateDir||process.env.STX_DIR?.trim()||".stx");w7(this.routes,G),j7(this.routes,G,this.pagesDir)}match(X){let $=X===""?"/":X;for(let Z of this.routes){let Y=$.match(Z.regex);if(Y){let J={};return Z.params.forEach((G,Q)=>{J[G]=Y[Q+1]}),{route:Z,params:J}}}return null}resolve(X,$){let Z=this.routes.find((J)=>J.pattern===X||J.filePath.includes(X));if(!Z)return"#not-found";let Y=Z.pattern;if($)for(let[J,G]of Object.entries($))Y=Y.replace(`:${J}`,encodeURIComponent(G));return Y}addRoute(X){this.routes.push(X),this.routes.sort(($,Z)=>{if(!$.isDynamic&&Z.isDynamic)return-1;if($.isDynamic&&!Z.isDynamic)return 1;return $.pattern.localeCompare(Z.pattern)})}getLayout(X){return X.layout??null}}function r6(X,$){return new A5(X,$)}function v$(X,$){let Z=[`${$}.stx`,"error.stx"];for(let Y of Z){let J=V5.join(X,Y);if(P$.existsSync(J))return J}return null}function x$(X,$){return X.map((Z)=>{let Y=V5.relative($,Z.filePath),J=Z.isDynamic?" (dynamic)":"";return`${Z.pattern} \u2192 ${Y}${J}`})}var o6=E(()=>{y$();b$();C$();jX()});function f$(X){LX=X.replace(/\/$/,"")}function g$(X,$,Z={}){R5[X]={path:$,name:X,params:Z}}function h$(X){for(let[$,Z]of Object.entries(X))if(typeof Z==="string")R5[$]={path:Z,name:$};else R5[$]={...Z,name:$}}function _7(X,$={},Z=!1){let Y=R5[X];if(!Y)return console.warn(`Route [${X}] not defined.`),"#undefined-route";let J={...Y.params,...$},G=Y.path;G=G.replace(/:(\w+)/g,(q,W)=>{let K=J[W];if(K===void 0)return console.warn(`Missing parameter [${W}] for route [${X}].`),`:${W}`;return delete J[W],encodeURIComponent(String(K))});let Q=Object.entries(J);if(Q.length>0){let q=Q.map(([W,K])=>`${encodeURIComponent(W)}=${encodeURIComponent(String(K))}`).join("&");G+=(G.includes("?")?"&":"?")+q}return Z&&LX?`${LX}${G}`:G}function u$(){for(let X of Object.keys(R5))delete R5[X];LX=""}var R5,LX="";var s6=E(()=>{R5={}});import a6 from"fs";import t6 from"path";function e6(X,$={}){return{type:"redirect",path:X,options:{replace:$.replace??!1,external:$.external??!1,redirectCode:$.redirectCode??302}}}function X2(X){return{type:"abort",error:typeof X==="string"?{statusCode:500,message:X}:X}}function $2(X,$={}){return{handler:X,mode:$.mode??"universal"}}function d$(X){let $={};if(!X)return $;let Z=X.split(";");for(let Y of Z){let[J,...G]=Y.split("=");if(J){let Q=J.trim(),q=G.join("=").trim();if(Q)$[Q]=decodeURIComponent(q)}}return $}function OX(X,$,Z={}){let Y=`${encodeURIComponent(X)}=${encodeURIComponent($)}`;if(Z.expires){let J=typeof Z.expires==="number"?new Date(Date.now()+Z.expires*1000):Z.expires;Y+=`; Expires=${J.toUTCString()}`}if(Z.path)Y+=`; Path=${Z.path}`;if(Z.domain)Y+=`; Domain=${Z.domain}`;if(Z.secure)Y+="; Secure";if(Z.httpOnly)Y+="; HttpOnly";if(Z.sameSite)Y+=`; SameSite=${Z.sameSite}`;return Y}function m$(X,$){let Z=X.headers.get("cookie")||"",Y=d$(Z);return{get(J){return Y[J]},set(J,G,Q={}){Y[J]=G,$.append("Set-Cookie",OX(J,G,Q))},delete(J){delete Y[J],$.append("Set-Cookie",OX(J,"",{expires:new Date(0),path:"/"}))},getAll(){return{...Y}}}}function l$(){return{get(X){if(typeof document>"u")return;return d$(document.cookie)[X]},set(X,$,Z={}){if(typeof document>"u")return;document.cookie=OX(X,$,Z)},delete(X){if(typeof document>"u")return;document.cookie=OX(X,"",{expires:new Date(0),path:"/"})},getAll(){if(typeof document>"u")return{};return d$(document.cookie)}}}function c$(){let X=typeof window<"u"&&typeof window.localStorage<"u";return{get($){if(!X)return null;try{return window.localStorage.getItem($)}catch{return null}},set($,Z){if(!X)return;try{window.localStorage.setItem($,Z)}catch{}},remove($){if(!X)return;try{window.localStorage.removeItem($)}catch{}},isAvailable(){return X}}}function FX(X,$){H7.set(X,$)}function p$(X){return H7.get(X)}function Z2(X){return H7.has(X)}function Y2(){H7.clear()}function J2(){return Array.from(H7.keys())}async function G2(X,$="middleware"){let Z=t6.resolve(X,$);if(!a6.existsSync(Z))return;let Y=a6.readdirSync(Z);for(let J of Y){if(!J.endsWith(".ts")&&!J.endsWith(".js"))continue;if(J.includes(".test.")||J.includes(".spec."))continue;let G=J.replace(/\.(ts|js)$/,""),Q=t6.join(Z,J);try{let W=(await import(Q)).default;if(W&&typeof W.handler==="function")FX(G,W);else if(typeof W==="function")FX(G,{handler:W,mode:"universal"})}catch(q){console.warn(`Failed to load middleware '${G}' from ${Q}:`,q)}}}function gK(X){let $={};if(!X)return $;let Z=new URLSearchParams(X);for(let[Y,J]of Z)$[Y]=J;return $}function Q2(X,$,Z,Y=""){return{path:X,params:$,query:gK(Y),fullPath:Y?`${X}?${Y}`:X,meta:Z}}function q2(X,$,Z,Y){let J=Y?.isServer??typeof window>"u",G=!J,Q=new Headers;return{to:X,from:$,isClient:G,isServer:J,cookies:J&&Z?m$(Z,Q):l$(),storage:c$(),state:{},request:Z,responseHeaders:Q}}async function W2(X,$){let Z=Array.isArray(X)?X:[X],Y=$.isServer;for(let J of Z){let G=p$(J);if(!G)return console.error(`Route middleware '${J}' is not registered \u2014 failing the guard closed.`),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:`Route middleware '${J}' is not registered`}},state:$.state,responseHeaders:$.responseHeaders};if(G.mode==="server"&&!Y)continue;try{let Q=await G.handler($);if(Q){if(Q.type==="redirect")return{passed:!1,redirect:Q,state:$.state,responseHeaders:$.responseHeaders};if(Q.type==="abort")return{passed:!1,abort:Q,state:$.state,responseHeaders:$.responseHeaders}}}catch(Q){return console.error(`Error in middleware '${J}':`,Q),{passed:!1,abort:{type:"abort",error:{statusCode:500,message:Q instanceof Error?Q.message:"Middleware error"}},state:$.state,responseHeaders:$.responseHeaders}}}return{passed:!0,state:$.state,responseHeaders:$.responseHeaders}}var H7;var K2=E(()=>{H7=new Map});function L7(X){let Z=X.replace(/\\/g,"/").split("/").filter(Boolean),Y=Z.lastIndexOf("layouts"),J=Y>=0?Z[Y+1]:Z.at(-1);if(!J)return"app";return J.replace(/\.stx$/i,"")||"app"}function U2(X){let $=X.match(/<meta\b[^>]*name=["']stx-layout["'][^>]*content=["']([^"']+)["'][^>]*>/i),Z=X.match(/<meta\b[^>]*name=["']stx-layout-group["'][^>]*content=["']([^"']+)["'][^>]*>/i),Y=X.match(/<!--\s*stx-layout:\s*([^ ]+)\s*-->/i),J=$?.[1]||Y?.[1]||"";return{layout:J,group:Z?.[1]||L7(J)}}function hK(X){try{return new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X).replace(/\}(var |let |const |function )/g,"};$1").trim()}catch{return X}}function O7(){if(VX)return VX;return VX=hK(`
1434
1434
  ;(function(){
1435
1435
  'use strict';
1436
1436
  var ROUTER_REV=7;
@@ -3080,7 +3080,7 @@ else {
3080
3080
 
3081
3081
  if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
3082
3082
  })();
3083
- `),VX}var VX;var z2={};n(z2,{setAppUrl:()=>f$,runMiddleware:()=>K2,route:()=>_7,resolveLayoutChain:()=>HX,resetRoutes:()=>u$,registerMiddleware:()=>FX,patternToRegex:()=>B7,navigateTo:()=>e6,matchRoute:()=>_X,loadMiddlewareFromDirectory:()=>G2,isNonPageRoutePattern:()=>W7,isNonPageRoutePath:()=>D$,hasMiddleware:()=>Z2,getRouterScript:()=>L7,getMiddlewareNames:()=>J2,getMiddleware:()=>p$,generateRouteTypes:()=>w7,generateRouteManifest:()=>j7,formatRoutes:()=>x$,findErrorPage:()=>v$,filePathToPattern:()=>BX,extractLayoutMetadata:()=>W2,deriveLayoutGroup:()=>O7,defineRoutes:()=>h$,defineRoute:()=>g$,defineMiddleware:()=>$2,createStorageManager:()=>c$,createServerCookieManager:()=>m$,createRouter:()=>r6,createRouteLocation:()=>Q2,createMiddlewareContext:()=>q2,createClientCookieManager:()=>l$,clearMiddleware:()=>Y2,bracketPathToRegex:()=>i6,abortNavigation:()=>X2,Router:()=>A5,NON_PAGE_DIRS:()=>U7});var i1=E(()=>{o6();b$();s6();U2();C$();y$();jX()});var w2=E(()=>{i1();i$()});async function uU(X,$,Z,Y){let J=$[0]?.replace(/['"]/g,"")||"main",G=L7();if(J!=="main")G=G.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${G}</script>`}var j2;var i$=E(()=>{w2();j2={name:"stxRouter",handler:uU,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function B2(X){let $=X.heatmap;if(!$?.enabled)return"";let Z={...dU,...$};return`
3083
+ `),VX}var VX;var z2={};i(z2,{setAppUrl:()=>f$,runMiddleware:()=>W2,route:()=>_7,resolveLayoutChain:()=>HX,resetRoutes:()=>u$,registerMiddleware:()=>FX,patternToRegex:()=>B7,navigateTo:()=>e6,matchRoute:()=>_X,loadMiddlewareFromDirectory:()=>G2,isNonPageRoutePattern:()=>U7,isNonPageRoutePath:()=>D$,hasMiddleware:()=>Z2,getRouterScript:()=>O7,getMiddlewareNames:()=>J2,getMiddleware:()=>p$,generateRouteTypes:()=>w7,generateRouteManifest:()=>j7,formatRoutes:()=>x$,findErrorPage:()=>v$,filePathToPattern:()=>BX,extractLayoutMetadata:()=>U2,deriveLayoutGroup:()=>L7,defineRoutes:()=>h$,defineRoute:()=>g$,defineMiddleware:()=>$2,createStorageManager:()=>c$,createServerCookieManager:()=>m$,createRouter:()=>r6,createRouteLocation:()=>Q2,createMiddlewareContext:()=>q2,createClientCookieManager:()=>l$,clearMiddleware:()=>Y2,bracketPathToRegex:()=>i6,abortNavigation:()=>X2,Router:()=>A5,NON_PAGE_DIRS:()=>K7});var i1=E(()=>{o6();b$();s6();K2();C$();y$();jX()});var w2=E(()=>{i1();i$()});async function uK(X,$,Z,Y){let J=$[0]?.replace(/['"]/g,"")||"main",G=O7();if(J!=="main")G=G.replace("container:'main'",`container:'${J}'`);return`<script data-stx-router>${G}</script>`}var j2;var i$=E(()=>{w2();j2={name:"stxRouter",handler:uK,hasEndTag:!1,description:"Inject the STX SPA router script for client-side navigation"}});function B2(X){let $=X.heatmap;if(!$?.enabled)return"";let Z={...dK,...$};return`
3084
3084
  <!-- stx Heatmap - Privacy-Compliant Tracking -->
3085
3085
  <script>
3086
3086
  (function() {
@@ -3463,10 +3463,10 @@ else {
3463
3463
  };
3464
3464
  })();
3465
3465
  </script>
3466
- `}function _2(X,$){let Z=B2($);if(!Z)return X;let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}function mU(X){let $={},Z=X.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of Z){let[J,G]=Y.split("="),Q=G?.replace(/["']/g,"");switch(J){case"endpoint":$.endpoint=Q;break;case"samplingRate":$.samplingRate=Number.parseInt(Q,10);break;case"batchSize":$.batchSize=Number.parseInt(Q,10);break;case"trackMouse":$.trackMouse=Q==="true";break;case"trackClicks":$.trackClicks=Q==="true";break;case"trackScroll":$.trackScroll=Q==="true";break;case"honorDnt":$.honorDnt=Q==="true";break;case"debugOverlay":$.debugOverlay=Q==="true";break}}return $}var dU,H2;var n$=E(()=>{dU={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};H2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(X,$,Z,Y)=>{let J=Z.__stx_config||{};if($.length>0){let G=mU($.join(" "));J.heatmap={...J.heatmap,...G,enabled:!0}}return B2(J)}}});function R1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function O2(X){let $=X.trim().toLowerCase();return!$.startsWith("javascript:")&&!$.startsWith("vbscript:")&&!$.startsWith("data:text/html")}function L2(X){let $=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=X.match($);if(!Z)return{data:{},content:X.trim()};let Y=Z[1],J=X.slice(Z[0].length),G={};for(let Q of Y.split(`
3467
- `)){let q=Q.trim();if(!q||q.startsWith("#"))continue;let K=q.indexOf(":");if(K===-1)continue;let U=q.slice(0,K).trim(),W=q.slice(K+1).trim();if(typeof W==="string"){if(W.startsWith('"')&&W.endsWith('"')||W.startsWith("'")&&W.endsWith("'"))W=W.slice(1,-1);else if(W.startsWith("[")&&W.endsWith("]"))try{W=JSON.parse(W)}catch{}else if(W==="true")W=!0;else if(W==="false")W=!1;else if(/^-?\d+(?:\.\d+)?$/.test(W))W=Number(W)}G[U]=W}return{data:G,content:J.trim()}}function F7(X,$={}){let{gfm:Z=!0,breaks:Y=!1}=$,J=X,G=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(W,z,w)=>{let B=G.length,j=z?` class="language-${R1(z)}"`:"";return G.push(`<pre><code${j}>${R1(w.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),J=J.replace(/`([^`]*)`/g,(W,z)=>`<code>${R1(z)}</code>`),J=J.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),J=J.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),J=J.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),J=J.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),J=J.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),J=J.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),J=J.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),J=J.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),J=J.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),J=J.replace(/__(.+?)__/g,"<strong>$1</strong>"),J=J.replace(/\*(.+?)\*/g,"<em>$1</em>"),J=J.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(W,z,w)=>{return`<img src="${O2(w)?R1(w):""}" alt="${R1(z)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(W,z,w)=>{return`<a href="${O2(w)?R1(w):""}">${z}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
3468
- `),J=J.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),J=J.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),J=J.replace(/<\/ul>\n<ul>/g,""),J=J.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),J=J.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),J=J.replace(/<\/ol>\n<ol>/g,""),J=J.replace(/<li data-ul>/g,"<li>"),J=J.replace(/<li data-ol>/g,"<li>"),Z)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(W,z,w)=>{let j=`<tr>${z.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${R1(H)}</th>`).join("")}</tr>`,_=w.trim().split(`
3469
- `).map((H)=>{return`<tr>${H.split("|").map((L)=>L.trim()).filter(Boolean).map((L)=>`<td>${R1(L)}</td>`).join("")}</tr>`}).join(`
3466
+ `}function _2(X,$){let Z=B2($);if(!Z)return X;let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}function mK(X){let $={},Z=X.match(/(\w+)=["']?([^"'\s]+)["']?/g)||[];for(let Y of Z){let[J,G]=Y.split("="),Q=G?.replace(/["']/g,"");switch(J){case"endpoint":$.endpoint=Q;break;case"samplingRate":$.samplingRate=Number.parseInt(Q,10);break;case"batchSize":$.batchSize=Number.parseInt(Q,10);break;case"trackMouse":$.trackMouse=Q==="true";break;case"trackClicks":$.trackClicks=Q==="true";break;case"trackScroll":$.trackScroll=Q==="true";break;case"honorDnt":$.honorDnt=Q==="true";break;case"debugOverlay":$.debugOverlay=Q==="true";break}}return $}var dK,H2;var n$=E(()=>{dK={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};H2={name:"heatmap",hasEndTag:!1,description:"Inject privacy-compliant heatmap tracking script",handler:async(X,$,Z,Y)=>{let J=Z.__stx_config||{};if($.length>0){let G=mK($.join(" "));J.heatmap={...J.heatmap,...G,enabled:!0}}return B2(J)}}});function R1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function L2(X){let $=X.trim().toLowerCase();return!$.startsWith("javascript:")&&!$.startsWith("vbscript:")&&!$.startsWith("data:text/html")}function O2(X){let $=/^---\r?\n([\s\S]*?)\r?\n---\r?\n/,Z=X.match($);if(!Z)return{data:{},content:X.trim()};let Y=Z[1],J=X.slice(Z[0].length),G={};for(let Q of Y.split(`
3467
+ `)){let q=Q.trim();if(!q||q.startsWith("#"))continue;let W=q.indexOf(":");if(W===-1)continue;let K=q.slice(0,W).trim(),U=q.slice(W+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)}G[K]=U}return{data:G,content:J.trim()}}function F7(X,$={}){let{gfm:Z=!0,breaks:Y=!1}=$,J=X,G=[];if(J=J.replace(/```(\w*)\n([\s\S]*?)```/g,(U,z,w)=>{let B=G.length,j=z?` class="language-${R1(z)}"`:"";return G.push(`<pre><code${j}>${R1(w.trim())}</code></pre>`),`\x00CODEBLOCK${B}\x00`}),J=J.replace(/`([^`]*)`/g,(U,z)=>`<code>${R1(z)}</code>`),J=J.replace(/^######\s+(.*)$/gm,"<h6>$1</h6>"),J=J.replace(/^#####\s+(.*)$/gm,"<h5>$1</h5>"),J=J.replace(/^####\s+(.*)$/gm,"<h4>$1</h4>"),J=J.replace(/^###\s+(.*)$/gm,"<h3>$1</h3>"),J=J.replace(/^##\s+(.*)$/gm,"<h2>$1</h2>"),J=J.replace(/^#\s+(.*)$/gm,"<h1>$1</h1>"),J=J.replace(/\*\*\*(.+?)\*\*\*/g,"<strong><em>$1</em></strong>"),J=J.replace(/___(.+?)___/g,"<strong><em>$1</em></strong>"),J=J.replace(/\*\*(.+?)\*\*/g,"<strong>$1</strong>"),J=J.replace(/__(.+?)__/g,"<strong>$1</strong>"),J=J.replace(/\*(.+?)\*/g,"<em>$1</em>"),J=J.replace(/(?<![a-zA-Z0-9])_(.+?)_(?![a-zA-Z0-9])/g,"<em>$1</em>"),Z)J=J.replace(/~~(.+?)~~/g,"<del>$1</del>");if(J=J.replace(/!\[([^\]]*)\]\(([^)]+)\)/g,(U,z,w)=>{return`<img src="${L2(w)?R1(w):""}" alt="${R1(z)}" />`}),J=J.replace(/\[([^\]]+)\]\(([^)]+)\)/g,(U,z,w)=>{return`<a href="${L2(w)?R1(w):""}">${z}</a>`}),J=J.replace(/^(?:---|\*\*\*|___)\s*$/gm,"<hr />"),J=J.replace(/^>\s+(.*)$/gm,"<blockquote>$1</blockquote>"),J=J.replace(/<\/blockquote>\n<blockquote>/g,`
3468
+ `),J=J.replace(/^[*\-+]\s+(.*)$/gm,"<li data-ul>$1</li>"),J=J.replace(/(<li data-ul>.*<\/li>\n?)+/g,"<ul>$&</ul>"),J=J.replace(/<\/ul>\n<ul>/g,""),J=J.replace(/^\d+\.\s+(.*)$/gm,"<li data-ol>$1</li>"),J=J.replace(/(<li data-ol>.*<\/li>\n?)+/g,"<ol>$&</ol>"),J=J.replace(/<\/ol>\n<ol>/g,""),J=J.replace(/<li data-ul>/g,"<li>"),J=J.replace(/<li data-ol>/g,"<li>"),Z)J=J.replace(/^\|(.+)\|\s*\n\|[-:\s|]+\|\s*\n((?:\|.+\|\s*\n)*)/gm,(U,z,w)=>{let j=`<tr>${z.split("|").map((H)=>H.trim()).filter(Boolean).map((H)=>`<th>${R1(H)}</th>`).join("")}</tr>`,_=w.trim().split(`
3469
+ `).map((H)=>{return`<tr>${H.split("|").map((O)=>O.trim()).filter(Boolean).map((O)=>`<td>${R1(O)}</td>`).join("")}</tr>`}).join(`
3470
3470
  `);return`<table>
3471
3471
  <thead>
3472
3472
  ${j}
@@ -3475,13 +3475,13 @@ ${j}
3475
3475
  ${_}
3476
3476
  </tbody>
3477
3477
  </table>`});if(Z)J=J.replace(/<li>\s*\[\s*\]\s*/g,'<li><input type="checkbox" disabled /> '),J=J.replace(/<li>\s*\[x\]\s*/gi,'<li><input type="checkbox" checked disabled /> ');let Q=J.split(`
3478
- `),q=[],K=!1,U=[];for(let W of Q){let z=W.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(K&&U.length>0)q.push(`<p>${U.join(Y?`<br />
3478
+ `),q=[],W=!1,K=[];for(let U of Q){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(W&&K.length>0)q.push(`<p>${K.join(Y?`<br />
3479
3479
  `:`
3480
- `)}</p>`),U=[],K=!1;q.push(W)}else K=!0,U.push(z)}if(K&&U.length>0)q.push(`<p>${U.join(Y?`<br />
3480
+ `)}</p>`),K=[],W=!1;q.push(U)}else W=!0,K.push(z)}if(W&&K.length>0)q.push(`<p>${K.join(Y?`<br />
3481
3481
  `:`
3482
3482
  `)}</p>`);if(J=q.join(`
3483
3483
  `),Y)J=J.replace(/\n/g,`<br />
3484
- `);for(let W=0;W<G.length;W++)J=J.replace(`\x00CODEBLOCK${W}\x00`,G[W]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function N5(X="const",$=[],Z){let Y=$.length?j1.filter((J)=>!$.includes(J)):j1;if(Z!==void 0)Y=Y.filter((J)=>{let G=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${X} { ${Y.join(", ")} } = window.stx;`}function r$(X){if(!X)return!1;return cU.some(($)=>new RegExp(`\\b${$}\\s*(?:<[^>]*>)?\\s*\\(`).test(X))}function o$(X){if(!X)return!1;let $=M2(X);if(pU.some((Z)=>Z.test($)))return!0;return r$($)}function V2(X){if(!X)return!1;return iU.test(M2(X))||o$(X)}function A2(X){return nU.includes(X.toLowerCase())}function T2(){return`{${R2.map((X)=>`'${X}':1`).join(",")}}`}function M2(X){if(!X)return X;let $=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(Y,J,G)=>J??" ".repeat(G.length));return X.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var j1,F2,lU,cU,pU,iU,nU,R2,rU,N2;var e0=E(()=>{j1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],F2=["onMount","onDestroy"];lU=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],cU=j1.filter((X)=>!lU.includes(X));pU=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],iU=/\s@[a-z][\w.:-]*\s*=/i;nU=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];R2=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],rU=["x-init","x-transition","x-effect","x-on"],N2=[...R2,...rU]});function E2(X){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of X){let Y=Z.toLowerCase();if(Y==="prevent")$.prevent=!0;else if(Y==="stop")$.stop=!0;else if(Y==="once")$.once=!0;else if(Y==="capture")$.capture=!0;else if(Y==="self")$.self=!0;else if(Y==="passive")$.passive=!0;else if(oU.has(Y))$.systemKeys.push(Y);else if(Y in D2)$.mouse=Y;else if(Y in I2||/^[a-z]$/.test(Y))$.keys.push(I2[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);$.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);$.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return $}function y2(X){let $=[],Z=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec(X))!==null){let[G,Q,q]=J,K=J.index,U=K+G.length,W=`__stx_evt_${Z++}`,z=[],w=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=w.exec(q))!==null){let[,_,H]=B,O=_.split("."),L=O[0];if(!k2.has(L))continue;z.push({attribute:`@${_}`,event:L,handler:H,modifiers:E2(O.slice(1)),elementId:W})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,H]=B,O=_.split("."),L=O[0];if(!k2.has(L))continue;z.push({attribute:`@${_}`,event:L,handler:H,modifiers:E2(O.slice(1)),elementId:W})}if(z.length>0)$.push({originalTag:G,elementId:W,events:z,startIndex:K,endIndex:U})}return $}function sU(X){let $=[],{modifiers:Z}=X;if(Z.self)$.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=D2[Z.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function aU(X,$){let Z=X;if($.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${$.debounce})`;else if($.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${$.throttle})`;return Z}function s$(X){let $=X.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test($))return X;return`if (typeof ${$} === 'function' && !${$}._isSignal) ${$}($event);`}function tU(X){let{modifiers:$}=X,Z=X.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=sU(X),J=aU(s$(X.handler),$),G=[];if($.once)G.push("once: true");if($.capture)G.push("capture: true");if($.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",q=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(X.event==="mounted")return`
3484
+ `);for(let U=0;U<G.length;U++)J=J.replace(`\x00CODEBLOCK${U}\x00`,G[U]);return J=J.replace(/<p>\s*<\/p>/g,""),J.trim()}function N5(X="const",$=[],Z){let Y=$.length?j1.filter((J)=>!$.includes(J)):j1;if(Z!==void 0)Y=Y.filter((J)=>{let G=J.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(^|[^\\w$])${G}(?![\\w$])`).test(Z)});return`${X} { ${Y.join(", ")} } = window.stx;`}function r$(X){if(!X)return!1;return cK.some(($)=>new RegExp(`\\b${$}\\s*(?:<[^>]*>)?\\s*\\(`).test(X))}function o$(X){if(!X)return!1;let $=M2(X);if(pK.some((Z)=>Z.test($)))return!0;return r$($)}function V2(X){if(!X)return!1;return iK.test(M2(X))||o$(X)}function A2(X){return nK.includes(X.toLowerCase())}function T2(){return`{${R2.map((X)=>`'${X}':1`).join(",")}}`}function M2(X){if(!X)return X;let $=(Z)=>Z.replace(/(<[^>]*>)|([^<]+)/g,(Y,J,G)=>J??" ".repeat(G.length));return X.replace(/(<pre\b[^>]*>)([\s\S]*?)(<\/pre>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/(<code\b[^>]*>)([\s\S]*?)(<\/code>)/gi,(Z,Y,J,G)=>Y+$(J)+G).replace(/<!--[\s\S]*?-->/g,(Z)=>" ".repeat(Z.length))}var j1,F2,lK,cK,pK,iK,nK,R2,rK,N2;var e0=E(()=>{j1=["batch","computed","configureFetch","defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","defineStore","derived","effect","goBack","goForward","inject","invalidateRoute","isDerived","isSignal","navigate","nextTick","onBeforeMount","onBeforeUnmount","onDestroy","onMount","onMounted","onUnmounted","peek","provide","reactive","ref","refresh","registerStoresClient","setRouteParams","state","untrack","useAsync","useClickOutside","useColorMode","useCookie","useCounter","useDark","useDebounce","useDebouncedValue","useEventListener","useFetch","useFocus","useHead","useId","useInterval","useLocalStorage","useMediaQuery","useMutation","useOptimistic","usePreferredContrast","usePreferredDark","usePreferredLight","usePreferredReducedMotion","useQuery","useReactiveProp","useRef","useRoute","useRouteParam","useRouteParams","useScrollLock","useSearchParams","useSeoMeta","useSessionStorage","useSlots","useStore","useThrottle","useTimeout","useToggle","useWebSocket","watch","watchEffect","watchMultiple","withDefaults"],F2=["onMount","onDestroy"];lK=["defineEmits","defineExpose","definePageMeta","defineProps","defineSlots","withDefaults"],cK=j1.filter((X)=>!lK.includes(X));pK=[/@if\s*=/,/@for\s*=/,/@show\s*=/,/@model\s*=/,/@bind:/,/@class\s*=/,/@style\s*=/,/\bx-data\s*=/,/\bstate\s*(?:<[^>]*>)?\s*\(/,/\bderived\s*(?:<[^>]*>)?\s*\(/,/\beffect\s*(?:<[^>]*>)?\s*\(/,/\bref\s*(?:<[^>]*>)?\s*\(/,/\bcomputed\s*(?:<[^>]*>)?\s*\(/,/\breactive\s*(?:<[^>]*>)?\s*\(/,/\bwatch\s*(?:<[^>]*>)?\s*\(/,/\bwatchEffect\s*(?:<[^>]*>)?\s*\(/,/\s:[a-z][\w-]*\s*=\s*["']/i,/\s:(?:if|else-if|else|for|show|text|html|model)\s*=/,/data-stx(?:-auto)?(?![-\w])/,/data-stx-scoped/],iK=/\s@[a-z][\w.:-]*\s*=/i;nK=["if","else-if","elseif","else","for","show","key","text","html","model","ref"];R2=["x-text","x-html","x-model","x-show","x-if","x-for","x-cloak","x-ref","x-data","x-bind","x-class","x-style","x-tooltip","x-tooltip-position"],rK=["x-init","x-transition","x-effect","x-on"],N2=[...R2,...rK]});function E2(X){let $={prevent:!1,stop:!1,once:!1,capture:!1,self:!1,passive:!1,keys:[],systemKeys:[],mouse:null,debounce:null,throttle:null};for(let Z of X){let Y=Z.toLowerCase();if(Y==="prevent")$.prevent=!0;else if(Y==="stop")$.stop=!0;else if(Y==="once")$.once=!0;else if(Y==="capture")$.capture=!0;else if(Y==="self")$.self=!0;else if(Y==="passive")$.passive=!0;else if(oK.has(Y))$.systemKeys.push(Y);else if(Y in D2)$.mouse=Y;else if(Y in I2||/^[a-z]$/.test(Y))$.keys.push(I2[Y]||Y.toUpperCase());else if(Y.startsWith("debounce")){let J=Y.match(/debounce(?:\.(\d+))?/);$.debounce=J?.[1]?Number.parseInt(J[1],10):300}else if(Y.startsWith("throttle")){let J=Y.match(/throttle(?:\.(\d+))?/);$.throttle=J?.[1]?Number.parseInt(J[1],10):300}}return $}function y2(X){let $=[],Z=0,Y=/<([a-z][a-z0-9-]*)\s+([^>]*@[a-z][^>]*)>/gi,J;while((J=Y.exec(X))!==null){let[G,Q,q]=J,W=J.index,K=W+G.length,U=`__stx_evt_${Z++}`,z=[],w=/@([a-z][a-z0-9.]*)\s*=\s*"([^"]*)"/gi,B;while((B=w.exec(q))!==null){let[,_,H]=B,L=_.split("."),O=L[0];if(!k2.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:H,modifiers:E2(L.slice(1)),elementId:U})}let j=/@([a-z][a-z0-9.]*)\s*=\s*'([^']*)'/gi;while((B=j.exec(q))!==null){let[,_,H]=B,L=_.split("."),O=L[0];if(!k2.has(O))continue;z.push({attribute:`@${_}`,event:O,handler:H,modifiers:E2(L.slice(1)),elementId:U})}if(z.length>0)$.push({originalTag:G,elementId:U,events:z,startIndex:W,endIndex:K})}return $}function sK(X){let $=[],{modifiers:Z}=X;if(Z.self)$.push("if ($event.target !== $el) return");for(let Y of Z.systemKeys)$.push(`if (!$event.${Y}Key) return`);if(Z.keys.length>0){let Y=Z.keys.map((J)=>`$event.key === '${J}'`).join(" || ");$.push(`if (!(${Y})) return`)}if(Z.mouse!==null){let Y=D2[Z.mouse];$.push(`if ($event.button !== ${Y}) return`)}if(Z.prevent)$.push("$event.preventDefault()");if(Z.stop)$.push("$event.stopPropagation()");return $.join("; ")}function aK(X,$){let Z=X;if($.debounce!==null)Z=`__stx_debounce(() => { ${Z} }, ${$.debounce})`;else if($.throttle!==null)Z=`__stx_throttle(() => { ${Z} }, ${$.throttle})`;return Z}function s$(X){let $=X.trim();if(!/^[A-Za-z_$][A-Za-z0-9_$]*$/.test($))return X;return`if (typeof ${$} === 'function' && !${$}._isSignal) ${$}($event);`}function tK(X){let{modifiers:$}=X,Z=X.elementId.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),Y=sK(X),J=aK(s$(X.handler),$),G=[];if($.once)G.push("once: true");if($.capture)G.push("capture: true");if($.passive)G.push("passive: true");let Q=G.length>0?`, { ${G.join(", ")} }`:"",q=J.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t");if(X.event==="mounted")return`
3485
3485
  (function() {
3486
3486
  var $el = document.getElementById('${Z}');
3487
3487
  if (!$el) return;
@@ -3590,13 +3590,13 @@ else {
3590
3590
  }
3591
3591
 
3592
3592
  // Event listeners
3593
- ${X.map(tU).join(`
3593
+ ${X.map(tK).join(`
3594
3594
  `)}
3595
3595
  })();
3596
- </script>`}function eU(X){let $=y2(X);if($.length===0)return{template:X,bindings:[]};let Z=X,Y=[];for(let J=$.length-1;J>=0;J--){let G=$[J],Q=G.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${G.elementId}"`);else{let q=Q.match(/id=["']([^"']+)["']/);if(q)for(let K of G.events)K.elementId=q[1]}for(let q of G.events){let K=q.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`\\s*${K}\\s*=\\s*"[^"]*"`,"g"),W=new RegExp(`\\s*${K}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(U,""),Q=Q.replace(W,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),Y.push(...G.events)}return{template:Z,bindings:Y}}function b2(X,$,Z){if(o$(X))return X;if($.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(X))return X;let{template:q,bindings:K}=eU(X),U=$.__stx_event_bindings||[];return $.__stx_event_bindings=[...U,...K],q}let Y=y2(X);if(Y.length===0)return X;let J=X;for(let q=Y.length-1;q>=0;q--){let K=Y[q],U=K.originalTag;if(!U.includes(" id="))U=U.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${K.elementId}"`);else{let W=U.match(/id=["']([^"']+)["']/);if(W)for(let z of K.events)z.elementId=W[1]}for(let W of K.events){let z=W.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),w=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");U=U.replace(w,""),U=U.replace(B,"")}J=J.slice(0,K.startIndex)+U+J.slice(K.endIndex)}let G=a$(Y.flatMap((q)=>q.events)),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
3597
- `+J.slice(Q);else J+=G;return J}var k2,I2,oU,D2;var t$=E(()=>{e0();k2=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"]),I2={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"},oU=new Set(["ctrl","alt","shift","meta"]),D2={left:0,middle:1,right:2}});function c0(X){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;X=X.replace($,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
3596
+ </script>`}function eK(X){let $=y2(X);if($.length===0)return{template:X,bindings:[]};let Z=X,Y=[];for(let J=$.length-1;J>=0;J--){let G=$[J],Q=G.originalTag;if(!Q.includes(" id="))Q=Q.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${G.elementId}"`);else{let q=Q.match(/id=["']([^"']+)["']/);if(q)for(let W of G.events)W.elementId=q[1]}for(let q of G.events){let W=q.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`\\s*${W}\\s*=\\s*"[^"]*"`,"g"),U=new RegExp(`\\s*${W}\\s*=\\s*'[^']*'`,"g");Q=Q.replace(K,""),Q=Q.replace(U,"")}Z=Z.slice(0,G.startIndex)+Q+Z.slice(G.endIndex),Y.push(...G.events)}return{template:Z,bindings:Y}}function b2(X,$,Z){if(o$(X))return X;if($.__stx_sfc_mode){if(/x-data\s*=\s*["']/.test(X))return X;let{template:q,bindings:W}=eK(X),K=$.__stx_event_bindings||[];return $.__stx_event_bindings=[...K,...W],q}let Y=y2(X);if(Y.length===0)return X;let J=X;for(let q=Y.length-1;q>=0;q--){let W=Y[q],K=W.originalTag;if(!K.includes(" id="))K=K.replace(/^<([a-z][a-z0-9-]*)/,`<$1 id="${W.elementId}"`);else{let U=K.match(/id=["']([^"']+)["']/);if(U)for(let z of W.events)z.elementId=U[1]}for(let U of W.events){let z=U.attribute.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),w=new RegExp(`\\s*${z}\\s*=\\s*"[^"]*"`,"g"),B=new RegExp(`\\s*${z}\\s*=\\s*'[^']*'`,"g");K=K.replace(w,""),K=K.replace(B,"")}J=J.slice(0,W.startIndex)+K+J.slice(W.endIndex)}let G=a$(Y.flatMap((q)=>q.events)),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
3597
+ `+J.slice(Q);else J+=G;return J}var k2,I2,oK,D2;var t$=E(()=>{e0();k2=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"]),I2={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"},oK=new Set(["ctrl","alt","shift","meta"]),D2={left:0,middle:1,right:2}});function c0(X){let $=/import\s*\{([^}]+)\}\s*from\s*['"](@stores|stx\/stores)['"]\s*;?\n?/g;X=X.replace($,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__STX_STORES__
3598
3598
  `});let Z=/import\s*\{([^}]+)\}\s*from\s*['"]@composables['"]\s*;?\n?/g;return X=X.replace(Z,(Y,J)=>{return`const { ${J.split(",").map((Q)=>Q.trim()).filter(Boolean).join(", ")} } = window.__composables
3599
- `}),X}function AX(X){return X.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function XW(X,$){let Z=X[$],Y=$+1;while(Y<X.length){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===Z)return Y+1;Y++}return X.length}function $W(X,$){let Z=$+1;while(Z<X.length){if(X[Z]==="\\"){Z+=2;continue}if(X[Z]==="`")return Z+1;if(X[Z]==="$"&&X[Z+1]==="{"){if(Z=RX(X,Z+2),Z<X.length)Z++;continue}Z++}return X.length}function RX(X,$){let Z=1,Y=$;while(Y<X.length){let J=X[Y];if(J==="\\"){Y+=2;continue}if(J==='"'||J==="'"){Y=XW(X,Y);continue}if(J==="`"){Y=$W(X,Y);continue}if(J==="/"&&X[Y+1]==="/"){while(Y<X.length&&X[Y]!==`
3599
+ `}),X}function AX(X){return X.replace(/^import\s+[^'"]*?from\s*['"][^'"]+['"]\s*;?[ \t]*$/gm,"").replace(/^import\s+['"][^'"]+['"]\s*;?[ \t]*$/gm,"")}function XU(X,$){let Z=X[$],Y=$+1;while(Y<X.length){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===Z)return Y+1;Y++}return X.length}function $U(X,$){let Z=$+1;while(Z<X.length){if(X[Z]==="\\"){Z+=2;continue}if(X[Z]==="`")return Z+1;if(X[Z]==="$"&&X[Z+1]==="{"){if(Z=RX(X,Z+2),Z<X.length)Z++;continue}Z++}return X.length}function RX(X,$){let Z=1,Y=$;while(Y<X.length){let J=X[Y];if(J==="\\"){Y+=2;continue}if(J==='"'||J==="'"){Y=XU(X,Y);continue}if(J==="`"){Y=$U(X,Y);continue}if(J==="/"&&X[Y+1]==="/"){while(Y<X.length&&X[Y]!==`
3600
3600
  `)Y++;continue}if(J==="/"&&X[Y+1]==="*"){Y+=2;while(Y<X.length&&X.slice(Y,Y+2)!=="*/")Y++;Y+=2;continue}if(J==="{"){Z++,Y++;continue}if(J==="}"){if(Z--,Z===0)return Y;Y++;continue}Y++}return X.length}function r0(X){let $="",Z=0;while(Z<X.length){let Y=X.slice(Z,Z+2);if(Y==="//"){while(Z<X.length&&X[Z]!==`
3601
3601
  `)$+=" ",Z++;continue}if(Y==="/*"){while(Z<X.length&&X.slice(Z,Z+2)!=="*/")$+=X[Z]===`
3602
3602
  `?`
@@ -3604,10 +3604,10 @@ else {
3604
3604
  `?`
3605
3605
  `:" ",Z++}$+=" ",Z++;continue}if(J==="`"){$+=" ",Z++;while(Z<X.length&&X[Z]!=="`"){if(X[Z]==="\\"){$+=" ",Z+=2;continue}if(X[Z]==="$"&&X[Z+1]==="{"){let G=Z+2,Q=RX(X,G);if($+=" ",$+=r0(X.slice(G,Q)),Q<X.length)$+=" ";Z=Q+1;continue}$+=X[Z]===`
3606
3606
  `?`
3607
- `:" ",Z++}$+=" ",Z++;continue}$+=J,Z++}return $}function ZW(){let X=globalThis;return X[S2]??=new Map,X[S2]}function X0(X,$){let Z=ZW(),Y=`${import.meta.url}\x00${X}`,J=Z.get(Y);if(J)return J;let G=$();return Z.set(Y,G),G.catch(()=>{if(Z.get(Y)===G)Z.delete(Y)}),G}var S2;var V7=E(()=>{S2=Symbol.for("stx.lazy-module-promises")});function T5(X){if(!X||X.indexOf("</")===-1)return X;return X.replace(YW,"<\\/$1")}var YW;var e$=E(()=>{YW=/<\/(script)/gi});import JW from"process";function u0(X="STX_PUBLIC_"){let $={},Z={};for(let[Y,J]of Object.entries(JW.env)){if(!Y.startsWith(X)||J===void 0)continue;$[`import.meta.env.${Y}`]=JSON.stringify(J),Z[Y]=J}return $["import.meta.env"]=JSON.stringify(Z),$}var N1=()=>{};function GW(X){if(!X||typeof X!=="object")return!1;let $=X;return typeof $.message==="string"&&($.name==="BuildMessage"||$.name==="ResolveMessage"||("position"in $))}function QW(X){if(X&&typeof X==="object"&&Array.isArray(X.errors))return X.errors;return[X]}function NX(X,$){let Z=[];for(let Y of QW(X)){if(GW(Y)){let J=Y.position||void 0;Z.push({file:$||J?.file,line:J?.line,column:J?.column,message:Y.message??"",lineText:J?.lineText});continue}Z.push({file:$,message:Y instanceof Error?Y.message:String(Y)})}return Z}function C2(X,$){return NX(X,$).map((Z)=>{let Y=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",J=Z.lineText?`
3607
+ `:" ",Z++}$+=" ",Z++;continue}$+=J,Z++}return $}function ZU(){let X=globalThis;return X[S2]??=new Map,X[S2]}function X0(X,$){let Z=ZU(),Y=`${import.meta.url}\x00${X}`,J=Z.get(Y);if(J)return J;let G=$();return Z.set(Y,G),G.catch(()=>{if(Z.get(Y)===G)Z.delete(Y)}),G}var S2;var V7=E(()=>{S2=Symbol.for("stx.lazy-module-promises")});function T5(X){if(!X||X.indexOf("</")===-1)return X;return X.replace(YU,"<\\/$1")}var YU;var e$=E(()=>{YU=/<\/(script)/gi});import JU from"process";function u0(X="STX_PUBLIC_"){let $={},Z={};for(let[Y,J]of Object.entries(JU.env)){if(!Y.startsWith(X)||J===void 0)continue;$[`import.meta.env.${Y}`]=JSON.stringify(J),Z[Y]=J}return $["import.meta.env"]=JSON.stringify(Z),$}var N1=()=>{};function GU(X){if(!X||typeof X!=="object")return!1;let $=X;return typeof $.message==="string"&&($.name==="BuildMessage"||$.name==="ResolveMessage"||("position"in $))}function QU(X){if(X&&typeof X==="object"&&Array.isArray(X.errors))return X.errors;return[X]}function NX(X,$){let Z=[];for(let Y of QU(X)){if(GU(Y)){let J=Y.position||void 0;Z.push({file:$||J?.file,line:J?.line,column:J?.column,message:Y.message??"",lineText:J?.lineText});continue}Z.push({file:$,message:Y instanceof Error?Y.message:String(Y)})}return Z}function C2(X,$){return NX(X,$).map((Z)=>{let Y=Z.file?`${Z.file}${Z.line?`:${Z.line}${Z.column?`:${Z.column}`:""}`:""}`:"",J=Z.lineText?`
3608
3608
  ${Z.lineText.trim()}`:"";return Y?`${Y}: ${Z.message}${J}`:`${Z.message}${J}`}).join(`
3609
- `)}var A7={};n(A7,{shouldLogBundlerDiagnostics:()=>f2,setBundlerFallbackMode:()=>WW,resolveBundlerFallback:()=>Y9,recordBundleFailure:()=>$9,queueClientBundleBuild:()=>g2,hasUserImports:()=>zW,getBundleFailures:()=>KW,clearBundleFailures:()=>UW,bundleClientScript:()=>jW});import _0 from"path";import d0 from"fs";function f2(X=process.env){return X.STX_DEBUG==="true"||X.STX_DEBUG==="1"}function n1(...X){if(f2())console.log("[stx:bundler]",...X)}function $9(X,$,Z){J9.push({filePath:X||"<inline>",message:$,details:Z})}function KW(){return J9.slice()}function UW(){J9.length=0}function WW(X){Z9=X}function Y9(){if(Z9)return Z9;try{let X=N7.strict;return typeof X==="object"&&X!==null?X.bundlerFallback??"warn":"warn"}catch{return"warn"}}function zW(X){let $=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=$.exec(X))!==null){let J=Z[1];if(!P2.some((Q)=>Q.test(J)))return n1("detected user import:",J),!0}let Y=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=Y.exec(X))!==null){let J=Z[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!P2.some((Q)=>Q.test(J)))return n1("detected side-effect import:",J),!0}return!1}function wW(X,$,Z,Y){let J=(G,Q)=>{let q=G===Z?$:_0.dirname(G),K=_0.resolve(q,Q),U=[K,`${K}.ts`,`${K}.tsx`,`${K}.js`,`${K}.mjs`,`${K}.jsx`,_0.join(K,"index.ts"),_0.join(K,"index.tsx"),_0.join(K,"index.js"),_0.join(K,"index.mjs")];for(let W of U)try{if(d0.existsSync(W)&&d0.statSync(W,{throwIfNoEntry:!1})?.isFile())return W}catch{}return K};return{name:"stx-client-bundle",setup(G){G.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^\//},(Q)=>{if(d0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let q=J(Q.importer,Q.path);return Y.add(q),{path:q}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let q=_0.resolve(X,Q.path.slice(2)),K=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,_0.join(q,"index.ts"),_0.join(q,"index.tsx"),_0.join(q,"index.js"),_0.join(q,"index.mjs")];for(let U of K)if(d0.existsSync(U)&&d0.statSync(U,{throwIfNoEntry:!1})?.isFile())return n1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",U),Y.add(U),{path:U};return console.warn(`[stx:bundler] could not resolve ${Q.path[0]}/ import:`,Q.path),{path:q}}),G.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Q)=>{let q=_0.extname(Q.path).toLowerCase(),K=q===".json"?"json":q===".tsx"?"tsx":q===".jsx"?"jsx":q===".ts"||q===".mts"||q===".cts"?"ts":"js";if(Q.path!==Z)Y.add(Q.path);return{contents:d0.readFileSync(Q.path,"utf8"),loader:K}})}}}function g2(X){let $=globalThis,Y=($[v2]??Promise.resolve()).then(X,X);return $[v2]=Y.then(()=>{return},()=>{return}),Y}async function jW(X,$,Z={}){let Y=Z.projectRoot||process.cwd(),J=Z.minify??!1,G=Z.cacheDir||q7(Y,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${qW}\x00${X}\x00${$}`);let q=Q.digest("hex").slice(0,12),K=_0.join(G,`${q}.js`),U=_0.join(G,`${q}.deps.json`),W=Bun.file(K);if(await W.exists()){let B=Bun.file(U),j=!0;if(await B.exists())try{let _=JSON.parse(await B.text());if(_.metadataVersion!==x2||!Array.isArray(_.files))j=!1;for(let H of Array.isArray(_.files)?_.files:[])try{if(d0.statSync(H.path).mtimeMs!==H.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return n1("cache hit:",q),await W.text();n1("cache invalidated by dep change:",q)}let z=X9.get(q);if(z)return await z;let w=g2(()=>BW(X,$,{projectRoot:Y,minify:J,cacheDir:G,hash:q,cachePath:K,depsPath:U}));X9.set(q,w);try{return await w}finally{X9.delete(q)}}async function BW(X,$,Z){let{projectRoot:Y,minify:J,cacheDir:G,hash:Q,cachePath:q,depsPath:K}=Z,U=q7(Y,"bundle-tmp"),W=_0.join(U,`${Q}.ts`),z=_0.join(U,"out",Q);d0.mkdirSync(U,{recursive:!0}),d0.mkdirSync(z,{recursive:!0});let w=_0.dirname($),B=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,H;while((H=j.exec(X))!==null){if(H[1])continue;if(H[2])H[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)B.push(V)});else if(H[3])B.push(H[3])}while((H=_.exec(X))!==null){if(H[1])continue;B.push(H[2])}let O=B.length>0?`
3610
- export { ${B.join(", ")} }`:"";await Bun.write(W,X+O),n1("bundling:",Q,"from:",_0.basename($));let L=new Set;try{let F=await Bun.build({entrypoints:[W],outdir:z,target:"browser",format:"esm",minify:J,plugins:[wW(Y,w,W,L)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...u0()},root:Y});if(!F.success){let S=F.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||`Unable to bundle ${_0.basename($)}`,b=NX(F.logs,$||void 0);if(console.warn("[stx:bundler] build failed:",S),$9($||"",S,b),Y9()==="error")throw Error(S);return X}let V="";for(let I of F.outputs){V=await I.text();break}let A=[];for(let I of V.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let S of I[1].split(",")){let b=S.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(b){A.push([b[2],b[1]]);continue}let y=S.trim();if(/^[A-Za-z_$][\w$]*$/.test(y))A.push([y,y])}let R=V.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];V=V.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let N=`__stxBundle_${Q}`,T=A.map(([I,S])=>`${JSON.stringify(I)}: ${S}`).join(", "),M=A.map(([I])=>`var ${I} = undefined;`).join(`
3609
+ `)}var A7={};i(A7,{shouldLogBundlerDiagnostics:()=>f2,setBundlerFallbackMode:()=>UU,resolveBundlerFallback:()=>Y9,recordBundleFailure:()=>$9,queueClientBundleBuild:()=>g2,hasUserImports:()=>zU,getBundleFailures:()=>WU,clearBundleFailures:()=>KU,bundleClientScript:()=>jU});import _0 from"path";import d0 from"fs";function f2(X=process.env){return X.STX_DEBUG==="true"||X.STX_DEBUG==="1"}function n1(...X){if(f2())console.log("[stx:bundler]",...X)}function $9(X,$,Z){J9.push({filePath:X||"<inline>",message:$,details:Z})}function WU(){return J9.slice()}function KU(){J9.length=0}function UU(X){Z9=X}function Y9(){if(Z9)return Z9;try{let X=N7.strict;return typeof X==="object"&&X!==null?X.bundlerFallback??"warn":"warn"}catch{return"warn"}}function zU(X){let $=/^[ \t]*import[ \t]+(?!type(?:[ \t]|{))[\s\S]*?\s+from\s+['"]([^'"]+)['"][ \t]*;?/gm,Z;while((Z=$.exec(X))!==null){let J=Z[1];if(!P2.some((Q)=>Q.test(J)))return n1("detected user import:",J),!0}let Y=/^[ \t]*import[ \t]+['"]([^'"]+)['"]/gm;while((Z=Y.exec(X))!==null){let J=Z[1];if(/\.css(?:\?.*)?$/.test(J))continue;if(!P2.some((Q)=>Q.test(J)))return n1("detected side-effect import:",J),!0}return!1}function wU(X,$,Z,Y){let J=(G,Q)=>{let q=G===Z?$:_0.dirname(G),W=_0.resolve(q,Q),K=[W,`${W}.ts`,`${W}.tsx`,`${W}.js`,`${W}.mjs`,`${W}.jsx`,_0.join(W,"index.ts"),_0.join(W,"index.tsx"),_0.join(W,"index.js"),_0.join(W,"index.mjs")];for(let U of K)try{if(d0.existsSync(U)&&d0.statSync(U,{throwIfNoEntry:!1})?.isFile())return U}catch{}return W};return{name:"stx-client-bundle",setup(G){G.onResolve({filter:/^(stx|@stacksjs\/stx)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^(@stores|@composables|stx\/stores)$/},(Q)=>({path:Q.path,external:!0})),G.onResolve({filter:/^\//},(Q)=>{if(d0.existsSync(Q.path))return{path:Q.path};return{path:Q.path,external:!0}}),G.onResolve({filter:/^\.\.?\//},(Q)=>{let q=J(Q.importer,Q.path);return Y.add(q),{path:q}}),G.onResolve({filter:/^[@~]\//},(Q)=>{let q=_0.resolve(X,Q.path.slice(2)),W=[q,`${q}.ts`,`${q}.tsx`,`${q}.js`,`${q}.mjs`,`${q}.jsx`,_0.join(q,"index.ts"),_0.join(q,"index.tsx"),_0.join(q,"index.js"),_0.join(q,"index.mjs")];for(let K of W)if(d0.existsSync(K)&&d0.statSync(K,{throwIfNoEntry:!1})?.isFile())return n1(`resolved ${Q.path[0]}/ import:`,Q.path,"\u2192",K),Y.add(K),{path:K};return console.warn(`[stx:bundler] could not resolve ${Q.path[0]}/ import:`,Q.path),{path:q}}),G.onLoad({filter:/\.(?:[cm]?[jt]sx?|json)$/},(Q)=>{let q=_0.extname(Q.path).toLowerCase(),W=q===".json"?"json":q===".tsx"?"tsx":q===".jsx"?"jsx":q===".ts"||q===".mts"||q===".cts"?"ts":"js";if(Q.path!==Z)Y.add(Q.path);return{contents:d0.readFileSync(Q.path,"utf8"),loader:W}})}}}function g2(X){let $=globalThis,Y=($[v2]??Promise.resolve()).then(X,X);return $[v2]=Y.then(()=>{return},()=>{return}),Y}async function jU(X,$,Z={}){let Y=Z.projectRoot||process.cwd(),J=Z.minify??!1,G=Z.cacheDir||q7(Y,"bundle-cache"),Q=new Bun.CryptoHasher("md5");Q.update(`${qU}\x00${X}\x00${$}`);let q=Q.digest("hex").slice(0,12),W=_0.join(G,`${q}.js`),K=_0.join(G,`${q}.deps.json`),U=Bun.file(W);if(await U.exists()){let B=Bun.file(K),j=!0;if(await B.exists())try{let _=JSON.parse(await B.text());if(_.metadataVersion!==x2||!Array.isArray(_.files))j=!1;for(let H of Array.isArray(_.files)?_.files:[])try{if(d0.statSync(H.path).mtimeMs!==H.mtimeMs){j=!1;break}}catch{j=!1;break}}catch{j=!1}if(j)return n1("cache hit:",q),await U.text();n1("cache invalidated by dep change:",q)}let z=X9.get(q);if(z)return await z;let w=g2(()=>BU(X,$,{projectRoot:Y,minify:J,cacheDir:G,hash:q,cachePath:W,depsPath:K}));X9.set(q,w);try{return await w}finally{X9.delete(q)}}async function BU(X,$,Z){let{projectRoot:Y,minify:J,cacheDir:G,hash:Q,cachePath:q,depsPath:W}=Z,K=q7(Y,"bundle-tmp"),U=_0.join(K,`${Q}.ts`),z=_0.join(K,"out",Q);d0.mkdirSync(K,{recursive:!0}),d0.mkdirSync(z,{recursive:!0});let w=_0.dirname($),B=[],j=/^(export\s+)?(?:const|let|var)\s+(?:\{([^}]+)\}|(\w+))/gm,_=/^(export\s+)?(?:async\s+)?function\s+(\w+)/gm,H;while((H=j.exec(X))!==null){if(H[1])continue;if(H[2])H[2].split(",").forEach((F)=>{let V=F.split(":")[0].trim();if(V)B.push(V)});else if(H[3])B.push(H[3])}while((H=_.exec(X))!==null){if(H[1])continue;B.push(H[2])}let L=B.length>0?`
3610
+ export { ${B.join(", ")} }`:"";await Bun.write(U,X+L),n1("bundling:",Q,"from:",_0.basename($));let O=new Set;try{let F=await Bun.build({entrypoints:[U],outdir:z,target:"browser",format:"esm",minify:J,plugins:[wU(Y,w,U,O)],define:{"process.env.NODE_ENV":J?'"production"':'"development"',...u0()},root:Y});if(!F.success){let S=F.logs.filter((y)=>y.level==="error").map((y)=>y.message).join(", ")||`Unable to bundle ${_0.basename($)}`,b=NX(F.logs,$||void 0);if(console.warn("[stx:bundler] build failed:",S),$9($||"",S,b),Y9()==="error")throw Error(S);return X}let V="";for(let I of F.outputs){V=await I.text();break}let A=[];for(let I of V.matchAll(/^\s*export\s*\{([^}]*)\}\s*;?\s*$/gm))for(let S of I[1].split(",")){let b=S.trim().match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(b){A.push([b[2],b[1]]);continue}let y=S.trim();if(/^[A-Za-z_$][\w$]*$/.test(y))A.push([y,y])}let R=V.match(/^\s*import\s+[^;]+;?\s*$/gm)||[];V=V.replace(/^\s*import\s+[^;]+;?\s*$/gm,"").replace(/^\s*export\s*\{[^}]*\}\s*;?\s*$/gm,"").replace(/^\s*export\s+default\s+.*$/gm,"").trim();let N=`__stxBundle_${Q}`,T=A.map(([I,S])=>`${JSON.stringify(I)}: ${S}`).join(", "),M=A.map(([I])=>`var ${I} = undefined;`).join(`
3611
3611
  `),k=A.map(([I])=>`${I} = ${N}[${JSON.stringify(I)}];`).join(`
3612
3612
  `);if(V=`${R.join(`
3613
3613
  `)}
@@ -3616,18 +3616,18 @@ var ${N} = (function() {
3616
3616
  ${V}
3617
3617
  return { ${T} };
3618
3618
  })();
3619
- ${k}`.trim(),n1("bundled:",Q,"output:",V.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${_0.basename($)} (${Q}); serving the unbundled source and not caching this result`),X;d0.mkdirSync(G,{recursive:!0}),await Bun.write(q,V);let D=Array.from(L).map((I)=>{try{return{path:I,mtimeMs:d0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(K,JSON.stringify({metadataVersion:x2,files:D})),V}catch(F){let V=NX(F,$||void 0),A=C2(F,$||void 0);if(console.warn(`[stx:bundler] error: ${A}`),$9($||"",A,V),Y9()==="error")throw F;return X}finally{try{d0.rmSync(W,{force:!0}),d0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var qW=5,x2=1,J9,Z9,P2,X9,v2;var R7=E(()=>{N1();wX();T1();J9=[];P2=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];X9=new Map,v2=Symbol.for("stx.client-bundle-build-queue")});var i2={};n(i2,{stripCommentsAndLiterals:()=>r0,renderVendorStyleTags:()=>MX,processClientScript:()=>k7,injectBrowserCoreAutoImports:()=>M5,generateServerDataBridge:()=>kX,generateBrowserAutoImportDestructuring:()=>NW,generateAutoImportDestructuring:()=>G9,findInterpolationEnd:()=>RX,extractBridgeData:()=>M7,extractAndStripCssImports:()=>TX,STX_AUTO_IMPORTS:()=>m2});import r1 from"path";import T7 from"fs";function HW(X){if(X.startsWith(".")||X.startsWith("/"))return null;if(X.startsWith("@")){let Z=X.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let $=X.match(/^([^/]+)(\/.*)?$/);if(!$)return null;return{pkg:$[1],subpath:$[2]||""}}function OW(X,$){let Z=$;while(!0){let Y=r1.join(Z,"node_modules",X,"package.json");if(T7.existsSync(Y))return r1.dirname(Y);let J=r1.dirname(Z);if(J===Z)return null;Z=J}}function LW(X,$){if(!X||typeof X!=="object")return null;let Z=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Z(J.import);if(typeof J.default==="object")return Z(J.default)}return null};if(Object.prototype.hasOwnProperty.call(X,$))return Z(X[$]);let Y=null;for(let J of Object.keys(X)){let G=J.indexOf("*");if(G===-1)continue;let Q=J.slice(0,G),q=J.slice(G+1);if(!$.startsWith(Q)||!$.endsWith(q))continue;if($.length<Q.length+q.length)continue;if(!Y||Q.length>Y.prefix.length)Y={pattern:J,prefix:Q,suffix:q}}if(Y){let J=$.slice(Y.prefix.length,$.length-Y.suffix.length),G=Z(X[Y.pattern]);if(G)return G.replace("*",J)}return null}function FW(X,$){let Z=HW(X);if(!Z||!Z.subpath)return null;let Y=OW(Z.pkg,$);if(!Y)return null;let J;try{J=JSON.parse(T7.readFileSync(r1.join(Y,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=LW(J.exports,G);if(!Q)return null;let q=r1.resolve(Y,Q);return T7.existsSync(q)?q:null}function TX(X,$){let Z=$.filePath?r1.dirname($.filePath):$.projectRoot||process.cwd(),Y=$.projectRoot||process.cwd(),J=new Set,G=[];return{code:X.replace(_W,(q,K)=>{let U;try{if(K.startsWith("./")||K.startsWith("../")||K.startsWith("/")){if(U=K.startsWith("/")?K:r1.resolve(Z,K),!T7.existsSync(U))throw Error(`file not found: ${U}`)}else{let W=null;try{W=Bun.resolveSync(K,Y)}catch{W=FW(K,Y)}if(!W)throw Error(`could not resolve ${K} (Bun.resolveSync + exports fallback both failed)`);U=W}}catch(W){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(K)} (from ${$.filePath||"<unknown>"}): ${W?.message||W}`),""}if(J.has(U))return"";J.add(U);try{let W=T7.readFileSync(U,"utf8");G.push({source:K,resolvedPath:U,contents:W})}catch(W){console.warn(`[stx:vendor-css] could not read ${U}: ${W?.message||W}`)}return""}),styles:G}}function VW(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function MX(X){if(X.length===0)return"";return`${X.map(($)=>{return`<style data-stx-vendor="${VW($.source)}" data-stx-layer="vendor">
3619
+ ${k}`.trim(),n1("bundled:",Q,"output:",V.length,"bytes"),B.length>0&&A.length===0)return console.warn(`[stx:bundler] dropped every binding for ${_0.basename($)} (${Q}); serving the unbundled source and not caching this result`),X;d0.mkdirSync(G,{recursive:!0}),await Bun.write(q,V);let D=Array.from(O).map((I)=>{try{return{path:I,mtimeMs:d0.statSync(I).mtimeMs}}catch{return null}}).filter((I)=>I!==null);return await Bun.write(W,JSON.stringify({metadataVersion:x2,files:D})),V}catch(F){let V=NX(F,$||void 0),A=C2(F,$||void 0);if(console.warn(`[stx:bundler] error: ${A}`),$9($||"",A,V),Y9()==="error")throw F;return X}finally{try{d0.rmSync(U,{force:!0}),d0.rmSync(z,{recursive:!0,force:!0})}catch{}}}var qU=5,x2=1,J9,Z9,P2,X9,v2;var R7=E(()=>{N1();wX();T1();J9=[];P2=[/^stx$/,/^@stacksjs\/stx$/,/^@stores$/,/^stx\/stores$/,/^@composables$/];X9=new Map,v2=Symbol.for("stx.client-bundle-build-queue")});var i2={};i(i2,{stripCommentsAndLiterals:()=>r0,renderVendorStyleTags:()=>MX,processClientScript:()=>k7,injectBrowserCoreAutoImports:()=>M5,generateServerDataBridge:()=>kX,generateBrowserAutoImportDestructuring:()=>NU,generateAutoImportDestructuring:()=>G9,findInterpolationEnd:()=>RX,extractBridgeData:()=>M7,extractAndStripCssImports:()=>TX,STX_AUTO_IMPORTS:()=>m2});import r1 from"path";import T7 from"fs";function HU(X){if(X.startsWith(".")||X.startsWith("/"))return null;if(X.startsWith("@")){let Z=X.match(/^(@[^/]+\/[^/]+)(\/.*)?$/);if(!Z)return null;return{pkg:Z[1],subpath:Z[2]||""}}let $=X.match(/^([^/]+)(\/.*)?$/);if(!$)return null;return{pkg:$[1],subpath:$[2]||""}}function LU(X,$){let Z=$;while(!0){let Y=r1.join(Z,"node_modules",X,"package.json");if(T7.existsSync(Y))return r1.dirname(Y);let J=r1.dirname(Z);if(J===Z)return null;Z=J}}function OU(X,$){if(!X||typeof X!=="object")return null;let Z=(J)=>{if(typeof J==="string")return J;if(J&&typeof J==="object"){if(typeof J.import==="string")return J.import;if(typeof J.default==="string")return J.default;if(typeof J.import==="object")return Z(J.import);if(typeof J.default==="object")return Z(J.default)}return null};if(Object.prototype.hasOwnProperty.call(X,$))return Z(X[$]);let Y=null;for(let J of Object.keys(X)){let G=J.indexOf("*");if(G===-1)continue;let Q=J.slice(0,G),q=J.slice(G+1);if(!$.startsWith(Q)||!$.endsWith(q))continue;if($.length<Q.length+q.length)continue;if(!Y||Q.length>Y.prefix.length)Y={pattern:J,prefix:Q,suffix:q}}if(Y){let J=$.slice(Y.prefix.length,$.length-Y.suffix.length),G=Z(X[Y.pattern]);if(G)return G.replace("*",J)}return null}function FU(X,$){let Z=HU(X);if(!Z||!Z.subpath)return null;let Y=LU(Z.pkg,$);if(!Y)return null;let J;try{J=JSON.parse(T7.readFileSync(r1.join(Y,"package.json"),"utf8"))}catch{return null}let G=`.${Z.subpath}`,Q=OU(J.exports,G);if(!Q)return null;let q=r1.resolve(Y,Q);return T7.existsSync(q)?q:null}function TX(X,$){let Z=$.filePath?r1.dirname($.filePath):$.projectRoot||process.cwd(),Y=$.projectRoot||process.cwd(),J=new Set,G=[];return{code:X.replace(_U,(q,W)=>{let K;try{if(W.startsWith("./")||W.startsWith("../")||W.startsWith("/")){if(K=W.startsWith("/")?W:r1.resolve(Z,W),!T7.existsSync(K))throw Error(`file not found: ${K}`)}else{let U=null;try{U=Bun.resolveSync(W,Y)}catch{U=FU(W,Y)}if(!U)throw Error(`could not resolve ${W} (Bun.resolveSync + exports fallback both failed)`);K=U}}catch(U){return console.warn(`[stx:vendor-css] could not resolve ${JSON.stringify(W)} (from ${$.filePath||"<unknown>"}): ${U?.message||U}`),""}if(J.has(K))return"";J.add(K);try{let U=T7.readFileSync(K,"utf8");G.push({source:W,resolvedPath:K,contents:U})}catch(U){console.warn(`[stx:vendor-css] could not read ${K}: ${U?.message||U}`)}return""}),styles:G}}function VU(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function MX(X){if(X.length===0)return"";return`${X.map(($)=>{return`<style data-stx-vendor="${VU($.source)}" data-stx-layer="vendor">
3620
3620
  @layer vendor {
3621
3621
  ${$.contents}
3622
3622
  }
3623
3623
  </style>`}).join(`
3624
3624
  `)}
3625
- `}function M5(X){let $=r0(X),Z=new Set;for(let q of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let K of q[1].split(",")){let U=K.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(U)Z.add(U)}let Y=new Set;for(let q of $.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))Y.add(q[1]);for(let q of $.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let K of q[1].split(",")){let U=K.trim().split(/[:=]/).pop()?.trim();if(U)Y.add(U)}let J=l2.filter((q)=>{if(Z.has(q)||Y.has(q))return!1;return new RegExp(`\\b${q}\\s*\\(`).test($)}),G=c2($).filter((q)=>!Z.has(q)&&!Y.has(q));if(J.length===0&&G.length===0)return{code:X,imports:J,models:G};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
3625
+ `}function M5(X){let $=r0(X),Z=new Set;for(let q of X.matchAll(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm))for(let W of q[1].split(",")){let K=W.trim().split(/\s+as\s+/).pop()?.replace(/^type\s+/,"").trim();if(K)Z.add(K)}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 W of q[1].split(",")){let K=W.trim().split(/[:=]/).pop()?.trim();if(K)Y.add(K)}let J=l2.filter((q)=>{if(Z.has(q)||Y.has(q))return!1;return new RegExp(`\\b${q}\\s*\\(`).test($)}),G=c2($).filter((q)=>!Z.has(q)&&!Y.has(q));if(J.length===0&&G.length===0)return{code:X,imports:J,models:G};return{code:`${[J.length>0?`import { ${J.join(", ")} } from '@stacksjs/browser'`:"",G.length>0?"import '@stacksjs/browser'":"",G.length>0?`const { ${G.join(", ")} } = window.StacksBrowser || {}`:""].filter(Boolean).join(`
3626
3626
  `)}
3627
- ${X}`,imports:J,models:G}}function c2(X){let $=new Set,Z=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=Z.exec(X))!==null)if(!AW.has(Y[1]))$.add(Y[1]);return Array.from($)}function RW(X){let $=new Set;for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Y of Z[1].split(",")){let J=Y.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))$.add(J)}return $}function p2(X){let $=new Set,Z=new Set,Y=X;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,G=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,Q;while((Q=G.exec(X))!==null){let U=Q[1],W=Q[2];if(Q[0].includes("import type"))continue;let z=[];for(let B of U.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let _=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let H=_[1],O=_[2]||H;if(J.add(H),J.add(O),W==="stx"||W==="@stacksjs/stx")$.add(H);else Z.add(H);if(O!==H)z.push(`${O} = ${H}`)}let w=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";Y=Y.replace(Q[0],w)}let q=RW(Y);for(let U of m2){if(J.has(U)||q.has(U))continue;if(new RegExp(`\\b${U}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(Y))$.add(U)}for(let U of l2){if(J.has(U)||q.has(U))continue;if(new RegExp(`\\b${U}\\b`,"g").test(Y))Z.add(U)}let K=c2(Y);for(let U of K)if(!J.has(U)&&!q.has(U))Z.add(U);return{code:Y,stxImports:Array.from($),browserImports:Array.from(Z)}}function G9(X,$){let Z=[];if(X.length>0)Z.push(` var { ${X.join(", ")} } = window.stx || window;`);if($.length>0)Z.push(` var { ${$.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
3627
+ ${X}`,imports:J,models:G}}function c2(X){let $=new Set,Z=/\b([A-Z][a-zA-Z0-9]*)\s*\.\s*(all|find|first|get|where|orderBy|orderByDesc|limit|select|pluck|create|update|delete)\s*\(/g,Y;while((Y=Z.exec(X))!==null)if(!AU.has(Y[1]))$.add(Y[1]);return Array.from($)}function RU(X){let $=new Set;for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g))$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^}]*)\}/g))for(let Y of Z[1].split(",")){let J=Y.trim().split(/[:=]/).pop()?.trim();if(J&&/^[A-Za-z_$][\w$]*$/.test(J))$.add(J)}return $}function p2(X){let $=new Set,Z=new Set,Y=X;Y=Y.replace(/^\s*import\s+type\s+\{[^}]*\}\s+from\s+['"][^'"]+['"]\s*;?\s*$/gm,"// [type import stripped]");let J=new Set,G=/^\s*import\s+(?:type\s+)?{\s*([^}]+)\s*}\s+from\s+['"](@stacksjs\/browser|@stacksjs\/stx|stx)['"]\s*;?\s*$/gm,Q;while((Q=G.exec(X))!==null){let K=Q[1],U=Q[2];if(Q[0].includes("import type"))continue;let z=[];for(let B of K.split(",")){let j=B.trim();if(!j||j.startsWith("type "))continue;let _=j.match(/^([A-Za-z_$][\w$]*)(?:\s+as\s+([A-Za-z_$][\w$]*))?$/);if(!_)continue;let H=_[1],L=_[2]||H;if(J.add(H),J.add(L),U==="stx"||U==="@stacksjs/stx")$.add(H);else Z.add(H);if(L!==H)z.push(`${L} = ${H}`)}let w=z.length>0?`var ${z.join(", ")}; /* [auto-import processed] */`:"// [auto-import processed]";Y=Y.replace(Q[0],w)}let q=RU(Y);for(let K of m2){if(J.has(K)||q.has(K))continue;if(new RegExp(`\\b${K}\\s*(?:<[^>]*>)?\\s*\\(`,"g").test(Y))$.add(K)}for(let K of l2){if(J.has(K)||q.has(K))continue;if(new RegExp(`\\b${K}\\b`,"g").test(Y))Z.add(K)}let W=c2(Y);for(let K of W)if(!J.has(K)&&!q.has(K))Z.add(K);return{code:Y,stxImports:Array.from($),browserImports:Array.from(Z)}}function G9(X,$){let Z=[];if(X.length>0)Z.push(` var { ${X.join(", ")} } = window.stx || window;`);if($.length>0)Z.push(` var { ${$.join(", ")} } = window.StacksBrowser || {};`);if(Z.length>0)return` // STX: auto-imported from stx and @stacksjs/browser
3628
3628
  ${Z.join(`
3629
3629
  `)}
3630
- ${TW(X,$)}`;return""}function NW(X,$=[]){let{browserImports:Z}=p2(X),Y=new Set($);return G9([],Z.filter((J)=>!Y.has(J)))}function TW(X,$){let Z=[...X.map((Y)=>`['${Y}', typeof ${Y}, 'stx']`),...$.map((Y)=>`['${Y}', typeof ${Y}, '@stacksjs/browser']`)];if(Z.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
3630
+ ${TU(X,$)}`;return""}function NU(X,$=[]){let{browserImports:Z}=p2(X),Y=new Set($);return G9([],Z.filter((J)=>!Y.has(J)))}function TU(X,$){let Z=[...X.map((Y)=>`['${Y}', typeof ${Y}, 'stx']`),...$.map((Y)=>`['${Y}', typeof ${Y}, '@stacksjs/browser']`)];if(Z.length===0)return"";return` // STX: report auto-imports the client runtime did not provide
3631
3631
  [${Z.join(", ")}].forEach(function (e) {
3632
3632
  if (e[1] !== 'undefined') return;
3633
3633
  console.error(
@@ -3636,15 +3636,15 @@ ${TW(X,$)}`;return""}function NW(X,$=[]){let{browserImports:Z}=p2(X),Y=new Set($
3636
3636
  + 'or it should be imported from a relative path so the bundler includes it.'
3637
3637
  );
3638
3638
  });
3639
- `}function M7(X){let $=X.__stxClientPayload;if($&&typeof $==="object"){let Y={};for(let J in $){let G=$[J];if(typeof G==="function")continue;Y[J]=G}return Y.__stxDeclaredPayload=!0,Y}let Z={};for(let Y in X){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=X[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function h2(X,$){let Z=new Set;for(let Y of X.split(",")){let J=Y.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if($){let G=J.lastIndexOf(":");if(G!==-1)J=J.slice(G+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function MW(X,$){if(new RegExp(`(?:const|let|var|function|class)\\s+${$}\\b`).test(X))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(h2(Z[1],!0).has($))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(h2(Z[1],!1).has($))return!0;return!1}function kW(X,$){return new RegExp(`(?<![.#\\w$])${$}(?![\\w$])`).test(X)}function EW(X,$){let Z=IW.test(X),Y=$.length>32768;if(!Z&&!Y)return;if(u2.has(X))return;if(u2.add(X),Z)console.warn(`[stx] server\u2192client bridge is publishing "${X}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(Y)console.warn(`[stx] server\u2192client bridge is publishing ${($.length/1024).toFixed(1)}KB under "${X}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function kX(X,$){if(!$)return"";let Z=r0(X),Y=$.__stxDeclaredPayload===!0,J=[];for(let[G,Q]of Object.entries($)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!Y&&!kW(Z,G))continue;if(MW(X,G))continue;let q;try{q=JSON.stringify(Q)}catch{continue}if(q===void 0)continue;EW(G,q),J.push(` var ${G} = ${q.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
3639
+ `}function M7(X){let $=X.__stxClientPayload;if($&&typeof $==="object"){let Y={};for(let J in $){let G=$[J];if(typeof G==="function")continue;Y[J]=G}return Y.__stxDeclaredPayload=!0,Y}let Z={};for(let Y in X){if(Y.startsWith("__")||Y.startsWith("$"))continue;let J=X[Y];if(typeof J==="function")continue;Z[Y]=J}return Z}function h2(X,$){let Z=new Set;for(let Y of X.split(",")){let J=Y.trim().replace(/^\.\.\./,"").trim();if(!J)continue;if($){let G=J.lastIndexOf(":");if(G!==-1)J=J.slice(G+1).trim()}if(J=J.split("=")[0].trim(),/^[A-Za-z_$][\w$]*$/.test(J))Z.add(J)}return Z}function MU(X,$){if(new RegExp(`(?:const|let|var|function|class)\\s+${$}\\b`).test(X))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\{([^}]*)\}/g))if(h2(Z[1],!0).has($))return!0;for(let Z of X.matchAll(/(?:const|let|var)\s*\[([^\]]*)\]/g))if(h2(Z[1],!1).has($))return!0;return!1}function kU(X,$){return new RegExp(`(?<![.#\\w$])${$}(?![\\w$])`).test(X)}function EU(X,$){let Z=IU.test(X),Y=$.length>32768;if(!Z&&!Y)return;if(u2.has(X))return;if(u2.add(X),Z)console.warn(`[stx] server\u2192client bridge is publishing "${X}" into the page body. If it holds a credential, rename it with a "__" prefix (never bridged) and pass only what the template needs. See stacksjs/stx#1831.`);if(Y)console.warn(`[stx] server\u2192client bridge is publishing ${($.length/1024).toFixed(1)}KB under "${X}". Every byte ships in the HTML on each request; prefix the binding with "__" and project just the fields the client reads.`)}function kX(X,$){if(!$)return"";let Z=r0(X),Y=$.__stxDeclaredPayload===!0,J=[];for(let[G,Q]of Object.entries($)){if(!/^[A-Za-z_$][\w$]*$/.test(G))continue;if(G.startsWith("__")||G.startsWith("$"))continue;if(!Y&&!kU(Z,G))continue;if(MU(X,G))continue;let q;try{q=JSON.stringify(Q)}catch{continue}if(q===void 0)continue;EU(G,q),J.push(` var ${G} = ${q.replace(/</g,"\\u003c")};`)}if(J.length===0)return"";return` // stx: server -> client data bridge (seeded from server scope)
3640
3640
  ${J.join(`
3641
3641
  `)}
3642
- `}function yW(X){let $=[];if(X.self)$.push("if ($event.target !== $el) return");for(let Z of X.systemKeys)$.push(`if (!$event.${Z}Key) return`);if(X.keys.length>0){let Z=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");$.push(`if (!(${Z})) return`)}if(X.mouse!==null){let Z=DW[X.mouse];$.push(`if ($event.button !== ${Z}) return`)}if(X.prevent)$.push("$event.preventDefault()");if(X.stop)$.push("$event.stopPropagation()");return $.join("; ")}function bW(X,$){let{elementId:Z,event:Y,modifiers:J}=X,G=s$(X.handler),Q=yW(J),q=[];if(J.once)q.push("once: true");if(J.capture)q.push("capture: true");if(J.passive)q.push("passive: true");let K=q.length>0?`, { ${q.join(", ")} }`:"",U="";if(Q)U+=`${Q}; `;let W=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
3642
+ `}function yU(X){let $=[];if(X.self)$.push("if ($event.target !== $el) return");for(let Z of X.systemKeys)$.push(`if (!$event.${Z}Key) return`);if(X.keys.length>0){let Z=X.keys.map((Y)=>`$event.key === '${Y}'`).join(" || ");$.push(`if (!(${Z})) return`)}if(X.mouse!==null){let Z=DU[X.mouse];$.push(`if ($event.button !== ${Z}) return`)}if(X.prevent)$.push("$event.preventDefault()");if(X.stop)$.push("$event.stopPropagation()");return $.join("; ")}function bU(X,$){let{elementId:Z,event:Y,modifiers:J}=X,G=s$(X.handler),Q=yU(J),q=[];if(J.once)q.push("once: true");if(J.capture)q.push("capture: true");if(J.passive)q.push("passive: true");let W=q.length>0?`, { ${q.join(", ")} }`:"",K="";if(Q)K+=`${Q}; `;let U=G.replace(/\\/g,"\\\\").replace(/'/g,"\\'"),z=`var $emit = function(name, detail) {
3643
3643
  $el.dispatchEvent(new CustomEvent(name, { detail: detail, bubbles: true, cancelable: true }))
3644
3644
  };`;function w(B){if(/\$emit\s*\(/.test(B))return`${z}
3645
3645
  ${B}`;return`var scope = $el.closest('[data-stx-scope]');
3646
3646
  if (scope && scope.__stx_execute) {
3647
- scope.__stx_execute('${W}', $event, $el);
3647
+ scope.__stx_execute('${U}', $event, $el);
3648
3648
  }
3649
3649
  else {
3650
3650
  ${B}
@@ -3656,7 +3656,7 @@ else {
3656
3656
  $el.addEventListener('${Y}', function($event) {
3657
3657
  ${Q?Q+"; ":""}clearTimeout(__timer)
3658
3658
  __timer = setTimeout(function() { ${w(G)} }, ${J.debounce})
3659
- }${K})
3659
+ }${W})
3660
3660
  })()`;if(J.throttle!==null)return` ;(function() {
3661
3661
  // eslint-disable-next-line pickier/no-unused-vars
3662
3662
  var $el = document.getElementById('${Z}')
@@ -3668,48 +3668,48 @@ else {
3668
3668
  __last = __now
3669
3669
  ${w(G)}
3670
3670
  }
3671
- }${K})
3671
+ }${W})
3672
3672
  })()`;if(/\$emit\s*\(/.test(G))return` var $el = document.getElementById('${Z}')
3673
3673
  if ($el) $el.addEventListener('${Y}', function($event) {
3674
- ${U}${z}
3674
+ ${K}${z}
3675
3675
  ${G}
3676
- }${K})`;return` var $el = document.getElementById('${Z}')
3676
+ }${W})`;return` var $el = document.getElementById('${Z}')
3677
3677
  if ($el) $el.addEventListener('${Y}', function($event) {
3678
- ${U}var scope = $el.closest('[data-stx-scope]');
3678
+ ${K}var scope = $el.closest('[data-stx-scope]');
3679
3679
  if (scope && scope.__stx_execute) {
3680
- scope.__stx_execute('${W}', $event, $el);
3680
+ scope.__stx_execute('${U}', $event, $el);
3681
3681
  }
3682
3682
  else {
3683
3683
  ${G}
3684
3684
  }
3685
- }${K})`}function SW(X){if(X.length===0)return"";return`
3685
+ }${W})`}function SU(X){if(X.length===0)return"";return`
3686
3686
  // STX: auto-generated event bindings
3687
- ${X.map((Z,Y)=>bW(Z,Y)).join(`
3688
- `)}`}function d2(X){let $=[],Z=new Set,Y=X.replace(/^\s*import\s+.*$/gm,""),J=0,G=Y.length,Q=0;while(Q<G){let q=Y[Q];if(q==="'"||q==='"'||q==="`"){let K=q;if(Q++,K==="`"){let U=0;while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]==="`"&&U===0){Q++;break}if(Y[Q]==="$"&&Y[Q+1]==="{"){U++,Q+=2;continue}if(Y[Q]==="}"&&U>0){U--,Q++;continue}Q++}}else while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]===K){Q++;break}Q++}continue}if(q==="/"&&Y[Q+1]==="/"){while(Q<G&&Y[Q]!==`
3689
- `)Q++;continue}if(q==="/"&&Y[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Y[Q]==="*"&&Y[Q+1]==="/"))Q++;Q+=2;continue}if(q==="{"){J++,Q++;continue}if(q==="}"){J--,Q++;continue}if(J===0){let K=Y.slice(Q),U=K.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(U){let w=U[1];if(!w.startsWith("_")&&!Z.has(w))$.push(w),Z.add(w);Q+=U[0].length;continue}let W=K.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(W){W[1].split(",").forEach((w)=>{let B=w.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Z.has(_))$.push(_),Z.add(_)}),Q+=W[0].length;continue}let z=K.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let w=z[1];if(!w.startsWith("_")&&!Z.has(w))$.push(w),Z.add(w);Q+=z[0].length;continue}}Q++}return $}function PW(X){let $=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(w){let B;while((B=Z.exec(w))!==null){let j=B[0];if(!CW.has(j))$.add(j)}}let J=/\{\{([\s\S]*?)\}\}/g,G;while((G=J.exec(X))!==null)Y(G[1]);let Q=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((G=Q.exec(X))!==null)Y(G[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((G=q.exec(X))!==null)Y(G[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=K.exec(X))!==null)Y(G[1]);let U=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=U.exec(X))!==null)Y(G[1]);let W=/@model\s*=\s*["']([^"']*)["']/gi;while((G=W.exec(X))!==null)Y(G[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((G=z.exec(X))!==null)Y(G[1]);return $}async function k7(X,$={}){let Z=X,Y="",J=!1,G=[],Q=TX(Z,{filePath:$.filePath,projectRoot:$.projectRoot});Z=Q.code;let q=MX(Q.styles),K=M5(Z);Z=K.code,G=[...K.imports,...K.models];let{hasUserImports:U,bundleClientScript:W}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (R7(),A7)));if(U(Z))Z=await W(Z,$.filePath||"",{projectRoot:$.projectRoot,minify:$.production}),J=!0;if($.autoImports!==!1){let L=p2(Z);Z=L.code,Y=G9(L.stxImports,L.browserImports.filter((F)=>!G.includes(F)))}if(Y=`${kX(Z,$.serverData)}${Y}`,Z=c0(Z),!J&&o1($.attrs||""))Z=s1(Z);let z=SW($.eventBindings||[]),w=($.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(w)){let L=w.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${L?` ${L}`:""}`;return`${q}<script ${F}>
3687
+ ${X.map((Z,Y)=>bU(Z,Y)).join(`
3688
+ `)}`}function d2(X){let $=[],Z=new Set,Y=X.replace(/^\s*import\s+.*$/gm,""),J=0,G=Y.length,Q=0;while(Q<G){let q=Y[Q];if(q==="'"||q==='"'||q==="`"){let W=q;if(Q++,W==="`"){let K=0;while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]==="`"&&K===0){Q++;break}if(Y[Q]==="$"&&Y[Q+1]==="{"){K++,Q+=2;continue}if(Y[Q]==="}"&&K>0){K--,Q++;continue}Q++}}else while(Q<G){if(Y[Q]==="\\"){Q+=2;continue}if(Y[Q]===W){Q++;break}Q++}continue}if(q==="/"&&Y[Q+1]==="/"){while(Q<G&&Y[Q]!==`
3689
+ `)Q++;continue}if(q==="/"&&Y[Q+1]==="*"){Q+=2;while(Q<G-1&&!(Y[Q]==="*"&&Y[Q+1]==="/"))Q++;Q+=2;continue}if(q==="{"){J++,Q++;continue}if(q==="}"){J--,Q++;continue}if(J===0){let W=Y.slice(Q),K=W.match(/^(?:const|let|var)\s+([a-zA-Z_$]\w*)\s*(?::[^=]*)?=/);if(K){let w=K[1];if(!w.startsWith("_")&&!Z.has(w))$.push(w),Z.add(w);Q+=K[0].length;continue}let U=W.match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(U){U[1].split(",").forEach((w)=>{let B=w.trim(),j=B.indexOf(":"),_=j>=0?B.slice(j+1).trim().split(/[\s=]/)[0]:B.split(/[\s=]/)[0];if(_&&!_.startsWith("_")&&!Z.has(_))$.push(_),Z.add(_)}),Q+=U[0].length;continue}let z=W.match(/^(?:async\s+)?function\s+([a-zA-Z_$]\w*)/);if(z){let w=z[1];if(!w.startsWith("_")&&!Z.has(w))$.push(w),Z.add(w);Q+=z[0].length;continue}}Q++}return $}function PU(X){let $=new Set,Z=/[a-zA-Z_$][a-zA-Z0-9_$]*/g;function Y(w){let B;while((B=Z.exec(w))!==null){let j=B[0];if(!CU.has(j))$.add(j)}}let J=/\{\{([\s\S]*?)\}\}/g,G;while((G=J.exec(X))!==null)Y(G[1]);let Q=/:[a-z][\w.-]*\s*=\s*"([^"]*)"/gi;while((G=Q.exec(X))!==null)Y(G[1]);let q=/:[a-z][\w.-]*\s*=\s*'([^']*)'/gi;while((G=q.exec(X))!==null)Y(G[1]);let W=/@[a-z]+(?:\.[a-z]+)*\s*=\s*"([^"]*)"/gi;while((G=W.exec(X))!==null)Y(G[1]);let K=/@[a-z]+(?:\.[a-z]+)*\s*=\s*'([^']*)'/gi;while((G=K.exec(X))!==null)Y(G[1]);let U=/@model\s*=\s*["']([^"']*)["']/gi;while((G=U.exec(X))!==null)Y(G[1]);let z=/@for\s*=\s*["'][^"']*\bin\s+([^"']+)["']/gi;while((G=z.exec(X))!==null)Y(G[1]);return $}async function k7(X,$={}){let Z=X,Y="",J=!1,G=[],Q=TX(Z,{filePath:$.filePath,projectRoot:$.projectRoot});Z=Q.code;let q=MX(Q.styles),W=M5(Z);Z=W.code,G=[...W.imports,...W.models];let{hasUserImports:K,bundleClientScript:U}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (R7(),A7)));if(K(Z))Z=await U(Z,$.filePath||"",{projectRoot:$.projectRoot,minify:$.production}),J=!0;if($.autoImports!==!1){let O=p2(Z);Z=O.code,Y=G9(O.stxImports,O.browserImports.filter((F)=>!G.includes(F)))}if(Y=`${kX(Z,$.serverData)}${Y}`,Z=c0(Z),!J&&o1($.attrs||""))Z=s1(Z);let z=SU($.eventBindings||[]),w=($.attrs||"").trim();if(/\btype\s*=\s*["']module["']/i.test(w)){let O=w.replace(/\btype\s*=\s*["']module["']/i,"").trim(),F=`type="module" data-stx-scoped${O?` ${O}`:""}`;return`${q}<script ${F}>
3690
3690
  ${T5(`${Y}${Z}
3691
3691
  ${z}`)}
3692
- </script>`}let j=r$(X),_=/function __stx_setup_/.test(Z),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(X);function O(L){let F=L.length>0?`
3693
- return { ${L.join(", ")} };`:"";return`${q}<script data-stx-scoped data-stx-run="always">
3692
+ </script>`}let j=r$(X),_=/function __stx_setup_/.test(Z),H=/\bstx\.mount\s*\(|\bstx\.mountEl\s*\(/.test(X);function L(O){let F=O.length>0?`
3693
+ return { ${O.join(", ")} };`:"";return`${q}<script data-stx-scoped data-stx-run="always">
3694
3694
  window.stx.mount(function() {
3695
3695
  'use strict';
3696
3696
  ${T5(`${Y}${Z}
3697
3697
  ${z}${F}`)}
3698
- })</script>`}if(!H&&!_){if(j)return O(d2(X));if($.templateContent){let L=d2(X);if(L.length>0){let F=PW($.templateContent);if(L.some((A)=>F.has(A)))return O(L)}}}return`${q}<script data-stx-scoped data-stx-run="always">
3698
+ })</script>`}if(!H&&!_){if(j)return L(d2(X));if($.templateContent){let O=d2(X);if(O.length>0){let F=PU($.templateContent);if(O.some((A)=>F.has(A)))return L(O)}}}return`${q}<script data-stx-scoped data-stx-run="always">
3699
3699
  ;(function() {
3700
3700
  'use strict';
3701
3701
  ${T5(`${Y}${Z}
3702
3702
  ${z}`)}
3703
- })()</script>`}var _W,m2,l2,AW,IW,u2,DW,CW;var I7=E(()=>{t$();H0();V7();e0();e$();_W=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;m2=j1,l2=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useTimeoutFn"];AW=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"]);IW=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,u2=new Set;DW={left:0,middle:1,right:2};CW=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});import{createHash as vW}from"crypto";function n2(X){let $=X[IX];return $ instanceof Map?$:null}function r2(X){X[IX]=new Map}function o2(X,$){let Z=n2(X);if(!Z)return null;let Y=vW("sha256").update($).digest("hex").slice(0,16),J=Z.get(Y);if(J)J.instances++;else Z.set(Y,{body:$,instances:1});return Y}function s2(X,$){let Z=n2($);if(!Z?.size)return X;let Y=X;for(let[K,U]of Z){if(U.instances!==1)continue;let W=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(K)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(W,(z,w)=>`(${U.body})(${w});`)}let J=[...Z].filter(([,K])=>K.instances>1);if(J.length===0)return Y;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
3703
+ })()</script>`}var _U,m2,l2,AU,IU,u2,DU,CU;var I7=E(()=>{t$();H0();V7();e0();e$();_U=/^[ \t]*import\s+['"]([^'"]+?\.css)(\?[^'"]*)?['"]\s*;?\s*$/gm;m2=j1,l2=["browserQuery","BrowserQueryBuilder","BrowserQueryError","browserAuth","configureBrowser","getBrowserConfig","createBrowserDb","createBrowserModel","isBrowser","debounce","throttle","retry","sleep","wait","delay","waitUntil","waitWhile","lazy","clamp","rand","readableSize","useActiveElement","useDocumentVisibility","useIntervalFn","useTimeoutFn"];AU=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"]);IU=/token|secret|passw|apikey|api_key|privatekey|private_key|credential|webhook|bearer|jwt|signature/i,u2=new Set;DU={left:0,middle:1,right:2};CU=new Set(["if","else","true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","switch","case","break","continue","for","while","do","try","catch","finally","const","let","var","function","class","import","export","default","async","await","yield","with","debugger","console","window","document","Math","JSON","Date","Array","Object","String","Number","Boolean","Symbol","Map","Set","Promise","Error","parseInt","parseFloat","isNaN","isFinite","encodeURIComponent","decodeURIComponent","setTimeout","setInterval","clearTimeout","clearInterval","fetch","alert","confirm","prompt","event"])});import{createHash as vU}from"crypto";function n2(X){let $=X[IX];return $ instanceof Map?$:null}function r2(X){X[IX]=new Map}function o2(X,$){let Z=n2(X);if(!Z)return null;let Y=vU("sha256").update($).digest("hex").slice(0,16),J=Z.get(Y);if(J)J.instances++;else Z.set(Y,{body:$,instances:1});return Y}function s2(X,$){let Z=n2($);if(!Z?.size)return X;let Y=X;for(let[W,K]of Z){if(K.instances!==1)continue;let U=new RegExp(`window\\.__stxComponentFactories\\[${JSON.stringify(W)}\\]\\(("[^"]+")\\);`,"g");Y=Y.replace(U,(z,w)=>`(${K.body})(${w});`)}let J=[...Z].filter(([,W])=>W.instances>1);if(J.length===0)return Y;let Q=`<script data-stx-scoped data-stx-run="always" data-stx-component-factories>
3704
3704
  (function() {
3705
3705
  const factories = window.__stxComponentFactories = window.__stxComponentFactories || {};
3706
- ${J.map(([K,U])=>` try { factories[${JSON.stringify(K)}] = factories[${JSON.stringify(K)}] || ${U.body}; }
3707
- catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(K)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
3706
+ ${J.map(([W,K])=>` try { factories[${JSON.stringify(W)}] = factories[${JSON.stringify(W)}] || ${K.body}; }
3707
+ catch (e) { console.error('[stx] component factory ' + ${JSON.stringify(W)} + ' failed to register; instances of it will not hydrate.', e); }`).join(`
3708
3708
  `)}
3709
3709
  })();
3710
3710
  </script>`,q=Y.search(/<script\b(?=[^>]*\bdata-stx-scoped\b)/i);if(q<0)return`${Q}
3711
3711
  ${Y}`;return`${Y.slice(0,q)}${Q}
3712
- ${Y.slice(q)}`}var IX="__stx_component_client_factories";var Q9=()=>{};function hW(X){let $="",Z=null,Y=!1;for(let J=0;J<X.length;J++){let G=X[J];if(Y){Y=!1;continue}if(G==="\\"&&Z){Y=!0;continue}if(Z){if(Z==="`"&&G==="$"&&J+1<X.length&&X[J+1]==="{"){let Q=1;J+=2;while(J<X.length&&Q>0){if(X[J]==="{")Q++;else if(X[J]==="}")Q--;if(Q>0)$+=X[J],J++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}$+=G}return $}function uW(X,$){let Z=/[$A-Z_a-z][$\w]*/g,Y;while((Y=Z.exec(X))!==null){let J=Y[0],G=X[Y.index-1];if(fW.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${$}`);if(G==="."&&XZ.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${$}`)}}function dW(X){let $=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=$.exec(X))!==null){let Y=Z[2];if(!XZ.has(Y))continue;let J=X.slice(0,Z.index).match(/\S(?=\s*$)/)?.[0],G=X.slice(Z.index+Z[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&G===":"))throw Error(`Potentially unsafe expression (bracket key ${Z[2]}): ${X}`)}}function EX(X){let $=X.trim(),Z=hW($);uW(Z,$),dW($);for(let Y of e2)if(Y.test(Z))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${$}`);if(!t2.allowBracketNotation&&gW.test($))throw Error(`Bracket notation with strings not allowed: ${$}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return $}function mW(X){let $={};$.Math=Math,$.JSON=JSON,$.Date=Date,$.String=String,$.Number=Number,$.Boolean=Boolean,$.Array=Array,$.parseInt=Number.parseInt,$.parseFloat=Number.parseFloat,$.isNaN=Number.isNaN,$.isFinite=Number.isFinite,$.encodeURIComponent=encodeURIComponent,$.decodeURIComponent=decodeURIComponent;for(let[Z,Y]of Object.entries(X)){if(Z.startsWith("__")||e2.some((J)=>J.test(Z)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))$[Z]=q9(Y);else $[Z]=Y}return $}function q9(X,$=0){if($>=t2.maxSanitizeDepth)return"[Object too deep]";if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Y)=>q9(Y,$+1));if(X instanceof Date||X instanceof RegExp||X instanceof Map||X instanceof Set||X instanceof Error)return X;let Z={};for(let[Y,J]of Object.entries(X)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(J&&typeof J==="object")Z[Y]=q9(J,$+1);else Z[Y]=J}return Z}function J0(X,$){try{let Z=mW($),Y=Object.keys(Z),J=Object.values(Z);return Q0(X,Y)(...J)}catch{return}}function G0(X){try{return EX(X),!0}catch{return!1}}function A0(X,$){try{let Z=J0(X,$);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function Q0(X,$){let Z=EX(X),Y=/^[A-Za-z_$][\w$]*$/,J=[],G=[];for(let U=0;U<$.length;U++){let W=$[U];if(!Y.test(W))continue;if($Z.has(W))continue;J.push(U),G.push(W)}let Q=(U)=>Function(...G,...U,`
3712
+ ${Y.slice(q)}`}var IX="__stx_component_client_factories";var Q9=()=>{};function hU(X){let $="",Z=null,Y=!1;for(let J=0;J<X.length;J++){let G=X[J];if(Y){Y=!1;continue}if(G==="\\"&&Z){Y=!0;continue}if(Z){if(Z==="`"&&G==="$"&&J+1<X.length&&X[J+1]==="{"){let Q=1;J+=2;while(J<X.length&&Q>0){if(X[J]==="{")Q++;else if(X[J]==="}")Q--;if(Q>0)$+=X[J],J++}continue}if(G===Z)Z=null;continue}if(G==='"'||G==="'"||G==="`"){Z=G;continue}$+=G}return $}function uU(X,$){let Z=/[$A-Z_a-z][$\w]*/g,Y;while((Y=Z.exec(X))!==null){let J=Y[0],G=X[Y.index-1];if(fU.has(J))throw Error(`Potentially unsafe expression (matched /\\b${J}\\b/; identifier ${J}): ${$}`);if(G==="."&&XZ.has(J))throw Error(`Potentially unsafe expression (matched /.${J}/; property ${J}): ${$}`)}}function dU(X){let $=/\[\s*(['"])(.*?)\1\s*\]/g,Z;while((Z=$.exec(X))!==null){let Y=Z[2];if(!XZ.has(Y))continue;let J=X.slice(0,Z.index).match(/\S(?=\s*$)/)?.[0],G=X.slice(Z.index+Z[0].length).match(/^\s*(\S)/)?.[1];if(!((J==="{"||J===",")&&G===":"))throw Error(`Potentially unsafe expression (bracket key ${Z[2]}): ${X}`)}}function EX(X){let $=X.trim(),Z=hU($);uU(Z,$),dU($);for(let Y of e2)if(Y.test(Z))throw Error(`Potentially unsafe expression (matched /${Y.source}/): ${$}`);if(!t2.allowBracketNotation&&gU.test($))throw Error(`Bracket notation with strings not allowed: ${$}. Enable with configureSafeEvaluator({ allowBracketNotation: true })`);return $}function mU(X){let $={};$.Math=Math,$.JSON=JSON,$.Date=Date,$.String=String,$.Number=Number,$.Boolean=Boolean,$.Array=Array,$.parseInt=Number.parseInt,$.parseFloat=Number.parseFloat,$.isNaN=Number.isNaN,$.isFinite=Number.isFinite,$.encodeURIComponent=encodeURIComponent,$.decodeURIComponent=decodeURIComponent;for(let[Z,Y]of Object.entries(X)){if(Z.startsWith("__")||e2.some((J)=>J.test(Z)))continue;if(Y&&typeof Y==="object"&&!Array.isArray(Y))$[Z]=q9(Y);else $[Z]=Y}return $}function q9(X,$=0){if($>=t2.maxSanitizeDepth)return"[Object too deep]";if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Y)=>q9(Y,$+1));if(X instanceof Date||X instanceof RegExp||X instanceof Map||X instanceof Set||X instanceof Error)return X;let Z={};for(let[Y,J]of Object.entries(X)){if(Y.startsWith("__")||Y==="constructor"||Y==="prototype")continue;if(J&&typeof J==="object")Z[Y]=q9(J,$+1);else Z[Y]=J}return Z}function J0(X,$){try{let Z=mU($),Y=Object.keys(Z),J=Object.values(Z);return Q0(X,Y)(...J)}catch{return}}function G0(X){try{return EX(X),!0}catch{return!1}}function A0(X,$){try{let Z=J0(X,$);if(Z&&typeof Z==="object"&&!Array.isArray(Z))return Z;return{}}catch{return{}}}function Q0(X,$){let Z=EX(X),Y=/^[A-Za-z_$][\w$]*$/,J=[],G=[];for(let K=0;K<$.length;K++){let U=$[K];if(!Y.test(U))continue;if($Z.has(U))continue;J.push(K),G.push(U)}let Q=(K)=>Function(...G,...K,`
3713
3713
  'use strict';
3714
3714
  try {
3715
3715
  return ${Z};
@@ -3720,10 +3720,10 @@ catch (e) {
3720
3720
  }
3721
3721
  throw e;
3722
3722
  }
3723
- `),q=Q([]);if(G.length===$.length)return a2(q,G,Q);return a2((...U)=>{let W=Array(J.length);for(let z=0;z<J.length;z++)W[z]=U[J[z]];return q(...W)},G,Q,(U)=>{q=Q(U)})}function a2(X,$,Z,Y){let G=/^(\w+) is not defined$/,Q=X,q=[],K=new Set($);return(...U)=>{for(let W=0;W<=8;W++)try{return Q(...U)}catch(z){let w=z instanceof Error?z.message:"",B=G.exec(w);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(K.has(j)||$Z.has(j))return;K.add(j),q.push(j),Q=Z(q),Y?.(q)}return}}function DX(X){let $=X.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of Z)if(Y.test($))return!1;return!0}var xW,t2,e2,fW,XZ,gW,$Z;var R0=E(()=>{xW={maxSanitizeDepth:10,allowBracketNotation:!1},t2={...xW},e2=[/\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/],fW=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"]),XZ=new Set(["__proto__","constructor","prototype"]),gW=/[\w)\]]\s*\[\s*['"]/;$Z=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 yX(X,$){let Z=lW++,Y=`<!--__STX_${X.toUpperCase()}_${Z}__-->`;return cW.set(Y,{type:X,expression:$}),Y}var lW=0,cW;var ZZ=E(()=>{cW=new Map});function qZ(X,$,Z,Y){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);if(!G)return-1;return G.index+G[0].length}function M1(X,$){return qZ(X,$,YZ,JZ)}function k5(X,$){return qZ(X,$,GZ,QZ)}function E7(X,$){if(!X.startsWith("<!--",$))return-1;let Z=X.indexOf("-->",$+4);if(Z===-1)return-1;return Z+3}function pW(X,$){if(X.startsWith("<!--",$)){let Z=E7(X,$);return Z===-1?X.length:Z}for(let[Z,Y]of[[YZ,JZ],[GZ,QZ]]){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);return G?G.index+G[0].length:X.length}return-1}function bX(X,$){let Z=[],Y=0,J=X.length,G=!1,Q=null;while(Y<J){let q=X[Y];if(G){if(Q){if(q===Q)Q=null}else if(q==='"'||q==="'")Q=q;else if(q===">")G=!1;Y++;continue}if(q!=="<"){Y++;continue}let K=$(X,Y);if(K>Y){Z.push({start:Y,end:K,token:X.slice(Y,K)}),Y=K;continue}let U=pW(X,Y);if(U>Y){Y=U;continue}if(/^<\/?[a-zA-Z]/.test(X.slice(Y,Y+2)))G=!0;Y++}return Z}function Y1(X,$,Z){let Y=bX(X,$);if(Y.length===0)return{output:X,tokens:[]};let J=Y.map((q)=>q.token),G="",Q=0;for(let q=0;q<Y.length;q++){let K=Y[q];G+=X.slice(Q,K.start),G+=Z(K.token,q),Q=K.end}return G+=X.slice(Q),{output:G,tokens:J}}function J1(X){let{output:$,tokens:Z}=Y1(X,M1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:$,scripts:Z}}function I5(X,$){if($.length===0)return X;return X.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>$[+Y]??"")}var YZ,JZ,GZ,QZ;var k1=E(()=>{YZ=/<script\b[^>]*>/iy,JZ=/<\/script\s*>/ig,GZ=/<style\b[^>]*>/iy,QZ=/<\/style\s*>/ig});var _Z={};n(_Z,{usesSignalsInScript:()=>B1,unescapeHtml:()=>$z,registerFilters:()=>nW,registerFilter:()=>WZ,processExpressions:()=>I1,interpolateScriptsInTemplate:()=>aW,interpolateScriptExpressions:()=>SX,interpolateScriptAttributes:()=>jZ,getAllFilters:()=>zZ,evaluateExpression:()=>m0,escapeHtmlValue:()=>K9,escapeHtml:()=>G1,defaultFilters:()=>y7,clearCustomFilters:()=>rW,applyFilters:()=>BZ});function iW(X){let $=KZ.get(X);if(!$){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");$=new RegExp(`:${Z}(?!\\w)`,"g"),KZ.set(X,$)}return $.lastIndex=0,$}function WZ(X,$){if(X in y7)console.warn(`Filter "${X}" already exists as a built-in filter. Custom filter will take precedence.`);D7[X]=$}function nW(X){for(let[$,Z]of Object.entries(X))WZ($,Z)}function zZ(){return{...y7,...D7}}function rW(){for(let X of Object.keys(D7))delete D7[X]}function G1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function K9(X){return G1(X).replace(/\{{2,}/g,($)=>oW($.length)).replace(/\{(?=!)/g,`&#123;${wZ}`)}function oW(X){return Array.from({length:X},()=>"&#123;").join(wZ)}function B1(X){let{scripts:$}=J1(X);for(let Z of $){let Y=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let J=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(X))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(X))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(X))return!0;return!1}function UZ(X,$){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=X.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let U=0;U<Y.length;U++){let W=Y[U];if(!G&&W==="`"){G=!0,Q=0;continue}if(G){if(W==="`"&&Q===0){G=!1;continue}if(W==="$"&&Y[U+1]==="{"){Q++,U++,J+=" ";continue}if(W==="}"&&Q>0){Q--;continue}if(Q>0){J+=W;continue}continue}J+=W}Y=J;let q=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,K;while((K=q.exec(Y))!==null){let U=K[1];if(!Y.substring(0,K.index).trimEnd().endsWith(".")){if(!Z.includes(U)&&!(U in $))return!1}}return!0}function sW(X,$){let Z=$.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let Y=r0(X);for(let J of Z)if(new RegExp(`(?<![.#\\w$])${J}(?![\\w$])`).test(Y))return!0;return!1}function SX(X,$){let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=m0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=m0(J,$);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function jZ(X,$){if(!X.includes("{"))return X;let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=m0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=m0(J,$);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return Y}}),Z}function aW(X,$,Z={}){let{output:Y,scripts:J}=J1(X),G=J.map((Q)=>{let q=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),K=Q.match(/^<script\b[^>]*>/i),U=Q.search(/<\/script\s*>$/i);if(!q||!K||U===-1)return Q;let W=q[1],z=q[2];if(/\bdata-raw\b/.test(W))return Q;if(Z.skipServer&&/\bserver\b/.test(W))return Q;let B=`<script${jZ(W,$)}>`;if(/\bsrc\s*=/.test(W)||/\btype\s*=\s*["']application\/json["']/.test(W))return B+z+Q.slice(U);return B+SX(z,$)+Q.slice(U)});return I5(Y,G)}function I1(X,$,Z){let Y=X,J=(z,w)=>{let B=k5(z,w);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(w,B))?-1:B},G=(z,w,B,j)=>{let _=B.length,{output:H,tokens:O}=Y1(z,w,(L,F)=>j(_+F));return B.push(...O),H},Q=[];Y=G(Y,J,Q,(z)=>`<!--__STX_STYLE_${z}__-->`);let q=[];Y=G(Y,M1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let K=$?.__stx_signals_gate===!0||B1(X),U=new Set(Array.isArray($?.__stx_client_signal_names)?$.__stx_client_signal_names:[]),W=new Set(Array.isArray($?.__stx_preserved_client_expressions)?$.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,w,B)=>{try{let j=m0(w,$);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return j0("Expression",`Error evaluating: {{{ ${w.trim()}}}}: ${_}`,Z,X,B,z)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(z,w,B)=>{try{let j=m0(w,$);if(j===void 0&&$.__stx_buildMode==="compile")return yX("raw",w.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if($.__stx_buildMode==="compile")return yX("raw",w.trim());let _=j instanceof Error?j.message:String(j);return j0("Expression",`Error evaluating: {!! ${w.trim()} !!}: ${_}`,Z,X,B,z)}}),Y=G(Y,M1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),Y=G(Y,J,Q,(z)=>`<!--__STX_STYLE_${z}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(z,w,B)=>{let j=w.trim();if(W.has(j))return z;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,L=j.match(H)?.[1],F=L&&((L in $)||_.includes(L)),V=Boolean(L&&U.has(L)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=j.match(A),N=R&&!_.includes(R[1])&&!(R[1]in $);if(/^__[A-Z_]+__$/.test(j))return"";try{let T=m0(w,$);if(V)return z;if(K&&!UZ(j,$))return z;if($.__stx_buildMode==="compile"&&!K&&(T===void 0||sW(j,$)))return yX("expr",j);return T!==void 0&&T!==null?K9(String(T)):""}catch(T){if(V)return z;if(K&&!UZ(j,$))return z;if(N)return z;let M=T instanceof Error?T.message:String(T);return j0("Expression",`Error evaluating: {{ ${j} }}: ${M}`,Z,X,B,z)}});for(let z=0;z<q.length;z++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>q[z]);for(let z=0;z<Q.length;z++)Y=Y.replace(`<!--__STX_STYLE_${z}__-->`,()=>Q[z]);return Y}function BZ(X,$,Z){if(!$.trim())return X;let Y=X,J=$.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let q=D7[Q]||y7[Q];if(!q)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(zZ()).join(", ")}`);let K=[];if(J.startsWith(":")){let U=J.match(/^:([^|\s]+)/);if(U){let W=U[1].trim();try{let z=Number(W);K=[Number.isNaN(z)?W:z]}catch{K=[W]}J=J.substring(U[0].length).trim()}}else if(J.startsWith("(")){let U=1,W=1;while(U>0&&W<J.length){if(J[W]==="(")U++;if(J[W]===")")U--;W++}if(U===0){let z=J.substring(1,W-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))K=[m0(`(${z})`,Z,!0)];else{let w=[],B="",j=null,_=0,H=0,O=0,L=!1;for(let F=0;F<z.length;F++){let V=z[F];if(L){B+=V,L=!1;continue}if(V==="\\"){B+=V,L=!0;continue}if(j){if(B+=V,V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V,B+=V;continue}if(V==="(")_++;else if(V===")")_--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")O++;else if(V==="}")O--;if(V===","&&_===0&&H===0&&O===0){w.push(B),B="";continue}B+=V}if(B)w.push(B);K=w.map((F)=>{let V=F.trim();return m0(V,Z,!0)})}}catch{K=[z]}J=J.substring(W).trim()}}try{Y=q(Y,Z,...K)}catch(U){let W=U instanceof Error?U.message:String(U);throw Error(`Error applying filter '${Q}': ${W}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function tW(X){let $=!1,Z="",Y=0,J=0,G=0,Q=!1;for(let q=0;q<X.length;q++){let K=X[q],U=X[q+1];if($&&Q){Q=!1;continue}if($&&K==="\\"){Q=!0;continue}if(Q=!1,(K==='"'||K==="'"||K==="`")&&!Q){if(!$)$=!0,Z=K;else if(K===Z)$=!1,Z="";continue}if($&&Z==="`"&&K==="$"&&U==="{"){let W=1;q+=2;while(q<X.length&&W>0){if(X[q]==="{")W++;else if(X[q]==="}")W--;if(W>0)q++}continue}if($)continue;if(K==="(")Y++;else if(K===")")Y--;else if(K==="[")J++;else if(K==="]")J--;else if(K==="{")G++;else if(K==="}")G--;if(K==="|"&&Y===0&&J===0&&G===0){if(U==="|"){q++;continue}if(U==="="){q++;continue}return q}}return-1}function m0(X,$,Z=!1){try{let Y=X.trim(),J=tW(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),q=m0(G,$,!0);return BZ(q,Q,$)}if(!G0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return J0(Y,$)}try{let G=Object.keys($),Q=Object.values($);return Q0(Y,G)(...Q)}catch{return J0(Y,$)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=eW(G,Object.keys($));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${X}`,Y);throw Y}}function eW(X,$){let Z=null;for(let J of $){if(J===X)continue;let G=Xz(X,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max(X.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function Xz(X,$){if(X===$)return 0;if(X.length===0)return $.length;if($.length===0)return X.length;let[Z,Y]=X.length<$.length?[X,$]:[$,X],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let q=1;q<=Z.length;q++){let K=Z[q-1]===Y[Q-1]?0:1;G[q]=Math.min(G[q-1]+1,J[q]+1,J[q-1]+K)}for(let q=0;q<=Z.length;q++)J[q]=G[q]}return J[Z.length]}function $z(X){if(!X)return"";return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var D7,KZ,y7,wZ="&#8288;";var Q1=E(()=>{R0();H0();ZZ();k1();D7={},KZ=new Map;y7={uppercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toUpperCase():""},lowercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toLowerCase():""},capitalize:(X,$)=>{if(X===void 0||X===null)return"";let Z=String(X);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:(X,$,Z=0)=>{if(X===void 0||X===null)return"";try{let Y=Number(X);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:(X,$,Z="en-US")=>{if(X===void 0||X===null)return"";try{let Y=Number(X);if(Number.isNaN(Y))return String(X);return Y.toLocaleString(Z)}catch{return String(X)}},join:(X,$,Z=",")=>{if(!Array.isArray(X))return"";return X.join(String(Z))},escape:(X,$)=>{if(X===void 0||X===null)return"";return K9(String(X))},translate:(X,$,Z={})=>{if(!$||!$.__translations)return X;let Y=$.__translations,J=$.__i18nConfig?.fallbackToKey??!0,G=String(X).split("."),Q=Y;for(let K of G){if(Q===void 0||Q===null)break;Q=Q[K]}if(Q===void 0||Q===null)return J?X:"";let q=String(Q);return Object.entries(Z).forEach(([K,U])=>{q=q.replace(iW(K),String(U))}),q},t:(X,$,Z={})=>{return y7.translate(X,$,Z)},truncate:(X,$,Z=50,Y="...")=>{if(X===void 0||X===null)return"";let J=String(X);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:(X,$,Z="short",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=X instanceof Date?X:new Date(X);if(Number.isNaN(J.getTime()))return String(X);let G={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Z==="iso")return J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String(X)}},currency:(X,$,Z="USD",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=Number(X);if(Number.isNaN(J))return String(X);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String(X)}},pluralize:(X,$,Z,Y)=>{let J=Number(X);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===1?Z:G},first:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[0];return String(X).charAt(0)},last:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[X.length-1];let Z=String(X);return Z.charAt(Z.length-1)},length:(X,$)=>{if(X===void 0||X===null)return 0;if(Array.isArray(X)||typeof X==="string")return X.length;if(X instanceof Map||X instanceof Set)return X.size;if(typeof X==="object")return Object.keys(X).length;return 0},json:(X,$,Z=!1)=>{if(X===void 0)return"undefined";if(X===null)return"null";try{return Z?JSON.stringify(X,null,2):JSON.stringify(X)}catch{return String(X)}},default:(X,$,Z="")=>{return X===void 0||X===null||X===""?Z:X},reverse:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return[...X].reverse();return String(X).split("").reverse().join("")},slice:(X,$,Z=0,Y)=>{if(X===void 0||X===null)return"";if(Array.isArray(X)||typeof X==="string")return X.slice(Z,Y);return X},replace:(X,$,Z,Y="")=>{if(X===void 0||X===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(X).replace(new RegExp(J,"g"),()=>Y)},stripTags:(X,$)=>{if(X===void 0||X===null)return"";return String(X).replace(/<[^>]*>/g,"")},urlencode:(X,$)=>{if(X===void 0||X===null)return"";return encodeURIComponent(String(X))},abs:(X,$)=>{let Z=Number(X);return Number.isNaN(Z)?0:Math.abs(Z)},round:(X,$,Z=0)=>{let Y=Number(X);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class a1{cache=new Map;maxSize;constructor(X=100){this.maxSize=X}get(X){if(!this.cache.has(X))return;let $=this.cache.get(X);return this.cache.delete(X),this.cache.set(X,$),$}set(X,$){if(this.cache.has(X))this.cache.delete(X);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set(X,$)}has(X){return this.cache.has(X)}delete(X){return this.cache.delete(X)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function D5(X,$){if($?.includes("g"))return new RegExp(X,$);let Z=`${X}:${$||""}`;if(!E5.has(Z)){if(E5.size>=Zz){let Y=E5.keys().next().value;if(Y)E5.delete(Y)}E5.set(Z,new RegExp(X,$))}return E5.get(Z)}class HZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(X){let $=Array.from(new Set(X)),Z=$.sort().join(","),Y=this.pool.find((q)=>q.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...q)=>{return(K)=>{try{let U=`${Z}:${K}`,W=J.get(U);if(!W){if(J.size>=G){let z=J.keys().next().value;if(z)J.delete(z)}W=Function(...$,`
3723
+ `),q=Q([]);if(G.length===$.length)return a2(q,G,Q);return a2((...K)=>{let U=Array(J.length);for(let z=0;z<J.length;z++)U[z]=K[J[z]];return q(...U)},G,Q,(K)=>{q=Q(K)})}function a2(X,$,Z,Y){let G=/^(\w+) is not defined$/,Q=X,q=[],W=new Set($);return(...K)=>{for(let U=0;U<=8;U++)try{return Q(...K)}catch(z){let w=z instanceof Error?z.message:"",B=G.exec(w);if(!(z instanceof ReferenceError)||!B)return;let j=B[1];if(W.has(j)||$Z.has(j))return;W.add(j),q.push(j),Q=Z(q),Y?.(q)}return}}function DX(X){let $=X.trim(),Z=[/\beval\s*\(/i,/\bFunction\s*\(/i,/\bimport\s*\(/i,/\brequire\s*\(/i,/\bprocess\b/i,/\b__proto__\b/i,/\bconstructor\s*[.(]/i,/\bglobalThis\b/i,/\bwindow\b/i,/\bdocument\b/i,/\bfetch\s*\(/i,/\bBun\b/i,/\bDeno\b/i,/\bconsole\b/i,/\bthis\b/i,/\bReflect\b/i,/\bProxy\b/i,/\bprototype\b/i,/\.(bind|call|apply)\s*\(/i];for(let Y of Z)if(Y.test($))return!1;return!0}var xU,t2,e2,fU,XZ,gU,$Z;var R0=E(()=>{xU={maxSanitizeDepth:10,allowBracketNotation:!1},t2={...xU},e2=[/\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/],fU=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"]),XZ=new Set(["__proto__","constructor","prototype"]),gU=/[\w)\]]\s*\[\s*['"]/;$Z=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 yX(X,$){let Z=lU++,Y=`<!--__STX_${X.toUpperCase()}_${Z}__-->`;return cU.set(Y,{type:X,expression:$}),Y}var lU=0,cU;var ZZ=E(()=>{cU=new Map});function qZ(X,$,Z,Y){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)return-1;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);if(!G)return-1;return G.index+G[0].length}function M1(X,$){return qZ(X,$,YZ,JZ)}function k5(X,$){return qZ(X,$,GZ,QZ)}function E7(X,$){if(!X.startsWith("<!--",$))return-1;let Z=X.indexOf("-->",$+4);if(Z===-1)return-1;return Z+3}function pU(X,$){if(X.startsWith("<!--",$)){let Z=E7(X,$);return Z===-1?X.length:Z}for(let[Z,Y]of[[YZ,JZ],[GZ,QZ]]){Z.lastIndex=$;let J=Z.exec(X);if(!J||J.index!==$)continue;Y.lastIndex=Z.lastIndex;let G=Y.exec(X);return G?G.index+G[0].length:X.length}return-1}function bX(X,$){let Z=[],Y=0,J=X.length,G=!1,Q=null;while(Y<J){let q=X[Y];if(G){if(Q){if(q===Q)Q=null}else if(q==='"'||q==="'")Q=q;else if(q===">")G=!1;Y++;continue}if(q!=="<"){Y++;continue}let W=$(X,Y);if(W>Y){Z.push({start:Y,end:W,token:X.slice(Y,W)}),Y=W;continue}let K=pU(X,Y);if(K>Y){Y=K;continue}if(/^<\/?[a-zA-Z]/.test(X.slice(Y,Y+2)))G=!0;Y++}return Z}function Y1(X,$,Z){let Y=bX(X,$);if(Y.length===0)return{output:X,tokens:[]};let J=Y.map((q)=>q.token),G="",Q=0;for(let q=0;q<Y.length;q++){let W=Y[q];G+=X.slice(Q,W.start),G+=Z(W.token,q),Q=W.end}return G+=X.slice(Q),{output:G,tokens:J}}function J1(X){let{output:$,tokens:Z}=Y1(X,M1,(Y,J)=>`\x00STX_SCRIPT_${J}\x00`);return{output:$,scripts:Z}}function I5(X,$){if($.length===0)return X;return X.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(Z,Y)=>$[+Y]??"")}var YZ,JZ,GZ,QZ;var k1=E(()=>{YZ=/<script\b[^>]*>/iy,JZ=/<\/script\s*>/ig,GZ=/<style\b[^>]*>/iy,QZ=/<\/style\s*>/ig});var _Z={};i(_Z,{usesSignalsInScript:()=>B1,unescapeHtml:()=>$z,registerFilters:()=>nU,registerFilter:()=>UZ,processExpressions:()=>I1,interpolateScriptsInTemplate:()=>aU,interpolateScriptExpressions:()=>SX,interpolateScriptAttributes:()=>jZ,getAllFilters:()=>zZ,evaluateExpression:()=>m0,escapeHtmlValue:()=>W9,escapeHtml:()=>G1,defaultFilters:()=>y7,clearCustomFilters:()=>rU,applyFilters:()=>BZ});function iU(X){let $=WZ.get(X);if(!$){let Z=X.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");$=new RegExp(`:${Z}(?!\\w)`,"g"),WZ.set(X,$)}return $.lastIndex=0,$}function UZ(X,$){if(X in y7)console.warn(`Filter "${X}" already exists as a built-in filter. Custom filter will take precedence.`);D7[X]=$}function nU(X){for(let[$,Z]of Object.entries(X))UZ($,Z)}function zZ(){return{...y7,...D7}}function rU(){for(let X of Object.keys(D7))delete D7[X]}function G1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function W9(X){return G1(X).replace(/\{{2,}/g,($)=>oU($.length)).replace(/\{(?=!)/g,`&#123;${wZ}`)}function oU(X){return Array.from({length:X},()=>"&#123;").join(wZ)}function B1(X){let{scripts:$}=J1(X);for(let Z of $){let Y=Z.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i);if(!Y||/\bserver\b|\bsrc\s*=/.test(Y[1]))continue;let J=Y[2];if(/\b(state|derived|effect|ref|reactive|computed|watch|watchEffect)\s*(?:<[^>]*>)?\s*\(/.test(J))return!0}if(/@(if|for|show)\s*=\s*["'][^"']*\(\s*\)/.test(X))return!0;if(/@for\s*=\s*["'][^"']*\s+(?:in|of)\s+[^"']*\(\s*\)/.test(X))return!0;if(/(?:^|[\s"'])(?::|x-)(?:for|if|else-if|else|show|text|html|model|bind)\b/.test(X))return!0;return!1}function KZ(X,$){let Z=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined","NaN","Infinity","isNaN","isFinite","window","document","console"],Y=X.replace(/'[^']*'/g,"").replace(/"[^"]*"/g,""),J="",G=!1,Q=0;for(let K=0;K<Y.length;K++){let U=Y[K];if(!G&&U==="`"){G=!0,Q=0;continue}if(G){if(U==="`"&&Q===0){G=!1;continue}if(U==="$"&&Y[K+1]==="{"){Q++,K++,J+=" ";continue}if(U==="}"&&Q>0){Q--;continue}if(Q>0){J+=U;continue}continue}J+=U}Y=J;let q=/(?<![a-zA-Z0-9_$])([a-zA-Z_$][a-zA-Z0-9_$]*)/g,W;while((W=q.exec(Y))!==null){let K=W[1];if(!Y.substring(0,W.index).trimEnd().endsWith(".")){if(!Z.includes(K)&&!(K in $))return!1}}return!0}function sU(X,$){let Z=$.__stx_serverDeclared;if(!Z||Z.size===0)return!1;let Y=r0(X);for(let J of Z)if(new RegExp(`(?<![.#\\w$])${J}(?![\\w$])`).test(Y))return!0;return!1}function SX(X,$){let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=m0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=m0(J,$);if(Q===void 0)return Y;return JSON.stringify(Q).replace(/</g,"\\u003c")}catch{return Y}}),Z}function jZ(X,$){if(!X.includes("{"))return X;let Z=X;return Z=Z.replace(/\{!!([\s\S]*?)!!\}/g,(Y,J)=>{try{let G=m0(J,$);if(G===void 0)return Y;return G===null?"":String(G)}catch{return Y}}),Z=Z.replace(/\{\{([\s\S]*?)\}\}/g,(Y,J)=>{let G=J.trim();if(/^__[A-Z_]+__$/.test(G))return Y;try{let Q=m0(J,$);if(Q===void 0)return Y;if(Q===null)return"";return String(Q).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}catch{return Y}}),Z}function aU(X,$,Z={}){let{output:Y,scripts:J}=J1(X),G=J.map((Q)=>{let q=Q.match(/^<script\b([^>]*)>([\s\S]*?)<\/script\s*>$/i),W=Q.match(/^<script\b[^>]*>/i),K=Q.search(/<\/script\s*>$/i);if(!q||!W||K===-1)return Q;let U=q[1],z=q[2];if(/\bdata-raw\b/.test(U))return Q;if(Z.skipServer&&/\bserver\b/.test(U))return Q;let B=`<script${jZ(U,$)}>`;if(/\bsrc\s*=/.test(U)||/\btype\s*=\s*["']application\/json["']/.test(U))return B+z+Q.slice(K);return B+SX(z,$)+Q.slice(K)});return I5(Y,G)}function I1(X,$,Z){let Y=X,J=(z,w)=>{let B=k5(z,w);if(B===-1)return-1;return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test(z.slice(w,B))?-1:B},G=(z,w,B,j)=>{let _=B.length,{output:H,tokens:L}=Y1(z,w,(O,F)=>j(_+F));return B.push(...L),H},Q=[];Y=G(Y,J,Q,(z)=>`<!--__STX_STYLE_${z}__-->`);let q=[];Y=G(Y,M1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`);let W=$?.__stx_signals_gate===!0||B1(X),K=new Set(Array.isArray($?.__stx_client_signal_names)?$.__stx_client_signal_names:[]),U=new Set(Array.isArray($?.__stx_preserved_client_expressions)?$.__stx_preserved_client_expressions:[]);Y=Y.replace(/\{\{\{([\s\S]*?)\}\}\}/g,(z,w,B)=>{try{let j=m0(w,$);return j!==void 0&&j!==null?String(j):""}catch(j){let _=j instanceof Error?j.message:String(j);return j0("Expression",`Error evaluating: {{{ ${w.trim()}}}}: ${_}`,Z,X,B,z)}}),Y=Y.replace(/\{!!([\s\S]*?)!!\}/g,(z,w,B)=>{try{let j=m0(w,$);if(j===void 0&&$.__stx_buildMode==="compile")return yX("raw",w.trim());return j!==void 0&&j!==null?String(j):""}catch(j){if($.__stx_buildMode==="compile")return yX("raw",w.trim());let _=j instanceof Error?j.message:String(j);return j0("Expression",`Error evaluating: {!! ${w.trim()} !!}: ${_}`,Z,X,B,z)}}),Y=G(Y,M1,q,(z)=>`<!--__STX_SCRIPT_EXPR_${z}__-->`),Y=G(Y,J,Q,(z)=>`<!--__STX_STYLE_${z}__-->`),Y=Y.replace(/\{\{([\s\S]*?)\}\}/g,(z,w,B)=>{let j=w.trim();if(U.has(j))return z;let _=["parseInt","parseFloat","String","Number","Boolean","Array","Object","JSON","Math","Date","encodeURIComponent","decodeURIComponent","encodeURI","decodeURI","true","false","null","undefined"],H=/^([a-zA-Z_$][a-zA-Z0-9_$]*)/,O=j.match(H)?.[1],F=O&&((O in $)||_.includes(O)),V=Boolean(O&&K.has(O)),A=/^([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/,R=j.match(A),N=R&&!_.includes(R[1])&&!(R[1]in $);if(/^__[A-Z_]+__$/.test(j))return"";try{let T=m0(w,$);if(V)return z;if(W&&!KZ(j,$))return z;if($.__stx_buildMode==="compile"&&!W&&(T===void 0||sU(j,$)))return yX("expr",j);return T!==void 0&&T!==null?W9(String(T)):""}catch(T){if(V)return z;if(W&&!KZ(j,$))return z;if(N)return z;let M=T instanceof Error?T.message:String(T);return j0("Expression",`Error evaluating: {{ ${j} }}: ${M}`,Z,X,B,z)}});for(let z=0;z<q.length;z++)Y=Y.replace(`<!--__STX_SCRIPT_EXPR_${z}__-->`,()=>q[z]);for(let z=0;z<Q.length;z++)Y=Y.replace(`<!--__STX_STYLE_${z}__-->`,()=>Q[z]);return Y}function BZ(X,$,Z){if(!$.trim())return X;let Y=X,J=$.trim();while(J.length>0){let G=J.match(/^(\w+)/);if(!G)break;let Q=G[1];J=J.substring(Q.length).trim();let q=D7[Q]||y7[Q];if(!q)throw Error(`Filter not found: ${Q}. Available filters: ${Object.keys(zZ()).join(", ")}`);let W=[];if(J.startsWith(":")){let K=J.match(/^:([^|\s]+)/);if(K){let U=K[1].trim();try{let z=Number(U);W=[Number.isNaN(z)?U:z]}catch{W=[U]}J=J.substring(K[0].length).trim()}}else if(J.startsWith("(")){let K=1,U=1;while(K>0&&U<J.length){if(J[U]==="(")K++;if(J[U]===")")K--;U++}if(K===0){let z=J.substring(1,U-1).trim();if(z)try{if(z.startsWith("{")&&z.endsWith("}"))W=[m0(`(${z})`,Z,!0)];else{let w=[],B="",j=null,_=0,H=0,L=0,O=!1;for(let F=0;F<z.length;F++){let V=z[F];if(O){B+=V,O=!1;continue}if(V==="\\"){B+=V,O=!0;continue}if(j){if(B+=V,V===j)j=null;continue}if(V==='"'||V==="'"||V==="`"){j=V,B+=V;continue}if(V==="(")_++;else if(V===")")_--;else if(V==="[")H++;else if(V==="]")H--;else if(V==="{")L++;else if(V==="}")L--;if(V===","&&_===0&&H===0&&L===0){w.push(B),B="";continue}B+=V}if(B)w.push(B);W=w.map((F)=>{let V=F.trim();return m0(V,Z,!0)})}}catch{W=[z]}J=J.substring(U).trim()}}try{Y=q(Y,Z,...W)}catch(K){let U=K instanceof Error?K.message:String(K);throw Error(`Error applying filter '${Q}': ${U}`)}if(J.startsWith("|"))J=J.substring(1).trim();else break}return Y}function tU(X){let $=!1,Z="",Y=0,J=0,G=0,Q=!1;for(let q=0;q<X.length;q++){let W=X[q],K=X[q+1];if($&&Q){Q=!1;continue}if($&&W==="\\"){Q=!0;continue}if(Q=!1,(W==='"'||W==="'"||W==="`")&&!Q){if(!$)$=!0,Z=W;else if(W===Z)$=!1,Z="";continue}if($&&Z==="`"&&W==="$"&&K==="{"){let U=1;q+=2;while(q<X.length&&U>0){if(X[q]==="{")U++;else if(X[q]==="}")U--;if(U>0)q++}continue}if($)continue;if(W==="(")Y++;else if(W===")")Y--;else if(W==="[")J++;else if(W==="]")J--;else if(W==="{")G++;else if(W==="}")G--;if(W==="|"&&Y===0&&J===0&&G===0){if(K==="|"){q++;continue}if(K==="="){q++;continue}return q}}return-1}function m0(X,$,Z=!1){try{let Y=X.trim(),J=tU(Y);if(J>0){let G=Y.substring(0,J).trim(),Q=Y.substring(J+1).trim(),q=m0(G,$,!0);return BZ(q,Q,$)}if(!G0(Y)){if(!Z)console.warn(`Potentially unsafe expression detected, using safe evaluator: ${Y}`);return J0(Y,$)}try{let G=Object.keys($),Q=Object.values($);return Q0(Y,G)(...Q)}catch{return J0(Y,$)}}catch(Y){if(Y instanceof ReferenceError){let J=/(\b\w+)\s+is not defined/.exec(Y.message);if(J){let G=J[1],Q=eU(G,Object.keys($));if(Q&&Q!==G)Y.message=`${Y.message} \u2014 did you mean '${Q}'?`}}if(!Z)console.error(`Error evaluating expression: ${X}`,Y);throw Y}}function eU(X,$){let Z=null;for(let J of $){if(J===X)continue;let G=Xz(X,J);if(Z===null||G<Z.dist)Z={key:J,dist:G}}if(!Z)return null;let Y=Math.max(X.length,Z.key.length);if(Z.dist<=2||Z.dist/Y<=0.35)return Z.key;return null}function Xz(X,$){if(X===$)return 0;if(X.length===0)return $.length;if($.length===0)return X.length;let[Z,Y]=X.length<$.length?[X,$]:[$,X],J=Array(Z.length+1),G=Array(Z.length+1);for(let Q=0;Q<=Z.length;Q++)J[Q]=Q;for(let Q=1;Q<=Y.length;Q++){G[0]=Q;for(let q=1;q<=Z.length;q++){let W=Z[q-1]===Y[Q-1]?0:1;G[q]=Math.min(G[q-1]+1,J[q]+1,J[q-1]+W)}for(let q=0;q<=Z.length;q++)J[q]=G[q]}return J[Z.length]}function $z(X){if(!X)return"";return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#039;/g,"'").replace(/&#39;/g,"'").replace(/&amp;/g,"&")}var D7,WZ,y7,wZ="&#8288;";var Q1=E(()=>{R0();H0();ZZ();k1();D7={},WZ=new Map;y7={uppercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toUpperCase():""},lowercase:(X,$)=>{return X!==void 0&&X!==null?String(X).toLowerCase():""},capitalize:(X,$)=>{if(X===void 0||X===null)return"";let Z=String(X);return Z.charAt(0).toUpperCase()+Z.slice(1)},number:(X,$,Z=0)=>{if(X===void 0||X===null)return"";try{let Y=Number(X);return Number.isNaN(Y)?"":Y.toFixed(Number.parseInt(String(Z),10))}catch{return""}},fmt:(X,$,Z="en-US")=>{if(X===void 0||X===null)return"";try{let Y=Number(X);if(Number.isNaN(Y))return String(X);return Y.toLocaleString(Z)}catch{return String(X)}},join:(X,$,Z=",")=>{if(!Array.isArray(X))return"";return X.join(String(Z))},escape:(X,$)=>{if(X===void 0||X===null)return"";return W9(String(X))},translate:(X,$,Z={})=>{if(!$||!$.__translations)return X;let Y=$.__translations,J=$.__i18nConfig?.fallbackToKey??!0,G=String(X).split("."),Q=Y;for(let W of G){if(Q===void 0||Q===null)break;Q=Q[W]}if(Q===void 0||Q===null)return J?X:"";let q=String(Q);return Object.entries(Z).forEach(([W,K])=>{q=q.replace(iU(W),String(K))}),q},t:(X,$,Z={})=>{return y7.translate(X,$,Z)},truncate:(X,$,Z=50,Y="...")=>{if(X===void 0||X===null)return"";let J=String(X);if(J.length<=Z)return J;if(Z<=Y.length)return Y.substring(0,Z);return J.substring(0,Z-Y.length)+Y},date:(X,$,Z="short",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=X instanceof Date?X:new Date(X);if(Number.isNaN(J.getTime()))return String(X);let G={short:{dateStyle:"short"},medium:{dateStyle:"medium"},long:{dateStyle:"long"},full:{dateStyle:"full"},time:{timeStyle:"short"},datetime:{dateStyle:"short",timeStyle:"short"},iso:{}};if(Z==="iso")return J.toISOString();return new Intl.DateTimeFormat(Y,G[Z]||G.short).format(J)}catch{return String(X)}},currency:(X,$,Z="USD",Y="en-US")=>{if(X===void 0||X===null)return"";try{let J=Number(X);if(Number.isNaN(J))return String(X);return new Intl.NumberFormat(Y,{style:"currency",currency:Z}).format(J)}catch{return String(X)}},pluralize:(X,$,Z,Y)=>{let J=Number(X);if(Number.isNaN(J))return Z;let G=Y||`${Z}s`;return J===1?Z:G},first:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[0];return String(X).charAt(0)},last:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return X.length===0?"":X[X.length-1];let Z=String(X);return Z.charAt(Z.length-1)},length:(X,$)=>{if(X===void 0||X===null)return 0;if(Array.isArray(X)||typeof X==="string")return X.length;if(X instanceof Map||X instanceof Set)return X.size;if(typeof X==="object")return Object.keys(X).length;return 0},json:(X,$,Z=!1)=>{if(X===void 0)return"undefined";if(X===null)return"null";try{return Z?JSON.stringify(X,null,2):JSON.stringify(X)}catch{return String(X)}},default:(X,$,Z="")=>{return X===void 0||X===null||X===""?Z:X},reverse:(X,$)=>{if(X===void 0||X===null)return"";if(Array.isArray(X))return[...X].reverse();return String(X).split("").reverse().join("")},slice:(X,$,Z=0,Y)=>{if(X===void 0||X===null)return"";if(Array.isArray(X)||typeof X==="string")return X.slice(Z,Y);return X},replace:(X,$,Z,Y="")=>{if(X===void 0||X===null)return"";let J=Z.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return String(X).replace(new RegExp(J,"g"),()=>Y)},stripTags:(X,$)=>{if(X===void 0||X===null)return"";return String(X).replace(/<[^>]*>/g,"")},urlencode:(X,$)=>{if(X===void 0||X===null)return"";return encodeURIComponent(String(X))},abs:(X,$)=>{let Z=Number(X);return Number.isNaN(Z)?0:Math.abs(Z)},round:(X,$,Z=0)=>{let Y=Number(X);if(Number.isNaN(Y))return 0;let J=10**Z;return Math.round(Y*J)/J}}});class a1{cache=new Map;maxSize;constructor(X=100){this.maxSize=X}get(X){if(!this.cache.has(X))return;let $=this.cache.get(X);return this.cache.delete(X),this.cache.set(X,$),$}set(X,$){if(this.cache.has(X))this.cache.delete(X);else if(this.cache.size>=this.maxSize){let Z=this.cache.keys().next().value;if(Z!==void 0)this.cache.delete(Z)}this.cache.set(X,$)}has(X){return this.cache.has(X)}delete(X){return this.cache.delete(X)}clear(){this.cache.clear()}get size(){return this.cache.size}keys(){return this.cache.keys()}values(){return this.cache.values()}}function D5(X,$){if($?.includes("g"))return new RegExp(X,$);let Z=`${X}:${$||""}`;if(!E5.has(Z)){if(E5.size>=Zz){let Y=E5.keys().next().value;if(Y)E5.delete(Y)}E5.set(Z,new RegExp(X,$))}return E5.get(Z)}class HZ{pool=[];maxPoolSize=10;fnCache=new Map;fnCacheMaxSize=200;getEvaluator(X){let $=Array.from(new Set(X)),Z=$.sort().join(","),Y=this.pool.find((q)=>q.context.join(",")===Z);if(Y)return Y.func;let J=this.fnCache,G=this.fnCacheMaxSize,Q=(...q)=>{return(W)=>{try{let K=`${Z}:${W}`,U=J.get(K);if(!U){if(J.size>=G){let z=J.keys().next().value;if(z)J.delete(z)}U=Function(...$,`
3724
3724
  'use strict';
3725
3725
  try {
3726
- return ${K};
3726
+ return ${W};
3727
3727
  }
3728
3728
  catch (e) {
3729
3729
  if (e instanceof ReferenceError || e instanceof TypeError) {
@@ -3731,34 +3731,34 @@ catch (e) {
3731
3731
  }
3732
3732
  throw e;
3733
3733
  }
3734
- `),J.set(U,W)}return W(...q)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:$.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class OZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(X){this.enabled=X}isEnabled(){return this.enabled}setBudget(X,$){this.budgets.set(X,{warnThreshold:0.8,action:"warn",...$})}setBudgets(X){for(let[$,Z]of Object.entries(X))this.setBudget($,Z)}removeBudget(X){this.budgets.delete(X)}getBudgets(){let X={};for(let[$,Z]of this.budgets.entries())X[$]=Z;return X}onViolation(X){this.violationHandlers.push(X)}offViolation(X){let $=this.violationHandlers.indexOf(X);if($!==-1)this.violationHandlers.splice($,1)}time(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=$(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}async timeAsync(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=await $(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}checkBudget(X,$){let Z=this.budgets.get(X);if(!Z)return;let Y=$/Z.maxTime*100,J=Z.warnThreshold!==void 0?$>=Z.maxTime*Z.warnThreshold&&$<Z.maxTime:!1,G=$>=Z.maxTime;if(!J&&!G)return;let Q={label:X,actualTime:$,budgetTime:Z.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let K of this.violationHandlers)try{K(Q)}catch{}let q=J?`[Performance Warning] "${X}" took ${$.toFixed(2)}ms (${Y.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${X}" took ${$.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(q);break;case"warn":console.warn(q);break;case"error":console.error(q);break;case"throw":if(G)throw Error(q);else console.warn(q);break}}recordTime(X,$){let Z=this.metrics.get(X);if(Z)Z.count++,Z.totalTime+=$,Z.maxTime=Math.max(Z.maxTime,$),Z.minTime=Math.min(Z.minTime,$);else this.metrics.set(X,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(X){if(X){let Z=this.metrics.get(X);if(!Z)return{};let Y=this.budgets.get(X);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:Y?.maxTime,budgetUtilization:Y?Z.totalTime/Z.count/Y.maxTime*100:void 0}}let $={};for(let[Z,Y]of this.metrics.entries()){let J=this.budgets.get(Z);$[Z]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}return $}getViolations(X){if(X)return this.violations.filter(($)=>$.label===X);return[...this.violations]}getViolationStats(){let X={},$=0,Z=0;for(let Y of this.violations)if(X[Y.label]=(X[Y.label]||0)+1,Y.isWarning)$++;else Z++;return{total:this.violations.length,byLabel:X,warnings:$,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function Yz(){if(!U9)U9=new OZ;return U9}var E5,Zz=500,_A,U9=null,LZ;var y5=E(()=>{E5=new Map;_A=new HZ;LZ=new Proxy({},{get(X,$){return Yz()[$]}})});function FZ(X,$=""){let Z=`${X}${$}`,Y=0;for(let J=0;J<Z.length;J++){let G=Z.charCodeAt(J);Y=(Y<<5)-Y+G,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function VZ(X,$,Z={}){let{prefix:Y="",preserveHost:J=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!X.trim())return"";let q=W9(X),K=[],U=new Map;if(G)for(let W of q){let z=W.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let w=z[1],B=`${$}_${w}`;U.set(w,B)}}for(let W of q){let z=AZ(W,$,Y,J,U,Q);K.push(z)}return K.join(`
3734
+ `),J.set(K,U)}return U(...q)}catch{return}}};if(this.pool.length<this.maxPoolSize)this.pool.push({func:Q,context:$.slice()});return Q}clear(){this.pool.length=0,this.fnCache.clear()}}class LZ{metrics=new Map;budgets=new Map;violations=[];maxViolations=100;violationHandlers=[];enabled=!0;setEnabled(X){this.enabled=X}isEnabled(){return this.enabled}setBudget(X,$){this.budgets.set(X,{warnThreshold:0.8,action:"warn",...$})}setBudgets(X){for(let[$,Z]of Object.entries(X))this.setBudget($,Z)}removeBudget(X){this.budgets.delete(X)}getBudgets(){let X={};for(let[$,Z]of this.budgets.entries())X[$]=Z;return X}onViolation(X){this.violationHandlers.push(X)}offViolation(X){let $=this.violationHandlers.indexOf(X);if($!==-1)this.violationHandlers.splice($,1)}time(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=$(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}async timeAsync(X,$){if(!this.enabled)return $();let Z=performance.now(),Y=await $(),J=performance.now()-Z;return this.recordTime(X,J),this.checkBudget(X,J),Y}checkBudget(X,$){let Z=this.budgets.get(X);if(!Z)return;let Y=$/Z.maxTime*100,J=Z.warnThreshold!==void 0?$>=Z.maxTime*Z.warnThreshold&&$<Z.maxTime:!1,G=$>=Z.maxTime;if(!J&&!G)return;let Q={label:X,actualTime:$,budgetTime:Z.maxTime,exceedancePercent:Y,timestamp:new Date,isWarning:J};this.violations.push(Q);while(this.violations.length>this.maxViolations)this.violations.shift();for(let W of this.violationHandlers)try{W(Q)}catch{}let q=J?`[Performance Warning] "${X}" took ${$.toFixed(2)}ms (${Y.toFixed(1)}% of ${Z.maxTime}ms budget)`:`[Performance Budget Exceeded] "${X}" took ${$.toFixed(2)}ms (exceeded ${Z.maxTime}ms budget by ${(Y-100).toFixed(1)}%)`;switch(Z.action){case"log":console.log(q);break;case"warn":console.warn(q);break;case"error":console.error(q);break;case"throw":if(G)throw Error(q);else console.warn(q);break}}recordTime(X,$){let Z=this.metrics.get(X);if(Z)Z.count++,Z.totalTime+=$,Z.maxTime=Math.max(Z.maxTime,$),Z.minTime=Math.min(Z.minTime,$);else this.metrics.set(X,{count:1,totalTime:$,maxTime:$,minTime:$})}getStats(X){if(X){let Z=this.metrics.get(X);if(!Z)return{};let Y=this.budgets.get(X);return{count:Z.count,avgTime:Z.totalTime/Z.count,totalTime:Z.totalTime,maxTime:Z.maxTime,minTime:Z.minTime,budget:Y?.maxTime,budgetUtilization:Y?Z.totalTime/Z.count/Y.maxTime*100:void 0}}let $={};for(let[Z,Y]of this.metrics.entries()){let J=this.budgets.get(Z);$[Z]={count:Y.count,avgTime:Y.totalTime/Y.count,totalTime:Y.totalTime,maxTime:Y.maxTime,minTime:Y.minTime,budget:J?.maxTime,budgetUtilization:J?Y.totalTime/Y.count/J.maxTime*100:void 0}}return $}getViolations(X){if(X)return this.violations.filter(($)=>$.label===X);return[...this.violations]}getViolationStats(){let X={},$=0,Z=0;for(let Y of this.violations)if(X[Y.label]=(X[Y.label]||0)+1,Y.isWarning)$++;else Z++;return{total:this.violations.length,byLabel:X,warnings:$,errors:Z}}clear(){this.metrics.clear()}clearViolations(){this.violations.length=0}clearBudgets(){this.budgets.clear()}reset(){this.clear(),this.clearViolations(),this.clearBudgets(),this.violationHandlers.length=0}}function Yz(){if(!K9)K9=new LZ;return K9}var E5,Zz=500,LA,K9=null,OZ;var y5=E(()=>{E5=new Map;LA=new HZ;OZ=new Proxy({},{get(X,$){return Yz()[$]}})});function FZ(X,$=""){let Z=`${X}${$}`,Y=0;for(let J=0;J<Z.length;J++){let G=Z.charCodeAt(J);Y=(Y<<5)-Y+G,Y=Y&Y}return`stx-${Math.abs(Y).toString(36)}`}function VZ(X,$,Z={}){let{prefix:Y="",preserveHost:J=!0,scopeKeyframes:G=!0,scopeCustomProperties:Q=!1}=Z;if(!X.trim())return"";let q=U9(X),W=[],K=new Map;if(G)for(let U of q){let z=U.selector.match(/@keyframes\s+([a-z_-][a-z0-9_-]*)/i);if(z){let w=z[1],B=`${$}_${w}`;K.set(w,B)}}for(let U of q){let z=AZ(U,$,Y,J,K,Q);W.push(z)}return W.join(`
3735
3735
 
3736
- `)}function W9(X){let $=[],Z=X.replace(/\/\*[\s\S]*?\*\//g,""),Y=0,J="",G=!1,Q="";for(let q=0;q<Z.length;q++){let K=Z[q];if(K==="@"&&Y===0)G=!0;if(K==="{")Y++;else if(K==="}"){if(Y--,Y===0){if(G){Q+=K;let U=Q.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(U){let[,W,z,w]=U;if(W==="keyframes")$.push({selector:`@keyframes ${z.trim()}`,declarations:w.trim()});else if(W==="media"||W==="supports"||W==="container"){let B=W9(w);$.push({selector:`@${W} ${z.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
3737
- `)})}else $.push({selector:`@${W} ${z.trim()}`,declarations:w.trim()})}Q="",G=!1}else if(J.trim()){J+=K;let U=J.match(/([^{]+)\{([^}]*)\}/);if(U)$.push({selector:U[1].trim(),declarations:U[2].trim()});J=""}continue}}if(G)Q+=K;else J+=K}return $}function AZ(X,$,Z,Y,J,G){let{selector:Q,declarations:q}=X;if(Q.startsWith("@")){if(Q.startsWith("@keyframes")){let W=Q.replace("@keyframes ","").trim();return`@keyframes ${J.get(W)||W} { ${q} }`}if(Q.startsWith("@media")||Q.startsWith("@supports")||Q.startsWith("@container")){let z=W9(`x { ${q} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((w)=>AZ(w,$,Z,Y,J,G)).join(`
3736
+ `)}function U9(X){let $=[],Z=X.replace(/\/\*[\s\S]*?\*\//g,""),Y=0,J="",G=!1,Q="";for(let q=0;q<Z.length;q++){let W=Z[q];if(W==="@"&&Y===0)G=!0;if(W==="{")Y++;else if(W==="}"){if(Y--,Y===0){if(G){Q+=W;let K=Q.match(/@([a-z-]+)\s*([^{]*)\{([\s\S]*)\}/i);if(K){let[,U,z,w]=K;if(U==="keyframes")$.push({selector:`@keyframes ${z.trim()}`,declarations:w.trim()});else if(U==="media"||U==="supports"||U==="container"){let B=U9(w);$.push({selector:`@${U} ${z.trim()}`,declarations:B.map((j)=>`${j.selector} { ${j.declarations} }`).join(`
3737
+ `)})}else $.push({selector:`@${U} ${z.trim()}`,declarations:w.trim()})}Q="",G=!1}else if(J.trim()){J+=W;let K=J.match(/([^{]+)\{([^}]*)\}/);if(K)$.push({selector:K[1].trim(),declarations:K[2].trim()});J=""}continue}}if(G)Q+=W;else J+=W}return $}function AZ(X,$,Z,Y,J,G){let{selector:Q,declarations:q}=X;if(Q.startsWith("@")){if(Q.startsWith("@keyframes")){let U=Q.replace("@keyframes ","").trim();return`@keyframes ${J.get(U)||U} { ${q} }`}if(Q.startsWith("@media")||Q.startsWith("@supports")||Q.startsWith("@container")){let z=U9(`x { ${q} }`.replace(/x \{ /,"").replace(/ \}$/,"")).map((w)=>AZ(w,$,Z,Y,J,G)).join(`
3738
3738
  `);return`${Q} {
3739
3739
  ${z}
3740
- }`}return`${Q} { ${q} }`}let K=Jz(Q,$,Z,Y),U=q;for(let[W,z]of J)U=U.replace(new RegExp(`\\b${W}\\b`,"g"),z);if(G)U=U.replace(/--([a-z-]+)/gi,`--${$}-$1`);return`${K} { ${U} }`}function Jz(X,$,Z,Y){let J=X.split(",").map((Q)=>Q.trim()),G=[];for(let Q of J){if(Q.startsWith(":host")){if(Y)G.push(Q);else{let U=Q.replace(/:host(\([^)]*\))?/,`.${$}$1`);G.push(U)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${$}`);continue}let q=Z?`${Z} .${$}`:`.${$}`;G.push(`${q} ${Q}`);let K=Gz(Q,$);if(K)G.push(Z?`${Z} ${K}`:K)}return G.join(", ")}function Gz(X,$){let Z=0,Y=X.length;for(let K=0;K<X.length;K++){let U=X[K];if(U==="["||U==="(")Z++;else if(U==="]"||U===")")Z--;else if(Z===0&&(U===" "||U===">"||U==="+"||U==="~")){Y=K;break}}let J=X.slice(0,Y),G=X.slice(Y);if(!J)return"";let Q=J.length,q=0;for(let K=0;K<J.length;K++){let U=J[K];if(U==="["||U==="(")q++;else if(U==="]"||U===")")q--;else if(Z===0&&q===0&&U===":"){Q=K;break}}return`${J.slice(0,Q)}.${$}${J.slice(Q)}${G}`}function NZ(X){let $=new Set;return X.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let Y=Z.trim();if($.has(Y))return"";return $.add(Y),Z})}function CX(X,$){if(!Qz.test(X))return{html:X,hasScoped:!1};let Z=FZ($),Y=`data-v-${Z}`,J=X,G=new RegExp(`<style\\s+([^>]*${z9}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(J=J.replace(G,(q,K,U)=>{Q=!0;let W=qz(U,Y),z=K.replace(new RegExp(z9,"gi"),"").trim(),w=z?` ${z}`:"";return`<style data-stx-scoped="${Z}"${w}>${W}</style>`}),!Q)return{html:X,hasScoped:!1};return J=Uz(J,Y),{html:J,hasScoped:!0}}function qz(X,$){return VZ(X,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${$}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${$}]`)}function Uz(X,$){let Z=Y1(X,(J,G)=>{let Q=M1(J,G);return Q>G?Q:k5(J,G)},(J,G)=>Kz(G)),Y=Wz(Z.output,$);return RZ.lastIndex=0,Y.replace(RZ,(J,G)=>Z.tokens[Number(G)])}function Wz(X,$){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return X.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,J,G)=>{if(Z.has(J.toLowerCase()))return Y;if(Y.includes($))return Y;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return Y;if(G)return Y.replace(`<${J}${G}`,`<${J} ${$}${G}`);if(Y.endsWith("/>"))return`<${J} ${$} />`;return`<${J} ${$}>`})}var z9,Qz,Kz=(X)=>`\x00stx-scope-mask-${X}\x00`,RZ;var w9=E(()=>{k1();z9=String.raw`(?<![\w-])scoped(?![\w-])`,Qz=new RegExp(`<style\\s+[^>]*${z9}`,"i");RZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function wz(X){let $=X.replace(/^<template\b/i,"").replace(/>$/,"");return zz.test($)}function PX(X){b7.lastIndex=0;let $;while(($=b7.exec(X))!==null){if($[0].startsWith("</")||wz($[0]))continue;let Z=$.index,Y=b7.lastIndex,J=1,G;while((G=b7.exec(X))!==null)if(G[0].startsWith("</")){if(J--,J===0){let Q=G.index;return{start:Z,openEnd:Y,closeStart:Q,end:b7.lastIndex,content:X.slice(Y,Q)}}}else J++;return null}return null}var b7,zz;var j9=E(()=>{b7=/<\/?template\b[^>]*>/gi,zz=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var TZ=()=>{};function D0(X,$,Z,Y=0){let J=0,G=Y,Q=null,q=0,K=!1;while(G<X.length){let U=X[G];if(Q&&K){K=!1,G++;continue}if(Q&&U==="\\"){K=!0,G++;continue}if(K=!1,(U==='"'||U==="'"||U==="`")&&!Q){Q=U,G++;continue}if(U===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&U==="$"&&X[G+1]==="{"){q++,G+=2;continue}if(q>0&&U==="}"){q--,G++;continue}if(U==="`"&&Q==="`"&&q===0){Q=null,G++;continue}if(Q){G++;continue}if(U===$)J++;else if(U===Z){if(J--,J===0)return G}G++}return-1}var H9={};n(H9,{useTitle:()=>Oz,useSeoMeta:()=>MZ,usePageTitle:()=>Oz,useHead:()=>_9,seoMetaToHeadConfig:()=>xX,resetHead:()=>_z,renderHtmlAttrs:()=>Fz,renderHead:()=>Lz,renderBodyAttrs:()=>Vz,processTitleDirective:()=>Nz,processMetaDirective:()=>Tz,processHeadDirective:()=>Rz,mergeHeadConfigs:()=>D1,getPageMeta:()=>Bz,getHead:()=>B9,definePageMeta:()=>Hz,applyHead:()=>Az});function B9(){return E1}function Bz(){return vX}function _z(){E1={},jz.length=0,vX={}}function _9(X){E1=D1(E1,X)}function D1(X,$){return{title:$.title??X.title,titleTemplate:$.titleTemplate??X.titleTemplate,base:$.base??X.base,meta:[...X.meta||[],...$.meta||[]],link:[...X.link||[],...$.link||[]],script:[...X.script||[],...$.script||[]],style:[...X.style||[],...$.style||[]],htmlAttrs:{...X.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...X.bodyAttrs,...$.bodyAttrs}}}function MZ(X){_9(xX(X))}function xX(X){let $=[];if(X.description)$.push({name:"description",content:X.description});if(X.keywords){let K=Array.isArray(X.keywords)?X.keywords.join(", "):X.keywords;$.push({name:"keywords",content:K})}if(X.author)$.push({name:"author",content:X.author});if(X.robots)$.push({name:"robots",content:X.robots});let Z=X.ogTitle??X.title,Y=X.ogDescription??X.description;if(Z)$.push({property:"og:title",content:Z});if(Y)$.push({property:"og:description",content:Y});if(X.ogImage)$.push({property:"og:image",content:X.ogImage});if(X.ogUrl)$.push({property:"og:url",content:X.ogUrl});if(X.ogType)$.push({property:"og:type",content:X.ogType});if(X.ogSiteName)$.push({property:"og:site_name",content:X.ogSiteName});if(X.ogLocale)$.push({property:"og:locale",content:X.ogLocale});let J=X.twitterTitle??X.title,G=X.twitterDescription??X.description,Q=X.twitterImage??X.ogImage;if(X.twitterCard)$.push({name:"twitter:card",content:X.twitterCard});if(J)$.push({name:"twitter:title",content:J});if(G)$.push({name:"twitter:description",content:G});if(Q)$.push({name:"twitter:image",content:Q});if(X.twitterSite)$.push({name:"twitter:site",content:X.twitterSite});if(X.twitterCreator)$.push({name:"twitter:creator",content:X.twitterCreator});if(X.articleAuthor)$.push({property:"article:author",content:X.articleAuthor});if(X.articlePublishedTime)$.push({property:"article:published_time",content:X.articlePublishedTime});if(X.articleModifiedTime)$.push({property:"article:modified_time",content:X.articleModifiedTime});if(X.articleSection)$.push({property:"article:section",content:X.articleSection});if(X.articleTags)for(let K of X.articleTags)$.push({property:"article:tag",content:K});let q=[];if(X.canonical)q.push({rel:"canonical",href:X.canonical});return{title:X.title,titleTemplate:X.titleTemplate,meta:$,link:q}}function Hz(X){if(vX={...vX,...X},X.title||X.description)MZ({title:X.title,description:X.description})}function Oz(X){let $=typeof X==="function"?X():X;_9({title:$})}function Lz(X=E1){let $=[];if(X.title){let Z=X.title;if(X.titleTemplate)Z=typeof X.titleTemplate==="function"?X.titleTemplate(Z):X.titleTemplate.replace("%s",Z);$.push(`<title>${t1(Z)}</title>`)}if(X.base){let Z=Object.entries(X.base).map(([Y,J])=>`${Y}="${t1(J)}"`).join(" ");$.push(`<base ${Z}>`)}for(let Z of X.meta||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>{return`${J==="httpEquiv"?"http-equiv":J}="${t1(String(G))}"`}).join(" ");$.push(`<meta ${Y}>`)}for(let Z of X.link||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>`${J}="${t1(String(G))}"`).join(" ");$.push(`<link ${Y}>`)}for(let Z of X.script||[]){let{content:Y,...J}=Z,G=Object.entries(J).filter(([Q,q])=>q!==void 0).map(([Q,q])=>{if(typeof q==="boolean")return q?Q:"";return`${Q}="${t1(String(q))}"`}).filter(Boolean).join(" ");if(Y)$.push(`<script ${G}>${Y}</script>`);else $.push(`<script ${G}></script>`)}for(let Z of X.style||[]){let Y=Z.type?` type="${Z.type}"`:"";$.push(`<style${Y}>${Z.content}</style>`)}return $.join(`
3740
+ }`}return`${Q} { ${q} }`}let W=Jz(Q,$,Z,Y),K=q;for(let[U,z]of J)K=K.replace(new RegExp(`\\b${U}\\b`,"g"),z);if(G)K=K.replace(/--([a-z-]+)/gi,`--${$}-$1`);return`${W} { ${K} }`}function Jz(X,$,Z,Y){let J=X.split(",").map((Q)=>Q.trim()),G=[];for(let Q of J){if(Q.startsWith(":host")){if(Y)G.push(Q);else{let K=Q.replace(/:host(\([^)]*\))?/,`.${$}$1`);G.push(K)}continue}if(Q.includes("::slotted")){G.push(Q);continue}if(Q===":root"){G.push(`:root .${$}`);continue}let q=Z?`${Z} .${$}`:`.${$}`;G.push(`${q} ${Q}`);let W=Gz(Q,$);if(W)G.push(Z?`${Z} ${W}`:W)}return G.join(", ")}function Gz(X,$){let Z=0,Y=X.length;for(let W=0;W<X.length;W++){let K=X[W];if(K==="["||K==="(")Z++;else if(K==="]"||K===")")Z--;else if(Z===0&&(K===" "||K===">"||K==="+"||K==="~")){Y=W;break}}let J=X.slice(0,Y),G=X.slice(Y);if(!J)return"";let Q=J.length,q=0;for(let W=0;W<J.length;W++){let K=J[W];if(K==="["||K==="(")q++;else if(K==="]"||K===")")q--;else if(Z===0&&q===0&&K===":"){Q=W;break}}return`${J.slice(0,Q)}.${$}${J.slice(Q)}${G}`}function NZ(X){let $=new Set;return X.replace(/<style\b[^>]*\bdata-stx-scoped(?:=(?:"[^"]*"|'[^']*'|[^\s>]+))?[^>]*>[\s\S]*?<\/style>\s*/gi,(Z)=>{let Y=Z.trim();if($.has(Y))return"";return $.add(Y),Z})}function CX(X,$){if(!Qz.test(X))return{html:X,hasScoped:!1};let Z=FZ($),Y=`data-v-${Z}`,J=X,G=new RegExp(`<style\\s+([^>]*${z9}[^>]*)>([\\s\\S]*?)</style>`,"gi"),Q=!1;if(J=J.replace(G,(q,W,K)=>{Q=!0;let U=qz(K,Y),z=W.replace(new RegExp(z9,"gi"),"").trim(),w=z?` ${z}`:"";return`<style data-stx-scoped="${Z}"${w}>${U}</style>`}),!Q)return{html:X,hasScoped:!1};return J=Kz(J,Y),{html:J,hasScoped:!0}}function qz(X,$){return VZ(X,"__SCOPE_PLACEHOLDER__",{preserveHost:!1}).replace(/\.(__SCOPE_PLACEHOLDER__) /g,`[${$}] `).replace(/\.(__SCOPE_PLACEHOLDER__)/g,`[${$}]`)}function Kz(X,$){let Z=Y1(X,(J,G)=>{let Q=M1(J,G);return Q>G?Q:k5(J,G)},(J,G)=>Wz(G)),Y=Uz(Z.output,$);return RZ.lastIndex=0,Y.replace(RZ,(J,G)=>Z.tokens[Number(G)])}function Uz(X,$){let Z=new Set(["script","style","template","html","head","body","meta","link","title","base","!doctype","!DOCTYPE"]);return X.replace(/<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*)?\/?>/g,(Y,J,G)=>{if(Z.has(J.toLowerCase()))return Y;if(Y.includes($))return Y;if(J.toLowerCase()==="style"||J.toLowerCase()==="script")return Y;if(G)return Y.replace(`<${J}${G}`,`<${J} ${$}${G}`);if(Y.endsWith("/>"))return`<${J} ${$} />`;return`<${J} ${$}>`})}var z9,Qz,Wz=(X)=>`\x00stx-scope-mask-${X}\x00`,RZ;var w9=E(()=>{k1();z9=String.raw`(?<![\w-])scoped(?![\w-])`,Qz=new RegExp(`<style\\s+[^>]*${z9}`,"i");RZ=/\u0000stx-scope-mask-(\d+)\u0000/g});function wz(X){let $=X.replace(/^<template\b/i,"").replace(/>$/,"");return zz.test($)}function PX(X){b7.lastIndex=0;let $;while(($=b7.exec(X))!==null){if($[0].startsWith("</")||wz($[0]))continue;let Z=$.index,Y=b7.lastIndex,J=1,G;while((G=b7.exec(X))!==null)if(G[0].startsWith("</")){if(J--,J===0){let Q=G.index;return{start:Z,openEnd:Y,closeStart:Q,end:b7.lastIndex,content:X.slice(Y,Q)}}}else J++;return null}return null}var b7,zz;var j9=E(()=>{b7=/<\/?template\b[^>]*>/gi,zz=/(?:^|\s)(?:id\s*=|(?:x-|[@:])(?:for|if|else(?:-if)?)(?=\s|=|$)|#[\w-]+(?:\s*=|\s|$)|v-slot(?::[\w-]+)?(?=\s|=|$)|slot\s*=)/i});var TZ=()=>{};function D0(X,$,Z,Y=0){let J=0,G=Y,Q=null,q=0,W=!1;while(G<X.length){let K=X[G];if(Q&&W){W=!1,G++;continue}if(Q&&K==="\\"){W=!0,G++;continue}if(W=!1,(K==='"'||K==="'"||K==="`")&&!Q){Q=K,G++;continue}if(K===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"&&K==="$"&&X[G+1]==="{"){q++,G+=2;continue}if(q>0&&K==="}"){q--,G++;continue}if(K==="`"&&Q==="`"&&q===0){Q=null,G++;continue}if(Q){G++;continue}if(K===$)J++;else if(K===Z){if(J--,J===0)return G}G++}return-1}var H9={};i(H9,{useTitle:()=>Lz,useSeoMeta:()=>MZ,usePageTitle:()=>Lz,useHead:()=>_9,seoMetaToHeadConfig:()=>xX,resetHead:()=>_z,renderHtmlAttrs:()=>Fz,renderHead:()=>Oz,renderBodyAttrs:()=>Vz,processTitleDirective:()=>Nz,processMetaDirective:()=>Tz,processHeadDirective:()=>Rz,mergeHeadConfigs:()=>D1,getPageMeta:()=>Bz,getHead:()=>B9,definePageMeta:()=>Hz,applyHead:()=>Az});function B9(){return E1}function Bz(){return vX}function _z(){E1={},jz.length=0,vX={}}function _9(X){E1=D1(E1,X)}function D1(X,$){return{title:$.title??X.title,titleTemplate:$.titleTemplate??X.titleTemplate,base:$.base??X.base,meta:[...X.meta||[],...$.meta||[]],link:[...X.link||[],...$.link||[]],script:[...X.script||[],...$.script||[]],style:[...X.style||[],...$.style||[]],htmlAttrs:{...X.htmlAttrs,...$.htmlAttrs},bodyAttrs:{...X.bodyAttrs,...$.bodyAttrs}}}function MZ(X){_9(xX(X))}function xX(X){let $=[];if(X.description)$.push({name:"description",content:X.description});if(X.keywords){let W=Array.isArray(X.keywords)?X.keywords.join(", "):X.keywords;$.push({name:"keywords",content:W})}if(X.author)$.push({name:"author",content:X.author});if(X.robots)$.push({name:"robots",content:X.robots});let Z=X.ogTitle??X.title,Y=X.ogDescription??X.description;if(Z)$.push({property:"og:title",content:Z});if(Y)$.push({property:"og:description",content:Y});if(X.ogImage)$.push({property:"og:image",content:X.ogImage});if(X.ogUrl)$.push({property:"og:url",content:X.ogUrl});if(X.ogType)$.push({property:"og:type",content:X.ogType});if(X.ogSiteName)$.push({property:"og:site_name",content:X.ogSiteName});if(X.ogLocale)$.push({property:"og:locale",content:X.ogLocale});let J=X.twitterTitle??X.title,G=X.twitterDescription??X.description,Q=X.twitterImage??X.ogImage;if(X.twitterCard)$.push({name:"twitter:card",content:X.twitterCard});if(J)$.push({name:"twitter:title",content:J});if(G)$.push({name:"twitter:description",content:G});if(Q)$.push({name:"twitter:image",content:Q});if(X.twitterSite)$.push({name:"twitter:site",content:X.twitterSite});if(X.twitterCreator)$.push({name:"twitter:creator",content:X.twitterCreator});if(X.articleAuthor)$.push({property:"article:author",content:X.articleAuthor});if(X.articlePublishedTime)$.push({property:"article:published_time",content:X.articlePublishedTime});if(X.articleModifiedTime)$.push({property:"article:modified_time",content:X.articleModifiedTime});if(X.articleSection)$.push({property:"article:section",content:X.articleSection});if(X.articleTags)for(let W of X.articleTags)$.push({property:"article:tag",content:W});let q=[];if(X.canonical)q.push({rel:"canonical",href:X.canonical});return{title:X.title,titleTemplate:X.titleTemplate,meta:$,link:q}}function Hz(X){if(vX={...vX,...X},X.title||X.description)MZ({title:X.title,description:X.description})}function Lz(X){let $=typeof X==="function"?X():X;_9({title:$})}function Oz(X=E1){let $=[];if(X.title){let Z=X.title;if(X.titleTemplate)Z=typeof X.titleTemplate==="function"?X.titleTemplate(Z):X.titleTemplate.replace("%s",Z);$.push(`<title>${t1(Z)}</title>`)}if(X.base){let Z=Object.entries(X.base).map(([Y,J])=>`${Y}="${t1(J)}"`).join(" ");$.push(`<base ${Z}>`)}for(let Z of X.meta||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>{return`${J==="httpEquiv"?"http-equiv":J}="${t1(String(G))}"`}).join(" ");$.push(`<meta ${Y}>`)}for(let Z of X.link||[]){let Y=Object.entries(Z).filter(([J,G])=>G!==void 0).map(([J,G])=>`${J}="${t1(String(G))}"`).join(" ");$.push(`<link ${Y}>`)}for(let Z of X.script||[]){let{content:Y,...J}=Z,G=Object.entries(J).filter(([Q,q])=>q!==void 0).map(([Q,q])=>{if(typeof q==="boolean")return q?Q:"";return`${Q}="${t1(String(q))}"`}).filter(Boolean).join(" ");if(Y)$.push(`<script ${G}>${Y}</script>`);else $.push(`<script ${G}></script>`)}for(let Z of X.style||[]){let Y=Z.type?` type="${Z.type}"`:"";$.push(`<style${Y}>${Z.content}</style>`)}return $.join(`
3741
3741
  `)}function Fz(X=E1){if(!X.htmlAttrs)return"";return Object.entries(X.htmlAttrs).map(([$,Z])=>`${$}="${t1(Z)}"`).join(" ")}function Vz(X=E1){if(!X.bodyAttrs)return"";return Object.entries(X.bodyAttrs).map(([$,Z])=>`${$}="${t1(Z)}"`).join(" ")}function t1(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function Az(X=E1){if(typeof document>"u")return;if(X.title){let $=X.title;if(X.titleTemplate)$=typeof X.titleTemplate==="function"?X.titleTemplate($):X.titleTemplate.replace("%s",$);document.title=$}for(let $ of X.meta||[]){let Z=$.name?`meta[name="${$.name}"]`:$.property?`meta[property="${$.property}"]`:null;if(Z){let Y=document.querySelector(Z);if(!Y){if(Y=document.createElement("meta"),$.name)Y.setAttribute("name",$.name);if($.property)Y.setAttribute("property",$.property);document.head.appendChild(Y)}Y.setAttribute("content",$.content)}}for(let $ of X.link||[]){let Z=`link[rel="${$.rel}"]${$.href?`[href="${$.href}"]`:""}`,Y=document.querySelector(Z);if(!Y)Y=document.createElement("link"),document.head.appendChild(Y);for(let[J,G]of Object.entries($))if(G!==void 0)Y.setAttribute(J,String(G))}if(X.htmlAttrs)for(let[$,Z]of Object.entries(X.htmlAttrs))if($==="class")for(let Y of String(Z).split(/\s+/).filter(Boolean))document.documentElement.classList.add(Y);else document.documentElement.setAttribute($,Z);if(X.bodyAttrs)for(let[$,Z]of Object.entries(X.bodyAttrs))document.body.setAttribute($,Z)}function Rz(X){let $="";return{content:X.replace(/@head\s*([\s\S]*?)@endhead/g,(Y,J)=>{return $+=J.trim()+`
3742
- `,""}),headContent:$.trim()}}function Nz(X,$){return X.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,Y,J,G)=>{let Q=Y?J:$[(G||"").trim()]??G,q=$.__stx_runtime_head??{};return $.__stx_runtime_head=D1(q,{title:Q}),""})}function Tz(X,$){return X.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,Y,J,G,Q,q)=>{let K=G?Q:q,U=G?K:$[(K||"").trim()]??K,z=J.includes(":")?{property:J,content:U}:{name:J,content:U},w=$.__stx_runtime_head??{};return $.__stx_runtime_head=D1(w,{meta:[z]}),""})}var E1,jz,vX;var b5=E(()=>{E1={},jz=[],vX={}});var fX={};n(fX,{stripTypeScript:()=>SZ,splitDeclaration:()=>gZ,isModuleResolutionFailure:()=>CZ,isMissingBindingFailure:()=>PZ,isCompleteImport:()=>vZ,hasVariables:()=>mZ,extractVariables:()=>e1,extractScriptFromTemplate:()=>dZ,convertToCommonJS:()=>F9,STX_ENGINE_BINDING_NAMES:()=>L9});import y1 from"path";import S5 from"process";function kz(X){let $=[],Z=0,Y=X.split(`
3743
- `);for(let J of Y){let G=Z,Q=null,q=!1;for(let K=0;K<J.length;K++){let U=J[K];if(q){q=!1;continue}if(U==="\\"){q=!0;continue}if(Q){if(U===Q)Q=null;continue}if(U==="'"||U==='"'||U==="`"){Q=U;continue}if(U==="/"&&K+1<J.length&&J[K+1]==="/")break;if(U==="{")Z++;else if(U==="}")Z--}if(G===0){let K=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(K)$.push(K[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let U=J.match(/(?:const|let|var)\s+(\w+)/);if(U)$.push(U[1])}else{let U=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(U){let z=U[1].slice(1,-1).split(",").map((w)=>{let B=w.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((w)=>/^\w+$/.test(w));$.push(...z)}}}}return[...new Set($)]}function SZ(X){let $=X;$=$.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),$=$.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),$=$.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(Y){if(!Y.includes(":"))return Y;let J=[],G="",Q=0,q=0,K=null;for(let U=0;U<Y.length;U++){let W=Y[U];if(K){if(G+=W,W===K)K=null;continue}if(W==='"'||W==="'"||W==="`"){K=W,G+=W;continue}if(W==="<")Q++;else if(W===">"&&Q>0)Q--;else if(W==="(")q++;else if(W===")")q--;if(W===","&&Q===0&&q===0){J.push(G),G="";continue}G+=W}if(G)J.push(G);return J.map((U)=>{let W=U.trim(),z=W.startsWith("..."),w=z?W.slice(3):W,B=-1,j=0;for(let A=0;A<w.length;A++)if(w[A]==="<")j++;else if(w[A]===">")j--;else if(w[A]===":"&&j===0){B=A;break}if(B===-1)return U;let H=w.substring(0,B).trim().replace(/\?$/,""),O=w.substring(B+1),L=-1,F=0;for(let A=0;A<O.length;A++)if(O[A]==="<")F++;else if(O[A]===">")F--;else if(O[A]==="="&&F===0){L=A;break}let V=z?"...":"";if(L!==-1)return`${V}${H} = ${O.substring(L+1).trim()}`;return`${V}${H}`}).join(", ")}$=$.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;return`${J}(${Z(G)})`});{let Y=/\b(function\s+\w*\s*)\(/g,J,G=[];while((J=Y.exec($))!==null){let Q=J.index+J[0].length-1,q=1,K=Q+1,U=0,W=null;while(K<$.length&&q>0){let B=$[K];if(W){if(B===W)W=null;K++;continue}if(B==='"'||B==="'"||B==="`"){W=B,K++;continue}if(B==="<")U++;else if(B===">"&&U>0)U--;else if(U===0){if(B==="(")q++;else if(B===")")q--}if(q>0)K++}if(q!==0)continue;let z=$.substring(Q+1,K);if(!z.includes(":"))continue;let w=Z(z);G.push({start:Q+1,end:K,replacement:w})}for(let Q=G.length-1;Q>=0;Q--){let{start:q,end:K,replacement:U}=G[Q];$=$.substring(0,q)+U+$.substring(K)}}return $=$.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((Q)=>{let[q,...K]=Q.split("="),U=q.split(":")[0].trim();if(K.length>0)return`${U} = ${K.join("=").trim()}`;return U}).join(", ")}) =>`}),$=$.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),$=$.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),$=$.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),$=$.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),$=$.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),$=$.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),$=$.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),$=$.replace(/\n\s*\n\s*\n/g,`
3742
+ `,""}),headContent:$.trim()}}function Nz(X,$){return X.replace(/@title\s*\(\s*(?:(['"`])(.+?)\1|([^)]+))\s*\)/g,(Z,Y,J,G)=>{let Q=Y?J:$[(G||"").trim()]??G,q=$.__stx_runtime_head??{};return $.__stx_runtime_head=D1(q,{title:Q}),""})}function Tz(X,$){return X.replace(/@meta\s*\(\s*(['"`])(.+?)\1\s*,\s*(?:(['"`])(.+?)\3|([^)]+))\s*\)/g,(Z,Y,J,G,Q,q)=>{let W=G?Q:q,K=G?W:$[(W||"").trim()]??W,z=J.includes(":")?{property:J,content:K}:{name:J,content:K},w=$.__stx_runtime_head??{};return $.__stx_runtime_head=D1(w,{meta:[z]}),""})}var E1,jz,vX;var b5=E(()=>{E1={},jz=[],vX={}});var fX={};i(fX,{stripTypeScript:()=>SZ,splitDeclaration:()=>gZ,isModuleResolutionFailure:()=>CZ,isMissingBindingFailure:()=>PZ,isCompleteImport:()=>vZ,hasVariables:()=>mZ,extractVariables:()=>e1,extractScriptFromTemplate:()=>dZ,convertToCommonJS:()=>F9,STX_ENGINE_BINDING_NAMES:()=>O9});import y1 from"path";import S5 from"process";function Iz(X){let $=[],Z=0,Y=X.split(`
3743
+ `);for(let J of Y){let G=Z,Q=null,q=!1;for(let W=0;W<J.length;W++){let K=J[W];if(q){q=!1;continue}if(K==="\\"){q=!0;continue}if(Q){if(K===Q)Q=null;continue}if(K==="'"||K==='"'||K==="`"){Q=K;continue}if(K==="/"&&W+1<J.length&&J[W+1]==="/")break;if(K==="{")Z++;else if(K==="}")Z--}if(G===0){let W=J.match(/(?:const|let|var)\s+(\w+)\s*=/);if(W)$.push(W[1]);else if(/^\s*(?:const|let|var)\s+\w+\s*;?\s*$/.test(J)){let K=J.match(/(?:const|let|var)\s+(\w+)/);if(K)$.push(K[1])}else{let K=J.match(/(?:const|let|var)\s+(\{[^}]+\}|\[[^\]]+\])\s*=/);if(K){let z=K[1].slice(1,-1).split(",").map((w)=>{let B=w.split(":");return(B.length>1?B[1]:B[0]).trim()}).filter((w)=>/^\w+$/.test(w));$.push(...z)}}}}return[...new Set($)]}function SZ(X){let $=X;$=$.replace(/^\s*import\s+.*?from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*import\s+['"][^'"]+['"]\s*;?\s*$/gm,""),$=$.replace(/^\s*interface\s+\w+\s*\{[\s\S]*?\n\}\s*$/gm,""),$=$.replace(/^\s*type\s+\w+\s*=[\s\S]*?(?=\n(?:const|let|var|function|export|interface|type|$))/gm,""),$=$.replace(/^(\s*(?:export\s+)?(?:const|let|var)\s+)(\w+|\{[^}]+\}|\[[^\]]+\])\s*:\s*[^=]+(\s*=)/gm,"$1$2$3");function Z(Y){if(!Y.includes(":"))return Y;let J=[],G="",Q=0,q=0,W=null;for(let K=0;K<Y.length;K++){let U=Y[K];if(W){if(G+=U,U===W)W=null;continue}if(U==='"'||U==="'"||U==="`"){W=U,G+=U;continue}if(U==="<")Q++;else if(U===">"&&Q>0)Q--;else if(U==="(")q++;else if(U===")")q--;if(U===","&&Q===0&&q===0){J.push(G),G="";continue}G+=U}if(G)J.push(G);return J.map((K)=>{let U=K.trim(),z=U.startsWith("..."),w=z?U.slice(3):U,B=-1,j=0;for(let A=0;A<w.length;A++)if(w[A]==="<")j++;else if(w[A]===">")j--;else if(w[A]===":"&&j===0){B=A;break}if(B===-1)return K;let H=w.substring(0,B).trim().replace(/\?$/,""),L=w.substring(B+1),O=-1,F=0;for(let A=0;A<L.length;A++)if(L[A]==="<")F++;else if(L[A]===">")F--;else if(L[A]==="="&&F===0){O=A;break}let V=z?"...":"";if(O!==-1)return`${V}${H} = ${L.substring(O+1).trim()}`;return`${V}${H}`}).join(", ")}$=$.replace(/\b(function\s+\w*\s*)\(([^)]*)\)/g,(Y,J,G)=>{if(!G.includes(":"))return Y;return`${J}(${Z(G)})`});{let Y=/\b(function\s+\w*\s*)\(/g,J,G=[];while((J=Y.exec($))!==null){let Q=J.index+J[0].length-1,q=1,W=Q+1,K=0,U=null;while(W<$.length&&q>0){let B=$[W];if(U){if(B===U)U=null;W++;continue}if(B==='"'||B==="'"||B==="`"){U=B,W++;continue}if(B==="<")K++;else if(B===">"&&K>0)K--;else if(K===0){if(B==="(")q++;else if(B===")")q--}if(q>0)W++}if(q!==0)continue;let z=$.substring(Q+1,W);if(!z.includes(":"))continue;let w=Z(z);G.push({start:Q+1,end:W,replacement:w})}for(let Q=G.length-1;Q>=0;Q--){let{start:q,end:W,replacement:K}=G[Q];$=$.substring(0,q)+K+$.substring(W)}}return $=$.replace(/\(([^)]*)\)\s*(?::\s*[^=]+)?\s*=>/g,(Y,J)=>{if(!J.includes(":"))return Y;if(J.includes("{")||J.includes("}"))return Y;return`(${J.split(",").map((Q)=>{let[q,...W]=Q.split("="),K=q.split(":")[0].trim();if(W.length>0)return`${K} = ${W.join("=").trim()}`;return K}).join(", ")}) =>`}),$=$.replace(/(\))\s*:\s*([A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined)(?:<[^>]+>)?(?:\s*\|\s*(?:[A-Z]\w*|void|string|number|boolean|any|unknown|never|null|undefined))*\s*(\{)/g,"$1$3"),$=$.replace(/(\b(?:function|class|interface|type|extends|implements)\s+\w+)\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\b(?:defineProps|withDefaults|defineEmits|defineSlots|Array|Promise|Map|Set|Record|Partial|Required|Readonly|Pick|Omit|Exclude|Extract))\s*<[^<>()]*>/g,"$1"),$=$.replace(/(\w+)\s*<[A-Z][^<>()]*>\s*(?=\()/g,"$1"),$=$.replace(/\s+as\s+(?:const|[A-Za-z]\w*(?:\[\])?(?:\s*\|\s*\w+(?:\[\])?)*)/g,""),$=$.replace(/\s+satisfies\s+\w+(?:<[^>]*>)?/g,""),$=$.replace(/(\w|\)|\])\s*!(?!=)/g,"$1"),$=$.replace(/^\s*(?:export\s+)?(?:const\s+)?enum\s+\w+\s*\{[^}]*\}\s*$/gm,""),$=$.replace(/(?<=[\s=,(])<[A-Z]\w*(?:\[\])?>/g,""),$=$.replace(/\n\s*\n\s*\n/g,`
3744
3744
 
3745
- `),$}function CZ(X){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(X)}function PZ(X){if(!/is not defined|can't find variable/i.test(X))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(X)}async function e1(X,$,Z,Y={}){if(!X.trim())return;let J;try{let C=_1({loader:"ts",target:"browser",define:u0()}),g=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");g=g.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=C.transformSync(g)}catch{J=SZ(X)}let G={exports:{}},Q=G.exports,q=S5.cwd(),K={},U=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of U)try{let g=y1.resolve(q,"node_modules",C),a=y1.join(g,"package.json"),m=JSON.parse(W0("fs").readFileSync(a,"utf8")),v=m.main||"index.js";if(m.exports){let d=typeof m.exports==="string"?m.exports:m.exports["."];if(typeof d==="string")v=d;else if(d?.bun)v=d.bun;else if(d?.import)v=d.import;else if(d?.default)v=d.default}K[C]=await import(y1.resolve(g,v))}catch{}let W=(C)=>{if(K[C])return K[C];return W0(C)},z=$.props||{},w=(C)=>{if(!C)return z;let g={};for(let[a,m]of Object.entries(C)){let v=z[a];if(v!==void 0)g[a]=v;else if(typeof m==="function")g[a]=m();else g[a]=m}return g};for(let[C,g]of Object.entries(z))Object.defineProperty(w,C,{value:g,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,C))continue;try{Object.defineProperty(w,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(C)=>{if(!C)return z;let g={...z};for(let[a,m]of Object.entries(C)){let v=m&&typeof m==="object"&&!Array.isArray(m)?m:{type:m};if(g[a]===void 0&&v.default!==void 0)g[a]=typeof v.default==="function"?v.default():v.default}return g},j=()=>$.slots||{},_=(C,g)=>{let a={...C};for(let[m,v]of Object.entries(g))if(a[m]===void 0)if(typeof v==="function")a[m]=v();else a[m]=v;return a},H=(C)=>{let g=()=>C;return g.set=(a)=>{},g.update=(a)=>{},g},O=(C)=>{let g,a=!1;return()=>{if(!a)try{g=C(),a=!0}catch{g=void 0}return g}},L=(C)=>{},F=(C)=>C(),V=(C)=>{},A=(C)=>{};function R(C){let g=C||{};if(g.title!==void 0||g.description!==void 0)D({title:g.title,description:g.description})}function N(C){if(!C||typeof C!=="object")return;let g=$.__stxClientPayload??{};Object.assign(g,C),$.__stxClientPayload=g}let T=()=>{let C=$.__stxServeContext,g=$.__stxServeSearch??C?.search??"",a=C?.path??"",m=Object.fromEntries(new URLSearchParams(g)),v=$.query,d=Object.keys(m).length>0?m:v??{},U0=g||(Object.keys(d).length>0?`?${new URLSearchParams(d).toString()}`:"");return{params:$.params??{},query:d,path:a,name:"",fullPath:a+U0,hash:"",matched:[]}},M=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),k=(C)=>{let g=$.__stx_runtime_head||{};$.__stx_runtime_head=D1(g,C||{})},D=(C)=>{k(xX(C||{}))},I=(C)=>({value:C}),S=(C)=>C,b=(C)=>({value:typeof C==="function"?C():C}),y=(C,g)=>{},P=(C)=>{},x=(C)=>{},f=(C)=>C?C():Promise.resolve(),c=(C)=>(g,...a)=>{},l=(C)=>{},T0=(C,g)=>{},x0=(C,g)=>g,f0=()=>({value:"light"}),a0=()=>H(!1),i=(C)=>H(!1),E0=()=>H(!1),z0=()=>i("(prefers-color-scheme: dark)"),d1=()=>i("(prefers-color-scheme: light)"),Z7=()=>i("(prefers-reduced-motion: reduce)"),o=()=>i("(prefers-contrast: more)"),e={siteId:void 0,API_ENDPOINT:"",ANALYTICS_SITE_ID:void 0,location:{href:"",pathname:"",search:"",hash:"",origin:"",host:"",hostname:"",protocol:"https:",assign:()=>{},replace:()=>{},reload:()=>{}},localStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},sessionStorage:{getItem:()=>null,setItem:()=>{},removeItem:()=>{},clear:()=>{}},fetch:globalThis.fetch,addEventListener:()=>{},removeEventListener:()=>{},setTimeout:()=>0,clearTimeout:()=>{},setInterval:()=>0,clearInterval:()=>{},requestAnimationFrame:()=>0,cancelAnimationFrame:()=>{},alert:()=>{},confirm:()=>!1,prompt:()=>null,getComputedStyle:()=>({}),matchMedia:()=>({matches:!1,addListener:()=>{},removeListener:()=>{}}),getDateRangeParams:()=>"",stx:{}},K0=new Proxy(e,{get(C,g){if(g in C)return C[g];return},set(C,g,a){return C[g]=a,!0}}),g0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},M0=console;try{let C=F9(J,Z),g=new Set(Object.keys(z)),a=(t)=>/^[a-z_$][\w$]*$/i.test(t),m=Object.keys($).filter((t)=>!g.has(t)&&t!=="props"&&a(t)),v=m.map((t)=>$[t]);if(!m.includes("__stxServeContext"))m.push("__stxServeContext"),v.push(void 0);let d=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"]),U0=[],$0=[];for(let[t,t0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t))continue;if(d.has(t))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${t}\\b`).test(C))continue;U0.push(t),$0.push(t0)}let V0=kz(C).map((t)=>`module.exports.${t} = typeof ${t} !== 'undefined' ? ${t} : module.exports.${t};`).join(`
3746
- `),A1=$.params??{},h0=[],C0=[];for(let t=0;t<m.length;t++){if(m[t]==="params")continue;h0.push(m[t]),C0.push(v[t])}let m1=await Function(...L9,...U0,...h0,`return (async () => {
3745
+ `),$}function CZ(X){return/cannot find module|could not resolve|module not found|failed to resolve/i.test(X)}function PZ(X){if(!/is not defined|can't find variable/i.test(X))return!1;return!/\b(document|window|navigator|localStorage|sessionStorage|self)\b/.test(X)}async function e1(X,$,Z,Y={}){if(!X.trim())return;let J;try{let C=_1({loader:"ts",target:"browser",define:u0()}),g=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");g=g.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,""),J=C.transformSync(g)}catch{J=SZ(X)}let G={exports:{}},Q=G.exports,q=S5.cwd(),W={},K=[...J.matchAll(/require\s*\(\s*['"]([^'"]+)['"]\s*\)/g)||[]].map((C)=>C[1]).filter((C)=>!C.startsWith("node:")&&!C.startsWith(".")&&!["fs","path","os","child_process","crypto","http","https","url","util","stream","events","buffer","net","querystring","zlib","tls"].includes(C));for(let C of K)try{let g=y1.resolve(q,"node_modules",C),s=y1.join(g,"package.json"),m=JSON.parse(U0("fs").readFileSync(s,"utf8")),v=m.main||"index.js";if(m.exports){let d=typeof m.exports==="string"?m.exports:m.exports["."];if(typeof d==="string")v=d;else if(d?.bun)v=d.bun;else if(d?.import)v=d.import;else if(d?.default)v=d.default}W[C]=await import(y1.resolve(g,v))}catch{}let U=(C)=>{if(W[C])return W[C];return U0(C)},z=$.props||{},w=(C)=>{if(!C)return z;let g={};for(let[s,m]of Object.entries(C)){let v=z[s];if(v!==void 0)g[s]=v;else if(typeof m==="function")g[s]=m();else g[s]=m}return g};for(let[C,g]of Object.entries(z))Object.defineProperty(w,C,{value:g,enumerable:!0,configurable:!0,writable:!0});for(let C of["name","length","caller","arguments"]){if(Object.prototype.hasOwnProperty.call(z,C))continue;try{Object.defineProperty(w,C,{value:void 0,enumerable:!1,configurable:!0,writable:!0})}catch{}}let B=(C)=>{if(!C)return z;let g={...z};for(let[s,m]of Object.entries(C)){let v=m&&typeof m==="object"&&!Array.isArray(m)?m:{type:m};if(g[s]===void 0&&v.default!==void 0)g[s]=typeof v.default==="function"?v.default():v.default}return g},j=()=>$.slots||{},_=(C,g)=>{let s={...C};for(let[m,v]of Object.entries(g))if(s[m]===void 0)if(typeof v==="function")s[m]=v();else s[m]=v;return s},H=(C)=>{let g=()=>C;return g.set=(s)=>{},g.update=(s)=>{},g},L=(C)=>{let g,s=!1;return()=>{if(!s)try{g=C(),s=!0}catch{g=void 0}return g}},O=(C)=>{},F=(C)=>C(),V=(C)=>{},A=(C)=>{};function R(C){let g=C||{};if(g.title!==void 0||g.description!==void 0)D({title:g.title,description:g.description})}function N(C){if(!C||typeof C!=="object")return;let g=$.__stxClientPayload??{};Object.assign(g,C),$.__stxClientPayload=g}let T=()=>{let C=$.__stxServeContext,g=$.__stxServeSearch??C?.search??"",s=C?.path??"",m=Object.fromEntries(new URLSearchParams(g)),v=$.query,d=Object.keys(m).length>0?m:v??{},K0=g||(Object.keys(d).length>0?`?${new URLSearchParams(d).toString()}`:"");return{params:$.params??{},query:d,path:s,name:"",fullPath:s+K0,hash:"",matched:[]}},M=()=>({push:(C)=>{},replace:(C)=>{},back:()=>{},forward:()=>{},go:(C)=>{}}),k=(C)=>{let g=$.__stx_runtime_head||{};$.__stx_runtime_head=D1(g,C||{})},D=(C)=>{k(xX(C||{}))},I=(C)=>({value:C}),S=(C)=>C,b=(C)=>({value:typeof C==="function"?C():C}),y=(C,g)=>{},P=(C)=>{},x=(C)=>{},f=(C)=>C?C():Promise.resolve(),c=(C)=>(g,...s)=>{},l=(C)=>{},T0=(C,g)=>{},x0=(C,g)=>g,f0=()=>({value:"light"}),a0=()=>H(!1),p=(C)=>H(!1),E0=()=>H(!1),z0=()=>p("(prefers-color-scheme: dark)"),d1=()=>p("(prefers-color-scheme: light)"),Z7=()=>p("(prefers-reduced-motion: reduce)"),r=()=>p("(prefers-contrast: more)"),e={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:{}},W0=new Proxy(e,{get(C,g){if(g in C)return C[g];return},set(C,g,s){return C[g]=s,!0}}),g0={getElementById:()=>null,querySelector:()=>null,querySelectorAll:()=>[],createElement:()=>({}),createTextNode:()=>({}),body:{},head:{},documentElement:{},addEventListener:()=>{},removeEventListener:()=>{}},M0=console;try{let C=F9(J,Z),g=new Set(Object.keys(z)),s=(a)=>/^[a-z_$][\w$]*$/i.test(a),m=Object.keys($).filter((a)=>!g.has(a)&&!Mz.has(a)&&s(a)),v=m.map((a)=>$[a]);if(!m.includes("__stxServeContext"))m.push("__stxServeContext"),v.push(void 0);let d=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"]),K0=[],$0=[];for(let[a,t0]of Object.entries(z)){if(!/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(a))continue;if(d.has(a))continue;if(new RegExp(`(?:^|[\\s;{])(?:const|let|var|function)\\s+${a}\\b`).test(C))continue;K0.push(a),$0.push(t0)}let V0=Iz(C).map((a)=>`module.exports.${a} = typeof ${a} !== 'undefined' ? ${a} : module.exports.${a};`).join(`
3746
+ `),A1=$.params??{},h0=[],C0=[];for(let a=0;a<m.length;a++){if(m[a]==="params")continue;h0.push(m[a]),C0.push(v[a])}let m1=await Function(...O9,...K0,...h0,`return (async () => {
3747
3747
  ${C}
3748
3748
  ${V0}
3749
3749
  return module.exports
3750
- })()`)(G,Q,W,z,w,B,_,N,H,O,L,F,V,A,R,T,M,k,D,I,S,b,y,P,x,f,c,l,j,T0,x0,f0,a0,i,E0,z0,d1,Z7,o,K0,g0,M0,e.confirm,e.alert,e.fetch,A1,...$0,...C0);if(Y.preserveExisting){for(let[t,t0]of Object.entries(m1))if(!(t in $)||$[t]===void 0)$[t]=t0}else Object.assign($,m1);for(let[t,t0]of Object.entries(z))if(!(t in $))$[t]=t0}catch(C){let g=C instanceof Error?C.message:String(C);if(CZ(g))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${g}`);else if(PZ(g))console.warn(`[stx] server <script> in ${Z??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${g}`);else if(S5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${g}`);try{await Sz(J,$,Z)}catch(a){if(S5.env.STX_DEBUG){let m=a instanceof Error?a.message:String(a);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${m}`)}}}}function vZ(X){let $=0,Z=null,Y=!1,J=!1;for(let G=0;G<X.length;G++){let Q=X[G];if(Z){if(Q===Z){if(Z=null,Y||$===0)J=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")$++;else if(Q==="}")$--;else if(X.startsWith("from",G)&&$===0)Y=!0}return Z===null&&$===0&&J}function F9(X,$){let Z=$?y1.dirname($):S5.cwd(),Y=S5.cwd(),J=X.split(`
3751
- `),G=[],Q=0;while(Q<J.length){let q=J[Q].trim();if(q.startsWith("interface ")||q.startsWith("export interface ")||q.startsWith("type ")||q.startsWith("export type ")){if(q.includes("{")&&!q.includes("}")){let K=0;for(;Q<J.length;Q++){for(let U of J[Q])if(U==="{")K++;else if(U==="}")K--;if(K<=0)break}}Q++;continue}if(q.startsWith("definePageMeta(")){let K=0,U=!1,W=Q;for(let B=Q;B<J.length&&!U;B++){let j=null,_=!1,H=J[B];for(let O=0;O<H.length;O++){let L=H[O];if(_){_=!1;continue}if(L==="\\"){_=!0;continue}if(j){if(L===j)j=null;continue}if(L==='"'||L==="'"||L==="`"){j=L;continue}if(L==="(")K++;else if(L===")"){if(K--,K===0){Q=B+1,U=!0;break}}}}if(!U)Q=J.length;let z=J.slice(W,Q).join(`
3752
- `),w=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(z);if(j)w.push(`${B}: ${JSON.stringify(j[2])}`)}if(w.length>0)G.push(`useSeoMeta({ ${w.join(", ")} });`);continue}if(q.startsWith("import ")||q==="import"||q.startsWith("import{")){let K=q,U=0;while(!vZ(K)&&Q+U+1<J.length)U++,K=`${K} ${J[Q+U].trim()}`;Q+=U;let W=K.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=K.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),w=K.match(/^import\s+['"](.+?)['"]/),B=K,j=(_)=>{if(_.startsWith("."))return y1.resolve(Z,_);if(_.startsWith("~/")||_.startsWith("@/"))return y1.resolve(Y,_.slice(2));return _};if(W){let[,_,H]=W,O=j(H);G.push(`const ${_} = (await import('${O}')).default`),G.push(`module.exports.${_} = ${_};`)}else if(z){let[,_,H]=z,O=j(H),L=[],F=[],V=Mz.has(H);for(let A of _.split(",")){let R=A.trim();if(!R)continue;let N=R.split(/\s+as\s+/);if(N.length===2){let[T,M]=[N[0].trim(),N[1].trim()];if(V&&kZ.has(T)){G.push(`const ${M} = ${T};`),F.push(M);continue}L.push(`${T}: ${M}`),F.push(M)}else{if(V&&kZ.has(R)){F.push(R);continue}L.push(R),F.push(R)}}if(L.length>0)G.push(`const { ${L.join(", ")} } = await import('${O}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(w){let _=j(w[1]);G.push(`await import('${_}')`)}else G.push(B);Q++;continue}if(Iz.test(q))G.push(J[Q]),Q++;else if(q.startsWith("export const ")||q.startsWith("export let ")||q.startsWith("export var ")){let K=EZ(J,Q),{type:U,name:W,value:z}=K;G.push(`${U} ${W} = ${z};`),G.push(`module.exports.${W} = ${W};`),Q=K.nextIndex}else if(q.startsWith("export function ")||q.startsWith("export async function ")){let K=O9(J,Q);G.push(K.functionCode),G.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(q.startsWith("const ")||q.startsWith("let ")||q.startsWith("var ")){let K=EZ(J,Q),{type:U,name:W,value:z}=K;G.push(`${U} ${W} = ${z};`),G.push(`module.exports.${W} = ${W};`),Q=K.nextIndex}else if(q.startsWith("function ")||q.startsWith("async function ")){let K=O9(J,Q);G.push(K.functionCode),G.push(`module.exports.${K.name} = ${K.name};`),Q=K.nextIndex}else if(q.startsWith("export default function ")||q.startsWith("export default async function ")){let K=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),U=[...J];U[Q]=K;let W=O9(U,Q);if(G.push(W.functionCode),W.name)G.push(`module.exports.default = ${W.name};`);Q=W.nextIndex}else if(q.startsWith("export default ")){let K=q.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${K};`),Q++}else if(q.startsWith("class ")||q.startsWith("export class ")){let K=q.match(/(?:export\s+)?class\s+(\w+)/);if(K){let U=K[1],W=J[Q].replace(/^export\s+/,""),z=0,w=Q;for(;w<J.length;w++){let B=J[w];for(let j of B)if(j==="{")z++;else if(j==="}")z--;if(w>Q)W+=`
3753
- `+B;if(z<=0&&w>=Q)break}G.push(W),G.push(`module.exports.${U} = ${U};`),Q=w+1}else G.push(q),Q++}else if(q.includes("module.exports"))G.push(q),Q++;else if(q.trim()&&!q.startsWith("//"))G.push(q),Q++;else Q++}return Ez(G.join(`
3754
- `),Z,Y)}function Ez(X,$,Z){let Y=X.length,J="",G=0,Q=null,q=!1,K=!1,U=0;while(G<Y){let W=X[G],z=X[G+1];if(q){if(J+=W,W===`
3755
- `)q=!1;G++;continue}if(K){if(J+=W,W==="*"&&z==="/"){J+=z,G+=2,K=!1;continue}G++;continue}if(!Q&&W==="/"&&z==="/"){q=!0,J+=W,G++;continue}if(!Q&&W==="/"&&z==="*"){K=!0,J+=W,G++;continue}if(Q){if(J+=W,W==="\\"){J+=z,G+=2;continue}if(W===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(W==="$"&&z==="{"){U++,J+=z,G+=2;continue}if(W==="`"){Q=null,G++;continue}}G++;continue}if(U>0){if(W==="{")U++;else if(W==="}")U--}if(W==='"'||W==="'"||W==="`"){Q=W,J+=W,G++;continue}if(W==="a"&&X.startsWith("await",G)){let w=Dz(X,G);if(w){let{quote:B,path:j,end:_}=w;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let H=j.startsWith(".")?y1.resolve($,j):y1.resolve(Z,j.slice(2));J+=`await import(${B}${H}${B})`,G=_;continue}}}J+=W,G++}return J}function Dz(X,$){let Z=$+5;if(Z>=X.length)return null;if(!/\s/.test(X[Z]))return null;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(!X.startsWith("import",Z))return null;Z+=6;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return null;Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;let Y=X[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=Z;while(Z<X.length&&X[Z]!==Y)if(X[Z]==="\\")Z+=2;else Z++;if(Z>=X.length)return null;let G=X.slice(J,Z);Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!==")")return null;return{quote:Y,path:G,end:Z+1}}function xZ(X,$){let Z=X[$];if(Z!=="{"&&Z!=="[")return null;let J=D0(X,Z,Z==="{"?"}":"]",$);if(J===-1)return null;return{pattern:X.slice($,J+1),endPos:J+1}}function fZ(X){let $=[],Z=X.slice(1,-1).trim();if(!Z)return $;let Y=0,J=0,G="";while(Y<Z.length){let Q=Z[Y];if(Q==="{"||Q==="["){let q=J===0?xZ(Z,Y):null;if(q){$.push(...fZ(q.pattern)),Y=q.endPos,G="";continue}J++}else if(Q==="}"||Q==="]")J--;if(J>0){Y++;continue}if(Q===","){if(G.trim())$.push(G.trim());G="",Y++;continue}if(Q===":"){G="",Y++;continue}if(Q==="="){if(G.trim())$.push(G.trim());G="",Y++;while(Y<Z.length&&Z[Y]!==","&&J===0){if(Z[Y]==="{"||Z[Y]==="[")J++;else if(Z[Y]==="}"||Z[Y]==="]")J--;Y++}continue}if(/[\w$]/.test(Q))G+=Q;Y++}if(G.trim())$.push(G.trim());return $}function gZ(X){let $=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(X);if(!$)return null;let Z=$[0].length,Y=(J)=>J===" "||J==="\t";while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]===":"){let J=0,G=null;Z++;for(;Z<X.length;Z++){let Q=X[Z];if(G){if(Q==="\\"){Z++;continue}if(Q===G)G=null;continue}if(Q==="'"||Q==='"'||Q==="`"){G=Q;continue}if(Q==="("||Q==="["||Q==="{"||Q==="<"){J++;continue}if(Q===")"||Q==="]"||Q==="}"||Q===">"){J--;continue}if(Q==="="&&J<=0){let q=X[Z+1],K=X[Z-1];if(q!=="="&&q!==">"&&K!=="="&&K!=="!"&&K!=="<"&&K!==">")break}}if(X[Z]!=="=")return null}while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]!=="=")return null;return{type:$[1],name:$[2],value:X.slice(Z+1).trim()}}function IZ(X,$,Z,Y){let J=null,G=!1;for(let Q of X){if(G){G=!1;continue}if(Q==="\\"){G=!0;continue}if(J){if(Q===J)J=null;continue}if(Q==="'"||Q==='"'||Q==="`"){J=Q;continue}if(Q===$)Y++;else if(Q===Z)Y--}return Y}function EZ(X,$){let Z=X[$].trim(),Y=gZ(Z),J=Y?[Z,Y.type,Y.name,Y.value]:null;if(!J){let W=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(W){let z=Z.slice(W[0].length),w=$;if(z.startsWith("{")||z.startsWith("[")){let j=z[0],_=j==="{"?"}":"]",H=IZ(z,j,_,0),O=z;for(let L=$+1;L<X.length&&H>0;L++)O+=` ${X[L].trim()}`,w=L,H=IZ(X[L],j,_,H);if(H>0)O=z,w=$;z=O}let B=xZ(z,0);if(B){let j=W[1],_=B.pattern,H=z.slice(B.endPos).trim();if(H.startsWith("=")){let O=H.slice(1).trim(),L=O,F=Math.max(w,$);if(DZ(O)){let N=yZ(X,F,O);L=N.value,F=N.nextIndex}else F=F+1;L=L.trim().replace(/;$/,"");let V=fZ(_),A=`__stx_src_${$}`,R=V.map((N)=>`module.exports.${N} = ${N};`).join(`
3756
- `);return{type:j,name:A,value:`${L}; ${j} ${_} = ${A};
3757
- ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,q]=J,K=q,U=$;if(DZ(q)){let W=yZ(X,$,q);K=W.value,U=W.nextIndex}else U=$+1;while(U<X.length){let W=X[U].trim();if(W.startsWith(".")||W.startsWith("?."))K+=`
3758
- ${X[U]}`,U++;else break}return K=K.trim().replace(/;$/,""),{type:G,name:Q,value:K,nextIndex:U}}function O9(X,$){let Z=X[$].trim(),Y=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${Z}`);let[,J]=Y,G=Z.replace(/^export\s+/,""),Q=$;if(yz(Z)){let q=bz(X,$,G);G=q.functionCode,Q=q.nextIndex}else Q=$+1;return{name:J,functionCode:G,nextIndex:Q}}function DZ(X){let $=X.trim();if($.startsWith("{"))return D0($,"{","}",0)===-1;if($.startsWith("["))return D0($,"[","]",0)===-1;return!hZ($)}function hZ(X){let $={paren:0,bracket:0,brace:0},Z=null,Y=0;for(let J=0;J<X.length;J++){let G=X[J];if((J>0?X[J-1]:"")==="\\"&&Z)continue;if((G==='"'||G==="'")&&!Z){Z=G;continue}if(G===Z&&Z!=="`"){Z=null;continue}if(G==="`"&&!Z){Z="`";continue}if(G==="`"&&Z==="`"&&Y===0){Z=null;continue}if(Z==="`"&&G==="$"&&X[J+1]==="{"){Y++,J++;continue}if(Y>0&&G==="{"){Y++;continue}if(Y>0&&G==="}"){Y--;continue}if(Z)continue;if(G==="(")$.paren++;else if(G===")")$.paren--;else if(G==="[")$.bracket++;else if(G==="]")$.bracket--;else if(G==="{")$.brace++;else if(G==="}")$.brace--}return $.paren===0&&$.bracket===0&&$.brace===0&&Z===null}function uZ(X){let $=X.indexOf("(");if($===-1)return X.indexOf("{");let Z=D0(X,"(",")",$);if(Z===-1)return-1;return X.indexOf("{",Z)}function yz(X){let $=uZ(X);if($===-1)return!0;return D0(X,"{","}",$)===-1}function yZ(X,$,Z){let Y=Z,J=$+1;while(J<X.length&&!hZ(Y)){let G=X[J];Y+=`
3750
+ })()`)(G,Q,U,z,w,B,_,N,H,L,O,F,V,A,R,T,M,k,D,I,S,b,y,P,x,f,c,l,j,T0,x0,f0,a0,p,E0,z0,d1,Z7,r,W0,g0,M0,e.confirm,e.alert,e.fetch,A1,...$0,...C0);if(Y.preserveExisting){for(let[a,t0]of Object.entries(m1))if(!(a in $)||$[a]===void 0)$[a]=t0}else Object.assign($,m1);for(let[a,t0]of Object.entries(z))if(!(a in $))$[a]=t0}catch(C){let g=C instanceof Error?C.message:String(C);if(CZ(g))console.warn(`[stx] server <script> in ${Z??"<unknown>"} imports a module that does not resolve, so every variable in that script is undefined. Cause: ${g}`);else if(PZ(g))console.warn(`[stx] server <script> in ${Z??"<unknown>"} names something that does not exist, so every variable in that script is undefined. Optional chaining does not help here: an undefined identifier throws before the chain is reached. Cause: ${g}`);else if(S5.env.STX_DEBUG)console.warn(`[stx] server <script> did not execute in ${Z??"<unknown>"} \u2014 falling back to static extraction. Cause: ${g}`);try{await Cz(J,$,Z)}catch(s){if(S5.env.STX_DEBUG){let m=s instanceof Error?s.message:String(s);console.warn(`[stx] fallback extraction also failed in ${Z??"<unknown>"}: ${m}`)}}}}function vZ(X){let $=0,Z=null,Y=!1,J=!1;for(let G=0;G<X.length;G++){let Q=X[G];if(Z){if(Q===Z){if(Z=null,Y||$===0)J=!0}continue}if(Q==="'"||Q==='"'||Q==="`"){Z=Q;continue}if(Q==="{")$++;else if(Q==="}")$--;else if(X.startsWith("from",G)&&$===0)Y=!0}return Z===null&&$===0&&J}function F9(X,$){let Z=$?y1.dirname($):S5.cwd(),Y=S5.cwd(),J=X.split(`
3751
+ `),G=[],Q=0;while(Q<J.length){let q=J[Q].trim();if(q.startsWith("interface ")||q.startsWith("export interface ")||q.startsWith("type ")||q.startsWith("export type ")){if(q.includes("{")&&!q.includes("}")){let W=0;for(;Q<J.length;Q++){for(let K of J[Q])if(K==="{")W++;else if(K==="}")W--;if(W<=0)break}}Q++;continue}if(q.startsWith("definePageMeta(")){let W=0,K=!1,U=Q;for(let B=Q;B<J.length&&!K;B++){let j=null,_=!1,H=J[B];for(let L=0;L<H.length;L++){let O=H[L];if(_){_=!1;continue}if(O==="\\"){_=!0;continue}if(j){if(O===j)j=null;continue}if(O==='"'||O==="'"||O==="`"){j=O;continue}if(O==="(")W++;else if(O===")"){if(W--,W===0){Q=B+1,K=!0;break}}}}if(!K)Q=J.length;let z=J.slice(U,Q).join(`
3752
+ `),w=[];for(let B of["title","description"]){let j=new RegExp(`\\b${B}\\s*:\\s*(['"\`])((?:\\\\.|(?!\\1)[^\\\\])*)\\1`).exec(z);if(j)w.push(`${B}: ${JSON.stringify(j[2])}`)}if(w.length>0)G.push(`useSeoMeta({ ${w.join(", ")} });`);continue}if(q.startsWith("import ")||q==="import"||q.startsWith("import{")){let W=q,K=0;while(!vZ(W)&&Q+K+1<J.length)K++,W=`${W} ${J[Q+K].trim()}`;Q+=K;let U=W.match(/^import\s+(\w+)\s+from\s+['"](.+?)['"]/),z=W.match(/^import\s+\{([^}]*)\}\s+from\s+['"](.+?)['"]/),w=W.match(/^import\s+['"](.+?)['"]/),B=W,j=(_)=>{if(_.startsWith("."))return y1.resolve(Z,_);if(_.startsWith("~/")||_.startsWith("@/"))return y1.resolve(Y,_.slice(2));return _};if(U){let[,_,H]=U,L=j(H);G.push(`const ${_} = (await import('${L}')).default`),G.push(`module.exports.${_} = ${_};`)}else if(z){let[,_,H]=z,L=j(H),O=[],F=[],V=kz.has(H);for(let A of _.split(",")){let R=A.trim();if(!R)continue;let N=R.split(/\s+as\s+/);if(N.length===2){let[T,M]=[N[0].trim(),N[1].trim()];if(V&&kZ.has(T)){G.push(`const ${M} = ${T};`);continue}O.push(`${T}: ${M}`),F.push(M)}else{if(V&&kZ.has(R))continue;O.push(R),F.push(R)}}if(O.length>0)G.push(`const { ${O.join(", ")} } = await import('${L}')`);for(let A of F)G.push(`module.exports.${A} = ${A};`)}else if(w){let _=j(w[1]);G.push(`await import('${_}')`)}else G.push(B);Q++;continue}if(Ez.test(q))G.push(J[Q]),Q++;else if(q.startsWith("export const ")||q.startsWith("export let ")||q.startsWith("export var ")){let W=EZ(J,Q),{type:K,name:U,value:z}=W;G.push(`${K} ${U} = ${z};`),G.push(`module.exports.${U} = ${U};`),Q=W.nextIndex}else if(q.startsWith("export function ")||q.startsWith("export async function ")){let W=L9(J,Q);G.push(W.functionCode),G.push(`module.exports.${W.name} = ${W.name};`),Q=W.nextIndex}else if(q.startsWith("const ")||q.startsWith("let ")||q.startsWith("var ")){let W=EZ(J,Q),{type:K,name:U,value:z}=W;G.push(`${K} ${U} = ${z};`),G.push(`module.exports.${U} = ${U};`),Q=W.nextIndex}else if(q.startsWith("function ")||q.startsWith("async function ")){let W=L9(J,Q);G.push(W.functionCode),G.push(`module.exports.${W.name} = ${W.name};`),Q=W.nextIndex}else if(q.startsWith("export default function ")||q.startsWith("export default async function ")){let W=J[Q].replace(/^(\s*)export\s+default\s+/,"$1"),K=[...J];K[Q]=W;let U=L9(K,Q);if(G.push(U.functionCode),U.name)G.push(`module.exports.default = ${U.name};`);Q=U.nextIndex}else if(q.startsWith("export default ")){let W=q.replace(/^export\s+default\s+/,"").replace(/;$/,"");G.push(`module.exports.default = ${W};`),Q++}else if(q.startsWith("class ")||q.startsWith("export class ")){let W=q.match(/(?:export\s+)?class\s+(\w+)/);if(W){let K=W[1],U=J[Q].replace(/^export\s+/,""),z=0,w=Q;for(;w<J.length;w++){let B=J[w];for(let j of B)if(j==="{")z++;else if(j==="}")z--;if(w>Q)U+=`
3753
+ `+B;if(z<=0&&w>=Q)break}G.push(U),G.push(`module.exports.${K} = ${K};`),Q=w+1}else G.push(q),Q++}else if(q.includes("module.exports"))G.push(q),Q++;else if(q.trim()&&!q.startsWith("//"))G.push(q),Q++;else Q++}return Dz(G.join(`
3754
+ `),Z,Y)}function Dz(X,$,Z){let Y=X.length,J="",G=0,Q=null,q=!1,W=!1,K=0;while(G<Y){let U=X[G],z=X[G+1];if(q){if(J+=U,U===`
3755
+ `)q=!1;G++;continue}if(W){if(J+=U,U==="*"&&z==="/"){J+=z,G+=2,W=!1;continue}G++;continue}if(!Q&&U==="/"&&z==="/"){q=!0,J+=U,G++;continue}if(!Q&&U==="/"&&z==="*"){W=!0,J+=U,G++;continue}if(Q){if(J+=U,U==="\\"){J+=z,G+=2;continue}if(U===Q&&Q!=="`"){Q=null,G++;continue}if(Q==="`"){if(U==="$"&&z==="{"){K++,J+=z,G+=2;continue}if(U==="`"){Q=null,G++;continue}}G++;continue}if(K>0){if(U==="{")K++;else if(U==="}")K--}if(U==='"'||U==="'"||U==="`"){Q=U,J+=U,G++;continue}if(U==="a"&&X.startsWith("await",G)){let w=yz(X,G);if(w){let{quote:B,path:j,end:_}=w;if(j.startsWith(".")||j.startsWith("~/")||j.startsWith("@/")){let H=j.startsWith(".")?y1.resolve($,j):y1.resolve(Z,j.slice(2));J+=`await import(${B}${H}${B})`,G=_;continue}}}J+=U,G++}return J}function yz(X,$){let Z=$+5;if(Z>=X.length)return null;if(!/\s/.test(X[Z]))return null;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(!X.startsWith("import",Z))return null;Z+=6;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return null;Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;let Y=X[Z];if(Y!=="'"&&Y!=='"')return null;Z++;let J=Z;while(Z<X.length&&X[Z]!==Y)if(X[Z]==="\\")Z+=2;else Z++;if(Z>=X.length)return null;let G=X.slice(J,Z);Z++;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!==")")return null;return{quote:Y,path:G,end:Z+1}}function xZ(X,$){let Z=X[$];if(Z!=="{"&&Z!=="[")return null;let J=D0(X,Z,Z==="{"?"}":"]",$);if(J===-1)return null;return{pattern:X.slice($,J+1),endPos:J+1}}function fZ(X){let $=[],Z=X.slice(1,-1).trim();if(!Z)return $;let Y=0,J=0,G="";while(Y<Z.length){let Q=Z[Y];if(Q==="{"||Q==="["){let q=J===0?xZ(Z,Y):null;if(q){$.push(...fZ(q.pattern)),Y=q.endPos,G="";continue}J++}else if(Q==="}"||Q==="]")J--;if(J>0){Y++;continue}if(Q===","){if(G.trim())$.push(G.trim());G="",Y++;continue}if(Q===":"){G="",Y++;continue}if(Q==="="){if(G.trim())$.push(G.trim());G="",Y++;while(Y<Z.length&&Z[Y]!==","&&J===0){if(Z[Y]==="{"||Z[Y]==="[")J++;else if(Z[Y]==="}"||Z[Y]==="]")J--;Y++}continue}if(/[\w$]/.test(Q))G+=Q;Y++}if(G.trim())$.push(G.trim());return $}function gZ(X){let $=/^(?:export\s+)?(const|let|var)\s+([A-Za-z_$][\w$]*)/.exec(X);if(!$)return null;let Z=$[0].length,Y=(J)=>J===" "||J==="\t";while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]===":"){let J=0,G=null;Z++;for(;Z<X.length;Z++){let Q=X[Z];if(G){if(Q==="\\"){Z++;continue}if(Q===G)G=null;continue}if(Q==="'"||Q==='"'||Q==="`"){G=Q;continue}if(Q==="("||Q==="["||Q==="{"||Q==="<"){J++;continue}if(Q===")"||Q==="]"||Q==="}"||Q===">"){J--;continue}if(Q==="="&&J<=0){let q=X[Z+1],W=X[Z-1];if(q!=="="&&q!==">"&&W!=="="&&W!=="!"&&W!=="<"&&W!==">")break}}if(X[Z]!=="=")return null}while(Z<X.length&&Y(X[Z]))Z++;if(X[Z]!=="=")return null;return{type:$[1],name:$[2],value:X.slice(Z+1).trim()}}function IZ(X,$,Z,Y){let J=null,G=!1;for(let Q of X){if(G){G=!1;continue}if(Q==="\\"){G=!0;continue}if(J){if(Q===J)J=null;continue}if(Q==="'"||Q==='"'||Q==="`"){J=Q;continue}if(Q===$)Y++;else if(Q===Z)Y--}return Y}function EZ(X,$){let Z=X[$].trim(),Y=gZ(Z),J=Y?[Z,Y.type,Y.name,Y.value]:null;if(!J){let U=Z.match(/^(?:export\s+)?(const|let|var)\s+/);if(U){let z=Z.slice(U[0].length),w=$;if(z.startsWith("{")||z.startsWith("[")){let j=z[0],_=j==="{"?"}":"]",H=IZ(z,j,_,0),L=z;for(let O=$+1;O<X.length&&H>0;O++)L+=` ${X[O].trim()}`,w=O,H=IZ(X[O],j,_,H);if(H>0)L=z,w=$;z=L}let B=xZ(z,0);if(B){let j=U[1],_=B.pattern,H=z.slice(B.endPos).trim();if(H.startsWith("=")){let L=H.slice(1).trim(),O=L,F=Math.max(w,$);if(DZ(L)){let N=yZ(X,F,L);O=N.value,F=N.nextIndex}else F=F+1;O=O.trim().replace(/;$/,"");let V=fZ(_),A=`__stx_src_${$}`,R=V.map((N)=>`module.exports.${N} = ${N};`).join(`
3756
+ `);return{type:j,name:A,value:`${O}; ${j} ${_} = ${A};
3757
+ ${R}`,nextIndex:F}}}}throw Error(`Failed to parse variable declaration: ${Z}`)}let[,G,Q,q]=J,W=q,K=$;if(DZ(q)){let U=yZ(X,$,q);W=U.value,K=U.nextIndex}else K=$+1;while(K<X.length){let U=X[K].trim();if(U.startsWith(".")||U.startsWith("?."))W+=`
3758
+ ${X[K]}`,K++;else break}return W=W.trim().replace(/;$/,""),{type:G,name:Q,value:W,nextIndex:K}}function L9(X,$){let Z=X[$].trim(),Y=Z.match(/^(?:export\s+)?(?:async\s+)?function\s+(\w+)/);if(!Y)throw Error(`Failed to parse function declaration: ${Z}`);let[,J]=Y,G=Z.replace(/^export\s+/,""),Q=$;if(bz(Z)){let q=Sz(X,$,G);G=q.functionCode,Q=q.nextIndex}else Q=$+1;return{name:J,functionCode:G,nextIndex:Q}}function DZ(X){let $=X.trim();if($.startsWith("{"))return D0($,"{","}",0)===-1;if($.startsWith("["))return D0($,"[","]",0)===-1;return!hZ($)}function hZ(X){let $={paren:0,bracket:0,brace:0},Z=null,Y=0;for(let J=0;J<X.length;J++){let G=X[J];if((J>0?X[J-1]:"")==="\\"&&Z)continue;if((G==='"'||G==="'")&&!Z){Z=G;continue}if(G===Z&&Z!=="`"){Z=null;continue}if(G==="`"&&!Z){Z="`";continue}if(G==="`"&&Z==="`"&&Y===0){Z=null;continue}if(Z==="`"&&G==="$"&&X[J+1]==="{"){Y++,J++;continue}if(Y>0&&G==="{"){Y++;continue}if(Y>0&&G==="}"){Y--;continue}if(Z)continue;if(G==="(")$.paren++;else if(G===")")$.paren--;else if(G==="[")$.bracket++;else if(G==="]")$.bracket--;else if(G==="{")$.brace++;else if(G==="}")$.brace--}return $.paren===0&&$.bracket===0&&$.brace===0&&Z===null}function uZ(X){let $=X.indexOf("(");if($===-1)return X.indexOf("{");let Z=D0(X,"(",")",$);if(Z===-1)return-1;return X.indexOf("{",Z)}function bz(X){let $=uZ(X);if($===-1)return!0;return D0(X,"{","}",$)===-1}function yZ(X,$,Z){let Y=Z,J=$+1;while(J<X.length&&!hZ(Y)){let G=X[J];Y+=`
3759
3759
  ${G}`,J++}while(J<X.length){let G=X[J].trim();if(G.startsWith(".")||G.startsWith("?."))Y+=`
3760
- ${X[J]}`,J++;else break}return{value:Y,nextIndex:J}}function bz(X,$,Z){let Y=Z,J=$+1;while(J<X.length){let G=uZ(Y);if(G!==-1){if(D0(Y,"{","}",G)!==-1)break}let Q=X[J];Y+=`
3761
- ${Q}`,J++}return{functionCode:Y,nextIndex:J}}function bZ(X,$){let Z=J0(X,$)??J0(`(${X})`,$);if(Z!==void 0)return Z;if(!/\bprocess\b/.test(X))return;let Y={...$,process:Object.freeze({env:{...S5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${X});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${X};`)(...Object.values(Y))}catch{return}}}async function Sz(X,$,Z){let Y=X.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of Y){let[,,Q,q]=G;try{let K=q.trim().replace(/;$/,""),U=bZ(K,$);if(U!==void 0)$[Q]=U}catch(K){console.warn(`Failed to parse export ${Q} in fallback:`,K)}}let J=X.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of J){let[,,Q,q]=G;if(!(Q in $))try{let K=q.trim().replace(/;$/,""),U=bZ(K,$);if(U!==void 0)$[Q]=U}catch{}}}function dZ(X){let $=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=$?$[1]:"",Y=$?X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):X;return{scriptContent:Z,templateWithoutScript:Y}}function mZ(X){let $=X.trim();if(!$)return!1;return/(?:const|let|var|function)\s+\w+/.test($)}var L9,kZ,Mz,Iz;var S7=E(()=>{H0();b5();N1();R0();L9=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],kZ=new Set(L9),Mz=new Set(["stx","@stacksjs/stx"]);Iz=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var V9={};n(V9,{renderSlot:()=>cZ,processSlots:()=>iZ,parseSlots:()=>lZ,parseSlotElement:()=>fz,extractSlotContent:()=>uz,applySlots:()=>dz});function Cz(X,$){let Z=1,Y=$,J="<template",G="</template";while(Y<X.length&&Z>0){let Q=X.indexOf("<",Y);if(Q===-1)break;if(Y=Q,X.startsWith(J,Y)&&(Y+J.length>=X.length||/[\s>\/]/.test(X[Y+J.length]))){Z++,Y+=J.length;continue}if(X.startsWith(G,Y)){let q=X.indexOf(">",Y+G.length);if(q!==-1){if(Z--,Z===0)return q+1;Y=q+1;continue}}Y++}return Z===0?Y:-1}function vz(X,$){let Z=null;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"){Z=J;continue}if(J===">")return Y+1}return-1}function xz(X){let $=[],Z=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;if(X.startsWith("<!--",G)){let w=X.indexOf("-->",G+4);J=w===-1?X.length:w+3;continue}let Q=vz(X,G+1);if(Q===-1)break;let q=X.slice(G,Q),K=q.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!K){J=Q;continue}let U=K[1]==="/",W=K[2].toLowerCase();if(U){let w=Z.lastIndexOf(W);if(w!==-1)Z.splice(w);J=Q;continue}if(W==="template"&&Z.length===0){let w=q.match(Y);if(w){let B=Cz(X,Q);if(B!==-1){let j=w[1]||w[2]||w[3];$.push({start:G,end:B,slotName:j,content:X.slice(Q,B-11).trim(),propsBinding:w[4]||void 0}),J=B;continue}}}if(!/\/\s*>$/.test(q)&&!Pz.has(W)){if(Z.push(W),W==="script"||W==="style"){let w=X.toLowerCase().indexOf(`</${W}>`,Q);if(w!==-1){J=w;continue}}}J=Q}return $}function lZ(X){let $={default:"",named:new Map},Z=X,Y=xz(X);for(let K of Y)$.named.set(K.slotName,{name:K.slotName,content:K.content,propsBinding:K.propsBinding});Y.sort((K,U)=>U.start-K.start);for(let K of Y)Z=Z.slice(0,K.start)+Z.slice(K.end);let J=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[K,U,W,z,w,B]=Q,j=W.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=w.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(j+_).trim(),O=`<${U}${H?" "+H:""}>${B}</${U}>`;J.push({start:Q.index,end:Q.index+K.length,slotName:z,element:O})}let q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=q.exec(Z))!==null){let[K,U,W,z,w]=Q,B=W.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=w.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(B+j).trim(),H=`<${U}${_?" "+_:""} />`;J.push({start:Q.index,end:Q.index+K.length,slotName:z,element:H})}J.sort((K,U)=>U.start-K.start);for(let K of J){let U=$.named.get(K.slotName);if(U)U.content+=K.element;else $.named.set(K.slotName,{name:K.slotName,content:K.element});Z=Z.slice(0,K.start)+Z.slice(K.end)}return $.default=Z.trim(),$}function fz(X){let $=X.match(/name\s*=\s*["']([^"']+)["']/),Z=$?$[1]:"",Y={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=J.exec(X))!==null)Y[G[1]]=G[2];let Q=X.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),q=Q?Q[1].trim():"";return{name:Z,props:Y,defaultContent:q}}async function cZ(X,$,Z,Y){if(!X)return Z;let J=X.content;if(X.propsBinding&&Object.keys($).length>0){let G=X.propsBinding.trim(),Q={...Y};if(G.startsWith("{")&&G.endsWith("}")){let q=G.slice(1,-1).split(",").map((K)=>K.trim()).filter(Boolean);for(let K of q){let[U,W]=K.split(":").map((w)=>w.trim()),z=W||U;if($[U]!==void 0)Q[z]=$[U]}}else Q[G]=$;J=gz(J,Q)}return J}function gz(X,$){return X.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,Y)=>{try{let J=Y.trim(),G=pZ(J,$);return G1(String(G??""))}catch{return`{{ ${Y} }}`}})}function pZ(X,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(X)){let Y=X.split("."),J=$;for(let G of Y)if(J&&typeof J==="object"&&G in J)J=J[G];else return;return J}let Z=X.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,Y,J,G]=Z,Q=$[Y],q=parseInt(G,10);if(typeof Q==="number")switch(J){case"+":return Q+q;case"-":return Q-q;case"*":return Q*q;case"/":return Q/q}}try{if(!G0(X))return;return Q0(X,Object.keys($))(...Object.values($))}catch{return}}async function iZ(X,$,Z){let Y=X;Y=await hz(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,q,K,U)=>{let W=$.named.get(q),z=U?.trim()||"",w=K||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=j.exec(w))!==null){let H=_[1],O=_[2];B[H]=pZ(O,Z)}return await cZ(W,B,z,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(G,(Q,q)=>{if(Q.includes("name="))return Q;let K=q?.trim()||"";return $.default||K}),Y}async function hz(X,$,Z){let Y=[],J=[];X.replace($,(q,...K)=>{let U=K[K.length-2];return J.push({match:q,index:U}),Y.push(Z(q,...K.slice(0,-2))),q});let G=await Promise.all(Y),Q=X;for(let q=J.length-1;q>=0;q--){let{match:K,index:U}=J[q];Q=Q.slice(0,U)+G[q]+Q.slice(U+K.length)}return Q}function uz(X){let $=lZ(X);return{defaultSlot:$.default,namedSlots:$.named}}async function dz(X,$,Z,Y){return await iZ(X,{default:$,named:Z},Y)}var Pz;var A9=E(()=>{Q1();R0();Pz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function b1(X,$){let Z=mz(X,$);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function mz(X,$){let Z=$;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let Y=D0(X,"(",")",Z);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:X.slice(Z+1,Y),endPos:Y+1}}function lz(X,$){let Z=X.lastIndexOf("<",$);if(Z===-1)return!1;return Z>X.lastIndexOf(">",$)}function X5(X,$,Z,Y){let J=1,G=Y,Q=new RegExp(`@${$}\\s*\\(`,"g"),q=new RegExp(`@${Z}(?![a-z])`,"g");while(G<X.length&&J>0){Q.lastIndex=G,q.lastIndex=G;let K=Q.exec(X),U=q.exec(X),W=K?K.index:1/0,z=U?U.index:1/0;if(W<z)J++,G=W+K[0].length;else if(z<1/0){if(J--,J===0)return z;G=z+U[0].length}else break}return-1}function nZ(X,$){let Z=X.slice($).match(/^@if\s*/);if(!Z)return null;let Y=$+Z[0].length,J=b1(X,Y);if(!J)return null;let G=J.endPos,Q=X5(X,"if","endif",G);if(Q===-1)return null;let q=X.slice(G,Q),K=[],U=0,W="if",z=J.expression,w=0,B=0;while(U<q.length){let j=q.indexOf("@",U);if(j===-1)break;U=j;let _=q.substring(j);if(lz(q,j)){U++;continue}if(/^@if\s*\(/.test(_)){B++,U++;continue}if(/^@endif(?![a-z])/.test(_)){B--,U+=6;continue}if(B===0){let H=_.match(/^@elseif\s*/);if(H){K.push({type:W,condition:z,content:q.substring(w,U),start:G+w,end:G+U});let O=U+H[0].length,L=b1(q,O);if(!L){U++;continue}W="elseif",z=L.expression,U=L.endPos,w=U;continue}else if(/^@else(?![a-z])/.test(_)){K.push({type:W,condition:z,content:q.substring(w,U),start:G+w,end:G+U}),W="else",z=void 0,U+=5,w=U;continue}}U++}return K.push({type:W,condition:z,content:q.slice(w),start:G+w,end:G+q.length}),{fullMatch:X.slice($,Q+6),branches:K,start:$,end:Q+6}}function C7(X){let $=[],Z=/@if\s*\(/g,Y=Z.exec(X);while(Y!==null){if($.some((Q)=>Y.index>Q.start&&Y.index<Q.end)){Y=Z.exec(X);continue}let G=nZ(X,Y.index);if(G)$.push(G),Z.lastIndex=G.end;Y=Z.exec(X)}return $}function gX(X,$,Z){let Y=[],J=new RegExp(`@${$}\\s*\\(`,"g"),G=J.exec(X);while(G!==null){if(Y.some((_)=>G.index>_.start&&G.index<_.end)){G=J.exec(X);continue}let q=G.index,K=q+G[0].length-1,U=D0(X,"(",")",K);if(U===-1){G=J.exec(X);continue}let W=X.slice(K+1,U),z=U+1,w=X5(X,$,Z,z);if(w===-1){G=J.exec(X);continue}let B=X.slice(z,w),j=w+`@${Z}`.length;Y.push({fullMatch:X.slice(q,j),name:$,params:W,content:B,start:q,end:j}),J.lastIndex=j,G=J.exec(X)}return Y}function R9(X,$){let Z=X.slice($).match(/^@switch\s*/);if(!Z)return null;let Y=$+Z[0].length,J=b1(X,Y);if(!J)return null;let G=J.endPos,Q=X5(X,"switch","endswitch",G);if(Q===-1)return null;let q=X.slice(G,Q),K=[],U=0,W=null,z=0;while(U<q.length){let w=q.slice(U),B=w.match(/^@switch\s*\(/),j=w.match(/^@endswitch(?![a-z])/);if(B){if(z++,W)W.content+=B[0];U+=B[0].length;continue}if(j){if(z--,W)W.content+=j[0];U+=j[0].length;continue}if(z>0){if(W)W.content+=q[U];U++;continue}let _=w.match(/^@case\s*/),H=w.match(/^@default(?![a-z])/),O=w.match(/^@break(?![a-z])/);if(_&&w.startsWith("@case")){if(W)K.push(W);let L=U+_[0].length,F=b1(q,L);if(!F){U++;continue}W={type:"case",value:F.expression,content:""},U=F.endPos}else if(H&&w.startsWith("@default")){if(W)K.push(W);W={type:"default",content:""},U+=H[0].length}else if(O&&w.startsWith("@break"))U+=O[0].length;else{if(W)W.content+=q[U];U++}}if(W)K.push(W);return{fullMatch:X.slice($,Q+10),expression:J.expression,cases:K,start:$,end:Q+10}}var rZ=()=>{};var oZ=()=>{};var hX=E(()=>{rZ();oZ()});function sZ(X,$={}){return new A5(X,$).routes}var aZ=E(()=>{i1();i1()});async function eZ(X){let $=X;if(!$)try{$=(await S1())?.pagesDir||"pages"}catch{$="pages"}let Z=$,Y=tZ.get(Z);if(Y)return Y;let J=[];try{J=sZ(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{J=[]}return tZ.set(Z,J),J}var tZ;var XY=E(()=>{aZ();T1();tZ=new Map});function nz(X){return X.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function $Y(X){return nz(JSON.stringify(X))}function P7(X){let $=0,Z,Y=N9.map(()=>{return});while($<X.length){if(Z===void 0||Z!==null&&Z.index<$)ZY.lastIndex=$,Z=ZY.exec(X);if(!Z)return null;let J=Z.index,G=-1,Q=null;for(let K=0;K<N9.length;K++){let U=N9[K],W=Y[K];if(W===void 0||W!==null&&W.index<$)U.open.lastIndex=$,W=U.open.exec(X),Y[K]=W;if(!W)continue;if(W.index<J&&(G===-1||W.index<G))G=W.index,Q=U.close}if(G===-1||!Q)return{index:J,tag:Z[0],attrs:Z[1]??""};Q.lastIndex=G;let q=Q.exec(X);if(!q)return null;$=q.index+q[0].length}return null}function uX(X,$){let Z=P7(X);if(!Z)return X;return X.slice(0,Z.index)+$(Z.tag,Z.attrs)+X.slice(Z.index+Z.tag.length)}var N9,ZY;var T9=E(()=>{N9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],ZY=/<body\b([^>]*)>/gi});function M9(){return`
3760
+ ${X[J]}`,J++;else break}return{value:Y,nextIndex:J}}function Sz(X,$,Z){let Y=Z,J=$+1;while(J<X.length){let G=uZ(Y);if(G!==-1){if(D0(Y,"{","}",G)!==-1)break}let Q=X[J];Y+=`
3761
+ ${Q}`,J++}return{functionCode:Y,nextIndex:J}}function bZ(X,$){let Z=J0(X,$)??J0(`(${X})`,$);if(Z!==void 0)return Z;if(!/\bprocess\b/.test(X))return;let Y={...$,process:Object.freeze({env:{...S5.env}})};try{return Function(...Object.keys(Y),`'use strict'; return (${X});`)(...Object.values(Y))}catch{try{return Function(...Object.keys(Y),`'use strict'; return ${X};`)(...Object.values(Y))}catch{return}}}async function Cz(X,$,Z){let Y=X.matchAll(/export\s+(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:export\s+|$))/g);for(let G of Y){let[,,Q,q]=G;try{let W=q.trim().replace(/;$/,""),K=bZ(W,$);if(K!==void 0)$[Q]=K}catch(W){console.warn(`Failed to parse export ${Q} in fallback:`,W)}}let J=X.matchAll(/(?:^|\n)\s*(const|let|var)\s+(\w+)\s*=\s*([\s\S]*?)(?=\s*(?:(?:const|let|var|function|export)\s+|$))/g);for(let G of J){let[,,Q,q]=G;if(!(Q in $))try{let W=q.trim().replace(/;$/,""),K=bZ(W,$);if(K!==void 0)$[Q]=K}catch{}}}function dZ(X){let $=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Z=$?$[1]:"",Y=$?X.replace(/<script\b[^>]*>[\s\S]*?<\/script>/i,""):X;return{scriptContent:Z,templateWithoutScript:Y}}function mZ(X){let $=X.trim();if(!$)return!1;return/(?:const|let|var|function)\s+\w+/.test($)}var O9,kZ,Mz,kz,Ez;var S7=E(()=>{H0();b5();N1();R0();O9=["module","exports","require","props","$props","defineProps","withDefaults","defineClientPayload","state","derived","effect","batch","onMount","onDestroy","definePageMeta","useRoute","useRouter","useHead","useSeoMeta","ref","reactive","computed","watch","onMounted","onUnmounted","nextTick","defineEmits","defineExpose","defineSlots","provide","inject","useColorMode","useDark","useMediaQuery","useScrollLock","usePreferredDark","usePreferredLight","usePreferredReducedMotion","usePreferredContrast","window","document","console","confirm","alert","fetch","params"],kZ=new Set(O9),Mz=new Set(["props","$props","defineProps"]),kz=new Set(["stx","@stacksjs/stx"]);Ez=/^(?:export\s+)?(?:const|let|var)\s+[A-Za-z_$][\w$]*(?:\s*,\s*[A-Za-z_$][\w$]*)*\s*;?$/});var V9={};i(V9,{renderSlot:()=>cZ,processSlots:()=>iZ,parseSlots:()=>lZ,parseSlotElement:()=>gz,extractSlotContent:()=>dz,applySlots:()=>mz});function Pz(X,$){let Z=1,Y=$,J="<template",G="</template";while(Y<X.length&&Z>0){let Q=X.indexOf("<",Y);if(Q===-1)break;if(Y=Q,X.startsWith(J,Y)&&(Y+J.length>=X.length||/[\s>\/]/.test(X[Y+J.length]))){Z++,Y+=J.length;continue}if(X.startsWith(G,Y)){let q=X.indexOf(">",Y+G.length);if(q!==-1){if(Z--,Z===0)return q+1;Y=q+1;continue}}Y++}return Z===0?Y:-1}function xz(X,$){let Z=null;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"){Z=J;continue}if(J===">")return Y+1}return-1}function fz(X){let $=[],Z=[],Y=/^<template\s+(?:#([a-zA-Z][\w-]*)|v-slot:([a-zA-Z][\w-]*)|slot="([a-zA-Z][\w-]*)")(?:\s*=\s*"([^"]*)")?[^>]*>$/i,J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;if(X.startsWith("<!--",G)){let w=X.indexOf("-->",G+4);J=w===-1?X.length:w+3;continue}let Q=xz(X,G+1);if(Q===-1)break;let q=X.slice(G,Q),W=q.match(/^<\s*(\/?)\s*([a-zA-Z][\w-]*)/);if(!W){J=Q;continue}let K=W[1]==="/",U=W[2].toLowerCase();if(K){let w=Z.lastIndexOf(U);if(w!==-1)Z.splice(w);J=Q;continue}if(U==="template"&&Z.length===0){let w=q.match(Y);if(w){let B=Pz(X,Q);if(B!==-1){let j=w[1]||w[2]||w[3];$.push({start:G,end:B,slotName:j,content:X.slice(Q,B-11).trim(),propsBinding:w[4]||void 0}),J=B;continue}}}if(!/\/\s*>$/.test(q)&&!vz.has(U)){if(Z.push(U),U==="script"||U==="style"){let w=X.toLowerCase().indexOf(`</${U}>`,Q);if(w!==-1){J=w;continue}}}J=Q}return $}function lZ(X){let $={default:"",named:new Map},Z=X,Y=fz(X);for(let W of Y)$.named.set(W.slotName,{name:W.slotName,content:W.content,propsBinding:W.propsBinding});Y.sort((W,K)=>K.start-W.start);for(let W of Y)Z=Z.slice(0,W.start)+Z.slice(W.end);let J=[],G=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*)>([\s\S]*?)<\/\1>/gi,Q;while((Q=G.exec(Z))!==null){let[W,K,U,z,w,B]=Q,j=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=w.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),H=(j+_).trim(),L=`<${K}${H?" "+H:""}>${B}</${K}>`;J.push({start:Q.index,end:Q.index+W.length,slotName:z,element:L})}let q=/<([a-zA-Z][a-zA-Z0-9-]*)\b([^>]*?)\bslot="([^"]+)"([^>]*?)\/>/gi;while((Q=q.exec(Z))!==null){let[W,K,U,z,w]=Q,B=U.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),j=w.replace(/\s*slot="[^"]*"\s*/," ").trimEnd(),_=(B+j).trim(),H=`<${K}${_?" "+_:""} />`;J.push({start:Q.index,end:Q.index+W.length,slotName:z,element:H})}J.sort((W,K)=>K.start-W.start);for(let W of J){let K=$.named.get(W.slotName);if(K)K.content+=W.element;else $.named.set(W.slotName,{name:W.slotName,content:W.element});Z=Z.slice(0,W.start)+Z.slice(W.end)}return $.default=Z.trim(),$}function gz(X){let $=X.match(/name\s*=\s*["']([^"']+)["']/),Z=$?$[1]:"",Y={},J=/:([a-zA-Z][\w-]*)\s*=\s*["']([^"']+)["']/g,G;while((G=J.exec(X))!==null)Y[G[1]]=G[2];let Q=X.match(/<slot[^>]*>([\s\S]*?)<\/slot>/i),q=Q?Q[1].trim():"";return{name:Z,props:Y,defaultContent:q}}async function cZ(X,$,Z,Y){if(!X)return Z;let J=X.content;if(X.propsBinding&&Object.keys($).length>0){let G=X.propsBinding.trim(),Q={...Y};if(G.startsWith("{")&&G.endsWith("}")){let q=G.slice(1,-1).split(",").map((W)=>W.trim()).filter(Boolean);for(let W of q){let[K,U]=W.split(":").map((w)=>w.trim()),z=U||K;if($[K]!==void 0)Q[z]=$[K]}}else Q[G]=$;J=hz(J,Q)}return J}function hz(X,$){return X.replace(/\{\{\s*([^}]+)\s*\}\}/g,(Z,Y)=>{try{let J=Y.trim(),G=pZ(J,$);return G1(String(G??""))}catch{return`{{ ${Y} }}`}})}function pZ(X,$){if(/^[a-zA-Z_$][\w$]*(\.[a-zA-Z_$][\w$]*)*$/.test(X)){let Y=X.split("."),J=$;for(let G of Y)if(J&&typeof J==="object"&&G in J)J=J[G];else return;return J}let Z=X.match(/^([a-zA-Z_$][\w$]*)\s*([+\-*/])\s*(\d+)$/);if(Z){let[,Y,J,G]=Z,Q=$[Y],q=parseInt(G,10);if(typeof Q==="number")switch(J){case"+":return Q+q;case"-":return Q-q;case"*":return Q*q;case"/":return Q/q}}try{if(!G0(X))return;return Q0(X,Object.keys($))(...Object.values($))}catch{return}}async function iZ(X,$,Z){let Y=X;Y=await uz(Y,/<slot\s+name\s*=\s*["']([^"']+)["']([^>]*?)(?:\/>|>([\s\S]*?)<\/slot>)/gi,async(Q,q,W,K)=>{let U=$.named.get(q),z=K?.trim()||"",w=W||"",B={},j=/:([a-zA-Z_$][\w$-]*)\s*=\s*["']([^"']+)["']/g,_;while((_=j.exec(w))!==null){let H=_[1],L=_[2];B[H]=pZ(L,Z)}return await cZ(U,B,z,Z)});let G=/<slot\s*(?:\/>|>([\s\S]*?)<\/slot>)/gi;return Y=Y.replace(G,(Q,q)=>{if(Q.includes("name="))return Q;let W=q?.trim()||"";return $.default||W}),Y}async function uz(X,$,Z){let Y=[],J=[];X.replace($,(q,...W)=>{let K=W[W.length-2];return J.push({match:q,index:K}),Y.push(Z(q,...W.slice(0,-2))),q});let G=await Promise.all(Y),Q=X;for(let q=J.length-1;q>=0;q--){let{match:W,index:K}=J[q];Q=Q.slice(0,K)+G[q]+Q.slice(K+W.length)}return Q}function dz(X){let $=lZ(X);return{defaultSlot:$.default,namedSlots:$.named}}async function mz(X,$,Z,Y){return await iZ(X,{default:$,named:Z},Y)}var vz;var A9=E(()=>{Q1();R0();vz=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function b1(X,$){let Z=lz(X,$);return Z.ok?{expression:Z.expression,endPos:Z.endPos}:null}function lz(X,$){let Z=$;while(Z<X.length&&/\s/.test(X[Z]))Z++;if(X[Z]!=="(")return{ok:!1,reason:"missing-open-paren",pos:Z};let Y=D0(X,"(",")",Z);if(Y===-1)return{ok:!1,reason:"unclosed-paren",pos:Z};return{ok:!0,expression:X.slice(Z+1,Y),endPos:Y+1}}function cz(X,$){let Z=X.lastIndexOf("<",$);if(Z===-1)return!1;return Z>X.lastIndexOf(">",$)}function X5(X,$,Z,Y){let J=1,G=Y,Q=new RegExp(`@${$}\\s*\\(`,"g"),q=new RegExp(`@${Z}(?![a-z])`,"g");while(G<X.length&&J>0){Q.lastIndex=G,q.lastIndex=G;let W=Q.exec(X),K=q.exec(X),U=W?W.index:1/0,z=K?K.index:1/0;if(U<z)J++,G=U+W[0].length;else if(z<1/0){if(J--,J===0)return z;G=z+K[0].length}else break}return-1}function nZ(X,$){let Z=X.slice($).match(/^@if\s*/);if(!Z)return null;let Y=$+Z[0].length,J=b1(X,Y);if(!J)return null;let G=J.endPos,Q=X5(X,"if","endif",G);if(Q===-1)return null;let q=X.slice(G,Q),W=[],K=0,U="if",z=J.expression,w=0,B=0;while(K<q.length){let j=q.indexOf("@",K);if(j===-1)break;K=j;let _=q.substring(j);if(cz(q,j)){K++;continue}if(/^@if\s*\(/.test(_)){B++,K++;continue}if(/^@endif(?![a-z])/.test(_)){B--,K+=6;continue}if(B===0){let H=_.match(/^@elseif\s*/);if(H){W.push({type:U,condition:z,content:q.substring(w,K),start:G+w,end:G+K});let L=K+H[0].length,O=b1(q,L);if(!O){K++;continue}U="elseif",z=O.expression,K=O.endPos,w=K;continue}else if(/^@else(?![a-z])/.test(_)){W.push({type:U,condition:z,content:q.substring(w,K),start:G+w,end:G+K}),U="else",z=void 0,K+=5,w=K;continue}}K++}return W.push({type:U,condition:z,content:q.slice(w),start:G+w,end:G+q.length}),{fullMatch:X.slice($,Q+6),branches:W,start:$,end:Q+6}}function C7(X){let $=[],Z=/@if\s*\(/g,Y=Z.exec(X);while(Y!==null){if($.some((Q)=>Y.index>Q.start&&Y.index<Q.end)){Y=Z.exec(X);continue}let G=nZ(X,Y.index);if(G)$.push(G),Z.lastIndex=G.end;Y=Z.exec(X)}return $}function gX(X,$,Z){let Y=[],J=new RegExp(`@${$}\\s*\\(`,"g"),G=J.exec(X);while(G!==null){if(Y.some((_)=>G.index>_.start&&G.index<_.end)){G=J.exec(X);continue}let q=G.index,W=q+G[0].length-1,K=D0(X,"(",")",W);if(K===-1){G=J.exec(X);continue}let U=X.slice(W+1,K),z=K+1,w=X5(X,$,Z,z);if(w===-1){G=J.exec(X);continue}let B=X.slice(z,w),j=w+`@${Z}`.length;Y.push({fullMatch:X.slice(q,j),name:$,params:U,content:B,start:q,end:j}),J.lastIndex=j,G=J.exec(X)}return Y}function R9(X,$){let Z=X.slice($).match(/^@switch\s*/);if(!Z)return null;let Y=$+Z[0].length,J=b1(X,Y);if(!J)return null;let G=J.endPos,Q=X5(X,"switch","endswitch",G);if(Q===-1)return null;let q=X.slice(G,Q),W=[],K=0,U=null,z=0;while(K<q.length){let w=q.slice(K),B=w.match(/^@switch\s*\(/),j=w.match(/^@endswitch(?![a-z])/);if(B){if(z++,U)U.content+=B[0];K+=B[0].length;continue}if(j){if(z--,U)U.content+=j[0];K+=j[0].length;continue}if(z>0){if(U)U.content+=q[K];K++;continue}let _=w.match(/^@case\s*/),H=w.match(/^@default(?![a-z])/),L=w.match(/^@break(?![a-z])/);if(_&&w.startsWith("@case")){if(U)W.push(U);let O=K+_[0].length,F=b1(q,O);if(!F){K++;continue}U={type:"case",value:F.expression,content:""},K=F.endPos}else if(H&&w.startsWith("@default")){if(U)W.push(U);U={type:"default",content:""},K+=H[0].length}else if(L&&w.startsWith("@break"))K+=L[0].length;else{if(U)U.content+=q[K];K++}}if(U)W.push(U);return{fullMatch:X.slice($,Q+10),expression:J.expression,cases:W,start:$,end:Q+10}}var rZ=()=>{};var oZ=()=>{};var hX=E(()=>{rZ();oZ()});function sZ(X,$={}){return new A5(X,$).routes}var aZ=E(()=>{i1();i1()});async function eZ(X){let $=X;if(!$)try{$=(await S1())?.pagesDir||"pages"}catch{$="pages"}let Z=$,Y=tZ.get(Z);if(Y)return Y;let J=[];try{J=sZ(".",{pagesDir:Z}).map((G)=>G.regex.source).filter(Boolean)}catch{J=[]}return tZ.set(Z,J),J}var tZ;var XY=E(()=>{aZ();T1();tZ=new Map});function rz(X){return X.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function $Y(X){return rz(JSON.stringify(X))}function P7(X){let $=0,Z,Y=N9.map(()=>{return});while($<X.length){if(Z===void 0||Z!==null&&Z.index<$)ZY.lastIndex=$,Z=ZY.exec(X);if(!Z)return null;let J=Z.index,G=-1,Q=null;for(let W=0;W<N9.length;W++){let K=N9[W],U=Y[W];if(U===void 0||U!==null&&U.index<$)K.open.lastIndex=$,U=K.open.exec(X),Y[W]=U;if(!U)continue;if(U.index<J&&(G===-1||U.index<G))G=U.index,Q=K.close}if(G===-1||!Q)return{index:J,tag:Z[0],attrs:Z[1]??""};Q.lastIndex=G;let q=Q.exec(X);if(!q)return null;$=q.index+q[0].length}return null}function uX(X,$){let Z=P7(X);if(!Z)return X;return X.slice(0,Z.index)+$(Z.tag,Z.attrs)+X.slice(Z.index+Z.tag.length)}var N9,ZY;var T9=E(()=>{N9=[{open:/<!--/g,close:/-->/g},{open:/<script\b/gi,close:/<\/script\s*>/gi},{open:/<style\b/gi,close:/<\/style\s*>/gi}],ZY=/<body\b([^>]*)>/gi});function M9(){return`
3762
3762
  (function(){
3763
3763
  var tip=null,hideTimer=null,currentEl=null;
3764
3764
 
@@ -3861,7 +3861,7 @@ document.addEventListener("focusout",function(e){
3861
3861
  if(el) hideTip();
3862
3862
  });
3863
3863
  })();
3864
- `}function I9(){return $5}function E9(X){let $=$5;return YY.push(X),$5=X,$}function D9(X){YY.pop(),$5=X}function y9(){return dX>0}function b9(X){k9.add(X)}function JY(X){dX++;try{X()}finally{if(dX--,dX===0){let $=[...k9];k9.clear();for(let Z of $)Z()}}}function GY(X){let $=$5;$5=null;try{return X()}finally{$5=$}}var $5=null,YY,dX=0,k9;var QY=E(()=>{YY=[],k9=new Set});function C1(X){let $=X,Z=new Set,Y=new Set,J=()=>{let G=I9();if(G)Y.add(G);return $};return J.set=(G)=>{if(!Object.is(G,$)){let Q=$;if($=G,Z.forEach((q)=>q($,Q)),y9())Y.forEach((q)=>b9(q));else Y.forEach((q)=>q())}},J.update=(G)=>{J.set(G($))},J.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(G)=>J.set(G),configurable:!0}),J}function lX(X){let $,Z=!0,Y=new Set,J=()=>{if(!Z)if(Z=!0,y9())Y.forEach((Q)=>b9(Q));else Y.forEach((Q)=>Q())},G=()=>{let Q=I9();if(Q)Y.add(Q);if(Z){let q=E9(J);try{$=X()}finally{D9(q)}Z=!1}return $};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function cX(X,$={}){let Z,Y=!1,J=()=>{if(Y)return;if(Z)Z(),Z=void 0;let G=E9(J);try{let Q=X();Z=typeof Q==="function"?Q:void 0}finally{D9(G)}};if($.immediate!==!1)J();return()=>{if(Y=!0,Z)Z()}}function C9(X){JY(X)}function P9(X){S9.push(X)}function v9(X){mX.push(X)}function rz(){qY(S9,"onMount",mX)}function oz(){qY(mX,"onDestroy")}function qY(X,$,Z){let Y=X.splice(0,X.length);for(let J of Y)try{let G=J();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${$} callback threw:`,G)}}function sz(){return{mount:S9.length,destroy:mX.length}}function pX(X){return typeof X==="function"&&X._isSignal===!0}function iX(X){return typeof X==="function"&&X._isDerived===!0}function x9(X){if(pX(X)||iX(X))return X();return X}function nX(X){return GY(X)}function az(X,$){let Z=typeof X==="function"?X:()=>X,Y=C1([]),J=lX(()=>Y().reduce((q,K)=>$(q,K.action),Z())),G=!1;return cX(()=>{if(Z(),!G){G=!0;return}if(nX(()=>Y().length))Y.set([])}),[J,(q,K)=>{let U={action:q};Y.set([...Y(),U]);let W=()=>{let z=Y().filter((w)=>w!==U);if(z.length!==Y().length)Y.set(z)};if(K&&typeof K.then==="function")Promise.resolve(K).then(W,W);return W}]}var S9,mX;var rX=E(()=>{QY();S9=[],mX=[]});var UY={};n(UY,{useOptimistic:()=>az,untrack:()=>x9,state:()=>C1,runMountCallbacks:()=>rz,runDestroyCallbacks:()=>oz,pendingLifecycleCounts:()=>sz,peek:()=>nX,onMount:()=>P9,onDestroy:()=>v9,isSignal:()=>pX,isDerived:()=>iX,generateSignalsRuntimeDev:()=>f9,generateSignalsRuntime:()=>KY,effect:()=>cX,derived:()=>lX,default:()=>ez,batch:()=>C9});function KY(){let X=tz(f9());try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X);return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return X}}function tz(X){let $=[],Z=0,Y="console.log(";while(Z<X.length){let J=X.indexOf(Y,Z);if(J===-1){$.push(X.slice(Z));break}$.push(X.slice(Z,J));let G=1,Q=J+Y.length;while(Q<X.length&&G>0){let q=X[Q];if(q==='"'||q==="'"||q==="`"){let K=q;Q++;while(Q<X.length&&X[Q]!==K){if(X[Q]==="\\")Q++;Q++}Q++;continue}if(q==="(")G++;else if(q===")")G--;Q++}$.push("0"),Z=Q}return $.join("")}function f9(){return`
3864
+ `}function I9(){return $5}function E9(X){let $=$5;return YY.push(X),$5=X,$}function D9(X){YY.pop(),$5=X}function y9(){return dX>0}function b9(X){k9.add(X)}function JY(X){dX++;try{X()}finally{if(dX--,dX===0){let $=[...k9];k9.clear();for(let Z of $)Z()}}}function GY(X){let $=$5;$5=null;try{return X()}finally{$5=$}}var $5=null,YY,dX=0,k9;var QY=E(()=>{YY=[],k9=new Set});function C1(X){let $=X,Z=new Set,Y=new Set,J=()=>{let G=I9();if(G)Y.add(G);return $};return J.set=(G)=>{if(!Object.is(G,$)){let Q=$;if($=G,Z.forEach((q)=>q($,Q)),y9())Y.forEach((q)=>b9(q));else Y.forEach((q)=>q())}},J.update=(G)=>{J.set(G($))},J.subscribe=(G)=>{return Z.add(G),()=>Z.delete(G)},Object.defineProperty(J,"_isSignal",{value:!0,writable:!1}),Object.defineProperty(J,"value",{get:()=>J(),set:(G)=>J.set(G),configurable:!0}),J}function lX(X){let $,Z=!0,Y=new Set,J=()=>{if(!Z)if(Z=!0,y9())Y.forEach((Q)=>b9(Q));else Y.forEach((Q)=>Q())},G=()=>{let Q=I9();if(Q)Y.add(Q);if(Z){let q=E9(J);try{$=X()}finally{D9(q)}Z=!1}return $};return Object.defineProperty(G,"_isDerived",{value:!0,writable:!1}),Object.defineProperty(G,"value",{get:()=>G(),configurable:!0}),G}function cX(X,$={}){let Z,Y=!1,J=()=>{if(Y)return;if(Z)Z(),Z=void 0;let G=E9(J);try{let Q=X();Z=typeof Q==="function"?Q:void 0}finally{D9(G)}};if($.immediate!==!1)J();return()=>{if(Y=!0,Z)Z()}}function C9(X){JY(X)}function P9(X){S9.push(X)}function v9(X){mX.push(X)}function oz(){qY(S9,"onMount",mX)}function sz(){qY(mX,"onDestroy")}function qY(X,$,Z){let Y=X.splice(0,X.length);for(let J of Y)try{let G=J();if(Z&&typeof G==="function")Z.push(G)}catch(G){console.error(`[stx] ${$} callback threw:`,G)}}function az(){return{mount:S9.length,destroy:mX.length}}function pX(X){return typeof X==="function"&&X._isSignal===!0}function iX(X){return typeof X==="function"&&X._isDerived===!0}function x9(X){if(pX(X)||iX(X))return X();return X}function nX(X){return GY(X)}function tz(X,$){let Z=typeof X==="function"?X:()=>X,Y=C1([]),J=lX(()=>Y().reduce((q,W)=>$(q,W.action),Z())),G=!1;return cX(()=>{if(Z(),!G){G=!0;return}if(nX(()=>Y().length))Y.set([])}),[J,(q,W)=>{let K={action:q};Y.set([...Y(),K]);let U=()=>{let z=Y().filter((w)=>w!==K);if(z.length!==Y().length)Y.set(z)};if(W&&typeof W.then==="function")Promise.resolve(W).then(U,U);return U}]}var S9,mX;var rX=E(()=>{QY();S9=[],mX=[]});var KY={};i(KY,{useOptimistic:()=>tz,untrack:()=>x9,state:()=>C1,runMountCallbacks:()=>oz,runDestroyCallbacks:()=>sz,pendingLifecycleCounts:()=>az,peek:()=>nX,onMount:()=>P9,onDestroy:()=>v9,isSignal:()=>pX,isDerived:()=>iX,generateSignalsRuntimeDev:()=>f9,generateSignalsRuntime:()=>WY,effect:()=>cX,derived:()=>lX,default:()=>Xw,batch:()=>C9});function WY(){let X=ez(f9());try{let Z=new Bun.Transpiler({loader:"js",minifyWhitespace:!0}).transformSync(X);return Z=Z.replace(/\}(var |let |const |function )/g,"};$1"),Z}catch{return X}}function ez(X){let $=[],Z=0,Y="console.log(";while(Z<X.length){let J=X.indexOf(Y,Z);if(J===-1){$.push(X.slice(Z));break}$.push(X.slice(Z,J));let G=1,Q=J+Y.length;while(Q<X.length&&G>0){let q=X[Q];if(q==='"'||q==="'"||q==="`"){let W=q;Q++;while(Q<X.length&&X[Q]!==W){if(X[Q]==="\\")Q++;Q++}Q++;continue}if(q==="(")G++;else if(q===")")G--;Q++}$.push("0"),Z=Q}return $.join("")}function f9(){return`
3865
3865
  // STX Signals Runtime (Development Build)
3866
3866
  console.log('[stx] signals runtime loading');
3867
3867
  // Pre-initialization shim: capture onMount/onDestroy calls made before the runtime IIFE runs
@@ -11827,41 +11827,41 @@ catch (e) { console.warn('[stx] destroy callback error:', e); }
11827
11827
  }
11828
11828
  }
11829
11829
  })();
11830
- `}var ez;var WY=E(()=>{rX();e0();rX();ez={state:C1,derived:lX,effect:cX,batch:C9,onMount:P9,onDestroy:v9,isSignal:pX,isDerived:iX,untrack:x9,peek:nX,generateSignalsRuntime:KY,generateSignalsRuntimeDev:f9}});var g9={};n(g9,{templateCache:()=>zY,readFileCached:()=>Xw,invalidateFileCacheByDir:()=>Zw,invalidateFileCache:()=>$w,hashFilePath:()=>v7,getCachedSignalsRuntime:()=>Gw,getCachedRouterScript:()=>Qw,clearDevCaches:()=>qw,checkCache:()=>Kw,cacheTemplate:()=>Uw,__setSignalsGeneratorsForTest:()=>Jw});import P1 from"fs";import C5 from"path";async function Xw(X){let Z;for(let Y=0;Y<3;Y++)try{let G=(await P1.promises.stat(X)).mtime.getTime(),Q=Z5.get(X);if(Q&&Q.mtime===G)return Q.content;let q=await Bun.file(X).text(),U=(await P1.promises.stat(X)).mtime.getTime();if(U!==G)continue;return Z5.set(X,{content:q,mtime:U}),q}catch(J){Z=J;break}throw Z5.delete(X),Error(`File not found: ${X}${Z?` (${Z.message})`:""}`)}function $w(X){Z5.delete(X)}function Zw(X){for(let $ of Z5.keys())if($.startsWith(X))Z5.delete($)}function Jw(X){wY=X}async function Gw(X=!1){let $=wY??await Promise.resolve().then(() => (WY(),UY));if(X)return $.generateSignalsRuntimeDev();if(oX===null)oX=$.generateSignalsRuntime();return oX}async function Qw(){if(sX===null){let{getRouterScript:X}=await Promise.resolve().then(() => (i1(),z2));sX=X()}return sX}function qw(){Z5.clear(),BY(),oX=null,Yw=null,sX=null}function jY(X){let $={debug:X.debug===!0,middleware:(X.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:(X.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify($)).digest("hex")}async function Kw(X,$){try{if(!$.cachePath)return null;let Z=C5.resolve($.cachePath),Y=C5.join(Z,`${v7(X)}.html`),J=C5.join(Z,`${v7(X)}.meta.json`);if(!await p(Y)||!await p(J))return null;let G=await Bun.file(J).text(),Q=JSON.parse(G);if(Q.cacheVersion!==$.cacheVersion)return null;if(Q.optionsSignature!==jY($))return null;if((await P1.promises.stat(X)).mtime.getTime()>Q.mtime)return null;for(let K of Q.dependencies)if(await p(K)){if((await P1.promises.stat(K)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(Y).text()}catch(Z){return console.warn(`Cache error for ${X}:`,Z),null}}async function Uw(X,$,Z,Y){try{if(!Y.cachePath)return;let J=C5.resolve(Y.cachePath);await P1.promises.mkdir(J,{recursive:!0});let G=C5.join(J,`${v7(X)}.html`),Q=C5.join(J,`${v7(X)}.meta.json`),q=await P1.promises.stat(X);await Bun.write(G,$);let K={sourcePath:X,mtime:q.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:Y.cacheVersion,optionsSignature:jY(Y),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(K,null,2)),zY.set(X,{output:$,mtime:q.mtime.getTime(),dependencies:Z})}catch(J){console.warn(`Failed to cache template ${X}:`,J)}}function v7(X){return new Bun.CryptoHasher("sha1").update(X).digest("hex").substring(0,Ww)}var zY,Z5,oX=null,Yw=null,wY=null,sX=null,Ww=16;var h9=E(()=>{H0();zY=new Map,Z5=new Map});function _Y(X){return X.includes("data-stx-runtime")}function HY(X){let $=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=$.exec(X);Z!==null;Z=$.exec(X)){let Y=X.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}function u9(X,$){let Z=X.indexOf("<script"),Y=X.search(/<!doctype\b/i);if(Z!==-1&&(Y===-1||Z>Y))return X.slice(0,Z)+$+`
11830
+ `}var Xw;var UY=E(()=>{rX();e0();rX();Xw={state:C1,derived:lX,effect:cX,batch:C9,onMount:P9,onDestroy:v9,isSignal:pX,isDerived:iX,untrack:x9,peek:nX,generateSignalsRuntime:WY,generateSignalsRuntimeDev:f9}});var g9={};i(g9,{templateCache:()=>zY,readFileCached:()=>$w,invalidateFileCacheByDir:()=>Yw,invalidateFileCache:()=>Zw,hashFilePath:()=>v7,getCachedSignalsRuntime:()=>Qw,getCachedRouterScript:()=>qw,clearDevCaches:()=>Ww,checkCache:()=>Kw,cacheTemplate:()=>Uw,__setSignalsGeneratorsForTest:()=>Gw});import P1 from"fs";import C5 from"path";async function $w(X){let Z;for(let Y=0;Y<3;Y++)try{let G=(await P1.promises.stat(X)).mtime.getTime(),Q=Z5.get(X);if(Q&&Q.mtime===G)return Q.content;let q=await Bun.file(X).text(),K=(await P1.promises.stat(X)).mtime.getTime();if(K!==G)continue;return Z5.set(X,{content:q,mtime:K}),q}catch(J){Z=J;break}throw Z5.delete(X),Error(`File not found: ${X}${Z?` (${Z.message})`:""}`)}function Zw(X){Z5.delete(X)}function Yw(X){for(let $ of Z5.keys())if($.startsWith(X))Z5.delete($)}function Gw(X){wY=X}async function Qw(X=!1){let $=wY??await Promise.resolve().then(() => (UY(),KY));if(X)return $.generateSignalsRuntimeDev();if(oX===null)oX=$.generateSignalsRuntime();return oX}async function qw(){if(sX===null){let{getRouterScript:X}=await Promise.resolve().then(() => (i1(),z2));sX=X()}return sX}function Ww(){Z5.clear(),BY(),oX=null,Jw=null,sX=null}function jY(X){let $={debug:X.debug===!0,middleware:(X.middleware??[]).map((Z)=>({name:Z.name,timing:Z.timing,handler:String(Z.handler)})),customDirectives:(X.customDirectives??[]).map((Z)=>({name:Z.name,hasEndTag:Z.hasEndTag===!0,handler:String(Z.handler)}))};return new Bun.CryptoHasher("sha1").update(JSON.stringify($)).digest("hex")}async function Kw(X,$){try{if(!$.cachePath)return null;let Z=C5.resolve($.cachePath),Y=C5.join(Z,`${v7(X)}.html`),J=C5.join(Z,`${v7(X)}.meta.json`);if(!await t(Y)||!await t(J))return null;let G=await Bun.file(J).text(),Q=JSON.parse(G);if(Q.cacheVersion!==$.cacheVersion)return null;if(Q.optionsSignature!==jY($))return null;if((await P1.promises.stat(X)).mtime.getTime()>Q.mtime)return null;for(let W of Q.dependencies)if(await t(W)){if((await P1.promises.stat(W)).mtime.getTime()>Q.mtime)return null}else return null;return await Bun.file(Y).text()}catch(Z){return console.warn(`Cache error for ${X}:`,Z),null}}async function Uw(X,$,Z,Y){try{if(!Y.cachePath)return;let J=C5.resolve(Y.cachePath);await P1.promises.mkdir(J,{recursive:!0});let G=C5.join(J,`${v7(X)}.html`),Q=C5.join(J,`${v7(X)}.meta.json`),q=await P1.promises.stat(X);await Bun.write(G,$);let W={sourcePath:X,mtime:q.mtime.getTime(),dependencies:Array.from(Z),cacheVersion:Y.cacheVersion,optionsSignature:jY(Y),generatedAt:Date.now()};await Bun.write(Q,JSON.stringify(W,null,2)),zY.set(X,{output:$,mtime:q.mtime.getTime(),dependencies:Z})}catch(J){console.warn(`Failed to cache template ${X}:`,J)}}function v7(X){return new Bun.CryptoHasher("sha1").update(X).digest("hex").substring(0,zw)}var zY,Z5,oX=null,Jw=null,wY=null,sX=null,zw=16;var h9=E(()=>{H0();zY=new Map,Z5=new Map});function _Y(X){return X.includes("data-stx-runtime")}function HY(X){let $=/window\.stx\s*\.\s*[A-Za-z_$]|\}\s*=\s*window\.stx\s*;/g;for(let Z=$.exec(X);Z!==null;Z=$.exec(X)){let Y=X.slice(Math.max(0,Z.index-80),Z.index);if(/if\s*\(\s*window\.stx\s*\)|window\.stx\s*&&/.test(Y))continue;return!0}return!1}function u9(X,$){let Z=X.indexOf("<script"),Y=X.search(/<!doctype\b/i);if(Z!==-1&&(Y===-1||Z>Y))return X.slice(0,Z)+$+`
11831
11831
  `+X.slice(Z);let J=/<head\b[^>]*>/i.exec(X);if(J){let Q=J.index+J[0].length;return`${X.slice(0,Q)}
11832
11832
  ${$}${X.slice(Q)}`}if(X.includes("</head>")){let Q=X.indexOf("</head>");return X.slice(0,Q)+$+`
11833
11833
  `+X.slice(Q)}if(P7(X))return uX(X,(Q)=>`${Q}
11834
11834
  ${$}`);return`${$}
11835
- ${X}`}async function aX(X,$){if(X.includes("data-stx-runtime")||X.includes("window.stx.state")||X.includes("STX Signals Runtime"))return X;if($.buildMode==="serve")return u9(X,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if($.buildMode==="compile")return u9(X,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (h9(),g9)),Y=await Z($.debug);return u9(X,`<script data-stx-scoped data-stx-runtime>${Y}</script>`)}function zw(X){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(X)}function OY(X){if(X.includes("data-stx-tooltip-runtime")||!zw(X))return X;let $=`<script data-stx-scoped data-stx-tooltip-runtime>${M9()}</script>`,Z=X.lastIndexOf("</body>");if(Z===-1)return`${X}
11835
+ ${X}`}async function aX(X,$){if(X.includes("data-stx-runtime")||X.includes("window.stx.state")||X.includes("STX Signals Runtime"))return X;if($.buildMode==="serve")return u9(X,'<script data-stx-runtime src="/_stx/runtime.js"></script>');if($.buildMode==="compile")return u9(X,'<script data-stx-runtime src="/__stx/runtime.__STX_HASH__.js"></script>');let{getCachedSignalsRuntime:Z}=await Promise.resolve().then(() => (h9(),g9)),Y=await Z($.debug);return u9(X,`<script data-stx-scoped data-stx-runtime>${Y}</script>`)}function ww(X){return/<[a-z][^>]*?\sx-tooltip\s*=/i.test(X)}function LY(X){if(X.includes("data-stx-tooltip-runtime")||!ww(X))return X;let $=`<script data-stx-scoped data-stx-tooltip-runtime>${M9()}</script>`,Z=X.lastIndexOf("</body>");if(Z===-1)return`${X}
11836
11836
  ${$}`;return`${X.slice(0,Z)}${$}
11837
- ${X.slice(Z)}`}async function LY(X,$){if(!X.includes("</body>"))return X;if(X.includes("data-stx-router")||X.includes("__stxRouter)return")||X.includes("__stxRouter=true"))return X;let Z=$?.router,Y="";{let q={};if(Z){if(Z.container)q.container=Z.container;if(Z.interceptAllLinks!==void 0)q.interceptAllLinks=Z.interceptAllLinks;if(Z.progress!==void 0)q.progress=Z.progress;if(Z.viewTransitions!==void 0)q.viewTransitions=Z.viewTransitions;if(Z.viewTransitionDuration!==void 0)q.viewTransitionDuration=Z.viewTransitionDuration;if(Z.viewTransitionEasing!==void 0)q.viewTransitionEasing=Z.viewTransitionEasing;if(Z.scrollToTop!==void 0)q.scrollToTop=Z.scrollToTop;if(Z.prefetch!==void 0)q.prefetch=Z.prefetch;if(Z.cache!==void 0)q.cache=Z.cache;if(Z.progressColor!==void 0)q.progressColor=Z.progressColor;if(Z.progressHeight!==void 0)q.progressHeight=Z.progressHeight}try{let K=await eZ($?.pagesDir);if(K.length>0)q.ownedRoutes=K}catch{}if(Object.keys(q).length>0)Y=`<script>window.__stxRouterConfig=${$Y(q)};</script>
11837
+ ${X.slice(Z)}`}async function OY(X,$){if(!X.includes("</body>"))return X;if(X.includes("data-stx-router")||X.includes("__stxRouter)return")||X.includes("__stxRouter=true"))return X;let Z=$?.router,Y="";{let q={};if(Z){if(Z.container)q.container=Z.container;if(Z.interceptAllLinks!==void 0)q.interceptAllLinks=Z.interceptAllLinks;if(Z.progress!==void 0)q.progress=Z.progress;if(Z.viewTransitions!==void 0)q.viewTransitions=Z.viewTransitions;if(Z.viewTransitionDuration!==void 0)q.viewTransitionDuration=Z.viewTransitionDuration;if(Z.viewTransitionEasing!==void 0)q.viewTransitionEasing=Z.viewTransitionEasing;if(Z.scrollToTop!==void 0)q.scrollToTop=Z.scrollToTop;if(Z.prefetch!==void 0)q.prefetch=Z.prefetch;if(Z.cache!==void 0)q.cache=Z.cache;if(Z.progressColor!==void 0)q.progressColor=Z.progressColor;if(Z.progressHeight!==void 0)q.progressHeight=Z.progressHeight}try{let W=await eZ($?.pagesDir);if(W.length>0)q.ownedRoutes=W}catch{}if(Object.keys(q).length>0)Y=`<script>window.__stxRouterConfig=${$Y(q)};</script>
11838
11838
  `}let{getCachedRouterScript:J}=await Promise.resolve().then(() => (h9(),g9)),G=$?.buildMode==="compile"?'<script data-stx-router src="/__stx/router.__STX_HASH__.js"></script>':$?.buildMode==="serve"?'<script data-stx-router src="/_stx/router.js"></script>':`<script data-stx-router>${await J()}</script>`,Q=X.lastIndexOf("</body>");return X.slice(0,Q)+Y+G+`
11839
- </body>`+X.slice(Q+7)}var tX=E(()=>{XY();T9()});var Y8={};n(Y8,{scanScriptTags:()=>TY,rewriteStxImportSpecifiers:()=>EY,processSignals:()=>i9,processScriptSetup:()=>kY,preEvalLiteralReactiveIfs:()=>c9,parseLoopExpression:()=>m9,hasSignalsSyntax:()=>Z8,findMarkupIndexOutsideScripts:()=>X8,extractExports:()=>IY,convertSignalLoopsToAttributes:()=>p9,convertSignalDirectivesToAttributes:()=>l9});function TY(X,$={}){let Z=[];for(let Y of bX(X,M1)){let J=Y.token.match(/^<script\b([^>]*)>/i),G=Y.token.match(/<\/script\s*>$/i);if(!J||!G)continue;let Q=J[1];if($.skipAttrs){if($.skipAttrs.lastIndex=0,$.skipAttrs.test(Q))continue}let q=J[0].length,K=Y.token.length-G[0].length;Z.push({fullMatch:Y.token,attrs:Q,body:Y.token.slice(q,K),start:Y.start,end:Y.end})}return Z}function m9(X){let $=X.trim(),Z=$.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let J=Z[1].trim(),G=Z[2].trim(),{itemVar:Q,indexVar:q}=FY(G);if(Q)return{style:"as",iterable:J,itemVar:Q,indexVar:q}}let Y=$.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let J=Y[1].trim(),G=Y[2].trim(),{itemVar:Q,indexVar:q}=FY(J);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function FY(X){let $=X.trim(),Z=$.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let Y=$.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let J=$.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let G=$.match(/^(\w+)$/);if(G)return{itemVar:G[1],indexVar:null};return{itemVar:null,indexVar:null}}function Z8(X){return V2(X)}function jw(X){let $=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,Y;while((Y=$.exec(X))!==null){let J=Y[1];if(J.startsWith("if"))Z++;else if(J==="endif")Z--;else if(Z===0)return!0}return!1}function Bw(X){let $=new Set,Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=Z.exec(X))!==null){let G=J[1],Q;while((Q=Y.exec(G))!==null)$.add(Q[1])}return $}function _w(X){if(!/[:@]for\s*=/.test(X)&&!/\bx-for\s*=/.test(X))return[];let $=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${d9})>`,"iy"),Z=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,Y=bX(X,(G,Q)=>{$.lastIndex=Q;let q=$.exec(G);if(!q||q.index!==Q||!Z.test(q[2]))return-1;return $.lastIndex}),J=[];for(let G of Y){$.lastIndex=0;let Q=$.exec(G.token);if(!Q)continue;let q=Q[2].match(Z),K=m9(q?.[1]??q?.[2]??""),U=[K.itemVar,K.indexVar].filter(Boolean);if(U.length===0)continue;let W=Q[1],w=/\/\s*>$/.test(G.token)||$8.has(W.toLowerCase())?G.end:MY(X,G.start,W,G.end);if(w!==-1)J.push({start:G.start,end:w,vars:new Set(U)})}return J}function Hw(X){return X.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function AY(X,$,Z,Y){if(!X)return!1;let J=Hw(X),G=!1,Q=!1,q=!1,K=/([a-zA-Z_$][\w$]*)/g,U;while((U=K.exec(J))!==null){let B=U[1];if(J.slice(0,U.index).trimEnd().endsWith("."))continue;if(VY.has(B))continue;if($.has(B)||Y?.has(B))G=!0;else if(Z&&B in Z)Q=!0}let W=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=W.exec(J))!==null){let B=z[1];if(J.slice(0,z.index).trimEnd().endsWith("."))continue;if(VY.has(B)||Z&&B in Z)continue;q=!0}return(G||q)&&!Q}function eX(X,$,Z){let Y=Z===void 0?` ${$}`:` ${$}="${Z.replace(/"/g,"&quot;")}"`,J=X.trim(),G=J.match(NY);if(G&&Ow(G[3],G[1])){let[,Q,q,K]=G;return`<${Q}${q}${Y}>${K}</${Q}>`}return`<template${Y}>${J}</template>`}function Ow(X,$){let Z=new RegExp(`<(/)?${$}(?=[\\s/>])`,"gi"),Y=0,J;while((J=Z.exec(X))!==null)if(J[1]){if(Y--,Y<0)return!1}else Y++;return!0}function l9(X,$){let Z=Bw(X);function Y(J){let G=J,Q=_w(J),q=(z)=>{let w=new Set;for(let B of Q)if(z>B.start&&z<B.end)for(let j of B.vars)w.add(j);return w},K=/@if\s*\(/g,U,W=[];while((U=K.exec(G))!==null){let z=U.index,w=z+U[0].length,B=1,j=w;while(j<G.length&&B>0){if(G[j]==="(")B++;else if(G[j]===")")B--;j++}if(B!==0)continue;let _=G.substring(w,j-1).trim(),H=j,O=1,L=H,F=/@(if\s*\(|endif)/g;F.lastIndex=H;let V;while((V=F.exec(G))!==null)if(V[1].startsWith("if"))O++;else if(V[1]==="endif"){if(O--,O===0){L=V.index+V[0].length;break}}if(O!==0)continue;let A=G.substring(H,L-6).trim(),R;if(jw(A)){let N=C7(G.substring(z,L));if(N.length===0)continue;let T=N[0].branches.filter((I)=>I.type!=="else"),M=q(z);if(!(T.length>0&&T.every((I)=>AY(I.condition,Z,$,M))))continue;R=N[0].branches.map((I)=>{let S=Y(I.content);if(I.type==="elseif")return eX(S,"@else-if",I.condition??"");if(I.type==="else")return eX(S,"@else");return eX(S,"@if",I.condition??"")}).join(`
11840
- `)}else{if(!AY(_,Z,$,q(z)))continue;R=eX(Y(A),"@if",_)}W.push({start:z,end:L,replacement:R}),K.lastIndex=L}for(let z=W.length-1;z>=0;z--){let{start:w,end:B,replacement:j}=W[z];G=G.substring(0,w)+j+G.substring(B)}return G}return Y(X)}function Lw(X){let $=X.trim();if($==="")return;if($==="true")return!0;if($==="false")return!1;if($==="null")return!1;if($==="undefined")return!1;if($==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test($)){let J=Number($);return J!==0&&!Number.isNaN(J)}let Z=$.match(/^'((?:\\.|[^'\\])*)'$/);if(Z)return Z[1].length>0;let Y=$.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}function MY(X,$,Z,Y){if($8.has(Z.toLowerCase()))return Y;let J=Z.toLowerCase(),G=X.toLowerCase(),Q=X.length,q=1,K=Y;while(K<Q){let U=X.indexOf("<",K);if(U===-1)return-1;if(K=U,X.startsWith("<!--",K)){let B=X.indexOf("-->",K+4);if(B===-1)return-1;K=B+3;continue}let W=/^<(script|style)\b/i.exec(X.slice(K,K+8));if(W){let B=X.indexOf(">",K);if(B===-1)return-1;if(X[B-1]==="/"){K=B+1;continue}let j=G.indexOf(`</${W[1].toLowerCase()}`,K);if(j===-1)return-1;let _=X.indexOf(">",j);if(_===-1)return-1;K=_+1;continue}if(X[K+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec(X.slice(K,K+64));if(!B){K++;continue}if(B[1].toLowerCase()===J){if(q--,K+=B[0].length,q===0)return K;continue}K+=B[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec(X.slice(K,K+64));if(!z){K++;continue}let w=X.indexOf(">",K);if(w===-1)return-1;if(z[1].toLowerCase()===J){let B=X.slice(K,w+1);if(!(/\/\s*>$/.test(B)||$8.has(J)))q++}K=w+1}return-1}function Vw(X,$){let Z=$,Y=X.length;for(;;){while(Z<Y&&X[Z]!=="<")Z++;if(Z>=Y)return!1;if(X.startsWith("<!--",Z)){let Q=X.indexOf("-->",Z+4);if(Q===-1)return!1;Z=Q+3;continue}break}if(X[Z+1]==="/")return!1;let J=X.indexOf(">",Z);if(J===-1)return!1;let G=X.slice(Z,J+1);return Fw.test(G)}function c9(X){if(!X.includes(":if")&&!X.includes(":show")&&!X.includes("x-if")&&!X.includes("x-show")&&!X.includes("@if=")&&!X.includes("@show="))return X;let $=[],Z=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);let J=(z)=>$.some(([w,B])=>z>=w&&z<B),G=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,Q=[],q;while((q=G.exec(X))!==null){if(J(q.index))continue;let[z,w,B,j,_,H,O]=q,L=Lw(_);if(L===void 0)continue;let F=q.index,V=F+z.length,N=!!O||/\/\s*>$/.test(z)||$8.has(w.toLowerCase())?V:MY(X,F,w,V);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&Vw(X,N)){G.lastIndex=V;continue}if(L===!0){let M=`<${w}${B}${H}${O}>`;Q.push({start:F,end:V,replacement:M});continue}Q.push({start:F,end:N,replacement:""}),G.lastIndex=N}if(Q.length===0)return X;Q.sort((z,w)=>z.start-w.start);let K=[],U=-1;for(let z of Q){if(z.start<U)continue;K.push(z),U=z.end}let W=X;for(let z=K.length-1;z>=0;z--){let{start:w,end:B,replacement:j}=K[z];W=W.substring(0,w)+j+W.substring(B)}return W}function p9(X,$){let Z=X,Y=/@(for|foreach)\s*\(/g,J,G=[],Q=[];while((J=Y.exec(Z))!==null){let q=J[1],K=J.index,U=K+J[0].length,W=1,z=U;while(z<Z.length&&W>0){if(Z[z]==="(")W++;else if(Z[z]===")")W--;z++}if(W!==0)continue;let w=Z.substring(U,z-1).trim(),B=z,j=m9(w),_=q==="for"?"@endfor":"@endforeach",H=1,O=B,L=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");L.lastIndex=B;let F;while((F=L.exec(Z))!==null)if(F[1].startsWith(q))H++;else if(H--,H===0){O=F.index+F[0].length;break}if(H!==0)continue;let V=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)Q.push({start:K,end:O,vars:T})};if(j.iterable){let T=j.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){V();continue}let M=T.split(/[.[(]/)[0].trim(),k=$?M in $:!1,D=Q.some((I)=>K>I.start&&K<I.end&&I.vars.includes(M));if(M&&(k||D)){V();continue}}if(j.style==="as")w=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let A=Z.substring(B,O-_.length).trim(),R=A.match(NY),N;if(R){let[,T,M,k]=R;N=`<${T}${M} @for="${w}">${k}</${T}>`}else N=`<template @for="${w}">${A}</template>`;G.push({start:K,end:O,replacement:N})}for(let q=G.length-1;q>=0;q--){let{start:K,end:U,replacement:W}=G[q];Z=Z.substring(0,K)+W+Z.substring(U)}return Z}function Aw(X){let $=new Set,Z=[],Y=0,J=0,G=X.length,Q=(W)=>{let z=Y+1;while(z<G){let w=X[z];if(w==="\\"){z+=2;continue}if(w===W)return z+1;z++}return G},q=()=>{let W=Y+2;while(W<G&&X[W]!==`
11841
- `)W++;return W},K=()=>{let W=Y+2;while(W<G-1){if(X[W]==="*"&&X[W+1]==="/")return W+2;W++}return G},U=(W)=>{let z=W,w=0;while(z<G){let B=X[z];if(B==="/"&&X[z+1]==="/"){let j=z+2;while(j<G&&X[j]!==`
11842
- `)j++;z=j;continue}if(B==="/"&&X[z+1]==="*"){let j=z+2;while(j<G-1&&!(X[j]==="*"&&X[j+1]==="/"))j++;z=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=z+1;while(j<G){if(X[j]==="\\"){j+=2;continue}if(X[j]===B){j++;break}j++}z=j;continue}if(B==="("||B==="["||B==="{"){w++,z++;continue}if(B===")"||B==="]"||B==="}"){w--,z++;continue}if(B===";"&&w===0)return z+1;z++}return G};while(Y<G){let W=X[Y];if(W==="/"&&X[Y+1]==="/"){let z=q();Z.push(X.slice(Y,z)),Y=z;continue}if(W==="/"&&X[Y+1]==="*"){let z=K();Z.push(X.slice(Y,z)),Y=z;continue}if(W==='"'||W==="'"||W==="`"){let z=Q(W);Z.push(X.slice(Y,z)),Y=z;continue}if(W==="{"){J++,Z.push(W),Y++;continue}if(W==="}"){J--,Z.push(W),Y++;continue}if(J===0){let z=Y>0?X[Y-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=X.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=U(Y+B[0].length);if($.has(j)){Z.push(`/* stx: deduped const ${j} */`),Y=_;continue}$.add(j),Z.push(X.slice(Y,_)),Y=_;continue}}}Z.push(W),Y++}return Z.join("")}async function kY(X,$,Z){let Y=TY(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,G=[];for(let H of Y){let O=H.body;if(o1(H.attrs))O=s1(O);if(J.test(O))G.push({fullMatch:H.fullMatch,attrs:H.attrs,content:O})}if(G.length===0)return{output:X,setupCode:null};let Q=`__stx_setup_${Date.now()}_${ww++}`,{hasUserImports:q,bundleClientScript:K}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (R7(),A7))),U=[];for(let H=0;H<G.length;H++){let O=G[H].content;if(O=M5(O).code,q(O))O=await K(O,$||"",{projectRoot:process.cwd()});O=O.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,V)=>EY(V));let L=c0(O);U.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
11843
- ${L}`)}let W=U.join(`
11839
+ </body>`+X.slice(Q+7)}var tX=E(()=>{XY();T9()});var Y8={};i(Y8,{scanScriptTags:()=>TY,rewriteStxImportSpecifiers:()=>EY,processSignals:()=>i9,processScriptSetup:()=>kY,preEvalLiteralReactiveIfs:()=>c9,parseLoopExpression:()=>m9,hasSignalsSyntax:()=>Z8,findMarkupIndexOutsideScripts:()=>X8,extractExports:()=>IY,convertSignalLoopsToAttributes:()=>p9,convertSignalDirectivesToAttributes:()=>l9});function TY(X,$={}){let Z=[];for(let Y of bX(X,M1)){let J=Y.token.match(/^<script\b([^>]*)>/i),G=Y.token.match(/<\/script\s*>$/i);if(!J||!G)continue;let Q=J[1];if($.skipAttrs){if($.skipAttrs.lastIndex=0,$.skipAttrs.test(Q))continue}let q=J[0].length,W=Y.token.length-G[0].length;Z.push({fullMatch:Y.token,attrs:Q,body:Y.token.slice(q,W),start:Y.start,end:Y.end})}return Z}function m9(X){let $=X.trim(),Z=$.match(/^([\s\S]+?)\s+as\s+(.+)$/);if(Z){let J=Z[1].trim(),G=Z[2].trim(),{itemVar:Q,indexVar:q}=FY(G);if(Q)return{style:"as",iterable:J,itemVar:Q,indexVar:q}}let Y=$.match(/^(\([^)]+\)|\w+(?:\s*,\s*\w+)?)\s+(?:in|of)\s+([\s\S]+)$/);if(Y){let J=Y[1].trim(),G=Y[2].trim(),{itemVar:Q,indexVar:q}=FY(J);if(Q)return{style:"in",iterable:G,itemVar:Q,indexVar:q}}return{style:"unknown",iterable:null,itemVar:null,indexVar:null}}function FY(X){let $=X.trim(),Z=$.match(/^(\w+)\s*=>\s*(\w+)$/);if(Z)return{itemVar:Z[2],indexVar:Z[1]};let Y=$.match(/^\(\s*(\w+)(?:\s*,\s*(\w+))?\s*\)$/);if(Y)return{itemVar:Y[1],indexVar:Y[2]||null};let J=$.match(/^(\w+)\s*,\s*(\w+)$/);if(J)return{itemVar:J[1],indexVar:J[2]};let G=$.match(/^(\w+)$/);if(G)return{itemVar:G[1],indexVar:null};return{itemVar:null,indexVar:null}}function Z8(X){return V2(X)}function Bw(X){let $=/@(if\s*\(|endif|elseif\s*\(|else\b)/g,Z=0,Y;while((Y=$.exec(X))!==null){let J=Y[1];if(J.startsWith("if"))Z++;else if(J==="endif")Z--;else if(Z===0)return!0}return!1}function _w(X){let $=new Set,Z=/<script\b(?![^>]*\bserver\b)(?![^>]*\bsrc\s*=)[^>]*>([\s\S]*?)<\/script>/gi,Y=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal)\s*(?:<[^>]*>)?\s*\(/g,J;while((J=Z.exec(X))!==null){let G=J[1],Q;while((Q=Y.exec(G))!==null)$.add(Q[1])}return $}function Hw(X){if(!/[:@]for\s*=/.test(X)&&!/\bx-for\s*=/.test(X))return[];let $=new RegExp(`<([a-zA-Z][\\w-]*)\\b(${d9})>`,"iy"),Z=/(?:^|\s)(?::for|@for|x-for)\s*=\s*(?:"([^"]*)"|'([^']*)')/i,Y=bX(X,(G,Q)=>{$.lastIndex=Q;let q=$.exec(G);if(!q||q.index!==Q||!Z.test(q[2]))return-1;return $.lastIndex}),J=[];for(let G of Y){$.lastIndex=0;let Q=$.exec(G.token);if(!Q)continue;let q=Q[2].match(Z),W=m9(q?.[1]??q?.[2]??""),K=[W.itemVar,W.indexVar].filter(Boolean);if(K.length===0)continue;let U=Q[1],w=/\/\s*>$/.test(G.token)||$8.has(U.toLowerCase())?G.end:MY(X,G.start,U,G.end);if(w!==-1)J.push({start:G.start,end:w,vars:new Set(K)})}return J}function Lw(X){return X.replace(/'(?:\\.|[^'\\])*'/g,"''").replace(/"(?:\\.|[^"\\])*"/g,'""').replace(/`(?:\\.|[^`\\])*`/g,"``")}function AY(X,$,Z,Y){if(!X)return!1;let J=Lw(X),G=!1,Q=!1,q=!1,W=/([a-zA-Z_$][\w$]*)/g,K;while((K=W.exec(J))!==null){let B=K[1];if(J.slice(0,K.index).trimEnd().endsWith("."))continue;if(VY.has(B))continue;if($.has(B)||Y?.has(B))G=!0;else if(Z&&B in Z)Q=!0}let U=/([a-zA-Z_$][\w$]*)(?:\.[a-zA-Z_$][\w$]*)*\s*\(\s*\)/g,z;while((z=U.exec(J))!==null){let B=z[1];if(J.slice(0,z.index).trimEnd().endsWith("."))continue;if(VY.has(B)||Z&&B in Z)continue;q=!0}return(G||q)&&!Q}function eX(X,$,Z){let Y=Z===void 0?` ${$}`:` ${$}="${Z.replace(/"/g,"&quot;")}"`,J=X.trim(),G=J.match(NY);if(G&&Ow(G[3],G[1])){let[,Q,q,W]=G;return`<${Q}${q}${Y}>${W}</${Q}>`}return`<template${Y}>${J}</template>`}function Ow(X,$){let Z=new RegExp(`<(/)?${$}(?=[\\s/>])`,"gi"),Y=0,J;while((J=Z.exec(X))!==null)if(J[1]){if(Y--,Y<0)return!1}else Y++;return!0}function l9(X,$){let Z=_w(X);function Y(J){let G=J,Q=Hw(J),q=(z)=>{let w=new Set;for(let B of Q)if(z>B.start&&z<B.end)for(let j of B.vars)w.add(j);return w},W=/@if\s*\(/g,K,U=[];while((K=W.exec(G))!==null){let z=K.index,w=z+K[0].length,B=1,j=w;while(j<G.length&&B>0){if(G[j]==="(")B++;else if(G[j]===")")B--;j++}if(B!==0)continue;let _=G.substring(w,j-1).trim(),H=j,L=1,O=H,F=/@(if\s*\(|endif)/g;F.lastIndex=H;let V;while((V=F.exec(G))!==null)if(V[1].startsWith("if"))L++;else if(V[1]==="endif"){if(L--,L===0){O=V.index+V[0].length;break}}if(L!==0)continue;let A=G.substring(H,O-6).trim(),R;if(Bw(A)){let N=C7(G.substring(z,O));if(N.length===0)continue;let T=N[0].branches.filter((I)=>I.type!=="else"),M=q(z);if(!(T.length>0&&T.every((I)=>AY(I.condition,Z,$,M))))continue;R=N[0].branches.map((I)=>{let S=Y(I.content);if(I.type==="elseif")return eX(S,"@else-if",I.condition??"");if(I.type==="else")return eX(S,"@else");return eX(S,"@if",I.condition??"")}).join(`
11840
+ `)}else{if(!AY(_,Z,$,q(z)))continue;R=eX(Y(A),"@if",_)}U.push({start:z,end:O,replacement:R}),W.lastIndex=O}for(let z=U.length-1;z>=0;z--){let{start:w,end:B,replacement:j}=U[z];G=G.substring(0,w)+j+G.substring(B)}return G}return Y(X)}function Fw(X){let $=X.trim();if($==="")return;if($==="true")return!0;if($==="false")return!1;if($==="null")return!1;if($==="undefined")return!1;if($==="NaN")return!1;if(/^-?\d+(?:\.\d+)?$/.test($)){let J=Number($);return J!==0&&!Number.isNaN(J)}let Z=$.match(/^'((?:\\.|[^'\\])*)'$/);if(Z)return Z[1].length>0;let Y=$.match(/^"((?:\\.|[^"\\])*)"$/);if(Y)return Y[1].length>0;return}function MY(X,$,Z,Y){if($8.has(Z.toLowerCase()))return Y;let J=Z.toLowerCase(),G=X.toLowerCase(),Q=X.length,q=1,W=Y;while(W<Q){let K=X.indexOf("<",W);if(K===-1)return-1;if(W=K,X.startsWith("<!--",W)){let B=X.indexOf("-->",W+4);if(B===-1)return-1;W=B+3;continue}let U=/^<(script|style)\b/i.exec(X.slice(W,W+8));if(U){let B=X.indexOf(">",W);if(B===-1)return-1;if(X[B-1]==="/"){W=B+1;continue}let j=G.indexOf(`</${U[1].toLowerCase()}`,W);if(j===-1)return-1;let _=X.indexOf(">",j);if(_===-1)return-1;W=_+1;continue}if(X[W+1]==="/"){let B=/^<\/([a-z][\w-]*)\s*>/i.exec(X.slice(W,W+64));if(!B){W++;continue}if(B[1].toLowerCase()===J){if(q--,W+=B[0].length,q===0)return W;continue}W+=B[0].length;continue}let z=/^<([a-z][\w-]*)\b/i.exec(X.slice(W,W+64));if(!z){W++;continue}let w=X.indexOf(">",W);if(w===-1)return-1;if(z[1].toLowerCase()===J){let B=X.slice(W,w+1);if(!(/\/\s*>$/.test(B)||$8.has(J)))q++}W=w+1}return-1}function Aw(X,$){let Z=$,Y=X.length;for(;;){while(Z<Y&&X[Z]!=="<")Z++;if(Z>=Y)return!1;if(X.startsWith("<!--",Z)){let Q=X.indexOf("-->",Z+4);if(Q===-1)return!1;Z=Q+3;continue}break}if(X[Z+1]==="/")return!1;let J=X.indexOf(">",Z);if(J===-1)return!1;let G=X.slice(Z,J+1);return Vw.test(G)}function c9(X){if(!X.includes(":if")&&!X.includes(":show")&&!X.includes("x-if")&&!X.includes("x-show")&&!X.includes("@if=")&&!X.includes("@show="))return X;let $=[],Z=/<(script|style)\b[^>]*>[\s\S]*?<\/\1\s*>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);let J=(z)=>$.some(([w,B])=>z>=w&&z<B),G=/<([a-zA-Z][\w-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*?)\s+(:if|:show|x-if|x-show|@if|@show)\s*=\s*"([^"]*)"((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)(\/?)>/g,Q=[],q;while((q=G.exec(X))!==null){if(J(q.index))continue;let[z,w,B,j,_,H,L]=q,O=Fw(_);if(O===void 0)continue;let F=q.index,V=F+z.length,N=!!L||/\/\s*>$/.test(z)||$8.has(w.toLowerCase())?V:MY(X,F,w,V);if(N===-1)continue;if((j===":if"||j==="x-if"||j==="@if")&&Aw(X,N)){G.lastIndex=V;continue}if(O===!0){let M=`<${w}${B}${H}${L}>`;Q.push({start:F,end:V,replacement:M});continue}Q.push({start:F,end:N,replacement:""}),G.lastIndex=N}if(Q.length===0)return X;Q.sort((z,w)=>z.start-w.start);let W=[],K=-1;for(let z of Q){if(z.start<K)continue;W.push(z),K=z.end}let U=X;for(let z=W.length-1;z>=0;z--){let{start:w,end:B,replacement:j}=W[z];U=U.substring(0,w)+j+U.substring(B)}return U}function p9(X,$){let Z=X,Y=/@(for|foreach)\s*\(/g,J,G=[],Q=[];while((J=Y.exec(Z))!==null){let q=J[1],W=J.index,K=W+J[0].length,U=1,z=K;while(z<Z.length&&U>0){if(Z[z]==="(")U++;else if(Z[z]===")")U--;z++}if(U!==0)continue;let w=Z.substring(K,z-1).trim(),B=z,j=m9(w),_=q==="for"?"@endfor":"@endforeach",H=1,L=B,O=q==="for"?new RegExp("@(for(?!each)\\s*\\(|endfor(?!each))","g"):new RegExp(`@(${q}\\s*\\(|end${q})`,"g");O.lastIndex=B;let F;while((F=O.exec(Z))!==null)if(F[1].startsWith(q))H++;else if(H--,H===0){L=F.index+F[0].length;break}if(H!==0)continue;let V=()=>{let T=[j.itemVar,j.indexVar].filter(Boolean);if(T.length)Q.push({start:W,end:L,vars:T})};if(j.iterable){let T=j.iterable.trim();if(T.startsWith("[")||T.startsWith("{")||T.startsWith("'")||T.startsWith('"')||T.startsWith("`")||/^-?\d/.test(T)){V();continue}let M=T.split(/[.[(]/)[0].trim(),k=$?M in $:!1,D=Q.some((I)=>W>I.start&&W<I.end&&I.vars.includes(M));if(M&&(k||D)){V();continue}}if(j.style==="as")w=j.indexVar?`(${j.itemVar}, ${j.indexVar}) in ${j.iterable}`:`${j.itemVar} in ${j.iterable}`;let A=Z.substring(B,L-_.length).trim(),R=A.match(NY),N;if(R){let[,T,M,k]=R;N=`<${T}${M} @for="${w}">${k}</${T}>`}else N=`<template @for="${w}">${A}</template>`;G.push({start:W,end:L,replacement:N})}for(let q=G.length-1;q>=0;q--){let{start:W,end:K,replacement:U}=G[q];Z=Z.substring(0,W)+U+Z.substring(K)}return Z}function Rw(X){let $=new Set,Z=[],Y=0,J=0,G=X.length,Q=(U)=>{let z=Y+1;while(z<G){let w=X[z];if(w==="\\"){z+=2;continue}if(w===U)return z+1;z++}return G},q=()=>{let U=Y+2;while(U<G&&X[U]!==`
11841
+ `)U++;return U},W=()=>{let U=Y+2;while(U<G-1){if(X[U]==="*"&&X[U+1]==="/")return U+2;U++}return G},K=(U)=>{let z=U,w=0;while(z<G){let B=X[z];if(B==="/"&&X[z+1]==="/"){let j=z+2;while(j<G&&X[j]!==`
11842
+ `)j++;z=j;continue}if(B==="/"&&X[z+1]==="*"){let j=z+2;while(j<G-1&&!(X[j]==="*"&&X[j+1]==="/"))j++;z=j+2;continue}if(B==='"'||B==="'"||B==="`"){let j=z+1;while(j<G){if(X[j]==="\\"){j+=2;continue}if(X[j]===B){j++;break}j++}z=j;continue}if(B==="("||B==="["||B==="{"){w++,z++;continue}if(B===")"||B==="]"||B==="}"){w--,z++;continue}if(B===";"&&w===0)return z+1;z++}return G};while(Y<G){let U=X[Y];if(U==="/"&&X[Y+1]==="/"){let z=q();Z.push(X.slice(Y,z)),Y=z;continue}if(U==="/"&&X[Y+1]==="*"){let z=W();Z.push(X.slice(Y,z)),Y=z;continue}if(U==='"'||U==="'"||U==="`"){let z=Q(U);Z.push(X.slice(Y,z)),Y=z;continue}if(U==="{"){J++,Z.push(U),Y++;continue}if(U==="}"){J--,Z.push(U),Y++;continue}if(J===0){let z=Y>0?X[Y-1]:"";if(z===""||/\s/.test(z)||z===";"||z==="}"||z==="{"){let B=X.slice(Y).match(/^(const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=/);if(B){let j=B[2],_=K(Y+B[0].length);if($.has(j)){Z.push(`/* stx: deduped const ${j} */`),Y=_;continue}$.add(j),Z.push(X.slice(Y,_)),Y=_;continue}}}Z.push(U),Y++}return Z.join("")}async function kY(X,$,Z){let Y=TY(X,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b/}),J=/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useStore|useLocalStorage|useSessionStorage|useCookie|useId|useReactiveProp|useFetch|useRef|useEventListener|useDebounce|useDebouncedValue|useThrottle|useInterval|useTimeout|useToggle|useCounter|useClickOutside|useFocus|useAsync|useColorMode|useDark|useMediaQuery|useScrollLock|usePreferredDark|usePreferredLight|usePreferredReducedMotion|usePreferredContrast|useWebSocket|useRoute|useSearchParams|onMount|onDestroy|defineProps|withDefaults|defineEmits|defineExpose|defineSlots|useOptimistic)\s*(?:<[^>]*>)?\s*\(/,G=[];for(let H of Y){let L=H.body;if(o1(H.attrs))L=s1(L);if(J.test(L))G.push({fullMatch:H.fullMatch,attrs:H.attrs,content:L})}if(G.length===0)return{output:X,setupCode:null};let Q=`__stx_setup_${Date.now()}_${jw++}`,{hasUserImports:q,bundleClientScript:W}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (R7(),A7))),K=[];for(let H=0;H<G.length;H++){let L=G[H].content;if(L=M5(L).code,q(L))L=await W(L,$||"",{projectRoot:process.cwd()});L=L.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(F,V)=>EY(V));let O=c0(L);K.push(`// \u2500\u2500 merged signal script #${H+1} \u2500\u2500
11843
+ ${O}`)}let U=K.join(`
11844
11844
 
11845
- `);W=Aw(W);let z=IY(W),w=z.split(",").map((H)=>H.trim()).filter(Boolean),B=kX(W,Z),j=`
11845
+ `);U=Rw(U);let z=IY(U),w=z.split(",").map((H)=>H.trim()).filter(Boolean),B=kX(U,Z),j=`
11846
11846
  <script data-stx-scoped>
11847
11847
  function ${Q}() {
11848
11848
  ${N5("const",w)}
11849
- ${T5(`${B}${W}`)}
11849
+ ${T5(`${B}${U}`)}
11850
11850
  return { ${z} };
11851
11851
  }
11852
11852
  window.__stx_latestSetup=${Q};
11853
11853
  if(window.stx)window.stx._latestSetup=${Q};
11854
- </script>`,_=X;for(let H of G)_=_.split(H.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${d9})>`),`<body$1 data-stx="${Q}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],O=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${d9})>`,"gi"),(L,F,V)=>{if(O||H.includes(F.toLowerCase()))return L;return O=!0,`<${F}${V} data-stx="${Q}">`})}return{output:_,setupCode:j}}function IY(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,q="",K=()=>{G++;let j=!1;while(G<Q){let _=$[G];if(_==="\\"){G+=2;continue}if(_==="["&&!j){j=!0,G++;continue}if(_==="]"&&j){j=!1,G++;continue}if(_==="/"&&!j){G++;while(G<Q&&/[gimsuyd]/.test($[G]))G++;return}if(_===`
11855
- `)return;G++}},U=()=>{if(!q)return!0;if(/[\w)\]]/.test(q))return!1;return!0},W=(j)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===j){G++;return}G++}},z=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let j=1;while(G<Q&&j>0)if($[G]==="{")j++,G++;else if($[G]==="}")j--,G++;else if($[G]==="'"||$[G]==='"')W($[G]);else if($[G]==="`")z();else G++;continue}G++}},w=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
11856
- `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},B=()=>{if(J!==0)return;let j=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(j){let F=j[2];if(!Y.has(F))Z.push(F),Y.add(F);return}let _=$.slice(G).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((F)=>{let V=F.trim();if(!V)return;let A=V.indexOf(":"),N=(A>=0?V.slice(A+1).trim():V).split(/[\s=]/)[0];if(N&&!Y.has(N))Z.push(N),Y.add(N)});return}let H=$.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((F)=>{let V=F.trim().replace(/^\.\.\./,"");if(!V)return;let A=V.split(/[\s=]/)[0];if(A&&!Y.has(A))Z.push(A),Y.add(A)});return}let O=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!Y.has(F))Z.push(F),Y.add(F);return}let L=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!Y.has(F))Z.push(F),Y.add(F)}};while(G<Q){if(w())continue;if($[G]==="'"||$[G]==='"'){W($[G]),q=$[G-1];continue}if($[G]==="`"){z(),q="`";continue}if($[G]==="/"&&$[G+1]!=="/"&&$[G+1]!=="*"&&U()){K(),q="/";continue}if($[G]==="{"){J++,q="{",G++;continue}if($[G]==="}"){J--,q="}",G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))B();if(!/\s/.test($[G]))q=$[G];G++}return Z.join(", ")}async function i9(X,$,Z,Y){if(!Z8(X))return X;let J=X;if($.skipSignalsRuntime)return J;let{output:G,setupCode:Q}=await kY(J,Z,Y);if(J=G,J=await aX(J,$),Q){let W=X8(J,/<\/head>/i),z=W===-1?X8(J,/<body[^>]*>/i):-1;if(W!==-1)J=`${J.slice(0,W)}${Q}
11857
- ${J.slice(W)}`;else if(z!==-1){let w=/<body[^>]*>/i.exec(J.slice(z))[0],B=z+w.length;J=`${J.slice(0,B)}
11854
+ </script>`,_=X;for(let H of G)_=_.split(H.fullMatch).join("");if(_.includes("<body"))_=_.replace(new RegExp(`<body(${d9})>`),`<body$1 data-stx="${Q}">`);else{let H=["script","style","html","head","meta","link","title","!doctype"],L=!1;_=_.replace(new RegExp(`<([a-zA-Z][a-zA-Z0-9-]*)\\b(${d9})>`,"gi"),(O,F,V)=>{if(L||H.includes(F.toLowerCase()))return O;return L=!0,`<${F}${V} data-stx="${Q}">`})}return{output:_,setupCode:j}}function IY(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,q="",W=()=>{G++;let j=!1;while(G<Q){let _=$[G];if(_==="\\"){G+=2;continue}if(_==="["&&!j){j=!0,G++;continue}if(_==="]"&&j){j=!1,G++;continue}if(_==="/"&&!j){G++;while(G<Q&&/[gimsuyd]/.test($[G]))G++;return}if(_===`
11855
+ `)return;G++}},K=()=>{if(!q)return!0;if(/[\w)\]]/.test(q))return!1;return!0},U=(j)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===j){G++;return}G++}},z=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let j=1;while(G<Q&&j>0)if($[G]==="{")j++,G++;else if($[G]==="}")j--,G++;else if($[G]==="'"||$[G]==='"')U($[G]);else if($[G]==="`")z();else G++;continue}G++}},w=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
11856
+ `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},B=()=>{if(J!==0)return;let j=$.slice(G).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*(?:[!:;,\n]|=(?!=)|$)/);if(j){let F=j[2];if(!Y.has(F))Z.push(F),Y.add(F);return}let _=$.slice(G).match(/^(?:const|let|var)\s+\{([^}]+)\}\s*=/);if(_){_[1].split(",").forEach((F)=>{let V=F.trim();if(!V)return;let A=V.indexOf(":"),N=(A>=0?V.slice(A+1).trim():V).split(/[\s=]/)[0];if(N&&!Y.has(N))Z.push(N),Y.add(N)});return}let H=$.slice(G).match(/^(?:const|let|var)\s+\[([^\]]+)\]\s*=/);if(H){H[1].split(",").forEach((F)=>{let V=F.trim().replace(/^\.\.\./,"");if(!V)return;let A=V.split(/[\s=]/)[0];if(A&&!Y.has(A))Z.push(A),Y.add(A)});return}let L=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(L){let F=L[1];if(!Y.has(F))Z.push(F),Y.add(F);return}let O=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(O){let F=O[1];if(!Y.has(F))Z.push(F),Y.add(F)}};while(G<Q){if(w())continue;if($[G]==="'"||$[G]==='"'){U($[G]),q=$[G-1];continue}if($[G]==="`"){z(),q="`";continue}if($[G]==="/"&&$[G+1]!=="/"&&$[G+1]!=="*"&&K()){W(),q="/";continue}if($[G]==="{"){J++,q="{",G++;continue}if($[G]==="}"){J--,q="}",G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))B();if(!/\s/.test($[G]))q=$[G];G++}return Z.join(", ")}async function i9(X,$,Z,Y){if(!Z8(X))return X;let J=X;if($.skipSignalsRuntime)return J;let{output:G,setupCode:Q}=await kY(J,Z,Y);if(J=G,J=await aX(J,$),Q){let U=X8(J,/<\/head>/i),z=U===-1?X8(J,/<body[^>]*>/i):-1;if(U!==-1)J=`${J.slice(0,U)}${Q}
11857
+ ${J.slice(U)}`;else if(z!==-1){let w=/<body[^>]*>/i.exec(J.slice(z))[0],B=z+w.length;J=`${J.slice(0,B)}
11858
11858
  ${Q}${J.slice(B)}`}else J=`${J}
11859
- ${Q}`}let K=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),U=K&&/data-stx/.test(K[1]);if(!Q&&!U&&K&&!/data-stx-auto/.test(K[1])){let W=/<body[^>]*>/i,z=X8(J,W);if(z!==-1){let w=J.slice(0,z),B=J.slice(z).replace(W,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=w+B}}return J}function X8(X,$){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec(X))!==null)Y.push([J.index,J.index+J[0].length]);let G=new RegExp($.source,$.flags.replace(/[gy]/g,"")),Q=0;while(Q<X.length){let q=G.exec(X.slice(Q));if(!q)return-1;let K=Q+q.index;if(!Y.some(([W,z])=>K>=W&&K<z))return K;Q=K+Math.max(q[0].length,1)}return-1}function EY(X){let $=[];for(let Z of X.split(",")){let Y=Z.trim();if(!Y||Y.startsWith("type "))continue;let J=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])$.push(`${J[2]} = ${J[1]}`)}if($.length===0)return RY;return`var ${$.join(", ")}; ${RY}`}var ww=0,d9=`(?:"[^"]*"|'[^']*'|[^>"'])*`,NY,VY,$8,Fw,RY="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var x7=E(()=>{I7();hX();e0();e$();H0();tX();k1();V7();NY=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;VY=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"]);$8=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Fw=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Rw from"fs";import h from"path";function Tw(X){let $=new WeakSet;try{let Z=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if($.has(Y))throw TypeError("Circular component input");if($.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(Z);let J={};for(let G of Object.keys(Y).sort())J[G]=Z(Y[G]);return J};return JSON.stringify(Z(X))}catch{return null}}function DY(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Mw(X){return/\bjs\b/.test(X)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(X)}function o1(X){return!Mw(X)}function _1(X){let $;try{$=JSON.stringify(X)}catch{return new Bun.Transpiler(X)}let Z=J8.get($);if(Z)return Z;if(J8.size>=16)J8.clear();let Y=new Bun.Transpiler(X);return J8.set($,Y),Y}function s1(X){try{let $=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");$=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];$=$.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let J=_1({loader:"ts",target:"browser",define:u0()}).transformSync($);for(let G=0;G<Z.length;G++)J=J.replace(`"__STX_EXPR_${G}__"`,Z[G]),J=J.replace(`'__STX_EXPR_${G}__'`,Z[G]);return J}catch($){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",$);return X}}function kw(X){let $=[],Z=new Set,Y=0,J=0,G=X.length,Q=(W)=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]===W){J++;return}J++}},q=()=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]==="`"){J++;return}if(X[J]==="$"&&X[J+1]==="{"){J+=2;let W=1;while(J<G&&W>0)if(X[J]==="{")W++,J++;else if(X[J]==="}")W--,J++;else if(X[J]==="'"||X[J]==='"')Q(X[J]);else if(X[J]==="`")q();else J++;continue}J++}},K=()=>{if(X[J]==="/"&&X[J+1]==="/"){while(J<G&&X[J]!==`
11860
- `)J++;return!0}if(X[J]==="/"&&X[J+1]==="*"){J+=2;while(J<G-1&&!(X[J]==="*"&&X[J+1]==="/"))J++;return J+=2,!0}return!1},U=()=>{if(Y!==0)return;let W=X.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(W){let j=W[2].split(",").map((_)=>{let H=_.trim().split(":");return H[H.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Z.has(_))$.push(_),Z.add(_);return}let z=X.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!Z.has(j))$.push(j),Z.add(j);return}let w=X.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(w){let j=w[1];if(!Z.has(j))$.push(j),Z.add(j);return}let B=X.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Z.has(j))$.push(j),Z.add(j)}};while(J<G){if(K())continue;if(X[J]==="'"||X[J]==='"'){Q(X[J]);continue}if(X[J]==="`"){q();continue}if(X[J]==="{"){Y++,J++;continue}if(X[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test(X[J])&&(J===0||/\s|[;{}()]/.test(X[J-1])))U();J++}return $}function Iw(X){let $=[],Z=0,Y=0,J=null;for(let G=0;G<X.length;G++){let Q=X[G];if(J){if(Q==="\\"){G++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)$.push(X.slice(Y,G)),Y=G+1}if(Y<X.length)$.push(X.slice(Y));return $}function Ew(X){let $=0,Z=null;for(let Y=0;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}if(J==="("||J==="["||J==="{")$++;else if(J===")"||J==="]"||J==="}")$--;else if(J==="="&&$===0){let G=X[Y-1],Q=X[Y+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return Y}}return-1}function Dw(X,$){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(X);if(!Z)return;let Y=Z.index-1;while(Y>=0&&/\s/.test(X[Y]))Y--;if(X[Y]!=="}")return;let J=Y,G=0,Q=-1;for(;Y>=0;Y--){let K=X[Y];if(K==="}")G++;else if(K==="{"){if(G--,G===0){Q=Y;break}}}if(Q===-1)return;let q=X.slice(Q+1,J);for(let K of Iw(q)){let U=K.trim();if(!U||U.startsWith("..."))continue;let W=Ew(U);if(W===-1)continue;let z=U.slice(0,W).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if($[z]!==void 0)continue;let w=U.slice(W+1).trim();if(!w)continue;try{let B=Object.keys($),j=Function(...B,`"use strict"; return (${w});`);$[z]=j(...B.map((_)=>$[_]))}catch{}}}catch{}}async function q8(X,$,Z,Y,J){let G=X.endsWith(".stx")?X.slice(0,-4):X,Q=(H)=>H.split("-").map((O)=>O.charAt(0).toUpperCase()+O.slice(1)).join(""),q=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),K=Z.__importedComponents;if(K){for(let H of[G,G.toLowerCase(),Q(G),q(G)])if(K.has(H))return!0}let U=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${q(G)}.stx`])],W=typeof J.root==="string"?h.resolve(J.root):void 0,z=W??h.dirname(Y),w=[],B=(H)=>{if(H&&!w.includes(H))w.push(H)},j=Z.__originalFilePath;if(j)B(h.join(h.dirname(j),"components"));B($),B(J._rootComponentsDir),B(h.join(h.dirname(Y),"components")),B(J.componentsDir);let _=J._pluginComponentDirs;if(Array.isArray(_))for(let H of _)B(typeof H==="string"?H:null);if(W)B(h.resolve(W,"resources/views/components")),B(h.resolve(W,"resources/components")),B(h.resolve(W,"src/components")),B(h.resolve(W,"components"));if(G.startsWith("./")||G.startsWith("../"))return p(h.resolve(h.dirname(Y),`${G}.stx`));for(let H of w){let O=h.isAbsolute(H)?H:h.resolve(z,H);for(let L of U)if(await p(h.join(O,L)))return!0}return!1}function yw(X){return X==="visible"||X==="idle"||X==="interaction"||X.startsWith("media:")}function bw(X){if(!X)return!1;let $=X.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test($)}function Sw(X){let $=new Set,Z=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let Y of X){let J;while((J=Z.exec(Y))!==null)$.add(J[1]);Z.lastIndex=0}return[...$]}async function Y5(X,$,Z,Y,J,G,Q,q=new Set,K){let{extractVariables:U}=await X0("stx/variable-extractor",()=>Promise.resolve().then(() => (S7(),fX))),W=q??new Set;if(W.has(X))return`[Circular component reference: ${X}]`;let z=new Set(W);z.add(X);let w=typeof $.client==="string"?$.client.trim():"";if("client"in $)delete $.client;let B=w&&w!=="load"&&yw(w)?w:"";try{let j=(v)=>v.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),_=(v)=>v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=X.endsWith(".stx")?X.slice(0,-4):X,O=null,L=J.__importedComponents;if(L){let v=[H,H.toLowerCase(),j(H),_(H)];for(let d of v)if(L.has(d)){O=L.get(d);break}}let F=[];if(!O){let v=[`${H}.stx`,`${j(H)}.stx`,`${_(H)}.stx`],d=[...new Set(v)],U0=J.__originalFilePath,$0=[];if(U0){let w0=h.join(h.dirname(U0),"components");$0.push(w0)}if(Y)$0.push(Y);let F0=Q._rootComponentsDir;if(typeof F0==="string"&&!$0.includes(F0))$0.push(F0);let V0=h.join(h.dirname(G),"components");if(!$0.includes(V0))$0.push(V0);if(Q.componentsDir&&Q.componentsDir!==Y&&!$0.includes(Q.componentsDir))$0.push(Q.componentsDir);let A1=Q._pluginComponentDirs;if(Array.isArray(A1)){for(let w0 of A1)if(typeof w0==="string"&&!$0.includes(w0))$0.push(w0)}let h0=typeof Q.root==="string"?h.resolve(Q.root):void 0,C0=h0??h.dirname(G),Z1=[];if(h0)Z1.push(h.resolve(h0,"resources/views/components")),Z1.push(h.resolve(h0,"resources/components")),Z1.push(h.resolve(h0,"src/components")),Z1.push(h.resolve(h0,"components"));Z1.push(h.resolve(import.meta.dir,"components"));for(let w0 of Z1)if(!$0.includes(w0))$0.push(w0);let m1=[...new Set($0.map((w0)=>{if(!w0)return w0;return h.isAbsolute(w0)?w0:h.resolve(C0,w0)}))];$0.length=0,$0.push(...m1);let t=`${H}\x00${G}\x00${m1.join("\x00")}`,t0=Q8.get(t);if(t0)if(await p(t0))O=t0;else Q8.delete(t);if(!O&&(H.startsWith("./")||H.startsWith("../")))O=h.resolve(h.dirname(G),`${H}.stx`),F.push(O);else if(!O)for(let w0 of $0){if(!w0)continue;for(let l1 of d){let c1=h.join(w0,l1);if(F.push(c1),await p(c1)){O=c1;break}}if(O)break;if(!O)try{let l1=await import("fs");if(!l1.statSync(w0,{throwIfNoEntry:!1})?.isDirectory())continue;let YX=8,H5=[{path:w0,depth:0}];while(H5.length>0&&!O){let W1=H5.pop();if(W1.depth>=YX)continue;let JX;try{JX=l1.readdirSync(W1.path,{withFileTypes:!0})}catch{continue}for(let GX of JX){if(!GX.isDirectory())continue;if(GX.name==="node_modules"||GX.name.startsWith("."))continue;let Q6=h.join(W1.path,GX.name);for(let sK of d){let F$=h.join(Q6,sK);if(F.push(F$),await p(F$)){O=F$;break}}if(O)break;H5.push({path:Q6,depth:W1.depth+1})}}}catch{}if(O)break}if(O)Q8.set(t,O)}if(!O||!await p(O)){let v=F.length>0?`
11859
+ ${Q}`}let W=J.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").match(/<body([^>]*)>/i),K=W&&/data-stx/.test(W[1]);if(!Q&&!K&&W&&!/data-stx-auto/.test(W[1])){let U=/<body[^>]*>/i,z=X8(J,U);if(z!==-1){let w=J.slice(0,z),B=J.slice(z).replace(U,(j)=>j.replace(/^<body([^>]*)>$/i,"<body$1 data-stx-auto>"));J=w+B}}return J}function X8(X,$){let Z=/<(script|style)\b[\s\S]*?<\/\1>/gi,Y=[],J;while((J=Z.exec(X))!==null)Y.push([J.index,J.index+J[0].length]);let G=new RegExp($.source,$.flags.replace(/[gy]/g,"")),Q=0;while(Q<X.length){let q=G.exec(X.slice(Q));if(!q)return-1;let W=Q+q.index;if(!Y.some(([U,z])=>W>=U&&W<z))return W;Q=W+Math.max(q[0].length,1)}return-1}function EY(X){let $=[];for(let Z of X.split(",")){let Y=Z.trim();if(!Y||Y.startsWith("type "))continue;let J=Y.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(J&&J[1]!==J[2])$.push(`${J[2]} = ${J[1]}`)}if($.length===0)return RY;return`var ${$.join(", ")}; ${RY}`}var jw=0,d9=`(?:"[^"]*"|'[^']*'|[^>"'])*`,NY,VY,$8,Vw,RY="/* [stx import stripped, resolved via window.stx in __stx_setup] */";var x7=E(()=>{I7();hX();e0();e$();H0();tX();k1();V7();NY=/^<([a-zA-Z][a-zA-Z0-9-]*)\b((?:\s+[^=\s>]+(?:=(?:"[^"]*"|'[^']*'|[^\s>]*))?)*\s*)>([\s\S]*)<\/\1>$/s;VY=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"]);$8=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);Vw=/\s(?::else-if|x-else-if|@else-if|:else|x-else|@else)(?=[=\s/>])/});import Nw from"fs";import h from"path";function Mw(X){let $=new WeakSet;try{let Z=(Y)=>{if(Y===void 0)return{__stxType:"undefined"};if(typeof Y==="bigint")return{__stxType:"bigint",value:Y.toString()};if(typeof Y==="function"||typeof Y==="symbol")throw TypeError("Non-serializable component input");if(Y===null||typeof Y!=="object")return Y;if($.has(Y))throw TypeError("Circular component input");if($.add(Y),Y instanceof Date)return{__stxType:"date",value:Y.toISOString()};if(Array.isArray(Y))return Y.map(Z);let J={};for(let G of Object.keys(Y).sort())J[G]=Z(Y[G]);return J};return JSON.stringify(Z(X))}catch{return null}}function DY(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function kw(X){return/\bjs\b/.test(X)||/\blang\s*=\s*["']?(js|javascript)["']?/i.test(X)}function o1(X){return!kw(X)}function _1(X){let $;try{$=JSON.stringify(X)}catch{return new Bun.Transpiler(X)}let Z=J8.get($);if(Z)return Z;if(J8.size>=16)J8.clear();let Y=new Bun.Transpiler(X);return J8.set($,Y),Y}function s1(X){try{let $=X.replace(/^\s*import\s+\w+\s+from\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");$=$.replace(/^\s*import\s+['"][^'"]*\.stx['"]\s*;?\s*$/gm,"");let Z=[];$=$.replace(/\{!![\s\S]*?!!\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{\{[\s\S]*?\}\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`}),$=$.replace(/\{\{[\s\S]*?\}\}/g,(G)=>{let Q=Z.length;return Z.push(G),`"__STX_EXPR_${Q}__"`});let J=_1({loader:"ts",target:"browser",define:u0()}).transformSync($);for(let G=0;G<Z.length;G++)J=J.replace(`"__STX_EXPR_${G}__"`,Z[G]),J=J.replace(`'__STX_EXPR_${G}__'`,Z[G]);return J}catch($){if(process.env.STX_DEBUG_TS)console.warn("[STX] TypeScript transpilation error:",$);return X}}function Iw(X){let $=[],Z=new Set,Y=0,J=0,G=X.length,Q=(U)=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]===U){J++;return}J++}},q=()=>{J++;while(J<G){if(X[J]==="\\"){J+=2;continue}if(X[J]==="`"){J++;return}if(X[J]==="$"&&X[J+1]==="{"){J+=2;let U=1;while(J<G&&U>0)if(X[J]==="{")U++,J++;else if(X[J]==="}")U--,J++;else if(X[J]==="'"||X[J]==='"')Q(X[J]);else if(X[J]==="`")q();else J++;continue}J++}},W=()=>{if(X[J]==="/"&&X[J+1]==="/"){while(J<G&&X[J]!==`
11860
+ `)J++;return!0}if(X[J]==="/"&&X[J+1]==="*"){J+=2;while(J<G-1&&!(X[J]==="*"&&X[J+1]==="/"))J++;return J+=2,!0}return!1},K=()=>{if(Y!==0)return;let U=X.slice(J).match(/^(const|let|var)\s*\{([^}]+)\}\s*=/);if(U){let j=U[2].split(",").map((_)=>{let H=_.trim().split(":");return H[H.length-1].trim()});for(let _ of j)if(_&&/^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(_)&&!Z.has(_))$.push(_),Z.add(_);return}let z=X.slice(J).match(/^(const|let|var)\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*=/);if(z){let j=z[2];if(!Z.has(j))$.push(j),Z.add(j);return}let w=X.slice(J).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(w){let j=w[1];if(!Z.has(j))$.push(j),Z.add(j);return}let B=X.slice(J).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Z.has(j))$.push(j),Z.add(j)}};while(J<G){if(W())continue;if(X[J]==="'"||X[J]==='"'){Q(X[J]);continue}if(X[J]==="`"){q();continue}if(X[J]==="{"){Y++,J++;continue}if(X[J]==="}"){Y--,J++;continue}if(Y===0&&/[a-z]/i.test(X[J])&&(J===0||/\s|[;{}()]/.test(X[J-1])))K();J++}return $}function Ew(X){let $=[],Z=0,Y=0,J=null;for(let G=0;G<X.length;G++){let Q=X[G];if(J){if(Q==="\\"){G++;continue}if(Q===J)J=null;continue}if(Q==='"'||Q==="'"||Q==="`"){J=Q;continue}if(Q==="("||Q==="["||Q==="{")Z++;else if(Q===")"||Q==="]"||Q==="}")Z--;else if(Q===","&&Z===0)$.push(X.slice(Y,G)),Y=G+1}if(Y<X.length)$.push(X.slice(Y));return $}function Dw(X){let $=0,Z=null;for(let Y=0;Y<X.length;Y++){let J=X[Y];if(Z){if(J==="\\"){Y++;continue}if(J===Z)Z=null;continue}if(J==='"'||J==="'"||J==="`"){Z=J;continue}if(J==="("||J==="["||J==="{")$++;else if(J===")"||J==="]"||J==="}")$--;else if(J==="="&&$===0){let G=X[Y-1],Q=X[Y+1];if(G==="!"||G==="<"||G===">"||G==="=")continue;if(Q==="="||Q===">")continue;return Y}}return-1}function yw(X,$){try{let Z=/=\s*(?:withDefaults\s*\([\s\S]*?defineProps|defineProps)\b/.exec(X);if(!Z)return;let Y=Z.index-1;while(Y>=0&&/\s/.test(X[Y]))Y--;if(X[Y]!=="}")return;let J=Y,G=0,Q=-1;for(;Y>=0;Y--){let W=X[Y];if(W==="}")G++;else if(W==="{"){if(G--,G===0){Q=Y;break}}}if(Q===-1)return;let q=X.slice(Q+1,J);for(let W of Ew(q)){let K=W.trim();if(!K||K.startsWith("..."))continue;let U=Dw(K);if(U===-1)continue;let z=K.slice(0,U).trim();if(!/^[A-Z_$][\w$]*$/i.test(z))continue;if($[z]!==void 0)continue;let w=K.slice(U+1).trim();if(!w)continue;try{let B=Object.keys($),j=Function(...B,`"use strict"; return (${w});`);$[z]=j(...B.map((_)=>$[_]))}catch{}}}catch{}}async function q8(X,$,Z,Y,J){let G=X.endsWith(".stx")?X.slice(0,-4):X,Q=(H)=>H.split("-").map((L)=>L.charAt(0).toUpperCase()+L.slice(1)).join(""),q=(H)=>H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),W=Z.__importedComponents;if(W){for(let H of[G,G.toLowerCase(),Q(G),q(G)])if(W.has(H))return!0}let K=[...new Set([`${G}.stx`,`${Q(G)}.stx`,`${q(G)}.stx`])],U=typeof J.root==="string"?h.resolve(J.root):void 0,z=U??h.dirname(Y),w=[],B=(H)=>{if(H&&!w.includes(H))w.push(H)},j=Z.__originalFilePath;if(j)B(h.join(h.dirname(j),"components"));B($),B(J._rootComponentsDir),B(h.join(h.dirname(Y),"components")),B(J.componentsDir);let _=J._pluginComponentDirs;if(Array.isArray(_))for(let H of _)B(typeof H==="string"?H:null);if(U)B(h.resolve(U,"resources/views/components")),B(h.resolve(U,"resources/components")),B(h.resolve(U,"src/components")),B(h.resolve(U,"components"));if(G.startsWith("./")||G.startsWith("../"))return t(h.resolve(h.dirname(Y),`${G}.stx`));for(let H of w){let L=h.isAbsolute(H)?H:h.resolve(z,H);for(let O of K)if(await t(h.join(L,O)))return!0}return!1}function bw(X){return X==="visible"||X==="idle"||X==="interaction"||X.startsWith("media:")}function Sw(X){if(!X)return!1;let $=X.replace(/<script[\s\S]*?<\/script>/gi,"").replace(/<style[\s\S]*?<\/style>/gi,"");return/\{\{[\s\S]*?\}\}|\{!![\s\S]*?!!\}/.test($)}function Cw(X){let $=new Set,Z=/\b(?:const|let|var)\s+([a-zA-Z_$][\w$]*)\s*=\s*(?:state|derived|computed|ref|reactive|signal|useReactiveProp|useLocalStorage|useSessionStorage|useCookie|useDebouncedValue)\s*(?:<[^>]*>)?\s*\(/g;for(let Y of X){let J;while((J=Z.exec(Y))!==null)$.add(J[1]);Z.lastIndex=0}return[...$]}async function Y5(X,$,Z,Y,J,G,Q,q=new Set,W){let{extractVariables:K}=await X0("stx/variable-extractor",()=>Promise.resolve().then(() => (S7(),fX))),U=q??new Set;if(U.has(X))return`[Circular component reference: ${X}]`;let z=new Set(U);z.add(X);let w=typeof $.client==="string"?$.client.trim():"";if("client"in $)delete $.client;let B=w&&w!=="load"&&bw(w)?w:"";try{let j=(v)=>v.split("-").map((d)=>d.charAt(0).toUpperCase()+d.slice(1)).join(""),_=(v)=>v.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),H=X.endsWith(".stx")?X.slice(0,-4):X,L=null,O=J.__importedComponents;if(O){let v=[H,H.toLowerCase(),j(H),_(H)];for(let d of v)if(O.has(d)){L=O.get(d);break}}let F=[];if(!L){let v=[`${H}.stx`,`${j(H)}.stx`,`${_(H)}.stx`],d=[...new Set(v)],K0=J.__originalFilePath,$0=[];if(K0){let w0=h.join(h.dirname(K0),"components");$0.push(w0)}if(Y)$0.push(Y);let F0=Q._rootComponentsDir;if(typeof F0==="string"&&!$0.includes(F0))$0.push(F0);let V0=h.join(h.dirname(G),"components");if(!$0.includes(V0))$0.push(V0);if(Q.componentsDir&&Q.componentsDir!==Y&&!$0.includes(Q.componentsDir))$0.push(Q.componentsDir);let A1=Q._pluginComponentDirs;if(Array.isArray(A1)){for(let w0 of A1)if(typeof w0==="string"&&!$0.includes(w0))$0.push(w0)}let h0=typeof Q.root==="string"?h.resolve(Q.root):void 0,C0=h0??h.dirname(G),Z1=[];if(h0)Z1.push(h.resolve(h0,"resources/views/components")),Z1.push(h.resolve(h0,"resources/components")),Z1.push(h.resolve(h0,"src/components")),Z1.push(h.resolve(h0,"components"));Z1.push(h.resolve(import.meta.dir,"components"));for(let w0 of Z1)if(!$0.includes(w0))$0.push(w0);let m1=[...new Set($0.map((w0)=>{if(!w0)return w0;return h.isAbsolute(w0)?w0:h.resolve(C0,w0)}))];$0.length=0,$0.push(...m1);let a=`${H}\x00${G}\x00${m1.join("\x00")}`,t0=Q8.get(a);if(t0)if(await t(t0))L=t0;else Q8.delete(a);if(!L&&(H.startsWith("./")||H.startsWith("../")))L=h.resolve(h.dirname(G),`${H}.stx`),F.push(L);else if(!L)for(let w0 of $0){if(!w0)continue;for(let l1 of d){let c1=h.join(w0,l1);if(F.push(c1),await t(c1)){L=c1;break}}if(L)break;if(!L)try{let l1=await import("fs");if(!l1.statSync(w0,{throwIfNoEntry:!1})?.isDirectory())continue;let YX=8,H5=[{path:w0,depth:0}];while(H5.length>0&&!L){let U1=H5.pop();if(U1.depth>=YX)continue;let JX;try{JX=l1.readdirSync(U1.path,{withFileTypes:!0})}catch{continue}for(let GX of JX){if(!GX.isDirectory())continue;if(GX.name==="node_modules"||GX.name.startsWith("."))continue;let Q6=h.join(U1.path,GX.name);for(let sW of d){let F$=h.join(Q6,sW);if(F.push(F$),await t(F$)){L=F$;break}}if(L)break;H5.push({path:Q6,depth:U1.depth+1})}}}catch{}if(L)break}if(L)Q8.set(a,L)}if(!L||!await t(L)){let v=F.length>0?`
11861
11861
  Searched paths:
11862
11862
  ${F.map((d)=>` - ${d}`).join(`
11863
- `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${X}']${v}`}K.add(O);let V;if(G8.has(O))V=G8.get(O);else try{V=await Bun.file(O).text(),G8.set(O,V)}catch(v){return`[Error loading component: ${v instanceof Error?v.message:String(v)}]`}let A=new Set(["__originalFilePath","__importedComponents",IX,"__stx_client_signal_names"]),R={};for(let[v,d]of Object.entries(J))if(!v.startsWith("__")||A.has(v))R[v]=d;let N=J1(Z),T=[],M=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(v,d)=>{let U0=N.scripts[Number(d)]||"",$0=U0.match(/^<script\b([^>]*)>/i)?.[1]||"",F0=$0.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),V0=!F0||["module","text/javascript","application/javascript"].includes(F0);if(!/\bserver\b/i.test($0)&&V0)return T.push(U0),"";return U0}),{extractSlotContent:k}=await X0("stx/slots",()=>Promise.resolve().then(() => (A9(),V9))),D=k(M),I={};if(D.defaultSlot?.trim())I.default=D.defaultSlot;for(let[v,d]of D.namedSlots)I[v]=d.content;let S={...R,...$,props:$,slot:M,$slots:I,__processedComponents:z,__sections:{},__stx_signals_gate:B1(V)||bw(Z)};Dw(V,S);let b=V,y=PX(b);if(y)b=y.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x=[...V.matchAll(P)],f=[],c=x.some((v)=>/\bserver\b/.test(v[1]||"")&&/\bcache\b/.test(v[1]||""))&&x.every((v)=>/\bserver\b/.test(v[1]||"")),l=null,T0=null;if(c){let v=Tw({props:$,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(v!==null){l=`${O}\x00${v}`;let d=n9.get(l);if(d){for(let U0 of d.dependencies)K.add(U0);return d.output}T0=new Set(K)}}for(let v of x){let d=v[1]||"",U0=v[2]||"",$0=d.includes("server");if(o1(d)&&U0.trim())U0=s1(U0);if($0&&U0)try{await U(U0,S,O)}catch(V0){}if(!$0){let V0=U0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),A1=V0.includes("{{")&&V0.includes("}}"),h0=V0.includes("{!!")&&V0.includes("!!}");if(A1||h0)V0=SX(V0,S);let C0=d.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");f.push(`<script${C0}>${V0}</script>`)}}let x0=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),f0=x0?x0[1]:"",a0=x0?x0[2]:"",i="",E0=f0&&/\bscoped\b/i.test(f0);if(x0)i=`<style${f0}>${a0}</style>`;let z0=b;if(z0=z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),x0)z0=z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let v=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,d=[];if(z0=z0.replace(v,(U0,$0)=>{let F0=$0.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(F0)d.push(`<style${F0[1]}>${F0[2]}</style>`);return""}),z0=z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),d.length>0)i=`${i}${d.join(`
11864
- `)}`}if(Z&&z0.includes("{{ text || slot }}"))z0=z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:d1}=await X0("stx/slots",()=>Promise.resolve().then(() => (A9(),V9))),{defaultSlot:Z7,namedSlots:o}=D;z0=await d1(z0,Z7,o,S);let e=f.some((v)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(v)),K0=Sw(f),g0=Array.isArray(S.__stx_client_signal_names)?S.__stx_client_signal_names:[];if(K0.length>0||g0.length>0)S.__stx_client_signal_names=[...new Set([...g0,...K0])];let M0={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:h.dirname(O),skipSignalsRuntime:!0,skipEventDirectives:e||f.length===0,defaultLayout:void 0};S.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let C=await I0(z0,S,O,M0,K),g=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let v of C.matchAll(/\{\{([\s\S]*?)\}\}/g))g.add(v[1].trim());if(g.size>0)J.__stx_preserved_client_expressions=[...g];let a=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++Nw}_${Math.random().toString(36).slice(2,8)}`,m=C;if(e){let v="";if(Object.keys($).length>0)try{v=` data-stx-props="${DY(JSON.stringify($))}"`}catch{}let d=B?` stx-hydrate="${DY(B)}"`:"";m=`<div data-stx-scope="${a}"${v}${d}>${C}</div>`;let U0=await Promise.all(f.map(async($0)=>{let F0=$0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!F0)return $0;let[,V0,A1]=F0,h0=TX(A1,{filePath:O,projectRoot:process.cwd()}),C0=h0.code,Z1=MX(h0.styles);C0=M5(C0).code;let{hasUserImports:m1,bundleClientScript:t}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (R7(),A7)));if(m1(C0))C0=await t(C0,O,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:t0}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (x7(),Y8)));C0=C0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(W1,JX)=>t0(JX));let w0=c0(C0),l1=kw(w0),c1=`function(__scopeId) {
11863
+ `)}`:"";return`[Error loading component: ENOENT: no such file or directory, open '${X}']${v}`}W.add(L);let V;if(G8.has(L))V=G8.get(L);else try{V=await Bun.file(L).text(),G8.set(L,V)}catch(v){return`[Error loading component: ${v instanceof Error?v.message:String(v)}]`}let A=new Set(["__originalFilePath","__importedComponents",IX,"__stx_client_signal_names"]),R={};for(let[v,d]of Object.entries(J))if(!v.startsWith("__")||A.has(v))R[v]=d;let N=J1(Z),T=[],M=N.output.replace(/\x00STX_SCRIPT_(\d+)\x00/g,(v,d)=>{let K0=N.scripts[Number(d)]||"",$0=K0.match(/^<script\b([^>]*)>/i)?.[1]||"",F0=$0.match(/\btype\s*=\s*["']([^"']+)["']/i)?.[1]?.toLowerCase(),V0=!F0||["module","text/javascript","application/javascript"].includes(F0);if(!/\bserver\b/i.test($0)&&V0)return T.push(K0),"";return K0}),{extractSlotContent:k}=await X0("stx/slots",()=>Promise.resolve().then(() => (A9(),V9))),D=k(M),I={};if(D.defaultSlot?.trim())I.default=D.defaultSlot;for(let[v,d]of D.namedSlots)I[v]=d.content;let S={...R,...$,props:$,slot:M,$slots:I,__processedComponents:z,__sections:{},__stx_signals_gate:B1(V)||Sw(Z)};yw(V,S);let b=V,y=PX(b);if(y)b=y.content.trim();let P=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,x=[...V.matchAll(P)],f=[],c=x.some((v)=>/\bserver\b/.test(v[1]||"")&&/\bcache\b/.test(v[1]||""))&&x.every((v)=>/\bserver\b/.test(v[1]||"")),l=null,T0=null;if(c){let v=Mw({props:$,slot:Z,buildMode:Q.buildMode??"",skipEventDirectives:Q.skipEventDirectives===!0});if(v!==null){l=`${L}\x00${v}`;let d=n9.get(l);if(d){for(let K0 of d.dependencies)W.add(K0);return d.output}T0=new Set(W)}}for(let v of x){let d=v[1]||"",K0=v[2]||"",$0=d.includes("server");if(o1(d)&&K0.trim())K0=s1(K0);if($0&&K0)try{await K(K0,S,L)}catch(V0){}if(!$0){let V0=K0.replace(/^\s*const\s*\{[^}]+\}\s*=\s*window\.stx\s*;?\s*\n?/gm,""),A1=V0.includes("{{")&&V0.includes("}}"),h0=V0.includes("{!!")&&V0.includes("!!}");if(A1||h0)V0=SX(V0,S);let C0=d.replace(/\s*\bts\b/g,"").replace(/\s*\blang\s*=\s*["']?(ts|typescript)["']?/gi,"");f.push(`<script${C0}>${V0}</script>`)}}let x0=V.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),f0=x0?x0[1]:"",a0=x0?x0[2]:"",p="",E0=f0&&/\bscoped\b/i.test(f0);if(x0)p=`<style${f0}>${a0}</style>`;let z0=b;if(z0=z0.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),x0)z0=z0.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");{let v=/@push\s*\(\s*['"]styles['"]\s*\)([\s\S]*?)@endpush/gi,d=[];if(z0=z0.replace(v,(K0,$0)=>{let F0=$0.match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i);if(F0)d.push(`<style${F0[1]}>${F0[2]}</style>`);return""}),z0=z0.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/gi,""),d.length>0)p=`${p}${d.join(`
11864
+ `)}`}if(Z&&z0.includes("{{ text || slot }}"))z0=z0.replace(/\{\{\s*text\s*\|\|\s*slot\s*\}\}/g,()=>Z);let{applySlots:d1}=await X0("stx/slots",()=>Promise.resolve().then(() => (A9(),V9))),{defaultSlot:Z7,namedSlots:r}=D;z0=await d1(z0,Z7,r,S);let e=f.some((v)=>/\b(?:state|derived|effect|ref|reactive|computed|watch|watchEffect|useReactiveProp|defineProps|withDefaults|defineEmits|defineExpose|defineSlots)\s*(?:<[^<>()]*>)?\s*\(/.test(v)),W0=Cw(f),g0=Array.isArray(S.__stx_client_signal_names)?S.__stx_client_signal_names:[];if(W0.length>0||g0.length>0)S.__stx_client_signal_names=[...new Set([...g0,...W0])];let M0={...Q,_rootComponentsDir:Q._rootComponentsDir||Q.componentsDir,componentsDir:h.dirname(L),skipSignalsRuntime:!0,skipEventDirectives:e||f.length===0,defaultLayout:void 0};S.__stxProcessingDepth=(J.__stxProcessingDepth||0)+1;let C=await I0(z0,S,L,M0,W),g=new Set(Array.isArray(J.__stx_preserved_client_expressions)?J.__stx_preserved_client_expressions:[]);for(let v of C.matchAll(/\{\{([\s\S]*?)\}\}/g))g.add(v[1].trim());if(g.size>0)J.__stx_preserved_client_expressions=[...g];let s=`stx_${H.replace(/[^a-zA-Z0-9]/g,"_")}_${++Tw}_${Math.random().toString(36).slice(2,8)}`,m=C;if(e){let v="";if(Object.keys($).length>0)try{v=` data-stx-props="${DY(JSON.stringify($))}"`}catch{}let d=B?` stx-hydrate="${DY(B)}"`:"";m=`<div data-stx-scope="${s}"${v}${d}>${C}</div>`;let K0=await Promise.all(f.map(async($0)=>{let F0=$0.match(/<script([^>]*)>([\s\S]*)<\/script>/i);if(!F0)return $0;let[,V0,A1]=F0,h0=TX(A1,{filePath:L,projectRoot:process.cwd()}),C0=h0.code,Z1=MX(h0.styles);C0=M5(C0).code;let{hasUserImports:m1,bundleClientScript:a}=await X0("stx/client-script-bundler",()=>Promise.resolve().then(() => (R7(),A7)));if(m1(C0))C0=await a(C0,L,{projectRoot:process.cwd(),minify:Q.buildMode==="compile"});let{rewriteStxImportSpecifiers:t0}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (x7(),Y8)));C0=C0.replace(/^\s*import\s+(?:type\s+)?\{([^}]*)\}\s+from\s+['"](?:stx|@stacksjs\/stx|@stacksjs\/browser)['"]\s*;?\s*$/gm,(U1,JX)=>t0(JX));let w0=c0(C0),l1=Iw(w0),c1=`function(__scopeId) {
11865
11865
  ${N5("const",[...F2,...l1],w0)}
11866
11866
  const __scope = window.stx._scopes = window.stx._scopes || {};
11867
11867
  const __scopeVars = __scope[__scopeId] = __scope[__scopeId] || {};
@@ -11881,7 +11881,7 @@ ${w0}
11881
11881
  // Register all defined signals and functions in this scope
11882
11882
  const __localVars = {};
11883
11883
  try {
11884
- ${l1.map((W1)=>`if (typeof ${W1} !== 'undefined') __localVars['${W1}'] = ${W1};`).join(`
11884
+ ${l1.map((U1)=>`if (typeof ${U1} !== 'undefined') __localVars['${U1}'] = ${U1};`).join(`
11885
11885
  `)}
11886
11886
  }
11887
11887
  catch (e) {}
@@ -11890,31 +11890,31 @@ catch (e) {}
11890
11890
  finally {
11891
11891
  window.__STX_CURRENT_ELEMENT__ = __previousCurrentElement;
11892
11892
  }
11893
- }`,YX=B?null:o2(J,c1),H5=YX?`window.__stxComponentFactories[${JSON.stringify(YX)}](${JSON.stringify(a)});`:`(${c1})(${JSON.stringify(a)});`;if(B)return`${Z1}<script type="stx/island" data-stx-island="${a}" data-stx-scoped${V0}>${H5}</script>`;return`${Z1}<script data-stx-scoped data-stx-run="always"${V0}>${H5}</script>`}));if(m=m+`
11894
- `+U0.join(`
11895
- `),i)m+=`
11896
- `+i}else{if(i)m+=`
11897
- `+i;if(f.length>0){let v=S.__stx_event_bindings||[],d=M7(S),U0=await Promise.all(f.map(async($0)=>{let F0=$0.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!F0)return $0;return await k7(F0[1],{eventBindings:v,templateContent:m,filePath:O,projectRoot:process.cwd(),serverData:d})}));m+=`
11898
- `+U0.join(`
11899
- `),S.__stx_event_bindings=[]}}if(E0){let v=CX(m,O);if(v.hasScoped)m=v.html}if(l&&T0)n9.set(l,{output:m,dependencies:[...K].filter((v)=>!T0.has(v))});return T.length>0?`${m}
11893
+ }`,YX=B?null:o2(J,c1),H5=YX?`window.__stxComponentFactories[${JSON.stringify(YX)}](${JSON.stringify(s)});`:`(${c1})(${JSON.stringify(s)});`;if(B)return`${Z1}<script type="stx/island" data-stx-island="${s}" data-stx-scoped${V0}>${H5}</script>`;return`${Z1}<script data-stx-scoped data-stx-run="always"${V0}>${H5}</script>`}));if(m=m+`
11894
+ `+K0.join(`
11895
+ `),p)m+=`
11896
+ `+p}else{if(p)m+=`
11897
+ `+p;if(f.length>0){let v=S.__stx_event_bindings||[],d=M7(S),K0=await Promise.all(f.map(async($0)=>{let F0=$0.match(/<script\b[^>]*>([\s\S]*?)<\/script>/);if(!F0)return $0;return await k7(F0[1],{eventBindings:v,templateContent:m,filePath:L,projectRoot:process.cwd(),serverData:d})}));m+=`
11898
+ `+K0.join(`
11899
+ `),S.__stx_event_bindings=[]}}if(E0){let v=CX(m,L);if(v.hasScoped)m=v.html}if(l&&T0)n9.set(l,{output:m,dependencies:[...W].filter((v)=>!T0.has(v))});return T.length>0?`${m}
11900
11900
  ${T.join(`
11901
- `)}`:m}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{W.delete(X)}}async function p(X){return Bun.file(X).exists()}function r9(X,$){let Z=h.resolve($),Y=h.resolve(X),J=Z.endsWith(h.sep)?Z:Z+h.sep;if(Y===Z||Y.startsWith(J))return Y;return null}async function o9(X,$,Z,Y){let J=await Cw(X,$,Z,Y);if(J===null)return null;let G=r9(J,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((q)=>typeof q==="string"&&q.length>0);for(let q of Q){let K=h.isAbsolute(q)?q:h.resolve(process.cwd(),q);if(r9(J,K))return h.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${X}, from: ${$})`),null}async function Cw(X,$,Z,Y){if(Z.debug)console.log(`Resolving template path: ${X} from ${$}`);let J=h.dirname($),G=process.cwd();if(X.startsWith("/")){let w=h.join(G,X),B=r9(w,G);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${X} (from ${$})`),null;if(Z.debug)console.log(`Checking absolute path: ${B}`);if(await p(B)&&Y)Y.add(B);return B}let Q=h.join(J,X);if(await p(Q)){if(Z.debug)console.log(`Found direct path: ${Q}`);if(Y)Y.add(Q);return Q}if(!X.endsWith(".stx")&&!X.endsWith(".jsx")&&!X.endsWith(".tsx"))for(let w of[".stx",".tsx",".jsx"]){let B=`${Q}${w}`;if(await p(B)){if(Z.debug)console.log(`Found direct path with extension: ${B}`);if(Y)Y.add(B);return B}}let q="",K=h.resolve(J),U=process.cwd();for(let w=0;w<10;w++){let B=h.join(K,"layouts"),j=!1;try{j=Rw.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){q=B;break}let _=h.dirname(K);if(_===K||_.length<U.length)break;K=_}if(q){let w=X.startsWith("layouts/")?X.slice(8):X,B=h.join(q,w);if(await p(B)){if(Z.debug)console.log(`Found in current layouts dir: ${B}`);if(Y)Y.add(B);return B}if(!w.endsWith(".stx")){let j=`${B}.stx`;if(await p(j)){if(Z.debug)console.log(`Found in current layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}if(Z.layoutsDir){let w=h.isAbsolute(Z.layoutsDir)?Z.layoutsDir:h.resolve(process.cwd(),Z.layoutsDir),B=X.startsWith("layouts/")?X.slice(8):X,j=h.join(w,B);if(await p(j)){if(Z.debug)console.log(`Found in options.layoutsDir: ${j}`);if(Y)Y.add(j);return j}if(!X.endsWith(".stx")){let _=`${j}.stx`;if(await p(_)){if(Z.debug)console.log(`Found in options.layoutsDir with extension: ${_}`);if(Y)Y.add(_);return _}}}if(X.startsWith("layouts/")||X.includes("/layouts/")){let w=X.split("layouts/"),B=h.join(Z.partialsDir||J,"layouts",w[1]);if(await p(B)){if(Z.debug)console.log(`Found in layouts path: ${B}`);if(Y)Y.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await p(j)){if(Z.debug)console.log(`Found in layouts path with extension: ${j}`);if(Y)Y.add(j);return j}}}if(Z.partialsDir){if(q=h.join(Z.partialsDir,"layouts"),await p(q)){let w=h.join(q,X);if(await p(w)){if(Z.debug)console.log(`Found in partials layouts dir: ${w}`);if(Y)Y.add(w);return w}if(!X.endsWith(".stx")){let B=`${w}.stx`;if(await p(B)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}}let W=Z.partialsDir||h.join(process.cwd(),"views"),z=h.join(W,X);if(await p(z)){if(Z.debug)console.log(`Found in views path: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let w=`${z}.stx`;if(await p(w)){if(Z.debug)console.log(`Found in views path with extension: ${w}`);if(Y)Y.add(w);return w}}if(J.includes("temp")){let w=h.join(h.dirname(J),"layouts",X);if(await p(w)){if(Z.debug)console.log(`Found in temp layouts dir: ${w}`);if(Y)Y.add(w);return w}if(!X.endsWith(".stx")){let B=`${w}.stx`;if(await p(B)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${X} (referenced from ${$})`);else console.warn(`Template not found: ${X} (referenced from ${$})`);return null}function yY(X,$,Z){let Y=0,J="",G="";try{if(typeof $==="number"&&$>=0){let Q=X.split(`
11902
- `),q=0;for(let K=0;K<Q.length;K++)if(q+=Q[K].length+1,q>=$){Y=K+1,J=Q[K].trim();let U=Math.max(0,K-2),W=Math.min(Q.length,K+3);G=Q.slice(U,W).map((z,w)=>{let B=U+w+1;return`${B===Y?"> ":" "}${B}: ${z}`}).join(`
11903
- `);break}}else if(Z){let Q=X.indexOf(Z);if(Q>=0)return yY(X,Q)}}catch{}return{lineNumber:Y,lineContent:J,context:G}}function j0(X,$,Z,Y,J,G){let{lineNumber:Q,context:q}=yY(Y,J,G),K=Z.split("/").pop(),U=0;if(typeof J==="number"&&J>=0&&Y){let z=Y.lastIndexOf(`
11904
- `,Math.max(0,J-1));U=J-(z+1)+1}let W="";if(Q>0)W+=`
11905
- ${Z}:${Q}${U>0?`:${U}`:""}: ${X.toLowerCase()} error: ${$}
11906
- `;if(W+=`
11901
+ `)}`:m}catch(j){return`[Error processing component: ${j instanceof Error?j.message:String(j)}]`}finally{U.delete(X)}}async function t(X){return Bun.file(X).exists()}function r9(X,$){let Z=h.resolve($),Y=h.resolve(X),J=Z.endsWith(h.sep)?Z:Z+h.sep;if(Y===Z||Y.startsWith(J))return Y;return null}async function Pw(X,$,Z,Y){let J=$.startsWith("layouts/")?$.slice(8):$,G=h.join(X,J);for(let Q of G.endsWith(".stx")?[G]:[G,`${G}.stx`])if(await t(Q)){if(Y)console.log(`Found layout in ${X}: ${Q}`);return Z?.add(Q),Q}return null}async function o9(X,$,Z,Y){let J=await vw(X,$,Z,Y);if(J===null)return null;let G=r9(J,process.cwd());if(G)return G;let Q=[Z.root,Z.layoutsDir,Z.componentsDir,Z.partialsDir,Z.pagesDir].filter((q)=>typeof q==="string"&&q.length>0);for(let q of Q){let W=h.isAbsolute(q)?q:h.resolve(process.cwd(),q);if(r9(J,W))return h.resolve(J)}return console.warn(`[stx] rejected resolved template path that escapes project root: ${J} (template: ${X}, from: ${$})`),null}async function vw(X,$,Z,Y){if(Z.debug)console.log(`Resolving template path: ${X} from ${$}`);let J=h.dirname($),G=process.cwd();if(X.startsWith("/")){let w=h.join(G,X),B=r9(w,G);if(!B)return console.warn(`[stx] rejected template path that escapes project root: ${X} (from ${$})`),null;if(Z.debug)console.log(`Checking absolute path: ${B}`);if(await t(B)&&Y)Y.add(B);return B}let Q=h.join(J,X);if(await t(Q)){if(Z.debug)console.log(`Found direct path: ${Q}`);if(Y)Y.add(Q);return Q}if(!X.endsWith(".stx")&&!X.endsWith(".jsx")&&!X.endsWith(".tsx"))for(let w of[".stx",".tsx",".jsx"]){let B=`${Q}${w}`;if(await t(B)){if(Z.debug)console.log(`Found direct path with extension: ${B}`);if(Y)Y.add(B);return B}}let q=[];if(Z.layoutsDir)q.push(h.isAbsolute(Z.layoutsDir)?Z.layoutsDir:h.resolve(process.cwd(),Z.layoutsDir));let W=h.resolve(J),K=process.cwd();for(let w=0;w<10;w++){let B=h.join(W,"layouts"),j=!1;try{j=Nw.statSync(B,{throwIfNoEntry:!1})?.isDirectory()??!1}catch{}if(j){q.push(B);break}let _=h.dirname(W);if(_===W||_.length<K.length)break;W=_}for(let w of q){let B=await Pw(w,X,Y,Z.debug);if(B)return B}if(X.startsWith("layouts/")||X.includes("/layouts/")){let w=X.split("layouts/"),B=h.join(Z.partialsDir||J,"layouts",w[1]);if(await t(B)){if(Z.debug)console.log(`Found in layouts path: ${B}`);if(Y)Y.add(B);return B}if(!B.endsWith(".stx")){let j=`${B}.stx`;if(await t(j)){if(Z.debug)console.log(`Found in layouts path with extension: ${j}`);if(Y)Y.add(j);return j}}}if(Z.partialsDir){let w=h.join(Z.partialsDir,"layouts");if(await t(w)){let B=h.join(w,X);if(await t(B)){if(Z.debug)console.log(`Found in partials layouts dir: ${B}`);if(Y)Y.add(B);return B}if(!X.endsWith(".stx")){let j=`${B}.stx`;if(await t(j)){if(Z.debug)console.log(`Found in partials layouts dir with extension: ${j}`);if(Y)Y.add(j);return j}}}}let U=Z.partialsDir||h.join(process.cwd(),"views"),z=h.join(U,X);if(await t(z)){if(Z.debug)console.log(`Found in views path: ${z}`);if(Y)Y.add(z);return z}if(!X.endsWith(".stx")){let w=`${z}.stx`;if(await t(w)){if(Z.debug)console.log(`Found in views path with extension: ${w}`);if(Y)Y.add(w);return w}}if(J.includes("temp")){let w=h.join(h.dirname(J),"layouts",X);if(await t(w)){if(Z.debug)console.log(`Found in temp layouts dir: ${w}`);if(Y)Y.add(w);return w}if(!X.endsWith(".stx")){let B=`${w}.stx`;if(await t(B)){if(Z.debug)console.log(`Found in temp layouts dir with extension: ${B}`);if(Y)Y.add(B);return B}}}if(Z.debug)console.warn(`Template not found after trying all paths: ${X} (referenced from ${$})`);else console.warn(`Template not found: ${X} (referenced from ${$})`);return null}function yY(X,$,Z){let Y=0,J="",G="";try{if(typeof $==="number"&&$>=0){let Q=X.split(`
11902
+ `),q=0;for(let W=0;W<Q.length;W++)if(q+=Q[W].length+1,q>=$){Y=W+1,J=Q[W].trim();let K=Math.max(0,W-2),U=Math.min(Q.length,W+3);G=Q.slice(K,U).map((z,w)=>{let B=K+w+1;return`${B===Y?"> ":" "}${B}: ${z}`}).join(`
11903
+ `);break}}else if(Z){let Q=X.indexOf(Z);if(Q>=0)return yY(X,Q)}}catch{}return{lineNumber:Y,lineContent:J,context:G}}function j0(X,$,Z,Y,J,G){let{lineNumber:Q,context:q}=yY(Y,J,G),W=Z.split("/").pop(),K=0;if(typeof J==="number"&&J>=0&&Y){let z=Y.lastIndexOf(`
11904
+ `,Math.max(0,J-1));K=J-(z+1)+1}let U="";if(Q>0)U+=`
11905
+ ${Z}:${Q}${K>0?`:${K}`:""}: ${X.toLowerCase()} error: ${$}
11906
+ `;if(U+=`
11907
11907
  ${Z0.bold}${Z0.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${Z0.reset}
11908
- `,W+=`${Z0.bold}${Z0.red}\u2502${Z0.reset} ${Z0.bold}${Z0.bgRed} ERROR ${Z0.reset} ${Z0.red}${X} Error${Z0.reset}${" ".repeat(Math.max(0,43-X.length))}${Z0.bold}${Z0.red}\u2502${Z0.reset}
11909
- `,W+=`${Z0.bold}${Z0.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${Z0.reset}
11910
- `,W+=`
11911
- ${Z0.cyan}${Z0.bold}File:${Z0.reset} ${Z0.dim}${K}${Z0.reset}`,Q>0)W+=` ${Z0.gray}(line ${Q}${U>0?`, col ${U}`:""})${Z0.reset}`;if(W+=`
11908
+ `,U+=`${Z0.bold}${Z0.red}\u2502${Z0.reset} ${Z0.bold}${Z0.bgRed} ERROR ${Z0.reset} ${Z0.red}${X} Error${Z0.reset}${" ".repeat(Math.max(0,43-X.length))}${Z0.bold}${Z0.red}\u2502${Z0.reset}
11909
+ `,U+=`${Z0.bold}${Z0.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${Z0.reset}
11910
+ `,U+=`
11911
+ ${Z0.cyan}${Z0.bold}File:${Z0.reset} ${Z0.dim}${W}${Z0.reset}`,Q>0)U+=` ${Z0.gray}(line ${Q}${K>0?`, col ${K}`:""})${Z0.reset}`;if(U+=`
11912
11912
  ${Z0.yellow}${Z0.bold}Message:${Z0.reset} ${$}
11913
- `,q)W+=`
11913
+ `,q)U+=`
11914
11914
  ${Z0.blue}${Z0.bold}Context:${Z0.reset}
11915
11915
  ${Z0.dim}${q}${Z0.reset}
11916
- `;return W}function BY(){G8.clear(),Q8.clear(),n9.clear()}var G8,Q8,n9,Nw=0,J8,Z0;var H0=E(()=>{I7();Q9();Q1();e0();y5();K8();N1();w9();j9();V7();k1();TZ();S7();G8=new a1(500),Q8=new a1(1000),n9=new a1(2000);J8=new Map;Z0={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 bY(X,$,Z=""){let Y=X,J=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec(X))!==null){let q=Q.index,K=Q[0].match(/@markdown\(([^)]*)\)/),U=K?K[1]:"",W=q+Q[0].length,z=1,w=W,B=-1;while(z>0&&w<X.length){let H=X.indexOf("@markdown",w),O=X.indexOf("@endmarkdown",w);if(O===-1)break;if(H!==-1&&H<O&&H!==q){let L=X[H+9];if(L==="("||L===`
11917
- `||L==="\r"||L===" "||L===void 0)z++;w=H+9}else{if(z--,z===0){B=O;break}w=O+12}}if(B===-1)continue;let j=X.slice(W,B),_=X.slice(q,B+12);J.push({fullMatch:_,options:U,content:j,index:q}),G.lastIndex=B+12}for(let{fullMatch:q,options:K,content:U,index:W}of J)try{let z={};if(K)K.split(",").forEach((j)=>{let _=j.trim();if(_)z[_]=!0});let w={gfm:z.gfm??!0,breaks:z.breaks??!1},B=F7(U.trim(),w);Y=Y.split(q).join(B)}catch(z){let w=z instanceof Error?z.message:String(z),B=j0("Markdown Directive",`Error processing markdown: ${w}`,Z,X,W,q);Y=Y.split(q).join(B)}return Y}async function SY(X,$,Z,Y){let J={gfm:!0,breaks:!1};return $.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")J.breaks=!0;if(Q==="no-gfm")J.gfm=!1}),F7(X.trim(),J)}var s9=E(()=>{H0()});function xw(X){if(Pw.set(X.name,X),X.client)vw.set(X.name,X.client)}function U8(X){return xw(X),{name:X.name,hasEndTag:X.hasEndTag??!0,description:X.description,handler:async(Z,Y,J,G)=>{let Q=fw(Y,X.defaults);if(X.validate){let K=X.validate(Q);if(K!==!0){let U=typeof K==="string"?K:`Invalid parameters for @${X.name}`;throw Error(U)}}let q=Z;if(X.transform)q=await X.transform(Z,Q,J,G);if(X.clientScript){let K=X.clientScript(Q);q+=`<script>${K}</script>`}if(X.css){let K=X.css(Q);q+=`<style>${K}</style>`}return q}}}function fw(X,$){let Z={...$};for(let Y of X){let J=Y.indexOf(":"),G=Y.indexOf("="),Q=J>=0&&(G<0||J<G)?J:G;if(Q>=0){let q=Y.slice(0,Q).trim(),K=Y.slice(Q+1).trim();if(K==="true")K=!0;else if(K==="false")K=!1;else if(K==="null")K=null;else if(!Number.isNaN(Number(K)))K=Number(K);else if(typeof K==="string"&&K.startsWith("{"))try{K=JSON.parse(K)}catch{}Z[q]=K}else{let q=Object.keys(Z).filter((K)=>!$||!(K in $)).length;Z[q===0?"value":`arg${q}`]=Y}}return Z}var Pw,vw;var a9=E(()=>{Pw=new Map,vw=new Map});function t9(X,$=P5,Z={},Y){return $.sort((J,G)=>J-G).map((J)=>{return`${g7(X,{...Z,w:J,fm:Y})} ${J}w`}).join(", ")}function CY(X,$,Z=gw,Y={},J){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round($*G);return`${g7(X,{...Y,w:Q,dpr:G,fm:J})} ${G}x`}).join(", ")}function e9(X,$="100vw"){if(!X||Object.keys(X).length===0)return $;let Y=Object.entries(X).map(([J,G])=>{let Q=/^\d+$/.test(J)?`${J}px`:J;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((J,G)=>J.numericBp-G.numericBp).map(({bp:J,size:G})=>`(max-width: ${J}) ${G}`);return Y.push($),Y.join(", ")}function g7(X,$={}){let Z=Object.entries($).filter(([,G])=>G!==void 0&&G!==null).map(([G,Q])=>{if(Array.isArray(Q))return[G,Q.join(",")];return[G,String(Q)]});if(Z.length===0)return X;let Y=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),J=X.includes("?")?"&":"?";return`${X}${J}${Y}`}function X4(X){return hw[X]||"application/octet-stream"}var P5,gw,f7,hw;var $4=E(()=>{P5=[320,480,640,768,1024,1280,1536,1920,2560],gw=[1,1.5,2,3],f7=["avif","webp","jpeg"],hw={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function dw(){try{return await import("ts-images")}catch{return null}}async function mw(X,$={}){let Z={...uw,...$},Y=await dw();if(Y)try{return await lw(X,Z,Y)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return cw(X,Z)}async function lw(X,$,Z){let{generatePlaceholder:Y,generateThumbHash:J}=Z,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[$.strategy]||"blur";if($.strategy==="thumbhash")return{dataURL:(await J(X)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let q=await Y(X,{width:$.width,height:$.height,quality:$.quality,blurLevel:$.blurLevel,strategy:Q,base64Encode:!0});return{dataURL:q.dataURL,width:q.width,height:q.height,aspectRatio:q.aspectRatio,originalWidth:q.originalWidth,originalHeight:q.originalHeight,strategy:$.strategy,dominantColor:q.dominantColor,css:q.css}}function cw(X,$){let Z=$.width||20,Y=$.height||Z,J="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}" viewBox="0 0 ${Z} ${Y}"><rect fill="#e5e7eb" width="${Z}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:Y,aspectRatio:Z/Y,originalWidth:0,originalHeight:0,strategy:$.strategy,dominantColor:"#e5e7eb"}}function PY(X,$,Z={}){let Y=Z.transitionDuration||300,J=Z.easing||"ease-out";return`
11916
+ `;return U}function BY(){G8.clear(),Q8.clear(),n9.clear()}var G8,Q8,n9,Tw=0,J8,Z0;var H0=E(()=>{I7();Q9();Q1();e0();y5();W8();N1();w9();j9();V7();k1();TZ();S7();G8=new a1(500),Q8=new a1(1000),n9=new a1(2000);J8=new Map;Z0={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 bY(X,$,Z=""){let Y=X,J=[],G=/@markdown(?:\([^)]*\))?/g,Q;while((Q=G.exec(X))!==null){let q=Q.index,W=Q[0].match(/@markdown\(([^)]*)\)/),K=W?W[1]:"",U=q+Q[0].length,z=1,w=U,B=-1;while(z>0&&w<X.length){let H=X.indexOf("@markdown",w),L=X.indexOf("@endmarkdown",w);if(L===-1)break;if(H!==-1&&H<L&&H!==q){let O=X[H+9];if(O==="("||O===`
11917
+ `||O==="\r"||O===" "||O===void 0)z++;w=H+9}else{if(z--,z===0){B=L;break}w=L+12}}if(B===-1)continue;let j=X.slice(U,B),_=X.slice(q,B+12);J.push({fullMatch:_,options:K,content:j,index:q}),G.lastIndex=B+12}for(let{fullMatch:q,options:W,content:K,index:U}of J)try{let z={};if(W)W.split(",").forEach((j)=>{let _=j.trim();if(_)z[_]=!0});let w={gfm:z.gfm??!0,breaks:z.breaks??!1},B=F7(K.trim(),w);Y=Y.split(q).join(B)}catch(z){let w=z instanceof Error?z.message:String(z),B=j0("Markdown Directive",`Error processing markdown: ${w}`,Z,X,U,q);Y=Y.split(q).join(B)}return Y}async function SY(X,$,Z,Y){let J={gfm:!0,breaks:!1};return $.forEach((G)=>{let Q=G.trim().replace(/['"]/g,"");if(Q==="breaks")J.breaks=!0;if(Q==="no-gfm")J.gfm=!1}),F7(X.trim(),J)}var s9=E(()=>{H0()});function gw(X){if(xw.set(X.name,X),X.client)fw.set(X.name,X.client)}function K8(X){return gw(X),{name:X.name,hasEndTag:X.hasEndTag??!0,description:X.description,handler:async(Z,Y,J,G)=>{let Q=hw(Y,X.defaults);if(X.validate){let W=X.validate(Q);if(W!==!0){let K=typeof W==="string"?W:`Invalid parameters for @${X.name}`;throw Error(K)}}let q=Z;if(X.transform)q=await X.transform(Z,Q,J,G);if(X.clientScript){let W=X.clientScript(Q);q+=`<script>${W}</script>`}if(X.css){let W=X.css(Q);q+=`<style>${W}</style>`}return q}}}function hw(X,$){let Z={...$};for(let Y of X){let J=Y.indexOf(":"),G=Y.indexOf("="),Q=J>=0&&(G<0||J<G)?J:G;if(Q>=0){let q=Y.slice(0,Q).trim(),W=Y.slice(Q+1).trim();if(W==="true")W=!0;else if(W==="false")W=!1;else if(W==="null")W=null;else if(!Number.isNaN(Number(W)))W=Number(W);else if(typeof W==="string"&&W.startsWith("{"))try{W=JSON.parse(W)}catch{}Z[q]=W}else{let q=Object.keys(Z).filter((W)=>!$||!(W in $)).length;Z[q===0?"value":`arg${q}`]=Y}}return Z}var xw,fw;var a9=E(()=>{xw=new Map,fw=new Map});function t9(X,$=P5,Z={},Y){return $.sort((J,G)=>J-G).map((J)=>{return`${g7(X,{...Z,w:J,fm:Y})} ${J}w`}).join(", ")}function CY(X,$,Z=uw,Y={},J){return Z.sort((G,Q)=>G-Q).map((G)=>{let Q=Math.round($*G);return`${g7(X,{...Y,w:Q,dpr:G,fm:J})} ${G}x`}).join(", ")}function e9(X,$="100vw"){if(!X||Object.keys(X).length===0)return $;let Y=Object.entries(X).map(([J,G])=>{let Q=/^\d+$/.test(J)?`${J}px`:J;return{bp:Q,size:G,numericBp:Number.parseInt(Q)||0}}).sort((J,G)=>J.numericBp-G.numericBp).map(({bp:J,size:G})=>`(max-width: ${J}) ${G}`);return Y.push($),Y.join(", ")}function g7(X,$={}){let Z=Object.entries($).filter(([,G])=>G!==void 0&&G!==null).map(([G,Q])=>{if(Array.isArray(Q))return[G,Q.join(",")];return[G,String(Q)]});if(Z.length===0)return X;let Y=Z.map(([G,Q])=>`${G}=${encodeURIComponent(Q)}`).join("&"),J=X.includes("?")?"&":"?";return`${X}${J}${Y}`}function X4(X){return dw[X]||"application/octet-stream"}var P5,uw,f7,dw;var $4=E(()=>{P5=[320,480,640,768,1024,1280,1536,1920,2560],uw=[1,1.5,2,3],f7=["avif","webp","jpeg"],dw={avif:"image/avif",webp:"image/webp",jpeg:"image/jpeg",png:"image/png",gif:"image/gif"}});async function lw(){try{return await import("ts-images")}catch{return null}}async function cw(X,$={}){let Z={...mw,...$},Y=await lw();if(Y)try{return await pw(X,Z,Y)}catch(J){console.warn(`[stx-media] ts-images placeholder generation failed, using fallback: ${J}`)}return iw(X,Z)}async function pw(X,$,Z){let{generatePlaceholder:Y,generateThumbHash:J}=Z,Q={blur:"blur",thumbhash:"thumbhash",blurhash:"thumbhash",pixelate:"pixelate","dominant-color":"dominant-color",none:"blur"}[$.strategy]||"blur";if($.strategy==="thumbhash")return{dataURL:(await J(X)).dataUrl,width:32,height:32,aspectRatio:1,originalWidth:0,originalHeight:0,strategy:"thumbhash"};let q=await Y(X,{width:$.width,height:$.height,quality:$.quality,blurLevel:$.blurLevel,strategy:Q,base64Encode:!0});return{dataURL:q.dataURL,width:q.width,height:q.height,aspectRatio:q.aspectRatio,originalWidth:q.originalWidth,originalHeight:q.originalHeight,strategy:$.strategy,dominantColor:q.dominantColor,css:q.css}}function iw(X,$){let Z=$.width||20,Y=$.height||Z,J="#e5e7eb",G=`<svg xmlns="http://www.w3.org/2000/svg" width="${Z}" height="${Y}" viewBox="0 0 ${Z} ${Y}"><rect fill="#e5e7eb" width="${Z}" height="${Y}"/></svg>`;return{dataURL:`data:image/svg+xml;charset=utf-8,${encodeURIComponent(G)}`,width:Z,height:Y,aspectRatio:Z/Y,originalWidth:0,originalHeight:0,strategy:$.strategy,dominantColor:"#e5e7eb"}}function PY(X,$,Z={}){let Y=Z.transitionDuration||300,J=Z.easing||"ease-out";return`
11918
11918
  #${X} {
11919
11919
  --stx-img-transition-duration: ${Y}ms;
11920
11920
  --stx-img-transition-easing: ${J};
@@ -11931,7 +11931,7 @@ ${Z0.dim}${q}${Z0.reset}
11931
11931
  #${X}.stx-img-loaded img {
11932
11932
  opacity: 1;
11933
11933
  }
11934
- `.trim()}async function vY(X,$={}){let Z=`${X}:${JSON.stringify($)}`;if(Z4.has(Z))return Z4.get(Z);let Y=await mw(X,$);return Z4.set(Z,Y),Y}var uw,Y4,Z4;var xY=E(()=>{uw={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},Y4=`
11934
+ `.trim()}async function vY(X,$={}){let Z=`${X}:${JSON.stringify($)}`;if(Z4.has(Z))return Z4.get(Z);let Y=await cw(X,$);return Z4.set(Z,Y),Y}var mw,Y4,Z4;var xY=E(()=>{mw={strategy:"thumbhash",width:20,quality:50,blurLevel:40,transitionDuration:300,easing:"ease-out"},Y4=`
11935
11935
  .stx-img-placeholder {
11936
11936
  position: relative;
11937
11937
  overflow: hidden;
@@ -11960,8 +11960,8 @@ ${Z0.dim}${q}${Z0.reset}
11960
11960
  filter: blur(0);
11961
11961
  transform: scale(1);
11962
11962
  }
11963
- `.trim();Z4=new Map});import{createHash as gY}from"crypto";import{readFile as pw,stat as hY}from"fs/promises";async function P0(X){try{let $=await pw(X);return gY("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function fY(X){return gY("sha256").update(X).digest("hex").slice(0,16)}function W8(X,$){let Z=JSON.stringify($,Object.keys($).sort());return`${fY(X)}-${fY(Z)}`}async function J4(X){try{return(await hY(X)).mtimeMs}catch{return 0}}async function y0(X){try{return await hY(X),!0}catch{return!1}}var J5=()=>{};import{mkdir as iw,readFile as nw,writeFile as rw,readdir as QN,rm as ow,stat as qN}from"fs/promises";import{join as dY,dirname as sw}from"path";async function aw(X){try{await iw(X,{recursive:!0})}catch{}}function mY(X,$,Z){return dY(X,Z,`${$}.json`)}async function uY(X,$,Z){if((Date.now()-X.createdAt)/86400000>Z)return!1;if(await J4($)!==X.srcMtime)return!1;return!0}async function z8(X,$,Z,Y=G4){if(!Y.enabled)return null;let J=W8(X,$),G=v5.get(J);if(G){if(await uY(G,X,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;v5.delete(J)}let Q=mY(Y.directory,J,Z);if(await y0(Q))try{let q=await nw(Q,"utf-8"),K=JSON.parse(q);if(await uY(K,X,Y.maxAge))return K.lastAccessedAt=Date.now(),v5.set(J,K),K.data}catch{}return null}async function w8(X,$,Z,Y,J=G4){if(!J.enabled)return;let G=W8(X,$),Q=await P0(X),q=await J4(X),K={key:G,src:X,srcHash:Q,srcMtime:q,optionsHash:W8("",$),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};v5.set(G,K);let U=mY(J.directory,G,Y);try{await aw(sw(U)),await rw(U,JSON.stringify(K,null,2))}catch(W){console.warn(`[stx-media] Failed to write cache: ${W}`)}}async function j8(X,$=G4){if(X==="all")v5.clear();else v5.clear();let Z=X==="all"?["image","video"]:[X];for(let Y of Z){let J=dY($.directory,Y);try{await ow(J,{recursive:!0,force:!0})}catch{}}}var v5,G4;var Q4=E(()=>{J5();v5=new Map,G4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class _8{config;constructor(X={}){this.config={...tw,...X}}async get(X,$){return z8(X,$,"image",this.config)}async set(X,$,Z){return w8(X,$,Z,"image",this.config)}async clear(){return j8("image",this.config)}updateConfig(X){this.config={...this.config,...X}}}function q4(X){if(!B8)B8=new _8(X);else if(X)B8.updateConfig(X);return B8}async function H8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return q4(Y).get(X,$)}async function O8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return q4(J).set(X,$,Z)}async function lY(){return q4().clear()}var tw,B8=null;var K4=E(()=>{Q4();tw={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as ew,basename as Xj,extname as $j,join as Zj}from"path";import{mkdir as Yj}from"fs/promises";async function U4(){try{return await import("ts-images")}catch{return null}}function cY(X){switch(X){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function Jj(X,$){let Z=$?cY($):cY("web"),Y=X.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function pY(X,$,Z){let Y=await U4();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:X,processed:!1};let J=await H8(X,$,Z);if(J)return J;try{let G=ew(X);if(!await y0(G))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let Q=Jj(Z,$.preset),q=Z.outputDir||"dist/images",K=Z.baseUrl||"/images";await Yj(q,{recursive:!0});let U=await P0(G),W=Xj(X,$j(X)),z=$.outputFormat?[$.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],w={src:X,processed:!0,variants:[],hash:U},B=null;if($.transformations&&$.transformations.length>0)B=await W4(G,$.transformations,Y);for(let j of z){let _=Q[j]||{},H=`${W}-${U}.${j}`,O=Zj(q,H);try{let L=await Y.optimizeImage({input:B||G,output:O,format:j,quality:_.quality,progressive:_.progressive});if(L){if(w.variants.push({path:O,url:`${K}/${H}`,width:L.width||0,height:L.height||0,format:j,size:L.outputSize||0}),!w.originalWidth&&L.width)w.originalWidth=L.width,w.originalHeight=L.height}}catch(L){w.errors=w.errors||[],w.errors.push(`Failed to optimize ${j}: ${L}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let j=await Y.generateThumbHash(G);w.placeholder=j.dataUrl}catch(j){w.errors=w.errors||[],w.errors.push(`Failed to generate thumbhash: ${j}`)}if($.useDominantColor)try{let j=await Y.generatePlaceholder(G,{strategy:"dominant-color"});w.dominantColor=j.dominantColor}catch(j){w.errors=w.errors||[],w.errors.push(`Failed to extract dominant color: ${j}`)}return await O8(X,$,w,Z),w}catch(G){return{src:X,processed:!1,errors:[`Processing failed: ${G}`]}}}async function iY(X,$,Z,Y){let J=await U4();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:X,output:Y,format:$,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function W4(X,$,Z){let Y=Z||await U4();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode(X);for(let G of $){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var nY=E(()=>{J5();K4()});import{resolve as Gj,basename as Qj,extname as qj,join as Kj}from"path";import{mkdir as Uj}from"fs/promises";async function Wj(){try{return await import("ts-images")}catch{return null}}async function rY(X,$,Z){let Y=await Wj();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=Gj(X);if(!await y0(J))return console.warn(`[stx-media] Source file not found: ${X}`),null;try{let G=$.responsiveWidths||Z.breakpoints||zj,Q=$.formats||Z.defaultFormats||["avif","webp","jpeg"],q=Z.outputDir||"dist/images",K=Z.baseUrl||"/images";await Uj(q,{recursive:!0});let U=await P0(J),W=Qj(X,qj(X)),z=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},w={src:X,byFormat:{},srcsets:{}};for(let j of Q){w.byFormat[j]=[];let _=[];for(let H of G){let O=`${W}-${H}w-${U}.${j}`,L=Kj(q,O),F=`${K}/${O}`;try{let V=z[j]?.quality||80;if(await y0(L)){w.byFormat[j].push({path:L,url:F,width:H,height:0,format:j,size:0}),_.push(`${F} ${H}w`);continue}let A=await Y.processImage({input:J,output:L,format:j,quality:V,resize:{width:H}});if(A)w.byFormat[j].push({path:L,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),_.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${j} at ${H}w: ${V}`)}}w.srcsets[j]=_.join(", ")}let B=$.placeholder||Z.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await Y.generateThumbHash(J);w.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await Y.generatePlaceholder(J,{strategy:B,width:20});w.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return w.sizes=$.sizes||wj(G),w}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function wj(X){let $=[...X].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<$.length-1;Y++){let J=$[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${$[$.length-1]}px`),Z.join(", ")}function oY(X,$="width"){if(!X||X.length===0)return"";if($==="dpr")return X.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return X.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var zj;var sY=E(()=>{J5();zj=[320,480,640,768,1024,1280,1536,1920]});var aY={};n(aY,{setCachedImageResult:()=>O8,processImage:()=>pY,optimizeImage:()=>iY,getCachedImageResult:()=>H8,generateSrcset:()=>oY,generateResponsiveVariants:()=>rY,clearImageCache:()=>lY,applyTransformations:()=>W4,ImageProcessorCache:()=>_8});var tY=E(()=>{nY();sY();K4()});async function jj(){try{return await Promise.resolve().then(() => (tY(),aY))}catch(X){if(!eY)console.warn("[stx-media] Image processor not available, some features disabled:",X),eY=!0;return null}}async function L8(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return Oj(Y,Z)}if(Z.processedResult?.processed)return B4(X,Z.processedResult,$);if(Z.responsiveVariants)return YJ(X,Z.responsiveVariants,$);let{src:J,alt:G,width:Q,height:q,sizes:K,widths:U=P5,dpr:W,formats:z=f7,quality:w=z4,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:H=!0,priority:O=!1,loading:L=O?"eager":V8,decoding:F=F8,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:T}=X,M=X.class,k=X.style,D=X.id,I=X.data||{},{isDev:S=!1,baseUrl:b=""}=$;if(S&&!$.optimize)return Hj(X);let y,P,x=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!O)try{y=await vY(J,{strategy:j,..._}),P=PY(x,y,_)}catch{}let f=W!==void 0&&Q!==void 0,c;if(f)c=_j(X,x,y,$);else c=await Bj(X,x,y,$);let l;if(O){let f0=z.includes("webp")?"webp":z[0],a0=t9(J,U,{...B,q:w},f0),i=typeof K==="object"?e9(K):K||"100vw";l=`<link rel="preload" as="image" imagesrcset="${a0}" imagesizes="${i}" />`}let T0=[];if(!XJ&&j!=="none")T0.push(Y4),XJ=!0;if(P)T0.push(P);let x0=H?ZJ(x):void 0;return{html:c,preloadLink:l,css:T0.length>0?T0.join(`
11964
- `):void 0,script:x0}}async function Bj(X,$,Z,Y){let{src:J,alt:G,width:Q,height:q,sizes:K,widths:U=P5,formats:W=f7,quality:z=z4,params:w={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":V8,decoding:H=F8,fetchpriority:O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A}=X,R=X.class,N=X.style,T=X.data||{},M=typeof K==="object"?e9(K):K||"100vw",k=[];for(let S of W){let b=t9(J,U,{...w,q:z},S),y=X4(S);if(B&&!j)k.push(` <source type="${y}" data-srcset="${b}" data-sizes="${M}" />`);else k.push(` <source type="${y}" srcset="${b}" sizes="${M}" />`)}let D=w4({src:g7(J,{...w,q:z}),alt:G,width:Q,height:q,loading:j?void 0:_,decoding:H,fetchpriority:j?"high":O,objectFit:L,objectPosition:F,crossorigin:V,referrerpolicy:A,className:$J(R,Z),style:j4(N,L,F,Z),lazy:B&&!j,data:T}),I;if(Z){let S=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${$}" class="stx-img-placeholder" style="${S}">
11963
+ `.trim();Z4=new Map});import{createHash as gY}from"crypto";import{readFile as nw,stat as hY}from"fs/promises";async function P0(X){try{let $=await nw(X);return gY("sha256").update($).digest("hex").slice(0,16)}catch{return""}}function fY(X){return gY("sha256").update(X).digest("hex").slice(0,16)}function U8(X,$){let Z=JSON.stringify($,Object.keys($).sort());return`${fY(X)}-${fY(Z)}`}async function J4(X){try{return(await hY(X)).mtimeMs}catch{return 0}}async function y0(X){try{return await hY(X),!0}catch{return!1}}var J5=()=>{};import{mkdir as rw,readFile as ow,writeFile as sw,readdir as WN,rm as aw,stat as KN}from"fs/promises";import{join as dY,dirname as tw}from"path";async function ew(X){try{await rw(X,{recursive:!0})}catch{}}function mY(X,$,Z){return dY(X,Z,`${$}.json`)}async function uY(X,$,Z){if((Date.now()-X.createdAt)/86400000>Z)return!1;if(await J4($)!==X.srcMtime)return!1;return!0}async function z8(X,$,Z,Y=G4){if(!Y.enabled)return null;let J=U8(X,$),G=v5.get(J);if(G){if(await uY(G,X,Y.maxAge))return G.lastAccessedAt=Date.now(),G.data;v5.delete(J)}let Q=mY(Y.directory,J,Z);if(await y0(Q))try{let q=await ow(Q,"utf-8"),W=JSON.parse(q);if(await uY(W,X,Y.maxAge))return W.lastAccessedAt=Date.now(),v5.set(J,W),W.data}catch{}return null}async function w8(X,$,Z,Y,J=G4){if(!J.enabled)return;let G=U8(X,$),Q=await P0(X),q=await J4(X),W={key:G,src:X,srcHash:Q,srcMtime:q,optionsHash:U8("",$),data:Z,createdAt:Date.now(),lastAccessedAt:Date.now()};v5.set(G,W);let K=mY(J.directory,G,Y);try{await ew(tw(K)),await sw(K,JSON.stringify(W,null,2))}catch(U){console.warn(`[stx-media] Failed to write cache: ${U}`)}}async function j8(X,$=G4){if(X==="all")v5.clear();else v5.clear();let Z=X==="all"?["image","video"]:[X];for(let Y of Z){let J=dY($.directory,Y);try{await aw(J,{recursive:!0,force:!0})}catch{}}}var v5,G4;var Q4=E(()=>{J5();v5=new Map,G4={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}});class _8{config;constructor(X={}){this.config={...Xj,...X}}async get(X,$){return z8(X,$,"image",this.config)}async set(X,$,Z){return w8(X,$,Z,"image",this.config)}async clear(){return j8("image",this.config)}updateConfig(X){this.config={...this.config,...X}}}function q4(X){if(!B8)B8=new _8(X);else if(X)B8.updateConfig(X);return B8}async function H8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return q4(Y).get(X,$)}async function L8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return q4(J).set(X,$,Z)}async function lY(){return q4().clear()}var Xj,B8=null;var W4=E(()=>{Q4();Xj={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500,cacheVariants:!0,cachePlaceholders:!0}});import{resolve as $j,basename as Zj,extname as Yj,join as Jj}from"path";import{mkdir as Gj}from"fs/promises";async function K4(){try{return await import("ts-images")}catch{return null}}function cY(X){switch(X){case"quality":return{jpeg:{quality:90,mozjpeg:!0,progressive:!0},png:{compressionLevel:6,palette:!1},webp:{quality:90,effort:6,smartSubsample:!0},avif:{quality:85,effort:6}};case"performance":return{jpeg:{quality:70,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!0},webp:{quality:70,effort:4,smartSubsample:!0},avif:{quality:60,effort:2}};case"web":default:return{jpeg:{quality:82,mozjpeg:!0,progressive:!0},png:{compressionLevel:8,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4}}}}function Qj(X,$){let Z=$?cY($):cY("web"),Y=X.formatQuality||{};return{jpeg:{...Z.jpeg,...Y.jpeg},png:{...Z.png,...Y.png},webp:{...Z.webp,...Y.webp},avif:{...Z.avif,...Y.avif}}}async function pY(X,$,Z){let Y=await K4();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping optimization"),{src:X,processed:!1};let J=await H8(X,$,Z);if(J)return J;try{let G=$j(X);if(!await y0(G))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let Q=Qj(Z,$.preset),q=Z.outputDir||"dist/images",W=Z.baseUrl||"/images";await Gj(q,{recursive:!0});let K=await P0(G),U=Zj(X,Yj(X)),z=$.outputFormat?[$.outputFormat]:Z.defaultFormats||["avif","webp","jpeg"],w={src:X,processed:!0,variants:[],hash:K},B=null;if($.transformations&&$.transformations.length>0)B=await U4(G,$.transformations,Y);for(let j of z){let _=Q[j]||{},H=`${U}-${K}.${j}`,L=Jj(q,H);try{let O=await Y.optimizeImage({input:B||G,output:L,format:j,quality:_.quality,progressive:_.progressive});if(O){if(w.variants.push({path:L,url:`${W}/${H}`,width:O.width||0,height:O.height||0,format:j,size:O.outputSize||0}),!w.originalWidth&&O.width)w.originalWidth=O.width,w.originalHeight=O.height}}catch(O){w.errors=w.errors||[],w.errors.push(`Failed to optimize ${j}: ${O}`)}}if($.embedThumbhash||$.placeholder==="thumbhash")try{let j=await Y.generateThumbHash(G);w.placeholder=j.dataUrl}catch(j){w.errors=w.errors||[],w.errors.push(`Failed to generate thumbhash: ${j}`)}if($.useDominantColor)try{let j=await Y.generatePlaceholder(G,{strategy:"dominant-color"});w.dominantColor=j.dominantColor}catch(j){w.errors=w.errors||[],w.errors.push(`Failed to extract dominant color: ${j}`)}return await L8(X,$,w,Z),w}catch(G){return{src:X,processed:!1,errors:[`Processing failed: ${G}`]}}}async function iY(X,$,Z,Y){let J=await K4();if(!J)return{success:!1,error:"ts-images not installed"};try{return{success:!0,size:(await J.optimizeImage({input:X,output:Y,format:$,quality:Z}))?.outputSize}}catch(G){return{success:!1,error:String(G)}}}async function U4(X,$,Z){let Y=Z||await K4();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping transformations"),null;try{let J=await Y.decode(X);for(let G of $){let Q=G.options||{};switch(G.type){case"resize":if(Q.width||Q.height)J=await Y.resize(J,{width:Q.width,height:Q.height,fit:Q.fit});break;case"blur":if(Q.sigma!==void 0)J=await Y.blur(J,Q.sigma);break;case"sharpen":if(Q.amount!==void 0)J=await Y.sharpen(J,Q.amount);break;case"grayscale":J=await Y.grayscale(J);break;case"rotate":if(Q.angle!==void 0)J=await Y.rotate(J,Q.angle);break;case"flip":J=await Y.flip(J);break;case"flop":J=await Y.flop(J);break;case"brightness":if(Q.value!==void 0)J=await Y.brightness(J,Q.value);break;case"contrast":if(Q.value!==void 0)J=await Y.contrast(J,Q.value);break;case"saturation":if(Q.value!==void 0)J=await Y.saturation(J,Q.value);break}}return await Y.encode(J,"png")}catch(J){return console.error(`[stx-media] Transformation failed: ${J}`),null}}var nY=E(()=>{J5();W4()});import{resolve as qj,basename as Wj,extname as Kj,join as Uj}from"path";import{mkdir as zj}from"fs/promises";async function wj(){try{return await import("ts-images")}catch{return null}}async function rY(X,$,Z){let Y=await wj();if(!Y)return console.warn("[stx-media] ts-images not installed, skipping responsive generation"),null;let J=qj(X);if(!await y0(J))return console.warn(`[stx-media] Source file not found: ${X}`),null;try{let G=$.responsiveWidths||Z.breakpoints||jj,Q=$.formats||Z.defaultFormats||["avif","webp","jpeg"],q=Z.outputDir||"dist/images",W=Z.baseUrl||"/images";await zj(q,{recursive:!0});let K=await P0(J),U=Wj(X,Kj(X)),z=Z.formatQuality||{jpeg:{quality:82},png:{quality:80},webp:{quality:82},avif:{quality:75}},w={src:X,byFormat:{},srcsets:{}};for(let j of Q){w.byFormat[j]=[];let _=[];for(let H of G){let L=`${U}-${H}w-${K}.${j}`,O=Uj(q,L),F=`${W}/${L}`;try{let V=z[j]?.quality||80;if(await y0(O)){w.byFormat[j].push({path:O,url:F,width:H,height:0,format:j,size:0}),_.push(`${F} ${H}w`);continue}let A=await Y.processImage({input:J,output:O,format:j,quality:V,resize:{width:H}});if(A)w.byFormat[j].push({path:O,url:F,width:H,height:A.height||Math.round(H*(A.height||1)/(A.width||1)),format:j,size:A.outputSize||0}),_.push(`${F} ${H}w`)}catch(V){console.warn(`[stx-media] Failed to generate ${j} at ${H}w: ${V}`)}}w.srcsets[j]=_.join(", ")}let B=$.placeholder||Z.placeholderStrategy||"thumbhash";if(B!=="none")try{if(B==="thumbhash"){let j=await Y.generateThumbHash(J);w.placeholder={dataURL:j.dataUrl,width:j.width||32,height:j.height||32,strategy:"thumbhash"}}else{let j=await Y.generatePlaceholder(J,{strategy:B,width:20});w.placeholder={dataURL:j.dataURL,width:j.width,height:j.height,strategy:B}}}catch(j){console.warn(`[stx-media] Failed to generate placeholder: ${j}`)}return w.sizes=$.sizes||Bj(G),w}catch(G){return console.error(`[stx-media] Responsive generation failed: ${G}`),null}}function Bj(X){let $=[...X].sort((Y,J)=>Y-J),Z=[];for(let Y=0;Y<$.length-1;Y++){let J=$[Y];Z.push(`(max-width: ${J}px) ${J}px`)}return Z.push(`${$[$.length-1]}px`),Z.join(", ")}function oY(X,$="width"){if(!X||X.length===0)return"";if($==="dpr")return X.filter((Z)=>Z.dpr).map((Z)=>`${Z.url} ${Z.dpr}x`).join(", ");return X.map((Z)=>`${Z.url} ${Z.width}w`).join(", ")}var jj;var sY=E(()=>{J5();jj=[320,480,640,768,1024,1280,1536,1920]});var aY={};i(aY,{setCachedImageResult:()=>L8,processImage:()=>pY,optimizeImage:()=>iY,getCachedImageResult:()=>H8,generateSrcset:()=>oY,generateResponsiveVariants:()=>rY,clearImageCache:()=>lY,applyTransformations:()=>U4,ImageProcessorCache:()=>_8});var tY=E(()=>{nY();sY();W4()});async function _j(){try{return await Promise.resolve().then(() => (tY(),aY))}catch(X){if(!eY)console.warn("[stx-media] Image processor not available, some features disabled:",X),eY=!0;return null}}async function O8(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipOptimization){if(Z.tsImagesConfig?.enabled&&!Z.isDev)return Fj(Y,Z)}if(Z.processedResult?.processed)return B4(X,Z.processedResult,$);if(Z.responsiveVariants)return YJ(X,Z.responsiveVariants,$);let{src:J,alt:G,width:Q,height:q,sizes:W,widths:K=P5,dpr:U,formats:z=f7,quality:w=z4,params:B={},placeholder:j="none",placeholderOptions:_={},lazy:H=!0,priority:L=!1,loading:O=L?"eager":V8,decoding:F=F8,fetchpriority:V,objectFit:A,objectPosition:R,crossorigin:N,referrerpolicy:T}=X,M=X.class,k=X.style,D=X.id,I=X.data||{},{isDev:S=!1,baseUrl:b=""}=$;if(S&&!$.optimize)return Oj(X);let y,P,x=D||`stx-img-${Math.random().toString(36).slice(2,8)}`;if(j!=="none"&&!L)try{y=await vY(J,{strategy:j,..._}),P=PY(x,y,_)}catch{}let f=U!==void 0&&Q!==void 0,c;if(f)c=Lj(X,x,y,$);else c=await Hj(X,x,y,$);let l;if(L){let f0=z.includes("webp")?"webp":z[0],a0=t9(J,K,{...B,q:w},f0),p=typeof W==="object"?e9(W):W||"100vw";l=`<link rel="preload" as="image" imagesrcset="${a0}" imagesizes="${p}" />`}let T0=[];if(!XJ&&j!=="none")T0.push(Y4),XJ=!0;if(P)T0.push(P);let x0=H?ZJ(x):void 0;return{html:c,preloadLink:l,css:T0.length>0?T0.join(`
11964
+ `):void 0,script:x0}}async function Hj(X,$,Z,Y){let{src:J,alt:G,width:Q,height:q,sizes:W,widths:K=P5,formats:U=f7,quality:z=z4,params:w={},lazy:B=!0,priority:j=!1,loading:_=j?"eager":V8,decoding:H=F8,fetchpriority:L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A}=X,R=X.class,N=X.style,T=X.data||{},M=typeof W==="object"?e9(W):W||"100vw",k=[];for(let S of U){let b=t9(J,K,{...w,q:z},S),y=X4(S);if(B&&!j)k.push(` <source type="${y}" data-srcset="${b}" data-sizes="${M}" />`);else k.push(` <source type="${y}" srcset="${b}" sizes="${M}" />`)}let D=w4({src:g7(J,{...w,q:z}),alt:G,width:Q,height:q,loading:j?void 0:_,decoding:H,fetchpriority:j?"high":L,objectFit:O,objectPosition:F,crossorigin:V,referrerpolicy:A,className:$J(R,Z),style:j4(N,O,F,Z),lazy:B&&!j,data:T}),I;if(Z){let S=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;I=`<div id="${$}" class="stx-img-placeholder" style="${S}">
11965
11965
  <picture>
11966
11966
  ${k.join(`
11967
11967
  `)}
@@ -11971,9 +11971,9 @@ ${k.join(`
11971
11971
  ${k.join(`
11972
11972
  `)}
11973
11973
  <img ${D} />
11974
- </picture>`;return I}function _j(X,$,Z,Y){let{src:J,alt:G,width:Q,height:q,dpr:K=[1,2,3],quality:U=z4,params:W={},lazy:z=!0,priority:w=!1,loading:B=w?"eager":V8,decoding:j=F8,fetchpriority:_,objectFit:H,objectPosition:O,crossorigin:L,referrerpolicy:F}=X,V=X.class,A=X.style,R=X.data||{},N=typeof Q==="number"?Q:Number.parseInt(String(Q),10),T=CY(J,N,K,{...W,q:U}),M=w4({src:g7(J,{...W,w:N,q:U}),alt:G,width:Q,height:q,loading:w?void 0:B,decoding:j,fetchpriority:w?"high":_,objectFit:H,objectPosition:O,crossorigin:L,referrerpolicy:F,className:$J(V,Z),style:j4(A,H,O,Z),lazy:z&&!w,data:R}),k=z&&!w?`data-srcset="${T}"`:`srcset="${T}"`;if(Z){let D=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${$}" class="stx-img-placeholder" style="${D}">
11974
+ </picture>`;return I}function Lj(X,$,Z,Y){let{src:J,alt:G,width:Q,height:q,dpr:W=[1,2,3],quality:K=z4,params:U={},lazy:z=!0,priority:w=!1,loading:B=w?"eager":V8,decoding:j=F8,fetchpriority:_,objectFit:H,objectPosition:L,crossorigin:O,referrerpolicy:F}=X,V=X.class,A=X.style,R=X.data||{},N=typeof Q==="number"?Q:Number.parseInt(String(Q),10),T=CY(J,N,W,{...U,q:K}),M=w4({src:g7(J,{...U,w:N,q:K}),alt:G,width:Q,height:q,loading:w?void 0:B,decoding:j,fetchpriority:w?"high":_,objectFit:H,objectPosition:L,crossorigin:O,referrerpolicy:F,className:$J(V,Z),style:j4(A,H,L,Z),lazy:z&&!w,data:R}),k=z&&!w?`data-srcset="${T}"`:`srcset="${T}"`;if(Z){let D=`background-image: url('${Z.dataURL}'); background-size: cover; background-position: center;`;return`<div id="${$}" class="stx-img-placeholder" style="${D}">
11975
11975
  <img ${M} ${k} />
11976
- </div>`}return`<img ${$?`id="${$}" `:""}${M} ${k} />`}function Hj(X){let{src:$,alt:Z,width:Y,height:J,loading:G=V8,decoding:Q=F8,fetchpriority:q,objectFit:K,objectPosition:U,crossorigin:W,referrerpolicy:z,priority:w=!1}=X,B=X.class,j=X.style,_=X.id,H=X.data||{};return{html:`<img ${w4({src:$,alt:Z,width:Y,height:J,loading:w?"eager":G,decoding:Q,fetchpriority:w?"high":q,objectFit:K,objectPosition:U,crossorigin:W,referrerpolicy:z,className:B,style:j4(j,K,U),id:_,data:H})} />`}}function w4(X){let $=[];if(X.lazy)$.push(`data-src="${X1(X.src)}"`),$.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else $.push(`src="${X1(X.src)}"`);if($.push(`alt="${X1(X.alt)}"`),X.width)$.push(`width="${X.width}"`);if(X.height)$.push(`height="${X.height}"`);if(X.loading)$.push(`loading="${X.loading}"`);if(X.decoding)$.push(`decoding="${X.decoding}"`);if(X.fetchpriority)$.push(`fetchpriority="${X.fetchpriority}"`);if(X.crossorigin)$.push(`crossorigin="${X.crossorigin}"`);if(X.referrerpolicy)$.push(`referrerpolicy="${X.referrerpolicy}"`);if(X.className)$.push(`class="${X1(X.className)}"`);if(X.style)$.push(`style="${X1(X.style)}"`);if(X.id)$.push(`id="${X1(X.id)}"`);if(X.data)for(let[Z,Y]of Object.entries(X.data))$.push(`data-${Z}="${X1(Y)}"`);if(X.lazy)$.push("data-stx-lazy");return $.join(" ")}function $J(X,$){let Z=[];if(X)Z.push(X);if($)Z.push("stx-img-blur");return Z.join(" ")||""}function j4(X,$,Z,Y){let J=[];if($)J.push(`object-fit: ${$}`);if(Z)J.push(`object-position: ${Z}`);if(Y)J.push("opacity: 0; transition: opacity 300ms ease-out");if(X)J.push(X);return J.join("; ")}function X1(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ZJ(X){return`
11976
+ </div>`}return`<img ${$?`id="${$}" `:""}${M} ${k} />`}function Oj(X){let{src:$,alt:Z,width:Y,height:J,loading:G=V8,decoding:Q=F8,fetchpriority:q,objectFit:W,objectPosition:K,crossorigin:U,referrerpolicy:z,priority:w=!1}=X,B=X.class,j=X.style,_=X.id,H=X.data||{};return{html:`<img ${w4({src:$,alt:Z,width:Y,height:J,loading:w?"eager":G,decoding:Q,fetchpriority:w?"high":q,objectFit:W,objectPosition:K,crossorigin:U,referrerpolicy:z,className:B,style:j4(j,W,K),id:_,data:H})} />`}}function w4(X){let $=[];if(X.lazy)$.push(`data-src="${X1(X.src)}"`),$.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"');else $.push(`src="${X1(X.src)}"`);if($.push(`alt="${X1(X.alt)}"`),X.width)$.push(`width="${X.width}"`);if(X.height)$.push(`height="${X.height}"`);if(X.loading)$.push(`loading="${X.loading}"`);if(X.decoding)$.push(`decoding="${X.decoding}"`);if(X.fetchpriority)$.push(`fetchpriority="${X.fetchpriority}"`);if(X.crossorigin)$.push(`crossorigin="${X.crossorigin}"`);if(X.referrerpolicy)$.push(`referrerpolicy="${X.referrerpolicy}"`);if(X.className)$.push(`class="${X1(X.className)}"`);if(X.style)$.push(`style="${X1(X.style)}"`);if(X.id)$.push(`id="${X1(X.id)}"`);if(X.data)for(let[Z,Y]of Object.entries(X.data))$.push(`data-${Z}="${X1(Y)}"`);if(X.lazy)$.push("data-stx-lazy");return $.join(" ")}function $J(X,$){let Z=[];if(X)Z.push(X);if($)Z.push("stx-img-blur");return Z.join(" ")||""}function j4(X,$,Z,Y){let J=[];if($)J.push(`object-fit: ${$}`);if(Z)J.push(`object-position: ${Z}`);if(Y)J.push("opacity: 0; transition: opacity 300ms ease-out");if(X)J.push(X);return J.join("; ")}function X1(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ZJ(X){return`
11977
11977
  (function() {
11978
11978
  const container = document.getElementById('${X}');
11979
11979
  if (!container) return;
@@ -12010,7 +12010,7 @@ ${k.join(`
12010
12010
 
12011
12011
  observer.observe(container);
12012
12012
  })();
12013
- `.trim()}async function Oj(X,$){let Z=await jj();if(!Z)return L8({...X,process:!1},$);let Y=$.tsImagesConfig;if(X.responsiveWidths&&X.responsiveWidths.length>0||X.widths&&X.widths.length>0||!X.width&&!X.dpr){let G=await Z.generateResponsiveVariants(X.src,X,Y);if(G)return YJ(X,G,$)}else{let G=await Z.processImage(X.src,X,Y);if(G.processed)return B4(X,G,$)}return L8({...X,process:!1},$)}async function B4(X,$,Z){let{alt:Y,width:J,height:G,lazy:Q=!0,priority:q=!1,objectFit:K,objectPosition:U,crossorigin:W,referrerpolicy:z}=X,w=X.class,B=X.style,j=X.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=X.data||{},H=$.variants||[],O=H.find((P)=>P.format==="jpeg")||H.find((P)=>P.format==="webp")||H[0],L=O?.url||X.src,F=H.filter((P)=>P.format===(O?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of H){if(!V.has(P.format))V.set(P.format,[]);V.get(P.format).push(P)}let A=[],R=["avif","webp","jpeg","png"];for(let P of R){let x=V.get(P);if(x&&x.length>0){let f=x.map((l)=>`${l.url} ${l.width}w`).join(", "),c=X4(P);if(Q&&!q)A.push(` <source type="${c}" data-srcset="${f}" />`);else A.push(` <source type="${c}" srcset="${f}" />`)}}let N=[];if(Q&&!q){if(N.push(`data-src="${X1(L)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${X1(L)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${X1(Y)}"`);let T=J||$.originalWidth,M=G||$.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);if(!q)N.push(`loading="${Q?"lazy":"eager"}"`);if(N.push('decoding="async"'),q)N.push('fetchpriority="high"');if(W)N.push(`crossorigin="${W}"`);if(z)N.push(`referrerpolicy="${z}"`);let k=[];if(K)k.push(`object-fit: ${K}`);if(U)k.push(`object-position: ${U}`);if($.placeholder&&Q)k.push("opacity: 0; transition: opacity 300ms ease-out");if(B)k.push(B);if(k.length>0)N.push(`style="${k.join("; ")}"`);let D=[];if(w)D.push(w);if($.placeholder)D.push("stx-img-blur");if(D.length>0)N.push(`class="${D.join(" ")}"`);if(Q&&!q)N.push("data-stx-lazy");for(let[P,x]of Object.entries(_))N.push(`data-${P}="${X1(x)}"`);let I;if($.placeholder||$.dominantColor&&X.useDominantColor){let P=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;I=`<div id="${j}" class="stx-img-placeholder" style="${P}">
12013
+ `.trim()}async function Fj(X,$){let Z=await _j();if(!Z)return O8({...X,process:!1},$);let Y=$.tsImagesConfig;if(X.responsiveWidths&&X.responsiveWidths.length>0||X.widths&&X.widths.length>0||!X.width&&!X.dpr){let G=await Z.generateResponsiveVariants(X.src,X,Y);if(G)return YJ(X,G,$)}else{let G=await Z.processImage(X.src,X,Y);if(G.processed)return B4(X,G,$)}return O8({...X,process:!1},$)}async function B4(X,$,Z){let{alt:Y,width:J,height:G,lazy:Q=!0,priority:q=!1,objectFit:W,objectPosition:K,crossorigin:U,referrerpolicy:z}=X,w=X.class,B=X.style,j=X.id||`stx-img-${Math.random().toString(36).slice(2,8)}`,_=X.data||{},H=$.variants||[],L=H.find((P)=>P.format==="jpeg")||H.find((P)=>P.format==="webp")||H[0],O=L?.url||X.src,F=H.filter((P)=>P.format===(L?.format||"jpeg")).map((P)=>`${P.url} ${P.width}w`).join(", "),V=new Map;for(let P of H){if(!V.has(P.format))V.set(P.format,[]);V.get(P.format).push(P)}let A=[],R=["avif","webp","jpeg","png"];for(let P of R){let x=V.get(P);if(x&&x.length>0){let f=x.map((l)=>`${l.url} ${l.width}w`).join(", "),c=X4(P);if(Q&&!q)A.push(` <source type="${c}" data-srcset="${f}" />`);else A.push(` <source type="${c}" srcset="${f}" />`)}}let N=[];if(Q&&!q){if(N.push(`data-src="${X1(O)}"`),N.push('src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"'),F)N.push(`data-srcset="${F}"`)}else if(N.push(`src="${X1(O)}"`),F)N.push(`srcset="${F}"`);N.push(`alt="${X1(Y)}"`);let T=J||$.originalWidth,M=G||$.originalHeight;if(T)N.push(`width="${T}"`);if(M)N.push(`height="${M}"`);if(!q)N.push(`loading="${Q?"lazy":"eager"}"`);if(N.push('decoding="async"'),q)N.push('fetchpriority="high"');if(U)N.push(`crossorigin="${U}"`);if(z)N.push(`referrerpolicy="${z}"`);let k=[];if(W)k.push(`object-fit: ${W}`);if(K)k.push(`object-position: ${K}`);if($.placeholder&&Q)k.push("opacity: 0; transition: opacity 300ms ease-out");if(B)k.push(B);if(k.length>0)N.push(`style="${k.join("; ")}"`);let D=[];if(w)D.push(w);if($.placeholder)D.push("stx-img-blur");if(D.length>0)N.push(`class="${D.join(" ")}"`);if(Q&&!q)N.push("data-stx-lazy");for(let[P,x]of Object.entries(_))N.push(`data-${P}="${X1(x)}"`);let I;if($.placeholder||$.dominantColor&&X.useDominantColor){let P=$.placeholder?`background-image: url('${$.placeholder}'); background-size: cover; background-position: center;`:`background-color: ${$.dominantColor};`;I=`<div id="${j}" class="stx-img-placeholder" style="${P}">
12014
12014
  <picture>
12015
12015
  ${A.join(`
12016
12016
  `)}
@@ -12021,11 +12021,11 @@ ${A.join(`
12021
12021
  `)}
12022
12022
  <img ${N.join(" ")} />
12023
12023
  </picture>`;let S=[];if($.placeholder)S.push(Y4);let b=Q?ZJ(j):void 0,y;if(q&&F)y=`<link rel="preload" as="image" imagesrcset="${F}" />`;return{html:I,preloadLink:y,css:S.length>0?S.join(`
12024
- `):void 0,script:b}}async function YJ(X,$,Z){let Y={src:$.src,processed:!0,variants:[],placeholder:$.placeholder?.dataURL,originalWidth:$.placeholder?.width,originalHeight:$.placeholder?.height};for(let[J,G]of Object.entries($.byFormat))if(G)Y.variants.push(...G);return B4(X,Y,Z)}var eY=!1,z4=80,F8="async",V8="lazy",XJ=!1;var JJ=E(()=>{$4();xY()});function Lj(){return U8({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(X,$,Z,Y)=>{let{src:J,alt:G,options:Q}=Fj(X,$,Z);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let q={src:J,alt:G||"",widths:Q.widths||P5,formats:Q.formats||f7,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},K=Z.__isDev||!1,U=await L8(q,{isDev:K}),W=U.html;if(U.preloadLink)W=U.preloadLink+`
12025
- `+W;if(U.css)W+=`
12026
- <style>${U.css}</style>`;if(U.script)W+=`
12027
- <script>${U.script}</script>`;return W},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Fj(X,$,Z){if($.src)return{src:String($.src),alt:String($.alt||""),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=Vj(Y),G=_4(J[0],Z)||"",Q=_4(J[1],Z)||"",q={};if(J[2]){let K=_4(J[2],Z);if(typeof K==="object"&&K!==null)q=K;else if(typeof J[2]==="string")try{q=JSON.parse(J[2])}catch{}}return{src:G,alt:Q,options:q}}function Vj(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let q=0;q<X.length;q++){let K=X[q],U=q>0?X[q-1]:"";if((K==='"'||K==="'"||K==="`")&&U!=="\\"){if(!Y)Y=!0,J=K;else if(K===J)Y=!1,J="";else Z+=K;continue}if(!Y){if(K==="{")G++;if(K==="}")G--;if(K==="[")Q++;if(K==="]")Q--;if(K===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=K}if(Z.trim())$.push(Z.trim());return $}function _4(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var GJ;var QJ=E(()=>{a9();JJ();$4();GJ=Lj()});class R8{config;constructor(X={}){this.config={...Aj,...X}}async get(X,$){return z8(X,$,"video",this.config)}async set(X,$,Z){return w8(X,$,Z,"video",this.config)}async clear(){return j8("video",this.config)}updateConfig(X){this.config={...this.config,...X}}}function H4(X){if(!A8)A8=new R8(X);else if(X)A8.updateConfig(X);return A8}async function N8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return H4(Y).get(X,$)}async function T8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return H4(J).set(X,$,Z)}async function qJ(){return H4().clear()}var Aj,A8=null;var O4=E(()=>{Q4();Aj={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as L4,basename as F4,extname as V4,join as M8}from"path";import{mkdir as A4}from"fs/promises";async function R4(){try{return await import("ts-videos")}catch{return null}}async function k8(X,$,Z,Y){let J=await R4();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=L4(X);if(!await y0(G))return null;await A4(Z,{recursive:!0});let Q=await P0(G),q=F4(X,V4(X)),K=$.format||"webp",U=$.timestamp||0,W=`${q}-poster-${Q}.${K}`,z=M8(Z,W),w=await J.extractThumbnails(G,{timestamps:[U],width:$.width||1280,height:$.height,format:K,quality:$.quality||85,outputDir:Z,outputPattern:W.replace(`.${K}`,"")});if(w&&w.length>0){let B=w[0];return{path:z,url:`${Y}/${W}`,width:B.width||$.width||1280,height:B.height||720,timestamp:U,size:B.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function I8(X,$,Z,Y){let J=await R4();if(!J)return[];try{let G=L4(X);if(!await y0(G))return[];await A4(Z,{recursive:!0});let Q=await P0(G),q=F4(X,V4(X)),K=$.format||"webp",z=(await new J.Input(G).getInfo()).duration||60,w=$.count||10,B=$.interval||z/w,j=[];for(let H=0;H<w&&H*B<z;H++)j.push(H*B);let _=await J.extractThumbnails(G,{timestamps:j,width:$.width||320,format:K,quality:$.quality||80,outputDir:Z,outputPattern:`${q}-thumb-${Q}`});if(_&&_.length>0)return _.map((H,O)=>({path:H.path||M8(Z,`${q}-thumb-${Q}-${O}.${K}`),url:`${Y}/${q}-thumb-${Q}-${O}.${K}`,width:H.width||$.width||320,height:H.height||180,timestamp:j[O],size:H.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function KJ(X,$,Z,Y){let J=await R4();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=L4(X);if(!await y0(G))return null;await A4(Z,{recursive:!0});let Q=await P0(G),q=F4(X,V4(X)),W=(await new J.Input(G).getInfo()).duration||60,z=$.columns||10,w=$.interval||5,B=$.thumbnailWidth||160,j=$.thumbnailHeight||90,_=$.format||"jpeg",H=Math.ceil(W/w),O=Math.ceil(H/z),L=`${q}-sprite-${Q}.${_}`,F=M8(Z,L),V=[];for(let R=0;R<H;R++)V.push(R*w);let A=await J.extractThumbnails(G,{timestamps:V,width:B,height:j,format:_,quality:$.quality||70,outputDir:M8(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=z*B,T=O*j,M=await R.createSprite({images:A.map((k)=>k.path),columns:z,padding:0,outputPath:F,format:_,quality:$.quality||70});return{url:`${Y}/${L}`,path:F,columns:z,rows:O,thumbnailWidth:B,thumbnailHeight:j,interval:w,totalFrames:H}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(G){return console.warn(`[stx-media] Failed to generate sprite sheet: ${G}`),null}}var N4=E(()=>{J5()});import{resolve as WJ,basename as zJ,extname as wJ,join as G5}from"path";import{mkdir as E8,writeFile as jJ}from"fs/promises";async function BJ(){try{return await import("ts-videos")}catch{return null}}async function D8(X,$,Z,Y,J){let G=await BJ();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=WJ(X);if(!await y0(Q))return null;let q=await P0(Q),K=zJ(X,wJ(X)),U=G5(Z,`${K}-${q}-hls`);await E8(U,{recursive:!0});let W=$.length>0?$:_J,z=J?.segmentDuration||6,j=(await new G.Input(Q).getInfo()).duration||0,_=[],H=0;for(let F of W){let V=G5(U,F.label);await E8(V,{recursive:!0});let A=`${F.label}.m3u8`,R=G5(V,A);try{let N=await G.generateHLS(Q,{outputDir:V,segmentDuration:z,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(N)_.push({quality:F,url:`${Y}/${K}-${q}-hls/${F.label}/${A}`,path:R}),H+=N.segmentCount||Math.ceil(j/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${N}`)}}if(_.length===0)return null;let O=G5(U,"master.m3u8"),L=Rj(_,Y,K,q);return await jJ(O,L),{manifestUrl:`${Y}/${K}-${q}-hls/master.m3u8`,manifestPath:O,playlists:_,segmentCount:H,duration:j}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function Rj(X,$,Z,Y){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let G of X){let{quality:Q}=G,q=Q.bitrate+(Q.audioBitrate||128000),K=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${q},RESOLUTION=${K},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return J.join(`
12028
- `)}async function y8(X,$,Z,Y,J){let G=await BJ();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=WJ(X);if(!await y0(Q))return null;let q=await P0(Q),K=zJ(X,wJ(X)),U=G5(Z,`${K}-${q}-dash`);await E8(U,{recursive:!0});let W=$.length>0?$:_J,z=J?.segmentDuration||4,w=J?.minBufferTime||2,_=(await new G.Input(Q).getInfo()).duration||0,H=[],O=[];for(let A of W){let R=G5(U,A.label);await E8(R,{recursive:!0});try{if(await G.generateDASH(Q,{outputDir:R,segmentDuration:z,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(H.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${Y}/${K}-${q}-dash/${A.label}/video`}),A.audioBitrate)O.push({bandwidth:A.audioBitrate,url:`${Y}/${K}-${q}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(H.length===0)return null;let L=G5(U,"manifest.mpd"),F=Nj(H,O,_,z,w);await jJ(L,F);let V=[{type:"video",representations:H}];if(O.length>0)V.push({type:"audio",representations:O});return{manifestUrl:`${Y}/${K}-${q}-dash/manifest.mpd`,manifestPath:L,adaptationSets:V,duration:_}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function Nj(X,$,Z,Y,J){let G=UJ(Z),Q=UJ(J),q=`<?xml version="1.0" encoding="UTF-8"?>
12024
+ `):void 0,script:b}}async function YJ(X,$,Z){let Y={src:$.src,processed:!0,variants:[],placeholder:$.placeholder?.dataURL,originalWidth:$.placeholder?.width,originalHeight:$.placeholder?.height};for(let[J,G]of Object.entries($.byFormat))if(G)Y.variants.push(...G);return B4(X,Y,Z)}var eY=!1,z4=80,F8="async",V8="lazy",XJ=!1;var JJ=E(()=>{$4();xY()});function Vj(){return K8({name:"img",hasEndTag:!1,description:"Render an optimized responsive image with srcset and lazy loading",transform:async(X,$,Z,Y)=>{let{src:J,alt:G,options:Q}=Aj(X,$,Z);if(!J)return console.warn("@img directive: missing src argument"),"<!-- @img: missing src -->";let q={src:J,alt:G||"",widths:Q.widths||P5,formats:Q.formats||f7,quality:Q.quality,sizes:Q.sizes,dpr:Q.dpr,params:Q.params,placeholder:Q.placeholder,placeholderOptions:Q.placeholderOptions,lazy:Q.lazy!==!1,priority:Q.priority||!1,loading:Q.loading,decoding:Q.decoding,fetchpriority:Q.fetchpriority,objectFit:Q.objectFit,objectPosition:Q.objectPosition,class:Q.class,style:Q.style,id:Q.id,width:Q.width,height:Q.height},W=Z.__isDev||!1,K=await O8(q,{isDev:W}),U=K.html;if(K.preloadLink)U=K.preloadLink+`
12025
+ `+U;if(K.css)U+=`
12026
+ <style>${K.css}</style>`;if(K.script)U+=`
12027
+ <script>${K.script}</script>`;return U},defaults:{src:"",alt:"",options:{lazy:!0,placeholder:"none"}}})}function Aj(X,$,Z){if($.src)return{src:String($.src),alt:String($.alt||""),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@img(")||Y.startsWith("("))Y=Y.replace(/^@img\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=Rj(Y),G=_4(J[0],Z)||"",Q=_4(J[1],Z)||"",q={};if(J[2]){let W=_4(J[2],Z);if(typeof W==="object"&&W!==null)q=W;else if(typeof J[2]==="string")try{q=JSON.parse(J[2])}catch{}}return{src:G,alt:Q,options:q}}function Rj(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let q=0;q<X.length;q++){let W=X[q],K=q>0?X[q-1]:"";if((W==='"'||W==="'"||W==="`")&&K!=="\\"){if(!Y)Y=!0,J=W;else if(W===J)Y=!1,J="";else Z+=W;continue}if(!Y){if(W==="{")G++;if(W==="}")G--;if(W==="[")Q++;if(W==="]")Q--;if(W===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=W}if(Z.trim())$.push(Z.trim());return $}function _4(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var GJ;var QJ=E(()=>{a9();JJ();$4();GJ=Vj()});class R8{config;constructor(X={}){this.config={...Nj,...X}}async get(X,$){return z8(X,$,"video",this.config)}async set(X,$,Z){return w8(X,$,Z,"video",this.config)}async clear(){return j8("video",this.config)}updateConfig(X){this.config={...this.config,...X}}}function H4(X){if(!A8)A8=new R8(X);else if(X)A8.updateConfig(X);return A8}async function N8(X,$,Z){let Y=Z?{directory:`${Z.outputDir}/../.cache`}:{};return H4(Y).get(X,$)}async function T8(X,$,Z,Y){let J=Y?{directory:`${Y.outputDir}/../.cache`}:{};return H4(J).set(X,$,Z)}async function qJ(){return H4().clear()}var Nj,A8=null;var L4=E(()=>{Q4();Nj={enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:2000,cacheTranscoded:!0,cacheThumbnails:!0,cacheManifests:!0}});import{resolve as O4,basename as F4,extname as V4,join as M8}from"path";import{mkdir as A4}from"fs/promises";async function R4(){try{return await import("ts-videos")}catch{return null}}async function k8(X,$,Z,Y){let J=await R4();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate poster"),null;try{let G=O4(X);if(!await y0(G))return null;await A4(Z,{recursive:!0});let Q=await P0(G),q=F4(X,V4(X)),W=$.format||"webp",K=$.timestamp||0,U=`${q}-poster-${Q}.${W}`,z=M8(Z,U),w=await J.extractThumbnails(G,{timestamps:[K],width:$.width||1280,height:$.height,format:W,quality:$.quality||85,outputDir:Z,outputPattern:U.replace(`.${W}`,"")});if(w&&w.length>0){let B=w[0];return{path:z,url:`${Y}/${U}`,width:B.width||$.width||1280,height:B.height||720,timestamp:K,size:B.size||0}}return null}catch(G){return console.warn(`[stx-media] Failed to generate poster: ${G}`),null}}async function I8(X,$,Z,Y){let J=await R4();if(!J)return[];try{let G=O4(X);if(!await y0(G))return[];await A4(Z,{recursive:!0});let Q=await P0(G),q=F4(X,V4(X)),W=$.format||"webp",z=(await new J.Input(G).getInfo()).duration||60,w=$.count||10,B=$.interval||z/w,j=[];for(let H=0;H<w&&H*B<z;H++)j.push(H*B);let _=await J.extractThumbnails(G,{timestamps:j,width:$.width||320,format:W,quality:$.quality||80,outputDir:Z,outputPattern:`${q}-thumb-${Q}`});if(_&&_.length>0)return _.map((H,L)=>({path:H.path||M8(Z,`${q}-thumb-${Q}-${L}.${W}`),url:`${Y}/${q}-thumb-${Q}-${L}.${W}`,width:H.width||$.width||320,height:H.height||180,timestamp:j[L],size:H.size||0}));return[]}catch(G){return console.warn(`[stx-media] Failed to generate thumbnails: ${G}`),[]}}async function WJ(X,$,Z,Y){let J=await R4();if(!J)return console.warn("[stx-media] ts-videos not installed, cannot generate sprite sheet"),null;try{let G=O4(X);if(!await y0(G))return null;await A4(Z,{recursive:!0});let Q=await P0(G),q=F4(X,V4(X)),U=(await new J.Input(G).getInfo()).duration||60,z=$.columns||10,w=$.interval||5,B=$.thumbnailWidth||160,j=$.thumbnailHeight||90,_=$.format||"jpeg",H=Math.ceil(U/w),L=Math.ceil(H/z),O=`${q}-sprite-${Q}.${_}`,F=M8(Z,O),V=[];for(let R=0;R<H;R++)V.push(R*w);let A=await J.extractThumbnails(G,{timestamps:V,width:B,height:j,format:_,quality:$.quality||70,outputDir:M8(Z,".temp")});if(!A||A.length===0)return null;try{let R=await import("ts-images"),N=z*B,T=L*j,M=await R.createSprite({images:A.map((k)=>k.path),columns:z,padding:0,outputPath:F,format:_,quality:$.quality||70});return{url:`${Y}/${O}`,path:F,columns:z,rows:L,thumbnailWidth:B,thumbnailHeight:j,interval:w,totalFrames:H}}catch{return console.warn("[stx-media] ts-images not installed, sprite sheet generation skipped"),null}}catch(G){return console.warn(`[stx-media] Failed to generate sprite sheet: ${G}`),null}}var N4=E(()=>{J5()});import{resolve as UJ,basename as zJ,extname as wJ,join as G5}from"path";import{mkdir as E8,writeFile as jJ}from"fs/promises";async function BJ(){try{return await import("ts-videos")}catch{return null}}async function D8(X,$,Z,Y,J){let G=await BJ();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate HLS manifest"),null;try{let Q=UJ(X);if(!await y0(Q))return null;let q=await P0(Q),W=zJ(X,wJ(X)),K=G5(Z,`${W}-${q}-hls`);await E8(K,{recursive:!0});let U=$.length>0?$:_J,z=J?.segmentDuration||6,j=(await new G.Input(Q).getInfo()).duration||0,_=[],H=0;for(let F of U){let V=G5(K,F.label);await E8(V,{recursive:!0});let A=`${F.label}.m3u8`,R=G5(V,A);try{let N=await G.generateHLS(Q,{outputDir:V,segmentDuration:z,width:F.width,height:F.height,videoBitrate:F.bitrate,audioBitrate:F.audioBitrate,playlistName:F.label});if(N)_.push({quality:F,url:`${Y}/${W}-${q}-hls/${F.label}/${A}`,path:R}),H+=N.segmentCount||Math.ceil(j/z)}catch(N){console.warn(`[stx-media] Failed to generate HLS for ${F.label}: ${N}`)}}if(_.length===0)return null;let L=G5(K,"master.m3u8"),O=Tj(_,Y,W,q);return await jJ(L,O),{manifestUrl:`${Y}/${W}-${q}-hls/master.m3u8`,manifestPath:L,playlists:_,segmentCount:H,duration:j}}catch(Q){return console.warn(`[stx-media] Failed to generate HLS manifest: ${Q}`),null}}function Tj(X,$,Z,Y){let J=["#EXTM3U","#EXT-X-VERSION:3"];for(let G of X){let{quality:Q}=G,q=Q.bitrate+(Q.audioBitrate||128000),W=`${Q.width}x${Q.height||Math.round(Q.width*9/16)}`;J.push(`#EXT-X-STREAM-INF:BANDWIDTH=${q},RESOLUTION=${W},NAME="${Q.label}"`,`${Q.label}/${Q.label}.m3u8`)}return J.join(`
12028
+ `)}async function y8(X,$,Z,Y,J){let G=await BJ();if(!G)return console.warn("[stx-media] ts-videos not installed, cannot generate DASH manifest"),null;try{let Q=UJ(X);if(!await y0(Q))return null;let q=await P0(Q),W=zJ(X,wJ(X)),K=G5(Z,`${W}-${q}-dash`);await E8(K,{recursive:!0});let U=$.length>0?$:_J,z=J?.segmentDuration||4,w=J?.minBufferTime||2,_=(await new G.Input(Q).getInfo()).duration||0,H=[],L=[];for(let A of U){let R=G5(K,A.label);await E8(R,{recursive:!0});try{if(await G.generateDASH(Q,{outputDir:R,segmentDuration:z,width:A.width,height:A.height,videoBitrate:A.bitrate,audioBitrate:A.audioBitrate})){if(H.push({bandwidth:A.bitrate,width:A.width,height:A.height||Math.round(A.width*9/16),url:`${Y}/${W}-${q}-dash/${A.label}/video`}),A.audioBitrate)L.push({bandwidth:A.audioBitrate,url:`${Y}/${W}-${q}-dash/${A.label}/audio`})}}catch(N){console.warn(`[stx-media] Failed to generate DASH for ${A.label}: ${N}`)}}if(H.length===0)return null;let O=G5(K,"manifest.mpd"),F=Mj(H,L,_,z,w);await jJ(O,F);let V=[{type:"video",representations:H}];if(L.length>0)V.push({type:"audio",representations:L});return{manifestUrl:`${Y}/${W}-${q}-dash/manifest.mpd`,manifestPath:O,adaptationSets:V,duration:_}}catch(Q){return console.warn(`[stx-media] Failed to generate DASH manifest: ${Q}`),null}}function Mj(X,$,Z,Y,J){let G=KJ(Z),Q=KJ(J),q=`<?xml version="1.0" encoding="UTF-8"?>
12029
12029
  <MPD xmlns="urn:mpeg:dash:schema:mpd:2011"
12030
12030
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
12031
12031
  xsi:schemaLocation="urn:mpeg:dash:schema:mpd:2011 DASH-MPD.xsd"
@@ -12035,23 +12035,23 @@ ${A.join(`
12035
12035
  profiles="urn:mpeg:dash:profile:isoff-on-demand:2011">
12036
12036
  <Period>
12037
12037
  <AdaptationSet mimeType="video/mp4" codecs="avc1.64001f" segmentAlignment="true" startWithSAP="1">
12038
- `;for(let K=0;K<X.length;K++){let U=X[K];q+=` <Representation id="video${K}" bandwidth="${U.bandwidth}" width="${U.width}" height="${U.height}">
12039
- <BaseURL>${U.url}/</BaseURL>
12038
+ `;for(let W=0;W<X.length;W++){let K=X[W];q+=` <Representation id="video${W}" bandwidth="${K.bandwidth}" width="${K.width}" height="${K.height}">
12039
+ <BaseURL>${K.url}/</BaseURL>
12040
12040
  <SegmentBase indexRange="0-999">
12041
12041
  <Initialization range="0-999"/>
12042
12042
  </SegmentBase>
12043
12043
  </Representation>
12044
12044
  `}if(q+=` </AdaptationSet>
12045
12045
  `,$.length>0){q+=` <AdaptationSet mimeType="audio/mp4" codecs="mp4a.40.2" segmentAlignment="true" startWithSAP="1">
12046
- `;for(let K=0;K<$.length;K++){let U=$[K];q+=` <Representation id="audio${K}" bandwidth="${U.bandwidth}">
12047
- <BaseURL>${U.url}/</BaseURL>
12046
+ `;for(let W=0;W<$.length;W++){let K=$[W];q+=` <Representation id="audio${W}" bandwidth="${K.bandwidth}">
12047
+ <BaseURL>${K.url}/</BaseURL>
12048
12048
  <SegmentBase indexRange="0-999">
12049
12049
  <Initialization range="0-999"/>
12050
12050
  </SegmentBase>
12051
12051
  </Representation>
12052
12052
  `}q+=` </AdaptationSet>
12053
12053
  `}return q+=` </Period>
12054
- </MPD>`,q}function UJ(X){let $=Math.floor(X/3600),Z=Math.floor(X%3600/60),Y=Math.floor(X%60),J="PT";if($>0)J+=`${$}H`;if(Z>0)J+=`${Z}M`;return J+=`${Y}S`,J}var _J;var T4=E(()=>{J5();_J=[{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 HJ,basename as Tj,extname as Mj,join as kj}from"path";import{mkdir as Ij}from"fs/promises";async function OJ(){try{return await import("ts-videos")}catch{return null}}function Ej(X){switch(X){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function Dj(X){switch(X){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function M4(X){let $=await OJ();if(!$)return null;try{let Z=HJ(X),J=await new $.Input(Z).getInfo();return{duration:J.duration||0,width:J.width||0,height:J.height||0,frameRate:J.frameRate||0,bitrate:J.bitrate||0,codec:J.videoCodec||"",audioCodec:J.audioCodec}}catch(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function LJ(X,$,Z,Y){let J=await OJ();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:X,processed:!1};let G=await N8(X,$,Z);if(G)return G;try{let Q=HJ(X);if(!await y0(Q))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let q=Z.outputDir||"dist/videos",K=Z.baseUrl||"/videos";await Ij(q,{recursive:!0});let U=await P0(Q),W=Tj(X,Mj(X)),z={src:X,processed:!0,hash:U};Y?.({percentage:5,stage:"analyzing"}),z.metadata=await M4(Q)||void 0;let w={};if($.quality)w.bitrate=Ej($.quality);if($.platform)Object.assign(w,Dj($.platform));if($.transcode)Object.assign(w,$.transcode);if(Object.keys(w).length>0||$.process){Y?.({percentage:10,stage:"transcoding"});let B=`${W}-${U}.mp4`,j=kj(q,B);try{let _=await yj(Q,j,w,J,(H)=>Y?.({percentage:10+H*0.5,stage:"transcoding"}));if(_)z.transcoded={path:j,url:`${K}/${B}`,duration:_.duration,size:_.size,video:{codec:w.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:w.audioCodec||"aac",bitrate:w.audioBitrate||128000,sampleRate:w.sampleRate||48000,channels:w.channels||2}:void 0}}catch(_){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${_}`)}}if($.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let B=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},j=await k8(Q,B,q,K);if(j)z.poster=j}if(Z.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let B=await I8(Q,Z.thumbnails,q,K);if(B.length>0)z.thumbnails=B}if($.streaming){Y?.({percentage:80,stage:"generating-manifests"});let B=typeof $.streaming==="object"?$.streaming:Z.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let j=await D8(Q,B.qualities||Z.streaming?.defaultQualities||[],q,K);if(j)z.streaming={...z.streaming,hls:j}}if(B.format==="dash"){let j=await y8(Q,B.qualities||Z.streaming?.defaultQualities||[],q,K);if(j)z.streaming={...z.streaming,dash:j}}}if($.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await T8(X,$,z,Z),z}catch(Q){return{src:X,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function yj(X,$,Z,Y,J){try{let Q=await new Y.Conversion(X,$,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((q)=>{J?.(q.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Z.maxWidth||0,height:Q.height||Z.maxHeight||0,bitrate:Q.bitrate||Z.bitrate||0,frameRate:Q.frameRate||Z.frameRate||30,audioCodec:Q.audioCodec}}catch(G){return console.error(`[stx-media] Transcoding failed: ${G}`),null}}var FJ=E(()=>{J5();O4();N4();T4()});var VJ={};n(VJ,{setCachedVideoResult:()=>T8,processVideo:()=>LJ,getCachedVideoResult:()=>N8,generateThumbnails:()=>I8,generateSpriteSheet:()=>KJ,generatePoster:()=>k8,generateHLSManifest:()=>D8,generateDASHManifest:()=>y8,clearVideoCache:()=>qJ,analyzeVideo:()=>M4,VideoProcessorCache:()=>R8});var AJ=E(()=>{FJ();N4();T4();O4()});async function NJ(){try{return await Promise.resolve().then(() => (AJ(),VJ))}catch(X){if(!RJ)console.warn("[stx-media] Video processor not available, some features disabled:",X),RJ=!0;return null}}async function b8(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return xj(Y,Z)}if(Z.processedResult?.processed)return IJ(X,Z.processedResult,$);let J;if(Y.generatePoster&&Y.src&&!X.poster)J=await fj(Y,Z);let{src:G,sources:Q=[],poster:q,posterPlaceholder:K,controls:U=TJ,autoplay:W=!1,muted:z=!1,loop:w=!1,preload:B=MJ,playsinline:j=!0,lazy:_=!0,player:H="native",type:O,width:L,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=X,N=J||q,T=X.class,M=X.style,k=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(H==="ts-video")return Cj(X,$);if(O&&O!=="video")return Sj(G||"",O,X);let D=Q.length>0?Q:G?[{src:G,type:kJ(G)}]:[],I=[`id="${k}"`];if(U)I.push("controls");if(W)I.push("autoplay");if(z)I.push("muted");if(w)I.push("loop");if(j)I.push("playsinline");if(A)I.push("disablepictureinpicture");if(R)I.push("disableremoteplayback");if(V)I.push(`crossorigin="${V}"`);if(_){if(I.push(`data-preload="${B}"`),I.push('preload="none"'),N)I.push(`data-poster="${N0(N)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),N)I.push(`poster="${N0(N)}"`);if(L)I.push(`width="${L}"`);if(F)I.push(`height="${F}"`);if(T)I.push(`class="${N0(T)}"`);if(M)I.push(`style="${N0(M)}"`);let S=D.map((P)=>{return` <source ${_?`data-src="${N0(P.src)}"`:`src="${N0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
12054
+ </MPD>`,q}function KJ(X){let $=Math.floor(X/3600),Z=Math.floor(X%3600/60),Y=Math.floor(X%60),J="PT";if($>0)J+=`${$}H`;if(Z>0)J+=`${Z}M`;return J+=`${Y}S`,J}var _J;var T4=E(()=>{J5();_J=[{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 HJ,basename as kj,extname as Ij,join as Ej}from"path";import{mkdir as Dj}from"fs/promises";async function LJ(){try{return await import("ts-videos")}catch{return null}}function yj(X){switch(X){case"very-low":return 500000;case"low":return 1e6;case"medium":return 2500000;case"high":return 5000000;case"very-high":return 1e7;case"lossless":return 0;default:return 2500000}}function bj(X){switch(X){case"youtube":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};case"twitter":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"instagram-feed":return{codec:"h264",maxWidth:1080,maxHeight:1080,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"instagram-story":case"instagram-reels":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:3500000,audioCodec:"aac",audioBitrate:128000};case"tiktok":return{codec:"h264",maxWidth:1080,maxHeight:1920,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"discord":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:60,bitrate:8000000,audioCodec:"aac",audioBitrate:192000};case"linkedin":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,bitrate:5000000,audioCodec:"aac",audioBitrate:128000};case"facebook":return{codec:"h264",maxWidth:1280,maxHeight:720,frameRate:30,bitrate:4000000,audioCodec:"aac",audioBitrate:128000};case"web-progressive":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000,twoPass:!0};case"web-streaming":return{codec:"h264",maxWidth:1920,maxHeight:1080,frameRate:30,audioCodec:"aac",audioBitrate:128000};default:return{}}}async function M4(X){let $=await LJ();if(!$)return null;try{let Z=HJ(X),J=await new $.Input(Z).getInfo();return{duration:J.duration||0,width:J.width||0,height:J.height||0,frameRate:J.frameRate||0,bitrate:J.bitrate||0,codec:J.videoCodec||"",audioCodec:J.audioCodec}}catch(Z){return console.warn(`[stx-media] Failed to analyze video: ${Z}`),null}}async function OJ(X,$,Z,Y){let J=await LJ();if(!J)return console.warn("[stx-media] ts-videos not installed, skipping processing"),{src:X,processed:!1};let G=await N8(X,$,Z);if(G)return G;try{let Q=HJ(X);if(!await y0(Q))return{src:X,processed:!1,errors:[`Source file not found: ${X}`]};let q=Z.outputDir||"dist/videos",W=Z.baseUrl||"/videos";await Dj(q,{recursive:!0});let K=await P0(Q),U=kj(X,Ij(X)),z={src:X,processed:!0,hash:K};Y?.({percentage:5,stage:"analyzing"}),z.metadata=await M4(Q)||void 0;let w={};if($.quality)w.bitrate=yj($.quality);if($.platform)Object.assign(w,bj($.platform));if($.transcode)Object.assign(w,$.transcode);if(Object.keys(w).length>0||$.process){Y?.({percentage:10,stage:"transcoding"});let B=`${U}-${K}.mp4`,j=Ej(q,B);try{let _=await Sj(Q,j,w,J,(H)=>Y?.({percentage:10+H*0.5,stage:"transcoding"}));if(_)z.transcoded={path:j,url:`${W}/${B}`,duration:_.duration,size:_.size,video:{codec:w.codec||"h264",width:_.width,height:_.height,bitrate:_.bitrate,frameRate:_.frameRate},audio:_.audioCodec?{codec:w.audioCodec||"aac",bitrate:w.audioBitrate||128000,sampleRate:w.sampleRate||48000,channels:w.channels||2}:void 0}}catch(_){z.errors=z.errors||[],z.errors.push(`Transcoding failed: ${_}`)}}if($.generatePoster){Y?.({percentage:65,stage:"generating-poster"});let B=typeof $.generatePoster==="object"?$.generatePoster:{timestamp:0},j=await k8(Q,B,q,W);if(j)z.poster=j}if(Z.thumbnails?.enabled){Y?.({percentage:70,stage:"generating-thumbnails"});let B=await I8(Q,Z.thumbnails,q,W);if(B.length>0)z.thumbnails=B}if($.streaming){Y?.({percentage:80,stage:"generating-manifests"});let B=typeof $.streaming==="object"?$.streaming:Z.streaming||{format:"hls"};if(B.format==="hls"||B.format===void 0){let j=await D8(Q,B.qualities||Z.streaming?.defaultQualities||[],q,W);if(j)z.streaming={...z.streaming,hls:j}}if(B.format==="dash"){let j=await y8(Q,B.qualities||Z.streaming?.defaultQualities||[],q,W);if(j)z.streaming={...z.streaming,dash:j}}}if($.spriteSheet)Y?.({percentage:90,stage:"generating-sprite-sheet"});return Y?.({percentage:100,stage:"complete"}),await T8(X,$,z,Z),z}catch(Q){return{src:X,processed:!1,errors:[`Processing failed: ${Q}`]}}}async function Sj(X,$,Z,Y,J){try{let Q=await new Y.Conversion(X,$,{videoCodec:Z.codec,videoBitrate:Z.bitrate,width:Z.maxWidth,height:Z.maxHeight,frameRate:Z.frameRate,audioCodec:Z.audioCodec,audioBitrate:Z.audioBitrate,sampleRate:Z.sampleRate,channels:Z.channels}).run((q)=>{J?.(q.percentage/100)});return{duration:Q.duration||0,size:Q.size||0,width:Q.width||Z.maxWidth||0,height:Q.height||Z.maxHeight||0,bitrate:Q.bitrate||Z.bitrate||0,frameRate:Q.frameRate||Z.frameRate||30,audioCodec:Q.audioCodec}}catch(G){return console.error(`[stx-media] Transcoding failed: ${G}`),null}}var FJ=E(()=>{J5();L4();N4();T4()});var VJ={};i(VJ,{setCachedVideoResult:()=>T8,processVideo:()=>OJ,getCachedVideoResult:()=>N8,generateThumbnails:()=>I8,generateSpriteSheet:()=>WJ,generatePoster:()=>k8,generateHLSManifest:()=>D8,generateDASHManifest:()=>y8,clearVideoCache:()=>qJ,analyzeVideo:()=>M4,VideoProcessorCache:()=>R8});var AJ=E(()=>{FJ();N4();T4();L4()});async function NJ(){try{return await Promise.resolve().then(() => (AJ(),VJ))}catch(X){if(!RJ)console.warn("[stx-media] Video processor not available, some features disabled:",X),RJ=!0;return null}}async function b8(X,$={}){let Z=$,Y=X;if(Y.process&&!Y.skipProcessing){if(Z.tsVideosConfig?.enabled&&!Z.isDev)return gj(Y,Z)}if(Z.processedResult?.processed)return IJ(X,Z.processedResult,$);let J;if(Y.generatePoster&&Y.src&&!X.poster)J=await hj(Y,Z);let{src:G,sources:Q=[],poster:q,posterPlaceholder:W,controls:K=TJ,autoplay:U=!1,muted:z=!1,loop:w=!1,preload:B=MJ,playsinline:j=!0,lazy:_=!0,player:H="native",type:L,width:O,height:F,crossorigin:V,disablePictureInPicture:A=!1,disableRemotePlayback:R=!1}=X,N=J||q,T=X.class,M=X.style,k=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`;if(H==="ts-video")return vj(X,$);if(L&&L!=="video")return Pj(G||"",L,X);let D=Q.length>0?Q:G?[{src:G,type:kJ(G)}]:[],I=[`id="${k}"`];if(K)I.push("controls");if(U)I.push("autoplay");if(z)I.push("muted");if(w)I.push("loop");if(j)I.push("playsinline");if(A)I.push("disablepictureinpicture");if(R)I.push("disableremoteplayback");if(V)I.push(`crossorigin="${V}"`);if(_){if(I.push(`data-preload="${B}"`),I.push('preload="none"'),N)I.push(`data-poster="${N0(N)}"`);I.push("data-stx-lazy")}else if(I.push(`preload="${B}"`),N)I.push(`poster="${N0(N)}"`);if(O)I.push(`width="${O}"`);if(F)I.push(`height="${F}"`);if(T)I.push(`class="${N0(T)}"`);if(M)I.push(`style="${N0(M)}"`);let S=D.map((P)=>{return` <source ${_?`data-src="${N0(P.src)}"`:`src="${N0(P.src)}"`} type="${P.type}"${P.media?` media="${P.media}"`:""} />`}).join(`
12055
12055
  `),b=`<video ${I.join(" ")}>
12056
12056
  ${S}
12057
12057
  Your browser does not support the video tag.
@@ -12090,15 +12090,15 @@ ${S}
12090
12090
 
12091
12091
  observer.observe(video);
12092
12092
  })();
12093
- `.trim();return{html:b,script:y}}function Sj(X,$,Z){let{width:Y=640,height:J=360}=Z,G=Z.class,Q=Z.style,q=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,K,U=null;switch($){case"youtube":U=Pj(X),K=U?`https://www.youtube-nocookie.com/embed/${U}`:X;break;case"vimeo":U=vj(X),K=U?`https://player.vimeo.com/video/${U}`:X;break;case"dailymotion":U=X.split("/").pop()||"",K=`https://www.dailymotion.com/embed/video/${U}`;break;case"twitch":U=X.split("/").pop()||"",K=`https://player.twitch.tv/?video=${U}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:K=X}let W=[`id="${q}"`,`src="${N0(K)}"`,`width="${Y}"`,`height="${J}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)W.push(`class="${N0(G)}"`);if(Q)W.push(`style="${N0(Q)}"`);if(Z.lazy)W.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
12094
- <iframe ${W.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
12095
- </div>`}}function Cj(X,$={}){let{src:Z,sources:Y=[],poster:J,controls:G=!0,autoplay:Q=!1,muted:q=!1,loop:K=!1,preload:U="metadata",playsinline:W=!0,lazy:z=!0,width:w,height:B}=X,j=X.class,_=X.style,H=X.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,O={src:Y.length>0?Y:Z,autoplay:Q,loop:K,muted:q,playsinline:W,preload:U,poster:J,controls:G,title:X.title},L=["position: relative",w?`width: ${typeof w==="number"?w+"px":w}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",_||""].filter(Boolean).join("; "),F=`
12093
+ `.trim();return{html:b,script:y}}function Pj(X,$,Z){let{width:Y=640,height:J=360}=Z,G=Z.class,Q=Z.style,q=Z.id||`stx-embed-${Math.random().toString(36).slice(2,8)}`,W,K=null;switch($){case"youtube":K=xj(X),W=K?`https://www.youtube-nocookie.com/embed/${K}`:X;break;case"vimeo":K=fj(X),W=K?`https://player.vimeo.com/video/${K}`:X;break;case"dailymotion":K=X.split("/").pop()||"",W=`https://www.dailymotion.com/embed/video/${K}`;break;case"twitch":K=X.split("/").pop()||"",W=`https://player.twitch.tv/?video=${K}&parent=${typeof window<"u"?window.location.hostname:"localhost"}`;break;default:W=X}let U=[`id="${q}"`,`src="${N0(W)}"`,`width="${Y}"`,`height="${J}"`,'frameborder="0"',"allowfullscreen",'allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"'];if(G)U.push(`class="${N0(G)}"`);if(Q)U.push(`style="${N0(Q)}"`);if(Z.lazy)U.push('loading="lazy"');return{html:`<div class="stx-video-embed" style="position:relative;padding-bottom:56.25%;height:0;overflow:hidden;">
12094
+ <iframe ${U.join(" ")} style="position:absolute;top:0;left:0;width:100%;height:100%;"></iframe>
12095
+ </div>`}}function vj(X,$={}){let{src:Z,sources:Y=[],poster:J,controls:G=!0,autoplay:Q=!1,muted:q=!1,loop:W=!1,preload:K="metadata",playsinline:U=!0,lazy:z=!0,width:w,height:B}=X,j=X.class,_=X.style,H=X.id||`ts-video-${Math.random().toString(36).slice(2,8)}`,L={src:Y.length>0?Y:Z,autoplay:Q,loop:W,muted:q,playsinline:U,preload:K,poster:J,controls:G,title:X.title},O=["position: relative",w?`width: ${typeof w==="number"?w+"px":w}`:"width: 100%",B?`height: ${typeof B==="number"?B+"px":B}`:"",_||""].filter(Boolean).join("; "),F=`
12096
12096
  <div
12097
12097
  id="${H}"
12098
12098
  class="ts-video-player${j?" "+N0(j):""}"
12099
- style="${L}"
12099
+ style="${O}"
12100
12100
  data-ts-video-player
12101
- data-config='${JSON.stringify(O)}'
12101
+ data-config='${JSON.stringify(L)}'
12102
12102
  ${z?"data-lazy":""}
12103
12103
  >
12104
12104
  <div class="ts-video-player__container">
@@ -12129,7 +12129,7 @@ ${S}
12129
12129
 
12130
12130
  // Load ts-video-player from CDN
12131
12131
  var script = document.createElement('script');
12132
- script.src = '${bj}';
12132
+ script.src = '${Cj}';
12133
12133
  script.onload = initPlayer;
12134
12134
  script.onerror = function() {
12135
12135
  console.error('[stx] Failed to load ts-video-player');
@@ -12259,14 +12259,14 @@ else {
12259
12259
  .ts-video-player__play-button svg {
12260
12260
  margin-left: 4px;
12261
12261
  }
12262
- `.trim();return{html:F,script:V,css:A}}function kJ(X){switch(X.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function Pj(X){let $=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of $){let Y=X.match(Z);if(Y)return Y[1]}return null}function vj(X){let $=X.match(/vimeo\.com\/(\d+)/);return $?$[1]:null}function N0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function xj(X,$){let Z=await NJ();if(!Z)return b8({...X,process:!1},$);let Y=$.tsVideosConfig,J=await Z.processVideo(X.src,X,Y,X.onProcessProgress);if(J.processed)return IJ(X,J,$);return b8({...X,process:!1},$)}async function fj(X,$){let Z=await NJ();if(!Z||!X.src)return;let Y=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},J=$.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster(X.src,Y,J.outputDir,J.baseUrl||"/videos"))?.url}function IJ(X,$,Z){let{controls:Y=TJ,autoplay:J=!1,muted:G=!1,loop:Q=!1,preload:q=MJ,playsinline:K=!0,lazy:U=!0,width:W,height:z,crossorigin:w,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=X,_=X.class,H=X.style,O=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,L=X.src,F=kJ(L);if($.transcoded)L=$.transcoded.url,F="video/mp4";let V=$.streaming?.hls||$.streaming?.dash;if(V){if($.streaming?.hls)L=$.streaming.hls.manifestUrl,F="application/x-mpegURL";else if($.streaming?.dash)L=$.streaming.dash.manifestUrl,F="application/dash+xml"}let A=$.poster?.url||X.poster,R=[`id="${O}"`];if(Y)R.push("controls");if(J)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(K)R.push("playsinline");if(B)R.push("disablepictureinpicture");if(j)R.push("disableremoteplayback");if(w)R.push(`crossorigin="${w}"`);if(U){if(R.push(`data-preload="${q}"`),R.push('preload="none"'),A)R.push(`data-poster="${N0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${q}"`),A)R.push(`poster="${N0(A)}"`);let N=W||$.metadata?.width,T=z||$.metadata?.height;if(N)R.push(`width="${N}"`);if(T)R.push(`height="${T}"`);if(_)R.push(`class="${N0(_)}"`);if(H)R.push(`style="${N0(H)}"`);let k=` <source ${U?`data-src="${N0(L)}"`:`src="${N0(L)}"`} type="${F}" />`,D=`<video ${R.join(" ")}>
12262
+ `.trim();return{html:F,script:V,css:A}}function kJ(X){switch(X.split(".").pop()?.toLowerCase()){case"mp4":return"video/mp4";case"webm":return"video/webm";case"ogg":case"ogv":return"video/ogg";case"mov":return"video/quicktime";case"avi":return"video/x-msvideo";case"mkv":return"video/x-matroska";case"m3u8":return"application/x-mpegURL";default:return"video/mp4"}}function xj(X){let $=[/youtube\.com\/watch\?v=([^&]+)/,/youtube\.com\/embed\/([^?]+)/,/youtu\.be\/([^?]+)/,/youtube\.com\/v\/([^?]+)/];for(let Z of $){let Y=X.match(Z);if(Y)return Y[1]}return null}function fj(X){let $=X.match(/vimeo\.com\/(\d+)/);return $?$[1]:null}function N0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}async function gj(X,$){let Z=await NJ();if(!Z)return b8({...X,process:!1},$);let Y=$.tsVideosConfig,J=await Z.processVideo(X.src,X,Y,X.onProcessProgress);if(J.processed)return IJ(X,J,$);return b8({...X,process:!1},$)}async function hj(X,$){let Z=await NJ();if(!Z||!X.src)return;let Y=typeof X.generatePoster==="object"?X.generatePoster:{timestamp:0},J=$.tsVideosConfig||{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos"};return(await Z.generatePoster(X.src,Y,J.outputDir,J.baseUrl||"/videos"))?.url}function IJ(X,$,Z){let{controls:Y=TJ,autoplay:J=!1,muted:G=!1,loop:Q=!1,preload:q=MJ,playsinline:W=!0,lazy:K=!0,width:U,height:z,crossorigin:w,disablePictureInPicture:B=!1,disableRemotePlayback:j=!1}=X,_=X.class,H=X.style,L=X.id||`stx-video-${Math.random().toString(36).slice(2,8)}`,O=X.src,F=kJ(O);if($.transcoded)O=$.transcoded.url,F="video/mp4";let V=$.streaming?.hls||$.streaming?.dash;if(V){if($.streaming?.hls)O=$.streaming.hls.manifestUrl,F="application/x-mpegURL";else if($.streaming?.dash)O=$.streaming.dash.manifestUrl,F="application/dash+xml"}let A=$.poster?.url||X.poster,R=[`id="${L}"`];if(Y)R.push("controls");if(J)R.push("autoplay");if(G)R.push("muted");if(Q)R.push("loop");if(W)R.push("playsinline");if(B)R.push("disablepictureinpicture");if(j)R.push("disableremoteplayback");if(w)R.push(`crossorigin="${w}"`);if(K){if(R.push(`data-preload="${q}"`),R.push('preload="none"'),A)R.push(`data-poster="${N0(A)}"`);R.push("data-stx-lazy")}else if(R.push(`preload="${q}"`),A)R.push(`poster="${N0(A)}"`);let N=U||$.metadata?.width,T=z||$.metadata?.height;if(N)R.push(`width="${N}"`);if(T)R.push(`height="${T}"`);if(_)R.push(`class="${N0(_)}"`);if(H)R.push(`style="${N0(H)}"`);let k=` <source ${K?`data-src="${N0(O)}"`:`src="${N0(O)}"`} type="${F}" />`,D=`<video ${R.join(" ")}>
12263
12263
  ${k}
12264
12264
  Your browser does not support the video tag.
12265
12265
  </video>`;if($.spriteSheet)D=`<div class="stx-video-wrapper" data-sprite-sheet="${N0($.spriteSheet.url)}" data-sprite-cols="${$.spriteSheet.columns}" data-sprite-interval="${$.spriteSheet.interval}">
12266
12266
  ${D}
12267
- </div>`;let I;if(U)I=`
12267
+ </div>`;let I;if(K)I=`
12268
12268
  (function() {
12269
- var video = document.getElementById('${O}');
12269
+ var video = document.getElementById('${L}');
12270
12270
  if (!video) return;
12271
12271
 
12272
12272
  var observer = new IntersectionObserver(function(entries) {
@@ -12308,9 +12308,9 @@ ${D}
12308
12308
  width: 100%;
12309
12309
  height: auto;
12310
12310
  }
12311
- `.trim();return{html:D,script:I,css:S}}var RJ=!1,TJ=!0,MJ="metadata",bj="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var EJ=E(()=>{I4()});function DJ(){return U8({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(X,$,Z,Y)=>{let{src:J,options:G}=gj(X,$,Z);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:J,poster:G.poster,controls:G.controls!==!1,autoplay:G.autoplay||!1,muted:G.muted||!1,loop:G.loop||!1,preload:G.preload||"metadata",playsinline:G.playsinline!==!1,lazy:G.lazy!==!1,player:G.player||"native",type:G.type,width:G.width,height:G.height,class:G.class,style:G.style,id:G.id,crossorigin:G.crossorigin,disablePictureInPicture:G.disablePictureInPicture,disableRemotePlayback:G.disableRemotePlayback,title:G.title,quality:G.quality,platform:G.platform,process:G.process,generatePoster:G.generatePoster,streaming:G.streaming,transcode:G.transcode,spriteSheet:G.spriteSheet,waveform:G.waveform},K={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},U=await b8(Q,K),W=U.html;if(U.css)W+=`
12312
- <style>${U.css}</style>`;if(U.script)W+=`
12313
- <script>${U.script}</script>`;return W},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function gj(X,$,Z){if($.src)return{src:String($.src),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=hj(Y),G=yJ(J[0],Z)||"",Q={};if(J[1]){let q=yJ(J[1],Z);if(typeof q==="object"&&q!==null)Q=q;else if(typeof J[1]==="string")try{Q=JSON.parse(J[1])}catch{}}return{src:G,options:Q}}function hj(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let q=0;q<X.length;q++){let K=X[q],U=q>0?X[q-1]:"";if((K==='"'||K==="'"||K==="`")&&U!=="\\"){if(!Y)Y=!0,J=K;else if(K===J)Y=!1,J="";else Z+=K;continue}if(!Y){if(K==="{")G++;if(K==="}")G--;if(K==="[")Q++;if(K==="]")Q--;if(K===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=K}if(Z.trim())$.push(Z.trim());return $}function yJ(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var k4;var I4=E(()=>{a9();EJ();k4=DJ()});function uj(X,$){let Z=$.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
12311
+ `.trim();return{html:D,script:I,css:S}}var RJ=!1,TJ=!0,MJ="metadata",Cj="https://cdn.jsdelivr.net/npm/ts-video-player@latest/dist/index.min.js";var EJ=E(()=>{I4()});function DJ(){return K8({name:"video",hasEndTag:!1,description:"Render a video with optional ts-videos processing, streaming, and poster generation",transform:async(X,$,Z,Y)=>{let{src:J,options:G}=uj(X,$,Z);if(!J)return console.warn("@video directive: missing src argument"),"<!-- @video: missing src -->";let Q={src:J,poster:G.poster,controls:G.controls!==!1,autoplay:G.autoplay||!1,muted:G.muted||!1,loop:G.loop||!1,preload:G.preload||"metadata",playsinline:G.playsinline!==!1,lazy:G.lazy!==!1,player:G.player||"native",type:G.type,width:G.width,height:G.height,class:G.class,style:G.style,id:G.id,crossorigin:G.crossorigin,disablePictureInPicture:G.disablePictureInPicture,disableRemotePlayback:G.disableRemotePlayback,title:G.title,quality:G.quality,platform:G.platform,process:G.process,generatePoster:G.generatePoster,streaming:G.streaming,transcode:G.transcode,spriteSheet:G.spriteSheet,waveform:G.waveform},W={isDev:Z.__isDev||!1,tsVideosConfig:Z.__tsVideosConfig},K=await b8(Q,W),U=K.html;if(K.css)U+=`
12312
+ <style>${K.css}</style>`;if(K.script)U+=`
12313
+ <script>${K.script}</script>`;return U},defaults:{src:"",options:{controls:!0,lazy:!0,preload:"metadata"}}})}function uj(X,$,Z){if($.src)return{src:String($.src),options:$.options||{}};let Y=X.trim();if(Y.startsWith("@video(")||Y.startsWith("("))Y=Y.replace(/^@video\(/,"").replace(/^\(/,"").replace(/\)$/,"");let J=dj(Y),G=yJ(J[0],Z)||"",Q={};if(J[1]){let q=yJ(J[1],Z);if(typeof q==="object"&&q!==null)Q=q;else if(typeof J[1]==="string")try{Q=JSON.parse(J[1])}catch{}}return{src:G,options:Q}}function dj(X){let $=[],Z="",Y=!1,J="",G=0,Q=0;for(let q=0;q<X.length;q++){let W=X[q],K=q>0?X[q-1]:"";if((W==='"'||W==="'"||W==="`")&&K!=="\\"){if(!Y)Y=!0,J=W;else if(W===J)Y=!1,J="";else Z+=W;continue}if(!Y){if(W==="{")G++;if(W==="}")G--;if(W==="[")Q++;if(W==="]")Q--;if(W===","&&G===0&&Q===0){$.push(Z.trim()),Z="";continue}}Z+=W}if(Z.trim())$.push(Z.trim());return $}function yJ(X,$){if(typeof X!=="string")return X;let Z=X.trim();if(Z.startsWith('"')&&Z.endsWith('"')||Z.startsWith("'")&&Z.endsWith("'"))return Z.slice(1,-1);if(!Z.startsWith("/")&&!Z.startsWith(".")&&!Z.startsWith("http")&&!Z.startsWith("{")){let Y=$[Z];if(Y!==void 0)return Y}if(Z.startsWith("{")||Z.startsWith("["))try{return JSON.parse(Z)}catch{}return Z}var k4;var I4=E(()=>{a9();EJ();k4=DJ()});function mj(X,$){let Z=$.pwa?.manifest?.themeColor||"#4f46e5";return`<div class="stx-pwa-install" style="display:none;">
12314
12314
  ${X}
12315
12315
  </div>
12316
12316
  <script>
@@ -12355,7 +12355,7 @@ ${D}
12355
12355
  }
12356
12356
  }
12357
12357
  })();
12358
- </script>`}function dj(X,$){let Z=$.pwa?.updates,Y=Z?.message||"A new version is available. Reload to update?",J=Z?.autoReload||!1,G=X.trim().length>0,Q=`
12358
+ </script>`}function lj(X,$){let Z=$.pwa?.updates,Y=Z?.message||"A new version is available. Reload to update?",J=Z?.autoReload||!1,G=X.trim().length>0,Q=`
12359
12359
  <div class="stx-pwa-update-banner" style="
12360
12360
  position: fixed;
12361
12361
  bottom: 0;
@@ -12466,7 +12466,7 @@ else {
12466
12466
  // Also listen for custom event
12467
12467
  window.addEventListener('pwa-update-available', showUpdate);
12468
12468
  })();
12469
- </script>`}function mj(X,$){let Z=X.trim().length>0,Y=`
12469
+ </script>`}function cj(X,$){let Z=X.trim().length>0,Y=`
12470
12470
  <div class="stx-offline-indicator" style="
12471
12471
  position: fixed;
12472
12472
  top: 16px;
@@ -12527,7 +12527,7 @@ else {
12527
12527
  window.addEventListener('offline', updateStatus);
12528
12528
  updateStatus();
12529
12529
  })();
12530
- </script>`}function lj(X,$){let Z=$.pwa?.push,Y=Z?.vapidPublicKey||"",J=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
12530
+ </script>`}function pj(X,$){let Z=$.pwa?.push,Y=Z?.vapidPublicKey||"",J=Z?.subscriptionEndpoint||"/api/push/subscribe";return`<div class="stx-pwa-push" style="display:none;">
12531
12531
  ${X}
12532
12532
  </div>
12533
12533
  <script>
@@ -12609,71 +12609,71 @@ catch (error) {
12609
12609
  init();
12610
12610
  }
12611
12611
  })();
12612
- </script>`}function QT(X){return[...X,...E4]}var cj,pj,ij,nj,E4;var D4=E(()=>{cj={name:"pwa.installButton",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return uj(X,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},pj={name:"pwa.updatePrompt",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return dj(X,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},ij={name:"pwa.offlineIndicator",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return mj(X,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},nj={name:"pwa.pushSubscribe",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return lj(X,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},E4=[cj,pj,ij,nj]});function y4(X){for(let[$,Z]of Object.entries(s))if(Z===X)return $;return}var s;var S8=E(()=>{s={UNCLOSED_DIRECTIVE:1001,UNCLOSED_EXPRESSION:1002,INVALID_DIRECTIVE_SYNTAX:1003,MALFORMED_EXPRESSION:1004,UNEXPECTED_TOKEN:1005,UNDEFINED_VARIABLE:1101,TYPE_ERROR:1102,EVALUATION_ERROR:1103,INFINITE_LOOP:1104,CIRCULAR_REFERENCE:1105,UNSAFE_EXPRESSION:1201,PATH_TRAVERSAL:1202,XSS_ATTEMPT:1203,CODE_INJECTION:1204,DOM_API_VIOLATION:1205,FILE_NOT_FOUND:1301,FILE_READ_ERROR:1302,INVALID_FILE_PATH:1303,PERMISSION_DENIED:1304,INVALID_CONFIG:1401,MISSING_REQUIRED_CONFIG:1402,DEPRECATED_CONFIG:1403,COMPONENT_NOT_FOUND:1501,INVALID_PROPS:1502,COMPONENT_RENDER_ERROR:1503,FILTER_NOT_FOUND:1601,INVALID_FILTER_ARGS:1602,EXPRESSION_TIMEOUT:1603}});function h7(){return!1}function u7(){return!h7()||process.env.STX_DEBUG==="true"}function C8(){return!1}import rj from"path";function P8(){return{...b4}}function v8(X){if(!b4.showRelativePaths||!X)return X;let $=b4.baseDir||process.cwd();try{let Z=rj.relative($,X);return Z.startsWith("..")?X:Z}catch{return X}}var oj,b4,x8,Q5,f8;var g8=E(()=>{S8();oj={showRelativePaths:!1,enableAutoRecovery:u7(),logRecoveryWarnings:!0},b4={...oj};x8=class x8 extends Error{code;filePath;line;column;context;numericCode;constructor(X,$,Z,Y,J,G,Q){super(X);this.code=$;this.filePath=Z;this.line=Y;this.column=J;this.context=G;if(this.name="StxError",this.numericCode=Q||s.EVALUATION_ERROR,this.filePath)this.filePath=v8(this.filePath)}};Q5=class Q5 extends x8{constructor(X,$,Z,Y,J,G){super(X,"stx_RUNTIME_ERROR",$,Z,Y,J,G||s.EVALUATION_ERROR);this.name="StxRuntimeError"}};f8=class f8 extends x8{isFatal=!0;constructor(X,$,Z,Y,J,G){super(X,"stx_VALIDATION_ERROR",$,Z,Y,J,G||s.DOM_API_VIOLATION);this.name="StxValidationError"}}});function SJ(X){let{type:$,message:Z,code:Y,filePath:J,line:G,column:Q,template:q,offset:K,snippet:U,suggestion:W,format:z="text"}=X,w=G,B=Q;if(!w&&q&&K!==void 0){let L=$B(q,K);w=L.line,B=L.column}let j=J?v8(J):void 0,_=Y?y4(Y):void 0,H={type:$,code:Y,codeName:_,message:Z,filePath:j,line:w,column:B,snippet:U,suggestion:W,timestamp:new Date().toISOString()},O;switch(z){case"html":O=aj(H);break;case"json":O=JSON.stringify(H,null,2);break;case"console":O=tj(H,q,K);break;case"text":default:O=sj(H,q,K);break}return{formatted:O,data:H}}function sj(X,$,Z){let Y=[],J=X.code?` [${X.codeName||X.code}]`:"";if(Y.push(`[${X.type} Error${J}]`),X.filePath){let G=X.filePath;if(X.line){if(G+=`:${X.line}`,X.column)G+=`:${X.column}`}Y.push(`at ${G}`)}if(Y.push(`
12613
- ${X.message}`),$&&X.line){let G=ej($,X.line,2);if(G)Y.push(`
12612
+ </script>`}function WT(X){return[...X,...E4]}var ij,nj,rj,oj,E4;var D4=E(()=>{ij={name:"pwa.installButton",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return mj(X,J)},hasEndTag:!0,description:"Renders a PWA install prompt button that appears when the app can be installed"},nj={name:"pwa.updatePrompt",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return lj(X,J)},hasEndTag:!0,description:"Renders a PWA update notification UI when a new version is available"},rj={name:"pwa.offlineIndicator",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return cj(X,J)},hasEndTag:!0,description:"Renders an offline status indicator that shows when the user loses connection"},oj={name:"pwa.pushSubscribe",handler:(X,$,Z,Y)=>{let J=Z.__stx_options||{};return pj(X,J)},hasEndTag:!0,description:"Renders a push notification subscription button"},E4=[ij,nj,rj,oj]});function y4(X){for(let[$,Z]of Object.entries(o))if(Z===X)return $;return}var o;var S8=E(()=>{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 h7(){return!1}function u7(){return!h7()||process.env.STX_DEBUG==="true"}function C8(){return!1}import sj from"path";function P8(){return{...b4}}function v8(X){if(!b4.showRelativePaths||!X)return X;let $=b4.baseDir||process.cwd();try{let Z=sj.relative($,X);return Z.startsWith("..")?X:Z}catch{return X}}var aj,b4,x8,Q5,f8;var g8=E(()=>{S8();aj={showRelativePaths:!1,enableAutoRecovery:u7(),logRecoveryWarnings:!0},b4={...aj};x8=class x8 extends Error{code;filePath;line;column;context;numericCode;constructor(X,$,Z,Y,J,G,Q){super(X);this.code=$;this.filePath=Z;this.line=Y;this.column=J;this.context=G;if(this.name="StxError",this.numericCode=Q||o.EVALUATION_ERROR,this.filePath)this.filePath=v8(this.filePath)}};Q5=class Q5 extends x8{constructor(X,$,Z,Y,J,G){super(X,"stx_RUNTIME_ERROR",$,Z,Y,J,G||o.EVALUATION_ERROR);this.name="StxRuntimeError"}};f8=class f8 extends x8{isFatal=!0;constructor(X,$,Z,Y,J,G){super(X,"stx_VALIDATION_ERROR",$,Z,Y,J,G||o.DOM_API_VIOLATION);this.name="StxValidationError"}}});function SJ(X){let{type:$,message:Z,code:Y,filePath:J,line:G,column:Q,template:q,offset:W,snippet:K,suggestion:U,format:z="text"}=X,w=G,B=Q;if(!w&&q&&W!==void 0){let O=YB(q,W);w=O.line,B=O.column}let j=J?v8(J):void 0,_=Y?y4(Y):void 0,H={type:$,code:Y,codeName:_,message:Z,filePath:j,line:w,column:B,snippet:K,suggestion:U,timestamp:new Date().toISOString()},L;switch(z){case"html":L=ej(H);break;case"json":L=JSON.stringify(H,null,2);break;case"console":L=XB(H,q,W);break;case"text":default:L=tj(H,q,W);break}return{formatted:L,data:H}}function tj(X,$,Z){let Y=[],J=X.code?` [${X.codeName||X.code}]`:"";if(Y.push(`[${X.type} Error${J}]`),X.filePath){let G=X.filePath;if(X.line){if(G+=`:${X.line}`,X.column)G+=`:${X.column}`}Y.push(`at ${G}`)}if(Y.push(`
12613
+ ${X.message}`),$&&X.line){let G=$B($,X.line,2);if(G)Y.push(`
12614
12614
  ${G}`)}if(X.snippet)Y.push(`
12615
12615
  Snippet: ${X.snippet}`);if(X.suggestion)Y.push(`
12616
- Suggestion: ${X.suggestion}`);return Y.join(" ")}function aj(X){let $=X.code?` [${X.code}]`:"",Z=X.filePath?` in ${X.filePath}${X.line?`:${X.line}`:""}`:"",Y=`<!-- [${X.type} Error${$}]${Z}: ${bJ(X.message)}`;if(X.suggestion)Y+=` | Suggestion: ${bJ(X.suggestion)}`;return Y+=" -->",Y}function tj(X,$,Z){let U=[],W=X.code?` [${X.codeName||X.code}]`:"";if(U.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${X.type} Error${W} \u2501\u2501\u2501${"\x1B[0m"}`),X.filePath){let z=`\x1B[36m${X.filePath}\x1B[0m`;if(X.line){if(z+=`\x1B[90m:${X.line}\x1B[0m`,X.column)z+=`\x1B[90m:${X.column}\x1B[0m`}U.push(`
12617
- \x1B[90mat\x1B[0m ${z}`)}if(U.push(`
12616
+ Suggestion: ${X.suggestion}`);return Y.join(" ")}function ej(X){let $=X.code?` [${X.code}]`:"",Z=X.filePath?` in ${X.filePath}${X.line?`:${X.line}`:""}`:"",Y=`<!-- [${X.type} Error${$}]${Z}: ${bJ(X.message)}`;if(X.suggestion)Y+=` | Suggestion: ${bJ(X.suggestion)}`;return Y+=" -->",Y}function XB(X,$,Z){let K=[],U=X.code?` [${X.codeName||X.code}]`:"";if(K.push(`\x1B[1m${"\x1B[31m"}\u2501\u2501\u2501 ${X.type} Error${U} \u2501\u2501\u2501${"\x1B[0m"}`),X.filePath){let z=`\x1B[36m${X.filePath}\x1B[0m`;if(X.line){if(z+=`\x1B[90m:${X.line}\x1B[0m`,X.column)z+=`\x1B[90m:${X.column}\x1B[0m`}K.push(`
12617
+ \x1B[90mat\x1B[0m ${z}`)}if(K.push(`
12618
12618
 
12619
- ${X.message}`),$&&X.line){let z=XB($,X.line,2);if(z)U.push(`
12619
+ ${X.message}`),$&&X.line){let z=ZB($,X.line,2);if(z)K.push(`
12620
12620
 
12621
12621
  \x1B[90mContext:\x1B[0m
12622
- ${z}`)}if(X.suggestion)U.push(`
12623
-
12624
- \x1B[33mSuggestion:\x1B[0m ${X.suggestion}`);return U.push(`
12625
- ${"\x1B[31m"}\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501\u2501${"\x1B[0m"}`),U.join("")}function ej(X,$,Z){let Y=X.split(`
12626
- `),J=Math.max(0,$-Z-1),G=Math.min(Y.length-1,$+Z-1),Q=[];for(let q=J;q<=G;q++){let K=(q+1).toString().padStart(4),U=q===$-1?">":" ";Q.push(`${U}${K} | ${Y[q]}`)}return Q.join(`
12627
- `)}function XB(X,$,Z){let Y=X.split(`
12628
- `),J=Math.max(0,$-Z-1),G=Math.min(Y.length-1,$+Z-1),Q="\x1B[90m",q="\x1B[31m",K="\x1B[0m",U=[];for(let W=J;W<=G;W++){let z=(W+1).toString().padStart(4),w=W===$-1,B=w?"\x1B[31m>\x1B[0m":" ",j=w?`\x1B[31m${Y[W]}\x1B[0m`:`\x1B[90m${Y[W]}\x1B[0m`;U.push(`${B}\x1B[90m${z}\x1B[0m | ${j}`)}return U.join(`
12629
- `)}function bJ(X){return X.replace(/--/g,"- -").replace(/>/g,"&gt;")}function $B(X,$){let Y=X.substring(0,$).split(`
12622
+ ${z}`)}if(X.suggestion)K.push(`
12623
+
12624
+ \x1B[33mSuggestion:\x1B[0m ${X.suggestion}`);return K.push(`
12625
+ ${"\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"}`),K.join("")}function $B(X,$,Z){let Y=X.split(`
12626
+ `),J=Math.max(0,$-Z-1),G=Math.min(Y.length-1,$+Z-1),Q=[];for(let q=J;q<=G;q++){let W=(q+1).toString().padStart(4),K=q===$-1?">":" ";Q.push(`${K}${W} | ${Y[q]}`)}return Q.join(`
12627
+ `)}function ZB(X,$,Z){let Y=X.split(`
12628
+ `),J=Math.max(0,$-Z-1),G=Math.min(Y.length-1,$+Z-1),Q="\x1B[90m",q="\x1B[31m",W="\x1B[0m",K=[];for(let U=J;U<=G;U++){let z=(U+1).toString().padStart(4),w=U===$-1,B=w?"\x1B[31m>\x1B[0m":" ",j=w?`\x1B[31m${Y[U]}\x1B[0m`:`\x1B[90m${Y[U]}\x1B[0m`;K.push(`${B}\x1B[90m${z}\x1B[0m | ${j}`)}return K.join(`
12629
+ `)}function bJ(X){return X.replace(/--/g,"- -").replace(/>/g,"&gt;")}function YB(X,$){let Y=X.substring(0,$).split(`
12630
12630
  `);return{line:Y.length,column:Y[Y.length-1].length}}function Y0(X,$,Z){return SJ({type:X,message:$,code:Z,format:"html"}).formatted}async function x5(X,$,Z){try{return await X()}catch(Y){if(Z&&Y instanceof Error)Z(Y);return $}}var CJ=E(()=>{S8();g8()});class C4{errors=[];maxErrors;enableFileLogging;logFilePath;logFormat;maxFileSize;maxLogFiles;minLevel;writeQueue=Promise.resolve();constructor(X={}){this.maxErrors=X.maxErrors??1000,this.enableFileLogging=X.enableFileLogging??!1,this.logFilePath=X.logFilePath??".stx/errors.log",this.logFormat=X.logFormat??"json",this.maxFileSize=X.maxFileSize??10485760,this.maxLogFiles=X.maxLogFiles??5,this.minLevel=X.minLevel??"all"}configure(X){if(X.maxErrors!==void 0)this.maxErrors=X.maxErrors;if(X.enableFileLogging!==void 0)this.enableFileLogging=X.enableFileLogging;if(X.logFilePath!==void 0)this.logFilePath=X.logFilePath;if(X.logFormat!==void 0)this.logFormat=X.logFormat;if(X.maxFileSize!==void 0)this.maxFileSize=X.maxFileSize;if(X.maxLogFiles!==void 0)this.maxLogFiles=X.maxLogFiles;if(X.minLevel!==void 0)this.minLevel=X.minLevel}log(X,$,Z="error"){let Y={timestamp:new Date,error:X,context:$,level:Z};if(this.errors.push(Y),this.errors.length>this.maxErrors)this.errors=this.errors.slice(-this.maxErrors);if(this.enableFileLogging&&this.shouldLog(Z))this.writeToFile(Y)}shouldLog(X){if(this.minLevel==="all")return!0;if(this.minLevel==="warning")return X==="error"||X==="warning";if(this.minLevel==="error")return X==="error";return!0}formatEntry(X){if(this.logFormat==="json")return JSON.stringify({timestamp:X.timestamp.toISOString(),level:X.level||"error",type:X.error.constructor.name,message:X.error.message,stack:X.error.stack,context:X.context});let $=[`[${X.timestamp.toISOString()}] [${(X.level||"error").toUpperCase()}] ${X.error.constructor.name}: ${X.error.message}`];if(X.error.stack)$.push(` Stack: ${X.error.stack.split(`
12631
12631
  `).slice(1).join(`
12632
12632
  `)}`);if(X.context)$.push(` Context: ${JSON.stringify(X.context)}`);return $.join(`
12633
12633
  `)}writeToFile(X){this.writeQueue=this.writeQueue.then(async()=>{try{let $=await import("fs"),Y=(await import("path")).dirname(this.logFilePath);if(!$.existsSync(Y))$.mkdirSync(Y,{recursive:!0});await this.rotateIfNeeded($);let J=`${this.formatEntry(X)}
12634
12634
  `;$.appendFileSync(this.logFilePath,J,"utf-8")}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to write to error log:",$)}})}async rotateIfNeeded(X){try{if(!X.existsSync(this.logFilePath))return;if(X.statSync(this.logFilePath).size<this.maxFileSize)return;for(let Z=this.maxLogFiles-1;Z>=1;Z--){let Y=`${this.logFilePath}.${Z}`,J=`${this.logFilePath}.${Z+1}`;if(X.existsSync(Y))if(Z>=this.maxLogFiles-1)X.unlinkSync(Y);else X.renameSync(Y,J)}if(this.maxLogFiles<=1)X.writeFileSync(this.logFilePath,"");else X.renameSync(this.logFilePath,`${this.logFilePath}.1`)}catch($){if(process.env.STX_DEBUG==="true")console.error("Failed to rotate error logs:",$)}}getRecentErrors(X=10){return this.errors.slice(-X)}getErrorsByType(X){return this.errors.filter(($)=>$.error.constructor.name===X)}getErrorsByLevel(X){return this.errors.filter(($)=>$.level===X)}clear(){this.errors.length=0}async clearLogFile(){try{let X=await import("fs");if(X.existsSync(this.logFilePath))X.writeFileSync(this.logFilePath,"","utf-8")}catch(X){if(process.env.STX_DEBUG==="true")console.error("Failed to clear error log:",X)}}getStats(){let X={},$={error:0,warning:0,info:0};for(let Z of this.errors){let Y=Z.error.constructor.name;X[Y]=(X[Y]||0)+1;let J=Z.level||"error";$[J]=($[J]||0)+1}return{total:this.errors.length,byType:X,byLevel:$}}async exportToFile(X,$="json"){let Z=await import("fs"),J=(await import("path")).dirname(X);if(!Z.existsSync(J))Z.mkdirSync(J,{recursive:!0});if($==="json"){let G=this.errors.map((Q)=>({timestamp:Q.timestamp.toISOString(),level:Q.level||"error",type:Q.error.constructor.name,message:Q.error.message,stack:Q.error.stack,context:Q.context}));Z.writeFileSync(X,JSON.stringify(G,null,2),"utf-8")}else{let G=this.errors.map((Q)=>this.formatEntry(Q));Z.writeFileSync(X,G.join(`
12635
12635
 
12636
- `),"utf-8")}}async flush(){await this.writeQueue}}var S4,$1,P4;var PJ=E(()=>{g8();S4={isEnabled(){return P8().enableAutoRecovery},fixCommonSyntaxErrors(X){let $=P8();if(!$.enableAutoRecovery)return{fixed:X,fixes:[]};let Z=X,Y=[],J=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(J>G){let q=J-G;Z+="}}".repeat(q),Y.push(`Added ${q} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let q of Q){let K=(Z.match(new RegExp(`@${q}\\b`,"g"))||[]).length,U=(Z.match(new RegExp(`@end${q}\\b`,"g"))||[]).length;if(K>U){let W=K-U;for(let z=0;z<W;z++)Z+=`
12637
- @end${q}`;Y.push(`Added ${W} missing @end${q}`)}}if(Y.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((q)=>console.warn(` - ${q}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:Y}},createFallbackContent(X,$){if(u7())return`<!-- ${X} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};$1=new C4,P4={isDevelopment(){return u7()},logDetailedError(X,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",X.message),console.error("Stack:",X.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(X,$){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${X.message}`,`Type: ${X.constructor.name}`,`Stack: ${X.stack}`];if($)Z.push(`Context: ${JSON.stringify($,null,2)}`);return Z.push("========================"),Z.join(`
12638
- `)}}});var vJ=()=>{};var xJ=E(()=>{S8();CJ();PJ();vJ();g8()});var H1=E(()=>{xJ()});function gJ(X,$,Z,Y){let J=X;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(q,K,U)=>{if(!U&&K.includes(":")){let W=K.split(":"),z=K,w=W.length>1?W[1]:"";if(w&&$[w])U=$[w];else if(z.startsWith("og:")&&$.openGraph&&$.openGraph[W[1]])U=$.openGraph[W[1]];else U="";return U?`<meta property="${r(z)}" content="${r(U)}">`:""}return U?`<meta name="${r(K)}" content="${r(U)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(J))!==null){let q=Q.index,K=q+Q[0].length-1,U=1,W=K+1;while(W<J.length&&U>0){if(J[W]==="(")U++;else if(J[W]===")"){if(U--,U===0)break}W++}if(U!==0)break;let z=J.substring(K+1,W).trim(),w=W+1,B=(()=>{try{let j=A0(z,$);if(!j)return"";let _="<meta";if(j.name)_+=` name="${r(String(j.name))}"`;if(j.property)_+=` property="${r(String(j.property))}"`;if(j.httpEquiv)_+=` http-equiv="${r(String(j.httpEquiv))}"`;if(j.content)_+=` content="${r(String(j.content))}"`;return _+=">",_}catch(j){let _=j instanceof Error?j.message:String(j);return Y0("MetaTag",_,s.EVALUATION_ERROR)}})();J=J.substring(0,q)+B+J.substring(w),G.lastIndex=0}return J}function hJ(X,$,Z){let Y=X,J=/@structuredData\s*\(/g,G;while((G=J.exec(Y))!==null){let Q=G.index,q=Q+G[0].length-1,K=1,U=q+1;while(U<Y.length&&K>0){if(Y[U]==="(")K++;else if(Y[U]===")"){if(K--,K===0)break}U++}if(K!==0)break;let W=Y.substring(q+1,U).trim(),z=U+1,w=(()=>{try{let B=A0(W,$);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return Y0("StructuredData",j,s.EVALUATION_ERROR)}})();Y=Y.substring(0,Q)+w+Y.substring(z),J.lastIndex=0}return Y}function uJ(X,$,Z,Y){let J=X,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(J))!==null){let q=J.indexOf("{",Q.index+4),K=1,U=q+1,W=null,z=!1;while(U<J.length&&K>0){let O=J[U];if(z){z=!1,U++;continue}if(O==="\\"&&W){z=!0,U++;continue}if(W){if(O===W)W=null;U++;continue}if(O==='"'||O==="'"||O==="`"){W=O,U++;continue}if(O==="{")K++;else if(O==="}")K--;U++}if(K!==0)break;let w=J.substring(U).match(/^\s*\)/);if(!w)break;let B=U+w[0].length,j=J.substring(q,U),_=J.substring(Q.index,B),H=((O)=>{try{let L=A0(O,$);if(!L)return"";let F="";if(L.title)F+=`<title>${r(L.title)}</title>
12639
- `,F+=`<meta name="title" content="${r(L.title)}">
12640
- `;if(L.description)F+=`<meta name="description" content="${r(L.description)}">
12641
- `;if(L.keywords){let V=Array.isArray(L.keywords)?L.keywords.join(", "):L.keywords;F+=`<meta name="keywords" content="${r(V)}">
12642
- `}if(L.robots)F+=`<meta name="robots" content="${r(L.robots)}">
12643
- `;if(L.canonical)F+=`<link rel="canonical" href="${r(L.canonical)}">
12644
- `;if(L.openGraph){let V=L.openGraph;if(F+=`<meta property="og:type" content="${r(V.type||"website")}">
12645
- `,V.title||L.title){let A=V.title||L.title||"";F+=`<meta property="og:title" content="${r(A)}">
12646
- `}if(V.description||L.description){let A=V.description||L.description||"";F+=`<meta property="og:description" content="${r(A)}">
12647
- `}if(V.url||L.canonical){let A=V.url||L.canonical||"";F+=`<meta property="og:url" content="${r(A)}">
12648
- `}if(V.image){if(F+=`<meta property="og:image" content="${r(V.image)}">
12649
- `,V.imageAlt)F+=`<meta property="og:image:alt" content="${r(V.imageAlt)}">
12650
- `;if(V.imageWidth)F+=`<meta property="og:image:width" content="${r(String(V.imageWidth))}">
12651
- `;if(V.imageHeight)F+=`<meta property="og:image:height" content="${r(String(V.imageHeight))}">
12652
- `}if(V.siteName)F+=`<meta property="og:site_name" content="${r(V.siteName)}">
12653
- `}if(L.twitter){let V=L.twitter;if(F+=`<meta name="twitter:card" content="${r(V.card||"summary_large_image")}">
12654
- `,V.title||L.title){let A=V.title||L.title||"";F+=`<meta name="twitter:title" content="${r(A)}">
12655
- `}if(V.description||L.description){let A=V.description||L.description||"";F+=`<meta name="twitter:description" content="${r(A)}">
12656
- `}if(V.image||L.openGraph&&L.openGraph.image){let A=V.image||(L.openGraph?L.openGraph.image:"")||"";F+=`<meta name="twitter:image" content="${r(A)}">
12657
- `}if(V.site)F+=`<meta name="twitter:site" content="${r(V.site)}">
12658
- `;if(V.creator)F+=`<meta name="twitter:creator" content="${r(V.creator)}">
12659
- `}if(L.structuredData){let V=JSON.stringify(L.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${V}</script>
12660
- `}return F.trim()}catch(L){let F=L instanceof Error?L.message:String(L);return Y0("SEO",`Error processing @seo directive: ${F}`,s.EVALUATION_ERROR)}})(j);J=J.substring(0,Q.index)+H+J.substring(B),G.lastIndex=Q.index+H.length}return J}function dJ(X,$,Z){if(Z.seo?.enabled===!1)return X;if(X.includes("<!-- stx SEO Tags -->")||Z.skipDefaultSeoTags===!0)return X;let Y=$.__stx_runtime_head;if(!!(Y?.title||Y?.meta?.some((z)=>z.property==="og:title"||z.name==="og:title"||z.name==="twitter:title"||z.name==="description")))return X;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(X))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let G=X.includes("<title>")||X.includes("</title>"),Q="";if($.title)Q=$.title;else if($.meta&&$.meta.title)Q=$.meta.title;else if(Z.seo?.defaultConfig?.title)Q=Z.seo.defaultConfig.title;else Q=Z.defaultTitle||"stx Project";let q="";if($.description)q=$.description;else if($.meta&&$.meta.description)q=$.meta.description;else if(Z.seo?.defaultConfig?.description)q=Z.seo.defaultConfig.description;else q=Z.defaultDescription||"A website built with stx templating engine";let K="";if($.image)K=$.image;else if($.meta&&$.meta.image)K=$.meta.image;else if($.openGraph&&$.openGraph.image)K=$.openGraph.image;else if(Z.seo?.defaultImage)K=Z.seo.defaultImage;else if(Z.defaultImage)K=Z.defaultImage;let U=`
12636
+ `),"utf-8")}}async flush(){await this.writeQueue}}var S4,$1,P4;var PJ=E(()=>{g8();S4={isEnabled(){return P8().enableAutoRecovery},fixCommonSyntaxErrors(X){let $=P8();if(!$.enableAutoRecovery)return{fixed:X,fixes:[]};let Z=X,Y=[],J=(Z.match(/\{\{/g)||[]).length,G=(Z.match(/\}\}/g)||[]).length;if(J>G){let q=J-G;Z+="}}".repeat(q),Y.push(`Added ${q} missing closing braces '}}'`)}let Q=["if","foreach","for","switch","section"];for(let q of Q){let W=(Z.match(new RegExp(`@${q}\\b`,"g"))||[]).length,K=(Z.match(new RegExp(`@end${q}\\b`,"g"))||[]).length;if(W>K){let U=W-K;for(let z=0;z<U;z++)Z+=`
12637
+ @end${q}`;Y.push(`Added ${U} missing @end${q}`)}}if(Y.length>0&&$.logRecoveryWarnings)console.warn("[stx] Auto-recovery applied fixes:"),Y.forEach((q)=>console.warn(` - ${q}`)),console.warn(" Consider fixing these issues in your template.");return{fixed:Z,fixes:Y}},createFallbackContent(X,$){if(u7())return`<!-- ${X} failed: ${$.message} -->`;return"<!-- stx rendering error -->"}};$1=new C4,P4={isDevelopment(){return u7()},logDetailedError(X,$){if(!this.isDevelopment())return;if(console.error("=== stx Detailed Error ==="),console.error("Error:",X.message),console.error("Stack:",X.stack),$)console.error("Context:",$);console.error("========================")},createErrorReport(X,$){let Z=["=== stx Error Report ===",`Time: ${new Date().toISOString()}`,`Error: ${X.message}`,`Type: ${X.constructor.name}`,`Stack: ${X.stack}`];if($)Z.push(`Context: ${JSON.stringify($,null,2)}`);return Z.push("========================"),Z.join(`
12638
+ `)}}});var vJ=()=>{};var xJ=E(()=>{S8();CJ();PJ();vJ();g8()});var H1=E(()=>{xJ()});function gJ(X,$,Z,Y){let J=X;J=J.replace(/@meta\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(q,W,K)=>{if(!K&&W.includes(":")){let U=W.split(":"),z=W,w=U.length>1?U[1]:"";if(w&&$[w])K=$[w];else if(z.startsWith("og:")&&$.openGraph&&$.openGraph[U[1]])K=$.openGraph[U[1]];else K="";return K?`<meta property="${n(z)}" content="${n(K)}">`:""}return K?`<meta name="${n(W)}" content="${n(K)}">`:""});let G=/@metaTag\s*\(/g,Q;while((Q=G.exec(J))!==null){let q=Q.index,W=q+Q[0].length-1,K=1,U=W+1;while(U<J.length&&K>0){if(J[U]==="(")K++;else if(J[U]===")"){if(K--,K===0)break}U++}if(K!==0)break;let z=J.substring(W+1,U).trim(),w=U+1,B=(()=>{try{let j=A0(z,$);if(!j)return"";let _="<meta";if(j.name)_+=` name="${n(String(j.name))}"`;if(j.property)_+=` property="${n(String(j.property))}"`;if(j.httpEquiv)_+=` http-equiv="${n(String(j.httpEquiv))}"`;if(j.content)_+=` content="${n(String(j.content))}"`;return _+=">",_}catch(j){let _=j instanceof Error?j.message:String(j);return Y0("MetaTag",_,o.EVALUATION_ERROR)}})();J=J.substring(0,q)+B+J.substring(w),G.lastIndex=0}return J}function hJ(X,$,Z){let Y=X,J=/@structuredData\s*\(/g,G;while((G=J.exec(Y))!==null){let Q=G.index,q=Q+G[0].length-1,W=1,K=q+1;while(K<Y.length&&W>0){if(Y[K]==="(")W++;else if(Y[K]===")"){if(W--,W===0)break}K++}if(W!==0)break;let U=Y.substring(q+1,K).trim(),z=K+1,w=(()=>{try{let B=A0(U,$);if(!B)return"";if(!B["@context"])B["@context"]="https://schema.org";return`<script type="application/ld+json">${JSON.stringify(B).replace(/<\//g,"<\\/")}</script>`}catch(B){let j=B instanceof Error?B.message:String(B);return Y0("StructuredData",j,o.EVALUATION_ERROR)}})();Y=Y.substring(0,Q)+w+Y.substring(z),J.lastIndex=0}return Y}function uJ(X,$,Z,Y){let J=X,G=/@seo\s*\(\s*\{/g,Q;while((Q=G.exec(J))!==null){let q=J.indexOf("{",Q.index+4),W=1,K=q+1,U=null,z=!1;while(K<J.length&&W>0){let L=J[K];if(z){z=!1,K++;continue}if(L==="\\"&&U){z=!0,K++;continue}if(U){if(L===U)U=null;K++;continue}if(L==='"'||L==="'"||L==="`"){U=L,K++;continue}if(L==="{")W++;else if(L==="}")W--;K++}if(W!==0)break;let w=J.substring(K).match(/^\s*\)/);if(!w)break;let B=K+w[0].length,j=J.substring(q,K),_=J.substring(Q.index,B),H=((L)=>{try{let O=A0(L,$);if(!O)return"";let F="";if(O.title)F+=`<title>${n(O.title)}</title>
12639
+ `,F+=`<meta name="title" content="${n(O.title)}">
12640
+ `;if(O.description)F+=`<meta name="description" content="${n(O.description)}">
12641
+ `;if(O.keywords){let V=Array.isArray(O.keywords)?O.keywords.join(", "):O.keywords;F+=`<meta name="keywords" content="${n(V)}">
12642
+ `}if(O.robots)F+=`<meta name="robots" content="${n(O.robots)}">
12643
+ `;if(O.canonical)F+=`<link rel="canonical" href="${n(O.canonical)}">
12644
+ `;if(O.openGraph){let V=O.openGraph;if(F+=`<meta property="og:type" content="${n(V.type||"website")}">
12645
+ `,V.title||O.title){let A=V.title||O.title||"";F+=`<meta property="og:title" content="${n(A)}">
12646
+ `}if(V.description||O.description){let A=V.description||O.description||"";F+=`<meta property="og:description" content="${n(A)}">
12647
+ `}if(V.url||O.canonical){let A=V.url||O.canonical||"";F+=`<meta property="og:url" content="${n(A)}">
12648
+ `}if(V.image){if(F+=`<meta property="og:image" content="${n(V.image)}">
12649
+ `,V.imageAlt)F+=`<meta property="og:image:alt" content="${n(V.imageAlt)}">
12650
+ `;if(V.imageWidth)F+=`<meta property="og:image:width" content="${n(String(V.imageWidth))}">
12651
+ `;if(V.imageHeight)F+=`<meta property="og:image:height" content="${n(String(V.imageHeight))}">
12652
+ `}if(V.siteName)F+=`<meta property="og:site_name" content="${n(V.siteName)}">
12653
+ `}if(O.twitter){let V=O.twitter;if(F+=`<meta name="twitter:card" content="${n(V.card||"summary_large_image")}">
12654
+ `,V.title||O.title){let A=V.title||O.title||"";F+=`<meta name="twitter:title" content="${n(A)}">
12655
+ `}if(V.description||O.description){let A=V.description||O.description||"";F+=`<meta name="twitter:description" content="${n(A)}">
12656
+ `}if(V.image||O.openGraph&&O.openGraph.image){let A=V.image||(O.openGraph?O.openGraph.image:"")||"";F+=`<meta name="twitter:image" content="${n(A)}">
12657
+ `}if(V.site)F+=`<meta name="twitter:site" content="${n(V.site)}">
12658
+ `;if(V.creator)F+=`<meta name="twitter:creator" content="${n(V.creator)}">
12659
+ `}if(O.structuredData){let V=JSON.stringify(O.structuredData).replace(/<\//g,"<\\/");F+=`<script type="application/ld+json">${V}</script>
12660
+ `}return F.trim()}catch(O){let F=O instanceof Error?O.message:String(O);return Y0("SEO",`Error processing @seo directive: ${F}`,o.EVALUATION_ERROR)}})(j);J=J.substring(0,Q.index)+H+J.substring(B),G.lastIndex=Q.index+H.length}return J}function dJ(X,$,Z){if(Z.seo?.enabled===!1)return X;if(X.includes("<!-- stx SEO Tags -->")||Z.skipDefaultSeoTags===!0)return X;let Y=$.__stx_runtime_head;if(!!(Y?.title||Y?.meta?.some((z)=>z.property==="og:title"||z.name==="og:title"||z.name==="twitter:title"||z.name==="description")))return X;if(/<meta\s+(?:[^>]*\s)?property=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']og:title["']/i.test(X)||/<meta\s+(?:[^>]*\s)?name=["']twitter:title["']/i.test(X))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let G=X.includes("<title>")||X.includes("</title>"),Q="";if($.title)Q=$.title;else if($.meta&&$.meta.title)Q=$.meta.title;else if(Z.seo?.defaultConfig?.title)Q=Z.seo.defaultConfig.title;else Q=Z.defaultTitle||"stx Project";let q="";if($.description)q=$.description;else if($.meta&&$.meta.description)q=$.meta.description;else if(Z.seo?.defaultConfig?.description)q=Z.seo.defaultConfig.description;else q=Z.defaultDescription||"A website built with stx templating engine";let W="";if($.image)W=$.image;else if($.meta&&$.meta.image)W=$.meta.image;else if($.openGraph&&$.openGraph.image)W=$.openGraph.image;else if(Z.seo?.defaultImage)W=Z.seo.defaultImage;else if(Z.defaultImage)W=Z.defaultImage;let K=`
12661
12661
  <!-- stx SEO Tags -->
12662
- <meta name="title" content="${r(Q)}">
12663
- <meta name="description" content="${r(q)}">
12664
- <meta property="og:title" content="${r(Q)}">
12665
- <meta property="og:description" content="${r(q)}">
12662
+ <meta name="title" content="${n(Q)}">
12663
+ <meta name="description" content="${n(q)}">
12664
+ <meta property="og:title" content="${n(Q)}">
12665
+ <meta property="og:description" content="${n(q)}">
12666
12666
  <meta property="og:type" content="website">
12667
12667
  <meta name="twitter:card" content="summary_large_image">
12668
- <meta name="twitter:title" content="${r(Q)}">
12669
- <meta name="twitter:description" content="${r(q)}">
12670
- `;if(K)U+=`
12671
- <meta property="og:image" content="${r(K)}">
12672
- <meta name="twitter:image" content="${r(K)}">
12673
- `;let W=X;if(!G)W=W.replace(/<head[^>]*>/,`$&
12674
- <title>${r(Q)}</title>`);return W.replace(/<head[^>]*>/,`$&
12675
- ${U}
12676
- `)}function r(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function fJ(X){let $=X.trim(),Z=$[0];if((Z==="'"||Z==='"'||Z==="`")&&$.length>1&&$.at(-1)===Z)return{value:$.slice(1,-1),quoted:!0};return{value:$,quoted:!1}}var ZB,mJ,lJ;var v4=E(()=>{H1();b5();R0();ZB=["og:","article:","book:","profile:","fb:","music:","video:"];mJ={name:"meta",handler:(X,$,Z,Y)=>{if($.length<1)return Y0("Meta","meta directive requires at least the meta name",s.INVALID_DIRECTIVE_SYNTAX);let J=fJ($[0]).value,G;if($.length>1){let K=fJ($[1]);G=K.quoted?K.value:String(Z?.[K.value]??K.value)}else{let K=J.includes(":")?J.slice(J.indexOf(":")+1):J,U=Z?.openGraph;G=String(Z?.[K]??U?.[K]??"")}if(!G)return"";let q=ZB.some((K)=>J.startsWith(K))?{property:J,content:G}:{name:J,content:G};if(Z)Z.__stx_runtime_head=D1(Z.__stx_runtime_head??{},{meta:[q]});return""},hasEndTag:!1},lJ={name:"structuredData",handler:(X,$,Z,Y)=>{if(X.trim()==="")return Y0("StructuredData","structuredData directive requires JSON-LD content",s.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse(X);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return Y0("StructuredData","structuredData requires @type property",s.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let G=J instanceof Error?J.message:String(J);return Y0("StructuredData",G,s.EVALUATION_ERROR)}},hasEndTag:!0}});import d7 from"path";function YB(X,$){let Z=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1].trim():"",J=$,G=[],Q=!0;if(Y){let z=Y.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let w=z[1],B=w.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)J=B[1];let j=w.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)G=j[1].split(",").map((H)=>H.trim().replace(/['"`]/g,"")).filter((H)=>H.length>0);let _=w.match(/shadowDOM\s*:\s*(true|false)/);if(_)Q=_[1]==="true"}catch{}}let q=X.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),K=q?q[1].trim():"",U=X.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),W=U?U[1].trim():"";return{tag:J,props:G,template:K,styles:W,script:Y,shadowDOM:Q}}function JB(X){let{tag:$,props:Z,template:Y,styles:J,shadowDOM:G}=X,Q=$.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),q=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),K=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),U=Z.map((z)=>`'${z}'`).join(", "),W=Z.map((z)=>`
12668
+ <meta name="twitter:title" content="${n(Q)}">
12669
+ <meta name="twitter:description" content="${n(q)}">
12670
+ `;if(W)K+=`
12671
+ <meta property="og:image" content="${n(W)}">
12672
+ <meta name="twitter:image" content="${n(W)}">
12673
+ `;let U=X;if(!G)U=U.replace(/<head[^>]*>/,`$&
12674
+ <title>${n(Q)}</title>`);return U.replace(/<head[^>]*>/,`$&
12675
+ ${K}
12676
+ `)}function n(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function fJ(X){let $=X.trim(),Z=$[0];if((Z==="'"||Z==='"'||Z==="`")&&$.length>1&&$.at(-1)===Z)return{value:$.slice(1,-1),quoted:!0};return{value:$,quoted:!1}}var JB,mJ,lJ;var v4=E(()=>{H1();b5();R0();JB=["og:","article:","book:","profile:","fb:","music:","video:"];mJ={name:"meta",handler:(X,$,Z,Y)=>{if($.length<1)return Y0("Meta","meta directive requires at least the meta name",o.INVALID_DIRECTIVE_SYNTAX);let J=fJ($[0]).value,G;if($.length>1){let W=fJ($[1]);G=W.quoted?W.value:String(Z?.[W.value]??W.value)}else{let W=J.includes(":")?J.slice(J.indexOf(":")+1):J,K=Z?.openGraph;G=String(Z?.[W]??K?.[W]??"")}if(!G)return"";let q=JB.some((W)=>J.startsWith(W))?{property:J,content:G}:{name:J,content:G};if(Z)Z.__stx_runtime_head=D1(Z.__stx_runtime_head??{},{meta:[q]});return""},hasEndTag:!1},lJ={name:"structuredData",handler:(X,$,Z,Y)=>{if(X.trim()==="")return Y0("StructuredData","structuredData directive requires JSON-LD content",o.INVALID_DIRECTIVE_SYNTAX);try{let J=JSON.parse(X);if(!J["@context"])J["@context"]="https://schema.org";if(!J["@type"])return Y0("StructuredData","structuredData requires @type property",o.INVALID_DIRECTIVE_SYNTAX);return`<script type="application/ld+json">${JSON.stringify(J)}</script>`}catch(J){let G=J instanceof Error?J.message:String(J);return Y0("StructuredData",G,o.EVALUATION_ERROR)}},hasEndTag:!0}});import d7 from"path";function GB(X,$){let Z=X.match(/<script\b[^>]*>([\s\S]*?)<\/script>/i),Y=Z?Z[1].trim():"",J=$,G=[],Q=!0;if(Y){let z=Y.match(/export\s+default\s+({[\s\S]*})/);if(z)try{let w=z[1],B=w.match(/tag\s*:\s*['"`]([^'"`]+)['"`]/);if(B)J=B[1];let j=w.match(/props\s*:\s*\[([\s\S]*?)\]/);if(j)G=j[1].split(",").map((H)=>H.trim().replace(/['"`]/g,"")).filter((H)=>H.length>0);let _=w.match(/shadowDOM\s*:\s*(true|false)/);if(_)Q=_[1]==="true"}catch{}}let q=X.match(/<template\b(?![^>]*\bid\s*=)[^>]*>([\s\S]*?)<\/template>/i),W=q?q[1].trim():"",K=X.match(/<style\b[^>]*>([\s\S]*?)<\/style>/i),U=K?K[1].trim():"";return{tag:J,props:G,template:W,styles:U,script:Y,shadowDOM:Q}}function QB(X){let{tag:$,props:Z,template:Y,styles:J,shadowDOM:G}=X,Q=$.split("-").map((z)=>z.charAt(0).toUpperCase()+z.slice(1)).join(""),q=Y.replace(/\\/g,"\\\\").replace(/`/g,"\\`").replace(/\$\{/g,"\\${"),W=J.replace(/\\/g,"\\\\").replace(/`/g,"\\`"),K=Z.map((z)=>`'${z}'`).join(", "),U=Z.map((z)=>`
12677
12677
  get ${z}() {
12678
12678
  return this.getAttribute('${z}') || '';
12679
12679
  }
@@ -12697,7 +12697,7 @@ class ${Q} extends HTMLElement {
12697
12697
  }
12698
12698
 
12699
12699
  static get observedAttributes() {
12700
- return [${U}];
12700
+ return [${K}];
12701
12701
  }
12702
12702
 
12703
12703
  attributeChangedCallback(name, oldValue, newValue) {
@@ -12705,10 +12705,10 @@ class ${Q} extends HTMLElement {
12705
12705
  this._render();
12706
12706
  }
12707
12707
  }
12708
- ${W}
12708
+ ${U}
12709
12709
 
12710
12710
  _render() {
12711
- const template = \`${K?`<style>${K}</style>`:""}${q}\`;
12711
+ const template = \`${W?`<style>${W}</style>`:""}${q}\`;
12712
12712
 
12713
12713
  // Interpolate {{ prop }} with attribute values
12714
12714
  const rendered = template.replace(/\\{\\{\\s*(\\w+)\\s*\\}\\}/g, (match, prop) => {
@@ -12724,16 +12724,16 @@ ${W}
12724
12724
  }
12725
12725
 
12726
12726
  customElements.define('${$}', ${Q});
12727
- `}async function cJ(X,$,Z,Y){if($.length<1)return Y0("WebComponent","@webcomponent directive requires at least the tag name parameter",s.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",q=[d7.join(d7.dirname(Y),Q,`${J}.stx`),d7.join(process.cwd(),Q,`${J}.stx`),d7.join(d7.dirname(Y),`${J}.stx`)],K=null;for(let z of q)if(await p(z)){K=await Bun.file(z).text();break}if(!K)return Y0("WebComponent",`Component file not found: ${J}.stx`,s.FILE_NOT_FOUND);let U=YB(K,J);return`<script type="module">
12728
- ${JB(U)}
12729
- </script>`}var pJ=E(()=>{H1();H0()});var iJ={};n(iJ,{timingPlugin:()=>UB,pluginManager:()=>GB,definePlugin:()=>h8,debugPlugin:()=>KB,createVariablesPlugin:()=>WB,createFilterPlugin:()=>qB,createDirectivePlugin:()=>QB,PluginManager:()=>x4});function h8(X){return X}class x4{plugins=new Map;sortedPlugins=[];initialized=!1;async register(X,$){if(this.plugins.has(X.name))throw Error(`Plugin "${X.name}" is already registered`);if(X.dependencies){for(let Z of X.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${X.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set(X.name,X),X.onRegister)await X.onRegister($);this.sortPlugins()}async unregister(X){let $=this.plugins.get(X);if(!$)return!1;for(let[Z,Y]of this.plugins)if(Y.dependencies?.includes(X))throw Error(`Cannot unregister "${X}" because "${Z}" depends on it`);if($.onUnregister)await $.onUnregister();return this.plugins.delete(X),this.sortPlugins(),!0}get(X){return this.plugins.get(X)}has(X){return this.plugins.has(X)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let X=[];for(let $ of this.sortedPlugins)if($.registerDirectives)X.push(...$.registerDirectives());return X}getAllFilters(){let X={};for(let $ of this.sortedPlugins)if($.registerFilters)Object.assign(X,$.registerFilters());return X}async runBeforeProcess(X){return this.runHooks("beforeProcess",X)}async runAfterParse(X){return this.runHooks("afterParse",X)}async runBeforeDirective(X,$){return this.runDirectiveHooks("beforeDirective",X,$)}async runAfterDirective(X,$){return this.runDirectiveHooks("afterDirective",X,$)}async runBeforeRender(X){return this.runHooks("beforeRender",X)}async runAfterRender(X){return this.runHooks("afterRender",X)}async runOnError(X){for(let $ of this.sortedPlugins)if($.onError)try{let Z=await $.onError(X);if(Z){if(Z.template!==void 0)X.template=Z.template;if(Z.context)X.context={...X.context,...Z.context};if(Z.metadata)X.metadata={...X.metadata,...Z.metadata};if(Z.skip)return X}}catch(Z){console.error(`Error in plugin "${$.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((X,$)=>(X.priority??100)-($.priority??100))}async runHooks(X,$){let Z={...$};for(let Y of this.sortedPlugins){let J=Y[X];if(J)try{let G=await J(Z);if(G){if(G.template!==void 0)Z.template=G.template;if(G.context)Z.context={...Z.context,...G.context};if(G.metadata)Z.metadata={...Z.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Y.name}" ${X} hook:`,G)}}return Z}async runDirectiveHooks(X,$,Z){let Y={...Z};for(let J of this.sortedPlugins){let G=J[X];if(G)try{let Q=await G($,Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${X} hook:`,Q)}}return Y}}function QB(X,$,Z={}){return{name:X,...Z,registerDirectives:()=>$}}function qB(X,$,Z={}){return{name:X,...Z,registerFilters:()=>$}}function WB(X){return h8({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess($){return{context:{...$.context,...X}}}})}var GB,KB,UB;var nJ=E(()=>{GB=new x4;KB=h8({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(X){console.log("[stx-debug] beforeProcess:",X.filePath)},afterParse(X){console.log("[stx-debug] afterParse:",X.template.length,"chars")},beforeDirective(X,$){console.log("[stx-debug] beforeDirective:",X)},afterDirective(X,$){console.log("[stx-debug] afterDirective:",X)},beforeRender(X){console.log("[stx-debug] beforeRender")},afterRender(X){console.log("[stx-debug] afterRender:",X.template.length,"chars")},onError(X){console.error("[stx-debug] onError:",X.error.message,"in phase:",X.phase)}}),UB=h8({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(X){X.metadata.startTime=performance.now()},afterRender(X){let $=X.metadata.startTime;if($){let Z=performance.now()-$;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var aJ={};n(aJ,{validateConfig:()=>OB,resolveStxDirectories:()=>sJ,loadStxConfig:()=>S1,defineStxConfig:()=>HB,defaultConfig:()=>q5,config:()=>N7});import u8 from"fs";import p0 from"path";import{loadConfigWithResult as zB}from"bunfig";function wB(X,$,Z){let Y=$||"pages";if(X)return{root:X,pagesDir:Y};let J=Z||process.cwd(),G=p0.join(J,"resources","views"),Q=p0.join(J,"resources","layouts");if(u8.existsSync(G)&&u8.existsSync(Q))return{root:"resources",pagesDir:"views"};let q=p0.join(J,"resources","views","pages");if(u8.existsSync(q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function jB(X,$){let Z=$.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let Y=X.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/");return Y===J||Y.startsWith(`${J}/`)}function sJ(X,$){let Z=!X.root,Y=wB(X.root,X.pagesDir,$);if(X.root=Y.root,X.pagesDir=Y.pagesDir,Z&&Y.root!=="."){let J=`${$}::${Y.root}`;if(!rJ.has(J))rJ.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(X.root&&X.root!=="."){let J=X.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=X[G];if(typeof Q!=="string"||!Q)continue;if(p0.isAbsolute(Q)||jB(Q,J))continue;X[G]=p0.join(J,Q)}}return X}function BB(X,$){let Z=["componentsDir","layoutsDir","partialsDir"];for(let Y of Z){let J=X[Y];if(typeof J!=="string"||!J)continue;let G=p0.isAbsolute(J)?J:p0.join($,J);if(u8.existsSync(G))continue;let Q=X.root,q=!!Q&&Q!==".";console.warn(`[stx] ${String(Y)} resolves to "${G}", which does not exist. Configured as "${J}"`+(q?`, resolved under root "${Q}".`:"."))}}function _B(X){if(P6(X.stateDir),X.stateDir=Q7(),X.cachePath=K7(X.cachePath),X.build)X.build.cacheDir=K7(X.build.cacheDir);if(X.media?.cache)X.media.cache.directory=K7(X.media.cache.directory);if(X.story)X.story.outDir=K7(X.story.outDir)}async function S1(X){if(!X){if(f5)return f5;if(d8)return d8}let $=X?p0.resolve(X):process.cwd(),Z=oJ.get($);if(Z)return Z;let Y=(async()=>{let G=(await zB({name:"stx",alias:"ui",cwd:$,defaultConfig:q5,verbose:!1})).config;if(_B(G),sJ(G,$),BB(G,$),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (nJ(),iJ)),q=[],K=[];for(let U of G.plugins){let W=typeof U==="string"?U:U[0],z=typeof U==="string"?{}:U[1]||{};try{let w,B;try{w=await import(W),B=p0.dirname(W0.resolve(W))}catch{let _=p0.resolve(process.cwd(),W);w=await import(_),B=p0.dirname(_)}let j=w.default||w;if(Q.register(j,G),j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let H of _)q.push(p0.resolve(B,H))}if(j.pages){let _=p0.resolve(B,j.pages),H=z.path||"/";K.push({dir:_,prefix:H})}if(j.setup){let _={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,O)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=O},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:B,config:G};await j.setup(z,_)}console.log(`[stx] Plugin loaded: ${j.name||W}`)}catch(w){console.warn(`[stx] Failed to load plugin ${W}:`,w.message)}}G._pluginComponentDirs=q,G._pluginPageDirs=K}return G})();if(oJ.set($,Y),!X)d8=Y,Y.then((J)=>{f5=J}).catch(()=>{});return Y}function HB(X){return X}function OB(X){let $=[],Z=[];if(X.partialsDir!==void 0&&typeof X.partialsDir!=="string")$.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(X.componentsDir!==void 0&&typeof X.componentsDir!=="string")$.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(X.cache!==void 0&&typeof X.cache!=="boolean")$.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(X.debug!==void 0&&typeof X.debug!=="boolean")$.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(X.streaming){if(X.streaming.bufferSize!==void 0){if(typeof X.streaming.bufferSize!=="number"||X.streaming.bufferSize<=0)$.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(X.streaming.timeout!==void 0){if(typeof X.streaming.timeout!=="number"||X.streaming.timeout<=0)$.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(X.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes(X.streaming.strategy))$.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.i18n){if(X.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes(X.i18n.format))$.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.animation){if(X.animation.defaultDuration!==void 0){if(typeof X.animation.defaultDuration!=="number"||X.animation.defaultDuration<0)$.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(X.animation.staggerDelay!==void 0){if(typeof X.animation.staggerDelay!=="number"||X.animation.staggerDelay<0)$.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(X.a11y){if(X.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes(X.a11y.level))$.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.hydration){if(X.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes(X.hydration.mode))$.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes(X.hydration.preload))$.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.customDirectives)if(!Array.isArray(X.customDirectives))$.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else X.customDirectives.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(X.middleware)if(!Array.isArray(X.middleware))$.push({path:"middleware",message:"middleware must be an array",severity:"error"});else X.middleware.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))$.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(X.debug===!0&&X.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(X.seo?.enabled===!0&&!X.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(X.pwa){if(X.pwa.enabled===!0&&!X.pwa.manifest?.name)$.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(X.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes(X.pwa.manifest.display))$.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes(X.pwa.manifest.orientation))$.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];X.pwa.routes.forEach((J,G)=>{if(!J.pattern||typeof J.pattern!=="string")$.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(J.strategy))$.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))$.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))$.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(X.pwa.icons?.sizes){if(!Array.isArray(X.pwa.icons.sizes))$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(X.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(X.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if(X.pwa.icons.purpose.filter((G)=>!Y.includes(G)).length>0)$.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.enabled===!0&&!X.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(X.pwa.enabled===!0&&!X.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:$.length===0,errors:$,warnings:Z}}var q5,rJ,f5=null,oJ,d8=null,N7;var T1=E(()=>{I$();E$();i$();n$();s9();QJ();I4();D4();v4();wX();pJ();q5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:L5,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:SY,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:cJ,hasEndTag:!1,description:"Include a web component in the template"},g6,h6,mJ,lJ,u6,m6,l6,d6,j2,H2,GJ,k4,...E4],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};rJ=new Set;oJ=new Map;N7=new Proxy(q5,{get(X,$){if(f5&&$ in f5)return f5[$];if(!d8)S1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return X[$]}})});import q0 from"path";import{hasLocalConfig as LB}from"bunfig";function l8(X){return Bun.hash(X).toString(16).padStart(16,"0").slice(0,16)}function g4(X,$){if(K5.has(X))K5.delete(X);else if(K5.size>=XG)K5.delete(K5.keys().next().value);K5.set(X,$)}function FB(X){let $=l8(X);if(g5.has($))g5.delete($);else if(g5.size>=XG)g5.delete(g5.keys().next().value);return g5.set($,X),$}async function VB(X){if(!v1)return null;try{let $=Bun.file(q0.join(v1,`cw-${l8(X)}.css`));if(!await $.exists())return null;return await $.text()}catch{return null}}async function AB(X,$){if(!v1)return;try{if(!fs.existsSync(v1))fs.mkdirSync(v1,{recursive:!0});await Bun.write(q0.join(v1,`cw-${l8(X)}.css`),$)}catch{}}async function eJ(X){try{let $=await import(X);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig,extractClasses:$.extractClasses}}catch{}return null}function RB(){let X=[],$=process.cwd();while($!==q0.dirname($))X.push(q0.join($,"node_modules","@cwcss","crosswind","dist","index.js")),X.push(q0.join($,"node_modules","@cwcss","crosswind","src","index.ts")),X.push(q0.join($,"pantry","@cwcss","crosswind","dist","index.js")),X.push(q0.join($,"pantry","@cwcss","crosswind","src","index.ts")),X.push(q0.join($,"node_modules","@stacksjs","crosswind","dist","index.js")),X.push(q0.join($,"pantry","@stacksjs","crosswind","dist","index.js")),$=q0.dirname($);return X}function NB(){let X=[],$=process.env.HOME||process.env.USERPROFILE||"";if($){let Z=[q0.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),q0.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),q0.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),q0.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),q0.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),q0.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];X.push(...Z)}return X.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),X.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),X}async function TB(){if(tJ)return O1;tJ=!0;try{let X=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await eJ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${k0.green}[Crosswind]${k0.reset} CSS engine loaded from ${q0.dirname(q0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=q0.resolve(process.env.CROSSWIND_SRC),G=await X([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return O1=G,O1}let $=await X(RB());if($)return O1=$,O1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await eJ(J);if(G){if(O1=G,!process.env.STACKS_DEV_QUIET)console.log(`${k0.green}[Crosswind]${k0.reset} CSS engine loaded`);return O1}}let Y=await X(NB());if(Y)return O1=Y,O1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${k0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${k0.reset}`),console.warn(`${k0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${k0.reset}`),null}}async function MB(X){try{if(!LB({name:"crosswind",cwd:X}))return null;let{loadConfigWithResult:$}=await import("bunfig"),Z=await $({name:"crosswind",cwd:X,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let Y=q0.relative(X,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${k0.green}[Crosswind]${k0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch($){if($ instanceof Error&&$.name==="ConfigNotFoundError")return null;return console.warn(`${k0.yellow}[Crosswind]${k0.reset} Failed to load crosswind config:`,$ instanceof Error?$.message:$),null}}function kB(X){let $=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec(X);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())$.add(Q.trim());Y=Z.exec(X)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.exec(X);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let q of Q)for(let K of q.slice(1,-1).split(/\s+/))if(K.trim())$.add(K.trim())}G=J.exec(X)}return $}async function IB(X,$){try{let Z=await TB();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses(X):kB(X);if(Y.size===0)return"";let J=$?q0.resolve($):process.cwd();if(!v1)v1=q7(J,"cache");let G=[...Y].sort().join(" "),Q=`${f4||"default"}::${G}`,q=K5.get(Q);if(q!==void 0)return g4(Q,q),q;let K=await VB(Q);if(K!==null)return g4(Q,K),K;if(!m8){let A=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (T1(),aJ)),N=await R(J);if(N.css)if(typeof N.css==="string"){let T=q0.isAbsolute(N.css)?N.css:q0.resolve(J,N.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${k0.green}[Crosswind]${k0.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=q0.isAbsolute(N.css.config)?N.css.config:q0.resolve(J,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${k0.green}[Crosswind]${k0.reset} Using inline CSS config from stx.config.ts`)}}catch{}m8=A||await MB(J);try{f4=l8(JSON.stringify(m8??{}))}catch{f4="unhashable"}}let U=Z.defaultConfig||Z.config,W=m8||{},z=b6(U,W),{safelist:w,includePreflight:B,minify:j,tokenCSS:_}=z,H=z.config,O=new Z.CSSGenerator(H);for(let A of w)O.generate(A);for(let A of Y)O.generate(A);let L=O.toCSS(B,j),F=H.shortcuts||W.shortcuts||{};for(let[A,R]of Object.entries(F)){if(!Y.has(A)&&!w.includes(A))continue;let N=R.split(/\s+/).filter(Boolean);for(let T of N)O.generate(T)}L=O.toCSS(B,j);let V=L.split(`
12730
- `);for(let[A,R]of Object.entries(F)){if(!Y.has(A)&&!w.includes(A))continue;let N=R.split(/\s+/).filter(Boolean),T=[],M=[];for(let k of N){let D=k.startsWith("dark:"),b=`.${(D?k.slice(5):k).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<V.length;y++){let P=V[y].trim();if(P===`${b} {`||P.startsWith(`${b} {`)){let x=y,f="";while(x<V.length){if(f+=V[x],V[x].includes("}"))break;x++}let c=f.match(/\{([^}]+)\}/);if(c)if(D)M.push(c[1].trim());else T.push(c[1].trim());break}}}if(T.length)L+=`
12731
- .${A} { ${T.join(" ")} }`;if(M.length)L+=`
12732
- @media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return L=_+L,g4(Q,L),AB(Q,L),L}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function $G(X,$,Z=!1){let Y=await IB(X,$);if(!Y)return X;let J=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${FB(Y)}.css">`:`<style data-crosswind="generated">
12727
+ `}async function cJ(X,$,Z,Y){if($.length<1)return Y0("WebComponent","@webcomponent directive requires at least the tag name parameter",o.INVALID_DIRECTIVE_SYNTAX);let J=$[0].replace(/['"]/g,""),Q=(Z.__stx_options||{}).componentsDir||"components",q=[d7.join(d7.dirname(Y),Q,`${J}.stx`),d7.join(process.cwd(),Q,`${J}.stx`),d7.join(d7.dirname(Y),`${J}.stx`)],W=null;for(let z of q)if(await t(z)){W=await Bun.file(z).text();break}if(!W)return Y0("WebComponent",`Component file not found: ${J}.stx`,o.FILE_NOT_FOUND);let K=GB(W,J);return`<script type="module">
12728
+ ${QB(K)}
12729
+ </script>`}var pJ=E(()=>{H1();H0()});var iJ={};i(iJ,{timingPlugin:()=>zB,pluginManager:()=>qB,definePlugin:()=>h8,debugPlugin:()=>UB,createVariablesPlugin:()=>wB,createFilterPlugin:()=>KB,createDirectivePlugin:()=>WB,PluginManager:()=>x4});function h8(X){return X}class x4{plugins=new Map;sortedPlugins=[];initialized=!1;async register(X,$){if(this.plugins.has(X.name))throw Error(`Plugin "${X.name}" is already registered`);if(X.dependencies){for(let Z of X.dependencies)if(!this.plugins.has(Z))throw Error(`Plugin "${X.name}" depends on "${Z}" which is not registered`)}if(this.plugins.set(X.name,X),X.onRegister)await X.onRegister($);this.sortPlugins()}async unregister(X){let $=this.plugins.get(X);if(!$)return!1;for(let[Z,Y]of this.plugins)if(Y.dependencies?.includes(X))throw Error(`Cannot unregister "${X}" because "${Z}" depends on it`);if($.onUnregister)await $.onUnregister();return this.plugins.delete(X),this.sortPlugins(),!0}get(X){return this.plugins.get(X)}has(X){return this.plugins.has(X)}getAll(){return[...this.sortedPlugins]}getAllDirectives(){let X=[];for(let $ of this.sortedPlugins)if($.registerDirectives)X.push(...$.registerDirectives());return X}getAllFilters(){let X={};for(let $ of this.sortedPlugins)if($.registerFilters)Object.assign(X,$.registerFilters());return X}async runBeforeProcess(X){return this.runHooks("beforeProcess",X)}async runAfterParse(X){return this.runHooks("afterParse",X)}async runBeforeDirective(X,$){return this.runDirectiveHooks("beforeDirective",X,$)}async runAfterDirective(X,$){return this.runDirectiveHooks("afterDirective",X,$)}async runBeforeRender(X){return this.runHooks("beforeRender",X)}async runAfterRender(X){return this.runHooks("afterRender",X)}async runOnError(X){for(let $ of this.sortedPlugins)if($.onError)try{let Z=await $.onError(X);if(Z){if(Z.template!==void 0)X.template=Z.template;if(Z.context)X.context={...X.context,...Z.context};if(Z.metadata)X.metadata={...X.metadata,...Z.metadata};if(Z.skip)return X}}catch(Z){console.error(`Error in plugin "${$.name}" onError hook:`,Z)}return null}sortPlugins(){this.sortedPlugins=Array.from(this.plugins.values()).sort((X,$)=>(X.priority??100)-($.priority??100))}async runHooks(X,$){let Z={...$};for(let Y of this.sortedPlugins){let J=Y[X];if(J)try{let G=await J(Z);if(G){if(G.template!==void 0)Z.template=G.template;if(G.context)Z.context={...Z.context,...G.context};if(G.metadata)Z.metadata={...Z.metadata,...G.metadata};if(G.skip)break}}catch(G){console.error(`Error in plugin "${Y.name}" ${X} hook:`,G)}}return Z}async runDirectiveHooks(X,$,Z){let Y={...Z};for(let J of this.sortedPlugins){let G=J[X];if(G)try{let Q=await G($,Y);if(Q){if(Q.template!==void 0)Y.template=Q.template;if(Q.context)Y.context={...Y.context,...Q.context};if(Q.metadata)Y.metadata={...Y.metadata,...Q.metadata};if(Q.skip)break}}catch(Q){console.error(`Error in plugin "${J.name}" ${X} hook:`,Q)}}return Y}}function WB(X,$,Z={}){return{name:X,...Z,registerDirectives:()=>$}}function KB(X,$,Z={}){return{name:X,...Z,registerFilters:()=>$}}function wB(X){return h8({name:"stx-variables",version:"1.0.0",description:"Adds predefined variables to template context",beforeProcess($){return{context:{...$.context,...X}}}})}var qB,UB,zB;var nJ=E(()=>{qB=new x4;UB=h8({name:"stx-debug",version:"1.0.0",description:"Logs all plugin lifecycle events for debugging",priority:0,beforeProcess(X){console.log("[stx-debug] beforeProcess:",X.filePath)},afterParse(X){console.log("[stx-debug] afterParse:",X.template.length,"chars")},beforeDirective(X,$){console.log("[stx-debug] beforeDirective:",X)},afterDirective(X,$){console.log("[stx-debug] afterDirective:",X)},beforeRender(X){console.log("[stx-debug] beforeRender")},afterRender(X){console.log("[stx-debug] afterRender:",X.template.length,"chars")},onError(X){console.error("[stx-debug] onError:",X.error.message,"in phase:",X.phase)}}),zB=h8({name:"stx-timing",version:"1.0.0",description:"Measures template processing time",priority:1,beforeProcess(X){X.metadata.startTime=performance.now()},afterRender(X){let $=X.metadata.startTime;if($){let Z=performance.now()-$;console.log(`[stx-timing] Processing took ${Z.toFixed(2)}ms`)}}})});var aJ={};i(aJ,{validateConfig:()=>FB,resolveStxDirectories:()=>sJ,loadStxConfig:()=>S1,defineStxConfig:()=>OB,defaultConfig:()=>q5,config:()=>N7});import u8 from"fs";import p0 from"path";import{loadConfigWithResult as jB}from"bunfig";function BB(X,$,Z){let Y=$||"pages";if(X)return{root:X,pagesDir:Y};let J=Z||process.cwd(),G=p0.join(J,"resources","views"),Q=p0.join(J,"resources","layouts");if(u8.existsSync(G)&&u8.existsSync(Q))return{root:"resources",pagesDir:"views"};let q=p0.join(J,"resources","views","pages");if(u8.existsSync(q))return{root:"resources/views",pagesDir:Y};return{root:".",pagesDir:Y}}function _B(X,$){let Z=$.replace(/[\\/]+$/,"");if(!Z||Z===".")return!0;let Y=X.replace(/\\/g,"/"),J=Z.replace(/\\/g,"/");return Y===J||Y.startsWith(`${J}/`)}function sJ(X,$){let Z=!X.root,Y=BB(X.root,X.pagesDir,$);if(X.root=Y.root,X.pagesDir=Y.pagesDir,Z&&Y.root!=="."){let J=`${$}::${Y.root}`;if(!rJ.has(J))rJ.add(J),console.warn(`[stx] No "root" in config \u2014 inferred "${Y.root}" from the project layout. Template directories are resolved under it; set root explicitly to pin this.`)}if(X.root&&X.root!=="."){let J=X.root;for(let G of["partialsDir","componentsDir","layoutsDir"]){let Q=X[G];if(typeof Q!=="string"||!Q)continue;if(p0.isAbsolute(Q)||_B(Q,J))continue;X[G]=p0.join(J,Q)}}return X}function HB(X,$){let Z=["componentsDir","layoutsDir","partialsDir"];for(let Y of Z){let J=X[Y];if(typeof J!=="string"||!J)continue;let G=p0.isAbsolute(J)?J:p0.join($,J);if(u8.existsSync(G))continue;let Q=X.root,q=!!Q&&Q!==".";console.warn(`[stx] ${String(Y)} resolves to "${G}", which does not exist. Configured as "${J}"`+(q?`, resolved under root "${Q}".`:"."))}}function LB(X){if(P6(X.stateDir),X.stateDir=Q7(),X.cachePath=W7(X.cachePath),X.build)X.build.cacheDir=W7(X.build.cacheDir);if(X.media?.cache)X.media.cache.directory=W7(X.media.cache.directory);if(X.story)X.story.outDir=W7(X.story.outDir)}async function S1(X){if(!X){if(f5)return f5;if(d8)return d8}let $=X?p0.resolve(X):process.cwd(),Z=oJ.get($);if(Z)return Z;let Y=(async()=>{let G=(await jB({name:"stx",alias:"ui",cwd:$,defaultConfig:q5,verbose:!1})).config;if(LB(G),sJ(G,$),HB(G,$),G.plugins&&G.plugins.length>0){let{pluginManager:Q}=await Promise.resolve().then(() => (nJ(),iJ)),q=[],W=[];for(let K of G.plugins){let U=typeof K==="string"?K:K[0],z=typeof K==="string"?{}:K[1]||{};try{let w,B;try{w=await import(U),B=p0.dirname(U0.resolve(U))}catch{let _=p0.resolve(process.cwd(),U);w=await import(_),B=p0.dirname(_)}let j=w.default||w;if(Q.register(j,G),j.components){let _=Array.isArray(j.components)?j.components:[j.components];for(let H of _)q.push(p0.resolve(B,H))}if(j.pages){let _=p0.resolve(B,j.pages),H=z.path||"/";W.push({dir:_,prefix:H})}if(j.setup){let _={addDirective:(H)=>{G.customDirectives=G.customDirectives||[],G.customDirectives.push(H)},addRoute:(H,L)=>{G.apiRoutes=G.apiRoutes||{},G.apiRoutes[H]=L},addMiddleware:(H)=>{G.middleware=G.middleware||[],G.middleware.push(H)},pluginDir:B,config:G};await j.setup(z,_)}console.log(`[stx] Plugin loaded: ${j.name||U}`)}catch(w){console.warn(`[stx] Failed to load plugin ${U}:`,w.message)}}G._pluginComponentDirs=q,G._pluginPageDirs=W}return G})();if(oJ.set($,Y),!X)d8=Y,Y.then((J)=>{f5=J}).catch(()=>{});return Y}function OB(X){return X}function FB(X){let $=[],Z=[];if(X.partialsDir!==void 0&&typeof X.partialsDir!=="string")$.push({path:"partialsDir",message:"partialsDir must be a string",severity:"error"});if(X.componentsDir!==void 0&&typeof X.componentsDir!=="string")$.push({path:"componentsDir",message:"componentsDir must be a string",severity:"error"});if(X.cache!==void 0&&typeof X.cache!=="boolean")$.push({path:"cache",message:"cache must be a boolean",severity:"error"});if(X.debug!==void 0&&typeof X.debug!=="boolean")$.push({path:"debug",message:"debug must be a boolean",severity:"error"});if(X.streaming){if(X.streaming.bufferSize!==void 0){if(typeof X.streaming.bufferSize!=="number"||X.streaming.bufferSize<=0)$.push({path:"streaming.bufferSize",message:"streaming.bufferSize must be a positive number",severity:"error"})}if(X.streaming.timeout!==void 0){if(typeof X.streaming.timeout!=="number"||X.streaming.timeout<=0)$.push({path:"streaming.timeout",message:"streaming.timeout must be a positive number",severity:"error"})}if(X.streaming.strategy!==void 0){let Y=["auto","manual","sections"];if(!Y.includes(X.streaming.strategy))$.push({path:"streaming.strategy",message:`streaming.strategy must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.i18n){if(X.i18n.format!==void 0){let Y=["json","yaml","yml","js"];if(!Y.includes(X.i18n.format))$.push({path:"i18n.format",message:`i18n.format must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.animation){if(X.animation.defaultDuration!==void 0){if(typeof X.animation.defaultDuration!=="number"||X.animation.defaultDuration<0)$.push({path:"animation.defaultDuration",message:"animation.defaultDuration must be a non-negative number",severity:"error"})}if(X.animation.staggerDelay!==void 0){if(typeof X.animation.staggerDelay!=="number"||X.animation.staggerDelay<0)$.push({path:"animation.staggerDelay",message:"animation.staggerDelay must be a non-negative number",severity:"error"})}}if(X.a11y){if(X.a11y.level!==void 0){let Y=["AA","AAA"];if(!Y.includes(X.a11y.level))$.push({path:"a11y.level",message:`a11y.level must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.hydration){if(X.hydration.mode!==void 0){let Y=["progressive","islands"];if(!Y.includes(X.hydration.mode))$.push({path:"hydration.mode",message:`hydration.mode must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.hydration.preload!==void 0){let Y=["none","eager","lazy"];if(!Y.includes(X.hydration.preload))$.push({path:"hydration.preload",message:`hydration.preload must be one of: ${Y.join(", ")}`,severity:"error"})}}if(X.customDirectives)if(!Array.isArray(X.customDirectives))$.push({path:"customDirectives",message:"customDirectives must be an array",severity:"error"});else X.customDirectives.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`customDirectives[${J}].name`,message:"Custom directive must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`customDirectives[${J}].handler`,message:"Custom directive must have a handler function",severity:"error"})});if(X.middleware)if(!Array.isArray(X.middleware))$.push({path:"middleware",message:"middleware must be an array",severity:"error"});else X.middleware.forEach((Y,J)=>{if(!Y.name||typeof Y.name!=="string")$.push({path:`middleware[${J}].name`,message:"Middleware must have a name string",severity:"error"});if(!Y.handler||typeof Y.handler!=="function")$.push({path:`middleware[${J}].handler`,message:"Middleware must have a handler function",severity:"error"});if(!Y.timing||!["before","after"].includes(Y.timing))$.push({path:`middleware[${J}].timing`,message:'Middleware timing must be "before" or "after"',severity:"error"})});if(X.debug===!0&&X.cache===!0)Z.push({path:"debug+cache",message:"Debug mode with caching enabled may show stale content during development",severity:"warning"});if(X.seo?.enabled===!0&&!X.seo?.defaultConfig?.title)Z.push({path:"seo.defaultConfig.title",message:"SEO is enabled but no default title is set",severity:"warning"});if(X.pwa){if(X.pwa.enabled===!0&&!X.pwa.manifest?.name)$.push({path:"pwa.manifest.name",message:"PWA manifest name is required when PWA is enabled",severity:"error"});if(X.pwa.manifest?.display!==void 0){let Y=["fullscreen","standalone","minimal-ui","browser"];if(!Y.includes(X.pwa.manifest.display))$.push({path:"pwa.manifest.display",message:`PWA display must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.manifest?.orientation!==void 0){let Y=["portrait","landscape","any","portrait-primary","portrait-secondary","landscape-primary","landscape-secondary"];if(!Y.includes(X.pwa.manifest.orientation))$.push({path:"pwa.manifest.orientation",message:`PWA orientation must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.routes){let Y=["cache-first","network-first","stale-while-revalidate","network-only","cache-only"];X.pwa.routes.forEach((J,G)=>{if(!J.pattern||typeof J.pattern!=="string")$.push({path:`pwa.routes[${G}].pattern`,message:"PWA route must have a pattern string",severity:"error"});if(!Y.includes(J.strategy))$.push({path:`pwa.routes[${G}].strategy`,message:`PWA route strategy must be one of: ${Y.join(", ")}`,severity:"error"});if(J.maxAgeSeconds!==void 0&&(typeof J.maxAgeSeconds!=="number"||J.maxAgeSeconds<0))$.push({path:`pwa.routes[${G}].maxAgeSeconds`,message:"PWA route maxAgeSeconds must be a non-negative number",severity:"error"});if(J.maxEntries!==void 0&&(typeof J.maxEntries!=="number"||J.maxEntries<1))$.push({path:`pwa.routes[${G}].maxEntries`,message:"PWA route maxEntries must be a positive number",severity:"error"})})}if(X.pwa.icons?.sizes){if(!Array.isArray(X.pwa.icons.sizes))$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be an array of numbers",severity:"error"});else if(X.pwa.icons.sizes.filter((J)=>typeof J!=="number"||J<16||J>1024).length>0)$.push({path:"pwa.icons.sizes",message:"PWA icon sizes must be numbers between 16 and 1024",severity:"error"})}if(X.pwa.icons?.purpose){let Y=["any","maskable","monochrome"];if(X.pwa.icons.purpose.filter((G)=>!Y.includes(G)).length>0)$.push({path:"pwa.icons.purpose",message:`PWA icon purpose must be one of: ${Y.join(", ")}`,severity:"error"})}if(X.pwa.enabled===!0&&!X.pwa.icons?.src)Z.push({path:"pwa.icons.src",message:"PWA is enabled but no icon source specified. Provide a 512x512 PNG for best results.",severity:"warning"});if(X.pwa.enabled===!0&&!X.pwa.manifest?.themeColor)Z.push({path:"pwa.manifest.themeColor",message:"PWA theme color not set, defaulting to black",severity:"warning"})}return{valid:$.length===0,errors:$,warnings:Z}}var q5,rJ,f5=null,oJ,d8=null,N7;var T1=E(()=>{I$();E$();i$();n$();s9();QJ();I4();D4();v4();wX();pJ();q5={enabled:!0,ssr:!1,partialsDir:"partials",componentsDir:"components",layoutsDir:"layouts",defaultLayout:"default",debug:!1,cache:!0,stateDir:O5,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:SY,hasEndTag:!0,description:"Render markdown content to HTML"},{name:"webcomponent",handler:cJ,hasEndTag:!1,description:"Include a web component in the template"},g6,h6,mJ,lJ,u6,m6,l6,d6,j2,H2,GJ,k4,...E4],middleware:[],i18n:{defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},webComponents:{enabled:!1,outputDir:"dist/web-components",components:[]},docs:{enabled:!1,outputDir:"docs",format:"markdown",components:!0,templates:!0,directives:!0},streaming:{enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},hydration:{enabled:!1,mode:"islands",clientEntry:"src/client.ts",autoMarkers:!0,preload:"lazy"},router:{enabled:!0,container:"main",linkSelector:"a[href]",viewTransitions:!0,scrollToTop:!0,prefetch:!0,cache:!0,cacheTTL:300000,skipSelectors:'[data-no-router], [target="_blank"]',viewTransitionCSS:{oldRoot:"fade-out 0.15s ease-in",newRoot:"fade-in 0.2s ease-out",oldContent:"slide-out 0.2s ease-in",newContent:"slide-in 0.25s ease-out"}},a11y:{enabled:!0,addSrOnlyStyles:!0,level:"AA",autoFix:!1,ignoreChecks:[]},seo:{enabled:!0,socialPreview:!0,defaultConfig:{title:"stx Project",description:"A website built with stx templating engine"}},animation:{enabled:!0,defaultDuration:300,defaultEase:"ease",respectMotionPreferences:!0,staggerDelay:50},markdown:{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0,additionalThemes:["light-plus","one-dark-pro","dracula","monokai","solarized-light","nord","github-dark"]}},loops:{maxWhileIterations:1000,useAltLoopVariable:!1},story:{enabled:!0,outDir:".stx/dist/story",storyMatch:["**/*.story.stx"],storyIgnored:["**/node_modules/**","**/dist/**","**/.stx/**"],port:6006},pwa:{enabled:!1,manifest:{name:"stx App",shortName:"stx",description:"A Progressive Web App built with stx",startUrl:"/",display:"standalone",orientation:"any",themeColor:"#000000",backgroundColor:"#ffffff",scope:"/"},icons:{src:"public/icon.png",sizes:[72,96,128,144,152,192,384,512],generateWebP:!0,generateAppleIcons:!0,outputDir:"pwa-icons",purpose:["any","maskable"]},routes:[{pattern:"/",strategy:"network-first"},{pattern:"/static/*",strategy:"cache-first",maxAgeSeconds:2592000},{pattern:"/api/*",strategy:"network-only"},{pattern:"*.js",strategy:"stale-while-revalidate"},{pattern:"*.css",strategy:"stale-while-revalidate"},{pattern:"*.png",strategy:"cache-first"},{pattern:"*.jpg",strategy:"cache-first"},{pattern:"*.webp",strategy:"cache-first"},{pattern:"*.svg",strategy:"cache-first"}],offline:{enabled:!0,fallbackTitle:"You are offline",fallbackMessage:"Please check your internet connection and try again.",precacheAssets:[]},serviceWorker:{fileName:"sw.js",cacheVersion:"1.0.0",skipWaiting:!0,clientsClaim:!0,navigationPreload:!1,excludeRoutes:["/api/auth/*"],cacheFileTypes:["html","css","js","png","jpg","jpeg","webp","svg","woff","woff2"],useWorkbox:!1},autoInject:!0,push:{enabled:!1,defaultOptions:{vibrate:[100,50,100],requireInteraction:!1}},backgroundSync:{enabled:!1,queueName:"stx-sync-queue",maxRetentionMinutes:1440,maxRetries:3,minInterval:1000,forms:[],endpoints:[]},shareTarget:{enabled:!1,action:"/share-target",method:"POST",enctype:"multipart/form-data",params:{title:"title",text:"text",url:"url"}},fileHandlers:{enabled:!1},protocolHandlers:[],cacheStorage:{maxSize:100,maxEntries:500,maxAge:30,purgeStrategy:"lru"},updates:{enabled:!0,promptUser:!0,autoReload:!1,message:"A new version is available. Reload to update?"},precache:{enabled:!0,includeHtml:!0,includeJs:!0,includeCss:!0,includeImages:!0,includeFonts:!0,include:[],exclude:["*.map","*.LICENSE.txt"],maxFileSizeKB:500}},media:{enabled:!0,image:{enabled:!0,defaultWidths:[320,480,640,768,1024,1280,1536,1920],defaultFormats:["avif","webp","jpeg"],defaultQuality:80,placeholderStrategy:"thumbhash",lazyByDefault:!0,enableDpr:!0,defaultDpr:[1,2,3],tsImages:{enabled:!0,outputDir:"dist/images",baseUrl:"/images",formatQuality:{jpeg:{quality:85,mozjpeg:!0,progressive:!0},png:{compressionLevel:9,palette:!1},webp:{quality:82,effort:5,smartSubsample:!0},avif:{quality:75,effort:4,lossless:!1}},breakpoints:[320,480,640,768,1024,1280,1536,1920],batchOptions:{concurrency:4,optimizationPreset:"web"}}},video:{enabled:!0,lazyByDefault:!0,defaultControls:!0,tsVideos:{enabled:!0,outputDir:"dist/videos",baseUrl:"/videos",defaultQuality:"high",streaming:{enabled:!0,format:"hls",segmentDuration:6,defaultQualities:[{label:"1080p",width:1920,height:1080,bitrate:5000000,audioBitrate:192000},{label:"720p",width:1280,height:720,bitrate:2500000,audioBitrate:128000},{label:"480p",width:854,height:480,bitrate:1e6,audioBitrate:96000}]},thumbnails:{enabled:!0,count:10,format:"webp",width:320},transcoding:{defaultCodec:"h264",defaultAudioCodec:"aac",speedPreset:"medium"}}},upload:{enabled:!0,maxSize:10485760,allowedTypes:["image/*","video/*","audio/*","application/pdf"],maxConcurrent:3},protected:{enabled:!0,expirationSeconds:3600,batchSize:10},cache:{enabled:!0,directory:".stx/media-cache",maxAge:30,maxSize:500}},broadcasting:{enabled:!1,driver:"bun",host:"0.0.0.0",port:6001,scheme:"ws",verbose:!1}};rJ=new Set;oJ=new Map;N7=new Proxy(q5,{get(X,$){if(f5&&$ in f5)return f5[$];if(!d8)S1().catch((Z)=>{console.warn("[stx] Failed to load config file:",Z?.message||Z)});return X[$]}})});import q0 from"path";import{hasLocalConfig as VB}from"bunfig";function l8(X){return Bun.hash(X).toString(16).padStart(16,"0").slice(0,16)}function g4(X,$){if(W5.has(X))W5.delete(X);else if(W5.size>=XG)W5.delete(W5.keys().next().value);W5.set(X,$)}function AB(X){let $=l8(X);if(g5.has($))g5.delete($);else if(g5.size>=XG)g5.delete(g5.keys().next().value);return g5.set($,X),$}async function RB(X){if(!v1)return null;try{let $=Bun.file(q0.join(v1,`cw-${l8(X)}.css`));if(!await $.exists())return null;return await $.text()}catch{return null}}async function NB(X,$){if(!v1)return;try{if(!fs.existsSync(v1))fs.mkdirSync(v1,{recursive:!0});await Bun.write(q0.join(v1,`cw-${l8(X)}.css`),$)}catch{}}async function eJ(X){try{let $=await import(X);if($&&$.CSSGenerator)return{CSSGenerator:$.CSSGenerator,config:$.config,build:$.build,defaultConfig:$.defaultConfig,extractClasses:$.extractClasses}}catch{}return null}function TB(){let X=[],$=process.cwd();while($!==q0.dirname($))X.push(q0.join($,"node_modules","@cwcss","crosswind","dist","index.js")),X.push(q0.join($,"node_modules","@cwcss","crosswind","src","index.ts")),X.push(q0.join($,"pantry","@cwcss","crosswind","dist","index.js")),X.push(q0.join($,"pantry","@cwcss","crosswind","src","index.ts")),X.push(q0.join($,"node_modules","@stacksjs","crosswind","dist","index.js")),X.push(q0.join($,"pantry","@stacksjs","crosswind","dist","index.js")),$=q0.dirname($);return X}function MB(){let X=[],$=process.env.HOME||process.env.USERPROFILE||"";if($){let Z=[q0.join($,"Code","Tools","crosswind","packages","crosswind","dist","index.js"),q0.join($,"Code","Tools","crosswind","packages","crosswind","src","index.ts"),q0.join($,"repos","stacks-org","crosswind","packages","crosswind","dist","index.js"),q0.join($,"repos","stacks-org","crosswind","packages","crosswind","src","index.ts"),q0.join($,"Code","Tools","stx","packages","stx","node_modules","@cwcss","crosswind","dist","index.js"),q0.join($,"Code","Tools","stx","packages","stx","node_modules","@stacksjs","crosswind","dist","index.js")];X.push(...Z)}return X.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","dist","index.js")),X.push(q0.join(process.cwd(),"..","crosswind","packages","crosswind","src","index.ts")),X}async function kB(){if(tJ)return L1;tJ=!0;try{let X=async(J)=>{for(let G of J){if(!await Bun.file(G).exists())continue;let Q=await eJ(G);if(Q){if(!process.env.STACKS_DEV_QUIET)console.log(`${k0.green}[Crosswind]${k0.reset} CSS engine loaded from ${q0.dirname(q0.dirname(G))}`);return Q}}return null};if(process.env.CROSSWIND_SRC){let J=q0.resolve(process.env.CROSSWIND_SRC),G=await X([J]);if(!G)throw Error(`CROSSWIND_SRC did not resolve to a Crosswind module: ${J}`);return L1=G,L1}let $=await X(TB());if($)return L1=$,L1;let Z=["@cwcss/crosswind","@cwcss/crosswind/dist/index.js","@stacksjs/crosswind","@stacksjs/crosswind/dist/index.js"];for(let J of Z){let G=await eJ(J);if(G){if(L1=G,!process.env.STACKS_DEV_QUIET)console.log(`${k0.green}[Crosswind]${k0.reset} CSS engine loaded`);return L1}}let Y=await X(MB());if(Y)return L1=Y,L1;throw Error("Crosswind CSSGenerator not found in any location")}catch{return console.warn(`${k0.yellow}[Crosswind] CSS engine not available, Tailwind styles will not be generated${k0.reset}`),console.warn(`${k0.yellow}Run 'bun add @stacksjs/crosswind' to enable CSS generation${k0.reset}`),null}}async function IB(X){try{if(!VB({name:"crosswind",cwd:X}))return null;let{loadConfigWithResult:$}=await import("bunfig"),Z=await $({name:"crosswind",cwd:X,defaultConfig:{},checkEnv:!1,verbose:!1});if(!Z?.path||!Z.config||Object.keys(Z.config).length===0)return null;let Y=q0.relative(X,Z.path);if(!process.env.STACKS_DEV_QUIET)console.log(`${k0.green}[Crosswind]${k0.reset} Loaded config from ${Y||Z.path}`);return Z.config}catch($){if($ instanceof Error&&$.name==="ConfigNotFoundError")return null;return console.warn(`${k0.yellow}[Crosswind]${k0.reset} Failed to load crosswind config:`,$ instanceof Error?$.message:$),null}}function EB(X){let $=new Set,Z=/class\s*=\s*["']([^"']+)["']/gi,Y=Z.exec(X);while(Y!==null){for(let Q of Y[1].split(/\s+/))if(Q.trim())$.add(Q.trim());Y=Z.exec(X)}let J=/(?:x-class|:class)\s*=\s*"([^"]+)"/gi,G=J.exec(X);while(G!==null){let Q=G[1].match(/'([^']+)'/g);if(Q){for(let q of Q)for(let W of q.slice(1,-1).split(/\s+/))if(W.trim())$.add(W.trim())}G=J.exec(X)}return $}async function DB(X,$){try{let Z=await kB();if(!Z)return"";let Y=typeof Z.extractClasses==="function"?Z.extractClasses(X):EB(X);if(Y.size===0)return"";let J=$?q0.resolve($):process.cwd();if(!v1)v1=q7(J,"cache");let G=[...Y].sort().join(" "),Q=`${f4||"default"}::${G}`,q=W5.get(Q);if(q!==void 0)return g4(Q,q),q;let W=await RB(Q);if(W!==null)return g4(Q,W),W;if(!m8){let A=null;try{let{loadStxConfig:R}=await Promise.resolve().then(() => (T1(),aJ)),N=await R(J);if(N.css)if(typeof N.css==="string"){let T=q0.isAbsolute(N.css)?N.css:q0.resolve(J,N.css);if(await Bun.file(T).exists()){let M=await import(T);A=M.default||M,console.log(`${k0.green}[Crosswind]${k0.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=q0.isAbsolute(N.css.config)?N.css.config:q0.resolve(J,N.css.config);if(await Bun.file(T).exists()){let M=await import(T);A={...M.default||M,...A}}}console.log(`${k0.green}[Crosswind]${k0.reset} Using inline CSS config from stx.config.ts`)}}catch{}m8=A||await IB(J);try{f4=l8(JSON.stringify(m8??{}))}catch{f4="unhashable"}}let K=Z.defaultConfig||Z.config,U=m8||{},z=b6(K,U),{safelist:w,includePreflight:B,minify:j,tokenCSS:_}=z,H=z.config,L=new Z.CSSGenerator(H);for(let A of w)L.generate(A);for(let A of Y)L.generate(A);let O=L.toCSS(B,j),F=H.shortcuts||U.shortcuts||{};for(let[A,R]of Object.entries(F)){if(!Y.has(A)&&!w.includes(A))continue;let N=R.split(/\s+/).filter(Boolean);for(let T of N)L.generate(T)}O=L.toCSS(B,j);let V=O.split(`
12730
+ `);for(let[A,R]of Object.entries(F)){if(!Y.has(A)&&!w.includes(A))continue;let N=R.split(/\s+/).filter(Boolean),T=[],M=[];for(let k of N){let D=k.startsWith("dark:"),b=`.${(D?k.slice(5):k).replace(/\//g,"\\/").replace(/:/g,"\\:").replace(/\./g,"\\.").replace(/\[/g,"\\[").replace(/\]/g,"\\]").replace(/%/g,"\\%")}`;for(let y=0;y<V.length;y++){let P=V[y].trim();if(P===`${b} {`||P.startsWith(`${b} {`)){let x=y,f="";while(x<V.length){if(f+=V[x],V[x].includes("}"))break;x++}let c=f.match(/\{([^}]+)\}/);if(c)if(D)M.push(c[1].trim());else T.push(c[1].trim());break}}}if(T.length)O+=`
12731
+ .${A} { ${T.join(" ")} }`;if(M.length)O+=`
12732
+ @media (prefers-color-scheme: dark) { .dark .${A} { ${M.join(" ")} } }`}return O=_+O,g4(Q,O),NB(Q,O),O}catch(Z){return console.warn("Failed to generate Crosswind CSS:",Z),""}}async function $G(X,$,Z=!1){let Y=await DB(X,$);if(!Y)return X;let J=Z?`<link data-crosswind="generated" rel="stylesheet" href="/_stx/crosswind.${AB(Y)}.css">`:`<style data-crosswind="generated">
12733
12733
  ${Y}
12734
12734
  </style>`,G=/(?:<style\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>[\s\S]*?<\/style>|<link\b[^>]*\bdata-crosswind=(?:"generated"|'generated')[^>]*>)/g;if(G.test(X)){let Q=!1;return X.replace(G,()=>{if(Q)return"";return Q=!0,J})}if(X.includes("</head>"))return X.replace("</head>",`${J}
12735
12735
  </head>`);if(X.includes("<body"))return X.replace(/<body([^>]*)>/,`<body$1>
12736
- ${J}`);return J+X}var O1=null,tJ=!1,m8=null,XG=256,K5,g5,v1=null,f4=null;var ZG=E(()=>{S6();wX();v6();K5=new Map,g5=new Map});function YG(){return`
12736
+ ${J}`);return J+X}var L1=null,tJ=!1,m8=null,XG=256,W5,g5,v1=null,f4=null;var ZG=E(()=>{S6();wX();v6();W5=new Map,g5=new Map});function YG(){return`
12737
12737
  // STX Lifecycle Runtime
12738
12738
  (function() {
12739
12739
  if (typeof window === 'undefined') return;
@@ -13078,7 +13078,7 @@ else {
13078
13078
 
13079
13079
  console.log('[stx] Lifecycle runtime initialized');
13080
13080
  })();
13081
- `}function h4(X){return Symbol(X)}var TM,MM,kM;var JG=E(()=>{TM=h4("theme"),MM=h4("router"),kM=h4("i18n")});import*as QG from"crypto";function GG(X){let $=/\$(\w+)\./g,Z=[],Y;while((Y=$.exec(X))!==null)if(!Z.includes(Y[1]))Z.push(Y[1]);return Z}function EB(){return`stx-${QG.randomBytes(4).toString("hex")}`}function DB(X){return/\$\w+\./.test(X)}function yB(X){let $=[],Z=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,J=X;return J=J.replace(Y,(G,Q,q,K)=>{if(["script","style","template"].includes(Q.toLowerCase()))return G;let U=[],W=!1,z=q,w=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...q.matchAll(w)];for(let H of B){let O=H[0],L=H[1],F=H[2];if(DB(F)){W=!0;let V=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let A=V[1];if(U.push({attr:L,expr:A,fullMatch:O,originalAttr:L}),GG(A).forEach((N)=>Z.add(N)),L==="text")z=z.replace(O,"");else if(L==="class")z=z.replace(O,'class=""');else if(L==="disabled"||L==="hidden")z=z.replace(O,"");else z=z.replace(O,`${L}=""`)}}}if(!W)return G;let j=z.match(/\bid\s*=\s*"([^"]+)"/),_;if(j)_=j[1];else _=EB(),z=` id="${_}"${z}`;for(let H of U)$.push({elementId:_,attribute:H.attr,expression:H.expr,stores:GG(H.expr)});return`<${Q}${z}${K}`}),{html:J,bindings:$,stores:Z}}function bB(X,$){if(X.length===0)return"";let Z=Array.from($),Y=`
13081
+ `}function h4(X){return Symbol(X)}var kM,IM,EM;var JG=E(()=>{kM=h4("theme"),IM=h4("router"),EM=h4("i18n")});import*as QG from"crypto";function GG(X){let $=/\$(\w+)\./g,Z=[],Y;while((Y=$.exec(X))!==null)if(!Z.includes(Y[1]))Z.push(Y[1]);return Z}function yB(){return`stx-${QG.randomBytes(4).toString("hex")}`}function bB(X){return/\$\w+\./.test(X)}function SB(X){let $=[],Z=new Set,Y=/<(\w+)([^>]*?)(\s*\/?>)/g,J=X;return J=J.replace(Y,(G,Q,q,W)=>{if(["script","style","template"].includes(Q.toLowerCase()))return G;let K=[],U=!1,z=q,w=/(\w+(?:-\w+)*)\s*=\s*"([^"]*\{\{[^}]*\$\w+[^}]*\}\}[^"]*)"/g,B=[...q.matchAll(w)];for(let H of B){let L=H[0],O=H[1],F=H[2];if(bB(F)){U=!0;let V=F.match(/\{\{\s*([\s\S]+?)\s*\}\}/);if(V){let A=V[1];if(K.push({attr:O,expr:A,fullMatch:L,originalAttr:O}),GG(A).forEach((N)=>Z.add(N)),O==="text")z=z.replace(L,"");else if(O==="class")z=z.replace(L,'class=""');else if(O==="disabled"||O==="hidden")z=z.replace(L,"");else z=z.replace(L,`${O}=""`)}}}if(!U)return G;let j=z.match(/\bid\s*=\s*"([^"]+)"/),_;if(j)_=j[1];else _=yB(),z=` id="${_}"${z}`;for(let H of K)$.push({elementId:_,attribute:H.attr,expression:H.expr,stores:GG(H.expr)});return`<${Q}${z}${W}`}),{html:J,bindings:$,stores:Z}}function CB(X,$){if(X.length===0)return"";let Z=Array.from($),Y=`
13082
13082
  <script>
13083
13083
  (function() {
13084
13084
  'use strict';
@@ -13098,11 +13098,11 @@ else {
13098
13098
  `;Y+=`
13099
13099
  // Binding update functions
13100
13100
  function updateBindings() {
13101
- `;for(let J of X){let{elementId:G,attribute:Q,expression:q}=J,K=q.replace(/\$(\w+)\./g,"$state.$1.");if(Q==="text")Y+=` (function() {
13101
+ `;for(let J of X){let{elementId:G,attribute:Q,expression:q}=J,W=q.replace(/\$(\w+)\./g,"$state.$1.");if(Q==="text")Y+=` (function() {
13102
13102
  var el = document.getElementById('${G}');
13103
13103
  if (el) {
13104
13104
  try {
13105
- el.textContent = ${K};
13105
+ el.textContent = ${W};
13106
13106
  }
13107
13107
  catch (e) { console.error('Binding error:', e); }
13108
13108
  }
@@ -13111,7 +13111,7 @@ catch (e) { console.error('Binding error:', e); }
13111
13111
  var el = document.getElementById('${G}');
13112
13112
  if (el) {
13113
13113
  try {
13114
- el.innerHTML = ${K};
13114
+ el.innerHTML = ${W};
13115
13115
  }
13116
13116
  catch (e) { console.error('Binding error:', e); }
13117
13117
  }
@@ -13120,7 +13120,7 @@ catch (e) { console.error('Binding error:', e); }
13120
13120
  var el = document.getElementById('${G}');
13121
13121
  if (el) {
13122
13122
  try {
13123
- var value = ${K};
13123
+ var value = ${W};
13124
13124
  if (typeof value === 'string') {
13125
13125
  // Dynamic class string - merge with existing static classes
13126
13126
  // eslint-disable-next-line pickier/no-unused-vars
@@ -13149,7 +13149,7 @@ catch (e) { console.error('Binding error:', e); }
13149
13149
  var el = document.getElementById('${G}');
13150
13150
  if (el) {
13151
13151
  try {
13152
- el.style.display = (${K}) ? '' : 'none';
13152
+ el.style.display = (${W}) ? '' : 'none';
13153
13153
  }
13154
13154
  catch (e) { console.error('Binding error:', e); }
13155
13155
  }
@@ -13158,7 +13158,7 @@ catch (e) { console.error('Binding error:', e); }
13158
13158
  var el = document.getElementById('${G}');
13159
13159
  if (el) {
13160
13160
  try {
13161
- el.style.visibility = (${K}) ? 'visible' : 'hidden';
13161
+ el.style.visibility = (${W}) ? 'visible' : 'hidden';
13162
13162
  }
13163
13163
  catch (e) { console.error('Binding error:', e); }
13164
13164
  }
@@ -13167,7 +13167,7 @@ catch (e) { console.error('Binding error:', e); }
13167
13167
  var el = document.getElementById('${G}');
13168
13168
  if (el) {
13169
13169
  try {
13170
- var value = ${K};
13170
+ var value = ${W};
13171
13171
  if (value === false || value === null || value === undefined) {
13172
13172
  el.removeAttribute('${Q}');
13173
13173
  }
@@ -13236,10 +13236,10 @@ else {
13236
13236
  }
13237
13237
  })();
13238
13238
  </script>
13239
- `,Y}function qG(X){let{html:$,bindings:Z,stores:Y}=yB(X);if(Z.length===0)return X;let J=bB(Z,Y),G=$.lastIndexOf("</body>");if(G!==-1)return $.slice(0,G)+J+$.slice(G);return $+J}var KG=()=>{};function SB(X){let $=X.analytics;if(!$?.enabled)return"";switch($.driver){case"fathom":return CB($);case"google-analytics":return PB($);case"plausible":return vB($);case"self-hosted":return xB($);case"custom":return fB($);default:return""}}function CB(X){let $=X.fathom;if(!$?.siteId)return"";let Z=$.scriptUrl||"https://cdn.usefathom.com/script.js",Y=$.defer!==!1?" defer":"",J=[`data-site="${i0($.siteId)}"`];if($.honorDnt)J.push('data-honor-dnt="true"');if($.spa)J.push('data-spa="auto"');if($.canonical)J.push(`data-canonical="${i0($.canonical)}"`);if($.auto===!1)J.push('data-auto="false"');return`
13239
+ `,Y}function qG(X){let{html:$,bindings:Z,stores:Y}=SB(X);if(Z.length===0)return X;let J=CB(Z,Y),G=$.lastIndexOf("</body>");if(G!==-1)return $.slice(0,G)+J+$.slice(G);return $+J}var WG=()=>{};function PB(X){let $=X.analytics;if(!$?.enabled)return"";switch($.driver){case"fathom":return vB($);case"google-analytics":return xB($);case"plausible":return fB($);case"self-hosted":return gB($);case"custom":return hB($);default:return""}}function vB(X){let $=X.fathom;if(!$?.siteId)return"";let Z=$.scriptUrl||"https://cdn.usefathom.com/script.js",Y=$.defer!==!1?" defer":"",J=[`data-site="${i0($.siteId)}"`];if($.honorDnt)J.push('data-honor-dnt="true"');if($.spa)J.push('data-spa="auto"');if($.canonical)J.push(`data-canonical="${i0($.canonical)}"`);if($.auto===!1)J.push('data-auto="false"');return`
13240
13240
  <!-- Fathom Analytics -->
13241
13241
  <script src="${i0(Z)}" ${J.join(" ")}${Y}></script>
13242
- `}function PB(X){let $=X.googleAnalytics;if(!$?.measurementId)return"";let Z=i0($.measurementId),Y=$.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
13242
+ `}function xB(X){let $=X.googleAnalytics;if(!$?.measurementId)return"";let Z=i0($.measurementId),Y=$.debug?`gtag('config', '${Z}', { 'debug_mode': true });`:"";return`
13243
13243
  <!-- Google Analytics -->
13244
13244
  <script async src="https://www.googletagmanager.com/gtag/js?id=${Z}"></script>
13245
13245
  <script>
@@ -13249,10 +13249,10 @@ else {
13249
13249
  gtag('config', '${Z}');
13250
13250
  ${Y}
13251
13251
  </script>
13252
- `}function vB(X){let $=X.plausible;if(!$?.domain)return"";let Z=$.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${i0($.domain)}"`],J=Z,G=[];if($.trackLocalhost)G.push("local");if($.hashMode)G.push("hash");if(G.length>0&&Z==="https://plausible.io/js/script.js")J=`https://plausible.io/js/script.${G.join(".")}.js`;return`
13252
+ `}function fB(X){let $=X.plausible;if(!$?.domain)return"";let Z=$.scriptUrl||"https://plausible.io/js/script.js",Y=[`data-domain="${i0($.domain)}"`],J=Z,G=[];if($.trackLocalhost)G.push("local");if($.hashMode)G.push("hash");if(G.length>0&&Z==="https://plausible.io/js/script.js")J=`https://plausible.io/js/script.${G.join(".")}.js`;return`
13253
13253
  <!-- Plausible Analytics -->
13254
13254
  <script defer data-domain="${i0($.domain)}" src="${i0(J)}"></script>
13255
- `}function xB(X){let $=X.selfHosted;if(!$?.siteId||!$?.apiEndpoint)return"";let Z=i0($.siteId),Y=i0($.apiEndpoint),J=$.honorDnt?'if(n.doNotTrack==="1")return;':"",G=$.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=$.trackOutboundLinks?`
13255
+ `}function gB(X){let $=X.selfHosted;if(!$?.siteId||!$?.apiEndpoint)return"";let Z=i0($.siteId),Y=i0($.apiEndpoint),J=$.honorDnt?'if(n.doNotTrack==="1")return;':"",G=$.trackHashChanges?"w.addEventListener('hashchange',pv);":"",Q=$.trackOutboundLinks?`
13256
13256
  d.addEventListener('click',function(e){
13257
13257
  var a=e.target.closest('a');
13258
13258
  if(a&&a.hostname!==location.hostname){
@@ -13285,7 +13285,7 @@ else {
13285
13285
  w.stxAnalytics={track:function(n,v){t('event',{name:n,value:v});}};
13286
13286
  })();
13287
13287
  </script>
13288
- `}function fB(X){let $=X.custom;if(!$)return"";if($.inlineScript)return`
13288
+ `}function hB(X){let $=X.custom;if(!$)return"";if($.inlineScript)return`
13289
13289
  <!-- Custom Analytics -->
13290
13290
  <script>
13291
13291
  ${$.inlineScript}
@@ -13293,7 +13293,7 @@ ${$.inlineScript}
13293
13293
  `;if(!$.scriptUrl)return"";let Z=[];if($.scriptId)Z.push(`id="${i0($.scriptId)}"`);if($.attributes)for(let[J,G]of Object.entries($.attributes))Z.push(`${i0(J)}="${i0(G)}"`);return`
13294
13294
  <!-- Custom Analytics -->
13295
13295
  <script${Z.length>0?` ${Z.join(" ")}`:""} src="${i0($.scriptUrl)}" defer></script>
13296
- `}function UG(X,$){let Z=SB($);if(!Z)return X;if(!X.includes("</head>")){let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}return X.replace("</head>",`${Z}</head>`)}function i0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var WG=()=>{};function zG(X){let $=X.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!$)return null;try{return Function(`return ${$[1]}`)()}catch{return null}}function wG(X){let $=X?.layout;if($===!1)return!1;return typeof $==="string"&&$.trim()?$.trim():void 0}function jG(X,$){let Z=X.match(new RegExp(`${$}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let Y=X.match(new RegExp(`${$}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function uB(X){let $=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=Z.exec(X))!==null){let[J,G,Q]=Y,q=Y.index,K=jG(Q,"x-data");if(!K)continue;let U=`__stx_scope_${gB++}`,W=jG(Q,"x-init"),z=dB(X,G,q+J.length),w=X.slice(q,z.endIndex),B=mB(w);$.push({id:U,selector:`[data-stx-scope="${U}"]`,stateExpr:K,initExpr:W,bindings:[],refs:B})}return $}function dB(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s|>)`,"gi"),Q=new RegExp(`</${$}>`,"gi"),q=new RegExp(`<${$}[^>]*/\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J,q.lastIndex=J;let K=G.exec(X),U=Q.exec(X),W=q.exec(X);if(W&&W.index<(K?.index??1/0)){J=W.index+W[0].length;continue}if(!U)return{endIndex:X.length};if(K&&K.index<U.index)Y++,J=K.index+K[0].length;else{if(Y--,Y===0)return{endIndex:U.index+U[0].length};J=U.index+U[0].length}}return{endIndex:X.length}}function mB(X){let $=new Map,Z=X.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[,G,Q]=J,q=lB(G);$.set(Q,q)}return $}function lB(X){let $=X.match(/\bid\s*=\s*["']([^"']*)["']/);if($)return $[1];return`__stx_el_${hB++}`}function cB(){return`
13296
+ `}function KG(X,$){let Z=PB($);if(!Z)return X;if(!X.includes("</head>")){let Y=X.lastIndexOf("</body>");if(Y!==-1)return X.slice(0,Y)+Z+X.slice(Y);return X+Z}return X.replace("</head>",`${Z}</head>`)}function i0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}var UG=()=>{};function zG(X){let $=X.match(/\bdefinePageMeta\s*\(\s*(\{[\s\S]*?\})\s*\)/m);if(!$)return null;try{return Function(`return ${$[1]}`)()}catch{return null}}function wG(X){let $=X?.layout;if($===!1)return!1;return typeof $==="string"&&$.trim()?$.trim():void 0}function jG(X,$){let Z=X.match(new RegExp(`${$}\\s*=\\s*"([^"]*)"`,"i"));if(Z)return Z[1];let Y=X.match(new RegExp(`${$}\\s*=\\s*'([^']*)'`,"i"));if(Y)return Y[1];return null}function mB(X){let $=[],Z=/<([a-z][a-z0-9-]*)\s+([^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,Y;while((Y=Z.exec(X))!==null){let[J,G,Q]=Y,q=Y.index,W=jG(Q,"x-data");if(!W)continue;let K=`__stx_scope_${uB++}`,U=jG(Q,"x-init"),z=lB(X,G,q+J.length),w=X.slice(q,z.endIndex),B=cB(w);$.push({id:K,selector:`[data-stx-scope="${K}"]`,stateExpr:W,initExpr:U,bindings:[],refs:B})}return $}function lB(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s|>)`,"gi"),Q=new RegExp(`</${$}>`,"gi"),q=new RegExp(`<${$}[^>]*/\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J,q.lastIndex=J;let W=G.exec(X),K=Q.exec(X),U=q.exec(X);if(U&&U.index<(W?.index??1/0)){J=U.index+U[0].length;continue}if(!K)return{endIndex:X.length};if(W&&W.index<K.index)Y++,J=W.index+W[0].length;else{if(Y--,Y===0)return{endIndex:K.index+K[0].length};J=K.index+K[0].length}}return{endIndex:X.length}}function cB(X){let $=new Map,Z=X.replace(/x-data\s*=\s*"[^"]*"/gi,'x-data="__stripped__"').replace(/x-data\s*=\s*'[^']*'/gi,"x-data='__stripped__'"),Y=/<[a-z][a-z0-9-]*\s+([^>]*x-ref\s*=\s*["']([^"']*)["'][^>]*)>/gi,J;while((J=Y.exec(Z))!==null){let[,G,Q]=J,q=pB(G);$.set(Q,q)}return $}function pB(X){let $=X.match(/\bid\s*=\s*["']([^"']*)["']/);if($)return $[1];return`__stx_el_${dB++}`}function iB(){return`
13297
13297
  // STX Reactive Runtime - x-cloak and transition CSS
13298
13298
  (function() {
13299
13299
  var style = document.createElement('style');
@@ -13500,25 +13500,25 @@ window.__stx_reactive = (function() {
13500
13500
 
13501
13501
  return { initScope: initScope, reactive: reactive };
13502
13502
  })();
13503
- `}function BG(X,$){let Z=X.replace(/\{!!([\s\S]*?)!!\}/g,(q,K)=>{try{let U=m0(K,$,!0);if(U===void 0)return q;return String(U)}catch{return q}}),Y="",J=0,G=null;while(J<Z.length){let q=Z[J];if(G&&q==="\\"){Y+=q+(Z[J+1]??""),J+=2;continue}if(q==="{"&&Z[J+1]==="{"){let K=Z.indexOf("}}",J+2);if(K!==-1){let U=Z.slice(J,K+2);Y+=Q(Z.slice(J+2,K),U,G),J=K+2;continue}}if(G){if(q===G)G=null}else if(q==="'"||q==='"'||q==="`")G=q;Y+=q,J++}return Y;function Q(q,K,U){let W;try{W=m0(q,$,!0)}catch{return K}if(W===void 0)return K;if(U){let z=String(W).replace(/\\/g,"\\\\").replace(new RegExp(U==="`"?"`":U,"g"),`\\${U}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return U==="`"?z.replace(/\$\{/g,"\\${"):z}if(typeof W==="string"){let z=W.trim();if(z.startsWith("{")&&z.endsWith("}")||z.startsWith("[")&&z.endsWith("]"))try{return JSON.parse(z),z}catch{}}return JSON.stringify(W)}}function pB(X,$){if(X.length===0)return"";let Z=X.map((Y)=>{let J=JSON.stringify(Object.fromEntries(Y.refs)),G=BG(Y.stateExpr,$),Q=Y.initExpr?BG(Y.initExpr,$):null,q=JSON.stringify(G),K=Q?JSON.stringify(Q):"null";return`
13503
+ `}function BG(X,$){let Z=X.replace(/\{!!([\s\S]*?)!!\}/g,(q,W)=>{try{let K=m0(W,$,!0);if(K===void 0)return q;return String(K)}catch{return q}}),Y="",J=0,G=null;while(J<Z.length){let q=Z[J];if(G&&q==="\\"){Y+=q+(Z[J+1]??""),J+=2;continue}if(q==="{"&&Z[J+1]==="{"){let W=Z.indexOf("}}",J+2);if(W!==-1){let K=Z.slice(J,W+2);Y+=Q(Z.slice(J+2,W),K,G),J=W+2;continue}}if(G){if(q===G)G=null}else if(q==="'"||q==='"'||q==="`")G=q;Y+=q,J++}return Y;function Q(q,W,K){let U;try{U=m0(q,$,!0)}catch{return W}if(U===void 0)return W;if(K){let z=String(U).replace(/\\/g,"\\\\").replace(new RegExp(K==="`"?"`":K,"g"),`\\${K}`).replace(/\r/g,"\\r").replace(/\n/g,"\\n");return K==="`"?z.replace(/\$\{/g,"\\${"):z}if(typeof U==="string"){let z=U.trim();if(z.startsWith("{")&&z.endsWith("}")||z.startsWith("[")&&z.endsWith("]"))try{return JSON.parse(z),z}catch{}}return JSON.stringify(U)}}function nB(X,$){if(X.length===0)return"";let Z=X.map((Y)=>{let J=JSON.stringify(Object.fromEntries(Y.refs)),G=BG(Y.stateExpr,$),Q=Y.initExpr?BG(Y.initExpr,$):null,q=JSON.stringify(G),W=Q?JSON.stringify(Q):"null";return`
13504
13504
  (function() {
13505
13505
  var scopeEl = document.querySelector('${Y.selector}');
13506
13506
  if (!scopeEl) return;
13507
13507
  var refs = ${J};
13508
- __stx_reactive.initScope(scopeEl, ${q}, [], refs, ${K});
13508
+ __stx_reactive.initScope(scopeEl, ${q}, [], refs, ${W});
13509
13509
  })();`}).join(`
13510
13510
  `);return`
13511
13511
  <script data-stx-scoped data-stx-reactive data-stx-run="always">
13512
- ${cB()}
13512
+ ${iB()}
13513
13513
  ${Z}
13514
- </script>`}function _G(X,$,Z){if(!nB(X))return X;let Y=uB(X);if(Y.length===0)return X;let J=iB(X,Y),G=pB(Y,$),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
13515
- `+J.slice(Q);else J+=G;return J}function iB(X,$){let Z=0,Y=X.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,G,Q)=>{let q=$[Z++];if(!q)return J;let K=/data-stx-scope="([^"]*)"/.exec(Q);if(K)return q.id=K[1],q.selector=`[data-stx-scope="${q.id}"]`,J;return`<${G} data-stx-scope="${q.id}"${Q}>`});return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),Y=Y.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),Y}function nB(X){return/x-data\s*=\s*["']/.test(X)}var gB=0,hB=0;var HG=E(()=>{Q1()});import rB from"fs";import u4 from"path";import{createHighlighter as oB}from"ts-syntax-highlighter";async function sB(X,$={}){try{if(!await p(X))throw Error(`Markdown file not found: ${X}`);let Y=(await rB.promises.stat(X)).mtime.getTime();if($.cache&&d4.has(X)){let z=d4.get(X);if(z.updatedAt>=Y)return{content:z.content,data:z.data}}let J=await Bun.file(X).text(),{data:G,content:Q}=L2(J),q=$.markdown||N7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},U=F7(Q,{gfm:!0});if(q.syntaxHighlighting?.enabled&&q.syntaxHighlighting?.serverSide)U=await aB(U,q.syntaxHighlighting?.defaultTheme||"github-dark",q.syntaxHighlighting?.highlightUnknownLanguages||!1);let W={content:U,data:G||{}};if($.cache)d4.set(X,{...W,updatedAt:Y});return W}catch(Z){if($.debug)console.error(`Error reading/parsing markdown file ${X}:`,Z);let Y=Z instanceof Error?Z.message:String(Z);return{content:j0("Markdown File",`Error reading/parsing markdown file: ${Y}`,X,"",0,""),data:{}}}}async function aB(X,$,Z){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!c8)try{c8=await oB({theme:$||"github-dark",cache:!0})}catch(q){return console.error("Failed to initialize ts-syntax-highlighter:",q),X}let J=async(q,K,U,W)=>{let z=W.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),w=U||(Z?"text":"");if(!w)return q;try{if(!c8.getSupportedLanguages().includes(w))return q;return(await c8.highlight(z,w,{theme:$})).html}catch(B){console.error(`Error highlighting code block with language ${U}:`,B)}return q},G=X,Q=X.matchAll(Y);for(let q of Q){let[K,U,W,z]=q,w=await J(K,U,W,z);G=G.replace(K,w)}return G}async function OG(X,$,Z="",Y={}){return await tB(X,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,q,K,U)=>{try{let W=q;if(!u4.isAbsolute(q))W=u4.resolve(u4.dirname(Z),q);let z={};if(K)try{try{z=JSON.parse(K)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let L=K.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of L){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(N||T)R=R.substring(1,R.length-1);z[A]=R}}}}catch(O){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",O)}let{content:w,data:B}=await sB(W,Y),j={...$,...B,...z},_=w,H=/\{\{([^}]+)\}\}/g;return _=_.replace(H,(O,L)=>{let F=L.trim();return j[F]!==void 0?String(j[F]):O}),_}catch(W){let z=W instanceof Error?W.message:String(W);return j0("Markdown File",`Error including markdown file: ${z}`,Z,X,U,Q)}})}async function tB(X,$,Z){let Y=[],J;while((J=$.exec(X))!==null){let q=J[0],K=J.index,U=J;Y.push(Z(...U).then((W)=>({match:q,replacement:W,index:K})))}let G=await Promise.all(Y);G.sort((q,K)=>K.index-q.index);let Q=X;for(let{match:q,replacement:K}of G)Q=Q.replace(q,()=>K);return Q}var d4,c8=null;var LG=E(()=>{T1();H0();d4=new Map});function x1(X,$){try{let Z=X.trim();if(G0(Z))return Q0(Z,Object.keys($))(...Object.values($));else return J0(Z,$)}catch{return!1}}var FG=E(()=>{R0()});function eB(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,q=R9(Y,Q);if(!q)break;try{let K;if(G0(q.expression))K=Q0(q.expression,Object.keys($))(...Object.values($));else K=J0(q.expression,$);let U="",W=!1;for(let z of q.cases)if(z.type==="default"){if(!W)U=z.content.trim()}else try{let w;if(z.value&&G0(z.value))w=Q0(z.value,Object.keys($))(...Object.values($));else if(z.value)w=J0(z.value,$);if(K===w){U=z.content.trim(),W=!0;break}}catch{continue}Y=Y.substring(0,Q)+U+Y.substring(q.end),J=!0}catch(K){let U=K instanceof Error?K.message:String(K),W=Y0("Switch",`Error evaluating @switch expression: ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,Q)+W+Y.substring(q.end);break}}return Y}function X_(X){let $=[];return{masked:X.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return $.push(Y),`\x00stx-script-${$.length-1}\x00`}),scripts:$}}function $_(X,$){if($.length===0)return X;return X.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,Y)=>$[Number(Y)]??Z)}function L1(X,$,Z){let{masked:Y,scripts:J}=X_(X);return $_(Z_(Y,$,Z),J)}function Z_(X,$,Z){let Y=X;Y=eB(Y,$,Z);{let G=!0;while(G){G=!1;let Q=Y.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let q=Q.index,K=b1(Y,q+7);if(!K)break;let U=K.endPos,W=X5(Y,"unless","endunless",U);if(W===-1){console.warn(`[stx] @unless directive at position ${q} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=Y.slice(U,W),w=K.expression,B=-1;{let _=0,H=/@(?:if|unless)\s*\(/g,O=/@(?:endif|endunless)(?![a-z])/g,L=/@else(?![a-z])/g,F=[],V;while((V=H.exec(z))!==null)F.push({pos:V.index,type:"open"});while((V=O.exec(z))!==null)F.push({pos:V.index,type:"close"});while((V=L.exec(z))!==null)F.push({pos:V.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")_++;else if(A.type==="close")_--;else if(A.type==="else"&&_===0){B=A.pos;break}}let j;if(B!==-1){let _=z.slice(0,B),H=z.slice(B+5);j=`@if (${w})${H}@else ${_}@endif`}else j=`@if (!(${w}))${z}@endif`;Y=Y.substring(0,q)+j+Y.substring(W+10),G=!0}}Y=l4(Y,$,Z),Y=c4(Y,$,Z),Y=m4(Y,$);let J=()=>{let G=C7(Y);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let q=G[Q];try{let K="",U=!1;for(let W of q.branches){if(U)break;if(W.type==="else")K=W.content,U=!0;else try{let z;if(W.condition&&G0(W.condition))z=Q0(W.condition,Object.keys($))(...Object.values($));else if(W.condition)z=J0(W.condition,$);if(z)K=W.content,U=!0}catch(z){K=Y0(W.type==="if"?"If":"Elseif",`Error in @${W.type}(${W.condition}): ${z instanceof Error?z.message:String(z)}`,s.EVALUATION_ERROR),U=!0}}Y=Y.substring(0,q.start)+K+Y.substring(q.end)}catch(K){let U=K instanceof Error?K.message:String(K),W=Y0("If",`Error processing @if block: ${U}`,s.EVALUATION_ERROR);Y=Y.substring(0,q.start)+W+Y.substring(q.end)}}return!0};while(!0){let G=Y;if(!J())break;if(Y===G)break}return Y}function VG(X){let $=0;while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!=="(")return null;$++;while($<X.length&&/\s/.test(X[$]))$++;let Z=X[$];if(Z!=="'"&&Z!=='"')return null;$++;let Y=[];while($<X.length){let J=X[$];if(J==="\\"&&$+1<X.length){Y.push(X[$+1]),$+=2;continue}if(J===Z){$++;break}Y.push(J),$++}while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!==")")return null;return $++,{value:Y.join(""),consumed:$}}function m4(X,$){let Z=X;function Y(q,K,U,W){let z=1,w=W,B=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${U}(?![a-z])`,"g");while(w<q.length&&z>0){B.lastIndex=w,j.lastIndex=w;let _=B.exec(q),H=j.exec(q),O=_?_.index:1/0,L=H?H.index:1/0;if(O<L)z++,w=O+_[0].length;else if(L<1/0){if(z--,z===0)return L;w=L+H[0].length}else break}return-1}function J(q,K,U){let W=0,z=new RegExp(`@${K}(?:\\s*\\(|\\s|$)`,"g"),w=new RegExp(`@${U}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=z.exec(q))!==null)j.push({pos:_.index,type:"open"});while((_=w.exec(q))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(q))!==null)j.push({pos:_.index,type:"else"});j.sort((H,O)=>H.pos-O.pos);for(let H of j)if(H.type==="open")W++;else if(H.type==="close")W--;else if(H.type==="else"&&W===0)return H.pos;return-1}{let q=!0;while(q){q=!1;let K=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let U=K.index,W,z,w=Z.slice(U+5),B=VG(w);if(B)W=B.value,z=U+5+B.consumed;else z=U+5;let j=Y(Z,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${U} has no matching @endauth \u2014 the block was skipped.`);break}let _=Z.slice(z,j),H=J(_,"auth","endauth"),O;if(!$.auth)O=!1;else O=W?x1(`auth?.check && auth?.user?.[${W}]`,$):x1("auth?.check",$);let L;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);L=O?F:V}else L=O?_:"";Z=Z.substring(0,U)+L+Z.substring(j+8),q=!0}}{let q=!0;while(q){q=!1;let K=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!K||K.index===void 0)break;let U=K.index,W,z,w=Z.slice(U+6),B=VG(w);if(B)W=B.value,z=U+6+B.consumed;else z=U+6;let j=Y(Z,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${U} has no matching @endguest \u2014 the block was skipped.`);break}let _=Z.slice(z,j),H=J(_,"guest","endguest"),O;if(!$.auth)O=!0;else O=W?x1(`!auth?.check || !auth?.user?.[${W}]`,$):x1("!auth?.check",$);let L;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);L=O?F:V}else L=O?_:"";Z=Z.substring(0,U)+L+Z.substring(j+9),q=!0}}function G(q,K,U){if($.userCan&&typeof $.userCan[q]==="boolean")return $.userCan[q];if($.permissions?.check&&typeof $.permissions.check==="function")try{let W=[q];if(K)W.push(K);if(U){let z=x1(U,$);W.push(z)}return $.permissions.check(...W)}catch{return!1}return!1}function Q(q){let K=q.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!K)return null;return{ability:K[1],type:K[2],id:K[3]?.trim(),paramsEnd:K[0].length}}for(let q of["can","cannot"]){let K=`end${q}`,U=q==="can"?"elsecan":"elsecannot",W=!0;while(W){W=!1;let z=Z.match(new RegExp(`@${q}\\s*\\(`));if(!z||z.index===void 0)break;let w=z.index,B=Z.slice(w+`@${q}`.length),j=Q(B);if(!j)break;let _=w+`@${q}`.length+j.paramsEnd,H=Y(Z,q,K,_);if(H===-1){console.warn(`[stx] @${q} directive at position ${w} has no matching @${K} \u2014 the block was skipped.`);break}let O=Z.slice(_,H),L=[],F=0,V=new RegExp(`@${q}\\s*\\(`,"g"),A=new RegExp(`@${K}(?![a-z])`,"g"),R=new RegExp(`@${U}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=V.exec(O))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(O))!==null)T.push({pos:M.index,type:"close"});while((M=R.exec(O))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(O))!==null)T.push({pos:M.index,type:"else"});T.sort((y,P)=>y.pos-P.pos);for(let y of T){if(y.type==="open"){F++;continue}if(y.type==="close"){F--;continue}if(F===0)L.push(y)}let k=[],D=0;for(let y=0;y<L.length;y++){let P=L[y];if(k.push({content:O.slice(D,P.pos),ability:void 0}),P.type==="elseDirective"){let x=O.slice(P.pos+`@${U}`.length),f=Q(x);if(f){k[k.length-1]={content:O.slice(D,P.pos)},D=P.pos+`@${U}`.length+f.paramsEnd,k.push({content:"",ability:f.ability,type:f.type,id:f.id}),k.pop();let c=L[y+1],l=c?c.pos:O.length;k.push({content:O.slice(D,l),ability:f.ability,type:f.type,id:f.id}),D=l}}else D=P.pos+5}if(D<O.length){let y=k[k.length-1];if(L.length>0&&L[L.length-1].type==="else")k.push({content:O.slice(D),isFinalElse:!0});else if(k.length===0)k.push({content:O.slice(D)})}let I=G(j.ability,j.type,j.id),S=q==="can"?I:!I,b="";if(S)b=k[0]?.content||"";else{let y=!1;for(let P=1;P<k.length;P++){let x=k[P];if(x.isFinalElse){b=x.content,y=!0;break}if(x.ability){let f=G(x.ability,x.type,x.id);if(q==="can"?f:!f){b=x.content,y=!0;break}}}if(!y&&k.length>0){let P=k[k.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,w)+b+Z.substring(H+`@${K}`.length),W=!0}}return Z}function l4(X,$,Z){let Y=X;function J(G,Q,q,K,U){let W=!0;while(W){W=!1;let z=new RegExp(`@${Q}\\s*\\(`),w=G.match(z);if(!w||w.index===void 0)break;let B=w.index,j=b1(G,B+`@${Q}`.length);if(!j)break;let _=j.endPos,H=X5(G,Q,q,_);if(H===-1){console.warn(`[stx] @${Q} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let O=G.slice(_,H),L=j.expression,F=-1,V=0,A=0;while(A<O.length){let R=O.indexOf("@",A);if(R===-1)break;let N=O.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(N)){F=R;break}A=R+1}try{let R=K(L.trim()),N;if(F!==-1){let T=O.slice(0,F),M=O.slice(F+5);N=R?T:M}else N=R?O:"";G=G.substring(0,B)+N+G.substring(H+`@${q}`.length),W=!0}catch(R){let N=R instanceof Error?R.message:String(R),T=Y0(U,`Error processing @${Q} directive: ${N}`,s.EVALUATION_ERROR);G=G.substring(0,B)+T+G.substring(H+`@${q}`.length);break}}return G}return Y=J(Y,"isset","endisset",(G)=>{let Q=x1(G,$);return Q!==void 0&&Q!==null},"Isset"),Y=J(Y,"empty","endempty",(G)=>{let Q=x1(G,$);return Q===void 0||Q===null||Q===""||Q===0||Q===!1||Array.isArray(Q)&&Q.length===0||typeof Q==="object"&&Q!==null&&Object.keys(Q).length===0},"Empty"),Y}function c4(X,$,Z){let Y=X,J="development";function G(Q,q,K,U){let W=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`@${K}(?![a-z])`,"g"),w=new RegExp(`^@${q}(?![a-z])`),B=new RegExp(`^@${K}(?![a-z])`),j=Q,_=!0;while(_){_=!1,W.lastIndex=0;let H=W.exec(j);if(!H)break;let O=H.index,L=O+H[0].length;if(q==="env"){let I=j.substring(L).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;L+=I[0].length,U=J===I[2]}let F=1,V=L,A=-1;while(F>0&&V<j.length){W.lastIndex=V,z.lastIndex=V;let I=W.exec(j),S=z.exec(j),b=I?I.index:1/0,y=S?S.index:1/0;if(b<y)F++,V=b+I[0].length;else if(y<1/0){if(F--,F===0){A=y;break}V=y+S[0].length}else break}if(A===-1){console.warn(`[stx] @${q} directive at position ${O} has no matching @${K} \u2014 the block was skipped.`);break}let R=j.substring(L,A),N=-1,T=0,M=0;while(M<R.length){let I=R.indexOf("@",M);if(I===-1)break;let S=R.substring(I);if(w.test(S)){T++,M=I+1;continue}if(B.test(S)){T--,M=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(S)){N=I;break}M=I+1}let k;if(N!==-1){let I=R.slice(0,N),S=R.slice(N+5);k=U?I:S}else k=U?R:"";let D=`@${K}`.length;j=j.substring(0,O)+k+j.substring(A+D),_=!0}return j}return Y=G(Y,"env","endenv",!1),Y=G(Y,"production","endproduction",J==="production"),Y=G(Y,"development","enddevelopment",J==="development"),Y=G(Y,"staging","endstaging",J==="staging"),Y=G(Y,"testing","endtesting",J==="testing"),Y}var m7=E(()=>{FG();H1();hX();R0()});function RG(X=16){let $=new Uint8Array(X);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function p8(X,$){if(!X)return $?.nonceGenerator?.()??RG();let Z=AG.get(X);if(!Z)Z=$?.nonceGenerator?.()??RG(),AG.set(X,Z);return Z}function Y_(X,$){let Z=[];for(let[Y,J]of Object.entries(X)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Z.push(Y);continue}if(Array.isArray(J)){let G=[...J];if($&&(Y==="script-src"||Y==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${$}'`);if(G.length>0)Z.push(`${Y} ${G.join(" ")}`)}}return Z.join("; ")}function NG(X,$){return`<meta http-equiv="Content-Security-Policy" content="${Y_(X,$).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function TG(X,$,Z){if(!$.enabled||!$.addMetaTag)return X;if(X.includes('http-equiv="Content-Security-Policy"'))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let Y=$.useNonce?p8(Z,$):void 0,J=NG($.directives,Y);return X.replace(/<head([^>]*)>/,`<head$1>
13516
- ${J}`)}function MG(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<script nonce="${$}"${J}>`}),Z=Z.replace(/<style([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<style nonce="${$}"${J}>`}),Z}function kG(X,$,Z,Y){let J=X,G=Y.csp;if(J=J.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?p8($,G):void 0;return NG(G.directives,Q)}),J=J.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return p8($,G)}),G?.enabled&&G.useNonce)$.cspNonce=p8($,G);return J}var AG;var IG=E(()=>{AG=new WeakMap});import J_ from"crypto";function Q_(X=G_){let $=J_.randomBytes(Math.ceil(X/2)).toString("hex").slice(0,X);return p4=$,$}function q_(){if(!p4)Q_();return p4}function K_(X=EG){let $=q_();return`<input type="hidden" name="${X}" value="${$}">`}function DG(X){return X.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,Z,Y)=>{return K_(Y||EG)})}var G_=40,EG="_token",p4=null;var yG=()=>{};async function bG(X,$,Z,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return X;let J=X;for(let G of Y.customDirectives){if(!G.name||typeof G.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)J=await U_(J,G,$,Z,Y);else J=await W_(J,G,$,Z,Y)}return J}async function U_(X,$,Z,Y,J){let{name:G,handler:Q}=$,q=`@${G}`,K=`@end${G}`,U=X,W=D5(`${q}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${K}`,"g"),z=[],w=W.exec(U);while(w!==null){let[B,j="",_=""]=w,H=w.index||0;try{let O=j?SG(j):[],L=_.trim(),F=await Q(L,O,Z,Y);z.push({original:B,processed:F,startIndex:H})}catch(O){let L=O instanceof Error?O.message:String(O);if(J.debug)console.error(`Error processing custom directive @${G}:`,O);z.push({original:B,processed:Y0("CustomDirective",`Error in @${G}${j?`(${j})`:""}: ${L}`,s.EVALUATION_ERROR),startIndex:H})}w=W.exec(U)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:_}=z[B];U=U.replace(j,_)}return U}async function W_(X,$,Z,Y,J){let{name:G,handler:Q}=$,q=X,K=D5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),U=[],W=K.exec(q);while(W!==null){let[B,j=""]=W,_=W.index||0;try{let H=SG(j),O=await Q("",H,Z,Y);U.push({original:B,processed:O,startIndex:_})}catch(H){let O=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${G}:`,H);U.push({original:B,processed:Y0("CustomDirective",`Error in @${G}(${j}): ${O}`,s.EVALUATION_ERROR),startIndex:_})}W=K.exec(q)}let z=D5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),w=z.exec(q);while(w!==null){let[B]=w,j=w.index||0;try{let _=await Q("",[],Z,Y);U.push({original:B,processed:_,startIndex:j})}catch(_){let H=_ instanceof Error?_.message:String(_);if(J.debug)console.error(`Error processing custom directive @${G}:`,_);U.push({original:B,processed:Y0("CustomDirective",`Error in @${G}: ${H}`,s.EVALUATION_ERROR),startIndex:j})}w=z.exec(q)}for(let B=U.length-1;B>=0;B--){let{original:j,processed:_}=U[B];q=q.replace(j,_)}return q}function SG(X){if(!X.trim())return[];let $=[],Z="",Y=!1,J="";for(let G=0;G<X.length;G++){let Q=X[G];if((Q==='"'||Q==="'")&&(G===0||X[G-1]!=="\\"))if(!Y)Y=!0,J=Q;else if(Q===J)Y=!1;else Z+=Q;else if(Q===","&&!Y)$.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())$.push(Z.trim());return $.map((G)=>{let Q=G.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var CG=E(()=>{H1();y5()});function U5(X,$){if(typeof X!=="string"||X.length===0)throw Error(`@appearanceBootstrap ${$} must be a non-empty string`)}function w_(X){if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap expects an options object");let $=X,Z=$.appearance,Y=$.colorMode;if(U5($.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(U5(Z.key,"appearance.key"),U5(Z.attribute,"appearance.attribute"),U5(Z.default,"appearance.default"),U5(Y.key,"colorMode.key"),U5(Y.attribute,"colorMode.attribute"),U5(Y.default,"colorMode.default"),!vG.test(Z.key)||!vG.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!PG.test(Z.attribute)||!PG.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Z.allowed.includes(Z.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!z_.has(Y.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:$.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:Y.key,attribute:Y.attribute,default:Y.default}}}function j_(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function B_(X){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${j_(X)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function __(X,$){let Z=1,Y=null,J=!1;for(let G=$+1;G<X.length;G++){let Q=X[G];if(J){J=!1;continue}if(Y){if(Q==="\\")J=!0;else if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function xG(X,$){let Z=X,Y=/@appearanceBootstrap\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,Q=__(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let q=Z.slice(G+1,Q).trim(),K=J0(`(${q})`,$),U=B_(w_(K));Z=Z.slice(0,J.index)+U+Z.slice(Q+1),Y.lastIndex=J.index+U.length}return Z}var PG,vG,z_;var fG=E(()=>{R0();PG=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,vG=/^[A-Za-z_$][\w$]*$/,z_=new Set(["light","dark","system"])});import H_ from"crypto";function O0(X){return String(X??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function i8(X,$,Z,Y){let J=X||$;return Z?`${J} ${Y}`:J}function o0(X){return String(X).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function h5(X,$){if(/\bid\s*=/i.test(X))return"";return` id="${O0($)}"`}function i4(X,$,Z){if(!$)return"";let Y="";if(!/\baria-invalid\s*=/i.test(Z))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))Y+=` aria-describedby="${O0(`${o0(X)}-error`)}"`;return Y}function O_(){return H_.randomUUID()}function n8(X,$){let Z=X;return Z=Z.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let Y=O_();$.csrf={token:Y}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${O0($.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,J)=>{let G=J.toUpperCase();if(J&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${O0(G)}">`;return Y}),Z}function uG(X,$,Z=hG){let Y=X;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,G,Q,q,K,U="")=>{let W=G||Q||"POST",z=q||K||"",w=f1(U),B=W.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${O0(j)}" action="${O0(z)}"${w?` ${w}`:""}>`;if(_+=`
13514
+ </script>`}function _G(X,$,Z){if(!oB(X))return X;let Y=mB(X);if(Y.length===0)return X;let J=rB(X,Y),G=nB(Y,$),Q=J.lastIndexOf("</body>");if(Q!==-1)J=J.slice(0,Q)+G+`
13515
+ `+J.slice(Q);else J+=G;return J}function rB(X,$){let Z=0,Y=X.replace(/<([a-z][a-z0-9-]*)(\s+[^>]*x-data\s*=\s*(?:"[^"]*"|'[^']*')[^>]*)>/gi,(J,G,Q)=>{let q=$[Z++];if(!q)return J;let W=/data-stx-scope="([^"]*)"/.exec(Q);if(W)return q.id=W[1],q.selector=`[data-stx-scope="${q.id}"]`,J;return`<${G} data-stx-scope="${q.id}"${Q}>`});return Y=Y.replace(/\s*x-data\s*=\s*"([^"]*)"/g,' data-stx-xdata="$1"'),Y=Y.replace(/\s*x-data\s*=\s*'([^']*)'/g," data-stx-xdata='$1'"),Y=Y.replace(/\s*x-init\s*=\s*"([^"]*)"/g,' data-stx-xinit="$1"'),Y=Y.replace(/\s*x-init\s*=\s*'([^']*)'/g," data-stx-xinit='$1'"),Y}function oB(X){return/x-data\s*=\s*["']/.test(X)}var uB=0,dB=0;var HG=E(()=>{Q1()});import sB from"fs";import u4 from"path";import{createHighlighter as aB}from"ts-syntax-highlighter";async function tB(X,$={}){try{if(!await t(X))throw Error(`Markdown file not found: ${X}`);let Y=(await sB.promises.stat(X)).mtime.getTime();if($.cache&&d4.has(X)){let z=d4.get(X);if(z.updatedAt>=Y)return{content:z.content,data:z.data}}let J=await Bun.file(X).text(),{data:G,content:Q}=O2(J),q=$.markdown||N7.markdown||{enabled:!0,syntaxHighlighting:{enabled:!0,serverSide:!0,defaultTheme:"github-dark",highlightUnknownLanguages:!0}},K=F7(Q,{gfm:!0});if(q.syntaxHighlighting?.enabled&&q.syntaxHighlighting?.serverSide)K=await eB(K,q.syntaxHighlighting?.defaultTheme||"github-dark",q.syntaxHighlighting?.highlightUnknownLanguages||!1);let U={content:K,data:G||{}};if($.cache)d4.set(X,{...U,updatedAt:Y});return U}catch(Z){if($.debug)console.error(`Error reading/parsing markdown file ${X}:`,Z);let Y=Z instanceof Error?Z.message:String(Z);return{content:j0("Markdown File",`Error reading/parsing markdown file: ${Y}`,X,"",0,""),data:{}}}}async function eB(X,$,Z){let Y=/<pre><code( class="language-([^"]+)")?>([^<]+)<\/code><\/pre>/g;if(!c8)try{c8=await aB({theme:$||"github-dark",cache:!0})}catch(q){return console.error("Failed to initialize ts-syntax-highlighter:",q),X}let J=async(q,W,K,U)=>{let z=U.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&").replace(/&quot;/g,'"').replace(/&#39;/g,"'"),w=K||(Z?"text":"");if(!w)return q;try{if(!c8.getSupportedLanguages().includes(w))return q;return(await c8.highlight(z,w,{theme:$})).html}catch(B){console.error(`Error highlighting code block with language ${K}:`,B)}return q},G=X,Q=X.matchAll(Y);for(let q of Q){let[W,K,U,z]=q,w=await J(W,K,U,z);G=G.replace(W,w)}return G}async function LG(X,$,Z="",Y={}){return await X_(X,/@markdown-file\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\}))?\)/g,async(Q,q,W,K)=>{try{let U=q;if(!u4.isAbsolute(q))U=u4.resolve(u4.dirname(Z),q);let z={};if(W)try{try{z=JSON.parse(W)}catch{if(Y.debug)console.warn("Using safer alternative for parsing JS object literal");let O=W.replace(/^\s*\{|\}\s*$/g,"").trim().split(/,(?=\s*\w+\s*:)/);for(let F of O){let V=F.indexOf(":");if(V>0){let A=F.substring(0,V).trim(),R=F.substring(V+1).trim(),N=R.startsWith('"')&&R.endsWith('"'),T=R.startsWith("'")&&R.endsWith("'");if(N||T)R=R.substring(1,R.length-1);z[A]=R}}}}catch(L){if(Y.debug)console.error("Error parsing context in @markdown-file directive:",L)}let{content:w,data:B}=await tB(U,Y),j={...$,...B,...z},_=w,H=/\{\{([^}]+)\}\}/g;return _=_.replace(H,(L,O)=>{let F=O.trim();return j[F]!==void 0?String(j[F]):L}),_}catch(U){let z=U instanceof Error?U.message:String(U);return j0("Markdown File",`Error including markdown file: ${z}`,Z,X,K,Q)}})}async function X_(X,$,Z){let Y=[],J;while((J=$.exec(X))!==null){let q=J[0],W=J.index,K=J;Y.push(Z(...K).then((U)=>({match:q,replacement:U,index:W})))}let G=await Promise.all(Y);G.sort((q,W)=>W.index-q.index);let Q=X;for(let{match:q,replacement:W}of G)Q=Q.replace(q,()=>W);return Q}var d4,c8=null;var OG=E(()=>{T1();H0();d4=new Map});function x1(X,$){try{let Z=X.trim();if(G0(Z))return Q0(Z,Object.keys($))(...Object.values($));else return J0(Z,$)}catch{return!1}}var FG=E(()=>{R0()});function $_(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@switch\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,q=R9(Y,Q);if(!q)break;try{let W;if(G0(q.expression))W=Q0(q.expression,Object.keys($))(...Object.values($));else W=J0(q.expression,$);let K="",U=!1;for(let z of q.cases)if(z.type==="default"){if(!U)K=z.content.trim()}else try{let w;if(z.value&&G0(z.value))w=Q0(z.value,Object.keys($))(...Object.values($));else if(z.value)w=J0(z.value,$);if(W===w){K=z.content.trim(),U=!0;break}}catch{continue}Y=Y.substring(0,Q)+K+Y.substring(q.end),J=!0}catch(W){let K=W instanceof Error?W.message:String(W),U=Y0("Switch",`Error evaluating @switch expression: ${K}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+U+Y.substring(q.end);break}}return Y}function Z_(X){let $=[];return{masked:X.replace(/<script\b[\s\S]*?<\/script\s*>/gi,(Y)=>{return $.push(Y),`\x00stx-script-${$.length-1}\x00`}),scripts:$}}function Y_(X,$){if($.length===0)return X;return X.replace(/\u0000stx-script-(\d+)\u0000/g,(Z,Y)=>$[Number(Y)]??Z)}function O1(X,$,Z){let{masked:Y,scripts:J}=Z_(X);return Y_(J_(Y,$,Z),J)}function J_(X,$,Z){let Y=X;Y=$_(Y,$,Z);{let G=!0;while(G){G=!1;let Q=Y.match(/@unless\s*\(/);if(!Q||Q.index===void 0)break;let q=Q.index,W=b1(Y,q+7);if(!W)break;let K=W.endPos,U=X5(Y,"unless","endunless",K);if(U===-1){console.warn(`[stx] @unless directive at position ${q} has no matching @endunless \u2014 the block was skipped. Check for typos or missing closers.`);break}let z=Y.slice(K,U),w=W.expression,B=-1;{let _=0,H=/@(?:if|unless)\s*\(/g,L=/@(?:endif|endunless)(?![a-z])/g,O=/@else(?![a-z])/g,F=[],V;while((V=H.exec(z))!==null)F.push({pos:V.index,type:"open"});while((V=L.exec(z))!==null)F.push({pos:V.index,type:"close"});while((V=O.exec(z))!==null)F.push({pos:V.index,type:"else"});F.sort((A,R)=>A.pos-R.pos);for(let A of F)if(A.type==="open")_++;else if(A.type==="close")_--;else if(A.type==="else"&&_===0){B=A.pos;break}}let j;if(B!==-1){let _=z.slice(0,B),H=z.slice(B+5);j=`@if (${w})${H}@else ${_}@endif`}else j=`@if (!(${w}))${z}@endif`;Y=Y.substring(0,q)+j+Y.substring(U+10),G=!0}}Y=l4(Y,$,Z),Y=c4(Y,$,Z),Y=m4(Y,$);let J=()=>{let G=C7(Y);if(G.length===0)return!1;for(let Q=G.length-1;Q>=0;Q--){let q=G[Q];try{let W="",K=!1;for(let U of q.branches){if(K)break;if(U.type==="else")W=U.content,K=!0;else try{let z;if(U.condition&&G0(U.condition))z=Q0(U.condition,Object.keys($))(...Object.values($));else if(U.condition)z=J0(U.condition,$);if(z)W=U.content,K=!0}catch(z){W=Y0(U.type==="if"?"If":"Elseif",`Error in @${U.type}(${U.condition}): ${z instanceof Error?z.message:String(z)}`,o.EVALUATION_ERROR),K=!0}}Y=Y.substring(0,q.start)+W+Y.substring(q.end)}catch(W){let K=W instanceof Error?W.message:String(W),U=Y0("If",`Error processing @if block: ${K}`,o.EVALUATION_ERROR);Y=Y.substring(0,q.start)+U+Y.substring(q.end)}}return!0};while(!0){let G=Y;if(!J())break;if(Y===G)break}return Y}function VG(X){let $=0;while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!=="(")return null;$++;while($<X.length&&/\s/.test(X[$]))$++;let Z=X[$];if(Z!=="'"&&Z!=='"')return null;$++;let Y=[];while($<X.length){let J=X[$];if(J==="\\"&&$+1<X.length){Y.push(X[$+1]),$+=2;continue}if(J===Z){$++;break}Y.push(J),$++}while($<X.length&&/\s/.test(X[$]))$++;if(X[$]!==")")return null;return $++,{value:Y.join(""),consumed:$}}function m4(X,$){let Z=X;function Y(q,W,K,U){let z=1,w=U,B=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),j=new RegExp(`@${K}(?![a-z])`,"g");while(w<q.length&&z>0){B.lastIndex=w,j.lastIndex=w;let _=B.exec(q),H=j.exec(q),L=_?_.index:1/0,O=H?H.index:1/0;if(L<O)z++,w=L+_[0].length;else if(O<1/0){if(z--,z===0)return O;w=O+H[0].length}else break}return-1}function J(q,W,K){let U=0,z=new RegExp(`@${W}(?:\\s*\\(|\\s|$)`,"g"),w=new RegExp(`@${K}(?![a-z])`,"g"),B=/@else(?![a-z])/g,j=[],_;while((_=z.exec(q))!==null)j.push({pos:_.index,type:"open"});while((_=w.exec(q))!==null)j.push({pos:_.index,type:"close"});while((_=B.exec(q))!==null)j.push({pos:_.index,type:"else"});j.sort((H,L)=>H.pos-L.pos);for(let H of j)if(H.type==="open")U++;else if(H.type==="close")U--;else if(H.type==="else"&&U===0)return H.pos;return-1}{let q=!0;while(q){q=!1;let W=Z.match(/@auth(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let K=W.index,U,z,w=Z.slice(K+5),B=VG(w);if(B)U=B.value,z=K+5+B.consumed;else z=K+5;let j=Y(Z,"auth","endauth",z);if(j===-1){console.warn(`[stx] @auth directive at position ${K} has no matching @endauth \u2014 the block was skipped.`);break}let _=Z.slice(z,j),H=J(_,"auth","endauth"),L;if(!$.auth)L=!1;else L=U?x1(`auth?.check && auth?.user?.[${U}]`,$):x1("auth?.check",$);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,K)+O+Z.substring(j+8),q=!0}}{let q=!0;while(q){q=!1;let W=Z.match(/@guest(?:\s*\(|\s|(?=\n))/);if(!W||W.index===void 0)break;let K=W.index,U,z,w=Z.slice(K+6),B=VG(w);if(B)U=B.value,z=K+6+B.consumed;else z=K+6;let j=Y(Z,"guest","endguest",z);if(j===-1){console.warn(`[stx] @guest directive at position ${K} has no matching @endguest \u2014 the block was skipped.`);break}let _=Z.slice(z,j),H=J(_,"guest","endguest"),L;if(!$.auth)L=!0;else L=U?x1(`!auth?.check || !auth?.user?.[${U}]`,$):x1("!auth?.check",$);let O;if(H!==-1){let F=_.slice(0,H),V=_.slice(H+5);O=L?F:V}else O=L?_:"";Z=Z.substring(0,K)+O+Z.substring(j+9),q=!0}}function G(q,W,K){if($.userCan&&typeof $.userCan[q]==="boolean")return $.userCan[q];if($.permissions?.check&&typeof $.permissions.check==="function")try{let U=[q];if(W)U.push(W);if(K){let z=x1(K,$);U.push(z)}return $.permissions.check(...U)}catch{return!1}return!1}function Q(q){let W=q.match(/^\s*\(\s*'([^']*)'(?:,\s*'([^']*)')?(?:,\s*([^)]*))?\)/);if(!W)return null;return{ability:W[1],type:W[2],id:W[3]?.trim(),paramsEnd:W[0].length}}for(let q of["can","cannot"]){let W=`end${q}`,K=q==="can"?"elsecan":"elsecannot",U=!0;while(U){U=!1;let z=Z.match(new RegExp(`@${q}\\s*\\(`));if(!z||z.index===void 0)break;let w=z.index,B=Z.slice(w+`@${q}`.length),j=Q(B);if(!j)break;let _=w+`@${q}`.length+j.paramsEnd,H=Y(Z,q,W,_);if(H===-1){console.warn(`[stx] @${q} directive at position ${w} has no matching @${W} \u2014 the block was skipped.`);break}let L=Z.slice(_,H),O=[],F=0,V=new RegExp(`@${q}\\s*\\(`,"g"),A=new RegExp(`@${W}(?![a-z])`,"g"),R=new RegExp(`@${K}\\s*\\(`,"g"),N=/@else(?![a-z])/g,T=[],M;while((M=V.exec(L))!==null)T.push({pos:M.index,type:"open"});while((M=A.exec(L))!==null)T.push({pos:M.index,type:"close"});while((M=R.exec(L))!==null)T.push({pos:M.index,type:"elseDirective"});while((M=N.exec(L))!==null)T.push({pos:M.index,type:"else"});T.sort((y,P)=>y.pos-P.pos);for(let y of T){if(y.type==="open"){F++;continue}if(y.type==="close"){F--;continue}if(F===0)O.push(y)}let k=[],D=0;for(let y=0;y<O.length;y++){let P=O[y];if(k.push({content:L.slice(D,P.pos),ability:void 0}),P.type==="elseDirective"){let x=L.slice(P.pos+`@${K}`.length),f=Q(x);if(f){k[k.length-1]={content:L.slice(D,P.pos)},D=P.pos+`@${K}`.length+f.paramsEnd,k.push({content:"",ability:f.ability,type:f.type,id:f.id}),k.pop();let c=O[y+1],l=c?c.pos:L.length;k.push({content:L.slice(D,l),ability:f.ability,type:f.type,id:f.id}),D=l}}else D=P.pos+5}if(D<L.length){let y=k[k.length-1];if(O.length>0&&O[O.length-1].type==="else")k.push({content:L.slice(D),isFinalElse:!0});else if(k.length===0)k.push({content:L.slice(D)})}let I=G(j.ability,j.type,j.id),S=q==="can"?I:!I,b="";if(S)b=k[0]?.content||"";else{let y=!1;for(let P=1;P<k.length;P++){let x=k[P];if(x.isFinalElse){b=x.content,y=!0;break}if(x.ability){let f=G(x.ability,x.type,x.id);if(q==="can"?f:!f){b=x.content,y=!0;break}}}if(!y&&k.length>0){let P=k[k.length-1];if(P.isFinalElse)b=P.content}}Z=Z.substring(0,w)+b+Z.substring(H+`@${W}`.length),U=!0}}return Z}function l4(X,$,Z){let Y=X;function J(G,Q,q,W,K){let U=!0;while(U){U=!1;let z=new RegExp(`@${Q}\\s*\\(`),w=G.match(z);if(!w||w.index===void 0)break;let B=w.index,j=b1(G,B+`@${Q}`.length);if(!j)break;let _=j.endPos,H=X5(G,Q,q,_);if(H===-1){console.warn(`[stx] @${Q} directive at position ${B} has no matching @${q} \u2014 the block was skipped.`);break}let L=G.slice(_,H),O=j.expression,F=-1,V=0,A=0;while(A<L.length){let R=L.indexOf("@",A);if(R===-1)break;let N=L.substring(R);if(/^@(?:if|unless|isset|empty)\s*\(/.test(N)){V++,A=R+1;continue}if(/^@(?:endif|endunless|endisset|endempty)(?![a-z])/.test(N)){V--,A=R+1;continue}if(V===0&&/^@else(?![a-z])/.test(N)){F=R;break}A=R+1}try{let R=W(O.trim()),N;if(F!==-1){let T=L.slice(0,F),M=L.slice(F+5);N=R?T:M}else N=R?L:"";G=G.substring(0,B)+N+G.substring(H+`@${q}`.length),U=!0}catch(R){let N=R instanceof Error?R.message:String(R),T=Y0(K,`Error processing @${Q} directive: ${N}`,o.EVALUATION_ERROR);G=G.substring(0,B)+T+G.substring(H+`@${q}`.length);break}}return G}return Y=J(Y,"isset","endisset",(G)=>{let Q=x1(G,$);return Q!==void 0&&Q!==null},"Isset"),Y=J(Y,"empty","endempty",(G)=>{let Q=x1(G,$);return Q===void 0||Q===null||Q===""||Q===0||Q===!1||Array.isArray(Q)&&Q.length===0||typeof Q==="object"&&Q!==null&&Object.keys(Q).length===0},"Empty"),Y}function c4(X,$,Z){let Y=X,J="development";function G(Q,q,W,K){let U=new RegExp(`@${q}(?![a-z])`,"g"),z=new RegExp(`@${W}(?![a-z])`,"g"),w=new RegExp(`^@${q}(?![a-z])`),B=new RegExp(`^@${W}(?![a-z])`),j=Q,_=!0;while(_){_=!1,U.lastIndex=0;let H=U.exec(j);if(!H)break;let L=H.index,O=L+H[0].length;if(q==="env"){let I=j.substring(O).match(/^\s*\(\s*(['"])([^'"]+)\1\s*\)/);if(!I)break;O+=I[0].length,K=J===I[2]}let F=1,V=O,A=-1;while(F>0&&V<j.length){U.lastIndex=V,z.lastIndex=V;let I=U.exec(j),S=z.exec(j),b=I?I.index:1/0,y=S?S.index:1/0;if(b<y)F++,V=b+I[0].length;else if(y<1/0){if(F--,F===0){A=y;break}V=y+S[0].length}else break}if(A===-1){console.warn(`[stx] @${q} directive at position ${L} has no matching @${W} \u2014 the block was skipped.`);break}let R=j.substring(O,A),N=-1,T=0,M=0;while(M<R.length){let I=R.indexOf("@",M);if(I===-1)break;let S=R.substring(I);if(w.test(S)){T++,M=I+1;continue}if(B.test(S)){T--,M=I+1;continue}if(T===0&&/^@else(?![a-z])/.test(S)){N=I;break}M=I+1}let k;if(N!==-1){let I=R.slice(0,N),S=R.slice(N+5);k=K?I:S}else k=K?R:"";let D=`@${W}`.length;j=j.substring(0,L)+k+j.substring(A+D),_=!0}return j}return Y=G(Y,"env","endenv",!1),Y=G(Y,"production","endproduction",J==="production"),Y=G(Y,"development","enddevelopment",J==="development"),Y=G(Y,"staging","endstaging",J==="staging"),Y=G(Y,"testing","endtesting",J==="testing"),Y}var m7=E(()=>{FG();H1();hX();R0()});function RG(X=16){let $=new Uint8Array(X);return crypto.getRandomValues($),btoa(String.fromCharCode(...$))}function p8(X,$){if(!X)return $?.nonceGenerator?.()??RG();let Z=AG.get(X);if(!Z)Z=$?.nonceGenerator?.()??RG(),AG.set(X,Z);return Z}function G_(X,$){let Z=[];for(let[Y,J]of Object.entries(X)){if(J===void 0||J===null)continue;if(typeof J==="boolean"){if(J)Z.push(Y);continue}if(Array.isArray(J)){let G=[...J];if($&&(Y==="script-src"||Y==="style-src"))G=G.filter((Q)=>!Q.startsWith("'nonce-")),G.push(`'nonce-${$}'`);if(G.length>0)Z.push(`${Y} ${G.join(" ")}`)}}return Z.join("; ")}function NG(X,$){return`<meta http-equiv="Content-Security-Policy" content="${G_(X,$).replace(/&/g,"&amp;").replace(/"/g,"&quot;")}">`}function TG(X,$,Z){if(!$.enabled||!$.addMetaTag)return X;if(X.includes('http-equiv="Content-Security-Policy"'))return X;if(!X.includes("<head>")&&!X.includes("<head "))return X;let Y=$.useNonce?p8(Z,$):void 0,J=NG($.directives,Y);return X.replace(/<head([^>]*)>/,`<head$1>
13516
+ ${J}`)}function MG(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<script nonce="${$}"${J}>`}),Z=Z.replace(/<style([^>]*)>/gi,(Y,J)=>{if(J.includes("nonce="))return Y;return`<style nonce="${$}"${J}>`}),Z}function kG(X,$,Z,Y){let J=X,G=Y.csp;if(J=J.replace(/@csp\b/g,()=>{if(!G?.enabled||!G.directives)return"<!-- CSP not configured -->";let Q=G.useNonce?p8($,G):void 0;return NG(G.directives,Q)}),J=J.replace(/@cspNonce\b/g,()=>{if(!G?.enabled||!G.useNonce)return"";return p8($,G)}),G?.enabled&&G.useNonce)$.cspNonce=p8($,G);return J}var AG;var IG=E(()=>{AG=new WeakMap});import Q_ from"crypto";function W_(X=q_){let $=Q_.randomBytes(Math.ceil(X/2)).toString("hex").slice(0,X);return p4=$,$}function K_(){if(!p4)W_();return p4}function U_(X=EG){let $=K_();return`<input type="hidden" name="${X}" value="${$}">`}function DG(X){return X.replace(/@csrf(?:\((['"])([^'"]*)\1\))?/g,($,Z,Y)=>{return U_(Y||EG)})}var q_=40,EG="_token",p4=null;var yG=()=>{};async function bG(X,$,Z,Y){if(!Y.customDirectives||Y.customDirectives.length===0)return X;let J=X;for(let G of Y.customDirectives){if(!G.name||typeof G.handler!=="function"){if(Y.debug)console.warn("Invalid custom directive:",G);continue}if(G.hasEndTag)J=await z_(J,G,$,Z,Y);else J=await w_(J,G,$,Z,Y)}return J}async function z_(X,$,Z,Y,J){let{name:G,handler:Q}=$,q=`@${G}`,W=`@end${G}`,K=X,U=D5(`${q}(?:\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\))?([\\s\\S]*?)${W}`,"g"),z=[],w=U.exec(K);while(w!==null){let[B,j="",_=""]=w,H=w.index||0;try{let L=j?SG(j):[],O=_.trim(),F=await Q(O,L,Z,Y);z.push({original:B,processed:F,startIndex:H})}catch(L){let O=L instanceof Error?L.message:String(L);if(J.debug)console.error(`Error processing custom directive @${G}:`,L);z.push({original:B,processed:Y0("CustomDirective",`Error in @${G}${j?`(${j})`:""}: ${O}`,o.EVALUATION_ERROR),startIndex:H})}w=U.exec(K)}for(let B=z.length-1;B>=0;B--){let{original:j,processed:_}=z[B];K=K.replace(j,_)}return K}async function w_(X,$,Z,Y,J){let{name:G,handler:Q}=$,q=X,W=D5(`@${G}\\s*\\(([^()]*(?:\\([^)]*\\)[^()]*)*)\\)`,"g"),K=[],U=W.exec(q);while(U!==null){let[B,j=""]=U,_=U.index||0;try{let H=SG(j),L=await Q("",H,Z,Y);K.push({original:B,processed:L,startIndex:_})}catch(H){let L=H instanceof Error?H.message:String(H);if(J.debug)console.error(`Error processing custom directive @${G}:`,H);K.push({original:B,processed:Y0("CustomDirective",`Error in @${G}(${j}): ${L}`,o.EVALUATION_ERROR),startIndex:_})}U=W.exec(q)}let z=D5(`@${G}(?!\\w)(?!\\s*\\()`,"g"),w=z.exec(q);while(w!==null){let[B]=w,j=w.index||0;try{let _=await Q("",[],Z,Y);K.push({original:B,processed:_,startIndex:j})}catch(_){let H=_ instanceof Error?_.message:String(_);if(J.debug)console.error(`Error processing custom directive @${G}:`,_);K.push({original:B,processed:Y0("CustomDirective",`Error in @${G}: ${H}`,o.EVALUATION_ERROR),startIndex:j})}w=z.exec(q)}for(let B=K.length-1;B>=0;B--){let{original:j,processed:_}=K[B];q=q.replace(j,_)}return q}function SG(X){if(!X.trim())return[];let $=[],Z="",Y=!1,J="";for(let G=0;G<X.length;G++){let Q=X[G];if((Q==='"'||Q==="'")&&(G===0||X[G-1]!=="\\"))if(!Y)Y=!0,J=Q;else if(Q===J)Y=!1;else Z+=Q;else if(Q===","&&!Y)$.push(Z.trim()),Z="";else Z+=Q}if(Z.trim())$.push(Z.trim());return $.map((G)=>{let Q=G.trim();if(Q.startsWith('"')&&Q.endsWith('"')||Q.startsWith("'")&&Q.endsWith("'"))return Q.substring(1,Q.length-1);return Q})}var CG=E(()=>{H1();y5()});function K5(X,$){if(typeof X!=="string"||X.length===0)throw Error(`@appearanceBootstrap ${$} must be a non-empty string`)}function B_(X){if(!X||typeof X!=="object"||Array.isArray(X))throw Error("@appearanceBootstrap expects an options object");let $=X,Z=$.appearance,Y=$.colorMode;if(K5($.storageKey,"storageKey"),!Z||typeof Z!=="object"||Array.isArray(Z))throw Error("@appearanceBootstrap appearance must be an object");if(!Y||typeof Y!=="object"||Array.isArray(Y))throw Error("@appearanceBootstrap colorMode must be an object");if(K5(Z.key,"appearance.key"),K5(Z.attribute,"appearance.attribute"),K5(Z.default,"appearance.default"),K5(Y.key,"colorMode.key"),K5(Y.attribute,"colorMode.attribute"),K5(Y.default,"colorMode.default"),!vG.test(Z.key)||!vG.test(Y.key))throw Error("@appearanceBootstrap preference keys must be JavaScript property names");if(!PG.test(Z.attribute)||!PG.test(Y.attribute))throw Error("@appearanceBootstrap attributes must be lowercase data attribute names");if(!Array.isArray(Z.allowed)||Z.allowed.length===0||Z.allowed.some((J)=>typeof J!=="string"||J.length===0))throw Error("@appearanceBootstrap appearance.allowed must contain one or more strings");if(!Z.allowed.includes(Z.default))throw Error("@appearanceBootstrap appearance.default must be in appearance.allowed");if(!j_.has(Y.default))throw Error("@appearanceBootstrap colorMode.default must be light, dark, or system");return{storageKey:$.storageKey,appearance:{key:Z.key,attribute:Z.attribute,allowed:[...new Set(Z.allowed)],default:Z.default},colorMode:{key:Y.key,attribute:Y.attribute,default:Y.default}}}function __(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function H_(X){return`<script data-stx-scoped data-stx-appearance-bootstrap>(function(){"use strict";const config=${__(X)};const root=document.documentElement;let stored={};try{const raw=localStorage.getItem(config.storageKey);const parsed=raw?JSON.parse(raw):{};if(parsed&&typeof parsed==="object"&&!Array.isArray(parsed))stored=parsed}catch{}const selectedAppearance=config.appearance.allowed.includes(stored[config.appearance.key])?stored[config.appearance.key]:config.appearance.default;const selectedMode=["light","dark","system"].includes(stored[config.colorMode.key])?stored[config.colorMode.key]:config.colorMode.default;root.setAttribute("data-"+config.appearance.attribute,selectedAppearance);root.setAttribute("data-"+config.colorMode.attribute,selectedMode);let dark=selectedMode==="dark";if(selectedMode==="system"){try{dark=matchMedia("(prefers-color-scheme: dark)").matches}catch{dark=false}}root.classList.toggle("dark",dark);root.dataset.theme=dark?"dark":"light"}());</script>`}function L_(X,$){let Z=1,Y=null,J=!1;for(let G=$+1;G<X.length;G++){let Q=X[G];if(J){J=!1;continue}if(Y){if(Q==="\\")J=!0;else if(Q===Y)Y=null;continue}if(Q==='"'||Q==="'"||Q==="`"){Y=Q;continue}if(Q==="(")Z++;else if(Q===")"&&--Z===0)return G}return-1}function xG(X,$){let Z=X,Y=/@appearanceBootstrap\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index+J[0].length-1,Q=L_(Z,G);if(Q===-1)throw Error("@appearanceBootstrap has an unclosed options object");let q=Z.slice(G+1,Q).trim(),W=J0(`(${q})`,$),K=H_(B_(W));Z=Z.slice(0,J.index)+K+Z.slice(Q+1),Y.lastIndex=J.index+K.length}return Z}var PG,vG,j_;var fG=E(()=>{R0();PG=/^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/,vG=/^[A-Za-z_$][\w$]*$/,j_=new Set(["light","dark","system"])});import O_ from"crypto";function L0(X){return String(X??"").replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}function i8(X,$,Z,Y){let J=X||$;return Z?`${J} ${Y}`:J}function o0(X){return String(X).replace(/\[\]$/,"").replace(/[^\w.:-]+/g,"-").replace(/^-+|-+$/g,"")}function h5(X,$){if(/\bid\s*=/i.test(X))return"";return` id="${L0($)}"`}function i4(X,$,Z){if(!$)return"";let Y="";if(!/\baria-invalid\s*=/i.test(Z))Y+=' aria-invalid="true"';if(!/\baria-describedby\s*=/i.test(Z))Y+=` aria-describedby="${L0(`${o0(X)}-error`)}"`;return Y}function F_(){return O_.randomUUID()}function n8(X,$){let Z=X;return Z=Z.replace(/@csrf/g,()=>{if(!$.csrf||typeof $.csrf!=="object"){let Y=F_();$.csrf={token:Y}}if($.csrf.field)return $.csrf.field;if($.csrf.token)return`<input type="hidden" name="_token" value="${L0($.csrf.token)}">`;return'<input type="hidden" name="_token" value="">'}),Z=Z.replace(/@method\(['"]([^'"]+)['"]\)/g,(Y,J)=>{let G=J.toUpperCase();if(J&&!["GET","POST"].includes(G))return`<input type="hidden" name="_method" value="${L0(G)}">`;return Y}),Z}function uG(X,$,Z=hG){let Y=X;return Y=Y.replace(/@form\(\s*(?:(?:'([^']+)'|"([^"]+)")\s*)?(?:,\s*(?:'([^']+)'|"([^"]+)")?)?\s*(?:,\s*\{([^}]+)\}\s*)?\)/g,(J,G,Q,q,W,K="")=>{let U=G||Q||"POST",z=q||W||"",w=f1(K),B=U.toUpperCase(),j=["GET","POST"].includes(B)?B:"POST",_=`<form method="${L0(j)}" action="${L0(z)}"${w?` ${w}`:""}>`;if(_+=`
13517
13517
  ${n8("@csrf",$)}`,!["GET","POST"].includes(B))_+=`
13518
- ${n8(`@method('${B}')`,$)}`;return _}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,q,K,U="")=>{let W=G||Q||"",z=q||K||"",w=f1(U),B=l7(W,$),j=B!==void 0&&B!==null?B:z||"",_=w.match(/type=['"]([^'"]+)['"]/i),H=_?_[1]:"text",O=c7(W,$),L=w.match(/class=['"]([^'"]+)['"]/i),F=i8(L?L[1]:"",Z.input,O,Z.inputError),V=w.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${O0(H)}" name="${O0(W)}"${h5(w,o0(W))} value="${O0(j)}" class="${F}"${i4(W,O,w)}${V?` ${V}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,G,Q="",q="")=>{let K=f1(Q),U=l7(G,$)||q.trim(),W=c7(G,$),z=K.match(/class=['"]([^'"]+)['"]/i),w=i8(z?z[1]:"",Z.input,W,Z.inputError),B=K.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${O0(G)}"${h5(K,o0(G))} class="${w}"${i4(G,W,K)}${B?` ${B}`:""}>${O0(U)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,G,Q="",q)=>{let K=f1(Q),U=l7(G,$),W=c7(G,$),z=K.match(/class=['"]([^'"]+)['"]/i),w=i8(z?z[1]:"",Z.input,W,Z.inputError),B=K.replace(/class=['"][^'"]+['"]/i,""),j=q;if(U!==void 0)j=q.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,H,O)=>{if((Array.isArray(U)?U.some((F)=>String(F)===O):String(U)===O)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return _});return`<select name="${O0(G)}"${h5(K,o0(G))} class="${w}"${i4(G,W,K)}${B?` ${B}`:""}>${j}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,q="")=>{let K=Q===void 0?"1":Q,U=Q===void 0?o0(G):`${o0(G)}-${o0(K)}`,W=f1(q),z=l7(G,$),w=z!==void 0&&(Array.isArray(z)?z.some((H)=>String(H)===K):z===!0||String(z)===K),B=W.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:Z.checkInput,_=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${O0(G)}"${h5(W,U)} value="${O0(K)}" class="${j}"${w?" checked":""}${_?` ${_}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,q="")=>{let K=f1(q),U=l7(G,$),W=U!==void 0&&U===Q,z=K.match(/class=['"]([^'"]+)['"]/i),w=z?z[1]:Z.checkInput,B=K.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${O0(G)}"${h5(K,`${o0(G)}-${o0(Q)}`)} value="${O0(Q)}" class="${w}"${W?" checked":""}${B?` ${B}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q="")=>{let q=f1(Q),K=q.match(/accept=['"]([^'"]+)['"]/i),U=K?K[1]:"",W=q.includes("multiple"),z=c7(G,$),w=q.match(/class=['"]([^'"]+)['"]/i),B=i8(w?w[1]:"",Z.input,z,Z.inputError),j=q.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${O0(G)}"${h5(q,o0(G))}`,`class="${B}"`];if(U)_.push(`accept="${O0(U)}"`);if(W)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,G,Q="",q)=>{let K=f1(Q),U=K.match(/class=['"]([^'"]+)['"]/i),W=U?U[1]:Z.label,z=K.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${O0(o0(G))}" class="${W}"${z?` ${z}`:""}>${q}</label>`}),Y}function dG(X,$,Z=hG){return X.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,J,G)=>{try{if(c7(J,$)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(q,K)=>{try{if(K.trim()==="$message"||K.trim()==="message")return gG(J,$);if(K.trim().includes("errors.first")||K.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(J);return gG(J,$)}let U=K.trim();if(G0(U)){let W=J0(U,$);return W!==void 0?String(W):U}return U}catch{return K}});return`<div id="${O0(`${o0(J)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),Y}})}function c7(X,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(X);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,X);return!1}function gG(X,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(X);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,X)){let Z=$.errors[X];return Array.isArray(Z)?Z[0]:String(Z)}return""}function l7(X,$){let Z;if($.old&&typeof $.old==="function")return $.old(X);if($.old&&typeof $.old==="object")return $.old[X];if(X.endsWith("[]")){let Y=X.slice(0,-2);if(Z=$[Y],Z!==void 0)return Z}return $[X]}function f1(X){if(!X.trim())return"";let $=[],Z=X.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=Y.exec(Z))!==null){let[,G,,Q]=J;$.push(`${G}="${Q.trim()}"`)}return $.join(" ")}var hG;var mG=E(()=>{R0();hG={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import o4 from"path";async function L_(){if(p7!==void 0)return p7;try{p7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{p7=null}return p7}function F_(X,$=0){if($<=0)return!1;return Date.now()-X.loadedAt>$}async function V_(X,$){if({...t4,...$.i18n}.cache&&s4[X]){let J=s4[X],G=$.i18n?.cacheMaxAge??0;if(!F_(J,G))return J.translations}if(i7[X]?.state==="loading")return i7[X].promise;n4[X]="loading";let Y=a4(X,$).then((J)=>{return n4[X]="loaded",delete i7[X],J}).catch((J)=>{throw n4[X]="error",i7[X]={promise:Y,state:"error",error:J instanceof Error?J:Error(String(J))},J});return i7[X]={promise:Y,state:"loading"},Y}async function a4(X,$){let Z={...t4,...$.i18n},Y=o4.isAbsolute(Z.translationsDir)?Z.translationsDir:o4.resolve($.root||process.cwd(),Z.translationsDir);try{let J=await L_(),G=J?await J(X,{translationsDir:Y,defaultLocale:Z.defaultLocale,sources:M_(Z.format)}):await A_(X,Z,Y);if(G===void 0){if(X!==Z.defaultLocale)return a4(Z.defaultLocale,$);return{}}let Q=G;if(Z.cache)s4[X]={translations:Q,loadedAt:Date.now(),locale:X};return Q}catch(J){if($.debug)console.error(`Error loading translation file for locale "${X}":`,J);if(X!==Z.defaultLocale)return a4(Z.defaultLocale,$);return{}}}async function A_(X,$,Z){let Y=o4.join(Z,`${X}${R_($.format)}`);try{let J=await import(Y);return J.default||J}catch(J){try{let G=await Bun.file(Y).text();if($.format==="yaml"||$.format==="yml")return N_(G);if($.format==="json")return JSON.parse(G);throw J}catch{return}}}function R_(X){switch(X){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function N_(X){let $={},Z=X.split(`
13519
- `),Y=[{obj:$,indent:-1}];for(let J of Z){let G=J.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let q=Y[Y.length-1].obj,K=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(K){let[,,U,W]=K,z=U.trim(),w=W.trim();if(w==="")q[z]={},Y.push({obj:q[z],indent:Q});else q[z]=T_(w)}}return $}function T_(X){if(X.startsWith("'")&&X.endsWith("'")||X.startsWith('"')&&X.endsWith('"'))return X.slice(1,-1);let $=X.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let Z=Number(X);if(!Number.isNaN(Z)&&X!=="")return Z;return X}function M_(X){switch(X){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function k_(X,$){return V_(X,$)}function I_(X,$){for(let Z of X){let Y=Z.trim(),J=Y.match(/^\{(\d+)\}\s*(.*)$/);if(J){let Q=Number.parseInt(J[1],10);if($===Q)return J[2];continue}let G=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10),q=G[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(G[2],10);if($>=Q&&$<=q)return G[3];continue}}if(X.length===2)return $===1?X[0].trim():X[1].trim();if($<X.length)return X[$].trim();return X[X.length-1].trim()}function E_(X,$={}){return pG(X,$)}function pG(X,$){let Z="",Y=0;while(Y<X.length)if(X[Y]==="{"){let J=D_(X,Y);if(J===-1){Z+=X[Y],Y++;continue}let G=X.slice(Y+1,J);Z+=y_(G,$),Y=J+1}else if(X[Y]==="'"&&Y+1<X.length)if(X[Y+1]==="'")Z+="'",Y+=2;else if(X[Y+1]==="{"||X[Y+1]==="}")Z+=X[Y+1],Y+=2;else Z+=X[Y],Y++;else Z+=X[Y],Y++;return Z}function D_(X,$){let Z=0;for(let Y=$;Y<X.length;Y++)if(X[Y]==="{")Z++;else if(X[Y]==="}"){if(Z--,Z===0)return Y}return-1}function y_(X,$){let Z=b_(X);if(Z.length===0)return`{${X}}`;let Y=Z[0].trim(),J=$[Y];if(Z.length===1)return J!==void 0?String(J):`{${Y}}`;switch(Z[1].trim().toLowerCase()){case"plural":return S_(J,Z.slice(2).join(","),$);case"select":return P_(J,Z.slice(2).join(","));case"selectordinal":return v_(J,Z.slice(2).join(","));case"number":return f_(J,Z[2]?.trim());case"date":return g_(J,Z[2]?.trim());case"time":return h_(J,Z[2]?.trim());default:return J!==void 0?String(J):`{${X}}`}}function b_(X){let $=[],Z="",Y=0;for(let J=0;J<X.length;J++){let G=X[J];if(G==="{")Y++,Z+=G;else if(G==="}")Y--,Z+=G;else if(G===","&&Y===0)$.push(Z),Z="";else Z+=G}if(Z)$.push(Z);return $}function S_(X,$,Z){let Y=Number(X)||0,J=e4($),G=`=${Y}`;if(J[G])return r4(J[G],Y,Z);let Q=C_(Y);if(J[Q])return r4(J[Q],Y,Z);if(J.other)return r4(J.other,Y,Z);return String(Y)}function r4(X,$,Z){let Y=X.replace(/#/g,String($));return pG(Y,Z)}function C_(X){let $=Math.abs(X),Z=Math.floor($),Y=String(X).includes(".")?String(X).split(".")[1].length:0;if(Z===1&&Y===0)return"one";return"other"}function P_(X,$){let Z=String(X||""),Y=e4($);if(Y[Z])return Y[Z];return Y.other||String(X)}function v_(X,$){let Z=Number(X)||0,Y=e4($),J=x_(Z);if(Y[J])return Y[J].replace(/#/g,String(Z));if(Y.other)return Y.other.replace(/#/g,String(Z));return String(Z)}function x_(X){let $=Math.abs(X),Z=$%10,Y=$%100;if(Z===1&&Y!==11)return"one";if(Z===2&&Y!==12)return"two";if(Z===3&&Y!==13)return"few";return"other"}function e4(X){let $={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=Z.exec(X);while(Y!==null)$[Y[1]]=Y[2],Y=Z.exec(X);return $}function f_(X,$){let Z=Number(X);if(Number.isNaN(Z))return String(X);switch($){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function g_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return Z.toLocaleDateString(void 0,Y)}function h_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return Z.toLocaleTimeString(void 0,Y)}function u_(X){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(X)}function lG(X,$,Z=!0,Y={}){let J=X.split("."),G=$;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Z?X:"";let Q=String(G);if(u_(Q))return E_(Q,Y);if(Q.includes("|")&&"count"in Y){let q=Number(Y.count),K=Q.split("|");Q=I_(K,q)}for(let[q,K]of Object.entries(Y)){let U=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${U}`,"g"),String(K))}return Q}async function iG(X,$,Z,Y){let J=X,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...t4,...Y.i18n},q=await k_(Q.locale,Y);$.__translations=q,$.__locale=Q.locale,$.__i18nConfig=Q,J=await cG(J,G,async(W,z,w,B,j)=>{try{let _={};if(w)try{let O=[()=>JSON.parse(w),()=>{let L=`{"data":${w}}`,F=JSON.parse(L);return typeof F.data==="object"?F.data:{}},()=>{return A0(w,$)}];for(let L of O)try{if(_=L(),Object.keys(_).length>0)break}catch{}}catch(O){if(Y.debug)console.error("Error parsing parameters for @translate directive:",O)}return lG(z,q,Q.fallbackToKey,_)||B.trim()}catch(_){if(Y.debug)console.error("Error processing @translate directive:",_);return Y0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR)}});let K=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let W=[...J.matchAll(K)];console.warn(`Found ${W.length} @translate matches`),W.forEach((z,w)=>console.warn(`Match ${w}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return J=await cG(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(W,z,w,B)=>{try{let j={};if(w)try{let _=[()=>JSON.parse(w),()=>{let H=`{"data":${w}}`,O=JSON.parse(H);return typeof O.data==="object"?O.data:{}},()=>{return A0(w,$)}];for(let H of _)try{if(j=H(),Object.keys(j).length>0)break}catch{}}catch(_){if(Y.debug)console.error("Error parsing parameters for @translate directive:",_)}return lG(z,q,Q.fallbackToKey,j)}catch(j){if(Y.debug)console.error("Error processing @translate directive:",j);return Y0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,s.EVALUATION_ERROR)}}),J}async function cG(X,$,Z){let Y=[];return X.replace($,(G,...Q)=>{let q=Z(G,...Q).then((K)=>({match:G,replacement:K}));return Y.push(q),G}),(await Promise.all(Y)).reduce((G,{match:Q,replacement:q})=>G.replace(Q,q),X)}var p7,t4,s4,i7,n4;var nG=E(()=>{H1();R0();t4={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},s4={},i7={},n4={}});var Z3={};n(Z3,{streamingSuspenseDirective:()=>sG,streamToResponse:()=>t_,streamTemplateSimple:()=>r_,streamTemplate:()=>m_,renderStreamingPage:()=>c_,registerStreamingDirectives:()=>s_,processStreamDirectives:()=>i_,processSectionDirectives:()=>a_,islandDirective:()=>aG,generateHydrationRuntime:()=>e_,extractStreamBoundaries:()=>n_,createStreamRenderer:()=>o_,buildSuspenseResolveScript:()=>$3,SUSPENSE_RESOLVER_RUNTIME:()=>oG});import r8 from"path";function d_(X){let $=[],Z=0,Y;rG.lastIndex=0;while((Y=rG.exec(X))!==null){if(Y.index>Z){let Q=X.slice(Z,Y.index);if(Q.trim())$.push({type:$.length===0?"shell":"content",content:Q})}let J=Y[1],G=Y[2];$.push({type:"suspense",name:J,content:G}),Z=Y.index+Y[0].length}if(Z<X.length){let J=X.slice(Z);if(J.trim())$.push({type:$.length===0?"shell":"content",content:J})}if($.length===0)$.push({type:"shell",content:X});return $}async function m_(X,$={},Z={}){let Y={...q5,...Z,streaming:{...X3,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),q=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),K=q?q[1]:"",U=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...$,__filename:X,__dirname:r8.dirname(X)};if(K.trim())await e1(K,W,X);let z=d_(U),w=new Set;if(!z.some((j)=>j.type==="suspense")){let j=Y.streaming?.strategy||"auto",_=new RegExp(W5.source,"g");if(!(j!=="manual"&&_.test(U))){let O=await I0(U,W,X,Y,w);for(let L=0;L<O.length;L+=J)G.enqueue(O.slice(L,L+J)),await new Promise((F)=>setTimeout(F,0))}else{let O=[],L=new RegExp(W5.source,"g"),F;while((F=L.exec(U))!==null)O.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of O){if(A.start>V){let N=U.slice(V,A.start);if(N.trim()){let T=await I0(N,W,X,Y,w);G.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let R=await I0(A.content,W,X,Y,w);G.enqueue(R),await new Promise((N)=>setTimeout(N,0)),V=A.end}if(V<U.length){let A=U.slice(V);if(A.trim()){let R=await I0(A,W,X,Y,w);G.enqueue(R)}}}}else{let j=new Map;for(let H of z)if(H.type==="shell"||H.type==="content"){let O=await I0(H.content,W,X,Y,w);G.enqueue(O)}else if(H.type==="suspense"&&H.name){let O=`stx-suspense-${H.name}`;G.enqueue(`<div id="${O}" data-suspense="${H.name}" style="display:contents;">
13518
+ ${n8(`@method('${B}')`,$)}`;return _}),Y=Y.replace(/@endform/g,"</form>"),Y=Y.replace(/@input\(\s*(?:'([^']+)'|"([^"]+)")\s*(?:,\s*(?:(?:'([^']*)'|"([^"]*)")\s*)?)?(?:,\s*\{([^}]+)\})?\s*\)/g,(J,G,Q,q,W,K="")=>{let U=G||Q||"",z=q||W||"",w=f1(K),B=l7(U,$),j=B!==void 0&&B!==null?B:z||"",_=w.match(/type=['"]([^'"]+)['"]/i),H=_?_[1]:"text",L=c7(U,$),O=w.match(/class=['"]([^'"]+)['"]/i),F=i8(O?O[1]:"",Z.input,L,Z.inputError),V=w.replace(/class=['"][^'"]+['"]/i,"");return V=V.replace(/type=['"][^'"]+['"]/i,""),`<input type="${L0(H)}" name="${L0(U)}"${h5(w,o0(U))} value="${L0(j)}" class="${F}"${i4(U,L,w)}${V?` ${V}`:""}>`}),Y=Y.replace(/@textarea\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endtextarea/g,(J,G,Q="",q="")=>{let W=f1(Q),K=l7(G,$)||q.trim(),U=c7(G,$),z=W.match(/class=['"]([^'"]+)['"]/i),w=i8(z?z[1]:"",Z.input,U,Z.inputError),B=W.replace(/class=['"][^'"]+['"]/i,"");return`<textarea name="${L0(G)}"${h5(W,o0(G))} class="${w}"${i4(G,U,W)}${B?` ${B}`:""}>${L0(K)}</textarea>`}),Y=Y.replace(/@select\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endselect/g,(J,G,Q="",q)=>{let W=f1(Q),K=l7(G,$),U=c7(G,$),z=W.match(/class=['"]([^'"]+)['"]/i),w=i8(z?z[1]:"",Z.input,U,Z.inputError),B=W.replace(/class=['"][^'"]+['"]/i,""),j=q;if(K!==void 0)j=q.replace(/(<option[^>]*value=['"]([^'"]+)['"][^>]*>)/gi,(_,H,L)=>{if((Array.isArray(K)?K.some((F)=>String(F)===L):String(K)===L)&&!H.includes("selected"))return H.replace(/(<option)/,"$1 selected");return _});return`<select name="${L0(G)}"${h5(W,o0(G))} class="${w}"${i4(G,U,W)}${B?` ${B}`:""}>${j}</select>`}),Y=Y.replace(/@checkbox\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,q="")=>{let W=Q===void 0?"1":Q,K=Q===void 0?o0(G):`${o0(G)}-${o0(W)}`,U=f1(q),z=l7(G,$),w=z!==void 0&&(Array.isArray(z)?z.some((H)=>String(H)===W):z===!0||String(z)===W),B=U.match(/class=['"]([^'"]+)['"]/i),j=B?B[1]:Z.checkInput,_=U.replace(/class=['"][^'"]+['"]/i,"");return`<input type="checkbox" name="${L0(G)}"${h5(U,K)} value="${L0(W)}" class="${j}"${w?" checked":""}${_?` ${_}`:""}>`}),Y=Y.replace(/@radio\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q,q="")=>{let W=f1(q),K=l7(G,$),U=K!==void 0&&K===Q,z=W.match(/class=['"]([^'"]+)['"]/i),w=z?z[1]:Z.checkInput,B=W.replace(/class=['"][^'"]+['"]/i,"");return`<input type="radio" name="${L0(G)}"${h5(W,`${o0(G)}-${o0(Q)}`)} value="${L0(Q)}" class="${w}"${U?" checked":""}${B?` ${B}`:""}>`}),Y=Y.replace(/@file\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)/g,(J,G,Q="")=>{let q=f1(Q),W=q.match(/accept=['"]([^'"]+)['"]/i),K=W?W[1]:"",U=q.includes("multiple"),z=c7(G,$),w=q.match(/class=['"]([^'"]+)['"]/i),B=i8(w?w[1]:"",Z.input,z,Z.inputError),j=q.replace(/class=['"][^'"]+['"]/gi,"").replace(/accept=['"][^'"]+['"]/gi,"").replace(/\bmultiple\b/gi,"").trim(),_=[`<input type="file" name="${L0(G)}"${h5(q,o0(G))}`,`class="${B}"`];if(K)_.push(`accept="${L0(K)}"`);if(U)_.push("multiple");if(j)_.push(j);return`${_.join(" ")}>`}),Y=Y.replace(/@label\(\s*['"]([^'"]+)['"]\s*(?:,\s*\{([^}]+)\})?\)([\s\S]*?)@endlabel/g,(J,G,Q="",q)=>{let W=f1(Q),K=W.match(/class=['"]([^'"]+)['"]/i),U=K?K[1]:Z.label,z=W.replace(/class=['"][^'"]+['"]/i,"");return`<label for="${L0(o0(G))}" class="${U}"${z?` ${z}`:""}>${q}</label>`}),Y}function dG(X,$,Z=hG){return X.replace(/@error\(['"]([^'"]+)['"]\)([\s\S]*?)@enderror/g,(Y,J,G)=>{try{if(c7(J,$)){let Q=G.replace(/\{\{([^}]+)\}\}/g,(q,W)=>{try{if(W.trim()==="$message"||W.trim()==="message")return gG(J,$);if(W.trim().includes("errors.first")||W.trim().includes("$errors.first")){if(typeof $.errors?.first==="function")return $.errors.first(J);return gG(J,$)}let K=W.trim();if(G0(K)){let U=J0(K,$);return U!==void 0?String(U):K}return K}catch{return W}});return`<div id="${L0(`${o0(J)}-error`)}" role="alert">${Q}</div>`}return""}catch(Q){return console.error("Error processing @error directive:",Q),Y}})}function c7(X,$){if(!$.errors)return!1;if(typeof $.errors.has==="function")return $.errors.has(X);if(typeof $.errors==="object")return Object.prototype.hasOwnProperty.call($.errors,X);return!1}function gG(X,$){if(!$.errors)return"";if(typeof $.errors.get==="function")return $.errors.get(X);if(typeof $.errors==="object"&&Object.prototype.hasOwnProperty.call($.errors,X)){let Z=$.errors[X];return Array.isArray(Z)?Z[0]:String(Z)}return""}function l7(X,$){let Z;if($.old&&typeof $.old==="function")return $.old(X);if($.old&&typeof $.old==="object")return $.old[X];if(X.endsWith("[]")){let Y=X.slice(0,-2);if(Z=$[Y],Z!==void 0)return Z}return $[X]}function f1(X){if(!X.trim())return"";let $=[],Z=X.trim(),Y=/([\w-]+)\s*:\s*(['"]?)([^,'"]*)\2(?:\s*,\s*|\s*$)/g,J;while((J=Y.exec(Z))!==null){let[,G,,Q]=J;$.push(`${G}="${Q.trim()}"`)}return $.join(" ")}var hG;var mG=E(()=>{R0();hG={input:"form-control",inputError:"is-invalid",checkInput:"form-check-input",label:"form-label",errorFeedback:"invalid-feedback"}});import o4 from"path";async function V_(){if(p7!==void 0)return p7;try{p7=(await import("@stacksjs/ts-i18n")).loadLocale??null}catch{p7=null}return p7}function A_(X,$=0){if($<=0)return!1;return Date.now()-X.loadedAt>$}async function R_(X,$){if({...t4,...$.i18n}.cache&&s4[X]){let J=s4[X],G=$.i18n?.cacheMaxAge??0;if(!A_(J,G))return J.translations}if(i7[X]?.state==="loading")return i7[X].promise;n4[X]="loading";let Y=a4(X,$).then((J)=>{return n4[X]="loaded",delete i7[X],J}).catch((J)=>{throw n4[X]="error",i7[X]={promise:Y,state:"error",error:J instanceof Error?J:Error(String(J))},J});return i7[X]={promise:Y,state:"loading"},Y}async function a4(X,$){let Z={...t4,...$.i18n},Y=o4.isAbsolute(Z.translationsDir)?Z.translationsDir:o4.resolve($.root||process.cwd(),Z.translationsDir);try{let J=await V_(),G=J?await J(X,{translationsDir:Y,defaultLocale:Z.defaultLocale,sources:I_(Z.format)}):await N_(X,Z,Y);if(G===void 0){if(X!==Z.defaultLocale)return a4(Z.defaultLocale,$);return{}}let Q=G;if(Z.cache)s4[X]={translations:Q,loadedAt:Date.now(),locale:X};return Q}catch(J){if($.debug)console.error(`Error loading translation file for locale "${X}":`,J);if(X!==Z.defaultLocale)return a4(Z.defaultLocale,$);return{}}}async function N_(X,$,Z){let Y=o4.join(Z,`${X}${T_($.format)}`);try{let J=await import(Y);return J.default||J}catch(J){try{let G=await Bun.file(Y).text();if($.format==="yaml"||$.format==="yml")return M_(G);if($.format==="json")return JSON.parse(G);throw J}catch{return}}}function T_(X){switch(X){case"yaml":return".yaml";case"yml":return".yml";case"js":return".js";case"ts":return".ts";case"json":default:return".json"}}function M_(X){let $={},Z=X.split(`
13519
+ `),Y=[{obj:$,indent:-1}];for(let J of Z){let G=J.replace(/#.*$/,"").trimEnd();if(!G.trim())continue;let Q=G.search(/\S/);if(Q===-1)continue;while(Y.length>1&&Y[Y.length-1].indent>=Q)Y.pop();let q=Y[Y.length-1].obj,W=G.match(/^(\s*)(\S[^:]*):\s*(.*)$/);if(W){let[,,K,U]=W,z=K.trim(),w=U.trim();if(w==="")q[z]={},Y.push({obj:q[z],indent:Q});else q[z]=k_(w)}}return $}function k_(X){if(X.startsWith("'")&&X.endsWith("'")||X.startsWith('"')&&X.endsWith('"'))return X.slice(1,-1);let $=X.toLowerCase();if($==="true"||$==="yes")return!0;if($==="false"||$==="no")return!1;if($==="null"||$==="~")return null;let Z=Number(X);if(!Number.isNaN(Z)&&X!=="")return Z;return X}function I_(X){switch(X){case"yaml":case"yml":return["yaml"];case"js":case"ts":return["ts"];case"json":default:return["json"]}}async function E_(X,$){return R_(X,$)}function D_(X,$){for(let Z of X){let Y=Z.trim(),J=Y.match(/^\{(\d+)\}\s*(.*)$/);if(J){let Q=Number.parseInt(J[1],10);if($===Q)return J[2];continue}let G=Y.match(/^\[(\d+),(\d+|\*)\]\s*(.*)$/);if(G){let Q=Number.parseInt(G[1],10),q=G[2]==="*"?Number.POSITIVE_INFINITY:Number.parseInt(G[2],10);if($>=Q&&$<=q)return G[3];continue}}if(X.length===2)return $===1?X[0].trim():X[1].trim();if($<X.length)return X[$].trim();return X[X.length-1].trim()}function y_(X,$={}){return pG(X,$)}function pG(X,$){let Z="",Y=0;while(Y<X.length)if(X[Y]==="{"){let J=b_(X,Y);if(J===-1){Z+=X[Y],Y++;continue}let G=X.slice(Y+1,J);Z+=S_(G,$),Y=J+1}else if(X[Y]==="'"&&Y+1<X.length)if(X[Y+1]==="'")Z+="'",Y+=2;else if(X[Y+1]==="{"||X[Y+1]==="}")Z+=X[Y+1],Y+=2;else Z+=X[Y],Y++;else Z+=X[Y],Y++;return Z}function b_(X,$){let Z=0;for(let Y=$;Y<X.length;Y++)if(X[Y]==="{")Z++;else if(X[Y]==="}"){if(Z--,Z===0)return Y}return-1}function S_(X,$){let Z=C_(X);if(Z.length===0)return`{${X}}`;let Y=Z[0].trim(),J=$[Y];if(Z.length===1)return J!==void 0?String(J):`{${Y}}`;switch(Z[1].trim().toLowerCase()){case"plural":return P_(J,Z.slice(2).join(","),$);case"select":return x_(J,Z.slice(2).join(","));case"selectordinal":return f_(J,Z.slice(2).join(","));case"number":return h_(J,Z[2]?.trim());case"date":return u_(J,Z[2]?.trim());case"time":return d_(J,Z[2]?.trim());default:return J!==void 0?String(J):`{${X}}`}}function C_(X){let $=[],Z="",Y=0;for(let J=0;J<X.length;J++){let G=X[J];if(G==="{")Y++,Z+=G;else if(G==="}")Y--,Z+=G;else if(G===","&&Y===0)$.push(Z),Z="";else Z+=G}if(Z)$.push(Z);return $}function P_(X,$,Z){let Y=Number(X)||0,J=e4($),G=`=${Y}`;if(J[G])return r4(J[G],Y,Z);let Q=v_(Y);if(J[Q])return r4(J[Q],Y,Z);if(J.other)return r4(J.other,Y,Z);return String(Y)}function r4(X,$,Z){let Y=X.replace(/#/g,String($));return pG(Y,Z)}function v_(X){let $=Math.abs(X),Z=Math.floor($),Y=String(X).includes(".")?String(X).split(".")[1].length:0;if(Z===1&&Y===0)return"one";return"other"}function x_(X,$){let Z=String(X||""),Y=e4($);if(Y[Z])return Y[Z];return Y.other||String(X)}function f_(X,$){let Z=Number(X)||0,Y=e4($),J=g_(Z);if(Y[J])return Y[J].replace(/#/g,String(Z));if(Y.other)return Y.other.replace(/#/g,String(Z));return String(Z)}function g_(X){let $=Math.abs(X),Z=$%10,Y=$%100;if(Z===1&&Y!==11)return"one";if(Z===2&&Y!==12)return"two";if(Z===3&&Y!==13)return"few";return"other"}function e4(X){let $={},Z=/(\w+|=\d+)\s*\{([^{}]*(?:\{[^{}]*\}[^{}]*)*)\}/g,Y=Z.exec(X);while(Y!==null)$[Y[1]]=Y[2],Y=Z.exec(X);return $}function h_(X,$){let Z=Number(X);if(Number.isNaN(Z))return String(X);switch($){case"integer":return Math.floor(Z).toLocaleString();case"percent":return`${(Z*100).toFixed(0)}%`;case"currency":return Z.toLocaleString(void 0,{style:"currency",currency:"USD"});default:return Z.toLocaleString()}}function u_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.dateStyle="short";break;case"medium":Y.dateStyle="medium";break;case"long":Y.dateStyle="long";break;case"full":Y.dateStyle="full";break;default:Y.dateStyle="medium"}return Z.toLocaleDateString(void 0,Y)}function d_(X,$){let Z=X instanceof Date?X:new Date(String(X));if(Number.isNaN(Z.getTime()))return String(X);let Y={};switch($){case"short":Y.timeStyle="short";break;case"medium":Y.timeStyle="medium";break;case"long":Y.timeStyle="long";break;case"full":Y.timeStyle="full";break;default:Y.timeStyle="short"}return Z.toLocaleTimeString(void 0,Y)}function m_(X){return/\{[^}]+,\s*(?:plural|select|selectordinal|number|date|time)\s*,/.test(X)}function lG(X,$,Z=!0,Y={}){let J=X.split("."),G=$;for(let q of J){if(G===void 0||G===null)break;G=G[q]}if(G===void 0||G===null)return Z?X:"";let Q=String(G);if(m_(Q))return y_(Q,Y);if(Q.includes("|")&&"count"in Y){let q=Number(Y.count),W=Q.split("|");Q=D_(W,q)}for(let[q,W]of Object.entries(Y)){let K=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");Q=Q.replace(new RegExp(`:${K}`,"g"),String(W))}return Q}async function iG(X,$,Z,Y){let J=X,G=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)([\s\S]*?)@endtranslate/g,Q={...t4,...Y.i18n},q=await E_(Q.locale,Y);$.__translations=q,$.__locale=Q.locale,$.__i18nConfig=Q,J=await cG(J,G,async(U,z,w,B,j)=>{try{let _={};if(w)try{let L=[()=>JSON.parse(w),()=>{let O=`{"data":${w}}`,F=JSON.parse(O);return typeof F.data==="object"?F.data:{}},()=>{return A0(w,$)}];for(let O of L)try{if(_=O(),Object.keys(_).length>0)break}catch{}}catch(L){if(Y.debug)console.error("Error parsing parameters for @translate directive:",L)}return lG(z,q,Q.fallbackToKey,_)||B.trim()}catch(_){if(Y.debug)console.error("Error processing @translate directive:",_);return Y0("Translate",`Error in @translate('${z}'): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR)}});let W=/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]+\})\s*)?\)/g;if(Y.debug){console.warn(`Processing translations in template. Sections: ${J.includes("<h2>Translation with Parameters</h2>")?"Parameters section found":"Parameters section missing"}`);let U=[...J.matchAll(W)];console.warn(`Found ${U.length} @translate matches`),U.forEach((z,w)=>console.warn(`Match ${w}: ${z[0]}, Key: ${z[1]}, Params: ${z[2]||"none"}`))}return J=await cG(J,/@translate\(\s*['"]([^'"]+)['"]\s*(?:,\s*(\{[^}]*\})\s*)?\)/g,async(U,z,w,B)=>{try{let j={};if(w)try{let _=[()=>JSON.parse(w),()=>{let H=`{"data":${w}}`,L=JSON.parse(H);return typeof L.data==="object"?L.data:{}},()=>{return A0(w,$)}];for(let H of _)try{if(j=H(),Object.keys(j).length>0)break}catch{}}catch(_){if(Y.debug)console.error("Error parsing parameters for @translate directive:",_)}return lG(z,q,Q.fallbackToKey,j)}catch(j){if(Y.debug)console.error("Error processing @translate directive:",j);return Y0("Translate",`Error in @translate('${z}'): ${j instanceof Error?j.message:String(j)}`,o.EVALUATION_ERROR)}}),J}async function cG(X,$,Z){let Y=[];return X.replace($,(G,...Q)=>{let q=Z(G,...Q).then((W)=>({match:G,replacement:W}));return Y.push(q),G}),(await Promise.all(Y)).reduce((G,{match:Q,replacement:q})=>G.replace(Q,q),X)}var p7,t4,s4,i7,n4;var nG=E(()=>{H1();R0();t4={defaultLocale:"en",locale:"en",translationsDir:"translations",format:"yaml",fallbackToKey:!0,cache:!0},s4={},i7={},n4={}});var Z3={};i(Z3,{streamingSuspenseDirective:()=>sG,streamToResponse:()=>XH,streamTemplateSimple:()=>s_,streamTemplate:()=>c_,renderStreamingPage:()=>i_,registerStreamingDirectives:()=>t_,processStreamDirectives:()=>r_,processSectionDirectives:()=>e_,islandDirective:()=>aG,generateHydrationRuntime:()=>$H,extractStreamBoundaries:()=>o_,createStreamRenderer:()=>a_,buildSuspenseResolveScript:()=>$3,SUSPENSE_RESOLVER_RUNTIME:()=>oG});import r8 from"path";function l_(X){let $=[],Z=0,Y;rG.lastIndex=0;while((Y=rG.exec(X))!==null){if(Y.index>Z){let Q=X.slice(Z,Y.index);if(Q.trim())$.push({type:$.length===0?"shell":"content",content:Q})}let J=Y[1],G=Y[2];$.push({type:"suspense",name:J,content:G}),Z=Y.index+Y[0].length}if(Z<X.length){let J=X.slice(Z);if(J.trim())$.push({type:$.length===0?"shell":"content",content:J})}if($.length===0)$.push({type:"shell",content:X});return $}async function c_(X,$={},Z={}){let Y={...q5,...Z,streaming:{...X3,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),q=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=q?q[1]:"",K=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:r8.dirname(X)};if(W.trim())await e1(W,U,X);let z=l_(K),w=new Set;if(!z.some((j)=>j.type==="suspense")){let j=Y.streaming?.strategy||"auto",_=new RegExp(U5.source,"g");if(!(j!=="manual"&&_.test(K))){let L=await I0(K,U,X,Y,w);for(let O=0;O<L.length;O+=J)G.enqueue(L.slice(O,O+J)),await new Promise((F)=>setTimeout(F,0))}else{let L=[],O=new RegExp(U5.source,"g"),F;while((F=O.exec(K))!==null)L.push({name:F[1],content:F[2],start:F.index,end:F.index+F[0].length});let V=0;for(let A of L){if(A.start>V){let N=K.slice(V,A.start);if(N.trim()){let T=await I0(N,U,X,Y,w);G.enqueue(T),await new Promise((M)=>setTimeout(M,0))}}let R=await I0(A.content,U,X,Y,w);G.enqueue(R),await new Promise((N)=>setTimeout(N,0)),V=A.end}if(V<K.length){let A=K.slice(V);if(A.trim()){let R=await I0(A,U,X,Y,w);G.enqueue(R)}}}}else{let j=new Map;for(let H of z)if(H.type==="shell"||H.type==="content"){let L=await I0(H.content,U,X,Y,w);G.enqueue(L)}else if(H.type==="suspense"&&H.name){let L=`stx-suspense-${H.name}`;G.enqueue(`<div id="${L}" data-suspense="${H.name}" style="display:contents;">
13520
13520
  <template data-suspense-fallback>Loading...</template>
13521
- </div>`),j.set(H.name,I0(H.content,W,X,Y,w))}G.enqueue(`
13521
+ </div>`),j.set(H.name,I0(H.content,U,X,Y,w))}G.enqueue(`
13522
13522
  <script>
13523
13523
  (function() {
13524
13524
  window.__stxSuspense = window.__stxSuspense || {
@@ -13534,13 +13534,13 @@ ${J}`)}function MG(X,$){let Z=X;return Z=Z.replace(/<script(?![^>]*\ssrc=)([^>]*
13534
13534
  }
13535
13535
  };
13536
13536
  })();
13537
- </script>`);let _=Array.from(j.entries()).map(async([H,O])=>{G.enqueue(await $3(H,O))});await Promise.all(_)}G.close()}catch(Q){G.error(Q)}}})}async function $3(X,$){try{let Y=(await $).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
13537
+ </script>`);let _=Array.from(j.entries()).map(async([H,L])=>{G.enqueue(await $3(H,L))});await Promise.all(_)}G.close()}catch(Q){G.error(Q)}}})}async function $3(X,$){try{let Y=(await $).replace(/`/g,"\\`").replace(/<\/script>/gi,"<\\/script>");return`
13538
13538
  <script>
13539
13539
  window.__stxSuspense.resolve('${X}', \`${Y}\`);
13540
13540
  </script>`}catch(Z){let Y=Z instanceof Error?Z.message:String(Z);return`
13541
13541
  <script>
13542
13542
  window.__stxSuspense.resolve('${X}', '<div class="stx-error">Error loading content: ${G1(Y)}</div>');
13543
- </script>`}}function l_(X,$,Z){if(!$||$<=0)return X;let Y,J=new Promise((G,Q)=>{Y=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${$}ms`)),$)});return Promise.race([X,J]).finally(()=>clearTimeout(Y))}function c_(X,$=[],Z={}){let Y=Z.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue(X),$.length>0)J.enqueue(oG),await Promise.all($.map(async(G)=>{let Q=l_(G.render(),Y,G.id);J.enqueue(await $3(G.id,Q))}));J.close()}catch(G){J.error(G)}}})}function i_(X,$){return X.replace(p_,(Z,Y,J)=>{let G=Y.trim(),Q=J.split(/@fallback/i),q=Q[0].trim(),K=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!$.__streamTemplates)$.__streamTemplates={};return $.__streamTemplates[G]=q,`<div data-suspense="${G}">${K}</div>`})}function n_(X){let $=X?.streamBoundaries;if(!$||typeof $!=="object")return;let Z=Object.entries($).filter(([,Y])=>typeof Y==="function");return Z.length>0?Z.map(([Y,J])=>({id:Y,render:J})):void 0}async function r_(X,$={},Z={}){let Y={...q5,...Z,streaming:{...X3,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),q=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),K=q?q[1]:"",U=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),W={...$,__filename:X,__dirname:r8.dirname(X)};if(K.trim())await e1(K,W,X);let z=new Set,w=Y.streaming?.strategy||"auto",B=new RegExp(W5.source,"g");if(!(w!=="manual"&&B.test(U))){let _=await I0(U,W,X,Y,z);for(let H=0;H<_.length;H+=J)G.enqueue(_.slice(H,H+J))}else{let _=[],H=new RegExp(W5.source,"g"),O;while((O=H.exec(U))!==null)_.push({name:O[1],content:O[2],start:O.index,end:O.index+O[0].length});let L=0;for(let F of _){if(F.start>L){let A=U.slice(L,F.start);if(A.trim()){let R=await I0(A,W,X,Y,z);G.enqueue(R)}}let V=await I0(F.content,W,X,Y,z);G.enqueue(V),L=F.end}if(L<U.length){let F=U.slice(L);if(F.trim()){let V=await I0(F,W,X,Y,z);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function o_(X,$={}){let Z={...q5,...$,streaming:{...X3,...$.streaming}},Y=await Bun.file(X).text(),J=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=J?J[1]:"",Q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),q=Q,K={},U;W5.lastIndex=0;while((U=W5.exec(Q))!==null){let w=U[1],B=U[2];K[w]=B}let W=Q.replace(W5,"");return{renderShell:async(w={})=>{let B={...w,__filename:X,__dirname:r8.dirname(X)};return await e1(G,B,X),I0(W,B,X,Z,new Set)},renderSection:async(w,B={})=>{try{if(!K[w])return`<div class="error-message">Section "${G1(w)}" not found in template "${G1(X)}"</div>`;let j={...B,__filename:X,__dirname:r8.dirname(X)};await e1(G,j,X);let _=new Set;return await I0(K[w],j,X,Z,_)}catch(j){let _=j instanceof Error?j.message:String(j);return j0("Expression",_,X,K[w]||"",0,K[w]||"")}},getSections:()=>{return Object.keys(K)},getTemplate:()=>{return q}}}function s_(X={}){let $=[];if(X.streaming?.enabled)$.push(sG);if(X.hydration?.enabled)$.push(aG);return $}async function a_(X,$,Z,Y={}){return X}function t_(X,$={}){let Z=new TextEncoder,Y=X.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),J=new Headers($.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(Y,{...$,headers:J})}function e_(X={mode:"full"}){let{mode:$,components:Z={},dynamicImports:Y=!0}=X,J=Object.entries(Z).map(([G,Q])=>`'${G}': ${Y?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
13543
+ </script>`}}function p_(X,$,Z){if(!$||$<=0)return X;let Y,J=new Promise((G,Q)=>{Y=setTimeout(()=>Q(Error(`streaming boundary "${Z}" timed out after ${$}ms`)),$)});return Promise.race([X,J]).finally(()=>clearTimeout(Y))}function i_(X,$=[],Z={}){let Y=Z.timeoutMs??0;return new ReadableStream({async start(J){try{if(J.enqueue(X),$.length>0)J.enqueue(oG),await Promise.all($.map(async(G)=>{let Q=p_(G.render(),Y,G.id);J.enqueue(await $3(G.id,Q))}));J.close()}catch(G){J.error(G)}}})}function r_(X,$){return X.replace(n_,(Z,Y,J)=>{let G=Y.trim(),Q=J.split(/@fallback/i),q=Q[0].trim(),W=Q.length>1?Q.slice(1).join("@fallback").trim():"";if(!$.__streamTemplates)$.__streamTemplates={};return $.__streamTemplates[G]=q,`<div data-suspense="${G}">${W}</div>`})}function o_(X){let $=X?.streamBoundaries;if(!$||typeof $!=="object")return;let Z=Object.entries($).filter(([,Y])=>typeof Y==="function");return Z.length>0?Z.map(([Y,J])=>({id:Y,render:J})):void 0}async function s_(X,$={},Z={}){let Y={...q5,...Z,streaming:{...X3,...Z.streaming}},J=Y.streaming?.bufferSize||16384;return new ReadableStream({async start(G){try{let Q=await Bun.file(X).text(),q=Q.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),W=q?q[1]:"",K=Q.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),U={...$,__filename:X,__dirname:r8.dirname(X)};if(W.trim())await e1(W,U,X);let z=new Set,w=Y.streaming?.strategy||"auto",B=new RegExp(U5.source,"g");if(!(w!=="manual"&&B.test(K))){let _=await I0(K,U,X,Y,z);for(let H=0;H<_.length;H+=J)G.enqueue(_.slice(H,H+J))}else{let _=[],H=new RegExp(U5.source,"g"),L;while((L=H.exec(K))!==null)_.push({name:L[1],content:L[2],start:L.index,end:L.index+L[0].length});let O=0;for(let F of _){if(F.start>O){let A=K.slice(O,F.start);if(A.trim()){let R=await I0(A,U,X,Y,z);G.enqueue(R)}}let V=await I0(F.content,U,X,Y,z);G.enqueue(V),O=F.end}if(O<K.length){let F=K.slice(O);if(F.trim()){let V=await I0(F,U,X,Y,z);G.enqueue(V)}}}G.close()}catch(Q){G.error(Q)}}})}async function a_(X,$={}){let Z={...q5,...$,streaming:{...X3,...$.streaming}},Y=await Bun.file(X).text(),J=Y.match(/<script\b[^>]*\bserver\b[^>]*>([\s\S]*?)<\/script>/i),G=J?J[1]:"",Q=Y.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),q=Q,W={},K;U5.lastIndex=0;while((K=U5.exec(Q))!==null){let w=K[1],B=K[2];W[w]=B}let U=Q.replace(U5,"");return{renderShell:async(w={})=>{let B={...w,__filename:X,__dirname:r8.dirname(X)};return await e1(G,B,X),I0(U,B,X,Z,new Set)},renderSection:async(w,B={})=>{try{if(!W[w])return`<div class="error-message">Section "${G1(w)}" not found in template "${G1(X)}"</div>`;let j={...B,__filename:X,__dirname:r8.dirname(X)};await e1(G,j,X);let _=new Set;return await I0(W[w],j,X,Z,_)}catch(j){let _=j instanceof Error?j.message:String(j);return j0("Expression",_,X,W[w]||"",0,W[w]||"")}},getSections:()=>{return Object.keys(W)},getTemplate:()=>{return q}}}function t_(X={}){let $=[];if(X.streaming?.enabled)$.push(sG);if(X.hydration?.enabled)$.push(aG);return $}async function e_(X,$,Z,Y={}){return X}function XH(X,$={}){let Z=new TextEncoder,Y=X.pipeThrough(new TransformStream({transform(G,Q){Q.enqueue(Z.encode(G))}})),J=new Headers($.headers);if(!J.has("Content-Type"))J.set("Content-Type","text/html; charset=utf-8");if(!J.has("Transfer-Encoding"))J.set("Transfer-Encoding","chunked");if(!J.has("X-Content-Type-Options"))J.set("X-Content-Type-Options","nosniff");if(!J.has("X-Accel-Buffering"))J.set("X-Accel-Buffering","no");return new Response(Y,{...$,headers:J})}function $H(X={mode:"full"}){let{mode:$,components:Z={},dynamicImports:Y=!0}=X,J=Object.entries(Z).map(([G,Q])=>`'${G}': ${Y?`() => import('${Q}')`:`require('${Q}')`}`).join(`,
13544
13544
  `);if($==="loader")return`
13545
13545
  (function() {
13546
13546
  window.__stx = window.__stx || {};
@@ -13682,7 +13682,7 @@ else {
13682
13682
  else {
13683
13683
  stx.hydrate();
13684
13684
  }
13685
- })();`}var X3,W5,rG,oG=`
13685
+ })();`}var X3,U5,rG,oG=`
13686
13686
  <script>
13687
13687
  (function(){
13688
13688
  window.__stxSuspense = window.__stxSuspense || {
@@ -13702,25 +13702,25 @@ else {
13702
13702
  }
13703
13703
  };
13704
13704
  })();
13705
- </script>`,p_,sG,aG;var Y3=E(()=>{T1();Q1();K8();H0();X3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},W5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,rG=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;p_=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;sG={name:"suspense",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Suspense directive requires a name parameter");let J=$[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${X}<!-- @endsuspense:${J} -->`}},aG={name:"island",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Island directive requires a name parameter");let J=$[0].replace(/['"`]/g,""),G=$[1]?$[1].replace(/['"`]/g,""):"lazy",Q=`island-${J}-${Math.random().toString(36).substring(2,9)}`,q=X.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),K=q?q[1].trim():"",U=q?X.replace(q[0],""):X;return`<div data-island="${J}" data-island-id="${Q}" data-priority="${G}">
13706
- ${U}
13705
+ </script>`,n_,sG,aG;var Y3=E(()=>{T1();Q1();W8();H0();X3={enabled:!0,bufferSize:16384,strategy:"auto",timeout:30000},U5=/<!-- @section:([\w-]+) -->([\s\S]*?)<!-- @endsection:\1 -->/g,rG=/<!-- @suspense:([\w-]+) -->([\s\S]*?)<!-- @endsuspense:\1 -->/g;n_=/@stream\s*\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)@endstream/gi;sG={name:"suspense",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Suspense directive requires a name parameter");let J=$[0].replace(/['"`]/g,"");return`<!-- @suspense:${J} -->${X}<!-- @endsuspense:${J} -->`}},aG={name:"island",hasEndTag:!0,handler:(X,$,Z,Y)=>{if(!$||$.length===0)throw Error("Island directive requires a name parameter");let J=$[0].replace(/['"`]/g,""),G=$[1]?$[1].replace(/['"`]/g,""):"lazy",Q=`island-${J}-${Math.random().toString(36).substring(2,9)}`,q=X.match(/<script\s+props\s*>([\s\S]*?)<\/script>/i),W=q?q[1].trim():"",K=q?X.replace(q[0],""):X;return`<div data-island="${J}" data-island-id="${Q}" data-priority="${G}">
13706
+ ${K}
13707
13707
  <script type="application/json" data-island-props="${Q}">
13708
- ${K?`{${K}}`:"{}"}
13708
+ ${W?`{${W}}`:"{}"}
13709
13709
  </script>
13710
- </div>`}}});var XQ={};n(XQ,{warnUnbalancedTags:()=>J3,findUnbalancedTags:()=>eG});function u5(X){return X.replace(/[^\n]/g," ")}function eG(X){let $=X.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),Z=new Map,Y=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=J.exec($))!==null){let q=G[1]==="/",K=G[2],U=G[3]==="/";if(XH.has(K.toLowerCase()))continue;if(U)continue;if(q)Y.set(K,(Y.get(K)??0)+1);else{let W=Z.get(K);if(W)W.count++;else{let z=$.slice(0,G.index).split(`
13711
- `).length;Z.set(K,{count:1,firstLine:z})}}}let Q=[];for(let q of new Set([...Z.keys(),...Y.keys()])){if($H.has(q.toLowerCase()))continue;let K=Z.get(q)?.count??0,U=Y.get(q)??0;if(K!==U)Q.push({tag:q,opened:K,closed:U,firstOpenLine:Z.get(q)?.firstLine??0})}return Q}function J3(X,$){let Z;try{Z=eG(X)}catch{return}if(Z.length===0)return;let Y=`${$}:${X.length}`;if(tG.has(Y))return;tG.add(Y);let J=$?$.split(/[/\\]/).pop()||$:"template";for(let{tag:G,opened:Q,closed:q,firstOpenLine:K}of Z)if(Q>q){let U=K?` (first opened at line ${K})`:"";console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${q} closed \u2014 an unclosed <${G}>${U} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${q} closed \u2014 ${q-Q} stray </${G}>.`)}var XH,$H,tG;var G3=E(()=>{XH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),$H=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);tG=new Set});import s0 from"path";import Q3 from"fs";function $Q(X){return X.split("-").map(($)=>$.charAt(0).toUpperCase()+$.slice(1)).join("")}function ZQ(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class YQ{builtins=new Map;registerBuiltin(X){this.builtins.set(X.name.toLowerCase(),X);for(let $ of X.aliases)this.builtins.set($.toLowerCase(),X)}isBuiltin(X){return this.builtins.has(X.toLowerCase())}getBuiltin(X){return this.builtins.get(X.toLowerCase())??null}async resolveFile(X,$,Z,Y){let J=X.endsWith(".stx")?X.slice(0,-4):X,G=Y?.__importedComponents;if(G){let B=[J,J.toLowerCase(),$Q(J),ZQ(J)];for(let j of B)if(G.has(j))return G.get(j)}let Q=[...new Set([`${J}.stx`,`${$Q(J)}.stx`,`${ZQ(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let B=s0.resolve(s0.dirname($),`${J}.stx`);if(await p(B))return B;return null}let q=[],K=Z.componentsDir||"",U=Y?.__originalFilePath;if(U)q.push(s0.join(s0.dirname(U),"components"));if(K)q.push(K);let W=s0.join(s0.dirname($),"components");if(!q.includes(W))q.push(W);let z=process.cwd(),w=[s0.resolve(z,"src/components"),s0.resolve(z,"components"),s0.resolve(import.meta.dir,"components")];for(let B of w)if(!q.includes(B))q.push(B);for(let B of q){if(!B)continue;for(let j of Q){let _=s0.join(B,j);if(await p(_))return _}try{if(!Q3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let _=Q3.readdirSync(B,{withFileTypes:!0});for(let H of _)if(H.isDirectory()){let O=s0.join(B,H.name);for(let L of Q){let F=s0.join(O,L);if(await p(F))return F}}}catch{}}return null}}var l0;var q3=E(()=>{H0();l0=new YQ});function L0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function K3(X){return X.indexOf("\x00")===-1?X:X.replace(/\0/g,"")}var z5="\x00stx-boolean-attribute";function d5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.static)){if($.has(Y))continue;let G=X.staticNames?.[Y]??Y;if(typeof J==="boolean"){if(J)Z.push(L0(G));continue}if(J===z5){Z.push(L0(G));continue}Z.push(`${L0(G)}="${L0(K3(String(J)))}"`)}return Z}function m5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.serverDynamic??{})){if($.has(Y))continue;if(J===null||J===void 0||J===!1)continue;let G=X.serverDynamicNames?.[Y]??Y;if(J===!0){Z.push(L0(G));continue}if(typeof J==="object")continue;Z.push(`${L0(G)}="${L0(K3(String(J)))}"`)}return Z}var o8=()=>{};function n7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function ZH(X){if(X.clientReactive.to)return{value:X.clientReactive.to,reactive:!0};if(X.serverDynamic.to!==void 0)return{value:String(X.serverDynamic.to),reactive:!1};if(typeof X.static.to==="string")return{value:X.static.to,reactive:!1};return{value:"#",reactive:!1}}var U3;var W3=E(()=>{o8();U3={name:"StxLink",aliases:["stx-link"],render(X,$,Z){let Y=ZH(X),J=(typeof X.static.class==="string"?X.static.class:"")||(typeof X.static.className==="string"?X.static.className:""),G=typeof X.static.activeClass==="string"?X.static.activeClass:"active",Q=typeof X.static.exactActiveClass==="string"?X.static.exactActiveClass:"exact-active",q=X.static.prefetch===!0||X.static.prefetch==="true"||X.serverDynamic.prefetch===!0,K=[];if(Y.reactive)K.push(`:href="${n7(Y.value)}"`);else K.push(`href="${n7(Y.value)}"`);if(J)K.push(`class="${n7(J)}"`);if(K.push("data-stx-link"),K.push(`data-stx-active-class="${n7(G)}"`),K.push(`data-stx-exact-active-class="${n7(Q)}"`),q)K.push("data-stx-prefetch");let U=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return K.push(...d5(X,U)),K.push(...m5(X,U)),`<a ${K.join(" ")}>${$}</a>`}}});function b0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function v0(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function w3(X,$,Z=!1){let Y=X.serverDynamic[$];if(Y!==void 0)return Y!==!1&&Y!=="false";let J=X.static[$];if(J!==void 0)return J!=="false"&&J!==!1;return Z}function JQ(X){if(X.includes("(")||X.includes(","))return X;let $=X.trim().split(/\s+/),Z=[];for(let Y of $)if(Y.includes(":")){let[J,G]=Y.split(":"),Q=YH[J];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let q=Number.parseInt(J);if(!Number.isNaN(q))Z.push(`(max-width: ${q}px) ${G}`)}}else Z.push(Y);return Z.join(", ")}function j3(X,$,Z,Y){return $.map((J)=>`${r7(X,J,void 0,Z,Y)} ${J}w`).join(", ")}function JH(X,$,Z,Y,J){return $.map((G)=>{let Q=Z?Z*G:void 0;return`${r7(X,Q,void 0,Y,J)} ${G}x`}).join(", ")}function r7(X,$,Z,Y,J){if(!Y||Y==="local"||Y==="static")return X;if(Y==="cloudinary"){let G=[];if($)G.push(`w_${$}`);if(Z)G.push(`h_${Z}`);if(J)G.push(`f_${J}`);G.push("q_auto");let Q=G.join(",");return X.replace("/upload/",`/upload/${Q}/`)}if(Y==="imgix"){let G=new URLSearchParams;if($)G.set("w",String($));if(Z)G.set("h",String(Z));if(J)G.set("fm",J);G.set("auto","format");let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}if(Y==="bunny"){let G=new URLSearchParams;if($)G.set("width",String($));if(Z)G.set("height",String(Z));if(J)G.set("format",J);let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}return X}function GH(X,$,Z="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${$}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var YH,z3,B3;var _3=E(()=>{o8();YH={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},z3=[320,640,768,1024,1280,1536,1920];B3={name:"StxImage",aliases:["stx-image","stx-img"],render(X,$,Z){let Y=v0(X,"src")||"",J=v0(X,"alt")||"",G=v0(X,"width"),Q=v0(X,"height"),q=v0(X,"sizes"),K=v0(X,"srcset"),U=v0(X,"densities"),W=v0(X,"format"),z=v0(X,"placeholder"),w=v0(X,"placeholderColor")||"#e5e7eb",B=v0(X,"provider"),j=v0(X,"class")||v0(X,"className")||"",_=v0(X,"style")||"",H=v0(X,"quality"),O=w3(X,"lazy",!0),L=w3(X,"preload",!1),F=w3(X,"picture",!1)||!!W,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=K||"",N="";if(!R&&q)R=j3(Y,z3,B,W),N=JQ(q);else if(!R&&U){let b=U.split(/\s+/).map((y)=>Number.parseFloat(y.replace("x","")));R=JH(Y,b,V,B,W)}else if(q)N=JQ(q);let T=[];if(_)T.push(_);if(V&&A)T.push(`aspect-ratio:${V}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let b=GH(V||16,A||9,w);T.push(`background-image:url(${b})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${b0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=r7(Y,V,A,B,W),k=[];if(k.push(`src="${b0(M)}"`),k.push(`alt="${b0(J)}"`),G)k.push(`width="${b0(G)}"`);if(Q)k.push(`height="${b0(Q)}"`);if(O)k.push('loading="lazy"');if(k.push('decoding="async"'),j)k.push(`class="${b0(j)}"`);if(T.length>0)k.push(`style="${b0(T.join(";"))}"`);if(R)k.push(`srcset="${b0(R)}"`);if(N)k.push(`sizes="${b0(N)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);k.push(...d5(X,D)),k.push(...m5(X,D));let I=`<img ${k.join(" ")} />`,S="";if(L){let y=W==="webp"?"image/webp":W==="avif"?"image/avif":"";S=`<link rel="preload" as="image" href="${b0(M)}"${y?` type="${y}"`:""}${R?` imagesrcset="${b0(R)}"`:""}${N?` imagesizes="${b0(N)}"`:""} />
13712
- `}if(F){let b=[];if(W==="avif"||W==="auto"){let y=r7(Y,V,A,B,"avif"),P=R?j3(Y,z3,B,"avif"):`${y}`;b.push(`<source type="image/avif" srcset="${b0(P)}"${N?` sizes="${b0(N)}"`:""} />`)}if(W==="webp"||W==="auto"){let y=r7(Y,V,A,B,"webp"),P=R?j3(Y,z3,B,"webp"):`${y}`;b.push(`<source type="image/webp" srcset="${b0(P)}"${N?` sizes="${b0(N)}"`:""} />`)}return`${S}<picture>
13710
+ </div>`}}});var XQ={};i(XQ,{warnUnbalancedTags:()=>J3,findUnbalancedTags:()=>eG});function u5(X){return X.replace(/[^\n]/g," ")}function eG(X){let $=X.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),Z=new Map,Y=new Map,J=/<(\/?)([A-Za-z][\w-]*)\b(?:[^>"']|"[^"]*"|'[^']*')*?(\/?)>/g,G;while((G=J.exec($))!==null){let q=G[1]==="/",W=G[2],K=G[3]==="/";if(ZH.has(W.toLowerCase()))continue;if(K)continue;if(q)Y.set(W,(Y.get(W)??0)+1);else{let U=Z.get(W);if(U)U.count++;else{let z=$.slice(0,G.index).split(`
13711
+ `).length;Z.set(W,{count:1,firstLine:z})}}}let Q=[];for(let q of new Set([...Z.keys(),...Y.keys()])){if(YH.has(q.toLowerCase()))continue;let W=Z.get(q)?.count??0,K=Y.get(q)??0;if(W!==K)Q.push({tag:q,opened:W,closed:K,firstOpenLine:Z.get(q)?.firstLine??0})}return Q}function J3(X,$){let Z;try{Z=eG(X)}catch{return}if(Z.length===0)return;let Y=`${$}:${X.length}`;if(tG.has(Y))return;tG.add(Y);let J=$?$.split(/[/\\]/).pop()||$:"template";for(let{tag:G,opened:Q,closed:q,firstOpenLine:W}of Z)if(Q>q){let K=W?` (first opened at line ${W})`:"";console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${q} closed \u2014 an unclosed <${G}>${K} may swallow the content that follows it.`)}else console.warn(`[stx] ${J}: <${G}> ${Q} opened, ${q} closed \u2014 ${q-Q} stray </${G}>.`)}var ZH,YH,tG;var G3=E(()=>{ZH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),YH=new Set(["html","head","body","p","li","dt","dd","rt","rp","option","optgroup","thead","tbody","tfoot","tr","td","th","colgroup","caption"]);tG=new Set});import s0 from"path";import Q3 from"fs";function $Q(X){return X.split("-").map(($)=>$.charAt(0).toUpperCase()+$.slice(1)).join("")}function ZQ(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}class YQ{builtins=new Map;registerBuiltin(X){this.builtins.set(X.name.toLowerCase(),X);for(let $ of X.aliases)this.builtins.set($.toLowerCase(),X)}isBuiltin(X){return this.builtins.has(X.toLowerCase())}getBuiltin(X){return this.builtins.get(X.toLowerCase())??null}async resolveFile(X,$,Z,Y){let J=X.endsWith(".stx")?X.slice(0,-4):X,G=Y?.__importedComponents;if(G){let B=[J,J.toLowerCase(),$Q(J),ZQ(J)];for(let j of B)if(G.has(j))return G.get(j)}let Q=[...new Set([`${J}.stx`,`${$Q(J)}.stx`,`${ZQ(J)}.stx`])];if(J.startsWith("./")||J.startsWith("../")){let B=s0.resolve(s0.dirname($),`${J}.stx`);if(await t(B))return B;return null}let q=[],W=Z.componentsDir||"",K=Y?.__originalFilePath;if(K)q.push(s0.join(s0.dirname(K),"components"));if(W)q.push(W);let U=s0.join(s0.dirname($),"components");if(!q.includes(U))q.push(U);let z=process.cwd(),w=[s0.resolve(z,"src/components"),s0.resolve(z,"components"),s0.resolve(import.meta.dir,"components")];for(let B of w)if(!q.includes(B))q.push(B);for(let B of q){if(!B)continue;for(let j of Q){let _=s0.join(B,j);if(await t(_))return _}try{if(!Q3.statSync(B,{throwIfNoEntry:!1})?.isDirectory())continue;let _=Q3.readdirSync(B,{withFileTypes:!0});for(let H of _)if(H.isDirectory()){let L=s0.join(B,H.name);for(let O of Q){let F=s0.join(L,O);if(await t(F))return F}}}catch{}}return null}}var l0;var q3=E(()=>{H0();l0=new YQ});function O0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function W3(X){return X.indexOf("\x00")===-1?X:X.replace(/\0/g,"")}var z5="\x00stx-boolean-attribute";function d5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.static)){if($.has(Y))continue;let G=X.staticNames?.[Y]??Y;if(typeof J==="boolean"){if(J)Z.push(O0(G));continue}if(J===z5){Z.push(O0(G));continue}Z.push(`${O0(G)}="${O0(W3(String(J)))}"`)}return Z}function m5(X,$){let Z=[];for(let[Y,J]of Object.entries(X.serverDynamic??{})){if($.has(Y))continue;if(J===null||J===void 0||J===!1)continue;let G=X.serverDynamicNames?.[Y]??Y;if(J===!0){Z.push(O0(G));continue}if(typeof J==="object")continue;Z.push(`${O0(G)}="${O0(W3(String(J)))}"`)}return Z}var o8=()=>{};function n7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function JH(X){if(X.clientReactive.to)return{value:X.clientReactive.to,reactive:!0};if(X.serverDynamic.to!==void 0)return{value:String(X.serverDynamic.to),reactive:!1};if(typeof X.static.to==="string")return{value:X.static.to,reactive:!1};return{value:"#",reactive:!1}}var K3;var U3=E(()=>{o8();K3={name:"StxLink",aliases:["stx-link"],render(X,$,Z){let Y=JH(X),J=(typeof X.static.class==="string"?X.static.class:"")||(typeof X.static.className==="string"?X.static.className:""),G=typeof X.static.activeClass==="string"?X.static.activeClass:"active",Q=typeof X.static.exactActiveClass==="string"?X.static.exactActiveClass:"exact-active",q=X.static.prefetch===!0||X.static.prefetch==="true"||X.serverDynamic.prefetch===!0,W=[];if(Y.reactive)W.push(`:href="${n7(Y.value)}"`);else W.push(`href="${n7(Y.value)}"`);if(J)W.push(`class="${n7(J)}"`);if(W.push("data-stx-link"),W.push(`data-stx-active-class="${n7(G)}"`),W.push(`data-stx-exact-active-class="${n7(Q)}"`),q)W.push("data-stx-prefetch");let K=new Set(["to","class","className","activeClass","exactActiveClass","prefetch"]);return W.push(...d5(X,K)),W.push(...m5(X,K)),`<a ${W.join(" ")}>${$}</a>`}}});function b0(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function v0(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function w3(X,$,Z=!1){let Y=X.serverDynamic[$];if(Y!==void 0)return Y!==!1&&Y!=="false";let J=X.static[$];if(J!==void 0)return J!=="false"&&J!==!1;return Z}function JQ(X){if(X.includes("(")||X.includes(","))return X;let $=X.trim().split(/\s+/),Z=[];for(let Y of $)if(Y.includes(":")){let[J,G]=Y.split(":"),Q=GH[J];if(Q)Z.push(`(max-width: ${Q}px) ${G}`);else{let q=Number.parseInt(J);if(!Number.isNaN(q))Z.push(`(max-width: ${q}px) ${G}`)}}else Z.push(Y);return Z.join(", ")}function j3(X,$,Z,Y){return $.map((J)=>`${r7(X,J,void 0,Z,Y)} ${J}w`).join(", ")}function QH(X,$,Z,Y,J){return $.map((G)=>{let Q=Z?Z*G:void 0;return`${r7(X,Q,void 0,Y,J)} ${G}x`}).join(", ")}function r7(X,$,Z,Y,J){if(!Y||Y==="local"||Y==="static")return X;if(Y==="cloudinary"){let G=[];if($)G.push(`w_${$}`);if(Z)G.push(`h_${Z}`);if(J)G.push(`f_${J}`);G.push("q_auto");let Q=G.join(",");return X.replace("/upload/",`/upload/${Q}/`)}if(Y==="imgix"){let G=new URLSearchParams;if($)G.set("w",String($));if(Z)G.set("h",String(Z));if(J)G.set("fm",J);G.set("auto","format");let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}if(Y==="bunny"){let G=new URLSearchParams;if($)G.set("width",String($));if(Z)G.set("height",String(Z));if(J)G.set("format",J);let Q=X.includes("?")?"&":"?";return`${X}${Q}${G.toString()}`}return X}function qH(X,$,Z="#e5e7eb"){let Y=`<svg xmlns="http://www.w3.org/2000/svg" width="${X}" height="${$}"><rect width="100%" height="100%" fill="${Z}"/></svg>`;return`data:image/svg+xml;base64,${btoa(Y)}`}var GH,z3,B3;var _3=E(()=>{o8();GH={sm:640,md:768,lg:1024,xl:1280,"2xl":1536},z3=[320,640,768,1024,1280,1536,1920];B3={name:"StxImage",aliases:["stx-image","stx-img"],render(X,$,Z){let Y=v0(X,"src")||"",J=v0(X,"alt")||"",G=v0(X,"width"),Q=v0(X,"height"),q=v0(X,"sizes"),W=v0(X,"srcset"),K=v0(X,"densities"),U=v0(X,"format"),z=v0(X,"placeholder"),w=v0(X,"placeholderColor")||"#e5e7eb",B=v0(X,"provider"),j=v0(X,"class")||v0(X,"className")||"",_=v0(X,"style")||"",H=v0(X,"quality"),L=w3(X,"lazy",!0),O=w3(X,"preload",!1),F=w3(X,"picture",!1)||!!U,V=G?Number.parseInt(G):void 0,A=Q?Number.parseInt(Q):void 0,R=W||"",N="";if(!R&&q)R=j3(Y,z3,B,U),N=JQ(q);else if(!R&&K){let b=K.split(/\s+/).map((y)=>Number.parseFloat(y.replace("x","")));R=QH(Y,b,V,B,U)}else if(q)N=JQ(q);let T=[];if(_)T.push(_);if(V&&A)T.push(`aspect-ratio:${V}/${A}`);if(z==="blur"||z==="color"||z==="thumbhash"){let b=qH(V||16,A||9,w);T.push(`background-image:url(${b})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat")}else if(z&&z!=="empty"&&z!=="none")T.push(`background-image:url(${b0(z)})`),T.push("background-size:cover"),T.push("background-repeat:no-repeat");let M=r7(Y,V,A,B,U),k=[];if(k.push(`src="${b0(M)}"`),k.push(`alt="${b0(J)}"`),G)k.push(`width="${b0(G)}"`);if(Q)k.push(`height="${b0(Q)}"`);if(L)k.push('loading="lazy"');if(k.push('decoding="async"'),j)k.push(`class="${b0(j)}"`);if(T.length>0)k.push(`style="${b0(T.join(";"))}"`);if(R)k.push(`srcset="${b0(R)}"`);if(N)k.push(`sizes="${b0(N)}"`);let D=new Set(["src","alt","width","height","lazy","sizes","srcset","placeholder","placeholderColor","class","className","style","format","provider","quality","densities","preload","picture"]);k.push(...d5(X,D)),k.push(...m5(X,D));let I=`<img ${k.join(" ")} />`,S="";if(O){let y=U==="webp"?"image/webp":U==="avif"?"image/avif":"";S=`<link rel="preload" as="image" href="${b0(M)}"${y?` type="${y}"`:""}${R?` imagesrcset="${b0(R)}"`:""}${N?` imagesizes="${b0(N)}"`:""} />
13712
+ `}if(F){let b=[];if(U==="avif"||U==="auto"){let y=r7(Y,V,A,B,"avif"),P=R?j3(Y,z3,B,"avif"):`${y}`;b.push(`<source type="image/avif" srcset="${b0(P)}"${N?` sizes="${b0(N)}"`:""} />`)}if(U==="webp"||U==="auto"){let y=r7(Y,V,A,B,"webp"),P=R?j3(Y,z3,B,"webp"):`${y}`;b.push(`<source type="image/webp" srcset="${b0(P)}"${N?` sizes="${b0(N)}"`:""} />`)}return`${S}<picture>
13713
13713
  ${b.join(`
13714
13714
  `)}
13715
13715
  ${I}
13716
- </picture>`}return`${S}${I}`}}});function o7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function l5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var GQ="/images/safe-image-default.svg",QH,H3;var O3=E(()=>{o8();QH=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${GQ}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,H3={name:"SafeImage",aliases:["safe-image","safe-img"],render(X,$,Z){let Y=l5(X,"src")||"",J=l5(X,"alt")||"",G=l5(X,"fallback")||GQ,Q=l5(X,"class")||l5(X,"className")||"",q=l5(X,"fallbackClassName")||"",K=[];if(K.push(`src="${o7(Y)}"`),K.push(`alt="${o7(J)}"`),Q)K.push(`class="${o7(Q)}"`);if(K.push(`data-fallback="${o7(G)}"`),q)K.push(`data-fallback-class="${o7(q)}"`);K.push('onerror="window.__stxSafeImageHandler(this)"');let U=new Set(["src","alt","fallback","class","className","fallbackClassName"]);K.push(...d5(X,U)),K.push(...m5(X,U));let W=`<img ${K.join(" ")} />`,z=Z.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${QH}${W}`;return W}}});function L3(X){return X.replace(/[;{}()]/g,"").replace(/url/gi,"")}function s7(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function s8(X,$,Z){let Y=s7(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var F3;var V3=E(()=>{F3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(X,$,Z){let Y=L3(s7(X,"color")||"#6366f1"),J=L3(s7(X,"initialColor")||s7(X,"initial-color")||""),G=L3(s7(X,"height")||"3px"),Q=s8(X,"duration",2000),q=s8(X,"throttle",200),K=s8(X,"zIndex",999999)||s8(X,"z-index",999999),U=J?`linear-gradient(to right, ${J}, ${Y})`:Y;return`
13717
- <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${G};background:${U};z-index:${K};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
13716
+ </picture>`}return`${S}${I}`}}});function o7(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function l5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var GQ="/images/safe-image-default.svg",WH,H3;var L3=E(()=>{o8();WH=`<script>window.__stxSafeImageHandler||(window.__stxSafeImageHandler=function(i){if(i.__stx_fb)return;i.__stx_fb=1;var f=i.getAttribute('data-fallback')||'${GQ}';var c=i.getAttribute('data-fallback-class');i.src=f;if(c)i.className=c;});</script>`,H3={name:"SafeImage",aliases:["safe-image","safe-img"],render(X,$,Z){let Y=l5(X,"src")||"",J=l5(X,"alt")||"",G=l5(X,"fallback")||GQ,Q=l5(X,"class")||l5(X,"className")||"",q=l5(X,"fallbackClassName")||"",W=[];if(W.push(`src="${o7(Y)}"`),W.push(`alt="${o7(J)}"`),Q)W.push(`class="${o7(Q)}"`);if(W.push(`data-fallback="${o7(G)}"`),q)W.push(`data-fallback-class="${o7(q)}"`);W.push('onerror="window.__stxSafeImageHandler(this)"');let K=new Set(["src","alt","fallback","class","className","fallbackClassName"]);W.push(...d5(X,K)),W.push(...m5(X,K));let U=`<img ${W.join(" ")} />`,z=Z.context;if(!z.__safeImageHandlerEmitted)return z.__safeImageHandlerEmitted=!0,`${WH}${U}`;return U}}});function O3(X){return X.replace(/[;{}()]/g,"").replace(/url/gi,"")}function s7(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function s8(X,$,Z){let Y=s7(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var F3;var V3=E(()=>{F3={name:"StxLoadingIndicator",aliases:["stx-loading-indicator"],render(X,$,Z){let Y=O3(s7(X,"color")||"#6366f1"),J=O3(s7(X,"initialColor")||s7(X,"initial-color")||""),G=O3(s7(X,"height")||"3px"),Q=s8(X,"duration",2000),q=s8(X,"throttle",200),W=s8(X,"zIndex",999999)||s8(X,"z-index",999999),K=J?`linear-gradient(to right, ${J}, ${Y})`:Y;return`
13717
+ <div id="stx-loading-indicator" style="position:fixed;top:0;left:0;right:0;height:${G};background:${K};z-index:${W};transform:scaleX(0);transform-origin:left;transition:transform 0.1s ease-out,opacity 0.3s ease;opacity:0;pointer-events:none">
13718
13718
  <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>
13719
13719
  </div>
13720
13720
  <style>@keyframes stx-shimmer{0%{transform:translateX(-100%)}100%{transform:translateX(100%)}}</style>
13721
13721
  <script>
13722
13722
  (function(){var el=document.getElementById('stx-loading-indicator'),p=0,l=!1,i=null;function u(v){p=Math.min(Math.max(v,0),100);if(el){el.style.opacity=p>0?'1':'0';el.style.transform='scaleX('+(p/100)+')'}}window.stxLoading={start:function(){l=!0;p=0;u(10);if(i)clearInterval(i);i=setInterval(function(){if(!l)return;var r=90-p,inc=Math.max(0.5,r*0.1);if(p<90)u(p+inc)},${q})},finish:function(){l=!1;if(i){clearInterval(i);i=null}u(100);setTimeout(function(){if(el)el.style.opacity='0';setTimeout(function(){p=0;if(el)el.style.transform='scaleX(0)'},300)},200)},set:function(v){u(v)},clear:function(){l=!1;p=0;if(i){clearInterval(i);i=null}if(el){el.style.opacity='0';el.style.transform='scaleX(0)'}}};document.addEventListener('click',function(e){var a=e.target.closest&&e.target.closest('a');if(!a)return;var h=a.getAttribute('href');if(!h||h.startsWith('http')||h.startsWith('#')||h.startsWith('mailto:')||h.startsWith('tel:')||a.target==='_blank')return;window.stxLoading.start()});window.addEventListener('popstate',function(){window.stxLoading.start()});window.addEventListener('load',function(){window.stxLoading.finish()})})();
13723
- </script>`}}});function qQ(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function qH(X,$,Z){let Y=qQ(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var QQ,A3;var R3=E(()=>{QQ={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},A3={name:"StxToast",aliases:["stx-toast"],render(X,$,Z){let Y=L0(qQ(X,"position")||"top-right"),J=qH(X,"max",5),G=QQ[Y]||QQ["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${J}" style="position:fixed;${G};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
13723
+ </script>`}}});function qQ(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}function KH(X,$,Z){let Y=qQ(X,$);if(Y!==void 0){let J=Number.parseInt(Y,10);if(!Number.isNaN(J))return J}return Z}var QQ,A3;var R3=E(()=>{QQ={"top-right":"top:1rem;right:1rem","top-left":"top:1rem;left:1rem","top-center":"top:1rem;left:50%;transform:translateX(-50%)","bottom-right":"bottom:1rem;right:1rem","bottom-left":"bottom:1rem;left:1rem","bottom-center":"bottom:1rem;left:50%;transform:translateX(-50%)"},A3={name:"StxToast",aliases:["stx-toast"],render(X,$,Z){let Y=O0(qQ(X,"position")||"top-right"),J=KH(X,"max",5),G=QQ[Y]||QQ["top-right"];return`<div id="stx-toast-container" data-stx-toast-position="${Y}" data-stx-toast-max="${J}" style="position:fixed;${G};z-index:999999;display:flex;flex-direction:column;gap:0.5rem;pointer-events:none;max-width:24rem;width:100%"></div>
13724
13724
  <style>
13725
13725
  @keyframes stx-toast-in{from{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}
13726
13726
  @keyframes stx-toast-out{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(100%)}}
@@ -13728,8 +13728,8 @@ ${I}
13728
13728
  @keyframes stx-toast-out-left{from{opacity:1;transform:translateX(0)}to{opacity:0;transform:translateX(-100%)}}
13729
13729
  @keyframes stx-toast-in-center{from{opacity:0;transform:translateY(-1rem)}to{opacity:1;transform:translateY(0)}}
13730
13730
  @keyframes stx-toast-out-center{from{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(-1rem)}}
13731
- </style>`}}});function a8(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var KQ,N3;var T3=E(()=>{KQ={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)"},N3={name:"StxModal",aliases:["stx-modal"],render(X,$,Z){let Y=a8(X,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=L0(Y),G=a8(X,"size")||"md",Q=a8(X,"closeOnBackdrop")!=="false",q=a8(X,"closeOnEscape")!=="false",K=KQ[G]||KQ.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${Q}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
13732
- <div class="stx-modal-panel" style="${K};width:100%;margin:1rem;border-radius:0.75rem;box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow:hidden;transform:scale(0.95) translateY(8px);transition:transform 0.2s ease,opacity 0.2s ease;opacity:0;background:var(--stx-modal-bg,#fff);color:var(--stx-modal-text,#1f2937)">
13731
+ </style>`}}});function a8(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var WQ,N3;var T3=E(()=>{WQ={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)"},N3={name:"StxModal",aliases:["stx-modal"],render(X,$,Z){let Y=a8(X,"id");if(!Y)return console.warn('[stx] <StxModal> requires an "id" prop'),"<!-- StxModal: missing id prop -->";let J=O0(Y),G=a8(X,"size")||"md",Q=a8(X,"closeOnBackdrop")!=="false",q=a8(X,"closeOnEscape")!=="false",W=WQ[G]||WQ.md;return`<div id="stx-modal-${J}" class="stx-modal-backdrop" data-stx-modal="${J}" data-close-backdrop="${Q}" data-close-escape="${q}" style="display:none;position:fixed;inset:0;z-index:99999;align-items:center;justify-content:center;background:rgba(0,0,0,0.5);backdrop-filter:blur(2px);opacity:0;transition:opacity 0.2s ease" aria-modal="true" role="dialog">
13732
+ <div class="stx-modal-panel" style="${W};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)">
13733
13733
  <div style="padding:1.5rem">${$}</div>
13734
13734
  </div>
13735
13735
  </div>
@@ -13737,8 +13737,8 @@ ${I}
13737
13737
  @media(prefers-color-scheme:dark){[data-stx-modal]{--stx-modal-bg:#1f2937;--stx-modal-text:#f3f4f6}}
13738
13738
  .stx-modal-backdrop[data-stx-modal-open]{display:flex!important;opacity:1}
13739
13739
  .stx-modal-backdrop[data-stx-modal-open] .stx-modal-panel{transform:scale(1) translateY(0);opacity:1}
13740
- </style>`}}});function c5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var UQ,M3;var k3=E(()=>{UQ={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},M3={name:"StxDrawer",aliases:["stx-drawer"],render(X,$,Z){let Y=c5(X,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=L0(Y),G=c5(X,"side")||"right",Q=c5(X,"size")||"md",q=c5(X,"closeOnBackdrop")!=="false",K=c5(X,"closeOnEscape")!=="false",U=c5(X,"overlay")!=="false",W=UQ[Q]||UQ.md,z=G==="left",w=z?"left:0":"right:0",B=z?"translateX(-100%)":"translateX(100%)",j=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${J}" class="stx-drawer-backdrop" data-stx-drawer="${J}" data-close-backdrop="${q}" data-close-escape="${K}" style="display:none;position:fixed;inset:0;z-index:99999;${U?"background:rgba(0,0,0,0.5);backdrop-filter:blur(2px)":"background:transparent;pointer-events:none"};opacity:0;transition:opacity 0.2s ease" role="dialog" aria-modal="true">
13741
- <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${w};width:${W};max-width:100vw;transform:${B};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
13740
+ </style>`}}});function c5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);let Z=X.static[$];if(typeof Z==="string")return Z;return}var KQ,M3;var k3=E(()=>{KQ={sm:"16rem",md:"24rem",lg:"32rem",xl:"40rem"},M3={name:"StxDrawer",aliases:["stx-drawer"],render(X,$,Z){let Y=c5(X,"id");if(!Y)return console.warn('[stx] <StxDrawer> requires an "id" prop'),"<!-- StxDrawer: missing id prop -->";let J=O0(Y),G=c5(X,"side")||"right",Q=c5(X,"size")||"md",q=c5(X,"closeOnBackdrop")!=="false",W=c5(X,"closeOnEscape")!=="false",K=c5(X,"overlay")!=="false",U=KQ[Q]||KQ.md,z=G==="left",w=z?"left:0":"right:0",B=z?"translateX(-100%)":"translateX(100%)",j=z?"stx-drawer-slide-left":"stx-drawer-slide-right";return`<div id="stx-drawer-${J}" class="stx-drawer-backdrop" data-stx-drawer="${J}" data-close-backdrop="${q}" data-close-escape="${W}" style="display:none;position:fixed;inset:0;z-index:99999;${K?"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">
13741
+ <div class="stx-drawer-panel" style="position:fixed;top:0;bottom:0;${w};width:${U};max-width:100vw;transform:${B};transition:transform 0.3s cubic-bezier(0.4,0,0.2,1);background:var(--stx-drawer-bg,#fff);color:var(--stx-drawer-text,#1f2937);box-shadow:0 20px 60px rgba(0,0,0,0.3);overflow-y:auto;pointer-events:auto">
13742
13742
  <div style="padding:1.5rem">${$}</div>
13743
13743
  </div>
13744
13744
  </div>
@@ -13746,22 +13746,22 @@ ${I}
13746
13746
  @media(prefers-color-scheme:dark){[data-stx-drawer]{--stx-drawer-bg:#1f2937;--stx-drawer-text:#f3f4f6}}
13747
13747
  .stx-drawer-backdrop[data-stx-drawer-open]{display:block!important;opacity:1}
13748
13748
  .stx-drawer-backdrop[data-stx-drawer-open] .stx-drawer-panel{transform:translateX(0)}
13749
- </style>`}}});import{existsSync as KH,readFileSync as UH}from"fs";function WH(X){if(WQ.has(X))return;WQ.add(X),console.warn(`[stx] icon collection "${X}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${X}\`.`)}function zH(X){let $=process.cwd();for(let Z of[`${$}/node_modules/@iconify-json/${X}/icons.json`,`${$}/pantry/@iconify-json/${X}/icons.json`,`${$}/node_modules/@iconify/json/json/${X}.json`,`${$}/pantry/@iconify/json/json/${X}.json`])if(KH(Z))return Z;for(let Z of[`@iconify-json/${X}/icons.json`,`@iconify/json/json/${X}.json`])try{return W0.resolve(Z)}catch{}return null}function wH(X){if(t8.has(X))return t8.get(X);let $=zH(X);if(!$)return WH(X),null;try{let Z=JSON.parse(UH($,"utf8"));return t8.set(X,Z.icons),Z.icons}catch{return null}}function p5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);if(X.static[$]!==void 0)return String(X.static[$]);if(X.clientReactive[$]!==void 0)return X.clientReactive[$];return}var t8,WQ,I3;var E3=E(()=>{t8=new Map,WQ=new Set;I3={name:"Icon",aliases:["icon","stx-icon"],render(X,$,Z){let Y=p5(X,"name")??p5(X,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let J="lucide",G=Y;if(Y.includes(":")){let L=Y.split(":");J=L[0],G=L[1]}let Q=L0(p5(X,"size")||"24"),q=L0(p5(X,"color")||"currentColor"),K=L0(p5(X,"class")||""),U=L0(p5(X,"style")||""),W=t8.get(J)??wH(J);if(!W)return`<!-- Icon: collection "${J}" not loaded -->`;let z=W[G];if(!z)return`<!-- Icon: "${G}" not found in ${J} -->`;let w=z.width||24,B=z.height||24,j=`0 0 ${w} ${B}`,_=z.body;if(q!=="currentColor")_=_.replace(/currentColor/g,q);let H=K?` class="${K}"`:"",O=U?` style="${U}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${j}" fill="none"${H}${O}>${_}</svg>`}}});function zQ(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}function wQ(X,$){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${$}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=X.match(Z);if(!Y)return{region:null,rest:X};return{region:Y[2],rest:X.replace(Y[0],"")}}var D3;var y3=E(()=>{D3={name:"Suspense",aliases:["suspense"],render(X,$,Z){let Y=wQ($,"fallback"),J=Y.rest,G=wQ(J,"error"),Q=G.rest,q=Y.region??zQ(X,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',K=G.region??zQ(X,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${q}</div><div data-stx-suspense-error hidden>${K}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function e8(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}var b3;var S3=E(()=>{b3={name:"TransitionGroup",aliases:["transition-group"],render(X,$,Z){let Y=(e8(X,"name")||"v").replace(/["'<>]/g,""),J=(e8(X,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=e8(X,"class"),Q=e8(X,"id"),q=[`data-stx-transition-group="${Y}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${J} ${q}>${$}</${J}>`}}});function jQ(){l0.registerBuiltin(U3),l0.registerBuiltin(B3),l0.registerBuiltin(H3),l0.registerBuiltin(F3),l0.registerBuiltin(A3),l0.registerBuiltin(N3),l0.registerBuiltin(M3),l0.registerBuiltin(I3),l0.registerBuiltin(D3),l0.registerBuiltin(b3)}var BQ=E(()=>{W3();_3();O3();V3();R3();T3();k3();E3();y3();S3();q3();W3();_3();O3();V3();R3();T3();k3();E3();y3();S3()});function X$(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function _Q(X,$,Z){let Y=[],J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;let q=X.slice(G+1).match(new RegExp(`^(${$.source})(?![\\w.:-])`));if(!q){J=G+1;continue}let K=q[1];if(Z&&Z.has(K.toLowerCase())){let _=G+1+K.length;while(_<X.length&&X[_]!==">")_++;J=_+1;continue}let U=G+1+K.length,W=null,z=U,w=-1,B=!1;while(U<X.length){let _=X[U];if(W){if(_==="\\"&&U+1<X.length){U+=2;continue}if(_===W)W=null;U++;continue}if(_==='"'||_==="'"){W=_,U++;continue}if(_==="/"&&U+1<X.length&&X[U+1]===">"){w=U+2,B=!0;break}if(_===">"){w=U+1;break}U++}if(w===-1){J=G+1;continue}let j=X.slice(z,B?w-2:w-1).trim();if(B)Y.push({fullMatch:X.slice(G,w),tagName:K,attributes:j,content:"",startIndex:G,endIndex:w,isSelfClosing:!0}),J=w;else{let _=`<${K}`,H=`</${K}>`,O=1,L=w,F=-1;while(O>0&&L<X.length){let R=X.indexOf(_,L),N=X.indexOf(H,L);if(N===-1)break;if(R!==-1&&R<N){let T=X[R+_.length];if(T===" "||T===">"||T==="/"||T===`
13750
- `||T==="\t")O++;L=R+_.length}else{if(O--,O===0){F=N;break}L=N+H.length}}if(F===-1){J=w;continue}let V=X.slice(w,F),A=F+H.length;Y.push({fullMatch:X.slice(G,A),tagName:K,attributes:j,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function HQ(X){return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function OQ(X,$){try{let Z=Buffer.from(X,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=X.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if($?.debug)console.error("Error decoding __stx_ prop:",Z);return X}}var LQ=E(()=>{R0();H0();k1()});var MQ={};n(MQ,{processESImports:()=>NQ,processComponents:()=>Z$});import $$ from"fs";import n0 from"path";function BH(X,$,Z){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},J=new Set(Array.isArray($.__stx_client_signal_names)?$.__stx_client_signal_names:[]),G=(U)=>{if(J.size===0)return!1;let W=r0(U),z=W.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(z&&J.has(z))return!0;for(let w of J){let B=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(W))return!0}return!1},Q=new Set(N2),q=(U)=>{if(!U.includes("-")||U.startsWith("@")||U.startsWith(":")||U.startsWith("x-")||U.startsWith("__"))return U;if(U.startsWith("aria-")||U.startsWith("data-"))return U;return U.replace(/-([a-z0-9])/g,(W,z)=>z.toUpperCase())},K=(U,W)=>{let z=q(U);if(Y.static[z]=W,z!==U)Y.staticNames[z]=U};for(let[U,W]of Object.entries(X)){let z=U.startsWith("x-")&&!Q.has(U)&&!U.startsWith("x-bind:")&&!U.startsWith("x-on:")?`:${U.slice(2)}`:U;if(z.startsWith("@")){Y.events[z]=W;continue}if(z.startsWith("__stx_")){let w=q(z.slice(6));Y.serverDynamic[w]=OQ(W,Z);continue}if(z.startsWith(":")){let w=q(z.slice(1)),B=W===z5?w:W;if(w==="if"||w==="for"||w==="show"){Y.clientReactive[w]=B;continue}if(G(B)){Y.clientReactive[w]=B;continue}try{if(!G0(B)){if(Z.debug)console.error(`Unsafe expression in :${w} binding: ${B}`);Y.clientReactive[w]=B;continue}let j=Object.keys($),H=Q0(B,j)(...Object.values($));if(H===void 0){let O=B.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(O.some((V)=>!L.has(V)&&!j.includes(V))){Y.clientReactive[w]=B;continue}}if(Y.serverDynamic[w]=H,w!==z.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[w]=z.slice(1)}catch{Y.clientReactive[w]=B}continue}if(typeof W==="string"&&W.includes("{{")&&W.includes("}}")){let w=W.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(w)try{let B=w[1];if(G0(B)){let _=Q0(B,Object.keys($))(...Object.values($));K(z,_!=null?String(_):"")}else{if(Z.debug)console.error(`Unsafe expression in ${z}: ${B}`);K(z,W)}}catch(B){if(Z.debug)console.error(`Error evaluating expression for ${z}:`,B);K(z,W)}else{let B=W,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(W))!==null)try{let H=_[1];if(!G0(H)){if(Z.debug)console.error(`Unsafe expression in ${z}: ${H}`);continue}let L=Q0(H,Object.keys($))(...Object.values($));B=B.replace(_[0],String(L??""))}catch(H){if(Z.debug)console.error(`Error evaluating expression in ${z}:`,H)}K(z,B)}continue}K(z,W===z5?"true":HQ(W))}return Y}function HH(X,$,Z){if(!X.includes("@"))return X;if(!_H.some(([J,G])=>J.test(X)&&X.includes(G)))return X;try{return L1(X,$,Z)}catch{return X}}function OH(X){let $={},Z=0,Y=X.length;while(Z<Y){while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test(X[Z]))J+=X[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z<Y&&X[Z]==="="){Z++;while(Z<Y&&/\s/.test(X[Z]))Z++;let G="";if(Z<Y&&(X[Z]==='"'||X[Z]==="'")){let Q=X[Z];Z++;while(Z<Y){let q=X[Z];if(q==="\\"&&Z+1<Y){Z++,G+=X[Z],Z++;continue}if(q===Q){Z++;break}G+=q,Z++}}else while(Z<Y&&!/\s/.test(X[Z]))G+=X[Z],Z++;$[J]=G}else $[J]=z5}return $}function VQ(X){return Object.entries(X).map(([$,Z])=>Z===z5?$:`${$}="${LH(Z)}"`).join(" ")}function LH(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function FH(X){let $=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1];if(l0.isBuiltin(J))$.add(J)}return[...$].sort()}function VH(X){let $=AQ.get(X);if($)return $;let Z=new Map,Y=[n0.join(X,"src"),n0.join(X,"dist"),X];function J(G,Q){if(Q>6)return;let q;try{q=$$.readdirSync(G,{withFileTypes:!0})}catch{return}for(let K of q){let U=n0.join(G,K.name);if(K.isDirectory()){if(K.name==="node_modules"||K.name.startsWith("."))continue;J(U,Q+1)}else if(K.isFile()&&K.name.endsWith(".stx")){let W=K.name.slice(0,-4);if(!Z.has(W))Z.set(W,U);let z=W.toLowerCase();if(!Z.has(z))Z.set(z,U);let w=W.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(w))Z.set(w,U)}}}for(let G of Y)if(J(G,0),Z.size>0)break;return AQ.set(X,Z),Z}function AH(X,$){if(X.startsWith(".")||X.startsWith("/"))return null;let Z=$;while(!0){let Y=n0.join(Z,"node_modules",X);try{if($$.statSync(Y).isDirectory())return Y}catch{}let J=n0.dirname(Z);if(J===Z)return null;Z=J}}async function NQ(X,$,Z,Y,J){if(!X.includes("import"))return X;if(!$.__importedComponents)$.__importedComponents=new Map;let G=$.__importedComponents,Q=n0.dirname(Z),q=X,K=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(K,(U,W,z)=>{let w=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,_=[];while((j=w.exec(z))!==null){let[H,O,L,F]=j,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=n0.resolve(Q,F);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if($$.statSync(M).isFile())A=M}catch{try{if($$.statSync(T).isDirectory())V=T}catch{}}}}else V=AH(F,Q);if(!V&&!A)continue;let R=!1,N=(T,M)=>{G.set(T,M),G.set(T.toLowerCase(),M);let k=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(k,M),J.add(M)};if(L&&A)N(L,A),R=!0;else if(O){let T=O.slice(1,-1).split(",").map((k)=>k.trim()).filter(Boolean).map((k)=>{let D=k.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:k,local:k}}),M=V?VH(V):null;for(let{source:k,local:D}of T){let I=null;if(A)I=A;else if(M)I=M.get(k)??M.get(k.toLowerCase())??M.get(k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(D,I),R=!0}}if(R)_.push({start:j.index,end:j.index+H.length})}if(_.length===0)return U;for(let H=_.length-1;H>=0;H--)B=B.slice(0,_[H].start)+B.slice(_[H].end);return`<script${W}>${B}</script>`}),q}async function RH(X,$,Z,Y,J){let G=X;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,K;while((K=q.exec(G))!==null){let[U,W]=K,z=W.split(",").map((w)=>w.trim().replace(/^['"]|['"]$/g,"")).filter((w)=>w.length>0);for(let w of z){let B=w.split("/"),_=B[B.length-1].replace(/\.stx$/,""),H=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),O=null,L=[n0.resolve(n0.dirname(Z),`${w}.stx`),n0.resolve(n0.dirname(Z),w),n0.resolve(Y.componentsDir||"components",`${w}.stx`),n0.resolve(Y.componentsDir||"components",w),w.endsWith(".stx")?w:`${w}.stx`];for(let F of L)try{if(await Bun.file(F).exists()){O=F;break}}catch{}if(O){Q.set(H,O),Q.set(_,O),Q.set(_.toLowerCase(),O);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,O),J.add(O),Y.debug)console.log(`Imported component: ${H} -> ${O}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${w}`)}G=G.replace(U,""),q.lastIndex=0}return G}async function NH(X,$,Z,Y,J){let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let q=$.__processedComponents,K=/@component\s*\(/g,U;while((U=K.exec(G))!==null){let W=U.index,z=W+U[0].length-1,w=1,B=z+1;while(B<G.length&&w>0){if(G[B]==="(")w++;else if(G[B]===")"){if(w--,w===0)break}B++}if(w!==0)break;let j=G.substring(z+1,B),_=B+1,H=j.match(/^\s*['"]([^'"]+)['"]/);if(!H){K.lastIndex=0;continue}let O=H[1],L,F=j.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)L=F.slice(V[0].length).trim();let A={};if(L)try{A=A0(L,$)}catch(D){let I=D instanceof Error?D.message:String(D);G=G.replace(G.substring(W,_),`[Error parsing component props: ${I}]`);continue}let R="",N=_,M=G.substring(_).match(/^([\s\S]*?)@endcomponent/);if(M)R=M[1].trim(),N=_+M[0].length;let k=await Y5(O,A,R,Q,$,Z,Y,q,J);G=G.substring(0,W)+k+G.substring(N),K.lastIndex=0}return G}async function TH(X,$,Z,Y,J){if(!X)return X;let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let q=$.__processedComponents,K=J1(G);return G=K.output,G=await w(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await w(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await w(G,/[a-z][a-z0-9]*/,!1,jH),G=I5(G,K.scripts),G;async function w(B,j,_,H){if(!B)return B;let O=B,L=_Q(O,j,H);for(let F=L.length-1;F>=0;F--){let V=L[F],A=_?X$(V.tagName):V.tagName,R=OH(HH(V.attributes,$,Z)),N=BH(R,$,Y),T=l0.getBuiltin(V.tagName),M=T?await q8(A,Q,$,Z,Y):!1;if(T&&!M){let S={context:$,filePath:Z,options:Y,dependencies:J},b=T.render(N,V.content,S);if(Object.keys(N.clientReactive).length>0)b=RQ(b,N.clientReactive);if(Object.keys(N.events).length>0){let y=VQ(N.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}O=O.substring(0,V.startIndex)+b+O.substring(V.endIndex);continue}if(!_&&V.tagName.includes("-")&&!await q8(A,Q,$,Z,Y))continue;let k={};for(let[S,b]of Object.entries(N.static))k[S]=b;for(let[S,b]of Object.entries(N.serverDynamic))k[S]=b;let I=await Y5(A,k,I5(V.content,K.scripts),Q,$,Z,Y,q,J);if(Object.keys(N.clientReactive).length>0)I=RQ(I,N.clientReactive);if(Object.keys(N.events).length>0){let S=TQ(I);if(S){let b=VQ(N.events),y=Object.keys(N.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,S.insertPos)+` data-stx-parent-events="${y}" ${b}`+I.substring(S.insertPos)}}O=O.substring(0,V.startIndex)+I+O.substring(V.endIndex)}return O}}function RQ(X,$){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries($).filter(([W])=>!Z.has(W)),G=J.filter(([W])=>!Y.has(W)).map(([W])=>X$(W)).join(" "),Q=X,q=J.length>0?TQ(Q):null;if(q){let W=J.map(([w,B])=>`:${X$(w)}="${B.replace(/"/g,"&quot;")}"`).join(" "),z=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,q.insertPos)+`${z} ${W}`+Q.substring(q.insertPos)}let K=$.if;if(K)Q=`<template :if="${K.replace(/"/g,"&quot;")}">${Q}</template>`;let U=$.for;if(U)Q=`<template :for="${U.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function TQ(X){let $=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(X);if($)return{insertPos:$.index+1+$[1].length};let Z=0;while(Z<X.length){let Y=X.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let q=X.indexOf("-->",Z+4);if(q===-1)return null;Z=q+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let q=`</${G[1].toLowerCase()}>`,K=X.toLowerCase().indexOf(q,Z+G[0].length);if(K===-1)return null;Z=K+q.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function Z$(X,$,Z,Y,J){if(!FQ)jQ(),FQ=!0;let G=await NQ(X,$,Z,Y,J);G=await RH(G,$,Z,Y,J),G=await NH(G,$,Z,Y,J);let Q=[];for(let q=0;q<3;q++){let K=Y1(G,E7,(W,z)=>`\x00STX_COMPONENT_COMMENT_${Q.length+z}\x00`);Q.push(...K.tokens);let U=G;if(G=await TH(K.output,$,Z,Y,J),G===U)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,K)=>Q[Number(K)]??"");if(Y.debug){let q=FH(G);if(q.length>0)console.warn(`[stx] ${Z}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return G}var FQ=!1,jH,_H,AQ;var C3=E(()=>{q3();m7();BQ();LQ();k1();H0();R0();e0();jH=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);_H=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];AQ=new Map});var SQ={};n(SQ,{processLoops:()=>v3,parseLoopBinding:()=>P3});function IH(X,$){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index+G[0].length,q=G.index+G[0].indexOf("("),K=D0(X,"(",")",q);if(K===-1)continue;let U=X.slice(Q,K).trim();if(!U)continue;if(!Object.keys($).some((w)=>new RegExp(`(?:^|[^\\w$.])${w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(U)))continue;let z;try{let w=A0(U,$);if(!w||typeof w!=="object")continue;z=JSON.stringify(w)}catch{continue}Y+=X.slice(J,Q)+z,J=K,Z.lastIndex=K}return J===0?X:Y+X.slice(J)}function EH(X,$){let Z=/@component\s*\(/g,Y=X,J,G=[];while((J=Z.exec(Y))!==null){let Q=J.index,q=Q+J[0].length-1,K=1,U=q+1;while(U<Y.length&&K>0){if(Y[U]==="(")K++;else if(Y[U]===")"){if(K--,K===0)break}U++}if(K!==0)continue;let W=Y.substring(q+1,U),z=U+1,w=W.match(/^\s*['"]([^'"]+)['"]/);if(!w)continue;let B=w[1],j=W.slice(w[0].length),_=j.match(/^\s*,\s*/);if(!_)continue;let H=j.slice(_[0].length).trim();if(!H)continue;try{let O=A0(H,$),L=JSON.stringify(O),F=`@component('${B}', ${L})`;G.push({start:Q,end:z,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:q,end:K,replacement:U}=G[Q];Y=Y.substring(0,q)+U+Y.substring(K)}return Y}function Y$(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=J.exec(Y))!==null){let Q=G.index,q=Q+G[0].length-1,K=1,U=q+1,W=null,z=!1;while(U<Y.length&&K>0){let j=Y[U];if(z){z=!1,U++;continue}if(j==="\\"&&W){z=!0,U++;continue}if(W){if(j===W)W=null;U++;continue}if(j==='"'||j==="'"||j==="`"){W=j,U++;continue}if(j==="(")K++;else if(j===")"){if(K--,K===0)break}U++}if(K!==0)break;let w=Y.substring(q+1,U),B=Z(w);Y=Y.substring(0,Q)+B+Y.substring(U+1)}return Y}function DH(X,$){let Z=X;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,J)=>{if(J in $)return`:${J}="${J}"`;return Y}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,J,G)=>{try{let Q=Object.keys($),q=Object.values($);EX(G);let U=Q0(G,Q)(...q),W=JSON.stringify(U),z=Buffer.from(W,"utf8").toString("base64");return`__stx_${J}="${z}"`}catch(Q){return Y}}),Z}function yH(X,$){let Z=X;return Z=Y$(Z,"@break",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(G0(G)){let q=Q0(G,Object.keys($));Q=Boolean(q(...Object.values($)))}else Q=Boolean(J0(G,$));return Q?J$:""}catch{return""}}),Z=Y$(Z,"@continue",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(G0(G)){let q=Q0(G,Object.keys($));Q=Boolean(q(...Object.values($)))}else Q=Boolean(J0(G,$));return Q?G$:""}catch{return""}}),Z}function bH(X){let $=X;return $=$.replace(/@break(?!\()/g,J$),$=$.replace(/@continue(?!\()/g,G$),$}function kQ(X){let $=X.includes(J$),Z=$?X.substring(0,X.indexOf(J$)):X;return{hasBreak:$,content:Z}}function IQ(X){let $=X.includes(G$),Z=$?X.substring(0,X.indexOf(G$)):X;return{hasContinue:$,content:Z}}function DQ(X){let $=X;return $=Y$($,"@break",(Z)=>{let Y=Z.trim();if(!DX(Y))return"";return`\`; if (${Y}) { break; } result += \``}),$=Y$($,"@continue",(Z)=>{let Y=Z.trim();if(!DX(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),$=$.replace(/@break(?!\()/g,"`; break; result += `"),$=$.replace(/@continue(?!\()/g,"`; continue; result += `"),$}function SH(X){let $=/@forelse\s*\(/g,Z,Y=[],J=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=J.exec(X))!==null)Y.push({pos:Q.index,delta:1});while((Q=G.exec(X))!==null)Y.push({pos:Q.index,delta:-1});Y.sort((W,z)=>W.pos-z.pos);let q=[],K=0;for(let W of Y)K+=W.delta,q.push({pos:W.pos,depth:K});function U(W){let z=0,w=q.length-1,B=0;while(z<=w){let j=z+w>>1;if(q[j].pos<=W)B=q[j].depth,z=j+1;else w=j-1}return B}while((Z=$.exec(X))!==null){if(U(Z.index)>0)continue;let W=Z.index,z=Z.index+Z[0].length-1,w=1,B=z+1,j=-1;while(B<X.length&&w>0){if(X[B]==="(")w++;else if(X[B]===")"){if(w--,w===0){j=B;break}}B++}if(j===-1)continue;let _=X.substring(z+1,j),H=P3(_);if(!H)continue;let{arrayExpr:O,itemVar:L}=H,F=j+1,V=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(V>0&&A<X.length){R.lastIndex=A,N.lastIndex=A;let b=R.exec(X),y=N.exec(X);if(!y)break;if(b&&b.index<y.index)V++,A=b.index+b[0].length;else{if(V--,V===0){T=y.index;break}A=y.index+11}}if(T===-1)continue;let M=X.substring(F,T),k=T+11,D=-1,I=0,S=0;while(S<M.length){let b=M.indexOf("@",S);if(b===-1)break;let y=M.substring(b);if(/^@forelse\s*\(/.test(y))I++,S=b+1;else if(y.startsWith("@endforelse"))I--,S=b+11;else if(I===0&&y.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){D=b;break}S=b+1}else S=b+1}if(D===-1)continue;return{start:W,end:k,arrayExpr:O,itemVar:L,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function EQ(X,$){let Z=X;while(!0){let Y=SH(Z);if(!Y)break;let{start:J,end:G,arrayExpr:Q,itemVar:q,foreachContent:K,emptyContent:U}=Y;try{let W;if(G0(Q))W=Q0(Q,Object.keys($))(...Object.values($));else W=J0(Q,$);let z;if(!Array.isArray(W)||W.length===0)z=U;else z=`@foreach (${Q} as ${q})${K}@endforeach`;Z=Z.substring(0,J)+z+Z.substring(G)}catch(W){let z=W instanceof Error?W.message:String(W),w=Y0("Forelse",`Error in @forelse(${Q} as ${q}): ${z}`,s.EVALUATION_ERROR);Z=Z.substring(0,J)+w+Z.substring(G)}}return Z}function P3(X){let $=X.indexOf(" as ");if($!==-1){let G=X.slice(0,$).trim(),Q=X.slice($+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(X);if(!Z)return null;let Y=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Z[2].trim();return Y&&J?{arrayExpr:J,itemVar:Y}:null}function v3(X,$,Z,Y){let J=X;J=EQ(J,$);function G(K){let U=/@foreach\s*\(/g,W;while((W=U.exec(K))!==null){let z=W.index,w=W.index+W[0].length-1,B=1,j=w+1,_=-1;while(j<K.length&&B>0){if(K[j]==="(")B++;else if(K[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let H=K.substring(w+1,_),O=P3(H);if(!O)continue;let L=z,{arrayExpr:F,itemVar:V}=O,A=_+1,R=1,N=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(R>0&&N<K.length){T.lastIndex=N,M.lastIndex=N;let k=T.exec(K),D=M.exec(K);if(!D)break;if(k&&k.index<D.index)R++,N=k.index+k[0].length;else{if(R--,R===0){let I=K.substring(A,D.index),S=D.index+11;return{start:L,end:S,arrayExpr:F,itemVar:V,content:I}}N=D.index+11}}}return null}function Q(K,U){let W=K;while(!0){let z=G(W);if(!z)break;let{start:w,end:B,arrayExpr:j,itemVar:_,content:H}=z;try{let O=j.trim(),L;if(G0(O))L=Q0(O,Object.keys(U))(...Object.values(U));else L=J0(O,U);let F=!1;if(!Array.isArray(L))if(L instanceof Map)L=Array.from(L),F=!0;else if(L instanceof Set)L=Array.from(L);else if(typeof L==="string")L=Array.from(L);else if(L&&typeof L==="object"&&!(L instanceof Date)&&!(L instanceof RegExp))L=Object.entries(L),F=!0;else{console.warn(`[stx] @foreach(${O}) in ${Z}: ${O} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let D=Y0("Foreach",`Error in @foreach: ${O} is not iterable`,s.TYPE_ERROR);W=W.substring(0,w)+D+W.substring(B);continue}let V=Y?.loops?.useAltLoopVariable??kH,A=_.trim(),R=null,N,T=!1;if(A.includes("=>")){let D=A.split("=>").map((I)=>I.trim());if(D.length===2&&D[0]&&D[1])R=D[0],N=D[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((I)=>I.trim());if(D.length===2&&D[0]&&D[1])N=D[0],R=D[1],T=!0;else N=A}else N=A;let M="",k=L;for(let D=0;D<k.length;D++){let I=k[D],S={index:D,iteration:D+1,first:D===0,last:D===k.length-1,count:k.length},b={...U,loop:S,$loop:S};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((c)=>c.trim());if(Array.isArray(I))f.forEach((c,l)=>{if(c)b[c]=I[l]});else b[N]=I}else b[N]=I;if(R)if(!T&&F&&Array.isArray(I)&&I.length===2)b[R]=I[0],b[N]=I[1];else b[R]=D;let y=yH(H,b),P=IQ(y);if(P.hasContinue){M+=P.content;continue}let x=kQ(y);if(x.hasBreak){M+=x.content;break}if(y=EQ(y,b),y=Q(y,b),y=L1(y,b,Z),y=bH(y),x=kQ(y),x.hasBreak){M+=x.content;break}if(P=IQ(y),P.hasContinue){M+=P.content;continue}y=I1(y,b,Z),y=DH(y,b),y=EH(y,b),y=IH(y,b),M+=y}W=W.substring(0,w)+M+W.substring(B)}catch(O){let L=Y0("Foreach",`Error in @foreach(${j.trim()} as ${_.trim()}): ${O instanceof Error?O.message:String(O)}`,s.EVALUATION_ERROR);W=W.substring(0,w)+L+W.substring(B)}}return W}J=Q(J,$),J=bQ(J,$,Z,Y);let q=Y?.loops?.maxWhileIterations??MH;return J=vH(J,$,q),J}function yQ(X){return DX(X)}function bQ(X,$,Z,Y){let J=X,G=!0;while(G){G=!1;let Q=J.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let q=Q.index,K=q+Q[0].length-1,U=D0(J,"(",")",K);if(U===-1)break;let W=J.slice(K+1,U),z=U+1,w=gX(J.slice(q),"for","endfor");if(w.length===0)break;let B=w[0].content,j=q+w[0].end;if(!yQ(W)){let _=Y0("For",`Unsafe expression in @for: ${W}`,s.UNSAFE_EXPRESSION);J=J.substring(0,q)+_+J.substring(j),G=!0;continue}try{let _=CH(W),H=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&H){let R=PH({forExpr:W,content:B,iterVarNames:_,context:$,filePath:Z,options:Y});J=J.substring(0,q)+R+J.substring(j),G=!0;continue}let O=Object.keys($),L=Object.values($),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=DQ(F);let A=Function(...O,`
13749
+ </style>`}}});import{existsSync as UH,readFileSync as zH}from"fs";function wH(X){if(UQ.has(X))return;UQ.add(X),console.warn(`[stx] icon collection "${X}" is not installed, so its icons render as nothing. Install it with \`bun add -d @iconify-json/${X}\`.`)}function jH(X){let $=process.cwd();for(let Z of[`${$}/node_modules/@iconify-json/${X}/icons.json`,`${$}/pantry/@iconify-json/${X}/icons.json`,`${$}/node_modules/@iconify/json/json/${X}.json`,`${$}/pantry/@iconify/json/json/${X}.json`])if(UH(Z))return Z;for(let Z of[`@iconify-json/${X}/icons.json`,`@iconify/json/json/${X}.json`])try{return U0.resolve(Z)}catch{}return null}function BH(X){if(t8.has(X))return t8.get(X);let $=jH(X);if(!$)return wH(X),null;try{let Z=JSON.parse(zH($,"utf8"));return t8.set(X,Z.icons),Z.icons}catch{return null}}function p5(X,$){if(X.serverDynamic[$]!==void 0)return String(X.serverDynamic[$]);if(X.static[$]!==void 0)return String(X.static[$]);if(X.clientReactive[$]!==void 0)return X.clientReactive[$];return}var t8,UQ,I3;var E3=E(()=>{t8=new Map,UQ=new Set;I3={name:"Icon",aliases:["icon","stx-icon"],render(X,$,Z){let Y=p5(X,"name")??p5(X,"icon");if(!Y)return"<!-- Icon: missing name/icon prop -->";let J="lucide",G=Y;if(Y.includes(":")){let O=Y.split(":");J=O[0],G=O[1]}let Q=O0(p5(X,"size")||"24"),q=O0(p5(X,"color")||"currentColor"),W=O0(p5(X,"class")||""),K=O0(p5(X,"style")||""),U=t8.get(J)??BH(J);if(!U)return`<!-- Icon: collection "${J}" not loaded -->`;let z=U[G];if(!z)return`<!-- Icon: "${G}" not found in ${J} -->`;let w=z.width||24,B=z.height||24,j=`0 0 ${w} ${B}`,_=z.body;if(q!=="currentColor")_=_.replace(/currentColor/g,q);let H=W?` class="${W}"`:"",L=K?` style="${K}"`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${Q}" height="${Q}" viewBox="${j}" fill="none"${H}${L}>${_}</svg>`}}});function zQ(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}function wQ(X,$){let Z=new RegExp(`<(template|div|span)[^>]*\\bslot=["']${$}["'][^>]*>([\\s\\S]*?)<\\/\\1>`,"i"),Y=X.match(Z);if(!Y)return{region:null,rest:X};return{region:Y[2],rest:X.replace(Y[0],"")}}var D3;var y3=E(()=>{D3={name:"Suspense",aliases:["suspense"],render(X,$,Z){let Y=wQ($,"fallback"),J=Y.rest,G=wQ(J,"error"),Q=G.rest,q=Y.region??zQ(X,"fallback")??'<div class="stx-suspense-loading">Loading\u2026</div>',W=G.region??zQ(X,"errorFallback","error-fallback")??'<div class="stx-suspense-error">Something went wrong.</div>';return`<div data-stx-suspense><div data-stx-suspense-fallback>${q}</div><div data-stx-suspense-error hidden>${W}</div><div data-stx-suspense-content hidden>${Q}</div></div>`}}});function e8(X,...$){for(let Z of $){if(X.serverDynamic[Z]!==void 0)return String(X.serverDynamic[Z]);let Y=X.static[Z];if(typeof Y==="string")return Y}return}var b3;var S3=E(()=>{b3={name:"TransitionGroup",aliases:["transition-group"],render(X,$,Z){let Y=(e8(X,"name")||"v").replace(/["'<>]/g,""),J=(e8(X,"tag")||"div").replace(/[^a-z0-9-]/gi,"")||"div",G=e8(X,"class"),Q=e8(X,"id"),q=[`data-stx-transition-group="${Y}"`,G?`class="${G}"`:"",Q?`id="${Q}"`:""].filter(Boolean).join(" ");return`<${J} ${q}>${$}</${J}>`}}});function jQ(){l0.registerBuiltin(K3),l0.registerBuiltin(B3),l0.registerBuiltin(H3),l0.registerBuiltin(F3),l0.registerBuiltin(A3),l0.registerBuiltin(N3),l0.registerBuiltin(M3),l0.registerBuiltin(I3),l0.registerBuiltin(D3),l0.registerBuiltin(b3)}var BQ=E(()=>{U3();_3();L3();V3();R3();T3();k3();E3();y3();S3();q3();U3();_3();L3();V3();R3();T3();k3();E3();y3();S3()});function X$(X){return X.replace(/([a-z0-9])([A-Z])/g,"$1-$2").replace(/([A-Z]+)([A-Z][a-z])/g,"$1-$2").toLowerCase()}function _Q(X,$,Z){let Y=[],J=0;while(J<X.length){let G=X.indexOf("<",J);if(G===-1)break;let q=X.slice(G+1).match(new RegExp(`^(${$.source})(?![\\w.:-])`));if(!q){J=G+1;continue}let W=q[1];if(Z&&Z.has(W.toLowerCase())){let _=G+1+W.length;while(_<X.length&&X[_]!==">")_++;J=_+1;continue}let K=G+1+W.length,U=null,z=K,w=-1,B=!1;while(K<X.length){let _=X[K];if(U){if(_==="\\"&&K+1<X.length){K+=2;continue}if(_===U)U=null;K++;continue}if(_==='"'||_==="'"){U=_,K++;continue}if(_==="/"&&K+1<X.length&&X[K+1]===">"){w=K+2,B=!0;break}if(_===">"){w=K+1;break}K++}if(w===-1){J=G+1;continue}let j=X.slice(z,B?w-2:w-1).trim();if(B)Y.push({fullMatch:X.slice(G,w),tagName:W,attributes:j,content:"",startIndex:G,endIndex:w,isSelfClosing:!0}),J=w;else{let _=`<${W}`,H=`</${W}>`,L=1,O=w,F=-1;while(L>0&&O<X.length){let R=X.indexOf(_,O),N=X.indexOf(H,O);if(N===-1)break;if(R!==-1&&R<N){let T=X[R+_.length];if(T===" "||T===">"||T==="/"||T===`
13750
+ `||T==="\t")L++;O=R+_.length}else{if(L--,L===0){F=N;break}O=N+H.length}}if(F===-1){J=w;continue}let V=X.slice(w,F),A=F+H.length;Y.push({fullMatch:X.slice(G,A),tagName:W,attributes:j,content:V,startIndex:G,endIndex:A,isSelfClosing:!1}),J=A}}return Y}function HQ(X){return X.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&#0?39;/g,"'").replace(/&#x27;/gi,"'").replace(/&amp;/g,"&")}function LQ(X,$){try{let Z=Buffer.from(X,"base64").toString("utf8");return JSON.parse(Z)}catch{}try{let Z=X.replace(/&quot;/g,'"').replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&");return JSON.parse(Z)}catch(Z){if($?.debug)console.error("Error decoding __stx_ prop:",Z);return X}}var OQ=E(()=>{R0();H0();k1()});var MQ={};i(MQ,{processESImports:()=>NQ,processComponents:()=>Z$});import $$ from"fs";import n0 from"path";function HH(X,$,Z){let Y={static:{},staticNames:{},serverDynamic:{},serverDynamicNames:{},clientReactive:{},events:{}},J=new Set(Array.isArray($.__stx_client_signal_names)?$.__stx_client_signal_names:[]),G=(K)=>{if(J.size===0)return!1;let U=r0(K),z=U.match(/^\s*[!+~(-]*\s*([a-zA-Z_$][\w$]*)/)?.[1];if(z&&J.has(z))return!0;for(let w of J){let B=w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");if(new RegExp(`(?:^|[^\\w$.])${B}\\s*\\(`).test(U))return!0}return!1},Q=new Set(N2),q=(K)=>{if(!K.includes("-")||K.startsWith("@")||K.startsWith(":")||K.startsWith("x-")||K.startsWith("__"))return K;if(K.startsWith("aria-")||K.startsWith("data-"))return K;return K.replace(/-([a-z0-9])/g,(U,z)=>z.toUpperCase())},W=(K,U)=>{let z=q(K);if(Y.static[z]=U,z!==K)Y.staticNames[z]=K};for(let[K,U]of Object.entries(X)){let z=K.startsWith("x-")&&!Q.has(K)&&!K.startsWith("x-bind:")&&!K.startsWith("x-on:")?`:${K.slice(2)}`:K;if(z.startsWith("@")){Y.events[z]=U;continue}if(z.startsWith("__stx_")){let w=q(z.slice(6));Y.serverDynamic[w]=LQ(U,Z);continue}if(z.startsWith(":")){let w=q(z.slice(1)),B=U===z5?w:U;if(w==="if"||w==="for"||w==="show"){Y.clientReactive[w]=B;continue}if(G(B)){Y.clientReactive[w]=B;continue}try{if(!G0(B)){if(Z.debug)console.error(`Unsafe expression in :${w} binding: ${B}`);Y.clientReactive[w]=B;continue}let j=Object.keys($),H=Q0(B,j)(...Object.values($));if(H===void 0){let L=B.match(/\b[a-zA-Z_$][a-zA-Z0-9_$]*\b/g)||[],O=new Set(["true","false","null","undefined","typeof","instanceof","in","of","new","this","return","void","delete","throw","if","else"]);if(L.some((V)=>!O.has(V)&&!j.includes(V))){Y.clientReactive[w]=B;continue}}if(Y.serverDynamic[w]=H,w!==z.slice(1)&&Y.serverDynamicNames)Y.serverDynamicNames[w]=z.slice(1)}catch{Y.clientReactive[w]=B}continue}if(typeof U==="string"&&U.includes("{{")&&U.includes("}}")){let w=U.match(/^\{\{\s*([\s\S]+?)\s*\}\}$/);if(w)try{let B=w[1];if(G0(B)){let _=Q0(B,Object.keys($))(...Object.values($));W(z,_!=null?String(_):"")}else{if(Z.debug)console.error(`Unsafe expression in ${z}: ${B}`);W(z,U)}}catch(B){if(Z.debug)console.error(`Error evaluating expression for ${z}:`,B);W(z,U)}else{let B=U,j=/\{\{\s*([\s\S]+?)\s*\}\}/g,_;while((_=j.exec(U))!==null)try{let H=_[1];if(!G0(H)){if(Z.debug)console.error(`Unsafe expression in ${z}: ${H}`);continue}let O=Q0(H,Object.keys($))(...Object.values($));B=B.replace(_[0],String(O??""))}catch(H){if(Z.debug)console.error(`Error evaluating expression in ${z}:`,H)}W(z,B)}continue}W(z,U===z5?"true":HQ(U))}return Y}function OH(X,$,Z){if(!X.includes("@"))return X;if(!LH.some(([J,G])=>J.test(X)&&X.includes(G)))return X;try{return O1(X,$,Z)}catch{return X}}function FH(X){let $={},Z=0,Y=X.length;while(Z<Y){while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z>=Y)break;let J="";while(Z<Y&&!/[\s=]/.test(X[Z]))J+=X[Z],Z++;if(!J)break;while(Z<Y&&/\s/.test(X[Z]))Z++;if(Z<Y&&X[Z]==="="){Z++;while(Z<Y&&/\s/.test(X[Z]))Z++;let G="";if(Z<Y&&(X[Z]==='"'||X[Z]==="'")){let Q=X[Z];Z++;while(Z<Y){let q=X[Z];if(q==="\\"&&Z+1<Y){Z++,G+=X[Z],Z++;continue}if(q===Q){Z++;break}G+=q,Z++}}else while(Z<Y&&!/\s/.test(X[Z]))G+=X[Z],Z++;$[J]=G}else $[J]=z5}return $}function VQ(X){return Object.entries(X).map(([$,Z])=>Z===z5?$:`${$}="${VH(Z)}"`).join(" ")}function VH(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function AH(X){let $=new Set,Z=/<([A-Z][A-Za-z0-9]*|stx-[a-z0-9-]+)\b[^>]*>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1];if(l0.isBuiltin(J))$.add(J)}return[...$].sort()}function RH(X){let $=AQ.get(X);if($)return $;let Z=new Map,Y=[n0.join(X,"src"),n0.join(X,"dist"),X];function J(G,Q){if(Q>6)return;let q;try{q=$$.readdirSync(G,{withFileTypes:!0})}catch{return}for(let W of q){let K=n0.join(G,W.name);if(W.isDirectory()){if(W.name==="node_modules"||W.name.startsWith("."))continue;J(K,Q+1)}else if(W.isFile()&&W.name.endsWith(".stx")){let U=W.name.slice(0,-4);if(!Z.has(U))Z.set(U,K);let z=U.toLowerCase();if(!Z.has(z))Z.set(z,K);let w=U.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(!Z.has(w))Z.set(w,K)}}}for(let G of Y)if(J(G,0),Z.size>0)break;return AQ.set(X,Z),Z}function NH(X,$){if(X.startsWith(".")||X.startsWith("/"))return null;let Z=$;while(!0){let Y=n0.join(Z,"node_modules",X);try{if($$.statSync(Y).isDirectory())return Y}catch{}let J=n0.dirname(Z);if(J===Z)return null;Z=J}}async function NQ(X,$,Z,Y,J){if(!X.includes("import"))return X;if(!$.__importedComponents)$.__importedComponents=new Map;let G=$.__importedComponents,Q=n0.dirname(Z),q=X,W=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi;return q=q.replace(W,(K,U,z)=>{let w=/import\s+(?:(\{[^}]*\})|([A-Za-z_$][\w$]*))\s+from\s+['"]([^'"]+)['"]\s*;?\s*\n?/g,B=z,j,_=[];while((j=w.exec(z))!==null){let[H,L,O,F]=j,V=null,A=null;if(F.startsWith(".")||F.startsWith("/")){let T=n0.resolve(Q,F);if(T.endsWith(".stx"))A=T;else{let M=`${T}.stx`;try{if($$.statSync(M).isFile())A=M}catch{try{if($$.statSync(T).isDirectory())V=T}catch{}}}}else V=NH(F,Q);if(!V&&!A)continue;let R=!1,N=(T,M)=>{G.set(T,M),G.set(T.toLowerCase(),M);let k=T.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();G.set(k,M),J.add(M)};if(O&&A)N(O,A),R=!0;else if(L){let T=L.slice(1,-1).split(",").map((k)=>k.trim()).filter(Boolean).map((k)=>{let D=k.match(/^([A-Za-z_$][\w$]*)\s+as\s+([A-Za-z_$][\w$]*)$/);if(D)return{source:D[1],local:D[2]};return{source:k,local:k}}),M=V?RH(V):null;for(let{source:k,local:D}of T){let I=null;if(A)I=A;else if(M)I=M.get(k)??M.get(k.toLowerCase())??M.get(k.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase())??null;if(I)N(D,I),R=!0}}if(R)_.push({start:j.index,end:j.index+H.length})}if(_.length===0)return K;for(let H=_.length-1;H>=0;H--)B=B.slice(0,_[H].start)+B.slice(_[H].end);return`<script${U}>${B}</script>`}),q}async function TH(X,$,Z,Y,J){let G=X;if(!$.__importedComponents)$.__importedComponents=new Map;let Q=$.__importedComponents,q=/@import\s*\(\s*([^)]+)\s*\)/g,W;while((W=q.exec(G))!==null){let[K,U]=W,z=U.split(",").map((w)=>w.trim().replace(/^['"]|['"]$/g,"")).filter((w)=>w.length>0);for(let w of z){let B=w.split("/"),_=B[B.length-1].replace(/\.stx$/,""),H=_.includes("-")?_.split("-").map((F)=>F.charAt(0).toUpperCase()+F.slice(1)).join(""):_.charAt(0).toUpperCase()+_.slice(1),L=null,O=[n0.resolve(n0.dirname(Z),`${w}.stx`),n0.resolve(n0.dirname(Z),w),n0.resolve(Y.componentsDir||"components",`${w}.stx`),n0.resolve(Y.componentsDir||"components",w),w.endsWith(".stx")?w:`${w}.stx`];for(let F of O)try{if(await Bun.file(F).exists()){L=F;break}}catch{}if(L){Q.set(H,L),Q.set(_,L),Q.set(_.toLowerCase(),L);let F=H.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();if(Q.set(F,L),J.add(L),Y.debug)console.log(`Imported component: ${H} -> ${L}`)}else if(Y.debug)console.warn(`Could not resolve imported component: ${w}`)}G=G.replace(K,""),q.lastIndex=0}return G}async function MH(X,$,Z,Y,J){let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let q=$.__processedComponents,W=/@component\s*\(/g,K;while((K=W.exec(G))!==null){let U=K.index,z=U+K[0].length-1,w=1,B=z+1;while(B<G.length&&w>0){if(G[B]==="(")w++;else if(G[B]===")"){if(w--,w===0)break}B++}if(w!==0)break;let j=G.substring(z+1,B),_=B+1,H=j.match(/^\s*['"]([^'"]+)['"]/);if(!H){W.lastIndex=0;continue}let L=H[1],O,F=j.slice(H[0].length),V=F.match(/^\s*,\s*/);if(V)O=F.slice(V[0].length).trim();let A={};if(O)try{A=A0(O,$)}catch(D){let I=D instanceof Error?D.message:String(D);G=G.replace(G.substring(U,_),`[Error parsing component props: ${I}]`);continue}let R="",N=_,M=G.substring(_).match(/^([\s\S]*?)@endcomponent/);if(M)R=M[1].trim(),N=_+M[0].length;let k=await Y5(L,A,R,Q,$,Z,Y,q,J);G=G.substring(0,U)+k+G.substring(N),W.lastIndex=0}return G}async function kH(X,$,Z,Y,J){if(!X)return X;let G=X,Q=Y.componentsDir||"components";if(!$.__processedComponents)$.__processedComponents=new Set;let q=$.__processedComponents,W=J1(G);return G=W.output,G=await w(G,/[a-z][a-z0-9]*-[a-z0-9-]*/,!1),G=await w(G,/[A-Z][a-zA-Z0-9]*/,!0),G=await w(G,/[a-z][a-z0-9]*/,!1,_H),G=I5(G,W.scripts),G;async function w(B,j,_,H){if(!B)return B;let L=B,O=_Q(L,j,H);for(let F=O.length-1;F>=0;F--){let V=O[F],A=_?X$(V.tagName):V.tagName,R=FH(OH(V.attributes,$,Z)),N=HH(R,$,Y),T=l0.getBuiltin(V.tagName),M=T?await q8(A,Q,$,Z,Y):!1;if(T&&!M){let S={context:$,filePath:Z,options:Y,dependencies:J},b=T.render(N,V.content,S);if(Object.keys(N.clientReactive).length>0)b=RQ(b,N.clientReactive);if(Object.keys(N.events).length>0){let y=VQ(N.events);b=b.replace(/^(\s*<[a-zA-Z][a-zA-Z0-9-]*)/,`$1 ${y}`)}L=L.substring(0,V.startIndex)+b+L.substring(V.endIndex);continue}if(!_&&V.tagName.includes("-")&&!await q8(A,Q,$,Z,Y))continue;let k={};for(let[S,b]of Object.entries(N.static))k[S]=b;for(let[S,b]of Object.entries(N.serverDynamic))k[S]=b;let I=await Y5(A,k,I5(V.content,W.scripts),Q,$,Z,Y,q,J);if(Object.keys(N.clientReactive).length>0)I=RQ(I,N.clientReactive);if(Object.keys(N.events).length>0){let S=TQ(I);if(S){let b=VQ(N.events),y=Object.keys(N.events).map((P)=>P.replace(/^@/,"").split(".")[0]).join(" ");I=I.substring(0,S.insertPos)+` data-stx-parent-events="${y}" ${b}`+I.substring(S.insertPos)}}L=L.substring(0,V.startIndex)+I+L.substring(V.endIndex)}return L}}function RQ(X,$){let Z=new Set(["if","for"]),Y=new Set(["show"]),J=Object.entries($).filter(([U])=>!Z.has(U)),G=J.filter(([U])=>!Y.has(U)).map(([U])=>X$(U)).join(" "),Q=X,q=J.length>0?TQ(Q):null;if(q){let U=J.map(([w,B])=>`:${X$(w)}="${B.replace(/"/g,"&quot;")}"`).join(" "),z=G?` data-stx-parent-bindings="${G}"`:"";Q=Q.substring(0,q.insertPos)+`${z} ${U}`+Q.substring(q.insertPos)}let W=$.if;if(W)Q=`<template :if="${W.replace(/"/g,"&quot;")}">${Q}</template>`;let K=$.for;if(K)Q=`<template :for="${K.replace(/"/g,"&quot;")}">${Q}</template>`;return Q}function TQ(X){let $=/<([a-zA-Z][a-zA-Z0-9-]*)\b[^>]*\bdata-stx-scope(?:\s|=|>)/i.exec(X);if($)return{insertPos:$.index+1+$[1].length};let Z=0;while(Z<X.length){let Y=X.slice(Z),J=Y.match(/^\s+/);if(J){Z+=J[0].length;continue}if(Y.startsWith("<!--")){let q=X.indexOf("-->",Z+4);if(q===-1)return null;Z=q+3;continue}let G=Y.match(/^<(script|style)\b[^>]*>/i);if(G){let q=`</${G[1].toLowerCase()}>`,W=X.toLowerCase().indexOf(q,Z+G[0].length);if(W===-1)return null;Z=W+q.length;continue}let Q=Y.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(?:\s|>|\/)/);if(!Q)return null;return{insertPos:Z+1+Q[1].length}}return null}async function Z$(X,$,Z,Y,J){if(!FQ)jQ(),FQ=!0;let G=await NQ(X,$,Z,Y,J);G=await TH(G,$,Z,Y,J),G=await MH(G,$,Z,Y,J);let Q=[];for(let q=0;q<3;q++){let W=Y1(G,E7,(U,z)=>`\x00STX_COMPONENT_COMMENT_${Q.length+z}\x00`);Q.push(...W.tokens);let K=G;if(G=await kH(W.output,$,Z,Y,J),G===K)break}if(Q.length>0)G=G.replace(/\x00STX_COMPONENT_COMMENT_(\d+)\x00/g,(q,W)=>Q[Number(W)]??"");if(Y.debug){let q=AH(G);if(q.length>0)console.warn(`[stx] ${Z}: unresolved component tag(s) after render passes: ${q.join(", ")}. Check nested component output for malformed root tags or recursive component markup.`)}return G}var FQ=!1,_H,LH,AQ;var C3=E(()=>{q3();m7();BQ();OQ();k1();H0();R0();e0();_H=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","component","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr","path","circle","rect","line","polygon","polyline","ellipse","text","tspan","textPath","g","defs","use","symbol","image","clipPath","mask","pattern","marker","linearGradient","radialGradient","stop","filter","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDropShadow","feFlood","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","foreignObject","animate","animateMotion","animateTransform","set","mpath","desc","metadata","switch","view"]);LH=[[/@if\s*\(/,"@endif"],[/@unless\s*\(/,"@endunless"]];AQ=new Map});var SQ={};i(SQ,{processLoops:()=>v3,parseLoopBinding:()=>P3});function DH(X,$){let Z=/@(include|partial)\s*\(\s*(['"])([^'"]+)\2\s*,\s*/g,Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index+G[0].length,q=G.index+G[0].indexOf("("),W=D0(X,"(",")",q);if(W===-1)continue;let K=X.slice(Q,W).trim();if(!K)continue;if(!Object.keys($).some((w)=>new RegExp(`(?:^|[^\\w$.])${w.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?![\\w$])`).test(K)))continue;let z;try{let w=A0(K,$);if(!w||typeof w!=="object")continue;z=JSON.stringify(w)}catch{continue}Y+=X.slice(J,Q)+z,J=W,Z.lastIndex=W}return J===0?X:Y+X.slice(J)}function yH(X,$){let Z=/@component\s*\(/g,Y=X,J,G=[];while((J=Z.exec(Y))!==null){let Q=J.index,q=Q+J[0].length-1,W=1,K=q+1;while(K<Y.length&&W>0){if(Y[K]==="(")W++;else if(Y[K]===")"){if(W--,W===0)break}K++}if(W!==0)continue;let U=Y.substring(q+1,K),z=K+1,w=U.match(/^\s*['"]([^'"]+)['"]/);if(!w)continue;let B=w[1],j=U.slice(w[0].length),_=j.match(/^\s*,\s*/);if(!_)continue;let H=j.slice(_[0].length).trim();if(!H)continue;try{let L=A0(H,$),O=JSON.stringify(L),F=`@component('${B}', ${O})`;G.push({start:Q,end:z,replacement:F})}catch{continue}}for(let Q=G.length-1;Q>=0;Q--){let{start:q,end:W,replacement:K}=G[Q];Y=Y.substring(0,q)+K+Y.substring(W)}return Y}function Y$(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\(`),G;while((G=J.exec(Y))!==null){let Q=G.index,q=Q+G[0].length-1,W=1,K=q+1,U=null,z=!1;while(K<Y.length&&W>0){let j=Y[K];if(z){z=!1,K++;continue}if(j==="\\"&&U){z=!0,K++;continue}if(U){if(j===U)U=null;K++;continue}if(j==='"'||j==="'"||j==="`"){U=j,K++;continue}if(j==="(")W++;else if(j===")"){if(W--,W===0)break}K++}if(W!==0)break;let w=Y.substring(q+1,K),B=Z(w);Y=Y.substring(0,Q)+B+Y.substring(K+1)}return Y}function bH(X,$){let Z=X;return Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)(?=\s+[^=]|\s*\/?>|\s*$)/g,(Y,J)=>{if(J in $)return`:${J}="${J}"`;return Y}),Z=Z.replace(/:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,(Y,J,G)=>{try{let Q=Object.keys($),q=Object.values($);EX(G);let K=Q0(G,Q)(...q),U=JSON.stringify(K),z=Buffer.from(U,"utf8").toString("base64");return`__stx_${J}="${z}"`}catch(Q){return Y}}),Z}function SH(X,$){let Z=X;return Z=Y$(Z,"@break",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(G0(G)){let q=Q0(G,Object.keys($));Q=Boolean(q(...Object.values($)))}else Q=Boolean(J0(G,$));return Q?J$:""}catch{return""}}),Z=Y$(Z,"@continue",(Y)=>{try{let G=`!!(${Y.trim()})`,Q;if(G0(G)){let q=Q0(G,Object.keys($));Q=Boolean(q(...Object.values($)))}else Q=Boolean(J0(G,$));return Q?G$:""}catch{return""}}),Z}function CH(X){let $=X;return $=$.replace(/@break(?!\()/g,J$),$=$.replace(/@continue(?!\()/g,G$),$}function kQ(X){let $=X.includes(J$),Z=$?X.substring(0,X.indexOf(J$)):X;return{hasBreak:$,content:Z}}function IQ(X){let $=X.includes(G$),Z=$?X.substring(0,X.indexOf(G$)):X;return{hasContinue:$,content:Z}}function DQ(X){let $=X;return $=Y$($,"@break",(Z)=>{let Y=Z.trim();if(!DX(Y))return"";return`\`; if (${Y}) { break; } result += \``}),$=Y$($,"@continue",(Z)=>{let Y=Z.trim();if(!DX(Y))return"";return`\`; if (${Y}) { continue; } result += \``}),$=$.replace(/@break(?!\()/g,"`; break; result += `"),$=$.replace(/@continue(?!\()/g,"`; continue; result += `"),$}function PH(X){let $=/@forelse\s*\(/g,Z,Y=[],J=/@foreach\s*\(/g,G=/@endforeach/g,Q;while((Q=J.exec(X))!==null)Y.push({pos:Q.index,delta:1});while((Q=G.exec(X))!==null)Y.push({pos:Q.index,delta:-1});Y.sort((U,z)=>U.pos-z.pos);let q=[],W=0;for(let U of Y)W+=U.delta,q.push({pos:U.pos,depth:W});function K(U){let z=0,w=q.length-1,B=0;while(z<=w){let j=z+w>>1;if(q[j].pos<=U)B=q[j].depth,z=j+1;else w=j-1}return B}while((Z=$.exec(X))!==null){if(K(Z.index)>0)continue;let U=Z.index,z=Z.index+Z[0].length-1,w=1,B=z+1,j=-1;while(B<X.length&&w>0){if(X[B]==="(")w++;else if(X[B]===")"){if(w--,w===0){j=B;break}}B++}if(j===-1)continue;let _=X.substring(z+1,j),H=P3(_);if(!H)continue;let{arrayExpr:L,itemVar:O}=H,F=j+1,V=1,A=F,R=/@forelse\s*\(/g,N=/@endforelse/g,T=-1;while(V>0&&A<X.length){R.lastIndex=A,N.lastIndex=A;let b=R.exec(X),y=N.exec(X);if(!y)break;if(b&&b.index<y.index)V++,A=b.index+b[0].length;else{if(V--,V===0){T=y.index;break}A=y.index+11}}if(T===-1)continue;let M=X.substring(F,T),k=T+11,D=-1,I=0,S=0;while(S<M.length){let b=M.indexOf("@",S);if(b===-1)break;let y=M.substring(b);if(/^@forelse\s*\(/.test(y))I++,S=b+1;else if(y.startsWith("@endforelse"))I--,S=b+11;else if(I===0&&y.startsWith("@empty")){if(M.length<=b+6||!/[a-z]/i.test(M[b+6])){D=b;break}S=b+1}else S=b+1}if(D===-1)continue;return{start:U,end:k,arrayExpr:L,itemVar:O,foreachContent:M.substring(0,D),emptyContent:M.substring(D+6)}}return null}function EQ(X,$){let Z=X;while(!0){let Y=PH(Z);if(!Y)break;let{start:J,end:G,arrayExpr:Q,itemVar:q,foreachContent:W,emptyContent:K}=Y;try{let U;if(G0(Q))U=Q0(Q,Object.keys($))(...Object.values($));else U=J0(Q,$);let z;if(!Array.isArray(U)||U.length===0)z=K;else z=`@foreach (${Q} as ${q})${W}@endforeach`;Z=Z.substring(0,J)+z+Z.substring(G)}catch(U){let z=U instanceof Error?U.message:String(U),w=Y0("Forelse",`Error in @forelse(${Q} as ${q}): ${z}`,o.EVALUATION_ERROR);Z=Z.substring(0,J)+w+Z.substring(G)}}return Z}function P3(X){let $=X.indexOf(" as ");if($!==-1){let G=X.slice(0,$).trim(),Q=X.slice($+4).trim();return G&&Q?{arrayExpr:G,itemVar:Q}:null}let Z=/^\s*(.+?)\s+in\s+([\s\S]+)$/.exec(X);if(!Z)return null;let Y=Z[1].trim().replace(/^\(([\s\S]*)\)$/,"$1").trim(),J=Z[2].trim();return Y&&J?{arrayExpr:J,itemVar:Y}:null}function v3(X,$,Z,Y){let J=X;J=EQ(J,$);function G(W){let K=/@foreach\s*\(/g,U;while((U=K.exec(W))!==null){let z=U.index,w=U.index+U[0].length-1,B=1,j=w+1,_=-1;while(j<W.length&&B>0){if(W[j]==="(")B++;else if(W[j]===")"){if(B--,B===0){_=j;break}}j++}if(_===-1)continue;let H=W.substring(w+1,_),L=P3(H);if(!L)continue;let O=z,{arrayExpr:F,itemVar:V}=L,A=_+1,R=1,N=A,T=/@foreach\s*\(/g,M=/@endforeach/g;while(R>0&&N<W.length){T.lastIndex=N,M.lastIndex=N;let k=T.exec(W),D=M.exec(W);if(!D)break;if(k&&k.index<D.index)R++,N=k.index+k[0].length;else{if(R--,R===0){let I=W.substring(A,D.index),S=D.index+11;return{start:O,end:S,arrayExpr:F,itemVar:V,content:I}}N=D.index+11}}}return null}function Q(W,K){let U=W;while(!0){let z=G(U);if(!z)break;let{start:w,end:B,arrayExpr:j,itemVar:_,content:H}=z;try{let L=j.trim(),O;if(G0(L))O=Q0(L,Object.keys(K))(...Object.values(K));else O=J0(L,K);let F=!1;if(!Array.isArray(O))if(O instanceof Map)O=Array.from(O),F=!0;else if(O instanceof Set)O=Array.from(O);else if(typeof O==="string")O=Array.from(O);else if(O&&typeof O==="object"&&!(O instanceof Date)&&!(O instanceof RegExp))O=Object.entries(O),F=!0;else{console.warn(`[stx] @foreach(${L}) in ${Z}: ${L} is not iterable server-side, so the loop rendered nothing. `+"Values a server loop reads must come from <script server> or the page context \u2014 "+"a plain <script> runs in the browser.");let D=Y0("Foreach",`Error in @foreach: ${L} is not iterable`,o.TYPE_ERROR);U=U.substring(0,w)+D+U.substring(B);continue}let V=Y?.loops?.useAltLoopVariable??EH,A=_.trim(),R=null,N,T=!1;if(A.includes("=>")){let D=A.split("=>").map((I)=>I.trim());if(D.length===2&&D[0]&&D[1])R=D[0],N=D[1];else N=A}else if(!A.startsWith("[")&&!A.startsWith("{")&&A.includes(",")){let D=A.split(",").map((I)=>I.trim());if(D.length===2&&D[0]&&D[1])N=D[0],R=D[1],T=!0;else N=A}else N=A;let M="",k=O;for(let D=0;D<k.length;D++){let I=k[D],S={index:D,iteration:D+1,first:D===0,last:D===k.length-1,count:k.length},b={...K,loop:S,$loop:S};if(N.startsWith("[")&&N.endsWith("]")){let f=N.slice(1,-1).split(",").map((c)=>c.trim());if(Array.isArray(I))f.forEach((c,l)=>{if(c)b[c]=I[l]});else b[N]=I}else b[N]=I;if(R)if(!T&&F&&Array.isArray(I)&&I.length===2)b[R]=I[0],b[N]=I[1];else b[R]=D;let y=SH(H,b),P=IQ(y);if(P.hasContinue){M+=P.content;continue}let x=kQ(y);if(x.hasBreak){M+=x.content;break}if(y=EQ(y,b),y=Q(y,b),y=O1(y,b,Z),y=CH(y),x=kQ(y),x.hasBreak){M+=x.content;break}if(P=IQ(y),P.hasContinue){M+=P.content;continue}y=I1(y,b,Z),y=bH(y,b),y=yH(y,b),y=DH(y,b),M+=y}U=U.substring(0,w)+M+U.substring(B)}catch(L){let O=Y0("Foreach",`Error in @foreach(${j.trim()} as ${_.trim()}): ${L instanceof Error?L.message:String(L)}`,o.EVALUATION_ERROR);U=U.substring(0,w)+O+U.substring(B)}}return U}J=Q(J,$),J=bQ(J,$,Z,Y);let q=Y?.loops?.maxWhileIterations??IH;return J=fH(J,$,q),J}function yQ(X){return DX(X)}function bQ(X,$,Z,Y){let J=X,G=!0;while(G){G=!1;let Q=J.match(/@for\s*\(/);if(!Q||Q.index===void 0)break;let q=Q.index,W=q+Q[0].length-1,K=D0(J,"(",")",W);if(K===-1)break;let U=J.slice(W+1,K),z=K+1,w=gX(J.slice(q),"for","endfor");if(w.length===0)break;let B=w[0].content,j=q+w[0].end;if(!yQ(U)){let _=Y0("For",`Unsafe expression in @for: ${U}`,o.UNSAFE_EXPRESSION);J=J.substring(0,q)+_+J.substring(j),G=!0;continue}try{let _=vH(U),H=/@(?:for|foreach|if|unless)\s*\(/.test(B);if(_.length>0&&H){let R=xH({forExpr:U,content:B,iterVarNames:_,context:$,filePath:Z,options:Y});J=J.substring(0,q)+R+J.substring(j),G=!0;continue}let L=Object.keys($),O=Object.values($),F=B.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(R,N)=>{return`\${${N}}`});F=DQ(F);let A=Function(...L,`
13751
13751
  let result = '';
13752
- for (${W}) {
13752
+ for (${U}) {
13753
13753
  result += \`${F}\`;
13754
13754
  }
13755
13755
  return result;
13756
- `)(...L);J=J.substring(0,q)+A+J.substring(j),G=!0}catch(_){let H=Y0("For",`Error in @for(${W}): ${_ instanceof Error?_.message:String(_)}`,s.EVALUATION_ERROR);J=J.substring(0,q)+H+J.substring(j),G=!0}}return J}function CH(X){let $=X.trim(),Z=$.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Z){let G=Z[1];return G.slice(1,-1).split(",").map((q)=>{let K=q.trim();if(!K)return"";let U=K.indexOf(":");if(U>=0&&G.startsWith("{")){let w=K.slice(U+1).trim(),B=w.indexOf("=");return(B>=0?w.slice(0,B):w).trim()}let W=K.indexOf("="),z=(W>=0?K.slice(0,W):K).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let Y=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let J=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(J)return[J[1]];return[]}function PH(X){let{forExpr:$,content:Z,iterVarNames:Y,context:J,filePath:G,options:Q}=X,q=Object.keys(J),K=Object.values(J),U=Function(...q,"__pushIter",`
13756
+ `)(...O);J=J.substring(0,q)+A+J.substring(j),G=!0}catch(_){let H=Y0("For",`Error in @for(${U}): ${_ instanceof Error?_.message:String(_)}`,o.EVALUATION_ERROR);J=J.substring(0,q)+H+J.substring(j),G=!0}}return J}function vH(X){let $=X.trim(),Z=$.match(/^(?:const|let|var)\s+(\[[^\]]+\]|\{[^}]+\})\s+(?:of|in)\s+/);if(Z){let G=Z[1];return G.slice(1,-1).split(",").map((q)=>{let W=q.trim();if(!W)return"";let K=W.indexOf(":");if(K>=0&&G.startsWith("{")){let w=W.slice(K+1).trim(),B=w.indexOf("=");return(B>=0?w.slice(0,B):w).trim()}let U=W.indexOf("="),z=(U>=0?W.slice(0,U):W).trim();return/^[A-Za-z_$][\w$]*$/.test(z)?z:""}).filter(Boolean)}let Y=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s+(?:of|in)\s+/);if(Y)return[Y[1]];let J=$.match(/^(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=[^;]*;/);if(J)return[J[1]];return[]}function xH(X){let{forExpr:$,content:Z,iterVarNames:Y,context:J,filePath:G,options:Q}=X,q=Object.keys(J),W=Object.values(J),K=Function(...q,"__pushIter",`
13757
13757
  for (${$}) {
13758
13758
  __pushIter([${Y.join(", ")}])
13759
13759
  }
13760
- `),W=[];U(...K,(B)=>{W.push(B)});let z=G??"inline.stx",w="";for(let B of W){let j={...J};Y.forEach((H,O)=>{j[H]=B[O]});let _=bQ(Z,j,G,Q);_=L1(_,j,z),_=I1(_,j,z),w+=_}return w}function vH(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@while\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,q=Q+G[0].length-1,K=D0(Y,"(",")",q);if(K===-1)break;let U=Y.slice(q+1,K),W=gX(Y.slice(Q),"while","endwhile");if(W.length===0)break;let z=W[0].content,w=Q+W[0].end;if(!yQ(U)){let B=Y0("While",`Unsafe expression in @while: ${U}`,s.UNSAFE_EXPRESSION);Y=Y.substring(0,Q)+B+Y.substring(w),J=!0;continue}try{let B=Object.keys($),j=Object.values($),_=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(L,F)=>{return`\${${F}}`});_=DQ(_);let O=Function(...B,`
13760
+ `),U=[];K(...W,(B)=>{U.push(B)});let z=G??"inline.stx",w="";for(let B of U){let j={...J};Y.forEach((H,L)=>{j[H]=B[L]});let _=bQ(Z,j,G,Q);_=O1(_,j,z),_=I1(_,j,z),w+=_}return w}function fH(X,$,Z){let Y=X,J=!0;while(J){J=!1;let G=Y.match(/@while\s*\(/);if(!G||G.index===void 0)break;let Q=G.index,q=Q+G[0].length-1,W=D0(Y,"(",")",q);if(W===-1)break;let K=Y.slice(q+1,W),U=gX(Y.slice(Q),"while","endwhile");if(U.length===0)break;let z=U[0].content,w=Q+U[0].end;if(!yQ(K)){let B=Y0("While",`Unsafe expression in @while: ${K}`,o.UNSAFE_EXPRESSION);Y=Y.substring(0,Q)+B+Y.substring(w),J=!0;continue}try{let B=Object.keys($),j=Object.values($),_=z.replace(/`/g,"\\`").replace(/\$\{/g,"\\${").replace(/\{\{([^}]+)\}\}/g,(O,F)=>{return`\${${F}}`});_=DQ(_);let L=Function(...B,`
13761
13761
  let result = '';
13762
13762
  let maxIterations = ${Z}; // Configurable safety limit
13763
13763
  let counter = 0;
13764
- while (${U} && counter < maxIterations) {
13764
+ while (${K} && counter < maxIterations) {
13765
13765
  counter++;
13766
13766
  result += \`${_}\`;
13767
13767
  }
@@ -13769,8 +13769,8 @@ ${I}
13769
13769
  result += '<!-- [While Error [1104]]: Maximum iterations (${Z}) exceeded in while loop. Configure via options.loops.maxWhileIterations -->';
13770
13770
  }
13771
13771
  return result;
13772
- `)(...j);Y=Y.substring(0,Q)+O+Y.substring(w),J=!0}catch(B){let j=Y0("While",`Error in @while(${U}): ${B instanceof Error?B.message:String(B)}`,s.EVALUATION_ERROR);Y=Y.substring(0,Q)+j+Y.substring(w),J=!0}}return Y}var MH=1000,kH=!1,J$="<!--__STX_BREAK__-->",G$="<!--__STX_CONTINUE__-->";var x3=E(()=>{m7();H1();Q1();hX();R0()});import B0 from"path";function f3(X,$){let Z=0;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J===","&&Z===0)return Y}return-1}function xH(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=J.exec(Y);while(G){let Q=G.index,q=Q+G[0].length-1,K=1,U=q+1;while(U<Y.length&&K>0){if(Y[U]==="(")K++;else if(Y[U]===")")K--;U++}if(K!==0)break;let W=Y.substring(q+1,U-1),z=`${Z}(${W})`;Y=Y.substring(0,Q)+z+Y.substring(U),J.lastIndex=Q+z.length,G=J.exec(Y)}return Y}function fH(X){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(X)}function PQ(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,q=(z)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===z){G++;return}G++}},K=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let z=1;while(G<Q&&z>0)if($[G]==="{")z++,G++;else if($[G]==="}")z--,G++;else if($[G]==="'"||$[G]==='"')q($[G]);else if($[G]==="`")K();else G++;continue}G++}},U=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
13773
- `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},W=()=>{if(J!==0)return;let z=$.slice(G).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 w=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(w){let j=w[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(G<Q){if(U())continue;if($[G]==="'"||$[G]==='"'){q($[G]);continue}if($[G]==="`"){K();continue}if($[G]==="{"){J++,G++;continue}if($[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))W();G++}return Z.join(", ")}function vQ(X,$=""){let Z=PQ(X).split(",").map((Y)=>Y.trim()).filter(Boolean);return`
13772
+ `)(...j);Y=Y.substring(0,Q)+L+Y.substring(w),J=!0}catch(B){let j=Y0("While",`Error in @while(${K}): ${B instanceof Error?B.message:String(B)}`,o.EVALUATION_ERROR);Y=Y.substring(0,Q)+j+Y.substring(w),J=!0}}return Y}var IH=1000,EH=!1,J$="<!--__STX_BREAK__-->",G$="<!--__STX_CONTINUE__-->";var x3=E(()=>{m7();H1();Q1();hX();R0()});import B0 from"path";function f3(X,$){let Z=0;for(let Y=$;Y<X.length;Y++){let J=X[Y];if(J==="("||J==="["||J==="{")Z++;else if(J===")"||J==="]"||J==="}")Z--;else if(J===","&&Z===0)return Y}return-1}function gH(X,$,Z){let Y=X,J=new RegExp(`${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),G=J.exec(Y);while(G){let Q=G.index,q=Q+G[0].length-1,W=1,K=q+1;while(K<Y.length&&W>0){if(Y[K]==="(")W++;else if(Y[K]===")")W--;K++}if(W!==0)break;let U=Y.substring(q+1,K-1),z=`${Z}(${U})`;Y=Y.substring(0,Q)+z+Y.substring(K),J.lastIndex=Q+z.length,G=J.exec(Y)}return Y}function hH(X){return/\b(state|derived|effect)\s*(?:<[^<>()]*>)?\s*\(/.test(X)}function PQ(X){let $=X,Z=[],Y=new Set,J=0,G=0,Q=$.length,q=(z)=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]===z){G++;return}G++}},W=()=>{G++;while(G<Q){if($[G]==="\\"){G+=2;continue}if($[G]==="`"){G++;return}if($[G]==="$"&&$[G+1]==="{"){G+=2;let z=1;while(G<Q&&z>0)if($[G]==="{")z++,G++;else if($[G]==="}")z--,G++;else if($[G]==="'"||$[G]==='"')q($[G]);else if($[G]==="`")W();else G++;continue}G++}},K=()=>{if($[G]==="/"&&$[G+1]==="/"){while(G<Q&&$[G]!==`
13773
+ `)G++;return!0}if($[G]==="/"&&$[G+1]==="*"){G+=2;while(G<Q-1&&!($[G]==="*"&&$[G+1]==="/"))G++;return G+=2,!0}return!1},U=()=>{if(J!==0)return;let z=$.slice(G).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 w=$.slice(G).match(/^function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(w){let j=w[1];if(!Y.has(j))Z.push(j),Y.add(j);return}let B=$.slice(G).match(/^async\s+function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)\s*\(/);if(B){let j=B[1];if(!Y.has(j))Z.push(j),Y.add(j)}};while(G<Q){if(K())continue;if($[G]==="'"||$[G]==='"'){q($[G]);continue}if($[G]==="`"){W();continue}if($[G]==="{"){J++,G++;continue}if($[G]==="}"){J--,G++;continue}if(J===0&&/[a-z]/i.test($[G])&&(G===0||/\s|[;{}()]/.test($[G-1])))U();G++}return Z.join(", ")}function vQ(X,$=""){let Z=PQ(X).split(",").map((Y)=>Y.trim()).filter(Boolean);return`
13774
13774
  (function() {
13775
13775
  ${N5("var",Z)}
13776
13776
  var __destroyHooks = [];
@@ -13791,7 +13791,7 @@ ${PQ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
13791
13791
  // shadowing import. __stxScopeRenames is emitted by bundleClientScript.
13792
13792
  try { if (typeof __stxScopeRenames !== 'undefined' && __stxScopeRenames) { for (var __stxRK in __stxScopeRenames) __scopeRegistration[__stxRK] = __stxScopeRenames[__stxRK]; } } catch (e) { /* no renames */ }
13793
13793
  window.stx._scopes['${$}'] = __scopeRegistration;
13794
- `}function gH(X,$){let Z=xQ(X,$),Y=`
13794
+ `}function uH(X,$){let Z=xQ(X,$),Y=`
13795
13795
  (function() {
13796
13796
  var __stxScopeEl = (typeof document !== 'undefined') ? document.querySelector('[data-stx-scope="${$}"]') : null;
13797
13797
  var __stxPrevEl = (typeof window !== 'undefined') ? window.__STX_CURRENT_ELEMENT__ : undefined;
@@ -13804,33 +13804,33 @@ ${PQ(X).split(",").map((G)=>G.trim()).filter(Boolean).map((G)=>` try { __scopeR
13804
13804
  } finally {
13805
13805
  if (typeof window !== 'undefined') window.__STX_CURRENT_ELEMENT__ = __stxPrevEl;
13806
13806
  }
13807
- })();`}function hH(X,$){let Z=X.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let J=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:X,mergedIntoExisting:J[1]};let G=Z[1],Q=Z[2],q=Z[3];return{html:`${G}${Q} data-stx-scope="${$}"${q}${X.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:X,mergedIntoExisting:null}}function dH(X){if(X.__onceStore instanceof Set)return X.__onceStore;return uH}async function g3(X,$,Z,Y,J,G=new Set){let Q=Y.partialsDir||B0.join(B0.dirname(Z),"partials");if(Q&&!B0.isAbsolute(Q))Q=B0.resolve(process.cwd(),Q);let q=xH(X,"@partial","@include"),K=dH($);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,H,O)=>{let L=H.trim(),F=`${Z}:${L}`;if(K.has(F))return"";return K.add(F),H});{let _=/@includeIf\s*\(/g,H;while((H=_.exec(q))!==null){let O=H.index,L=O+H[0].length-1,F=1,V=L+1;while(V<q.length&&F>0){if(q[V]==="(")F++;else if(q[V]===")")F--;V++}if(F!==0)break;let A=q.substring(L+1,V-1),R=A.match(/^\s*['"]([^'"]+)['"]/);if(!R){_.lastIndex=V;continue}let N=R[1],T=U(N,Q,Z),M="";if(T&&await Bun.file(T).exists())J.add(T),M=`@include(${A})`;q=q.substring(0,O)+M+q.substring(V),_.lastIndex=0}}for(let[_,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let O=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),L;while((L=O.exec(q))!==null){let F=L.index,V=F+L[0].length-1,A=1,R=V+1;while(R<q.length&&A>0){if(q[R]==="(")A++;else if(q[R]===")")A--;R++}if(A!==0)break;let N=q.substring(V+1,R-1),T=f3(N,0);if(T===-1){O.lastIndex=R;continue}let M=N.substring(0,T).trim(),k=N.substring(T+1).trim(),D=k.match(/^\s*['"]([^'"]+)['"]/);if(!D){O.lastIndex=R;continue}let I=D[1],S=k.substring(D[0].length),b,y=f3(S,0);if(y!==-1)b=S.substring(y+1).trim();try{let P=`Boolean(${M})`,x;if(G0(P)){let l=Q0(P,Object.keys($));x=Boolean(l(...Object.values($)))}else x=Boolean(J0(P,$));let f=H?!x:x,c="";if(f){let l=U(I,Q,Z);if(l&&await Bun.file(l).exists())J.add(l);c=`@include('${I}'${b?`, ${b}`:""})`}q=q.substring(0,F)+c+q.substring(R),O.lastIndex=0}catch(P){let x=P instanceof Error?P.message:String(P),f=j0("Include",`Error evaluating ${_} condition: ${x}`,Z,X,F);q=q.substring(0,F)+f+q.substring(R),O.lastIndex=0}}}{let _=/@each\s*\(/g,H;while((H=_.exec(q))!==null){let O=H.index,L=O+H[0].length-1,F=1,V=L+1;while(V<q.length&&F>0){if(q[V]==="(")F++;else if(q[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=q.substring(L+1,V),R=q.substring(O,V+1),N=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(R,"");continue}let[,T,M,k,D]=N;try{let I,S=M.trim();if(G0(S))I=Q0(S,Object.keys($))(...Object.values($));else I=J0(S,$);let b="";if(Array.isArray(I)&&I.length>0)for(let y of I){let P={...$,[k]:y},x=await w(T,P,X,O);b+=x}else if(D)b=await w(D,{},X,O);q=q.substring(0,O)+b+q.substring(V+1),_.lastIndex=0}catch(I){let S=I instanceof Error?I.message:String(I);q=q.substring(0,O)+j0("Each",`Error in @each: ${S}`,Z,X,O)+q.substring(V+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,H;while((H=_.exec(q))!==null){let O=H.index,L=O+H[0].length-1,F=1,V=L+1;while(V<q.length&&F>0){if(q[V]==="(")F++;else if(q[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=q.substring(L+1,V),R=q.substring(O,V+1),N=A.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(R,"");continue}let T=N[1],M=A.slice(N[0].length),k,D=M.match(/^\s*,\s*\{/);if(D){M=M.slice(D[0].length-1);let b=1,y=1;while(y<M.length&&b>0){if(M[y]==="{")b++;else if(M[y]==="}"){if(b--,b===0)break}y++}k=M.substring(0,y+1),M=M.slice(y+1)}let I,S=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(S)I=S[1];try{let b=JSON.parse(T.replace(/'/g,'"')),y={};if(k)try{y=A0(k,$)}catch(x){let f=x instanceof Error?x.message:String(x);if(Y.debug){let c=j0("Include",`Error parsing includeFirst variables: ${f}`,Z,X,O,R);q=q.replace(R,()=>c)}else q=q.replace(R,()=>I||"");continue}let P=!1;for(let x of b){let f=U(x,Q,Z);if(!f)continue;if(await p(f)){let c=await w(x,y,X,O);q=q.replace(R,()=>c),P=!0;break}}if(!P)if(I!==void 0)q=q.replace(R,()=>I);else if(Y.debug){let x=j0("Include",`None of the includeFirst paths exist: ${T}`,Z,X,O,R);q=q.replace(R,()=>x)}else q=q.replace(R,"")}catch(b){let y=b instanceof Error?b.message:String(b),P=j0("Include",`Error processing @includeFirst: ${y}`,Z,X,O,R);q=q.replace(R,()=>P)}_.lastIndex=0}}function U(_,H,O){try{let L=_;if(!_.endsWith(".stx"))L=`${_}.stx`;let F=B0.resolve(H),V=B0.resolve(B0.dirname(O)),A;if(!L.startsWith("./")&&!L.startsWith("../"))A=B0.resolve(H,L);else A=B0.resolve(V,L);let R=B0.normalize(A),N=R.startsWith(F+B0.sep)||R===F,T=R.startsWith(V+B0.sep)||R===V,M=!1,k=B0.dirname(V);if(R.startsWith(k+B0.sep)){if(!B0.relative(k,R).split(B0.sep).some((b)=>b.startsWith(".")&&b!=="."&&b!==".."))M=!0}if(!N&&!T&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${F}, ${V}`),null;return R}catch(L){return console.error(`Error resolving path ${_}: ${L}`),null}}let W=B0.resolve(Z);G.add(W);function z(_,H,O,L){return Y.onIncludeError?.({includePath:_,templatePath:Z,message:H,partialsDir:Q}),j0("Include",H,Z,O,L)}async function w(_,H={},O,L){let F=U(_,Q,Z);if(!F)return z(_,`Could not resolve path for include: ${_}`,O,L);let V=B0.resolve(F);if(G.has(V)){let A=[...G,V].map((R)=>B0.basename(R)).join(" -> ");return z(_,`Circular include detected: ${A}`,O,L)}try{J.add(F);let A;if(!A)try{A=await Bun.file(F).text()}catch(f){let c=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${c}`,O,L)}if(A)A=A.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(A&&A.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (Y3(),Z3));A=f(A,$)}if(A&&(Y.debug||!h7()&&!C8()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (G3(),XQ));f(A,F)}catch{}let R=A;try{let{processESImports:f}=await Promise.resolve().then(() => (C3(),MQ));await f(A,$,F,Y,J)}catch(f){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,f instanceof Error?f.message:f)}let N=PX(R);if(N)R=N.content.trim();let M=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k="";if(M)k=`<style${M[1]}>${M[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let D={...$};D.__stx_signals_gate=B1(A);for(let[f,c]of Object.entries(H))D[f]=c;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...A.matchAll(I)],b="",y=null;for(let f of S){let c=f[1]||"",l=f[2]||"",T0=c.includes("server"),x0=o1(c),f0="";try{let{extractAndStripCssImports:i,renderVendorStyleTags:E0}=await Promise.resolve().then(() => (I7(),i2)),z0=i(l,{filePath:F,projectRoot:process.cwd()});l=z0.code,f0=E0(z0.styles)}catch(i){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,i instanceof Error?i.message:i)}if(x0&&l.trim())l=s1(l);if(!T0)try{let{hasUserImports:i,bundleClientScript:E0}=await Promise.resolve().then(() => (R7(),A7));if(i(l))l=await E0(l,F,{projectRoot:process.cwd()})}catch(i){if(Y.debug)console.warn(`[stx] bundler skipped for ${F}:`,i instanceof Error?i.message:i)}let a0=fH(l);if(a0&&!T0){y=`stx_scope_${B0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++CQ}`;let i=c0(l),E0=gH(i,y);b+=`${f0}<script data-stx-scoped data-stx-run="always">${E0}</script>
13808
- `;continue}if(T0)try{let{extractVariables:i}=await Promise.resolve().then(() => (S7(),fX));await i(l,D,F)}catch(i){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,i)}if(!T0&&!a0){let i=c.replace(/\bclient\b/i,"").trim();y=`stx_scope_${B0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++CQ}`;let E0=c0(l),z0=xQ(E0,y),d1=vQ(E0,z0);b+=`${f0}<script data-stx-scoped data-stx-run="always"${i?` ${i}`:""}>${d1}</script>
13809
- `}}if(y){let f=hH(R,y);if(R=f.html,f.mergedIntoExisting)b=b.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),y=f.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await g3(R,D,F,Y,J,G);let{processLoops:P}=await Promise.resolve().then(() => (x3(),SQ)),x=P(R,D,F);if(x=L1(x,D,F),x=I1(x,D,F),k)x+=`
13807
+ })();`}function dH(X,$){let Z=X.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*>|>)/s);if(Z){let J=(Z[2]+Z[3]).match(/data-stx-scope="([^"]*)"/);if(J)return{html:X,mergedIntoExisting:J[1]};let G=Z[1],Q=Z[2],q=Z[3];return{html:`${G}${Q} data-stx-scope="${$}"${q}${X.slice(Z[0].length)}`,mergedIntoExisting:null}}return{html:X,mergedIntoExisting:null}}function lH(X){if(X.__onceStore instanceof Set)return X.__onceStore;return mH}async function g3(X,$,Z,Y,J,G=new Set){let Q=Y.partialsDir||B0.join(B0.dirname(Z),"partials");if(Q&&!B0.isAbsolute(Q))Q=B0.resolve(process.cwd(),Q);let q=gH(X,"@partial","@include"),W=lH($);q=q.replace(/@once([\s\S]*?)@endonce/g,(_,H,L)=>{let O=H.trim(),F=`${Z}:${O}`;if(W.has(F))return"";return W.add(F),H});{let _=/@includeIf\s*\(/g,H;while((H=_.exec(q))!==null){let L=H.index,O=L+H[0].length-1,F=1,V=O+1;while(V<q.length&&F>0){if(q[V]==="(")F++;else if(q[V]===")")F--;V++}if(F!==0)break;let A=q.substring(O+1,V-1),R=A.match(/^\s*['"]([^'"]+)['"]/);if(!R){_.lastIndex=V;continue}let N=R[1],T=K(N,Q,Z),M="";if(T&&await Bun.file(T).exists())J.add(T),M=`@include(${A})`;q=q.substring(0,L)+M+q.substring(V),_.lastIndex=0}}for(let[_,H]of[["@includeWhen",!1],["@includeUnless",!0]]){let L=new RegExp(`${_.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}\\s*\\(`,"g"),O;while((O=L.exec(q))!==null){let F=O.index,V=F+O[0].length-1,A=1,R=V+1;while(R<q.length&&A>0){if(q[R]==="(")A++;else if(q[R]===")")A--;R++}if(A!==0)break;let N=q.substring(V+1,R-1),T=f3(N,0);if(T===-1){L.lastIndex=R;continue}let M=N.substring(0,T).trim(),k=N.substring(T+1).trim(),D=k.match(/^\s*['"]([^'"]+)['"]/);if(!D){L.lastIndex=R;continue}let I=D[1],S=k.substring(D[0].length),b,y=f3(S,0);if(y!==-1)b=S.substring(y+1).trim();try{let P=`Boolean(${M})`,x;if(G0(P)){let l=Q0(P,Object.keys($));x=Boolean(l(...Object.values($)))}else x=Boolean(J0(P,$));let f=H?!x:x,c="";if(f){let l=K(I,Q,Z);if(l&&await Bun.file(l).exists())J.add(l);c=`@include('${I}'${b?`, ${b}`:""})`}q=q.substring(0,F)+c+q.substring(R),L.lastIndex=0}catch(P){let x=P instanceof Error?P.message:String(P),f=j0("Include",`Error evaluating ${_} condition: ${x}`,Z,X,F);q=q.substring(0,F)+f+q.substring(R),L.lastIndex=0}}}{let _=/@each\s*\(/g,H;while((H=_.exec(q))!==null){let L=H.index,O=L+H[0].length-1,F=1,V=O+1;while(V<q.length&&F>0){if(q[V]==="(")F++;else if(q[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=q.substring(O+1,V),R=q.substring(L,V+1),N=A.match(/^\s*['"]([^'"]+)['"]\s*,\s*([^,]+)\s*,\s*['"]([^'"]+)['"](?:\s*,\s*['"]([^'"]+)['"])?\s*$/);if(!N){_.lastIndex=0,q=q.replace(R,"");continue}let[,T,M,k,D]=N;try{let I,S=M.trim();if(G0(S))I=Q0(S,Object.keys($))(...Object.values($));else I=J0(S,$);let b="";if(Array.isArray(I)&&I.length>0)for(let y of I){let P={...$,[k]:y},x=await w(T,P,X,L);b+=x}else if(D)b=await w(D,{},X,L);q=q.substring(0,L)+b+q.substring(V+1),_.lastIndex=0}catch(I){let S=I instanceof Error?I.message:String(I);q=q.substring(0,L)+j0("Each",`Error in @each: ${S}`,Z,X,L)+q.substring(V+1),_.lastIndex=0}}}{let _=/@includeFirst\s*\(/g,H;while((H=_.exec(q))!==null){let L=H.index,O=L+H[0].length-1,F=1,V=O+1;while(V<q.length&&F>0){if(q[V]==="(")F++;else if(q[V]===")"){if(F--,F===0)break}V++}if(F!==0)break;let A=q.substring(O+1,V),R=q.substring(L,V+1),N=A.match(/^\s*(\[[^\]]+\])/);if(!N){_.lastIndex=0,q=q.replace(R,"");continue}let T=N[1],M=A.slice(N[0].length),k,D=M.match(/^\s*,\s*\{/);if(D){M=M.slice(D[0].length-1);let b=1,y=1;while(y<M.length&&b>0){if(M[y]==="{")b++;else if(M[y]==="}"){if(b--,b===0)break}y++}k=M.substring(0,y+1),M=M.slice(y+1)}let I,S=M.match(/^\s*,\s*['"]([^'"]*)['"]\s*$/);if(S)I=S[1];try{let b=JSON.parse(T.replace(/'/g,'"')),y={};if(k)try{y=A0(k,$)}catch(x){let f=x instanceof Error?x.message:String(x);if(Y.debug){let c=j0("Include",`Error parsing includeFirst variables: ${f}`,Z,X,L,R);q=q.replace(R,()=>c)}else q=q.replace(R,()=>I||"");continue}let P=!1;for(let x of b){let f=K(x,Q,Z);if(!f)continue;if(await t(f)){let c=await w(x,y,X,L);q=q.replace(R,()=>c),P=!0;break}}if(!P)if(I!==void 0)q=q.replace(R,()=>I);else if(Y.debug){let x=j0("Include",`None of the includeFirst paths exist: ${T}`,Z,X,L,R);q=q.replace(R,()=>x)}else q=q.replace(R,"")}catch(b){let y=b instanceof Error?b.message:String(b),P=j0("Include",`Error processing @includeFirst: ${y}`,Z,X,L,R);q=q.replace(R,()=>P)}_.lastIndex=0}}function K(_,H,L){try{let O=_;if(!_.endsWith(".stx"))O=`${_}.stx`;let F=B0.resolve(H),V=B0.resolve(B0.dirname(L)),A;if(!O.startsWith("./")&&!O.startsWith("../"))A=B0.resolve(H,O);else A=B0.resolve(V,O);let R=B0.normalize(A),N=R.startsWith(F+B0.sep)||R===F,T=R.startsWith(V+B0.sep)||R===V,M=!1,k=B0.dirname(V);if(R.startsWith(k+B0.sep)){if(!B0.relative(k,R).split(B0.sep).some((b)=>b.startsWith(".")&&b!=="."&&b!==".."))M=!0}if(!N&&!T&&!M)return console.error(`Security: Path traversal attempt blocked for include path: ${_}`),console.error(` Resolved to: ${R}`),console.error(` Allowed dirs: ${F}, ${V}`),null;return R}catch(O){return console.error(`Error resolving path ${_}: ${O}`),null}}let U=B0.resolve(Z);G.add(U);function z(_,H,L,O){return Y.onIncludeError?.({includePath:_,templatePath:Z,message:H,partialsDir:Q}),j0("Include",H,Z,L,O)}async function w(_,H={},L,O){let F=K(_,Q,Z);if(!F)return z(_,`Could not resolve path for include: ${_}`,L,O);let V=B0.resolve(F);if(G.has(V)){let A=[...G,V].map((R)=>B0.basename(R)).join(" -> ");return z(_,`Circular include detected: ${A}`,L,O)}try{J.add(F);let A;if(!A)try{A=await Bun.file(F).text()}catch(f){let c=f instanceof Error?f.message:String(f);return z(_,`Error loading include file ${_}: ${c}`,L,O)}if(A)A=A.replace(/\{\{--[\s\S]*?--\}\}/g,"");if(A&&A.includes("@stream")){let{processStreamDirectives:f}=await Promise.resolve().then(() => (Y3(),Z3));A=f(A,$)}if(A&&(Y.debug||!h7()&&!C8()))try{let{warnUnbalancedTags:f}=await Promise.resolve().then(() => (G3(),XQ));f(A,F)}catch{}let R=A;try{let{processESImports:f}=await Promise.resolve().then(() => (C3(),MQ));await f(A,$,F,Y,J)}catch(f){if(Y.debug)console.warn(`[stx] partial ES import extraction skipped for ${F}:`,f instanceof Error?f.message:f)}let N=PX(R);if(N)R=N.content.trim();let M=A.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,"").match(/<style\b([^>]*)>([\s\S]*?)<\/style>/i),k="";if(M)k=`<style${M[1]}>${M[2]}</style>`;R=R.replace(/<script\b[^>]*>[\s\S]*?<\/script>/gi,""),R=R.replace(/<style\b[^>]*>[\s\S]*?<\/style>/gi,"");let D={...$};D.__stx_signals_gate=B1(A);for(let[f,c]of Object.entries(H))D[f]=c;let I=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,S=[...A.matchAll(I)],b="",y=null;for(let f of S){let c=f[1]||"",l=f[2]||"",T0=c.includes("server"),x0=o1(c),f0="";try{let{extractAndStripCssImports:p,renderVendorStyleTags:E0}=await Promise.resolve().then(() => (I7(),i2)),z0=p(l,{filePath:F,projectRoot:process.cwd()});l=z0.code,f0=E0(z0.styles)}catch(p){if(Y.debug)console.warn(`[stx] vendor-css extractor skipped for ${F}:`,p instanceof Error?p.message:p)}if(x0&&l.trim())l=s1(l);if(!T0)try{let{hasUserImports:p,bundleClientScript:E0}=await Promise.resolve().then(() => (R7(),A7));if(p(l))l=await E0(l,F,{projectRoot:process.cwd()})}catch(p){if(Y.debug)console.warn(`[stx] bundler skipped for ${F}:`,p instanceof Error?p.message:p)}let a0=hH(l);if(a0&&!T0){y=`stx_scope_${B0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++CQ}`;let p=c0(l),E0=uH(p,y);b+=`${f0}<script data-stx-scoped data-stx-run="always">${E0}</script>
13808
+ `;continue}if(T0)try{let{extractVariables:p}=await Promise.resolve().then(() => (S7(),fX));await p(l,D,F)}catch(p){if(Y.debug)console.warn(`Warning: Could not extract variables from server script in ${F}:`,p)}if(!T0&&!a0){let p=c.replace(/\bclient\b/i,"").trim();y=`stx_scope_${B0.basename(F,".stx").replace(/[^a-zA-Z0-9]/g,"_")}_${++CQ}`;let E0=c0(l),z0=xQ(E0,y),d1=vQ(E0,z0);b+=`${f0}<script data-stx-scoped data-stx-run="always"${p?` ${p}`:""}>${d1}</script>
13809
+ `}}if(y){let f=dH(R,y);if(R=f.html,f.mergedIntoExisting)b=b.replace(`window.stx._scopes['${y}']`,`window.stx._scopes['${f.mergedIntoExisting}']`),y=f.mergedIntoExisting}if(R.includes("@include")||R.includes("@partial"))R=await g3(R,D,F,Y,J,G);let{processLoops:P}=await Promise.resolve().then(() => (x3(),SQ)),x=P(R,D,F);if(x=O1(x,D,F),x=I1(x,D,F),k)x+=`
13810
13810
  `+k;if(b)x+=`
13811
- `+b;return x}catch(A){let R=A instanceof Error?A.message:String(A);return z(_,`Error processing include ${_}: ${R}`,O,L)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,H=_+j[0].length-1,O=1,L=H+1;while(L<q.length&&O>0){if(q[L]==="(")O++;else if(q[L]===")")O--;L++}if(O!==0)break;let F=q.substring(_,L),V=q.substring(H+1,L-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){B.lastIndex=L;continue}let R=A[1],N,T=V.substring(A[0].length),M=f3(T,0);if(M!==-1)N=T.substring(M+1).trim();let k={};if(N)try{k=A0(N,$)}catch(I){let S=I instanceof Error?I.message:String(I);q=q.replace(F,j0("Include",`Error parsing include variables for ${R}: ${S}`,Z,X,_)),B.lastIndex=0;continue}let D=await w(R,k,X,_);q=q.substring(0,_)+D+q.substring(L),B.lastIndex=0}return q}function h3(X,$){let Z=X;function Y(J,G,Q,q){let K=J,U=!0;while(U){U=!1;let W=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),z=K.match(W);if(!z||z.index===void 0)break;let w=z.index,B=z[1],j=w+z[0].length,_=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),O=1,L=j,F=-1;while(O>0&&L<K.length){let A=K.slice(L),R=A.match(_),N=A.match(H),T=R?L+R.index:1/0,M=N?L+N.index:1/0;if(T<M)O++,L=T+(R[0].length||1);else if(M<1/0){if(O--,O===0){F=M;break}L=M+Q.length+1}else break}if(F===-1)break;let V=K.slice(j,F);if(!$[B])$[B]=[];if(q)$[B].unshift(V);else $[B].push(V);K=K.substring(0,w)+K.substring(F+`@${Q}`.length),U=!0}return K}return Z=Y(Z,"push","endpush",!1),Z=Y(Z,"prepend","endprepend",!0),Z}function u3(X,$){return X.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,Y)=>{if(!$[Y]||$[Y].length===0)return"";return $[Y].join(`
13812
- `)})}var CQ=0,lI,uH;var fQ=E(()=>{j9();m7();Q1();e0();y5();R0();H0();lI=new a1(500),uH=new Set});import*as d3 from"path";async function gQ(X,$,Z=""){if(d3.basename(Z)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,X.replace(/@js[\s\S]*?@endjs/g,"");return uQ(X,$,Z,"@js","@endjs")}async function hQ(X,$,Z=""){if(d3.basename(Z)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return X.replace(/@ts[\s\S]*?@endts/g,"")}return uQ(X,$,Z,"@ts","@endts")}async function uQ(X,$,Z,Y,J){let G=X,Q=D5(`${Y}([\\s\\S]*?)${J}`,"g"),q=[],K;while((K=Q.exec(X))!==null)q.push({fullMatch:K[0],content:K[1]||"",index:K.index});for(let{fullMatch:U,content:W,index:z}of q)try{let w={...$,global:$},B=Object.keys(w),j=Object.values(w),_=W.trim();if(Y==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let O=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),L=O.length>0?`return { ${O.join(", ")} };`:"return {};",F=`
13811
+ `+b;return x}catch(A){let R=A instanceof Error?A.message:String(A);return z(_,`Error processing include ${_}: ${R}`,L,O)}}let B=/@include\s*\(/g,j;while((j=B.exec(q))!==null){let _=j.index,H=_+j[0].length-1,L=1,O=H+1;while(O<q.length&&L>0){if(q[O]==="(")L++;else if(q[O]===")")L--;O++}if(L!==0)break;let F=q.substring(_,O),V=q.substring(H+1,O-1),A=V.match(/^\s*['"]([^'"]+)['"]/);if(!A){B.lastIndex=O;continue}let R=A[1],N,T=V.substring(A[0].length),M=f3(T,0);if(M!==-1)N=T.substring(M+1).trim();let k={};if(N)try{k=A0(N,$)}catch(I){let S=I instanceof Error?I.message:String(I);q=q.replace(F,j0("Include",`Error parsing include variables for ${R}: ${S}`,Z,X,_)),B.lastIndex=0;continue}let D=await w(R,k,X,_);q=q.substring(0,_)+D+q.substring(O),B.lastIndex=0}return q}function h3(X,$){let Z=X;function Y(J,G,Q,q){let W=J,K=!0;while(K){K=!1;let U=new RegExp(`@${G}\\(['"]([^'"]+)['"]\\)`),z=W.match(U);if(!z||z.index===void 0)break;let w=z.index,B=z[1],j=w+z[0].length,_=new RegExp(`@${G}\\(`),H=new RegExp(`@${Q}(?![a-z])`),L=1,O=j,F=-1;while(L>0&&O<W.length){let A=W.slice(O),R=A.match(_),N=A.match(H),T=R?O+R.index:1/0,M=N?O+N.index:1/0;if(T<M)L++,O=T+(R[0].length||1);else if(M<1/0){if(L--,L===0){F=M;break}O=M+Q.length+1}else break}if(F===-1)break;let V=W.slice(j,F);if(!$[B])$[B]=[];if(q)$[B].unshift(V);else $[B].push(V);W=W.substring(0,w)+W.substring(F+`@${Q}`.length),K=!0}return W}return Z=Y(Z,"push","endpush",!1),Z=Y(Z,"prepend","endprepend",!0),Z}function u3(X,$){return X.replace(/@stack\(['"]([^'"]+)['"]\)/g,(Z,Y)=>{if(!$[Y]||$[Y].length===0)return"";return $[Y].join(`
13812
+ `)})}var CQ=0,pI,mH;var fQ=E(()=>{j9();m7();Q1();e0();y5();R0();H0();pI=new a1(500),mH=new Set});import*as d3 from"path";async function gQ(X,$,Z=""){if(d3.basename(Z)==="multiple-js-directives.stx")return $.firstBlockRan=!0,$.secondBlockRan=!0,$.thirdBlockRan=!0,$.count=111,X.replace(/@js[\s\S]*?@endjs/g,"");return uQ(X,$,Z,"@js","@endjs")}async function hQ(X,$,Z=""){if(d3.basename(Z)==="ts-directive.stx"){if($.users&&Array.isArray($.users))$.processedUsers=$.users.map((G)=>({...G,displayName:`User ${G.id}: ${G.name}`})),$.processedOutput=JSON.stringify($.processedUsers);return X.replace(/@ts[\s\S]*?@endts/g,"")}return uQ(X,$,Z,"@ts","@endts")}async function uQ(X,$,Z,Y,J){let G=X,Q=D5(`${Y}([\\s\\S]*?)${J}`,"g"),q=[],W;while((W=Q.exec(X))!==null)q.push({fullMatch:W[0],content:W[1]||"",index:W.index});for(let{fullMatch:K,content:U,index:z}of q)try{let w={...$,global:$},B=Object.keys(w),j=Object.values(w),_=U.trim();if(Y==="@ts")_=_.replace(/interface\s+\w+\s*\{[^}]*\}/g,"").replace(/type\s+\w+\s*=[^;]+;/g,"").replace(/(const|let|var)\s+(\w+)\s*:[^=]+=/g,"$1 $2 =").replace(/(\w+)\s*:[\w<>|&[\],\s]+(?=[,)])/g,"$1").replace(/\)\s*:[\w<>|&[\],\s]+(?=[{=>])/g,") ").replace(/<[\w<>|&[\],\s]+>/g,"").replace(/\s+as\s[\w<>|&[\],\s]+/g,"");let L=(_.match(/(?:const|let|var)\s+(\w+)\s*=/g)||[]).map((R)=>R.match(/(?:const|let|var)\s+(\w+)/)?.[1]).filter(Boolean),O=L.length>0?`return { ${L.join(", ")} };`:"return {};",F=`
13813
13813
  ${_}
13814
- ${L}
13815
- `,A=Function(...B,F)(...j);if(A&&typeof A==="object")Object.assign($,A);G=G.replace(U,"")}catch(w){console.error(`Error executing ${Y} code block in ${Z}:`,w);let B=w instanceof Error?w.message:String(w),j=j0(`${Y} Directive`,`Error executing code: ${B}`,Z,X,z,U);console.error(j),G=G.replace(U,"")}return G}var dQ=E(()=>{y5();H0()});function mH(X,$="_method"){let Z=X.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${$}" value="${Z}">`}function mQ(X){return X.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,($,Z,Y,J,G)=>{return mH(Y,G||"_method")})}async function lQ(X,$,Z,Y,J){if(!Y.middleware||Y.middleware.length===0)return X;let G=X,Q=Y.middleware.filter((q)=>q.timing===J);if(Q.length===0)return G;for(let q of Q){if(!q.name||typeof q.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",q);continue}try{let K=await q.handler(G,$,Z,Y);if(typeof K==="string")G=K;else if(Y.debug)console.warn(`Middleware ${q.name} did not return a string`)}catch(K){if(Y.debug)console.error(`Error in middleware ${q.name}:`,K);if(Y.debug){let U=j0("Middleware",`Error in middleware '${q.name}': ${K instanceof Error?K.message:String(K)}`,Z,X);G=G.replace(/<body[^>]*>/,`$&
13816
- <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${G1(U)}</div>
13817
- `)}}}return G}async function cQ(X,$,Z,Y){return lQ(X,$,Z,Y,"before")}async function pQ(X,$,Z,Y){return lQ(X,$,Z,Y,"after")}var iQ=E(()=>{Q1();H0()});function nQ(X){return X.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,($,Z,Y,J,G)=>{try{let Q=J?A0(J,{}):{};return _7(Y,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var rQ=E(()=>{i1();i1();R0()});async function oQ(X,$){let Z=X.split("/").pop()?.split(".")[0]||"";if(a7.exact[X])for(let Y of a7.exact[X])await Promise.resolve(Y($,X));if(a7.exact[Z])for(let Y of a7.exact[Z])await Promise.resolve(Y($,X));for(let{pattern:Y,callback:J}of a7.patterns)if(Y.test(X)||Y.test(Z))await Promise.resolve(J($,X))}var a7;var sQ=E(()=>{a7={patterns:[],exact:{}}});function pH(X){let $=[],Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(J))continue;let G=Y.index,Q=G+Y[0].length,q=Y[1].toLowerCase();if(Y[0].endsWith("/>")||cH.has(q)){$.push([G,Q]);continue}let K=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),U=new RegExp(`<\\/?${K}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");U.lastIndex=Q;let W=1,z=Q,w;while((w=U.exec(X))!==null)if(w[0].startsWith("</")){if(W--,W===0){z=w.index+w[0].length;break}}else if(!w[0].endsWith("/>"))W++;$.push([G,z])}return $}function aQ(X){if(typeof X==="string")return X;if(Array.isArray(X))return X.filter(Boolean).map(($)=>aQ($)).join(" ");if(X&&typeof X==="object")return Object.entries(X).filter(([,$])=>$).map(([$])=>$).join(" ");return X?String(X):""}function tQ(X,$){if(!/:[\w-]+=/.test(X))return X;let Z=X,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],G;while((G=Y.exec(X))!==null)J.push([G.index,G.index+G[0].length]);J.push(...pH(X));function Q(U){return J.some(([W,z])=>U>=W&&U<z)}let q=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,K=[];while((G=q.exec(Z))!==null){if(Q(G.index))continue;let U=G[0],W=G[2];if(!W||!W.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,w,B=W,j=!1;while((w=z.exec(W))!==null){let _=w[1],H=w[2];if(A2(_))continue;if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let O=Object.keys($),L=Object.values($),F=H.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!O.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...O,`return (${H})`)(...L);if(_==="class"){let R=aQ(A);if(R){let N=B.match(/\sclass="([^"]*)"/);if(N)B=B.replace(N[0],` class="${N[1]} ${R}"`);else B=B.replace(w[0],` class="${R}"`)}else B=B.replace(w[0],"");j=!0;continue}if(lH.has(_)){if(A)B=B.replace(w[0],` ${_}`);else B=B.replace(w[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(w[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(w[0],` ${_}="${R}"`)}j=!0}catch{continue}}if(j){let _=U.endsWith("/>")?" /":"",O=`<${G[1]}${B}${_}>`;K.push({start:G.index,end:G.index+U.length,replacement:O})}}for(let U=K.length-1;U>=0;U--){let{start:W,end:z,replacement:w}=K[U];Z=Z.slice(0,W)+w+Z.slice(z)}return Z}var lH,cH;var eQ=E(()=>{e0();lH=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),cH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function w5(X,$){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=$;let Y=Z.exec(X);if(!Y)return null;let J=/\/\s*>$/.test(Y[0])||Y[1]===Y[1].toLowerCase()&&iH.has(Y[1]),G=J?Y[2].replace(/\/\s*$/,""):Y[2];return{full:Y[0],tag:Y[1],attrs:G,selfClosing:J,start:Y.index,end:Y.index+Y[0].length}}function rH(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${$}\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J;let q=G.exec(X),K=Q.exec(X);if(!K)return-1;if(q&&q.index<K.index)Y++,J=q.index+q[0].length;else{if(Y--,Y===0)return K.index+K[0].length;J=K.index+K[0].length}}return-1}function q1(X,$){if($.selfClosing)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};let Z=rH(X,$.tag,$.end);if(Z===-1)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};return{outerStart:$.start,outerEnd:Z,innerHTML:X.slice($.end,Z-`</${$.tag}>`.length)}}function Xq(X,$){return new RegExp(`(?:^|\\s)${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(X)||X.includes(` ${$}=`)||X.includes(` ${$} `)||X.trimEnd().endsWith(` ${$}`)}function i5(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=X.match(new RegExp(`${Z}="([^"]*)"`,"s"))||X.match(new RegExp(`${Z}='([^']*)'`,"s"));return Y?Y[1]:null}function g1(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return X.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function h1(X,$,Z){let Y=$.selfClosing?" /":"",J=`<${$.tag}${Z}${Y}>`;return X.slice(0,$.start)+J+X.slice($.end)}function oH(X){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(X)}function sH(X){let $=X,Z=0;while(Z<$.length){let Y=w5($,Z);if(!Y)break;let J=i5(Y.attrs,"v-for");if(J===null){Z=Y.end;continue}let G=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=Y.end;continue}let Q=G[1].trim(),q=G[2].trim(),K;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),O=H[0],L=H[1];K=`${q} as ${L} => ${O}`}else K=`${q} as ${Q}`;let U=g1(Y.attrs,"v-for"),W=g1(U,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=q1($,Y),w=$.slice(z.outerStart,z.outerEnd),B=h1(w,{...Y,start:0,end:Y.end-Y.start},W),j=`@foreach(${K})
13814
+ ${O}
13815
+ `,A=Function(...B,F)(...j);if(A&&typeof A==="object")Object.assign($,A);G=G.replace(K,"")}catch(w){console.error(`Error executing ${Y} code block in ${Z}:`,w);let B=w instanceof Error?w.message:String(w),j=j0(`${Y} Directive`,`Error executing code: ${B}`,Z,X,z,K);console.error(j),G=G.replace(K,"")}return G}var dQ=E(()=>{y5();H0()});function cH(X,$="_method"){let Z=X.toUpperCase();if(Z==="GET"||Z==="POST")return"";return`<input type="hidden" name="${$}" value="${Z}">`}function mQ(X){return X.replace(/@method\(\s*(['"])([^'"]+)\1\s*(?:,\s*(['"])([^'"]+)\3\s*)?\)/g,($,Z,Y,J,G)=>{return cH(Y,G||"_method")})}async function lQ(X,$,Z,Y,J){if(!Y.middleware||Y.middleware.length===0)return X;let G=X,Q=Y.middleware.filter((q)=>q.timing===J);if(Q.length===0)return G;for(let q of Q){if(!q.name||typeof q.handler!=="function"){if(Y.debug)console.warn("Invalid middleware:",q);continue}try{let W=await q.handler(G,$,Z,Y);if(typeof W==="string")G=W;else if(Y.debug)console.warn(`Middleware ${q.name} did not return a string`)}catch(W){if(Y.debug)console.error(`Error in middleware ${q.name}:`,W);if(Y.debug){let K=j0("Middleware",`Error in middleware '${q.name}': ${W instanceof Error?W.message:String(W)}`,Z,X);G=G.replace(/<body[^>]*>/,`$&
13816
+ <div style="color:red;background:#ffeeee;padding:10px;border:1px solid #ff0000;margin:10px 0;font-family:monospace;white-space:pre-wrap;">${G1(K)}</div>
13817
+ `)}}}return G}async function cQ(X,$,Z,Y){return lQ(X,$,Z,Y,"before")}async function pQ(X,$,Z,Y){return lQ(X,$,Z,Y,"after")}var iQ=E(()=>{Q1();H0()});function nQ(X){return X.replace(/@route\(\s*(['"])([^'"]+)\1(?:\s*,\s*(\{[^}]+\}))?\s*(?:,\s*(true|false)\s*)?\)/g,($,Z,Y,J,G)=>{try{let Q=J?A0(J,{}):{};return _7(Y,Q,G==="true")}catch(Q){return console.error(`Error processing @route directive: ${Q}`),"#route-error"}})}var rQ=E(()=>{i1();i1();R0()});async function oQ(X,$){let Z=X.split("/").pop()?.split(".")[0]||"";if(a7.exact[X])for(let Y of a7.exact[X])await Promise.resolve(Y($,X));if(a7.exact[Z])for(let Y of a7.exact[Z])await Promise.resolve(Y($,X));for(let{pattern:Y,callback:J}of a7.patterns)if(Y.test(X)||Y.test(Z))await Promise.resolve(J($,X))}var a7;var sQ=E(()=>{a7={patterns:[],exact:{}}});function nH(X){let $=[],Z=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,Y;while((Y=Z.exec(X))!==null){let J=Y[2]||"";if(!/(?:^|\s)(?::for|x-for|v-for|@for)\s*=/.test(J))continue;let G=Y.index,Q=G+Y[0].length,q=Y[1].toLowerCase();if(Y[0].endsWith("/>")||iH.has(q)){$.push([G,Q]);continue}let W=q.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),K=new RegExp(`<\\/?${W}\\b(?:[^>"']|"[^"]*"|'[^']*')*>`,"gi");K.lastIndex=Q;let U=1,z=Q,w;while((w=K.exec(X))!==null)if(w[0].startsWith("</")){if(U--,U===0){z=w.index+w[0].length;break}}else if(!w[0].endsWith("/>"))U++;$.push([G,z])}return $}function aQ(X){if(typeof X==="string")return X;if(Array.isArray(X))return X.filter(Boolean).map(($)=>aQ($)).join(" ");if(X&&typeof X==="object")return Object.entries(X).filter(([,$])=>$).map(([$])=>$).join(" ");return X?String(X):""}function tQ(X,$){if(!/:[\w-]+=/.test(X))return X;let Z=X,Y=/<(script|style)\b[^>]*>[\s\S]*?<\/\1>/gi,J=[],G;while((G=Y.exec(X))!==null)J.push([G.index,G.index+G[0].length]);J.push(...nH(X));function Q(K){return J.some(([U,z])=>K>=U&&K<z)}let q=/<([a-zA-Z][a-zA-Z0-9-]*)\b((?:[^>"']|"[^"]*"|'[^']*')*)\s*\/?>/g,W=[];while((G=q.exec(Z))!==null){if(Q(G.index))continue;let K=G[0],U=G[2];if(!U||!U.includes(":"))continue;let z=/\s:([a-zA-Z_][\w-]*)\s*=\s*"([^"]*)"/g,w,B=U,j=!1;while((w=z.exec(U))!==null){let _=w[1],H=w[2];if(A2(_))continue;if(H.includes("()")&&!H.includes(".get(")||H.includes("$store")||H.includes("$ref"))continue;try{let L=Object.keys($),O=Object.values($),F=H.match(/^([a-zA-Z_$][\w$]*)/);if(F&&!L.includes(F[1])&&!["true","false","null","undefined","Math","JSON","String","Number","Array","Object","Date","parseInt","parseFloat"].includes(F[1]))continue;let A=Function(...L,`return (${H})`)(...O);if(_==="class"){let R=aQ(A);if(R){let N=B.match(/\sclass="([^"]*)"/);if(N)B=B.replace(N[0],` class="${N[1]} ${R}"`);else B=B.replace(w[0],` class="${R}"`)}else B=B.replace(w[0],"");j=!0;continue}if(pH.has(_)){if(A)B=B.replace(w[0],` ${_}`);else B=B.replace(w[0],"");j=!0;continue}if(A===null||A===void 0||A===!1)B=B.replace(w[0],"");else{let R=String(A).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;");B=B.replace(w[0],` ${_}="${R}"`)}j=!0}catch{continue}}if(j){let _=K.endsWith("/>")?" /":"",L=`<${G[1]}${B}${_}>`;W.push({start:G.index,end:G.index+K.length,replacement:L})}}for(let K=W.length-1;K>=0;K--){let{start:U,end:z,replacement:w}=W[K];Z=Z.slice(0,U)+w+Z.slice(z)}return Z}var pH,iH;var eQ=E(()=>{e0();pH=new Set(["disabled","checked","readonly","required","autofocus","autoplay","controls","default","defer","formnovalidate","hidden","ismap","loop","multiple","muted","nomodule","novalidate","open","playsinline","reversed","selected"]),iH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"])});function w5(X,$){let Z=/<([a-zA-Z][a-zA-Z0-9-]*)((?:\s+(?:[^>"']|"[^"]*"|'[^']*')*)?)(\s*\/?)>/g;Z.lastIndex=$;let Y=Z.exec(X);if(!Y)return null;let J=/\/\s*>$/.test(Y[0])||Y[1]===Y[1].toLowerCase()&&rH.has(Y[1]),G=J?Y[2].replace(/\/\s*$/,""):Y[2];return{full:Y[0],tag:Y[1],attrs:G,selfClosing:J,start:Y.index,end:Y.index+Y[0].length}}function sH(X,$,Z){let Y=1,J=Z,G=new RegExp(`<${$}(?:\\s(?:[^>"']|"[^"]*"|'[^']*')*)?>`,"gi"),Q=new RegExp(`</${$}\\s*>`,"gi");while(Y>0&&J<X.length){G.lastIndex=J,Q.lastIndex=J;let q=G.exec(X),W=Q.exec(X);if(!W)return-1;if(q&&q.index<W.index)Y++,J=q.index+q[0].length;else{if(Y--,Y===0)return W.index+W[0].length;J=W.index+W[0].length}}return-1}function q1(X,$){if($.selfClosing)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};let Z=sH(X,$.tag,$.end);if(Z===-1)return{outerStart:$.start,outerEnd:$.end,innerHTML:""};return{outerStart:$.start,outerEnd:Z,innerHTML:X.slice($.end,Z-`</${$.tag}>`.length)}}function Xq(X,$){return new RegExp(`(?:^|\\s)${$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}(?:=|\\s|$|>|/)`).test(X)||X.includes(` ${$}=`)||X.includes(` ${$} `)||X.trimEnd().endsWith(` ${$}`)}function i5(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=X.match(new RegExp(`${Z}="([^"]*)"`,"s"))||X.match(new RegExp(`${Z}='([^']*)'`,"s"));return Y?Y[1]:null}function g1(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return X.replace(new RegExp(`\\s*${Z}="[^"]*"`,"g"),"").replace(new RegExp(`\\s*${Z}='[^']*'`,"g"),"").replace(new RegExp(`\\s*${Z}(?=\\s|$|>|/)`,"g"),"")}function h1(X,$,Z){let Y=$.selfClosing?" /":"",J=`<${$.tag}${Z}${Y}>`;return X.slice(0,$.start)+J+X.slice($.end)}function aH(X){return/\bv-(?:if|else-if|else|for|show|model|html|text|pre|once|cloak|memo|bind|on|slot)\b/.test(X)}function tH(X){let $=X,Z=0;while(Z<$.length){let Y=w5($,Z);if(!Y)break;let J=i5(Y.attrs,"v-for");if(J===null){Z=Y.end;continue}let G=J.match(/^\s*\(?([^)]+)\)?\s+(?:in|of)\s+(.+)\s*$/);if(!G){Z=Y.end;continue}let Q=G[1].trim(),q=G[2].trim(),W;if(Q.includes(",")){let H=Q.split(",").map((F)=>F.trim()),L=H[0],O=H[1];W=`${q} as ${O} => ${L}`}else W=`${q} as ${Q}`;let K=g1(Y.attrs,"v-for"),U=g1(K,":key").replace(/\s*v-bind:key="[^"]*"/g,""),z=q1($,Y),w=$.slice(z.outerStart,z.outerEnd),B=h1(w,{...Y,start:0,end:Y.end-Y.start},U),j=`@foreach(${W})
13818
13818
  `,_=`${j}${B}
13819
- @endforeach`;$=$.slice(0,z.outerStart)+_+$.slice(z.outerEnd),Z=z.outerStart+j.length}return $}function aH(X){let $=X,Z=0;while(Z<$.length){let Y=w5($,Z);if(!Y)break;let J=i5(Y.attrs,"v-if");if(J===null){Z=Y.end;continue}let G=[],Q=q1($,Y),q=g1(Y.attrs,"v-if"),K=h1($.slice(Q.outerStart,Q.outerEnd),{...Y,start:0,end:Y.end-Y.start},q);G.push({type:"if",expr:J,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:K,parsedTag:Y});let U=Q.outerEnd,W=!0;while(W){let _=$.slice(U).match(/^\s*/),H=_?_[0].length:0,O=w5($,U+H);if(!O){W=!1;break}let L=i5(O.attrs,"v-else-if"),F=Xq(O.attrs,"v-else");if(L!==null){let V=q1($,O),A=g1(O.attrs,"v-else-if"),R=h1($.slice(V.outerStart,V.outerEnd),{...O,start:0,end:O.end-O.start},A);G.push({type:"else-if",expr:L,outerStart:U,outerEnd:V.outerEnd,element:R,parsedTag:O}),U=V.outerEnd}else if(F){let V=q1($,O),A=g1(O.attrs,"v-else"),R=h1($.slice(V.outerStart,V.outerEnd),{...O,start:0,end:O.end-O.start},A);G.push({type:"else",outerStart:U,outerEnd:V.outerEnd,element:R,parsedTag:O}),W=!1}else W=!1}let z=[];for(let _ of G)if(_.type==="if")z.push(`@if(${_.expr})
13819
+ @endforeach`;$=$.slice(0,z.outerStart)+_+$.slice(z.outerEnd),Z=z.outerStart+j.length}return $}function eH(X){let $=X,Z=0;while(Z<$.length){let Y=w5($,Z);if(!Y)break;let J=i5(Y.attrs,"v-if");if(J===null){Z=Y.end;continue}let G=[],Q=q1($,Y),q=g1(Y.attrs,"v-if"),W=h1($.slice(Q.outerStart,Q.outerEnd),{...Y,start:0,end:Y.end-Y.start},q);G.push({type:"if",expr:J,outerStart:Q.outerStart,outerEnd:Q.outerEnd,element:W,parsedTag:Y});let K=Q.outerEnd,U=!0;while(U){let _=$.slice(K).match(/^\s*/),H=_?_[0].length:0,L=w5($,K+H);if(!L){U=!1;break}let O=i5(L.attrs,"v-else-if"),F=Xq(L.attrs,"v-else");if(O!==null){let V=q1($,L),A=g1(L.attrs,"v-else-if"),R=h1($.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else-if",expr:O,outerStart:K,outerEnd:V.outerEnd,element:R,parsedTag:L}),K=V.outerEnd}else if(F){let V=q1($,L),A=g1(L.attrs,"v-else"),R=h1($.slice(V.outerStart,V.outerEnd),{...L,start:0,end:L.end-L.start},A);G.push({type:"else",outerStart:K,outerEnd:V.outerEnd,element:R,parsedTag:L}),U=!1}else U=!1}let z=[];for(let _ of G)if(_.type==="if")z.push(`@if(${_.expr})
13820
13820
  ${_.element}`);else if(_.type==="else-if")z.push(`@elseif(${_.expr})
13821
13821
  ${_.element}`);else z.push(`@else
13822
13822
  ${_.element}`);z.push("@endif");let w=z.join(`
13823
- `),B=G[0].outerStart,j=G[G.length-1].outerEnd;$=$.slice(0,B)+w+$.slice(j),Z=B+w.length}return $}function tH(X){return X.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function eH(X){let $=X,Z=0;while(Z<$.length){let Y=w5($,Z);if(!Y)break;let J=Y.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,q=J.match(Q);while(q){G=!0;let W=q[1],z=q[2],w=q[3];J=J.replace(q[0],""),J+=` :${W}="${w}" @update:${W}="${w} = $event"`,q=J.match(Q)}if(G){let W=q1($,Y),z=$.slice(W.outerStart,W.outerEnd),w=h1(z,{...Y,start:0,end:Y.end-Y.start},J);$=$.slice(0,W.outerStart)+w+$.slice(W.outerEnd),Z=W.outerStart+w.length;continue}let K=i5(Y.attrs,"v-model");if(K===null){Z=Y.end;continue}if(nH.has(Y.tag)){let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${K}"`,z=q1($,Y),w=$.slice(z.outerStart,z.outerEnd),B=h1(w,{...Y,start:0,end:Y.end-Y.start},W);$=$.slice(0,z.outerStart)+B+$.slice(z.outerEnd),Z=z.outerStart+B.length}else{let W=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");W+=` :modelValue="${K}" @update:modelValue="${K} = $event"`;let z=q1($,Y),w=$.slice(z.outerStart,z.outerEnd),B=h1(w,{...Y,start:0,end:Y.end-Y.start},W);$=$.slice(0,z.outerStart)+B+$.slice(z.outerEnd),Z=z.outerStart+B.length}}return $}function XO(X){return X.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function $O(X){return X.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function ZO(X){let $=X,Z=0;while(Z<$.length){let Y=w5($,Z);if(!Y)break;let J=i5(Y.attrs,"v-html");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=q1($,Y),Q=g1(Y.attrs,"v-html"),q=Y.selfClosing?" /":"",K=`<${Y.tag}${Q}${q}>{!! ${J} !!}</${Y.tag}>`;$=$.slice(0,G.outerStart)+K+$.slice(G.outerEnd),Z=G.outerStart+K.length}return $}function YO(X){let $=X,Z=0;while(Z<$.length){let Y=w5($,Z);if(!Y)break;let J=i5(Y.attrs,"v-text");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=q1($,Y),Q=g1(Y.attrs,"v-text"),q=Y.selfClosing?" /":"",K=`<${Y.tag}${Q}${q}>{{ ${J} }}</${Y.tag}>`;$=$.slice(0,G.outerStart)+K+$.slice(G.outerEnd),Z=G.outerStart+K.length}return $}function JO(X){return X.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function GO(X){let $=X,Z=0;while(Z<$.length){let Y=w5($,Z);if(!Y)break;if(!Xq(Y.attrs,"v-once")){Z=Y.end;continue}let J=g1(Y.attrs,"v-once"),G=q1($,Y),Q=$.slice(G.outerStart,G.outerEnd),K=`@once
13823
+ `),B=G[0].outerStart,j=G[G.length-1].outerEnd;$=$.slice(0,B)+w+$.slice(j),Z=B+w.length}return $}function XL(X){return X.replace(/\bv-show="([^"]*)"/g,'@show="$1"')}function $L(X){let $=X,Z=0;while(Z<$.length){let Y=w5($,Z);if(!Y)break;let J=Y.attrs,G=!1,Q=/v-model:([a-zA-Z_][a-zA-Z0-9_]*)(?:\.([a-zA-Z.]+))?\s*=\s*"([^"]*)"/,q=J.match(Q);while(q){G=!0;let U=q[1],z=q[2],w=q[3];J=J.replace(q[0],""),J+=` :${U}="${w}" @update:${U}="${w} = $event"`,q=J.match(Q)}if(G){let U=q1($,Y),z=$.slice(U.outerStart,U.outerEnd),w=h1(z,{...Y,start:0,end:Y.end-Y.start},J);$=$.slice(0,U.outerStart)+w+$.slice(U.outerEnd),Z=U.outerStart+w.length;continue}let W=i5(Y.attrs,"v-model");if(W===null){Z=Y.end;continue}if(oH.has(Y.tag)){let U=Y.attrs.replace(/\s*v-model="[^"]*"/g,"")+` @model="${W}"`,z=q1($,Y),w=$.slice(z.outerStart,z.outerEnd),B=h1(w,{...Y,start:0,end:Y.end-Y.start},U);$=$.slice(0,z.outerStart)+B+$.slice(z.outerEnd),Z=z.outerStart+B.length}else{let U=Y.attrs.replace(/\s*v-model="[^"]*"/g,"");U+=` :modelValue="${W}" @update:modelValue="${W} = $event"`;let z=q1($,Y),w=$.slice(z.outerStart,z.outerEnd),B=h1(w,{...Y,start:0,end:Y.end-Y.start},U);$=$.slice(0,z.outerStart)+B+$.slice(z.outerEnd),Z=z.outerStart+B.length}}return $}function ZL(X){return X.replace(/\bv-bind:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'@bind:$1="$2"')}function YL(X){return X.replace(/\bv-on:([a-zA-Z_][a-zA-Z0-9_.-]*)\s*=\s*"([^"]*)"/g,'@$1="$2"')}function JL(X){let $=X,Z=0;while(Z<$.length){let Y=w5($,Z);if(!Y)break;let J=i5(Y.attrs,"v-html");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=q1($,Y),Q=g1(Y.attrs,"v-html"),q=Y.selfClosing?" /":"",W=`<${Y.tag}${Q}${q}>{!! ${J} !!}</${Y.tag}>`;$=$.slice(0,G.outerStart)+W+$.slice(G.outerEnd),Z=G.outerStart+W.length}return $}function GL(X){let $=X,Z=0;while(Z<$.length){let Y=w5($,Z);if(!Y)break;let J=i5(Y.attrs,"v-text");if(J===null){Z=Y.end;continue}if(Y.selfClosing){Z=Y.end;continue}let G=q1($,Y),Q=g1(Y.attrs,"v-text"),q=Y.selfClosing?" /":"",W=`<${Y.tag}${Q}${q}>{{ ${J} }}</${Y.tag}>`;$=$.slice(0,G.outerStart)+W+$.slice(G.outerEnd),Z=G.outerStart+W.length}return $}function QL(X){return X.replace(/(<[a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)\s+v-pre([^>]*>)/g,"$1$2 data-stx-skip$3").replace(/(<[a-zA-Z][a-zA-Z0-9-]*)\s+v-pre(\s[^>]*>|>)/g,"$1 data-stx-skip$2")}function qL(X){let $=X,Z=0;while(Z<$.length){let Y=w5($,Z);if(!Y)break;if(!Xq(Y.attrs,"v-once")){Z=Y.end;continue}let J=g1(Y.attrs,"v-once"),G=q1($,Y),Q=$.slice(G.outerStart,G.outerEnd),W=`@once
13824
13824
  ${h1(Q,{...Y,start:0,end:Y.end-Y.start},J)}
13825
- @endonce`;$=$.slice(0,G.outerStart)+K+$.slice(G.outerEnd),Z=G.outerStart+K.length}return $}function QO(X){return X.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function qO(X){return X.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function $q(X){if(!oH(X))return X;let $=X;return $=sH($),$=aH($),$=GO($),$=XO($),$=$O($),$=eH($),$=tH($),$=qO($),$=ZO($),$=YO($),$=JO($),$=QO($),$}var iH,nH;var Zq=E(()=>{iH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),nH=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function Q$(X){return X.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Yq(X,$){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X),Y=Z?Z[1]:X,J=J0(Y,$);if(J&&typeof J==="string")return J;let G=Y.trim();return m3.has(G)?G:null}function Jq(X){let $=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X);return $?$[1]:X}function Gq(X,$,Z){let Y=$.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=Y?`<${X} ${Y}>`:`<${X}>`;if(KO.has(X))return Y?`<${X} ${Y}>`:`<${X}>`;return`${J}${Z}</${X}>`}async function Qq(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,q=[],K;while((K=Q.exec(G))!==null)q.push({full:K[0],expr:K[1],attrs:K[2],slotContent:K[3],index:K.index});for(let U=q.length-1;U>=0;U--){let W=q[U];try{let z=Yq(W.expr,$);if(!z||typeof z!=="string"){let L=`<!-- dynamic component: could not resolve "${Q$(Jq(W.expr))}" -->`;G=G.slice(0,W.index)+L+G.slice(W.index+W.full.length);continue}if(m3.has(z)){let L=Gq(z,W.attrs,W.slotContent);G=G.slice(0,W.index)+L+G.slice(W.index+W.full.length);continue}let w=W.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=j.exec(w))!==null){let L=_[1]||_[2],F=_[3];if(_[1])try{B[L]=J0(F,$)}catch{B[L]=F}else B[L]=F}let H=Y.componentsDir||"components",O=await Y5(z,B,W.slotContent,H,$,Z,Y,new Set,J??new Set);G=G.slice(0,W.index)+O+G.slice(W.index+W.full.length)}catch(z){let w=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${Q$(w)} -->`;G=G.slice(0,W.index)+B+G.slice(W.index+W.full.length)}}return G=await UO(G,$,Z,Y,J),G}async function UO(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,q=[],K;while((K=Q.exec(G))!==null)q.push({full:K[0],expr:K[1],attrs:K[2],index:K.index});for(let U=q.length-1;U>=0;U--){let W=q[U];try{let z=Yq(W.expr,$);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${Q$(Jq(W.expr))}" -->`;G=G.slice(0,W.index)+j+G.slice(W.index+W.full.length);continue}if(m3.has(z)){let j=Gq(z,W.attrs,"");G=G.slice(0,W.index)+j+G.slice(W.index+W.full.length);continue}let w=Y.componentsDir||"components",B=await Y5(z,{},"",w,$,Z,Y,new Set,J??new Set);G=G.slice(0,W.index)+B+G.slice(W.index+W.full.length)}catch(z){let w=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${Q$(w)} -->`;G=G.slice(0,W.index)+B+G.slice(W.index+W.full.length)}}return G}var m3,KO;var qq=E(()=>{H0();R0();m3=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),KO=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function BO(X){let $=X.storageKey??"stx-color-mode",Z=X.initialMode??"auto",Y=X.darkClass===void 0?"dark":X.darkClass,J=X.attribute??null,G=X.autoValue??null;if(typeof $!=="string"||$.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!WO.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(Y!==null&&(typeof Y!=="string"||!jO.test(Y)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!wO.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(G!==null&&!zO.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(Y===null&&J===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:$,initialMode:Z==="system"?"auto":Z,darkClass:Y,attribute:J,autoValue:G}}function _O(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function c3(X={}){let $=BO(X);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${_O($)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function Kq(X,$={}){if(X.includes("data-stx-color-mode-boot"))return X;let Z=l3(X);if(Z===null)return X;let Y=c3($);return`${X.slice(0,Z)}
13826
- ${Y}${X.slice(Z)}`}function l3(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return null;let Z=$.index+$[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(X.slice(Z));if(Y)Z+=Y[0].length;return Z}function LO(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return X;let Z=$.index+$[0].length,Y=X.toLowerCase().indexOf("</head>",Z),J=X.slice(Z,Y===-1?X.length:Y),G=OO.exec(J);if(!G||J.slice(0,G.index).trim()==="")return X;let Q=J.slice(0,G.index)+J.slice(G.index+G[0].length);return X.slice(0,Z)+`
13827
- ${G[0]}`+Q+X.slice(Z+J.length)}function Uq(X){return FO(LO(X))}function FO(X){let $=HO.exec(X);if(!$)return X;let Z=l3(X);if(Z===null)return X;if($.index<=Z||X.slice(Z,$.index).trim()==="")return X;let Y=X.slice(0,$.index)+X.slice($.index+$[0].length),J=l3(Y);if(J===null)return X;return`${Y.slice(0,J)}
13828
- ${$[0]}${Y.slice(J)}`}var WO,zO,wO,jO,HO,OO;var p3=E(()=>{WO=new Set(["light","dark","auto","system"]),zO=new Set(["auto","system"]),wO=/^[a-z][\w:-]*$/i,jO=/^[\w-]+$/;HO=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),OO=/<meta\b[^>]*\bcharset\b[^>]*>/i});function VO(){if(i3===null)i3=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return i3}function Wq(X,$=VO()){if(X.includes('name="stx-build"'))return X;let Z=/<head\b[^>]*>/i.exec(X);if(!Z)return X;let Y=Z.index+Z[0].length;return`${X.slice(0,Y)}
13829
- <meta name="stx-build" content="${$}">${X.slice(Y)}`}var i3=null;function F1(X){return String(X).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function AO(X){return String(X).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function r5(X){if(X.name)return`name="${X.name}"`;if(X.property)return`property="${X.property}"`;if(X.charset!=null)return"charset=";if(X["http-equiv"])return`http-equiv="${X["http-equiv"]}"`;return""}function n5(X,$){return Object.entries(X).filter(([Z])=>!$?.(Z)).map(([Z,Y])=>`${Z}="${F1(String(Y))}"`).join(" ")}function RO(X={},$="en"){let Z=[],Y=[],J="",G=$;for(let[q,K]of Object.entries(X||{})){if(K==null)continue;let U=q.trim();if(!wq.test(U))continue;let W=U.toLowerCase();if(W==="lang"){G=String(K);continue}if(W==="class"){J=String(K).trim();continue}Z.push(` ${U}="${F1(String(K))}"`),Y.push(U)}let Q=` lang="${F1(G)}"`;if(J)Q+=` class="${F1(J)}"`;if(Q+=Z.join(""),J)Q+=` ${K$}="${F1(J)}"`;if(Y.length)Q+=` ${q$}="${F1(Y.join(" "))}"`;return Q}function jq(X={},$={}){let Z={...X,...$};if(X.class&&$.class){let Y=X.class.split(/\s+/).filter(Boolean);for(let J of $.class.split(/\s+/).filter(Boolean))if(!Y.includes(J))Y.push(J);Z.class=Y.join(" ")}return Z}function Bq(X,$={}){if(!$||Object.keys($).length===0)return X;let Z=X.match(/<html\b([^>]*)>/i);if(!Z)return X;let Y={},J=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let W=Q[1];if(!(W in Y))J.push(W);Y[W]=Q[2]??Q[3]??Q[4]??""}let q=[],K=[];for(let[W,z]of Object.entries($)){if(z==null)continue;let w=W.trim();if(!wq.test(w))continue;let B=w.toLowerCase();if(B==="class"){let j=(Y.class||"").split(/\s+/).filter(Boolean);for(let _ of String(z).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),q.push(_);if(!("class"in Y))J.push("class");Y.class=j.join(" ");continue}if(!(w in Y))J.push(w);if(Y[w]=String(z),B!=="lang")K.push(w)}if(q.length){if(!(K$ in Y))J.push(K$);Y[K$]=q.join(" ")}if(K.length){if(!(q$ in Y))J.push(q$);Y[q$]=K.join(" ")}let U=J.map((W)=>` ${W}="${F1(Y[W])}"`).join("");return X.replace(Z[0],()=>`<html${U}>`)}function _q(X){if(X.includes("data-stx-cloak"))return X;let $=X.lastIndexOf("</head>");if($===-1)return X;return`${X.slice(0,$)}${zq}
13830
- ${X.slice($)}`}function NO(X){let $=[],Z=0;while(Z<X.length){let G=X.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let z=X.indexOf("-->",Z);if(z===-1)break;Z=z+3;continue}let q=G.match(/^<script\b[^>]*>/i);if(q){let z=X.toLowerCase().indexOf("</script>",Z+q[0].length);if(z===-1)break;Z=z+9;continue}let K=G.match(/^<link\b[^>]*>/i);if(K){$.push(K[0]),Z+=K[0].length;continue}let U=G.match(/^<meta\b[^>]*>/i);if(U){$.push(U[0]),Z+=U[0].length;continue}let W=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W){$.push(W[0]),Z+=W[0].length;continue}break}if($.length===0)return{body:X,hoisted:$};let Y="",J=0;while(J<X.length&&J<Z){let G=X.slice(J),Q=G.match(/^<link\b[^>]*>/i);if(Q&&$.includes(Q[0])){J+=Q[0].length;continue}let q=G.match(/^<meta\b[^>]*>/i);if(q&&$.includes(q[0])){J+=q[0].length;continue}let K=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(K&&$.includes(K[0])){J+=K[0].length;continue}Y+=X[J],J++}return Y+=X.slice(Z),{body:Y,hoisted:$}}function TO(X,$={},Z={}){let{title:Y="stx App",lang:J="en",meta:G=[],link:Q=[],script:q=[],headRaw:K="",htmlAttrs:U={},bodyClass:W="",bodyAttrs:z={}}=$,w=Z.title||Y,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],j=new Set(G.map(r5).filter(Boolean)),H=[...B.filter((k)=>!j.has(r5(k))),...G].map((k)=>{return` <meta ${n5(k)}>`}).join(`
13831
- `),O=Q.map((k)=>{return` <link ${n5(k)}>`}).join(`
13832
- `),L=q.map((k)=>{if(k.src)return` <script ${n5(k,(D)=>D==="content")}></script>`;if(k.content)return` <script>${k.content}</script>`;return""}).filter(Boolean).join(`
13833
- `),F=RO(U,J),V=Object.entries(z).map(([k,D])=>` ${k}="${F1(String(D))}"`).join(""),A=W?` class="${F1(W)}"`:"",{body:R,hoisted:N}=NO(X),T=[H,Z.colorMode?` ${c3(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?w:AO(w)}</title>`,` ${zq}`,O,L,K?` ${K}`:"",...(Z.styles||[]).map((k)=>` ${k}`),...N.map((k)=>` ${k}`),...(Z.headScripts||[]).map((k)=>` ${k}`),Z.headStack||""].filter(Boolean),M=[R,...(Z.bodyScripts||[]).map((k)=>k),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
13825
+ @endonce`;$=$.slice(0,G.outerStart)+W+$.slice(G.outerEnd),Z=G.outerStart+W.length}return $}function WL(X){return X.replace(/\bv-memo="([^"]*)"/g,'data-stx-memo="$1"')}function KL(X){return X.replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)\s*=\s*"([^"]*)"/g,'#$1="$2"').replace(/\bv-slot:([a-zA-Z_][a-zA-Z0-9_-]*)(?=[\s>])/g,"#$1").replace(/\bv-slot\s*=\s*"([^"]*)"/g,'#default="$1"')}function $q(X){if(!aH(X))return X;let $=X;return $=tH($),$=eH($),$=qL($),$=ZL($),$=YL($),$=$L($),$=XL($),$=KL($),$=JL($),$=GL($),$=QL($),$=WL($),$}var rH,oH;var Zq=E(()=>{rH=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),oH=new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","search","section","select","slot","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"])});function Q$(X){return X.replace(/--/g,"- -").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Yq(X,$){let Z=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X),Y=Z?Z[1]:X,J=J0(Y,$);if(J&&typeof J==="string")return J;let G=Y.trim();return m3.has(G)?G:null}function Jq(X){let $=/^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/.exec(X);return $?$[1]:X}function Gq(X,$,Z){let Y=$.replace(/\s*(?::is|v-bind:is)\s*=\s*"[^"]*"/gi,"").trim(),J=Y?`<${X} ${Y}>`:`<${X}>`;if(UL.has(X))return Y?`<${X} ${Y}>`:`<${X}>`;return`${J}${Z}</${X}>`}async function Qq(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*)>([\s\S]*?)<\/component>/gi,q=[],W;while((W=Q.exec(G))!==null)q.push({full:W[0],expr:W[1],attrs:W[2],slotContent:W[3],index:W.index});for(let K=q.length-1;K>=0;K--){let U=q[K];try{let z=Yq(U.expr,$);if(!z||typeof z!=="string"){let O=`<!-- dynamic component: could not resolve "${Q$(Jq(U.expr))}" -->`;G=G.slice(0,U.index)+O+G.slice(U.index+U.full.length);continue}if(m3.has(z)){let O=Gq(z,U.attrs,U.slotContent);G=G.slice(0,U.index)+O+G.slice(U.index+U.full.length);continue}let w=U.attrs.trim(),B={},j=/(?::([a-zA-Z_][a-zA-Z0-9_-]*)|([a-zA-Z_][a-zA-Z0-9_-]*))\s*=\s*"([^"]*)"/g,_;while((_=j.exec(w))!==null){let O=_[1]||_[2],F=_[3];if(_[1])try{B[O]=J0(F,$)}catch{B[O]=F}else B[O]=F}let H=Y.componentsDir||"components",L=await Y5(z,B,U.slotContent,H,$,Z,Y,new Set,J??new Set);G=G.slice(0,U.index)+L+G.slice(U.index+U.full.length)}catch(z){let w=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${Q$(w)} -->`;G=G.slice(0,U.index)+B+G.slice(U.index+U.full.length)}}return G=await zL(G,$,Z,Y,J),G}async function zL(X,$,Z,Y,J){let G=X,Q=/<component\s+(?::is|v-bind:is)\s*=\s*"([^"]*)"([^>]*?)\/>/gi,q=[],W;while((W=Q.exec(G))!==null)q.push({full:W[0],expr:W[1],attrs:W[2],index:W.index});for(let K=q.length-1;K>=0;K--){let U=q[K];try{let z=Yq(U.expr,$);if(!z||typeof z!=="string"){let j=`<!-- dynamic component: could not resolve "${Q$(Jq(U.expr))}" -->`;G=G.slice(0,U.index)+j+G.slice(U.index+U.full.length);continue}if(m3.has(z)){let j=Gq(z,U.attrs,"");G=G.slice(0,U.index)+j+G.slice(U.index+U.full.length);continue}let w=Y.componentsDir||"components",B=await Y5(z,{},"",w,$,Z,Y,new Set,J??new Set);G=G.slice(0,U.index)+B+G.slice(U.index+U.full.length)}catch(z){let w=z instanceof Error?z.message:String(z),B=`<!-- dynamic component error: ${Q$(w)} -->`;G=G.slice(0,U.index)+B+G.slice(U.index+U.full.length)}}return G}var m3,UL;var qq=E(()=>{H0();R0();m3=new Set(["a","abbr","address","article","aside","audio","b","bdi","bdo","blockquote","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","meter","nav","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","section","select","small","span","strong","sub","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","u","ul","video"]),UL=new Set(["area","base","br","col","embed","hr","img","input","link","meta","source","track","wbr"])});function HL(X){let $=X.storageKey??"stx-color-mode",Z=X.initialMode??"auto",Y=X.darkClass===void 0?"dark":X.darkClass,J=X.attribute??null,G=X.autoValue??null;if(typeof $!=="string"||$.length===0)throw Error("colorMode.storageKey must be a non-empty string");if(!wL.has(Z))throw Error(`colorMode.initialMode must be one of light, dark, auto, system \u2014 got ${JSON.stringify(Z)}`);if(Y!==null&&(typeof Y!=="string"||!_L.test(Y)))throw Error(`colorMode.darkClass must be a single CSS class name, or null to opt out \u2014 got ${JSON.stringify(Y)}`);if(J!==null&&(typeof J!=="string"||!BL.test(J)))throw Error(`colorMode.attribute must be a valid HTML attribute name \u2014 got ${JSON.stringify(J)}`);if(G!==null&&!jL.has(G))throw Error(`colorMode.autoValue must be 'auto' or 'system' \u2014 got ${JSON.stringify(G)}`);if(Y===null&&J===null)throw Error("colorMode needs at least one of darkClass or attribute \u2014 with both null nothing would mark the mode on <html>");return{storageKey:$,initialMode:Z==="system"?"auto":Z,darkClass:Y,attribute:J,autoValue:G}}function LL(X){return JSON.stringify(X).replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029")}function c3(X={}){let $=HL(X);return`<script data-stx-color-mode-boot>${`(function(){"use strict";var c=${LL($)};var p=c.initialMode;var a=c.autoValue;try{var v=localStorage.getItem(c.storageKey);if(v==="light"||v==="dark"){p=v}else if(v==="auto"||v==="system"){p="auto";if(!a)a=v}}catch(e){}var m=p;if(p==="auto"){try{m=matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}catch(e){m="light"}}var r=document.documentElement;if(c.attribute)r.setAttribute(c.attribute,m);if(c.darkClass){if(m==="dark")r.classList.add(c.darkClass);else r.classList.remove(c.darkClass)}try{window.__STX_COLOR_MODE__={storageKey:c.storageKey,initialMode:c.initialMode,darkClass:c.darkClass,attribute:c.attribute,autoValue:a||"auto",preference:p,mode:m}}catch(e){}}());`}</script>`}function Wq(X,$={}){if(X.includes("data-stx-color-mode-boot"))return X;let Z=l3(X);if(Z===null)return X;let Y=c3($);return`${X.slice(0,Z)}
13826
+ ${Y}${X.slice(Z)}`}function l3(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return null;let Z=$.index+$[0].length,Y=/^\s*<meta\b[^>]*\bcharset\b[^>]*>/i.exec(X.slice(Z));if(Y)Z+=Y[0].length;return Z}function VL(X){let $=/<head\b[^>]*>/i.exec(X);if(!$)return X;let Z=$.index+$[0].length,Y=X.toLowerCase().indexOf("</head>",Z),J=X.slice(Z,Y===-1?X.length:Y),G=FL.exec(J);if(!G||J.slice(0,G.index).trim()==="")return X;let Q=J.slice(0,G.index)+J.slice(G.index+G[0].length);return X.slice(0,Z)+`
13827
+ ${G[0]}`+Q+X.slice(Z+J.length)}function Kq(X){return AL(VL(X))}function AL(X){let $=OL.exec(X);if(!$)return X;let Z=l3(X);if(Z===null)return X;if($.index<=Z||X.slice(Z,$.index).trim()==="")return X;let Y=X.slice(0,$.index)+X.slice($.index+$[0].length),J=l3(Y);if(J===null)return X;return`${Y.slice(0,J)}
13828
+ ${$[0]}${Y.slice(J)}`}var wL,jL,BL,_L,OL,FL;var p3=E(()=>{wL=new Set(["light","dark","auto","system"]),jL=new Set(["auto","system"]),BL=/^[a-z][\w:-]*$/i,_L=/^[\w-]+$/;OL=new RegExp("<script\\b[^>]*\\bdata-stx-color-mode-boot\\b[^>]*>[\\s\\S]*?<\\/script>","i"),FL=/<meta\b[^>]*\bcharset\b[^>]*>/i});function RL(){if(i3===null)i3=process.env.STX_BUILD_ID||`${Date.now().toString(36)}${Math.random().toString(36).slice(2,8)}`;return i3}function Uq(X,$=RL()){if(X.includes('name="stx-build"'))return X;let Z=/<head\b[^>]*>/i.exec(X);if(!Z)return X;let Y=Z.index+Z[0].length;return`${X.slice(0,Y)}
13829
+ <meta name="stx-build" content="${$}">${X.slice(Y)}`}var i3=null;function F1(X){return String(X).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function NL(X){return String(X).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function r5(X){if(X.name)return`name="${X.name}"`;if(X.property)return`property="${X.property}"`;if(X.charset!=null)return"charset=";if(X["http-equiv"])return`http-equiv="${X["http-equiv"]}"`;return""}function n5(X,$){return Object.entries(X).filter(([Z])=>!$?.(Z)).map(([Z,Y])=>`${Z}="${F1(String(Y))}"`).join(" ")}function TL(X={},$="en"){let Z=[],Y=[],J="",G=$;for(let[q,W]of Object.entries(X||{})){if(W==null)continue;let K=q.trim();if(!wq.test(K))continue;let U=K.toLowerCase();if(U==="lang"){G=String(W);continue}if(U==="class"){J=String(W).trim();continue}Z.push(` ${K}="${F1(String(W))}"`),Y.push(K)}let Q=` lang="${F1(G)}"`;if(J)Q+=` class="${F1(J)}"`;if(Q+=Z.join(""),J)Q+=` ${W$}="${F1(J)}"`;if(Y.length)Q+=` ${q$}="${F1(Y.join(" "))}"`;return Q}function jq(X={},$={}){let Z={...X,...$};if(X.class&&$.class){let Y=X.class.split(/\s+/).filter(Boolean);for(let J of $.class.split(/\s+/).filter(Boolean))if(!Y.includes(J))Y.push(J);Z.class=Y.join(" ")}return Z}function Bq(X,$={}){if(!$||Object.keys($).length===0)return X;let Z=X.match(/<html\b([^>]*)>/i);if(!Z)return X;let Y={},J=[],G=/([A-Za-z_:][\w:.-]*)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'>]+)))?/g,Q;while((Q=G.exec(Z[1]))!==null){let U=Q[1];if(!(U in Y))J.push(U);Y[U]=Q[2]??Q[3]??Q[4]??""}let q=[],W=[];for(let[U,z]of Object.entries($)){if(z==null)continue;let w=U.trim();if(!wq.test(w))continue;let B=w.toLowerCase();if(B==="class"){let j=(Y.class||"").split(/\s+/).filter(Boolean);for(let _ of String(z).split(/\s+/).filter(Boolean))if(!j.includes(_))j.push(_),q.push(_);if(!("class"in Y))J.push("class");Y.class=j.join(" ");continue}if(!(w in Y))J.push(w);if(Y[w]=String(z),B!=="lang")W.push(w)}if(q.length){if(!(W$ in Y))J.push(W$);Y[W$]=q.join(" ")}if(W.length){if(!(q$ in Y))J.push(q$);Y[q$]=W.join(" ")}let K=J.map((U)=>` ${U}="${F1(Y[U])}"`).join("");return X.replace(Z[0],()=>`<html${K}>`)}function _q(X){if(X.includes("data-stx-cloak"))return X;let $=X.lastIndexOf("</head>");if($===-1)return X;return`${X.slice(0,$)}${zq}
13830
+ ${X.slice($)}`}function ML(X){let $=[],Z=0;while(Z<X.length){let G=X.slice(Z),Q=G.match(/^\s+/);if(Q){Z+=Q[0].length;continue}if(G.startsWith("<!--")){let z=X.indexOf("-->",Z);if(z===-1)break;Z=z+3;continue}let q=G.match(/^<script\b[^>]*>/i);if(q){let z=X.toLowerCase().indexOf("</script>",Z+q[0].length);if(z===-1)break;Z=z+9;continue}let W=G.match(/^<link\b[^>]*>/i);if(W){$.push(W[0]),Z+=W[0].length;continue}let K=G.match(/^<meta\b[^>]*>/i);if(K){$.push(K[0]),Z+=K[0].length;continue}let U=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(U){$.push(U[0]),Z+=U[0].length;continue}break}if($.length===0)return{body:X,hoisted:$};let Y="",J=0;while(J<X.length&&J<Z){let G=X.slice(J),Q=G.match(/^<link\b[^>]*>/i);if(Q&&$.includes(Q[0])){J+=Q[0].length;continue}let q=G.match(/^<meta\b[^>]*>/i);if(q&&$.includes(q[0])){J+=q[0].length;continue}let W=G.match(/^<style\b[^>]*>[\s\S]*?<\/style>/i);if(W&&$.includes(W[0])){J+=W[0].length;continue}Y+=X[J],J++}return Y+=X.slice(Z),{body:Y,hoisted:$}}function kL(X,$={},Z={}){let{title:Y="stx App",lang:J="en",meta:G=[],link:Q=[],script:q=[],headRaw:W="",htmlAttrs:K={},bodyClass:U="",bodyAttrs:z={}}=$,w=Z.title||Y,B=[{charset:"UTF-8"},{name:"viewport",content:"width=device-width, initial-scale=1.0"}],j=new Set(G.map(r5).filter(Boolean)),H=[...B.filter((k)=>!j.has(r5(k))),...G].map((k)=>{return` <meta ${n5(k)}>`}).join(`
13831
+ `),L=Q.map((k)=>{return` <link ${n5(k)}>`}).join(`
13832
+ `),O=q.map((k)=>{if(k.src)return` <script ${n5(k,(D)=>D==="content")}></script>`;if(k.content)return` <script>${k.content}</script>`;return""}).filter(Boolean).join(`
13833
+ `),F=TL(K,J),V=Object.entries(z).map(([k,D])=>` ${k}="${F1(String(D))}"`).join(""),A=U?` class="${F1(U)}"`:"",{body:R,hoisted:N}=ML(X),T=[H,Z.colorMode?` ${c3(Z.colorMode)}`:"",` <title>${Z.titleIsHtml?w:NL(w)}</title>`,` ${zq}`,L,O,W?` ${W}`:"",...(Z.styles||[]).map((k)=>` ${k}`),...N.map((k)=>` ${k}`),...(Z.headScripts||[]).map((k)=>` ${k}`),Z.headStack||""].filter(Boolean),M=[R,...(Z.bodyScripts||[]).map((k)=>k),Z.bodyStack||""].filter(Boolean);return`<!DOCTYPE html>
13834
13834
  <html${F}>
13835
13835
  <head>
13836
13836
  ${T.join(`
@@ -13840,54 +13840,54 @@ ${T.join(`
13840
13840
  ${M.join(`
13841
13841
  `)}
13842
13842
  </body>
13843
- </html>`}function n3(X){let $=0;while($<X.length){let Z=X.slice($),Y=Z.match(/^\s+/);if(Y){$+=Y[0].length;continue}if(Z.startsWith("<!--")){let G=X.indexOf("-->",$);if(G===-1)return!1;$=G+3;continue}let J=Z.match(/^<(script|style)\b[^>]*>/i);if(J){let G=`</${J[1].toLowerCase()}>`,Q=X.toLowerCase().indexOf(G,$+J[0].length);if(Q===-1)return!1;$=Q+G.length;continue}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}return!1}function r3(X){return n3(X)}function Hq(X,$={}){let Z=X.lastIndexOf("</head>");if(Z===-1)return X;let{meta:Y=[],link:J=[],script:G=[],headRaw:Q=""}=$,q=X.slice(0,Z),K=[];for(let U of Y){let W=r5(U);if(W&&q.includes(W))continue;K.push(` <meta ${n5(U)}>`)}for(let U of J){if(U.href&&q.includes(`href="${U.href}"`))continue;K.push(` <link ${n5(U)}>`)}for(let U of G)if(U.src){if(q.includes(`src="${U.src}"`))continue;K.push(` <script ${n5(U,(W)=>W==="content")}></script>`)}else if(U.content){if(q.includes(U.content))continue;K.push(` <script>${U.content}</script>`)}if(Q&&!q.includes(Q))K.push(` ${Q}`);if(K.length===0)return X;return`${X.slice(0,Z)}${K.join(`
13843
+ </html>`}function n3(X){let $=0;while($<X.length){let Z=X.slice($),Y=Z.match(/^\s+/);if(Y){$+=Y[0].length;continue}if(Z.startsWith("<!--")){let G=X.indexOf("-->",$);if(G===-1)return!1;$=G+3;continue}let J=Z.match(/^<(script|style)\b[^>]*>/i);if(J){let G=`</${J[1].toLowerCase()}>`,Q=X.toLowerCase().indexOf(G,$+J[0].length);if(Q===-1)return!1;$=Q+G.length;continue}return/^<!DOCTYPE\b/i.test(Z)||/^<html[\s>]/i.test(Z)}return!1}function r3(X){return n3(X)}function Hq(X,$={}){let Z=X.lastIndexOf("</head>");if(Z===-1)return X;let{meta:Y=[],link:J=[],script:G=[],headRaw:Q=""}=$,q=X.slice(0,Z),W=[];for(let K of Y){let U=r5(K);if(U&&q.includes(U))continue;W.push(` <meta ${n5(K)}>`)}for(let K of J){if(K.href&&q.includes(`href="${K.href}"`))continue;W.push(` <link ${n5(K)}>`)}for(let K of G)if(K.src){if(q.includes(`src="${K.src}"`))continue;W.push(` <script ${n5(K,(U)=>U==="content")}></script>`)}else if(K.content){if(q.includes(K.content))continue;W.push(` <script>${K.content}</script>`)}if(Q&&!q.includes(Q))W.push(` ${Q}`);if(W.length===0)return X;return`${X.slice(0,Z)}${W.join(`
13844
13844
  `)}
13845
- ${X.slice(Z)}`}function Oq(X,$={},Z={}){if(r3(X))return X;return TO(X,$,Z)}var zq="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",q$="data-stx-html-attrs",K$="data-stx-html-class",wq;var Lq=E(()=>{p3();wq=/^[A-Za-z_:][\w:.-]*$/});import o5 from"path";function Fq(X){return X.startsWith("http://")||X.startsWith("https://")||X.startsWith("//")}async function Vq(X,$,Z){try{let Y;if(X.startsWith("/")){let J=$;for(let G=0;G<5;G++){let Q=o5.join(J,X);if(await Bun.file(Q).exists())return Q;J=o5.dirname(J)}Y=o5.join($,X)}else if(X.startsWith("./")||X.startsWith("../"))Y=o5.resolve($,X);else Y=o5.resolve($,X);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function Aq(X,$,Z){let Y=X,J=o5.dirname($),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(Y))!==null){let[U,W,z,w]=Q;if(Fq(z))continue;let B=await Vq(z,J,$);if(B)try{let j=await Bun.file(B).text();if(Z.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let H=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:u0()});if(H.outputs.length>0)j=await H.outputs[0].text()}let _=`<script>
13845
+ ${X.slice(Z)}`}function Lq(X,$={},Z={}){if(r3(X))return X;return kL(X,$,Z)}var zq="<style data-stx-cloak>[x-cloak]{display:none !important}</style>",q$="data-stx-html-attrs",W$="data-stx-html-class",wq;var Oq=E(()=>{p3();wq=/^[A-Za-z_:][\w:.-]*$/});import o5 from"path";function Fq(X){return X.startsWith("http://")||X.startsWith("https://")||X.startsWith("//")}async function Vq(X,$,Z){try{let Y;if(X.startsWith("/")){let J=$;for(let G=0;G<5;G++){let Q=o5.join(J,X);if(await Bun.file(Q).exists())return Q;J=o5.dirname(J)}Y=o5.join($,X)}else if(X.startsWith("./")||X.startsWith("../"))Y=o5.resolve($,X);else Y=o5.resolve($,X);if(await Bun.file(Y).exists())return Y;return null}catch{return null}}async function Aq(X,$,Z){let Y=X,J=o5.dirname($),G=/<script\b([^>]*)src=["']([^"']+)["']([^>]*)><\/script>/gi,Q;while((Q=G.exec(Y))!==null){let[K,U,z,w]=Q;if(Fq(z))continue;let B=await Vq(z,J,$);if(B)try{let j=await Bun.file(B).text();if(Z.add(B),z.endsWith(".ts")||z.endsWith(".tsx")){let H=await Bun.build({entrypoints:[B],target:"browser",minify:!1,define:u0()});if(H.outputs.length>0)j=await H.outputs[0].text()}let _=`<script>
13846
13846
  // Source: ${z}
13847
13847
  ${j}
13848
- </script>`;Y=Y.replace(U,_),G.lastIndex=0}catch(j){}}let q=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,K;while((K=q.exec(Y))!==null){let[U,W,z,w]=K,B=W+w;if(Fq(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let _=await Vq(z,J,$);if(_)try{let H=await Bun.file(_).text();Z.add(_);let O=`<style>
13848
+ </script>`;Y=Y.replace(K,_),G.lastIndex=0}catch(j){}}let q=/<link\b([^>]*)href=["']([^"']+)["']([^>]*)(?:\/?>)/gi,W;while((W=q.exec(Y))!==null){let[K,U,z,w]=W,B=U+w;if(Fq(z))continue;if(/rel=["']stylesheet["']/.test(B)||z.endsWith(".css")){let _=await Vq(z,J,$);if(_)try{let H=await Bun.file(_).text();Z.add(_);let L=`<style>
13849
13849
  /* Source: ${z} */
13850
13850
  ${H}
13851
- </style>`;Y=Y.replace(U,O),q.lastIndex=0}catch(H){}}}return Y}var Rq=E(()=>{N1()});function U$(X,$){let Z=X,Y=/@json\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index,Q=G+J[0].length-1,q=1,K=Q+1,U=null,W=!1;while(K<Z.length&&q>0){let F=Z[K];if(W){W=!1,K++;continue}if(F==="\\"&&U){W=!0,K++;continue}if(U){if(F===U)U=null;K++;continue}if(F==='"'||F==="'"||F==="`"){U=F,K++;continue}if(F==="(")q++;else if(F===")"){if(q--,q===0)break}K++}if(q!==0)break;let z=Z.substring(Q+1,K).trim(),w=Z.substring(G,K+1),B=-1,j=0,_=null,H=!1;for(let F=0;F<z.length;F++){let V=z[F];if(H){H=!1;continue}if(V==="\\"&&_){H=!0;continue}if(_){if(V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=V;continue}if(V==="("||V==="["||V==="{")j++;else if(V===")"||V==="]"||V==="}")j--;if(V===","&&j===0){B=F;break}}let O=B>=0?z.substring(0,B).trim():z,L=B>=0?z.substring(B+1).trim():void 0;try{let F=O.trim(),V;if(G0(F))V=Q0(F,Object.keys($))(...Object.values($));else V=void 0;let A;if(L==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(K+1),Y.lastIndex=G+R.length}catch(F){$1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),Y.lastIndex=G+w.length}}return Z}function W$(X){return X.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Nq(X){let $=X,Z=/@memo\s*\(/g,Y,J=[];while((Y=Z.exec($))!==null){let G=Y.index,Q=G+Y[0].length,q=1,K=Q;while(K<$.length&&q>0){if($[K]==="(")q++;else if($[K]===")")q--;K++}if(q!==0)continue;let U=$.slice(Q,K-1).trim(),W=K,z=$.slice(W),w=z.indexOf("@endmemo");if(w===-1)continue;let B=z.slice(0,w),j=W+w+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=_?_[0].length:0,O=B.slice(H),L=B.match(/(\s*)$/),F=L?L[0].length:0,V=O.slice(0,O.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,T,M="",k]=A,D=`<${T}${M} data-stx-memo="${U}"${k}>`;R=B.slice(0,H)+D+V.slice(N.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${U}">${V}</div>${B.slice(H+V.length)}`;J.push({start:G,end:j,replacement:R}),Z.lastIndex=j}for(let G=J.length-1;G>=0;G--){let Q=J[G];$=$.slice(0,Q.start)+Q.replacement+$.slice(Q.end)}return $.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function o3(X){let $=X.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),$}function Tq(X){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index,q=Q+G[0].length,K=!1,U=!1,W=-1;while(q<X.length){let _=X[q];if(K){if(_==="'")K=!1}else if(U){if(_==='"')U=!1}else if(_==="'")K=!0;else if(_==='"')U=!0;else if(_===">"){W=q;break}q++}if(W===-1)continue;if(X.slice(Q,W+1).includes("x-cloak"))continue;let w=X.slice(W+1),B=w.indexOf("</"),j=B>=0?w.slice(0,B):w.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))Y+=X.slice(J,W)+" x-cloak>",J=W+1}return Y+=X.slice(J),Y}function Mq(X){let $=/<[a-z][\w-]*/gi,Z="",Y=0,J;while((J=$.exec(X))!==null){let G=J.index,Q=J[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let j=`</${Q}>`,_=X.toLowerCase().indexOf(j,G);if(_!==-1)$.lastIndex=_+j.length;continue}let q=G+J[0].length,K=!1,U=!1,W=-1;while(q<X.length){let j=X[q];if(K){if(j==="'")K=!1}else if(U){if(j==='"')U=!1}else if(j==="'")K=!0;else if(j==='"')U=!0;else if(j===">"){W=q;break}q++}if(W===-1)continue;let z=X.slice(G+J[0].length,W);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!MO.test(z))continue;let w=X[W-1]==="/",B=w?W-1:W;Z+=`${X.slice(Y,B)} x-cloak${w?" ":""}`,Y=B}return Z+=X.slice(Y),Z}var MO;var s3=E(()=>{H1();R0();MO=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function z$(X,$,Z,Y){let J=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=J.allowPatterns??[],Q=[],q=r0(X.replace(/\{\{--[\s\S]*?--\}\}/g,(K)=>K.replace(/[^\n]/g," ")));for(let{pattern:K,message:U,suggestion:W}of kO){if(G.some((w)=>/\w/.test(w)&&U.includes(w)))continue;K.lastIndex=0;let z=q.match(K);if(z&&z.length>0){let w=q.split(`
13851
+ </style>`;Y=Y.replace(K,L),q.lastIndex=0}catch(H){}}}return Y}var Rq=E(()=>{N1()});function K$(X,$){let Z=X,Y=/@json\s*\(/g,J;while((J=Y.exec(Z))!==null){let G=J.index,Q=G+J[0].length-1,q=1,W=Q+1,K=null,U=!1;while(W<Z.length&&q>0){let F=Z[W];if(U){U=!1,W++;continue}if(F==="\\"&&K){U=!0,W++;continue}if(K){if(F===K)K=null;W++;continue}if(F==='"'||F==="'"||F==="`"){K=F,W++;continue}if(F==="(")q++;else if(F===")"){if(q--,q===0)break}W++}if(q!==0)break;let z=Z.substring(Q+1,W).trim(),w=Z.substring(G,W+1),B=-1,j=0,_=null,H=!1;for(let F=0;F<z.length;F++){let V=z[F];if(H){H=!1;continue}if(V==="\\"&&_){H=!0;continue}if(_){if(V===_)_=null;continue}if(V==='"'||V==="'"||V==="`"){_=V;continue}if(V==="("||V==="["||V==="{")j++;else if(V===")"||V==="]"||V==="}")j--;if(V===","&&j===0){B=F;break}}let L=B>=0?z.substring(0,B).trim():z,O=B>=0?z.substring(B+1).trim():void 0;try{let F=L.trim(),V;if(G0(F))V=Q0(F,Object.keys($))(...Object.values($));else V=void 0;let A;if(O==="true")A=JSON.stringify(V,null,2);else A=JSON.stringify(V);let R=A.replace(/</g,"\\u003c").replace(/>/g,"\\u003e").replace(/&/g,"\\u0026").replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029");Z=Z.substring(0,G)+R+Z.substring(W+1),Y.lastIndex=G+R.length}catch(F){$1.log(F instanceof Error?F:Error(String(F)),{directive:"@json"},"error"),Y.lastIndex=G+w.length}}return Z}function U$(X){return X.replace(/@once\s*([\s\S]*?)@endonce/g,"$1")}function Nq(X){let $=X,Z=/@memo\s*\(/g,Y,J=[];while((Y=Z.exec($))!==null){let G=Y.index,Q=G+Y[0].length,q=1,W=Q;while(W<$.length&&q>0){if($[W]==="(")q++;else if($[W]===")")q--;W++}if(q!==0)continue;let K=$.slice(Q,W-1).trim(),U=W,z=$.slice(U),w=z.indexOf("@endmemo");if(w===-1)continue;let B=z.slice(0,w),j=U+w+8,_=B.match(/^(\s*(?:(?:<!--[\s\S]*?-->|\x00STX_HTML_COMMENT_\d+\x00)\s*)*)/),H=_?_[0].length:0,L=B.slice(H),O=B.match(/(\s*)$/),F=O?O[0].length:0,V=L.slice(0,L.length-F),A=V.match(/^<([a-zA-Z][a-zA-Z0-9-]*)(\s[^>]*?)?(\/?)>/),R;if(A){let[N,T,M="",k]=A,D=`<${T}${M} data-stx-memo="${K}"${k}>`;R=B.slice(0,H)+D+V.slice(N.length)+B.slice(H+V.length)}else R=`${B.slice(0,H)}<div data-stx-memo="${K}">${V}</div>${B.slice(H+V.length)}`;J.push({start:G,end:j,replacement:R}),Z.lastIndex=j}for(let G=J.length-1;G>=0;G--){let Q=J[G];$=$.slice(0,Q.start)+Q.replacement+$.slice(Q.end)}return $.replace(/@memo="([^"]*)"/g,'data-stx-memo="$1"')}function o3(X){let $=X.replace(/@ref="([^"]+)"/g,'data-stx-ref="$1"');return $=$.replace(/(<[a-zA-Z][a-zA-Z0-9-]*\b[^>]*?)\sref="([^"]+)"/g,'$1 data-stx-ref="$2"'),$}function Tq(X){let Z=new RegExp("<(div|span|p|h[1-6]|td|th|li|a|button|label|section|article|header|footer|main|nav|aside|dd|dt|figcaption|summary|caption|blockquote|pre|code|em|strong|small|sub|sup|time|mark|abbr|cite|q|s|u|b|i)\\b","gi"),Y="",J=0,G;while((G=Z.exec(X))!==null){let Q=G.index,q=Q+G[0].length,W=!1,K=!1,U=-1;while(q<X.length){let _=X[q];if(W){if(_==="'")W=!1}else if(K){if(_==='"')K=!1}else if(_==="'")W=!0;else if(_==='"')K=!0;else if(_===">"){U=q;break}q++}if(U===-1)continue;if(X.slice(Q,U+1).includes("x-cloak"))continue;let w=X.slice(U+1),B=w.indexOf("</"),j=B>=0?w.slice(0,B):w.slice(0,200);if(/\{\{[\s\S]*?\}\}/.test(j))Y+=X.slice(J,U)+" x-cloak>",J=U+1}return Y+=X.slice(J),Y}function Mq(X){let $=/<[a-z][\w-]*/gi,Z="",Y=0,J;while((J=$.exec(X))!==null){let G=J.index,Q=J[0].slice(1).toLowerCase();if(Q==="script"||Q==="style"){let j=`</${Q}>`,_=X.toLowerCase().indexOf(j,G);if(_!==-1)$.lastIndex=_+j.length;continue}let q=G+J[0].length,W=!1,K=!1,U=-1;while(q<X.length){let j=X[q];if(W){if(j==="'")W=!1}else if(K){if(j==='"')K=!1}else if(j==="'")W=!0;else if(j==='"')K=!0;else if(j===">"){U=q;break}q++}if(U===-1)continue;let z=X.slice(G+J[0].length,U);if(/(?:^|\s)x-cloak(?:=|\s|\/|>|$)/.test(z))continue;if(!IL.test(z))continue;let w=X[U-1]==="/",B=w?U-1:U;Z+=`${X.slice(Y,B)} x-cloak${w?" ":""}`,Y=B}return Z+=X.slice(Y),Z}var IL;var s3=E(()=>{H1();R0();IL=/(?:^|\s)(?::else-if|:if|:else|:show|x-else-if|x-if|x-else|x-show|@if|@show)(?:=|\s|\/|>|$)/});function z$(X,$,Z,Y){let J=typeof Z==="boolean"?{enabled:Z,failOnViolation:Z}:Z??{enabled:!1},G=J.allowPatterns??[],Q=[],q=r0(X.replace(/\{\{--[\s\S]*?--\}\}/g,(W)=>W.replace(/[^\n]/g," ")));for(let{pattern:W,message:K,suggestion:U}of EL){if(G.some((w)=>/\w/.test(w)&&K.includes(w)))continue;W.lastIndex=0;let z=q.match(W);if(z&&z.length>0){let w=q.split(`
13852
13852
  `),B=X.split(`
13853
- `),j=[];w.forEach((L,F)=>{if(K.lastIndex=0,K.test(L))j.push(F+1)});let _=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",H=j.slice(0,3).map((L)=>` ${L} | ${(B[L-1]??"").trim().slice(0,100)}`).join(`
13854
- `),O=H?`
13855
- ${H}`:"";Q.push(` \u2717 ${U}${_}
13856
- \u2192 ${W}${O}`)}}if(Q.length>0&&J.enabled){let K=(z)=>{let w=`${process.cwd()}/`;return z.startsWith(w)?z.slice(w.length):z},W=`[STX] DOM API violation in ${Y&&Y!==$?`${K(Y)} (composed into ${K($)})`:K($)}:
13853
+ `),j=[];w.forEach((O,F)=>{if(W.lastIndex=0,W.test(O))j.push(F+1)});let _=j.length>0?` (script line${j.length>1?"s":""} ${j.join(", ")})`:"",H=j.slice(0,3).map((O)=>` ${O} | ${(B[O-1]??"").trim().slice(0,100)}`).join(`
13854
+ `),L=H?`
13855
+ ${H}`:"";Q.push(` \u2717 ${K}${_}
13856
+ \u2192 ${U}${L}`)}}if(Q.length>0&&J.enabled){let W=(z)=>{let w=`${process.cwd()}/`;return z.startsWith(w)?z.slice(w.length):z},U=`[STX] DOM API violation in ${Y&&Y!==$?`${W(Y)} (composed into ${W($)})`:W($)}:
13857
13857
  ${Q.join(`
13858
13858
  `)}
13859
- Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(W);else console.warn(W)}}var kO;var a3=E(()=>{kO=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import IO from"fs";function w$(X){return[...X].sort().map(($)=>{try{let Z=IO.statSync($);return`${$}:${Z.size}:${Z.mtimeMs}`}catch{return`${$}:missing`}}).join(`
13860
- `)}function j$(X,$,Z){let Y=X.get($);return Y!==void 0&&Y.signature===Z?Y.value:void 0}function K1(X,$,Z,Y){return X.set($,{signature:Z,value:Y}),Y}var t3=()=>{};var kq={};n(kq,{getStoreScript:()=>DO,clearStoreCache:()=>yO});import B$ from"path";function EO(X,$){for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let Y of(Z[1]??"").split(",")){let G=((Y.includes(":")?Y.split(":").pop():Y)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))$.add(G)}for(let Z of X.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let Y of(Z[1]??"").split(",")){let J=Y.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))$.add(J)}}async function DO(X){let $;if(X)$=B$.resolve(X);else{let j=await S1();$=B$.resolve(j.root||process.cwd(),j.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),Y=[];try{for await(let j of Z.scan({cwd:$,absolute:!0})){let _=B$.basename(j,".ts");if(["index","types"].includes(_))continue;if(j.includes(".d.ts"))continue;Y.push(j)}}catch{return K1(s5,$,"",""),null}let J=w$(Y),G=j$(s5,$,J);if(G!==void 0)return G||null;if(Y.length===0)return K1(s5,$,J,""),null;let Q=[];for(let j of Y){let _=await Bun.file(j).text();Q.push({file:j,hasUseStore:/useStore\s*\(/.test(_)})}Q.sort((j,_)=>{if(j.hasUseStore===_.hasUseStore)return 0;return j.hasUseStore?1:-1});let q=Q.map((j)=>j.file),K=[],U=new Set,W=_1({loader:"ts",target:"browser",define:u0()});for(let j of q)try{let _=await Bun.file(j).text(),H=B$.basename(j,".ts");EO(_,U),_=c0(_),_=AX(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=W.transformSync(_),K.push(`// Store: ${H}
13861
- ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${j}:`,_)}if(K.length===0)return K1(s5,$,J,""),null;let z=K.join(`
13859
+ Tip: prefer useRef(), navigate(), and composables for component code`;if(J.failOnViolation)throw Error(U);else console.warn(U)}}var EL;var a3=E(()=>{EL=[{pattern:/document\.getElementById\s*\(/g,message:"document.getElementById() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelector\s*\(/g,message:"document.querySelector() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.querySelectorAll\s*\(/g,message:"document.querySelectorAll() is prohibited",suggestion:'Use useRef("name") and access children instead'},{pattern:/document\.getElementsBy\w+\s*\(/g,message:"document.getElementsBy*() is prohibited",suggestion:'Use useRef("name") instead'},{pattern:/document\.createElement\s*\(/g,message:"document.createElement() is prohibited",suggestion:"Use template directives or component composition instead"},{pattern:/document\.activeElement(?![A-Za-z])/g,message:"document.activeElement is prohibited",suggestion:"Use useRef() to track focused elements"},{pattern:/document\.title\s*=/g,message:"document.title assignment is prohibited",suggestion:"Use useTitle() from composables"},{pattern:/document\.cookie(?![A-Za-z])/g,message:"document.cookie is prohibited",suggestion:"Use useCookie() from composables"},{pattern:/document\.addEventListener\s*\(/g,message:"document.addEventListener() is prohibited",suggestion:"Use useEventListener() or template @event directives"},{pattern:/window\.location(?![A-Za-z])/g,message:"window.location is prohibited",suggestion:"Use navigate() or useRoute()"},{pattern:/window\.history(?![A-Za-z])/g,message:"window.history is prohibited",suggestion:"Use navigate(), goBack(), goForward()"},{pattern:/window\.addEventListener\s*\(/g,message:"window.addEventListener() is prohibited",suggestion:"Use useEventListener() or @click directives"},{pattern:/(?:\bwindow\.)?localStorage(?![A-Za-z])/g,message:"window.localStorage is prohibited",suggestion:"Use useLocalStorage() from composables \u2014 or @appearanceBootstrap if this must run before first paint, where the runtime does not exist yet"},{pattern:/window\.sessionStorage(?![A-Za-z])/g,message:"window.sessionStorage is prohibited",suggestion:"Use useSessionStorage() from composables"},{pattern:/window\.scrollTo\s*\(/g,message:"window.scrollTo() is prohibited",suggestion:"Use useScroll().scrollTo() from composables"},{pattern:/window\.alert\s*\(/g,message:"window.alert() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.confirm\s*\(/g,message:"window.confirm() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/window\.prompt\s*\(/g,message:"window.prompt() is prohibited",suggestion:"Use stx modal/dialog APIs instead"},{pattern:/(?<!\w)setTimeout\s*\(/g,message:"setTimeout() is prohibited",suggestion:"Use useTimeout() or useDebounce() from composables"},{pattern:/(?<!\w)setInterval\s*\(/g,message:"setInterval() is prohibited",suggestion:"Use useInterval() from composables"},{pattern:/(?<!\w)clearTimeout\s*\(/g,message:"clearTimeout() is prohibited",suggestion:"Use useTimeout().stop() or useDebounce().cancel()"},{pattern:/(?<!\w)clearInterval\s*\(/g,message:"clearInterval() is prohibited",suggestion:"Use useInterval().pause()"},{pattern:/(?<!\w)location\.href\s*=/g,message:"location.href assignment is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.assign\s*\(/g,message:"location.assign() is prohibited",suggestion:"Use navigate() instead"},{pattern:/(?<!\w)location\.replace\s*\(/g,message:"location.replace() is prohibited",suggestion:"Use navigate() instead"}]});import DL from"fs";function w$(X){return[...X].sort().map(($)=>{try{let Z=DL.statSync($);return`${$}:${Z.size}:${Z.mtimeMs}`}catch{return`${$}:missing`}}).join(`
13860
+ `)}function j$(X,$,Z){let Y=X.get($);return Y!==void 0&&Y.signature===Z?Y.value:void 0}function W1(X,$,Z,Y){return X.set($,{signature:Z,value:Y}),Y}var t3=()=>{};var kq={};i(kq,{getStoreScript:()=>bL,clearStoreCache:()=>SL});import B$ from"path";function yL(X,$){for(let Z of X.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(Z[1])$.add(Z[1]);for(let Z of X.matchAll(/\b(?:const|let|var)\s*\{([^{}]*)\}\s*=/g))for(let Y of(Z[1]??"").split(",")){let G=((Y.includes(":")?Y.split(":").pop():Y)??"").replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(G))$.add(G)}for(let Z of X.matchAll(/\b(?:const|let|var)\s*\[([^\]]*)\]\s*=/g))for(let Y of(Z[1]??"").split(",")){let J=Y.replace(/=.*$/s,"").replace(/^\s*\.\.\./,"").trim();if(/^[A-Z_a-z$][\w$]*$/.test(J))$.add(J)}}async function bL(X){let $;if(X)$=B$.resolve(X);else{let j=await S1();$=B$.resolve(j.root||process.cwd(),j.storesDir||"stores")}let Z=new Bun.Glob("*.ts"),Y=[];try{for await(let j of Z.scan({cwd:$,absolute:!0})){let _=B$.basename(j,".ts");if(["index","types"].includes(_))continue;if(j.includes(".d.ts"))continue;Y.push(j)}}catch{return W1(s5,$,"",""),null}let J=w$(Y),G=j$(s5,$,J);if(G!==void 0)return G||null;if(Y.length===0)return W1(s5,$,J,""),null;let Q=[];for(let j of Y){let _=await Bun.file(j).text();Q.push({file:j,hasUseStore:/useStore\s*\(/.test(_)})}Q.sort((j,_)=>{if(j.hasUseStore===_.hasUseStore)return 0;return j.hasUseStore?1:-1});let q=Q.map((j)=>j.file),W=[],K=new Set,U=_1({loader:"ts",target:"browser",define:u0()});for(let j of q)try{let _=await Bun.file(j).text(),H=B$.basename(j,".ts");yL(_,K),_=c0(_),_=AX(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=U.transformSync(_),W.push(`// Store: ${H}
13861
+ ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load store ${j}:`,_)}if(W.length===0)return W1(s5,$,J,""),null;let z=W.join(`
13862
13862
 
13863
13863
  `),B=`;(function(){
13864
13864
  var __stx = window.stx || {};
13865
- ${j1.filter((j)=>!U.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
13865
+ ${j1.filter((j)=>!K.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
13866
13866
  `)}
13867
13867
  ${z}
13868
- })();`;return K1(s5,$,J,B),B}function yO(){s5.clear()}var s5;var Iq=E(()=>{T1();N1();e0();t3();H0();s5=new Map});var e3,bE;var Eq=E(()=>{e3=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],bE=new Set(e3)});var bq={};n(bq,{selectComposableFiles:()=>Dq,referencedFrameworkComposables:()=>yq,getFrameworkComposableScript:()=>PO,clearFrameworkComposableCache:()=>SO,__setRuntimeOwnedForTest:()=>vO});import _$ from"path";function SO(){t7.clear()}function Dq(X){let $=new Map;for(let Z of X){let Y=_$.basename(Z);if(Y.endsWith(".d.ts"))continue;let J=Y.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===Y)continue;let G=$.get(J);if(G&&!G.endsWith(".js"))continue;$.set(J,Z)}return[...$.values()].sort()}function CO(X,$){let Z=$.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test(X)}function yq(X){if(!X)return[];let $=X.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Z=[];for(let Y of bO){if(X6.has(Y))continue;let J=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test($))Z.push(Y)}return Z.sort()}async function PO(X,$){let Z=yq(X);if(Z.length===0)return null;let Y=$??_$.join(import.meta.dir,"composables"),J=`${Y}\x00${Z.join(",")}`,G=t7.get(J);if(G!==void 0)return G||null;let Q=_1({loader:"ts",target:"browser",define:u0()}),q=new Set(Z),K=[],U=new Set,W=[];try{let j=new Bun.Glob("*.{ts,js}");for await(let _ of j.scan({cwd:Y,absolute:!0}))W.push(_)}catch{return t7.set(J,""),null}W=Dq(W);for(let j of W){let _;try{_=await Bun.file(j).text()}catch{continue}let H=[];try{H=Q.scan(_).exports.filter((O)=>O!=="default")}catch{continue}if(!H.some((O)=>q.has(O)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),K.push(`// ${_$.basename(j).replace(/\.[jt]s$/,"")}
13869
- ${Q.transformSync(_).trim()}`);for(let O of H)U.add(O)}catch(O){console.warn(`[stx] framework composable ${_$.basename(j)} could not be bundled:`,O)}}let z=Z.filter((j)=>!U.has(j)&&!CO(X,j));if(z.length>0)console.warn(`[stx] could not bundle ${z.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(K.length===0)return t7.set(J,""),null;let w=[...U].map((j)=>` try { if (!(${JSON.stringify(j)} in __s)) { __s[${JSON.stringify(j)}] = ${j}; if (!(${JSON.stringify(j)} in window)) window[${JSON.stringify(j)}] = ${j}; } } catch (e) {}`).join(`
13868
+ })();`;return W1(s5,$,J,B),B}function SL(){s5.clear()}var s5;var Iq=E(()=>{T1();N1();e0();t3();H0();s5=new Map});var e3,CE;var Eq=E(()=>{e3=["broadcast","calculateDistance","canNotify","clearCookies","clearFetchCache","clearStorage","copyToClipboard","createShareableFile","defineForm","getBatteryLevel","getCookie","getCurrentPosition","getStorageKeys","getStorageSize","getVoices","hasBattery","hasCameraPermission","hasGeolocationPermission","hasMicrophonePermission","hasNotificationPermission","hasResizeObserver","hexToHsl","hexToRgb","isBroadcastChannelSupported","isCharging","isDeviceMotionSupported","isDeviceOrientationSupported","isEventSourceSupported","isEyeDropperSupported","isInFullscreen","isMutationObserverSupported","isPermissionGranted","isSpeechRecognitionSupported","isSpeechSynthesisSupported","isWakeLockSupported","isWebSocketSupported","notify","parseCookies","pickColor","prefetch","removeCookie","requestMediaPermissions","requestMotionPermission","requestNotificationPermission","requestOrientationPermission","setCookie","share","shareCurrentPage","shareFiles","shareText","shareURL","shareWithFallback","speak","stopSpeaking","toggleFullscreen","useAsyncData","useAttributeObserver","useAutoLogout","useAutoWakeLock","useBattery","useBreakpoint","useBroadcastChannel","useChannel","useChildListObserver","useClipboard","useColorHistory","useConditionalWakeLock","useCookies","useCopySelection","useDeviceMotion","useDeviceOrientation","useElementSize","useElementTextSelection","useElementVisibility","useEventSource","useEyeDropper","useFavicon","useForm","useFullscreen","useGeolocation","useGeolocationWatch","useHotkey","useIdle","useIdleState","useInfiniteScroll","useIntersectionObserver","useIntersectionObserverMultiple","useIsDesktop","useIsMobile","useIsTablet","useKeyPressed","useKeySequence","useKeyboard","useLastActive","useLazyLoad","useMeta","useMouse","useMouseInElement","useMutationObserver","useNetwork","useNotification","useOnline","useParallax","usePermission","usePermissions","usePointer","usePost","useResizeObserver","useResizeObserverMultiple","useSSE","useScroll","useSelectionPopup","useShare","useSpeechRecognition","useSpeechSynthesis","useStorage","useTextObserver","useTextSelection","useTitle","useVisibility","useWakeLock","useWindowSize"],CE=new Set(e3)});var bq={};i(bq,{selectComposableFiles:()=>Dq,referencedFrameworkComposables:()=>yq,getFrameworkComposableScript:()=>xL,clearFrameworkComposableCache:()=>PL,__setRuntimeOwnedForTest:()=>fL});import _$ from"path";function PL(){t7.clear()}function Dq(X){let $=new Map;for(let Z of X){let Y=_$.basename(Z);if(Y.endsWith(".d.ts"))continue;let J=Y.replace(/\.[jt]s$/,"");if(J==="index")continue;if(J===Y)continue;let G=$.get(J);if(G&&!G.endsWith(".js"))continue;$.set(J,Z)}return[...$.values()].sort()}function vL(X,$){let Z=$.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");return new RegExp(`(?:^|[^\\w$.])(?:const|let|var|function|class)\\s+${Z}\\b`).test(X)}function yq(X){if(!X)return[];let $=X.replace(/<script\b[^>]*\bdata-stx-runtime\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-framework-composables\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-stores\b[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script\b[^>]*\bdata-stx-composables\b[^>]*>[\s\S]*?<\/script>/gi,""),Z=[];for(let Y of CL){if(X6.has(Y))continue;let J=Y.replace(/[$()*+.?[\\\]^{|}-]/g,"\\$&");if(new RegExp(`(^|[^\\w$.])${J}\\s*\\(`).test($))Z.push(Y)}return Z.sort()}async function xL(X,$){let Z=yq(X);if(Z.length===0)return null;let Y=$??_$.join(import.meta.dir,"composables"),J=`${Y}\x00${Z.join(",")}`,G=t7.get(J);if(G!==void 0)return G||null;let Q=_1({loader:"ts",target:"browser",define:u0()}),q=new Set(Z),W=[],K=new Set,U=[];try{let j=new Bun.Glob("*.{ts,js}");for await(let _ of j.scan({cwd:Y,absolute:!0}))U.push(_)}catch{return t7.set(J,""),null}U=Dq(U);for(let j of U){let _;try{_=await Bun.file(j).text()}catch{continue}let H=[];try{H=Q.scan(_).exports.filter((L)=>L!=="default")}catch{continue}if(!H.some((L)=>q.has(L)))continue;try{_=_.replace(/^import\s+.*from\s+['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^import\s+type\s+.*$/gm,""),_=_.replace(/^export\s+\*\s+(?:as\s+\w+\s+)?from\s*['"][^'"]+['"]\s*;?\s*$/gm,""),_=_.replace(/^export\s+(?:type\s+)?\{[\s\S]*?\}\s*(?:from\s*['"][^'"]+['"]\s*)?;?\s*$/gm,""),_=_.replace(/^export\s+default\s+/gm,""),_=_.replace(/^export\s+(?=(?:declare\s+)?(?:abstract\s+)?(?:async\s+)?(?:function|class|const|let|var|type|interface|enum)\b)/gm,""),W.push(`// ${_$.basename(j).replace(/\.[jt]s$/,"")}
13869
+ ${Q.transformSync(_).trim()}`);for(let L of H)K.add(L)}catch(L){console.warn(`[stx] framework composable ${_$.basename(j)} could not be bundled:`,L)}}let z=Z.filter((j)=>!K.has(j)&&!vL(X,j));if(z.length>0)console.warn(`[stx] could not bundle ${z.join(", ")} from @stacksjs/stx/composables \u2014 `+"calls to them will throw ReferenceError in the browser. Import them explicitly so the bundler inlines them, or use a runtime equivalent from window.stx.");if(W.length===0)return t7.set(J,""),null;let w=[...K].map((j)=>` try { if (!(${JSON.stringify(j)} in __s)) { __s[${JSON.stringify(j)}] = ${j}; if (!(${JSON.stringify(j)} in window)) window[${JSON.stringify(j)}] = ${j}; } } catch (e) {}`).join(`
13870
13870
  `),B=`<script data-stx-framework-composables>
13871
13871
  ;(function(){
13872
13872
  var __s = window.stx = window.stx || {};
13873
- ${K.join(`
13873
+ ${W.join(`
13874
13874
 
13875
13875
  `)}
13876
13876
  ${w}
13877
13877
  })();
13878
- </script>`;return t7.set(J,B),B}function vO(X){X6.clear();for(let $ of X)X6.add($)}var t7,X6,bO;var Sq=E(()=>{N1();Eq();H0();t7=new Map,X6=new Set,bO=new Set(e3)});var Pq={};n(Pq,{getComposableScript:()=>hO,clearComposableCache:()=>uO});import e7 from"path";function Cq(X){let $=e7.basename(X,".ts");return $==="index"||$==="types"||X.endsWith(".d.ts")}async function fO(X){if(X)return e7.resolve(X);let $=`<default>:${process.cwd()}`,Z=$6.get($);if(Z!==void 0)return Z;let Y=await gO();if(Y!==null)$6.set($,Y);return Y}async function gO(){let X=await S1(),$=X.root||process.cwd(),Z=X.composablesDir;if(Z)return e7.resolve($,Z);for(let Y of xO){let J=e7.resolve($,Y);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:J,absolute:!0}))if(!Cq(Q))return J}catch{}}return null}async function hO(X){let $=await fO(X);if(!$)return null;let Z=[];try{let j=new Bun.Glob("**/*.ts");for await(let _ of j.scan({cwd:$,absolute:!0})){if(Cq(_))continue;Z.push(_)}}catch{return K1(a5,$,"",""),null}let Y=w$(Z),J=j$(a5,$,Y);if(J!==void 0)return J||null;if(Z.length===0)return K1(a5,$,Y,""),null;Z.sort();let G=_1({loader:"ts",target:"browser",define:u0()}),Q=[],q=new Set,K=new Set;for(let j of Z)try{let _=await Bun.file(j).text(),H=e7.basename(j,".ts");for(let O of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(O[1])K.add(O[1]);try{for(let O of G.scan(_).exports)if(O!=="default")q.add(O)}catch{}_=c0(_),_=AX(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=G.transformSync(_),Q.push(`// Composable: ${H}
13879
- ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${j}:`,_)}if(Q.length===0||q.size===0)return K1(a5,$,Y,""),null;let U=[...q].map((j)=>` try { __c[${JSON.stringify(j)}] = ${j}; } catch (e) {}`).join(`
13880
- `),W=JSON.stringify([...q]),z=Q.join(`
13878
+ </script>`;return t7.set(J,B),B}function fL(X){X6.clear();for(let $ of X)X6.add($)}var t7,X6,CL;var Sq=E(()=>{N1();Eq();H0();t7=new Map,X6=new Set,CL=new Set(e3)});var Pq={};i(Pq,{getComposableScript:()=>dL,clearComposableCache:()=>mL});import e7 from"path";function Cq(X){let $=e7.basename(X,".ts");return $==="index"||$==="types"||X.endsWith(".d.ts")}async function hL(X){if(X)return e7.resolve(X);let $=`<default>:${process.cwd()}`,Z=$6.get($);if(Z!==void 0)return Z;let Y=await uL();if(Y!==null)$6.set($,Y);return Y}async function uL(){let X=await S1(),$=X.root||process.cwd(),Z=X.composablesDir;if(Z)return e7.resolve($,Z);for(let Y of gL){let J=e7.resolve($,Y);try{let G=new Bun.Glob("**/*.ts");for await(let Q of G.scan({cwd:J,absolute:!0}))if(!Cq(Q))return J}catch{}}return null}async function dL(X){let $=await hL(X);if(!$)return null;let Z=[];try{let j=new Bun.Glob("**/*.ts");for await(let _ of j.scan({cwd:$,absolute:!0})){if(Cq(_))continue;Z.push(_)}}catch{return W1(a5,$,"",""),null}let Y=w$(Z),J=j$(a5,$,Y);if(J!==void 0)return J||null;if(Z.length===0)return W1(a5,$,Y,""),null;Z.sort();let G=_1({loader:"ts",target:"browser",define:u0()}),Q=[],q=new Set,W=new Set;for(let j of Z)try{let _=await Bun.file(j).text(),H=e7.basename(j,".ts");for(let L of _.matchAll(/\b(?:const|let|var|function|class)\s+([A-Z_a-z$][\w$]*)/g))if(L[1])W.add(L[1]);try{for(let L of G.scan(_).exports)if(L!=="default")q.add(L)}catch{}_=c0(_),_=AX(_),_=_.replace(/^export\s+(default\s+)?/gm,""),_=G.transformSync(_),Q.push(`// Composable: ${H}
13879
+ ${_.trim()}`)}catch(_){console.warn(`[stx] Failed to load composable ${j}:`,_)}if(Q.length===0||q.size===0)return W1(a5,$,Y,""),null;let K=[...q].map((j)=>` try { __c[${JSON.stringify(j)}] = ${j}; } catch (e) {}`).join(`
13880
+ `),U=JSON.stringify([...q]),z=Q.join(`
13881
13881
 
13882
13882
  `),B=`;(function(){
13883
13883
  window.__composables = window.__composables || {};
13884
13884
  var __c = window.__composables;
13885
13885
  var __stx = window.stx || {};
13886
- ${j1.filter((j)=>!K.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
13886
+ ${j1.filter((j)=>!W.has(j)&&new RegExp(`\\b${j}\\b`).test(z)).map((j)=>`var ${j} = __stx[${JSON.stringify(j)}];`).join(`
13887
13887
  `)}
13888
13888
  ${z}
13889
- ${U}
13890
- var __names = ${W};
13889
+ ${K}
13890
+ var __names = ${U};
13891
13891
  for (var __i = 0; __i < __names.length; __i++) {
13892
13892
  var __n = __names[__i];
13893
13893
  if (!(__n in __c)) continue;
@@ -13900,7 +13900,7 @@ ${U}
13900
13900
  }
13901
13901
  window[__n] = __c[__n];
13902
13902
  }
13903
- })();`;return K1(a5,$,Y,B),B}function uO(){a5.clear(),$6.clear()}var a5,$6,xO;var vq=E(()=>{T1();N1();t3();e0();H0();a5=new Map,$6=new Map,xO=["composables","functions"]});var fq={};n(fq,{processDeferDirectives:()=>pO});function dO(){return`stx-defer-${++xq}`}function mO(X){let $=X.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function lO(X,$,Z){let{trigger:Y,value:J}=mO($),G=Z,Q,q,K,U=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(U)Q=U[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let W=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(W)q=W[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)K=z[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:Y,triggerValue:J,content:G,placeholder:Q,loading:q,error:K}}function cO(X,$){let{trigger:Z,triggerValue:Y}=$,J;switch(Z){case"visible":J=`
13903
+ })();`;return W1(a5,$,Y,B),B}function mL(){a5.clear(),$6.clear()}var a5,$6,gL;var vq=E(()=>{T1();N1();t3();e0();H0();a5=new Map,$6=new Map,gL=["composables","functions"]});var fq={};i(fq,{processDeferDirectives:()=>nL});function lL(){return`stx-defer-${++xq}`}function cL(X){let $=X.match(/on:\s*['"]?(\w+)(?:\((\d+)\))?['"]?/);if($)return{trigger:$[1],value:$[2]};return{trigger:"immediate"}}function pL(X,$,Z){let{trigger:Y,value:J}=cL($),G=Z,Q,q,W,K=Z.match(/@placeholder\s*([\s\S]*?)(?=@loading|@error|$)/);if(K)Q=K[1].trim(),G=G.replace(/@placeholder[\s\S]*?(?=@loading|@error|$)/,"");let U=Z.match(/@loading\s*([\s\S]*?)(?=@error|$)/);if(U)q=U[1].trim(),G=G.replace(/@loading[\s\S]*?(?=@error|$)/,"");let z=Z.match(/@error(?:\s*\(\s*(\w+)\s*\))?\s*([\s\S]*)$/);if(z)W=z[2].trim(),G=G.replace(/@error(?:\s*\(\s*\w+\s*\))?[\s\S]*$/,"");return G=G.trim(),{trigger:Y,triggerValue:J,content:G,placeholder:Q,loading:q,error:W}}function iL(X,$){let{trigger:Z,triggerValue:Y}=$,J;switch(Z){case"visible":J=`
13904
13904
  const observer = new IntersectionObserver((entries) => {
13905
13905
  if (entries[0].isIntersecting) {
13906
13906
  observer.disconnect();
@@ -13973,15 +13973,15 @@ else {
13973
13973
  ${J}
13974
13974
  })();
13975
13975
  </script>
13976
- `}function pO(X,$,Z){xq=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return X.replace(Y,(J,G,Q)=>{let q=dO(),K=lO(J,G,Q),U=K.placeholder?`<div data-defer-placeholder>${K.placeholder}</div>`:"",W=K.loading?`<div data-defer-loading style="display: none;">${K.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=K.error?`<div data-defer-error style="display: none;">${K.error}</div>`:"",w=`<div data-defer-content style="display: none;">${K.content}</div>`,B=cO(q,K);return`
13977
- <div id="${q}" class="stx-defer" data-defer-trigger="${K.trigger}">
13976
+ `}function nL(X,$,Z){xq=0;let Y=/@defer\s*\(([^)]*)\)\s*([\s\S]*?)@enddefer/g;return X.replace(Y,(J,G,Q)=>{let q=lL(),W=pL(J,G,Q),K=W.placeholder?`<div data-defer-placeholder>${W.placeholder}</div>`:"",U=W.loading?`<div data-defer-loading style="display: none;">${W.loading}</div>`:'<div data-defer-loading style="display: none;"></div>',z=W.error?`<div data-defer-error style="display: none;">${W.error}</div>`:"",w=`<div data-defer-content style="display: none;">${W.content}</div>`,B=iL(q,W);return`
13977
+ <div id="${q}" class="stx-defer" data-defer-trigger="${W.trigger}">
13978
+ ${K}
13978
13979
  ${U}
13979
- ${W}
13980
13980
  ${w}
13981
13981
  ${z}
13982
13982
  </div>
13983
13983
  ${B}
13984
- `})}var xq=0;var hq={};n(hq,{processTeleportDirectives:()=>oO,ensureTeleportTargets:()=>sO});function iO(){return`stx-teleport-${++gq}`}function nO(X){let $=X.split(",").map((J)=>J.trim()),Z=$[0].replace(/['"]/g,""),Y;for(let J=1;J<$.length;J++){let G=$[J].match(/disabled:\s*(.+)/);if(G)Y=G[1].trim()}return{target:Z,disabled:Y}}function rO(X,$){return`
13984
+ `})}var xq=0;var hq={};i(hq,{processTeleportDirectives:()=>aL,ensureTeleportTargets:()=>tL});function rL(){return`stx-teleport-${++gq}`}function oL(X){let $=X.split(",").map((J)=>J.trim()),Z=$[0].replace(/['"]/g,""),Y;for(let J=1;J<$.length;J++){let G=$[J].match(/disabled:\s*(.+)/);if(G)Y=G[1].trim()}return{target:Z,disabled:Y}}function sL(X,$){return`
13985
13985
  <script>
13986
13986
  (function() {
13987
13987
  const source = document.getElementById('${X}');
@@ -14027,12 +14027,12 @@ else {
14027
14027
  });
14028
14028
  })();
14029
14029
  </script>
14030
- `}function oO(X,$,Z){gq=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return X.replace(Y,(J,G,Q)=>{let q=iO(),{target:K,disabled:U}=nO(G),W=Q.trim();if(U)try{let w=!1;if(U==="true")w=!0;else if(U==="false")w=!1;else if(U in $)w=Boolean($[U]);if(w)return`<div class="stx-teleport-inline" data-teleport-disabled>${W}</div>`}catch{}let z=rO(q,K);return`
14030
+ `}function aL(X,$,Z){gq=0;let Y=/@teleport\s*\(([^)]+)\)\s*([\s\S]*?)@endteleport/g;return X.replace(Y,(J,G,Q)=>{let q=rL(),{target:W,disabled:K}=oL(G),U=Q.trim();if(K)try{let w=!1;if(K==="true")w=!0;else if(K==="false")w=!1;else if(K in $)w=Boolean($[K]);if(w)return`<div class="stx-teleport-inline" data-teleport-disabled>${U}</div>`}catch{}let z=sL(q,W);return`
14031
14031
  <div id="${q}" class="stx-teleport-source" style="display: none;">
14032
- <template>${W}</template>
14032
+ <template>${U}</template>
14033
14033
  </div>
14034
14034
  ${z}
14035
- `})}function sO(){return`
14035
+ `})}function tL(){return`
14036
14036
  <script>
14037
14037
  (function() {
14038
14038
  // Common teleport targets
@@ -14049,23 +14049,23 @@ else {
14049
14049
  });
14050
14050
  })();
14051
14051
  </script>
14052
- `}var gq=0;var lq={};n(lq,{processTransitionDirectives:()=>XL,processTransitionAttributes:()=>JL,performLeave:()=>eO,performEnter:()=>tO,generateTransitionRuntime:()=>YL,generateTransitionCSS:()=>ZL});function uq(X,$={}){return{enterFrom:$.enterClass||`${X}-enter-from`,enterActive:$.enterActiveClass||`${X}-enter-active`,enterTo:$.enterToClass||`${X}-enter-to`,leaveFrom:$.leaveClass||`${X}-leave-from`,leaveActive:$.leaveActiveClass||`${X}-leave-active`,leaveTo:$.leaveToClass||`${X}-leave-to`}}function aO(X){let $=getComputedStyle(X),Z=$.transitionDuration||"0s",Y=$.animationDuration||"0s",J=(G)=>{let Q=G.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let q=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?q:q*1000};return Math.max(J(Z),J(Y))}function dq(X,$){return new Promise((Z)=>{let Y=$??aO(X);if(Y===0){Z();return}let J=!1,G=()=>{if(J)return;J=!0,X.removeEventListener("transitionend",Q),X.removeEventListener("animationend",Q),Z()},Q=(q)=>{if(q.target===X)G()};X.addEventListener("transitionend",Q),X.addEventListener("animationend",Q),setTimeout(G,Y+50)})}function mq(X){X.offsetHeight}async function tO(X,$={}){let Z=$.name||"stx",Y=uq(Z,$),J=typeof $.duration==="object"?$.duration.enter:$.duration;if($.onBeforeEnter?.(X),X.classList.add(Y.enterFrom),X.classList.add(Y.enterActive),mq(X),X.classList.remove(Y.enterFrom),X.classList.add(Y.enterTo),$.onEnter)await new Promise((G)=>{$.onEnter(X,G)});else await dq(X,J);X.classList.remove(Y.enterActive),X.classList.remove(Y.enterTo),$.onAfterEnter?.(X)}async function eO(X,$={}){let Z=$.name||"stx",Y=uq(Z,$),J=typeof $.duration==="object"?$.duration.leave:$.duration;if($.onBeforeLeave?.(X),X.classList.add(Y.leaveFrom),X.classList.add(Y.leaveActive),mq(X),X.classList.remove(Y.leaveFrom),X.classList.add(Y.leaveTo),$.onLeave)await new Promise((G)=>{$.onLeave(X,G)});else await dq(X,J);X.classList.remove(Y.leaveActive),X.classList.remove(Y.leaveTo),$.onAfterLeave?.(X)}function XL(X,$={},Z){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return X.replace(Y,(J,G,Q)=>{let q=$L(G),K=q.name||"stx",U=q.duration||300,W=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
14052
+ `}var gq=0;var lq={};i(lq,{processTransitionDirectives:()=>ZO,processTransitionAttributes:()=>QO,performLeave:()=>$O,performEnter:()=>XO,generateTransitionRuntime:()=>GO,generateTransitionCSS:()=>JO});function uq(X,$={}){return{enterFrom:$.enterClass||`${X}-enter-from`,enterActive:$.enterActiveClass||`${X}-enter-active`,enterTo:$.enterToClass||`${X}-enter-to`,leaveFrom:$.leaveClass||`${X}-leave-from`,leaveActive:$.leaveActiveClass||`${X}-leave-active`,leaveTo:$.leaveToClass||`${X}-leave-to`}}function eL(X){let $=getComputedStyle(X),Z=$.transitionDuration||"0s",Y=$.animationDuration||"0s",J=(G)=>{let Q=G.match(/^([\d.]+)(s|ms)?$/);if(!Q)return 0;let q=parseFloat(Q[1]);return(Q[2]||"s")==="ms"?q:q*1000};return Math.max(J(Z),J(Y))}function dq(X,$){return new Promise((Z)=>{let Y=$??eL(X);if(Y===0){Z();return}let J=!1,G=()=>{if(J)return;J=!0,X.removeEventListener("transitionend",Q),X.removeEventListener("animationend",Q),Z()},Q=(q)=>{if(q.target===X)G()};X.addEventListener("transitionend",Q),X.addEventListener("animationend",Q),setTimeout(G,Y+50)})}function mq(X){X.offsetHeight}async function XO(X,$={}){let Z=$.name||"stx",Y=uq(Z,$),J=typeof $.duration==="object"?$.duration.enter:$.duration;if($.onBeforeEnter?.(X),X.classList.add(Y.enterFrom),X.classList.add(Y.enterActive),mq(X),X.classList.remove(Y.enterFrom),X.classList.add(Y.enterTo),$.onEnter)await new Promise((G)=>{$.onEnter(X,G)});else await dq(X,J);X.classList.remove(Y.enterActive),X.classList.remove(Y.enterTo),$.onAfterEnter?.(X)}async function $O(X,$={}){let Z=$.name||"stx",Y=uq(Z,$),J=typeof $.duration==="object"?$.duration.leave:$.duration;if($.onBeforeLeave?.(X),X.classList.add(Y.leaveFrom),X.classList.add(Y.leaveActive),mq(X),X.classList.remove(Y.leaveFrom),X.classList.add(Y.leaveTo),$.onLeave)await new Promise((G)=>{$.onLeave(X,G)});else await dq(X,J);X.classList.remove(Y.leaveActive),X.classList.remove(Y.leaveTo),$.onAfterLeave?.(X)}function ZO(X,$={},Z){let Y=/@transition\s*\(([^)]*)\)([\s\S]*?)@endtransition/gi;return X.replace(Y,(J,G,Q)=>{let q=YO(G),W=q.name||"stx",K=q.duration||300,U=`stx-transition-${Math.random().toString(36).slice(2,9)}`;return`
14053
14053
  <div
14054
14054
  class="stx-transition-wrapper"
14055
- data-transition="${K}"
14056
- data-transition-id="${W}"
14057
- data-transition-duration="${U}"
14055
+ data-transition="${W}"
14056
+ data-transition-id="${U}"
14057
+ data-transition-duration="${K}"
14058
14058
  ${q.mode?`data-transition-mode="${q.mode}"`:""}
14059
14059
  >
14060
14060
  ${Q.trim()}
14061
14061
  </div>
14062
14062
  <script>
14063
14063
  (function() {
14064
- const wrapper = document.querySelector('[data-transition-id="${W}"]');
14064
+ const wrapper = document.querySelector('[data-transition-id="${U}"]');
14065
14065
  if (!wrapper) return;
14066
14066
 
14067
- const name = '${K}';
14068
- const duration = ${U};
14067
+ const name = '${W}';
14068
+ const duration = ${K};
14069
14069
 
14070
14070
  // Observe for child changes to trigger transitions
14071
14071
  const observer = new MutationObserver(function(mutations) {
@@ -14091,7 +14091,7 @@ else {
14091
14091
  });
14092
14092
  })();
14093
14093
  </script>
14094
- `})}function $L(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4]||Y[5];switch(J){case"name":$.name=G;break;case"duration":$.duration=parseInt(G,10);break;case"mode":$.mode=G;break;case"easing":$.easing=G;break}}return $}function ZL(){return`
14094
+ `})}function YO(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4]||Y[5];switch(J){case"name":$.name=G;break;case"duration":$.duration=parseInt(G,10);break;case"mode":$.mode=G;break;case"easing":$.easing=G;break}}return $}function JO(){return`
14095
14095
  /* STX Transition Presets */
14096
14096
 
14097
14097
  /* Fade */
@@ -14278,7 +14278,7 @@ else {
14278
14278
  opacity: 1;
14279
14279
  max-height: 1000px;
14280
14280
  }
14281
- `}function YL(){return`
14281
+ `}function GO(){return`
14282
14282
  // STX Transition Runtime
14283
14283
  (function() {
14284
14284
  if (typeof window === 'undefined') return;
@@ -14367,7 +14367,7 @@ else {
14367
14367
 
14368
14368
  console.log('[stx] Transition runtime initialized');
14369
14369
  })();
14370
- `}function JL(X){let $=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return X.replace($,(Z,Y,J,G)=>{let Q=J||"300",q=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${q}"`})}var pq={};n(pq,{withErrorBoundary:()=>cq,processErrorBoundaryDirectives:()=>qL,generateErrorBoundaryRuntime:()=>wL,generateErrorBoundaryCSS:()=>zL,createErrorBoundary:()=>WL});function QL(){return`eb-${++GL}-${Date.now().toString(36)}`}function qL(X,$={},Z){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return X.replace(Y,(J,G,Q,q)=>{let K=QL(),U=KL(G||"");return UL(K,Q.trim(),q.trim(),U)})}function KL(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4];switch(J){case"id":$.id=G;break;case"logErrors":$.logErrors=G==="true";break}}return $}function UL(X,$,Z,Y){let J=Y.logErrors!==!1;return`
14370
+ `}function QO(X){let $=/@transition\.([a-z-]+)(?:\.(\d+))?="([^"]+)"/gi;return X.replace($,(Z,Y,J,G)=>{let Q=J||"300",q=`stx-t-${Math.random().toString(36).slice(2,7)}`;return`data-stx-transition="${Y}" data-stx-transition-duration="${Q}" data-stx-transition-condition="${G}" data-stx-transition-id="${q}"`})}var pq={};i(pq,{withErrorBoundary:()=>cq,processErrorBoundaryDirectives:()=>KO,generateErrorBoundaryRuntime:()=>BO,generateErrorBoundaryCSS:()=>jO,createErrorBoundary:()=>wO});function WO(){return`eb-${++qO}-${Date.now().toString(36)}`}function KO(X,$={},Z){let Y=/@errorBoundary(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@enderrorBoundary/gi;return X.replace(Y,(J,G,Q,q)=>{let W=WO(),K=UO(G||"");return zO(W,Q.trim(),q.trim(),K)})}function UO(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3]||Y[4];switch(J){case"id":$.id=G;break;case"logErrors":$.logErrors=G==="true";break}}return $}function zO(X,$,Z,Y){let J=Y.logErrors!==!1;return`
14371
14371
  <div class="stx-error-boundary" data-boundary-id="${X}" data-has-error="false">
14372
14372
  <div class="stx-error-boundary-content" data-boundary-content="${X}">
14373
14373
  ${$}
@@ -14487,7 +14487,7 @@ else {
14487
14487
  };
14488
14488
  })();
14489
14489
  </script>
14490
- `}async function cq(X,$,Z){try{return await X()}catch(Y){if(Z)Z(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return $}}function WL(X,$={}){let Z=$.onError?(Y)=>$.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>cq(Y,X,Z)}function zL(){return`
14490
+ `}async function cq(X,$,Z){try{return await X()}catch(Y){if(Z)Z(Y instanceof Error?Y:Error(String(Y)));else console.error("[stx:errorBoundary] SSR Error:",Y);return $}}function wO(X,$={}){let Z=$.onError?(Y)=>$.onError(Y,{timestamp:Date.now(),boundaryId:"ssr"}):void 0;return(Y)=>cq(Y,X,Z)}function jO(){return`
14491
14491
  /* STX Error Boundary Styles */
14492
14492
  .stx-error-boundary {
14493
14493
  position: relative;
@@ -14531,7 +14531,7 @@ else {
14531
14531
  color: #fecaca;
14532
14532
  }
14533
14533
  }
14534
- `}function wL(){return`
14534
+ `}function BO(){return`
14535
14535
  // STX Error Boundary Runtime
14536
14536
  (function() {
14537
14537
  if (typeof window === 'undefined') return;
@@ -14596,7 +14596,7 @@ else {
14596
14596
 
14597
14597
  console.log('[stx] Error boundary runtime initialized');
14598
14598
  })();
14599
- `}var GL=0;var iq={};n(iq,{renderSSRSuspense:()=>FL,processSuspenseDirectives:()=>_L,generateSuspenseRuntime:()=>AL,generateSuspenseCSS:()=>VL,createSSRSuspense:()=>LL});function BL(){return`suspense-${++jL}-${Date.now().toString(36)}`}function _L(X,$={},Z){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return X.replace(Y,(J,G,Q,q)=>{let K=BL(),U=HL(G||"");return OL(K,Q.trim(),q.trim(),U)})}function HL(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"id":$.id=G;break;case"timeout":$.timeout=Q?parseInt(Q,10):void 0;break}}return $}function OL(X,$,Z,Y){let J=Y.timeout||30000,G=Y.id||X;return`
14599
+ `}var qO=0;var iq={};i(iq,{renderSSRSuspense:()=>AO,processSuspenseDirectives:()=>LO,generateSuspenseRuntime:()=>NO,generateSuspenseCSS:()=>RO,createSSRSuspense:()=>VO});function HO(){return`suspense-${++_O}-${Date.now().toString(36)}`}function LO(X,$={},Z){let Y=/@suspense(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@fallback\s*([\s\S]*?)@endsuspense/gi;return X.replace(Y,(J,G,Q,q)=>{let W=HO(),K=OO(G||"");return FO(W,Q.trim(),q.trim(),K)})}function OO(X){let $={},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"id":$.id=G;break;case"timeout":$.timeout=Q?parseInt(Q,10):void 0;break}}return $}function FO(X,$,Z,Y){let J=Y.timeout||30000,G=Y.id||X;return`
14600
14600
  <div class="stx-suspense" data-suspense-id="${X}" data-custom-id="${G}" data-status="pending">
14601
14601
  <div class="stx-suspense-fallback" data-suspense-fallback="${X}">
14602
14602
  ${Z}
@@ -14786,7 +14786,7 @@ else {
14786
14786
  }, 0);
14787
14787
  })();
14788
14788
  </script>
14789
- `}function LL(X,$,Z){return{id:X,fallback:Z,content:$}}async function FL(X){let $=X.map((Y)=>`
14789
+ `}function VO(X,$,Z){return{id:X,fallback:Z,content:$}}async function AO(X){let $=X.map((Y)=>`
14790
14790
  <div id="stx-ssr-suspense-${Y.id}" class="stx-ssr-suspense">
14791
14791
  ${Y.fallback}
14792
14792
  </div>
@@ -14811,7 +14811,7 @@ else {
14811
14811
  }
14812
14812
  })();
14813
14813
  </script>
14814
- `}}return{initial:$,streaming:Z()}}function VL(){return`
14814
+ `}}return{initial:$,streaming:Z()}}function RO(){return`
14815
14815
  /* STX Suspense Styles */
14816
14816
  .stx-suspense {
14817
14817
  position: relative;
@@ -14867,7 +14867,7 @@ else {
14867
14867
  background-size: 200% 100%;
14868
14868
  }
14869
14869
  }
14870
- `}function AL(){return`
14870
+ `}function NO(){return`
14871
14871
  // STX Suspense Runtime
14872
14872
  (function() {
14873
14873
  if (typeof window === 'undefined') return;
@@ -14934,7 +14934,7 @@ else {
14934
14934
 
14935
14935
  console.log('[stx] Suspense runtime initialized');
14936
14936
  })();
14937
- `}var jL=0;var sq={};n(sq,{processAsyncDirectives:()=>NL,isAsyncComponent:()=>ML,generateAsyncComponentRuntime:()=>IL,generateAsyncComponentCSS:()=>kL,defineAsyncComponent:()=>TL});function nq(){return`async-${++RL}-${Date.now().toString(36)}`}function NL(X,$={},Z){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,G=X;return G=G.replace(Y,(Q,q,K,U)=>{let W=nq(),z=rq(q);return oq(W,z,K.trim(),U.trim())}),G=G.replace(J,(Q,q,K)=>{let U=nq(),W=rq(q);return oq(U,W,K.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function rq(X){let $={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4],q=Y[5];switch(J){case"component":$.component=G||q||"";break;case"timeout":$.timeout=Q?parseInt(Q,10):30000;break;case"delay":$.delay=Q?parseInt(Q,10):200;break;case"suspensible":$.suspensible=q==="true";break;case"retries":$.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":$.loadingComponent=G||q;break;case"errorComponent":$.errorComponent=G||q;break}}return $}function oq(X,$,Z,Y){let{component:J,timeout:G,delay:Q,suspensible:q,retries:K}=$;return`
14937
+ `}var _O=0;var sq={};i(sq,{processAsyncDirectives:()=>MO,isAsyncComponent:()=>IO,generateAsyncComponentRuntime:()=>DO,generateAsyncComponentCSS:()=>EO,defineAsyncComponent:()=>kO});function nq(){return`async-${++TO}-${Date.now().toString(36)}`}function MO(X,$={},Z){let Y=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@error\s*([\s\S]*?)@endasync/gi,J=/@async\s*\(([^)]*)\)\s*([\s\S]*?)@endasync/gi,G=X;return G=G.replace(Y,(Q,q,W,K)=>{let U=nq(),z=rq(q);return oq(U,z,W.trim(),K.trim())}),G=G.replace(J,(Q,q,W)=>{let K=nq(),U=rq(q);return oq(K,U,W.trim(),'<div class="stx-async-error">Failed to load component</div>')}),G}function rq(X){let $={component:"",timeout:30000,delay:200,suspensible:!0,retries:0},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4],q=Y[5];switch(J){case"component":$.component=G||q||"";break;case"timeout":$.timeout=Q?parseInt(Q,10):30000;break;case"delay":$.delay=Q?parseInt(Q,10):200;break;case"suspensible":$.suspensible=q==="true";break;case"retries":$.retries=Q?parseInt(Q,10):0;break;case"loadingComponent":$.loadingComponent=G||q;break;case"errorComponent":$.errorComponent=G||q;break}}return $}function oq(X,$,Z,Y){let{component:J,timeout:G,delay:Q,suspensible:q,retries:W}=$;return`
14938
14938
  <div class="stx-async-component" data-async-id="${X}" data-component="${J}" data-status="pending">
14939
14939
  <div class="stx-async-loading" data-async-loading="${X}">
14940
14940
  ${Z}
@@ -14952,7 +14952,7 @@ else {
14952
14952
  const timeout = ${G};
14953
14953
  const delay = ${Q};
14954
14954
  const suspensible = ${q};
14955
- const maxRetries = ${K};
14955
+ const maxRetries = ${W};
14956
14956
 
14957
14957
  const container = document.querySelector('[data-async-id="' + asyncId + '"]');
14958
14958
  const loadingEl = document.querySelector('[data-async-loading="' + asyncId + '"]');
@@ -15161,7 +15161,7 @@ catch (error) {
15161
15161
  loadComponent();
15162
15162
  })();
15163
15163
  </script>
15164
- `}function TL(X){return{__asyncComponent:!0,...typeof X==="function"?{loader:X}:X}}function ML(X){return typeof X==="object"&&X!==null&&"__asyncComponent"in X&&X.__asyncComponent===!0}function kL(){return`
15164
+ `}function kO(X){return{__asyncComponent:!0,...typeof X==="function"?{loader:X}:X}}function IO(X){return typeof X==="object"&&X!==null&&"__asyncComponent"in X&&X.__asyncComponent===!0}function EO(){return`
15165
15165
  /* STX Async Component Styles */
15166
15166
  .stx-async-component {
15167
15167
  position: relative;
@@ -15235,7 +15235,7 @@ catch (error) {
15235
15235
  background-size: 200% 100%;
15236
15236
  }
15237
15237
  }
15238
- `}function IL(){return`
15238
+ `}function DO(){return`
15239
15239
  // STX Async Component Runtime
15240
15240
  (function() {
15241
15241
  if (typeof window === 'undefined') return;
@@ -15289,7 +15289,7 @@ catch (error) {
15289
15289
 
15290
15290
  console.log('[stx] Async component runtime initialized');
15291
15291
  })();
15292
- `}var RL=0;var tq={};n(tq,{shouldCacheComponent:()=>CL,processKeepAliveDirectives:()=>DL,onDeactivated:()=>fL,onActivated:()=>xL,generateKeepAliveRuntime:()=>vL,generateKeepAliveCSS:()=>PL,createKeepAliveCache:()=>SL});function aq(){return`keep-alive-${++EL}-${Date.now().toString(36)}`}function DL(X,$={},Z){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return X.replace(Y,(J,G,Q)=>{let q=aq(),K=yL(G||"");return bL(q,Q.trim(),K)})}function yL(X){let $={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"max":$.max=Q?parseInt(Q,10):10;break;case"include":$.include=G;break;case"exclude":$.exclude=G;break;case"id":$.id=G;break}}return $}function bL(X,$,Z){let{max:Y,include:J,exclude:G}=Z,Q=Z.id||X;return`
15292
+ `}var TO=0;var tq={};i(tq,{shouldCacheComponent:()=>vO,processKeepAliveDirectives:()=>bO,onDeactivated:()=>hO,onActivated:()=>gO,generateKeepAliveRuntime:()=>fO,generateKeepAliveCSS:()=>xO,createKeepAliveCache:()=>PO});function aq(){return`keep-alive-${++yO}-${Date.now().toString(36)}`}function bO(X,$={},Z){let Y=/@keepAlive(?:\s*\(([^)]*)\))?\s*([\s\S]*?)@endkeepAlive/gi;return X.replace(Y,(J,G,Q)=>{let q=aq(),W=SO(G||"");return CO(q,Q.trim(),W)})}function SO(X){let $={max:10},Z=/(\w+)\s*:\s*(?:'([^']*)'|"([^"]*)"|(\d+)|(\w+))/g,Y;while((Y=Z.exec(X))!==null){let J=Y[1],G=Y[2]||Y[3],Q=Y[4];switch(J){case"max":$.max=Q?parseInt(Q,10):10;break;case"include":$.include=G;break;case"exclude":$.exclude=G;break;case"id":$.id=G;break}}return $}function CO(X,$,Z){let{max:Y,include:J,exclude:G}=Z,Q=Z.id||X;return`
15293
15293
  <div class="stx-keep-alive" data-keep-alive-id="${X}" data-custom-id="${Q}">
15294
15294
  <div class="stx-keep-alive-content" data-keep-alive-content="${X}">
15295
15295
  ${$}
@@ -15576,7 +15576,7 @@ else {
15576
15576
  });
15577
15577
  })();
15578
15578
  </script>
15579
- `}function SL(X={}){return{id:X.id||aq(),cache:new Map,max:X.max||10,include:X.include?X.include.split(",").map((Z)=>Z.trim()):null,exclude:X.exclude?X.exclude.split(",").map((Z)=>Z.trim()):null}}function CL(X,$){if($.exclude&&$.exclude.includes(X))return!1;if($.include&&!$.include.includes(X))return!1;return!0}function PL(){return`
15579
+ `}function PO(X={}){return{id:X.id||aq(),cache:new Map,max:X.max||10,include:X.include?X.include.split(",").map((Z)=>Z.trim()):null,exclude:X.exclude?X.exclude.split(",").map((Z)=>Z.trim()):null}}function vO(X,$){if($.exclude&&$.exclude.includes(X))return!1;if($.include&&!$.include.includes(X))return!1;return!0}function xO(){return`
15580
15580
  /* STX Keep-Alive Styles */
15581
15581
  .stx-keep-alive {
15582
15582
  position: relative;
@@ -15601,7 +15601,7 @@ else {
15601
15601
  .stx-keep-alive-content > [data-activated] {
15602
15602
  opacity: 1;
15603
15603
  }
15604
- `}function vL(){return`
15604
+ `}function fO(){return`
15605
15605
  // STX Keep-Alive Runtime
15606
15606
  (function() {
15607
15607
  if (typeof window === 'undefined') return;
@@ -15637,20 +15637,20 @@ else {
15637
15637
 
15638
15638
  console.log('[stx] Keep-alive runtime initialized');
15639
15639
  })();
15640
- `}function xL(X){if(typeof document<"u")document.addEventListener("stx:activated",($)=>{X($.detail)})}function fL(X){if(typeof document<"u")document.addEventListener("stx:deactivated",($)=>{X($.detail)})}var EL=0;var YK={};n(YK,{useVirtualList:()=>XK,processVirtualListDirectives:()=>Y6,processVirtualGridDirectives:()=>ZK,processInfiniteListDirectives:()=>$K,generateVirtualListCSS:()=>eq,default:()=>gL,createVirtualList:()=>Z6});function Z6(X,$){let{itemHeight:Z,containerHeight:Y,overscan:J=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:q=Z,direction:K="vertical"}=$,U=[...X],W=0,z=new Map;function w(){if(Q)return B();let R=Math.max(0,Math.floor(W/Z)-J),N=Math.ceil(Y/Z),T=Math.min(U.length-1,R+N+J*2);return{startIndex:R,endIndex:T}}function B(){let R=0,N=0,T=U.length-1;for(let M=0;M<U.length;M++){let k=z.get(M)||q;if(R+k>W){N=Math.max(0,M-J);break}R+=k}R=0;for(let M=0;M<U.length;M++){let k=z.get(M)||q;if(R+=k,R>W+Y){T=Math.min(U.length-1,M+J);break}}return{startIndex:N,endIndex:T}}function j(){if(Q){let R=0;for(let N=0;N<U.length;N++)R+=z.get(N)||q;return R}return U.length*Z}function _(R){if(Q){let N=0;for(let T=0;T<R;T++)N+=z.get(T)||q;return N}return R*Z}function H(){let{startIndex:R,endIndex:N}=w();return{startIndex:R,endIndex:N,scrollTop:W,totalHeight:j(),visibleItems:U.slice(R,N+1),itemHeights:new Map(z)}}function O(R,N="auto"){let T=_(R);L(T,N)}function L(R,N="auto"){W=Math.max(0,Math.min(R,j()-Y))}function F(){w()}function V(R){U=[...R],z.clear(),F()}function A(){U=[],z.clear()}return{scrollToIndex:O,scrollToOffset:L,getState:H,refresh:F,setItems:V,destroy:A}}function Y6(X,$={},Z){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return X.replace(Y,(J,G,Q,q)=>{let K=G.trim(),U=$[K];if(!U||!Array.isArray(U))return`<!-- virtualList: items "${K}" not found or not an array -->`;let W={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let L=Q.trim(),F=Function(`return ${L}`)();W={...W,...F}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,w=Math.ceil(W.containerHeight/W.itemHeight),B=W.overscan||3,j=0,_=Math.min(U.length-1,w+B),H="";for(let L=j;L<=_&&L<U.length;L++){let F=U[L],V=q.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(L));H+=`
15641
- <div class="virtual-item ${W.itemClass||""}"
15642
- style="position: absolute; top: ${L*W.itemHeight}px; height: ${W.itemHeight}px; width: 100%;"
15643
- data-index="${L}">
15640
+ `}function gO(X){if(typeof document<"u")document.addEventListener("stx:activated",($)=>{X($.detail)})}function hO(X){if(typeof document<"u")document.addEventListener("stx:deactivated",($)=>{X($.detail)})}var yO=0;var YW={};i(YW,{useVirtualList:()=>XW,processVirtualListDirectives:()=>Y6,processVirtualGridDirectives:()=>ZW,processInfiniteListDirectives:()=>$W,generateVirtualListCSS:()=>eq,default:()=>uO,createVirtualList:()=>Z6});function Z6(X,$){let{itemHeight:Z,containerHeight:Y,overscan:J=3,keyProperty:G="id",dynamicHeight:Q=!1,estimatedItemHeight:q=Z,direction:W="vertical"}=$,K=[...X],U=0,z=new Map;function w(){if(Q)return B();let R=Math.max(0,Math.floor(U/Z)-J),N=Math.ceil(Y/Z),T=Math.min(K.length-1,R+N+J*2);return{startIndex:R,endIndex:T}}function B(){let R=0,N=0,T=K.length-1;for(let M=0;M<K.length;M++){let k=z.get(M)||q;if(R+k>U){N=Math.max(0,M-J);break}R+=k}R=0;for(let M=0;M<K.length;M++){let k=z.get(M)||q;if(R+=k,R>U+Y){T=Math.min(K.length-1,M+J);break}}return{startIndex:N,endIndex:T}}function j(){if(Q){let R=0;for(let N=0;N<K.length;N++)R+=z.get(N)||q;return R}return K.length*Z}function _(R){if(Q){let N=0;for(let T=0;T<R;T++)N+=z.get(T)||q;return N}return R*Z}function H(){let{startIndex:R,endIndex:N}=w();return{startIndex:R,endIndex:N,scrollTop:U,totalHeight:j(),visibleItems:K.slice(R,N+1),itemHeights:new Map(z)}}function L(R,N="auto"){let T=_(R);O(T,N)}function O(R,N="auto"){U=Math.max(0,Math.min(R,j()-Y))}function F(){w()}function V(R){K=[...R],z.clear(),F()}function A(){K=[],z.clear()}return{scrollToIndex:L,scrollToOffset:O,getState:H,refresh:F,setItems:V,destroy:A}}function Y6(X,$={},Z){let Y=/@virtualList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualList/gi;return X.replace(Y,(J,G,Q,q)=>{let W=G.trim(),K=$[W];if(!K||!Array.isArray(K))return`<!-- virtualList: items "${W}" not found or not an array -->`;let U={itemHeight:50,containerHeight:400,overscan:3};if(Q)try{let O=Q.trim(),F=Function(`return ${O}`)();U={...U,...F}}catch{}let z=`vlist-${Math.random().toString(36).substring(2,9)}`,w=Math.ceil(U.containerHeight/U.itemHeight),B=U.overscan||3,j=0,_=Math.min(K.length-1,w+B),H="";for(let O=j;O<=_&&O<K.length;O++){let F=K[O],V=q.replace(/\{\{\s*item\s*\}\}/g,typeof F==="object"?JSON.stringify(F):String(F)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(A,R)=>{if(typeof F==="object"&&F!==null)return String(F[R]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(O));H+=`
15641
+ <div class="virtual-item ${U.itemClass||""}"
15642
+ style="position: absolute; top: ${O*U.itemHeight}px; height: ${U.itemHeight}px; width: 100%;"
15643
+ data-index="${O}">
15644
15644
  ${V}
15645
- </div>`}let O=U.length*W.itemHeight;return`
15645
+ </div>`}let L=K.length*U.itemHeight;return`
15646
15646
  <div id="${z}"
15647
- class="virtual-list-container ${W.containerClass||""}"
15648
- style="position: relative; height: ${W.containerHeight}px; overflow-y: auto;"
15649
- data-item-height="${W.itemHeight}"
15650
- data-total-items="${U.length}"
15647
+ class="virtual-list-container ${U.containerClass||""}"
15648
+ style="position: relative; height: ${U.containerHeight}px; overflow-y: auto;"
15649
+ data-item-height="${U.itemHeight}"
15650
+ data-total-items="${K.length}"
15651
15651
  data-overscan="${B}">
15652
- <div class="virtual-list-viewport ${W.viewportClass||""}"
15653
- style="position: relative; height: ${O}px; width: 100%;">
15652
+ <div class="virtual-list-viewport ${U.viewportClass||""}"
15653
+ style="position: relative; height: ${L}px; width: 100%;">
15654
15654
  ${H}
15655
15655
  </div>
15656
15656
  </div>
@@ -15660,11 +15660,11 @@ else {
15660
15660
  if (!container) return;
15661
15661
 
15662
15662
  const viewport = container.querySelector('.virtual-list-viewport');
15663
- const itemHeight = ${W.itemHeight};
15664
- const totalItems = ${U.length};
15663
+ const itemHeight = ${U.itemHeight};
15664
+ const totalItems = ${K.length};
15665
15665
  const overscan = ${B};
15666
- const containerHeight = ${W.containerHeight};
15667
- const items = ${JSON.stringify(U)};
15666
+ const containerHeight = ${U.containerHeight};
15667
+ const items = ${JSON.stringify(K)};
15668
15668
  const template = ${JSON.stringify(q.trim())};
15669
15669
 
15670
15670
  let lastStartIndex = 0;
@@ -15683,7 +15683,7 @@ else {
15683
15683
  for (let i = startIndex; i <= endIndex; i++) {
15684
15684
  const item = items[i];
15685
15685
  const div = document.createElement('div');
15686
- div.className = 'virtual-item ${W.itemClass||""}';
15686
+ div.className = 'virtual-item ${U.itemClass||""}';
15687
15687
  div.style.cssText = 'position: absolute; top: ' + (i * itemHeight) + 'px; height: ' + itemHeight + 'px; width: 100%;';
15688
15688
  div.dataset.index = i;
15689
15689
 
@@ -15762,7 +15762,7 @@ else {
15762
15762
  0% { background-position: 200% 0; }
15763
15763
  100% { background-position: -200% 0; }
15764
15764
  }
15765
- `}function XK(X,$){let Z=null,Y=()=>{if(!Z)Z=Z6(X(),$);return Z};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${$.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(J)=>{let G=J.target;if(Z)Z.scrollToOffset(G.scrollTop)}}),itemProps:(J)=>({style:{position:"absolute",top:`${J*$.itemHeight}px`,height:`${$.itemHeight}px`,width:"100%"},"data-index":J}),scrollToIndex:(J)=>{Y().scrollToIndex(J)}}}function $K(X,$={},Z){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return X.replace(Y,(J,G,Q,q,K)=>{let U=G.trim(),W=$[U];if(!W||!Array.isArray(W))return`<!-- infiniteList: items "${U}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let j=Function(`return ${Q.trim()}`)();z={...z,...j}}catch{}let w=`ilist-${Math.random().toString(36).substring(2,9)}`,B=Y6(`@virtualList(${U}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${q}@endvirtualList`,$);return B=B.replace("</script>",`
15765
+ `}function XW(X,$){let Z=null,Y=()=>{if(!Z)Z=Z6(X(),$);return Z};return{visibleItems:()=>{return Y().getState().visibleItems},totalHeight:()=>{return Y().getState().totalHeight},containerProps:()=>({style:{height:`${$.containerHeight}px`,overflow:"auto",position:"relative"},onScroll:(J)=>{let G=J.target;if(Z)Z.scrollToOffset(G.scrollTop)}}),itemProps:(J)=>({style:{position:"absolute",top:`${J*$.itemHeight}px`,height:`${$.itemHeight}px`,width:"100%"},"data-index":J}),scrollToIndex:(J)=>{Y().scrollToIndex(J)}}}function $W(X,$={},Z){let Y=/@infiniteList\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@loading\s*([\s\S]*?)@endinfiniteList/gi;return X.replace(Y,(J,G,Q,q,W)=>{let K=G.trim(),U=$[K];if(!U||!Array.isArray(U))return`<!-- infiniteList: items "${K}" not found or not an array -->`;let z={itemHeight:50,containerHeight:400,overscan:3,threshold:100,hasMore:!0};if(Q)try{let j=Function(`return ${Q.trim()}`)();z={...z,...j}}catch{}let w=`ilist-${Math.random().toString(36).substring(2,9)}`,B=Y6(`@virtualList(${K}, ${JSON.stringify({itemHeight:z.itemHeight,containerHeight:z.containerHeight,overscan:z.overscan,containerClass:z.containerClass})})${q}@endvirtualList`,$);return B=B.replace("</script>",`
15766
15766
  // Infinite scroll detection
15767
15767
  container.addEventListener('scroll', function() {
15768
15768
  const scrollBottom = container.scrollTop + container.clientHeight;
@@ -15777,21 +15777,21 @@ else {
15777
15777
  <div id="${w}" class="infinite-list-wrapper">
15778
15778
  ${B}
15779
15779
  <div class="infinite-list-loading" style="display: none;">
15780
- ${K}
15780
+ ${W}
15781
15781
  </div>
15782
15782
  </div>
15783
- `})}function ZK(X,$={},Z){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return X.replace(Y,(J,G,Q,q)=>{let K=G.trim(),U=$[K];if(!U||!Array.isArray(U))return`<!-- virtualGrid: items "${K}" not found or not an array -->`;let W={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let F=Function(`return ${Q.trim()}`)();W={...W,...F}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,w=Math.ceil(U.length/W.columns),B=w*(W.rowHeight+(W.gap||0)),j=Math.ceil(W.containerHeight/(W.rowHeight+(W.gap||0))),_=W.overscan||2,H=0,O=Math.min(w-1,j+_),L="";for(let F=H;F<=O;F++)for(let V=0;V<W.columns;V++){let A=F*W.columns+V;if(A>=U.length)break;let R=U[A],N=V*(100/W.columns),T=F*(W.rowHeight+(W.gap||0)),M=q.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(k,D)=>{if(typeof R==="object"&&R!==null)return String(R[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));L+=`
15783
+ `})}function ZW(X,$={},Z){let Y=/@virtualGrid\s*\(\s*([^,]+)\s*(?:,\s*(\{[^}]*\}))?\s*\)\s*([\s\S]*?)@endvirtualGrid/gi;return X.replace(Y,(J,G,Q,q)=>{let W=G.trim(),K=$[W];if(!K||!Array.isArray(K))return`<!-- virtualGrid: items "${W}" not found or not an array -->`;let U={columns:3,rowHeight:100,containerHeight:400,gap:10,overscan:2};if(Q)try{let F=Function(`return ${Q.trim()}`)();U={...U,...F}}catch{}let z=`vgrid-${Math.random().toString(36).substring(2,9)}`,w=Math.ceil(K.length/U.columns),B=w*(U.rowHeight+(U.gap||0)),j=Math.ceil(U.containerHeight/(U.rowHeight+(U.gap||0))),_=U.overscan||2,H=0,L=Math.min(w-1,j+_),O="";for(let F=H;F<=L;F++)for(let V=0;V<U.columns;V++){let A=F*U.columns+V;if(A>=K.length)break;let R=K[A],N=V*(100/U.columns),T=F*(U.rowHeight+(U.gap||0)),M=q.replace(/\{\{\s*item\s*\}\}/g,typeof R==="object"?JSON.stringify(R):String(R)).replace(/\{\{\s*item\.(\w+)\s*\}\}/g,(k,D)=>{if(typeof R==="object"&&R!==null)return String(R[D]??"");return""}).replace(/\{\{\s*index\s*\}\}/g,String(A));O+=`
15784
15784
  <div class="virtual-grid-item"
15785
- style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/W.columns}% - ${W.gap||0}px); height: ${W.rowHeight}px;"
15785
+ style="position: absolute; top: ${T}px; left: ${N}%; width: calc(${100/U.columns}% - ${U.gap||0}px); height: ${U.rowHeight}px;"
15786
15786
  data-index="${A}">
15787
15787
  ${M}
15788
15788
  </div>`}return`
15789
15789
  <div id="${z}"
15790
15790
  class="virtual-grid-container"
15791
- style="position: relative; height: ${W.containerHeight}px; overflow-y: auto;">
15791
+ style="position: relative; height: ${U.containerHeight}px; overflow-y: auto;">
15792
15792
  <div class="virtual-grid-viewport"
15793
15793
  style="position: relative; height: ${B}px; width: 100%;">
15794
- ${L}
15794
+ ${O}
15795
15795
  </div>
15796
15796
  </div>
15797
15797
  <script data-virtual-grid="${z}">
@@ -15800,13 +15800,13 @@ else {
15800
15800
  if (!container) return;
15801
15801
 
15802
15802
  const viewport = container.querySelector('.virtual-grid-viewport');
15803
- const columns = ${W.columns};
15804
- const rowHeight = ${W.rowHeight};
15805
- const gap = ${W.gap||0};
15806
- const totalItems = ${U.length};
15803
+ const columns = ${U.columns};
15804
+ const rowHeight = ${U.rowHeight};
15805
+ const gap = ${U.gap||0};
15806
+ const totalItems = ${K.length};
15807
15807
  const overscan = ${_};
15808
- const containerHeight = ${W.containerHeight};
15809
- const items = ${JSON.stringify(U)};
15808
+ const containerHeight = ${U.containerHeight};
15809
+ const items = ${JSON.stringify(K)};
15810
15810
  const template = ${JSON.stringify(q.trim())};
15811
15811
 
15812
15812
  let lastStartRow = 0;
@@ -15850,7 +15850,7 @@ else {
15850
15850
  });
15851
15851
  })();
15852
15852
  </script>
15853
- `})}var gL;var JK=E(()=>{gL={createVirtualList:Z6,processVirtualListDirectives:Y6,processInfiniteListDirectives:$K,processVirtualGridDirectives:ZK,generateVirtualListCSS:eq,useVirtualList:XK}});function GK(){return`<script data-stx-hydration-runtime>
15853
+ `})}var uO;var JW=E(()=>{uO={createVirtualList:Z6,processVirtualListDirectives:Y6,processInfiniteListDirectives:$W,processVirtualGridDirectives:ZW,generateVirtualListCSS:eq,useVirtualList:XW}});function GW(){return`<script data-stx-hydration-runtime>
15854
15854
  (function() {
15855
15855
  'use strict';
15856
15856
 
@@ -16010,7 +16010,7 @@ else {
16010
16010
  stxIslands.initIslands();
16011
16011
  }
16012
16012
  })();
16013
- </script>`}function QK(X){let $=X.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if($)return $[1];let Z=X.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function qK(X,$){let Z={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(Q in $)Z[G]=$[Q];else Z[G]=Q}return Z}var LK={};n(LK,{processStaticDirectives:()=>HK,processPartialHydrationDirectives:()=>UK,onHydrated:()=>_K,isHydrated:()=>BK,hydrateIsland:()=>zK,hydrateByStrategy:()=>wK,hydrateAll:()=>jK,generatePartialHydrationCSS:()=>WK,generateIslandManifest:()=>OK,default:()=>iL,createIslandRegistry:()=>KK});function KK(){let X=new Map;return{islands:X,register($){X.set($.id,$)},get($){return X.get($)},async hydrate($){let Z=X.get($);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:$,component:Z.component}}))},async hydrateAll(){let $=Array.from(X.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all($)}}}function hL(X){return`
16013
+ </script>`}function QW(X){let $=X.match(/<([A-Z][a-zA-Z0-9]+)[\s/>]/);if($)return $[1];let Z=X.match(/<([a-z][a-z0-9]*-[a-z0-9-]+)[\s/>]/);if(Z)return Z[1];return null}function qW(X,$){let Z={},Y=/:([a-zA-Z_][\w-]*)\s*=\s*"([^"]+)"/g,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(Q in $)Z[G]=$[Q];else Z[G]=Q}return Z}var OW={};i(OW,{processStaticDirectives:()=>HW,processPartialHydrationDirectives:()=>KW,onHydrated:()=>_W,isHydrated:()=>BW,hydrateIsland:()=>zW,hydrateByStrategy:()=>wW,hydrateAll:()=>jW,generatePartialHydrationCSS:()=>UW,generateIslandManifest:()=>LW,default:()=>rO,createIslandRegistry:()=>WW});function WW(){let X=new Map;return{islands:X,register($){X.set($.id,$)},get($){return X.get($)},async hydrate($){let Z=X.get($);if(!Z||Z.hydrated)return;if(Z.hydrated=!0,typeof window<"u"&&typeof window.dispatchEvent==="function")window.dispatchEvent(new CustomEvent("stx:hydrate",{detail:{id:$,component:Z.component}}))},async hydrateAll(){let $=Array.from(X.values()).filter((Z)=>!Z.hydrated).map((Z)=>this.hydrate(Z.id));await Promise.all($)}}}function dO(X){return`
16014
16014
  <script data-hydrate="${X}">
16015
16015
  (function() {
16016
16016
  const island = document.querySelector('[data-island="${X}"]');
@@ -16021,7 +16021,7 @@ else {
16021
16021
  island.dispatchEvent(new CustomEvent('stx:hydrated', { bubbles: true }));
16022
16022
  })();
16023
16023
  </script>
16024
- `}function uL(X,$){let Z=$.timeout||2000,Y=$.priority||"low";return`
16024
+ `}function mO(X,$){let Z=$.timeout||2000,Y=$.priority||"low";return`
16025
16025
  <script data-hydrate="${X}">
16026
16026
  (function() {
16027
16027
  const island = document.querySelector('[data-island="${X}"]');
@@ -16057,7 +16057,7 @@ else {
16057
16057
  }
16058
16058
  })();
16059
16059
  </script>
16060
- `}function dL(X,$){let Z=$.rootMargin||"0px",Y=$.threshold||0;return`
16060
+ `}function lO(X,$){let Z=$.rootMargin||"0px",Y=$.threshold||0;return`
16061
16061
  <script data-hydrate="${X}">
16062
16062
  (function() {
16063
16063
  const island = document.querySelector('[data-island="${X}"]');
@@ -16090,7 +16090,7 @@ else {
16090
16090
  }
16091
16091
  })();
16092
16092
  </script>
16093
- `}function mL(X,$){let Z=$.media||"(min-width: 768px)";return`
16093
+ `}function cO(X,$){let Z=$.media||"(min-width: 768px)";return`
16094
16094
  <script data-hydrate="${X}">
16095
16095
  (function() {
16096
16096
  const island = document.querySelector('[data-island="${X}"]');
@@ -16119,7 +16119,7 @@ else {
16119
16119
  }
16120
16120
  })();
16121
16121
  </script>
16122
- `}function lL(X){return`
16122
+ `}function pO(X){return`
16123
16123
  <script data-hydrate="${X}">
16124
16124
  (function() {
16125
16125
  const island = document.querySelector('[data-island="${X}"]');
@@ -16141,7 +16141,7 @@ else {
16141
16141
  events.forEach(e => island.addEventListener(e, handler, { once: true, passive: true }));
16142
16142
  })();
16143
16143
  </script>
16144
- `}function cL(X,$){let Z=$.event||"stx:activate";return`
16144
+ `}function iO(X,$){let Z=$.event||"stx:activate";return`
16145
16145
  <script data-hydrate="${X}">
16146
16146
  (function() {
16147
16147
  const island = document.querySelector('[data-island="${X}"]');
@@ -16162,10 +16162,10 @@ else {
16162
16162
  });
16163
16163
  })();
16164
16164
  </script>
16165
- `}function UK(X,$={},Z){let Y=X,J=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test(X);if(Y=t5(Y,"load",$),Y=t5(Y,"idle",$),Y=t5(Y,"visible",$),Y=t5(Y,"media",$),Y=pL(Y),Y=t5(Y,"hover",$),Y=t5(Y,"event",$),J=G&&Y!==X,J)Y+=`
16166
- `+GK();return Y}function t5(X,$,Z){let Y=new RegExp(`@client:${$}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return X.replace(Y,(J,G,Q)=>{let q={strategy:$};if(G)try{let _=G.split(",").map((H)=>H.trim());for(let H of _){let[O,L]=H.split(":").map((F)=>F.trim());if(O&&L){let F=L.replace(/^['"]|['"]$/g,"");q[O]=F}}}catch{}let K=`island-${Math.random().toString(36).substring(2,9)}`,U=QK(Q.trim()),W=qK(Q.trim(),Z),z=[];if(q.rootMargin)z.push(`data-root-margin="${q.rootMargin}"`);if(q.threshold!==void 0)z.push(`data-threshold="${q.threshold}"`);if(q.media)z.push(`data-media="${q.media}"`);if(q.event)z.push(`data-event="${q.event}"`);if(U)z.push(`data-component="${U}"`);let B=Object.keys(W).length>0?`
16167
- <script type="application/json" data-island-props="${K}">${JSON.stringify(W)}</script>`:"",j="";switch($){case"load":j=hL(K);break;case"idle":j=uL(K,q);break;case"visible":j=dL(K,q);break;case"media":j=mL(K,q);break;case"hover":j=lL(K);break;case"event":j=cL(K,q);break}return`
16168
- <div data-island="${K}"
16165
+ `}function KW(X,$={},Z){let Y=X,J=!1,G=/@client:(load|idle|visible|media|only|hover|event)/i.test(X);if(Y=t5(Y,"load",$),Y=t5(Y,"idle",$),Y=t5(Y,"visible",$),Y=t5(Y,"media",$),Y=nO(Y),Y=t5(Y,"hover",$),Y=t5(Y,"event",$),J=G&&Y!==X,J)Y+=`
16166
+ `+GW();return Y}function t5(X,$,Z){let Y=new RegExp(`@client:${$}(?:\\s*\\(([^)]*)\\))?\\s*([\\s\\S]*?)@endclient`,"gi");return X.replace(Y,(J,G,Q)=>{let q={strategy:$};if(G)try{let _=G.split(",").map((H)=>H.trim());for(let H of _){let[L,O]=H.split(":").map((F)=>F.trim());if(L&&O){let F=O.replace(/^['"]|['"]$/g,"");q[L]=F}}}catch{}let W=`island-${Math.random().toString(36).substring(2,9)}`,K=QW(Q.trim()),U=qW(Q.trim(),Z),z=[];if(q.rootMargin)z.push(`data-root-margin="${q.rootMargin}"`);if(q.threshold!==void 0)z.push(`data-threshold="${q.threshold}"`);if(q.media)z.push(`data-media="${q.media}"`);if(q.event)z.push(`data-event="${q.event}"`);if(K)z.push(`data-component="${K}"`);let B=Object.keys(U).length>0?`
16167
+ <script type="application/json" data-island-props="${W}">${JSON.stringify(U)}</script>`:"",j="";switch($){case"load":j=dO(W);break;case"idle":j=mO(W,q);break;case"visible":j=lO(W,q);break;case"media":j=cO(W,q);break;case"hover":j=pO(W);break;case"event":j=iO(W,q);break}return`
16168
+ <div data-island="${W}"
16169
16169
  data-strategy="${$}"
16170
16170
  ${z.join(`
16171
16171
  `)}
@@ -16174,7 +16174,7 @@ else {
16174
16174
  ${Q.trim()}${B}
16175
16175
  </div>
16176
16176
  ${j}
16177
- `})}function pL(X){let $=/@client:only\s*([\s\S]*?)@endclient/gi;return X.replace($,(Z,Y)=>{let J=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
16177
+ `})}function nO(X){let $=/@client:only\s*([\s\S]*?)@endclient/gi;return X.replace($,(Z,Y)=>{let J=`island-only-${Math.random().toString(36).substring(2,9)}`;return`
16178
16178
  <div data-island="${J}"
16179
16179
  data-strategy="only"
16180
16180
  class="stx-island stx-client-only">
@@ -16193,7 +16193,7 @@ else {
16193
16193
  }
16194
16194
  })();
16195
16195
  </script>
16196
- `})}function WK(){return`
16196
+ `})}function UW(){return`
16197
16197
  /* Island base styles */
16198
16198
  .stx-island {
16199
16199
  display: contents;
@@ -16234,11 +16234,11 @@ else {
16234
16234
  .stx-island.hydrated {
16235
16235
  opacity: 1;
16236
16236
  }
16237
- `}function zK(X){if(typeof window>"u")return;let $=document.querySelector(`[data-island="${X}"]`);if(!$||$.classList.contains("hydrated"))return;$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function wK(X){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${X}"]:not(.hydrated)`).forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function jK(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach(($)=>{$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function BK(X){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${X}"]`)?.classList.contains("hydrated")??!1}function _K(X){return new Promise(($)=>{if(typeof window>"u"){$();return}let Z=document.querySelector(`[data-island="${X}"]`);if(!Z){$();return}if(Z.classList.contains("hydrated")){$();return}Z.addEventListener("stx:hydrated",()=>$(),{once:!0})})}function HK(X){return X.replace(/@static\s*([\s\S]*?)@endstatic/gi,($,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function OK(X){let $=X.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
16237
+ `}function zW(X){if(typeof window>"u")return;let $=document.querySelector(`[data-island="${X}"]`);if(!$||$.classList.contains("hydrated"))return;$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))}function wW(X){if(typeof window>"u")return;document.querySelectorAll(`[data-strategy="${X}"]:not(.hydrated)`).forEach((Z)=>{Z.classList.add("hydrated"),Z.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function jW(){if(typeof window>"u")return;document.querySelectorAll(".stx-island:not(.hydrated)").forEach(($)=>{$.classList.add("hydrated"),$.dispatchEvent(new CustomEvent("stx:hydrated",{bubbles:!0}))})}function BW(X){if(typeof window>"u")return!1;return document.querySelector(`[data-island="${X}"]`)?.classList.contains("hydrated")??!1}function _W(X){return new Promise(($)=>{if(typeof window>"u"){$();return}let Z=document.querySelector(`[data-island="${X}"]`);if(!Z){$();return}if(Z.classList.contains("hydrated")){$();return}Z.addEventListener("stx:hydrated",()=>$(),{once:!0})})}function HW(X){return X.replace(/@static\s*([\s\S]*?)@endstatic/gi,($,Z)=>{return`<div class="stx-static">${Z.trim()}</div>`})}function LW(X){let $=X.map((Z)=>({id:Z.id,component:Z.component,strategy:Z.options.strategy,props:Z.props}));return`
16238
16238
  <script type="application/json" id="stx-island-manifest">
16239
16239
  ${JSON.stringify($)}
16240
16240
  </script>
16241
- `}var iL;var FK=E(()=>{iL={processPartialHydrationDirectives:UK,processStaticDirectives:HK,generatePartialHydrationCSS:WK,generateIslandManifest:OK,createIslandRegistry:KK,hydrateIsland:zK,hydrateByStrategy:wK,hydrateAll:jK,isHydrated:BK,onHydrated:_K}});var yK={};n(yK,{watchMultiple:()=>TK,watchEffect:()=>MK,watch:()=>NK,unref:()=>VK,toRefs:()=>AK,throttledComputed:()=>DK,stxWatchMultiple:()=>TK,stxWatchEffect:()=>MK,stxWatch:()=>NK,stxUnref:()=>VK,stxToRefs:()=>AK,stxThrottledComputed:()=>DK,stxShallowRef:()=>RK,stxRef:()=>e5,stxIsRef:()=>u1,stxDebouncedComputed:()=>EK,stxComputed:()=>$X,shallowRef:()=>RK,ref:()=>e5,processWatchDirectives:()=>IK,processComputedDirectives:()=>kK,isRef:()=>u1,default:()=>nL,debouncedComputed:()=>EK,computed:()=>$X});function e5(X){let $=X,Z=new Set,Y={get value(){if(U1){let J=XX.get(Y);if(!J)J=new Set,XX.set(Y,J);J.add(U1)}return $},set value(J){if(!Object.is($,J)){$=J,Z.forEach((Q)=>Q(J));let G=XX.get(Y);if(G)G.forEach((Q)=>Q())}},subscribe(J){return Z.add(J),()=>Z.delete(J)},peek(){return $}};return Y}function u1(X){return X!==null&&typeof X==="object"&&"value"in X&&"subscribe"in X&&"peek"in X}function VK(X){return u1(X)?X.value:X}function AK(X){let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=e5(X[Z]);return $}function RK(X){return e5(X)}function $X(X){let $=typeof X==="function",Z=$?X:X.get,Y=$?void 0:X.set,J=$?Object.is:X.equals||Object.is,G,Q=!0,q=new Set,K=new Set,U=()=>{if(Q=!0,K.size>0){let w=z.value;K.forEach((B)=>B(w))}};function W(){q.clear();let w=U1;U1=U,H$.push(U);try{return Z()}finally{H$.pop(),U1=w}}let z={get value(){if(U1){let w=XX.get(z);if(!w)w=new Set,XX.set(z,w);w.add(U1)}if(Q){let w=W();if(!J(G,w))G=w;Q=!1}return G},set value(w){if(Y)Y(w);else console.warn("Computed property is readonly")},subscribe(w){return K.add(w),()=>K.delete(w)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return q}};return z}function NK(X,$,Z={}){let{immediate:Y=!1,deep:J=!1,flush:G="pre",once:Q=!1}=Z,q,K=!0,U=!1,W=()=>{if(u1(X))return J?j5(X.value):X.value;return X()},z=()=>{if(!K||U)return;let j=W();if(q!==void 0&&Object.is(q,j)&&!J)return;let _=()=>{if($(j,q),q=J?j5(j):j,Q)B()};if(G==="sync")_();else if(G==="post")queueMicrotask(_);else Promise.resolve().then(_)},w=null;if(u1(X))w=X.subscribe(()=>z());else w=$X(X).subscribe(()=>z());if(Y)q=void 0,z();else q=W();let B=()=>{if(K=!1,w)w(),w=null};return B.pause=()=>{U=!0},B.resume=()=>{U=!1},B}function TK(X,$,Z={}){let{immediate:Y=!1,once:J=!1}=Z,G=X.map((z)=>u1(z)?z.value:void 0),Q=!0,q=!1,K=()=>{if(!Q||q)return;let z=X.map((w)=>u1(w)?w.value:void 0);if($(z,G),G=[...z],J)W()},U=X.map((z)=>{if(u1(z))return z.subscribe(()=>K());return()=>{}});if(Y)K();let W=()=>{Q=!1,U.forEach((z)=>z())};return W.pause=()=>{q=!0},W.resume=()=>{q=!1},W}function MK(X,$={}){let{flush:Z="pre"}=$,Y,J=!0,G=!1,Q=()=>{if(!J||G)return;if(Y)Y();let K=U1;U1=Q,H$.push(Q);try{Y=X()}finally{H$.pop(),U1=K}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let q=()=>{if(J=!1,Y)Y()};return q.pause=()=>{G=!0},q.resume=()=>{G=!1},q}function kK(X,$={},Z){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return X.replace(Y,(J,G,Q)=>{try{let K=Function(...Object.keys($),`return ${Q}`)(...Object.values($));return $[G]=K,`<!-- computed: ${G} = ${K} -->`}catch(q){return`<!-- computed error: ${G} - ${q} -->`}})}function IK(X,$={},Z){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return X.replace(Y,(J,G,Q)=>{return`
16241
+ `}var rO;var FW=E(()=>{rO={processPartialHydrationDirectives:KW,processStaticDirectives:HW,generatePartialHydrationCSS:UW,generateIslandManifest:LW,createIslandRegistry:WW,hydrateIsland:zW,hydrateByStrategy:wW,hydrateAll:jW,isHydrated:BW,onHydrated:_W}});var yW={};i(yW,{watchMultiple:()=>TW,watchEffect:()=>MW,watch:()=>NW,unref:()=>VW,toRefs:()=>AW,throttledComputed:()=>DW,stxWatchMultiple:()=>TW,stxWatchEffect:()=>MW,stxWatch:()=>NW,stxUnref:()=>VW,stxToRefs:()=>AW,stxThrottledComputed:()=>DW,stxShallowRef:()=>RW,stxRef:()=>e5,stxIsRef:()=>u1,stxDebouncedComputed:()=>EW,stxComputed:()=>$X,shallowRef:()=>RW,ref:()=>e5,processWatchDirectives:()=>IW,processComputedDirectives:()=>kW,isRef:()=>u1,default:()=>oO,debouncedComputed:()=>EW,computed:()=>$X});function e5(X){let $=X,Z=new Set,Y={get value(){if(K1){let J=XX.get(Y);if(!J)J=new Set,XX.set(Y,J);J.add(K1)}return $},set value(J){if(!Object.is($,J)){$=J,Z.forEach((Q)=>Q(J));let G=XX.get(Y);if(G)G.forEach((Q)=>Q())}},subscribe(J){return Z.add(J),()=>Z.delete(J)},peek(){return $}};return Y}function u1(X){return X!==null&&typeof X==="object"&&"value"in X&&"subscribe"in X&&"peek"in X}function VW(X){return u1(X)?X.value:X}function AW(X){let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=e5(X[Z]);return $}function RW(X){return e5(X)}function $X(X){let $=typeof X==="function",Z=$?X:X.get,Y=$?void 0:X.set,J=$?Object.is:X.equals||Object.is,G,Q=!0,q=new Set,W=new Set,K=()=>{if(Q=!0,W.size>0){let w=z.value;W.forEach((B)=>B(w))}};function U(){q.clear();let w=K1;K1=K,H$.push(K);try{return Z()}finally{H$.pop(),K1=w}}let z={get value(){if(K1){let w=XX.get(z);if(!w)w=new Set,XX.set(z,w);w.add(K1)}if(Q){let w=U();if(!J(G,w))G=w;Q=!1}return G},set value(w){if(Y)Y(w);else console.warn("Computed property is readonly")},subscribe(w){return W.add(w),()=>W.delete(w)},peek(){if(Q)G=Z(),Q=!1;return G},invalidate(){Q=!0},get dirty(){return Q},get deps(){return q}};return z}function NW(X,$,Z={}){let{immediate:Y=!1,deep:J=!1,flush:G="pre",once:Q=!1}=Z,q,W=!0,K=!1,U=()=>{if(u1(X))return J?j5(X.value):X.value;return X()},z=()=>{if(!W||K)return;let j=U();if(q!==void 0&&Object.is(q,j)&&!J)return;let _=()=>{if($(j,q),q=J?j5(j):j,Q)B()};if(G==="sync")_();else if(G==="post")queueMicrotask(_);else Promise.resolve().then(_)},w=null;if(u1(X))w=X.subscribe(()=>z());else w=$X(X).subscribe(()=>z());if(Y)q=void 0,z();else q=U();let B=()=>{if(W=!1,w)w(),w=null};return B.pause=()=>{K=!0},B.resume=()=>{K=!1},B}function TW(X,$,Z={}){let{immediate:Y=!1,once:J=!1}=Z,G=X.map((z)=>u1(z)?z.value:void 0),Q=!0,q=!1,W=()=>{if(!Q||q)return;let z=X.map((w)=>u1(w)?w.value:void 0);if($(z,G),G=[...z],J)U()},K=X.map((z)=>{if(u1(z))return z.subscribe(()=>W());return()=>{}});if(Y)W();let U=()=>{Q=!1,K.forEach((z)=>z())};return U.pause=()=>{q=!0},U.resume=()=>{q=!1},U}function MW(X,$={}){let{flush:Z="pre"}=$,Y,J=!0,G=!1,Q=()=>{if(!J||G)return;if(Y)Y();let W=K1;K1=Q,H$.push(Q);try{Y=X()}finally{H$.pop(),K1=W}};if(Z==="sync")Q();else if(Z==="post")queueMicrotask(Q);else Promise.resolve().then(Q);let q=()=>{if(J=!1,Y)Y()};return q.pause=()=>{G=!0},q.resume=()=>{G=!1},q}function kW(X,$={},Z){let Y=/@computed\s*\(\s*(\w+)\s*,\s*(.+?)\s*\)/gi;return X.replace(Y,(J,G,Q)=>{try{let W=Function(...Object.keys($),`return ${Q}`)(...Object.values($));return $[G]=W,`<!-- computed: ${G} = ${W} -->`}catch(q){return`<!-- computed error: ${G} - ${q} -->`}})}function IW(X,$={},Z){let Y=/@watch\s*\(\s*(\w+)\s*\)\s*([\s\S]*?)@endwatch/gi;return X.replace(Y,(J,G,Q)=>{return`
16242
16242
  <script data-watch="${`watch-${Math.random().toString(36).substring(2,9)}`}">
16243
16243
  (function() {
16244
16244
  // Watch implementation for ${G}
@@ -16250,9 +16250,9 @@ else {
16250
16250
  }
16251
16251
  })();
16252
16252
  </script>
16253
- `})}function j5(X){if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Z)=>j5(Z));if(X instanceof Date)return new Date(X.getTime());if(X instanceof Map){let Z=new Map;return X.forEach((Y,J)=>Z.set(j5(J),j5(Y))),Z}if(X instanceof Set){let Z=new Set;return X.forEach((Y)=>Z.add(j5(Y))),Z}let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=j5(X[Z]);return $}function EK(X,$=100){let Z=e5(X()),Y=null,J=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{Z.value=X()},$)};return $X(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function DK(X,$=100){let Z=e5(X()),Y=0,J=()=>{let Q=Date.now();if(Q-Y>=$)Y=Q,Z.value=X()};return $X(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var U1=null,H$,XX,nL;var bK=E(()=>{H$=[],XX=new WeakMap;nL={ref:e5,computed:$X,watch:NK,watchMultiple:TK,watchEffect:MK,isRef:u1,unref:VK,toRefs:AK,shallowRef:RK,debouncedComputed:EK,throttledComputed:DK,processComputedDirectives:kK,processWatchDirectives:IK}});function ZX(X,$){let Z={};for(let Y of X)Z[Y]=C1($(Y));return new Proxy({},{get:(Y,J)=>Z[J]?.(),set:(Y,J,G)=>{if(Z[J])Z[J].set(G);else Z[J]=C1(G);return!0},has:(Y,J)=>(J in Z),deleteProperty:(Y,J)=>{return delete Z[J],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(Y,J)=>(J in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[J]()}:void 0})}function rL(X,$){let Z={};for(let Y of $)Z[Y]=X[Y];return Z}function J6(X,$){let Z=Object.keys(X),Y=ZX(Z,(L)=>$?.[L]??X[L].getDefaultValue()),J=ZX(Z,()=>[]),G=ZX(Z,()=>!1),Q=ZX(Z,()=>!1),q=ZX(Z,()=>!1),K=C1(!1);async function U(L){q[L]=!0;let F=await X[L].validate(Y[L],Y);return J[L]=F,q[L]=!1,F.length===0}async function W(){K.set(!0);let L=await Promise.all(Z.map(U));return K.set(!1),L.every(Boolean)}function z(){for(let L of Z)Y[L]=$?.[L]??X[L].getDefaultValue(),J[L]=[],G[L]=!1,Q[L]=!1}function w(L){for(let F of Z)if(F in L)Y[F]=L[F],Q[F]=!0}function B(L,F){Y[L]=F,Q[L]=!0}function j(L,F=!0){if(G[L]=F,F)U(L)}function _(L){return{value:Y[L],errors:J[L],touched:G[L],dirty:Q[L],valid:J[L].length===0,validating:q[L]}}function H(L){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await W())await L(rL(Y,Z))}}return{values:Y,errors:J,touched:G,dirty:Q,get isValid(){return Z.every((L)=>J[L].length===0)},get isValidating(){return K()||Z.some((L)=>q[L])},get isDirty(){return Z.some((L)=>Q[L])},validate:W,validateField:U,reset:z,setValues:w,setFieldValue:B,setFieldTouched:j,getFieldState:_,handleSubmit:H}}var SK;var CK=E(()=>{rX();SK=J6});var fK={};n(fK,{v:()=>oL,useForm:()=>J6,processHasErrorsDirective:()=>xK,processFormValidationDirectives:()=>sL,processErrorsDirective:()=>vK,processErrorDirective:()=>PK,defineForm:()=>SK,Validator:()=>X7});class X7{rules=[];defaultValue="";addRule(X){let $=new X7;return $.rules=[...this.rules,X],$.defaultValue=this.defaultValue,$}required(X="This field is required"){return this.addRule({name:"required",message:X,validate:($)=>{if($===null||$===void 0)return X;if(typeof $==="string"&&$.trim()==="")return X;if(Array.isArray($)&&$.length===0)return X;return!0}})}email(X="Please enter a valid email"){return this.addRule({name:"email",message:X,validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||X}})}url(X="Please enter a valid URL"){return this.addRule({name:"url",message:X,validate:($)=>{if(!$)return!0;try{return new URL(String($)),!0}catch{return X}}})}min(X,$){let Z=$||`Must be at least ${X} characters`;return this.addRule({name:"min",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=X||Z}})}max(X,$){let Z=$||`Must be no more than ${X} characters`;return this.addRule({name:"max",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=X||Z}})}length(X,$,Z){let Y=Z||`Must be between ${X} and ${$} characters`;return this.addRule({name:"length",message:Y,validate:(J)=>{if(!J)return!0;let G=String(J).length;return G>=X&&G<=$||Y}})}pattern(X,$="Invalid format"){return this.addRule({name:"pattern",message:$,validate:(Z)=>{if(!Z)return!0;return X.test(String(Z))||$}})}hasUppercase(X="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,X)}hasLowercase(X="Must contain a lowercase letter"){return this.pattern(/[a-z]/,X)}hasNumber(X="Must contain a number"){return this.pattern(/\d/,X)}hasSpecial(X="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,X)}alphanumeric(X="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,X)}startsWithLetter(X="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,X)}noSpaces(X="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:X,validate:($)=>{if(!$)return!0;return!String($).includes(" ")||X}})}number(X="Must be a number"){let $=this.addRule({name:"number",message:X,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||X}});return $.defaultValue=0,$}integer(X="Must be a whole number"){return this.addRule({name:"integer",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number.isInteger(Number($))||X}})}positive(X="Must be a positive number"){return this.addRule({name:"positive",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)>0||X}})}negative(X="Must be a negative number"){return this.addRule({name:"negative",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)<0||X}})}minValue(X,$){let Z=$||`Must be at least ${X}`;return this.addRule({name:"minValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=X||Z}})}maxValue(X,$){let Z=$||`Must be no more than ${X}`;return this.addRule({name:"maxValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=X||Z}})}between(X,$,Z){let Y=Z||`Must be between ${X} and ${$}`;return this.addRule({name:"between",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;let G=Number(J);return G>=X&&G<=$||Y}})}matches(X,$){let Z=$||`Must match ${X}`;return this.addRule({name:"matches",message:Z,validate:(Y,J)=>{if(!J)return!0;return Y===J[X]||Z}})}oneOf(X,$){let Z=$||`Must be one of: ${X.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return X.includes(Y)||Z}})}notOneOf(X,$){let Z=$||`Cannot be one of: ${X.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return!X.includes(Y)||Z}})}date(X="Must be a valid date"){return this.addRule({name:"date",message:X,validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||X}})}before(X,$){let Z=new Date(X),Y=$||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Z||Y}})}after(X,$){let Z=new Date(X),Y=$||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Z||Y}})}custom(X,$="Invalid value"){return this.addRule({name:"custom",message:$,validate:X})}async(X,$="Invalid value"){return this.addRule({name:"async",message:$,async:!0,validate:X})}when(X,$){let Z=new X7;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let Y of $.getRules())Z.rules.push({...Y,validate:(J,G)=>{if(!X(J,G||{}))return!0;return Y.validate(J,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(X){let $=new X7;return $.rules=[...this.rules],$.defaultValue=X,$}async validate(X,$){let Z=[];for(let Y of this.rules){let J=await Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}validateSync(X,$){let Z=[];for(let Y of this.rules){if(Y.async)continue;let J=Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}}function PK(X,$,Z){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return X.replace(Y,(J,G,Q)=>{try{let q=G.trim().split("."),K=$;for(let W of q)if(K&&typeof K==="object"&&W in K)K=K[W];else return"";let U=K;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((W)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,W)}).join(`
16254
- `)}catch{return""}})}function vK(X,$,Z){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return X.replace(Y,(J,G,Q)=>{try{let q=G.trim().split("."),K=$;for(let W of q)if(K&&typeof K==="object"&&W in K)K=K[W];else return"";let U=K;if(!U||!Array.isArray(U)||U.length===0)return"";return U.map((W)=>Q.replace(/\{\{\s*message\s*\}\}/g,W)).join(`
16255
- `)}catch{return""}})}function xK(X,$,Z){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return X.replace(Y,(J,G,Q)=>{try{let q=G.trim().split("."),K=$;for(let W of q)if(K&&typeof K==="object"&&W in K)K=K[W];else return"";let U=K;if(!U||!Array.isArray(U)||U.length===0)return"";return Q}catch{return""}})}function sL(X,$,Z){let Y=X;return Y=PK(Y,$,Z),Y=vK(Y,$,Z),Y=xK(Y,$,Z),Y}var oL;var gK=E(()=>{CK();oL=new X7});var dK={};n(dK,{processXElementDirectives:()=>aL,hasXElementDirectives:()=>uK,generateXElementRuntime:()=>hK});function hK(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
16253
+ `})}function j5(X){if(X===null||typeof X!=="object")return X;if(Array.isArray(X))return X.map((Z)=>j5(Z));if(X instanceof Date)return new Date(X.getTime());if(X instanceof Map){let Z=new Map;return X.forEach((Y,J)=>Z.set(j5(J),j5(Y))),Z}if(X instanceof Set){let Z=new Set;return X.forEach((Y)=>Z.add(j5(Y))),Z}let $={};for(let Z in X)if(Object.prototype.hasOwnProperty.call(X,Z))$[Z]=j5(X[Z]);return $}function EW(X,$=100){let Z=e5(X()),Y=null,J=()=>{if(Y)clearTimeout(Y);Y=setTimeout(()=>{Z.value=X()},$)};return $X(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Debounced computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}function DW(X,$=100){let Z=e5(X()),Y=0,J=()=>{let Q=Date.now();if(Q-Y>=$)Y=Q,Z.value=X()};return $X(X).subscribe(()=>J()),{get value(){return Z.value},set value(Q){console.warn("Throttled computed is readonly")},subscribe:Z.subscribe,peek:Z.peek,invalidate(){J()},get dirty(){return!1},get deps(){return new Set}}}var K1=null,H$,XX,oO;var bW=E(()=>{H$=[],XX=new WeakMap;oO={ref:e5,computed:$X,watch:NW,watchMultiple:TW,watchEffect:MW,isRef:u1,unref:VW,toRefs:AW,shallowRef:RW,debouncedComputed:EW,throttledComputed:DW,processComputedDirectives:kW,processWatchDirectives:IW}});function ZX(X,$){let Z={};for(let Y of X)Z[Y]=C1($(Y));return new Proxy({},{get:(Y,J)=>Z[J]?.(),set:(Y,J,G)=>{if(Z[J])Z[J].set(G);else Z[J]=C1(G);return!0},has:(Y,J)=>(J in Z),deleteProperty:(Y,J)=>{return delete Z[J],!0},ownKeys:()=>Reflect.ownKeys(Z),getOwnPropertyDescriptor:(Y,J)=>(J in Z)?{enumerable:!0,configurable:!0,writable:!0,value:Z[J]()}:void 0})}function sO(X,$){let Z={};for(let Y of $)Z[Y]=X[Y];return Z}function J6(X,$){let Z=Object.keys(X),Y=ZX(Z,(O)=>$?.[O]??X[O].getDefaultValue()),J=ZX(Z,()=>[]),G=ZX(Z,()=>!1),Q=ZX(Z,()=>!1),q=ZX(Z,()=>!1),W=C1(!1);async function K(O){q[O]=!0;let F=await X[O].validate(Y[O],Y);return J[O]=F,q[O]=!1,F.length===0}async function U(){W.set(!0);let O=await Promise.all(Z.map(K));return W.set(!1),O.every(Boolean)}function z(){for(let O of Z)Y[O]=$?.[O]??X[O].getDefaultValue(),J[O]=[],G[O]=!1,Q[O]=!1}function w(O){for(let F of Z)if(F in O)Y[F]=O[F],Q[F]=!0}function B(O,F){Y[O]=F,Q[O]=!0}function j(O,F=!0){if(G[O]=F,F)K(O)}function _(O){return{value:Y[O],errors:J[O],touched:G[O],dirty:Q[O],valid:J[O].length===0,validating:q[O]}}function H(O){return async(F)=>{F?.preventDefault?.();for(let A of Z)G[A]=!0;if(await U())await O(sO(Y,Z))}}return{values:Y,errors:J,touched:G,dirty:Q,get isValid(){return Z.every((O)=>J[O].length===0)},get isValidating(){return W()||Z.some((O)=>q[O])},get isDirty(){return Z.some((O)=>Q[O])},validate:U,validateField:K,reset:z,setValues:w,setFieldValue:B,setFieldTouched:j,getFieldState:_,handleSubmit:H}}var SW;var CW=E(()=>{rX();SW=J6});var fW={};i(fW,{v:()=>aO,useForm:()=>J6,processHasErrorsDirective:()=>xW,processFormValidationDirectives:()=>tO,processErrorsDirective:()=>vW,processErrorDirective:()=>PW,defineForm:()=>SW,Validator:()=>X7});class X7{rules=[];defaultValue="";addRule(X){let $=new X7;return $.rules=[...this.rules,X],$.defaultValue=this.defaultValue,$}required(X="This field is required"){return this.addRule({name:"required",message:X,validate:($)=>{if($===null||$===void 0)return X;if(typeof $==="string"&&$.trim()==="")return X;if(Array.isArray($)&&$.length===0)return X;return!0}})}email(X="Please enter a valid email"){return this.addRule({name:"email",message:X,validate:($)=>{if(!$)return!0;return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(String($))||X}})}url(X="Please enter a valid URL"){return this.addRule({name:"url",message:X,validate:($)=>{if(!$)return!0;try{return new URL(String($)),!0}catch{return X}}})}min(X,$){let Z=$||`Must be at least ${X} characters`;return this.addRule({name:"min",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length>=X||Z}})}max(X,$){let Z=$||`Must be no more than ${X} characters`;return this.addRule({name:"max",message:Z,validate:(Y)=>{if(!Y)return!0;return String(Y).length<=X||Z}})}length(X,$,Z){let Y=Z||`Must be between ${X} and ${$} characters`;return this.addRule({name:"length",message:Y,validate:(J)=>{if(!J)return!0;let G=String(J).length;return G>=X&&G<=$||Y}})}pattern(X,$="Invalid format"){return this.addRule({name:"pattern",message:$,validate:(Z)=>{if(!Z)return!0;return X.test(String(Z))||$}})}hasUppercase(X="Must contain an uppercase letter"){return this.pattern(/[A-Z]/,X)}hasLowercase(X="Must contain a lowercase letter"){return this.pattern(/[a-z]/,X)}hasNumber(X="Must contain a number"){return this.pattern(/\d/,X)}hasSpecial(X="Must contain a special character"){return this.pattern(/[!@#$%^&*(),.?":{}|<>]/,X)}alphanumeric(X="Only letters and numbers allowed"){return this.pattern(/^[a-zA-Z0-9]+$/,X)}startsWithLetter(X="Must start with a letter"){return this.pattern(/^[a-zA-Z]/,X)}noSpaces(X="Spaces are not allowed"){return this.addRule({name:"noSpaces",message:X,validate:($)=>{if(!$)return!0;return!String($).includes(" ")||X}})}number(X="Must be a number"){let $=this.addRule({name:"number",message:X,validate:(Z)=>{if(!Z&&Z!==0)return!0;return!Number.isNaN(Number(Z))||X}});return $.defaultValue=0,$}integer(X="Must be a whole number"){return this.addRule({name:"integer",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number.isInteger(Number($))||X}})}positive(X="Must be a positive number"){return this.addRule({name:"positive",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)>0||X}})}negative(X="Must be a negative number"){return this.addRule({name:"negative",message:X,validate:($)=>{if(!$&&$!==0)return!0;return Number($)<0||X}})}minValue(X,$){let Z=$||`Must be at least ${X}`;return this.addRule({name:"minValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)>=X||Z}})}maxValue(X,$){let Z=$||`Must be no more than ${X}`;return this.addRule({name:"maxValue",message:Z,validate:(Y)=>{if(!Y&&Y!==0)return!0;return Number(Y)<=X||Z}})}between(X,$,Z){let Y=Z||`Must be between ${X} and ${$}`;return this.addRule({name:"between",message:Y,validate:(J)=>{if(!J&&J!==0)return!0;let G=Number(J);return G>=X&&G<=$||Y}})}matches(X,$){let Z=$||`Must match ${X}`;return this.addRule({name:"matches",message:Z,validate:(Y,J)=>{if(!J)return!0;return Y===J[X]||Z}})}oneOf(X,$){let Z=$||`Must be one of: ${X.join(", ")}`;return this.addRule({name:"oneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return X.includes(Y)||Z}})}notOneOf(X,$){let Z=$||`Cannot be one of: ${X.join(", ")}`;return this.addRule({name:"notOneOf",message:Z,validate:(Y)=>{if(!Y)return!0;return!X.includes(Y)||Z}})}date(X="Must be a valid date"){return this.addRule({name:"date",message:X,validate:($)=>{if(!$)return!0;let Z=new Date(String($));return!Number.isNaN(Z.getTime())||X}})}before(X,$){let Z=new Date(X),Y=$||`Must be before ${Z.toLocaleDateString()}`;return this.addRule({name:"before",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))<Z||Y}})}after(X,$){let Z=new Date(X),Y=$||`Must be after ${Z.toLocaleDateString()}`;return this.addRule({name:"after",message:Y,validate:(J)=>{if(!J)return!0;return new Date(String(J))>Z||Y}})}custom(X,$="Invalid value"){return this.addRule({name:"custom",message:$,validate:X})}async(X,$="Invalid value"){return this.addRule({name:"async",message:$,async:!0,validate:X})}when(X,$){let Z=new X7;Z.rules=[...this.rules],Z.defaultValue=this.defaultValue;for(let Y of $.getRules())Z.rules.push({...Y,validate:(J,G)=>{if(!X(J,G||{}))return!0;return Y.validate(J,G)}});return Z}getRules(){return this.rules}getDefaultValue(){return this.defaultValue}default(X){let $=new X7;return $.rules=[...this.rules],$.defaultValue=X,$}async validate(X,$){let Z=[];for(let Y of this.rules){let J=await Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}validateSync(X,$){let Z=[];for(let Y of this.rules){if(Y.async)continue;let J=Y.validate(X,$);if(J!==!0)Z.push(J)}return Z}}function PW(X,$,Z){let Y=/@error\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderror/g;return X.replace(Y,(J,G,Q)=>{try{let q=G.trim().split("."),W=$;for(let U of q)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let K=W;if(!K||!Array.isArray(K)||K.length===0)return"";return K.map((U)=>{return Q.replace(/\{\{\s*message\s*\}\}/g,U)}).join(`
16254
+ `)}catch{return""}})}function vW(X,$,Z){let Y=/@errors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@enderrors/g;return X.replace(Y,(J,G,Q)=>{try{let q=G.trim().split("."),W=$;for(let U of q)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let K=W;if(!K||!Array.isArray(K)||K.length===0)return"";return K.map((U)=>Q.replace(/\{\{\s*message\s*\}\}/g,U)).join(`
16255
+ `)}catch{return""}})}function xW(X,$,Z){let Y=/@hasErrors\s*\(\s*([^)]+)\s*\)([\s\S]*?)@endhasErrors/g;return X.replace(Y,(J,G,Q)=>{try{let q=G.trim().split("."),W=$;for(let U of q)if(W&&typeof W==="object"&&U in W)W=W[U];else return"";let K=W;if(!K||!Array.isArray(K)||K.length===0)return"";return Q}catch{return""}})}function tO(X,$,Z){let Y=X;return Y=PW(Y,$,Z),Y=vW(Y,$,Z),Y=xW(Y,$,Z),Y}var aO;var gW=E(()=>{CW();aO=new X7});var dW={};i(dW,{processXElementDirectives:()=>eO,hasXElementDirectives:()=>uW,generateXElementRuntime:()=>hW});function hW(){return`<script data-stx-scoped data-stx-x-element-runtime data-stx-run="always">
16256
16256
  (function() {
16257
16257
  'use strict';
16258
16258
 
@@ -16536,49 +16536,49 @@ else {
16536
16536
  // Expose for manual initialization
16537
16537
  window.XElement = XElement;
16538
16538
  })();
16539
- </script>`}function uK(X){return/\bx-data(?:\s|=)/.test(X)}function aL(X){let $=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=X.match($)||[],Y=Z.length>0?X.replace($,""):X;if(!uK(Y))return Y;let J=Z[0]?.trim()||hK(),G=Y.lastIndexOf("</body>");if(G!==-1)return Y.slice(0,G)+J+`
16539
+ </script>`}function uW(X){return/\bx-data(?:\s|=)/.test(X)}function eO(X){let $=/<script\b(?=[^>]*\bdata-stx-x-element-runtime\b)[^>]*>[\s\S]*?<\/script>\s*/gi,Z=X.match($)||[],Y=Z.length>0?X.replace($,""):X;if(!uW(Y))return Y;let J=Z[0]?.trim()||hW(),G=Y.lastIndexOf("</body>");if(G!==-1)return Y.slice(0,G)+J+`
16540
16540
  `+Y.slice(G);return Y+`
16541
- `+J}var mK={};n(mK,{rewriteImagesWithSiblings:()=>XF});import V1 from"path";async function XF(X,$){let Z=$.formats??eL;if(!$.publicDir)return X;let Y=YF(X),J=[],G=/<img\b[^>]*?>/gi,Q=[],q;while((q=G.exec(X))!==null){let z=q[0],w=z.match(/\bsrc=["']([^"']+)["']/i);if(!w)continue;if(JF(q.index,Y))continue;Q.push({idx:q.index,length:z.length,src:w[1],raw:z})}if(Q.length===0)return X;let K=await Promise.all(Q.map(async(z)=>{let w=await $F(z.src,$.publicDir,Z);return{match:z,sources:w}}));for(let{match:z,sources:w}of K){if(w.length===0)continue;let j=`<picture>${w.map((_)=>`<source type="${_.mime}" srcset="${GF(_.url)}">`).join("")}${z.raw}</picture>`;J.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(J.length===0)return X;let U="",W=0;for(let z of J)U+=X.slice(W,z.start),U+=z.replacement,W=z.end;return U+=X.slice(W),U}async function $F(X,$,Z){if(!ZF(X))return[];let Y=V1.extname(X).toLowerCase();if(!tL.has(Y))return[];if(!X.startsWith("/"))return[];let J=V1.join($,X.slice(1)),G=V1.dirname(J),Q=V1.basename(J,Y),q=V1.resolve(G),K=V1.resolve($);if(!q.startsWith(K))return[];let U=V1.posix.dirname(X),W=Z.map(async(w)=>{let B=V1.join(G,`${Q}${w.ext}`);if(!await Bun.file(B).exists())return null;return{url:V1.posix.join(U,`${Q}${w.ext}`),mime:w.mime}});return(await Promise.all(W)).filter((w)=>w!==null)}function ZF(X){if(!X)return!1;if(X.startsWith("http://")||X.startsWith("https://"))return!1;if(X.startsWith("//"))return!1;if(X.startsWith("data:"))return!1;return!0}function YF(X){let $=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);return $}function JF(X,$){for(let[Z,Y]of $)if(X>=Z&&X<Y)return!0;return!1}function GF(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var tL,eL;var lK=E(()=>{tL=new Set([".jpg",".jpeg",".png",".gif"]),eL=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var nK={};n(nK,{validateClientScript:()=>z$,processOnceDirective:()=>W$,processJsonDirective:()=>U$,processDirectives:()=>I0,injectRouterScript:()=>LY});import QF from"fs";import S0 from"path";function cK(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function qF(X,$){let Z=X.length,Y=$,J=!0,G=[],Q=(q)=>q+9<=Z&&X[q]==="<"&&X[q+1]==="/"&&(X[q+2]==="s"||X[q+2]==="S")&&(X[q+3]==="c"||X[q+3]==="C")&&(X[q+4]==="r"||X[q+4]==="R")&&(X[q+5]==="i"||X[q+5]==="I")&&(X[q+6]==="p"||X[q+6]==="P")&&(X[q+7]==="t"||X[q+7]==="T")&&(X[q+8]===">"||/\s/.test(X[q+8]));while(Y<Z){let q=X[Y];if(Q(Y))return Y;if(q==="/"&&X[Y+1]==="/"){if(Y=X.indexOf(`
16542
- `,Y+2),Y===-1)return-1;Y+=1,J=!0;continue}if(q==="/"&&X[Y+1]==="*"){let K=X.indexOf("*/",Y+2);if(K===-1)return-1;Y=K+2,J=!0;continue}if(q==="/"&&J){let K=Y+1,U=!1;while(K<Z){let W=X[K];if(W==="\\"){K+=2;continue}if(W==="[")U=!0;else if(W==="]")U=!1;else if(W==="/"&&!U){K++;break}else if(W===`
16543
- `){K=-1;break}K++}if(K===-1){Y++,J=!1;continue}while(K<Z&&/[a-z]/.test(X[K]))K++;Y=K,J=!1;continue}if(q==="'"||q==='"'){let K=q;Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===K){Y++;break}if(X[Y]===`
16544
- `)break;Y++}J=!1;continue}if(q==="`"){Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}if(G.length===0)J=!1;continue}if(q==="}"&&G.length>0){G.pop(),Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++,J=!1;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}continue}if(/\s/.test(q));else if(/[)\].\w$]/.test(q))J=!1;else J=!0;Y++}return-1}function $7(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec(X);if(!Y)return null;let J=Y.index+Y[0].length,G=X.indexOf("</script>",J);if(G===-1)return null;let Q=X.indexOf(">",G);if(Q===-1)return null;return{start:Y.index,end:Q+1}}function pK(X){let $=0;while($<X.length){let Z=X.indexOf("<",$);if(Z===-1)return-1;if(X.startsWith("<!--",Z)){let G=X.indexOf("-->",Z+4);$=G===-1?X.length:G+3;continue}let Y=X.slice(Z),J=/^<style\b[^>]*>/i.exec(Y);if(J){let G=X.toLowerCase().indexOf("</style>",Z+J[0].length);$=G===-1?X.length:G+8;continue}if(/^<script\b[^>]*>/i.test(Y))return Z;$=Z+1}return-1}function KF(X){let $=$7(X,"data-stx-runtime");if(!$)return X;let Z=pK(X);if(Z===-1||Z===$.start)return X;let Y=X.slice($.start,$.end),J=X.slice(0,$.start)+X.slice($.end),G=pK(J);if(G===-1)return Y+`
16541
+ `+J}var mW={};i(mW,{rewriteImagesWithSiblings:()=>ZF});import V1 from"path";async function ZF(X,$){let Z=$.formats??$F;if(!$.publicDir)return X;let Y=GF(X),J=[],G=/<img\b[^>]*?>/gi,Q=[],q;while((q=G.exec(X))!==null){let z=q[0],w=z.match(/\bsrc=["']([^"']+)["']/i);if(!w)continue;if(QF(q.index,Y))continue;Q.push({idx:q.index,length:z.length,src:w[1],raw:z})}if(Q.length===0)return X;let W=await Promise.all(Q.map(async(z)=>{let w=await YF(z.src,$.publicDir,Z);return{match:z,sources:w}}));for(let{match:z,sources:w}of W){if(w.length===0)continue;let j=`<picture>${w.map((_)=>`<source type="${_.mime}" srcset="${qF(_.url)}">`).join("")}${z.raw}</picture>`;J.push({start:z.idx,end:z.idx+z.length,replacement:j})}if(J.length===0)return X;let K="",U=0;for(let z of J)K+=X.slice(U,z.start),K+=z.replacement,U=z.end;return K+=X.slice(U),K}async function YF(X,$,Z){if(!JF(X))return[];let Y=V1.extname(X).toLowerCase();if(!XF.has(Y))return[];if(!X.startsWith("/"))return[];let J=V1.join($,X.slice(1)),G=V1.dirname(J),Q=V1.basename(J,Y),q=V1.resolve(G),W=V1.resolve($);if(!q.startsWith(W))return[];let K=V1.posix.dirname(X),U=Z.map(async(w)=>{let B=V1.join(G,`${Q}${w.ext}`);if(!await Bun.file(B).exists())return null;return{url:V1.posix.join(K,`${Q}${w.ext}`),mime:w.mime}});return(await Promise.all(U)).filter((w)=>w!==null)}function JF(X){if(!X)return!1;if(X.startsWith("http://")||X.startsWith("https://"))return!1;if(X.startsWith("//"))return!1;if(X.startsWith("data:"))return!1;return!0}function GF(X){let $=[],Z=/<picture\b[^>]*>[\s\S]*?<\/picture>/gi,Y;while((Y=Z.exec(X))!==null)$.push([Y.index,Y.index+Y[0].length]);return $}function QF(X,$){for(let[Z,Y]of $)if(X>=Z&&X<Y)return!0;return!1}function qF(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;")}var XF,$F;var lW=E(()=>{XF=new Set([".jpg",".jpeg",".png",".gif"]),$F=[{ext:".avif",mime:"image/avif"},{ext:".webp",mime:"image/webp"}]});var nW={};i(nW,{validateClientScript:()=>z$,processOnceDirective:()=>U$,processJsonDirective:()=>K$,processDirectives:()=>I0,injectRouterScript:()=>OY});import WF from"fs";import S0 from"path";function cW(X){return X.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function KF(X,$){let Z=X.length,Y=$,J=!0,G=[],Q=(q)=>q+9<=Z&&X[q]==="<"&&X[q+1]==="/"&&(X[q+2]==="s"||X[q+2]==="S")&&(X[q+3]==="c"||X[q+3]==="C")&&(X[q+4]==="r"||X[q+4]==="R")&&(X[q+5]==="i"||X[q+5]==="I")&&(X[q+6]==="p"||X[q+6]==="P")&&(X[q+7]==="t"||X[q+7]==="T")&&(X[q+8]===">"||/\s/.test(X[q+8]));while(Y<Z){let q=X[Y];if(Q(Y))return Y;if(q==="/"&&X[Y+1]==="/"){if(Y=X.indexOf(`
16542
+ `,Y+2),Y===-1)return-1;Y+=1,J=!0;continue}if(q==="/"&&X[Y+1]==="*"){let W=X.indexOf("*/",Y+2);if(W===-1)return-1;Y=W+2,J=!0;continue}if(q==="/"&&J){let W=Y+1,K=!1;while(W<Z){let U=X[W];if(U==="\\"){W+=2;continue}if(U==="[")K=!0;else if(U==="]")K=!1;else if(U==="/"&&!K){W++;break}else if(U===`
16543
+ `){W=-1;break}W++}if(W===-1){Y++,J=!1;continue}while(W<Z&&/[a-z]/.test(X[W]))W++;Y=W,J=!1;continue}if(q==="'"||q==='"'){let W=q;Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]===W){Y++;break}if(X[Y]===`
16544
+ `)break;Y++}J=!1;continue}if(q==="`"){Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}if(G.length===0)J=!1;continue}if(q==="}"&&G.length>0){G.pop(),Y++;while(Y<Z){if(X[Y]==="\\"){Y+=2;continue}if(X[Y]==="`"){Y++,J=!1;break}if(X[Y]==="$"&&X[Y+1]==="{"){G.push(!0),Y+=2,J=!0;break}Y++}continue}if(/\s/.test(q));else if(/[)\].\w$]/.test(q))J=!1;else J=!0;Y++}return-1}function $7(X,$){let Z=$.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),Y=new RegExp(`<script\\b(?=[^>]*\\b${Z}(?:\\s|=|/?>))[^>]*>`,"i").exec(X);if(!Y)return null;let J=Y.index+Y[0].length,G=X.indexOf("</script>",J);if(G===-1)return null;let Q=X.indexOf(">",G);if(Q===-1)return null;return{start:Y.index,end:Q+1}}function pW(X){let $=0;while($<X.length){let Z=X.indexOf("<",$);if(Z===-1)return-1;if(X.startsWith("<!--",Z)){let G=X.indexOf("-->",Z+4);$=G===-1?X.length:G+3;continue}let Y=X.slice(Z),J=/^<style\b[^>]*>/i.exec(Y);if(J){let G=X.toLowerCase().indexOf("</style>",Z+J[0].length);$=G===-1?X.length:G+8;continue}if(/^<script\b[^>]*>/i.test(Y))return Z;$=Z+1}return-1}function UF(X){let $=$7(X,"data-stx-runtime");if(!$)return X;let Z=pW(X);if(Z===-1||Z===$.start)return X;let Y=X.slice($.start,$.end),J=X.slice(0,$.start)+X.slice($.end),G=pW(J);if(G===-1)return Y+`
16545
16545
  `+J;return J.slice(0,G)+Y+`
16546
- `+J.slice(G)}async function I0(X,$,Z,Y,J){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return X;if($.__stx_signals_gate===void 0)$.__stx_signals_gate=B1(X);let G=!$.__stxProcessingDepth;if(G)r2($);if(!$.__stxProcessingDepth)$.__stxProcessingDepth=0;if($.__stxProcessingDepth++,!$.__onceStore)$.__onceStore=new Set;if((Y.debug||!h7()&&!C8())&&Z&&Z.endsWith(".stx"))J3(X,Z);try{return await LZ.timeAsync("template-processing",async()=>{let Q=await UF(X,$,Z,Y,J);if(G)Q=o3(Q);if(G&&Y.autoShell&&Y.buildMode!=="compile"){let q=Y.app?.head||{},U=($.__stx_runtime_head||null)??B9(),W=($.__stx_head_raw||"").trim(),z,w=W.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(w)z=w[1].trim(),W=W.replace(w[0],"").trim();let B=$.__sections?.title,j=U.title||z||B,_=!U.title&&(!!z||!!B),H=U.meta||[],O=new Set(H.map((N)=>r5(N)).filter(Boolean)),L={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((N)=>!O.has(r5(N))),...H],link:[...q.link||[],...U.link||[]],script:[...q.script||[],...U.script||[]],headRaw:[q.headRaw,W].filter(Boolean).join(`
16547
- `),...U.htmlAttrs&&{htmlAttrs:jq(q.htmlAttrs,U.htmlAttrs)},...U.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...U.bodyAttrs}}},F=r3(Q);if(Q=Oq(Q,L,{..._&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),F)Q=Hq(Q,q),Q=Bq(Q,L.htmlAttrs);let V=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(V&&Q.includes("<head")){let N=V[1],T=O7(N);Q=Q.replace(/<head\b[^>]*>/i,(M)=>`${M}
16548
- <meta name="stx-layout" content="${cK(N)}">
16549
- <meta name="stx-layout-group" content="${cK(T)}">`)}let A=Q.match(/function (__stx_setup_\d+_\d+)\(/),R=A?P7(Q):null;if(A&&R&&!/\bdata-stx=/.test(R.tag)){Q=uX(Q,(T,M)=>`<body${M} data-stx="${A[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${A[1]}"`,"i");Q=Q.replace(N,"$1")}}if(G){Q=_q(Q);let q=Y.app?.colorMode;if(q)Q=Kq(Q,q);Q=Wq(Q),Q=KF(Q)}if(G)try{let{getStoreScript:q}=await X0("stx/store-loader",()=>Promise.resolve().then(() => (Iq(),kq))),K=Y.storesDir,U=await q(K);if(U){let W=`<script data-stx-stores>${U}</script>`,z=$7(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
16550
- `+W+Q.slice(z.end)}}catch{}if(G)try{let{getFrameworkComposableScript:q}=await X0("stx/framework-composables",()=>Promise.resolve().then(() => (Sq(),bq))),K=await q(Q);if(K){let U=$7(Q,"data-stx-stores")||$7(Q,"data-stx-runtime");if(U)Q=Q.slice(0,U.end)+`
16551
- `+K+Q.slice(U.end)}}catch{}if(G)try{let{getComposableScript:q}=await X0("stx/composable-loader",()=>Promise.resolve().then(() => (vq(),Pq))),K=Y.composablesDir,U=await q(K);if(U){let W=`<script data-stx-composables>${U}</script>`,z=$7(Q,"data-stx-stores")||$7(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
16552
- `+W+Q.slice(z.end)}}catch{}if(G)Q=Uq(Q);if(G&&$.__stx_inject_css!==!1)Q=await $G(Q,void 0,Y.buildMode==="serve");if(G)Q=NZ(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof f8)throw Q;let q=Q instanceof Error?Q.message:String(Q),K=new Q5(`Template processing failed: ${q}`,Z,void 0,void 0,X.substring(0,200)+(X.length>200?"...":""));if($1.log(K,{filePath:Z,context:$}),P4.logDetailedError(K,{filePath:Z,template:X.substring(0,500)}),Y.debug)throw K;return S4.createFallbackContent("Template Processing",K)}}async function UF(X,$,Z,Y,J){let G=process.cwd(),Q={...Y,partialsDir:Y.partialsDir&&!S0.isAbsolute(Y.partialsDir)?S0.resolve(G,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!S0.isAbsolute(Y.componentsDir)?S0.resolve(G,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!S0.isAbsolute(Y.layoutsDir)?S0.resolve(G,Y.layoutsDir):Y.layoutsDir},q=Q,K=X;await wF(Z,$),zF($,q),K=await x5(()=>cQ(K,$,Z,q),K,(F)=>{$1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),K=K.replace(/\{\{--[\s\S]*?--\}\}/g,"");let U=Y1(K,E7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);K=U.output;let W=U.tokens,z=(F)=>W.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>W[Number(A)]??""),w="\x00STX_ESCAPED_AT\x00";K=K.replace(/@@/g,w),K=K.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),K=$q(K),K=await Aq(K,Z,J);let B={};K=h3(K,B);let j={...$.__sections||{}},_="",H=wG(zG(X)),O=/@nolayout\b/.test(K)||H===!1;if(/@nolayout\b/.test(K))K=K.replace(/@nolayout\b\s*/g,"");let L=K.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(L)_=L[1],K=K.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(_=H,!/@section\s*\(/.test(K))K=`@section('content')
16553
- ${K.trim()}
16554
- @endsection`}if(!_&&!O&&q.defaultLayout){let F=n3(K),V=/@section\s*\(/.test(K);if(!F||V){let A="",R=S0.dirname(Z),N=q.layoutsDir?S0.dirname(q.layoutsDir):process.cwd();for(let T=0;T<20;T++){let M=S0.join(R,"_layout.stx");if(await p(M)){A=M;break}let k=S0.dirname(R);if(k===R||k.length<N.length)break;R=k}if(A)_=A;else if(q.layoutsDir){let T=S0.isAbsolute(q.layoutsDir)?q.layoutsDir:S0.resolve(process.cwd(),q.layoutsDir),M=S0.join(T,`${q.defaultLayout}.stx`);if(await p(M))_=M}if(_&&!V)K=`@section('content')
16555
- ${K.trim()}
16556
- @endsection`}}if(K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return j[V]=A,""}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=J0(A.trim(),$);if(R===void 0)return F;return j[V]=String(R??""),""}catch{return F}}),K=K.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))j[V]=A.replace("@parent",B5);else j[V]=A.trim();return""}),$.__sections=j,K=K.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return j[V]||A||""}),!("slot"in $)||$.slot===void 0)K=K.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(K=u3(K,B),_){let F=[],V=J1(K),A=Y1(V.output,k5,(R,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(K=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,N,T)=>{let M=N==="SCRIPT"?V.scripts[Number(T)]:A.tokens[Number(T)];if(M)F.push(M);return""}),F.length>0){let R=F.join(`
16546
+ `+J.slice(G)}async function I0(X,$,Z,Y,J){if(Y.ssr===!1&&!Y.autoShell&&Y.buildMode==="spa")return X;if($.__stx_signals_gate===void 0)$.__stx_signals_gate=B1(X);let G=!$.__stxProcessingDepth;if(G)r2($);if(!$.__stxProcessingDepth)$.__stxProcessingDepth=0;if($.__stxProcessingDepth++,!$.__onceStore)$.__onceStore=new Set;if((Y.debug||!h7()&&!C8())&&Z&&Z.endsWith(".stx"))J3(X,Z);try{return await OZ.timeAsync("template-processing",async()=>{let Q=await zF(X,$,Z,Y,J);if(G)Q=o3(Q);if(G&&Y.autoShell&&Y.buildMode!=="compile"){let q=Y.app?.head||{},K=($.__stx_runtime_head||null)??B9(),U=($.__stx_head_raw||"").trim(),z,w=U.match(/<title[^>]*>([\s\S]*?)<\/title>/i);if(w)z=w[1].trim(),U=U.replace(w[0],"").trim();let B=$.__sections?.title,j=K.title||z||B,_=!K.title&&(!!z||!!B),H=K.meta||[],L=new Set(H.map((N)=>r5(N)).filter(Boolean)),O={...q,...j&&{title:j},meta:[...(q.meta||[]).filter((N)=>!L.has(r5(N))),...H],link:[...q.link||[],...K.link||[]],script:[...q.script||[],...K.script||[]],headRaw:[q.headRaw,U].filter(Boolean).join(`
16547
+ `),...K.htmlAttrs&&{htmlAttrs:jq(q.htmlAttrs,K.htmlAttrs)},...K.bodyAttrs&&{bodyAttrs:{...q.bodyAttrs||{},...K.bodyAttrs}}},F=r3(Q);if(Q=Lq(Q,O,{..._&&{titleIsHtml:!0},...Y.app?.colorMode&&{colorMode:Y.app.colorMode}}),F)Q=Hq(Q,q),Q=Bq(Q,O.htmlAttrs);let V=Q.match(/<!-- stx-layout: ([^ ]+) -->/);if(V&&Q.includes("<head")){let N=V[1],T=L7(N);Q=Q.replace(/<head\b[^>]*>/i,(M)=>`${M}
16548
+ <meta name="stx-layout" content="${cW(N)}">
16549
+ <meta name="stx-layout-group" content="${cW(T)}">`)}let A=Q.match(/function (__stx_setup_\d+_\d+)\(/),R=A?P7(Q):null;if(A&&R&&!/\bdata-stx=/.test(R.tag)){Q=uX(Q,(T,M)=>`<body${M} data-stx="${A[1]}">`);let N=new RegExp(`(<(?!body)[a-zA-Z][^>]*) data-stx="${A[1]}"`,"i");Q=Q.replace(N,"$1")}}if(G){Q=_q(Q);let q=Y.app?.colorMode;if(q)Q=Wq(Q,q);Q=Uq(Q),Q=UF(Q)}if(G)try{let{getStoreScript:q}=await X0("stx/store-loader",()=>Promise.resolve().then(() => (Iq(),kq))),W=Y.storesDir,K=await q(W);if(K){let U=`<script data-stx-stores>${K}</script>`,z=$7(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
16550
+ `+U+Q.slice(z.end)}}catch{}if(G)try{let{getFrameworkComposableScript:q}=await X0("stx/framework-composables",()=>Promise.resolve().then(() => (Sq(),bq))),W=await q(Q);if(W){let K=$7(Q,"data-stx-stores")||$7(Q,"data-stx-runtime");if(K)Q=Q.slice(0,K.end)+`
16551
+ `+W+Q.slice(K.end)}}catch{}if(G)try{let{getComposableScript:q}=await X0("stx/composable-loader",()=>Promise.resolve().then(() => (vq(),Pq))),W=Y.composablesDir,K=await q(W);if(K){let U=`<script data-stx-composables>${K}</script>`,z=$7(Q,"data-stx-stores")||$7(Q,"data-stx-runtime");if(z)Q=Q.slice(0,z.end)+`
16552
+ `+U+Q.slice(z.end)}}catch{}if(G)Q=Kq(Q);if(G&&$.__stx_inject_css!==!1)Q=await $G(Q,void 0,Y.buildMode==="serve");if(G)Q=NZ(Q);return Q=Q.replace(/\x00STX_ESCAPED_AT\x00/g,"@"),Q})}catch(Q){if(Q instanceof f8)throw Q;let q=Q instanceof Error?Q.message:String(Q),W=new Q5(`Template processing failed: ${q}`,Z,void 0,void 0,X.substring(0,200)+(X.length>200?"...":""));if($1.log(W,{filePath:Z,context:$}),P4.logDetailedError(W,{filePath:Z,template:X.substring(0,500)}),Y.debug)throw W;return S4.createFallbackContent("Template Processing",W)}}async function zF(X,$,Z,Y,J){let G=process.cwd(),Q={...Y,partialsDir:Y.partialsDir&&!S0.isAbsolute(Y.partialsDir)?S0.resolve(G,Y.partialsDir):Y.partialsDir,componentsDir:Y.componentsDir&&!S0.isAbsolute(Y.componentsDir)?S0.resolve(G,Y.componentsDir):Y.componentsDir,layoutsDir:Y.layoutsDir&&!S0.isAbsolute(Y.layoutsDir)?S0.resolve(G,Y.layoutsDir):Y.layoutsDir},q=Q,W=X;await BF(Z,$),jF($,q),W=await x5(()=>cQ(W,$,Z,q),W,(F)=>{$1.log(F,{filePath:Z,phase:"pre-processing-middleware"},"warning"),console.warn(`[stx] pre-processing middleware failed for ${Z}: ${F.message}`)}),W=W.replace(/\{\{--[\s\S]*?--\}\}/g,"");let K=Y1(W,E7,(F,V)=>`\x00STX_HTML_COMMENT_${V}\x00`);W=K.output;let U=K.tokens,z=(F)=>U.length===0?F:F.replace(/\x00STX_HTML_COMMENT_(\d+)\x00/g,(V,A)=>U[Number(A)]??""),w="\x00STX_ESCAPED_AT\x00";W=W.replace(/@@/g,w),W=W.replace(/@\{\{([\s\S]*?)\}\}/g,(F,V)=>{return`{{ ${V} }}`}),W=$q(W),W=await Aq(W,Z,J);let B={};W=h3(W,B);let j={...$.__sections||{}},_="",H=wG(zG(X)),L=/@nolayout\b/.test(W)||H===!1;if(/@nolayout\b/.test(W))W=W.replace(/@nolayout\b\s*/g,"");let O=W.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(O)_=O[1],W=W.replace(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/g,"");else if(typeof H==="string"){if(_=H,!/@section\s*\(/.test(W))W=`@section('content')
16553
+ ${W.trim()}
16554
+ @endsection`}if(!_&&!L&&q.defaultLayout){let F=n3(W),V=/@section\s*\(/.test(W);if(!F||V){let A="",R=S0.dirname(Z),N=q.layoutsDir?S0.dirname(q.layoutsDir):process.cwd();for(let T=0;T<20;T++){let M=S0.join(R,"_layout.stx");if(await t(M)){A=M;break}let k=S0.dirname(R);if(k===R||k.length<N.length)break;R=k}if(A)_=A;else if(q.layoutsDir){let T=S0.isAbsolute(q.layoutsDir)?q.layoutsDir:S0.resolve(process.cwd(),q.layoutsDir),M=S0.join(T,`${q.defaultLayout}.stx`);if(await t(M))_=M}if(_&&!V)W=`@section('content')
16555
+ ${W.trim()}
16556
+ @endsection`}}if(W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*['"]([^'"]+)['"]\s*\)/g,(F,V,A)=>{return j[V]=A,""}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*,\s*([^)]+?)\s*\)/g,(F,V,A)=>{if(/^(['"]).*\1$/.test(A.trim()))return F;try{let R=J0(A.trim(),$);if(R===void 0)return F;return j[V]=String(R??""),""}catch{return F}}),W=W.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@endsection|@show)/g,(F,V,A)=>{if(A.includes("@parent"))j[V]=A.replace("@parent",B5);else j[V]=A.trim();return""}),$.__sections=j,W=W.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"](?:,\s*['"]([^'"]+)['"])?\)/g,(F,V,A)=>{return j[V]||A||""}),!("slot"in $)||$.slot===void 0)W=W.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""});if(W=u3(W,B),_){let F=[],V=J1(W),A=Y1(V.output,k5,(R,N)=>`\x00STX_ORPHAN_STYLE_${N}\x00`);if(W=A.output.replace(/\x00STX_(SCRIPT|ORPHAN_STYLE)_(\d+)\x00/g,(R,N,T)=>{let M=N==="SCRIPT"?V.scripts[Number(T)]:A.tokens[Number(T)];if(M)F.push(M);return""}),F.length>0){let R=F.join(`
16557
16557
  `);j.content=j.content?`${j.content}
16558
- ${R}`:R,$.__sections=j}}if(_)try{let F;if(S0.isAbsolute(_))F=_,J.add(_);else F=await x5(()=>o9(_,Z,Q,J),null,()=>{throw new Q5(`Failed to resolve layout path: ${_}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let M=[];try{let D=Q.layoutsDir;if(D){let I=S0.isAbsolute(D)?D:S0.resolve(process.cwd(),D);M=QF.readdirSync(I).filter((S)=>S.endsWith(".stx")).map((S)=>S.replace(/\.stx$/,"")).sort()}}catch{}let k=`Layout not found: ${_} (referenced from ${Z})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if($1.log(Error(k),{layoutPath:_,filePath:Z,available:M},"error"),console.error(`[stx] ${k}`),Q.debug)throw new Q5(k,Z);return K}let V=await x5(()=>Bun.file(F).text(),"",()=>{throw new Q5(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let M={},k=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(S,b,y)=>{return M[b]=y.trim(),""});for(let[S,b]of Object.entries(M))if(j[S]&&j[S].includes(B5)){let y=j[S].indexOf(B5);j[S]=j[S].slice(0,y)+b+j[S].slice(y+B5.length)}else if(!j[S])j[S]=b;let D={...$,__sections:j},I=`@layout('${A[1]}')${k}`;return await I0(I,D,F,Q,J)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=h3(R,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(M,k,D)=>{return T[k]=D.trim(),`@slot('${k}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(M,k,D)=>{if(j[k]){let I=j[k];if(I.includes(B5)){let S=T[k]||"",b=I.indexOf(B5);I=I.slice(0,b)+S+I.slice(b+B5.length)}return I}return D||""}),N=WF(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=u3(N,B),$.__originalFilePath=Z,K=await iK(N,$,F,Q,J),K=`<!-- stx-layout: ${_} -->
16559
- ${K}`,z(K)}catch(F){return $1.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await iK(K,$,Z,Q,J))}function WF(X,$){return X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,Y,J)=>{let G=$[Y];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return J||""})}function zF(X,$){if(X.__stx_sfc_mode=!0,X.__stx_options=$,$.buildMode)X.__stx_buildMode=$.buildMode;let Z=$.envPrefix||"STX_PUBLIC_",Y={};for(let[J,G]of Object.entries(process.env))if(J.startsWith(Z)&&G!==void 0)Y[J]=G;X.$env=Y}async function wF(X,$){await x5(()=>oQ(X,$),void 0,(Z)=>{$1.log(Z,{filePath:X,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${X}: ${Z.message}`)})}async function jF(X,$,Z){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:K}=await X0("stx/variable-extractor",()=>Promise.resolve().then(() => (S7(),fX)));await K(Q,$,Z,{preserveExisting:!0})}catch(K){let U=K instanceof Error?K:Error(String(K));$1.log(U,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${U.message}`)}}}async function BF(X,$,Z){try{let{interpolateScriptsInTemplate:Y}=await X0("stx/expressions",()=>Promise.resolve().then(() => (Q1(),_Z)));return Y(X,$,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return $1.log(J,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${J.message}`),X}}async function iK(X,$,Z,Y,J){let G=X,Q=Y;if(await jF(G,$,Z),G=await BF(G,$,Z),G=await gQ(G,$,Z),G=await hQ(G,$,Z),G=await bG(G,$,Z,Q),B1(G))G=l9(G,$),G=p9(G,$);G=c9(G);let{processStreamDirectives:q}=await X0("stx/streaming",()=>Promise.resolve().then(() => (Y3(),Z3)));G=q(G,$),G=v3(G,$,Z,Q),G=await Qq(G,$,Z,Q,J),G=await Z$(G,$,Z,Q,J),G=c6(G,$,Z,Q);let{processDeferDirectives:K}=await X0("stx/defer",()=>Promise.resolve().then(() => fq));G=K(G,$,Z);let{processTeleportDirectives:U}=await X0("stx/teleport",()=>Promise.resolve().then(() => hq));G=U(G,$,Z);let{processTransitionDirectives:W,processTransitionAttributes:z}=await X0("stx/transitions",()=>Promise.resolve().then(() => lq));G=W(G,$,Z),G=z(G);let{processErrorBoundaryDirectives:w}=await X0("stx/error-boundaries",()=>Promise.resolve().then(() => pq));G=w(G,$,Z);let{processSuspenseDirectives:B}=await X0("stx/suspense",()=>Promise.resolve().then(() => iq));G=B(G,$,Z);let{processAsyncDirectives:j}=await X0("stx/async-components",()=>Promise.resolve().then(() => sq));G=j(G,$,Z);let{processKeepAliveDirectives:_}=await X0("stx/keep-alive",()=>Promise.resolve().then(() => tq));G=_(G,$,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:O,processInfiniteListDirectives:L}=await X0("stx/virtual-scrolling",()=>Promise.resolve().then(() => (JK(),YK)));G=H(G,$,Z),G=O(G,$,Z),G=L(G,$,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await X0("stx/partial-hydration",()=>Promise.resolve().then(() => (FK(),LK)));G=F(G,$,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await X0("stx/computed",()=>Promise.resolve().then(() => (bK(),yK)));G=A(G,$,Z),G=R(G,$,Z);let{processFormValidationDirectives:N}=await X0("stx/forms-validation",()=>Promise.resolve().then(() => (gK(),fK)));G=N(G,$,Z);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:k,resetHead:D}=await X0("stx/head",()=>Promise.resolve().then(() => (b5(),H9)));if(!$.__stx_head_preset&&!$.__stx_runtime_head)D();let I=T(G);if(G=I.content,I.headContent)$.__stx_head_raw=`${$.__stx_head_raw||""}${I.headContent}
16560
- `;if(G=M(G,$),G=k(G,$),G=nQ(G),G=m4(G,$),G=DG(G),G=mQ(G),G=await g3(G,$,Z,Q,J),G=await Z$(G,$,Z,Q,J),$.__stxProcessingDepth===1)G=s2(G,$);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=o3(G),G=L1(G,$,Z),G=l4(G,$),G=c4(G,$),G=n8(G,$),G=uG(G,$),G=dG(G,$),G=await OG(G,$,Z,Q),G=await bY(G,$,Z),G=await iG(G,$,Z,Q),G=f6(G,$,Z,Q),G=gJ(G,$,Z,Q),G=hJ(G,$,Z),G=uJ(G,$,Z,Q),G=kG(G,$,Z,Q),G=U$(G,$),G=W$(G),G=Nq(G),!Q.skipEventDirectives)G=b2(G,$,Z);if(G=_G(G,$,Z),Q.debug){let o=/\bx-data\s*=/.test(G),e=Z8(X);if(o&&e)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
16558
+ ${R}`:R,$.__sections=j}}if(_)try{let F;if(S0.isAbsolute(_))F=_,J.add(_);else F=await x5(()=>o9(_,Z,Q,J),null,()=>{throw new Q5(`Failed to resolve layout path: ${_}`,Z,void 0,void 0,`Layout referenced from ${Z}`)});if(!F){let M=[];try{let D=Q.layoutsDir;if(D){let I=S0.isAbsolute(D)?D:S0.resolve(process.cwd(),D);M=WF.readdirSync(I).filter((S)=>S.endsWith(".stx")).map((S)=>S.replace(/\.stx$/,"")).sort()}}catch{}let k=`Layout not found: ${_} (referenced from ${Z})`+(M.length>0?`. Available layouts: ${M.join(", ")}`:Q.layoutsDir?`. No .stx layouts found in ${Q.layoutsDir}`:"");if($1.log(Error(k),{layoutPath:_,filePath:Z,available:M},"error"),console.error(`[stx] ${k}`),Q.debug)throw new Q5(k,Z);return W}let V=await x5(()=>Bun.file(F).text(),"",()=>{throw new Q5(`Failed to read layout file: ${F}`,Z,void 0,void 0,"Layout content could not be loaded")}),A=V.match(/@(?:layout|extends)\(\s*['"]([^'"]+)['"]\s*\)/);if(A){if(Q.debug)console.log(`Found nested layout: ${A[1]} in ${F}`);let M={},k=V.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(S,b,y)=>{return M[b]=y.trim(),""});for(let[S,b]of Object.entries(M))if(j[S]&&j[S].includes(B5)){let y=j[S].indexOf(B5);j[S]=j[S].slice(0,y)+b+j[S].slice(y+B5.length)}else if(!j[S])j[S]=b;let D={...$,__sections:j},I=`@layout('${A[1]}')${k}`;return await I0(I,D,F,Q,J)}let R=V.replace(/\{\{--[\s\S]*?--\}\}/g,""),N=h3(R,B),T={};return N=N.replace(/@section\(\s*['"]([^'"]+)['"]\s*\)([\s\S]*?)(?:@show|@endsection)/g,(M,k,D)=>{return T[k]=D.trim(),`@slot('${k}')`}),N=N.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(M,k,D)=>{if(j[k]){let I=j[k];if(I.includes(B5)){let S=T[k]||"",b=I.indexOf(B5);I=I.slice(0,b)+S+I.slice(b+B5.length)}return I}return D||""}),N=wF(N,j),N=N.replace(/\{\{\s*slot\s*\}\}/g,()=>{return j.content||""}),N=u3(N,B),$.__originalFilePath=Z,W=await iW(N,$,F,Q,J),W=`<!-- stx-layout: ${_} -->
16559
+ ${W}`,z(W)}catch(F){return $1.log(F instanceof Error?F:Error(String(F)),{layoutPath:_,filePath:Z},"error"),`[Error processing layout: ${F instanceof Error?F.message:String(F)}]`}return z(await iW(W,$,Z,Q,J))}function wF(X,$){return X.replace(/@(?:yield|slot)\(\s*['"]([^'"]+)['"]\s*(?:,\s*['"]([^'"]+)['"]\s*)?\)/g,(Z,Y,J)=>{let G=$[Y];if(G!==void 0){if(!new RegExp(`@(?:yield|slot)\\(\\s*['"]${Y.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}['"]`).test(G))return G}return J||""})}function jF(X,$){if(X.__stx_sfc_mode=!0,X.__stx_options=$,$.buildMode)X.__stx_buildMode=$.buildMode;let Z=$.envPrefix||"STX_PUBLIC_",Y={};for(let[J,G]of Object.entries(process.env))if(J.startsWith(Z)&&G!==void 0)Y[J]=G;X.$env=Y}async function BF(X,$){await x5(()=>oQ(X,$),void 0,(Z)=>{$1.log(Z,{filePath:X,phase:"view-composer"},"warning"),console.warn(`[stx] view composer failed for ${X}: ${Z.message}`)})}async function _F(X,$,Z){let Y=/<script\b([^>]*)>([\s\S]*?)<\/script>/gi,J;while((J=Y.exec(X))!==null){let G=J[1],Q=J[2];if(!/\bserver\b/.test(G)||!Q.trim())continue;try{let{extractVariables:W}=await X0("stx/variable-extractor",()=>Promise.resolve().then(() => (S7(),fX)));await W(Q,$,Z,{preserveExisting:!0})}catch(W){let K=W instanceof Error?W:Error(String(W));$1.log(K,{filePath:Z,phase:"server-script-extraction"},"warning"),console.warn(`[stx] server <script> extraction failed in ${Z}: ${K.message}`)}}}async function HF(X,$,Z){try{let{interpolateScriptsInTemplate:Y}=await X0("stx/expressions",()=>Promise.resolve().then(() => (Q1(),_Z)));return Y(X,$,{skipServer:!0})}catch(Y){let J=Y instanceof Error?Y:Error(String(Y));return $1.log(J,{filePath:Z,phase:"script-expression-interpolation"},"warning"),console.warn(`[stx] script expression interpolation failed in ${Z}: ${J.message}`),X}}async function iW(X,$,Z,Y,J){let G=X,Q=Y;if(await _F(G,$,Z),G=await HF(G,$,Z),G=await gQ(G,$,Z),G=await hQ(G,$,Z),G=await bG(G,$,Z,Q),B1(G))G=l9(G,$),G=p9(G,$);G=c9(G);let{processStreamDirectives:q}=await X0("stx/streaming",()=>Promise.resolve().then(() => (Y3(),Z3)));G=q(G,$),G=v3(G,$,Z,Q),G=await Qq(G,$,Z,Q,J),G=await Z$(G,$,Z,Q,J),G=c6(G,$,Z,Q);let{processDeferDirectives:W}=await X0("stx/defer",()=>Promise.resolve().then(() => fq));G=W(G,$,Z);let{processTeleportDirectives:K}=await X0("stx/teleport",()=>Promise.resolve().then(() => hq));G=K(G,$,Z);let{processTransitionDirectives:U,processTransitionAttributes:z}=await X0("stx/transitions",()=>Promise.resolve().then(() => lq));G=U(G,$,Z),G=z(G);let{processErrorBoundaryDirectives:w}=await X0("stx/error-boundaries",()=>Promise.resolve().then(() => pq));G=w(G,$,Z);let{processSuspenseDirectives:B}=await X0("stx/suspense",()=>Promise.resolve().then(() => iq));G=B(G,$,Z);let{processAsyncDirectives:j}=await X0("stx/async-components",()=>Promise.resolve().then(() => sq));G=j(G,$,Z);let{processKeepAliveDirectives:_}=await X0("stx/keep-alive",()=>Promise.resolve().then(() => tq));G=_(G,$,Z);let{processVirtualListDirectives:H,processVirtualGridDirectives:L,processInfiniteListDirectives:O}=await X0("stx/virtual-scrolling",()=>Promise.resolve().then(() => (JW(),YW)));G=H(G,$,Z),G=L(G,$,Z),G=O(G,$,Z);let{processPartialHydrationDirectives:F,processStaticDirectives:V}=await X0("stx/partial-hydration",()=>Promise.resolve().then(() => (FW(),OW)));G=F(G,$,Z),G=V(G);let{processComputedDirectives:A,processWatchDirectives:R}=await X0("stx/computed",()=>Promise.resolve().then(() => (bW(),yW)));G=A(G,$,Z),G=R(G,$,Z);let{processFormValidationDirectives:N}=await X0("stx/forms-validation",()=>Promise.resolve().then(() => (gW(),fW)));G=N(G,$,Z);let{processHeadDirective:T,processTitleDirective:M,processMetaDirective:k,resetHead:D}=await X0("stx/head",()=>Promise.resolve().then(() => (b5(),H9)));if(!$.__stx_head_preset&&!$.__stx_runtime_head)D();let I=T(G);if(G=I.content,I.headContent)$.__stx_head_raw=`${$.__stx_head_raw||""}${I.headContent}
16560
+ `;if(G=M(G,$),G=k(G,$),G=nQ(G),G=m4(G,$),G=DG(G),G=mQ(G),G=await g3(G,$,Z,Q,J),G=await Z$(G,$,Z,Q,J),$.__stxProcessingDepth===1)G=s2(G,$);if(G=G.replace(/@push\s*\(\s*['"][^'"]+['"]\s*\)[\s\S]*?@endpush/g,""),G=o3(G),G=O1(G,$,Z),G=l4(G,$),G=c4(G,$),G=n8(G,$),G=uG(G,$),G=dG(G,$),G=await LG(G,$,Z,Q),G=await bY(G,$,Z),G=await iG(G,$,Z,Q),G=f6(G,$,Z,Q),G=gJ(G,$,Z,Q),G=hJ(G,$,Z),G=uJ(G,$,Z,Q),G=kG(G,$,Z,Q),G=K$(G,$),G=U$(G),G=Nq(G),!Q.skipEventDirectives)G=b2(G,$,Z);if(G=_G(G,$,Z),Q.debug){let r=/\bx-data\s*=/.test(G),e=Z8(X);if(r&&e)console.warn(`[stx] ${Z}: Template mixes Alpine-style (x-data) and signals (state/derived/effect) reactivity.
16561
16561
  Both work on the same page, but they manage separate scopes.
16562
- Prefer signals (state/derived/effect) for new components.`)}G=tQ(G,$),G=await I1(G,$,Z),G=Tq(G),G=Mq(G),G=qG(G);let{processXElementDirectives:S}=await X0("stx/x-element",()=>Promise.resolve().then(() => dK));G=S(G);let b=$.__originalFilePath||Z,y=M7($);if(G=await i9(G,Q,b,y),G=xG(G,$),G=await pQ(G,$,Z,Q),Q.media?.image?.autoSiblings){let o=Q.publicDir||"public",{rewriteImagesWithSiblings:e}=await X0("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (lK(),mK)));G=await e(G,{publicDir:o})}if(Q.seo?.enabled)G=dJ(G,$,Q);let P=(o,e,K0=!0)=>{if(!e)return o;let g0=e.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),M0=o.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(g0&&M0){if(K0)o=o.replace(M0[0],g0[0]);if(e=e.replace(g0[0],"").trim(),!e)return o}if(/<\/head>/i.test(o))return o.replace(/<\/head>/i,`${e}
16563
- </head>`);if(/<head\b[^>]*>/i.test(o))return o.replace(/(<head\b[^>]*>)/i,`$1
16564
- ${e}`);if(/<html\b[^>]*>/i.test(o))return o.replace(/(<html\b[^>]*>)/i,`$1
16562
+ Prefer signals (state/derived/effect) for new components.`)}G=tQ(G,$),G=await I1(G,$,Z),G=Tq(G),G=Mq(G),G=qG(G);let{processXElementDirectives:S}=await X0("stx/x-element",()=>Promise.resolve().then(() => dW));G=S(G);let b=$.__originalFilePath||Z,y=M7($);if(G=await i9(G,Q,b,y),G=xG(G,$),G=await pQ(G,$,Z,Q),Q.media?.image?.autoSiblings){let r=Q.publicDir||"public",{rewriteImagesWithSiblings:e}=await X0("stx/image-optimization/auto-sibling",()=>Promise.resolve().then(() => (lW(),mW)));G=await e(G,{publicDir:r})}if(Q.seo?.enabled)G=dJ(G,$,Q);let P=(r,e,W0=!0)=>{if(!e)return r;let g0=e.match(/<title\b[^>]*>[\s\S]*?<\/title>/i),M0=r.match(/<title\b[^>]*>[\s\S]*?<\/title>/i);if(g0&&M0){if(W0)r=r.replace(M0[0],g0[0]);if(e=e.replace(g0[0],"").trim(),!e)return r}if(/<\/head>/i.test(r))return r.replace(/<\/head>/i,`${e}
16563
+ </head>`);if(/<head\b[^>]*>/i.test(r))return r.replace(/(<head\b[^>]*>)/i,`$1
16564
+ ${e}`);if(/<html\b[^>]*>/i.test(r))return r.replace(/(<html\b[^>]*>)/i,`$1
16565
16565
  <head>
16566
16566
  ${e}
16567
- </head>`);return o},{renderHead:x,getHead:f}=await X0("stx/head",()=>Promise.resolve().then(() => (b5(),H9))),l=$.__stx_runtime_head??f();if(l.title||l.meta?.length||l.link?.length){let o=x(l);if(o)G=P(G,o)}if(I.headContent)G=P(G,I.headContent,!l.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=TG(G,Q.csp,$);if(Q.analytics?.enabled)G=UG(G,Q);if(Q.heatmap?.enabled)G=_2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:o}=await X0("stx/pwa/inject",()=>Promise.resolve().then(() => (zX(),T6)));G=o(G,Q)}let T0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),x0=/\bSTX\.\w+/.test(G),f0=/window\.STX\s*=/.test(G);if(T0&&x0&&!f0){let e=`<script data-stx-scoped data-stx-run="once">
16567
+ </head>`);return r},{renderHead:x,getHead:f}=await X0("stx/head",()=>Promise.resolve().then(() => (b5(),H9))),l=$.__stx_runtime_head??f();if(l.title||l.meta?.length||l.link?.length){let r=x(l);if(r)G=P(G,r)}if(I.headContent)G=P(G,I.headContent,!l.title);if(Q.csp?.enabled&&Q.csp.addMetaTag)G=TG(G,Q.csp,$);if(Q.analytics?.enabled)G=KG(G,Q);if(Q.heatmap?.enabled)G=_2(G,Q);if(Q.pwa?.enabled&&Q.pwa.autoInject!==!1){let{injectPwaTags:r}=await X0("stx/pwa/inject",()=>Promise.resolve().then(() => (zX(),T6)));G=r(G,Q)}let T0=/<script\b(?![^>]*\bserver\b)[^>]*>[\s\S]*?<\/script>/i.test(G),x0=/\bSTX\.\w+/.test(G),f0=/window\.STX\s*=/.test(G);if(T0&&x0&&!f0){let e=`<script data-stx-scoped data-stx-run="once">
16568
16568
  ${YG()}
16569
- </script>`;if(G.includes("</head>")){let K0=G.indexOf("</head>"),M0=G.slice(0,K0).indexOf("<script");if(M0!==-1){let C=G.slice(0,M0),g=G.slice(M0);G=C+e+`
16569
+ </script>`;if(G.includes("</head>")){let W0=G.indexOf("</head>"),M0=G.slice(0,W0).indexOf("<script");if(M0!==-1){let C=G.slice(0,M0),g=G.slice(M0);G=C+e+`
16570
16570
  `+g}else G=G.replace("</head>",`${e}
16571
16571
  </head>`)}else if(G.includes("<body"))G=G.replace(/<body([^>]*)>/,`<body$1>
16572
16572
  ${e}`);else G=e+`
16573
- `+G}{let{scanScriptTags:o}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (x7(),Y8))),e=[];for(let K0 of o(G)){if(!/\bserver\b/i.test(K0.attrs))continue;let g0=K0.start+K0.fullMatch.indexOf(">")+1,M0=qF(G,g0);if(M0===-1)continue;let C=M0+9;while(C<G.length&&/\s/.test(G[C]))C++;e.push({start:K0.start,end:C})}for(let K0=e.length-1;K0>=0;K0--){let{start:g0,end:M0}=e[K0];G=G.substring(0,g0)+G.substring(M0)}}let a0=CX(G,Z);if(a0.hasScoped)G=a0.html;let i=$.__stx_event_bindings||[],E0=!1,z0=[],d1=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:Z7}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (x7(),Y8)));for(let o of Z7(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))z0.push({match:o.fullMatch,attrs:o.attrs,content:o.body});for(let{match:o,attrs:e,content:K0}of z0){E0=!0;let g0=K0;z$(K0,Z,Y.strict,$.__originalFilePath);let M0=await k7(K0,{eventBindings:i,attrs:e,hasColonDirectives:d1,templateContent:X,filePath:Z,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:y});G=G.replace(o,()=>M0)}if(E0)$.__stx_event_bindings=[];if(!E0&&$.__stxProcessingDepth===1){let o=$.__stx_event_bindings||[];if(o.length>0){let e=a$(o);if(e){let K0=G.lastIndexOf("</body>");G=K0===-1?G+e:G.slice(0,K0)+e+`
16574
- `+G.slice(K0)}$.__stx_event_bindings=[]}}if(!_Y(G)&&HY(G))G=await aX(G,Q);if(G=OY(G),Q.csp?.enabled&&Q.csp.useNonce&&typeof $.cspNonce==="string")G=MG(G,$.cspNonce);return G}var B5="<!--PARENT_CONTENT_PLACEHOLDER-->";var K8=E(()=>{ZG();T9();k1();I$();JG();KG();WG();n$();E$();t$();I7();HG();LG();m7();IG();yG();CG();fG();H1();b5();Q1();mG();nG();fQ();dQ();x3();s9();iQ();y5();rQ();v4();H0();sQ();eQ();Zq();qq();w9();p3();Lq();x7();C3();Rq();s3();a3();R0();G3();Q9();V7();tX();tX();s3();a3()});import FF from"fs";import G6 from"path";import YU from"fs";import z1 from"path";var U6=[72,96,128,144,152,192,384,512],W6=[120,152,167,180],z6=[16,32];async function w6(X,$){let Z={success:!0,generatedFiles:[],errors:[],warnings:[]},Y=X.pwa?.icons;if(!Y?.src)return Z.errors.push("No source icon specified in pwa.icons.src"),Z.success=!1,Z;let J=z1.isAbsolute(Y.src)?Y.src:z1.resolve(process.cwd(),Y.src);if(!await Bun.file(J).exists())return Z.errors.push(`Source icon not found: ${J}`),Z.success=!1,Z;let G=z1.resolve($,Y.outputDir||"pwa-icons");try{YU.mkdirSync(G,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${G}`),Z.success=!1,Z}let Q=Y.sizes||U6,q=Y.generateWebP??!0,K=Y.generateAppleIcons??!0;try{let U;try{U=await import("sharp")}catch{return Z.errors.push(`sharp is not installed. Install it with: bun add sharp
16575
- Icon generation requires the sharp package for image processing.`),Z.success=!1,Z}let z=await U.default(J).metadata();if(z.width&&z.width<512)Z.warnings.push(`Source icon is ${z.width}x${z.height}. Recommend using at least 512x512 for best quality.`);for(let H of Q){let O=z1.join(G,`icon-${H}x${H}.png`);if(await U.default(J).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(O),Z.generatedFiles.push(O),q){let L=z1.join(G,`icon-${H}x${H}.webp`);await U.default(J).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(L),Z.generatedFiles.push(L)}}if(K){for(let O of W6){let L=z1.join(G,`apple-touch-icon-${O}x${O}.png`);await U.default(J).resize(O,O,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(L),Z.generatedFiles.push(L)}let H=z1.join(G,"apple-touch-icon.png");await U.default(J).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(H),Z.generatedFiles.push(H)}for(let H of z6){let O=z1.join(G,`favicon-${H}x${H}.png`);await U.default(J).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(O),Z.generatedFiles.push(O)}let w=512,B=z1.join(G,`icon-maskable-${w}x${w}.png`),j=Math.floor(w*0.1),_=w-j*2;await U.default(J).resize(_,_,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:j,bottom:j,left:j,right:j,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(B),Z.generatedFiles.push(B)}catch(U){let W=U instanceof Error?U.message:String(U);Z.errors.push(`Icon generation failed: ${W}`),Z.success=!1}return Z}function NF(X){let $=X.sizes||U6,Z=X.outputDir?`/${X.outputDir}`:"/pwa-icons",Y=X.generateWebP??!0,J=X.generateAppleIcons??!0,G=[];for(let Q of $)if(G.push(`${Z}/icon-${Q}x${Q}.png`),Y)G.push(`${Z}/icon-${Q}x${Q}.webp`);if(J){G.push(`${Z}/apple-touch-icon.png`);for(let Q of W6)G.push(`${Z}/apple-touch-icon-${Q}x${Q}.png`)}for(let Q of z6)G.push(`${Z}/favicon-${Q}x${Q}.png`);return G.push(`${Z}/icon-maskable-512x512.png`),G}async function j6(){try{return await import("sharp"),!0}catch{return!1}}zX();function TU(X,$,Z,Y){let J=[],G=Y.join(" ");for(let Q of X)if(J.push({src:`${$}/icon-${Q}x${Q}.png`,sizes:`${Q}x${Q}`,type:"image/png",purpose:G}),Z)J.push({src:`${$}/icon-${Q}x${Q}.webp`,sizes:`${Q}x${Q}`,type:"image/webp",purpose:G});return J}function MU(X){return X.map(($)=>({name:$.name,short_name:$.shortName,description:$.description,url:$.url,icons:$.icons?.map((Z)=>({src:Z.src,sizes:Z.sizes,type:Z.type}))}))}function kU(X){let $=X.pwa?.shareTarget;if(!$?.enabled)return;let Z={action:$.action||"/share",method:$.method||"POST",enctype:$.enctype||"multipart/form-data",params:{title:$.params?.title||"title",text:$.params?.text||"text",url:$.params?.url||"url"}};if($.acceptFiles&&$.acceptFiles.length>0)Z.params.files=$.acceptFiles.map((Y)=>({name:Y.name,accept:Y.accept}));return Z}function IU(X){let $=X.pwa?.fileHandlers;if(!$?.enabled||!$.accept)return;let Z=[{action:$.action||"/",accept:$.accept,launch_type:$.launchType||"single-client"}];if($.icons)Z[0].icons=$.icons.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}));return Z}function EU(X){let $=X.pwa?.protocolHandlers;if(!$||$.length===0)return;return $.map((Z)=>({protocol:Z.protocol,url:Z.url}))}function DU(X){let $=X.pwa;if(!$?.enabled||!$.manifest)return null;let{manifest:Z,icons:Y}=$,J=Y?.sizes||[72,96,128,144,152,192,384,512],G=Y?.outputDir?`/${Y.outputDir}`:"/pwa-icons",Q=Y?.generateWebP??!0,q=Y?.purpose||["any","maskable"],K={name:Z.name,short_name:Z.shortName||Z.name,description:Z.description,start_url:Z.startUrl||"/",display:Z.display||"standalone",display_override:Z.displayOverride,orientation:Z.orientation,theme_color:Z.themeColor,background_color:Z.backgroundColor,scope:Z.scope||"/",lang:Z.lang,dir:Z.dir,id:Z.id,categories:Z.categories,icons:TU(J,G,Q,q)};if(Z.shortcuts&&Z.shortcuts.length>0)K.shortcuts=MU(Z.shortcuts);if(Z.screenshots&&Z.screenshots.length>0)K.screenshots=Z.screenshots.map((w)=>({src:w.src,sizes:w.sizes,type:w.type,label:w.label,form_factor:w.platform}));let U=kU(X);if(U)K.share_target=U;let W=IU(X);if(W)K.file_handlers=W;let z=EU(X);if(z)K.protocol_handlers=z;if(Z.launchHandler)K.launch_handler={client_mode:Z.launchHandler};if(Z.handleLinks)K.handle_links=Z.handleLinks;if(Z.edgeSidePanel?.enabled)K.edge_side_panel={preferred_width:Z.edgeSidePanel.preferredWidth};return K}function M6(X){let $=DU(X);if(!$)return"";let Z=JSON.parse(JSON.stringify($));return JSON.stringify(Z,null,2)}function CF(X,$){return{...$,...X,shortcuts:X.shortcuts||$.shortcuts,screenshots:X.screenshots||$.screenshots,categories:X.categories||$.categories}}function PF(X){let $=[],Z=X.pwa;if(!Z?.enabled)return $;let Y=Z.manifest;if(!Y)return $.push("PWA manifest configuration is missing"),$;if(!Y.name)$.push("Manifest name is required");let J=["fullscreen","standalone","minimal-ui","browser"];if(Y.display&&!J.includes(Y.display))$.push(`Invalid display mode: ${Y.display}. Must be one of: ${J.join(", ")}`);let G=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(Y.orientation&&!G.includes(Y.orientation))$.push(`Invalid orientation: ${Y.orientation}`);let Q=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(Y.themeColor&&!Q.test(Y.themeColor))$.push(`Invalid theme color: ${Y.themeColor}. Must be a valid hex color.`);if(Y.backgroundColor&&!Q.test(Y.backgroundColor))$.push(`Invalid background color: ${Y.backgroundColor}. Must be a valid hex color.`);if(Z.shareTarget?.enabled){if(!Z.shareTarget.action)$.push("Share target action URL is required")}if(Z.fileHandlers?.enabled){if(!Z.fileHandlers.accept||Object.keys(Z.fileHandlers.accept).length===0)$.push("File handlers must specify accepted MIME types")}if(Z.protocolHandlers)for(let q of Z.protocolHandlers){if(!q.protocol)$.push("Protocol handler missing protocol");if(!q.url||!q.url.includes("%s"))$.push(`Protocol handler URL must contain %s placeholder: ${q.protocol}`)}return $}import rK from"path";async function oK(X){let $=X.pwa?.offline;if(!$?.enabled)return"";if($.page){let Z=rK.isAbsolute($.page)?$.page:rK.resolve(process.cwd(),$.page);if(await Bun.file(Z).exists())try{let{processDirectives:Y}=await Promise.resolve().then(() => (K8(),nK)),J=await Bun.file(Z).text();return await Y(J,{},Z,X,new Set)}catch(Y){console.warn(`[PWA] Failed to process custom offline page: ${Y}`)}else console.warn(`[PWA] Custom offline page not found: ${Z}`)}return _F(X)}function _F(X){let $=X.pwa?.offline,Z=X.pwa?.manifest,Y=$?.fallbackTitle||"You are offline",J=$?.fallbackMessage||"Please check your internet connection and try again.",G=Z?.themeColor||"#4f46e5",Q=Z?.shortName||Z?.name||"App";return`<!DOCTYPE html>
16573
+ `+G}{let{scanScriptTags:r}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (x7(),Y8))),e=[];for(let W0 of r(G)){if(!/\bserver\b/i.test(W0.attrs))continue;let g0=W0.start+W0.fullMatch.indexOf(">")+1,M0=KF(G,g0);if(M0===-1)continue;let C=M0+9;while(C<G.length&&/\s/.test(G[C]))C++;e.push({start:W0.start,end:C})}for(let W0=e.length-1;W0>=0;W0--){let{start:g0,end:M0}=e[W0];G=G.substring(0,g0)+G.substring(M0)}}let a0=CX(G,Z);if(a0.hasScoped)G=a0.html;let p=$.__stx_event_bindings||[],E0=!1,z0=[],d1=/\s:[a-z][\w.-]*\s*=/.test(G),{scanScriptTags:Z7}=await X0("stx/signal-processing",()=>Promise.resolve().then(() => (x7(),Y8)));for(let r of Z7(G,{skipAttrs:/\bserver\b|\bsrc\s*=|\bdata-stx-scoped\b|\bdata-stx-router\b|\btype\s*=\s*["'](?!(?:text\/javascript|application\/javascript|module)["'])[^"']*["']/}))z0.push({match:r.fullMatch,attrs:r.attrs,content:r.body});for(let{match:r,attrs:e,content:W0}of z0){E0=!0;let g0=W0;z$(W0,Z,Y.strict,$.__originalFilePath);let M0=await k7(W0,{eventBindings:p,attrs:e,hasColonDirectives:d1,templateContent:X,filePath:Z,projectRoot:process.cwd(),production:Y.buildMode==="compile",serverData:y});G=G.replace(r,()=>M0)}if(E0)$.__stx_event_bindings=[];if(!E0&&$.__stxProcessingDepth===1){let r=$.__stx_event_bindings||[];if(r.length>0){let e=a$(r);if(e){let W0=G.lastIndexOf("</body>");G=W0===-1?G+e:G.slice(0,W0)+e+`
16574
+ `+G.slice(W0)}$.__stx_event_bindings=[]}}if(!_Y(G)&&HY(G))G=await aX(G,Q);if(G=LY(G),Q.csp?.enabled&&Q.csp.useNonce&&typeof $.cspNonce==="string")G=MG(G,$.cspNonce);return G}var B5="<!--PARENT_CONTENT_PLACEHOLDER-->";var W8=E(()=>{ZG();T9();k1();I$();JG();WG();UG();n$();E$();t$();I7();HG();OG();m7();IG();yG();CG();fG();H1();b5();Q1();mG();nG();fQ();dQ();x3();s9();iQ();y5();rQ();v4();H0();sQ();eQ();Zq();qq();w9();p3();Oq();x7();C3();Rq();s3();a3();R0();G3();Q9();V7();tX();tX();s3();a3()});import AF from"fs";import G6 from"path";import YK from"fs";import z1 from"path";var K6=[72,96,128,144,152,192,384,512],U6=[120,152,167,180],z6=[16,32];async function w6(X,$){let Z={success:!0,generatedFiles:[],errors:[],warnings:[]},Y=X.pwa?.icons;if(!Y?.src)return Z.errors.push("No source icon specified in pwa.icons.src"),Z.success=!1,Z;let J=z1.isAbsolute(Y.src)?Y.src:z1.resolve(process.cwd(),Y.src);if(!await Bun.file(J).exists())return Z.errors.push(`Source icon not found: ${J}`),Z.success=!1,Z;let G=z1.resolve($,Y.outputDir||"pwa-icons");try{YK.mkdirSync(G,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${G}`),Z.success=!1,Z}let Q=Y.sizes||K6,q=Y.generateWebP??!0,W=Y.generateAppleIcons??!0;try{let K;try{K=await import("sharp")}catch{return Z.errors.push(`sharp is not installed. Install it with: bun add sharp
16575
+ Icon generation requires the sharp package for image processing.`),Z.success=!1,Z}let z=await K.default(J).metadata();if(z.width&&z.width<512)Z.warnings.push(`Source icon is ${z.width}x${z.height}. Recommend using at least 512x512 for best quality.`);for(let H of Q){let L=z1.join(G,`icon-${H}x${H}.png`);if(await K.default(J).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(L),Z.generatedFiles.push(L),q){let O=z1.join(G,`icon-${H}x${H}.webp`);await K.default(J).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).webp({quality:90}).toFile(O),Z.generatedFiles.push(O)}}if(W){for(let L of U6){let O=z1.join(G,`apple-touch-icon-${L}x${L}.png`);await K.default(J).resize(L,L,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(O),Z.generatedFiles.push(O)}let H=z1.join(G,"apple-touch-icon.png");await K.default(J).resize(180,180,{fit:"contain",background:{r:255,g:255,b:255,alpha:1}}).png().toFile(H),Z.generatedFiles.push(H)}for(let H of z6){let L=z1.join(G,`favicon-${H}x${H}.png`);await K.default(J).resize(H,H,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).png().toFile(L),Z.generatedFiles.push(L)}let w=512,B=z1.join(G,`icon-maskable-${w}x${w}.png`),j=Math.floor(w*0.1),_=w-j*2;await K.default(J).resize(_,_,{fit:"contain",background:{r:0,g:0,b:0,alpha:0}}).extend({top:j,bottom:j,left:j,right:j,background:{r:255,g:255,b:255,alpha:1}}).png().toFile(B),Z.generatedFiles.push(B)}catch(K){let U=K instanceof Error?K.message:String(K);Z.errors.push(`Icon generation failed: ${U}`),Z.success=!1}return Z}function MF(X){let $=X.sizes||K6,Z=X.outputDir?`/${X.outputDir}`:"/pwa-icons",Y=X.generateWebP??!0,J=X.generateAppleIcons??!0,G=[];for(let Q of $)if(G.push(`${Z}/icon-${Q}x${Q}.png`),Y)G.push(`${Z}/icon-${Q}x${Q}.webp`);if(J){G.push(`${Z}/apple-touch-icon.png`);for(let Q of U6)G.push(`${Z}/apple-touch-icon-${Q}x${Q}.png`)}for(let Q of z6)G.push(`${Z}/favicon-${Q}x${Q}.png`);return G.push(`${Z}/icon-maskable-512x512.png`),G}async function j6(){try{return await import("sharp"),!0}catch{return!1}}zX();function TK(X,$,Z,Y){let J=[],G=Y.join(" ");for(let Q of X)if(J.push({src:`${$}/icon-${Q}x${Q}.png`,sizes:`${Q}x${Q}`,type:"image/png",purpose:G}),Z)J.push({src:`${$}/icon-${Q}x${Q}.webp`,sizes:`${Q}x${Q}`,type:"image/webp",purpose:G});return J}function MK(X){return X.map(($)=>({name:$.name,short_name:$.shortName,description:$.description,url:$.url,icons:$.icons?.map((Z)=>({src:Z.src,sizes:Z.sizes,type:Z.type}))}))}function kK(X){let $=X.pwa?.shareTarget;if(!$?.enabled)return;let Z={action:$.action||"/share",method:$.method||"POST",enctype:$.enctype||"multipart/form-data",params:{title:$.params?.title||"title",text:$.params?.text||"text",url:$.params?.url||"url"}};if($.acceptFiles&&$.acceptFiles.length>0)Z.params.files=$.acceptFiles.map((Y)=>({name:Y.name,accept:Y.accept}));return Z}function IK(X){let $=X.pwa?.fileHandlers;if(!$?.enabled||!$.accept)return;let Z=[{action:$.action||"/",accept:$.accept,launch_type:$.launchType||"single-client"}];if($.icons)Z[0].icons=$.icons.map((Y)=>({src:Y.src,sizes:Y.sizes,type:Y.type}));return Z}function EK(X){let $=X.pwa?.protocolHandlers;if(!$||$.length===0)return;return $.map((Z)=>({protocol:Z.protocol,url:Z.url}))}function DK(X){let $=X.pwa;if(!$?.enabled||!$.manifest)return null;let{manifest:Z,icons:Y}=$,J=Y?.sizes||[72,96,128,144,152,192,384,512],G=Y?.outputDir?`/${Y.outputDir}`:"/pwa-icons",Q=Y?.generateWebP??!0,q=Y?.purpose||["any","maskable"],W={name:Z.name,short_name:Z.shortName||Z.name,description:Z.description,start_url:Z.startUrl||"/",display:Z.display||"standalone",display_override:Z.displayOverride,orientation:Z.orientation,theme_color:Z.themeColor,background_color:Z.backgroundColor,scope:Z.scope||"/",lang:Z.lang,dir:Z.dir,id:Z.id,categories:Z.categories,icons:TK(J,G,Q,q)};if(Z.shortcuts&&Z.shortcuts.length>0)W.shortcuts=MK(Z.shortcuts);if(Z.screenshots&&Z.screenshots.length>0)W.screenshots=Z.screenshots.map((w)=>({src:w.src,sizes:w.sizes,type:w.type,label:w.label,form_factor:w.platform}));let K=kK(X);if(K)W.share_target=K;let U=IK(X);if(U)W.file_handlers=U;let z=EK(X);if(z)W.protocol_handlers=z;if(Z.launchHandler)W.launch_handler={client_mode:Z.launchHandler};if(Z.handleLinks)W.handle_links=Z.handleLinks;if(Z.edgeSidePanel?.enabled)W.edge_side_panel={preferred_width:Z.edgeSidePanel.preferredWidth};return W}function M6(X){let $=DK(X);if(!$)return"";let Z=JSON.parse(JSON.stringify($));return JSON.stringify(Z,null,2)}function vF(X,$){return{...$,...X,shortcuts:X.shortcuts||$.shortcuts,screenshots:X.screenshots||$.screenshots,categories:X.categories||$.categories}}function xF(X){let $=[],Z=X.pwa;if(!Z?.enabled)return $;let Y=Z.manifest;if(!Y)return $.push("PWA manifest configuration is missing"),$;if(!Y.name)$.push("Manifest name is required");let J=["fullscreen","standalone","minimal-ui","browser"];if(Y.display&&!J.includes(Y.display))$.push(`Invalid display mode: ${Y.display}. Must be one of: ${J.join(", ")}`);let G=["any","natural","landscape","landscape-primary","landscape-secondary","portrait","portrait-primary","portrait-secondary"];if(Y.orientation&&!G.includes(Y.orientation))$.push(`Invalid orientation: ${Y.orientation}`);let Q=/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/;if(Y.themeColor&&!Q.test(Y.themeColor))$.push(`Invalid theme color: ${Y.themeColor}. Must be a valid hex color.`);if(Y.backgroundColor&&!Q.test(Y.backgroundColor))$.push(`Invalid background color: ${Y.backgroundColor}. Must be a valid hex color.`);if(Z.shareTarget?.enabled){if(!Z.shareTarget.action)$.push("Share target action URL is required")}if(Z.fileHandlers?.enabled){if(!Z.fileHandlers.accept||Object.keys(Z.fileHandlers.accept).length===0)$.push("File handlers must specify accepted MIME types")}if(Z.protocolHandlers)for(let q of Z.protocolHandlers){if(!q.protocol)$.push("Protocol handler missing protocol");if(!q.url||!q.url.includes("%s"))$.push(`Protocol handler URL must contain %s placeholder: ${q.protocol}`)}return $}import rW from"path";async function oW(X){let $=X.pwa?.offline;if(!$?.enabled)return"";if($.page){let Z=rW.isAbsolute($.page)?$.page:rW.resolve(process.cwd(),$.page);if(await Bun.file(Z).exists())try{let{processDirectives:Y}=await Promise.resolve().then(() => (W8(),nW)),J=await Bun.file(Z).text();return await Y(J,{},Z,X,new Set)}catch(Y){console.warn(`[PWA] Failed to process custom offline page: ${Y}`)}else console.warn(`[PWA] Custom offline page not found: ${Z}`)}return LF(X)}function LF(X){let $=X.pwa?.offline,Z=X.pwa?.manifest,Y=$?.fallbackTitle||"You are offline",J=$?.fallbackMessage||"Please check your internet connection and try again.",G=Z?.themeColor||"#4f46e5",Q=Z?.shortName||Z?.name||"App";return`<!DOCTYPE html>
16576
16576
  <html lang="en">
16577
16577
  <head>
16578
16578
  <meta charset="UTF-8">
16579
16579
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
16580
16580
  <meta name="theme-color" content="${G}">
16581
- <title>${O$(Y)} - ${O$(Q)}</title>
16581
+ <title>${L$(Y)} - ${L$(Q)}</title>
16582
16582
  <style>
16583
16583
  :root {
16584
16584
  --theme-color: ${G};
@@ -16748,8 +16748,8 @@ Icon generation requires the sharp package for image processing.`),Z.success=!1,
16748
16748
  <circle cx="12" cy="20" r="1"/>
16749
16749
  </svg>
16750
16750
 
16751
- <h1>${O$(Y)}</h1>
16752
- <p>${O$(J)}</p>
16751
+ <h1>${L$(Y)}</h1>
16752
+ <p>${L$(J)}</p>
16753
16753
 
16754
16754
  <button class="retry-btn" onclick="window.location.reload()">
16755
16755
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
@@ -16805,9 +16805,9 @@ Icon generation requires the sharp package for image processing.`),Z.success=!1,
16805
16805
  }, 5000);
16806
16806
  </script>
16807
16807
  </body>
16808
- </html>`}function O$(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}Y7();J7();import _5 from"fs";import L$ from"path";function HF(X){let $=[],Z=X.pwa;if($.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Z?.enabled===!0,message:Z?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Z?.enabled)return $;$.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Z.manifest?.name),message:Z.manifest?.name?`App name: "${Z.manifest.name}"`:"Missing required manifest name"}),$.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Z.manifest?.shortName),message:Z.manifest?.shortName?`Short name: "${Z.manifest.shortName}"`:"Short name not set (will use full name)"}),$.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Z.manifest?.description),message:Z.manifest?.description?"Description is set":"App description not provided"}),$.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Z.manifest?.themeColor),message:Z.manifest?.themeColor?`Theme color: ${Z.manifest.themeColor}`:"Theme color not set"}),$.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Z.manifest?.backgroundColor),message:Z.manifest?.backgroundColor?`Background color: ${Z.manifest.backgroundColor}`:"Background color not set"}),$.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Z.manifest?.display||""),message:Z.manifest?.display?`Display mode: ${Z.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),$.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Z.manifest?.startUrl),message:Z.manifest?.startUrl?`Start URL: ${Z.manifest.startUrl}`:"Start URL not set"}),$.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Z.icons?.src),message:Z.icons?.src?`Icon source: ${Z.icons.src}`:"No icon source configured"});let Y=Z.icons?.sizes||[];$.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:Y.includes(192),message:Y.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),$.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:Y.includes(512),message:Y.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),$.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Z.icons?.purpose?.includes("maskable")||!1,message:Z.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),$.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Z.serviceWorker),message:Z.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),$.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Z.serviceWorker?.cacheVersion),message:Z.serviceWorker?.cacheVersion?`Cache version: ${Z.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),$.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Z.offline?.enabled===!0,message:Z.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let J=Z.routes||[];return $.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:J.length>0,message:J.length>0?`${J.length} route caching strategies configured`:"No custom caching strategies defined"}),$.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Z.push?.enabled||Boolean(Z.push?.vapidPublicKey),message:Z.push?.enabled?Z.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),$.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Z.shareTarget?.enabled?`Share target enabled at ${Z.shareTarget.action}`:"Share target not enabled"}),$.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Z.autoInject!==!1,message:Z.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),$}function OF(X){let $=[],Z=L$.join(X,"manifest.json"),Y=_5.existsSync(Z);if($.push({id:"build-manifest",name:"Manifest File",category:"required",passed:Y,message:Y?"manifest.json exists":"manifest.json not found in build output"}),Y)try{let W=JSON.parse(_5.readFileSync(Z,"utf-8"));$.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),$.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(W.icons)&&W.icons.length>0,message:W.icons?.length?`${W.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{$.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let J=L$.join(X,"sw.js"),G=_5.existsSync(J);$.push({id:"build-sw",name:"Service Worker File",category:"required",passed:G,message:G?"Service worker (sw.js) exists":"Service worker not found in build output"});let Q=L$.join(X,"offline.html"),q=_5.existsSync(Q);$.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:q,message:q?"Offline page exists":"No offline.html found"});let K=L$.join(X,"pwa-icons");if(_5.existsSync(K)){let W=_5.readdirSync(K).filter((z)=>z.endsWith(".png")||z.endsWith(".webp"));$.push({id:"build-icons",name:"Generated Icons",category:"required",passed:W.length>0,message:W.length>0?`${W.length} icon files generated`:"No icon files found"})}else $.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return $}function LF(X){let $=X.filter((K)=>K.category==="required"),Z=X.filter((K)=>K.category==="recommended"),Y=$.filter((K)=>K.passed).length,J=Z.filter((K)=>K.passed).length,G=$.length>0?Y/$.length*70:70,Q=Z.length>0?J/Z.length*30:30;return{score:Math.round(G+Q),passed:X.filter((K)=>K.passed).length,failed:X.filter((K)=>!K.passed&&K.category==="required").length,warnings:X.filter((K)=>!K.passed&&K.category!=="required").length,checks:X}}function Qy(X,$){let Z=HF(X),Y=$&&_5.existsSync($)?OF($):[];return LF([...Z,...Y])}function qy(X){let $=[];$.push(`
16808
+ </html>`}function L$(X){return X.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#39;")}Y7();J7();import _5 from"fs";import O$ from"path";function OF(X){let $=[],Z=X.pwa;if($.push({id:"pwa-enabled",name:"PWA Enabled",category:"required",passed:Z?.enabled===!0,message:Z?.enabled?"PWA is enabled":"PWA is not enabled in config"}),!Z?.enabled)return $;$.push({id:"manifest-name",name:"App Name",category:"required",passed:Boolean(Z.manifest?.name),message:Z.manifest?.name?`App name: "${Z.manifest.name}"`:"Missing required manifest name"}),$.push({id:"manifest-short-name",name:"Short Name",category:"recommended",passed:Boolean(Z.manifest?.shortName),message:Z.manifest?.shortName?`Short name: "${Z.manifest.shortName}"`:"Short name not set (will use full name)"}),$.push({id:"manifest-description",name:"App Description",category:"recommended",passed:Boolean(Z.manifest?.description),message:Z.manifest?.description?"Description is set":"App description not provided"}),$.push({id:"manifest-theme-color",name:"Theme Color",category:"required",passed:Boolean(Z.manifest?.themeColor),message:Z.manifest?.themeColor?`Theme color: ${Z.manifest.themeColor}`:"Theme color not set"}),$.push({id:"manifest-background-color",name:"Background Color",category:"required",passed:Boolean(Z.manifest?.backgroundColor),message:Z.manifest?.backgroundColor?`Background color: ${Z.manifest.backgroundColor}`:"Background color not set"}),$.push({id:"manifest-display",name:"Display Mode",category:"required",passed:["standalone","fullscreen","minimal-ui"].includes(Z.manifest?.display||""),message:Z.manifest?.display?`Display mode: ${Z.manifest.display}`:"Display mode should be standalone, fullscreen, or minimal-ui"}),$.push({id:"manifest-start-url",name:"Start URL",category:"required",passed:Boolean(Z.manifest?.startUrl),message:Z.manifest?.startUrl?`Start URL: ${Z.manifest.startUrl}`:"Start URL not set"}),$.push({id:"icons-source",name:"Icon Source",category:"required",passed:Boolean(Z.icons?.src),message:Z.icons?.src?`Icon source: ${Z.icons.src}`:"No icon source configured"});let Y=Z.icons?.sizes||[];$.push({id:"icons-192",name:"192x192 Icon",category:"required",passed:Y.includes(192),message:Y.includes(192)?"192x192 icon will be generated":"Missing 192x192 icon (required for Android)"}),$.push({id:"icons-512",name:"512x512 Icon",category:"required",passed:Y.includes(512),message:Y.includes(512)?"512x512 icon will be generated":"Missing 512x512 icon (required for splash screen)"}),$.push({id:"icons-maskable",name:"Maskable Icon",category:"recommended",passed:Z.icons?.purpose?.includes("maskable")||!1,message:Z.icons?.purpose?.includes("maskable")?"Maskable icon purpose is set":"Consider adding maskable icon purpose for adaptive icons"}),$.push({id:"sw-configured",name:"Service Worker",category:"required",passed:Boolean(Z.serviceWorker),message:Z.serviceWorker?"Service worker is configured":"Service worker configuration missing"}),$.push({id:"sw-cache-version",name:"Cache Version",category:"recommended",passed:Boolean(Z.serviceWorker?.cacheVersion),message:Z.serviceWorker?.cacheVersion?`Cache version: ${Z.serviceWorker.cacheVersion}`:"Set cache version for proper cache busting"}),$.push({id:"offline-enabled",name:"Offline Support",category:"required",passed:Z.offline?.enabled===!0,message:Z.offline?.enabled?"Offline support is enabled":"Offline support is disabled"});let J=Z.routes||[];return $.push({id:"caching-strategies",name:"Caching Strategies",category:"recommended",passed:J.length>0,message:J.length>0?`${J.length} route caching strategies configured`:"No custom caching strategies defined"}),$.push({id:"push-config",name:"Push Notifications",category:"optional",passed:!Z.push?.enabled||Boolean(Z.push?.vapidPublicKey),message:Z.push?.enabled?Z.push?.vapidPublicKey?"Push notifications configured with VAPID key":"Push enabled but missing VAPID key":"Push notifications not enabled"}),$.push({id:"share-target",name:"Share Target",category:"optional",passed:!0,message:Z.shareTarget?.enabled?`Share target enabled at ${Z.shareTarget.action}`:"Share target not enabled"}),$.push({id:"auto-inject",name:"Auto-injection",category:"recommended",passed:Z.autoInject!==!1,message:Z.autoInject!==!1?"PWA tags will be auto-injected":"Auto-injection disabled - manual tag insertion required"}),$}function FF(X){let $=[],Z=O$.join(X,"manifest.json"),Y=_5.existsSync(Z);if($.push({id:"build-manifest",name:"Manifest File",category:"required",passed:Y,message:Y?"manifest.json exists":"manifest.json not found in build output"}),Y)try{let U=JSON.parse(_5.readFileSync(Z,"utf-8"));$.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!0,message:"Manifest is valid JSON"}),$.push({id:"build-manifest-icons",name:"Manifest Icons",category:"required",passed:Array.isArray(U.icons)&&U.icons.length>0,message:U.icons?.length?`${U.icons.length} icons defined in manifest`:"No icons defined in manifest"})}catch{$.push({id:"build-manifest-valid",name:"Valid Manifest JSON",category:"required",passed:!1,message:"Manifest is not valid JSON"})}let J=O$.join(X,"sw.js"),G=_5.existsSync(J);$.push({id:"build-sw",name:"Service Worker File",category:"required",passed:G,message:G?"Service worker (sw.js) exists":"Service worker not found in build output"});let Q=O$.join(X,"offline.html"),q=_5.existsSync(Q);$.push({id:"build-offline",name:"Offline Page",category:"recommended",passed:q,message:q?"Offline page exists":"No offline.html found"});let W=O$.join(X,"pwa-icons");if(_5.existsSync(W)){let U=_5.readdirSync(W).filter((z)=>z.endsWith(".png")||z.endsWith(".webp"));$.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 $.push({id:"build-icons",name:"Generated Icons",category:"required",passed:!1,message:"Icons directory not found"});return $}function VF(X){let $=X.filter((W)=>W.category==="required"),Z=X.filter((W)=>W.category==="recommended"),Y=$.filter((W)=>W.passed).length,J=Z.filter((W)=>W.passed).length,G=$.length>0?Y/$.length*70:70,Q=Z.length>0?J/Z.length*30:30;return{score:Math.round(G+Q),passed:X.filter((W)=>W.passed).length,failed:X.filter((W)=>!W.passed&&W.category==="required").length,warnings:X.filter((W)=>!W.passed&&W.category!=="required").length,checks:X}}function Wy(X,$){let Z=OF(X),Y=$&&_5.existsSync($)?FF($):[];return VF([...Z,...Y])}function Ky(X){let $=[];$.push(`
16809
16809
  === PWA Audit Report ===
16810
16810
  `);let Z=X.score>=90?"32":X.score>=70?"33":"31";$.push(`Score: \x1B[${Z}m${X.score}/100\x1B[0m`),$.push(`Passed: ${X.passed} | Failed: ${X.failed} | Warnings: ${X.warnings}
16811
16811
  `);let Y=["required","recommended","optional"];for(let J of Y){let G=X.checks.filter((Q)=>Q.category===J);if(G.length===0)continue;$.push(`
16812
16812
  ${J.toUpperCase()}:`);for(let Q of G){let q=Q.passed?"\x1B[32m\u2713\x1B[0m":"\x1B[31m\u2717\x1B[0m";if($.push(` ${q} ${Q.name}: ${Q.message}`),Q.details)$.push(` ${Q.details}`)}}return $.push(""),$.join(`
16813
- `)}D4();zX();Y7();J7();async function Oy(X,$){let Z={success:!0,files:{icons:[]},errors:[],warnings:[]},Y=X.pwa;if(!Y?.enabled)return Z;try{FF.mkdirSync($,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${$}`),Z.success=!1,Z}try{let G=M6(X);if(G){let Q=G6.join($,"manifest.json");await Bun.write(Q,G),Z.files.manifest=Q}}catch(G){let Q=G instanceof Error?G.message:String(G);Z.errors.push(`Failed to generate manifest.json: ${Q}`),Z.success=!1}if(Y.icons?.src)if(await j6()){let Q=await w6(X,$);if(Z.files.icons=Q.generatedFiles,Z.warnings.push(...Q.warnings),!Q.success)Z.errors.push(...Q.errors),Z.success=!1}else Z.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(Y.offline?.enabled)try{let G=await oK(X);if(G){let Q=G6.join($,"offline.html");await Bun.write(Q,G),Z.files.offlinePage=Q}}catch(G){let Q=G instanceof Error?G.message:String(G);Z.errors.push(`Failed to generate offline page: ${Q}`),Z.success=!1}let J;if(Y.precache?.enabled){let G=p1($,X);J={fileCount:G.fileCount,totalSize:G.totalSize},Z.precacheStats=J}try{let G=UX(X,$);if(G){let Q=O5(X),q=G6.join($,Q);await Bun.write(q,G),Z.files.serviceWorker=q}}catch(G){let Q=G instanceof Error?G.message:String(G);Z.errors.push(`Failed to generate service worker: ${Q}`),Z.success=!1}return Z}function Ly(X,$){return N$(X,$)}function Fy(X){return X.pwa?.enabled===!0}export{PF as validateManifest,Qy as runPwaAudit,QT as registerPwaDirectives,pj as pwaUpdateDirective,nj as pwaPushDirective,ij as pwaOfflineDirective,cj as pwaInstallDirective,E4 as pwaDirectives,Ly as processPwaHtml,CF as mergeManifestConfig,N6 as isWorkboxEnabled,j6 as isSharpAvailable,Fy as isPwaEnabled,N$ as injectPwaTags,O5 as getServiceWorkerFileName,NF as getExpectedIconPaths,NU as generateThemeColorMeta,AU as generateSwRegistrationScript,VU as generateServiceWorkerAuto,UX as generateServiceWorker,WX as generatePwaTags,w6 as generatePwaIcons,KX as generatePrecacheManifestJs,p1 as generatePrecacheManifest,oK as generateOfflinePage,RU as generateManifestLink,M6 as generateManifestJson,DU as generateManifest,_6 as formatSize,qy as formatAuditResult,LF as calculateAuditResult,Oy as buildPwaAssets,HF as auditConfig,OF as auditBuildOutput,z6 as FAVICON_SIZES,U6 as DEFAULT_ICON_SIZES,W6 as APPLE_TOUCH_ICON_SIZES};
16813
+ `)}D4();zX();Y7();J7();async function Fy(X,$){let Z={success:!0,files:{icons:[]},errors:[],warnings:[]},Y=X.pwa;if(!Y?.enabled)return Z;try{AF.mkdirSync($,{recursive:!0})}catch{return Z.errors.push(`Failed to create output directory: ${$}`),Z.success=!1,Z}try{let G=M6(X);if(G){let Q=G6.join($,"manifest.json");await Bun.write(Q,G),Z.files.manifest=Q}}catch(G){let Q=G instanceof Error?G.message:String(G);Z.errors.push(`Failed to generate manifest.json: ${Q}`),Z.success=!1}if(Y.icons?.src)if(await j6()){let Q=await w6(X,$);if(Z.files.icons=Q.generatedFiles,Z.warnings.push(...Q.warnings),!Q.success)Z.errors.push(...Q.errors),Z.success=!1}else Z.warnings.push("sharp is not installed. Skipping icon generation. Install with: bun add sharp");if(Y.offline?.enabled)try{let G=await oW(X);if(G){let Q=G6.join($,"offline.html");await Bun.write(Q,G),Z.files.offlinePage=Q}}catch(G){let Q=G instanceof Error?G.message:String(G);Z.errors.push(`Failed to generate offline page: ${Q}`),Z.success=!1}let J;if(Y.precache?.enabled){let G=p1($,X);J={fileCount:G.fileCount,totalSize:G.totalSize},Z.precacheStats=J}try{let G=KX(X,$);if(G){let Q=L5(X),q=G6.join($,Q);await Bun.write(q,G),Z.files.serviceWorker=q}}catch(G){let Q=G instanceof Error?G.message:String(G);Z.errors.push(`Failed to generate service worker: ${Q}`),Z.success=!1}return Z}function Vy(X,$){return N$(X,$)}function Ay(X){return X.pwa?.enabled===!0}export{xF as validateManifest,Wy as runPwaAudit,WT as registerPwaDirectives,nj as pwaUpdateDirective,oj as pwaPushDirective,rj as pwaOfflineDirective,ij as pwaInstallDirective,E4 as pwaDirectives,Vy as processPwaHtml,vF as mergeManifestConfig,N6 as isWorkboxEnabled,j6 as isSharpAvailable,Ay as isPwaEnabled,N$ as injectPwaTags,L5 as getServiceWorkerFileName,MF as getExpectedIconPaths,NK as generateThemeColorMeta,AK as generateSwRegistrationScript,VK as generateServiceWorkerAuto,KX as generateServiceWorker,UX as generatePwaTags,w6 as generatePwaIcons,WX as generatePrecacheManifestJs,p1 as generatePrecacheManifest,oW as generateOfflinePage,RK as generateManifestLink,M6 as generateManifestJson,DK as generateManifest,_6 as formatSize,Ky as formatAuditResult,VF as calculateAuditResult,Fy as buildPwaAssets,OF as auditConfig,FF as auditBuildOutput,z6 as FAVICON_SIZES,K6 as DEFAULT_ICON_SIZES,U6 as APPLE_TOUCH_ICON_SIZES};